/**
 * React (with addons) v0.12.2
 *
 * Copyright 2013-2014, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 */



/* @preserve
 * The MIT License (MIT)
 * 
 * Copyright (c) 2014 Petka Antonov
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:</p>
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * 
 */



// Copyright Joyent, Inc. and other Node contributors.

//

// Permission is hereby granted, free of charge, to any person obtaining a

// copy of this software and associated documentation files (the

// "Software"), to deal in the Software without restriction, including

// without limitation the rights to use, copy, modify, merge, publish,

// distribute, sublicense, and/or sell copies of the Software, and to permit

// persons to whom the Software is furnished to do so, subject to the

// following conditions:

//

// The above copyright notice and this permission notice shall be included

// in all copies or substantial portions of the Software.

//

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS

// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF

// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN

// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,

// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR

// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE

// USE OR OTHER DEALINGS IN THE SOFTWARE.



/*
 * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
 *  
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"), 
 * to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 * and/or sell copies of the Software, and to permit persons to whom the 
 * Software is furnished to do so, subject to the following conditions:
 *  
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *  
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 * 
 */



/**
 * @license RequireJS text 2.0.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/text for details
 */



// inherits is licensed under the ISC license:



// Copyright (c) Isaac Z. Schlueter



// copyright notice and this permission notice appear in all copies.



/*
 * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
 *  
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"), 
 * to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 * and/or sell copies of the Software, and to permit persons to whom the 
 * Software is furnished to do so, subject to the following conditions:
 *  
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *  
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 * 
 */



/**
 * @license RequireJS i18n 2.0.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/i18n for details
 */



/*
 * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 */



/*!
 * EventEmitter v4.2.11 - git.io/ee
 * Unlicense - http://unlicense.org/
 * Oliver Caldwell - http://oli.me.uk/
 * @preserve
 */



/**
     * Inherit the prototype methods from one constructor into another. 
     *
     * Modeled after Node's util.inherits, which is licensed under the MIT license
     *   Implementation: https://github.com/joyent/node/blob/master/lib/util.js#L628
     *   License: https://github.com/joyent/node/blob/master/LICENSE
     *
     * @param {function} ctor Constructor function which needs to inherit the prototype.
     * @param {function} superCtor Constructor function to inherit prototype from.
     */



/**
 *  Copyright (c) 2014-2015, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 */



/**
 * @license
 * lodash 3.6.0 (Custom Build) <https://lodash.com/>
 * Build: `lodash modern -o ./lodash.js`
 * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <https://lodash.com/license>
 */



/**
 * math.js
 * https://github.com/josdejong/mathjs
 *
 * Math.js is an extensive math library for JavaScript and Node.js,
 * It features real and complex numbers, units, matrices, a large set of
 * mathematical functions, and a flexible expression parser.
 *
 * @version 1.5.2
 * @date    2015-04-09
 *
 * @license
 * Copyright (C) 2013-2015 Jos de Jong <wjosdejong@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy
 * of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */



/**
	   * Round a value towards plus infinity
	   * If `x` is complex, both real and imaginary part are rounded towards plus infinity.
	   * For matrices, the function is evaluated element wise.
	   *
	   * Syntax:
	   *
	   *    math.ceil(x)
	   *
	   * Examples:
	   *
	   *    math.ceil(3.2);               // returns Number 4
	   *    math.ceil(3.8);               // returns Number 4
	   *    math.ceil(-4.2);              // returns Number -4
	   *    math.ceil(-4.7);              // returns Number -4
	   *
	   *    var c = math.complex(3.2, -2.7);
	   *    math.ceil(c);                 // returns Complex 4 - 2i
	   *
	   *    math.ceil([3.2, 3.8, -4.7]);  // returns Array [4, 4, -4]
	   *
	   * See also:
	   *
	   *    floor, fix, round
	   *
	   * @param  {Number | BigNumber | Boolean | Complex | Array | Matrix | null} x  Number to be rounded
	   * @return {Number | BigNumber | Complex | Array | Matrix} Rounded value
	   */



/**
	   * Round a value towards zero.
	   * For matrices, the function is evaluated element wise.
	   *
	   * Syntax:
	   *
	   *    math.fix(x)
	   *
	   * Examples:
	   *
	   *    math.fix(3.2);                // returns Number 3
	   *    math.fix(3.8);                // returns Number 3
	   *    math.fix(-4.2);               // returns Number -4
	   *    math.fix(-4.7);               // returns Number -4
	   *
	   *    var c = math.complex(3.2, -2.7);
	   *    math.fix(c);                  // returns Complex 3 - 2i
	   *
	   *    math.fix([3.2, 3.8, -4.7]);   // returns Array [3, 3, -4]
	   *
	   * See also:
	   *
	   *    ceil, floor, round
	   *
	   * @param {Number | BigNumber | Boolean | Complex | Array | Matrix | null} x Number to be rounded
	   * @return {Number | BigNumber | Complex | Array | Matrix}            Rounded value
	   */



/**
	   * Round a value towards minus infinity.
	   * For matrices, the function is evaluated element wise.
	   *
	   * Syntax:
	   *
	   *    math.floor(x)
	   *
	   * Examples:
	   *
	   *    math.floor(3.2);              // returns Number 3
	   *    math.floor(3.8);              // returns Number 3
	   *    math.floor(-4.2);             // returns Number -5
	   *    math.floor(-4.7);             // returns Number -5
	   *
	   *    var c = math.complex(3.2, -2.7);
	   *    math.floor(c);                // returns Complex 3 - 3i
	   *
	   *    math.floor([3.2, 3.8, -4.7]); // returns Array [3, 3, -5]
	   *
	   * See also:
	   *
	   *    ceil, fix, round
	   *
	   * @param  {Number | BigNumber | Boolean | Complex | Array | Matrix | null} x  Number to be rounded
	   * @return {Number | BigNumber | Complex | Array | Matrix} Rounded value
	   */



/**
	   * Round a value towards the nearest integer.
	   * For matrices, the function is evaluated element wise.
	   *
	   * Syntax:
	   *
	   *    math.round(x)
	   *    math.round(x, n)
	   *
	   * Examples:
	   *
	   *    math.round(3.2);              // returns Number 3
	   *    math.round(3.8);              // returns Number 4
	   *    math.round(-4.2);             // returns Number -4
	   *    math.round(-4.7);             // returns Number -5
	   *    math.round(math.pi, 3);       // returns Number 3.142
	   *    math.round(123.45678, 2);     // returns Number 123.46
	   *
	   *    var c = math.complex(3.2, -2.7);
	   *    math.round(c);                // returns Complex 3 - 3i
	   *
	   *    math.round([3.2, 3.8, -4.7]); // returns Array [3, 4, -5]
	   *
	   * See also:
	   *
	   *    ceil, fix, floor
	   *
	   * @param  {Number | BigNumber | Boolean | Complex | Array | Matrix | null} x   Number to be rounded
	   * @param  {Number | BigNumber | Boolean | Array | null} [n=0]                 Number of decimals
	   * @return {Number | BigNumber | Complex | Array | Matrix} Rounded value
	   */



/*! decimal.js v4.0.2 https://github.com/MikeMcl/decimal.js/LICENCE */



/*

	     *  decimal.js v4.0.2

	     *  An arbitrary-precision Decimal type for JavaScript.

	     *  https://github.com/MikeMcl/decimal.js

	     *  Copyright (c) 2014 Michael Mclaughlin <M8ch88l@gmail.com>

	     *  MIT Expat Licence

	     */



/*! loglevel - v1.2.0 - https://github.com/pimterry/loglevel - (c) 2014 Tim Perry - licensed MIT */



/*
 * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
 *  
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"), 
 * to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 * and/or sell copies of the Software, and to permit persons to whom the 
 * Software is furnished to do so, subject to the following conditions:
 *  
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *  
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 *
 *
 * Portions of this code are adapted from react-simple-colorpicker
 * https://github.com/WickyNilliams/react-simple-colorpicker
 * 
 * The MIT License (MIT)
 * 
 * Copyright (c) 2014 Nick Williams
 * Copyright (c) 2014 George Czabania
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */



/*
 * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
 *  
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"), 
 * to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 * and/or sell copies of the Software, and to permit persons to whom the 
 * Software is furnished to do so, subject to the following conditions:
 *  
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *  
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 *
 *
 * Portions of this code are adapted from react-draggable
 * https://github.com/mzabriskie/react-draggable
 * 
 * (MIT License)
 * 
 * Copyright (c) 2014 Matt Zabriskie. All rights reserved.
 *  
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"), 
 * to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 * and/or sell copies of the Software, and to permit persons to whom the 
 * Software is furnished to do so, subject to the following conditions:
 *  
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *  
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 */



/*
 * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 */



!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define("react",[],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.React=e()}}(function(){return function e(t,n,r){function i(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t){"use strict";var n=e("./LinkedStateMixin"),r=e("./React"),i=e("./ReactComponentWithPureRenderMixin"),s=e("./ReactCSSTransitionGroup"),o=e("./ReactTransitionGroup"),u=e("./ReactUpdates"),a=e("./cx"),f=e("./cloneWithProps"),l=e("./update");r.addons={CSSTransitionGroup:s,LinkedStateMixin:n,PureRenderMixin:i,TransitionGroup:o,batchedUpdates:u.batchedUpdates,classSet:a,cloneWithProps:f,update:l},t.exports=r},{"./LinkedStateMixin":25,"./React":31,"./ReactCSSTransitionGroup":34,"./ReactComponentWithPureRenderMixin":39,"./ReactTransitionGroup":87,"./ReactUpdates":88,"./cloneWithProps":110,"./cx":115,"./update":154}],2:[function(e,t){"use strict";var n=e("./focusNode"),r={componentDidMount:function(){this.props.autoFocus&&n(this.getDOMNode())}};t.exports=r},{"./focusNode":122}],3:[function(e,t){"use strict";function n(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function r(e){return(e.ctrlKey||e.altKey||e.metaKey)&&(!e.ctrlKey||!e.altKey)}var i=e("./EventConstants"),s=e("./EventPropagators"),o=e("./ExecutionEnvironment"),u=e("./SyntheticInputEvent"),a=e("./keyOf"),f=o.canUseDOM&&"TextEvent"in window&&!("documentMode"in document||n()),l=32,c=String.fromCharCode(l),h=i.topLevelTypes,p={beforeInput:{phasedRegistrationNames:{bubbled:a({onBeforeInput:null}),captured:a({onBeforeInputCapture:null})},dependencies:[h.topCompositionEnd,h.topKeyPress,h.topTextInput,h.topPaste]}},d=null,v=!1,m={eventTypes:p,extractEvents:function(e,t,n,i){var o;if(f)switch(e){case h.topKeyPress:var a=i.which;if(a!==l)return;v=!0,o=c;break;case h.topTextInput:if(o=i.data,o===c&&v)return;break;default:return}else{switch(e){case h.topPaste:d=null;break;case h.topKeyPress:i.which&&!r(i)&&(d=String.fromCharCode(i.which));break;case h.topCompositionEnd:d=i.data}if(null===d)return;o=d}if(o){var m=u.getPooled(p.beforeInput,n,i);return m.data=o,d=null,s.accumulateTwoPhaseDispatches(m),m}}};t.exports=m},{"./EventConstants":17,"./EventPropagators":22,"./ExecutionEnvironment":23,"./SyntheticInputEvent":98,"./keyOf":144}],4:[function(e,t){var n=e("./invariant"),r={addClass:function(e,t){return n(!/\s/.test(t)),t&&(e.classList?e.classList.add(t):r.hasClass(e,t)||(e.className=e.className+" "+t)),e},removeClass:function(e,t){return n(!/\s/.test(t)),t&&(e.classList?e.classList.remove(t):r.hasClass(e,t)&&(e.className=e.className.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,""))),e},conditionClass:function(e,t,n){return(n?r.addClass:r.removeClass)(e,t)},hasClass:function(e,t){return n(!/\s/.test(t)),e.classList?!!t&&e.classList.contains(t):(" "+e.className+" ").indexOf(" "+t+" ")>-1}};t.exports=r},{"./invariant":137}],5:[function(e,t){"use strict";function n(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var r={columnCount:!0,flex:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeOpacity:!0},i=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(e){i.forEach(function(t){r[n(t,e)]=r[e]})});var s={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},o={isUnitlessNumber:r,shorthandPropertyExpansions:s};t.exports=o},{}],6:[function(e,t){"use strict";var n=e("./CSSProperty"),r=e("./ExecutionEnvironment"),i=(e("./camelizeStyleName"),e("./dangerousStyleValue")),s=e("./hyphenateStyleName"),o=e("./memoizeStringOnly"),u=(e("./warning"),o(function(e){return s(e)})),a="cssFloat";r.canUseDOM&&void 0===document.documentElement.style.cssFloat&&(a="styleFloat");var f={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=u(n)+":",t+=i(n,r)+";")}return t||null},setValueForStyles:function(e,t){var r=e.style;for(var s in t)if(t.hasOwnProperty(s)){var o=i(s,t[s]);if("float"===s&&(s=a),o)r[s]=o;else{var u=n.shorthandPropertyExpansions[s];if(u)for(var f in u)r[f]="";else r[s]=""}}}};t.exports=f},{"./CSSProperty":5,"./ExecutionEnvironment":23,"./camelizeStyleName":109,"./dangerousStyleValue":116,"./hyphenateStyleName":135,"./memoizeStringOnly":146,"./warning":155}],7:[function(e,t){"use strict";function n(){this._callbacks=null,this._contexts=null}var r=e("./PooledClass"),i=e("./Object.assign"),s=e("./invariant");i(n.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){s(e.length===t.length),this._callbacks=null,this._contexts=null;for(var n=0,r=e.length;r>n;n++)e[n].call(t[n]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),r.addPoolingTo(n),t.exports=n},{"./Object.assign":29,"./PooledClass":30,"./invariant":137}],8:[function(e,t){"use strict";function n(e){return"SELECT"===e.nodeName||"INPUT"===e.nodeName&&"file"===e.type}function r(e){var t=S.getPooled(k.change,A,e);b.accumulateTwoPhaseDispatches(t),E.batchedUpdates(i,t)}function i(e){y.enqueueEvents(e),y.processEventQueue()}function s(e,t){L=e,A=t,L.attachEvent("onchange",r)}function o(){L&&(L.detachEvent("onchange",r),L=null,A=null)}function u(e,t,n){return e===C.topChange?n:void 0}function a(e,t,n){e===C.topFocus?(o(),s(t,n)):e===C.topBlur&&o()}function f(e,t){L=e,A=t,O=e.value,M=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(L,"value",P),L.attachEvent("onpropertychange",c)}function l(){L&&(delete L.value,L.detachEvent("onpropertychange",c),L=null,A=null,O=null,M=null)}function c(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==O&&(O=t,r(e))}}function h(e,t,n){return e===C.topInput?n:void 0}function p(e,t,n){e===C.topFocus?(l(),f(t,n)):e===C.topBlur&&l()}function d(e){return e!==C.topSelectionChange&&e!==C.topKeyUp&&e!==C.topKeyDown||!L||L.value===O?void 0:(O=L.value,A)}function v(e){return"INPUT"===e.nodeName&&("checkbox"===e.type||"radio"===e.type)}function m(e,t,n){return e===C.topClick?n:void 0}var g=e("./EventConstants"),y=e("./EventPluginHub"),b=e("./EventPropagators"),w=e("./ExecutionEnvironment"),E=e("./ReactUpdates"),S=e("./SyntheticEvent"),x=e("./isEventSupported"),T=e("./isTextInputElement"),N=e("./keyOf"),C=g.topLevelTypes,k={change:{phasedRegistrationNames:{bubbled:N({onChange:null}),captured:N({onChangeCapture:null})},dependencies:[C.topBlur,C.topChange,C.topClick,C.topFocus,C.topInput,C.topKeyDown,C.topKeyUp,C.topSelectionChange]}},L=null,A=null,O=null,M=null,_=!1;w.canUseDOM&&(_=x("change")&&(!("documentMode"in document)||document.documentMode>8));var D=!1;w.canUseDOM&&(D=x("input")&&(!("documentMode"in document)||document.documentMode>9));var P={get:function(){return M.get.call(this)},set:function(e){O=""+e,M.set.call(this,e)}},H={eventTypes:k,extractEvents:function(e,t,r,i){var s,o;if(n(t)?_?s=u:o=a:T(t)?D?s=h:(s=d,o=p):v(t)&&(s=m),s){var f=s(e,t,r);if(f){var l=S.getPooled(k.change,f,i);return b.accumulateTwoPhaseDispatches(l),l}}o&&o(e,t,r)}};t.exports=H},{"./EventConstants":17,"./EventPluginHub":19,"./EventPropagators":22,"./ExecutionEnvironment":23,"./ReactUpdates":88,"./SyntheticEvent":96,"./isEventSupported":138,"./isTextInputElement":140,"./keyOf":144}],9:[function(e,t){"use strict";var n=0,r={createReactRootIndex:function(){return n++}};t.exports=r},{}],10:[function(e,t){"use strict";function n(e){switch(e){case g.topCompositionStart:return b.compositionStart;case g.topCompositionEnd:return b.compositionEnd;case g.topCompositionUpdate:return b.compositionUpdate}}function r(e,t){return e===g.topKeyDown&&t.keyCode===d}function i(e,t){switch(e){case g.topKeyUp:return-1!==p.indexOf(t.keyCode);case g.topKeyDown:return t.keyCode!==d;case g.topKeyPress:case g.topMouseDown:case g.topBlur:return!0;default:return!1}}function s(e){this.root=e,this.startSelection=f.getSelection(e),this.startValue=this.getText()}var o=e("./EventConstants"),u=e("./EventPropagators"),a=e("./ExecutionEnvironment"),f=e("./ReactInputSelection"),l=e("./SyntheticCompositionEvent"),c=e("./getTextContentAccessor"),h=e("./keyOf"),p=[9,13,27,32],d=229,v=a.canUseDOM&&"CompositionEvent"in window,m=!v||"documentMode"in document&&document.documentMode>8&&document.documentMode<=11,g=o.topLevelTypes,y=null,b={compositionEnd:{phasedRegistrationNames:{bubbled:h({onCompositionEnd:null}),captured:h({onCompositionEndCapture:null})},dependencies:[g.topBlur,g.topCompositionEnd,g.topKeyDown,g.topKeyPress,g.topKeyUp,g.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:h({onCompositionStart:null}),captured:h({onCompositionStartCapture:null})},dependencies:[g.topBlur,g.topCompositionStart,g.topKeyDown,g.topKeyPress,g.topKeyUp,g.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:h({onCompositionUpdate:null}),captured:h({onCompositionUpdateCapture:null})},dependencies:[g.topBlur,g.topCompositionUpdate,g.topKeyDown,g.topKeyPress,g.topKeyUp,g.topMouseDown]}};s.prototype.getText=function(){return this.root.value||this.root[c()]},s.prototype.getData=function(){var e=this.getText(),t=this.startSelection.start,n=this.startValue.length-this.startSelection.end;return e.substr(t,e.length-n-t)};var w={eventTypes:b,extractEvents:function(e,t,o,a){var f,c;if(v?f=n(e):y?i(e,a)&&(f=b.compositionEnd):r(e,a)&&(f=b.compositionStart),m&&(y||f!==b.compositionStart?f===b.compositionEnd&&y&&(c=y.getData(),y=null):y=new s(t)),f){var h=l.getPooled(f,o,a);return c&&(h.data=c),u.accumulateTwoPhaseDispatches(h),h}}};t.exports=w},{"./EventConstants":17,"./EventPropagators":22,"./ExecutionEnvironment":23,"./ReactInputSelection":63,"./SyntheticCompositionEvent":94,"./getTextContentAccessor":132,"./keyOf":144}],11:[function(e,t){"use strict";function n(e,t,n){e.insertBefore(t,e.childNodes[n]||null)}var r,i=e("./Danger"),s=e("./ReactMultiChildUpdateTypes"),o=e("./getTextContentAccessor"),u=e("./invariant"),a=o();r="textContent"===a?function(e,t){e.textContent=t}:function(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);if(t){var n=e.ownerDocument||document;e.appendChild(n.createTextNode(t))}};var f={dangerouslyReplaceNodeWithMarkup:i.dangerouslyReplaceNodeWithMarkup,updateTextContent:r,processUpdates:function(e,t){for(var o,a=null,f=null,l=0;o=e[l];l++)if(o.type===s.MOVE_EXISTING||o.type===s.REMOVE_NODE){var c=o.fromIndex,h=o.parentNode.childNodes[c],p=o.parentID;u(h),a=a||{},a[p]=a[p]||[],a[p][c]=h,f=f||[],f.push(h)}var d=i.dangerouslyRenderMarkup(t);if(f)for(var v=0;v<f.length;v++)f[v].parentNode.removeChild(f[v]);for(var m=0;o=e[m];m++)switch(o.type){case s.INSERT_MARKUP:n(o.parentNode,d[o.markupIndex],o.toIndex);break;case s.MOVE_EXISTING:n(o.parentNode,a[o.parentID][o.fromIndex],o.toIndex);break;case s.TEXT_CONTENT:r(o.parentNode,o.textContent);break;case s.REMOVE_NODE:}}};t.exports=f},{"./Danger":14,"./ReactMultiChildUpdateTypes":70,"./getTextContentAccessor":132,"./invariant":137}],12:[function(e,t){"use strict";function n(e,t){return(e&t)===t}var r=e("./invariant"),i={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=e.Properties||{},s=e.DOMAttributeNames||{},u=e.DOMPropertyNames||{},f=e.DOMMutationMethods||{};e.isCustomAttribute&&o._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var l in t){r(!o.isStandardName.hasOwnProperty(l)),o.isStandardName[l]=!0;var c=l.toLowerCase();if(o.getPossibleStandardName[c]=l,s.hasOwnProperty(l)){var h=s[l];o.getPossibleStandardName[h]=l,o.getAttributeName[l]=h}else o.getAttributeName[l]=c;o.getPropertyName[l]=u.hasOwnProperty(l)?u[l]:l,o.getMutationMethod[l]=f.hasOwnProperty(l)?f[l]:null;var p=t[l];o.mustUseAttribute[l]=n(p,i.MUST_USE_ATTRIBUTE),o.mustUseProperty[l]=n(p,i.MUST_USE_PROPERTY),o.hasSideEffects[l]=n(p,i.HAS_SIDE_EFFECTS),o.hasBooleanValue[l]=n(p,i.HAS_BOOLEAN_VALUE),o.hasNumericValue[l]=n(p,i.HAS_NUMERIC_VALUE),o.hasPositiveNumericValue[l]=n(p,i.HAS_POSITIVE_NUMERIC_VALUE),o.hasOverloadedBooleanValue[l]=n(p,i.HAS_OVERLOADED_BOOLEAN_VALUE),r(!o.mustUseAttribute[l]||!o.mustUseProperty[l]),r(o.mustUseProperty[l]||!o.hasSideEffects[l]),r(!!o.hasBooleanValue[l]+!!o.hasNumericValue[l]+!!o.hasOverloadedBooleanValue[l]<=1)}}},s={},o={ID_ATTRIBUTE_NAME:"data-reactid",isStandardName:{},getPossibleStandardName:{},getAttributeName:{},getPropertyName:{},getMutationMethod:{},mustUseAttribute:{},mustUseProperty:{},hasSideEffects:{},hasBooleanValue:{},hasNumericValue:{},hasPositiveNumericValue:{},hasOverloadedBooleanValue:{},_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<o._isCustomAttributeFunctions.length;t++){var n=o._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,r=s[e];return r||(s[e]=r={}),t in r||(n=document.createElement(e),r[t]=n[t]),r[t]},injection:i};t.exports=o},{"./invariant":137}],13:[function(e,t){"use strict";function n(e,t){return null==t||r.hasBooleanValue[e]&&!t||r.hasNumericValue[e]&&isNaN(t)||r.hasPositiveNumericValue[e]&&1>t||r.hasOverloadedBooleanValue[e]&&t===!1}var r=e("./DOMProperty"),i=e("./escapeTextForBrowser"),s=e("./memoizeStringOnly"),o=(e("./warning"),s(function(e){return i(e)+'="'})),u={createMarkupForID:function(e){return o(r.ID_ATTRIBUTE_NAME)+i(e)+'"'},createMarkupForProperty:function(e,t){if(r.isStandardName.hasOwnProperty(e)&&r.isStandardName[e]){if(n(e,t))return"";var s=r.getAttributeName[e];return r.hasBooleanValue[e]||r.hasOverloadedBooleanValue[e]&&t===!0?i(s):o(s)+i(t)+'"'}return r.isCustomAttribute(e)?null==t?"":o(e)+i(t)+'"':null},setValueForProperty:function(e,t,i){if(r.isStandardName.hasOwnProperty(t)&&r.isStandardName[t]){var s=r.getMutationMethod[t];if(s)s(e,i);else if(n(t,i))this.deleteValueForProperty(e,t);else if(r.mustUseAttribute[t])e.setAttribute(r.getAttributeName[t],""+i);else{var o=r.getPropertyName[t];r.hasSideEffects[t]&&""+e[o]==""+i||(e[o]=i)}}else r.isCustomAttribute(t)&&(null==i?e.removeAttribute(t):e.setAttribute(t,""+i))},deleteValueForProperty:function(e,t){if(r.isStandardName.hasOwnProperty(t)&&r.isStandardName[t]){var n=r.getMutationMethod[t];if(n)n(e,void 0);else if(r.mustUseAttribute[t])e.removeAttribute(r.getAttributeName[t]);else{var i=r.getPropertyName[t],s=r.getDefaultValueForProperty(e.nodeName,i);r.hasSideEffects[t]&&""+e[i]===s||(e[i]=s)}}else r.isCustomAttribute(t)&&e.removeAttribute(t)}};t.exports=u},{"./DOMProperty":12,"./escapeTextForBrowser":120,"./memoizeStringOnly":146,"./warning":155}],14:[function(e,t){"use strict";function n(e){return e.substring(1,e.indexOf(" "))}var r=e("./ExecutionEnvironment"),i=e("./createNodesFromMarkup"),s=e("./emptyFunction"),o=e("./getMarkupWrap"),u=e("./invariant"),a=/^(<[^ \/>]+)/,f="data-danger-index",l={dangerouslyRenderMarkup:function(e){u(r.canUseDOM);for(var t,l={},h=0;h<e.length;h++)u(e[h]),t=n(e[h]),t=o(t)?t:"*",l[t]=l[t]||[],l[t][h]=e[h];var p=[],d=0;for(t in l)if(l.hasOwnProperty(t)){var v=l[t];for(var m in v)if(v.hasOwnProperty(m)){var g=v[m];v[m]=g.replace(a,"$1 "+f+'="'+m+'" ')}var y=i(v.join(""),s);for(h=0;h<y.length;++h){var b=y[h];b.hasAttribute&&b.hasAttribute(f)&&(m=+b.getAttribute(f),b.removeAttribute(f),u(!p.hasOwnProperty(m)),p[m]=b,d+=1)}}return u(d===p.length),u(p.length===e.length),p},dangerouslyReplaceNodeWithMarkup:function(e,t){u(r.canUseDOM),u(t),u("html"!==e.tagName.toLowerCase());var n=i(t,s)[0];e.parentNode.replaceChild(n,e)}};t.exports=l},{"./ExecutionEnvironment":23,"./createNodesFromMarkup":114,"./emptyFunction":118,"./getMarkupWrap":129,"./invariant":137}],15:[function(e,t){"use strict";var n=e("./keyOf"),r=[n({ResponderEventPlugin:null}),n({SimpleEventPlugin:null}),n({TapEventPlugin:null}),n({EnterLeaveEventPlugin:null}),n({ChangeEventPlugin:null}),n({SelectEventPlugin:null}),n({CompositionEventPlugin:null}),n({BeforeInputEventPlugin:null}),n({AnalyticsEventPlugin:null}),n({MobileSafariClickEventPlugin:null})];t.exports=r},{"./keyOf":144}],16:[function(e,t){"use strict";var n=e("./EventConstants"),r=e("./EventPropagators"),i=e("./SyntheticMouseEvent"),s=e("./ReactMount"),o=e("./keyOf"),u=n.topLevelTypes,a=s.getFirstReactDOM,f={mouseEnter:{registrationName:o({onMouseEnter:null}),dependencies:[u.topMouseOut,u.topMouseOver]},mouseLeave:{registrationName:o({onMouseLeave:null}),dependencies:[u.topMouseOut,u.topMouseOver]}},l=[null,null],c={eventTypes:f,extractEvents:function(e,t,n,o){if(e===u.topMouseOver&&(o.relatedTarget||o.fromElement))return null;if(e!==u.topMouseOut&&e!==u.topMouseOver)return null;var c;if(t.window===t)c=t;else{var h=t.ownerDocument;c=h?h.defaultView||h.parentWindow:window}var p,d;if(e===u.topMouseOut?(p=t,d=a(o.relatedTarget||o.toElement)||c):(p=c,d=t),p===d)return null;var v=p?s.getID(p):"",m=d?s.getID(d):"",g=i.getPooled(f.mouseLeave,v,o);g.type="mouseleave",g.target=p,g.relatedTarget=d;var y=i.getPooled(f.mouseEnter,m,o);return y.type="mouseenter",y.target=d,y.relatedTarget=p,r.accumulateEnterLeaveDispatches(g,y,v,m),l[0]=g,l[1]=y,l}};t.exports=c},{"./EventConstants":17,"./EventPropagators":22,"./ReactMount":68,"./SyntheticMouseEvent":100,"./keyOf":144}],17:[function(e,t){"use strict";var n=e("./keyMirror"),r=n({bubbled:null,captured:null}),i=n({topBlur:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topReset:null,topScroll:null,topSelectionChange:null,topSubmit:null,topTextInput:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topWheel:null}),s={topLevelTypes:i,PropagationPhases:r};t.exports=s},{"./keyMirror":143}],18:[function(e,t){var n=e("./emptyFunction"),r={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,r){return e.addEventListener?(e.addEventListener(t,r,!0),{remove:function(){e.removeEventListener(t,r,!0)}}):{remove:n}},registerDefault:function(){}};t.exports=r},{"./emptyFunction":118}],19:[function(e,t){"use strict";var n=e("./EventPluginRegistry"),r=e("./EventPluginUtils"),i=e("./accumulateInto"),s=e("./forEachAccumulated"),o=e("./invariant"),u={},a=null,f=function(e){if(e){var t=r.executeDispatch,i=n.getPluginModuleForEvent(e);i&&i.executeDispatch&&(t=i.executeDispatch),r.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e)}},l=null,c={injection:{injectMount:r.injection.injectMount,injectInstanceHandle:function(e){l=e},getInstanceHandle:function(){return l},injectEventPluginOrder:n.injectEventPluginOrder,injectEventPluginsByName:n.injectEventPluginsByName},eventNameDispatchConfigs:n.eventNameDispatchConfigs,registrationNameModules:n.registrationNameModules,putListener:function(e,t,n){o(!n||"function"==typeof n);var r=u[t]||(u[t]={});r[e]=n},getListener:function(e,t){var n=u[t];return n&&n[e]},deleteListener:function(e,t){var n=u[t];n&&delete n[e]},deleteAllListeners:function(e){for(var t in u)delete u[t][e]},extractEvents:function(e,t,r,s){for(var o,u=n.plugins,a=0,f=u.length;f>a;a++){var l=u[a];if(l){var c=l.extractEvents(e,t,r,s);c&&(o=i(o,c))}}return o},enqueueEvents:function(e){e&&(a=i(a,e))},processEventQueue:function(){var e=a;a=null,s(e,f),o(!a)},__purge:function(){u={}},__getListenerBank:function(){return u}};t.exports=c},{"./EventPluginRegistry":20,"./EventPluginUtils":21,"./accumulateInto":106,"./forEachAccumulated":123,"./invariant":137}],20:[function(e,t){"use strict";function n(){if(o)for(var e in u){var t=u[e],n=o.indexOf(e);if(s(n>-1),!a.plugins[n]){s(t.extractEvents),a.plugins[n]=t;var i=t.eventTypes;for(var f in i)s(r(i[f],t,f))}}}function r(e,t,n){s(!a.eventNameDispatchConfigs.hasOwnProperty(n)),a.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var u=r[o];i(u,t,n)}return!0}return e.registrationName?(i(e.registrationName,t,n),!0):!1}function i(e,t,n){s(!a.registrationNameModules[e]),a.registrationNameModules[e]=t,a.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var s=e("./invariant"),o=null,u={},a={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s(!o),o=Array.prototype.slice.call(e),n()},injectEventPluginsByName:function(e){var t=!1;for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];u.hasOwnProperty(r)&&u[r]===i||(s(!u[r]),u[r]=i,t=!0)}t&&n()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return a.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=a.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){o=null;for(var e in u)u.hasOwnProperty(e)&&delete u[e];a.plugins.length=0;var t=a.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=a.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};t.exports=a},{"./invariant":137}],21:[function(e,t){"use strict";function n(e){return e===v.topMouseUp||e===v.topTouchEnd||e===v.topTouchCancel}function r(e){return e===v.topMouseMove||e===v.topTouchMove}function i(e){return e===v.topMouseDown||e===v.topTouchStart}function s(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var i=0;i<n.length&&!e.isPropagationStopped();i++)t(e,n[i],r[i]);else n&&t(e,n,r)}function o(e,t,n){e.currentTarget=d.Mount.getNode(n);var r=t(e,n);return e.currentTarget=null,r}function u(e,t){s(e,t),e._dispatchListeners=null,e._dispatchIDs=null}function a(e){var t=e._dispatchListeners,n=e._dispatchIDs;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function f(e){var t=a(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function l(e){var t=e._dispatchListeners,n=e._dispatchIDs;p(!Array.isArray(t));var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function c(e){return!!e._dispatchListeners}var h=e("./EventConstants"),p=e("./invariant"),d={Mount:null,injectMount:function(e){d.Mount=e}},v=h.topLevelTypes,m={isEndish:n,isMoveish:r,isStartish:i,executeDirectDispatch:l,executeDispatch:o,executeDispatchesInOrder:u,executeDispatchesInOrderStopAtTrue:f,hasDispatches:c,injection:d,useTouchEvents:!1};t.exports=m},{"./EventConstants":17,"./invariant":137}],22:[function(e,t){"use strict";function n(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return v(e,r)}function r(e,t,r){var i=t?d.bubbled:d.captured,s=n(e,r,i);s&&(r._dispatchListeners=h(r._dispatchListeners,s),r._dispatchIDs=h(r._dispatchIDs,e))}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&c.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,r,e)}function s(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,i=v(e,r);i&&(n._dispatchListeners=h(n._dispatchListeners,i),n._dispatchIDs=h(n._dispatchIDs,e))}}function o(e){e&&e.dispatchConfig.registrationName&&s(e.dispatchMarker,null,e)}function u(e){p(e,i)}function a(e,t,n,r){c.injection.getInstanceHandle().traverseEnterLeave(n,r,s,e,t)}function f(e){p(e,o)}var l=e("./EventConstants"),c=e("./EventPluginHub"),h=e("./accumulateInto"),p=e("./forEachAccumulated"),d=l.PropagationPhases,v=c.getListener,m={accumulateTwoPhaseDispatches:u,accumulateDirectDispatches:f,accumulateEnterLeaveDispatches:a};t.exports=m},{"./EventConstants":17,"./EventPluginHub":19,"./accumulateInto":106,"./forEachAccumulated":123}],23:[function(e,t){"use strict";var n="undefined"!=typeof window&&!!window.document&&!!window.document.createElement,r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&(!!window.addEventListener||!!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};t.exports=r},{}],24:[function(e,t){"use strict";var n,r=e("./DOMProperty"),i=e("./ExecutionEnvironment"),s=r.injection.MUST_USE_ATTRIBUTE,o=r.injection.MUST_USE_PROPERTY,u=r.injection.HAS_BOOLEAN_VALUE,a=r.injection.HAS_SIDE_EFFECTS,f=r.injection.HAS_NUMERIC_VALUE,l=r.injection.HAS_POSITIVE_NUMERIC_VALUE,c=r.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(i.canUseDOM){var h=document.implementation;n=h&&h.hasFeature&&h.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var p={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:s|u,allowTransparency:s,alt:null,async:u,autoComplete:null,autoPlay:u,cellPadding:null,cellSpacing:null,charSet:s,checked:o|u,classID:s,className:n?s:o,cols:s|l,colSpan:null,content:null,contentEditable:null,contextMenu:s,controls:o|u,coords:null,crossOrigin:null,data:null,dateTime:s,defer:u,dir:null,disabled:s|u,download:c,draggable:null,encType:null,form:s,formAction:s,formEncType:s,formMethod:s,formNoValidate:u,formTarget:s,frameBorder:s,height:s,hidden:s|u,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:o,label:null,lang:null,list:s,loop:o|u,manifest:s,marginHeight:null,marginWidth:null,max:null,maxLength:s,media:s,mediaGroup:null,method:null,min:null,multiple:o|u,muted:o|u,name:null,noValidate:u,open:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:o|u,rel:null,required:u,role:s,rows:s|l,rowSpan:null,sandbox:null,scope:null,scrolling:null,seamless:s|u,selected:o|u,shape:null,size:s|l,sizes:s,span:l,spellCheck:null,src:null,srcDoc:o,srcSet:s,start:f,step:null,style:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:o|a,width:s,wmode:s,autoCapitalize:null,autoCorrect:null,itemProp:s,itemScope:s|u,itemType:s,property:null},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoCapitalize:"autocapitalize",autoComplete:"autocomplete",autoCorrect:"autocorrect",autoFocus:"autofocus",autoPlay:"autoplay",encType:"enctype",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=p},{"./DOMProperty":12,"./ExecutionEnvironment":23}],25:[function(e,t){"use strict";var n=e("./ReactLink"),r=e("./ReactStateSetters"),i={linkState:function(e){return new n(this.state[e],r.createStateKeySetter(this,e))}};t.exports=i},{"./ReactLink":66,"./ReactStateSetters":83}],26:[function(e,t){"use strict";function n(e){a(null==e.props.checkedLink||null==e.props.valueLink)}function r(e){n(e),a(null==e.props.value&&null==e.props.onChange)}function i(e){n(e),a(null==e.props.checked&&null==e.props.onChange)}function s(e){this.props.valueLink.requestChange(e.target.value)}function o(e){this.props.checkedLink.requestChange(e.target.checked)}var u=e("./ReactPropTypes"),a=e("./invariant"),f={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0},l={Mixin:{propTypes:{value:function(e,t){return!e[t]||f[e.type]||e.onChange||e.readOnly||e.disabled?void 0:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t){return!e[t]||e.onChange||e.readOnly||e.disabled?void 0:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:u.func}},getValue:function(e){return e.props.valueLink?(r(e),e.props.valueLink.value):e.props.value},getChecked:function(e){return e.props.checkedLink?(i(e),e.props.checkedLink.value):e.props.checked},getOnChange:function(e){return e.props.valueLink?(r(e),s):e.props.checkedLink?(i(e),o):e.props.onChange}};t.exports=l},{"./ReactPropTypes":77,"./invariant":137}],27:[function(e,t){"use strict";function n(e){e.remove()}var r=e("./ReactBrowserEventEmitter"),i=e("./accumulateInto"),s=e("./forEachAccumulated"),o=e("./invariant"),u={trapBubbledEvent:function(e,t){o(this.isMounted());var n=r.trapBubbledEvent(e,t,this.getDOMNode());this._localEventListeners=i(this._localEventListeners,n)},componentWillUnmount:function(){this._localEventListeners&&s(this._localEventListeners,n)}};t.exports=u},{"./ReactBrowserEventEmitter":33,"./accumulateInto":106,"./forEachAccumulated":123,"./invariant":137}],28:[function(e,t){"use strict";var n=e("./EventConstants"),r=e("./emptyFunction"),i=n.topLevelTypes,s={eventTypes:null,extractEvents:function(e,t,n,s){if(e===i.topTouchStart){var u=s.target;u&&!u.onclick&&(u.onclick=r)}}};t.exports=s},{"./EventConstants":17,"./emptyFunction":118}],29:[function(e,t){function n(e){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var t=Object(e),n=Object.prototype.hasOwnProperty,r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i){var s=Object(i);for(var o in s)n.call(s,o)&&(t[o]=s[o])}}return t}t.exports=n},{}],30:[function(e,t){"use strict";var n=e("./invariant"),r=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},i=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},s=function(e,t,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,e,t,n),i}return new r(e,t,n)},o=function(e,t,n,r,i){var s=this;if(s.instancePool.length){var o=s.instancePool.pop();return s.call(o,e,t,n,r,i),o}return new s(e,t,n,r,i)},u=function(e){var t=this;n(e instanceof t),e.destructor&&e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},a=10,f=r,l=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||f,n.poolSize||(n.poolSize=a),n.release=u,n},c={addPoolingTo:l,oneArgumentPooler:r,twoArgumentPooler:i,threeArgumentPooler:s,fiveArgumentPooler:o};t.exports=c},{"./invariant":137}],31:[function(e,t){"use strict";var n=e("./DOMPropertyOperations"),r=e("./EventPluginUtils"),i=e("./ReactChildren"),s=e("./ReactComponent"),o=e("./ReactCompositeComponent"),u=e("./ReactContext"),a=e("./ReactCurrentOwner"),f=e("./ReactElement"),l=(e("./ReactElementValidator"),e("./ReactDOM")),c=e("./ReactDOMComponent"),h=e("./ReactDefaultInjection"),p=e("./ReactInstanceHandles"),d=e("./ReactLegacyElement"),v=e("./ReactMount"),m=e("./ReactMultiChild"),g=e("./ReactPerf"),y=e("./ReactPropTypes"),b=e("./ReactServerRendering"),w=e("./ReactTextComponent"),E=e("./Object.assign"),S=e("./deprecated"),x=e("./onlyChild");h.inject();var T=f.createElement,N=f.createFactory;T=d.wrapCreateElement(T),N=d.wrapCreateFactory(N);var C=g.measure("React","render",v.render),k={Children:{map:i.map,forEach:i.forEach,count:i.count,only:x},DOM:l,PropTypes:y,initializeTouchEvents:function(e){r.useTouchEvents=e},createClass:o.createClass,createElement:T,createFactory:N,constructAndRenderComponent:v.constructAndRenderComponent,constructAndRenderComponentByID:v.constructAndRenderComponentByID,render:C,renderToString:b.renderToString,renderToStaticMarkup:b.renderToStaticMarkup,unmountComponentAtNode:v.unmountComponentAtNode,isValidClass:d.isValidClass,isValidElement:f.isValidElement,withContext:u.withContext,__spread:E,renderComponent:S("React","renderComponent","render",this,C),renderComponentToString:S("React","renderComponentToString","renderToString",this,b.renderToString),renderComponentToStaticMarkup:S("React","renderComponentToStaticMarkup","renderToStaticMarkup",this,b.renderToStaticMarkup),isValidComponent:S("React","isValidComponent","isValidElement",this,f.isValidElement)};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({Component:s,CurrentOwner:a,DOMComponent:c,DOMPropertyOperations:n,InstanceHandles:p,Mount:v,MultiChild:m,TextComponent:w}),k.version="0.12.2",t.exports=k},{"./DOMPropertyOperations":13,"./EventPluginUtils":21,"./Object.assign":29,"./ReactChildren":36,"./ReactComponent":37,"./ReactCompositeComponent":40,"./ReactContext":41,"./ReactCurrentOwner":42,"./ReactDOM":43,"./ReactDOMComponent":45,"./ReactDefaultInjection":55,"./ReactElement":56,"./ReactElementValidator":57,"./ReactInstanceHandles":64,"./ReactLegacyElement":65,"./ReactMount":68,"./ReactMultiChild":69,"./ReactPerf":73,"./ReactPropTypes":77,"./ReactServerRendering":81,"./ReactTextComponent":84,"./deprecated":117,"./onlyChild":148}],32:[function(e,t){"use strict";var n=e("./ReactEmptyComponent"),r=e("./ReactMount"),i=e("./invariant"),s={getDOMNode:function(){return i(this.isMounted()),n.isNullComponentID(this._rootNodeID)?null:r.getNode(this._rootNodeID)}};t.exports=s},{"./ReactEmptyComponent":58,"./ReactMount":68,"./invariant":137}],33:[function(e,t){"use strict";function n(e){return Object.prototype.hasOwnProperty.call(e,d)||(e[d]=h++,l[e[d]]={}),l[e[d]]}var r=e("./EventConstants"),i=e("./EventPluginHub"),s=e("./EventPluginRegistry"),o=e("./ReactEventEmitterMixin"),u=e("./ViewportMetrics"),a=e("./Object.assign"),f=e("./isEventSupported"),l={},c=!1,h=0,p={topBlur:"blur",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topWheel:"wheel"},d="_reactListenersID"+String(Math.random()).slice(2),v=a({},o,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!!v.ReactEventListener&&!!v.ReactEventListener.isEnabled()},listenTo:function(e,t){for(var i=t,o=n(i),u=s.registrationNameDependencies[e],a=r.topLevelTypes,l=0,c=u.length;c>l;l++){var h=u[l];o.hasOwnProperty(h)&&o[h]||(h===a.topWheel?f("wheel")?v.ReactEventListener.trapBubbledEvent(a.topWheel,"wheel",i):f("mousewheel")?v.ReactEventListener.trapBubbledEvent(a.topWheel,"mousewheel",i):v.ReactEventListener.trapBubbledEvent(a.topWheel,"DOMMouseScroll",i):h===a.topScroll?f("scroll",!0)?v.ReactEventListener.trapCapturedEvent(a.topScroll,"scroll",i):v.ReactEventListener.trapBubbledEvent(a.topScroll,"scroll",v.ReactEventListener.WINDOW_HANDLE):h===a.topFocus||h===a.topBlur?(f("focus",!0)?(v.ReactEventListener.trapCapturedEvent(a.topFocus,"focus",i),v.ReactEventListener.trapCapturedEvent(a.topBlur,"blur",i)):f("focusin")&&(v.ReactEventListener.trapBubbledEvent(a.topFocus,"focusin",i),v.ReactEventListener.trapBubbledEvent(a.topBlur,"focusout",i)),o[a.topBlur]=!0,o[a.topFocus]=!0):p.hasOwnProperty(h)&&v.ReactEventListener.trapBubbledEvent(h,p[h],i),o[h]=!0)}},trapBubbledEvent:function(e,t,n){return v.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return v.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!c){var e=u.refreshScrollValues;v.ReactEventListener.monitorScrollValue(e),c=!0}},eventNameDispatchConfigs:i.eventNameDispatchConfigs,registrationNameModules:i.registrationNameModules,putListener:i.putListener,getListener:i.getListener,deleteListener:i.deleteListener,deleteAllListeners:i.deleteAllListeners});t.exports=v},{"./EventConstants":17,"./EventPluginHub":19,"./EventPluginRegistry":20,"./Object.assign":29,"./ReactEventEmitterMixin":60,"./ViewportMetrics":105,"./isEventSupported":138}],34:[function(e,t){"use strict";var n=e("./React"),r=e("./Object.assign"),i=n.createFactory(e("./ReactTransitionGroup")),s=n.createFactory(e("./ReactCSSTransitionGroupChild")),o=n.createClass({displayName:"ReactCSSTransitionGroup",propTypes:{transitionName:n.PropTypes.string.isRequired,transitionEnter:n.PropTypes.bool,transitionLeave:n.PropTypes.bool},getDefaultProps:function(){return{transitionEnter:!0,transitionLeave:!0}},_wrapChild:function(e){return s({name:this.props.transitionName,enter:this.props.transitionEnter,leave:this.props.transitionLeave},e)},render:function(){return i(r({},this.props,{childFactory:this._wrapChild}))}});t.exports=o},{"./Object.assign":29,"./React":31,"./ReactCSSTransitionGroupChild":35,"./ReactTransitionGroup":87}],35:[function(e,t){"use strict";var n=e("./React"),r=e("./CSSCore"),i=e("./ReactTransitionEvents"),s=e("./onlyChild"),o=17,u=n.createClass({displayName:"ReactCSSTransitionGroupChild",transition:function(e,t){var n=this.getDOMNode(),s=this.props.name+"-"+e,o=s+"-active",u=function(e){e&&e.target!==n||(r.removeClass(n,s),r.removeClass(n,o),i.removeEndEventListener(n,u),t&&t())};i.addEndEventListener(n,u),r.addClass(n,s),this.queueClass(o)},queueClass:function(e){this.classNameQueue.push(e),this.timeout||(this.timeout=setTimeout(this.flushClassNameQueue,o))},flushClassNameQueue:function(){this.isMounted()&&this.classNameQueue.forEach(r.addClass.bind(r,this.getDOMNode())),this.classNameQueue.length=0,this.timeout=null},componentWillMount:function(){this.classNameQueue=[]},componentWillUnmount:function(){this.timeout&&clearTimeout(this.timeout)},componentWillEnter:function(e){this.props.enter?this.transition("enter",e):e()},componentWillLeave:function(e){this.props.leave?this.transition("leave",e):e()},render:function(){return s(this.props.children)}});t.exports=u},{"./CSSCore":4,"./React":31,"./ReactTransitionEvents":86,"./onlyChild":148}],36:[function(e,t){"use strict";function n(e,t){this.forEachFunction=e,this.forEachContext=t}function r(e,t,n,r){var i=e;i.forEachFunction.call(i.forEachContext,t,r)}function i(e,t,i){if(null==e)return e;var s=n.getPooled(t,i);c(e,r,s),n.release(s)}function s(e,t,n){this.mapResult=e,this.mapFunction=t,this.mapContext=n}function o(e,t,n,r){var i=e,s=i.mapResult,o=!s.hasOwnProperty(n);if(o){var u=i.mapFunction.call(i.mapContext,t,r);s[n]=u}}function u(e,t,n){if(null==e)return e;var r={},i=s.getPooled(r,t,n);return c(e,o,i),s.release(i),r}function a(){return null}function f(e){return c(e,a,null)}var l=e("./PooledClass"),c=e("./traverseAllChildren"),h=(e("./warning"),l.twoArgumentPooler),p=l.threeArgumentPooler;l.addPoolingTo(n,h),l.addPoolingTo(s,p);var d={forEach:i,map:u,count:f};t.exports=d},{"./PooledClass":30,"./traverseAllChildren":153,"./warning":155}],37:[function(e,t){"use strict";var n=e("./ReactElement"),r=e("./ReactOwner"),i=e("./ReactUpdates"),s=e("./Object.assign"),o=e("./invariant"),u=e("./keyMirror"),a=u({MOUNTED:null,UNMOUNTED:null}),f=!1,l=null,c=null,h={injection:{injectEnvironment:function(e){o(!f),c=e.mountImageIntoNode,l=e.unmountIDFromEnvironment,h.BackendIDOperations=e.BackendIDOperations,f=!0}},LifeCycle:a,BackendIDOperations:null,Mixin:{isMounted:function(){return this._lifeCycleState===a.MOUNTED},setProps:function(e,t){var n=this._pendingElement||this._currentElement;this.replaceProps(s({},n.props,e),t)},replaceProps:function(e,t){o(this.isMounted()),o(0===this._mountDepth),this._pendingElement=n.cloneAndReplaceProps(this._pendingElement||this._currentElement,e),i.enqueueUpdate(this,t)},_setPropsInternal:function(e,t){var r=this._pendingElement||this._currentElement;this._pendingElement=n.cloneAndReplaceProps(r,s({},r.props,e)),i.enqueueUpdate(this,t)},construct:function(e){this.props=e.props,this._owner=e._owner,this._lifeCycleState=a.UNMOUNTED,this._pendingCallbacks=null,this._currentElement=e,this._pendingElement=null},mountComponent:function(e,t,n){o(!this.isMounted());var i=this._currentElement.ref;if(null!=i){var s=this._currentElement._owner;r.addComponentAsRefTo(this,i,s)}this._rootNodeID=e,this._lifeCycleState=a.MOUNTED,this._mountDepth=n},unmountComponent:function(){o(this.isMounted());var e=this._currentElement.ref;null!=e&&r.removeComponentAsRefFrom(this,e,this._owner),l(this._rootNodeID),this._rootNodeID=null,this._lifeCycleState=a.UNMOUNTED},receiveComponent:function(e,t){o(this.isMounted()),this._pendingElement=e,this.performUpdateIfNecessary(t)},performUpdateIfNecessary:function(e){if(null!=this._pendingElement){var t=this._currentElement,n=this._pendingElement;this._currentElement=n,this.props=n.props,this._owner=n._owner,this._pendingElement=null,this.updateComponent(e,t)}},updateComponent:function(e,t){var n=this._currentElement;(n._owner!==t._owner||n.ref!==t.ref)&&(null!=t.ref&&r.removeComponentAsRefFrom(this,t.ref,t._owner),null!=n.ref&&r.addComponentAsRefTo(this,n.ref,n._owner))},mountComponentIntoNode:function(e,t,n){var r=i.ReactReconcileTransaction.getPooled();r.perform(this._mountComponentIntoNode,this,e,t,r,n),i.ReactReconcileTransaction.release(r)},_mountComponentIntoNode:function(e,t,n,r){var i=this.mountComponent(e,n,0);c(i,t,r)},isOwnedBy:function(e){return this._owner===e},getSiblingByRef:function(e){var t=this._owner;return t&&t.refs?t.refs[e]:null}}};t.exports=h},{"./Object.assign":29,"./ReactElement":56,"./ReactOwner":72,"./ReactUpdates":88,"./invariant":137,"./keyMirror":143}],38:[function(e,t){"use strict";var n=e("./ReactDOMIDOperations"),r=e("./ReactMarkupChecksum"),i=e("./ReactMount"),s=e("./ReactPerf"),o=e("./ReactReconcileTransaction"),u=e("./getReactRootElementInContainer"),a=e("./invariant"),f=e("./setInnerHTML"),l=1,c=9,h={ReactReconcileTransaction:o,BackendIDOperations:n,unmountIDFromEnvironment:function(e){i.purgeID(e)},mountImageIntoNode:s.measure("ReactComponentBrowserEnvironment","mountImageIntoNode",function(e,t,n){if(a(t&&(t.nodeType===l||t.nodeType===c)),n){if(r.canReuseMarkup(e,u(t)))return;a(t.nodeType!==c)}a(t.nodeType!==c),f(t,e)})};t.exports=h},{"./ReactDOMIDOperations":47,"./ReactMarkupChecksum":67,"./ReactMount":68,"./ReactPerf":73,"./ReactReconcileTransaction":79,"./getReactRootElementInContainer":131,"./invariant":137,"./setInnerHTML":149}],39:[function(e,t){"use strict";var n=e("./shallowEqual"),r={shouldComponentUpdate:function(e,t){return!n(this.props,e)||!n(this.state,t)}};t.exports=r},{"./shallowEqual":150}],40:[function(e,t){"use strict";function n(e){var t=e._owner||null;return t&&t.constructor&&t.constructor.displayName?" Check the render method of `"+t.constructor.displayName+"`.":""}function r(e,t){for(var n in t)t.hasOwnProperty(n)&&N("function"==typeof t[n])}function i(e,t){var n=D.hasOwnProperty(t)?D[t]:null;B.hasOwnProperty(t)&&N(n===M.OVERRIDE_BASE),e.hasOwnProperty(t)&&N(n===M.DEFINE_MANY||n===M.DEFINE_MANY_MERGED)}function s(e){var t=e._compositeLifeCycleState;N(e.isMounted()||t===H.MOUNTING),N(null==p.current),N(t!==H.UNMOUNTING)}function o(e,t){if(t){N(!g.isValidFactory(t)),N(!d.isValidElement(t));var n=e.prototype;t.hasOwnProperty(O)&&P.mixins(e,t.mixins);for(var r in t)if(t.hasOwnProperty(r)&&r!==O){var s=t[r];if(i(n,r),P.hasOwnProperty(r))P[r](e,s);else{var o=D.hasOwnProperty(r),u=n.hasOwnProperty(r),a=s&&s.__reactDontBind,c="function"==typeof s,h=c&&!o&&!u&&!a;if(h)n.__reactAutoBindMap||(n.__reactAutoBindMap={}),n.__reactAutoBindMap[r]=s,n[r]=s;else if(u){var p=D[r];N(o&&(p===M.DEFINE_MANY_MERGED||p===M.DEFINE_MANY)),p===M.DEFINE_MANY_MERGED?n[r]=f(n[r],s):p===M.DEFINE_MANY&&(n[r]=l(n[r],s))}else n[r]=s}}}}function u(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var i=n in P;N(!i);var s=n in e;N(!s),e[n]=r}}}function a(e,t){return N(e&&t&&"object"==typeof e&&"object"==typeof t),L(t,function(t,n){N(void 0===e[n]),e[n]=t}),e}function f(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);return null==n?r:null==r?n:a(n,r)}}function l(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}var c=e("./ReactComponent"),h=e("./ReactContext"),p=e("./ReactCurrentOwner"),d=e("./ReactElement"),v=(e("./ReactElementValidator"),e("./ReactEmptyComponent")),m=e("./ReactErrorUtils"),g=e("./ReactLegacyElement"),y=e("./ReactOwner"),b=e("./ReactPerf"),w=e("./ReactPropTransferer"),E=e("./ReactPropTypeLocations"),S=(e("./ReactPropTypeLocationNames"),e("./ReactUpdates")),x=e("./Object.assign"),T=e("./instantiateReactComponent"),N=e("./invariant"),C=e("./keyMirror"),k=e("./keyOf"),L=(e("./monitorCodeUse"),e("./mapObject")),A=e("./shouldUpdateReactComponent"),O=(e("./warning"),k({mixins:null})),M=C({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),_=[],D={mixins:M.DEFINE_MANY,statics:M.DEFINE_MANY,propTypes:M.DEFINE_MANY,contextTypes:M.DEFINE_MANY,childContextTypes:M.DEFINE_MANY,getDefaultProps:M.DEFINE_MANY_MERGED,getInitialState:M.DEFINE_MANY_MERGED,getChildContext:M.DEFINE_MANY_MERGED,render:M.DEFINE_ONCE,componentWillMount:M.DEFINE_MANY,componentDidMount:M.DEFINE_MANY,componentWillReceiveProps:M.DEFINE_MANY,shouldComponentUpdate:M.DEFINE_ONCE,componentWillUpdate:M.DEFINE_MANY,componentDidUpdate:M.DEFINE_MANY,componentWillUnmount:M.DEFINE_MANY,updateComponent:M.OVERRIDE_BASE},P={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){r(e,t,E.childContext),e.childContextTypes=x({},e.childContextTypes,t)},contextTypes:function(e,t){r(e,t,E.context),e.contextTypes=x({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps=e.getDefaultProps?f(e.getDefaultProps,t):t},propTypes:function(e,t){r(e,t,E.prop),e.propTypes=x({},e.propTypes,t)},statics:function(e,t){u(e,t)}},H=C({MOUNTING:null,UNMOUNTING:null,RECEIVING_PROPS:null}),B={construct:function(){c.Mixin.construct.apply(this,arguments),y.Mixin.construct.apply(this,arguments),this.state=null,this._pendingState=null,this.context=null,this._compositeLifeCycleState=null},isMounted:function(){return c.Mixin.isMounted.call(this)&&this._compositeLifeCycleState!==H.MOUNTING},mountComponent:b.measure("ReactCompositeComponent","mountComponent",function(e,t,n){c.Mixin.mountComponent.call(this,e,t,n),this._compositeLifeCycleState=H.MOUNTING,this.__reactAutoBindMap&&this._bindAutoBindMethods(),this.context=this._processContext(this._currentElement._context),this.props=this._processProps(this.props),this.state=this.getInitialState?this.getInitialState():null,N("object"==typeof this.state&&!Array.isArray(this.state)),this._pendingState=null,this._pendingForceUpdate=!1,this.componentWillMount&&(this.componentWillMount(),this._pendingState&&(this.state=this._pendingState,this._pendingState=null)),this._renderedComponent=T(this._renderValidatedComponent(),this._currentElement.type),this._compositeLifeCycleState=null;var r=this._renderedComponent.mountComponent(e,t,n+1);return this.componentDidMount&&t.getReactMountReady().enqueue(this.componentDidMount,this),r}),unmountComponent:function(){this._compositeLifeCycleState=H.UNMOUNTING,this.componentWillUnmount&&this.componentWillUnmount(),this._compositeLifeCycleState=null,this._renderedComponent.unmountComponent(),this._renderedComponent=null,c.Mixin.unmountComponent.call(this)},setState:function(e,t){N("object"==typeof e||null==e),this.replaceState(x({},this._pendingState||this.state,e),t)},replaceState:function(e,t){s(this),this._pendingState=e,this._compositeLifeCycleState!==H.MOUNTING&&S.enqueueUpdate(this,t)},_processContext:function(e){var t=null,n=this.constructor.contextTypes;if(n){t={};for(var r in n)t[r]=e[r]}return t},_processChildContext:function(e){var t=this.getChildContext&&this.getChildContext();if(this.constructor.displayName||"ReactCompositeComponent",t){N("object"==typeof this.constructor.childContextTypes);for(var n in t)N(n in this.constructor.childContextTypes);return x({},e,t)}return e},_processProps:function(e){return e},_checkPropTypes:function(e,t,r){var i=this.constructor.displayName;for(var s in e)if(e.hasOwnProperty(s)){var o=e[s](t,s,i,r);o instanceof Error&&n(this)}},performUpdateIfNecessary:function(e){var t=this._compositeLifeCycleState;if(t!==H.MOUNTING&&t!==H.RECEIVING_PROPS&&(null!=this._pendingElement||null!=this._pendingState||this._pendingForceUpdate)){var n=this.context,r=this.props,i=this._currentElement;null!=this._pendingElement&&(i=this._pendingElement,n=this._processContext(i._context),r=this._processProps(i.props),this._pendingElement=null,this._compositeLifeCycleState=H.RECEIVING_PROPS,this.componentWillReceiveProps&&this.componentWillReceiveProps(r,n)),this._compositeLifeCycleState=null;var s=this._pendingState||this.state;this._pendingState=null;var o=this._pendingForceUpdate||!this.shouldComponentUpdate||this.shouldComponentUpdate(r,s,n);o?(this._pendingForceUpdate=!1,this._performComponentUpdate(i,r,s,n,e)):(this._currentElement=i,this.props=r,this.state=s,this.context=n,this._owner=i._owner)}},_performComponentUpdate:function(e,t,n,r,i){var s=this._currentElement,o=this.props,u=this.state,a=this.context;this.componentWillUpdate&&this.componentWillUpdate(t,n,r),this._currentElement=e,this.props=t,this.state=n,this.context=r,this._owner=e._owner,this.updateComponent(i,s),this.componentDidUpdate&&i.getReactMountReady().enqueue(this.componentDidUpdate.bind(this,o,u,a),this)},receiveComponent:function(e,t){(e!==this._currentElement||null==e._owner)&&c.Mixin.receiveComponent.call(this,e,t)},updateComponent:b.measure("ReactCompositeComponent","updateComponent",function(e,t){c.Mixin.updateComponent.call(this,e,t);var n=this._renderedComponent,r=n._currentElement,i=this._renderValidatedComponent();if(A(r,i))n.receiveComponent(i,e);else{var s=this._rootNodeID,o=n._rootNodeID;n.unmountComponent(),this._renderedComponent=T(i,this._currentElement.type);var u=this._renderedComponent.mountComponent(s,e,this._mountDepth+1);c.BackendIDOperations.dangerouslyReplaceNodeWithMarkupByID(o,u)}}),forceUpdate:function(e){var t=this._compositeLifeCycleState;N(this.isMounted()||t===H.MOUNTING),N(t!==H.UNMOUNTING&&null==p.current),this._pendingForceUpdate=!0,S.enqueueUpdate(this,e)},_renderValidatedComponent:b.measure("ReactCompositeComponent","_renderValidatedComponent",function(){var e,t=h.current;h.current=this._processChildContext(this._currentElement._context),p.current=this;try{e=this.render(),null===e||e===!1?(e=v.getEmptyComponent(),v.registerNullComponentID(this._rootNodeID)):v.deregisterNullComponentID(this._rootNodeID)}finally{h.current=t,p.current=null}return N(d.isValidElement(e)),e}),_bindAutoBindMethods:function(){for(var e in this.__reactAutoBindMap)if(this.__reactAutoBindMap.hasOwnProperty(e)){var t=this.__reactAutoBindMap[e];this[e]=this._bindAutoBindMethod(m.guard(t,this.constructor.displayName+"."+e))}},_bindAutoBindMethod:function(e){var t=this,n=e.bind(t);return n}},j=function(){};x(j.prototype,c.Mixin,y.Mixin,w.Mixin,B);var F={LifeCycle:H,Base:j,createClass:function(e){var t=function(){};t.prototype=new j,t.prototype.constructor=t,_.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),N(t.prototype.render);for(var n in D)t.prototype[n]||(t.prototype[n]=null);return g.wrapFactory(d.createFactory(t))},injection:{injectMixin:function(e){_.push(e)}}};t.exports=F},{"./Object.assign":29,"./ReactComponent":37,"./ReactContext":41,"./ReactCurrentOwner":42,"./ReactElement":56,"./ReactElementValidator":57,"./ReactEmptyComponent":58,"./ReactErrorUtils":59,"./ReactLegacyElement":65,"./ReactOwner":72,"./ReactPerf":73,"./ReactPropTransferer":74,"./ReactPropTypeLocationNames":75,"./ReactPropTypeLocations":76,"./ReactUpdates":88,"./instantiateReactComponent":136,"./invariant":137,"./keyMirror":143,"./keyOf":144,"./mapObject":145,"./monitorCodeUse":147,"./shouldUpdateReactComponent":151,"./warning":155}],41:[function(e,t){"use strict";var n=e("./Object.assign"),r={current:{},withContext:function(e,t){var i,s=r.current;r.current=n({},s,e);try{i=t()}finally{r.current=s}return i}};t.exports=r},{"./Object.assign":29}],42:[function(e,t){"use strict";var n={current:null};t.exports=n},{}],43:[function(e,t){"use strict";function n(e){return i.markNonLegacyFactory(r.createFactory(e))}var r=e("./ReactElement"),i=(e("./ReactElementValidator"),e("./ReactLegacyElement")),s=e("./mapObject"),o=s({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",defs:"defs",ellipse:"ellipse",g:"g",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},n);t.exports=o},{"./ReactElement":56,"./ReactElementValidator":57,"./ReactLegacyElement":65,"./mapObject":145}],44:[function(e,t){"use strict";var n=e("./AutoFocusMixin"),r=e("./ReactBrowserComponentMixin"),i=e("./ReactCompositeComponent"),s=e("./ReactElement"),o=e("./ReactDOM"),u=e("./keyMirror"),a=s.createFactory(o.button.type),f=u({onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0}),l=i.createClass({displayName:"ReactDOMButton",mixins:[n,r],render:function(){var e={};for(var t in this.props)!this.props.hasOwnProperty(t)||this.props.disabled&&f[t]||(e[t]=this.props[t]);return a(e,this.props.children)}});t.exports=l},{"./AutoFocusMixin":2,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":56,"./keyMirror":143}],45:[function(e,t){"use strict";function n(e){e&&(g(null==e.children||null==e.dangerouslySetInnerHTML),g(null==e.style||"object"==typeof e.style))}function r(e,t,n,r){var i=h.findReactContainerForID(e);if(i){var s=i.nodeType===T?i.ownerDocument:i;w(t,s)}r.getPutListenerQueue().enqueuePutListener(e,t,n)}function i(e){L.call(k,e)||(g(C.test(e)),k[e]=!0)}function s(e){i(e),this._tag=e,this.tagName=e.toUpperCase()}var o=e("./CSSPropertyOperations"),u=e("./DOMProperty"),a=e("./DOMPropertyOperations"),f=e("./ReactBrowserComponentMixin"),l=e("./ReactComponent"),c=e("./ReactBrowserEventEmitter"),h=e("./ReactMount"),p=e("./ReactMultiChild"),d=e("./ReactPerf"),v=e("./Object.assign"),m=e("./escapeTextForBrowser"),g=e("./invariant"),y=(e("./isEventSupported"),e("./keyOf")),b=(e("./monitorCodeUse"),c.deleteListener),w=c.listenTo,E=c.registrationNameModules,S={string:!0,number:!0},x=y({style:null}),T=1,N={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},C=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,k={},L={}.hasOwnProperty;s.displayName="ReactDOMComponent",s.Mixin={mountComponent:d.measure("ReactDOMComponent","mountComponent",function(e,t,r){l.Mixin.mountComponent.call(this,e,t,r),n(this.props);var i=N[this._tag]?"":"</"+this._tag+">";return this._createOpenTagMarkupAndPutListeners(t)+this._createContentMarkup(t)+i}),_createOpenTagMarkupAndPutListeners:function(e){var t=this.props,n="<"+this._tag;for(var i in t)if(t.hasOwnProperty(i)){var s=t[i];if(null!=s)if(E.hasOwnProperty(i))r(this._rootNodeID,i,s,e);else{i===x&&(s&&(s=t.style=v({},t.style)),s=o.createMarkupForStyles(s));var u=a.createMarkupForProperty(i,s);u&&(n+=" "+u)}}if(e.renderToStaticMarkup)return n+">";var f=a.createMarkupForID(this._rootNodeID);return n+" "+f+">"},_createContentMarkup:function(e){var t=this.props.dangerouslySetInnerHTML;if(null!=t){if(null!=t.__html)return t.__html}else{var n=S[typeof this.props.children]?this.props.children:null,r=null!=n?null:this.props.children;if(null!=n)return m(n);if(null!=r){var i=this.mountChildren(r,e);return i.join("")}}return""},receiveComponent:function(e,t){(e!==this._currentElement||null==e._owner)&&l.Mixin.receiveComponent.call(this,e,t)},updateComponent:d.measure("ReactDOMComponent","updateComponent",function(e,t){n(this._currentElement.props),l.Mixin.updateComponent.call(this,e,t),this._updateDOMProperties(t.props,e),this._updateDOMChildren(t.props,e)}),_updateDOMProperties:function(e,t){var n,i,s,o=this.props;for(n in e)if(!o.hasOwnProperty(n)&&e.hasOwnProperty(n))if(n===x){var a=e[n];for(i in a)a.hasOwnProperty(i)&&(s=s||{},s[i]="")}else E.hasOwnProperty(n)?b(this._rootNodeID,n):(u.isStandardName[n]||u.isCustomAttribute(n))&&l.BackendIDOperations.deletePropertyByID(this._rootNodeID,n);for(n in o){var f=o[n],c=e[n];if(o.hasOwnProperty(n)&&f!==c)if(n===x)if(f&&(f=o.style=v({},f)),c){for(i in c)!c.hasOwnProperty(i)||f&&f.hasOwnProperty(i)||(s=s||{},s[i]="");for(i in f)f.hasOwnProperty(i)&&c[i]!==f[i]&&(s=s||{},s[i]=f[i])}else s=f;else E.hasOwnProperty(n)?r(this._rootNodeID,n,f,t):(u.isStandardName[n]||u.isCustomAttribute(n))&&l.BackendIDOperations.updatePropertyByID(this._rootNodeID,n,f)}s&&l.BackendIDOperations.updateStylesByID(this._rootNodeID,s)},_updateDOMChildren:function(e,t){var n=this.props,r=S[typeof e.children]?e.children:null,i=S[typeof n.children]?n.children:null,s=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,o=n.dangerouslySetInnerHTML&&n.dangerouslySetInnerHTML.__html,u=null!=r?null:e.children,a=null!=i?null:n.children,f=null!=r||null!=s,c=null!=i||null!=o;null!=u&&null==a?this.updateChildren(null,t):f&&!c&&this.updateTextContent(""),null!=i?r!==i&&this.updateTextContent(""+i):null!=o?s!==o&&l.BackendIDOperations.updateInnerHTMLByID(this._rootNodeID,o):null!=a&&this.updateChildren(a,t)},unmountComponent:function(){this.unmountChildren(),c.deleteAllListeners(this._rootNodeID),l.Mixin.unmountComponent.call(this)}},v(s.prototype,l.Mixin,s.Mixin,p.Mixin,f),t.exports=s},{"./CSSPropertyOperations":6,"./DOMProperty":12,"./DOMPropertyOperations":13,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactBrowserEventEmitter":33,"./ReactComponent":37,"./ReactMount":68,"./ReactMultiChild":69,"./ReactPerf":73,"./escapeTextForBrowser":120,"./invariant":137,"./isEventSupported":138,"./keyOf":144,"./monitorCodeUse":147}],46:[function(e,t){"use strict";var n=e("./EventConstants"),r=e("./LocalEventTrapMixin"),i=e("./ReactBrowserComponentMixin"),s=e("./ReactCompositeComponent"),o=e("./ReactElement"),u=e("./ReactDOM"),a=o.createFactory(u.form.type),f=s.createClass({displayName:"ReactDOMForm",mixins:[i,r],render:function(){return a(this.props)},componentDidMount:function(){this.trapBubbledEvent(n.topLevelTypes.topReset,"reset"),this.trapBubbledEvent(n.topLevelTypes.topSubmit,"submit")}});t.exports=f},{"./EventConstants":17,"./LocalEventTrapMixin":27,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":56}],47:[function(e,t){"use strict";var n=e("./CSSPropertyOperations"),r=e("./DOMChildrenOperations"),i=e("./DOMPropertyOperations"),s=e("./ReactMount"),o=e("./ReactPerf"),u=e("./invariant"),a=e("./setInnerHTML"),f={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},l={updatePropertyByID:o.measure("ReactDOMIDOperations","updatePropertyByID",function(e,t,n){var r=s.getNode(e);u(!f.hasOwnProperty(t)),null!=n?i.setValueForProperty(r,t,n):i.deleteValueForProperty(r,t)}),deletePropertyByID:o.measure("ReactDOMIDOperations","deletePropertyByID",function(e,t,n){var r=s.getNode(e);u(!f.hasOwnProperty(t)),i.deleteValueForProperty(r,t,n)}),updateStylesByID:o.measure("ReactDOMIDOperations","updateStylesByID",function(e,t){var r=s.getNode(e);n.setValueForStyles(r,t)}),updateInnerHTMLByID:o.measure("ReactDOMIDOperations","updateInnerHTMLByID",function(e,t){var n=s.getNode(e);a(n,t)}),updateTextContentByID:o.measure("ReactDOMIDOperations","updateTextContentByID",function(e,t){var n=s.getNode(e);r.updateTextContent(n,t)}),dangerouslyReplaceNodeWithMarkupByID:o.measure("ReactDOMIDOperations","dangerouslyReplaceNodeWithMarkupByID",function(e,t){var n=s.getNode(e);r.dangerouslyReplaceNodeWithMarkup(n,t)}),dangerouslyProcessChildrenUpdates:o.measure("ReactDOMIDOperations","dangerouslyProcessChildrenUpdates",function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=s.getNode(e[n].parentID);r.processUpdates(e,t)})};t.exports=l},{"./CSSPropertyOperations":6,"./DOMChildrenOperations":11,"./DOMPropertyOperations":13,"./ReactMount":68,"./ReactPerf":73,"./invariant":137,"./setInnerHTML":149}],48:[function(e,t){"use strict";var n=e("./EventConstants"),r=e("./LocalEventTrapMixin"),i=e("./ReactBrowserComponentMixin"),s=e("./ReactCompositeComponent"),o=e("./ReactElement"),u=e("./ReactDOM"),a=o.createFactory(u.img.type),f=s.createClass({displayName:"ReactDOMImg",tagName:"IMG",mixins:[i,r],render:function(){return a(this.props)},componentDidMount:function(){this.trapBubbledEvent(n.topLevelTypes.topLoad,"load"),this.trapBubbledEvent(n.topLevelTypes.topError,"error")}});t.exports=f},{"./EventConstants":17,"./LocalEventTrapMixin":27,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":56}],49:[function(e,t){"use strict";function n(){this.isMounted()&&this.forceUpdate()}var r=e("./AutoFocusMixin"),i=e("./DOMPropertyOperations"),s=e("./LinkedValueUtils"),o=e("./ReactBrowserComponentMixin"),u=e("./ReactCompositeComponent"),a=e("./ReactElement"),f=e("./ReactDOM"),l=e("./ReactMount"),c=e("./ReactUpdates"),h=e("./Object.assign"),p=e("./invariant"),d=a.createFactory(f.input.type),v={},m=u.createClass({displayName:"ReactDOMInput",mixins:[r,s.Mixin,o],getInitialState:function(){var e=this.props.defaultValue;return{initialChecked:this.props.defaultChecked||!1,initialValue:null!=e?e:null}},render:function(){var e=h({},this.props);e.defaultChecked=null,e.defaultValue=null;var t=s.getValue(this);e.value=null!=t?t:this.state.initialValue;var n=s.getChecked(this);return e.checked=null!=n?n:this.state.initialChecked,e.onChange=this._handleChange,d(e,this.props.children)},componentDidMount:function(){var e=l.getID(this.getDOMNode());v[e]=this},componentWillUnmount:function(){var e=this.getDOMNode(),t=l.getID(e);delete v[t]},componentDidUpdate:function(){var e=this.getDOMNode();null!=this.props.checked&&i.setValueForProperty(e,"checked",this.props.checked||!1);var t=s.getValue(this);null!=t&&i.setValueForProperty(e,"value",""+t)},_handleChange:function(e){var t,r=s.getOnChange(this);r&&(t=r.call(this,e)),c.asap(n,this);var i=this.props.name;if("radio"===this.props.type&&null!=i){for(var o=this.getDOMNode(),u=o;u.parentNode;)u=u.parentNode;for(var a=u.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),f=0,h=a.length;h>f;f++){var d=a[f];if(d!==o&&d.form===o.form){var m=l.getID(d);p(m);var g=v[m];p(g),c.asap(n,g)}}}return t}});t.exports=m},{"./AutoFocusMixin":2,"./DOMPropertyOperations":13,"./LinkedValueUtils":26,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":56,"./ReactMount":68,"./ReactUpdates":88,"./invariant":137}],50:[function(e,t){"use strict";var n=e("./ReactBrowserComponentMixin"),r=e("./ReactCompositeComponent"),i=e("./ReactElement"),s=e("./ReactDOM"),o=(e("./warning"),i.createFactory(s.option.type)),u=r.createClass({displayName:"ReactDOMOption",mixins:[n],componentWillMount:function(){},render:function(){return o(this.props,this.props.children)}});t.exports=u},{"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":56,"./warning":155}],51:[function(e,t){"use strict";function n(){this.isMounted()&&(this.setState({value:this._pendingValue}),this._pendingValue=0)}function r(e,t){if(null!=e[t])if(e.multiple){if(!Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be an array if `multiple` is true.")}else if(Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be a scalar value if `multiple` is false.")}function i(e,t){var n,r,i,s=e.props.multiple,o=null!=t?t:e.state.value,u=e.getDOMNode().options;if(s)for(n={},r=0,i=o.length;i>r;++r)n[""+o[r]]=!0;else n=""+o;for(r=0,i=u.length;i>r;r++){var a=s?n.hasOwnProperty(u[r].value):u[r].value===n;a!==u[r].selected&&(u[r].selected=a)}}var s=e("./AutoFocusMixin"),o=e("./LinkedValueUtils"),u=e("./ReactBrowserComponentMixin"),a=e("./ReactCompositeComponent"),f=e("./ReactElement"),l=e("./ReactDOM"),c=e("./ReactUpdates"),h=e("./Object.assign"),p=f.createFactory(l.select.type),d=a.createClass({displayName:"ReactDOMSelect",mixins:[s,o.Mixin,u],propTypes:{defaultValue:r,value:r},getInitialState:function(){return{value:this.props.defaultValue||(this.props.multiple?[]:"")}},componentWillMount:function(){this._pendingValue=null},componentWillReceiveProps:function(e){!this.props.multiple&&e.multiple?this.setState({value:[this.state.value]}):this.props.multiple&&!e.multiple&&this.setState({value:this.state.value[0]})},render:function(){var e=h({},this.props);return e.onChange=this._handleChange,e.value=null,p(e,this.props.children)},componentDidMount:function(){i(this,o.getValue(this))},componentDidUpdate:function(e){var t=o.getValue(this),n=!!e.multiple,r=!!this.props.multiple;(null!=t||n!==r)&&i(this,t)},_handleChange:function(e){var t,r=o.getOnChange(this);r&&(t=r.call(this,e));var i;if(this.props.multiple){i=[];for(var s=e.target.options,u=0,a=s.length;a>u;u++)s[u].selected&&i.push(s[u].value)}else i=e.target.value;return this._pendingValue=i,c.asap(n,this),t}});t.exports=d},{"./AutoFocusMixin":2,"./LinkedValueUtils":26,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":56,"./ReactUpdates":88}],52:[function(e,t){"use strict";function n(e,t,n,r){return e===n&&t===r}function r(e){var t=document.selection,n=t.createRange(),r=n.text.length,i=n.duplicate();i.moveToElementText(e),i.setEndPoint("EndToStart",n);var s=i.text.length,o=s+r;return{start:s,end:o}}function i(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var r=t.anchorNode,i=t.anchorOffset,s=t.focusNode,o=t.focusOffset,u=t.getRangeAt(0),a=n(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),f=a?0:u.toString().length,l=u.cloneRange();l.selectNodeContents(e),l.setEnd(u.startContainer,u.startOffset);var c=n(l.startContainer,l.startOffset,l.endContainer,l.endOffset),h=c?0:l.toString().length,p=h+f,d=document.createRange();d.setStart(r,i),d.setEnd(s,o);var v=d.collapsed;return{start:v?p:h,end:v?h:p}}function s(e,t){var n,r,i=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),i.moveToElementText(e),i.moveStart("character",n),i.setEndPoint("EndToStart",i),i.moveEnd("character",r-n),i.select()}function o(e,t){if(window.getSelection){var n=window.getSelection(),r=e[f()].length,i=Math.min(t.start,r),s="undefined"==typeof t.end?i:Math.min(t.end,r);if(!n.extend&&i>s){var o=s;s=i,i=o}var u=a(e,i),l=a(e,s);if(u&&l){var c=document.createRange();c.setStart(u.node,u.offset),n.removeAllRanges(),i>s?(n.addRange(c),n.extend(l.node,l.offset)):(c.setEnd(l.node,l.offset),n.addRange(c))}}}var u=e("./ExecutionEnvironment"),a=e("./getNodeForCharacterOffset"),f=e("./getTextContentAccessor"),l=u.canUseDOM&&document.selection,c={getOffsets:l?r:i,setOffsets:l?s:o};t.exports=c},{"./ExecutionEnvironment":23,"./getNodeForCharacterOffset":130,"./getTextContentAccessor":132}],53:[function(e,t){"use strict";function n(){this.isMounted()&&this.forceUpdate()}var r=e("./AutoFocusMixin"),i=e("./DOMPropertyOperations"),s=e("./LinkedValueUtils"),o=e("./ReactBrowserComponentMixin"),u=e("./ReactCompositeComponent"),a=e("./ReactElement"),f=e("./ReactDOM"),l=e("./ReactUpdates"),c=e("./Object.assign"),h=e("./invariant"),p=(e("./warning"),a.createFactory(f.textarea.type)),d=u.createClass({displayName:"ReactDOMTextarea",mixins:[r,s.Mixin,o],getInitialState:function(){var e=this.props.defaultValue,t=this.props.children;null!=t&&(h(null==e),Array.isArray(t)&&(h(t.length<=1),t=t[0]),e=""+t),null==e&&(e="");var n=s.getValue(this);return{initialValue:""+(null!=n?n:e)}},render:function(){var e=c({},this.props);return h(null==e.dangerouslySetInnerHTML),e.defaultValue=null,e.value=null,e.onChange=this._handleChange,p(e,this.state.initialValue)},componentDidUpdate:function(){var e=s.getValue(this);if(null!=e){var t=this.getDOMNode();i.setValueForProperty(t,"value",""+e)}},_handleChange:function(e){var t,r=s.getOnChange(this);return r&&(t=r.call(this,e)),l.asap(n,this),t}});t.exports=d},{"./AutoFocusMixin":2,"./DOMPropertyOperations":13,"./LinkedValueUtils":26,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":56,"./ReactUpdates":88,"./invariant":137,"./warning":155}],54:[function(e,t){"use strict";function n(){this.reinitializeTransaction()}var r=e("./ReactUpdates"),i=e("./Transaction"),s=e("./Object.assign"),o=e("./emptyFunction"),u={initialize:o,close:function(){c.isBatchingUpdates=!1}},a={initialize:o,close:r.flushBatchedUpdates.bind(r)},f=[a,u];s(n.prototype,i.Mixin,{getTransactionWrappers:function(){return f}});var l=new n,c={isBatchingUpdates:!1,batchedUpdates:function(e,t,n){var r=c.isBatchingUpdates;c.isBatchingUpdates=!0,r?e(t,n):l.perform(e,null,t,n)}};t.exports=c},{"./Object.assign":29,"./ReactUpdates":88,"./Transaction":104,"./emptyFunction":118}],55:[function(e,t){"use strict";function n(){T.EventEmitter.injectReactEventListener(x),T.EventPluginHub.injectEventPluginOrder(u),T.EventPluginHub.injectInstanceHandle(N),T.EventPluginHub.injectMount(C),T.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:A,EnterLeaveEventPlugin:a,ChangeEventPlugin:i,CompositionEventPlugin:o,MobileSafariClickEventPlugin:c,SelectEventPlugin:k,BeforeInputEventPlugin:r}),T.NativeComponent.injectGenericComponentClass(v),T.NativeComponent.injectComponentClasses({button:m,form:g,img:y,input:b,option:w,select:E,textarea:S,html:M("html"),head:M("head"),body:M("body")}),T.CompositeComponent.injectMixin(h),T.DOMProperty.injectDOMPropertyConfig(l),T.DOMProperty.injectDOMPropertyConfig(O),T.EmptyComponent.injectEmptyComponent("noscript"),T.Updates.injectReconcileTransaction(p.ReactReconcileTransaction),T.Updates.injectBatchingStrategy(d),T.RootIndex.injectCreateReactRootIndex(f.canUseDOM?s.createReactRootIndex:L.createReactRootIndex),T.Component.injectEnvironment(p)}var r=e("./BeforeInputEventPlugin"),i=e("./ChangeEventPlugin"),s=e("./ClientReactRootIndex"),o=e("./CompositionEventPlugin"),u=e("./DefaultEventPluginOrder"),a=e("./EnterLeaveEventPlugin"),f=e("./ExecutionEnvironment"),l=e("./HTMLDOMPropertyConfig"),c=e("./MobileSafariClickEventPlugin"),h=e("./ReactBrowserComponentMixin"),p=e("./ReactComponentBrowserEnvironment"),d=e("./ReactDefaultBatchingStrategy"),v=e("./ReactDOMComponent"),m=e("./ReactDOMButton"),g=e("./ReactDOMForm"),y=e("./ReactDOMImg"),b=e("./ReactDOMInput"),w=e("./ReactDOMOption"),E=e("./ReactDOMSelect"),S=e("./ReactDOMTextarea"),x=e("./ReactEventListener"),T=e("./ReactInjection"),N=e("./ReactInstanceHandles"),C=e("./ReactMount"),k=e("./SelectEventPlugin"),L=e("./ServerReactRootIndex"),A=e("./SimpleEventPlugin"),O=e("./SVGDOMPropertyConfig"),M=e("./createFullPageComponent");t.exports={inject:n}},{"./BeforeInputEventPlugin":3,"./ChangeEventPlugin":8,"./ClientReactRootIndex":9,"./CompositionEventPlugin":10,"./DefaultEventPluginOrder":15,"./EnterLeaveEventPlugin":16,"./ExecutionEnvironment":23,"./HTMLDOMPropertyConfig":24,"./MobileSafariClickEventPlugin":28,"./ReactBrowserComponentMixin":32,"./ReactComponentBrowserEnvironment":38,"./ReactDOMButton":44,"./ReactDOMComponent":45,"./ReactDOMForm":46,"./ReactDOMImg":48,"./ReactDOMInput":49,"./ReactDOMOption":50,"./ReactDOMSelect":51,"./ReactDOMTextarea":53,"./ReactDefaultBatchingStrategy":54,"./ReactEventListener":61,"./ReactInjection":62,"./ReactInstanceHandles":64,"./ReactMount":68,"./SVGDOMPropertyConfig":89,"./SelectEventPlugin":90,"./ServerReactRootIndex":91,"./SimpleEventPlugin":92,"./createFullPageComponent":113}],56:[function(e,t){"use strict";var n=e("./ReactContext"),r=e("./ReactCurrentOwner"),i=(e("./warning"),{key:!0,ref:!0}),s=function(e,t,n,r,i,s){this.type=e,this.key=t,this.ref=n,this._owner=r,this._context=i,this.props=s};s.prototype={_isReactElement:!0},s.createElement=function(e,t,u){var a,f={},l=null,c=null;if(null!=t){c=void 0===t.ref?null:t.ref,l=null==t.key?null:""+t.key;for(a in t)t.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(f[a]=t[a])}var h=arguments.length-2;if(1===h)f.children=u;else if(h>1){for(var p=Array(h),d=0;h>d;d++)p[d]=arguments[d+2];f.children=p}if(e&&e.defaultProps){var v=e.defaultProps;for(a in v)"undefined"==typeof f[a]&&(f[a]=v[a])}return new s(e,l,c,r.current,n.current,f)},s.createFactory=function(e){var t=s.createElement.bind(null,e);return t.type=e,t},s.cloneAndReplaceProps=function(e,t){var n=new s(e.type,e.key,e.ref,e._owner,e._context,t);return n},s.isValidElement=function(e){var t=!!e&&!!e._isReactElement;return t},t.exports=s},{"./ReactContext":41,"./ReactCurrentOwner":42,"./warning":155}],57:[function(e,t){"use strict";function n(){var e=c.current;return e&&e.constructor.displayName||void 0}function r(e,t){e._store.validated||null!=e.key||(e._store.validated=!0,s("react_key_warning",'Each child in an array should have a unique "key" prop.',e,t))}function i(e,t,n){m.test(e)&&s("react_numeric_key_warning","Child objects should have non-numeric keys so ordering is preserved.",t,n)}function s(e,t,r,i){var s=n(),o=i.displayName,u=s||o,a=p[e];if(!a.hasOwnProperty(u)){a[u]=!0,t+=s?" Check the render method of "+s+".":" Check the renderComponent call using <"+o+">.";var f=null;r._owner&&r._owner!==c.current&&(f=r._owner.constructor.displayName,t+=" It was passed a child from "+f+"."),t+=" See http://fb.me/react-warning-keys for more information.",h(e,{component:u,componentOwner:f}),console.warn(t)}}function o(){var e=n()||"";d.hasOwnProperty(e)||(d[e]=!0,h("react_object_map_children"))}function u(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++){var s=e[n];f.isValidElement(s)&&r(s,t)}else if(f.isValidElement(e))e._store.validated=!0;else if(e&&"object"==typeof e){o();for(var u in e)i(u,e[u],t)}}function a(e,t,n,r){for(var i in t)if(t.hasOwnProperty(i)){var s;try{s=t[i](n,i,e,r)}catch(o){s=o}s instanceof Error&&!(s.message in v)&&(v[s.message]=!0,h("react_failed_descriptor_type_check",{message:s.message}))}}var f=e("./ReactElement"),l=e("./ReactPropTypeLocations"),c=e("./ReactCurrentOwner"),h=e("./monitorCodeUse"),p=(e("./warning"),{react_key_warning:{},react_numeric_key_warning:{}}),d={},v={},m=/^\d+$/,g={createElement:function(e){var t=f.createElement.apply(this,arguments);if(null==t)return t;for(var n=2;n<arguments.length;n++)u(arguments[n],e);if(e){var r=e.displayName;e.propTypes&&a(r,e.propTypes,t.props,l.prop),e.contextTypes&&a(r,e.contextTypes,t._context,l.context)}return t},createFactory:function(e){var t=g.createElement.bind(null,e);return t.type=e,t}};t.exports=g},{"./ReactCurrentOwner":42,"./ReactElement":56,"./ReactPropTypeLocations":76,"./monitorCodeUse":147,"./warning":155}],58:[function(e,t){"use strict";function n(){return a(o),o()}function r(e){f[e]=!0}function i(e){delete f[e]}function s(e){return f[e]}var o,u=e("./ReactElement"),a=e("./invariant"),f={},l={injectEmptyComponent:function(e){o=u.createFactory(e)}},c={deregisterNullComponentID:i,getEmptyComponent:n,injection:l,isNullComponentID:s,registerNullComponentID:r};t.exports=c},{"./ReactElement":56,"./invariant":137}],59:[function(e,t){"use strict";var n={guard:function(e){return e}};t.exports=n},{}],60:[function(e,t){"use strict";function n(e){r.enqueueEvents(e),r.processEventQueue()}var r=e("./EventPluginHub"),i={handleTopLevel:function(e,t,i,s){var o=r.extractEvents(e,t,i,s);n(o)}};t.exports=i},{"./EventPluginHub":19}],61:[function(e,t){"use strict";function n(e){var t=l.getID(e),n=f.getReactRootIDFromNodeID(t),r=l.findReactContainerForID(n),i=l.getFirstReactDOM(r);return i}function r(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function i(e){for(var t=l.getFirstReactDOM(p(e.nativeEvent))||window,r=t;r;)e.ancestors.push(r),r=n(r);for(var i=0,s=e.ancestors.length;s>i;i++){t=e.ancestors[i];var o=l.getID(t)||"";v._handleTopLevel(e.topLevelType,t,o,e.nativeEvent)}}function s(e){var t=d(window);e(t)}var o=e("./EventListener"),u=e("./ExecutionEnvironment"),a=e("./PooledClass"),f=e("./ReactInstanceHandles"),l=e("./ReactMount"),c=e("./ReactUpdates"),h=e("./Object.assign"),p=e("./getEventTarget"),d=e("./getUnboundedScrollPosition");h(r.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),a.addPoolingTo(r,a.twoArgumentPooler);var v={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:u.canUseDOM?window:null,setHandleTopLevel:function(e){v._handleTopLevel=e},setEnabled:function(e){v._enabled=!!e},isEnabled:function(){return v._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?o.listen(r,t,v.dispatchEvent.bind(null,e)):void 0},trapCapturedEvent:function(e,t,n){var r=n;return r?o.capture(r,t,v.dispatchEvent.bind(null,e)):void 0},monitorScrollValue:function(e){var t=s.bind(null,e);o.listen(window,"scroll",t),o.listen(window,"resize",t)},dispatchEvent:function(e,t){if(v._enabled){var n=r.getPooled(e,t);try{c.batchedUpdates(i,n)}finally{r.release(n)}}}};t.exports=v},{"./EventListener":18,"./ExecutionEnvironment":23,"./Object.assign":29,"./PooledClass":30,"./ReactInstanceHandles":64,"./ReactMount":68,"./ReactUpdates":88,"./getEventTarget":128,"./getUnboundedScrollPosition":133}],62:[function(e,t){"use strict";var n=e("./DOMProperty"),r=e("./EventPluginHub"),i=e("./ReactComponent"),s=e("./ReactCompositeComponent"),o=e("./ReactEmptyComponent"),u=e("./ReactBrowserEventEmitter"),a=e("./ReactNativeComponent"),f=e("./ReactPerf"),l=e("./ReactRootIndex"),c=e("./ReactUpdates"),h={Component:i.injection,CompositeComponent:s.injection,DOMProperty:n.injection,EmptyComponent:o.injection,EventPluginHub:r.injection,EventEmitter:u.injection,NativeComponent:a.injection,Perf:f.injection,RootIndex:l.injection,Updates:c.injection};t.exports=h},{"./DOMProperty":12,"./EventPluginHub":19,"./ReactBrowserEventEmitter":33,"./ReactComponent":37,"./ReactCompositeComponent":40,"./ReactEmptyComponent":58,"./ReactNativeComponent":71,"./ReactPerf":73,"./ReactRootIndex":80,"./ReactUpdates":88}],63:[function(e,t){"use strict";function n(e){return i(document.documentElement,e)}var r=e("./ReactDOMSelection"),i=e("./containsNode"),s=e("./focusNode"),o=e("./getActiveElement"),u={hasSelectionCapabilities:function(e){return e&&("INPUT"===e.nodeName&&"text"===e.type||"TEXTAREA"===e.nodeName||"true"===e.contentEditable)},getSelectionInformation:function(){var e=o();return{focusedElem:e,selectionRange:u.hasSelectionCapabilities(e)?u.getSelection(e):null}},restoreSelection:function(e){var t=o(),r=e.focusedElem,i=e.selectionRange;t!==r&&n(r)&&(u.hasSelectionCapabilities(r)&&u.setSelection(r,i),s(r))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&"INPUT"===e.nodeName){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=r.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,i=t.end;if("undefined"==typeof i&&(i=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(i,e.value.length);else if(document.selection&&"INPUT"===e.nodeName){var s=e.createTextRange();s.collapse(!0),s.moveStart("character",n),s.moveEnd("character",i-n),s.select()}else r.setOffsets(e,t)}};t.exports=u},{"./ReactDOMSelection":52,"./containsNode":111,"./focusNode":122,"./getActiveElement":124}],64:[function(e,t){"use strict";function n(e){return h+e.toString(36)}function r(e,t){return e.charAt(t)===h||t===e.length}function i(e){return""===e||e.charAt(0)===h&&e.charAt(e.length-1)!==h}function s(e,t){return 0===t.indexOf(e)&&r(t,e.length)}function o(e){return e?e.substr(0,e.lastIndexOf(h)):""}function u(e,t){if(c(i(e)&&i(t)),c(s(e,t)),e===t)return e;for(var n=e.length+p,o=n;o<t.length&&!r(t,o);o++);return t.substr(0,o)}function a(e,t){var n=Math.min(e.length,t.length);if(0===n)return"";for(var s=0,o=0;n>=o;o++)if(r(e,o)&&r(t,o))s=o;else if(e.charAt(o)!==t.charAt(o))break;var u=e.substr(0,s);return c(i(u)),u}function f(e,t,n,r,i,a){e=e||"",t=t||"",c(e!==t);var f=s(t,e);c(f||s(e,t));for(var l=0,h=f?o:u,p=e;;p=h(p,t)){var v;if(i&&p===e||a&&p===t||(v=n(p,f,r)),v===!1||p===t)break;c(l++<d)}}var l=e("./ReactRootIndex"),c=e("./invariant"),h=".",p=h.length,d=100,v={createReactRootID:function(){return n(l.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===h&&e.length>1){var t=e.indexOf(h,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,i){var s=a(e,t);s!==e&&f(e,s,n,r,!1,!0),s!==t&&f(s,t,n,i,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(f("",e,t,n,!0,!1),f(e,"",t,n,!1,!0))},traverseAncestors:function(e,t,n){f("",e,t,n,!0,!1)},_getFirstCommonAncestorID:a,_getNextDescendantID:u,isAncestorIDOf:s,SEPARATOR:h};t.exports=v},{"./ReactRootIndex":80,"./invariant":137}],65:[function(e,t){"use strict";function n(e,t){if("function"==typeof t)for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];if("function"==typeof r){var i=r.bind(t);for(var s in r)r.hasOwnProperty(s)&&(i[s]=r[s]);e[n]=i}else e[n]=r}}var r=(e("./ReactCurrentOwner"),e("./invariant")),i=(e("./monitorCodeUse"),e("./warning"),{}),s={},o={};o.wrapCreateFactory=function(e){var t=function(t){return"function"!=typeof t?e(t):t.isReactNonLegacyFactory?e(t.type):t.isReactLegacyFactory?e(t.type):t};return t},o.wrapCreateElement=function(e){var t=function(t){if("function"!=typeof t)return e.apply(this,arguments);var n;return t.isReactNonLegacyFactory?(n=Array.prototype.slice.call(arguments,0),n[0]=t.type,e.apply(this,n)):t.isReactLegacyFactory?(t._isMockFunction&&(t.type._mockedReactClassConstructor=t),n=Array.prototype.slice.call(arguments,0),n[0]=t.type,e.apply(this,n)):t.apply(null,Array.prototype.slice.call(arguments,1))};return t},o.wrapFactory=function(e){r("function"==typeof e);var t=function(){return e.apply(this,arguments)};return n(t,e.type),t.isReactLegacyFactory=i,t.type=e.type,t},o.markNonLegacyFactory=function(e){return e.isReactNonLegacyFactory=s,e},o.isValidFactory=function(e){return"function"==typeof e&&e.isReactLegacyFactory===i},o.isValidClass=function(e){return o.isValidFactory(e)},o._isLegacyCallWarningEnabled=!0,t.exports=o},{"./ReactCurrentOwner":42,"./invariant":137,"./monitorCodeUse":147,"./warning":155}],66:[function(e,t){"use strict";function n(e,t){this.value=e,this.requestChange=t}function r(e){var t={value:"undefined"==typeof e?i.PropTypes.any.isRequired:e.isRequired,requestChange:i.PropTypes.func.isRequired};return i.PropTypes.shape(t)}var i=e("./React");n.PropTypes={link:r},t.exports=n},{"./React":31}],67:[function(e,t){"use strict";var n=e("./adler32"),r={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=n(e);return e.replace(">"," "+r.CHECKSUM_ATTR_NAME+'="'+t+'">')},canReuseMarkup:function(e,t){var i=t.getAttribute(r.CHECKSUM_ATTR_NAME);i=i&&parseInt(i,10);var s=n(e);return s===i}};t.exports=r},{"./adler32":107}],68:[function(e,t){"use strict";function n(e){var t=b(e);return t&&D.getID(t)}function r(e){var t=i(e);if(t)if(C.hasOwnProperty(t)){var n=C[t];n!==e&&(E(!u(n,t)),C[t]=e)}else C[t]=e;return t}function i(e){return e&&e.getAttribute&&e.getAttribute(N)||""}function s(e,t){var n=i(e);n!==t&&delete C[n],e.setAttribute(N,t),C[t]=e}function o(e){return C.hasOwnProperty(e)&&u(C[e],e)||(C[e]=D.findReactNodeByID(e)),C[e]}function u(e,t){if(e){E(i(e)===t);var n=D.findReactContainerForID(t);if(n&&g(n,e))return!0}return!1}function a(e){delete C[e]}function f(e){var t=C[e];return t&&u(t,e)?void (_=t):!1}function l(e){_=null,v.traverseAncestors(e,f);var t=_;return _=null,t}var c=e("./DOMProperty"),h=e("./ReactBrowserEventEmitter"),p=(e("./ReactCurrentOwner"),e("./ReactElement")),d=e("./ReactLegacyElement"),v=e("./ReactInstanceHandles"),m=e("./ReactPerf"),g=e("./containsNode"),y=e("./deprecated"),b=e("./getReactRootElementInContainer"),w=e("./instantiateReactComponent"),E=e("./invariant"),S=e("./shouldUpdateReactComponent"),x=(e("./warning"),d.wrapCreateElement(p.createElement)),T=v.SEPARATOR,N=c.ID_ATTRIBUTE_NAME,C={},k=1,L=9,A={},O={},M=[],_=null,D={_instancesByReactRootID:A,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){var i=t.props;return D.scrollMonitor(n,function(){e.replaceProps(i,r)}),e},_registerComponent:function(e,t){E(t&&(t.nodeType===k||t.nodeType===L)),h.ensureScrollValueMonitoring();var n=D.registerContainer(t);return A[n]=e,n},_renderNewRootComponent:m.measure("ReactMount","_renderNewRootComponent",function(e,t,n){var r=w(e,null),i=D._registerComponent(r,t);return r.mountComponentIntoNode(i,t,n),r}),render:function(e,t,r){E(p.isValidElement(e));var i=A[n(t)];if(i){var s=i._currentElement;if(S(s,e))return D._updateRootComponent(i,e,t,r);D.unmountComponentAtNode(t)}var o=b(t),u=o&&D.isRenderedByReact(o),a=u&&!i,f=D._renderNewRootComponent(e,t,a);return r&&r.call(f),f},constructAndRenderComponent:function(e,t,n){var r=x(e,t);return D.render(r,n)},constructAndRenderComponentByID:function(e,t,n){var r=document.getElementById(n);return E(r),D.constructAndRenderComponent(e,t,r)},registerContainer:function(e){var t=n(e);return t&&(t=v.getReactRootIDFromNodeID(t)),t||(t=v.createReactRootID()),O[t]=e,t},unmountComponentAtNode:function(e){var t=n(e),r=A[t];return r?(D.unmountComponentFromNode(r,e),delete A[t],delete O[t],!0):!1},unmountComponentFromNode:function(e,t){for(e.unmountComponent(),t.nodeType===L&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)},findReactContainerForID:function(e){var t=v.getReactRootIDFromNodeID(e),n=O[t];return n},findReactNodeByID:function(e){var t=D.findReactContainerForID(e);return D.findComponentRoot(t,e)},isRenderedByReact:function(e){if(1!==e.nodeType)return!1;var t=D.getID(e);return t?t.charAt(0)===T:!1},getFirstReactDOM:function(e){for(var t=e;t&&t.parentNode!==t;){if(D.isRenderedByReact(t))return t;t=t.parentNode}return null},findComponentRoot:function(e,t){var n=M,r=0,i=l(t)||e;for(n[0]=i.firstChild,n.length=1;r<n.length;){for(var s,o=n[r++];o;){var u=D.getID(o);u?t===u?s=o:v.isAncestorIDOf(u,t)&&(n.length=r=0,n.push(o.firstChild)):n.push(o.firstChild),o=o.nextSibling}if(s)return n.length=0,s}n.length=0,E(!1)},getReactRootID:n,getID:r,setID:s,getNode:o,purgeID:a};D.renderComponent=y("ReactMount","renderComponent","render",this,D.render),t.exports=D},{"./DOMProperty":12,"./ReactBrowserEventEmitter":33,"./ReactCurrentOwner":42,"./ReactElement":56,"./ReactInstanceHandles":64,"./ReactLegacyElement":65,"./ReactPerf":73,"./containsNode":111,"./deprecated":117,"./getReactRootElementInContainer":131,"./instantiateReactComponent":136,"./invariant":137,"./shouldUpdateReactComponent":151,"./warning":155}],69:[function(e,t){"use strict";function n(e,t,n){d.push({parentID:e,parentNode:null,type:f.INSERT_MARKUP,markupIndex:v.push(t)-1,textContent:null,fromIndex:null,toIndex:n})}function r(e,t,n){d.push({parentID:e,parentNode:null,type:f.MOVE_EXISTING,markupIndex:null,textContent:null,fromIndex:t,toIndex:n})}function i(e,t){d.push({parentID:e,parentNode:null,type:f.REMOVE_NODE,markupIndex:null,textContent:null,fromIndex:t,toIndex:null})}function s(e,t){d.push({parentID:e,parentNode:null,type:f.TEXT_CONTENT,markupIndex:null,textContent:t,fromIndex:null,toIndex:null})}function o(){d.length&&(a.BackendIDOperations.dangerouslyProcessChildrenUpdates(d,v),u())}function u(){d.length=0,v.length=0}var a=e("./ReactComponent"),f=e("./ReactMultiChildUpdateTypes"),l=e("./flattenChildren"),c=e("./instantiateReactComponent"),h=e("./shouldUpdateReactComponent"),p=0,d=[],v=[],m={Mixin:{mountChildren:function(e,t){var n=l(e),r=[],i=0;this._renderedChildren=n;for(var s in n){var o=n[s];if(n.hasOwnProperty(s)){var u=c(o,null);n[s]=u;var a=this._rootNodeID+s,f=u.mountComponent(a,t,this._mountDepth+1);u._mountIndex=i,r.push(f),i++}}return r},updateTextContent:function(e){p++;var t=!0;try{var n=this._renderedChildren;for(var r in n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setTextContent(e),t=!1}finally{p--,p||(t?u():o())}},updateChildren:function(e,t){p++;var n=!0;try{this._updateChildren(e,t),n=!1}finally{p--,p||(n?u():o())}},_updateChildren:function(e,t){var n=l(e),r=this._renderedChildren;if(n||r){var i,s=0,o=0;for(i in n)if(n.hasOwnProperty(i)){var u=r&&r[i],a=u&&u._currentElement,f=n[i];if(h(a,f))this.moveChild(u,o,s),s=Math.max(u._mountIndex,s),u.receiveComponent(f,t),u._mountIndex=o;else{u&&(s=Math.max(u._mountIndex,s),this._unmountChildByName(u,i));var p=c(f,null);this._mountChildByNameAtIndex(p,i,o,t)}o++}for(i in r)!r.hasOwnProperty(i)||n&&n[i]||this._unmountChildByName(r[i],i)}},unmountChildren:function(){var e=this._renderedChildren;for(var t in e){var n=e[t];n.unmountComponent&&n.unmountComponent()}this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&r(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){n(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){i(this._rootNodeID,e._mountIndex)},setTextContent:function(e){s(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,r){var i=this._rootNodeID+t,s=e.mountComponent(i,r,this._mountDepth+1);e._mountIndex=n,this.createChild(e,s),this._renderedChildren=this._renderedChildren||{},this._renderedChildren[t]=e},_unmountChildByName:function(e,t){this.removeChild(e),e._mountIndex=null,e.unmountComponent(),delete this._renderedChildren[t]}}};t.exports=m},{"./ReactComponent":37,"./ReactMultiChildUpdateTypes":70,"./flattenChildren":121,"./instantiateReactComponent":136,"./shouldUpdateReactComponent":151}],70:[function(e,t){"use strict";var n=e("./keyMirror"),r=n({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,TEXT_CONTENT:null});t.exports=r},{"./keyMirror":143}],71:[function(e,t){"use strict";function n(e,t,n){var r=o[e];return null==r?(i(s),new s(e,t)):n===e?(i(s),new s(e,t)):new r.type(t)}var r=e("./Object.assign"),i=e("./invariant"),s=null,o={},u={injectGenericComponentClass:function(e){s=e},injectComponentClasses:function(e){r(o,e)}},a={createInstanceForTag:n,injection:u};t.exports=a},{"./Object.assign":29,"./invariant":137}],72:[function(e,t){"use strict";var n=e("./emptyObject"),r=e("./invariant"),i={isValidOwner:function(e){return!!e&&"function"==typeof e.attachRef&&"function"==typeof e.detachRef},addComponentAsRefTo:function(e,t,n){r(i.isValidOwner(n)),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){r(i.isValidOwner(n)),n.refs[t]===e&&n.detachRef(t)},Mixin:{construct:function(){this.refs=n},attachRef:function(e,t){r(t.isOwnedBy(this));var i=this.refs===n?this.refs={}:this.refs;i[e]=t},detachRef:function(e){delete this.refs[e]}}};t.exports=i},{"./emptyObject":119,"./invariant":137}],73:[function(e,t){"use strict";function n(e,t,n){return n}var r={enableMeasure:!1,storedMeasure:n,measure:function(e,t,n){return n},injection:{injectMeasure:function(e){r.storedMeasure=e}}};t.exports=r},{}],74:[function(e,t){"use strict";function n(e){return function(t,n,r){t[n]=t.hasOwnProperty(n)?e(t[n],r):r}}function r(e,t){for(var n in t)if(t.hasOwnProperty(n)){var r=f[n];r&&f.hasOwnProperty(n)?r(e,n,t[n]):e.hasOwnProperty(n)||(e[n]=t[n])}return e}var i=e("./Object.assign"),s=e("./emptyFunction"),o=e("./invariant"),u=e("./joinClasses"),a=(e("./warning"),n(function(e,t){return i({},t,e)})),f={children:s,className:n(u),style:a},l={TransferStrategies:f,mergeProps:function(e,t){return r(i({},e),t)},Mixin:{transferPropsTo:function(e){return o(e._owner===this),r(e.props,this.props),e}}};t.exports=l},{"./Object.assign":29,"./emptyFunction":118,"./invariant":137,"./joinClasses":142,"./warning":155}],75:[function(e,t){"use strict";var n={};t.exports=n},{}],76:[function(e,t){"use strict";var n=e("./keyMirror"),r=n({prop:null,context:null,childContext:null});t.exports=r},{"./keyMirror":143}],77:[function(e,t){"use strict";function n(e){function t(t,n,r,i,s){if(i=i||w,null!=n[r])return e(n,r,i,s);var o=g[s];return t?new Error("Required "+o+" `"+r+"` was not specified in "+("`"+i+"`.")):void 0}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function r(e){function t(t,n,r,i){var s=t[n],o=d(s);if(o!==e){var u=g[i],a=v(s);return new Error("Invalid "+u+" `"+n+"` of type `"+a+"` "+("supplied to `"+r+"`, expected `"+e+"`."))}}return n(t)}function i(){return n(b.thatReturns())}function s(e){function t(t,n,r,i){var s=t[n];if(!Array.isArray(s)){var o=g[i],u=d(s);return new Error("Invalid "+o+" `"+n+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an array."))}for(var a=0;a<s.length;a++){var f=e(s,a,r,i);if(f instanceof Error)return f}}return n(t)}function o(){function e(e,t,n,r){if(!m.isValidElement(e[t])){var i=g[r];return new Error("Invalid "+i+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactElement."))}}return n(e)}function u(e){function t(t,n,r,i){if(!(t[n]instanceof e)){var s=g[i],o=e.name||w;return new Error("Invalid "+s+" `"+n+"` supplied to "+("`"+r+"`, expected instance of `"+o+"`."))}}return n(t)}function a(e){function t(t,n,r,i){for(var s=t[n],o=0;o<e.length;o++)if(s===e[o])return;var u=g[i],a=JSON.stringify(e);return new Error("Invalid "+u+" `"+n+"` of value `"+s+"` "+("supplied to `"+r+"`, expected one of "+a+"."))}return n(t)}function f(e){function t(t,n,r,i){var s=t[n],o=d(s);if("object"!==o){var u=g[i];return new Error("Invalid "+u+" `"+n+"` of type "+("`"+o+"` supplied to `"+r+"`, expected an object."))}for(var a in s)if(s.hasOwnProperty(a)){var f=e(s,a,r,i);if(f instanceof Error)return f}}return n(t)}function l(e){function t(t,n,r,i){for(var s=0;s<e.length;s++){var o=e[s];if(null==o(t,n,r,i))return}var u=g[i];return new Error("Invalid "+u+" `"+n+"` supplied to "+("`"+r+"`."))}return n(t)}function c(){function e(e,t,n,r){if(!p(e[t])){var i=g[r];return new Error("Invalid "+i+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactNode."))}}return n(e)}function h(e){function t(t,n,r,i){var s=t[n],o=d(s);if("object"!==o){var u=g[i];return new Error("Invalid "+u+" `"+n+"` of type `"+o+"` "+("supplied to `"+r+"`, expected `object`."))}for(var a in e){var f=e[a];if(f){var l=f(s,a,r,i);if(l)return l}}}return n(t,"expected `object`")}function p(e){switch(typeof e){case"number":case"string":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(p);if(m.isValidElement(e))return!0;for(var t in e)if(!p(e[t]))return!1;return!0;default:return!1}}function d(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function v(e){var t=d(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}var m=e("./ReactElement"),g=e("./ReactPropTypeLocationNames"),y=e("./deprecated"),b=e("./emptyFunction"),w="<<anonymous>>",E=o(),S=c(),x={array:r("array"),bool:r("boolean"),func:r("function"),number:r("number"),object:r("object"),string:r("string"),any:i(),arrayOf:s,element:E,instanceOf:u,node:S,objectOf:f,oneOf:a,oneOfType:l,shape:h,component:y("React.PropTypes","component","element",this,E),renderable:y("React.PropTypes","renderable","node",this,S)};t.exports=x},{"./ReactElement":56,"./ReactPropTypeLocationNames":75,"./deprecated":117,"./emptyFunction":118}],78:[function(e,t){"use strict";function n(){this.listenersToPut=[]}var r=e("./PooledClass"),i=e("./ReactBrowserEventEmitter"),s=e("./Object.assign");s(n.prototype,{enqueuePutListener:function(e,t,n){this.listenersToPut.push({rootNodeID:e,propKey:t,propValue:n})},putListeners:function(){for(var e=0;e<this.listenersToPut.length;e++){var t=this.listenersToPut[e];i.putListener(t.rootNodeID,t.propKey,t.propValue)}},reset:function(){this.listenersToPut.length=0},destructor:function(){this.reset()}}),r.addPoolingTo(n),t.exports=n},{"./Object.assign":29,"./PooledClass":30,"./ReactBrowserEventEmitter":33}],79:[function(e,t){"use strict";function n(){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=r.getPooled(null),this.putListenerQueue=u.getPooled()}var r=e("./CallbackQueue"),i=e("./PooledClass"),s=e("./ReactBrowserEventEmitter"),o=e("./ReactInputSelection"),u=e("./ReactPutListenerQueue"),a=e("./Transaction"),f=e("./Object.assign"),l={initialize:o.getSelectionInformation,close:o.restoreSelection},c={initialize:function(){var e=s.isEnabled();return s.setEnabled(!1),e},close:function(e){s.setEnabled(e)}},h={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},p={initialize:function(){this.putListenerQueue.reset()},close:function(){this.putListenerQueue.putListeners()}},d=[p,l,c,h],v={getTransactionWrappers:function(){return d},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){r.release(this.reactMountReady),this.reactMountReady=null,u.release(this.putListenerQueue),this.putListenerQueue=null}};f(n.prototype,a.Mixin,v),i.addPoolingTo(n),t.exports=n},{"./CallbackQueue":7,"./Object.assign":29,"./PooledClass":30,"./ReactBrowserEventEmitter":33,"./ReactInputSelection":63,"./ReactPutListenerQueue":78,"./Transaction":104}],80:[function(e,t){"use strict";var n={injectCreateReactRootIndex:function(e){r.createReactRootIndex=e}},r={createReactRootIndex:null,injection:n};t.exports=r},{}],81:[function(e,t){"use strict";function n(e){f(i.isValidElement(e));var t;try{var n=s.createReactRootID();return t=u.getPooled(!1),t.perform(function(){var r=a(e,null),i=r.mountComponent(n,t,0);return o.addChecksumToMarkup(i)},null)}finally{u.release(t)}}function r(e){f(i.isValidElement(e));var t;try{var n=s.createReactRootID();return t=u.getPooled(!0),t.perform(function(){var r=a(e,null);return r.mountComponent(n,t,0)},null)}finally{u.release(t)}}var i=e("./ReactElement"),s=e("./ReactInstanceHandles"),o=e("./ReactMarkupChecksum"),u=e("./ReactServerRenderingTransaction"),a=e("./instantiateReactComponent"),f=e("./invariant");t.exports={renderToString:n,renderToStaticMarkup:r}},{"./ReactElement":56,"./ReactInstanceHandles":64,"./ReactMarkupChecksum":67,"./ReactServerRenderingTransaction":82,"./instantiateReactComponent":136,"./invariant":137}],82:[function(e,t){"use strict";function n(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=i.getPooled(null),this.putListenerQueue=s.getPooled()}var r=e("./PooledClass"),i=e("./CallbackQueue"),s=e("./ReactPutListenerQueue"),o=e("./Transaction"),u=e("./Object.assign"),a=e("./emptyFunction"),f={initialize:function(){this.reactMountReady.reset()},close:a},l={initialize:function(){this.putListenerQueue.reset()},close:a},c=[l,f],h={getTransactionWrappers:function(){return c},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){i.release(this.reactMountReady),this.reactMountReady=null,s.release(this.putListenerQueue),this.putListenerQueue=null}};u(n.prototype,o.Mixin,h),r.addPoolingTo(n),t.exports=n},{"./CallbackQueue":7,"./Object.assign":29,"./PooledClass":30,"./ReactPutListenerQueue":78,"./Transaction":104,"./emptyFunction":118}],83:[function(e,t){"use strict";function n(e,t){var n={};return function(r){n[t]=r,e.setState(n)}}var r={createStateSetter:function(e,t){return function(n,r,i,s,o,u){var a=t.call(e,n,r,i,s,o,u);a&&e.setState(a)}},createStateKeySetter:function(e,t){var r=e.__keySetters||(e.__keySetters={});return r[t]||(r[t]=n(e,t))}};r.Mixin={createStateSetter:function(e){return r.createStateSetter(this,e)},createStateKeySetter:function(e){return r.createStateKeySetter(this,e)}},t.exports=r},{}],84:[function(e,t){"use strict";var n=e("./DOMPropertyOperations"),r=e("./ReactComponent"),i=e("./ReactElement"),s=e("./Object.assign"),o=e("./escapeTextForBrowser"),u=function(){};s(u.prototype,r.Mixin,{mountComponent:function(e,t,i){r.Mixin.mountComponent.call(this,e,t,i);var s=o(this.props);return t.renderToStaticMarkup?s:"<span "+n.createMarkupForID(e)+">"+s+"</span>"},receiveComponent:function(e){var t=e.props;t!==this.props&&(this.props=t,r.BackendIDOperations.updateTextContentByID(this._rootNodeID,t))}});var a=function(e){return new i(u,null,null,null,null,e)};a.type=u,t.exports=a},{"./DOMPropertyOperations":13,"./Object.assign":29,"./ReactComponent":37,"./ReactElement":56,"./escapeTextForBrowser":120}],85:[function(e,t){"use strict";var n=e("./ReactChildren"),r={getChildMapping:function(e){return n.map(e,function(e){return e})},mergeChildMappings:function(e,t){function n(n){return t.hasOwnProperty(n)?t[n]:e[n]}e=e||{},t=t||{};var r={},i=[];for(var s in e)t.hasOwnProperty(s)?i.length&&(r[s]=i,i=[]):i.push(s);var o,u={};for(var a in t){if(r.hasOwnProperty(a))for(o=0;o<r[a].length;o++){var f=r[a][o];u[r[a][o]]=n(f)}u[a]=n(a)}for(o=0;o<i.length;o++)u[i[o]]=n(i[o]);return u}};t.exports=r},{"./ReactChildren":36}],86:[function(e,t){"use strict";function n(){var e=document.createElement("div"),t=e.style;"AnimationEvent"in window||delete o.animationend.animation,"TransitionEvent"in window||delete o.transitionend.transition;for(var n in o){var r=o[n];for(var i in r)if(i in t){u.push(r[i]);break}}}function r(e,t,n){e.addEventListener(t,n,!1)}function i(e,t,n){e.removeEventListener(t,n,!1)}var s=e("./ExecutionEnvironment"),o={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},u=[];s.canUseDOM&&n();var a={addEndEventListener:function(e,t){return 0===u.length?void window.setTimeout(t,0):void u.forEach(function(n){r(e,n,t)})},removeEndEventListener:function(e,t){0!==u.length&&u.forEach(function(n){i(e,n,t)})}};t.exports=a},{"./ExecutionEnvironment":23}],87:[function(e,t){"use strict";var n=e("./React"),r=e("./ReactTransitionChildMapping"),i=e("./Object.assign"),s=e("./cloneWithProps"),o=e("./emptyFunction"),u=n.createClass({displayName:"ReactTransitionGroup",propTypes:{component:n.PropTypes.any,childFactory:n.PropTypes.func},getDefaultProps:function(){return{component:"span",childFactory:o.thatReturnsArgument}},getInitialState:function(){return{children:r.getChildMapping(this.props.children)}},componentWillReceiveProps:function(e){var t=r.getChildMapping(e.children),n=this.state.children;this.setState({children:r.mergeChildMappings(n,t)});var i;for(i in t){var s=n&&n.hasOwnProperty(i);!t[i]||s||this.currentlyTransitioningKeys[i]||this.keysToEnter.push(i)}for(i in n){var o=t&&t.hasOwnProperty(i);!n[i]||o||this.currentlyTransitioningKeys[i]||this.keysToLeave.push(i)}},componentWillMount:function(){this.currentlyTransitioningKeys={},this.keysToEnter=[],this.keysToLeave=[]},componentDidUpdate:function(){var e=this.keysToEnter;this.keysToEnter=[],e.forEach(this.performEnter);var t=this.keysToLeave;this.keysToLeave=[],t.forEach(this.performLeave)},performEnter:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)},_handleDoneEntering:function(e){var t=this.refs[e];t.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e];var n=r.getChildMapping(this.props.children);n&&n.hasOwnProperty(e)||this.performLeave(e)},performLeave:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillLeave?t.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)},_handleDoneLeaving:function(e){var t=this.refs[e];t.componentDidLeave&&t.componentDidLeave(),delete this.currentlyTransitioningKeys[e];var n=r.getChildMapping(this.props.children);if(n&&n.hasOwnProperty(e))this.performEnter(e);else{var s=i({},this.state.children);delete s[e],this.setState({children:s})}},render:function(){var e={};for(var t in this.state.children){var r=this.state.children[t];r&&(e[t]=s(this.props.childFactory(r),{ref:t}))}return n.createElement(this.props.component,this.props,e)}});t.exports=u},{"./Object.assign":29,"./React":31,"./ReactTransitionChildMapping":85,"./cloneWithProps":110,"./emptyFunction":118}],88:[function(e,t){"use strict";function n(){d(T.ReactReconcileTransaction&&y)}function r(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=f.getPooled(),this.reconcileTransaction=T.ReactReconcileTransaction.getPooled()}function i(e,t,r){n(),y.batchedUpdates(e,t,r)}function s(e,t){return e._mountDepth-t._mountDepth}function o(e){var t=e.dirtyComponentsLength;d(t===v.length),v.sort(s);for(var n=0;t>n;n++){var r=v[n];if(r.isMounted()){var i=r._pendingCallbacks;if(r._pendingCallbacks=null,r.performUpdateIfNecessary(e.reconcileTransaction),i)for(var o=0;o<i.length;o++)e.callbackQueue.enqueue(i[o],r)}}}function u(e,t){return d(!t||"function"==typeof t),n(),y.isBatchingUpdates?(v.push(e),void (t&&(e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t]))):void y.batchedUpdates(u,e,t)}function a(e,t){d(y.isBatchingUpdates),m.enqueue(e,t),g=!0}var f=e("./CallbackQueue"),l=e("./PooledClass"),c=(e("./ReactCurrentOwner"),e("./ReactPerf")),h=e("./Transaction"),p=e("./Object.assign"),d=e("./invariant"),v=(e("./warning"),[]),m=f.getPooled(),g=!1,y=null,b={initialize:function(){this.dirtyComponentsLength=v.length},close:function(){this.dirtyComponentsLength!==v.length?(v.splice(0,this.dirtyComponentsLength),S()):v.length=0}},w={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},E=[b,w];p(r.prototype,h.Mixin,{getTransactionWrappers:function(){return E},destructor:function(){this.dirtyComponentsLength=null,f.release(this.callbackQueue),this.callbackQueue=null,T.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return h.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),l.addPoolingTo(r);var S=c.measure("ReactUpdates","flushBatchedUpdates",function(){for(;v.length||g;){if(v.length){var e=r.getPooled();e.perform(o,null,e),r.release(e)}if(g){g=!1;var t=m;m=f.getPooled(),t.notifyAll(),f.release(t)}}}),x={injectReconcileTransaction:function(e){d(e),T.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){d(e),d("function"==typeof e.batchedUpdates),d("boolean"==typeof e.isBatchingUpdates),y=e}},T={ReactReconcileTransaction:null,batchedUpdates:i,enqueueUpdate:u,flushBatchedUpdates:S,injection:x,asap:a};t.exports=T},{"./CallbackQueue":7,"./Object.assign":29,"./PooledClass":30,"./ReactCurrentOwner":42,"./ReactPerf":73,"./Transaction":104,"./invariant":137,"./warning":155}],89:[function(e,t){"use strict";var n=e("./DOMProperty"),r=n.injection.MUST_USE_ATTRIBUTE,i={Properties:{cx:r,cy:r,d:r,dx:r,dy:r,fill:r,fillOpacity:r,fontFamily:r,fontSize:r,fx:r,fy:r,gradientTransform:r,gradientUnits:r,markerEnd:r,markerMid:r,markerStart:r,offset:r,opacity:r,patternContentUnits:r,patternUnits:r,points:r,preserveAspectRatio:r,r:r,rx:r,ry:r,spreadMethod:r,stopColor:r,stopOpacity:r,stroke:r,strokeDasharray:r,strokeLinecap:r,strokeOpacity:r,strokeWidth:r,textAnchor:r,transform:r,version:r,viewBox:r,x1:r,x2:r,x:r,y1:r,y2:r,y:r},DOMAttributeNames:{fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox"}};t.exports=i},{"./DOMProperty":12}],90:[function(e,t){"use strict";function n(e){if("selectionStart"in e&&o.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function r(e){if(!g&&null!=d&&d==a()){var t=n(d);if(!m||!c(m,t)){m=t;var r=u.getPooled(p.select,v,e);return r.type="select",r.target=d,s.accumulateTwoPhaseDispatches(r),r}}}var i=e("./EventConstants"),s=e("./EventPropagators"),o=e("./ReactInputSelection"),u=e("./SyntheticEvent"),a=e("./getActiveElement"),f=e("./isTextInputElement"),l=e("./keyOf"),c=e("./shallowEqual"),h=i.topLevelTypes,p={select:{phasedRegistrationNames:{bubbled:l({onSelect:null}),captured:l({onSelectCapture:null})},dependencies:[h.topBlur,h.topContextMenu,h.topFocus,h.topKeyDown,h.topMouseDown,h.topMouseUp,h.topSelectionChange]}},d=null,v=null,m=null,g=!1,y={eventTypes:p,extractEvents:function(e,t,n,i){switch(e){case h.topFocus:(f(t)||"true"===t.contentEditable)&&(d=t,v=n,m=null);break;case h.topBlur:d=null,v=null,m=null;break;case h.topMouseDown:g=!0;break;case h.topContextMenu:case h.topMouseUp:return g=!1,r(i);case h.topSelectionChange:case h.topKeyDown:case h.topKeyUp:return r(i)}}};t.exports=y},{"./EventConstants":17,"./EventPropagators":22,"./ReactInputSelection":63,"./SyntheticEvent":96,"./getActiveElement":124,"./isTextInputElement":140,"./keyOf":144,"./shallowEqual":150}],91:[function(e,t){"use strict";var n=Math.pow(2,53),r={createReactRootIndex:function(){return Math.ceil(Math.random()*n)}};t.exports=r},{}],92:[function(e,t){"use strict";var n=e("./EventConstants"),r=e("./EventPluginUtils"),i=e("./EventPropagators"),s=e("./SyntheticClipboardEvent"),o=e("./SyntheticEvent"),u=e("./SyntheticFocusEvent"),a=e("./SyntheticKeyboardEvent"),f=e("./SyntheticMouseEvent"),l=e("./SyntheticDragEvent"),c=e("./SyntheticTouchEvent"),h=e("./SyntheticUIEvent"),p=e("./SyntheticWheelEvent"),d=e("./getEventCharCode"),v=e("./invariant"),m=e("./keyOf"),g=(e("./warning"),n.topLevelTypes),y={blur:{phasedRegistrationNames:{bubbled:m({onBlur:!0}),captured:m({onBlurCapture:!0})}},click:{phasedRegistrationNames:{bubbled:m({onClick:!0}),captured:m({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:m({onContextMenu:!0}),captured:m({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:m({onCopy:!0}),captured:m({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:m({onCut:!0}),captured:m({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:m({onDoubleClick:!0}),captured:m({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:m({onDrag:!0}),captured:m({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:m({onDragEnd:!0}),captured:m({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:m({onDragEnter:!0}),captured:m({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:m({onDragExit:!0}),captured:m({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:m({onDragLeave:!0}),captured:m({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:m({onDragOver:!0}),captured:m({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:m({onDragStart:!0}),captured:m({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:m({onDrop:!0}),captured:m({onDropCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:m({onFocus:!0}),captured:m({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:m({onInput:!0}),captured:m({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:m({onKeyDown:!0}),captured:m({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:m({onKeyPress:!0}),captured:m({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:m({onKeyUp:!0}),captured:m({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:m({onLoad:!0}),captured:m({onLoadCapture:!0})}},error:{phasedRegistrationNames:{bubbled:m({onError:!0}),captured:m({onErrorCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:m({onMouseDown:!0}),captured:m({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:m({onMouseMove:!0}),captured:m({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:m({onMouseOut:!0}),captured:m({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:m({onMouseOver:!0}),captured:m({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:m({onMouseUp:!0}),captured:m({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:m({onPaste:!0}),captured:m({onPasteCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:m({onReset:!0}),captured:m({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:m({onScroll:!0}),captured:m({onScrollCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:m({onSubmit:!0}),captured:m({onSubmitCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:m({onTouchCancel:!0}),captured:m({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:m({onTouchEnd:!0}),captured:m({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:m({onTouchMove:!0}),captured:m({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:m({onTouchStart:!0}),captured:m({onTouchStartCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:m({onWheel:!0}),captured:m({onWheelCapture:!0})}}},b={topBlur:y.blur,topClick:y.click,topContextMenu:y.contextMenu,topCopy:y.copy,topCut:y.cut,topDoubleClick:y.doubleClick,topDrag:y.drag,topDragEnd:y.dragEnd,topDragEnter:y.dragEnter,topDragExit:y.dragExit,topDragLeave:y.dragLeave,topDragOver:y.dragOver,topDragStart:y.dragStart,topDrop:y.drop,topError:y.error,topFocus:y.focus,topInput:y.input,topKeyDown:y.keyDown,topKeyPress:y.keyPress,topKeyUp:y.keyUp,topLoad:y.load,topMouseDown:y.mouseDown,topMouseMove:y.mouseMove,topMouseOut:y.mouseOut,topMouseOver:y.mouseOver,topMouseUp:y.mouseUp,topPaste:y.paste,topReset:y.reset,topScroll:y.scroll,topSubmit:y.submit,topTouchCancel:y.touchCancel,topTouchEnd:y.touchEnd,topTouchMove:y.touchMove,topTouchStart:y.touchStart,topWheel:y.wheel};for(var w in b)b[w].dependencies=[w];var E={eventTypes:y,executeDispatch:function(e,t,n){var i=r.executeDispatch(e,t,n);i===!1&&(e.stopPropagation(),e.preventDefault())},extractEvents:function(e,t,n,r){var m=b[e];if(!m)return null;var y;switch(e){case g.topInput:case g.topLoad:case g.topError:case g.topReset:case g.topSubmit:y=o;break;case g.topKeyPress:if(0===d(r))return null;case g.topKeyDown:case g.topKeyUp:y=a;break;case g.topBlur:case g.topFocus:y=u;break;case g.topClick:if(2===r.button)return null;case g.topContextMenu:case g.topDoubleClick:case g.topMouseDown:case g.topMouseMove:case g.topMouseOut:case g.topMouseOver:case g.topMouseUp:y=f;break;case g.topDrag:case g.topDragEnd:case g.topDragEnter:case g.topDragExit:case g.topDragLeave:case g.topDragOver:case g.topDragStart:case g.topDrop:y=l;break;case g.topTouchCancel:case g.topTouchEnd:case g.topTouchMove:case g.topTouchStart:y=c;break;case g.topScroll:y=h;break;case g.topWheel:y=p;break;case g.topCopy:case g.topCut:case g.topPaste:y=s}v(y);var w=y.getPooled(m,n,r);return i.accumulateTwoPhaseDispatches(w),w}};t.exports=E},{"./EventConstants":17,"./EventPluginUtils":21,"./EventPropagators":22,"./SyntheticClipboardEvent":93,"./SyntheticDragEvent":95,"./SyntheticEvent":96,"./SyntheticFocusEvent":97,"./SyntheticKeyboardEvent":99,"./SyntheticMouseEvent":100,"./SyntheticTouchEvent":101,"./SyntheticUIEvent":102,"./SyntheticWheelEvent":103,"./getEventCharCode":125,"./invariant":137,"./keyOf":144,"./warning":155}],93:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticEvent"),i={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};r.augmentClass(n,i),t.exports=n},{"./SyntheticEvent":96}],94:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticEvent"),i={data:null};r.augmentClass(n,i),t.exports=n},{"./SyntheticEvent":96}],95:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticMouseEvent"),i={dataTransfer:null};r.augmentClass(n,i),t.exports=n},{"./SyntheticMouseEvent":100}],96:[function(e,t){"use strict";function n(e,t,n){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var r=this.constructor.Interface;for(var i in r)if(r.hasOwnProperty(i)){var o=r[i];this[i]=o?o(n):n[i]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;this.isDefaultPrevented=u?s.thatReturnsTrue:s.thatReturnsFalse,this.isPropagationStopped=s.thatReturnsFalse}var r=e("./PooledClass"),i=e("./Object.assign"),s=e("./emptyFunction"),o=e("./getEventTarget"),u={type:null,target:o,currentTarget:s.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=s.thatReturnsTrue},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=s.thatReturnsTrue},persist:function(){this.isPersistent=s.thatReturnsTrue},isPersistent:s.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),n.Interface=u,n.augmentClass=function(e,t){var n=this,s=Object.create(n.prototype);i(s,e.prototype),e.prototype=s,e.prototype.constructor=e,e.Interface=i({},n.Interface,t),e.augmentClass=n.augmentClass,r.addPoolingTo(e,r.threeArgumentPooler)},r.addPoolingTo(n,r.threeArgumentPooler),t.exports=n},{"./Object.assign":29,"./PooledClass":30,"./emptyFunction":118,"./getEventTarget":128}],97:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticUIEvent"),i={relatedTarget:null};r.augmentClass(n,i),t.exports=n},{"./SyntheticUIEvent":102}],98:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticEvent"),i={data:null};r.augmentClass(n,i),t.exports=n},{"./SyntheticEvent":96}],99:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticUIEvent"),i=e("./getEventCharCode"),s=e("./getEventKey"),o=e("./getEventModifierState"),u={key:s,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:o,charCode:function(e){return"keypress"===e.type?i(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?i(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};r.augmentClass(n,u),t.exports=n},{"./SyntheticUIEvent":102,"./getEventCharCode":125,"./getEventKey":126,"./getEventModifierState":127}],100:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticUIEvent"),i=e("./ViewportMetrics"),s=e("./getEventModifierState"),o={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:s,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+i.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+i.currentScrollTop}};r.augmentClass(n,o),t.exports=n},{"./SyntheticUIEvent":102,"./ViewportMetrics":105,"./getEventModifierState":127}],101:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticUIEvent"),i=e("./getEventModifierState"),s={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:i};r.augmentClass(n,s),t.exports=n},{"./SyntheticUIEvent":102,"./getEventModifierState":127}],102:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticEvent"),i=e("./getEventTarget"),s={view:function(e){if(e.view)return e.view;var t=i(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};r.augmentClass(n,s),t.exports=n},{"./SyntheticEvent":96,"./getEventTarget":128}],103:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticMouseEvent"),i={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};r.augmentClass(n,i),t.exports=n},{"./SyntheticMouseEvent":100}],104:[function(e,t){"use strict";var n=e("./invariant"),r={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,r,i,s,o,u,a){n(!this.isInTransaction());var f,l;try{this._isInTransaction=!0,f=!0,this.initializeAll(0),l=e.call(t,r,i,s,o,u,a),f=!1}finally{try{if(f)try{this.closeAll(0)}catch(c){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return l},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=i.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===i.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(s){}}}},closeAll:function(e){n(this.isInTransaction());for(var t=this.transactionWrappers,r=e;r<t.length;r++){var s,u=t[r],a=this.wrapperInitData[r];try{s=!0,a!==i.OBSERVED_ERROR&&u.close&&u.close.call(this,a),s=!1}finally{if(s)try{this.closeAll(r+1)}catch(f){}}}this.wrapperInitData.length=0}},i={Mixin:r,OBSERVED_ERROR:{}};t.exports=i},{"./invariant":137}],105:[function(e,t){"use strict";var n=e("./getUnboundedScrollPosition"),r={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(){var e=n(window);r.currentScrollLeft=e.x,r.currentScrollTop=e.y}};t.exports=r},{"./getUnboundedScrollPosition":133}],106:[function(e,t){"use strict";function n(e,t){if(r(null!=t),null==e)return t;var n=Array.isArray(e),i=Array.isArray(t);return n&&i?(e.push.apply(e,t),e):n?(e.push(t),e):i?[e].concat(t):[e,t]}var r=e("./invariant");t.exports=n},{"./invariant":137}],107:[function(e,t){"use strict";function n(e){for(var t=1,n=0,i=0;i<e.length;i++)t=(t+e.charCodeAt(i))%r,n=(n+t)%r;return t|n<<16}var r=65521;t.exports=n},{}],108:[function(e,t){function n(e){return e.replace(r,function(e,t){return t.toUpperCase()})}var r=/-(.)/g;t.exports=n},{}],109:[function(e,t){"use strict";function n(e){return r(e.replace(i,"ms-"))}var r=e("./camelize"),i=/^-ms-/;t.exports=n},{"./camelize":108}],110:[function(e,t){"use strict";function n(e,t){var n=i.mergeProps(t,e.props);return!n.hasOwnProperty(o)&&e.props.hasOwnProperty(o)&&(n.children=e.props.children),r.createElement(e.type,n)}var r=e("./ReactElement"),i=e("./ReactPropTransferer"),s=e("./keyOf"),o=(e("./warning"),s({children:null}));t.exports=n},{"./ReactElement":56,"./ReactPropTransferer":74,"./keyOf":144,"./warning":155}],111:[function(e,t){function n(e,t){return e&&t?e===t?!0:r(e)?!1:r(t)?n(e,t.parentNode):e.contains?e.contains(t):e.compareDocumentPosition?!!(16&e.compareDocumentPosition(t)):!1:!1}var r=e("./isTextNode");t.exports=n},{"./isTextNode":141}],112:[function(e,t){function n(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function r(e){return n(e)?Array.isArray(e)?e.slice():i(e):[e]}var i=e("./toArray");t.exports=r},{"./toArray":152}],113:[function(e,t){"use strict";function n(e){var t=i.createFactory(e),n=r.createClass({displayName:"ReactFullPageComponent"+e,componentWillUnmount:function(){s(!1)},render:function(){return t(this.props)}});return n}var r=e("./ReactCompositeComponent"),i=e("./ReactElement"),s=e("./invariant");t.exports=n},{"./ReactCompositeComponent":40,"./ReactElement":56,"./invariant":137}],114:[function(e,t){function n(e){var t=e.match(f);return t&&t[1].toLowerCase()}function r(e,t){var r=a;u(!!a);var i=n(e),f=i&&o(i);if(f){r.innerHTML=f[1]+e+f[2];for(var l=f[0];l--;)r=r.lastChild}else r.innerHTML=e;var c=r.getElementsByTagName("script");c.length&&(u(t),s(c).forEach(t));for(var h=s(r.childNodes);r.lastChild;)r.removeChild(r.lastChild);return h}var i=e("./ExecutionEnvironment"),s=e("./createArrayFrom"),o=e("./getMarkupWrap"),u=e("./invariant"),a=i.canUseDOM?document.createElement("div"):null,f=/^\s*<(\w+)/;t.exports=r},{"./ExecutionEnvironment":23,"./createArrayFrom":112,"./getMarkupWrap":129,"./invariant":137}],115:[function(e,t){function n(e){return"object"==typeof e?Object.keys(e).filter(function(t){return e[t]}).join(" "):Array.prototype.join.call(arguments," ")}t.exports=n},{}],116:[function(e,t){"use strict";function n(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||i.hasOwnProperty(e)&&i[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var r=e("./CSSProperty"),i=r.isUnitlessNumber;t.exports=n},{"./CSSProperty":5}],117:[function(e,t){function n(e,t,n,r,i){return i}e("./Object.assign"),e("./warning"),t.exports=n},{"./Object.assign":29,"./warning":155}],118:[function(e,t){function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},t.exports=r},{}],119:[function(e,t){"use strict";var n={};t.exports=n},{}],120:[function(e,t){"use strict";function n(e){return i[e]}function r(e){return(""+e).replace(s,n)}var i={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},s=/[&><"']/g;t.exports=r},{}],121:[function(e,t){"use strict";function n(e,t,n){var r=e,s=!r.hasOwnProperty(n);if(s&&null!=t){var u,a=typeof t;u="string"===a?i(t):"number"===a?i(""+t):t,r[n]=u}}function r(e){if(null==e)return e;var t={};return s(e,n,t),t}var i=e("./ReactTextComponent"),s=e("./traverseAllChildren");e("./warning"),t.exports=r},{"./ReactTextComponent":84,"./traverseAllChildren":153,"./warning":155}],122:[function(e,t){"use strict";function n(e){try{e.focus()}catch(t){}}t.exports=n},{}],123:[function(e,t){"use strict";var n=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=n},{}],124:[function(e,t){function n(){try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=n},{}],125:[function(e,t){"use strict";function n(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=n},{}],126:[function(e,t){"use strict";function n(e){if(e.key){var t=i[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=r(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?s[e.keyCode]||"Unidentified":""}var r=e("./getEventCharCode"),i={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},s={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=n},{"./getEventCharCode":125}],127:[function(e,t){"use strict";function n(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=i[e];return r?!!n[r]:!1}function r(){return n}var i={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=r},{}],128:[function(e,t){"use strict";function n(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}t.exports=n},{}],129:[function(e,t){function n(e){return i(!!s),c.hasOwnProperty(e)||(e="*"),o.hasOwnProperty(e)||(s.innerHTML="*"===e?"<link />":"<"+e+"></"+e+">",o[e]=!s.firstChild),o[e]?c[e]:null}var r=e("./ExecutionEnvironment"),i=e("./invariant"),s=r.canUseDOM?document.createElement("div"):null,o={circle:!0,defs:!0,ellipse:!0,g:!0,line:!0,linearGradient:!0,path:!0,polygon:!0,polyline:!0,radialGradient:!0,rect:!0,stop:!0,text:!0},u=[1,'<select multiple="true">',"</select>"],a=[1,"<table>","</table>"],f=[3,"<table><tbody><tr>","</tr></tbody></table>"],l=[1,"<svg>","</svg>"],c={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:u,option:u,caption:a,colgroup:a,tbody:a,tfoot:a,thead:a,td:f,th:f,circle:l,defs:l,ellipse:l,g:l,line:l,linearGradient:l,path:l,polygon:l,polyline:l,radialGradient:l,rect:l,stop:l,text:l};t.exports=n},{"./ExecutionEnvironment":23,"./invariant":137}],130:[function(e,t){"use strict";function n(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function r(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function i(e,t){for(var i=n(e),s=0,o=0;i;){if(3==i.nodeType){if(o=s+i.textContent.length,t>=s&&o>=t)return{node:i,offset:t-s};s=o}i=n(r(i))}}t.exports=i},{}],131:[function(e,t){"use strict";function n(e){return e?e.nodeType===r?e.documentElement:e.firstChild:null}var r=9;t.exports=n},{}],132:[function(e,t){"use strict";function n(){return!i&&r.canUseDOM&&(i="textContent"in document.documentElement?"textContent":"innerText"),i}var r=e("./ExecutionEnvironment"),i=null;t.exports=n},{"./ExecutionEnvironment":23}],133:[function(e,t){"use strict";function n(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=n},{}],134:[function(e,t){function n(e){return e.replace(r,"-$1").toLowerCase()}var r=/([A-Z])/g;t.exports=n},{}],135:[function(e,t){"use strict";function n(e){return r(e).replace(i,"-ms-")}var r=e("./hyphenate"),i=/^ms-/;t.exports=n},{"./hyphenate":134}],136:[function(e,t){"use strict";function n(e,t){var n;return n="string"==typeof e.type?r.createInstanceForTag(e.type,e.props,t):new e.type(e.props),n.construct(e),n}var r=(e("./warning"),e("./ReactElement"),e("./ReactLegacyElement"),e("./ReactNativeComponent"));e("./ReactEmptyComponent"),t.exports=n},{"./ReactElement":56,"./ReactEmptyComponent":58,"./ReactLegacyElement":65,"./ReactNativeComponent":71,"./warning":155}],137:[function(e,t){"use strict";var n=function(e,t,n,r,i,s,o,u){if(!e){var a;if(void 0===t)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,i,s,o,u],l=0;a=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return f[l++]}))}throw a.framesToPop=1,a}};t.exports=n},{}],138:[function(e,t){"use strict";function n(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,s=n in document;if(!s){var u=document.createElement("div");u.setAttribute(n,"return;"),s="function"==typeof u[n]}return!s&&r&&"wheel"===e&&(s=document.implementation.hasFeature("Events.wheel","3.0")),s}var r,i=e("./ExecutionEnvironment");i.canUseDOM&&(r=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=n},{"./ExecutionEnvironment":23}],139:[function(e,t){function n(e){return!!e&&("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName)}t.exports=n},{}],140:[function(e,t){"use strict";function n(e){return e&&("INPUT"===e.nodeName&&r[e.type]||"TEXTAREA"===e.nodeName)}var r={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=n},{}],141:[function(e,t){function n(e){return r(e)&&3==e.nodeType}var r=e("./isNode");t.exports=n},{"./isNode":139}],142:[function(e,t){"use strict";function n(e){e||(e="");var t,n=arguments.length;if(n>1)for(var r=1;n>r;r++)t=arguments[r],t&&(e=(e?e+" ":"")+t);return e}t.exports=n},{}],143:[function(e,t){"use strict";var n=e("./invariant"),r=function(e){var t,r={};n(e instanceof Object&&!Array.isArray(e));for(t in e)e.hasOwnProperty(t)&&(r[t]=t);return r};t.exports=r},{"./invariant":137}],144:[function(e,t){var n=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=n},{}],145:[function(e,t){"use strict";function n(e,t,n){if(!e)return null;var i={};for(var s in e)r.call(e,s)&&(i[s]=t.call(n,e[s],s,e));return i}var r=Object.prototype.hasOwnProperty;t.exports=n},{}],146:[function(e,t){"use strict";function n(e){var t={};return function(n){return t.hasOwnProperty(n)?t[n]:t[n]=e.call(this,n)}}t.exports=n},{}],147:[function(e,t){"use strict";function n(e){r(e&&!/[^a-z0-9_]/.test(e))}var r=e("./invariant");t.exports=n},{"./invariant":137}],148:[function(e,t){"use strict";function n(e){return i(r.isValidElement(e)),e}var r=e("./ReactElement"),i=e("./invariant");t.exports=n},{"./ReactElement":56,"./invariant":137}],149:[function(e,t){"use strict";var n=e("./ExecutionEnvironment"),r=/^[ \r\n\t\f]/,i=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,s=function(e,t){e.innerHTML=t};if(n.canUseDOM){var o=document.createElement("div");o.innerHTML=" ",""===o.innerHTML&&(s=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),r.test(t)||"<"===t[0]&&i.test(t)){e.innerHTML=""+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=s},{"./ExecutionEnvironment":23}],150:[function(e,t){"use strict";function n(e,t){if(e===t)return!0;var n;for(n in e)if(e.hasOwnProperty(n)&&(!t.hasOwnProperty(n)||e[n]!==t[n]))return!1;for(n in t)if(t.hasOwnProperty(n)&&!e.hasOwnProperty(n))return!1;return!0}t.exports=n},{}],151:[function(e,t){"use strict";function n(e,t){return e&&t&&e.type===t.type&&e.key===t.key&&e._owner===t._owner?!0:!1}t.exports=n},{}],152:[function(e,t){function n(e){var t=e.length;if(r(!Array.isArray(e)&&("object"==typeof e||"function"==typeof e)),r("number"==typeof t),r(0===t||t-1 in e),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var i=Array(t),s=0;t>s;s++)i[s]=e[s];return i}var r=e("./invariant");t.exports=n},{"./invariant":137}],153:[function(e,t){"use strict";function n(e){return h[e]}function r(e,t){return e&&null!=e.key?s(e.key):t.toString(36)}function i(e){return(""+e).replace(p,n)}function s(e){return"$"+i(e)}function o(e,t,n){return null==e?0:d(e,"",0,t,n)}var u=e("./ReactElement"),a=e("./ReactInstanceHandles"),f=e("./invariant"),l=a.SEPARATOR,c=":",h={"=":"=0",".":"=1",":":"=2"},p=/[=.:]/g,d=function(e,t,n,i,o){var a,h,p=0;if(Array.isArray(e))for(var v=0;v<e.length;v++){var m=e[v];a=t+(t?c:l)+r(m,v),h=n+p,p+=d(m,a,h,i,o)}else{var g=typeof e,y=""===t,b=y?l+r(e,0):t;if(null==e||"boolean"===g)i(o,null,b,n),p=1;else if("string"===g||"number"===g||u.isValidElement(e))i(o,e,b,n),p=1;else if("object"===g){f(!e||1!==e.nodeType);for(var w in e)e.hasOwnProperty(w)&&(a=t+(t?c:l)+s(w)+c+r(e[w],0),h=n+p,p+=d(e[w],a,h,i,o))}}return p};t.exports=o},{"./ReactElement":56,"./ReactInstanceHandles":64,"./invariant":137}],154:[function(e,t){"use strict";function n(e){return Array.isArray(e)?e.concat():e&&"object"==typeof e?s(new e.constructor,e):e}function r(e,t,n){u(Array.isArray(e));var r=t[n];u(Array.isArray(r))}function i(e,t){if(u("object"==typeof t),t.hasOwnProperty(c))return u(1===Object.keys(t).length),t[c];var o=n(e);if(t.hasOwnProperty(h)){var d=t[h];u(d&&"object"==typeof d),u(o&&"object"==typeof o),s(o,t[h])}t.hasOwnProperty(a)&&(r(e,t,a),t[a].forEach(function(e){o.push(e)})),t.hasOwnProperty(f)&&(r(e,t,f),t[f].forEach(function(e){o.unshift(e)})),t.hasOwnProperty(l)&&(u(Array.isArray(e)),u(Array.isArray(t[l])),t[l].forEach(function(e){u(Array.isArray(e)),o.splice.apply(o,e)})),t.hasOwnProperty(p)&&(u("function"==typeof t[p]),o=t[p](o));for(var g in t)v.hasOwnProperty(g)&&v[g]||(o[g]=i(e[g],t[g]));return o}var s=e("./Object.assign"),o=e("./keyOf"),u=e("./invariant"),a=o({$push:null}),f=o({$unshift:null}),l=o({$splice:null}),c=o({$set:null}),h=o({$merge:null}),p=o({$apply:null}),d=[a,f,l,c,h,p],v={};d.forEach(function(e){v[e]=!0}),t.exports=i},{"./Object.assign":29,"./invariant":137,"./keyOf":144}],155:[function(e,t){"use strict";var n=e("./emptyFunction"),r=n;t.exports=r},{"./emptyFunction":118}]},{},[1])(1)}),!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define("bluebird",[],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.Promise=e()}}(function(){var define,module,exports;return function e(t,n,r){function i(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(s)return s(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var s=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){"use strict";t.exports=function(e){function n(e){var n=new t(e),r=n.promise();return n.setHowMany(1),n.setUnwrap(),n.init(),r}var t=e._SomePromiseArray;e.any=function(e){return n(e)},e.prototype.any=function(){return n(this)}}},{}],2:[function(e,t,n){"use strict";function a(){this._isTickUsed=!1,this._lateQueue=new o(16),this._normalQueue=new o(16),this._trampolineEnabled=!0;var e=this;this.drainQueues=function(){e._drainQueues()},this._schedule=s.isStatic?s(this.drainQueues):s}function p(e,t,n){var r=this._getDomain();r!==undefined&&(e=r.bind(e)),this._lateQueue.push(e,t,n),this._queueTick()}function d(e,t,n){var r=this._getDomain();r!==undefined&&(e=r.bind(e)),this._normalQueue.push(e,t,n),this._queueTick()}function v(e){var t=this._getDomain();if(t!==undefined){var n=t.bind(e._settlePromises);this._normalQueue.push(n,e,undefined)}else this._normalQueue._pushOne(e);this._queueTick()}var r;try{throw new Error}catch(i){r=i}var s=e("./schedule.js"),o=e("./queue.js"),u=e("./util.js");a.prototype.disableTrampolineIfNecessary=function(){u.hasDevTools&&(this._trampolineEnabled=!1)},a.prototype.enableTrampoline=function(){this._trampolineEnabled||(this._trampolineEnabled=!0,this._schedule=function(e){setTimeout(e,0)})},a.prototype.haveItemsQueued=function(){return this._normalQueue.length()>0},a.prototype.throwLater=function(e,t){arguments.length===1&&(t=e,e=function(){throw t});var n=this._getDomain();n!==undefined&&(e=n.bind(e));if(typeof setTimeout!="undefined")setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch(r){throw new Error("No async scheduler available\n\n    See http://goo.gl/m3OTXk\n")}},a.prototype._getDomain=function(){},u.hasDevTools?(a.prototype.invokeLater=function(e,t,n){this._trampolineEnabled?p.call(this,e,t,n):setTimeout(function(){e.call(t,n)},100)},a.prototype.invoke=function(e,t,n){this._trampolineEnabled?d.call(this,e,t,n):setTimeout(function(){e.call(t,n)},0)},a.prototype.settlePromises=function(e){this._trampolineEnabled?v.call(this,e):setTimeout(function(){e._settlePromises()},0)}):(a.prototype.invokeLater=p,a.prototype.invoke=d,a.prototype.settlePromises=v),a.prototype.invokeFirst=function(e,t,n){var r=this._getDomain();r!==undefined&&(e=r.bind(e)),this._normalQueue.unshift(e,t,n),this._queueTick()},a.prototype._drainQueue=function(e){while(e.length()>0){var t=e.shift();if(typeof t!="function"){t._settlePromises();continue}var n=e.shift(),r=e.shift();t.call(n,r)}},a.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._drainQueue(this._lateQueue)},a.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},a.prototype._reset=function(){this._isTickUsed=!1},t.exports=new a,t.exports.firstLineError=r},{"./queue.js":28,"./schedule.js":31,"./util.js":38,events:39}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r=function(e,t){this._reject(t)},i=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(r,r,null,this,e)},s=function(e,t){this._setBoundTo(e),this._isPending()&&this._resolveCallback(t.target)},o=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(r){var u=n(r),a=new e(t);a._propagateFrom(this,1);var f=this._target();if(u instanceof e){var l={promiseRejectionQueued:!1,promise:a,target:f,bindingPromise:u};f._then(t,i,a._progress,a,l),u._then(s,o,a._progress,a,l)}else a._setBoundTo(r),a._resolveCallback(f);return a},e.prototype._setBoundTo=function(e){e!==undefined?(this._bitField=this._bitField|131072,this._boundTo=e):this._bitField=this._bitField&-131073},e.prototype._isBound=function(){return(this._bitField&131072)===131072},e.bind=function(r,i){var s=n(r),o=new e(t);return s instanceof e?s._then(function(e){o._setBoundTo(e),o._resolveCallback(i)},o._reject,o._progress,o,null):(o._setBoundTo(r),o._resolveCallback(i)),o}}},{}],4:[function(e,t,n){"use strict";function i(){try{Promise===s&&(Promise=r)}catch(e){}return s}var r;typeof Promise!="undefined"&&(r=Promise);var s=e("./promise.js")();s.noConflict=i,t.exports=s},{"./promise.js":23}],5:[function(e,t,n){"use strict";var r=Object.create;if(r){var i=r(null),s=r(null);i[" size"]=s[" size"]=0}t.exports=function(t){function h(e,r){var i;e!=null&&(i=e[r]);if(typeof i!="function"){var s="Object "+n.classString(e)+" has no method '"+n.toString(r)+"'";throw new t.TypeError(s)}return i}function p(e){var t=this.pop(),n=h(e,t);return n.apply(e,this)}function d(e){return e[this]}function v(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}var n=e("./util.js"),r=n.canEvaluate,o=n.isIdentifier,u,a;t.prototype.call=function(e){var t=arguments.length,n=new Array(t-1);for(var i=1;i<t;++i)n[i-1]=arguments[i];return n.push(e),this._then(p,undefined,undefined,n,undefined)},t.prototype.get=function(e){var t=typeof e=="number",n;if(!t)if(r){var i=a(e);n=i!==null?i:d}else n=d;else n=v;return this._then(n,undefined,undefined,e,undefined)}}},{"./util.js":38}],6:[function(e,t,n){"use strict";t.exports=function(t){var n=e("./errors.js"),r=e("./async.js"),i=n.CancellationError;t.prototype._cancel=function(e){if(!this.isCancellable())return this;var t,n=this;while((t=n._cancellationParent)!==undefined&&t.isCancellable())n=t;this._unsetCancellable(),n._target()._rejectCallback(e,!1,!0)},t.prototype.cancel=function(e){return this.isCancellable()?(e===undefined&&(e=new i),r.invokeLater(this._cancel,this,e),this):this},t.prototype.cancellable=function(){return this._cancellable()?this:(r.enableTrampoline(),this._setCancellable(),this._cancellationParent=undefined,this)},t.prototype.uncancellable=function(){var e=this.then();return e._unsetCancellable(),e},t.prototype.fork=function(e,t,n){var r=this._then(e,t,n,undefined,undefined);return r._setCancellable(),r._cancellationParent=undefined,r}}},{"./async.js":2,"./errors.js":13}],7:[function(e,t,n){"use strict";t.exports=function(){function a(e){this._parent=e;var t=this._length=1+(e===undefined?0:e._length);b(this,a),t>32&&this.uncycle()}function f(e,t){for(var n=0;n<t.length-1;++n)t[n].push("From previous event:"),t[n]=t[n].join("\n");return n<t.length&&(t[n]=t[n].join("\n")),e+"\n"+t.join("\n")}function l(e){for(var t=0;t<e.length;++t)if(e[t].length===0||t+1<e.length&&e[t][0]===e[t+1][0])e.splice(t,1),t--}function c(e){var t=e[0];for(var n=1;n<e.length;++n){var r=e[n],i=t.length-1,s=t[i],o=-1;for(var u=r.length-1;u>=0;--u)if(r[u]===s){o=u;break}for(var u=o;u>=0;--u){var a=r[u];if(t[i]!==a)break;t.pop(),i--}t=r}}function h(e){var t=[];for(var n=0;n<e.length;++n){var r=e[n],s=i.test(r)||"    (No stack trace)"===r,u=s&&m(r);s&&!u&&(o&&r.charAt(0)!==" "&&(r="    "+r),t.push(r))}return t}function p(e){var t=e.stack.replace(/\s+$/g,"").split("\n");for(var n=0;n<t.length;++n){var r=t[n];if("    (No stack trace)"===r||i.test(r))break}return n>0&&(t=t.slice(n)),t}function d(e){var t;if(typeof e=="function")t="[function "+(e.name||"anonymous")+"]";else{t=e.toString();var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(t))try{var r=JSON.stringify(e);t=r}catch(i){}t.length===0&&(t="(empty array)")}return"(<"+v(t)+">, no stack trace)"}function v(e){var t=41;return e.length<t?e:e.substr(0,t-3)+"..."}function y(e){var t=e.match(g);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}var t=e("./async.js"),n=e("./util.js"),r=/[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/,i=null,s=null,o=!1,u;n.inherits(a,Error),a.prototype.uncycle=function(){var e=this._length;if(e<2)return;var t=[],n={};for(var r=0,i=this;i!==undefined;++r)t.push(i),i=i._parent;e=this._length=r;for(var r=e-1;r>=0;--r){var s=t[r].stack;n[s]===undefined&&(n[s]=r)}for(var r=0;r<e;++r){var o=t[r].stack,u=n[o];if(u!==undefined&&u!==r){u>0&&(t[u-1]._parent=undefined,t[u-1]._length=1),t[r]._parent=undefined,t[r]._length=1;var a=r>0?t[r-1]:this;u<e-1?(a._parent=t[u+1],a._parent.uncycle(),a._length=a._parent._length+1):(a._parent=undefined,a._length=1);var f=a._length+1;for(var l=r-2;l>=0;--l)t[l]._length=f,f++;return}}},a.prototype.parent=function(){return this._parent},a.prototype.hasParent=function(){return this._parent!==undefined},a.prototype.attachExtraTrace=function(e){if(e.__stackCleaned__)return;this.uncycle();var t=a.parseStackAndMessage(e),r=t.message,i=[t.stack],s=this;while(s!==undefined)i.push(h(s.stack.split("\n"))),s=s._parent;c(i),l(i),n.notEnumerableProp(e,"stack",f(r,i)),n.notEnumerableProp(e,"__stackCleaned__",!0)},a.parseStackAndMessage=function(e){var t=e.stack,n=e.toString();return t=typeof t=="string"&&t.length>0?p(e):["    (No stack trace)"],{message:n,stack:h(t)}},a.formatAndLogError=function(e,t){if(typeof console!="undefined"){var n;if(typeof e=="object"||typeof e=="function"){var r=e.stack;n=t+s(r,e)}else n=t+String(e);typeof u=="function"?u(n):(typeof console.log=="function"||typeof console.log=="object")&&console.log(n)}},a.unhandledRejection=function(e){a.formatAndLogError(e,"^--- With additional stack trace: ")},a.isSupported=function(){return typeof b=="function"},a.fireRejectionEvent=function(e,n,r,i){var s=!1;try{typeof n=="function"&&(s=!0,e==="rejectionHandled"?n(i):n(r,i))}catch(o){t.throwLater(o)}var u=!1;try{u=E(e,r,i)}catch(o){u=!0,t.throwLater(o)}var f=!1;if(w)try{f=w(e.toLowerCase(),{reason:r,promise:i})}catch(o){f=!0,t.throwLater(o)}!u&&!s&&!f&&e==="unhandledRejection"&&a.formatAndLogError(r,"Unhandled rejection ")};var m=function(){return!1},g=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;a.setBounds=function(e,t){if(!a.isSupported())return;var n=e.stack.split("\n"),i=t.stack.split("\n"),s=-1,o=-1,u,f;for(var l=0;l<n.length;++l){var c=y(n[l]);if(c){u=c.fileName,s=c.line;break}}for(var l=0;l<i.length;++l){var c=y(i[l]);if(c){f=c.fileName,o=c.line;break}}if(s<0||o<0||!u||!f||u!==f||s>=o)return;m=function(e){if(r.test(e))return!0;var t=y(e);return t&&t.fileName===u&&s<=t.line&&t.line<=o?!0:!1}};var b=function(){var t=/^\s*at\s*/,n=function(e,t){return typeof e=="string"?e:t.name!==undefined&&t.message!==undefined?t.toString():d(t)};if(typeof Error.stackTraceLimit=="number"&&typeof Error.captureStackTrace=="function"){Error.stackTraceLimit=Error.stackTraceLimit+6,i=t,s=n;var u=Error.captureStackTrace;return m=function(e){return r.test(e)},function(e,t){Error.stackTraceLimit=Error.stackTraceLimit+6,u(e,t),Error.stackTraceLimit=Error.stackTraceLimit-6}}var a=new Error;if(typeof a.stack=="string"&&a.stack.split("\n")[0].indexOf("stackDetection@")>=0)return i=/@/,s=n,o=!0,function(t){t.stack=(new Error).stack};var f;try{throw new Error}catch(l){f="stack"in l}return"stack"in a||!f?(s=function(e,t){return typeof e=="string"?e:typeof t!="object"&&typeof t!="function"||t.name===undefined||t.message===undefined?d(t):t.toString()},null):(i=t,s=n,function(t){Error.stackTraceLimit=Error.stackTraceLimit+6;try{throw new Error}catch(n){t.stack=n.stack}Error.stackTraceLimit=Error.stackTraceLimit-6})}([]),w,E=function(){if(n.isNode)return function(e,t,n){return e==="rejectionHandled"?process.emit(e,n):process.emit(e,t,n)};var e=!1,t=!0;try{var r=new self.CustomEvent("test");e=r instanceof CustomEvent}catch(i){}if(!e)try{var s=document.createEvent("CustomEvent");s.initCustomEvent("testingtheevent",!1,!0,{}),self.dispatchEvent(s)}catch(i){t=!1}t&&(w=function(t,n){var r;return e?r=new self.CustomEvent(t,{detail:n,bubbles:!1,cancelable:!0}):self.dispatchEvent&&(r=document.createEvent("CustomEvent"),r.initCustomEvent(t,!1,!0,n)),r?!self.dispatchEvent(r):!1});var o={};return o.unhandledRejection="onunhandledRejection".toLowerCase(),o.rejectionHandled="onrejectionHandled".toLowerCase(),function(e,t,n){var r=o[e],i=self[r];return i?(e==="rejectionHandled"?i.call(self,n):i.call(self,t,n),!0):!1}}();return typeof console!="undefined"&&typeof console.warn!="undefined"&&(u=function(e){console.warn(e)},n.isNode&&process.stderr.isTTY?u=function(e){process.stderr.write("[31m"+e+"[39m\n")}:!n.isNode&&typeof (new Error).stack=="string"&&(u=function(e){console.warn("%c"+e,"color: red")})),a}},{"./async.js":2,"./util.js":38}],8:[function(e,t,n){"use strict";t.exports=function(t){function a(e,t,n){this._instances=e,this._callback=t,this._promise=n}function f(e,t){var n={},r=i(e).call(n,t);if(r===s)return r;var a=o(n);return a.length?(s.e=new u("Catch filter must inherit from Error or be a simple predicate function\n\n    See http://goo.gl/o84o68\n"),s):r}var n=e("./util.js"),r=e("./errors.js"),i=n.tryCatch,s=n.errorObj,o=e("./es5.js").keys,u=r.TypeError;return a.prototype.doFilter=function(e){var n=this._callback,r=this._promise,o=r._boundTo;for(var u=0,a=this._instances.length;u<a;++u){var l=this._instances[u],c=l===Error||l!=null&&l.prototype instanceof Error;if(c&&e instanceof l){var h=i(n).call(o,e);return h===s?(t.e=h.e,t):h}if(typeof l=="function"&&!c){var p=f(l,e);if(p===s){e=s.e;break}if(p){var h=i(n).call(o,e);return h===s?(t.e=h.e,t):h}}}return t.e=e,t},a}},{"./errors.js":13,"./es5.js":14,"./util.js":38}],9:[function(e,t,n){"use strict";t.exports=function(e,t,n){function i(){this._trace=new t(o())}function s(){if(n())return new i}function o(){var e=r.length-1;return e>=0?r[e]:undefined}var r=[];return i.prototype._pushContext=function(){if(!n())return;this._trace!==undefined&&r.push(this._trace)},i.prototype._popContext=function(){if(!n())return;this._trace!==undefined&&r.pop()},e.prototype._peekContext=o,e.prototype._pushContext=i.prototype._pushContext,e.prototype._popContext=i.prototype._popContext,s}},{}],10:[function(e,t,n){"use strict";t.exports=function(t,n){var r=e("./async.js"),i=e("./errors.js").Warning,s=e("./util.js"),o=s.canAttachTrace,u,a,f=s.isNode&&(!!process.env.BLUEBIRD_DEBUG||process.env.NODE_ENV==="development");return f&&r.disableTrampolineIfNecessary(),t.prototype._ensurePossibleRejectionHandled=function(){this._setRejectionIsUnhandled(),r.invokeLater(this._notifyUnhandledRejection,this,undefined)},t.prototype._notifyUnhandledRejectionIsHandled=function(){n.fireRejectionEvent("rejectionHandled",u,undefined,this)},t.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._getCarriedStackTrace()||this._settledValue;this._setUnhandledRejectionIsNotified(),n.fireRejectionEvent("unhandledRejection",a,e,this)}},t.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=this._bitField|524288},t.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=this._bitField&-524289},t.prototype._isUnhandledRejectionNotified=function(){return(this._bitField&524288)>0},t.prototype._setRejectionIsUnhandled=function(){this._bitField=this._bitField|2097152},t.prototype._unsetRejectionIsUnhandled=function(){this._bitField=this._bitField&-2097153,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},t.prototype._isRejectionUnhandled=function(){return(this._bitField&2097152)>0},t.prototype._setCarriedStackTrace=function(e){this._bitField=this._bitField|1048576,this._fulfillmentHandler0=e},t.prototype._isCarryingStackTrace=function(){return(this._bitField&1048576)>0},t.prototype._getCarriedStackTrace=function(){return this._isCarryingStackTrace()?this._fulfillmentHandler0:undefined},t.prototype._captureStackTrace=function(){return f&&(this._trace=new n(this._peekContext())),this},t.prototype._attachExtraTrace=function(e,t){if(f&&o(e)){var r=this._trace;r!==undefined&&t&&(r=r._parent);if(r!==undefined)r.attachExtraTrace(e);else if(!e.__stackCleaned__){var i=n.parseStackAndMessage(e);s.notEnumerableProp(e,"stack",i.message+"\n"+i.stack.join("\n")),s.notEnumerableProp(e,"__stackCleaned__",!0)}}},t.prototype._warn=function(e){var t=new i(e),r=this._peekContext();if(r)r.attachExtraTrace(t);else{var s=n.parseStackAndMessage(t);t.stack=s.message+"\n"+s.stack.join("\n")}n.formatAndLogError(t,"")},t.onPossiblyUnhandledRejection=function(e){a=typeof e=="function"?e:undefined},t.onUnhandledRejectionHandled=function(e){u=typeof e=="function"?e:undefined},t.longStackTraces=function(){if(r.haveItemsQueued()&&f===!1)throw new Error("cannot enable long stack traces after promises have been created\n\n    See http://goo.gl/DT1qyG\n");f=n.isSupported(),f&&r.disableTrampolineIfNecessary()},t.hasLongStackTraces=function(){return f&&n.isSupported()},n.isSupported()||(t.longStackTraces=function(){},f=!1),function(){return f}}},{"./async.js":2,"./errors.js":13,"./util.js":38}],11:[function(e,t,n){"use strict";var r=e("./util.js"),i=r.isPrimitive,s=r.wrapsPrimitiveReceiver;t.exports=function(e){var t=function(){return this},n=function(){throw this},r=function(e,t){if(t===1)return function(){throw e};if(t===2)return function(){return e}};e.prototype["return"]=e.prototype.thenReturn=function(e){return s&&i(e)?this._then(r(e,2),undefined,undefined,undefined,undefined):this._then(t,undefined,undefined,e,undefined)},e.prototype["throw"]=e.prototype.thenThrow=function(e){return s&&i(e)?this._then(r(e,1),undefined,undefined,undefined,undefined):this._then(n,undefined,undefined,e,undefined)}}},{"./util.js":38}],12:[function(e,t,n){"use strict";t.exports=function(e,t){var n=e.reduce;e.prototype.each=function(e){return n(this,e,null,t)},e.each=function(e,r){return n(e,r,null,t)}}},{}],13:[function(e,t,n){"use strict";function a(e,t){function n(r){if(!(this instanceof n))return new n(r);u(this,"message",typeof r=="string"?r:t),u(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return o(n,Error),n}function b(e){if(!(this instanceof b))return new b(e);u(this,"name","OperationalError"),u(this,"message",e),this.cause=e,this.isOperational=!0,e instanceof Error?(u(this,"message",e.message),u(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}var r=e("./es5.js"),i=r.freeze,s=e("./util.js"),o=s.inherits,u=s.notEnumerableProp,f,l,c=a("Warning","warning"),h=a("CancellationError","cancellation error"),p=a("TimeoutError","timeout error"),d=a("AggregateError","aggregate error");try{f=TypeError,l=RangeError}catch(v){f=a("TypeError","type error"),l=a("RangeError","range error")}var m="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(var g=0;g<m.length;++g)typeof Array.prototype[m[g]]=="function"&&(d.prototype[m[g]]=Array.prototype[m[g]]);r.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var y=0;d.prototype.toString=function(){var e=Array(y*4+1).join(" "),t="\n"+e+"AggregateError of:"+"\n";y++,e=Array(y*4+1).join(" ");for(var n=0;n<this.length;++n){var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n");for(var s=0;s<i.length;++s)i[s]=e+i[s];r=i.join("\n"),t+=r+"\n"}return y--,t},o(b,Error);var w=Error.__BluebirdErrorTypes__;w||(w=i({CancellationError:h,TimeoutError:p,OperationalError:b,RejectionError:b,AggregateError:d}),u(Error,"__BluebirdErrorTypes__",w)),t.exports={Error:Error,TypeError:f,RangeError:l,CancellationError:w.CancellationError,OperationalError:w.OperationalError,TimeoutError:w.TimeoutError,AggregateError:w.AggregateError,Warning:c}},{"./es5.js":14,"./util.js":38}],14:[function(e,t,n){var r=function(){"use strict";return this===undefined}();if(r)t.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!!(!n||n.writable||n.set)}};else{var i={}.hasOwnProperty,s={}.toString,o={}.constructor.prototype,u=function(e){var t=[];for(var n in e)i.call(e,n)&&t.push(n);return t},a=function(e,t){return{value:e[t]}},f=function(e,t,n){return e[t]=n.value,e},l=function(e){return e},c=function(e){try{return Object(e).constructor.prototype}catch(t){return o}},h=function(e){try{return s.call(e)==="[object Array]"}catch(t){return!1}};t.exports={isArray:h,keys:u,names:u,defineProperty:f,getDescriptor:a,freeze:l,getPrototypeOf:c,isES5:r,propertyIsWritable:function(){return!0}}}},{}],15:[function(e,t,n){"use strict";t.exports=function(e,t){var n=e.map;e.prototype.filter=function(e,r){return n(this,e,r,t)},e.filter=function(e,r,i){return n(e,r,i,t)}}},{}],16:[function(e,t,n){"use strict";t.exports=function(t,n,r){function a(){return this}function f(){throw this}function l(e){return function(){return e}}function c(e){return function(){throw e}}function h(e,t,n){var r;return s&&o(t)?r=n?l(t):c(t):r=n?a:f,e._then(r,u,undefined,t,undefined)}function p(e){var i=this.promise,s=this.handler,o=i._isBound()?s.call(i._boundTo):s();if(o!==undefined){var u=r(o,i);if(u instanceof t)return u=u._target(),h(u,e,i.isFulfilled())}return i.isRejected()?(n.e=e,n):e}function d(e){var n=this.promise,i=this.handler,s=n._isBound()?i.call(n._boundTo,e):i(e);if(s!==undefined){var o=r(s,n);if(o instanceof t)return o=o._target(),h(o,e,!0)}return e}var i=e("./util.js"),s=i.wrapsPrimitiveReceiver,o=i.isPrimitive,u=i.thrower;t.prototype._passThroughHandler=function(e,t){if(typeof e!="function")return this.then();var n={promise:this,handler:e};return this._then(t?p:d,t?p:undefined,undefined,n,undefined)},t.prototype.lastly=t.prototype["finally"]=function(e){return this._passThroughHandler(e,!0)},t.prototype.tap=function(e){return this._passThroughHandler(e,!1)}}},{"./util.js":38}],17:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){function c(e,n,r){for(var s=0;s<n.length;++s){r._pushContext();var o=f(n[s])(e);r._popContext();if(o===a){r._pushContext();var u=t.reject(a.e);return r._popContext(),u}var l=i(o,r);if(l instanceof t)return l}return null}function h(e,n,i,s){var o=this._promise=new t(r);o._captureStackTrace(),this._stack=s,this._generatorFunction=e,this._receiver=n,this._generator=undefined,this._yieldHandlers=typeof i=="function"?[i].concat(l):l}var s=e("./errors.js"),o=s.TypeError,u=e("./util.js"),a=u.errorObj,f=u.tryCatch,l=[];h.prototype.promise=function(){return this._promise},h.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=undefined,this._next(undefined)},h.prototype._continue=function(e){if(e===a)return this._promise._rejectCallback(e.e,!1,!0);var n=e.value;if(e.done===!0)this._promise._resolveCallback(n);else{var r=i(n,this._promise);if(!(r instanceof t)){r=c(r,this._yieldHandlers,this._promise);if(r===null){this._throw(new o("A value %s was yielded that could not be treated as a promise\n\n    See http://goo.gl/4Y4pDk\n\n".replace("%s",n)+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")));return}}r._then(this._next,this._throw,undefined,this,null)}},h.prototype._throw=function(e){this._promise._attachExtraTrace(e),this._promise._pushContext();var t=f(this._generator["throw"]).call(this._generator,e);this._promise._popContext(),this._continue(t)},h.prototype._next=function(e){this._promise._pushContext();var t=f(this._generator.next).call(this._generator,e);this._promise._popContext(),this._continue(t)},t.coroutine=function(e,t){if(typeof e!="function")throw new o("generatorFunction must be a function\n\n    See http://goo.gl/6Vqhm0\n");var n=Object(t).yieldHandler,r=h,i=(new Error).stack;return function(){var t=e.apply(this,arguments),s=new r(undefined,undefined,n,i);return s._generator=t,s._next(undefined),s.promise()}},t.coroutine.addYieldHandler=function(e){if(typeof e!="function")throw new o("fn must be a function\n\n    See http://goo.gl/916lJJ\n");l.push(e)},t.spawn=function(e){if(typeof e!="function")return n("generatorFunction must be a function\n\n    See http://goo.gl/6Vqhm0\n");var r=new h(e,this),i=r.promise();return r._run(t.spawn),i}}},{"./errors.js":13,"./util.js":38}],18:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){var s=e("./util.js"),o=s.canEvaluate,u=s.tryCatch,a=s.errorObj,f;t.join=function(){var e=arguments.length-1,s;e>0&&typeof arguments[e]=="function"&&(s=arguments[e]);var d=arguments.length,m=new Array(d);for(var g=0;g<d;++g)m[g]=arguments[g];s&&m.pop();var u=(new n(m)).promise();return s!==undefined?u.spread(s):u}}},{"./util.js":38}],19:[function(e,t,n){"use strict";t.exports=function(t,n,r,i,s){function h(e,t,n,r){this.constructor$(e),this._promise._captureStackTrace(),this._callback=t,this._preservedValues=r===s?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=n>=1?[]:c,o.invoke(p,this,undefined)}function p(){this._init$(undefined,-2)}function d(e,t,n,r){var i=typeof n=="object"&&n!==null?n.concurrency:0;return i=typeof i=="number"&&isFinite(i)&&i>=1?i:0,new h(e,t,i,r)}var o=e("./async.js"),u=e("./util.js"),a=u.tryCatch,f=u.errorObj,l={},c=[];u.inherits(h,n),h.prototype._init=function(){},h.prototype._promiseFulfilled=function(e,n){var r=this._values,s=this.length(),o=this._preservedValues,u=this._limit;if(r[n]===l){r[n]=e;if(u>=1){this._inFlight--,this._drainQueue();if(this._isResolved())return}}else{if(u>=1&&this._inFlight>=u){r[n]=e,this._queue.push(n);return}o!==null&&(o[n]=e);var c=this._callback,h=this._promise._boundTo;this._promise._pushContext();var p=a(c).call(h,e,n,s);this._promise._popContext();if(p===f)return this._reject(p.e);var d=i(p,this._promise);if(d instanceof t){d=d._target();if(d._isPending())return u>=1&&this._inFlight++,r[n]=l,d._proxyPromiseArray(this,n);if(!d._isFulfilled())return this._reject(d._reason());p=d._value()}r[n]=p}var v=++this._totalResolved;v>=s&&(o!==null?this._filter(r,o):this._resolve(r))},h.prototype._drainQueue=function(){var e=this._queue,t=this._limit,n=this._values;while(e.length>0&&this._inFlight<t){if(this._isResolved())return;var r=e.pop();this._promiseFulfilled(n[r],r)}},h.prototype._filter=function(e,t){var n=t.length,r=new Array(n),i=0;for(var s=0;s<n;++s)e[s]&&(r[i++]=t[s]);r.length=i,this._resolve(r)},h.prototype.preservedValues=function(){return this._preservedValues},t.prototype.map=function(e,t){return typeof e!="function"?r("fn must be a function\n\n    See http://goo.gl/916lJJ\n"):d(this,e,t,null).promise()},t.map=function(e,t,n,i){return typeof t!="function"?r("fn must be a function\n\n    See http://goo.gl/916lJJ\n"):d(e,t,n,i).promise()}}},{"./async.js":2,"./util.js":38}],20:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){var s=e("./util.js"),o=s.tryCatch;t.method=function(e){if(typeof e!="function")throw new t.TypeError("fn must be a function\n\n    See http://goo.gl/916lJJ\n");return function(){var r=new t(n);r._captureStackTrace(),r._pushContext();var i=o(e).apply(this,arguments);return r._popContext(),r._resolveFromSyncValue(i),r}},t.attempt=t["try"]=function(e,r,u){if(typeof e!="function")return i("fn must be a function\n\n    See http://goo.gl/916lJJ\n");var a=new t(n);a._captureStackTrace(),a._pushContext();var f=s.isArray(r)?o(e).apply(u,r):o(e).call(u,r);return a._popContext(),a._resolveFromSyncValue(f),a},t.prototype._resolveFromSyncValue=function(e){e===s.errorObj?this._rejectCallback(e.e,!1,!0):this._resolveCallback(e,!0)}}},{"./util.js":38}],21:[function(e,t,n){"use strict";t.exports=function(t){function o(e,t){var o=this;if(!n.isArray(e))return u.call(o,e,t);var a=i(t).apply(o._boundTo,[null].concat(e));a===s&&r.throwLater(a.e)}function u(e,t){var n=this,o=n._boundTo,u=e===undefined?i(t).call(o,null):i(t).call(o,null,e);u===s&&r.throwLater(u.e)}function a(e,t){var n=this;if(!e){var o=n._target(),u=o._getCarriedStackTrace();u.cause=e,e=u}var a=i(t).call(n._boundTo,e);a===s&&r.throwLater(a.e)}var n=e("./util.js"),r=e("./async.js"),i=n.tryCatch,s=n.errorObj;t.prototype.asCallback=t.prototype.nodeify=function(e,t){if(typeof e=="function"){var n=u;t!==undefined&&Object(t).spread&&(n=o),this._then(n,a,undefined,this,e)}return this}}},{"./async.js":2,"./util.js":38}],22:[function(e,t,n){"use strict";t.exports=function(t,n){var r=e("./util.js"),i=e("./async.js"),s=r.tryCatch,o=r.errorObj;t.prototype.progressed=function(e){return this._then(undefined,undefined,e,undefined,undefined)},t.prototype._progress=function(e){if(this._isFollowingOrFulfilledOrRejected())return;this._target()._progressUnchecked(e)},t.prototype._progressHandlerAt=function(e){return e===0?this._progressHandler0:this[(e<<2)+e-5+2]},t.prototype._doProgressWith=function(e){var n=e.value,i=e.handler,u=e.promise,a=e.receiver,f=s(i).call(a,n);if(f===o){if(f.e!=null&&f.e.name!=="StopProgressPropagation"){var l=r.canAttachTrace(f.e)?f.e:new Error(r.toString(f.e));u._attachExtraTrace(l),u._progress(f.e)}}else f instanceof t?f._then(u._progress,null,null,u,undefined):u._progress(f)},t.prototype._progressUnchecked=function(e){var r=this._length(),s=this._progress;for(var o=0;o<r;o++){var u=this._progressHandlerAt(o),a=this._promiseAt(o);if(!(a instanceof t)){var f=this._receiverAt(o);typeof u=="function"?u.call(f,e,a):f instanceof n&&!f._isResolved()&&f._promiseProgressed(e,a);continue}typeof u=="function"?i.invoke(this._doProgressWith,this,{handler:u,promise:a,receiver:this._receiverAt(o),value:e}):i.invoke(s,a,e)}}}},{"./async.js":2,"./util.js":38}],23:[function(e,t,n){"use strict";t.exports=function(){function E(e){if(typeof e!="function")throw new u("the promise constructor requires a resolver function\n\n    See http://goo.gl/EC22Yn\n");if(this.constructor!==E)throw new u("the promise constructor cannot be invoked directly\n\n    See http://goo.gl/KsIlge\n");this._bitField=0,this._fulfillmentHandler0=undefined,this._rejectionHandler0=undefined,this._progressHandler0=undefined,this._promise0=undefined,this._receiver0=undefined,this._settledValue=undefined,e!==a&&this._resolveFromResolver(e)}function S(e){var t=new E(a);t._fulfillmentHandler0=e,t._rejectionHandler0=e,t._progressHandler0=e,t._promise0=e,t._receiver0=e,t._settledValue=e}var t=function(){return new u("circular promise resolution chain\n\n    See http://goo.gl/LhFpo0\n")},n=function(){return new E.PromiseInspection(this._target())},r=function(e){return E.reject(new u(e))},i=e("./util.js"),s=e("./async.js"),o=e("./errors.js"),u=E.TypeError=o.TypeError;E.RangeError=o.RangeError,E.CancellationError=o.CancellationError,E.TimeoutError=o.TimeoutError,E.OperationalError=o.OperationalError,E.RejectionError=o.OperationalError,E.AggregateError=o.AggregateError;var a=function(){},f={},l={e:null},c=e("./thenables.js")(E,a),h=e("./promise_array.js")(E,a,c,r),p=e("./captured_trace.js")(),d=e("./debuggability.js")(E,p),v=e("./context.js")(E,p,d),m=e("./catch_filter.js")(l),g=e("./promise_resolver.js"),y=g._nodebackForPromise,b=i.errorObj,w=i.tryCatch;return E.prototype.toString=function(){return"[object Promise]"},E.prototype.caught=E.prototype["catch"]=function(e){var t=arguments.length;if(t>1){var n=new Array(t-1),r=0,i;for(i=0;i<t-1;++i){var s=arguments[i];if(typeof s!="function")return E.reject(new u("Catch filter must inherit from Error or be a simple predicate function\n\n    See http://goo.gl/o84o68\n"));n[r++]=s}n.length=r,e=arguments[i];var o=new m(n,e,this);return this._then(undefined,o.doFilter,undefined,o,undefined)}return this._then(undefined,e,undefined,undefined,undefined)},E.prototype.reflect=function(){return this._then(n,n,undefined,this,undefined)},E.prototype.then=function(e,t,n){if(d()&&arguments.length>0&&typeof e!="function"&&typeof t!="function"){var r=".then() only accepts functions but was passed: "+i.classString(e);arguments.length>1&&(r+=", "+i.classString(t)),this._warn(r)}return this._then(e,t,n,undefined,undefined)},E.prototype.done=function(e,t,n){var r=this._then(e,t,n,undefined,undefined);r._setIsFinal()},E.prototype.spread=function(e,t){return this.all()._then(e,t,undefined,f,undefined)},E.prototype.isCancellable=function(){return!this.isResolved()&&this._cancellable()},E.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:undefined,rejectionReason:undefined};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},E.prototype.all=function(){return(new h(this)).promise()},E.prototype.error=function(e){return this.caught(i.originatesFromRejection,e)},E.is=function(e){return e instanceof E},E.fromNode=function(e){var t=new E(a),n=w(e)(y(t));return n===b&&t._rejectCallback(n.e,!0,!0),t},E.all=function(e){return(new h(e)).promise()},E.defer=E.pending=function(){var e=new E(a);return new g(e)},E.cast=function(e){var t=c(e);if(!(t instanceof E)){var n=t;t=new E(a),t._fulfillUnchecked(n)}return t},E.resolve=E.fulfilled=E.cast,E.reject=E.rejected=function(e){var t=new E(a);return t._captureStackTrace(),t._rejectCallback(e,!0),t},E.setScheduler=function(e){if(typeof e!="function")throw new u("fn must be a function\n\n    See http://goo.gl/916lJJ\n");var t=s._schedule;return s._schedule=e,t},E.prototype._then=function(e,t,n,r,i){var o=i!==undefined,u=o?i:new E(a);o||(u._propagateFrom(this,5),u._captureStackTrace());var f=this._target();f!==this&&(r===undefined&&(r=this._boundTo),o||u._setIsMigrated());var l=f._addCallbacks(e,t,n,u,r);return f._isResolved()&&!f._isSettlePromisesQueued()&&s.invoke(f._settlePromiseAtPostResolution,f,l),u},E.prototype._settlePromiseAtPostResolution=function(e){this._isRejectionUnhandled()&&this._unsetRejectionIsUnhandled(),this._settlePromiseAt(e)},E.prototype._length=function(){return this._bitField&131071},E.prototype._isFollowingOrFulfilledOrRejected=function(){return(this._bitField&939524096)>0},E.prototype._isFollowing=function(){return(this._bitField&536870912)===536870912},E.prototype._setLength=function(e){this._bitField=this._bitField&-131072|e&131071},E.prototype._setFulfilled=function(){this._bitField=this._bitField|268435456},E.prototype._setRejected=function(){this._bitField=this._bitField|134217728},E.prototype._setFollowing=function(){this._bitField=this._bitField|536870912},E.prototype._setIsFinal=function(){this._bitField=this._bitField|33554432},E.prototype._isFinal=function(){return(this._bitField&33554432)>0},E.prototype._cancellable=function(){return(this._bitField&67108864)>0},E.prototype._setCancellable=function(){this._bitField=this._bitField|67108864},E.prototype._unsetCancellable=function(){this._bitField=this._bitField&-67108865},E.prototype._setIsMigrated=function(){this._bitField=this._bitField|4194304},E.prototype._unsetIsMigrated=function(){this._bitField=this._bitField&-4194305},E.prototype._isMigrated=function(){return(this._bitField&4194304)>0},E.prototype._receiverAt=function(e){var t=e===0?this._receiver0:this[e*5-5+4];return t===undefined&&this._isBound()?this._boundTo:t},E.prototype._promiseAt=function(e){return e===0?this._promise0:this[e*5-5+3]},E.prototype._fulfillmentHandlerAt=function(e){return e===0?this._fulfillmentHandler0:this[e*5-5+0]},E.prototype._rejectionHandlerAt=function(e){return e===0?this._rejectionHandler0:this[e*5-5+1]},E.prototype._migrateCallbacks=function(e,t){var n=e._fulfillmentHandlerAt(t),r=e._rejectionHandlerAt(t),i=e._progressHandlerAt(t),s=e._promiseAt(t),o=e._receiverAt(t);s instanceof E&&s._setIsMigrated(),this._addCallbacks(n,r,i,s,o)},E.prototype._addCallbacks=function(e,t,n,r,i){var s=this._length();s>=131066&&(s=0,this._setLength(0));if(s===0)this._promise0=r,i!==undefined&&(this._receiver0=i),typeof e=="function"&&!this._isCarryingStackTrace()&&(this._fulfillmentHandler0=e),typeof t=="function"&&(this._rejectionHandler0=t),typeof n=="function"&&(this._progressHandler0=n);else{var o=s*5-5;this[o+3]=r,this[o+4]=i,typeof e=="function"&&(this[o+0]=e),typeof t=="function"&&(this[o+1]=t),typeof n=="function"&&(this[o+2]=n)}return this._setLength(s+1),s},E.prototype._setProxyHandlers=function(e,t){var n=this._length();n>=131066&&(n=0,this._setLength(0));if(n===0)this._promise0=t,this._receiver0=e;else{var r=n*5-5;this[r+3]=t,this[r+4]=e}this._setLength(n+1)},E.prototype._proxyPromiseArray=function(e,t){this._setProxyHandlers(e,t)},E.prototype._resolveCallback=function(e,n){if(this._isFollowingOrFulfilledOrRejected())return;if(e===this)return this._rejectCallback(t(),!1,!0);var r=c(e,this);if(!(r instanceof E))return this._fulfill(e);var i=1|(n?4:0);this._propagateFrom(r,i);var s=r._target();if(s._isPending()){var o=this._length();for(var u=0;u<o;++u)s._migrateCallbacks(this,u);this._setFollowing(),this._setLength(0),this._setFollowee(s)}else s._isFulfilled()?this._fulfillUnchecked(s._value()):this._rejectUnchecked(s._reason(),s._getCarriedStackTrace())},E.prototype._rejectCallback=function(e,t,n){n||i.markAsOriginatingFromRejection(e);var r=i.ensureErrorObject(e),s=r===e;this._attachExtraTrace(r,t?s:!1),this._reject(e,s?undefined:r)},E.prototype._resolveFromResolver=function(e){var t=this;this._captureStackTrace(),this._pushContext();var n=!0,r=w(e)(function(e){if(t===null)return;t._resolveCallback(e),t=null},function(e){if(t===null)return;t._rejectCallback(e,n),t=null});n=!1,this._popContext(),r!==undefined&&r===b&&t!==null&&(t._rejectCallback(r.e,!0,!0),t=null)},E.prototype._settlePromiseFromHandler=function(e,n,r,i){if(i._isRejected())return;i._pushContext();var s;n===f&&!this._isRejected()?s=w(e).apply(this._boundTo,r):s=w(e).call(n,r),i._popContext();if(s===b||s===i||s===l){var o=s===i?t():s.e;i._rejectCallback(o,!1,!0)}else i._resolveCallback(s)},E.prototype._target=function(){var e=this;while(e._isFollowing())e=e._followee();return e},E.prototype._followee=function(){return this._rejectionHandler0},E.prototype._setFollowee=function(e){this._rejectionHandler0=e},E.prototype._cleanValues=function(){this._cancellable()&&(this._cancellationParent=undefined)},E.prototype._propagateFrom=function(e,t){(t&1)>0&&e._cancellable()&&(this._setCancellable(),this._cancellationParent=e),(t&4)>0&&e._isBound()&&this._setBoundTo(e._boundTo)},E.prototype._fulfill=function(e){if(this._isFollowingOrFulfilledOrRejected())return;this._fulfillUnchecked(e)},E.prototype._reject=function(e,t){if(this._isFollowingOrFulfilledOrRejected())return;this._rejectUnchecked(e,t)},E.prototype._settlePromiseAt=function(e){var t=this._promiseAt(e),n=t instanceof E;if(n&&t._isMigrated())return t._unsetIsMigrated(),s.invoke(this._settlePromiseAt,this,e);var r=this._isFulfilled()?this._fulfillmentHandlerAt(e):this._rejectionHandlerAt(e),i=this._isCarryingStackTrace()?this._getCarriedStackTrace():undefined,o=this._settledValue,u=this._receiverAt(e);this._clearCallbackDataAtIndex(e),typeof r=="function"?n?this._settlePromiseFromHandler(r,u,o,t):r.call(u,o,t):u instanceof h?u._isResolved()||(this._isFulfilled()?u._promiseFulfilled(o,t):u._promiseRejected(o,t)):n&&(this._isFulfilled()?t._fulfill(o):t._reject(o,i)),e>=4&&(e&31)===4&&s.invokeLater(this._setLength,this,0)},E.prototype._clearCallbackDataAtIndex=function(e){if(e===0)this._isCarryingStackTrace()||(this._fulfillmentHandler0=undefined),this._rejectionHandler0=this._progressHandler0=this._receiver0=this._promise0=undefined;else{var t=e*5-5;this[t+3]=this[t+4]=this[t+0]=this[t+1]=this[t+2]=undefined}},E.prototype._isSettlePromisesQueued=function(){return(this._bitField&-1073741824)===-1073741824},E.prototype._setSettlePromisesQueued=function(){this._bitField=this._bitField|-1073741824},E.prototype._unsetSettlePromisesQueued=function(){this._bitField=this._bitField&1073741823},E.prototype._queueSettlePromises=function(){s.settlePromises(this),this._setSettlePromisesQueued()},E.prototype._fulfillUnchecked=function(e){if(e===this){var n=t();return this._attachExtraTrace(n),this._rejectUnchecked(n,undefined)}this._setFulfilled(),this._settledValue=e,this._cleanValues(),this._length()>0&&this._queueSettlePromises()},E.prototype._rejectUncheckedCheckError=function(e){var t=i.ensureErrorObject(e);this._rejectUnchecked(e,t===e?undefined:t)},E.prototype._rejectUnchecked=function(e,n){if(e===this){var r=t();return this._attachExtraTrace(r),this._rejectUnchecked(r)}this._setRejected(),this._settledValue=e,this._cleanValues();if(this._isFinal()){s.throwLater(function(e){throw"stack"in e&&s.invokeFirst(p.unhandledRejection,undefined,e),e},n===undefined?e:n);return}n!==undefined&&n!==e&&this._setCarriedStackTrace(n),this._length()>0?this._queueSettlePromises():this._ensurePossibleRejectionHandled()},E.prototype._settlePromises=function(){this._unsetSettlePromisesQueued();var e=this._length();for(var t=0;t<e;t++)this._settlePromiseAt(t)},E._makeSelfResolutionError=t,e("./progress.js")(E,h),e("./method.js")(E,a,c,r),e("./bind.js")(E,a,c),e("./finally.js")(E,l,c),e("./direct_resolve.js")(E),e("./synchronous_inspection.js")(E),e("./join.js")(E,h,c,a),E.Promise=E,e("./map.js")(E,h,r,c,a),e("./cancel.js")(E),e("./using.js")(E,r,c,v),e("./generators.js")(E,r,a,c),e("./nodeify.js")(E),e("./call_get.js")(E),e("./props.js")(E,h,c,r),e("./race.js")(E,a,c,r),e("./reduce.js")(E,h,r,c,a),e("./settle.js")(E,h),e("./some.js")(E,h,r),e("./promisify.js")(E,a),e("./any.js")(E),e("./each.js")(E,a),e("./timers.js")(E,a),e("./filter.js")(E,a),i.toFastProperties(E),i.toFastProperties(E.prototype),S({a:1}),S({b:2}),S({c:3}),S(1),S(function(){}),S(undefined),S(!1),S(new E(a)),p.setBounds(s.firstLineError,i.lastLineError),E}},{"./any.js":1,"./async.js":2,"./bind.js":3,"./call_get.js":5,"./cancel.js":6,"./captured_trace.js":7,"./catch_filter.js":8,"./context.js":9,"./debuggability.js":10,"./direct_resolve.js":11,"./each.js":12,"./errors.js":13,"./filter.js":15,"./finally.js":16,"./generators.js":17,"./join.js":18,"./map.js":19,"./method.js":20,"./nodeify.js":21,"./progress.js":22,"./promise_array.js":24,"./promise_resolver.js":25,"./promisify.js":26,"./props.js":27,"./race.js":29,"./reduce.js":30,"./settle.js":32,"./some.js":33,"./synchronous_inspection.js":34,"./thenables.js":35,"./timers.js":36,"./using.js":37,"./util.js":38}],24:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){function u(e){switch(e){case-2:return[];case-3:return{}}}function a(e){var r=this._promise=new t(n),i;e instanceof t&&(i=e,r._propagateFrom(i,5)),this._values=e,this._length=0,this._totalResolved=0,this._init(undefined,-2)}var s=e("./util.js"),o=s.isArray;return a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function f(e,n){var s=r(this._values,this._promise);if(s instanceof t){s=s._target(),this._values=s;if(!s._isFulfilled()){if(s._isPending()){s._then(f,this._reject,undefined,this,n);return}this._reject(s._reason());return}s=s._value();if(!o(s)){var a=new t.TypeError("expecting an array, a promise or a thenable\n\n    See http://goo.gl/s8MMhc\n");this.__hardReject__(a);return}}else if(!o(s)){this._promise._reject(i("expecting an array, a promise or a thenable\n\n    See http://goo.gl/s8MMhc\n")._reason());return}if(s.length===0){n===-5?this._resolveEmptyArray():this._resolve(u(n));return}var l=this.getActualLength(s.length);this._length=l,this._values=this.shouldCopyValues()?new Array(l):this._values;var c=this._promise;for(var h=0;h<l;++h){var p=this._isResolved(),d=r(s[h],c);d instanceof t?(d=d._target(),p?d._unsetRejectionIsUnhandled():d._isPending()?d._proxyPromiseArray(this,h):d._isFulfilled()?this._promiseFulfilled(d._value(),h):this._promiseRejected(d._reason(),h)):p||this._promiseFulfilled(d,h)}},a.prototype._isResolved=function(){return this._values===null},a.prototype._resolve=function(e){this._values=null,this._promise._fulfill(e)},a.prototype.__hardReject__=a.prototype._reject=function(e){this._values=null,this._promise._rejectCallback(e,!1,!0)},a.prototype._promiseProgressed=function(e,t){this._promise._progress({index:t,value:e})},a.prototype._promiseFulfilled=function(e,t){this._values[t]=e;var n=++this._totalResolved;n>=this._length&&this._resolve(this._values)},a.prototype._promiseRejected=function(e,t){this._totalResolved++,this._reject(e)},a.prototype.shouldCopyValues=function(){return!0},a.prototype.getActualLength=function(e){return e},a}},{"./util.js":38}],25:[function(e,t,n){"use strict";function l(e){return e instanceof Error&&f.getPrototypeOf(e)===Error.prototype}function h(e){var t;if(l(e)){t=new u(e),t.name=e.name,t.message=e.message,t.stack=e.stack;var n=f.keys(e);for(var i=0;i<n.length;++i){var s=n[i];c.test(s)||(t[s]=e[s])}return t}return r.markAsOriginatingFromRejection(e),e}function p(e){return function(t,n){if(e===null)return;if(t){var r=h(i(t));e._attachExtraTrace(r),e._reject(r)}else if(arguments.length>2){var s=arguments.length,o=new Array(s-1);for(var u=1;u<s;++u)o[u-1]=arguments[u];e._fulfill(o)}else e._fulfill(n);e=null}}var r=e("./util.js"),i=r.maybeWrapAsError,s=e("./errors.js"),o=s.TimeoutError,u=s.OperationalError,a=r.haveGetters,f=e("./es5.js"),c=/^(?:name|message|stack|cause)$/,d;a?d=function(e){this.promise=e}:d=function(e){this.promise=e,this.asCallback=p(e),this.callback=this.asCallback};if(a){var v={get:function(){return p(this.promise)}};f.defineProperty(d.prototype,"asCallback",v),f.defineProperty(d.prototype,"callback",v)}d._nodebackForPromise=p,d.prototype.toString=function(){return"[object PromiseResolver]"},d.prototype.resolve=d.prototype.fulfill=function(e){if(!(this instanceof d))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n    See http://goo.gl/sdkXL9\n");this.promise._resolveCallback(e)},d.prototype.reject=function(e){if(!(this instanceof d))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n    See http://goo.gl/sdkXL9\n");this.promise._rejectCallback(e)},d.prototype.progress=function(e){if(!(this instanceof d))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n    See http://goo.gl/sdkXL9\n");this.promise._progress(e)},d.prototype.cancel=function(e){this.promise.cancel(e)},d.prototype.timeout=function(){this.reject(new o("timeout"))},d.prototype.isResolved=function(){return this.promise.isResolved()},d.prototype.toJSON=function(){return this.promise.toJSON()},t.exports=d},{"./errors.js":13,"./es5.js":14,"./util.js":38}],26:[function(e,t,n){"use strict";t.exports=function(t,n){function d(e){return!h.test(e)}function v(e){try{return e.__isPromisified__===!0}catch(t){return!1}}function m(e,t,n){var r=i.getDataPropertyOrDefault(e,t+n,c);return r?v(r):!1}function g(e,t,n){for(var r=0;r<e.length;r+=2){var i=e[r];if(n.test(i)){var s=i.replace(n,"");for(var o=0;o<e.length;o+=2)if(e[o]===s)throw new f("Cannot promisify an API that has normal methods with '%s'-suffix\n\n    See http://goo.gl/iWrZbw\n".replace("%s",t))}}}function y(e,t,n,r){var s=i.inheritedDataKeys(e),o=[];for(var u=0;u<s.length;++u){var a=s[u],f=e[a],l=r===p?!0:p(a,f,e);typeof f=="function"&&!v(f)&&!m(e,a,t)&&r(a,f,e,l)&&o.push(a,f)}return g(o,t,n),o}function N(e,i,a,f){function h(){var a=i;i===r&&(a=this);var f=new t(n);f._captureStackTrace();var h=typeof c=="string"&&this!==l?this[c]:e,p=s(f);try{h.apply(a,o(arguments,p))}catch(d){f._rejectCallback(u(d),!0,!0)}return f}var l=function(){return this}(),c=e;return typeof c=="string"&&(e=f),h.__isPromisified__=!0,h}function k(e,t,n,s){var o=new RegExp(b(t)+"$"),u=y(e,t,o,n);for(var a=0,f=u.length;a<f;a+=2){var l=u[a],c=u[a+1],h=l+t;e[h]=s===C?C(l,r,l,c,t):s(c,function(){return C(l,r,l,c,t)})}return i.toFastProperties(e),e}function L(e,t){return C(e,t,undefined,e)}var r={},i=e("./util.js"),s=e("./promise_resolver.js")._nodebackForPromise,o=i.withAppended,u=i.maybeWrapAsError,a=i.canEvaluate,f=e("./errors").TypeError,l="Async",c={__isPromisified__:!0},h=/^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/,p=function(e,t){return i.isIdentifier(e)&&e.charAt(0)!=="_"&&!i.isClass(t)},b=function(e){return e.replace(/([$])/,"\\$")},w,C=a?w:N;t.promisify=function(e,t){if(typeof e!="function")throw new f("fn must be a function\n\n    See http://goo.gl/916lJJ\n");if(v(e))return e;var n=L(e,arguments.length<2?r:t);return i.copyDescriptors(e,n,d),n},t.promisifyAll=function(e,t){if(typeof e!="function"&&typeof e!="object")throw new f("the target of promisifyAll must be an object or a function\n\n    See http://goo.gl/9ITlV0\n");t=Object(t);var n=t.suffix;typeof n!="string"&&(n=l);var r=t.filter;typeof r!="function"&&(r=p);var s=t.promisifier;typeof s!="function"&&(s=C);if(!i.isIdentifier(n))throw new RangeError("suffix must be a valid identifier\n\n    See http://goo.gl/8FZo5V\n");var o=i.inheritedDataKeys(e);for(var u=0;u<o.length;++u){var a=e[o[u]];o[u]!=="constructor"&&i.isClass(a)&&(k(a.prototype,n,r,s),k(a,n,r,s))}return k(e,n,r,s)}}},{"./errors":13,"./promise_resolver.js":25,"./util.js":38}],27:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){function a(e){var t=u.keys(e),n=t.length,r=new Array(n*2);for(var i=0;i<n;++i){var s=t[i];r[i]=e[s],r[i+n]=s}this.constructor$(r)}function f(e){var n,s=r(e);return o(s)?(s instanceof t?n=s._then(t.props,undefined,undefined,undefined,undefined):n=(new a(s)).promise(),s instanceof t&&n._propagateFrom(s,4),n):i("cannot await properties of a non-object\n\n    See http://goo.gl/OsFKC8\n")}var s=e("./util.js"),o=s.isObject,u=e("./es5.js");s.inherits(a,n),a.prototype._init=function(){this._init$(undefined,-3)},a.prototype._promiseFulfilled=function(e,t){this._values[t]=e;var n=++this._totalResolved;if(n>=this._length){var r={},i=this.length();for(var s=0,o=this.length();s<o;++s)r[this._values[s+i]]=this._values[s];this._resolve(r)}},a.prototype._promiseProgressed=function(e,t){this._promise._progress({key:this._values[t+this.length()],value:e})},a.prototype.shouldCopyValues=function(){return!1},a.prototype.getActualLength=function(e){return e>>1},t.prototype.props=function(){return f(this)},t.props=function(e){return f(e)}}},{"./es5.js":14,"./util.js":38}],28:[function(e,t,n){"use strict";function r(e,t,n,r,i){for(var s=0;s<i;++s)n[s+r]=e[s+t],e[s+t]=void 0}function i(e){this._capacity=e,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(e){return this._capacity<e},i.prototype._pushOne=function(e){var t=this.length();this._checkCapacity(t+1);var n=this._front+t&this._capacity-1;this[n]=e,this._length=t+1},i.prototype._unshiftOne=function(e){var t=this._capacity;this._checkCapacity(this.length()+1);var n=this._front,r=(n-1&t-1^t)-t;this[r]=e,this._front=r,this._length=this.length()+1},i.prototype.unshift=function(e,t,n){this._unshiftOne(n),this._unshiftOne(t),this._unshiftOne(e)},i.prototype.push=function(e,t,n){var r=this.length()+3;if(this._willBeOverCapacity(r)){this._pushOne(e),this._pushOne(t),this._pushOne(n);return}var i=this._front+r-3;this._checkCapacity(r);var s=this._capacity-1;this[i+0&s]=e,this[i+1&s]=t,this[i+2&s]=n,this._length=r},i.prototype.shift=function(){var e=this._front,t=this[e];return this[e]=undefined,this._front=e+1&this._capacity-1,this._length--,t},i.prototype.length=function(){return this._length},i.prototype._checkCapacity=function(e){this._capacity<e&&this._resizeTo(this._capacity<<1)},i.prototype._resizeTo=function(e){var t=this._capacity;this._capacity=e;var n=this._front,i=this._length,s=n+i&t-1;r(this,0,this,t,s)},t.exports=i},{}],29:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){function u(e,u){var a=r(e);if(a instanceof t)return o(a);if(!s(e))return i("expecting an array, a promise or a thenable\n\n    See http://goo.gl/s8MMhc\n");var f=new t(n);u!==undefined&&f._propagateFrom(u,5);var l=f._fulfill,c=f._reject;for(var h=0,p=e.length;h<p;++h){var d=e[h];if(!(d!==undefined||h in e))continue;t.cast(d)._then(l,c,undefined,f,null)}return f}var s=e("./util.js").isArray,o=function(e){return e.then(function(t){return u(t,e)})};t.race=function(e){return u(e,undefined)},t.prototype.race=function(){return u(this,undefined)}}},{"./util.js":38}],30:[function(e,t,n){"use strict";t.exports=function(t,n,r,i,s){function l(e,n,r,u){this.constructor$(e),this._promise._captureStackTrace(),this._preservedValues=u===s?[]:null,this._zerothIsAccum=r===undefined,this._gotAccum=!1,this._reducingIndex=this._zerothIsAccum?1:0,this._valuesPhase=undefined;var a=i(r,this._promise),f=!1,l=a instanceof t;l&&(a=a._target(),a._isPending()?a._proxyPromiseArray(this,-1):a._isFulfilled()?(r=a._value(),this._gotAccum=!0):(this._reject(a._reason()),f=!0)),!l&&!this._zerothIsAccum&&(this._gotAccum=!0),this._callback=n,this._accum=r,f||o.invoke(c,this,undefined)}function c(){this._init$(undefined,-5)}function h(e,t,n,i){if(typeof t!="function")return r("fn must be a function\n\n    See http://goo.gl/916lJJ\n");var s=new l(e,t,n,i);return s.promise()}var o=e("./async.js"),u=e("./util.js"),a=u.tryCatch,f=u.errorObj;u.inherits(l,n),l.prototype._init=function(){},l.prototype._resolveEmptyArray=function(){(this._gotAccum||this._zerothIsAccum)&&this._resolve(this._preservedValues!==null?[]:this._accum)},l.prototype._promiseFulfilled=function(e,n){var r=this._values;r[n]=e;var s=this.length(),o=this._preservedValues,u=o!==null,l=this._gotAccum,c=this._valuesPhase,h;if(!c){c=this._valuesPhase=new Array(s);for(h=0;h<s;++h)c[h]=0}h=c[n],n===0&&this._zerothIsAccum?(this._accum=e,this._gotAccum=l=!0,c[n]=h===0?1:2):n===-1?(this._accum=e,this._gotAccum=l=!0):h===0?c[n]=1:(c[n]=2,this._accum=e);if(!l)return;var p=this._callback,d=this._promise._boundTo,v;for(var m=this._reducingIndex;m<s;++m){h=c[m];if(h===2){this._reducingIndex=m+1;continue}if(h!==1)return;e=r[m],this._promise._pushContext(),u?(o.push(e),v=a(p).call(d,e,m,s)):v=a(p).call(d,this._accum,e,m,s),this._promise._popContext();if(v===f)return this._reject(v.e);var g=i(v,this._promise);if(g instanceof t){g=g._target();if(g._isPending())return c[m]=4,g._proxyPromiseArray(this,m);if(!g._isFulfilled())return this._reject(g._reason());v=g._value()}this._reducingIndex=m+1,this._accum=v}this._resolve(u?o:this._accum)},t.prototype.reduce=function(e,t){return h(this,e,t,null)},t.reduce=function(e,t,n,r){return h(e,t,n,r)}}},{"./async.js":2,"./util.js":38}],31:[function(e,t,n){"use strict";var r,i=function(){throw new Error("No async scheduler available\n\n    See http://goo.gl/m3OTXk\n")};if(e("./util.js").isNode){var s=process.versions.node.split(".").map(Number);r=s[0]===0&&s[1]>10||s[0]>0?global.setImmediate:process.nextTick,r||(typeof setImmediate!="undefined"?r=setImmediate:typeof setTimeout!="undefined"?r=setTimeout:r=i)}else typeof MutationObserver!="undefined"?(r=function(e){var t=document.createElement("div"),n=new MutationObserver(e);return n.observe(t,{attributes:!0}),function(){t.classList.toggle("foo")}},r.isStatic=!0):typeof setImmediate!="undefined"?r=function(e){setImmediate(e)}:typeof setTimeout!="undefined"?r=function(e){setTimeout(e,0)}:r=i;t.exports=r},{"./util.js":38}],32:[function(e,t,n){"use strict";t.exports=function(t,n){function s(e){this.constructor$(e)}var r=t.PromiseInspection,i=e("./util.js");i.inherits(s,n),s.prototype._promiseResolved=function(e,t){this._values[e]=t;var n=++this._totalResolved;n>=this._length&&this._resolve(this._values)},s.prototype._promiseFulfilled=function(e,t){var n=new r;n._bitField=268435456,n._settledValue=e,this._promiseResolved(t,n)},s.prototype._promiseRejected=function(e,t){var n=new r;n._bitField=134217728,n._settledValue=e,this._promiseResolved(t,n)},t.settle=function(e){return(new s(e)).promise()},t.prototype.settle=function(){return(new s(this)).promise()}}},{"./util.js":38}],33:[function(e,t,n){"use strict";t.exports=function(t,n,r){function a(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function f(e,t){if((t|0)!==t||t<0)return r("expecting a positive integer\n\n    See http://goo.gl/1wAmHx\n");var n=new a(e),i=n.promise();return n.setHowMany(t),n.init(),i}var i=e("./util.js"),s=e("./errors.js").RangeError,o=e("./errors.js").AggregateError,u=i.isArray;i.inherits(a,n),a.prototype._init=function(){if(!this._initialized)return;if(this._howMany===0){this._resolve([]);return}this._init$(undefined,-5);var e=u(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))},a.prototype.init=function(){this._initialized=!0,this._init()},a.prototype.setUnwrap=function(){this._unwrap=!0},a.prototype.howMany=function(){return this._howMany},a.prototype.setHowMany=function(e){this._howMany=e},a.prototype._promiseFulfilled=function(e){this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),this.howMany()===1&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values))},a.prototype._promiseRejected=function(e){this._addRejected(e);if(this.howMany()>this._canPossiblyFulfill()){var t=new o;for(var n=this.length();n<this._values.length;++n)t.push(this._values[n]);this._reject(t)}},a.prototype._fulfilled=function(){return this._totalResolved},a.prototype._rejected=function(){return this._values.length-this.length()},a.prototype._addRejected=function(e){this._values.push(e)},a.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},a.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},a.prototype._getRangeError=function(e){var t="Input array must contain at least "+this._howMany+" items but contains only "+e+" items";return new s(t)},a.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=function(e,t){return f(e,t)},t.prototype.some=function(e){return f(this,e)},t._SomePromiseArray=a}},{"./errors.js":13,"./util.js":38}],34:[function(e,t,n){"use strict";t.exports=function(e){function t(e){e!==undefined?(e=e._target(),this._bitField=e._bitField,this._settledValue=e._settledValue):(this._bitField=0,this._settledValue=undefined)}t.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n    See http://goo.gl/hc1DLj\n");return this._settledValue},t.prototype.error=t.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n    See http://goo.gl/hPuiwB\n");return this._settledValue},t.prototype.isFulfilled=e.prototype._isFulfilled=function(){return(this._bitField&268435456)>0},t.prototype.isRejected=e.prototype._isRejected=function(){return(this._bitField&134217728)>0},t.prototype.isPending=e.prototype._isPending=function(){return(this._bitField&402653184)===0},t.prototype.isResolved=e.prototype._isResolved=function(){return(this._bitField&402653184)>0},e.prototype.isPending=function(){return this._target()._isPending()},e.prototype.isRejected=function(){return this._target()._isRejected()},e.prototype.isFulfilled=function(){return this._target()._isFulfilled()},e.prototype.isResolved=function(){return this._target()._isResolved()},e.prototype._value=function(){return this._settledValue},e.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue},e.prototype.value=function(){var e=this._target();if(!e.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n    See http://goo.gl/hc1DLj\n");return e._settledValue},e.prototype.reason=function(){var e=this._target();if(!e.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n    See http://goo.gl/hPuiwB\n");return e._unsetRejectionIsUnhandled(),e._settledValue},e.PromiseInspection=t}},{}],35:[function(e,t,n){"use strict";t.exports=function(t,n){function o(e,o){if(s(e)){if(e instanceof t)return e;if(f(e)){var a=new t(n);return e._then(a._fulfillUnchecked,a._rejectUncheckedCheckError,a._progressUnchecked,a,null),a}var c=r.tryCatch(u)(e);if(c===i){o&&o._pushContext();var a=t.reject(c.e);return o&&o._popContext(),a}if(typeof c=="function")return l(e,c,o)}return e}function u(e){return e.then}function f(e){return a.call(e,"_promise0")}function l(e,s,o){function c(n){if(!u)return;e===n?u._rejectCallback(t._makeSelfResolutionError(),!1,!0):u._resolveCallback(n),u=null}function h(e){if(!u)return;u._rejectCallback(e,f,!0),u=null}function p(e){if(!u)return;typeof u._progress=="function"&&u._progress(e)}var u=new t(n),a=u;o&&o._pushContext(),u._captureStackTrace(),o&&o._popContext();var f=!0,l=r.tryCatch(s).call(e,c,h,p);return f=!1,u&&l===i&&(u._rejectCallback(l.e,!0,!0),u=null),a}var r=e("./util.js"),i=r.errorObj,s=r.isObject,a={}.hasOwnProperty;return o}},{"./util.js":38}],36:[function(e,t,n){"use strict";t.exports=function(t,n){function a(e){var t=this;return t instanceof Number&&(t=+t),clearTimeout(t),e}function f(e){var t=this;throw t instanceof Number&&(t=+t),clearTimeout(t),e}var r=e("./util.js"),i=t.TimeoutError,s=function(e,t){if(!e.isPending())return;typeof t!="string"&&(t="operation timed out");var n=new i(t);r.markAsOriginatingFromRejection(n),e._attachExtraTrace(n),e._cancel(n)},o=function(e){return u(+this).thenReturn(e)},u=t.delay=function(e,r){if(r===undefined){r=e,e=undefined;var i=new t(n);return setTimeout(function(){i._fulfill()},r),i}return r=+r,t.resolve(e)._then(o,null,null,r,undefined)};t.prototype.delay=function(e){return u(this,e)},t.prototype.timeout=function(e,t){e=+e;var n=this.then().cancellable();n._cancellationParent=this;var r=setTimeout(function(){s(n,t)},e);return n._then(a,f,undefined,r,undefined)}}},{"./util.js":38}],37:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){function a(e){var n=e.length;for(var r=0;r<n;++r){var i=e[r];if(i.isRejected())return t.reject(i.error());e[r]=i._settledValue}return e}function f(e){setTimeout(function(){throw e},0)}function l(e){var t=r(e);return t!==e&&typeof e._isDisposable=="function"&&typeof e._getDisposer=="function"&&e._isDisposable()&&t._setDisposable(e._getDisposer()),t}function c(e,n){function u(){if(i>=s)return o.resolve();var a=l(e[i++]);if(a instanceof t&&a._isDisposable()){try{a=r(a._getDisposer().tryDispose(n),e.promise)}catch(c){return f(c)}if(a instanceof t)return a._then(u,f,null,null,null)}u()}var i=0,s=e.length,o=t.defer();return u(),o.promise}function h(e){var t=new u;return t._settledValue=e,t._bitField=268435456,c(this,t).thenReturn(e)}function p(e){var t=new u;return t._settledValue=e,t._bitField=134217728,c(this,t).thenThrow(e)}function d(e,t,n){this._data=e,this._promise=t,this._context=n}function v(e,t,n){this.constructor$(e,t,n)}function m(e){return d.isDisposer(e)?(this.resources[this.index]._setDisposable(e),e.promise()):e}var s=e("./errors.js").TypeError,o=e("./util.js").inherits,u=t.PromiseInspection;d.prototype.data=function(){return this._data},d.prototype.promise=function(){return this._promise},d.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},d.prototype.tryDispose=function(e){var t=this.resource(),n=this._context;n!==undefined&&n._pushContext();var r=t!==null?this.doDispose(t,e):null;return n!==undefined&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},d.isDisposer=function(e){return e!=null&&typeof e.resource=="function"&&typeof e.tryDispose=="function"},o(v,d),v.prototype.doDispose=function(e,t){var n=this.data();return n.call(e,e,t)},t.using=function(){var e=arguments.length;if(e<2)return n("you must pass at least 2 arguments to Promise.using");var i=arguments[e-1];if(typeof i!="function")return n("fn must be a function\n\n    See http://goo.gl/916lJJ\n");e--;var s=new Array(e);for(var o=0;o<e;++o){var u=arguments[o];if(d.isDisposer(u)){var f=u;u=u.promise(),u._setDisposable(f)}else{var l=r(u);l instanceof t&&(u=l._then(m,null,null,{resources:s,index:o},undefined))}s[o]=u}var c=t.settle(s).then(a).then(function(e){c._pushContext();var t;try{t=i.apply(undefined,e)}finally{c._popContext()}return t})._then(h,p,undefined,s,undefined);return s.promise=c,c},t.prototype._setDisposable=function(e){this._bitField=this._bitField|262144,this._disposer=e},t.prototype._isDisposable=function(){return(this._bitField&262144)>0},t.prototype._getDisposer=function(){return this._disposer},t.prototype._unsetDisposable=function(){this._bitField=this._bitField&-262145,this._disposer=undefined},t.prototype.disposer=function(e){if(typeof e=="function")return new v(e,this,i());throw new s}}},{"./errors.js":13,"./util.js":38}],38:[function(_dereq_,module,exports){"use strict";function tryCatcher(){try{return tryCatchTarget.apply(this,arguments)}catch(e){return errorObj.e=e,errorObj}}function tryCatch(e){return tryCatchTarget=e,tryCatcher}function isPrimitive(e){return e==null||e===!0||e===!1||typeof e=="string"||typeof e=="number"}function isObject(e){return!isPrimitive(e)}function maybeWrapAsError(e){return isPrimitive(e)?new Error(safeToString(e)):e}function withAppended(e,t){var n=e.length,r=new Array(n+1),i;for(i=0;i<n;++i)r[i]=e[i];return r[i]=t,r}function getDataPropertyOrDefault(e,t,n){if(!es5.isES5)return{}.hasOwnProperty.call(e,t)?e[t]:undefined;var r=Object.getOwnPropertyDescriptor(e,t);if(r!=null)return r.get==null&&r.set==null?r.value:n}function notEnumerableProp(e,t,n){if(isPrimitive(e))return e;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return es5.defineProperty(e,t,r),e}function thrower(e){throw e}function isClass(e){try{if(typeof e=="function"){var t=es5.names(e.prototype);return es5.isES5?t.length>1:t.length>0&&(t.length!==1||t[0]!=="constructor")}return!1}catch(n){return!1}}function toFastProperties(obj){function f(){}f.prototype=obj;var l=8;while(l--)new f;return obj}function isIdentifier(e){return rident.test(e)}function filledRange(e,t,n){var r=new Array(e);for(var i=0;i<e;++i)r[i]=t+i+n;return r}function safeToString(e){try{return e+""}catch(t){return"[no string representation]"}}function markAsOriginatingFromRejection(e){try{notEnumerableProp(e,"isOperational",!0)}catch(t){}}function originatesFromRejection(e){return e==null?!1:e instanceof Error.__BluebirdErrorTypes__.OperationalError||e.isOperational===!0}function canAttachTrace(e){return e instanceof Error&&es5.propertyIsWritable(e,"stack")}function classString(e){return{}.toString.call(e)}function copyDescriptors(e,t,n){var r=es5.names(e);for(var i=0;i<r.length;++i){var s=r[i];n(s)&&es5.defineProperty(t,s,es5.getDescriptor(e,s))}}var es5=_dereq_("./es5.js"),canEvaluate=typeof navigator=="undefined",haveGetters=function(){try{var e={};return es5.defineProperty(e,"f",{get:function(){return 3}}),e.f===3}catch(t){return!1}}(),errorObj={e:{}},tryCatchTarget,inherits=function(e,t){function r(){this.constructor=e,this.constructor$=t;for(var r in t.prototype)n.call(t.prototype,r)&&r.charAt(r.length-1)!=="$"&&(this[r+"$"]=t.prototype[r])}var n={}.hasOwnProperty;return r.prototype=t.prototype,e.prototype=new r,e.prototype},wrapsPrimitiveReceiver=function(){return this!=="string"}.call("string"),inheritedDataKeys=function(){if(es5.isES5){var e=Object.prototype,t=Object.getOwnPropertyNames;return function(n){var r=[],i=Object.create(null);while(n!=null&&n!==e){var s;try{s=t(n)}catch(o){return r}for(var u=0;u<s.length;++u){var a=s[u];if(i[a])continue;i[a]=!0;var f=Object.getOwnPropertyDescriptor(n,a);f!=null&&f.get==null&&f.set==null&&r.push(a)}n=es5.getPrototypeOf(n)}return r}}return function(e){var t=[];for(var n in e)t.push(n);return t}}(),rident=/^[a-z$_][a-z$_0-9]*$/i,ensureErrorObject=function(){return"stack"in new Error?function(e){return canAttachTrace(e)?e:new Error(safeToString(e))}:function(e){if(canAttachTrace(e))return e;try{throw new Error(safeToString(e))}catch(t){return t}}}(),ret={isClass:isClass,isIdentifier:isIdentifier,inheritedDataKeys:inheritedDataKeys,getDataPropertyOrDefault:getDataPropertyOrDefault,thrower:thrower,isArray:es5.isArray,haveGetters:haveGetters,notEnumerableProp:notEnumerableProp,isPrimitive:isPrimitive,isObject:isObject,canEvaluate:canEvaluate,errorObj:errorObj,tryCatch:tryCatch,inherits:inherits,withAppended:withAppended,maybeWrapAsError:maybeWrapAsError,wrapsPrimitiveReceiver:wrapsPrimitiveReceiver,toFastProperties:toFastProperties,filledRange:filledRange,toString:safeToString,canAttachTrace:canAttachTrace,ensureErrorObject:ensureErrorObject,originatesFromRejection:originatesFromRejection,markAsOriginatingFromRejection:markAsOriginatingFromRejection,classString:classString,copyDescriptors:copyDescriptors,hasDevTools:typeof chrome!="undefined"&&chrome&&typeof chrome.loadTimes=="function",isNode:typeof process!="undefined"&&classString(process).toLowerCase()==="[object process]"};try{throw new Error}catch(e){ret.lastLineError=e}module.exports=ret},{"./es5.js":14}],39:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||undefined}function i(e){return typeof e=="function"}function s(e){return typeof e=="number"}function o(e){return typeof e=="object"&&e!==null}function u(e){return e===void 0}t.exports=r,r.EventEmitter=r,r.prototype._events=undefined,r.prototype._maxListeners=undefined,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,s,a,f;this._events||(this._events={});if(e==="error")if(!this._events.error||o(this._events.error)&&!this._events.error.length)throw t=arguments[1],t instanceof Error?t:TypeError('Uncaught, unspecified "error" event.');n=this._events[e];if(u(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:r=arguments.length,s=new Array(r-1);for(a=1;a<r;a++)s[a-1]=arguments[a];n.apply(this,s)}else if(o(n)){r=arguments.length,s=new Array(r-1);for(a=1;a<r;a++)s[a-1]=arguments[a];f=n.slice(),r=f.length;for(a=0;a<r;a++)f[a].apply(this,s)}return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t;if(o(this._events[e])&&!this._events[e].warned){var n;u(this._maxListeners)?n=r.defaultMaxListeners:n=this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),typeof console.trace=="function"&&console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var n,r,s,u;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;n=this._events[e],s=n.length,r=-1;if(n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(u=s;u-->0;)if(n[u]===t||n[u].listener&&n[u].listener===t){r=u;break}if(r<0)return this;n.length===1?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[e]&&delete this._events[e],this;if(arguments.length===0){for(t in this._events){if(t==="removeListener")continue;this.removeAllListeners(t)}return this.removeAllListeners("removeListener"),this._events={},this}n=this._events[e];if(i(n))this.removeListener(e,n);else while(n.length)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return!this._events||!this._events[e]?t=[]:i(this._events[e])?t=[this._events[e]]:t=this._events[e].slice(),t},r.listenerCount=function(e,t){var n;return!e._events||!e._events[t]?n=0:i(e._events[t])?n=1:n=e._events[t].length,n}},{}]},{},[4])(4)}),typeof window!="undefined"&&window!==null?window.P=window.Promise:typeof self!="undefined"&&self!==null&&(self.P=self.Promise),define("adapter/main",["require","exports","module","bluebird"],function(e,t){"use strict";var n=e("bluebird"),r=n.promisify(_spaces.openURLInDefaultBrowser),i={major:1,minor:0,patch:13};Object.defineProperties(t,{version:{enumerable:!0,value:_spaces.version},abort:{enumerable:!0,value:n.promisify(_spaces.abort)}});var s=function(e,t){return e.hasOwnProperty("major")&&e.major>t.major?!1:e.hasOwnProperty("minor")&&e.minor>t.minor?!1:e.hasOwnProperty("patch")&&e.patch>t.patch?!1:!0},o=function(e){return[e.major,e.minor,e.patch].join(".")},u=function(){var e=_spaces.version;if(!s(i,e)){var t="Plugin version "+o(e)+" is incompatible with the minimum required version, "+o(i);throw new Error(t)}},a=function(e){return r(e)};t.openURLInDefaultBrowser=a,u()}),define("adapter",["adapter/main"],function(e){return e}),define("text",["module"],function(e){"use strict";var t,n,r,i,s,o=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],u=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,a=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,f=typeof location!="undefined"&&location.href,l=f&&location.protocol&&location.protocol.replace(/\:/,""),c=f&&location.hostname,h=f&&(location.port||undefined),p={},d=e.config&&e.config()||{};t={version:"2.0.14",strip:function(e){if(e){e=e.replace(u,"");var t=e.match(a);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:d.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=o[t];try{e=new ActiveXObject(n)}catch(r){}if(e){o=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.lastIndexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,d.isBuild&&(p[e]=r),i(r)},load:function(e,n,r,i){if(i&&i.isBuild&&!i.inlineText){r();return}d.isBuild=i&&i.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),u=n.toUrl(o),a=d.useXhr||t.useXhr;if(u.indexOf("empty:")===0){r();return}!f||a(u,l,c,h)?t.get(u,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(p.hasOwnProperty(n)){var s=t.jsEscape(p[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(d.env==="node"||!d.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node&&!process.versions["node-webkit"]&&!process.versions["atom-shell"])n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");i[0]==="﻿"&&(i=i.substring(1)),t(i)}catch(s){r&&r(s)}};else if(d.env==="xhr"||!d.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);d.onXhr&&d.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status||0,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r&&r(o)):n(s.responseText),d.onXhrComplete&&d.onXhrComplete(s,e))},s.send(null)};else if(d.env==="rhino"||!d.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),r!==null&&n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};else if(d.env==="xpconnect"||!d.env&&typeof Components!="undefined"&&Components.classes&&Components.interfaces)r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in r,t.get=function(e,t){var n,o,u,a={};s&&(e=e.replace(/\//g,"\\")),u=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(u,1,0,!1),o=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),o.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(n.available(),a),o.close(),n.close(),t(a.value)}catch(f){throw new Error((u&&u.path||"")+": "+f)}};return t}),define("jsx",{load:function(e){throw new Error("Dynamic load not allowed: "+e)}}),function(t,n){typeof exports=="object"&&typeof module=="object"?module.exports=n():typeof define=="function"&&define.amd?define("fluxxor",n):typeof exports=="object"?exports.Fluxxor=n():t.Fluxxor=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var t={};return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){var r=n(1),i=n(2),s=n(3),o=n(4),u=n(5),a=n(6),f={Dispatcher:r,Flux:i,FluxMixin:s,FluxChildMixin:o,StoreWatchMixin:u,createStore:a,version:n(7)};e.exports=f},function(e,t,n){var r=n(12),i=n(15),s=n(16),o=n(19),u=n(17),a=n(21),f=n(22),l=n(23),c=n(18),h=n(20),p=function(e){this.stores={},this.currentDispatch=null,this.currentActionType=null,this.waitingToDispatch=[];for(var t in e)e.hasOwnProperty(t)&&this.addStore(t,e[t])};p.prototype.addStore=function(e,t){t.dispatcher=this,this.stores[e]=t},p.prototype.dispatch=function(e){if(!e||!e.type)throw new Error("Can only dispatch actions with a 'type' property");if(this.currentDispatch){var t="Cannot dispatch an action ('"+e.type+"') while another action ('"+this.currentActionType+"') is being dispatched";throw new Error(t)}this.waitingToDispatch=r(this.stores),this.currentActionType=e.type,this.currentDispatch=i(this.stores,function(){return{resolved:!1,waitingOn:[],waitCallback:null}});try{this.doDispatchLoop(e)}finally{this.currentActionType=null,this.currentDispatch=null}},p.prototype.doDispatchLoop=function(e){var t,n,r=!1,i=[],c=[];s(this.waitingToDispatch,function(s,f){t=this.currentDispatch[f],n=!t.waitingOn.length||!o(t.waitingOn,u(this.waitingToDispatch)).length;if(n){if(t.waitCallback){var l=a(t.waitingOn,function(e){return this.stores[e]},this),h=t.waitCallback;t.waitCallback=null,t.waitingOn=[],t.resolved=!0,h.apply(null,l),r=!0}else{t.resolved=!0;var p=this.stores[f].__handleAction__(e);p&&(r=!0)}c.push(f),this.currentDispatch[f].resolved&&i.push(f)}},this);if(u(this.waitingToDispatch).length&&!c.length){var h=u(this.waitingToDispatch).join(", ");throw new Error("Indirect circular wait detected among: "+h)}f(i,function(e){delete this.waitingToDispatch[e]},this),l(this.waitingToDispatch)&&this.doDispatchLoop(e),!r&&console&&console.warn&&console.warn("An action of type "+e.type+" was dispatched, but no store handled it")},p.prototype.waitForStores=function(e,t,n){if(!this.currentDispatch)throw new Error("Cannot wait unless an action is being dispatched");var r=c(this.stores,function(t){return t===e});if(t.indexOf(r)>-1)throw new Error("A store cannot wait on itself");var i=this.currentDispatch[r];if(i.waitingOn.length)throw new Error(r+" already waiting on stores");f(t,function(e){var t=this.currentDispatch[e];if(!this.stores[e])throw new Error("Cannot wait for non-existent store "+e);if(t.waitingOn.indexOf(r)>-1)throw new Error("Circular wait detected between "+r+" and "+e)},this),i.resolved=!1,i.waitingOn=h(i.waitingOn.concat(t)),i.waitCallback=n},e.exports=p},function(e,t,n){var r=n(10),i=n(8),s=n(11),o=n(22),u=n(24),a=n(13),f=n(14),l=n(1),c=function(e,t,n){t=t||[];for(var r in e)e.hasOwnProperty(r)&&(a(e[r])?n(t.concat(r),e[r]):c(e[r],t.concat(r),n))},h=function(e,t){r.call(this),this.dispatcher=new l(e),this.actions={},this.stores={};var n=this.dispatcher,i=this;this.dispatchBinder={flux:i,dispatch:function(e,t){try{i.emit("dispatch",e,t)}finally{n.dispatch({type:e,payload:t})}}},this.addActions(t),this.addStores(e)};i(h,r),h.prototype.addActions=function(e){c(e,[],this.addAction.bind(this))},h.prototype.addAction=function(){if(arguments.length<2)throw new Error("addAction requires at least two arguments, a string (or array of strings) and a function");var e=Array.prototype.slice.call(arguments);if(!a(e[e.length-1]))throw new Error("The last argument to addAction must be a function");var t=e.pop().bind(this.dispatchBinder);f(e[0])||(e=e[0]);var n=u(e,function(e,t){if(e){var n=e[e.length-1].concat([t]);return e.concat([n])}return[[t]]},null);o(n,function(t){if(a(s.get(this.actions,t)))throw new Error("An action named "+e.join(".")+" already exists")},this);if(s.get(this.actions,e))throw new Error("A namespace named "+e.join(".")+" already exists");s.set(this.actions,e,t,!0)},h.prototype.store=function(e){return this.stores[e]},h.prototype.addStore=function(e,t){if(e in this.stores)throw new Error("A store named '"+e+"' already exists");t.flux=this,this.stores[e]=t,this.dispatcher.addStore(e,t)},h.prototype.addStores=function(e){for(var t in e)e.hasOwnProperty(t)&&this.addStore(t,e[t])},e.exports=h},function(e,t,n){var r=function(e){return{componentWillMount:function(){if(!this.props.flux&&(!this.context||!this.context.flux)){var e=this.constructor.displayName?" of "+this.constructor.displayName:"";throw new Error("Could not find flux on this.props or this.context"+e)}},childContextTypes:{flux:e.PropTypes.object},contextTypes:{flux:e.PropTypes.object},getChildContext:function(){return{flux:this.getFlux()}},getFlux:function(){return this.props.flux||this.context&&this.context.flux}}};r.componentWillMount=function(){throw new Error("Fluxxor.FluxMixin is a function that takes React as a parameter and returns the mixin, e.g.: mixins: [Fluxxor.FluxMixin(React)]")},e.exports=r},function(e,t,n){var r=function(e){return{componentWillMount:function(){if(console&&console.warn){var e=this.constructor.displayName?" in "+this.constructor.displayName:"",t="Fluxxor.FluxChildMixin was found in use"+e+", "+"but has been deprecated. Use Fluxxor.FluxMixin instead.";console.warn(t)}},contextTypes:{flux:e.PropTypes.object},getFlux:function(){return this.context.flux}}};r.componentWillMount=function(){throw new Error("Fluxxor.FluxChildMixin is a function that takes React as a parameter and returns the mixin, e.g.: mixins[Fluxxor.FluxChildMixin(React)]")},e.exports=r},function(e,t,n){var r=n(22),i=function(){var e=Array.prototype.slice.call(arguments);return{componentDidMount:function(){var t=this.props.flux||this.context.flux;r(e,function(e){t.store(e).on("change",this._setStateFromFlux)},this)},componentWillUnmount:function(){var t=this.props.flux||this.context.flux;r(e,function(e){t.store(e).removeListener("change",this._setStateFromFlux)},this)},_setStateFromFlux:function(){this.isMounted()&&this.setState(this.getStateFromFlux())},getInitialState:function(){return this.getStateFromFlux()}}};i.componentWillMount=function(){throw new Error('Fluxxor.StoreWatchMixin is a function that takes one or more store names as parameters and returns the mixin, e.g.: mixins: [Fluxxor.StoreWatchMixin("Store1", "Store2")]')},e.exports=i},function(e,t,n){var r=n(22),i=n(13),s=n(9),o=n(8),u=["flux","waitFor"],a=function(e){r(u,function(t){if(e[t])throw new Error("Reserved key '"+t+"' found in store definition")});var t=function(t){t=t||{},s.call(this);for(var n in e)n==="actions"?this.bindActions(e[n]):n!=="initialize"&&(i(e[n])?this[n]=e[n].bind(this):this[n]=e[n]);e.initialize&&e.initialize.call(this,t)};return o(t,s),t};e.exports=a},function(e,t,n){e.exports="1.5.3"},function(e,t,n){typeof Object.create=="function"?e.exports=function(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},function(e,t,n){function u(e){this.dispatcher=e,this.__actions__={},r.call(this)}var r=n(10),i=n(8),s=n(13),o=n(25);i(u,r),u.prototype.__handleAction__=function(e){var t;if(!(t=this.__actions__[e.type]))return!1;if(s(t))t.call(this,e.payload,e.type);else{if(!t||!s(this[t]))throw new Error("The handler for action type "+e.type+" is not a function");this[t].call(this,e.payload,e.type)}return!0},u.prototype.bindActions=function(){var e=Array.prototype.slice.call(arguments);if(e.length>1&&e.length%2!==0)throw new Error("bindActions must take an even number of arguments.");var t=function(e,t){if(!t)throw new Error("The handler for action type "+e+" is falsy");this.__actions__[e]=t}.bind(this);if(e.length===1&&o(e[0])){e=e[0];for(var n in e)e.hasOwnProperty(n)&&t(n,e[n])}else for(var r=0;r<e.length;r+=2){var i=e[r],s=e[r+1];if(!i)throw new Error("Argument "+(r+1)+" to bindActions is a falsy value");t(i,s)}},u.prototype.waitFor=function(e,t){this.dispatcher.waitForStores(this,e,t.bind(this))},e.exports=u},function(e,t,n){"use strict";function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(){}i.prototype._events=undefined,i.prototype.listeners=function(t){if(!this._events||!this._events[t])return[];if(this._events[t].fn)return[this._events[t].fn];for(var n=0,r=this._events[t].length,i=new Array(r);n<r;n++)i[n]=this._events[t][n].fn;return i},i.prototype.emit=function(t,n,r,i,s,o){if(!this._events||!this._events[t])return!1;var u=this._events[t],a=arguments.length,f,l;if("function"==typeof u.fn){u.once&&this.removeListener(t,u.fn,!0);switch(a){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,n),!0;case 3:return u.fn.call(u.context,n,r),!0;case 4:return u.fn.call(u.context,n,r,i),!0;case 5:return u.fn.call(u.context,n,r,i,s),!0;case 6:return u.fn.call(u.context,n,r,i,s,o),!0}for(l=1,f=new Array(a-1);l<a;l++)f[l-1]=arguments[l];u.fn.apply(u.context,f)}else{var c=u.length,h;for(l=0;l<c;l++){u[l].once&&this.removeListener(t,u[l].fn,!0);switch(a){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,n);break;case 3:u[l].fn.call(u[l].context,n,r);break;default:if(!f)for(h=1,f=new Array(a-1);h<a;h++)f[h-1]=arguments[h];u[l].fn.apply(u[l].context,f)}}}return!0},i.prototype.on=function(t,n,i){var s=new r(n,i||this);return this._events||(this._events={}),this._events[t]?this._events[t].fn?this._events[t]=[this._events[t],s]:this._events[t].push(s):this._events[t]=s,this},i.prototype.once=function(t,n,i){var s=new r(n,i||this,!0);return this._events||(this._events={}),this._events[t]?this._events[t].fn?this._events[t]=[this._events[t],s]:this._events[t].push(s):this._events[t]=s,this},i.prototype.removeListener=function(t,n,r){if(!this._events||!this._events[t])return this;var i=this._events[t],s=[];if(n){i.fn&&(i.fn!==n||r&&!i.once)&&s.push(i);if(!i.fn)for(var o=0,u=i.length;o<u;o++)(i[o].fn!==n||r&&!i[o].once)&&s.push(i[o])}return s.length?this._events[t]=s.length===1?s[0]:s:delete this._events[t],this},i.prototype.removeAllListeners=function(t){return this._events?(t?delete this._events[t]:this._events={},this):this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prototype.setMaxListeners=function(){return this},i.EventEmitter=i,i.EventEmitter2=i,i.EventEmitter3=i,e.exports=i},function(e,t,n){var r,i,s;(function(n,o){"use strict";typeof e=="object"&&typeof e.exports=="object"?e.exports=o():(i=[],r=o,s=typeof r=="function"?r.apply(t,i):r,s===undefined||!(e.exports=s))})(this,function(){"use strict";function n(e){if(!e)return!0;if(u(e)&&e.length===0)return!0;for(var n in e)if(t.call(e,n))return!1;return!0}function r(t){return e.call(t)}function i(e){return typeof e=="number"||r(e)==="[object Number]"}function s(e){return typeof e=="string"||r(e)==="[object String]"}function o(e){return typeof e=="object"&&r(e)==="[object Object]"}function u(e){return typeof e=="object"&&typeof e.length=="number"&&r(e)==="[object Array]"}function a(e){return typeof e=="boolean"||r(e)==="[object Boolean]"}function f(e){var t=parseInt(e);return t.toString()===e?t:e}function l(e,t,r,o){i(t)&&(t=[t]);if(n(t))return e;if(s(t))return l(e,t.split("."),r,o);var u=f(t[0]);if(t.length===1){var a=e[u];if(a===void 0||!o)e[u]=r;return a}return e[u]===void 0&&(i(u)?e[u]=[]:e[u]={}),l(e[u],t.slice(1),r,o)}function c(e,t){i(t)&&(t=[t]);if(n(e))return void 0;if(n(t))return e;if(s(t))return c(e,t.split("."));var r=f(t[0]),o=e[r];if(t.length===1)o!==void 0&&(u(e)?e.splice(r,1):delete e[r]);else if(e[r]!==void 0)return c(e[r],t.slice(1));return e}var e=Object.prototype.toString,t=Object.prototype.hasOwnProperty,h={};return h.ensureExists=function(e,t,n){return l(e,t,n,!0)},h.set=function(e,t,n,r){return l(e,t,n,r)},h.insert=function(e,t,n,r){var i=h.get(e,t);r=~~r,u(i)||(i=[],h.set(e,t,i)),i.splice(r,0,n)},h.empty=function(e,r){if(n(r))return e;if(n(e))return void 0;var f,l;if(!(f=h.get(e,r)))return e;if(s(f))return h.set(e,r,"");if(a(f))return h.set(e,r,!1);if(i(f))return h.set(e,r,0);if(u(f))f.length=0;else{if(!o(f))return h.set(e,r,null);for(l in f)t.call(f,l)&&delete f[l]}},h.push=function(e,t){var n=h.get(e,t);u(n)||(n=[],h.set(e,t,n)),n.push.apply(n,Array.prototype.slice.call(arguments,2))},h.coalesce=function(e,t,n){var r;for(var i=0,s=t.length;i<s;i++)if((r=h.get(e,t[i]))!==void 0)return r;return n},h.get=function(e,t,r){i(t)&&(t=[t]);if(n(t))return e;if(n(e))return r;if(s(t))return h.get(e,t.split("."),r);var o=f(t[0]);return t.length===1?e[o]===void 0?r:e[o]:h.get(e[o],t.slice(1),r)},h.del=function(e,t){return c(e,t)},h})},function(e,t,n){function o(e,t,n,o){return t&&typeof t!="boolean"&&s(e,t,n)?t=!1:typeof t=="function"&&(o=n,n=t,t=!1),n=typeof n=="function"&&i(n,o,1),r(e,t,n)}var r=n(26),i=n(27),s=n(28);e.exports=o},function(e,t,n){(function(t){var r=n(29),i=n(30),s="[object Function]",o=Object.prototype,u=o.toString,a=i(a=t.Uint8Array)&&a,f=r(/x/)||a&&!r(a)?function(e){return u.call(e)==s}:r;e.exports=f}).call(t,function(){return this}())},function(e,t,n){function u(e){return typeof e=="string"||r(e)&&o.call(e)==i}var r=n(31),i="[object String]",s=Object.prototype,o=s.toString;e.exports=u},function(e,t,n){function s(e,t,n){var s={};return t=r(t,n,3),i(e,function(e,n,r){s[n]=t(e,n,r)}),s}var r=n(34),i=n(32);e.exports=s},function(e,t,n){var r=n(32),i=n(33),s=i(r);e.exports=s},function(e,t,n){var r=n(35),i=n(30),s=n(25),o=n(36),u=i(u=Object.keys)&&u,a=u?function(e){if(e)var t=e.constructor,n=e.length;return typeof t=="function"&&t.prototype===e||typeof e!="function"&&n&&r(n)?o(e):s(e)?u(e):[]}:o;e.exports=a},function(e,t,n){var r=n(32),i=n(39),s=i(r);e.exports=s},function(e,t,n){function a(){var e=[],t=-1,n=arguments.length,a=[],f=r,l=!0;while(++t<n){var c=arguments[t];if(u(c)||o(c))e.push(c),a.push(l&&c.length>=120?s(t&&c):null)}n=e.length;var h=e[0],p=-1,d=h?h.length:0,v=[],m=a[0];e:while(++p<d){c=h[p];if((m?i(m,c):f(v,c,0))<0){t=n;while(--t){var g=a[t];if((g?i(g,c):f(e[t],c,0))<0)continue e}m&&m.push(c),v.push(c)}}return v}var r=n(40),i=n(41),s=n(42),o=n(43),u=n(44);e.exports=a},function(e,t,n){function u(e,t,n,u){var a=e?e.length:0;return a?(t!=null&&typeof t!="boolean"&&(u=n,n=s(e,t,u)?null:t,t=!1),n=n==null?n:r(n,u,3),t?o(e,n):i(e,n)):[]}var r=n(34),i=n(37),s=n(28),o=n(38);e.exports=u},function(e,t,n){function u(e,t,n){var u=o(e)?r:s;return t=i(t,n,3),u(e,t)}var r=n(45),i=n(34),s=n(46),o=n(44);e.exports=u},function(e,t,n){var r=n(47),i=n(48),s=n(49),o=s(r,i);e.exports=o},function(e,t,n){function s(e){var t=e?e.length:0;return r(t)?t:i(e).length}var r=n(35),i=n(17);e.exports=s},function(e,t,n){var r=n(50),i=n(48),s=n(51),o=s(r,i);e.exports=o},function(e,t,n){function r(e){var t=typeof e;return t=="function"||!!e&&t=="object"}e.exports=r},function(e,t,n){function I(e,t,n,d,v,m,g){var b;n&&(b=v?n(e,d,v):n(e));if(typeof b!="undefined")return b;if(!c(e))return e;var w=l(e);if(w){b=u(e);if(!t)return r(e,b)}else{var S=F.call(e),x=S==y;if(!(S==E||S==p||x&&!v))return B[S]?a(e,S,t):v?e:{};b=f(x?{}:e);if(!t)return s(e,b,h(e))}m||(m=[]),g||(g=[]);var T=m.length;while(T--)if(m[T]==e)return g[T];return m.push(e),g.push(b),(w?i:o)(e,function(r,i){b[i]=I(r,t,n,i,e,m,g)}),b}var r=n(52),i=n(47),s=n(53),o=n(32),u=n(54),a=n(55),f=n(56),l=n(44),c=n(25),h=n(17),p="[object Arguments]",d="[object Array]",v="[object Boolean]",m="[object Date]",g="[object Error]",y="[object Function]",b="[object Map]",w="[object Number]",E="[object Object]",S="[object RegExp]",x="[object Set]",T="[object String]",N="[object WeakMap]",C="[object ArrayBuffer]",k="[object Float32Array]",L="[object Float64Array]",A="[object Int8Array]",O="[object Int16Array]",M="[object Int32Array]",_="[object Uint8Array]",D="[object Uint8ClampedArray]",P="[object Uint16Array]",H="[object Uint32Array]",B={};B[p]=B[d]=B[C]=B[v]=B[m]=B[k]=B[L]=B[A]=B[O]=B[M]=B[w]=B[E]=B[S]=B[T]=B[_]=B[D]=B[P]=B[H]=!0,B[g]=B[y]=B[b]=B[x]=B[N]=!1;var j=Object.prototype,F=j.toString;e.exports=I},function(e,t,n){function i(e,t,n){if(typeof e!="function")return r;if(typeof t=="undefined")return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,s){return e.call(t,n,r,i,s)};case 5:return function(n,r,i,s,o){return e.call(t,n,r,i,s,o)}}return function(){return e.apply(t,arguments)}}var r=n(57);e.exports=i},function(e,t,n){function o(e,t,n){if(!s(n))return!1;var o=typeof t;if(o=="number")var u=n.length,a=i(u)&&r(t,u);else a=o=="string"&&t in n;if(a){var f=n[t];return e===e?e===f:f!==f}return!1}var r=n(58),i=n(35),s=n(25);e.exports=o},function(e,t,n){function r(e){return typeof e=="function"||!1}e.exports=r},function(e,t,n){function c(e){return e==null?!1:f.call(e)==s?l.test(a.call(e)):i(e)&&o.test(e)}var r=n(59),i=n(31),s="[object Function]",o=/^\[object .+?Constructor\]$/,u=Object.prototype,a=Function.prototype.toString,f=u.toString,l=RegExp("^"+r(f).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=c},function(e,t,n){function r(e){return!!e&&typeof e=="object"}e.exports=r},function(e,t,n){function s(e,t){return r(e,t,i)}var r=n(60),i=n(17);e.exports=s},function(e,t,n){function i(e){return function(t,n,i){if(typeof n!="function"||typeof i!="undefined")n=r(n,i,3);return e(t,n)}}var r=n(27);e.exports=i},function(e,t,n){function a(e,t,n){var a=typeof e;return a=="function"?typeof t=="undefined"?e:o(e,t,n):e==null?u:a=="object"?r(e):typeof t=="undefined"?s(e+""):i(e+"",t)}var r=n(61),i=n(62),s=n(63),o=n(27),u=n(57);e.exports=a},function(e,t,n){function i(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}var r=Math.pow(2,53)-1;e.exports=i},function(e,t,n){function c(e){var t=u(e),n=t.length,f=n&&e.length,c=f&&o(f)&&(i(e)||a.nonEnumArgs&&r(e)),h=-1,p=[];while(++h<n){var d=t[h];(c&&s(d,f)||l.call(e,d))&&p.push(d)}return p}var r=n(43),i=n(44),s=n(58),o=n(35),u=n(64),a=n(65),f=Object.prototype,l=f.hasOwnProperty;e.exports=c},function(e,t,n){function o(e,t){var n=-1,o=r,u=e.length,a=!0,f=a&&u>=200,l=f?s():null,c=[];l?(o=i,a=!1):(f=!1,l=t?[]:c);e:while(++n<u){var h=e[n],p=t?t(h,n,e):h;if(a&&h===h){var d=l.length;while(d--)if(l[d]===p)continue e;t&&l.push(p),c.push(h)}else o(l,p,0)<0&&((t||f)&&l.push(p),c.push(h))}return c}var r=n(40),i=n(41),s=n(42);e.exports=o},function(e,t,n){function r(e,t){var n,r=-1,i=e.length,s=-1,o=[];while(++r<i){var u=e[r],a=t?t(u,r,e):u;if(!r||n!==a)n=a,o[++s]=u}return o}e.exports=r},function(e,t,n){function s(e){return function(t,n,s){return n=r(n,s,3),i(t,n,e,!0)}}var r=n(34),i=n(66);e.exports=s},function(e,t,n){function i(e,t,n){if(t!==t)return r(e,n);var i=n-1,s=e.length;while(++i<s)if(e[i]===t)return i;return-1}var r=n(67);e.exports=i},function(e,t,n){function i(e,t){var n=e.data,i=typeof t=="string"||r(t)?n.set.has(t):n.hash[t];return i?0:-1}var r=n(25);e.exports=i},function(e,t,n){(function(t){var r=n(68),i=n(69),s=n(30),o=s(o=t.Set)&&o,u=s(u=Object.create)&&u,a=!u||!o?i(null):function(e){return new r(e)};e.exports=a}).call(t,function(){return this}())},function(e,t,n){function a(e){var t=i(e)?e.length:undefined;return r(t)&&u.call(e)==s}var r=n(35),i=n(31),s="[object Arguments]",o=Object.prototype,u=o.toString;e.exports=a},function(e,t,n){var r=n(35),i=n(30),s=n(31),o="[object Array]",u=Object.prototype,a=u.toString,f=i(f=Array.isArray)&&f,l=f||function(e){return s(e)&&r(e.length)&&a.call(e)==o};e.exports=l},function(e,t,n){function r(e,t){var n=-1,r=e.length,i=Array(r);while(++n<r)i[n]=t(e[n],n,e);return i}e.exports=r},function(e,t,n){function i(e,t){var n=[];return r(e,function(e,r,i){n.push(t(e,r,i))}),n}var r=n(48);e.exports=i},function(e,t,n){function r(e,t){var n=-1,r=e.length;while(++n<r)if(t(e[n],n,e)===!1)break;return e}e.exports=r},function(e,t,n){var r=n(32),i=n(70),s=i(r);e.exports=s},function(e,t,n){function s(e,t){return function(n,s,o){return typeof s=="function"&&typeof o=="undefined"&&i(n)?e(n,s):t(n,r(s,o,3))}}var r=n(27),i=n(44);e.exports=s},function(e,t,n){function r(e,t,n,r){var i=-1,s=e.length;r&&s&&(n=e[++i]);while(++i<s)n=t(n,e[i],i,e);return n}e.exports=r},function(e,t,n){function o(e,t){return function(n,o,u,a){var f=arguments.length<3;return typeof o=="function"&&typeof a=="undefined"&&s(n)?e(n,o,u,f):i(n,r(o,a,4),u,f,t)}}var r=n(34),i=n(71),s=n(44);e.exports=o},function(e,t,n){function r(e,t){var n=-1,r=e.length;t||(t=Array(r));while(++n<r)t[n]=e[n];return t}e.exports=r},function(e,t,n){function r(e,t,n){n||(n=t,t={});var r=-1,i=n.length;while(++r<i){var s=n[r];t[s]=e[s]}return t}e.exports=r},function(e,t,n){function s(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&i.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var r=Object.prototype,i=r.hasOwnProperty;e.exports=s},function(e,t,n){function w(e,t,n){var w=e.constructor;switch(t){case f:return r(e);case i:case s:return new w(+e);case l:case c:case h:case p:case d:case v:case m:case g:case y:var E=e.buffer;return new w(n?r(E):E,e.byteOffset,e.length);case o:case a:return new w(e);case u:var S=new w(e.source,b.exec(e));S.lastIndex=e.lastIndex}return S}var r=n(72),i="[object Boolean]",s="[object Date]",o="[object Number]",u="[object RegExp]",a="[object String]",f="[object ArrayBuffer]",l="[object Float32Array]",c="[object Float64Array]",h="[object Int8Array]",p="[object Int16Array]",d="[object Int32Array]",v="[object Uint8Array]",m="[object Uint8ClampedArray]",g="[object Uint16Array]",y="[object Uint32Array]",b=/\w*$/;e.exports=w},function(e,t,n){function r(e){var t=e.constructor;return typeof t=="function"&&t instanceof t||(t=Object),new t}e.exports=r},function(e,t,n){function r(e){return e}e.exports=r},function(e,t,n){function i(e,t){return e=+e,t=t==null?r:t,e>-1&&e%1==0&&e<t}var r=Math.pow(2,53)-1;e.exports=i},function(e,t,n){function o(e){return e=r(e),e&&s.test(e)?e.replace(i,"\\$&"):e}var r=n(73),i=/[.*+?^${}()|[\]\/\\]/g,s=RegExp(i.source);e.exports=o},function(e,t,n){var r=n(74),i=r();e.exports=i},function(e,t,n){function a(e){var t=o(e),n=t.length;if(!n)return i(!0);if(n==1){var a=t[0],f=e[a];if(s(f))return function(e){return e!=null&&e[a]===f&&(typeof f!="undefined"||a in u(e))}}var l=Array(n),c=Array(n);while(n--)f=e[t[n]],l[n]=f,c[n]=s(f);return function(e){return e!=null&&r(u(e),t,l,c)}}var r=n(75),i=n(69),s=n(76),o=n(17),u=n(77);e.exports=a},function(e,t,n){function o(e,t){return i(t)?function(n){return n!=null&&n[e]===t&&(typeof t!="undefined"||e in s(n))}:function(n){return n!=null&&r(t,n[e],null,!0)}}var r=n(78),i=n(76),s=n(77);e.exports=o},function(e,t,n){function r(e){return function(t){return t==null?undefined:t[e]}}e.exports=r},function(e,t,n){function c(e){if(e==null)return[];u(e)||(e=Object(e));var t=e.length;t=t&&o(t)&&(i(e)||a.nonEnumArgs&&r(e))&&t||0;var n=e.constructor,f=-1,c=typeof n=="function"&&n.prototype===e,h=Array(t),p=t>0;while(++f<t)h[f]=f+"";for(var d in e)(!p||!s(d,t))&&(d!="constructor"||!c&&!!l.call(e,d))&&h.push(d);return h}var r=n(43),i=n(44),s=n(58),o=n(35),u=n(25),a=n(65),f=Object.prototype,l=f.hasOwnProperty;e.exports=c},function(e,t,n){(function(t){var n=Object.prototype,r=(r=t.window)&&r.document,i=n.propertyIsEnumerable,s={};(function(e){s.funcDecomp=/\bthis\b/.test(function(){return this}),s.funcNames=typeof Function.name=="string";try{s.dom=r.createDocumentFragment().nodeType===11}catch(t){s.dom=!1}try{s.nonEnumArgs=!i.call(arguments,1)}catch(t){s.nonEnumArgs=!0}})(0,0),e.exports=s}).call(t,function(){return this}())},function(e,t,n){function r(e,t,n,r){var i;return n(e,function(e,n,s){if(t(e,n,s))return i=r?n:e,!1}),i}e.exports=r},function(e,t,n){function r(e,t,n){var r=e.length,i=t+(n?0:-1);while(n?i--:++i<r){var s=e[i];if(s!==s)return i}return-1}e.exports=r},function(e,t,n){(function(t){function u(e){var t=e?e.length:0;this.data={hash:o(null),set:new s};while(t--)this.push(e[t])}var r=n(79),i=n(30),s=i(s=t.Set)&&s,o=i(o=Object.create)&&o;u.prototype.push=r,e.exports=u}).call(t,function(){return this}())},function(e,t,n){function r(e){return function(){return e}}e.exports=r},function(e,t,n){function s(e,t){return function(n,s){var o=n?n.length:0;if(!r(o))return e(n,s);var u=t?o:-1,a=i(n);while(t?u--:++u<o)if(s(a[u],u,a)===!1)break;return n}}var r=n(35),i=n(77);e.exports=s},function(e,t,n){function r(e,t,n,r,i){return i(e,function(e,i,s){n=r?(r=!1,e):t(n,e,i,s)}),n}e.exports=r},function(e,t,n){(function(t){function c(e){return o.call(e,0)}var r=n(69),i=n(30),s=i(s=t.ArrayBuffer)&&s,o=i(o=s&&(new s(0)).slice)&&o,u=Math.floor,a=i(a=t.Uint8Array)&&a,f=function(){try{var e=i(e=t.Float64Array)&&e,n=new e(new s(10),0,1)&&e}catch(r){}return n}(),l=f?f.BYTES_PER_ELEMENT:0;o||(c=!s||!a?r(null):function(e){var t=e.byteLength,n=f?u(t/l):0,r=n*l,i=new s(t);if(n){var o=new f(i,0,n);o.set(new f(e,0,n))}return t!=r&&(o=new a(i,r),o.set(new a(e,r))),i}),e.exports=c}).call(t,function(){return this}())},function(e,t,n){function r(e){return typeof e=="string"?e:e==null?"":e+""}e.exports=r},function(e,t,n){function i(e){return function(t,n,i){var s=r(t),o=i(t),u=o.length,a=e?u:-1;while(e?a--:++a<u){var f=o[a];if(n(s[f],f,s)===!1)break}return t}}var r=n(77);e.exports=i},function(e,t,n){function i(e,t,n,i,s){var o=-1,u=t.length,a=!s;while(++o<u)if(a&&i[o]?n[o]!==e[t[o]]:!(t[o]in e))return!1;o=-1;while(++o<u){var f=t[o],l=e[f],c=n[o];if(a&&i[o])var h=typeof l!="undefined"||f in e;else h=s?s(l,c,f):undefined,typeof h=="undefined"&&(h=r(c,l,s,!0));if(!h)return!1}return!0}var r=n(78);e.exports=i},function(e,t,n){function i(e){return e===e&&(e===0?1/e>0:!r(e))}var r=n(25);e.exports=i},function(e,t,n){function i(e){return r(e)?e:Object(e)}var r=n(25);e.exports=i},function(e,t,n){function i(e,t,n,s,o,u){if(e===t)return e!==0||1/e==1/t;var a=typeof e,f=typeof t;return a!="function"&&a!="object"&&f!="function"&&f!="object"||e==null||t==null?e!==e&&t!==t:r(e,t,i,n,s,o,u)}var r=n(80);e.exports=i},function(e,t,n){function i(e){var t=this.data;typeof e=="string"||r(e)?t.set.add(e):t.hash[e]=!0}var r=n(25);e.exports=i},function(e,t,n){function v(e,t,n,h,v,m,g){var y=o(e),b=o(t),w=f,E=f;y||(w=d.call(e),w==a?w=c:w!=c&&(y=u(e))),b||(E=d.call(t),E==a?E=c:E!=c&&(b=u(t)));var S=w==c||v&&w==l,x=E==c||v&&E==l,T=w==E;if(T&&!y&&!S)return i(e,t,w);if(v){if(!T&&(!S||!x))return!1}else{var N=S&&p.call(e,"__wrapped__"),C=x&&p.call(t,"__wrapped__");if(N||C)return n(N?e.value():e,C?t.value():t,h,v,m,g);if(!T)return!1}m||(m=[]),g||(g=[]);var k=m.length;while(k--)if(m[k]==e)return g[k]==t;m.push(e),g.push(t);var L=(y?r:s)(e,t,n,h,v,m,g);return m.pop(),g.pop(),L}var r=n(81),i=n(82),s=n(83),o=n(44),u=n(84),a="[object Arguments]",f="[object Array]",l="[object Function]",c="[object Object]",h=Object.prototype,p=h.hasOwnProperty,d=h.toString;e.exports=v},function(e,t,n){function r(e,t,n,r,i,s,o){var u=-1,a=e.length,f=t.length,l=!0;if(a!=f&&!(i&&f>a))return!1;while(l&&++u<a){var c=e[u],h=t[u];l=undefined,r&&(l=i?r(h,c,u):r(c,h,u));if(typeof l=="undefined")if(i){var p=f;while(p--){h=t[p],l=c&&c===h||n(c,h,r,i,s,o);if(l)break}}else l=c&&c===h||n(c,h,r,i,s,o)}return!!l}e.exports=r},function(e,t,n){function f(e,t,n){switch(n){case r:case i:return+e==+t;case s:return e.name==t.name&&e.message==t.message;case o:return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case u:case a:return e==t+""}return!1}var r="[object Boolean]",i="[object Date]",s="[object Error]",o="[object Number]",u="[object RegExp]",a="[object String]";e.exports=f},function(e,t,n){function o(e,t,n,i,o,u,a){var f=r(e),l=f.length,c=r(t),h=c.length;if(l!=h&&!o)return!1;var p=o,d=-1;while(++d<l){var v=f[d],m=o?v in t:s.call(t,v);if(m){var g=e[v],y=t[v];m=undefined,i&&(m=o?i(y,g,v):i(g,y,v)),typeof m=="undefined"&&(m=g&&g===y||n(g,y,i,o,u,a))}if(!m)return!1;p||(p=v=="constructor")}if(!p){var b=e.constructor,w=t.constructor;if(b!=w&&"constructor"in e&&"constructor"in t&&!(typeof b=="function"&&b instanceof b&&typeof w=="function"&&w instanceof w))return!1}return!0}var r=n(17),i=Object.prototype,s=i.hasOwnProperty;e.exports=o},function(e,t,n){function M(e){return i(e)&&r(e.length)&&!!L[O.call(e)]}var r=n(35),i=n(31),s="[object Arguments]",o="[object Array]",u="[object Boolean]",a="[object Date]",f="[object Error]",l="[object Function]",c="[object Map]",h="[object Number]",p="[object Object]",d="[object RegExp]",v="[object Set]",m="[object String]",g="[object WeakMap]",y="[object ArrayBuffer]",b="[object Float32Array]",w="[object Float64Array]",E="[object Int8Array]",S="[object Int16Array]",x="[object Int32Array]",T="[object Uint8Array]",N="[object Uint8ClampedArray]",C="[object Uint16Array]",k="[object Uint32Array]",L={};L[b]=L[w]=L[E]=L[S]=L[x]=L[T]=L[N]=L[C]=L[k]=!0,L[s]=L[o]=L[y]=L[u]=L[a]=L[f]=L[l]=L[c]=L[h]=L[p]=L[d]=L[v]=L[m]=L[g]=!1;var A=Object.prototype,O=A.toString;e.exports=M}])}),define("jsx!js/jsx/shared/Button",["require","exports","module","react"],function(e,t,n){"use strict";var r=e("react"),i=r.createClass({displayName:"Button",mixins:[r.addons.PureRenderMixin],render:function(){var e={"button-simple":!0,"button-simple__disabled":this.props.disabled};this.props.hasOwnProperty("className")&&(e[this.props.className]=!0);var t=r.addons.classSet(e),n=!this.props.disabled&&this.props.onClick,i=!this.props.disabled&&this.props.onDoubleClick;return r.createElement("div",r.__spread({},this.props,{onClick:n,onDoubleClick:i,className:t}),this.props.children)}});n.exports=i}),define("jsx!js/jsx/shared/SVGIcon",["require","exports","module","react"],function(e,t,n){"use strict";var r=e("react"),i=r.createClass({displayName:"SVGIcon",_getDefaultIconPath:function(){return"img/ico-"+this.props.CSSID+".svg#"+this.props.CSSID},_setLinkAttribute:function(e){var t;this.props.hasOwnProperty("iconPath")?t=this.props.iconPath+"#"+this.props.CSSID:t=this._getDefaultIconPath(),e.setAttributeNS("http://www.w3.org/1999/xlink","href",t)},shouldComponentUpdate:function(e){return e.iconPath!==this.props.iconPath||e.CSSID!==this.props.CSSID},componentDidMount:function(){var e=this.getDOMNode(),t=window.document.createElementNS("http://www.w3.org/2000/svg","use");this._setLinkAttribute(t),e.appendChild(t)},componentDidUpdate:function(){var e=this.getDOMNode().querySelector("use");this._setLinkAttribute(e)},render:function(){return this.props.hasOwnProperty("className")||(this.props.className=""),r.createElement("svg",{viewBox:this.props.viewBox,className:this.props.className})}});n.exports=i}),function(){"use strict";function t(e,t,n,r,i,s){t[e]&&(n.push(e),(t[e]===!0||t[e]===1)&&r.push(i+e+"/"+s))}function n(e,t,n,r,i){var s=r+t+"/"+i;require._fileExists(e.toUrl(s+".js"))&&n.push(s)}function r(e,t,n){var i;for(i in t)t.hasOwnProperty(i)&&(!e.hasOwnProperty(i)||n)?e[i]=t[i]:typeof t[i]=="object"&&(!e[i]&&t[i]&&(e[i]={}),r(e[i],t[i],n))}var e=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(i){var s=i.config?i.config():{};return{version:"2.0.4",load:function(i,o,u,a){a=a||{},a.locale&&(s.locale=a.locale);var f,l=e.exec(i),c=l[1],h=l[4],p=l[5],d=h.split("-"),v=[],m={},g,y,b="";l[5]?(c=l[1],f=c+p):(f=i,p=l[4],h=s.locale,h||(h=s.locale=typeof navigator=="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),d=h.split("-"));if(a.isBuild){v.push(f),n(o,"root",v,c,p);for(g=0;g<d.length;g++)y=d[g],b+=(b?"-":"")+y,n(o,b,v,c,p);o(v,function(){u()})}else o([f],function(e){var n=[],i;t("root",e,n,v,c,p);for(g=0;g<d.length;g++)i=d[g],b+=(b?"-":"")+i,t(b,e,n,v,c,p);o(v,function(){var t,i,s;for(t=n.length-1;t>-1&&n[t];t--){s=n[t],i=e[s];if(i===!0||i===1)i=o(c+s+"/"+p);r(m,i)}u(m)})})}}})}(),define("nls/strings",["require","exports","module"],function(e,t,n){"use strict";n.exports={root:!0}}),define("nls/root/strings",["require","exports","module"],function(e,t,n){"use strict";n.exports={ACTIONS:{ADD_STROKE:"Add Stroke",ADD_FILL:"Add Fill",SET_STROKE_COLOR:"Set Stroke Color",SET_STROKE_OPACITY:"Set Stroke Opacity",SET_STROKE_WIDTH:"Set Stroke Width",SET_STROKE_ALIGNMENT:"Set Stroke Alignment",SET_FILL_COLOR:"Set Fill Color",SET_FILL_OPACITY:"Set Fill Opacity",DELETE_LAYERS:"Delete Layers",CHANGE_LAYER_OPACITY:"Change Layer Opacity",SET_BLEND_MODE:"Set Blend Mode",FLIP_LAYERS:"Flip Layers",ALIGN_LAYERS:"Align Layers",DISTRIBUTE_LAYERS:"Distribute Layers",SET_RADIUS:"Set Radius",ROTATE_LAYERS:"Rotate Layers",DUPLICATE_LAYERS:"Duplicate Layers",SET_LAYER_EFFECTS:"Set Layer Effects",SET_LAYER_POSITION:"Set Position",SET_LAYER_SIZE:"Set Size",NUDGE_LAYERS:"Nudge Layers",SWAP_LAYERS:"Swap Layers",COMBINE_SHAPES:"Combine Shapes",SET_PROPORTIONAL_SCALE:"Set Proportional Scaling",SET_TYPE_FACE:"Set Type Face",SET_TYPE_COLOR:"Set Type Color",SET_TYPE_SIZE:"Set Type Size",SET_TYPE_LEADING:"Set Type Leading",SET_TYPE_TRACKING:"Set Type Tracking",SET_TYPE_ALIGNMENT:"Set Type Alignment"},APP_NAME:"Photoshop",MENU:{APPLICATION:{$MENU:"Application",ABOUT_MAC:"About Photoshop…",PREFERENCES:"Preferences…",HIDE_APPLICATION:"Hide Photoshop",HIDE_OTHER_APPLICATIONS:"Hide Others",SHOW_ALL:"Show All",QUIT_APPLICATION_MAC:"Quit Photoshop"},FILE:{$MENU:"File",NEW:"New",NEW_EXTENDED:"New…",NEW_FROM_TEMPLATE:{$MENU:"New From Template",IPHONE_6_PLUS:"iPhone 6+",IPHONE_6:"iPhone 6",IPHONE_5:"iPhone 5",IPAD_12:"iPad Mini",IPAD_34:"iPad Retina",ANDROID_1080P:"Android 1080p",MS_SURFACE_PRO:"Microsoft Surface Pro",MS_SURFACE_PRO_3:"Microsoft Surface Pro 3",APPLE_WATCH_38MM:"Apple Watch 38mm",APPLE_WATCH_42MM:"Apple Watch 42mm",WEB_1440_900:"Web (1440 x 900)",WEB_1920_1080:"Web (1920 x 1080)"},OPEN:"Open...",OPEN_RECENT:{$MENU:"Open Recent"},CLOSE:"Close",SAVE:"Save",SAVE_AS:"Save As…",REVERT:"Revert",RENAME_DOCUMENT:"Rename…",GENERATE_ASSETS:"Generate Assets…",AUTO_GENERATE_IMAGE_ASSETS:"Auto Generate Assets",PLACE_EMBEDDED:"Place Embedded…",PLACE_LINKED:"Place Linked…",PACKAGE:"Package…",PRINT:"Print…",QUIT_APPLICATION_WIN:"Quit Photoshop"},EDIT:{$MENU:"Edit",UNDO:"Undo",REDO:"Redo",CUT:"Cut",CUT_ATTRIBUTES:"Cut Attributes | Style",COPY:"Copy",COPY_MERGED:"Copy Merged",COPY_ATTRIBUTES:"Copy Attributes | Style",COPY_CSS:"Copy CSS Attributes",PASTE:"Paste",PASTE_ATTRIBUTES:"Paste Attributes | Style",DELETE:"Delete",CLEAR_ATTRIBUTES:"Clear Attributes",DUPLICATE:"Duplicate Selection",DUPLICATE_WITH_OFFSET:"Duplicate Selection with Offset",SELECT_ALL:"Select All",DESELECT:"Deselect",INVERT_SELECTION:"Invert Selection"},LAYER:{$MENU:"Layer",CONVERT_TO_SMART_OBJECT:"Convert To Smart Object",FIND_LAYER:"Find Layer…",RENAME_LAYER:"Rename Layer…",MERGE_LAYERS:"Merge Layers",COMBINE:{$MENU:"Combine",COMBINE_UNION:"Union",COMBINE_SUBTRACT:"Subtract",COMBINE_INTERSECT:"Intersect",COMBINE_DIFFERENCE:"Difference"},TRANSFORM:{$MENU:"Transform",TRANSFORM_SCALE:"Scale",TRANSFORM_ROTATE:"Rotate",TRANSFORM_ROTATE_180:"Rotate 180º",TRANSFORM_ROTATE_LEFT:"Rotate Left",TRANSFORM_ROTATE_RIGHT:"Rotate Right"},CREATE_CLIPPING_MASK:"Create Clipping Mask",CREATE_ARTBOARD:"Create New Artboard"},TYPE:{$MENU:"Type",ADD_FONTS_FROM_TYPEKIT:"Add Fonts from Typekit…",BOLD:"Bold",ITALIC:"Italic",UNDERLINE:"Underline",CHANGE_CASE:{$MENU:"Change Case",LOWERCASE:"lowercase",UPPERCASE:"UPPERCASE",TITLECASE:"Title Case",SENTENCECASE:"Sentence case"},INCREASE_FONT_SIZE:"Increase Size",DECREASE_FONT_SIZE:"Decrease Size",TEXT_SPACING_TIGHTEN:"Tighten Kerning | Letter Spacing",TEXT_SPACING_LOOSEN:"Loosen Kerning | Letter Spacing",LINEHEIGHT_INCREASE:"Raise Line Height",LINEHEIGHT_DECREASE:"Lower Line Height",ALIGN_TEXT:{$MENU:"Align Text",ALIGN_TEXT_LEFT:"Left",ALIGN_TEXT_CENTER:"Center",ALIGN_TEXT_RIGHT:"Right",ALIGN_TEXT_JUSTIFY:"Justify"},SWASH:"Swash | …",OLD_STYLE:"Old Style | …",ORNAMENTS:"Ornaments | …",ORDINALS:"Ordinals | …",FRACTIONS:"Fractions | …",STANDARD_LIGATURES:"Standard Ligatures | …",DISCRETIONARY_LIGATURES:"Discretionary Ligatures | …",TITLING_ALTERNATES:"Titling Ligatures | …",CONTEXTUAL_ALTERNATES:"Contextual Alternates | …",STYLISTIC_ALTERNATES:"Stylistic Alternates | …",JUSTIFICATION_ALTERNATES:"Justification Alternates | …",CONVERT_TEXT_TO_OUTLINES:"Convert Text to Outlines"},ARRANGE:{$MENU:"Arrange",BRING_FORWARD:"Bring Forward",BRING_FRONT:"Bring to Front",SEND_BACKWARD:"Send Backward",SEND_TO_BACK:"Send to Back",LAYOUT_MAKE_GRID_OF_OBJECTS:"Make Grid of Objects…",LAYOUT_DIVIDE:"Divide…",LAYOUT_INSET:"Inset…",DISTRIBUTE:{$MENU:"Distribute Objects",DISTRIBUTE_HORIZONTAL:"Horizontally",DISTRIBUTE_VERTICAL:"Vertically",DISTRIBUTE_EVENLY:"Evenly"},ALIGN:{$MENU:"Align Objects",ALIGN_LEFT:"Left",ALIGN_CENTER:"Center",ALIGN_RIGHT:"Right",ALIGN_TOP:"Top",ALIGN_MIDDLE:"Middle",ALIGN_BOTTOM:"Bottom"},FLIP_HORIZONTAL:"Flip Horizontal",FLIP_VERTICAL:"Flip Vertical",SWAP_POSITION:"Swap Position",LOCK_LAYER:"Lock",UNLOCK_LAYER:"Unlock",GROUP_LAYERS:"Group",UNGROUP_LAYERS:"Ungroup"},VIEW:{$MENU:"View",ZOOM_IN:"Zoom In",ZOOM_OUT:"Zoom Out",FIT_TO_WINDOW:"Fit to Window",ACTUAL_SIZE:"Actual Size",ZOOM_TO_SELECTION:"Zoom to Selection",CENTER_SELECTION:"Center Selection",FULLSCREEN_MENUBAR:"Full Screen with Menu Bar",FULLSCREEN:"Full Screen",PRESENTATION:"Presentation",TOGGLE_EXTRAS:"Show | Hide Extras",TOGGLE_RULERS:"Show | Hide Rulers",TOGGLE_SMART_GUIDES:"Show Smart Guides",TOGGLE_GUIDES:"Show Guides"},WINDOW:{$MENU:"Window",MINIMIZE:"Minimize",BRING_ALL_TO_FRONT:"Bring All to Front",NEXT_DOCUMENT:"Next Document",TOGGLE_TOOLBAR:"Pin Toolbar",PREVIOUS_DOCUMENT:"Previous Document",RETURN_TO_STANDARD:"Return to Standard Photoshop",OPEN_DOCUMENT_ONE:"Document Name 1",OPEN_DOCUMENT_TWO:"Document Name 2",OPEN_DOCUMENT_THREE:"…etc…"},HELP:{$MENU:"Help",ABOUT_WIN:"About Photoshop…",RUN_TESTS:"Run Tests…",ACTION_FAILURE:"Test Action Failure…",RESET_FAILURE:"Test Reset Failure…",UPDATE_CURRENT_DOCUMENT:"Update Current Document",RESET_RECESS:"Reset Design Space",OPEN_FIRST_LAUNCH:"Design Space Introduction",SHORTCUTS:"Keyboard Shortcuts",TWITTER:"Design Space on Twitter",HELPX:"Design Space Help",FORUM:"Design Space Forum"}},FIRST_LAUNCH:{CONTINUE:"Continue",GET_STARTED:"Get Started",SLIDES:[{HEADLINE:"Hiya.",SUBHEAD:"Welcome to something awesome.",BODY:"This is Design Space (technology preview), a companion experience to Photoshop for professional web and app designers. Interactions are tailored to your workflows, and built on the power and reliability that you know from Adobe Photoshop CC."},{HEADLINE:"Streamlined Interface",BODY:"A minimized toolset and a single contextual properties panel give you only the necessary information and controls, letting you focus on your work."},{HEADLINE:"New Features and Interactions",BODY:"We’re leveraging a new technology, Photoshop Spaces, that allows us to quickly build new interactions and features just for your workflows. Expect to get your job done faster with fewer clicks and dialogs. Stay tuned for more – this is just the beginning!",FEATURE_SELECT:{TITLE:"Select",BODY:"An improved Select Tool simplifies targeting and editing. Double-click to dive into any group, nested group or layer, and Escape to back out."},FEATURE_VECTOR:{TITLE:"Vector Workflow",BODY:"Design Space takes a vector-first approach. Shapes and type are first-class citizens, with creation, layout, styling, and editing optimized for efficiency."},FEATURE_MATH:{TITLE:"Math Operations",BODY:"Use math operations (like 100 / 2) in any numeric field to quickly describe positions, lengths and sizes."},FEATURE_ARTBOARD:{TITLE:"Artboard",BODY:"Create multiple artboards to design both visuals and overall flow in a single document. Artboards are the default experience."},FEATURE_SWAP:{TITLE:"Swap",BODY:"Easily swap the contents and positions of any pair of layers or groups with a single click."},FEATURE_OS:{TITLE:"Open Source",BODY:"Download the source code and follow our development team’s progress on "}},{HEADLINE:"Moving between Design Space and Photoshop",BODY:"Design Space is planned to be fully compatible with standard Photoshop and PSDs. Jump back and forth from the toolbar, with a keyboard shortcut, or from the Window menu."},{HEADLINE:"Feedback",BODY:"Visit us online and tell us what you think. It’s still early and you can help make Design Space even better."}]},KEYBOARD_SHORTCUTS:{TOOLS_TITLE:"Tools",SELECT_TITLE:"Select Tool",TOOLS:{SELECT:"Select",RECTANGLE:"Rectangle",ELLIPSE:"Ellipse",PEN:"Pen",TYPE:"Type"},SELECT_TOOL:{TARGET:"Target Nested Group / Layers",TARGET_INSTRUCTION:"Double-click on Canvas",EDIT_PATH:"Edit Path / Text",EDIT_PATH_INSTRUCTION:"Double-click on Vector Object / Type",EDIT_SMART:"Edit / Open in Set Application",EDIT_SMART_INSTRUCTION:"Double-click on Smart Object",BACK_OUT:"Back Out of Hierarchy",BACK_OUT_INSTRUCTION:"Esc",HOLD_SELECTION:"Hold the Topmost Selection in Layers",HOLD_SEL_MAC:"Opt + Esc",HOLD_SEL_WIN:"Shift + Esc",TARGET_LAYER:"Target Specific Layer",TARGET_LAYER_MAC:"Cmd + Click",TARGET_LAYER_WIN:"Ctrl + Click"}},TITLE_PAGES:"LAYERS",TITLE_STYLE:"STYLE",NO_DOC:{RECENT_FILES_TITLE:"RECENT FILES",ARTBOARD_PRESETS_TITLE:"TEMPLATES"},TITLE_TRANSFORM:"TRANSFORM",TOOLS:{newSelect:"V - Select Tool",rectangle:"R - Rectangle Tool",ellipse:"E - Ellipse Tool",pen:"P - Pen Tool",typeCreateOrEdit:"T - Type Tool",eyedropper:"I - Sampler Tool"},TOOLTIPS:{SELECT_NEXT_DOCUMENT:"Select Next Document",SELECT_PREVIOUS_DOCUMENT:"Select Previous Document",UNSUPPORTED_FEATURES:"Document has unsupported features and is read-only",DISTRIBUTE_HORIZONTALLY:"Distribute Horizontal Center",DISTRIBUTE_VERTICALLY:"Distribute Vertical Center",ALIGN_LEFT:"Align Left Edges",ALIGN_CENTER:"Align Horizontal Center",ALIGN_RIGHT:"Align Right Edges",ALIGN_TOP:"Align Top Edges",ALIGN_MIDDLE:"Align Vertical Center",ALIGN_BOTTOM:"Align Bottom Edges",SET_X_POSITION:"Set X Position",SET_Y_POSITION:"Set Y Position",SET_WIDTH:"Set Width",LOCK_PROPORTIONAL_TRANSFORM:"Lock Width & Height to Proportional",SET_HEIGHT:"Set Height",SET_ROTATION:"Set Rotation",FLIP_HORIZONTAL:"Flip Horizontal",FLIP_VERTICAL:"Flip Vertical",SWAP_POSITION:"Swap Position",SET_RADIUS:"Set Border Radius",SET_RADIUS_SLIDER:"Adjust Slider to Set Radius ",SET_OPACITY:"Set Opacity",VECTOR_SETTINGS:"Show Vector Settings",SET_COMBINATION:"Set Shape Combination",UNITE_SHAPE:"Unite Shape",SUBTRACT_SHAPE:"Subtract Shape",INTERSECT_SHAPE:"Intersect Shape",DIFFERENCE_SHAPE:"Difference Shape",SHOW_LOREM_IPSUM:"Show Lorem Ipsum",SHOW_GLYPHS:"Show Glyphs",TYPE_SETTINGS:"Show Type Settings",SET_TYPEFACE:"Set Typeface",SET_WEIGHT:"Set Weight",SET_TYPE_COLOR:"Set Text Color",SET_TYPE_SIZE:"Set Text Size",SET_LETTERSPACING:"Set Letterspacing",SET_LINESPACING:"Set Linespacing",SET_TYPE_ALIGNMENT:"Set Type Alignment",ALIGN_TYPE_LEFT:"Align Text Left",ALIGN_TYPE_CENTER:"Align Text Center",ALIGN_TYPE_RIGHT:"Align Text Right",ALIGN_TYPE_JUSTIFIED:"Justify Text",SET_STROKE_COLOR:"Set Stroke Color",SET_STROKE_OPACITY:"Set Stroke Opacity",SET_STROKE_SIZE:"Set Stroke Size",SET_STROKE_ALIGNMENT:"Set Stroke Alignment",TOGGLE_STROKE:"Toggle Stroke",SET_FILL_COLOR:"Set Fill Color",SET_FILL_OPACITY:"Set Fill Opacity",SET_FILL_BLENDING:"Set Fill Blending",TOGGLE_FILL:"Toggle Fill",SET_LAYER_VISIBILITY:"Set Layer Visibility",LOCK_LAYER:"Lock Layer",LAYER_COUNT:"Selected layers of total layers",TOGGLE_DROP_SHADOW:"Toggle Drop Shadow",SET_DROP_SHADOW_COLOR:"Set Drop Shadow Color",SET_DROP_SHADOW_PROPS:"Set Drop Shadow Dimensions",SET_DROP_SHADOW_X_POSITION:"Set Drop Shadow X Position",SET_DROP_SHADOW_Y_POSITION:"Set Drop Shadow Y Position",SET_DROP_SHADOW_BLUR:"Set Drop Shadow Blur",SET_DROP_SHADOW_SPREAD:"Set Drop Shadow Spread",SET_COLOR_PICKER_FORMAT:"Set Color Picker Format",SET_COLOR_PICKER_MODE:"Set Color Picker Mode",TOGGLE_INNER_SHADOW:"Toggle Inner Shadow",SET_INNER_SHADOW_COLOR:"Set Inner Shadow Color",SET_INNER_SHADOW_PROPS:"Set Inner Shadow Dimensions",SET_INNER_SHADOW_X_POSITION:"Set Inner Shadow X Position",SET_INNER_SHADOW_Y_POSITION:"Set Inner Shadow Y Position",SET_INNER_SHADOW_BLUR:"Set Inner Shadow Blur",SET_INNER_SHADOW_SPREAD:"Set Inner Shadow Spread",SECTION_COLLAPSE:": double-click to collapse",SECTION_EXPAND:": double-click to expand"},LAYER_KIND:{0:"Any Layer",1:"Pixel Layer",2:"Adjustment Layer",3:"Text Layer",4:"Vector Layer",5:"Smart Object Layer",6:"Video Layer",7:"Group Layer",8:"3D Layer",9:"Gradient Layer",10:"Pattern Layer",11:"Solidcolor Layer",12:"Background Layer",13:"Groupend Layer"},COLOR_PICKER:{FORMAT:"Format",MODE:{SOLID:"Solid",GRADIENT:"Gradient",PATTERN:"Pattern"}},TRANSFORM:{X:"X",Y:"Y",W:"W",H:"H",RADIUS:"Radius",ROTATE:"Rotate",MIXED:"mixed"},STYLE:{BLEND:{NORMAL:"Normal",DISSOLVE:"Dissolve",DARKEN:"Darken",LIGHTEN:"Lighten",SCREEN:"Screen",OVERLAY:"Overlay",MULTIPLY:"Multiply",COLORBURN:"Color Burn",LINEARBURN:"Linear Burn",DARKERCOLOR:"Darker Color",PASSTHROUGH:"Pass Through",COLORDODGE:"Color Dodge",LINEARDODGE:"Linear Dodge",LIGHTERCOLOR:"Lighter Color",SOFTLIGHT:"Soft Light",HARDLIGHT:"Hard Light",VIVIDLIGHT:"Vivid Light",LINEARLIGHT:"Linear Light",PINLIGHT:"Pin Light",HARDMIX:"Hard Mix",DIFFERENCE:"Difference",EXCLUSION:"Exclusion",SUBTRACT:"Subtract",DIVIDE:"Divide",HUE:"Hue",SATURATION:"Saturation",COLOR:"Color",LUMINOSITY:"Luminosity"},OPACITY:"Opacity",FILL:{TITLE:"Fill",ALPHA:"Alpha",BLENDING:"Blending"},STROKE:{TITLE:"Stroke",ALPHA:"Alpha",SIZE:"Size",ALIGNMENT:"Align",ALIGNMENT_MODES:{INSIDE:"Inside",CENTER:"Center",OUTSIDE:"Outside"}},DROP_SHADOW:{TITLE:"Drop Shadows",ADD:"Add Drop Shadow",X_POSITION:"X",Y_POSITION:"Y",BLUR:"Blur",SPREAD:"Spread"},INNER_SHADOW:{TITLE:"Inner Shadows",ADD:"Add Inner Shadow",X_POSITION:"X",Y_POSITION:"Y",BLUR:"Blur",SPREAD:"Spread"},TYPE:{TITLE:"Type",TYPEFACE:"Typeface",WEIGHT:"Weight",SIZE:"Size",LETTER:"Letter",LINE:"Line",ALIGN:"Align",AUTO_LEADING:"auto",MISSING:"missing"},VECTOR:{TITLE:"Vector",COMBINE:"Combine"}},TEMPLATES:{IPHONE_6_PLUS:"iPhone 6+",IPHONE_6:"iPhone 6",IPHONE_5:"iPhone 5",IPAD_12:"iPad Mini",IPAD_34:"iPad Retina",ANDROID_1080P:"Android 1080p",MS_SURFACE_PRO:"Microsoft Surface Pro",MS_SURFACE_PRO_3:"Microsoft Surface Pro 3",APPLE_WATCH_38MM:"Apple Watch 38mm",APPLE_WATCH_42MM:"Apple Watch 42mm",WEB_1440_900:"Web",WEB_1920_1080:"Web"},ERR:{UNRECOVERABLE:"Design Space has encountered an unrecoverable error."}}}),define("jsx!js/jsx/ToolbarIcon",["require","exports","module","react","fluxxor","jsx!js/jsx/shared/Button","jsx!js/jsx/shared/SVGIcon","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("jsx!js/jsx/shared/Button"),u=e("jsx!js/jsx/shared/SVGIcon"),a=e("i18n!nls/strings"),f=r.createClass({displayName:"ToolbarIcon",mixins:[s],_getToolCSSID:function(e){return"tool-"+e.icon},shouldComponentUpdate:function(e){return this.props.selected!==e.selected||this.props.disabled!==e.disabled||this.props.style!==e.style},render:function(){var e=this.props.toolID;if(!this.props.toolID)return r.createElement("li",{key:this.props.index,className:"tool-spacer"});var t=this.getFlux().store("tool"),n=t.getToolByID(e),i=this._getToolCSSID(n),s=r.addons.classSet({"tool-selected":this.props.selected});return r.createElement("li",{key:this.props.index,id:this.props.id,style:this.props.style,className:s},r.createElement(o,{title:a.TOOLS[e],className:"toolbar-button",onClick:!this.props.disabled&&this.props.onClick,disabled:this.props.disabled},r.createElement(u,{viewBox:"0 0 24 24",CSSID:i})))}});n.exports=f}),define("jsx!js/jsx/Toolbar",["require","exports","module","react","fluxxor","jsx!js/jsx/ToolbarIcon","jsx!js/jsx/shared/Button","jsx!js/jsx/shared/SVGIcon","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=i.StoreWatchMixin,u=e("jsx!js/jsx/ToolbarIcon"),a=e("jsx!js/jsx/shared/Button"),f=e("jsx!js/jsx/shared/SVGIcon"),l=e("i18n!nls/strings"),c=r.createClass({displayName:"Toolbar",mixins:[s,o("tool","application","preferences")],_layout:["newSelect","rectangle","ellipse","pen","typeCreateOrEdit"],getInitialState:function(){return{expanded:!1}},getStateFromFlux:function(){var e=this.getFlux(),t=e.store("tool").getState(),n=e.store("application").getCurrentDocument(),r=e.store("preferences").getState(),i=r.get("toolbarPinned",!0);return{currentTool:t.current,previousTool:t.previous,document:n,pinned:i}},componentDidMount:function(){var e=this.getFlux(),t=e.store("preferences").getState(),n=t.get("toolbarPinned",!0);if(n){var r=this.refs.toolbar.getDOMNode().clientWidth,i=n?r:0;e.actions.ui.updateToolbarWidth(i)}},componentWillUpdate:function(e,t){var n=this.getFlux(),r=t.document,i=r&&r.unsupported;if(r&&i){var s=n.store("tool"),o=s.getDefaultTool(),u=s.getCurrentTool();o!==u&&n.actions.tools.select(o)}if(this.state.pinned!==t.pinned){var a=this.refs.toolbar.getDOMNode().clientWidth,f=t.pinned?a:0;n.actions.ui.updateToolbarWidth(f)}},render:function(){var e=this.state.document,t=e&&e.unsupported,n=this.getFlux().store("tool"),i=n.getCurrentTool(),s=i?i.id:"",o=this._layout.map(function(e){var i=n.getToolByID(e),o=e===s;return e==="newSelect"&&s==="superselectVector"?(o=!0,e="superselectVector",i=n.getToolByID(e)):e==="typeCreateOrEdit"&&s==="superselectType"&&(o=!0),r.createElement(u,{key:e,id:e,selected:o,disabled:t,onClick:this._handleToolbarButtonClick.bind(this,i),toolID:e})},this),c=r.addons.classSet({expanded:this.state.pinned||this.state.expanded,"toolbar-pop-over":!0});return r.createElement("div",{ref:"toolbar",className:c},r.createElement("ul",null,o),r.createElement(a,{className:"toolbar__backToPs",title:l.MENU.WINDOW.RETURN_TO_STANDARD,onClick:this._handleBackToPSClick},r.createElement(f,{viewbox:"0 0 18 16",CSSID:"workspace"})))},_expandToolbar:function(){this.setState({expanded:!0})},_collapseToolbar:function(){this.setState({expanded:!1})},_handleBackToPSClick:function(){this.getFlux().actions.menu.native({commandID:5999})},_handleToolbarButtonClick:function(e){this.state.expanded||this.state.pinned?(e&&(this.getFlux().actions.tools.select(e),this.getDOMNode().querySelector(".tool-selected").classList.remove("tool-selected"),this.getDOMNode().querySelector("#"+e.id).classList.add("tool-selected")),this.state.pinned||this._collapseToolbar()):this._expandToolbar()}});n.exports=c}),function(){"use strict";function e(){}function i(e,t){var n=e.length;while(n--)if(e[n].listener===t)return n;return-1}function s(e){return function(){return this[e].apply(this,arguments)}}var t=e.prototype,n=this,r=n.EventEmitter;t.getListeners=function(t){var n=this._getEvents(),r,i;if(t instanceof RegExp){r={};for(i in n)n.hasOwnProperty(i)&&t.test(i)&&(r[i]=n[i])}else r=n[t]||(n[t]=[]);return r},t.flattenListeners=function(t){var n=[],r;for(r=0;r<t.length;r+=1)n.push(t[r].listener);return n},t.getListenersAsObject=function(t){var n=this.getListeners(t),r;return n instanceof Array&&(r={},r[t]=n),r||n},t.addListener=function(t,n){var r=this.getListenersAsObject(t),s=typeof n=="object",o;for(o in r)r.hasOwnProperty(o)&&i(r[o],n)===-1&&r[o].push(s?n:{listener:n,once:!1});return this},t.on=s("addListener"),t.addOnceListener=function(t,n){return this.addListener(t,{listener:n,once:!0})},t.once=s("addOnceListener"),t.defineEvent=function(t){return this.getListeners(t),this},t.defineEvents=function(t){for(var n=0;n<t.length;n+=1)this.defineEvent(t[n]);return this},t.removeListener=function(t,n){var r=this.getListenersAsObject(t),s,o;for(o in r)r.hasOwnProperty(o)&&(s=i(r[o],n),s!==-1&&r[o].splice(s,1));return this},t.off=s("removeListener"),t.addListeners=function(t,n){return this.manipulateListeners(!1,t,n)},t.removeListeners=function(t,n){return this.manipulateListeners(!0,t,n)},t.manipulateListeners=function(t,n,r){var i,s,o=t?this.removeListener:this.addListener,u=t?this.removeListeners:this.addListeners;if(typeof n!="object"||n instanceof RegExp){i=r.length;while(i--)o.call(this,n,r[i])}else for(i in n)n.hasOwnProperty(i)&&(s=n[i])&&(typeof s=="function"?o.call(this,i,s):u.call(this,i,s));return this},t.removeEvent=function(t){var n=typeof t,r=this._getEvents(),i;if(n==="string")delete r[t];else if(t instanceof RegExp)for(i in r)r.hasOwnProperty(i)&&t.test(i)&&delete r[i];else delete this._events;return this},t.removeAllListeners=s("removeEvent"),t.emitEvent=function(t,n){var r=this.getListenersAsObject(t),i,s,o,u;for(o in r)if(r.hasOwnProperty(o)){s=r[o].length;while(s--)i=r[o][s],i.once===!0&&this.removeListener(t,i.listener),u=i.listener.apply(this,n||[]),u===this._getOnceReturnValue()&&this.removeListener(t,i.listener)}return this},t.trigger=s("emitEvent"),t.emit=function(t){var n=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,n)},t.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},t._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},t._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return n.EventEmitter=r,e},typeof define=="function"&&define.amd?define("eventEmitter",[],function(){return e}):typeof module=="object"&&module.exports?module.exports=e:n.EventEmitter=e}.call(this),define("adapter/util",["require","exports","module"],function(e,t){"use strict";var n=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},r=function(e,t){console.assert(e,t)};t.inherits=n,t.assert=r}),define("adapter/os",["require","exports","module","eventEmitter","./util","bluebird"],function(e,t,n){"use strict";var r=e("eventEmitter"),i=e("./util"),s=e("bluebird"),o=s.promisifyAll(_spaces.os),u=s.promisifyAll(_spaces.os.keyboardFocus),a=s.promisifyAll(_spaces.os.clipboard),f=function(){r.call(this)};i.inherits(f,r),f.prototype.notifierKind=o.notifierKind,f.prototype.eventKind=o.eventKind,f.prototype.eventModifiers=o.eventModifiers,f.prototype.eventKeyCode=o.eventKeyCode,f.prototype._eventHandler=function(e,t,n){if(e){console.error("Failed to handle OS event: "+e);return}this.emit("all",t,n),this.emit(t,n)},f.prototype.hasKeyboardFocus=function(e){return e=e||{},u.isActiveAsync(e)},f.prototype.acquireKeyboardFocus=function(e){return e=e||{},u.acquireAsync(e)},f.prototype.releaseKeyboardFocus=function(e){return e=e||{},u.releaseAsync(e)},f.prototype.postEvent=function(e,t){return t=t||{},o.postEventAsync(e,t)},f.prototype.clipboardRead=function(e){var t={formats:e||["string"]};return a.readAsync(t)},f.prototype.clipboardWrite=function(e,t){var n={data:e,format:t||"string"};return a.writeAsync(n)},f.prototype.setTooltip=function(e){return o.setTooltipAsync({label:e})},f.prototype.resetCursor=function(e){return e=e||{},o.resetCursorAsync(e)};var l=new f;_spaces.setNotifier(_spaces.notifierGroup.OS,{},l._eventHandler.bind(l)),n.exports=l}),function(e,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define("immutable",t):e.Immutable=t()}(this,function(){"use strict";function t(e,t){t&&(e.prototype=Object.create(t.prototype)),e.prototype.constructor=e}function f(e){return e.value=!1,e}function l(e){e&&(e.value=!0)}function c(){}function h(e,t){t=t||0;var n=Math.max(0,e.length-t),r=new Array(n);for(var i=0;i<n;i++)r[i]=e[i+t];return r}function p(e){return e.size===undefined&&(e.size=e.__iterate(v)),e.size}function d(e,t){return t>=0?+t:p(e)+ +t}function v(){return!0}function m(e,t,n){return(e===0||n!==undefined&&e<=-n)&&(t===undefined||n!==undefined&&t>=n)}function g(e,t){return b(e,t,0)}function y(e,t){return b(e,t,t)}function b(e,t,n){return e===undefined?n:e<0?Math.max(0,t+e):t===undefined?e:Math.min(t,e)}function w(e){return T(e)?e:$(e)}function E(e){return N(e)?e:J(e)}function S(e){return C(e)?e:K(e)}function x(e){return T(e)&&!k(e)?e:Q(e)}function T(e){return!!e&&!!e[A]}function N(e){return!!e&&!!e[O]}function C(e){return!!e&&!!e[M]}function k(e){return N(e)||C(e)}function L(e){return!!e&&!!e[_]}function I(e){this.next=e}function q(e,t,n,r){var i=e===0?t:e===1?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function R(){return{value:undefined,done:!0}}function U(e){return!!X(e)}function z(e){return e&&typeof e.next=="function"}function W(e){var t=X(e);return t&&t.call(e)}function X(e){var t=e&&(B&&e[B]||e[j]);if(typeof t=="function")return t}function V(e){return e&&typeof e.length=="number"}function $(e){return e===null||e===undefined?it():T(e)?e.toSeq():ut(e)}function J(e){return e===null||e===undefined?it().toKeyedSeq():T(e)?N(e)?e.toSeq():e.fromEntrySeq():st(e)}function K(e){return e===null||e===undefined?it():T(e)?N(e)?e.entrySeq():e.toIndexedSeq():ot(e)}function Q(e){return(e===null||e===undefined?it():T(e)?N(e)?e.entrySeq():e:ot(e)).toSetSeq()}function Y(e){this._array=e,this.size=e.length}function Z(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function et(e){this._iterable=e,this.size=e.length||e.size}function tt(e){this._iterator=e,this._iteratorCache=[]}function nt(e){return!!e&&!!e[G]}function it(){return rt||(rt=new Y([]))}function st(e){var t=Array.isArray(e)?(new Y(e)).fromEntrySeq():z(e)?(new tt(e)).fromEntrySeq():U(e)?(new et(e)).fromEntrySeq():typeof e=="object"?new Z(e):undefined;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function ot(e){var t=at(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function ut(e){var t=at(e)||typeof e=="object"&&new Z(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function at(e){return V(e)?new Y(e):z(e)?new tt(e):U(e)?new et(e):undefined}function ft(e,t,n,r){var i=e._cache;if(i){var s=i.length-1;for(var o=0;o<=s;o++){var u=i[n?s-o:o];if(t(u[1],r?u[0]:o,e)===!1)return o+1}return o}return e.__iterateUncached(t,n)}function lt(e,t,n,r){var i=e._cache;if(i){var s=i.length-1,o=0;return new I(function(){var e=i[n?s-o:o];return o++>s?R():q(t,r?e[0]:o-1,e[1])})}return e.__iteratorUncached(t,n)}function ct(){throw TypeError("Abstract")}function ht(){}function pt(){}function dt(){}function vt(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if(typeof e.valueOf=="function"&&typeof t.valueOf=="function"){e=e.valueOf(),t=t.valueOf();if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return typeof e.equals=="function"&&typeof t.equals=="function"&&e.equals(t)?!0:!1}function mt(e,t){return t?gt(t,e,"",{"":e}):yt(e)}function gt(e,t,n,r){return Array.isArray(t)?e.call(r,n,K(t).map(function(n,r){return gt(e,n,r,t)})):bt(t)?e.call(r,n,J(t).map(function(n,r){return gt(e,n,r,t)})):t}function yt(e){return Array.isArray(e)?K(e).map(yt).toList():bt(e)?J(e).map(yt).toMap():e}function bt(e){return e&&(e.constructor===Object||e.constructor===undefined)}function Et(e){return e>>>1&1073741824|e&3221225471}function St(e){if(e===!1||e===null||e===undefined)return 0;if(typeof e.valueOf=="function"){e=e.valueOf();if(e===!1||e===null||e===undefined)return 0}if(e===!0)return 1;var t=typeof e;if(t==="number"){var n=e|0;n!==e&&(n^=e*4294967295);while(e>4294967295)e/=4294967295,n^=e;return Et(n)}return t==="string"?e.length>Dt?xt(e):Tt(e):typeof e.hashCode=="function"?e.hashCode():Nt(e)}function xt(e){var t=Bt[e];return t===undefined&&(t=Tt(e),Ht===Pt&&(Ht=0,Bt={}),Ht++,Bt[e]=t),t}function Tt(e){var t=0;for(var n=0;n<e.length;n++)t=31*t+e.charCodeAt(n)|0;return Et(t)}function Nt(e){var t;if(At){t=Ot.get(e);if(t!==undefined)return t}t=e[_t];if(t!==undefined)return t;if(!kt){t=e.propertyIsEnumerable&&e.propertyIsEnumerable[_t];if(t!==undefined)return t;t=Lt(e);if(t!==undefined)return t}t=++Mt,Mt&1073741824&&(Mt=0);if(At)Ot.set(e,t);else{if(Ct!==undefined&&Ct(e)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(kt)Object.defineProperty(e,_t,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(e.propertyIsEnumerable!==undefined&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[_t]=t;else{if(e.nodeType===undefined)throw new Error("Unable to set a non-enumerable property on object.");e[_t]=t}}return t}function Lt(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function jt(e,t){if(!e)throw new Error(t)}function Ft(e){jt(e!==Infinity,"Cannot perform this action with an infinite size.")}function It(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function qt(e){this._iter=e,this.size=e.size}function Rt(e){this._iter=e,this.size=e.size}function Ut(e){this._iter=e,this.size=e.size}function zt(e){var t=cn(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=hn,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return t(n,e,r)!==!1},n)},t.__iteratorUncached=function(t,n){if(t===H){var r=e.__iterator(t,n);return new I(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===P?D:P,n)},t}function Wt(e,t,n){var r=cn(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,i){var s=e.get(r,o);return s===o?i:t.call(n,s,r,e)},r.__iterateUncached=function(r,i){var s=this;return e.__iterate(function(e,i,o){return r(t.call(n,e,i,o),i,s)!==!1},i)},r.__iteratorUncached=function(r,i){var s=e.__iterator(H,i);return new I(function(){var i=s.next();if(i.done)return i;var o=i.value,u=o[0];return q(r,u,t.call(n,o[1],u,e),i)})},r}function Xt(e,t){var n=cn(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=zt(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=hn,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function Vt(e,t,n,r){var i=cn(e);return r&&(i.has=function(r){var i=e.get(r,o);return i!==o&&!!t.call(n,i,r,e)},i.get=function(r,i){var s=e.get(r,o);return s!==o&&t.call(n,s,r,e)?s:i}),i.__iterateUncached=function(i,s){var o=this,u=0;return e.__iterate(function(e,s,a){if(t.call(n,e,s,a))return u++,i(e,r?s:u-1,o)},s),u},i.__iteratorUncached=function(i,s){var o=e.__iterator(H,s),u=0;return new I(function(){for(;;){var s=o.next();if(s.done)return s;var a=s.value,f=a[0],l=a[1];if(t.call(n,l,f,e))return q(i,r?f:u++,l,s)}})},i}function $t(e,t,n){var r=vn().asMutable();return e.__iterate(function(i,s){r.update(t.call(n,i,s,e),0,function(e){return e+1})}),r.asImmutable()}function Jt(e,t,n){var r=N(e),i=(L(e)?cr():vn()).asMutable();e.__iterate(function(s,o){i.update(t.call(n,s,o,e),function(e){return e=e||[],e.push(r?[o,s]:s),e})});var s=ln(e);return i.map(function(t){return un(e,s(t))})}function Kt(e,t,n,r){var i=e.size;if(m(t,n,i))return e;var s=g(t,i),o=y(n,i);if(s!==s||o!==o)return Kt(e.toSeq().cacheResult(),t,n,r);var u=o-s;u<0&&(u=0);var a=cn(e);return a.size=u===0?u:e.size&&u||undefined,!r&&nt(e)&&u>=0&&(a.get=function(t,n){return t=d(this,t),t>=0&&t<u?e.get(t+s,n):n}),a.__iterateUncached=function(t,n){var i=this;if(u===0)return 0;if(n)return this.cacheResult().__iterate(t,n);var o=0,a=!0,f=0;return e.__iterate(function(e,n){if(!a||!(a=o++<s))return f++,t(e,r?n:f-1,i)!==!1&&f!==u}),f},a.__iteratorUncached=function(t,n){if(u&&n)return this.cacheResult().__iterator(t,n);var i=u&&e.__iterator(t,n),o=0,a=0;return new I(function(){while(o++<s)i.next();if(++a>u)return R();var e=i.next();return r||t===P?e:t===D?q(t,a-1,undefined,e):q(t,a-1,e.value[1],e)})},a}function Qt(e,t,n){var r=cn(e);return r.__iterateUncached=function(r,i){var s=this;if(i)return this.cacheResult().__iterate(r,i);var o=0;return e.__iterate(function(e,i,u){return t.call(n,e,i,u)&&++o&&r(e,i,s)}),o},r.__iteratorUncached=function(r,i){var s=this;if(i)return this.cacheResult().__iterator(r,i);var o=e.__iterator(H,i),u=!0;return new I(function(){if(!u)return R();var e=o.next();if(e.done)return e;var i=e.value,a=i[0],f=i[1];return t.call(n,f,a,s)?r===H?e:q(r,a,f,e):(u=!1,R())})},r}function Gt(e,t,n,r){var i=cn(e);return i.__iterateUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterate(i,s);var u=!0,a=0;return e.__iterate(function(e,s,f){if(!u||!(u=t.call(n,e,s,f)))return a++,i(e,r?s:a-1,o)}),a},i.__iteratorUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterator(i,s);var u=e.__iterator(H,s),a=!0,f=0;return new I(function(){var e,s,l;do{e=u.next();if(e.done)return r||i===P?e:i===D?q(i,f++,undefined,e):q(i,f++,e.value[1],e);var c=e.value;s=c[0],l=c[1],a&&(a=t.call(n,l,s,o))}while(a);return i===H?e:q(i,s,l,e)})},i}function Yt(e,t){var n=N(e),r=[e].concat(t).map(function(e){return T(e)?n&&(e=E(e)):e=n?st(e):ot(Array.isArray(e)?e:[e]),e}).filter(function(e){return e.size!==0});if(r.length===0)return e;if(r.length===1){var i=r[0];if(i===e||n&&N(i)||C(e)&&C(i))return i}var s=new Y(r);return n?s=s.toKeyedSeq():C(e)||(s=s.toSetSeq()),s=s.flatten(!0),s.size=r.reduce(function(e,t){if(e!==undefined){var n=t.size;if(n!==undefined)return e+n}},0),s}function Zt(e,t,n){var r=cn(e);return r.__iterateUncached=function(r,i){function u(e,a){var f=this;e.__iterate(function(e,i){return(!t||a<t)&&T(e)?u(e,a+1):r(e,n?i:s++,f)===!1&&(o=!0),!o},i)}var s=0,o=!1;return u(e,0),s},r.__iteratorUncached=function(r,i){var s=e.__iterator(r,i),o=[],u=0;return new I(function(){while(s){var e=s.next();if(e.done!==!1){s=o.pop();continue}var a=e.value;r===H&&(a=a[1]);if(!(!t||o.length<t)||!T(a))return n?e:q(r,u++,a,e);o.push(s),s=a.__iterator(r,i)}return R()})},r}function en(e,t,n){var r=ln(e);return e.toSeq().map(function(i,s){return r(t.call(n,i,s,e))}).flatten(!0)}function tn(e,t){var n=cn(e);return n.size=e.size&&e.size*2-1,n.__iterateUncached=function(n,r){var i=this,s=0;return e.__iterate(function(e,r){return(!s||n(t,s++,i)!==!1)&&n(e,s++,i)!==!1},r),s},n.__iteratorUncached=function(n,r){var i=e.__iterator(P,r),s=0,o;return new I(function(){if(!o||s%2){o=i.next();if(o.done)return o}return s%2?q(n,s++,t):q(n,s++,o.value,o)})},n}function nn(e,t,n){t||(t=pn);var r=N(e),i=0,s=e.toSeq().map(function(t,r){return[r,t,i++,n?n(t,r,e):t]}).toArray();return s.sort(function(e,n){return t(e[3],n[3])||e[2]-n[2]}).forEach(r?function(e,t){s[t].length=2}:function(e,t){s[t]=e[1]}),r?J(s):C(e)?K(s):Q(s)}function rn(e,t,n){t||(t=pn);if(n){var r=e.toSeq().map(function(t,r){return[t,n(t,r,e)]}).reduce(function(e,n){return sn(t,e[1],n[1])?n:e});return r&&r[0]}return e.reduce(function(e,n){return sn(t,e,n)?n:e})}function sn(e,t,n){var r=e(n,t);return r===0&&n!==t&&(n===undefined||n===null||n!==n)||r>0}function on(e,t,n){var r=cn(e);return r.size=(new Y(n)).map(function(e){return e.size}).min(),r.__iterate=function(e,t){var n=this.__iterator(P,t),r,i=0;while(!(r=n.next()).done)if(e(r.value,i++,this)===!1)break;return i},r.__iteratorUncached=function(e,r){var i=n.map(function(e){return e=w(e),W(r?e.reverse():e)}),s=0,o=!1;return new I(function(){var n;return o||(n=i.map(function(e){return e.next()}),o=n.some(function(e){return e.done})),o?R():q(e,s++,t.apply(null,n.map(function(e){return e.value})))})},r}function un(e,t){return nt(e)?t:e.constructor(t)}function an(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function fn(e){return Ft(e.size),p(e)}function ln(e){return N(e)?E:C(e)?S:x}function cn(e){return Object.create((N(e)?J:C(e)?K:Q).prototype)}function hn(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):$.prototype.cacheResult.call(this)}function pn(e,t){return e>t?1:e<t?-1:0}function dn(e){var t=W(e);if(!t){if(!V(e))throw new TypeError("Expected iterable or array-like: "+e);t=W(w(e))}return t}function vn(e){return e===null||e===undefined?An():mn(e)?e:An().withMutations(function(t){var n=E(e);Ft(n.size),n.forEach(function(e,n){return t.set(n,e)})})}function mn(e){return!!e&&!!e[gn]}function bn(e,t){this.ownerID=e,this.entries=t}function wn(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function En(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function Sn(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function xn(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function Tn(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&Cn(e._root)}function Nn(e,t){return q(e,t[0],t[1])}function Cn(e,t){return{node:e,index:0,__prev:t}}function kn(e,t,n,r){var i=Object.create(yn);return i.size=e,i._root=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function An(){return Ln||(Ln=kn(0))}function On(e,t,n){var r,i;if(!e._root){if(n===o)return e;i=1,r=new bn(e.__ownerID,[[t,n]])}else{var s=f(u),l=f(a);r=Mn(e._root,e.__ownerID,0,undefined,t,n,s,l);if(!l.value)return e;i=e.size+(s.value?n===o?-1:1:0)}return e.__ownerID?(e.size=i,e._root=r,e.__hash=undefined,e.__altered=!0,e):r?kn(i,r):An()}function Mn(e,t,n,r,i,s,u,a){return e?e.update(t,n,r,i,s,u,a):s===o?e:(l(a),l(u),new xn(t,r,[i,s]))}function _n(e){return e.constructor===xn||e.constructor===Sn}function Dn(e,t,n,i,o){if(e.keyHash===i)return new Sn(t,i,[e.entry,o]);var u=(n===0?e.keyHash:e.keyHash>>>n)&s,a=(n===0?i:i>>>n)&s,f,l=u===a?[Dn(e,t,n+r,i,o)]:(f=new xn(t,i,o),u<a?[e,f]:[f,e]);return new wn(t,1<<u|1<<a,l)}function Pn(e,t,n,r){e||(e=new c);var i=new xn(e,St(n),[n,r]);for(var s=0;s<t.length;s++){var o=t[s];i=i.update(e,0,undefined,o[0],o[1])}return i}function Hn(e,t,n,r){var i=0,s=0,o=new Array(n);for(var u=0,a=1,f=t.length;u<f;u++,a<<=1){var l=t[u];l!==undefined&&u!==r&&(i|=a,o[s++]=l)}return new wn(e,i,o)}function Bn(e,t,n,r,s){var o=0,u=new Array(i);for(var a=0;n!==0;a++,n>>>=1)u[a]=n&1?t[o++]:undefined;return u[r]=s,new En(e,o+1,u)}function jn(e,t,n){var r=[];for(var i=0;i<n.length;i++){var s=n[i],o=E(s);T(s)||(o=o.map(function(e){return mt(e)})),r.push(o)}return In(e,t,r)}function Fn(e){return function(t,n,r){return t&&t.mergeDeepWith&&T(n)?t.mergeDeepWith(e,n):e?e(t,n,r):n}}function In(e,t,n){return n=n.filter(function(e){return e.size!==0}),n.length===0?e:e.size===0&&!e.__ownerID&&n.length===1?e.constructor(n[0]):e.withMutations(function(e){var r=t?function(n,r){e.update(r,o,function(e){return e===o?n:t(e,n,r)})}:function(t,n){e.set(n,t)};for(var i=0;i<n.length;i++)n[i].forEach(r)})}function qn(e,t,n,r){var i=e===o,s=t.next();if(s.done){var u=i?n:e,a=r(u);return a===u?e:a}jt(i||e&&e.set,"invalid keyPath");var f=s.value,l=i?o:e.get(f,o),c=qn(l,t,n,r);return c===l?e:c===o?e.remove(f):(i?An():e).set(f,c)}function Rn(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function Un(e,t,n,r){var i=r?e:h(e);return i[t]=n,i}function zn(e,t,n,r){var i=e.length+1;if(r&&t+1===i)return e[t]=n,e;var s=new Array(i),o=0;for(var u=0;u<i;u++)u===t?(s[u]=n,o=-1):s[u]=e[u+o];return s}function Wn(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;var i=new Array(r),s=0;for(var o=0;o<r;o++)o===t&&(s=1),i[o]=e[o+s];return i}function Jn(e){var t=rr();if(e===null||e===undefined)return t;if(Kn(e))return e;var n=S(e),s=n.size;return s===0?t:(Ft(s),s>0&&s<i?tr(0,s,r,null,new Yn(n.toArray())):t.withMutations(function(e){e.setSize(s),n.forEach(function(t,n){return e.set(n,t)})}))}function Kn(e){return!!e&&!!e[Qn]}function Yn(e,t){this.array=e,this.ownerID=t}function er(e,t){function a(e,t,n){return t===0?f(e,n):l(e,t,n)}function f(e,r){var a=r===o?u&&u.array:e&&e.array,f=r>n?0:n-r,l=s-r;return l>i&&(l=i),function(){if(f===l)return Zn;var e=t?--l:f++;return a&&a[e]}}function l(e,o,u){var f,l=e&&e.array,c=u>n?0:n-u>>o,h=(s-u>>o)+1;return h>i&&(h=i),function(){do{if(f){var e=f();if(e!==Zn)return e;f=null}if(c===h)return Zn;var n=t?--h:c++;f=a(l&&l[n],o-r,u+(n<<o))}while(!0)}}var n=e._origin,s=e._capacity,o=lr(s),u=e._tail;return a(e._root,e._level,0)}function tr(e,t,n,r,i,s,o){var u=Object.create(Gn);return u.size=t-e,u._origin=e,u._capacity=t,u._level=n,u._root=r,u._tail=i,u.__ownerID=s,u.__hash=o,u.__altered=!1,u}function rr(){return nr||(nr=tr(0,0,r))}function ir(e,t,n){t=d(e,t);if(t>=e.size||t<0)return e.withMutations(function(e){t<0?ar(e,t).set(0,n):ar(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,i=e._root,s=f(a);return t>=lr(e._capacity)?r=sr(r,e.__ownerID,0,t,n,s):i=sr(i,e.__ownerID,e._level,t,n,s),s.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=undefined,e.__altered=!0,e):tr(e._origin,e._capacity,e._level,i,r):e}function sr(e,t,n,i,o,u){var a=i>>>n&s,f=e&&a<e.array.length;if(!f&&o===undefined)return e;var c;if(n>0){var h=e&&e.array[a],p=sr(h,t,n-r,i,o,u);return p===h?e:(c=or(e,t),c.array[a]=p,c)}return f&&e.array[a]===o?e:(l(u),c=or(e,t),o===undefined&&a===c.array.length-1?c.array.pop():c.array[a]=o,c)}function or(e,t){return t&&e&&t===e.ownerID?e:new Yn(e?e.array.slice():[],t)}function ur(e,t){if(t>=lr(e._capacity))return e._tail;if(t<1<<e._level+r){var n=e._root,i=e._level;while(n&&i>0)n=n.array[t>>>i&s],i-=r;return n}}function ar(e,t,n){var i=e.__ownerID||new c,o=e._origin,u=e._capacity,a=o+t,f=n===undefined?u:n<0?u+n:o+n;if(a===o&&f===u)return e;if(a>=f)return e.clear();var l=e._level,h=e._root,p=0;while(a+p<0)h=new Yn(h&&h.array.length?[undefined,h]:[],i),l+=r,p+=1<<l;p&&(a+=p,o+=p,f+=p,u+=p);var d=lr(u),v=lr(f);while(v>=1<<l+r)h=new Yn(h&&h.array.length?[h]:[],i),l+=r;var m=e._tail,g=v<d?ur(e,f-1):v>d?new Yn([],i):m;if(m&&v>d&&a<u&&m.array.length){h=or(h,i);var y=h;for(var b=l;b>r;b-=r){var w=d>>>b&s;y=y.array[w]=or(y.array[w],i)}y.array[d>>>r&s]=m}f<u&&(g=g&&g.removeAfter(i,0,f));if(a>=v)a-=v,f-=v,l=r,h=null,g=g&&g.removeBefore(i,0,a);else if(a>o||v<d){p=0;while(h){var E=a>>>l&s;if(E!==v>>>l&s)break;E&&(p+=(1<<l)*E),l-=r,h=h.array[E]}h&&a>o&&(h=h.removeBefore(i,l,a-p)),h&&v<d&&(h=h.removeAfter(i,l,v-p)),p&&(a-=p,f-=p)}return e.__ownerID?(e.size=f-a,e._origin=a,e._capacity=f,e._level=l,e._root=h,e._tail=g,e.__hash=undefined,e.__altered=!0,e):tr(a,f,l,h,g)}function fr(e,t,n){var r=[],i=0;for(var s=0;s<n.length;s++){var o=n[s],u=S(o);u.size>i&&(i=u.size),T(o)||(u=u.map(function(e){return mt(e)})),r.push(u)}return i>e.size&&(e=e.setSize(i)),In(e,t,r)}function lr(e){return e<i?0:e-1>>>r<<r}function cr(e){return e===null||e===undefined?vr():hr(e)?e:vr().withMutations(function(t){var n=E(e);Ft(n.size),n.forEach(function(e,n){return t.set(n,e)})})}function hr(e){return mn(e)&&L(e)}function pr(e,t,n,r){var i=Object.create(cr.prototype);return i.size=e?e.size:0,i._map=e,i._list=t,i.__ownerID=n,i.__hash=r,i}function vr(){return dr||(dr=pr(An(),rr()))}function mr(e,t,n){var r=e._map,s=e._list,u=r.get(t),a=u!==undefined,f,l;if(n===o){if(!a)return e;s.size>=i&&s.size>=r.size*2?(l=s.filter(function(e,t){return e!==undefined&&u!==t}),f=l.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(f.__ownerID=l.__ownerID=e.__ownerID)):(f=r.remove(t),l=u===s.size-1?s.pop():s.set(u,undefined))}else if(a){if(n===s.get(u)[1])return e;f=r,l=s.set(u,[t,n])}else f=r.set(t,s.size),l=s.set(s.size,[t,n]);return e.__ownerID?(e.size=f.size,e._map=f,e._list=l,e.__hash=undefined,e):pr(f,l)}function gr(e){return e===null||e===undefined?xr():yr(e)?e:xr().unshiftAll(e)}function yr(e){return!!e&&!!e[br]}function Er(e,t,n,r){var i=Object.create(wr);return i.size=e,i._head=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function xr(){return Sr||(Sr=Er(0))}function Tr(e){return e===null||e===undefined?Mr():Nr(e)?e:Mr().withMutations(function(t){var n=x(e);Ft(n.size),n.forEach(function(e){return t.add(e)})})}function Nr(e){return!!e&&!!e[Cr]}function Lr(e,t){return e.__ownerID?(e.size=t.size,e._map=t,e):t===e._map?e:t.size===0?e.__empty():e.__make(t)}function Ar(e,t){var n=Object.create(kr);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function Mr(){return Or||(Or=Ar(An()))}function _r(e){return e===null||e===undefined?jr():Dr(e)?e:jr().withMutations(function(t){var n=x(e);Ft(n.size),n.forEach(function(e){return t.add(e)})})}function Dr(e){return Nr(e)&&L(e)}function Hr(e,t){var n=Object.create(Pr);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function jr(){return Br||(Br=Hr(vr()))}function Fr(e,t){var n,r=function(o){if(o instanceof r)return o;if(!(this instanceof r))return new r(o);if(!n){n=!0;var u=Object.keys(e);Ur(i,u),i.size=u.length,i._name=t,i._keys=u,i._defaultValues=e}this._map=vn(o)},i=r.prototype=Object.create(Ir);return i.constructor=r,r}function qr(e,t,n){var r=Object.create(Object.getPrototypeOf(e));return r._map=t,r.__ownerID=n,r}function Rr(e){return e._name||e.constructor.name||"Record"}function Ur(e,t){try{t.forEach(zr.bind(undefined,e))}catch(n){}}function zr(e,t){Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){jt(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}function Wr(e,t){if(e===t)return!0;if(!T(t)||e.size!==undefined&&t.size!==undefined&&e.size!==t.size||e.__hash!==undefined&&t.__hash!==undefined&&e.__hash!==t.__hash||N(e)!==N(t)||C(e)!==C(t)||L(e)!==L(t))return!1;if(e.size===0&&t.size===0)return!0;var n=!k(e);if(L(e)){var r=e.entries();return t.every(function(e,t){var i=r.next().value;return i&&vt(i[1],e)&&(n||vt(i[0],t))})&&r.next().done}var i=!1;if(e.size===undefined)if(t.size===undefined)typeof e.cacheResult=="function"&&e.cacheResult();else{i=!0;var s=e;e=t,t=s}var u=!0,a=t.__iterate(function(t,r){if(n?!e.has(t):i?!vt(t,e.get(r,o)):!vt(e.get(r,o),t))return u=!1,!1});return u&&e.size===a}function Xr(e,t,n){if(!(this instanceof Xr))return new Xr(e,t,n);jt(n!==0,"Cannot step a Range by 0"),e=e||0,t===undefined&&(t=Infinity),n=n===undefined?1:Math.abs(n),t<e&&(n=-n),this._start=e,this._end=t,this._step=n,this.size=Math.max(0,Math.ceil((t-e)/n-1)+1);if(this.size===0){if(Vr)return Vr;Vr=this}}function $r(e,t){if(!(this instanceof $r))return new $r(e,t);this._value=e,this.size=t===undefined?Infinity:Math.max(0,t);if(this.size===0){if(Jr)return Jr;Jr=this}}function Kr(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}function Yr(e,t){return t}function Zr(e,t){return[t,e]}function ei(e){return function(){return!e.apply(this,arguments)}}function ti(e){return function(){return-e.apply(this,arguments)}}function ni(e){return typeof e=="string"?JSON.stringify(e):e}function ri(){return h(arguments)}function ii(e,t){return e<t?1:e>t?-1:0}function si(e){if(e.size===Infinity)return 0;var t=L(e),n=N(e),r=t?1:0,i=e.__iterate(n?t?function(e,t){r=31*r+ui(St(e),St(t))|0}:function(e,t){r=r+ui(St(e),St(t))|0}:t?function(e){r=31*r+St(e)|0}:function(e){r=r+St(e)|0});return oi(i,r)}function oi(e,t){return t=wt(t,3432918353),t=wt(t<<15|t>>>-15,461845907),t=wt(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=wt(t^t>>>16,2246822507),t=wt(t^t>>>13,3266489909),t=Et(t^t>>>16),t}function ui(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var e=Array.prototype.slice,n="delete",r=5,i=1<<r,s=i-1,o={},u={value:!1},a={value:!1};t(E,w),t(S,w),t(x,w),w.isIterable=T,w.isKeyed=N,w.isIndexed=C,w.isAssociative=k,w.isOrdered=L,w.Keyed=E,w.Indexed=S,w.Set=x;var A="@@__IMMUTABLE_ITERABLE__@@",O="@@__IMMUTABLE_KEYED__@@",M="@@__IMMUTABLE_INDEXED__@@",_="@@__IMMUTABLE_ORDERED__@@",D=0,P=1,H=2,B=typeof Symbol=="function"&&Symbol.iterator,j="@@iterator",F=B||j;I.prototype.toString=function(){return"[Iterator]"},I.KEYS=D,I.VALUES=P,I.ENTRIES=H,I.prototype.inspect=I.prototype.toSource=function(){return this.toString()},I.prototype[F]=function(){return this},t($,w),$.of=function(){return $(arguments)},$.prototype.toSeq=function(){return this},$.prototype.toString=function(){return this.__toString("Seq {","}")},$.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},$.prototype.__iterate=function(e,t){return ft(this,e,t,!0)},$.prototype.__iterator=function(e,t){return lt(this,e,t,!0)},t(J,$),J.prototype.toKeyedSeq=function(){return this},t(K,$),K.of=function(){return K(arguments)},K.prototype.toIndexedSeq=function(){return this},K.prototype.toString=function(){return this.__toString("Seq [","]")},K.prototype.__iterate=function(e,t){return ft(this,e,t,!1)},K.prototype.__iterator=function(e,t){return lt(this,e,t,!1)},t(Q,$),Q.of=function(){return Q(arguments)},Q.prototype.toSetSeq=function(){return this},$.isSeq=nt,$.Keyed=J,$.Set=Q,$.Indexed=K;var G="@@__IMMUTABLE_SEQ__@@";$.prototype[G]=!0,t(Y,K),Y.prototype.get=function(e,t){return this.has(e)?this._array[d(this,e)]:t},Y.prototype.__iterate=function(e,t){var n=this._array,r=n.length-1;for(var i=0;i<=r;i++)if(e(n[t?r-i:i],i,this)===!1)return i+1;return i},Y.prototype.__iterator=function(e,t){var n=this._array,r=n.length-1,i=0;return new I(function(){return i>r?R():q(e,i,n[t?r-i++:i++])})},t(Z,J),Z.prototype.get=function(e,t){return t!==undefined&&!this.has(e)?t:this._object[e]},Z.prototype.has=function(e){return this._object.hasOwnProperty(e)},Z.prototype.__iterate=function(e,t){var n=this._object,r=this._keys,i=r.length-1;for(var s=0;s<=i;s++){var o=r[t?i-s:s];if(e(n[o],o,this)===!1)return s+1}return s},Z.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,i=r.length-1,s=0;return new I(function(){var o=r[t?i-s:s];return s++>i?R():q(e,o,n[o])})},Z.prototype[_]=!0,t(et,K),et.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=W(n),i=0;if(z(r)){var s;while(!(s=r.next()).done)if(e(s.value,i++,this)===!1)break}return i},et.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=W(n);if(!z(r))return new I(R);var i=0;return new I(function(){var t=r.next();return t.done?t:q(e,i++,t.value)})},t(tt,K),tt.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterator,r=this._iteratorCache,i=0;while(i<r.length)if(e(r[i],i++,this)===!1)return i;var s;while(!(s=n.next()).done){var o=s.value;r[i]=o;if(e(o,i++,this)===!1)break}return i},tt.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterator,r=this._iteratorCache,i=0;return new I(function(){if(i>=r.length){var t=n.next();if(t.done)return t;r[i]=t.value}return q(e,i,r[i++])})};var rt;t(ct,w),t(ht,ct),t(pt,ct),t(dt,ct),ct.Keyed=ht,ct.Indexed=pt,ct.Set=dt;var wt=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(t,n){t|=0,n|=0;var r=t&65535,i=n&65535;return r*i+((t>>>16)*i+r*(n>>>16)<<16>>>0)|0},Ct=Object.isExtensible,kt=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),At=typeof WeakMap=="function",Ot;At&&(Ot=new WeakMap);var Mt=0,_t="__immutablehash__";typeof Symbol=="function"&&(_t=Symbol(_t));var Dt=16,Pt=255,Ht=0,Bt={};t(It,J),It.prototype.get=function(e,t){return this._iter.get(e,t)},It.prototype.has=function(e){return this._iter.has(e)},It.prototype.valueSeq=function(){return this._iter.valueSeq()},It.prototype.reverse=function(){var e=this,t=Xt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},It.prototype.map=function(e,t){var n=this,r=Wt(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},It.prototype.__iterate=function(e,t){var n=this,r;return this._iter.__iterate(this._useKeys?function(t,r){return e(t,r,n)}:(r=t?fn(this):0,function(i){return e(i,t?--r:r++,n)}),t)},It.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(P,t),r=t?fn(this):0;return new I(function(){var i=n.next();return i.done?i:q(e,t?--r:r++,i.value,i)})},It.prototype[_]=!0,t(qt,K),qt.prototype.includes=function(e){return this._iter.includes(e)},qt.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},qt.prototype.__iterator=function(e,t){var n=this._iter.__iterator(P,t),r=0;return new I(function(){var t=n.next();return t.done?t:q(e,r++,t.value,t)})},t(Rt,Q),Rt.prototype.has=function(e){return this._iter.includes(e)},Rt.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},Rt.prototype.__iterator=function(e,t){var n=this._iter.__iterator(P,t);return new I(function(){var t=n.next();return t.done?t:q(e,t.value,t.value,t)})},t(Ut,J),Ut.prototype.entrySeq=function(){return this._iter.toSeq()},Ut.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){an(t);var r=T(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},Ut.prototype.__iterator=function(e,t){var n=this._iter.__iterator(P,t);return new I(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){an(r);var i=T(r);return q(e,i?r.get(0):r[0],i?r.get(1):r[1],t)}}})},qt.prototype.cacheResult=It.prototype.cacheResult=Rt.prototype.cacheResult=Ut.prototype.cacheResult=hn,t(vn,ht),vn.prototype.toString=function(){return this.__toString("Map {","}")},vn.prototype.get=function(e,t){return this._root?this._root.get(0,undefined,e,t):t},vn.prototype.set=function(e,t){return On(this,e,t)},vn.prototype.setIn=function(e,t){return this.updateIn(e,o,function(){return t})},vn.prototype.remove=function(e){return On(this,e,o)},vn.prototype.deleteIn=function(e){return this.updateIn(e,function(){return o})},vn.prototype.update=function(e,t,n){return arguments.length===1?e(this):this.updateIn([e],t,n)},vn.prototype.updateIn=function(e,t,n){n||(n=t,t=undefined);var r=qn(this,dn(e),t,n);return r===o?undefined:r},vn.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=undefined,this.__altered=!0,this):An()},vn.prototype.merge=function(){return jn(this,undefined,arguments)},vn.prototype.mergeWith=function(t){var n=e.call(arguments,1);return jn(this,t,n)},vn.prototype.mergeIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,An(),function(e){return e.merge.apply(e,n)})},vn.prototype.mergeDeep=function(){return jn(this,Fn(undefined),arguments)},vn.prototype.mergeDeepWith=function(t){var n=e.call(arguments,1);return jn(this,Fn(t),n)},vn.prototype.mergeDeepIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,An(),function(e){return e.mergeDeep.apply(e,n)})},vn.prototype.sort=function(e){return cr(nn(this,e))},vn.prototype.sortBy=function(e,t){return cr(nn(this,t,e))},vn.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},vn.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new c)},vn.prototype.asImmutable=function(){return this.__ensureOwner()},vn.prototype.wasAltered=function(){return this.__altered},vn.prototype.__iterator=function(e,t){return new Tn(this,e,t)},vn.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},vn.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?kn(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},vn.isMap=mn;var gn="@@__IMMUTABLE_MAP__@@",yn=vn.prototype;yn[gn]=!0,yn[n]=yn.remove,yn.removeIn=yn.deleteIn,bn.prototype.get=function(e,t,n,r){var i=this.entries;for(var s=0,o=i.length;s<o;s++)if(vt(n,i[s][0]))return i[s][1];return r},bn.prototype.update=function(e,t,n,r,i,s,u){var a=i===o,f=this.entries,c=0;for(var p=f.length;c<p;c++)if(vt(r,f[c][0]))break;var d=c<p;if(d?f[c][1]===i:a)return this;l(u),(a||!d)&&l(s);if(a&&f.length===1)return;if(!d&&!a&&f.length>=Xn)return Pn(e,f,r,i);var v=e&&e===this.ownerID,m=v?f:h(f);return d?a?c===p-1?m.pop():m[c]=m.pop():m[c]=[r,i]:m.push([r,i]),v?(this.entries=m,this):new bn(e,m)},wn.prototype.get=function(e,t,n,i){t===undefined&&(t=St(n));var o=1<<((e===0?t:t>>>e)&s),u=this.bitmap;return(u&o)===0?i:this.nodes[Rn(u&o-1)].get(e+r,t,n,i)},wn.prototype.update=function(e,t,n,i,u,a,f){n===undefined&&(n=St(i));var l=(t===0?n:n>>>t)&s,c=1<<l,h=this.bitmap,p=(h&c)!==0;if(!p&&u===o)return this;var d=Rn(h&c-1),v=this.nodes,m=p?v[d]:undefined,g=Mn(m,e,t+r,n,i,u,a,f);if(g===m)return this;if(!p&&g&&v.length>=Vn)return Bn(e,v,h,l,g);if(p&&!g&&v.length===2&&_n(v[d^1]))return v[d^1];if(p&&g&&v.length===1&&_n(g))return g;var y=e&&e===this.ownerID,b=p?g?h:h^c:h|c,w=p?g?Un(v,d,g,y):Wn(v,d,y):zn(v,d,g,y);return y?(this.bitmap=b,this.nodes=w,this):new wn(e,b,w)},En.prototype.get=function(e,t,n,i){t===undefined&&(t=St(n));var o=(e===0?t:t>>>e)&s,u=this.nodes[o];return u?u.get(e+r,t,n,i):i},En.prototype.update=function(e,t,n,i,u,a,f){n===undefined&&(n=St(i));var l=(t===0?n:n>>>t)&s,c=u===o,h=this.nodes,p=h[l];if(c&&!p)return this;var d=Mn(p,e,t+r,n,i,u,a,f);if(d===p)return this;var v=this.count;if(!p)v++;else if(!d){v--;if(v<$n)return Hn(e,h,v,l)}var m=e&&e===this.ownerID,g=Un(h,l,d,m);return m?(this.count=v,this.nodes=g,this):new En(e,v,g)},Sn.prototype.get=function(e,t,n,r){var i=this.entries;for(var s=0,o=i.length;s<o;s++)if(vt(n,i[s][0]))return i[s][1];return r},Sn.prototype.update=function(e,t,n,r,i,s,u){n===undefined&&(n=St(r));var a=i===o;if(n!==this.keyHash)return a?this:(l(u),l(s),Dn(this,e,t,n,[r,i]));var f=this.entries,c=0;for(var p=f.length;c<p;c++)if(vt(r,f[c][0]))break;var d=c<p;if(d?f[c][1]===i:a)return this;l(u),(a||!d)&&l(s);if(a&&p===2)return new xn(e,this.keyHash,f[c^1]);var v=e&&e===this.ownerID,m=v?f:h(f);return d?a?c===p-1?m.pop():m[c]=m.pop():m[c]=[r,i]:m.push([r,i]),v?(this.entries=m,this):new Sn(e,this.keyHash,m)},xn.prototype.get=function(e,t,n,r){return vt(n,this.entry[0])?this.entry[1]:r},xn.prototype.update=function(e,t,n,r,i,s,u){var a=i===o,f=vt(r,this.entry[0]);if(f?i===this.entry[1]:a)return this;l(u);if(a){l(s);return}return f?e&&e===this.ownerID?(this.entry[1]=i,this):new xn(e,this.keyHash,[r,i]):(l(s),Dn(this,e,t,St(r),[r,i]))},bn.prototype.iterate=Sn.prototype.iterate=function(e,t){var n=this.entries;for(var r=0,i=n.length-1;r<=i;r++)if(e(n[t?i-r:r])===!1)return!1},wn.prototype.iterate=En.prototype.iterate=function(e,t){var n=this.nodes;for(var r=0,i=n.length-1;r<=i;r++){var s=n[t?i-r:r];if(s&&s.iterate(e,t)===!1)return!1}},xn.prototype.iterate=function(e,t){return e(this.entry)},t(Tn,I),Tn.prototype.next=function(){var e=this._type,t=this._stack;while(t){var n=t.node,r=t.index++,i;if(n.entry){if(r===0)return Nn(e,n.entry)}else if(n.entries){i=n.entries.length-1;if(r<=i)return Nn(e,n.entries[this._reverse?i-r:r])}else{i=n.nodes.length-1;if(r<=i){var s=n.nodes[this._reverse?i-r:r];if(s){if(s.entry)return Nn(e,s.entry);t=this._stack=Cn(s,t)}continue}}t=this._stack=this._stack.__prev}return R()};var Ln,Xn=i/4,Vn=i/2,$n=i/4;t(Jn,pt),Jn.of=function(){return this(arguments)},Jn.prototype.toString=function(){return this.__toString("List [","]")},Jn.prototype.get=function(e,t){e=d(this,e);if(e<0||e>=this.size)return t;e+=this._origin;var n=ur(this,e);return n&&n.array[e&s]},Jn.prototype.set=function(e,t){return ir(this,e,t)},Jn.prototype.remove=function(e){return this.has(e)?e===0?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},Jn.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=r,this._root=this._tail=null,this.__hash=undefined,this.__altered=!0,this):rr()},Jn.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations(function(n){ar(n,0,t+e.length);for(var r=0;r<e.length;r++)n.set(t+r,e[r])})},Jn.prototype.pop=function(){return ar(this,0,-1)},Jn.prototype.unshift=function(){var e=arguments;return this.withMutations(function(t){ar(t,-e.length);for(var n=0;n<e.length;n++)t.set(n,e[n])})},Jn.prototype.shift=function(){return ar(this,1)},Jn.prototype.merge=function(){return fr(this,undefined,arguments)},Jn.prototype.mergeWith=function(t){var n=e.call(arguments,1);return fr(this,t,n)},Jn.prototype.mergeDeep=function(){return fr(this,Fn(undefined),arguments)},Jn.prototype.mergeDeepWith=function(t){var n=e.call(arguments,1);return fr(this,Fn(t),n)},Jn.prototype.setSize=function(e){return ar(this,0,e)},Jn.prototype.slice=function(e,t){var n=this.size;return m(e,t,n)?this:ar(this,g(e,n),y(t,n))},Jn.prototype.__iterator=function(e,t){var n=0,r=er(this,t);return new I(function(){var t=r();return t===Zn?R():q(e,n++,t)})},Jn.prototype.__iterate=function(e,t){var n=0,r=er(this,t),i;while((i=r())!==Zn)if(e(i,n++,this)===!1)break;return n},Jn.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?tr(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):(this.__ownerID=e,this)},Jn.isList=Kn;var Qn="@@__IMMUTABLE_LIST__@@",Gn=Jn.prototype;Gn[Qn]=!0,Gn[n]=Gn.remove,Gn.setIn=yn.setIn,Gn.deleteIn=Gn.removeIn=yn.removeIn,Gn.update=yn.update,Gn.updateIn=yn.updateIn,Gn.mergeIn=yn.mergeIn,Gn.mergeDeepIn=yn.mergeDeepIn,Gn.withMutations=yn.withMutations,Gn.asMutable=yn.asMutable,Gn.asImmutable=yn.asImmutable,Gn.wasAltered=yn.wasAltered,Yn.prototype.removeBefore=function(e,t,n){if(n===t?1<<t:this.array.length===0)return this;var i=n>>>t&s;if(i>=this.array.length)return new Yn([],e);var o=i===0,u;if(t>0){var a=this.array[i];u=a&&a.removeBefore(e,t-r,n);if(u===a&&o)return this}if(o&&!u)return this;var f=or(this,e);if(!o)for(var l=0;l<i;l++)f.array[l]=undefined;return u&&(f.array[i]=u),f},Yn.prototype.removeAfter=function(e,t,n){if(n===t?1<<t:this.array.length===0)return this;var i=n-1>>>t&s;if(i>=this.array.length)return this;var o=i===this.array.length-1,u;if(t>0){var a=this.array[i];u=a&&a.removeAfter(e,t-r,n);if(u===a&&o)return this}if(o&&!u)return this;var f=or(this,e);return o||f.array.pop(),u&&(f.array[i]=u),f};var Zn={},nr;t(cr,vn),cr.of=function(){return this(arguments)},cr.prototype.toString=function(){return this.__toString("OrderedMap {","}")},cr.prototype.get=function(e,t){var n=this._map.get(e);return n!==undefined?this._list.get(n)[1]:t},cr.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):vr()},cr.prototype.set=function(e,t){return mr(this,e,t)},cr.prototype.remove=function(e){return mr(this,e,o)},cr.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},cr.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},cr.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},cr.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?pr(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},cr.isOrderedMap=hr,cr.prototype[_]=!0,cr.prototype[n]=cr.prototype.remove;var dr;t(gr,pt),gr.of=function(){return this(arguments)},gr.prototype.toString=function(){return this.__toString("Stack [","]")},gr.prototype.get=function(e,t){var n=this._head;e=d(this,e);while(n&&e--)n=n.next;return n?n.value:t},gr.prototype.peek=function(){return this._head&&this._head.value},gr.prototype.push=function(){if(arguments.length===0)return this;var e=this.size+arguments.length,t=this._head;for(var n=arguments.length-1;n>=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=undefined,this.__altered=!0,this):Er(e,t)},gr.prototype.pushAll=function(e){e=S(e);if(e.size===0)return this;Ft(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=undefined,this.__altered=!0,this):Er(t,n)},gr.prototype.pop=function(){return this.slice(1)},gr.prototype.unshift=function(){return this.push.apply(this,arguments)},gr.prototype.unshiftAll=function(e){return this.pushAll(e)},gr.prototype.shift=function(){return this.pop.apply(this,arguments)},gr.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=undefined,this.__hash=undefined,this.__altered=!0,this):xr()},gr.prototype.slice=function(e,t){if(m(e,t,this.size))return this;var n=g(e,this.size),r=y(t,this.size);if(r!==this.size)return pt.prototype.slice.call(this,e,t);var i=this.size-n,s=this._head;while(n--)s=s.next;return this.__ownerID?(this.size=i,this._head=s,this.__hash=undefined,this.__altered=!0,this):Er(i,s)},gr.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Er(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},gr.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);var n=0,r=this._head;while(r){if(e(r.value,n++,this)===!1)break;r=r.next}return n},gr.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new I(function(){if(r){var t=r.value;return r=r.next,q(e,n++,t)}return R()})},gr.isStack=yr;var br="@@__IMMUTABLE_STACK__@@",wr=gr.prototype;wr[br]=!0,wr.withMutations=yn.withMutations,wr.asMutable=yn.asMutable,wr.asImmutable=yn.asImmutable,wr.wasAltered=yn.wasAltered;var Sr;t(Tr,dt),Tr.of=function(){return this(arguments)},Tr.fromKeys=function(e){return this(E(e).keySeq())},Tr.prototype.toString=function(){return this.__toString("Set {","}")},Tr.prototype.has=function(e){return this._map.has(e)},Tr.prototype.add=function(e){return Lr(this,this._map.set(e,!0))},Tr.prototype.remove=function(e){return Lr(this,this._map.remove(e))},Tr.prototype.clear=function(){return Lr(this,this._map.clear())},Tr.prototype.union=function(){var t=e.call(arguments,0);return t=t.filter(function(e){return e.size!==0}),t.length===0?this:this.size===0&&!this.__ownerID&&t.length===1?this.constructor(t[0]):this.withMutations(function(e){for(var n=0;n<t.length;n++)x(t[n]).forEach(function(t){return e.add(t)})})},Tr.prototype.intersect=function(){var t=e.call(arguments,0);if(t.length===0)return this;t=t.map(function(e){return x(e)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.every(function(e){return e.includes(n)})||e.remove(n)})})},Tr.prototype.subtract=function(){var t=e.call(arguments,0);if(t.length===0)return this;t=t.map(function(e){return x(e)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.some(function(e){return e.includes(n)})&&e.remove(n)})})},Tr.prototype.merge=function(){return this.union.apply(this,arguments)},Tr.prototype.mergeWith=function(t){var n=e.call(arguments,1);return this.union.apply(this,n)},Tr.prototype.sort=function(e){return _r(nn(this,e))},Tr.prototype.sortBy=function(e,t){return _r(nn(this,t,e))},Tr.prototype.wasAltered=function(){return this._map.wasAltered()},Tr.prototype.__iterate=function(e,t){var n=this;return this._map.__iterate(function(t,r){return e(r,r,n)},t)},Tr.prototype.__iterator=function(e,t){return this._map.map(function(e,t){return t}).__iterator(e,t)},Tr.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e);return e?this.__make(t,e):(this.__ownerID=e,this._map=t,this)},Tr.isSet=Nr;var Cr="@@__IMMUTABLE_SET__@@",kr=Tr.prototype;kr[Cr]=!0,kr[n]=kr.remove,kr.mergeDeep=kr.merge,kr.mergeDeepWith=kr.mergeWith,kr.withMutations=yn.withMutations,kr.asMutable=yn.asMutable,kr.asImmutable=yn.asImmutable,kr.__empty=Mr,kr.__make=Ar;var Or;t(_r,Tr),_r.of=function(){return this(arguments)},_r.fromKeys=function(e){return this(E(e).keySeq())},_r.prototype.toString=function(){return this.__toString("OrderedSet {","}")},_r.isOrderedSet=Dr;var Pr=_r.prototype;Pr[_]=!0,Pr.__empty=jr,Pr.__make=Hr;var Br;t(Fr,ht),Fr.prototype.toString=function(){return this.__toString(Rr(this)+" {","}")},Fr.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Fr.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},Fr.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=qr(this,An()))},Fr.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Rr(this));var n=this._map&&this._map.set(e,t);return this.__ownerID||n===this._map?this:qr(this,n)},Fr.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:qr(this,t)},Fr.prototype.wasAltered=function(){return this._map.wasAltered()},Fr.prototype.__iterator=function(e,t){var n=this;return E(this._defaultValues).map(function(e,t){return n.get(t)}).__iterator(e,t)},Fr.prototype.__iterate=function(e,t){var n=this;return E(this._defaultValues).map(function(e,t){return n.get(t)}).__iterate(e,t)},Fr.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?qr(this,t,e):(this.__ownerID=e,this._map=t,this)};var Ir=Fr.prototype;Ir[n]=Ir.remove,Ir.deleteIn=Ir.removeIn=yn.removeIn,Ir.merge=yn.merge,Ir.mergeWith=yn.mergeWith,Ir.mergeIn=yn.mergeIn,Ir.mergeDeep=yn.mergeDeep,Ir.mergeDeepWith=yn.mergeDeepWith,Ir.mergeDeepIn=yn.mergeDeepIn,Ir.setIn=yn.setIn,Ir.update=yn.update,Ir.updateIn=yn.updateIn,Ir.withMutations=yn.withMutations,Ir.asMutable=yn.asMutable,Ir.asImmutable=yn.asImmutable,t(Xr,K),Xr.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},Xr.prototype.get=function(e,t){return this.has(e)?this._start+d(this,e)*this._step:t},Xr.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t<this.size&&t===Math.floor(t)},Xr.prototype.slice=function(e,t){return m(e,t,this.size)?this:(e=g(e,this.size),t=y(t,this.size),t<=e?new Xr(0,0):new Xr(this.get(e,this._end),this.get(t,this._end),this._step))},Xr.prototype.indexOf=function(e){var t=e-this._start;if(t%this._step===0){var n=t/this._step;if(n>=0&&n<this.size)return n}return-1},Xr.prototype.lastIndexOf=function(e){return this.indexOf(e)},Xr.prototype.__iterate=function(e,t){var n=this.size-1,r=this._step,i=t?this._start+n*r:this._start;for(var s=0;s<=n;s++){if(e(i,s,this)===!1)return s+1;i+=t?-r:r}return s},Xr.prototype.__iterator=function(e,t){var n=this.size-1,r=this._step,i=t?this._start+n*r:this._start,s=0;return new I(function(){var o=i;return i+=t?-r:r,s>n?R():q(e,s++,o)})},Xr.prototype.equals=function(e){return e instanceof Xr?this._start===e._start&&this._end===e._end&&this._step===e._step:Wr(this,e)};var Vr;t($r,K),$r.prototype.toString=function(){return this.size===0?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},$r.prototype.get=function(e,t){return this.has(e)?this._value:t},$r.prototype.includes=function(e){return vt(this._value,e)},$r.prototype.slice=function(e,t){var n=this.size;return m(e,t,n)?this:new $r(this._value,y(t,n)-g(e,n))},$r.prototype.reverse=function(){return this},$r.prototype.indexOf=function(e){return vt(this._value,e)?0:-1},$r.prototype.lastIndexOf=function(e){return vt(this._value,e)?this.size:-1},$r.prototype.__iterate=function(e,t){for(var n=0;n<this.size;n++)if(e(this._value,n,this)===!1)return n+1;return n},$r.prototype.__iterator=function(e,t){var n=this,r=0;return new I(function(){return r<n.size?q(e,r++,n._value):R()})},$r.prototype.equals=function(e){return e instanceof $r?vt(this._value,e._value):Wr(e)};var Jr;w.Iterator=I,Kr(w,{toArray:function(){Ft(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new qt(this)},toJS:function(){return this.toSeq().map(function(e){return e&&typeof e.toJS=="function"?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&typeof e.toJSON=="function"?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new It(this,!0)},toMap:function(){return vn(this.toKeyedSeq())},toObject:function(){Ft(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return cr(this.toKeyedSeq())},toOrderedSet:function(){return _r(N(this)?this.valueSeq():this)},toSet:function(){return Tr(N(this)?this.valueSeq():this)},toSetSeq:function(){return new Rt(this)},toSeq:function(){return C(this)?this.toIndexedSeq():N(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return gr(N(this)?this.valueSeq():this)},toList:function(){return Jn(N(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return this.size===0?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){var t=e.call(arguments,0);return un(this,Yt(this,t))},contains:function(e){return this.includes(e)},includes:function(e){return this.some(function(t){return vt(t,e)})},entries:function(){return this.__iterator(H)},every:function(e,t){Ft(this.size);var n=!0;return this.__iterate(function(r,i,s){if(!e.call(t,r,i,s))return n=!1,!1}),n},filter:function(e,t){return un(this,Vt(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},findEntry:function(e,t){var n;return this.__iterate(function(r,i,s){if(e.call(t,r,i,s))return n=[i,r],!1}),n},findLastEntry:function(e,t){return this.toSeq().reverse().findEntry(e,t)},forEach:function(e,t){return Ft(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Ft(this.size),e=e!==undefined?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=r!==null&&r!==undefined?r.toString():""}),t},keys:function(){return this.__iterator(D)},map:function(e,t){return un(this,Wt(this,e,t))},reduce:function(e,t,n){Ft(this.size);var r,i;return arguments.length<2?i=!0:r=t,this.__iterate(function(t,s,o){i?(i=!1,r=t):r=e.call(n,r,t,s,o)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return un(this,Xt(this,!0))},slice:function(e,t){return un(this,Kt(this,e,t,!0))},some:function(e,t){return!this.every(ei(e),t)},sort:function(e){return un(this,nn(this,e))},values:function(){return this.__iterator(P)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==undefined?this.size===0:!this.some(function(){return!0})},count:function(e,t){return p(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return $t(this,e,t)},equals:function(e){return Wr(this,e)},entrySeq:function(){var e=this;if(e._cache)return new Y(e._cache);var t=e.toSeq().map(Zr).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(ei(e),t)},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},first:function(){return this.find(v)},flatMap:function(e,t){return un(this,en(this,e,t))},flatten:function(e){return un(this,Zt(this,e,!0))},fromEntrySeq:function(){return new Ut(this)},get:function(e,t){return this.find(function(t,n){return vt(n,e)},undefined,t)},getIn:function(e,t){var n=this,r=dn(e),i;while(!(i=r.next()).done){var s=i.value;n=n&&n.get?n.get(s,o):o;if(n===o)return t}return n},groupBy:function(e,t){return Jt(this,e,t)},has:function(e){return this.get(e,o)!==o},hasIn:function(e){return this.getIn(e,o)!==o},isSubset:function(e){return e=typeof e.includes=="function"?e:w(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e.isSubset(this)},keySeq:function(){return this.toSeq().map(Yr).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(e){return rn(this,e)},maxBy:function(e,t){return rn(this,t,e)},min:function(e){return rn(this,e?ti(e):ii)},minBy:function(e,t){return rn(this,t?ti(t):ii,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return un(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return un(this,Gt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(ei(e),t)},sortBy:function(e,t){return un(this,nn(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return un(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return un(this,Qt(this,e,t))},takeUntil:function(e,t){return this.takeWhile(ei(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=si(this))}});var Qr=w.prototype;Qr[A]=!0,Qr[F]=Qr.values,Qr.__toJS=Qr.toArray,Qr.__toStringMapper=ni,Qr.inspect=Qr.toSource=function(){return this.toString()},Qr.chain=Qr.flatMap,function(){try{Object.defineProperty(Qr,"length",{get:function(){if(!w.noLengthWarning){var e;try{throw new Error}catch(t){e=t.stack}if(e.indexOf("_wrapObject")===-1)return console&&console.warn&&console.warn("iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. "+e),this.size}}})}catch(e){}}(),Kr(E,{flip:function(){return un(this,zt(this))},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLastKey:function(e,t){return this.toSeq().reverse().findKey(e,t)},keyOf:function(e){return this.findKey(function(t){return vt(t,e)})},lastKeyOf:function(e){return this.findLastKey(function(t){return vt(t,e)})},mapEntries:function(e,t){var n=this,r=0;return un(this,this.toSeq().map(function(i,s){return e.call(t,[s,i],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return un(this,this.toSeq().flip().map(function(r,i){return e.call(t,r,i,n)}).flip())}});var Gr=E.prototype;Gr[O]=!0,Gr[F]=Qr.entries,Gr.__toJS=Qr.toObject,Gr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+ni(e)},Kr(S,{toKeyedSeq:function(){return new It(this,!1)},filter:function(e,t){return un(this,Vt(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.toKeyedSeq().keyOf(e);return t===undefined?-1:t},lastIndexOf:function(e){return this.toSeq().reverse().indexOf(e)},reverse:function(){return un(this,Xt(this,!1))},slice:function(e,t){return un(this,Kt(this,e,t,!1))},splice:function(e,t){var n=arguments.length;t=Math.max(t|0,0);if(n===0||n===2&&!t)return this;e=g(e,this.size);var r=this.slice(0,e);return un(this,n===1?r:r.concat(h(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.toKeyedSeq().findLastKey(e,t);return n===undefined?-1:n},first:function(){return this.get(0)},flatten:function(e){return un(this,Zt(this,e,!1))},get:function(e,t){return e=d(this,e),e<0||this.size===Infinity||this.size!==undefined&&e>this.size?t:this.find(function(t,n){return n===e},undefined,t)},has:function(e){return e=d(this,e),e>=0&&(this.size!==undefined?this.size===Infinity||e<this.size:this.indexOf(e)!==-1)},interpose:function(e){return un(this,tn(this,e))},interleave:function(){var e=[this].concat(h(arguments)),t=on(this.toSeq(),K.of,e),n=t.flatten(!0);return t.size&&(n.size=t.size*e.length),un(this,n)},last:function(){return this.get(-1)},skipWhile:function(e,t){return un(this,Gt(this,e,t,!1))},zip:function(){var e=[this].concat(h(arguments));return un(this,on(this,ri,e))},zipWith:function(e){var t=h(arguments);return t[0]=this,un(this,on(this,e,t))}}),S.prototype[M]=!0,S.prototype[_]=!0,Kr(x,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}}),x.prototype.has=Qr.includes,Kr(J,E.prototype),Kr(K,S.prototype),Kr(Q,x.prototype),Kr(ht,E.prototype),Kr(pt,S.prototype),Kr(dt,x.prototype);var ai={Iterable:w,Seq:$,Collection:ct,Map:vn,OrderedMap:cr,List:Jn,Stack:gr,Set:Tr,OrderedSet:_r,Record:Fr,Range:Xr,Repeat:$r,is:vt,fromJS:mt};return ai}),function(){function Lt(e,t){if(e!==t){var n=e===e,r=t===t;if(e>t||!n||typeof e=="undefined"&&r)return 1;if(e<t||!r||typeof t=="undefined"&&n)return-1}return 0}function At(e,t,n){var r=e.length,i=n?r:-1;while(n?i--:++i<r)if(t(e[i],i,e))return i;return-1}function Ot(e,t,n){if(t!==t)return Rt(e,n);var r=n-1,i=e.length;while(++r<i)if(e[r]===t)return r;return-1}function Mt(e){return typeof e=="function"||!1}function _t(e){return typeof e=="string"?e:e==null?"":e+""}function Dt(e){return e.charCodeAt(0)}function Pt(e,t){var n=-1,r=e.length;while(++n<r&&t.indexOf(e.charAt(n))>-1);return n}function Ht(e,t){var n=e.length;while(n--&&t.indexOf(e.charAt(n))>-1);return n}function Bt(e,t){return Lt(e.criteria,t.criteria)||e.index-t.index}function jt(e,t,n){var r=-1,i=e.criteria,s=t.criteria,o=i.length,u=n.length;while(++r<o){var a=Lt(i[r],s[r]);if(a)return r>=u?a:a*(n[r]?1:-1)}return e.index-t.index}function Ft(e){return mt[e]}function It(e){return gt[e]}function qt(e){return"\\"+wt[e]}function Rt(e,t,n){var r=e.length,i=t+(n?0:-1);while(n?i--:++i<r){var s=e[i];if(s!==s)return i}return-1}function Ut(e){return!!e&&typeof e=="object"}function zt(e){return e<=160&&e>=9&&e<=13||e==32||e==160||e==5760||e==6158||e>=8192&&(e<=8202||e==8232||e==8233||e==8239||e==8287||e==12288||e==65279)}function Wt(e,t){var n=-1,r=e.length,i=-1,s=[];while(++n<r)e[n]===t&&(e[n]=b,s[++i]=n);return s}function Xt(e,t){var n,r=-1,i=e.length,s=-1,o=[];while(++r<i){var u=e[r],a=t?t(u,r,e):u;if(!r||n!==a)n=a,o[++s]=u}return o}function Vt(e){var t=-1,n=e.length;while(++t<n&&zt(e.charCodeAt(t)));return t}function $t(e){var t=e.length;while(t--&&zt(e.charCodeAt(t)));return t}function Jt(e){return yt[e]}function Kt(C){function Fn(e){if(Ut(e)&&!Yo(e)&&!(e instanceof Un)){if(e instanceof qn)return e;if(Zt.call(e,"__chain__")&&Zt.call(e,"__wrapped__"))return ss(e)}return new qn(e)}function In(){}function qn(e,t,n){this.__wrapped__=e,this.__actions__=n||[],this.__chain__=!!t}function Un(e){this.__wrapped__=e,this.__actions__=null,this.__dir__=1,this.__dropCount__=0,this.__filtered__=!1,this.__iteratees__=null,this.__takeCount__=On,this.__views__=null}function zn(){var e=this.__actions__,t=this.__iteratees__,n=this.__views__,r=new Un(this.__wrapped__);return r.__actions__=e?er(e):null,r.__dir__=this.__dir__,r.__filtered__=this.__filtered__,r.__iteratees__=t?er(t):null,r.__takeCount__=this.__takeCount__,r.__views__=n?er(n):null,r}function Wn(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Xn(){var e=this.__wrapped__.value();if(!Yo(e))return ti(e,this.__actions__);var t=this.__dir__,n=t<0,r=Ri(0,e.length,this.__views__),i=r.start,s=r.end,o=s-i,u=n?s:i-1,a=Tn(o,this.__takeCount__),f=this.__iteratees__,l=f?f.length:0,c=0,h=[];e:while(o--&&c<a){u+=t;var p=-1,d=e[u];while(++p<l){var y=f[p],b=y.iteratee,w=y.type;if(w==v){y.done&&(n?u>y.index:u<y.index)&&(y.count=0,y.done=!1),y.index=u;if(!y.done){var E=y.limit;if(!(y.done=E>-1?y.count++>=E:!b(d)))continue e}}else{var S=b(d);if(w==g)d=S;else if(!S){if(w==m)continue e;break e}}}h[c++]=d}return h}function Vn(){this.__data__={}}function $n(e){return this.has(e)&&delete this.__data__[e]}function Jn(t){return t=="__proto__"?e:this.__data__[t]}function Kn(e){return e!="__proto__"&&Zt.call(this.__data__,e)}function Qn(e,t){return e!="__proto__"&&(this.__data__[e]=t),this}function Gn(e){var t=e?e.length:0;this.data={hash:wn(null),set:new pn};while(t--)this.push(e[t])}function Yn(e,t){var n=e.data,r=typeof t=="string"||uu(t)?n.set.has(t):n.hash[t];return r?0:-1}function Zn(e){var t=this.data;typeof e=="string"||uu(e)?t.set.add(e):t.hash[e]=!0}function er(e,t){var n=-1,r=e.length;t||(t=O(r));while(++n<r)t[n]=e[n];return t}function tr(e,t){var n=-1,r=e.length;while(++n<r)if(t(e[n],n,e)===!1)break;return e}function nr(e,t){var n=e.length;while(n--)if(t(e[n],n,e)===!1)break;return e}function rr(e,t){var n=-1,r=e.length;while(++n<r)if(!t(e[n],n,e))return!1;return!0}function ir(e,t){var n=-1,r=e.length,i=-1,s=[];while(++n<r){var o=e[n];t(o,n,e)&&(s[++i]=o)}return s}function sr(e,t){var n=-1,r=e.length,i=O(r);while(++n<r)i[n]=t(e[n],n,e);return i}function or(e){var t=-1,n=e.length,r=An;while(++t<n){var i=e[t];i>r&&(r=i)}return r}function ur(e){var t=-1,n=e.length,r=On;while(++t<n){var i=e[t];i<r&&(r=i)}return r}function ar(e,t,n,r){var i=-1,s=e.length;r&&s&&(n=e[++i]);while(++i<s)n=t(n,e[i],i,e);return n}function fr(e,t,n,r){var i=e.length;r&&i&&(n=e[--i]);while(i--)n=t(n,e[i],i,e);return n}function lr(e,t){var n=-1,r=e.length;while(++n<r)if(t(e[n],n,e))return!0;return!1}function cr(e){var t=e.length,n=0;while(t--)n+=+e[t]||0;return n}function hr(e,t){return typeof e=="undefined"?t:e}function pr(e,t,n,r){return typeof e=="undefined"||!Zt.call(r,n)?t:e}function dr(e,t,n){var r=_u(t);if(!n)return mr(t,e,r);var i=-1,s=r.length;while(++i<s){var o=r[i],u=e[o],a=n(u,t[o],o,e,t);if((a===a?a!==u:u===u)||typeof u=="undefined"&&!(o in e))e[o]=a}return e}function vr(t,n){var r=-1,i=t.length,s=Ji(i),o=n.length,u=O(o);while(++r<o){var a=n[r];s?(a=parseFloat(a),u[r]=Xi(a,i)?t[a]:e):u[r]=t[a]}return u}function mr(e,t,n){n||(n=t,t={});var r=-1,i=n.length;while(++r<i){var s=n[r];t[s]=e[s]}return t}function gr(e,t,n){var r=typeof e;return r=="function"?typeof t=="undefined"?e:ii(e,t,n):e==null?ma:r=="object"?Ir(e):typeof t=="undefined"?zr(e+""):qr(e+"",t)}function yr(e,t,n,r,i,s,o){var u;n&&(u=i?n(e,r,i):n(e));if(typeof u!="undefined")return u;if(!uu(e))return e;var a=Yo(e);if(a){u=Ui(e);if(!t)return er(e,u)}else{var f=tn.call(e),l=f==N;if(!(f==L||f==w||l&&!i))return dt[f]?Wi(e,f,t):i?e:{};u=zi(l?{}:e);if(!t)return mr(e,u,_u(e))}s||(s=[]),o||(o=[]);var c=s.length;while(c--)if(s[c]==e)return o[c];return s.push(e),o.push(u),(a?tr:_r)(e,function(r,i){u[i]=yr(r,t,n,i,e,s,o)}),u}function wr(t,n,r){if(typeof t!="function")throw new xt(y);return dn(function(){t.apply(e,r)},n)}function Er(e,t){var n=e?e.length:0,r=[];if(!n)return r;var i=-1,s=qi(),o=s==Ot,u=o&&t.length>=200?pi(t):null,a=t.length;u&&(s=Yn,o=!1,t=u);e:while(++i<n){var f=e[i];if(o&&f===f){var l=a;while(l--)if(t[l]===f)continue e;r.push(f)}else s(t,f,0)<0&&r.push(f)}return r}function Tr(e,t){var n=!0;return Sr(e,function(e,r,i){return n=!!t(e,r,i),n}),n}function Nr(e,t,n,r){var i=e.length;n=n==null?0:+n||0,n<0&&(n=-n>i?0:i+n),r=typeof r=="undefined"||r>i?i:+r||0,r<0&&(r+=i),i=n>r?0:r>>>0,n>>>=0;while(n<i)e[n++]=t;return e}function Cr(e,t){var n=[];return Sr(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function kr(e,t,n,r){var i;return n(e,function(e,n,s){if(t(e,n,s))return i=r?n:e,!1}),i}function Lr(e,t,n){var r=-1,i=e.length,s=-1,o=[];while(++r<i){var u=e[r];if(Ut(u)&&Ji(u.length)&&(Yo(u)||Go(u))){t&&(u=Lr(u,t,n));var a=-1,f=u.length;o.length+=f;while(++a<f)o[++s]=u[a]}else n||(o[++s]=u)}return o}function Mr(e,t){return Ar(e,t,Du)}function _r(e,t){return Ar(e,t,_u)}function Dr(e,t){return Or(e,t,_u)}function Pr(e,t){var n=-1,r=t.length,i=-1,s=[];while(++n<r){var o=t[n];ou(e[o])&&(s[++i]=o)}return s}function Hr(e,t,n,r,i,s){if(e===t)return e!==0||1/e==1/t;var o=typeof e,u=typeof t;return o!="function"&&o!="object"&&u!="function"&&u!="object"||e==null||t==null?e!==e&&t!==t:Br(e,t,Hr,n,r,i,s)}function Br(e,t,n,r,i,s,o){var u=Yo(e),a=Yo(t),f=E,l=E;u||(f=tn.call(e),f==w?f=L:f!=L&&(u=mu(e))),a||(l=tn.call(t),l==w?l=L:l!=L&&(a=mu(t)));var c=f==L||i&&f==N,h=l==L||i&&l==N,p=f==l;if(p&&!u&&!c)return Pi(e,t,f);if(i){if(!p&&(!c||!h))return!1}else{var d=c&&Zt.call(e,"__wrapped__"),v=h&&Zt.call(t,"__wrapped__");if(d||v)return n(d?e.value():e,v?t.value():t,r,i,s,o);if(!p)return!1}s||(s=[]),o||(o=[]);var m=s.length;while(m--)if(s[m]==e)return o[m]==t;s.push(e),o.push(t);var g=(u?Di:Hi)(e,t,n,r,i,s,o);return s.pop(),o.pop(),g}function jr(t,n,r,i,s){var o=-1,u=n.length,a=!s;while(++o<u)if(a&&i[o]?r[o]!==t[n[o]]:!(n[o]in t))return!1;o=-1;while(++o<u){var f=n[o],l=t[f],c=r[o];if(a&&i[o])var h=typeof l!="undefined"||f in t;else h=s?s(l,c,f):e,typeof h=="undefined"&&(h=Hr(c,l,s,!0));if(!h)return!1}return!0}function Fr(e,t){var n=[];return Sr(e,function(e,r,i){n.push(t(e,r,i))}),n}function Ir(e){var t=_u(e),n=t.length;if(!n)return va(!0);if(n==1){var r=t[0],i=e[r];if(Ki(i))return function(e){return e!=null&&e[r]===i&&(typeof i!="undefined"||r in is(e))}}var s=O(n),o=O(n);while(n--)i=e[t[n]],s[n]=i,o[n]=Ki(i);return function(e){return e!=null&&jr(is(e),t,s,o)}}function qr(e,t){return Ki(t)?function(n){return n!=null&&n[e]===t&&(typeof t!="undefined"||e in is(n))}:function(n){return n!=null&&Hr(t,n[e],null,!0)}}function Rr(t,n,r,i,s){if(!uu(t))return t;var o=Ji(n.length)&&(Yo(n)||mu(n));return(o?tr:_r)(n,function(n,u,a){if(Ut(n))return i||(i=[]),s||(s=[]),Ur(t,a,u,Rr,r,i,s);var f=t[u],l=r?r(f,n,u,t,a):e,c=typeof l=="undefined";c&&(l=n),(o||typeof l!="undefined")&&(c||(l===l?l!==f:f===f))&&(t[u]=l)}),t}function Ur(t,n,r,i,s,o,u){var a=o.length,f=n[r];while(a--)if(o[a]==f){t[r]=u[a];return}var l=t[r],c=s?s(l,f,r,t,n):e,h=typeof c=="undefined";h&&(c=f,Ji(f.length)&&(Yo(f)||mu(f))?c=Yo(l)?l:l&&l.length?er(l):[]:pu(f)||Go(f)?c=Go(l)?bu(l):pu(l)?l:{}:h=!1),o.push(f),u.push(c);if(h)t[r]=i(c,f,s,o,u);else if(c===c?c!==l:l===l)t[r]=c}function zr(t){return function(n){return n==null?e:n[t]}}function Wr(e,t){return e+fn(Ln()*(t-e+1))}function Xr(e,t,n,r,i){return i(e,function(e,i,s){n=r?(r=!1,e):t(n,e,i,s)}),n}function $r(e,t,n){var r=-1,i=e.length;t=t==null?0:+t||0,t<0&&(t=-t>i?0:i+t),n=typeof n=="undefined"||n>i?i:+n||0,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;var s=O(i);while(++r<i)s[r]=e[r+t];return s}function Jr(e,t){var n;return Sr(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}function Kr(e,t){var n=e.length;e.sort(t);while(n--)e[n]=e[n].value;return e}function Qr(t,n,r){var i=-1,s=t.length,o=Ji(s)?O(s):[];return Sr(t,function(t){var r=n.length,s=O(r);while(r--)s[r]=t==null?e:t[n[r]];o[++i]={criteria:s,index:i,value:t}}),Kr(o,function(e,t){return jt(e,t,r)})}function Gr(e,t){var n=0;return Sr(e,function(e,r,i){n+=+t(e,r,i)||0}),n}function Yr(e,t){var n=-1,r=qi(),i=e.length,s=r==Ot,o=s&&i>=200,u=o?pi():null,a=[];u?(r=Yn,s=!1):(o=!1,u=t?[]:a);e:while(++n<i){var f=e[n],l=t?t(f,n,e):f;if(s&&f===f){var c=u.length;while(c--)if(u[c]===l)continue e;t&&u.push(l),a.push(f)}else r(u,l,0)<0&&((t||o)&&u.push(l),a.push(f))}return a}function Zr(e,t){var n=-1,r=t.length,i=O(r);while(++n<r)i[n]=e[t[n]];return i}function ei(e,t,n,r){var i=e.length,s=r?i:-1;while((r?s--:++s<i)&&t(e[s],s,e));return n?$r(e,r?0:s,r?s+1:i):$r(e,r?s+1:0,r?i:s)}function ti(e,t){var n=e;n instanceof Un&&(n=n.value());var r=-1,i=t.length;while(++r<i){var s=[n],o=t[r];cn.apply(s,o.args),n=o.func.apply(o.thisArg,s)}return n}function ni(e,t,n){var r=0,i=e?e.length:r;if(typeof t=="number"&&t===t&&i<=Dn){while(r<i){var s=r+i>>>1,o=e[s];(n?o<=t:o<t)?r=s+1:i=s}return i}return ri(e,t,ma,n)}function ri(e,t,n,r){t=n(t);var i=0,s=e?e.length:0,o=t!==t,u=typeof t=="undefined";while(i<s){var a=fn((i+s)/2),f=n(e[a]),l=f===f;if(o)var c=l||r;else u?c=l&&(r||typeof f!="undefined"):c=r?f<=t:f<t;c?i=a+1:s=a}return Tn(s,_n)}function ii(e,t,n){if(typeof e!="function")return ma;if(typeof t=="undefined")return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,s){return e.call(t,n,r,i,s)};case 5:return function(n,r,i,s,o){return e.call(t,n,r,i,s,o)}}return function(){return e.apply(t,arguments)}}function si(e){return on.call(e,0)}function oi(e,t,n){var r=n.length,i=-1,s=xn(e.length-r,0),o=-1,u=t.length,a=O(s+u);while(++o<u)a[o]=t[o];while(++i<r)a[n[i]]=e[i];while(s--)a[o++]=e[i++];return a}function ui(e,t,n){var r=-1,i=n.length,s=-1,o=xn(e.length-i,0),u=-1,a=t.length,f=O(o+a);while(++s<o)f[s]=e[s];var l=s;while(++u<a)f[l+u]=t[u];while(++r<i)f[l+n[r]]=e[s++];return f}function ai(e,t){return function(n,r,i){var s=t?t():{};r=ji(r,i,3);if(Yo(n)){var o=-1,u=n.length;while(++o<u){var a=n[o];e(s,a,r(a,o,n),n)}}else Sr(n,function(t,n,i){e(s,t,r(t,n,i),i)});return s}}function fi(e){return function(){var t=arguments,n=t.length,r=t[0];if(n<2||r==null)return r;var i=t[n-2],s=t[n-1],o=t[3];n>3&&typeof i=="function"?(i=ii(i,s,5),n-=2):(i=n>2&&typeof s=="function"?s:null,n-=i?1:0),o&&Vi(t[1],t[2],o)&&(i=n==3?null:i,n=2);var u=0;while(++u<n){var a=t[u];a&&e(r,a,i)}return r}}function li(e,t){return function(n,r){var i=n?n.length:0;if(!Ji(i))return e(n,r);var s=t?i:-1,o=is(n);while(t?s--:++s<i)if(r(o[s],s,o)===!1)break;return n}}function ci(e){return function(t,n,r){var i=is(t),s=r(t),o=s.length,u=e?o:-1;while(e?u--:++u<o){var a=s[u];if(n(i[a],a,i)===!1)break}return t}}function hi(e,t){function r(){var i=this&&this!==kt&&this instanceof r?n:e;return i.apply(t,arguments)}var n=vi(e);return r}function di(e){return function(t){var n=-1,r=ha($u(t)),i=r.length,s="";while(++n<i)s=e(s,r[n],n);return s}}function vi(e){return function(){var t=br(e.prototype),n=e.apply(t,arguments);return uu(n)?n:t}}function mi(e){function t(n,r,i){i&&Vi(n,r,i)&&(r=null);var s=_i(n,e,null,null,null,null,null,r);return s.placeholder=t.placeholder,s}return t}function gi(e,t){return function(n,r,i){i&&Vi(n,r,i)&&(r=null);var s=ji(),o=r==null;if(s!==gr||!o)o=!1,r=s(r,i,3);if(o){var u=Yo(n);if(!!u||!vu(n))return e(u?n:rs(n));r=Dt}return Bi(n,r,t)}}function yi(t,n){return function(r,i,s){i=ji(i,s,3);if(Yo(r)){var o=At(r,i,n);return o>-1?r[o]:e}return kr(r,i,t)}}function bi(e){return function(t,n,r){return!t||!t.length?-1:(n=ji(n,r,3),At(t,n,e))}}function wi(e){return function(t,n,r){return n=ji(n,r,3),kr(t,n,e,!0)}}function Ei(e){return function(){var t=arguments.length;if(!t)return function(){return arguments[0]};var n,r=e?t:-1,i=0,s=O(t);while(e?r--:++r<t){var o=s[i++]=arguments[r];if(typeof o!="function")throw new xt(y);var u=n?"":Ii(o);n=u=="wrapper"?new qn([]):n}r=n?-1:t;while(++r<t){o=s[r],u=Ii(o);var a=u=="wrapper"?Fi(o):null;a&&$i(a[0])?n=n[Ii(a[0])].apply(n,a[3]):n=o.length==1&&$i(o)?n[u]():n.thru(o)}return function(){var e=arguments;if(n&&e.length==1&&Yo(e[0]))return n.plant(e[0]).value();var r=0,i=s[r].apply(this,e);while(++r<t)i=s[r].call(this,i);return i}}}function Si(e,t){return function(n,r,i){return typeof r=="function"&&typeof i=="undefined"&&Yo(n)?e(n,r):t(n,ii(r,i,3))}}function xi(e){return function(t,n,r){if(typeof n!="function"||typeof r!="undefined")n=ii(n,r,3);return e(t,n,Du)}}function Ti(e){return function(t,n,r){if(typeof n!="function"||typeof r!="undefined")n=ii(n,r,3);return e(t,n)}}function Ni(e){return function(t,n,r){return t=_t(t),t&&(e?t:"")+Ai(t,n,r)+(e?"":t)}}function Ci(e){var t=Xo(function(n,r){var i=Wt(r,t.placeholder);return _i(n,e,null,r,i)});return t}function ki(e,t){return function(n,r,i,s){var o=arguments.length<3;return typeof r=="function"&&typeof s=="undefined"&&Yo(n)?e(n,r,i,o):Xr(n,ji(r,s,4),i,o,t)}}function Li(t,l,c,h,p,d,v,m,g,y){function k(){var i=arguments.length,s=i,o=O(i);while(s--)o[s]=arguments[s];h&&(o=oi(o,h,p)),d&&(o=ui(o,d,v));if(S||T){var f=k.placeholder,L=Wt(o,f);i-=L.length;if(i<y){var A=m?er(m):null,M=xn(y-i,0),_=S?L:null,D=S?null:L,P=S?o:null,H=S?null:o;l|=S?u:a,l&=~(S?a:u),x||(l&=~(n|r));var B=[t,l,c,P,_,H,D,A,g,M],j=Li.apply(e,B);return $i(t)&&es(j,B),j.placeholder=f,j}}var F=w?c:this;E&&(t=F[C]),m&&(o=Zi(o,m)),b&&g<o.length&&(o.length=g);var I=this&&this!==kt&&this instanceof k?N||vi(t):t;return I.apply(F,o)}var b=l&f,w=l&n,E=l&r,S=l&s,x=l&i,T=l&o,N=!E&&vi(t),C=t;return k}function Ai(e,t,n){var r=e.length;t=+t;if(r>=t||!En(t))return"";var i=t-r;return n=n==null?" ":n+"",na(n,un(i/n.length)).slice(0,i)}function Oi(e,t,r,i){function u(){var t=-1,n=arguments.length,a=-1,f=i.length,l=O(n+f);while(++a<f)l[a]=i[a];while(n--)l[a++]=arguments[++t];var c=this&&this!==kt&&this instanceof u?o:e;return c.apply(s?r:this,l)}var s=t&n,o=vi(e);return u}function Mi(e){return function(t,n,r,i){var s=ji(r);return s===gr&&r==null?ni(t,n,e):ri(t,n,s(r,i,1),e)}}function _i(t,i,s,o,f,l,c,h){var p=i&r;if(!p&&typeof t!="function")throw new xt(y);var d=o?o.length:0;d||(i&=~(u|a),o=f=null),d-=f?f.length:0;if(i&a){var v=o,m=f;o=f=null}var g=p?null:Fi(t),b=[t,i,s,o,f,v,m,l,c,h];g&&(Qi(b,g),i=b[1],h=b[9]),b[9]=h==null?p?0:t.length:xn(h-d,0)||0;if(i==n)var w=hi(b[0],b[2]);else i!=u&&i!=(n|u)||!!b[4].length?w=Li.apply(e,b):w=Oi.apply(e,b);var E=g?Vr:es;return E(w,b)}function Di(t,n,r,i,s,o,u){var a=-1,f=t.length,l=n.length,c=!0;if(f!=l&&!(s&&l>f))return!1;while(c&&++a<f){var h=t[a],p=n[a];c=e,i&&(c=s?i(p,h,a):i(h,p,a));if(typeof c=="undefined")if(s){var d=l;while(d--){p=n[d],c=h&&h===p||r(h,p,i,s,o,u);if(c)break}}else c=h&&h===p||r(h,p,i,s,o,u)}return!!c}function Pi(e,t,n){switch(n){case S:case x:return+e==+t;case T:return e.name==t.name&&e.message==t.message;case k:return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case A:case M:return e==t+""}return!1}function Hi(t,n,r,i,s,o,u){var a=_u(t),f=a.length,l=_u(n),c=l.length;if(f!=c&&!s)return!1;var h=s,p=-1;while(++p<f){var d=a[p],v=s?d in n:Zt.call(n,d);if(v){var m=t[d],g=n[d];v=e,i&&(v=s?i(g,m,d):i(m,g,d)),typeof v=="undefined"&&(v=m&&m===g||r(m,g,i,s,o,u))}if(!v)return!1;h||(h=d=="constructor")}if(!h){var y=t.constructor,b=n.constructor;if(y!=b&&"constructor"in t&&"constructor"in n&&!(typeof y=="function"&&y instanceof y&&typeof b=="function"&&b instanceof b))return!1}return!0}function Bi(e,t,n){var r=n?On:An,i=r,s=i;return Sr(e,function(e,o,u){var a=t(e,o,u);if((n?a<i:a>i)||a===r&&a===s)i=a,s=e}),s}function ji(e,t,n){var r=Fn.callback||da;return r=r===da?gr:r,n?r(e,t,n):r}function qi(e,t,n){var r=Fn.indexOf||bs;return r=r===bs?Ot:r,e?r(e,t,n):r}function Ri(e,t,n){var r=-1,i=n?n.length:0;while(++r<i){var s=n[r],o=s.size;switch(s.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=Tn(t,e+o);break;case"takeRight":e=xn(e,t-o)}}return{start:e,end:t}}function Ui(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Zt.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function zi(e){var t=e.constructor;return typeof t=="function"&&t instanceof t||(t=wt),new t}function Wi(e,t,n){var r=e.constructor;switch(t){case D:return si(e);case S:case x:return new r(+e);case P:case H:case B:case j:case F:case I:case q:case R:case U:var i=e.buffer;return new r(n?si(i):i,e.byteOffset,e.length);case k:case M:return new r(e);case A:var s=new r(e.source,tt.exec(e));s.lastIndex=e.lastIndex}return s}function Xi(e,t){return e=+e,t=t==null?Hn:t,e>-1&&e%1==0&&e<t}function Vi(e,t,n){if(!uu(n))return!1;var r=typeof t;if(r=="number")var i=n.length,s=Ji(i)&&Xi(t,i);else s=r=="string"&&t in n;if(s){var o=n[t];return e===e?e===o:o!==o}return!1}function $i(e){var t=Ii(e);return!!t&&e===Fn[t]&&t in Un.prototype}function Ji(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Hn}function Ki(e){return e===e&&(e===0?1/e>0:!uu(e))}function Qi(e,t){var r=e[1],o=t[1],u=r|o,a=u<f,c=o==f&&r==s||o==f&&r==l&&e[7].length<=t[8]||o==(f|l)&&r==s;if(!a&&!c)return e;o&n&&(e[2]=t[2],u|=r&n?0:i);var h=t[3];if(h){var p=e[3];e[3]=p?oi(p,h,t[4]):er(h),e[4]=p?Wt(e[3],b):er(t[4])}return h=t[5],h&&(p=e[5],e[5]=p?ui(p,h,t[6]):er(h),e[6]=p?Wt(e[5],b):er(t[6])),h=t[7],h&&(e[7]=er(h)),o&f&&(e[8]=e[8]==null?t[8]:Tn(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=u,e}function Gi(e,t){e=is(e);var n=-1,r=t.length,i={};while(++n<r){var s=t[n];s in e&&(i[s]=e[s])}return i}function Yi(e,t){var n={};return Mr(e,function(e,r,i){t(e,r,i)&&(n[r]=e)}),n}function Zi(t,n){var r=t.length,i=Tn(n.length,r),s=er(t);while(i--){var o=n[i];t[i]=Xi(o,r)?s[o]:e}return t}function ts(e){var t,n=Fn.support;if(!Ut(e)||tn.call(e)!=L||!Zt.call(e,"constructor")&&(t=e.constructor,typeof t=="function"&&!(t instanceof t)))return!1;var r;return Mr(e,function(e,t){r=t}),typeof r=="undefined"||Zt.call(e,r)}function ns(e){var t=Du(e),n=t.length,r=n&&e.length,i=Fn.support,s=r&&Ji(r)&&(Yo(e)||i.nonEnumArgs&&Go(e)),o=-1,u=[];while(++o<n){var a=t[o];(s&&Xi(a,r)||Zt.call(e,a))&&u.push(a)}return u}function rs(e){return e==null?[]:Ji(e.length)?uu(e)?e:wt(e):Ru(e)}function is(e){return uu(e)?e:wt(e)}function ss(e){return e instanceof Un?e.clone():new qn(e.__wrapped__,e.__chain__,er(e.__actions__))}function os(e,t,n){(n?Vi(e,t,n):t==null)?t=1:t=xn(+t||1,1);var r=0,i=e?e.length:0,s=-1,o=O(un(i/t));while(r<i)o[++s]=$r(e,r,r+=t);return o}function us(e){var t=-1,n=e?e.length:0,r=-1,i=[];while(++t<n){var s=e[t];s&&(i[++r]=s)}return i}function fs(e,t,n){var r=e?e.length:0;if(!r)return[];if(n?Vi(e,t,n):t==null)t=1;return $r(e,t<0?0:t)}function ls(e,t,n){var r=e?e.length:0;if(!r)return[];if(n?Vi(e,t,n):t==null)t=1;return t=r-(+t||0),$r(e,0,t<0?0:t)}function cs(e,t,n){return e&&e.length?ei(e,ji(t,n,3),!0,!0):[]}function hs(e,t,n){return e&&e.length?ei(e,ji(t,n,3),!0):[]}function ps(e,t,n,r){var i=e?e.length:0;return i?(n&&typeof n!="number"&&Vi(e,t,n)&&(n=0,r=i),Nr(e,t,n,r)):[]}function ms(t){return t?t[0]:e}function gs(e,t,n){var r=e?e.length:0;return n&&Vi(e,t,n)&&(t=!1),r?Lr(e,t):[]}function ys(e){var t=e?e.length:0;return t?Lr(e,!0):[]}function bs(e,t,n){var r=e?e.length:0;if(!r)return-1;if(typeof n=="number")n=n<0?xn(r+n,0):n;else if(n){var i=ni(e,t),s=e[i];return(t===t?t===s:s!==s)?i:-1}return Ot(e,t,n||0)}function ws(e){return ls(e,1)}function Es(){var e=[],t=-1,n=arguments.length,r=[],i=qi(),s=i==Ot;while(++t<n){var o=arguments[t];if(Yo(o)||Go(o))e.push(o),r.push(s&&o.length>=120?pi(t&&o):null)}n=e.length;var u=e[0],a=-1,f=u?u.length:0,l=[],c=r[0];e:while(++a<f){o=u[a];if((c?Yn(c,o):i(l,o,0))<0){t=n;while(--t){var h=r[t];if((h?Yn(h,o):i(e[t],o,0))<0)continue e}c&&c.push(o),l.push(o)}}return l}function Ss(t){var n=t?t.length:0;return n?t[n-1]:e}function xs(e,t,n){var r=e?e.length:0;if(!r)return-1;var i=r;if(typeof n=="number")i=(n<0?xn(r+n,0):Tn(n||0,r-1))+1;else if(n){i=ni(e,t,!0)-1;var s=e[i];return(t===t?t===s:s!==s)?i:-1}if(t!==t)return Rt(e,i,!0);while(i--)if(e[i]===t)return i;return-1}function Ts(){var e=arguments,t=e[0];if(!t||!t.length)return t;var n=0,r=qi(),i=e.length;while(++n<i){var s=0,o=e[n];while((s=r(t,o,s))>-1)vn.call(t,s,1)}return t}function Cs(e,t,n){var r=-1,i=e?e.length:0,s=[];t=ji(t,n,3);while(++r<i){var o=e[r];t(o,r,e)&&(s.push(o),vn.call(e,r--,1),i--)}return s}function ks(e){return fs(e,1)}function Ls(e,t,n){var r=e?e.length:0;return r?(n&&typeof n!="number"&&Vi(e,t,n)&&(t=0,n=r),$r(e,t,n)):[]}function Ms(e,t,n){var r=e?e.length:0;if(!r)return[];if(n?Vi(e,t,n):t==null)t=1;return $r(e,0,t<0?0:t)}function _s(e,t,n){var r=e?e.length:0;if(!r)return[];if(n?Vi(e,t,n):t==null)t=1;return t=r-(+t||0),$r(e,t<0?0:t)}function Ds(e,t,n){return e&&e.length?ei(e,ji(t,n,3),!1,!0):[]}function Ps(e,t,n){return e&&e.length?ei(e,ji(t,n,3)):[]}function Bs(e,t,n,r){var i=e?e.length:0;if(!i)return[];t!=null&&typeof t!="boolean"&&(r=n,n=Vi(e,t,r)?null:t,t=!1);var s=ji();if(s!==gr||n!=null)n=s(n,r,3);return t&&qi()==Ot?Xt(e,n):Yr(e,n)}function js(e){var t=-1,n=(e&&e.length&&or(sr(e,Yt)))>>>0,r=O(n);while(++t<n)r[t]=sr(e,zr(t));return r}function Is(){var e=-1,t=arguments.length;while(++e<t){var n=arguments[e];if(Yo(n)||Go(n))var r=r?Er(r,n).concat(Er(n,r)):n}return r?Yr(r):[]}function Rs(e,t){var n=-1,r=e?e.length:0,i={};r&&!t&&!Yo(e[0])&&(t=[]);while(++n<r){var s=e[n];t?i[s]=t[n]:s&&(i[s[0]]=s[1])}return i}function Us(e){var t=Fn(e);return t.__chain__=!0,t}function zs(e,t,n){return t.call(n,e),e}function Ws(e,t,n){return t.call(n,e)}function Xs(){return Us(this)}function Vs(){return new qn(this.value(),this.__chain__)}function $s(e){var t,n=this;while(n instanceof In){var r=ss(n);t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t}function Js(){var e=this.__wrapped__;return e instanceof Un?(this.__actions__.length&&(e=new Un(this)),new qn(e.reverse(),this.__chain__)):this.thru(function(e){return e.reverse()})}function Ks(){return this.value()+""}function Qs(){return ti(this.__wrapped__,this.__actions__)}function Zs(e,t,n){var r=Yo(e)?rr:Tr;n&&Vi(e,t,n)&&(t=null);if(typeof t!="function"||typeof n!="undefined")t=ji(t,n,3);return r(e,t)}function eo(e,t,n){var r=Yo(e)?ir:Cr;return t=ji(t,n,3),r(e,t)}function ro(e,t){return to(e,Ir(t))}function uo(e,t,n,r){var i=e?e.length:0;return Ji(i)||(e=Ru(e),i=e.length),i?(typeof n!="number"||r&&Vi(t,n,r)?n=0:n=n<0?xn(i+n,0):n||0,typeof e=="string"||!Yo(e)&&vu(e)?n<i&&e.indexOf(t,n)>-1:qi(e,t,n)>-1):!1}function lo(e,t,n){var r=Yo(e)?sr:Fr;return t=ji(t,n,3),r(e,t)}function ho(e,t){return lo(e,zr(t))}function mo(e,t,n){var r=Yo(e)?ir:Cr;return t=ji(t,n,3),r(e,function(e,n,r){return!t(e,n,r)})}function go(t,n,r){if(r?Vi(t,n,r):n==null){t=rs(t);var i=t.length;return i>0?t[Wr(0,i-1)]:e}var s=yo(t);return s.length=Tn(n<0?0:+n||0,s.length),s}function yo(e){e=rs(e);var t=-1,n=e.length,r=O(n);while(++t<n){var i=Wr(0,t);t!=i&&(r[t]=r[i]),r[i]=e[t]}return r}function bo(e){var t=e?e.length:0;return Ji(t)?t:_u(e).length}function wo(e,t,n){var r=Yo(e)?lr:Jr;n&&Vi(e,t,n)&&(t=null);if(typeof t!="function"||typeof n!="undefined")t=ji(t,n,3);return r(e,t)}function Eo(e,t,n){if(e==null)return[];var r=-1,i=e.length,s=Ji(i)?O(i):[];return n&&Vi(e,t,n)&&(t=null),t=ji(t,n,3),Sr(e,function(e,n,i){s[++r]={criteria:t(e,n,i),index:r,value:e}}),Kr(s,Bt)}function So(){var e=arguments,t=e[0],n=e[3],r=0,i=e.length-1;if(t==null)return[];var s=O(i);while(r<i)s[r]=e[++r];return n&&Vi(e[1],e[2],n)&&(s=e[1]),Qr(t,Lr(s),[])}function xo(e,t,n,r){return e==null?[]:(r&&Vi(t,n,r)&&(n=null),Yo(t)||(t=t==null?[]:[t]),Yo(n)||(n=n==null?[]:[n]),Qr(e,t,n))}function To(e,t){return eo(e,Ir(t))}function Co(e,t){if(typeof t!="function"){if(typeof e!="function")throw new xt(y);var n=e;e=t,t=n}return e=En(e=+e)?e:0,function(){if(--e<1)return t.apply(this,arguments)}}function ko(e,t,n){return n&&Vi(e,t,n)&&(t=null),t=e&&t==null?e.length:xn(+t||0,0),_i(e,f,null,null,null,null,t)}function Lo(e,t){var n;if(typeof t!="function"){if(typeof e!="function")throw new xt(y);var r=e;e=t,t=r}return function(){return--e>0?n=t.apply(this,arguments):t=null,n}}function Po(t,n,r){function v(){f&&an(f),s&&an(s),s=f=l=e}function m(){var r=n-(No()-u);if(r<=0||r>n){s&&an(s);var h=l;s=f=l=e,h&&(c=No(),o=t.apply(a,i),!f&&!s&&(i=a=null))}else f=dn(m,r)}function g(){f&&an(f),s=f=l=e;if(p||h!==n)c=No(),o=t.apply(a,i),!f&&!s&&(i=a=null)}function b(){i=arguments,u=No(),a=this,l=p&&(f||!d);if(h===!1)var e=d&&!f;else{!s&&!d&&(c=u);var r=h-(u-c),v=r<=0||r>h;v?(s&&(s=an(s)),c=u,o=t.apply(a,i)):s||(s=dn(g,r))}return v&&f?f=an(f):!f&&n!==h&&(f=dn(m,n)),e&&(v=!0,o=t.apply(a,i)),v&&!f&&!s&&(i=a=null),o}var i,s,o,u,a,f,l,c=0,h=!1,p=!0;if(typeof t!="function")throw new xt(y);n=n<0?0:+n||0;if(r===!0){var d=!0;p=!1}else uu(r)&&(d=r.leading,h="maxWait"in r&&xn(+r.maxWait||0,n),p="trailing"in r?r.trailing:p);return b.cancel=v,b}function Io(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new xt(y);var n=function(){var r=arguments,i=n.cache,s=t?t.apply(this,r):r[0];if(i.has(s))return i.get(s);var o=e.apply(this,r);return i.set(s,o),o};return n.cache=new Io.Cache,n}function qo(e){if(typeof e!="function")throw new xt(y);return function(){return!e.apply(this,arguments)}}function Ro(e){return Lo(e,2)}function Xo(e,t){if(typeof e!="function")throw new xt(y);return t=xn(typeof t=="undefined"?e.length-1:+t||0,0),function(){var n=arguments,r=-1,i=xn(n.length-t,0),s=O(i);while(++r<i)s[r]=n[t+r];switch(t){case 0:return e.call(this,s);case 1:return e.call(this,n[0],s);case 2:return e.call(this,n[0],n[1],s)}var o=O(t+1);r=-1;while(++r<t)o[r]=n[r];return o[t]=s,e.apply(this,o)}}function Vo(e){if(typeof e!="function")throw new xt(y);return function(t){return e.apply(this,t)}}function $o(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new xt(y);return n===!1?r=!1:uu(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),vt.leading=r,vt.maxWait=+t,vt.trailing=i,Po(e,t,vt)}function Jo(e,t){return t=t==null?ma:t,_i(t,u,null,[e],[])}function Ko(e,t,n,r){return t&&typeof t!="boolean"&&Vi(e,t,n)?t=!1:typeof t=="function"&&(r=n,n=t,t=!1),n=typeof n=="function"&&ii(n,r,1),yr(e,t,n)}function Qo(e,t,n){return t=typeof t=="function"&&ii(t,n,1),yr(e,!0,t)}function Go(t){var n=Ut(t)?t.length:e;return Ji(n)&&tn.call(t)==w}function Zo(e){return e===!0||e===!1||Ut(e)&&tn.call(e)==S}function eu(e){return Ut(e)&&tn.call(e)==x}function tu(e){return!!e&&e.nodeType===1&&Ut(e)&&tn.call(e).indexOf("Element")>-1}function nu(e){if(e==null)return!0;var t=e.length;return Ji(t)&&(Yo(e)||vu(e)||Go(e)||Ut(e)&&ou(e.splice))?!t:!_u(e).length}function ru(t,n,r,i){r=typeof r=="function"&&ii(r,i,3);if(!r&&Ki(t)&&Ki(n))return t===n;var s=r?r(t,n):e;return typeof s=="undefined"?Hr(t,n,r):!!s}function iu(e){return Ut(e)&&typeof e.message=="string"&&tn.call(e)==T}function uu(e){var t=typeof e;return t=="function"||!!e&&t=="object"}function au(e,t,n,r){var i=_u(t),s=i.length;if(!s)return!0;if(e==null)return!1;n=typeof n=="function"&&ii(n,r,3);if(!n&&s==1){var o=i[0],u=t[o];if(Ki(u))return u===e[o]&&(typeof u!="undefined"||o in is(e))}var a=O(s),f=O(s);while(s--)u=a[s]=t[i[s]],f[s]=Ki(u);return jr(is(e),i,a,f,n)}function fu(e){return hu(e)&&e!=+e}function lu(e){return e==null?!1:tn.call(e)==N?rn.test(Gt.call(e)):Ut(e)&&rt.test(e)}function cu(e){return e===null}function hu(e){return typeof e=="number"||Ut(e)&&tn.call(e)==k}function du(e){return Ut(e)&&tn.call(e)==A||!1}function vu(e){return typeof e=="string"||Ut(e)&&tn.call(e)==M}function mu(e){return Ut(e)&&Ji(e.length)&&!!pt[tn.call(e)]}function gu(e){return typeof e=="undefined"}function yu(e){var t=e?e.length:0;return Ji(t)?t?er(e):[]:Ru(e)}function bu(e){return mr(e,Du(e))}function Eu(e,t,n){var r=br(e);return n&&Vi(e,t,n)&&(t=null),t?mr(t,r,_u(t)):r}function Au(e){return Pr(e,Du(e))}function Ou(e,t){return e?Zt.call(e,t):!1}function Mu(e,t,n){n&&Vi(e,t,n)&&(t=null);var r=-1,i=_u(e),s=i.length,o={};while(++r<s){var u=i[r],a=e[u];t?Zt.call(o,a)?o[a].push(u):o[a]=[u]:o[a]=u}return o}function Du(e){if(e==null)return[];uu(e)||(e=wt(e));var t=e.length;t=t&&Ji(t)&&(Yo(e)||Rn.nonEnumArgs&&Go(e))&&t||0;var n=e.constructor,r=-1,i=typeof n=="function"&&n.prototype===e,s=O(t),o=t>0;while(++r<t)s[r]=r+"";for(var u in e)(!o||!Xi(u,t))&&(u!="constructor"||!i&&!!Zt.call(e,u))&&s.push(u);return s}function Pu(e,t,n){var r={};return t=ji(t,n,3),_r(e,function(e,n,i){r[n]=t(e,n,i)}),r}function ju(e){var t=-1,n=_u(e),r=n.length,i=O(r);while(++t<r){var s=n[t];i[t]=[s,e[s]]}return i}function Iu(t,n,r){var i=t==null?e:t[n];return typeof i=="undefined"&&(i=r),ou(i)?i.call(t):i}function qu(e,t,n,r){var i=Yo(e)||mu(e);t=ji(t,r,4);if(n==null)if(i||uu(e)){var s=e.constructor;i?n=Yo(e)?new s:[]:n=br(ou(s)&&s.prototype)}else n={};return(i?tr:_r)(e,function(e,r,i){return t(n,e,r,i)}),n}function Ru(e){return Zr(e,_u(e))}function Uu(e){return Zr(e,Du(e))}function zu(e,t,n){return t=+t||0,typeof n=="undefined"?(n=t,t=0):n=+n||0,e>=t&&e<n}function Wu(e,t,n){n&&Vi(e,t,n)&&(t=n=null);var r=e==null,i=t==null;n==null&&(i&&typeof e=="boolean"?(n=e,e=1):typeof t=="boolean"&&(n=t,i=!0)),r&&i&&(t=1,i=!1),e=+e||0,i?(t=e,e=0):t=+t||0;if(n||e%1||t%1){var s=Ln();return Tn(e+s*(t-e+parseFloat("1e-"+((s+"").length-1))),t)}return Wr(e,t)}function Vu(e){return e=_t(e),e&&e.charAt(0).toUpperCase()+e.slice(1)}function $u(e){return e=_t(e),e&&e.replace(it,Ft).replace(Z,"")}function Ju(e,t,n){e=_t(e),t+="";var r=e.length;return n=typeof n=="undefined"?r:Tn(n<0?0:+n||0,r),n-=t.length,n>=0&&e.indexOf(t,n)==n}function Ku(e){return e=_t(e),e&&K.test(e)?e.replace($,It):e}function Qu(e){return e=_t(e),e&&ut.test(e)?e.replace(ot,"\\$&"):e}function Yu(e,t,n){e=_t(e),t=+t;var r=e.length;if(r>=t||!En(t))return e;var i=(t-r)/2,s=fn(i),o=un(i);return n=Ai("",o,n),n.slice(0,s)+e+n}function ta(e,t,n){return n&&Vi(e,t,n)&&(t=0),kn(e,t)}function na(e,t){var n="";e=_t(e),t=+t;if(t<1||!e||!En(t))return n;do t%2&&(n+=e),t=fn(t/2),e+=e;while(t);return n}function sa(e,t,n){return e=_t(e),n=n==null?0:Tn(n<0?0:+n||0,e.length),e.lastIndexOf(t,n)==n}function oa(t,n,r){var i=Fn.templateSettings;r&&Vi(t,n,r)&&(n=r=null),t=_t(t),n=dr(dr({},r||n),i,pr);var s=dr(dr({},n.imports),i.imports,pr),o=_u(s),u=Zr(s,o),a,f,l=0,c=n.interpolate||st,h="__p += '",p=Et((n.escape||st).source+"|"+c.source+"|"+(c===Y?et:st).source+"|"+(n.evaluate||st).source+"|$","g"),d="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++ht+"]")+"\n";t.replace(p,function(e,n,r,i,s,o){return r||(r=i),h+=t.slice(l,o).replace(at,qt),n&&(a=!0,h+="' +\n__e("+n+") +\n'"),s&&(f=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=o+e.length,e}),h+="';\n";var v=n.variable;v||(h="with (obj) {\n"+h+"\n}\n"),h=(f?h.replace(z,""):h).replace(W,"$1").replace(X,"$1;"),h="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(f?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var m=pa(function(){return gt(o,d+"return "+h).apply(e,u)});m.source=h;if(iu(m))throw m;return m}function ua(e,t,n){var r=e;return e=_t(e),e?(n?Vi(r,t,n):t==null)?e.slice(Vt(e),$t(e)+1):(t+="",e.slice(Pt(e,t),Ht(e,t)+1)):e}function aa(e,t,n){var r=e;return e=_t(e),e?(n?Vi(r,t,n):t==null)?e.slice(Vt(e)):e.slice(Pt(e,t+"")):e}function fa(e,t,n){var r=e;return e=_t(e),e?(n?Vi(r,t,n):t==null)?e.slice(0,$t(e)+1):e.slice(0,Ht(e,t+"")+1):e}function la(e,t,n){n&&Vi(e,t,n)&&(t=null);var r=c,i=h;if(t!=null)if(uu(t)){var s="separator"in t?t.separator:s;r="length"in t?+t.length||0:r,i="omission"in t?_t(t.omission):i}else r=+t||0;e=_t(e);if(r>=e.length)return e;var o=r-i.length;if(o<1)return i;var u=e.slice(0,o);if(s==null)return u+i;if(du(s)){if(e.slice(o).search(s)){var a,f,l=e.slice(0,o);s.global||(s=Et(s.source,(tt.exec(s)||"")+"g")),s.lastIndex=0;while(a=s.exec(l))f=a.index;u=u.slice(0,f==null?o:f)}}else if(e.indexOf(s,o)!=o){var p=u.lastIndexOf(s);p>-1&&(u=u.slice(0,p))}return u+i}function ca(e){return e=_t(e),e&&J.test(e)?e.replace(V,Jt):e}function ha(e,t,n){return n&&Vi(e,t,n)&&(t=null),e=_t(e),e.match(t||ft)||[]}function da(e,t,n){return n&&Vi(e,t,n)&&(t=null),Ut(e)?ga(e):gr(e,t)}function va(e){return function(){return e}}function ma(e){return e}function ga(e){return Ir(yr(e,!0))}function ya(e,t){return qr(e+"",yr(t,!0))}function ba(e,t,n){if(n==null){var r=uu(t),i=r&&_u(t),s=i&&i.length&&Pr(t,i);if(s?!s.length:!r)s=!1,n=t,t=e,e=this}s||(s=Pr(t,_u(t)));var o=!0,u=-1,a=ou(e),f=s.length;n===!1?o=!1:uu(n)&&"chain"in n&&(o=n.chain);while(++u<f){var l=s[u],c=t[l];e[l]=c,a&&(e.prototype[l]=function(t){return function(){var n=this.__chain__;if(o||n){var r=e(this.__wrapped__),i=r.__actions__=er(this.__actions__);return i.push({func:t,args:arguments,thisArg:e}),r.__chain__=n,r}var s=[this.value()];return cn.apply(s,arguments),t.apply(e,s)}}(c))}return e}function wa(){return C._=nn,this}function Ea(){}function Sa(e){return zr(e+"")}function xa(t){return function(n){return t==null?e:t[n]}}function Ta(e,t,n){n&&Vi(e,t,n)&&(t=n=null),e=+e||0,n=n==null?1:+n||0,t==null?(t=e,e=0):t=+t||0;var r=-1,i=xn(un((t-e)/(n||1)),0),s=O(i);while(++r<i)s[r]=e,e+=n;return s}function Na(e,t,n){e=+e;if(e<1||!En(e))return[];var r=-1,i=O(Tn(e,Mn));t=ii(t,n,1);while(++r<e)r<Mn?i[r]=t(r):t(r);return i}function Ca(e){var t=++en;return _t(e)+t}function ka(e,t){return e+t}function Oa(e,t,n){n&&Vi(e,t,n)&&(t=null);var r=ji(),i=t==null;if(r!==gr||!i)i=!1,t=r(t,n,3);return i?cr(Yo(e)?e:rs(e)):Gr(e,t)}C=C?Qt.defaults(kt.Object(),C,Qt.pick(kt,ct)):kt;var O=C.Array,_=C.Date,mt=C.Error,gt=C.Function,yt=C.Math,bt=C.Number,wt=C.Object,Et=C.RegExp,St=C.String,xt=C.TypeError,Tt=O.prototype,Nt=wt.prototype,Ct=St.prototype,zt=(zt=C.window)&&zt.document,Gt=gt.prototype.toString,Yt=zr("length"),Zt=Nt.hasOwnProperty,en=0,tn=Nt.toString,nn=C._,rn=Et("^"+Qu(tn).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sn=lu(sn=C.ArrayBuffer)&&sn,on=lu(on=sn&&(new sn(0)).slice)&&on,un=yt.ceil,an=C.clearTimeout,fn=yt.floor,ln=lu(ln=wt.getPrototypeOf)&&ln,cn=Tt.push,hn=Nt.propertyIsEnumerable,pn=lu(pn=C.Set)&&pn,dn=C.setTimeout,vn=Tt.splice,mn=lu(mn=C.Uint8Array)&&mn,gn=lu(gn=C.WeakMap)&&gn,yn=function(){try{var e=lu(e=C.Float64Array)&&e,t=new e(new sn(10),0,1)&&e}catch(n){}return t}(),bn=lu(bn=O.isArray)&&bn,wn=lu(wn=wt.create)&&wn,En=C.isFinite,Sn=lu(Sn=wt.keys)&&Sn,xn=yt.max,Tn=yt.min,Nn=lu(Nn=_.now)&&Nn,Cn=lu(Cn=bt.isFinite)&&Cn,kn=C.parseInt,Ln=yt.random,An=bt.NEGATIVE_INFINITY,On=bt.POSITIVE_INFINITY,Mn=yt.pow(2,32)-1,_n=Mn-1,Dn=Mn>>>1,Pn=yn?yn.BYTES_PER_ELEMENT:0,Hn=yt.pow(2,53)-1,Bn=gn&&new gn,jn={},Rn=Fn.support={};(function(e){Rn.funcDecomp=/\bthis\b/.test(function(){return this}),Rn.funcNames=typeof gt.name=="string";try{Rn.dom=zt.createDocumentFragment().nodeType===11}catch(t){Rn.dom=!1}try{Rn.nonEnumArgs=!hn.call(arguments,1)}catch(t){Rn.nonEnumArgs=!0}})(0,0),Fn.templateSettings={escape:Q,evaluate:G,interpolate:Y,variable:"",imports:{_:Fn}};var br=function(){function e(){}return function(t){if(uu(t)){e.prototype=t;var n=new e;e.prototype=null}return n||C.Object()}}(),Sr=li(_r),xr=li(Dr,!0),Ar=ci(),Or=ci(!0),Vr=Bn?function(e,t){return Bn.set(e,t),e}:ma;on||(si=!sn||!mn?va(null):function(e){var t=e.byteLength,n=yn?fn(t/Pn):0,r=n*Pn,i=new sn(t);if(n){var s=new yn(i,0,n);s.set(new yn(e,0,n))}return t!=r&&(s=new mn(i,r),s.set(new mn(e,r))),i});var pi=!wn||!pn?va(null):function(e){return new Gn(e)},Fi=Bn?function(e){return Bn.get(e)}:Ea,Ii=function(){return Rn.funcNames?va.name=="constant"?zr("name"):function(e){var t=e.name,n=jn[t],r=n?n.length:0;while(r--){var i=n[r],s=i.func;if(s==null||s==e)return i.name}return t}:va("")}(),es=function(){var e=0,t=0;return function(n,r){var i=No(),s=d-(i-t);t=i;if(s>0){if(++e>=p)return n}else e=0;return Vr(n,r)}}(),as=Xo(function(e,t){return Yo(e)||Go(e)?Er(e,Lr(t,!1,!0)):[]}),ds=bi(),vs=bi(!0),Ns=Xo(function(e,t){e||(e=[]),t=Lr(t);var n=t.length,r=vr(e,t);t.sort(Lt);while(n--){var i=parseFloat(t[n]);if(i!=s&&Xi(i)){var s=i;vn.call(e,i,1)}}return r}),As=Mi(),Os=Mi(!0),Hs=Xo(function(e){return Yr(Lr(e,!1,!0))}),Fs=Xo(function(e,t){return Yo(e)||Go(e)?Er(e,t):[]}),qs=Xo(js),Gs=Xo(function(e,t){var n=e?e.length:0;return Ji(n)&&(e=rs(e)),vr(e,Lr(t))}),Ys=ai(function(e,t,n){Zt.call(e,n)?++e[n]:e[n]=1}),to=yi(Sr),no=yi(xr,!0),io=Si(tr,Sr),so=Si(nr,xr),oo=ai(function(e,t,n){Zt.call(e,n)?e[n].push(t):e[n]=[t]}),ao=ai(function(e,t,n){e[n]=t}),fo=Xo(function(t,n,r){var i=-1,s=typeof n=="function",o=t?t.length:0,u=Ji(o)?O(o):[];return Sr(t,function(t){var o=s?n:t!=null&&t[n];u[++i]=o?o.apply(t,r):e}),u}),co=ai(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),po=ki(ar,Sr),vo=ki(fr,xr),No=Nn||function(){return(new _).getTime()},Ao=Xo(function(e,t,r){var i=n;if(r.length){var s=Wt(r,Ao.placeholder);i|=u}return _i(e,i,t,r,s)}),Oo=Xo(function(e,t){t=t.length?Lr(t):Au(e);var r=-1,i=t.length;while(++r<i){var s=t[r];e[s]=_i(e[s],n,e)}return e}),Mo=Xo(function(e,t,i){var s=n|r;if(i.length){var o=Wt(i,Mo.placeholder);s|=u}return _i(t,s,e,i,o)}),_o=mi(s),Do=mi(o),Ho=Xo(function(e,t){return wr(e,1,t)}),Bo=Xo(function(e,t,n){return wr(e,t,n)}),jo=Ei(),Fo=Ei(!0),Uo=Ci(u),zo=Ci(a),Wo=Xo(function(e,t){return _i(e,l,null,null,null,Lr(t))}),Yo=bn||function(e){return Ut(e)&&Ji(e.length)&&tn.call(e)==E};Rn.dom||(tu=function(e){return!!e&&e.nodeType===1&&Ut(e)&&!pu(e)});var su=Cn||function(e){return typeof e=="number"&&En(e)},ou=Mt(/x/)||mn&&!Mt(mn)?function(e){return tn.call(e)==N}:Mt,pu=ln?function(e){if(!e||tn.call(e)!=L)return!1;var t=e.valueOf,n=lu(t)&&(n=ln(t))&&ln(n);return n?e==n||ln(e)==n:ts(e)}:ts,wu=fi(dr),Su=Xo(function(t){var n=t[0];return n==null?n:(t.push(hr),wu.apply(e,t))}),xu=wi(_r),Tu=wi(Dr),Nu=xi(Ar),Cu=xi(Or),ku=Ti(_r),Lu=Ti(Dr),_u=Sn?function(e){if(e)var t=e.constructor,n=e.length;return typeof t=="function"&&t.prototype===e||typeof e!="function"&&n&&Ji(n)?ns(e):uu(e)?Sn(e):[]}:ns,Hu=fi(Rr),Bu=Xo(function(e,t){if(e==null)return{};if(typeof t[0]!="function"){var t=sr(Lr(t),St);return Gi(e,Er(Du(e),t))}var n=ii(t[0],t[1],3);return Yi(e,function(e,t,r){return!n(e,t,r)})}),Fu=Xo(function(e,t){return e==null?{}:typeof t[0]=="function"?Yi(e,ii(t[0],t[1],3)):Gi(e,Lr(t))}),Xu=di(function(e,t,n){return t=t.toLowerCase(),e+(n?t.charAt(0).toUpperCase()+t.slice(1):t)}),Gu=di(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Zu=Ni(),ea=Ni(!0);kn(lt+"08")!=8&&(ta=function(e,t,n){return(n?Vi(e,t,n):t==null)?t=0:t&&(t=+t),e=ua(e),kn(e,t||(nt.test(e)?16:10))});var ra=di(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),ia=di(function(e,t,n){return e+(n?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))}),pa=Xo(function(t,n){try{return t.apply(e,n)}catch(r){return iu(r)?r:new mt(r)}}),La=gi(or),Aa=gi(ur,!0);return Fn.prototype=In.prototype,qn.prototype=br(In.prototype),qn.prototype.constructor=qn,Un.prototype=br(In.prototype),Un.prototype.constructor=Un,Vn.prototype["delete"]=$n,Vn.prototype.get=Jn,Vn.prototype.has=Kn,Vn.prototype.set=Qn,Gn.prototype.push=Zn,Io.Cache=Vn,Fn.after=Co,Fn.ary=ko,Fn.assign=wu,Fn.at=Gs,Fn.before=Lo,Fn.bind=Ao,Fn.bindAll=Oo,Fn.bindKey=Mo,Fn.callback=da,Fn.chain=Us,Fn.chunk=os,Fn.compact=us,Fn.constant=va,Fn.countBy=Ys,Fn.create=Eu,Fn.curry=_o,Fn.curryRight=Do,Fn.debounce=Po,Fn.defaults=Su,Fn.defer=Ho,Fn.delay=Bo,Fn.difference=as,Fn.drop=fs,Fn.dropRight=ls,Fn.dropRightWhile=cs,Fn.dropWhile=hs,Fn.fill=ps,Fn.filter=eo,Fn.flatten=gs,Fn.flattenDeep=ys,Fn.flow=jo,Fn.flowRight=Fo,Fn.forEach=io,Fn.forEachRight=so,Fn.forIn=Nu,Fn.forInRight=Cu,Fn.forOwn=ku,Fn.forOwnRight=Lu,Fn.functions=Au,Fn.groupBy=oo,Fn.indexBy=ao,Fn.initial=ws,Fn.intersection=Es,Fn.invert=Mu,Fn.invoke=fo,Fn.keys=_u,Fn.keysIn=Du,Fn.map=lo,Fn.mapValues=Pu,Fn.matches=ga,Fn.matchesProperty=ya,Fn.memoize=Io,Fn.merge=Hu,Fn.mixin=ba,Fn.negate=qo,Fn.omit=Bu,Fn.once=Ro,Fn.pairs=ju,Fn.partial=Uo,Fn.partialRight=zo,Fn.partition=co,Fn.pick=Fu,Fn.pluck=ho,Fn.property=Sa,Fn.propertyOf=xa,Fn.pull=Ts,Fn.pullAt=Ns,Fn.range=Ta,Fn.rearg=Wo,Fn.reject=mo,Fn.remove=Cs,Fn.rest=ks,Fn.restParam=Xo,Fn.shuffle=yo,Fn.slice=Ls,Fn.sortBy=Eo,Fn.sortByAll=So,Fn.sortByOrder=xo,Fn.spread=Vo,Fn.take=Ms,Fn.takeRight=_s,Fn.takeRightWhile=Ds,Fn.takeWhile=Ps,Fn.tap=zs,Fn.throttle=$o,Fn.thru=Ws,Fn.times=Na,Fn.toArray=yu,Fn.toPlainObject=bu,Fn.transform=qu,Fn.union=Hs,Fn.uniq=Bs,Fn.unzip=js,Fn.values=Ru,Fn.valuesIn=Uu,Fn.where=To,Fn.without=Fs,Fn.wrap=Jo,Fn.xor=Is,Fn.zip=qs,Fn.zipObject=Rs,Fn.backflow=Fo,Fn.collect=lo,Fn.compose=Fo,Fn.each=io,Fn.eachRight=so,Fn.extend=wu,Fn.iteratee=da,Fn.methods=Au,Fn.object=Rs,Fn.select=eo,Fn.tail=ks,Fn.unique=Bs,ba(Fn,Fn),Fn.add=ka,Fn.attempt=pa,Fn.camelCase=Xu,Fn.capitalize=Vu,Fn.clone=Ko,Fn.cloneDeep=Qo,Fn.deburr=$u,Fn.endsWith=Ju,Fn.escape=Ku,Fn.escapeRegExp=Qu,Fn.every=Zs,Fn.find=to,Fn.findIndex=ds,Fn.findKey=xu,Fn.findLast=no,Fn.findLastIndex=vs,Fn.findLastKey=Tu,Fn.findWhere=ro,Fn.first=ms,Fn.has=Ou,Fn.identity=ma,Fn.includes=uo,Fn.indexOf=bs,Fn.inRange=zu,Fn.isArguments=Go,Fn.isArray=Yo,Fn.isBoolean=Zo,Fn.isDate=eu,Fn.isElement=tu,Fn.isEmpty=nu,Fn.isEqual=ru,Fn.isError=iu,Fn.isFinite=su,Fn.isFunction=ou,Fn.isMatch=au,Fn.isNaN=fu,Fn.isNative=lu,Fn.isNull=cu,Fn.isNumber=hu,Fn.isObject=uu,Fn.isPlainObject=pu,Fn.isRegExp=du,Fn.isString=vu,Fn.isTypedArray=mu,Fn.isUndefined=gu,Fn.kebabCase=Gu,Fn.last=Ss,Fn.lastIndexOf=xs,Fn.max=La,Fn.min=Aa,Fn.noConflict=wa,Fn.noop=Ea,Fn.now=No,Fn.pad=Yu,Fn.padLeft=Zu,Fn.padRight=ea,Fn.parseInt=ta,Fn.random=Wu,Fn.reduce=po,Fn.reduceRight=vo,Fn.repeat=na,Fn.result=Iu,Fn.runInContext=Kt,Fn.size=bo,Fn.snakeCase=ra,Fn.some=wo,Fn.sortedIndex=As,Fn.sortedLastIndex=Os,Fn.startCase=ia,Fn.startsWith=sa,Fn.sum=Oa,Fn.template=oa,Fn.trim=ua,Fn.trimLeft=aa,Fn.trimRight=fa,Fn.trunc=la,Fn.unescape=ca,Fn.uniqueId=Ca,Fn.words=ha,Fn.all=Zs,Fn.any=wo,Fn.contains=uo,Fn.detect=to,Fn.foldl=po,Fn.foldr=vo,Fn.head=ms,Fn.include=uo,Fn.inject=po,ba(Fn,function(){var e={};return _r(Fn,function(t,n){Fn.prototype[n]||(e[n]=t)}),e}(),!1),Fn.sample=go,Fn.prototype.sample=function(e){return!this.__chain__&&e==null?go(this.value()):this.thru(function(t){return go(t,e)})},Fn.VERSION=t,tr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Fn[e].placeholder=Fn}),tr(["dropWhile","filter","map","takeWhile"],function(e,t){var n=t!=g,r=t==v;Un.prototype[e]=function(e,i){var s=this.__filtered__,o=s&&r?new Un(this):this.clone(),u=o.__iteratees__||(o.__iteratees__=[]);return u.push({done:!1,count:0,index:0,iteratee:ji(e,i,1),limit:-1,type:t}),o.__filtered__=s||n,o}}),tr(["drop","take"],function(e,t){var n=e+"While";Un.prototype[e]=function(n){var r=this.__filtered__,i=r&&!t?this.dropWhile():this.clone();n=n==null?1:xn(fn(n)||0,0);if(r)t?i.__takeCount__=Tn(i.__takeCount__,n):Ss(i.__iteratees__).limit=n;else{var s=i.__views__||(i.__views__=[]);s.push({size:n,type:e+(i.__dir__<0?"Right":"")})}return i},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()},Un.prototype[e+"RightWhile"]=function(e,t){return this.reverse()[n](e,t).reverse()}}),tr(["first","last"],function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}}),tr(["initial","rest"],function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this[n](1)}}),tr(["pluck","where"],function(e,t){var n=t?"filter":"map",r=t?Ir:zr;Un.prototype[e]=function(e){return this[n](r(e))}}),Un.prototype.compact=function(){return this.filter(ma)},Un.prototype.reject=function(e,t){return e=ji(e,t,1),this.filter(function(t){return!e(t)})},Un.prototype.slice=function(e,t){e=e==null?0:+e||0;var n=e<0?this.takeRight(-e):this.drop(e);return typeof t!="undefined"&&(t=+t||0,n=t<0?n.dropRight(-t):n.take(t-e)),n},Un.prototype.toArray=function(){return this.drop(0)},_r(Un.prototype,function(e,t){var n=Fn[t];if(!n)return;var r=/^(?:filter|map|reject)|While$/.test(t),i=/^(?:first|last)$/.test(t);Fn.prototype[t]=function(){var t=arguments,s=t.length,o=this.__chain__,u=this.__wrapped__,a=!!this.__actions__.length,f=u instanceof Un,l=t[0],c=f||Yo(u);c&&r&&typeof l=="function"&&l.length!=1&&(f=c=!1);var h=f&&!a;if(i&&!o)return h?e.call(u):n.call(Fn,this.value());var p=function(e){var r=[e];return cn.apply(r,t),n.apply(Fn,r)};if(c){var d=h?u:new Un(this),v=e.apply(d,t);if(!i&&(a||v.__actions__)){var m=v.__actions__||(v.__actions__=[]);m.push({func:Ws,args:[p],thisArg:Fn})}return new qn(v,o)}return this.thru(p)}}),tr(["concat","join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var t=(/^(?:replace|split)$/.test(e)?Ct:Tt)[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:join|pop|replace|shift)$/.test(e);Fn.prototype[e]=function(){var e=arguments;return r&&!this.__chain__?t.apply(this.value(),e):this[n](function(n){return t.apply(n,e)})}}),_r(Un.prototype,function(e,t){var n=Fn[t];if(n){var r=n.name,i=jn[r]||(jn[r]=[]);i.push({name:t,func:n})}}),jn[Li(null,r).name]=[{name:"wrapper",func:null}],Un.prototype.clone=zn,Un.prototype.reverse=Wn,Un.prototype.value=Xn,Fn.prototype.chain=Xs,Fn.prototype.commit=Vs,Fn.prototype.plant=$s,Fn.prototype.reverse=Js,Fn.prototype.toString=Ks,Fn.prototype.run=Fn.prototype.toJSON=Fn.prototype.valueOf=Fn.prototype.value=Qs,Fn.prototype.collect=Fn.prototype.map,Fn.prototype.head=Fn.prototype.first,Fn.prototype.select=Fn.prototype.filter,Fn.prototype.tail=Fn.prototype.rest,Fn}var e,t="3.6.0",n=1,r=2,i=4,s=8,o=16,u=32,a=64,f=128,l=256,c=30,h="...",p=150,d=16,v=0,m=1,g=2,y="Expected a function",b="__lodash_placeholder__",w="[object Arguments]",E="[object Array]",S="[object Boolean]",x="[object Date]",T="[object Error]",N="[object Function]",C="[object Map]",k="[object Number]",L="[object Object]",A="[object RegExp]",O="[object Set]",M="[object String]",_="[object WeakMap]",D="[object ArrayBuffer]",P="[object Float32Array]",H="[object Float64Array]",B="[object Int8Array]",j="[object Int16Array]",F="[object Int32Array]",I="[object Uint8Array]",q="[object Uint8ClampedArray]",R="[object Uint16Array]",U="[object Uint32Array]",z=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,X=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39|#96);/g,$=/[&<>"'`]/g,J=RegExp(V.source),K=RegExp($.source),Q=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,Z=/[\u0300-\u036f\ufe20-\ufe23]/g,et=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tt=/\w*$/,nt=/^0[xX]/,rt=/^\[object .+?Constructor\]$/,it=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,st=/($^)/,ot=/[.*+?^${}()|[\]\/\\]/g,ut=RegExp(ot.source),at=/['\n\r\u2028\u2029\\]/g,ft=function(){var e="[A-Z\\xc0-\\xd6\\xd8-\\xde]",t="[a-z\\xdf-\\xf6\\xf8-\\xff]+";return RegExp(e+"+(?="+e+t+")|"+e+"?"+t+"|"+e+"+|[0-9]+","g")}(),lt=" 	\f ﻿\n\r\u2028\u2029 ᠎             　",ct=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","document","isFinite","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","window"],ht=-1,pt={};pt[P]=pt[H]=pt[B]=pt[j]=pt[F]=pt[I]=pt[q]=pt[R]=pt[U]=!0,pt[w]=pt[E]=pt[D]=pt[S]=pt[x]=pt[T]=pt[N]=pt[C]=pt[k]=pt[L]=pt[A]=pt[O]=pt[M]=pt[_]=!1;var dt={};dt[w]=dt[E]=dt[D]=dt[S]=dt[x]=dt[P]=dt[H]=dt[B]=dt[j]=dt[F]=dt[k]=dt[L]=dt[A]=dt[M]=dt[I]=dt[q]=dt[R]=dt[U]=!0,dt[T]=dt[N]=dt[C]=dt[O]=dt[_]=!1;var vt={leading:!1,maxWait:0,trailing:!1},mt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},gt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},yt={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"},bt={"function":!0,object:!0},wt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Et=bt[typeof exports]&&exports&&!exports.nodeType&&exports,St=bt[typeof module]&&module&&!module.nodeType&&module,xt=Et&&St&&typeof global=="object"&&global,Tt=bt[typeof self]&&self&&self.Object&&self,Nt=bt[typeof window]&&window&&window.Object&&window,Ct=St&&St.exports===Et&&Et,kt=xt||Nt!==(this&&this.window)&&Nt||Tt||this,Qt=Kt();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(kt._=Qt,define("lodash",[],function(){return Qt})):Et&&St?Ct?(St.exports=Qt)._=Qt:Et._=Qt:kt._=Qt}.call(this),define("adapter/ps/descriptor",["require","exports","module","eventEmitter","../util","bluebird"],function(e,t,n){"use strict";var r=e("eventEmitter"),i=e("../util"),s=e("bluebird"),o=function(){r.call(this),this._psEventHandler=this._psEventHandler.bind(this)};i.inherits(o,r),o.prototype._psEventHandler=function(e,t,n){if(e){this.emit("error","Failed to handle Photoshop event: "+e);return}this.emit("all",t,n),this.emit(t,n)},o.prototype.emitEvent=function(e,t){if(e==="error"){var n=this.getListeners(e);if(n.length===0){var r,i;throw t.length>0&&typeof t[0]=="string"?r=t.shift():r="Unhandled error event",i=new Error(r),i.args=t,i}}o.super_.prototype.emitEvent.call(this,e,t)};var u=function(e){var t;return Array.isArray(e)?t={ref:e.map(u).reverse()}:typeof e=="string"?t={ref:e,"enum":"ordinal",value:"targetEnum"}:(t=e,t.hasOwnProperty("null")&&(t["null"]=u(t["null"]))),t},a=function(e,t){var n={ref:"property",property:t};return Array.isArray(e)?e.concat(n):[e,n]};o.prototype.get=function(e,t){t===undefined&&(t={});var n=u(e),r=s.promisify(_spaces.ps.descriptor.get,_spaces.ps.descriptor);return r(n,t)},o.prototype.getProperty=function(e,t,n){var r=a(e,t);return this.get(r,n).then(function(e){if(!e||!e.hasOwnProperty(t))throw new Error("No such property: "+t);return e[t]})},o.prototype.setProperty=function(e,t,n,r){if(!e.hasOwnProperty("ref"))throw new Error("You must pass a full reference to setProperty or else PS will crash!");var i=a(e,t).reverse(),s={obj:t,value:n},o={"null":{ref:i},to:s};return this.play("set",o,r)},o.prototype.interactionMode=_spaces.ps.descriptor.interactionMode,o.prototype.play=function(e,t,n){var r=[{name:e,descriptor:t||{}}];return this.batchPlay(r,n).get(0)},o.prototype.playObject=function(e,t){return this.batchPlayObjects([e],t).get(0)},o.prototype.batchPlay=function(e,t){t=t||{},t.hasOwnProperty("interactionMode")||(t.interactionMode=this.interactionMode.SILENT);var n=s.promisify(_spaces.ps.descriptor.batchPlay,_spaces.ps.descriptor);return n(e,t).then(function(e){if(t.continueOnError)return e;var n;e[1].some(function(e){if(e)return n=e,!0});if(n)throw n;return e[0]})},o.prototype.batchPlayObjects=function(e,t){var n=e.map(function(e){var t={name:e.command,descriptor:u(e.descriptor)};return e.hasOwnProperty("options")&&(t.options=e.options),t});return this.batchPlay(n,t)},o.prototype.batchGet=function(e,t){var n=e.map(function(e){return{name:"get",descriptor:{"null":u(e)}}});return this.batchPlay(n,t)},o.prototype.batchGetProperties=function(e,t){t=t||{};var n=e.map(function(e){return a(e.reference,e.property)});return this.batchGet(n,t).then(function(n){return t.continueOnError?n:n.map(function(t,n){var r=e[n].property;if(!t||!t.hasOwnProperty(r))throw new Error("No such property: "+r);return t[r]})})},o.prototype.batchGetOptionalProperties=function(e,t){var n=function(t){return{reference:e,property:t}},r=t.map(n),i={continueOnError:!0};return this.batchGetProperties(r,i).then(function(e){var n=e[0];return n.reduce(function(e,n,r){var i=t[r];return n&&n.hasOwnProperty(i)&&(e[i]=n[i]),e},{})})},o.prototype.batchGetProperty=function(e,t,n){var r=e.map(function(e){return{reference:e,property:t}});return this.batchGetProperties(r,n)};var f=new o;_spaces.setNotifier(_spaces.notifierGroup.PHOTOSHOP,{},f._psEventHandler),n.exports=f}),define("adapter/playobject",["require","exports","module","./ps/descriptor"],function(e,t,n){"use strict";var r=e("./ps/descriptor"),i=function(e,t,n){this.command=e,this.descriptor=t,this.options={interactionMode:r.interactionMode.SILENT},n!==undefined&&Object.keys(n).forEach(function(e){this.options[e]=n[e]},this)};i.prototype.command=null,i.prototype.descriptor=null,i.prototype.options=null,n.exports=i}),define("adapter/lib/reference",["require","exports","module"],function(e,t,n){"use strict";var r=function(e){if(Array.isArray(e))return r(e[e.length-1]);var t=e.ref;return Array.isArray(t)?t[0].ref:e.ref},i=function(e){var t=function(n,r){if(Array.isArray(r))return{ref:r.map(t.bind(null,n))};var i={ref:e};return i[n]=r,i},n=function(t,n){return{ref:e,"enum":t,value:n}};return{index:t.bind(null,"index"),id:t.bind(null,"id"),offset:t.bind(null,"offset"),name:t.bind(null,"name"),target:n("ordinal","targetEnum"),current:n("ordinal","targetEnum"),front:n("ordinal","front"),back:n("ordinal","back"),all:n("ordinal","all"),none:n("ordinal","none")}};n.exports.wrapper=i,n.exports.refersTo=r}),define("adapter/lib/unit",["require","exports","module"],function(e,t){"use strict";var n=function(e,t){return{unit:e+"Unit",value:t}};t.density=n.bind(null,"density"),t.pixels=t.px=n.bind(null,"pixels"),t.percent=n.bind(null,"percent"),t.angle=n.bind(null,"angle"),t.inches=t.in=n.bind(null,"inches"),t.centimeters=t.cm=n.bind(null,"centimeters"),t.picas=n.bind(null,"picas"),t.degrees=n.bind(null,"degrees"),t.number=n.bind(null,"number"),t.seconds=n.bind(null,"seconds"),t.points=t.pt=n.bind(null,"points"),t.millimeters=t.mm=n.bind(null,"millimeters"),t.distance=n.bind(null,"distance")}),define("adapter/lib/layer",["require","exports","module","../playobject","./reference","./unit","../util","./reference"],function(e,t){"use strict";var n=e("../playobject"),r=e("./reference"),i=r.wrapper("layer"),s=e("./unit"),o=e("../util").assert,u=e("./reference").refersTo,a=Object.defineProperties({},{ANY:{writeable:!1,enumerable:!0,value:0},PIXEL:{writeable:!1,enumerable:!0,value:1},ADJUSTMENT:{writeable:!1,enumerable:!0,value:2},TEXT:{writeable:!1,enumerable:!0,value:3},VECTOR:{writeable:!1,enumerable:!0,value:4},SMARTOBJECT:{writeable:!1,enumerable:!0,value:5},VIDEO:{writeable:!1,enumerable:!0,value:6},GROUP:{writeable:!1,enumerable:!0,value:7},"3D":{writeable:!1,enumerable:!0,value:8},GRADIENT:{writeable:!1,enumerable:!0,value:9},PATTERN:{writeable:!1,enumerable:!0,value:10},SOLIDCOLOR:{writeable:!1,enumerable:!0,value:11},BACKGROUND:{writeable:!1,enumerable:!0,value:12},GROUPEND:{writeable:!1,enumerable:!0,value:13}}),f=function(e,t){return o(u(e)==="layer","reorder is passed a non-layer reference"),new n("move",{adjustment:!1,"null":e,to:t,version:5})},l=function(e,t){return o(u(e)==="layer","align is passed a non-layer reference"),new n("align",{"null":e,using:{"enum":"alignDistributeSelector",value:l.vals[t]}})};l.vals={left:"ADSLefts",right:"ADSRights",horizontally:"ADSCentersH",center:"ADSCentersH",hCenter:"ADSCentersH",middle:"ADSCentersV",vCenter:"ADSCentersV",vertically:"ADSCentersV",top:"ADSTops",bottom:"ADSBottoms"};var c=function(e,t){return o(u(e)==="layer","distribute is passed a non-layer reference"),new n("distort",{"null":e,using:{"enum":"alignDistributeSelector",value:l.vals[t]}})},h=function(e,t,r){return r=r||"select",t=t||!1,o(u(e)==="layer","select is passed a non-layer reference"),new n("select",{"null":e,makeVisible:t,selectionModifier:{"enum":"selectionModifierType",value:h.vals[r]}})};h.vals={select:"0",deselect:"removeFromSelection",add:"addToSelection",addUpTo:"addToSelectionContinuous"};var p=function(){return new n("selectNoLayers",{"null":i.target})},d=function(e){return o(u(e)==="layer","hide is passed a non-layer reference"),new n("hide",{"null":e})},v=function(e){return o(u(e)==="layer","show is passed a non-layer reference"),new n("show",{"null":e})},m=function(e,t,r){o(u(e[0])==="layer","duplicate is passed a non-layer first-from reference"),o(u(e[1])==="document","duplicate is passed a non-layer second-from reference"),o(u(t)==="document","duplicate is passed a non-document to reference");var i={"null":{ref:e},to:t};return r!==undefined&&(i.name=r),new n("duplicate",i)},g=function(e,t){return o(u(e)==="layer","flip is passed a non-layer reference"),new n("flip",{"null":e,axis:{"enum":"orientation",value:t}})},y=function(e,t,r){return o(u(e)==="layer","setPosition is passed a non-layer reference"),new n("transform",{"null":e,snapToDocBounds:!0,relative:!1,position:{obj:"position",value:{horizontal:s.pixels(t),vertical:s.pixels(r)}}})},b=function(e,t,r,i,a,f){o(u(e)==="layer","setHeight is passed a non-layer reference");var l={"null":e,snapToDocBounds:!0};return t&&(l.width=s.pixels(t)),r&&(l.height=s.pixels(r)),i!==undefined&&!i?(l.relative=!1,o(a!==undefined&&f!==undefined,"Calling setSize with absolute flag with no x,y provided"),l.position={obj:"position",value:{horizontal:s.pixels(a),vertical:s.pixels(f)}}):l.relative=!0,new n("transform",l)},w=function(e,t){return o(u(e)==="layer","rotate is passed a non-layer reference"),new n("transform",{"null":e,snapToDocBounds:!0,angle:s.angle(t)})},E=function(e,t){return o(u(e)==="layer","setOpacity is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"to",value:{opacity:s.percent(t)}}})},S=function(e,t){return o(u(e)==="layer","setFillOpacity is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"to",value:{fillOpacity:s.percent(t)}}})},x=function(e,t){return o(u(e)==="layer","setBlendMode is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"layer",value:{mode:{"enum":"blendMode",value:t}}}})},T=function(e,t){return o(u(e)==="layer","setProportionalScaling is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"layer",value:{proportionalScaling:t}}})},N=function(e){return new n("set",{layerID:e,"null":{property:"background",ref:"layer"},to:{obj:"layer",value:{mode:{"enum":"blendMode",value:"normal"},opacity:{unit:"percentUnit",value:100}}}})},C=function(e){return o(u(e)==="layer","deleteLayer is passed a non-layer reference"),new n("delete",{"null":e})},k=function(e,t){return o(u(e)==="layer","renameLayer is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"layer",value:{name:t}}})},L=function(){return new n("make",{from:i.target,"null":{ref:"layerSection"}})},A=function(e,t){o(u(e)==="layer","setLocking is passed a non-layer reference");var r=t?{protectAll:!0}:{protectNone:!0};return new n("applyLocking",{"null":e,group:!0,layerLocking:{obj:"layerLocking",value:r}})},O=function(e,t,r){o(u(e)==="layer","translate is passed a non-layer reference");var i=t||0,a=r||0;return new n("transform",{"null":e,snapToDocBounds:!0,position:{obj:"position",value:{horizontal:s.pixels(i),vertical:s.pixels(a)}}})};t.referenceBy=i,t.layerKinds=a,t.reorder=f,t.align=l,t.distribute=c,t.select=h,t.deselectAll=p,t.hide=d,t.show=v,t.duplicate=m,t.flip=g,t.setPosition=y,t.setProportionalScaling=T,t.setSize=b,t.rotate=w,t.setOpacity=E,t.setFillOpacity=S,t.setBlendMode=x,t.delete=C,t.rename=k,t.groupSelected=L,t.setLocking=A,t.translate=O,t.unlockBackground=N}),define("js/util/object",["require","exports","module"],function(e,t){"use strict";var n=function(e,t){return typeof e!="object"?undefined:(t.split(".").some(function(t){if(!e.hasOwnProperty(t))return e=undefined,!0;e=e[t]}),e)},r=function(e,t,n){var r=window.Symbol(e);return n=n||{},n[e]={enumerable:!0,get:function(){return this.wasAltered()?(delete this[r],t.apply(this,arguments)):(this.hasOwnProperty(r)||(this[r]=t.apply(this,arguments)),this[r])}},n},i=function(e){return Object.keys(e).reduce(function(t,n){return r(n,e[n],t)},{})},s=function(e){var t=window.Symbol();return{value:function(n){this.hasOwnProperty(t)||(this[t]=new Map);var r=this[t];if(r.has(n))return r.get(n);var i=e.apply(this,arguments);return r.set(n,i),i}}};t.getPath=n,t.cachedGetSpec=r,t.cachedGetSpecs=i,t.cachedLookupSpec=s}),define("js/models/bounds",["require","exports","module","immutable","adapter/lib/layer","js/util/object"],function(e,t,n){"use strict";var r=e("immutable"),i=e("adapter/lib/layer"),s=e("js/util/object"),o=r.Record({top:null,bottom:null,left:null,right:null});Object.defineProperties(o.prototype,s.cachedGetSpecs({width:function(){return this.right-this.left},height:function(){return this.bottom-this.top},xCenter:function(){return this.left+this.width/2},yCenter:function(){return this.top+this.height/2},area:function(){return this.width*this.height},empty:function(){return this.area===0}})),o.fromDocumentDescriptor=function(e){var t=e.resolution.value,n=t/72,r={},i=e.height.value*n,s=e.width.value*n;return r.top=0,r.left=0,r.bottom=i,r.right=s,new o(r)},o.fromLayerDescriptor=function(e){var t=this.parseLayerDescriptor(e);return new o(t)},o.parseLayerDescriptor=function(e){var t;if(e.artboardEnabled)t=s.getPath(e,"artboard.value.artboardRect.value");else if(e.hasOwnProperty("pathBounds"))t=s.getPath(e,"pathBounds.value.pathBounds.value");else{switch(e.layerKind){case i.layerKinds.GROUP:case i.layerKinds.GROUPEND:return null}var n={};t=e.boundsNoEffects.value,n.top=t.top.value,n.left=t.left.value,n.bottom=t.bottom.value,n.right=t.right.value,t=n}return t},o.prototype.resetFromDescriptor=function(e){var t=o.parseLayerDescriptor(e);return this.merge(t)},o.union=function(e){if(e.isEmpty())return null;var t=e.first(),n=t.withMutations(function(t){e.rest().forEach(function(e){t.top=Math.min(t.top,e.top),t.left=Math.min(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)})});return n},o.prototype.contains=function(e,t){return this.top<=t&&t<=this.bottom&&this.left<=e&&e<=this.right},o.prototype.normalize=function(){var e={};return this.right<this.left&&(e.left=this.right,e.right=this.left),this.bottom<this.top&&(e.top=this.bottom,e.bottom=this.top),this.merge(e)},o.prototype.updatePosition=function(e,t){var n=this.width,r=this.height,i={};return typeof e=="number"&&(i.left=e,i.right=e+n),typeof t=="number"&&(i.top=t,i.bottom=t+r),this.merge(i)},o.prototype.updateSize=function(e,t,n){var r={};if(typeof e=="number"){var i=this.width;r.right=this.left+e;if(n){var s=this.height/i*e;r.bottom=this.top+s}}if(typeof t=="number"){var o=this.height;r.bottom=this.top+t;if(n){var u=this.width/o*t;r.right=this.left+u}}return this.merge(r)},o.prototype.updateSizeAndPosition=function(e,t,n,r){var i={};return typeof e=="number"&&(i.left=e,typeof n=="number"&&(i.right=e+n)),typeof t=="number"&&(i.top=t,typeof r=="number"&&(i.bottom=t+r)),this.merge(i)},o.prototype.intersects=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},n.exports=o}),!function(){function i(e){return e&&(e.ownerDocument||e.document||e).documentElement}function s(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}function p(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function d(e){return e===null?NaN:+e}function v(e){return!isNaN(e)}function m(e){return{left:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;e(t[s],n)<0?r=s+1:i=s}return r},right:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;e(t[s],n)>0?i=s:r=s+1}return r}}}function y(e){return e.length}function w(e){var t=1;while(e*t%1)t*=10;return t}function E(e,t){for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}function S(){this._=Object.create(null)}function N(e){return(e+="")===x||e[0]===T?T+e:e}function C(e){return(e+="")[0]===T?e.slice(1):e}function k(e){return N(e)in this._}function L(e){return(e=N(e))in this._&&delete this._[e]}function A(){var e=[];for(var t in this._)e.push(C(t));return e}function O(){var e=0;for(var t in this._)++e;return e}function M(){for(var e in this._)return!1;return!0}function _(){this._=Object.create(null)}function D(e){return e}function P(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function H(e,t){if(t in e)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var n=0,r=B.length;n<r;++n){var i=B[n]+t;if(i in e)return i}}function j(){}function F(){}function I(e){function r(){var n=t,r=-1,i=n.length,s;while(++r<i)(s=n[r].on)&&s.apply(this,arguments);return e}var t=[],n=new S;return r.on=function(r,i){var s=n.get(r),o;return arguments.length<2?s&&s.on:(s&&(s.on=null,t=t.slice(0,o=t.indexOf(s)).concat(t.slice(o+1)),n.remove(r)),i&&t.push(n.set(r,{on:i})),e)},r}function q(){e.event.preventDefault()}function R(){var t=e.event,n;while(n=t.sourceEvent)t=n;return t}function U(t){var n=new F,r=0,i=arguments.length;while(++r<i)n[arguments[r]]=I(n);return n.of=function(r,i){return function(s){try{var o=s.sourceEvent=e.event;s.target=t,e.event=s,n[s.type].apply(r,i)}finally{e.event=o}}},n}function X(e){return W(e,K),e}function Q(e){return typeof e=="function"?e:function(){return V(e,this)}}function G(e){return typeof e=="function"?e:function(){return $(e,this)}}function Z(t,n){function r(){this.removeAttribute(t)}function i(){this.removeAttributeNS(t.space,t.local)}function s(){this.setAttribute(t,n)}function o(){this.setAttributeNS(t.space,t.local,n)}function u(){var e=n.apply(this,arguments);e==null?this.removeAttribute(t):this.setAttribute(t,e)}function a(){var e=n.apply(this,arguments);e==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}return t=e.ns.qualify(t),n==null?t.local?i:r:typeof n=="function"?t.local?a:u:t.local?o:s}function et(e){return e.trim().replace(/\s+/g," ")}function tt(t){return new RegExp("(?:^|\\s+)"+e.requote(t)+"(?:\\s+|$)","g")}function nt(e){return(e+"").trim().split(/^|\s+/)}function rt(e,t){function r(){var r=-1;while(++r<n)e[r](this,t)}function i(){var r=-1,i=t.apply(this,arguments);while(++r<n)e[r](this,i)}e=nt(e).map(it);var n=e.length;return typeof t=="function"?i:r}function it(e){var t=tt(e);return function(n,r){if(i=n.classList)return r?i.add(e):i.remove(e);var i=n.getAttribute("class")||"";r?(t.lastIndex=0,t.test(i)||n.setAttribute("class",et(i+" "+e))):n.setAttribute("class",et(i.replace(t," ")))}}function st(e,t,n){function r(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,t,n)}function s(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}return t==null?r:typeof t=="function"?s:i}function ot(e,t){function n(){delete this[e]}function r(){this[e]=t}function i(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}return t==null?n:typeof t=="function"?i:r}function ut(t){function n(){var e=this.ownerDocument,n=this.namespaceURI;return n?e.createElementNS(n,t):e.createElement(t)}function r(){return this.ownerDocument.createElementNS(t.space,t.local)}return typeof t=="function"?t:(t=e.ns.qualify(t)).local?r:n}function at(){var e=this.parentNode;e&&e.removeChild(this)}function ft(e){return{__data__:e}}function lt(e){return function(){return J(this,e)}}function ct(e){return arguments.length||(e=p),function(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}}function ht(e,t){for(var n=0,r=e.length;n<r;n++)for(var i=e[n],s=0,o=i.length,u;s<o;s++)(u=i[s])&&t(u,s,n);return e}function pt(e){return W(e,dt),e}function vt(e){var t,n;return function(r,i,s){var o=e[s].update,u=o.length,a;s!=n&&(n=s,t=0),i>=t&&(t=i+1);while(!(a=o[t])&&++t<u);return a}}function mt(t,r,i){function f(){var e=this[s];e&&(this.removeEventListener(t,e,e.$),delete this[s])}function l(){var e=u(r,n(arguments));f.call(this),this.addEventListener(t,this[s]=e,e.$=i),e._=r}function c(){var n=new RegExp("^__on([^.]+)"+e.requote(t)+"$"),r;for(var i in this)if(r=i.match(n)){var s=this[i];this.removeEventListener(r[1],s,s.$),delete this[i]}}var s="__on"+t,o=t.indexOf("."),u=yt;o>0&&(t=t.slice(0,o));var a=gt.get(t);return a&&(t=a,u=bt),o?r?l:f:r?j:c}function yt(t,n){return function(r){var i=e.event;e.event=r,n[0]=this.__data__;try{t.apply(this,n)}finally{e.event=i}}}function bt(e,t){var n=yt(e,t);return function(e){var t=this,r=e.relatedTarget;(!r||r!==t&&!(r.compareDocumentPosition(t)&8))&&n.call(t,e)}}function St(t){var n=".dragsuppress-"+ ++Et,r="click"+n,o=e.select(s(t)).on("touchmove"+n,q).on("dragstart"+n,q).on("selectstart"+n,q);wt==null&&(wt="onselectstart"in t?!1:H(t.style,"userSelect"));if(wt){var u=i(t).style,a=u[wt];u[wt]="none"}return function(e){o.on(n,null),wt&&(u[wt]=a);if(e){var t=function(){o.on(r,null)};o.on(r,function(){q(),t()},!0),setTimeout(t,0)}}}function Tt(t,n){n.changedTouches&&(n=n.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(xt<0){var o=s(t);if(o.scrollX||o.scrollY){r=e.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=r[0][0].getScreenCTM();xt=!u.f&&!u.e,r.remove()}}return xt?(i.x=n.pageX,i.y=n.pageY):(i.x=n.clientX,i.y=n.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var a=t.getBoundingClientRect();return[n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop]}function Nt(){return e.event.changedTouches[0].identifier}function Pt(e){return e>0?1:e<0?-1:0}function Ht(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function Bt(e){return e>1?0:e<-1?Lt:Math.acos(e)}function jt(e){return e>1?Mt:e<-1?-Mt:Math.asin(e)}function Ft(e){return((e=Math.exp(e))-1/e)/2}function It(e){return((e=Math.exp(e))+1/e)/2}function qt(e){return((e=Math.exp(2*e))-1)/(e+1)}function Rt(e){return(e=Math.sin(e/2))*e}function Jt(){}function Kt(e,t,n){return this instanceof Kt?void (this.h=+e,this.s=+t,this.l=+n):arguments.length<2?e instanceof Kt?new Kt(e.h,e.s,e.l):yn(""+e,bn,Kt):new Kt(e,t,n)}function Gt(e,t,n){function s(e){return e>360?e-=360:e<0&&(e+=360),e<60?r+(i-r)*e/60:e<180?i:e<240?r+(i-r)*(240-e)/60:r}function o(e){return Math.round(s(e)*255)}var r,i;return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)?0:t<0?0:t>1?1:t,n=n<0?0:n>1?1:n,i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i,new pn(o(e+120),o(e),o(e-120))}function Yt(t,n,r){return this instanceof Yt?void (this.h=+t,this.c=+n,this.l=+r):arguments.length<2?t instanceof Yt?new Yt(t.h,t.c,t.l):t instanceof tn?fn(t.l,t.a,t.b):fn((t=wn((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Yt(t,n,r)}function en(e,t,n){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new tn(n,Math.cos(e*=_t)*t,Math.sin(e)*t)}function tn(e,t,n){return this instanceof tn?void (this.l=+e,this.a=+t,this.b=+n):arguments.length<2?e instanceof tn?new tn(e.l,e.a,e.b):e instanceof Yt?en(e.h,e.c,e.l):wn((e=pn(e)).r,e.g,e.b):new tn(e,t,n)}function an(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;return i=ln(i)*rn,r=ln(r)*sn,s=ln(s)*on,new pn(hn(3.2404542*i-1.5371385*r-.4985314*s),hn(-0.969266*i+1.8760108*r+.041556*s),hn(.0556434*i-.2040259*r+1.0572252*s))}function fn(e,t,n){return e>0?new Yt(Math.atan2(n,t)*Dt,Math.sqrt(t*t+n*n),e):new Yt(NaN,NaN,e)}function ln(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function cn(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function hn(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function pn(e,t,n){return this instanceof pn?void (this.r=~~e,this.g=~~t,this.b=~~n):arguments.length<2?e instanceof pn?new pn(e.r,e.g,e.b):yn(""+e,pn,Gt):new pn(e,t,n)}function dn(e){return new pn(e>>16,e>>8&255,e&255)}function vn(e){return dn(e)+""}function gn(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function yn(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(Sn(u[0]),Sn(u[1]),Sn(u[2]))}}return(a=xn.get(e.toLowerCase()))?t(a.r,a.g,a.b):(e!=null&&e.charAt(0)==="#"&&!isNaN(a=parseInt(e.slice(1),16))&&(e.length===4?(r=(a&3840)>>4,r=r>>4|r,i=a&240,i=i>>4|i,s=a&15,s=s<<4|s):e.length===7&&(r=(a&16711680)>>16,i=(a&65280)>>8,s=a&255)),t(r,i,s))}function bn(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;return s?(u=a<.5?s/(i+r):s/(2-i-r),e==i?o=(t-n)/s+(t<n?6:0):t==i?o=(n-e)/s+2:o=(e-t)/s+4,o*=60):(o=NaN,u=a>0&&a<1?0:o),new Kt(o,u,a)}function wn(e,t,n){e=En(e),t=En(t),n=En(n);var r=cn((.4124564*e+.3575761*t+.1804375*n)/rn),i=cn((.2126729*e+.7151522*t+.072175*n)/sn),s=cn((.0193339*e+.119192*t+.9503041*n)/on);return tn(116*i-16,500*(r-i),200*(i-s))}function En(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Sn(e){var t=parseFloat(e);return e.charAt(e.length-1)==="%"?Math.round(t*2.55):t}function Tn(e){return typeof e=="function"?e:function(){return e}}function Nn(e){return function(t,n,r){return arguments.length===2&&typeof n=="function"&&(r=n,n=null),Cn(t,n,e,r)}}function Cn(t,r,i,s){function c(){var e=f.status,t;if(!e&&Ln(f)||e>=200&&e<300||e===304){try{t=i.call(o,f)}catch(n){u.error.call(o,n);return}u.load.call(o,t)}else u.error.call(o,f)}var o={},u=e.dispatch("beforesend","progress","load","error"),a={},f=new XMLHttpRequest,l=null;return this.XDomainRequest&&!("withCredentials"in f)&&/^(http(s)?:)?\/\//.test(t)&&(f=new XDomainRequest),"onload"in f?f.onload=f.onerror=c:f.onreadystatechange=function(){f.readyState>3&&c()},f.onprogress=function(t){var n=e.event;e.event=t;try{u.progress.call(o,f)}finally{e.event=n}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?a[e]:(t==null?delete a[e]:a[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(r=e==null?null:e+"",o):r},o.responseType=function(e){return arguments.length?(l=e,o):l},o.response=function(e){return i=e,o},["get","post"].forEach(function(e){o[e]=function(){return o.send.apply(o,[e].concat(n(arguments)))}}),o.send=function(e,n,i){arguments.length===2&&typeof n=="function"&&(i=n,n=null),f.open(e,t,!0),r!=null&&!("accept"in a)&&(a.accept=r+",*/*");if(f.setRequestHeader)for(var s in a)f.setRequestHeader(s,a[s]);return r!=null&&f.overrideMimeType&&f.overrideMimeType(r),l!=null&&(f.responseType=l),i!=null&&o.on("error",i).on("load",function(e){i(null,e)}),u.beforesend.call(o,f),f.send(n==null?null:n),o},o.abort=function(){return f.abort(),o},e.rebind(o,u,"on"),s==null?o:o.get(kn(s))}function kn(e){return e.length===1?function(t,n){e(t==null?n:null)}:e}function Ln(e){var t=e.responseType;return t&&t!=="text"?e.response:e.responseText}function Hn(){var e=Bn(),t=jn()-e;t>24?(isFinite(t)&&(clearTimeout(_n),_n=setTimeout(Hn,t)),Mn=0):(Mn=1,Pn(Hn))}function Bn(){var e=Date.now();Dn=An;while(Dn)e>=Dn.t&&(Dn.f=Dn.c(e-Dn.t)),Dn=Dn.n;return e}function jn(){var e,t=An,n=Infinity;while(t)t.f?t=e?e.n=t.n:An=t.n:(t.t<n&&(n=t.t),t=(e=t).n);return On=e,n}function Fn(e,t){return t-(e?Math.ceil(Math.log(e)/Math.LN10):1)}function qn(e,t){var n=Math.pow(10,b(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function Rn(t){var n=t.decimal,r=t.thousands,i=t.grouping,s=t.currency,o=i&&r?function(e,t){var n=e.length,s=[],o=0,u=i[0],a=0;while(n>0&&u>0){a+u+1>t&&(u=Math.max(1,t-a)),s.push(e.substring(n-=u,n+u));if((a+=u+1)>t)break;u=i[o=(o+1)%i.length]}return s.reverse().join(r)}:D;return function(t){var r=Un.exec(t),i=r[1]||" ",u=r[2]||">",a=r[3]||"-",f=r[4]||"",l=r[5],c=+r[6],h=r[7],p=r[8],d=r[9],v=1,m="",g="",y=!1,b=!0;p&&(p=+p.substring(1));if(l||i==="0"&&u==="=")l=i="0",u="=";switch(d){case"n":h=!0,d="g";break;case"%":v=100,g="%",d="f";break;case"p":v=100,g="%",d="r";break;case"b":case"o":case"x":case"X":f==="#"&&(m="0"+d.toLowerCase());case"c":b=!1;case"d":y=!0,p=0;break;case"s":v=-1,d="r"}f==="$"&&(m=s[0],g=s[1]),d=="r"&&!p&&(d="g");if(p!=null)if(d=="g")p=Math.max(1,Math.min(21,p));else if(d=="e"||d=="f")p=Math.max(0,Math.min(20,p));d=zn.get(d)||Wn;var w=l&&h;return function(t){var r=g;if(y&&t%1)return"";var s=t<0||t===0&&1/t<0?(t=-t,"-"):a==="-"?"":a;if(v<0){var f=e.formatPrefix(t,p);t=f.scale(t),r=f.symbol+g}else t*=v;t=d(t,p);var E=t.lastIndexOf("."),S,x;if(E<0){var T=b?t.lastIndexOf("e"):-1;T<0?(S=t,x=""):(S=t.substring(0,T),x=t.substring(T))}else S=t.substring(0,E),x=n+t.substring(E+1);!l&&h&&(S=o(S,Infinity));var N=m.length+S.length+x.length+(w?0:s.length),C=N<c?(new Array(N=c-N+1)).join(i):"";return w&&(S=o(C+S,C.length?c-x.length:Infinity)),s+=m,t=S+x,(u==="<"?s+t+C:u===">"?C+s+t:u==="^"?C.substring(0,N>>=1)+s+t+C.substring(N):s+(w?t:C+t))+r}}}function Wn(e){return e+""}function $n(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Kn(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n<r-t?n:r}function i(n){return t(n=e(new Vn(n-1)),1),n}function s(e,n){return t(e=new Vn(+e),n),e}function o(e,r,s){var o=i(e),u=[];if(s>1)while(o<r)n(o)%s||u.push(new Date(+o)),t(o,1);else while(o<r)u.push(new Date(+o)),t(o,1);return u}function u(e,t,n){try{Vn=$n;var r=new $n;return r._=e,o(r,t,n)}finally{Vn=Date}}e.floor=e,e.round=r,e.ceil=i,e.offset=s,e.range=o;var a=e.utc=Qn(e);return a.floor=a,a.round=Qn(r),a.ceil=Qn(i),a.offset=Qn(s),a.range=u,e}function Qn(e){return function(t,n){try{Vn=$n;var r=new $n;return r._=t,e(r,n)._}finally{Vn=Date}}}function Gn(t){function l(e){function n(n){var r=[],i=-1,s=0,o,u,a;while(++i<t)if(e.charCodeAt(i)===37){r.push(e.slice(s,i)),(u=Yn[o=e.charAt(++i)])!=null&&(o=e.charAt(++i));if(a=E[o])o=a(n,u==null?o==="e"?" ":"0":u);r.push(o),s=i+1}return r.push(e.slice(s,i)),r.join("")}var t=e.length;return n.parse=function(t){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},r=c(n,e,t,0);if(r!=t.length)return null;"p"in n&&(n.H=n.H%12+n.p*12);var i=n.Z!=null&&Vn!==$n,s=new(i?$n:Vn);return"j"in n?s.setFullYear(n.y,0,n.j):"w"in n&&("W"in n||"U"in n)?(s.setFullYear(n.y,0,1),s.setFullYear(n.y,0,"W"in n?(n.w+6)%7+n.W*7-(s.getDay()+5)%7:n.w+n.U*7-(s.getDay()+6)%7)):s.setFullYear(n.y,n.m,n.d),s.setHours(n.H+(n.Z/100|0),n.M+n.Z%100,n.S,n.L),i?s._:s},n.toString=function(){return e},n}function c(e,t,n,r){var i,s,o,u=0,a=t.length,f=n.length;while(u<a){if(r>=f)return-1;i=t.charCodeAt(u++);if(i===37){o=t.charAt(u++),s=S[o in Yn?t.charAt(u++):o];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function x(e,t,n){v.lastIndex=0;var r=v.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function T(e,t,n){p.lastIndex=0;var r=p.exec(t.slice(n));return r?(e.w=d.get(r[0].toLowerCase()),n+r[0].length):-1}function N(e,t,n){b.lastIndex=0;var r=b.exec(t.slice(n));return r?(e.m=w.get(r[0].toLowerCase()),n+r[0].length):-1}function C(e,t,n){g.lastIndex=0;var r=g.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){return c(e,E.c.toString(),t,n)}function L(e,t,n){return c(e,E.x.toString(),t,n)}function A(e,t,n){return c(e,E.X.toString(),t,n)}function O(e,t,n){var r=h.get(t.slice(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}var n=t.dateTime,r=t.date,i=t.time,s=t.periods,o=t.days,u=t.shortDays,a=t.months,f=t.shortMonths;l.utc=function(e){function n(e){try{Vn=$n;var n=new Vn;return n._=e,t(n)}finally{Vn=Date}}var t=l(e);return n.parse=function(e){try{Vn=$n;var n=t.parse(e);return n&&n._}finally{Vn=Date}},n.toString=t.toString,n},l.multi=l.utc.multi=wr;var h=e.map(),p=nr(o),d=rr(o),v=nr(u),m=rr(u),g=nr(a),y=rr(a),b=nr(f),w=rr(f);s.forEach(function(e,t){h.set(e.toLowerCase(),t)});var E={a:function(e){return u[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return f[e.getMonth()]},B:function(e){return a[e.getMonth()]},c:l(n),d:function(e,t){return tr(e.getDate(),t,2)},e:function(e,t){return tr(e.getDate(),t,2)},H:function(e,t){return tr(e.getHours(),t,2)},I:function(e,t){return tr(e.getHours()%12||12,t,2)},j:function(e,t){return tr(1+Xn.dayOfYear(e),t,3)},L:function(e,t){return tr(e.getMilliseconds(),t,3)},m:function(e,t){return tr(e.getMonth()+1,t,2)},M:function(e,t){return tr(e.getMinutes(),t,2)},p:function(e){return s[+(e.getHours()>=12)]},S:function(e,t){return tr(e.getSeconds(),t,2)},U:function(e,t){return tr(Xn.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return tr(Xn.mondayOfYear(e),t,2)},x:l(r),X:l(i),y:function(e,t){return tr(e.getFullYear()%100,t,2)},Y:function(e,t){return tr(e.getFullYear()%1e4,t,4)},Z:yr,"%":function(){return"%"}},S={a:x,A:T,b:N,B:C,c:k,d:hr,e:hr,H:dr,I:dr,j:pr,L:gr,m:cr,M:vr,p:O,S:mr,U:sr,w:ir,W:or,x:L,X:A,y:ar,Y:ur,Z:fr,"%":br};return l}function tr(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s<n?(new Array(n-s+1)).join(t)+i:i)}function nr(t){return new RegExp("^(?:"+t.map(e.requote).join("|")+")","i")}function rr(e){var t=new S,n=-1,r=e.length;while(++n<r)t.set(e[n].toLowerCase(),n);return t}function ir(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function sr(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n));return r?(e.U=+r[0],n+r[0].length):-1}function or(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n));return r?(e.W=+r[0],n+r[0].length):-1}function ur(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function ar(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+2));return r?(e.y=lr(+r[0]),n+r[0].length):-1}function fr(e,t,n){return/^[+-]\d{4}$/.test(t=t.slice(n,n+5))?(e.Z=-t,n+5):-1}function lr(e){return e+(e>68?1900:2e3)}function cr(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function hr(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function pr(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+3));return r?(e.j=+r[0],n+r[0].length):-1}function dr(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function vr(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function mr(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function gr(e,t,n){Zn.lastIndex=0;var r=Zn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function yr(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=b(t)/60|0,i=b(t)%60;return n+tr(r,"0",2)+tr(i,"0",2)}function br(e,t,n){er.lastIndex=0;var r=er.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function wr(e){var t=e.length,n=-1;while(++n<t)e[n][0]=this(e[n][0]);return function(t){var n=0,r=e[n];while(!r[1](t))r=e[++n];return r[0](t)}}function Sr(){}function Tr(e,t,n){var r=n.s=e+t,i=r-e,s=r-i;n.t=e-s+(t-i)}function Nr(e,t){e&&kr.hasOwnProperty(e.type)&&kr[e.type](e,t)}function Lr(e,t,n){var r=-1,i=e.length-n,s;t.lineStart();while(++r<i)s=e[r],t.point(s[0],s[1],s[2]);t.lineEnd()}function Ar(e,t){var n=-1,r=e.length;t.polygonStart();while(++n<r)Lr(e[n],t,1);t.polygonEnd()}function Dr(){function s(e,t){e*=_t,t=t*_t/2+Lt/4;var s=e-n,o=s>=0?1:-1,u=o*s,a=Math.cos(t),f=Math.sin(t),l=i*f,c=r*a+l*Math.cos(u),h=l*o*Math.sin(u);Mr.add(Math.atan2(h,c)),n=e,r=a,i=f}var e,t,n,r,i;_r.point=function(o,u){_r.point=s,n=(e=o)*_t,r=Math.cos(u=(t=u)*_t/2+Lt/4),i=Math.sin(u)},_r.lineEnd=function(){s(e,t)}}function Pr(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function Hr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Br(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function jr(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Fr(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ir(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function qr(e){return[Math.atan2(e[1],e[0]),jt(e[2])]}function Rr(e,t){return b(e[0]-t[0])<Ct&&b(e[1]-t[1])<Ct}function ei(e,t){e*=_t;var n=Math.cos(t*=_t);ti(n*Math.cos(e),n*Math.sin(e),Math.sin(t))}function ti(e,t,n){++Ur,Wr+=(e-Wr)/Ur,Xr+=(t-Xr)/Ur,Vr+=(n-Vr)/Ur}function ni(){function r(r,i){r*=_t;var s=Math.cos(i*=_t),o=s*Math.cos(r),u=s*Math.sin(r),a=Math.sin(i),f=Math.atan2(Math.sqrt((f=t*a-n*u)*f+(f=n*o-e*a)*f+(f=e*u-t*o)*f),e*o+t*u+n*a);zr+=f,$r+=f*(e+(e=o)),Jr+=f*(t+(t=u)),Kr+=f*(n+(n=a)),ti(e,t,n)}var e,t,n;Zr.point=function(i,s){i*=_t;var o=Math.cos(s*=_t);e=o*Math.cos(i),t=o*Math.sin(i),n=Math.sin(s),Zr.point=r,ti(e,t,n)}}function ri(){Zr.point=ei}function ii(){function s(e,t){e*=_t;var s=Math.cos(t*=_t),o=s*Math.cos(e),u=s*Math.sin(e),a=Math.sin(t),f=r*a-i*u,l=i*o-n*a,c=n*u-r*o,h=Math.sqrt(f*f+l*l+c*c),p=n*o+r*u+i*a,d=h&&-Bt(p)/h,v=Math.atan2(h,p);Qr+=d*f,Gr+=d*l,Yr+=d*c,zr+=v,$r+=v*(n+(n=o)),Jr+=v*(r+(r=u)),Kr+=v*(i+(i=a)),ti(n,r,i)}var e,t,n,r,i;Zr.point=function(o,u){e=o,t=u,Zr.point=s,o*=_t;var a=Math.cos(u*=_t);n=a*Math.cos(o),r=a*Math.sin(o),i=Math.sin(u),ti(n,r,i)},Zr.lineEnd=function(){s(e,t),Zr.lineEnd=ri,Zr.point=ei}}function si(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}function oi(){return!0}function ui(e,t,n,r,i){var s=[],o=[];e.forEach(function(e){if((t=e.length-1)<=0)return;var t,n=e[0],r=e[t];if(Rr(n,r)){i.lineStart();for(var u=0;u<t;++u)i.point((n=e[u])[0],n[1]);i.lineEnd();return}var a=new fi(n,e,null,!0),f=new fi(n,null,a,!1);a.o=f,s.push(a),o.push(f),a=new fi(r,e,null,!1),f=new fi(r,null,a,!0),a.o=f,s.push(a),o.push(f)}),o.sort(t),ai(s),ai(o);if(!s.length)return;for(var u=0,a=n,f=o.length;u<f;++u)o[u].e=a=!a;var l=s[0],c,h;for(;;){var p=l,d=!0;while(p.v)if((p=p.n)===l)return;c=p.z,i.lineStart();do{p.v=p.o.v=!0;if(p.e){if(d)for(var u=0,f=c.length;u<f;++u)i.point((h=c[u])[0],h[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(d){c=p.p.z;for(var u=c.length-1;u>=0;--u)i.point((h=c[u])[0],h[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,c=p.z,d=!d}while(!p.v);i.lineEnd()}}function ai(e){if(!(t=e.length))return;var t,n=0,r=e[0],i;while(++n<t)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}function fi(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function li(t,n,r,i){return function(s,o){function l(e,n){var r=s(e,n);t(e=r[0],n=r[1])&&o.point(e,n)}function c(e,t){var n=s(e,t);u.point(n[0],n[1])}function h(){f.point=c,u.lineStart()}function p(){f.point=l,u.lineEnd()}function w(e,t){b.push([e,t]);var n=s(e,t);m.point(n[0],n[1])}function E(){m.lineStart(),b=[]}function S(){w(b[0][0],b[0][1]),m.lineEnd();var e=m.clean(),t=v.buffer(),n,r=t.length;b.pop(),y.push(b),b=null;if(!r)return;if(e&1){n=t[0];var r=n.length-1,i=-1,s;if(r>0){g||(o.polygonStart(),g=!0),o.lineStart();while(++i<r)o.point((s=n[i])[0],s[1]);o.lineEnd()}return}r>1&&e&2&&t.push(t.pop().concat(t.shift())),d.push(t.filter(ci))}var u=n(o),a=s.invert(i[0],i[1]),f={point:l,lineStart:h,lineEnd:p,polygonStart:function(){f.point=w,f.lineStart=E,f.lineEnd=S,d=[],y=[]},polygonEnd:function(){f.point=l,f.lineStart=h,f.lineEnd=p,d=e.merge(d);var t=yi(a,y);d.length?(g||(o.polygonStart(),g=!0),ui(d,pi,t,r,o)):t&&(g||(o.polygonStart(),g=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),g&&(o.polygonEnd(),g=!1),d=y=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}},d,v=hi(),m=n(v),g=!1,y,b;return f}}function ci(e){return e.length>1}function hi(){var e=[],t;return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:j,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function pi(e,t){return((e=e.x)[0]<0?e[1]-Mt-Ct:Mt-e[1])-((t=t.x)[0]<0?t[1]-Mt-Ct:Mt-t[1])}function vi(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(s,o){var u=s>0?Lt:-Lt,a=b(s-t);b(a-Lt)<Ct?(e.point(t,n=(n+o)/2>0?Mt:-Mt),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(u,n),e.point(s,n),i=0):r!==u&&a>=Lt&&(b(t-r)<Ct&&(t-=r*Ct),b(s-u)<Ct&&(s-=u*Ct),n=mi(t,n,s,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(u,n),i=0),e.point(t=s,n=o),r=u},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function mi(e,t,n,r){var i,s,o=Math.sin(e-n);return b(o)>Ct?Math.atan((Math.sin(t)*(s=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*s*o)):(t+r)/2}function gi(e,t,n,r){var i;if(e==null)i=n*Mt,r.point(-Lt,i),r.point(0,i),r.point(Lt,i),r.point(Lt,0),r.point(Lt,-i),r.point(0,-i),r.point(-Lt,-i),r.point(-Lt,0),r.point(-Lt,i);else if(b(e[0]-t[0])>Ct){var s=e[0]<t[0]?Lt:-Lt;i=n*s/2,r.point(-s,i),r.point(0,i),r.point(s,i)}else r.point(t[0],t[1])}function yi(e,t){var n=e[0],r=e[1],i=[Math.sin(n),-Math.cos(n),0],s=0,o=0;Mr.reset();for(var u=0,a=t.length;u<a;++u){var f=t[u],l=f.length;if(!l)continue;var c=f[0],h=c[0],p=c[1]/2+Lt/4,d=Math.sin(p),v=Math.cos(p),m=1;for(;;){m===l&&(m=0),e=f[m];var g=e[0],y=e[1]/2+Lt/4,b=Math.sin(y),w=Math.cos(y),E=g-h,S=E>=0?1:-1,x=S*E,T=x>Lt,N=d*b;Mr.add(Math.atan2(N*S*Math.sin(x),v*w+N*Math.cos(x))),s+=T?E+S*At:E;if(T^h>=n^g>=n){var C=Br(Pr(c),Pr(e));Ir(C);var k=Br(i,C);Ir(k);var L=(T^E>=0?-1:1)*jt(k[2]);if(r>L||r===L&&(C[0]||C[1]))o+=T^E>=0?1:-1}if(!(m++))break;h=g,d=b,v=w,c=e}}return(s<-Ct||s<Ct&&Mr<0)^o&1}function bi(e){function s(e,n){return Math.cos(e)*Math.cos(n)>t}function o(e){var t,i,o,f,l;return{lineStart:function(){f=o=!1,l=1},point:function(c,h){var p=[c,h],d,v=s(c,h),m=n?v?0:a(c,h):v?a(c+(c<0?Lt:-Lt),h):0;!t&&(f=o=v)&&e.lineStart();if(v!==o){d=u(t,p);if(Rr(t,d)||Rr(p,d))p[0]+=Ct,p[1]+=Ct,v=s(p[0],p[1])}if(v!==o)l=0,v?(e.lineStart(),d=u(p,t),e.point(d[0],d[1])):(d=u(t,p),e.point(d[0],d[1]),e.lineEnd()),t=d;else if(r&&t&&n^v){var g;!(m&i)&&(g=u(p,t,!0))&&(l=0,n?(e.lineStart(),e.point(g[0][0],g[0][1]),e.point(g[1][0],g[1][1]),e.lineEnd()):(e.point(g[1][0],g[1][1]),e.lineEnd(),e.lineStart(),e.point(g[0][0],g[0][1])))}v&&(!t||!Rr(t,p))&&e.point(p[0],p[1]),t=p,o=v,i=m},lineEnd:function(){o&&e.lineEnd(),t=null},clean:function(){return l|(f&&o)<<1}}}function u(e,n,r){var i=Pr(e),s=Pr(n),o=[1,0,0],u=Br(i,s),a=Hr(u,u),f=u[0],l=a-f*f;if(!l)return!r&&e;var c=t*a/l,h=-t*f/l,p=Br(o,u),d=Fr(o,c),v=Fr(u,h);jr(d,v);var m=p,g=Hr(d,m),y=Hr(m,m),w=g*g-y*(Hr(d,d)-1);if(w<0)return;var E=Math.sqrt(w),S=Fr(m,(-g-E)/y);jr(S,d),S=qr(S);if(!r)return S;var x=e[0],T=n[0],N=e[1],C=n[1],k;T<x&&(k=x,x=T,T=k);var L=T-x,A=b(L-Lt)<Ct,O=A||L<Ct;!A&&C<N&&(k=N,N=C,C=k);if(O?A?N+C>0^S[1]<(b(S[0]-x)<Ct?N:C):N<=S[1]&&S[1]<=C:L>Lt^(x<=S[0]&&S[0]<=T)){var M=Fr(m,(-g+E)/y);return jr(M,d),[S,qr(M)]}}function a(t,r){var i=n?e:Lt-e,s=0;return t<-i?s|=1:t>i&&(s|=2),r<-i?s|=4:r>i&&(s|=8),s}var t=Math.cos(e),n=t>0,r=b(t)>Ct,i=ns(e,6*_t);return li(s,o,i,n?[0,-e]:[-Lt,e-Lt])}function wi(e,t,n,r){return function(i){var s=i.a,o=i.b,u=s.x,a=s.y,f=o.x,l=o.y,c=0,h=1,p=f-u,d=l-a,v;v=e-u;if(!p&&v>0)return;v/=p;if(p<0){if(v<c)return;v<h&&(h=v)}else if(p>0){if(v>h)return;v>c&&(c=v)}v=n-u;if(!p&&v<0)return;v/=p;if(p<0){if(v>h)return;v>c&&(c=v)}else if(p>0){if(v<c)return;v<h&&(h=v)}v=t-a;if(!d&&v>0)return;v/=d;if(d<0){if(v<c)return;v<h&&(h=v)}else if(d>0){if(v>h)return;v>c&&(c=v)}v=r-a;if(!d&&v<0)return;v/=d;if(d<0){if(v>h)return;v>c&&(c=v)}else if(d>0){if(v<c)return;v<h&&(h=v)}return c>0&&(i.a={x:u+c*p,y:a+c*d}),h<1&&(i.b={x:u+h*p,y:a+h*d}),i}}function Si(t,n,r,i){function s(e,i){return b(e[0]-t)<Ct?i>0?0:3:b(e[0]-r)<Ct?i>0?2:1:b(e[1]-n)<Ct?i>0?1:0:i>0?3:2}function o(e,t){return u(e.x,t.x)}function u(e,t){var n=s(e,1),r=s(t,1);return n!==r?n-r:n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]}return function(a){function m(e){var t=0,n=p.length,r=e[1];for(var i=0;i<n;++i)for(var s=1,o=p[i],u=o.length,a=o[0],f;s<u;++s)f=o[s],a[1]<=r?f[1]>r&&Ht(a,f,e)>0&&++t:f[1]<=r&&Ht(a,f,e)<0&&--t,a=f;return t!==0}function g(e,o,a,f){var l=0,c=0;if(e==null||(l=s(e,a))!==(c=s(o,a))||u(e,o)<0^a>0){do f.point(l===0||l===3?t:r,l>1?i:n);while((l=(l+a+4)%4)!==c)}else f.point(o[0],o[1])}function y(e,s){return t<=e&&e<=r&&n<=s&&s<=i}function b(e,t){y(e,t)&&a.point(e,t)}function L(){v.point=O,p&&p.push(d=[]),C=!0,N=!1,x=T=NaN}function A(){h&&(O(w,E),S&&N&&l.rejoin(),h.push(l.buffer())),v.point=b,N&&a.lineEnd()}function O(e,t){e=Math.max(-Ei,Math.min(Ei,e)),t=Math.max(-Ei,Math.min(Ei,t));var n=y(e,t);p&&d.push([e,t]);if(C)w=e,E=t,S=n,C=!1,n&&(a.lineStart(),a.point(e,t));else if(n&&N)a.point(e,t);else{var r={a:{x:x,y:T},b:{x:e,y:t}};c(r)?(N||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),n||a.lineEnd(),k=!1):n&&(a.lineStart(),a.point(e,t),k=!1)}x=e,T=t,N=n}var f=a,l=hi(),c=wi(t,n,r,i),h,p,d,v={point:b,lineStart:L,lineEnd:A,polygonStart:function(){a=l,h=[],p=[],k=!0},polygonEnd:function(){a=f,h=e.merge(h);var n=m([t,i]),r=k&&n,s=h.length;if(r||s)a.polygonStart(),r&&(a.lineStart(),g(null,null,1,a),a.lineEnd()),s&&ui(h,o,n,g,a),a.polygonEnd();h=p=d=null}},w,E,S,x,T,N,C,k;return v}}function xi(e){var t=0,n=Lt/3,r=Ji(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*Lt/180,n=e[1]*Lt/180):[t/Lt*180,n/Lt*180]},i}function Ti(e,t){function o(e,t){var n=Math.sqrt(i-2*r*Math.sin(t))/r;return[n*Math.sin(e*=r),s-n*Math.cos(e)]}var n=Math.sin(e),r=(n+Math.sin(t))/2,i=1+n*(2*r-n),s=Math.sqrt(i)/r;return o.invert=function(e,t){var n=s-t;return[Math.atan2(e,n)/r,jt((i-(e*e+n*n)*r*r)/(2*r))]},o}function Li(){function i(e,t){Ci+=r*e-n*t,n=e,r=t}var e,t,n,r;ki.point=function(s,o){ki.point=i,e=n=s,t=r=o},ki.lineEnd=function(){i(e,t)}}function Pi(e,t){e<Ai&&(Ai=e),e>Mi&&(Mi=e),t<Oi&&(Oi=t),t>_i&&(_i=t)}function Hi(){function r(n,r){t.push("M",n,",",r,e)}function i(e,r){t.push("M",e,",",r),n.point=s}function s(e,n){t.push("L",e,",",n)}function o(){n.point=r}function u(){t.push("Z")}var e=Bi(4.5),t=[],n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=u},polygonEnd:function(){n.lineEnd=o,n.point=r},pointRadius:function(t){return e=Bi(t),n},result:function(){if(t.length){var e=t.join("");return t=[],e}}};return n}function Bi(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+ -2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function Fi(e,t){Wr+=e,Xr+=t,++Vr}function Ii(){function n(n,r){var i=n-e,s=r-t,o=Math.sqrt(i*i+s*s);$r+=o*(e+n)/2,Jr+=o*(t+r)/2,Kr+=o,Fi(e=n,t=r)}var e,t;ji.point=function(r,i){ji.point=n,Fi(e=r,t=i)}}function qi(){ji.point=Fi}function Ri(){function i(e,t){var i=e-n,s=t-r,o=Math.sqrt(i*i+s*s);$r+=o*(n+e)/2,Jr+=o*(r+t)/2,Kr+=o,o=r*e-n*t,Qr+=o*(n+e),Gr+=o*(r+t),Yr+=o*3,Fi(n=e,r=t)}var e,t,n,r;ji.point=function(s,o){ji.point=i,Fi(e=n=s,t=r=o)},ji.lineEnd=function(){i(e,t)}}function Ui(e){function r(n,r){e.moveTo(n+t,r),e.arc(n,r,t,0,At)}function i(t,r){e.moveTo(t,r),n.point=s}function s(t,n){e.lineTo(t,n)}function o(){n.point=r}function u(){e.closePath()}var t=4.5,n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=u},polygonEnd:function(){n.lineEnd=o,n.point=r},pointRadius:function(e){return t=e,n},result:j};return n}function zi(e){function i(e){return(r?o:s)(e)}function s(t){return Vi(t,function(n,r){n=e(n,r),t.point(n[0],n[1])})}function o(t){function y(n,r){n=e(n,r),t.point(n[0],n[1])}function b(){h=NaN,g.point=w,t.lineStart()}function w(n,i){var s=Pr([n,i]),o=e(n,i);u(h,p,c,d,v,m,h=o[0],p=o[1],c=n,d=s[0],v=s[1],m=s[2],r,t),t.point(h,p)}function E(){g.point=y,t.lineEnd()}function S(){b(),g.point=x,g.lineEnd=T}function x(e,t){w(n=e,i=t),s=h,o=p,a=d,f=v,l=m,g.point=w}function T(){u(h,p,c,d,v,m,s,o,n,a,f,l,r,t),g.lineEnd=E,E()}var n,i,s,o,a,f,l,c,h,p,d,v,m,g={point:y,lineStart:b,lineEnd:E,polygonStart:function(){t.polygonStart(),g.lineStart=S},polygonEnd:function(){t.polygonEnd(),g.lineStart=b}};return g}function u(r,i,s,o,a,f,l,c,h,p,d,v,m,g){var y=l-r,w=c-i,E=y*y+w*w;if(E>4*t&&m--){var S=o+p,x=a+d,T=f+v,N=Math.sqrt(S*S+x*x+T*T),C=Math.asin(T/=N),k=b(b(T)-1)<Ct||b(s-h)<Ct?(s+h)/2:Math.atan2(x,S),L=e(k,C),A=L[0],O=L[1],M=A-r,_=O-i,D=w*M-y*_;if(D*D/E>t||b((y*M+w*_)/E-.5)>.3||o*p+a*d+f*v<n)u(r,i,s,o,a,f,A,O,k,S/=N,x/=N,T,m,g),g.point(A,O),u(A,O,k,S,x,T,l,c,h,p,d,v,m,g)}}var t=.5,n=Math.cos(30*_t),r=16;return i.precision=function(e){return arguments.length?(r=(t=e*e)>0&&16,i):Math.sqrt(t)},i}function Wi(e){var t=zi(function(t,n){return e([t*Dt,n*Dt])});return function(e){return Ki(t(e))}}function Xi(e){this.stream=e}function Vi(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function $i(e){return Ji(function(){return e})()}function Ji(t){function E(e){return e=i(e[0]*_t,e[1]*_t),[e[0]*o+d,v-e[1]*o]}function S(e){return e=i.invert((e[0]-d)/o,(v-e[1])/o),e&&[e[0]*Dt,e[1]*Dt]}function x(){i=si(r=Yi(c,h,p),n);var e=n(f,l);return d=u-e[0]*o,v=a+e[1]*o,T()}function T(){return w&&(w.valid=!1,w=null),E}var n,r,i,s=zi(function(e,t){return e=n(e,t),[e[0]*o+d,v-e[1]*o]}),o=150,u=480,a=250,f=0,l=0,c=0,h=0,p=0,d,v,m=di,g=D,y=null,b=null,w;return E.stream=function(e){return w&&(w.valid=!1),w=Ki(m(r,s(g(e)))),w.valid=!0,w},E.clipAngle=function(e){return arguments.length?(m=e==null?(y=e,di):bi((y=+e)*_t),T()):y},E.clipExtent=function(e){return arguments.length?(b=e,g=e?Si(e[0][0],e[0][1],e[1][0],e[1][1]):D,T()):b},E.scale=function(e){return arguments.length?(o=+e,x()):o},E.translate=function(e){return arguments.length?(u=+e[0],a=+e[1],x()):[u,a]},E.center=function(e){return arguments.length?(f=e[0]%360*_t,l=e[1]%360*_t,x()):[f*Dt,l*Dt]},E.rotate=function(e){return arguments.length?(c=e[0]%360*_t,h=e[1]%360*_t,p=e.length>2?e[2]%360*_t:0,x()):[c*Dt,h*Dt,p*Dt]},e.rebind(E,s,"precision"),function(){return n=t.apply(this,arguments),E.invert=n.invert&&S,x()}}function Ki(e){return Vi(e,function(t,n){e.point(t*_t,n*_t)})}function Qi(e,t){return[e,t]}function Gi(e,t){return[e>Lt?e-At:e<-Lt?e+At:e,t]}function Yi(e,t,n){return e?t||n?si(es(e),ts(t,n)):es(e):t||n?ts(t,n):Gi}function Zi(e){return function(t,n){return t+=e,[t>Lt?t-At:t<-Lt?t+At:t,n]}}function es(e){var t=Zi(e);return t.invert=Zi(-e),t}function ts(e,t){function o(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*n+u*r;return[Math.atan2(a*i-l*s,u*n-f*r),jt(l*i+a*s)]}var n=Math.cos(e),r=Math.sin(e),i=Math.cos(t),s=Math.sin(t);return o.invert=function(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*i-a*s;return[Math.atan2(a*i+f*s,u*n+l*r),jt(l*n-u*r)]},o}function ns(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,s,o,u){var a=o*t;if(i!=null){i=rs(n,i),s=rs(n,s);if(o>0?i<s:i>s)i+=o*At}else i=e+o*At,s=e-.5*a;for(var f,l=i;o>0?l>s:l<s;l-=a)u.point((f=qr([n,-r*Math.cos(l),-r*Math.sin(l)]))[0],f[1])}}function rs(e,t){var n=Pr(t);n[0]-=e,Ir(n);var r=Bt(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-Ct)%(2*Math.PI)}function is(t,n,r){var i=e.range(t,n-Ct,r).concat(n);return function(e){return i.map(function(t){return[e,t]})}}function ss(t,n,r){var i=e.range(t,n-Ct,r).concat(n);return function(e){return i.map(function(t){return[t,e]})}}function os(e){return e.source}function us(e){return e.target}function as(e,t,n,r){var i=Math.cos(t),s=Math.sin(t),o=Math.cos(r),u=Math.sin(r),a=i*Math.cos(e),f=i*Math.sin(e),l=o*Math.cos(n),c=o*Math.sin(n),h=2*Math.asin(Math.sqrt(Rt(r-t)+i*o*Rt(n-e))),p=1/Math.sin(h),d=h?function(e){var t=Math.sin(e*=h)*p,n=Math.sin(h-e)*p,r=n*a+t*l,i=n*f+t*c,o=n*s+t*u;return[Math.atan2(i,r)*Dt,Math.atan2(o,Math.sqrt(r*r+i*i))*Dt]}:function(){return[e*Dt,t*Dt]};return d.distance=h,d}function cs(){function r(r,i){var s=Math.sin(i*=_t),o=Math.cos(i),u=b((r*=_t)-e),a=Math.cos(u);fs+=Math.atan2(Math.sqrt((u=o*Math.sin(u))*u+(u=n*s-t*o*a)*u),t*s+n*o*a),e=r,t=s,n=o}var e,t,n;ls.point=function(i,s){e=i*_t,t=Math.sin(s*=_t),n=Math.cos(s),ls.point=r},ls.lineEnd=function(){ls.point=ls.lineEnd=j}}function hs(e,t){function n(t,n){var r=Math.cos(t),i=Math.cos(n),s=e(r*i);return[s*i*Math.sin(t),s*Math.sin(n)]}return n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),i=t(r),s=Math.sin(i),o=Math.cos(i);return[Math.atan2(e*s,r*o),Math.asin(r&&n*s/r)]},n}function vs(e,t){function o(e,t){s>0?t<-Mt+Ct&&(t=-Mt+Ct):t>Mt-Ct&&(t=Mt-Ct);var n=s/Math.pow(r(t),i);return[n*Math.sin(i*e),s-n*Math.cos(i*e)]}var n=Math.cos(e),r=function(e){return Math.tan(Lt/4+e/2)},i=e===t?Math.sin(e):Math.log(n/Math.cos(t))/Math.log(r(t)/r(e)),s=n*Math.pow(r(e),i)/i;return i?(o.invert=function(e,t){var n=s-t,r=Pt(i)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/i,2*Math.atan(Math.pow(s/r,1/i))-Mt]},o):ys}function ms(e,t){function s(e,t){var n=i-t;return[n*Math.sin(r*e),i-n*Math.cos(r*e)]}var n=Math.cos(e),r=e===t?Math.sin(e):(n-Math.cos(t))/(t-e),i=n/r+e;return b(r)<Ct?Qi:(s.invert=function(e,t){var n=i-t;return[Math.atan2(e,n)/r,i-Pt(r)*Math.sqrt(e*e+n*n)]},s)}function ys(e,t){return[e,Math.log(Math.tan(Lt/4+t/2))]}function bs(e){var t=$i(e),n=t.scale,r=t.translate,i=t.clipExtent,s;return t.scale=function(){var e=n.apply(t,arguments);return e===t?s?t.clipExtent(null):t:e},t.translate=function(){var e=r.apply(t,arguments);return e===t?s?t.clipExtent(null):t:e},t.clipExtent=function(e){var o=i.apply(t,arguments);if(o===t){if(s=e==null){var u=Lt*n(),a=r();i([[a[0]-u,a[1]-u],[a[0]+u,a[1]+u]])}}else s&&(o=null);return o},t.clipExtent(null)}function Ss(e,t){return[Math.log(Math.tan(Lt/4+t/2)),-e]}function xs(e){return e[0]}function Ts(e){return e[1]}function Ns(e){var t=e.length,n=[0,1],r=2;for(var i=2;i<t;i++){while(r>1&&Ht(e[n[r-2]],e[n[r-1]],e[i])<=0)--r;n[r++]=i}return n.slice(0,r)}function Cs(e,t){return e[0]-t[0]||e[1]-t[1]}function Ls(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function As(e,t,n,r){var i=e[0],s=n[0],o=t[0]-i,u=r[0]-s,a=e[1],f=n[1],l=t[1]-a,c=r[1]-f,h=(u*(a-f)-c*(i-s))/(c*o-u*l);return[i+h*o,a+h*l]}function Os(e){var t=e[0],n=e[e.length-1];return!(t[0]-n[0]||t[1]-n[1])}function Fs(){so(this),this.edge=this.site=this.circle=null}function Is(e){var t=Ps.pop()||new Fs;return t.site=e,t}function qs(e){Qs(e),Ds.remove(e),Ps.push(e),so(e)}function Rs(e){var t=e.circle,n=t.x,r=t.cy,i={x:n,y:r},s=e.P,o=e.N,u=[e];qs(e);var a=s;while(a.circle&&b(n-a.circle.x)<Ct&&b(r-a.circle.cy)<Ct)s=a.P,u.unshift(a),qs(a),a=s;u.unshift(a),Qs(a);var f=o;while(f.circle&&b(n-f.circle.x)<Ct&&b(r-f.circle.cy)<Ct)o=f.N,u.push(f),qs(f),f=o;u.push(f),Qs(f);var l=u.length,c;for(c=1;c<l;++c)f=u[c],a=u[c-1],no(f.edge,a.site,f.site,i);a=u[0],f=u[l-1],f.edge=eo(a.site,f.site,null,i),Ks(a),Ks(f)}function Us(e){var t=e.x,n=e.y,r,i,s,o,u=Ds._;while(u){s=zs(u,n)-t;if(s>Ct)u=u.L;else{o=t-Ws(u,n);if(!(o>Ct)){s>-Ct?(r=u.P,i=u):o>-Ct?(r=u,i=u.N):r=i=u;break}if(!u.R){r=u;break}u=u.R}}var a=Is(e);Ds.insert(r,a);if(!r&&!i)return;if(r===i){Qs(r),i=Is(r.site),Ds.insert(a,i),a.edge=i.edge=eo(r.site,a.site),Ks(r),Ks(i);return}if(!i){a.edge=eo(r.site,a.site);return}Qs(r),Qs(i);var f=r.site,l=f.x,c=f.y,h=e.x-l,p=e.y-c,d=i.site,v=d.x-l,m=d.y-c,g=2*(h*m-p*v),y=h*h+p*p,b=v*v+m*m,w={x:(m*y-p*b)/g+l,y:(h*b-v*y)/g+c};no(i.edge,f,d,w),a.edge=eo(f,e,null,w),i.edge=eo(e,d,null,w),Ks(r),Ks(i)}function zs(e,t){var n=e.site,r=n.x,i=n.y,s=i-t;if(!s)return r;var o=e.P;if(!o)return-Infinity;n=o.site;var u=n.x,a=n.y,f=a-t;if(!f)return u;var l=u-r,c=1/s-1/f,h=l/f;return c?(-h+Math.sqrt(h*h-2*c*(l*l/(-2*f)-a+f/2+i-s/2)))/c+r:(r+u)/2}function Ws(e,t){var n=e.N;if(n)return zs(n,t);var r=e.site;return r.y===t?r.x:Infinity}function Xs(e){this.site=e,this.edges=[]}function Vs(e){var t=e[0][0],n=e[1][0],r=e[0][1],i=e[1][1],s,o,u,a,f=_s,l=f.length,c,h,p,d,v,m;while(l--){c=f[l];if(!c||!c.prepare())continue;p=c.edges,d=p.length,h=0;while(h<d){m=p[h].end(),u=m.x,a=m.y,v=p[++h%d].start(),s=v.x,o=v.y;if(b(u-s)>Ct||b(a-o)>Ct)p.splice(h,0,new ro(to(c.site,m,b(u-t)<Ct&&i-a>Ct?{x:t,y:b(s-t)<Ct?o:i}:b(a-i)<Ct&&n-u>Ct?{x:b(o-i)<Ct?s:n,y:i}:b(u-n)<Ct&&a-r>Ct?{x:n,y:b(s-n)<Ct?o:r}:b(a-r)<Ct&&u-t>Ct?{x:b(o-r)<Ct?s:t,y:r}:null),c.site,null)),++d}}}function $s(e,t){return t.angle-e.angle}function Js(){so(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ks(e){var t=e.P,n=e.N;if(!t||!n)return;var r=t.site,i=e.site,s=n.site;if(r===s)return;var o=i.x,u=i.y,a=r.x-o,f=r.y-u,l=s.x-o,c=s.y-u,h=2*(a*c-f*l);if(h>=-kt)return;var p=a*a+f*f,d=l*l+c*c,v=(c*p-f*d)/h,m=(a*d-l*p)/h,c=m+u,g=js.pop()||new Js;g.arc=e,g.site=i,g.x=v+o,g.y=c+Math.sqrt(v*v+m*m),g.cy=c,e.circle=g;var y=null,b=Bs._;while(b)if(g.y<b.y||g.y===b.y&&g.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}Bs.insert(y,g),y||(Hs=g)}function Qs(e){var t=e.circle;t&&(t.P||(Hs=t.N),Bs.remove(t),js.push(t),so(t),e.circle=null)}function Gs(e){var t=Ms,n=wi(e[0][0],e[0][1],e[1][0],e[1][1]),r=t.length,i;while(r--){i=t[r];if(!Ys(i,e)||!n(i)||b(i.a.x-i.b.x)<Ct&&b(i.a.y-i.b.y)<Ct)i.a=i.b=null,t.splice(r,1)}}function Ys(e,t){var n=e.b;if(n)return!0;var r=e.a,i=t[0][0],s=t[1][0],o=t[0][1],u=t[1][1],a=e.l,f=e.r,l=a.x,c=a.y,h=f.x,p=f.y,d=(l+h)/2,v=(c+p)/2,m,g;if(p===c){if(d<i||d>=s)return;if(l>h){if(!r)r={x:d,y:o};else if(r.y>=u)return;n={x:d,y:u}}else{if(!r)r={x:d,y:u};else if(r.y<o)return;n={x:d,y:o}}}else{m=(l-h)/(p-c),g=v-m*d;if(m<-1||m>1)if(l>h){if(!r)r={x:(o-g)/m,y:o};else if(r.y>=u)return;n={x:(u-g)/m,y:u}}else{if(!r)r={x:(u-g)/m,y:u};else if(r.y<o)return;n={x:(o-g)/m,y:o}}else if(c<p){if(!r)r={x:i,y:m*i+g};else if(r.x>=s)return;n={x:s,y:m*s+g}}else{if(!r)r={x:s,y:m*s+g};else if(r.x<i)return;n={x:i,y:m*i+g}}}return e.a=r,e.b=n,!0}function Zs(e,t){this.l=e,this.r=t,this.a=this.b=null}function eo(e,t,n,r){var i=new Zs(e,t);return Ms.push(i),n&&no(i,e,t,n),r&&no(i,t,e,r),_s[e.i].edges.push(new ro(i,e,t)),_s[t.i].edges.push(new ro(i,t,e)),i}function to(e,t,n){var r=new Zs(e,null);return r.a=t,r.b=n,Ms.push(r),r}function no(e,t,n,r){!e.a&&!e.b?(e.a=r,e.l=t,e.r=n):e.l===n?e.b=r:e.a=r}function ro(e,t,n){var r=e.a,i=e.b;this.edge=e,this.site=t,this.angle=n?Math.atan2(n.y-t.y,n.x-t.x):e.l===t?Math.atan2(i.x-r.x,r.y-i.y):Math.atan2(r.x-i.x,i.y-r.y)}function io(){this._=null}function so(e){e.U=e.C=e.L=e.R=e.P=e.N=null}function oo(e,t){var n=t,r=t.R,i=n.U;i?i.L===n?i.L=r:i.R=r:e._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function uo(e,t){var n=t,r=t.L,i=n.U;i?i.L===n?i.L=r:i.R=r:e._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function ao(e){while(e.L)e=e.L;return e}function fo(e,t){var n=e.sort(lo).pop(),r,i,s;Ms=[],_s=new Array(e.length),Ds=new io,Bs=new io;for(;;){s=Hs;if(n&&(!s||n.y<s.y||n.y===s.y&&n.x<s.x)){if(n.x!==r||n.y!==i)_s[n.i]=new Xs(n),Us(n),r=n.x,i=n.y;n=e.pop()}else{if(!s)break;Rs(s.arc)}}t&&(Gs(t),Vs(t));var o={cells:_s,edges:Ms};return Ds=Bs=Ms=_s=null,o}function lo(e,t){return t.y-e.y||t.x-e.x}function ho(e,t,n){return(e.x-n.x)*(t.y-e.y)-(e.x-t.x)*(n.y-e.y)}function po(e){return e.x}function vo(e){return e.y}function mo(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function go(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;a[0]&&go(e,a[0],n,r,o,u),a[1]&&go(e,a[1],o,r,i,u),a[2]&&go(e,a[2],n,u,o,s),a[3]&&go(e,a[3],o,u,i,s)}}function yo(e,t,n,r,i,s,o){var u=Infinity,a;return function f(e,l,c,h,p){if(l>s||c>o||h<r||p<i)return;if(d=e.point){var d,v=t-e.x,m=n-e.y,g=v*v+m*m;if(g<u){var y=Math.sqrt(u=g);r=t-y,i=n-y,s=t+y,o=n+y,a=d}}var b=e.nodes,w=(l+h)*.5,E=(c+p)*.5,S=t>=w,x=n>=E;for(var T=x<<1|S,N=T+4;T<N;++T)if(e=b[T&3])switch(T&3){case 0:f(e,l,c,w,E);break;case 1:f(e,w,c,h,E);break;case 2:f(e,l,E,w,p);break;case 3:f(e,w,E,h,p)}}(e,r,i,s,o),a}function bo(t,n){t=e.rgb(t),n=e.rgb(n);var r=t.r,i=t.g,s=t.b,o=n.r-r,u=n.g-i,a=n.b-s;return function(e){return"#"+gn(Math.round(r+o*e))+gn(Math.round(i+u*e))+gn(Math.round(s+a*e))}}function wo(e,t){var n={},r={},i;for(i in e)i in t?n[i]=No(e[i],t[i]):r[i]=e[i];for(i in t)i in e||(r[i]=t[i]);return function(e){for(i in n)r[i]=n[i](e);return r}}function Eo(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function So(e,t){var n=xo.lastIndex=To.lastIndex=0,r,i,s,o=-1,u=[],a=[];e+="",t+="";while((r=xo.exec(e))&&(i=To.exec(t)))(s=i.index)>n&&(s=t.slice(n,s),u[o]?u[o]+=s:u[++o]=s),(r=r[0])===(i=i[0])?u[o]?u[o]+=i:u[++o]=i:(u[++o]=null,a.push({i:o,x:Eo(r,i)})),n=To.lastIndex;return n<t.length&&(s=t.slice(n),u[o]?u[o]+=s:u[++o]=s),u.length<2?a[0]?(t=a[0].x,function(e){return t(e)+""}):function(){return t}:(t=a.length,function(e){for(var n=0,r;n<t;++n)u[(r=a[n]).i]=r.x(e);return u.join("")})}function No(t,n){var r=e.interpolators.length,i;while(--r>=0&&!(i=e.interpolators[r](t,n)));return i}function Co(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u<o;++u)n.push(No(e[u],t[u]));for(;u<i;++u)r[u]=e[u];for(;u<s;++u)r[u]=t[u];return function(e){for(u=0;u<o;++u)r[u]=n[u](e);return r}}function Oo(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function Mo(e){return function(t){return 1-e(1-t)}}function _o(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function Do(e){return e*e}function Po(e){return e*e*e}function Ho(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function Bo(e){return function(t){return Math.pow(t,e)}}function jo(e){return 1-Math.cos(e*Mt)}function Fo(e){return Math.pow(2,10*(e-1))}function Io(e){return 1-Math.sqrt(1-e*e)}function qo(e,t){var n;return arguments.length<2&&(t=.45),arguments.length?n=t/At*Math.asin(1/e):(e=1,n=t/4),function(r){return 1+e*Math.pow(2,-10*r)*Math.sin((r-n)*At/t)}}function Ro(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function Uo(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function zo(t,n){t=e.hcl(t),n=e.hcl(n);var r=t.h,i=t.c,s=t.l,o=n.h-r,u=n.c-i,a=n.l-s;return isNaN(u)&&(u=0,i=isNaN(i)?n.c:i),isNaN(o)?(o=0,r=isNaN(r)?n.h:r):o>180?o-=360:o<-180&&(o+=360),function(e){return en(r+o*e,i+u*e,s+a*e)+""}}function Wo(t,n){t=e.hsl(t),n=e.hsl(n);var r=t.h,i=t.s,s=t.l,o=n.h-r,u=n.s-i,a=n.l-s;return isNaN(u)&&(u=0,i=isNaN(i)?n.s:i),isNaN(o)?(o=0,r=isNaN(r)?n.h:r):o>180?o-=360:o<-180&&(o+=360),function(e){return Gt(r+o*e,i+u*e,s+a*e)+""}}function Xo(t,n){t=e.lab(t),n=e.lab(n);var r=t.l,i=t.a,s=t.b,o=n.l-r,u=n.a-i,a=n.b-s;return function(e){return an(r+o*e,i+u*e,s+a*e)+""}}function Vo(e,t){return t-=e,function(n){return Math.round(e+t*n)}}function $o(e){var t=[e.a,e.b],n=[e.c,e.d],r=Ko(t),i=Jo(t,n),s=Ko(Qo(n,t,-i))||0;t[0]*n[1]<n[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-n[0],n[1]))*Dt,this.translate=[e.e,e.f],this.scale=[r,s],this.skew=s?Math.atan2(i,s)*Dt:0}function Jo(e,t){return e[0]*t[0]+e[1]*t[1]}function Ko(e){var t=Math.sqrt(Jo(e,e));return t&&(e[0]/=t,e[1]/=t),t}function Qo(e,t,n){return e[0]+=n*t[0],e[1]+=n*t[1],e}function Yo(t,n){var r=[],i=[],s,o=e.transform(t),u=e.transform(n),a=o.translate,f=u.translate,l=o.rotate,c=u.rotate,h=o.skew,p=u.skew,d=o.scale,v=u.scale;return a[0]!=f[0]||a[1]!=f[1]?(r.push("translate(",null,",",null,")"),i.push({i:1,x:Eo(a[0],f[0])},{i:3,x:Eo(a[1],f[1])})):f[0]||f[1]?r.push("translate("+f+")"):r.push(""),l!=c?(l-c>180?c+=360:c-l>180&&(l+=360),i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:Eo(l,c)})):c&&r.push(r.pop()+"rotate("+c+")"),h!=p?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:Eo(h,p)}):p&&r.push(r.pop()+"skewX("+p+")"),d[0]!=v[0]||d[1]!=v[1]?(s=r.push(r.pop()+"scale(",null,",",null,")"),i.push({i:s-4,x:Eo(d[0],v[0])},{i:s-2,x:Eo(d[1],v[1])})):(v[0]!=1||v[1]!=1)&&r.push(r.pop()+"scale("+v+")"),s=i.length,function(e){var t=-1,n;while(++t<s)r[(n=i[t]).i]=n.x(e);return r.join("")}}function Zo(e,t){return t=(t-=e=+e)||1/t,function(n){return(n-e)/t}}function eu(e,t){return t=(t-=e=+e)||1/t,function(n){return Math.max(0,Math.min(1,(n-e)/t))}}function tu(e){var t=e.source,n=e.target,r=ru(t,n),i=[t];while(t!==r)t=t.parent,i.push(t);var s=i.length;while(n!==r)i.splice(s,0,n),n=n.parent;return i}function nu(e){var t=[],n=e.parent;while(n!=null)t.push(e),e=n,n=n.parent;return t.push(e),t}function ru(e,t){if(e===t)return e;var n=nu(e),r=nu(t),i=n.pop(),s=r.pop(),o=null;while(i===s)o=i,i=n.pop(),s=r.pop();return o}function iu(e){e.fixed|=2}function su(e){e.fixed&=-7}function ou(e){e.fixed|=4,e.px=e.x,e.py=e.y}function uu(e){e.fixed&=-5}function au(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++u<o){a=s[u];if(a==null)continue;au(a,t,n),e.charge+=a.charge,r+=a.charge*a.cx,i+=a.charge*a.cy}}if(e.point){e.leaf||(e.point.x+=Math.random()-.5,e.point.y+=Math.random()-.5);var f=t*n[e.point.index];e.charge+=e.pointCharge=f,r+=f*e.point.x,i+=f*e.point.y}e.cx=r/e.charge,e.cy=i/e.charge}function hu(t,n){return e.rebind(t,n,"sort","children","value"),t.nodes=t,t.links=yu,t}function pu(e,t){var n=[e];while((e=n.pop())!=null){t(e);if((i=e.children)&&(r=i.length)){var r,i;while(--r>=0)n.push(i[r])}}}function du(e,t){var n=[e],r=[];while((e=n.pop())!=null){r.push(e);if((o=e.children)&&(s=o.length)){var i=-1,s,o;while(++i<s)n.push(o[i])}}while((e=r.pop())!=null)t(e)}function vu(e){return e.children}function mu(e){return e.value}function gu(e,t){return t.value-e.value}function yu(t){return e.merge(t.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function wu(e){return e.x}function Eu(e){return e.y}function Su(e,t,n){e.y0=t,e.y=n}function Nu(t){return e.range(t.length)}function Cu(e){var t=-1,n=e[0].length,r=[];while(++t<n)r[t]=0;return r}function ku(e){var t=1,n=0,r=e[0][1],i,s=e.length;for(;t<s;++t)(i=e[t][1])>r&&(n=t,r=i);return n}function Lu(e){return e.reduce(Au,0)}function Au(e,t){return e+t[1]}function Ou(e,t){return Mu(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Mu(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function _u(t){return[e.min(t),e.max(t)]}function Du(e,t){return e.value-t.value}function Pu(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function Hu(e,t){e._pack_next=t,t._pack_prev=e}function Bu(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return.999*i*i>n*n+r*r}function ju(e){function p(e){n=Math.min(e.x-e.r,n),r=Math.max(e.x+e.r,r),i=Math.min(e.y-e.r,i),s=Math.max(e.y+e.r,s)}if(!(t=e.children)||!(h=t.length))return;var t,n=Infinity,r=-Infinity,i=Infinity,s=-Infinity,o,u,a,f,l,c,h;t.forEach(Fu),o=t[0],o.x=-o.r,o.y=0,p(o);if(h>1){u=t[1],u.x=u.r,u.y=0,p(u);if(h>2){a=t[2],Ru(o,u,a),p(a),Pu(o,a),o._pack_prev=a,Pu(a,u),u=o._pack_next;for(f=3;f<h;f++){Ru(o,u,a=t[f]);var d=0,v=1,m=1;for(l=u._pack_next;l!==u;l=l._pack_next,v++)if(Bu(l,a)){d=1;break}if(d==1)for(c=o._pack_prev;c!==l._pack_prev;c=c._pack_prev,m++)if(Bu(c,a))break;d?(v<m||v==m&&u.r<o.r?Hu(o,u=l):Hu(o=c,u),f--):(Pu(o,a),u=a,p(a))}}}var g=(n+r)/2,y=(i+s)/2,b=0;for(f=0;f<h;f++)a=t[f],a.x-=g,a.y-=y,b=Math.max(b,a.r+Math.sqrt(a.x*a.x+a.y*a.y));e.r=b,t.forEach(Iu)}function Fu(e){e._pack_next=e._pack_prev=e}function Iu(e){delete e._pack_next,delete e._pack_prev}function qu(e,t,n,r){var i=e.children;e.x=t+=r*e.x,e.y=n+=r*e.y,e.r*=r;if(i){var s=-1,o=i.length;while(++s<o)qu(i[s],t,n,r)}}function Ru(e,t,n){var r=e.r+n.r,i=t.x-e.x,s=t.y-e.y;if(r&&(i||s)){var o=t.r+n.r,u=i*i+s*s;o*=o,r*=r;var a=.5+(r-o)/(2*u),f=Math.sqrt(Math.max(0,2*o*(r+u)-(r-=u)*r-o*o))/(2*u);n.x=e.x+a*i+f*s,n.y=e.y+a*s-f*i}else n.x=e.x+r,n.y=e.y}function Uu(e,t){return e.parent==t.parent?1:2}function zu(e){var t=e.children;return t.length?t[0]:e.t}function Wu(e){var t=e.children,n;return(n=t.length)?t[n-1]:e.t}function Xu(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function Vu(e){var t=0,n=0,r=e.children,i=r.length,s;while(--i>=0)s=r[i],s.z+=t,s.m+=t,t+=s.s+(n+=s.c)}function $u(e,t,n){return e.a.parent===t.parent?e.a:n}function Ju(t){return 1+e.max(t,function(e){return e.y})}function Ku(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function Qu(e){var t=e.children;return t&&t.length?Qu(t[0]):e}function Gu(e){var t=e.children,n;return t&&(n=t.length)?Gu(t[n-1]):e}function Yu(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Zu(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];return i<0&&(n+=i/2,i=0),s<0&&(r+=s/2,s=0),{x:n,y:r,dx:i,dy:s}}function ea(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function ta(e){return e.rangeExtent?e.rangeExtent():ea(e.range())}function na(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function ra(e,t){var n=0,r=e.length-1,i=e[n],s=e[r],o;return s<i&&(o=n,n=r,r=o,o=i,i=s,s=o),e[n]=t.floor(i),e[r]=t.ceil(s),e}function ia(e){return e?{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}:sa}function oa(t,n,r,i){var s=[],o=[],u=0,a=Math.min(t.length,n.length)-1;t[a]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());while(++u<=a)s.push(r(t[u-1],t[u])),o.push(i(n[u-1],n[u]));return function(n){var r=e.bisect(t,n,1,a)-1;return o[r](s[r](n))}}function ua(e,t,n,r){function o(){var o=Math.min(e.length,t.length)>2?oa:na,a=r?eu:Zo;return i=o(e,t,a,n),s=o(t,e,a,No),u}function u(e){return i(e)}var i,s;return u.invert=function(e){return s(e)},u.domain=function(t){return arguments.length?(e=t.map(Number),o()):e},u.range=function(e){return arguments.length?(t=e,o()):t},u.rangeRound=function(e){return u.range(e).interpolate(Vo)},u.clamp=function(e){return arguments.length?(r=e,o()):r},u.interpolate=function(e){return arguments.length?(n=e,o()):n},u.ticks=function(t){return ca(e,t)},u.tickFormat=function(t,n){return ha(e,t,n)},u.nice=function(t){return fa(e,t),o()},u.copy=function(){return ua(e,t,n,r)},o()}function aa(t,n){return e.rebind(t,n,"range","rangeRound","interpolate","clamp")}function fa(e,t){return ra(e,ia(la(e,t)[2]))}function la(e,t){t==null&&(t=10);var n=ea(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;return s<=.15?i*=10:s<=.35?i*=5:s<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+i*.5,n[2]=i,n}function ca(t,n){return e.range.apply(e,la(t,n))}function ha(t,n,r){var i=la(t,n);if(r){var s=Un.exec(r);s.shift();if(s[8]==="s"){var o=e.formatPrefix(Math.max(b(i[0]),b(i[1])));return s[7]||(s[7]="."+da(o.scale(i[2]))),s[8]="f",r=e.format(s.join("")),function(e){return r(o.scale(e))+o.symbol}}s[7]||(s[7]="."+va(s[8],i)),r=s.join("")}else r=",."+da(i[2])+"f";return e.format(r)}function da(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}function va(e,t){var n=da(t[2]);return e in pa?Math.abs(n-da(Math.max(b(t[0]),b(t[1]))))+ +(e!=="e"):n-(e==="%")*2}function ma(t,n,r,i){function s(e){return(r?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(n)}function o(e){return r?Math.pow(n,e):-Math.pow(n,-e)}function u(e){return t(s(e))}return u.invert=function(e){return o(t.invert(e))},u.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((i=e.map(Number)).map(s)),u):i},u.base=function(e){return arguments.length?(n=+e,t.domain(i.map(s)),u):n},u.nice=function(){var e=ra(i.map(s),r?Math:ya);return t.domain(e),i=e.map(o),u},u.ticks=function(){var e=ea(i),t=[],u=e[0],a=e[1],f=Math.floor(s(u)),l=Math.ceil(s(a)),c=n%1?2:n;if(isFinite(l-f)){if(r){for(;f<l;f++)for(var h=1;h<c;h++)t.push(o(f)*h);t.push(o(f))}else{t.push(o(f));for(;f++<l;)for(var h=c-1;h>0;h--)t.push(o(f)*h)}for(f=0;t[f]<u;f++);for(l=t.length;t[l-1]>a;l--);t=t.slice(f,l)}return t},u.tickFormat=function(t,n){if(!arguments.length)return ga;arguments.length<2?n=ga:typeof n!="function"&&(n=e.format(n));var i=Math.max(.1,t/u.ticks().length),a=r?(f=1e-12,Math.ceil):(f=-1e-12,Math.floor),f;return function(e){return e/o(a(s(e)+f))<=i?n(e):""}},u.copy=function(){return ma(t.copy(),n,r,i)},aa(u,t)}function ba(e,t,n){function s(t){return e(r(t))}var r=wa(t),i=wa(1/t);return s.invert=function(t){return i(e.invert(t))},s.domain=function(t){return arguments.length?(e.domain((n=t.map(Number)).map(r)),s):n},s.ticks=function(e){return ca(n,e)},s.tickFormat=function(e,t){return ha(n,e,t)},s.nice=function(e){return s.domain(fa(n,e))},s.exponent=function(o){return arguments.length?(r=wa(t=o),i=wa(1/t),e.domain(n.map(r)),s):t},s.copy=function(){return ba(e.copy(),t,n)},aa(s,e)}function wa(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Ea(t,n){function o(e){return i[((r.get(e)||(n.t==="range"?r.set(e,t.push(e)):NaN))-1)%i.length]}function u(n,r){return e.range(t.length).map(function(e){return n+r*e})}var r,i,s;return o.domain=function(e){if(!arguments.length)return t;t=[],r=new S;var i=-1,s=e.length,u;while(++i<s)r.has(u=e[i])||r.set(u,t.push(u));return o[n.t].apply(o,n.a)},o.range=function(e){return arguments.length?(i=e,s=0,n={t:"range",a:arguments},o):i},o.rangePoints=function(e,r){arguments.length<2&&(r=0);var a=e[0],f=e[1],l=t.length<2?(a=(a+f)/2,0):(f-a)/(t.length-1+r);return i=u(a+l*r/2,l),s=0,n={t:"rangePoints",a:arguments},o},o.rangeRoundPoints=function(e,r){arguments.length<2&&(r=0);var a=e[0],f=e[1],l=t.length<2?(a=f=Math.round((a+f)/2),0):(f-a)/(t.length-1+r)|0;return i=u(a+Math.round(l*r/2+(f-a-(t.length-1+r)*l)/2),l),s=0,n={t:"rangeRoundPoints",a:arguments},o},o.rangeBands=function(e,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var f=e[1]<e[0],l=e[f-0],c=e[1-f],h=(c-l)/(t.length-r+2*a);return i=u(l+h*a,h),f&&i.reverse(),s=h*(1-r),n={t:"rangeBands",a:arguments},o},o.rangeRoundBands=function(e,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var f=e[1]<e[0],l=e[f-0],c=e[1-f],h=Math.floor((c-l)/(t.length-r+2*a));return i=u(l+Math.round((c-l-(t.length-r)*h)/2),h),f&&i.reverse(),s=Math.round(h*(1-r)),n={t:"rangeRoundBands",a:arguments},o},o.rangeBand=function(){return s},o.rangeExtent=function(){return ea(n.a[0])},o.copy=function(){return Ea(t,n)},o.domain(t)}function Ca(t,n){function i(){var i=0,o=n.length;r=[];while(++i<o)r[i-1]=e.quantile(t,i/o);return s}function s(t){if(!isNaN(t=+t))return n[e.bisect(r,t)]}var r;return s.domain=function(e){return arguments.length?(t=e.map(d).filter(v).sort(p),i()):t},s.range=function(e){return arguments.length?(n=e,i()):n},s.quantiles=function(){return r},s.invertExtent=function(e){return e=n.indexOf(e),e<0?[NaN,NaN]:[e>0?r[e-1]:t[0],e<r.length?r[e]:t[t.length-1]]},s.copy=function(){return Ca(t,n)},i()}function ka(e,t,n){function s(t){return n[Math.max(0,Math.min(i,Math.floor(r*(t-e))))]}function o(){return r=n.length/(t-e),i=n.length-1,s}var r,i;return s.domain=function(n){return arguments.length?(e=+n[0],t=+n[n.length-1],o()):[e,t]},s.range=function(e){return arguments.length?(n=e,o()):n},s.invertExtent=function(t){return t=n.indexOf(t),t=t<0?NaN:t/r+e,[t,t+1/r]},s.copy=function(){return ka(e,t,n)},o()}function La(t,n){function r(r){if(r<=r)return n[e.bisect(t,r)]}return r.domain=function(e){return arguments.length?(t=e,r):t},r.range=function(e){return arguments.length?(n=e,r):n},r.invertExtent=function(e){return e=n.indexOf(e),[t[e-1],t[e]]},r.copy=function(){return La(t,n)},r}function Aa(e){function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=n.map(t),t):e},t.ticks=function(t){return ca(e,t)},t.tickFormat=function(t,n){return ha(e,t,n)},t.copy=function(){return Aa(e)},t}function Oa(){return 0}function _a(e){return e.innerRadius}function Da(e){return e.outerRadius}function Pa(e){return e.startAngle}function Ha(e){return e.endAngle}function Ba(e){return e&&e.padAngle}function ja(e,t,n,r){return(e-n)*t-(t-r)*e>0?0:1}function Fa(e,t,n,r,i){var s=e[0]-t[0],o=e[1]-t[1],u=(i?r:-r)/Math.sqrt(s*s+o*o),a=u*o,f=-u*s,l=e[0]+a,c=e[1]+f,h=t[0]+a,p=t[1]+f,d=(l+h)/2,v=(c+p)/2,m=h-l,g=p-c,y=m*m+g*g,b=n-r,w=l*p-h*c,E=(g<0?-1:1)*Math.sqrt(b*b*y-w*w),S=(w*g-m*E)/y,x=(-w*m-g*E)/y,T=(w*g+m*E)/y,N=(-w*m+g*E)/y,C=S-d,k=x-v,L=T-d,A=N-v;return C*C+k*k>L*L+A*A&&(S=T,x=N),[[S-a,x-f],[S*n/b,x*n/b]]}function Ia(e){function u(s){function d(){u.push("M",i(e(a),o))}var u=[],a=[],f=-1,l=s.length,c,h=Tn(t),p=Tn(n);while(++f<l)r.call(this,c=s[f],f)?a.push([+h.call(this,c,f),+p.call(this,c,f)]):a.length&&(d(),a=[]);return a.length&&d(),u.length?u.join(""):null}var t=xs,n=Ts,r=oi,i=Ra,s=i.key,o=.7;return u.x=function(e){return arguments.length?(t=e,u):t},u.y=function(e){return arguments.length?(n=e,u):n},u.defined=function(e){return arguments.length?(r=e,u):r},u.interpolate=function(e){return arguments.length?(typeof e=="function"?s=i=e:s=(i=qa.get(e)||Ra).key,u):s},u.tension=function(e){return arguments.length?(o=e,u):o},u}function Ra(e){return e.join("L")}function Ua(e){return Ra(e)+"Z"}function za(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r[0]+(r=e[t])[0])/2,"V",r[1]);return n>1&&i.push("H",r[0]),i.join("")}function Wa(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("V",(r=e[t])[1],"H",r[0]);return i.join("")}function Xa(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];while(++t<n)i.push("H",(r=e[t])[0],"V",r[1]);return i.join("")}function Va(e,t){return e.length<4?Ra(e):e[1]+Ka(e.slice(1,-1),Qa(e,t))}function $a(e,t){return e.length<3?Ra(e):e[0]+Ka((e.push(e[0]),e),Qa([e[e.length-2]].concat(e,[e[1]]),t))}function Ja(e,t){return e.length<3?Ra(e):e[0]+Ka(e,Qa(e,t))}function Ka(e,t){if(t.length<1||e.length!=t.length&&e.length!=t.length+2)return Ra(e);var n=e.length!=t.length,r="",i=e[0],s=e[1],o=t[0],u=o,a=1;n&&(r+="Q"+(s[0]-o[0]*2/3)+","+(s[1]-o[1]*2/3)+","+s[0]+","+s[1],i=e[1],a=2);if(t.length>1){u=t[1],s=e[a],a++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f<t.length;f++,a++)s=e[a],u=t[f],r+="S"+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1]}if(n){var l=e[a];r+="Q"+(s[0]+u[0]*2/3)+","+(s[1]+u[1]*2/3)+","+l[0]+","+l[1]}return r}function Qa(e,t){var n=[],r=(1-t)/2,i,s=e[0],o=e[1],u=1,a=e.length;while(++u<a)i=s,s=o,o=e[u],n.push([r*(o[0]-i[0]),r*(o[1]-i[1])]);return n}function Ga(e){if(e.length<3)return Ra(e);var t=1,n=e.length,r=e[0],i=r[0],s=r[1],o=[i,i,i,(r=e[1])[0]],u=[s,s,s,r[1]],a=[i,",",s,"L",tf(sf,o),",",tf(sf,u)];e.push(e[n-1]);while(++t<=n)r=e[t],o.shift(),o.push(r[0]),u.shift(),u.push(r[1]),of(a,o,u);return e.pop(),a.push("L",r),a.join("")}function Ya(e){if(e.length<4)return Ra(e);var t=[],n=-1,r=e.length,i,s=[0],o=[0];while(++n<3)i=e[n],s.push(i[0]),o.push(i[1]);t.push(tf(sf,s)+","+tf(sf,o)),--n;while(++n<r)i=e[n],s.shift(),s.push(i[0]),o.shift(),o.push(i[1]),of(t,s,o);return t.join("")}function Za(e){var t,n=-1,r=e.length,i=r+4,s,o=[],u=[];while(++n<4)s=e[n%r],o.push(s[0]),u.push(s[1]);t=[tf(sf,o),",",tf(sf,u)],--n;while(++n<i)s=e[n%r],o.shift(),o.push(s[0]),u.shift(),u.push(s[1]),of(t,o,u);return t.join("")}function ef(e,t){var n=e.length-1;if(n){var r=e[0][0],i=e[0][1],s=e[n][0]-r,o=e[n][1]-i,u=-1,a,f;while(++u<=n)a=e[u],f=u/n,a[0]=t*a[0]+(1-t)*(r+f*s),a[1]=t*a[1]+(1-t)*(i+f*o)}return Ga(e)}function tf(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function of(e,t,n){e.push("C",tf(nf,t),",",tf(nf,n),",",tf(rf,t),",",tf(rf,n),",",tf(sf,t),",",tf(sf,n))}function uf(e,t){return(t[1]-e[1])/(t[0]-e[0])}function af(e){var t=0,n=e.length-1,r=[],i=e[0],s=e[1],o=r[0]=uf(i,s);while(++t<n)r[t]=(o+(o=uf(i=s,s=e[t+1])))/2;return r[t]=o,r}function ff(e){var t=[],n,r,i,s,o=af(e),u=-1,a=e.length-1;while(++u<a)n=uf(e[u],e[u+1]),b(n)<Ct?o[u]=o[u+1]=0:(r=o[u]/n,i=o[u+1]/n,s=r*r+i*i,s>9&&(s=n*3/Math.sqrt(s),o[u]=s*r,o[u+1]=s*i));u=-1;while(++u<=a)s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u])),t.push([s||0,o[u]*s||0]);return t}function lf(e){return e.length<3?Ra(e):e[0]+Ka(e,ff(e))}function cf(e){var t,n=-1,r=e.length,i,s;while(++n<r)t=e[n],i=t[0],s=t[1]-Mt,t[0]=i*Math.cos(s),t[1]=i*Math.sin(s);return e}function hf(e){function c(u){function x(){c.push("M",o(e(p),l),f,a(e(h.reverse()),l),"Z")}var c=[],h=[],p=[],d=-1,v=u.length,m,g=Tn(t),y=Tn(r),b=t===n?function(){return E}:Tn(n),w=r===i?function(){return S}:Tn(i),E,S;while(++d<v)s.call(this,m=u[d],d)?(h.push([E=+g.call(this,m,d),S=+y.call(this,m,d)]),p.push([+b.call(this,m,d),+w.call(this,m,d)])):h.length&&(x(),h=[],p=[]);return h.length&&x(),c.length?c.join(""):null}var t=xs,n=xs,r=0,i=Ts,s=oi,o=Ra,u=o.key,a=o,f="L",l=.7;return c.x=function(e){return arguments.length?(t=n=e,c):n},c.x0=function(e){return arguments.length?(t=e,c):t},c.x1=function(e){return arguments.length?(n=e,c):n},c.y=function(e){return arguments.length?(r=i=e,c):i},c.y0=function(e){return arguments.length?(r=e,c):r},c.y1=function(e){return arguments.length?(i=e,c):i},c.defined=function(e){return arguments.length?(s=e,c):s},c.interpolate=function(e){return arguments.length?(typeof e=="function"?u=o=e:u=(o=qa.get(e)||Ra).key,a=o.reverse||o,f=o.closed?"M":"L",c):u},c.tension=function(e){return arguments.length?(l=e,c):l},c}function pf(e){return e.radius}function df(e){return[e.x,e.y]}function vf(e){return function(){var t=e.apply(this,arguments),n=t[0],r=t[1]-Mt;return[n*Math.cos(r),n*Math.sin(r)]}}function mf(){return 64}function gf(){return"circle"}function yf(e){var t=Math.sqrt(e/Lt);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+ -t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function xf(e){return function(){var t,n;(t=this[e])&&(n=t[t.active])&&(--t.count?delete t[t.active]:delete this[e],t.active+=.5,n.event&&n.event.interrupt.call(this,this.__data__,n.index))}}function Tf(e,t,n){return W(e,Nf),e.namespace=t,e.id=n,e}function Af(e,t,n,r){var i=e.id,s=e.namespace;return ht(e,typeof n=="function"?function(e,o,u){e[s][i].tween.set(t,r(n.call(e,e.__data__,o,u)))}:(n=r(n),function(e){e[s][i].tween.set(t,n)}))}function Of(e){return e==null&&(e=""),function(){this.textContent=e}}function Mf(e){return e==null?"__transition__":"__transition_"+e+"__"}function _f(t,n,r,i,s){var o=t[r]||(t[r]={active:0,count:0}),u=o[i];if(!u){var a=s.time;u=o[i]={tween:new S,time:a,delay:s.delay,duration:s.duration,ease:s.ease,index:n},s=null,++o.count,e.timer(function(s){function d(r){if(o.active>i)return m();var s=o[o.active];s&&(--o.count,delete o[o.active],s.event&&s.event.interrupt.call(t,t.__data__,s.index)),o.active=i,u.event&&u.event.start.call(t,t.__data__,n),u.tween.forEach(function(e,r){(r=r.call(t,t.__data__,n))&&p.push(r)}),c=u.ease,l=u.duration,e.timer(function(){return h.c=v(r||1)?oi:v,1},0,a)}function v(e){if(o.active!==i)return 1;var r=e/l,s=c(r),a=p.length;while(a>0)p[--a].call(t,s);if(r>=1)return u.event&&u.event.end.call(t,t.__data__,n),m()}function m(){return--o.count?delete o[i]:delete t[r],1}var f=u.delay,l,c,h=Dn,p=[];h.t=f+a;if(f<=s)return d(s-f);h.c=d},0,a)}}function Hf(e,t,n){e.attr("transform",function(e){var r=t(e);return"translate("+(isFinite(r)?r:n(e))+",0)"})}function Bf(e,t,n){e.attr("transform",function(e){var r=t(e);return"translate(0,"+(isFinite(r)?r:n(e))+")"})}function Uf(e){return e.toISOString()}function zf(t,n,r){function i(e){return t(e)}function s(t,r){var i=t[1]-t[0],s=i/r,o=e.bisect(Xf,s);return o==Xf.length?[n.year,la(t.map(function(e){return e/31536e6}),r)[2]]:o?n[s/Xf[o-1]<Xf[o]/s?o-1:o]:[Jf,la(t,r)[2]]}return i.invert=function(e){return Wf(t.invert(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain().map(Wf)},i.nice=function(e,t){function u(n){return!isNaN(n)&&!e.range(n,Wf(+n+1),t).length}var n=i.domain(),r=ea(n),o=e==null?s(r,10):typeof e=="number"&&s(r,e);return o&&(e=o[0],t=o[1]),i.domain(ra(n,t>1?{floor:function(t){while(u(t=e.floor(t)))t=Wf(t-1);return t},ceil:function(t){while(u(t=e.ceil(t)))t=Wf(+t+1);return t}}:e))},i.ticks=function(e,t){var n=ea(i.domain()),r=e==null?s(n,10):typeof e=="number"?s(n,e):!e.range&&[{range:e},t];return r&&(e=r[0],t=r[1]),e.range(n[0],Wf(+n[1]+1),t<1?1:t)},i.tickFormat=function(){return r},i.copy=function(){return zf(t.copy(),n,r)},aa(i,t)}function Wf(e){return new Date(e)}function Gf(e){return JSON.parse(e.responseText)}function Yf(e){var t=r.createRange();return t.selectNode(r.body),t.createContextualFragment(e.responseText)}var e={version:"3.5.5"},t=[].slice,n=function(e){return t.call(e)},r=this.document;if(r)try{n(r.documentElement.childNodes)[0].nodeType}catch(o){n=function(e){var t=e.length,n=new Array(t);while(t--)n[t]=e[t];return n}}Date.now||(Date.now=function(){return+(new Date)});if(r)try{r.createElement("DIV").style.setProperty("opacity",0,"")}catch(u){var a=this.Element.prototype,f=a.setAttribute,l=a.setAttributeNS,c=this.CSSStyleDeclaration.prototype,h=c.setProperty;a.setAttribute=function(e,t){f.call(this,e,t+"")},a.setAttributeNS=function(e,t,n){l.call(this,e,t,n+"")},c.setProperty=function(e,t,n){h.call(this,e,t+"",n)}}e.ascending=p,e.descending=function(e,t){return t<e?-1:t>e?1:t>=e?0:NaN},e.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r)if((s=e[n])!=null&&s>=s){i=s;break}while(++n<r)(s=e[n])!=null&&i>s&&(i=s)}else{while(++n<r)if((s=t.call(e,e[n],n))!=null&&s>=s){i=s;break}while(++n<r)(s=t.call(e,e[n],n))!=null&&i>s&&(i=s)}return i},e.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r)if((s=e[n])!=null&&s>=s){i=s;break}while(++n<r)(s=e[n])!=null&&s>i&&(i=s)}else{while(++n<r)if((s=t.call(e,e[n],n))!=null&&s>=s){i=s;break}while(++n<r)(s=t.call(e,e[n],n))!=null&&s>i&&(i=s)}return i},e.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++n<r)if((s=e[n])!=null&&s>=s){i=o=s;break}while(++n<r)(s=e[n])!=null&&(i>s&&(i=s),o<s&&(o=s))}else{while(++n<r)if((s=t.call(e,e[n],n))!=null&&s>=s){i=o=s;break}while(++n<r)(s=t.call(e,e[n],n))!=null&&(i>s&&(i=s),o<s&&(o=s))}return[i,o]},e.sum=function(e,t){var n=0,r=e.length,i,s=-1;if(arguments.length===1)while(++s<r)v(i=+e[s])&&(n+=i);else while(++s<r)v(i=+t.call(e,e[s],s))&&(n+=i);return n},e.mean=function(e,t){var n=0,r=e.length,i,s=-1,o=r;if(arguments.length===1)while(++s<r)v(i=d(e[s]))?n+=i:--o;else while(++s<r)v(i=d(t.call(e,e[s],s)))?n+=i:--o;if(o)return n/o},e.quantile=function(e,t){var n=(e.length-1)*t+1,r=Math.floor(n),i=+e[r-1],s=n-r;return s?i+s*(e[r]-i):i},e.median=function(t,n){var r=[],i=t.length,s,o=-1;if(arguments.length===1)while(++o<i)v(s=d(t[o]))&&r.push(s);else while(++o<i)v(s=d(n.call(t,t[o],o)))&&r.push(s);if(r.length)return e.quantile(r.sort(p),.5)},e.variance=function(e,t){var n=e.length,r=0,i,s,o=0,u=-1,a=0;if(arguments.length===1)while(++u<n)v(i=d(e[u]))&&(s=i-r,r+=s/++a,o+=s*(i-r));else while(++u<n)v(i=d(t.call(e,e[u],u)))&&(s=i-r,r+=s/++a,o+=s*(i-r));if(a>1)return o/(a-1)},e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};var g=m(p);e.bisectLeft=g.left,e.bisect=e.bisectRight=g.right,e.bisector=function(e){return m(e.length===1?function(t,n){return p(e(t),n)}:e)},e.shuffle=function(e,t,n){(r=arguments.length)<3&&(n=e.length,r<2&&(t=0));var r=n-t,i,s;while(r)s=Math.random()*r--|0,i=e[r+t],e[r+t]=e[s+t],e[s+t]=i;return e},e.permute=function(e,t){var n=t.length,r=new Array(n);while(n--)r[n]=e[t[n]];return r},e.pairs=function(e){var t=0,n=e.length-1,r,i=e[0],s=new Array(n<0?0:n);while(t<n)s[t]=[r=i,i=e[++t]];return s},e.zip=function(){if(!(s=arguments.length))return[];for(var t=-1,n=e.min(arguments,y),r=new Array(n);++t<n;)for(var i=-1,s,o=r[t]=new Array(s);++i<s;)o[i]=arguments[i][t];return r},e.transpose=function(t){return e.zip.apply(e,t)},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t},e.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t},e.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t},e.merge=function(e){var t=e.length,n,r=-1,i=0,s,o;while(++r<t)i+=e[r].length;s=new Array(i);while(--t>=0){o=e[t],n=o.length;while(--n>=0)s[--i]=o[n]}return s};var b=Math.abs;e.range=function(e,t,n){arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0));if((t-e)/n===Infinity)throw new Error("infinite range");var r=[],i=w(b(n)),s=-1,o;e*=i,t*=i,n*=i;if(n<0)while((o=e+n*++s)>t)r.push(o/i);else while((o=e+n*++s)<t)r.push(o/i);return r},e.map=function(e,t){var n=new S;if(e instanceof S)e.forEach(function(e,t){n.set(e,t)});else if(Array.isArray(e)){var r=-1,i=e.length,s;if(arguments.length===1)while(++r<i)n.set(r,e[r]);else while(++r<i)n.set(t.call(e,s=e[r],r),s)}else for(var o in e)n.set(o,e[o]);return n};var x="__proto__",T="\0";E(S,{has:k,get:function(e){return this._[N(e)]},set:function(e,t){return this._[N(e)]=t},remove:L,keys:A,values:function(){var e=[];for(var t in this._)e.push(this._[t]);return e},entries:function(){var e=[];for(var t in this._)e.push({key:C(t),value:this._[t]});return e},size:O,empty:M,forEach:function(e){for(var t in this._)e.call(this,C(t),this._[t])}}),e.nest=function(){function o(e,r,u){if(u>=n.length)return s?s.call(t,r):i?r.sort(i):r;var a=-1,f=r.length,l=n[u++],c,h,p,d=new S,v;while(++a<f)(v=d.get(c=l(h=r[a])))?v.push(h):d.set(c,[h]);return e?(h=e(),p=function(t,n){h.set(t,o(e,n,u))}):(h={},p=function(t,n){h[t]=o(e,n,u)}),d.forEach(p),h}function u(e,t){if(t>=n.length)return e;var i=[],s=r[t++];return e.forEach(function(e,n){i.push({key:e,values:u(n,t)})}),s?i.sort(function(e,t){return s(e.key,t.key)}):i}var t={},n=[],r=[],i,s;return t.map=function(e,t){return o(t,e,0)},t.entries=function(t){return u(o(e.map,t,0),0)},t.key=function(e){return n.push(e),t},t.sortKeys=function(e){return r[n.length-1]=e,t},t.sortValues=function(e){return i=e,t},t.rollup=function(e){return s=e,t},t},e.set=function(e){var t=new _;if(e)for(var n=0,r=e.length;n<r;++n)t.add(e[n]);return t},E(_,{has:k,add:function(e){return this._[N(e+="")]=!0,e},remove:L,values:A,size:O,empty:M,forEach:function(e){for(var t in this._)e.call(this,C(t))}}),e.behavior={},e.rebind=function(e,t){var n=1,r=arguments.length,i;while(++n<r)e[i=arguments[n]]=P(e,t,t[i]);return e};var B=["webkit","ms","moz","Moz","o","O"];e.dispatch=function(){var e=new F,t=-1,n=arguments.length;while(++t<n)e[arguments[t]]=I(e);return e},F.prototype.on=function(e,t){var n=e.indexOf("."),r="";n>=0&&(r=e.slice(n+1),e=e.slice(0,n));if(e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(arguments.length===2){if(t==null)for(e in this)this.hasOwnProperty(e)&&this[e].on(r,null);return this}},e.event=null,e.requote=function(e){return e.replace(z,"\\$&")};var z=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,W={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]},V=function(e,t){return t.querySelector(e)},$=function(e,t){return t.querySelectorAll(e)},J=function(e,t){var n=e.matches||e[H(e,"matchesSelector")];return J=function(e,t){return n.call(e,t)},J(e,t)};typeof Sizzle=="function"&&(V=function(e,t){return Sizzle(e,t)[0]||null},$=Sizzle,J=Sizzle.matchesSelector),e.selection=function(){return e.select(r.documentElement)};var K=e.selection.prototype=[];K.select=function(e){var t=[],n,r,i,s;e=Q(e);for(var o=-1,u=this.length;++o<u;){t.push(n=[]),n.parentNode=(i=this[o]).parentNode;for(var a=-1,f=i.length;++a<f;)(s=i[a])?(n.push(r=e.call(s,s.__data__,a,o)),r&&"__data__"in s&&(r.__data__=s.__data__)):n.push(null)}return X(t)},K.selectAll=function(e){var t=[],r,i;e=G(e);for(var s=-1,o=this.length;++s<o;)for(var u=this[s],a=-1,f=u.length;++a<f;)if(i=u[a])t.push(r=n(e.call(i,i.__data__,a,s))),r.parentNode=i;return X(t)};var Y={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/"};e.ns={prefix:Y,qualify:function(e){var t=e.indexOf(":"),n=e;return t>=0&&(n=e.slice(0,t),e=e.slice(t+1)),Y.hasOwnProperty(n)?{space:Y[n],local:e}:e}},K.attr=function(t,n){if(arguments.length<2){if(typeof t=="string"){var r=this.node();return t=e.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(n in t)this.each(Z(n,t[n]));return this}return this.each(Z(t,n))},K.classed=function(e,t){if(arguments.length<2){if(typeof e=="string"){var n=this.node(),r=(e=nt(e)).length,i=-1;if(t=n.classList){while(++i<r)if(!t.contains(e[i]))return!1}else{t=n.getAttribute("class");while(++i<r)if(!tt(e[i]).test(t))return!1}return!0}for(t in e)this.each(rt(t,e[t]));return this}return this.each(rt(e,t))},K.style=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t="");for(n in e)this.each(st(n,e[n],t));return this}if(r<2){var i=this.node();return s(i).getComputedStyle(i,null).getPropertyValue(e)}n=""}return this.each(st(e,t,n))},K.property=function(e,t){if(arguments.length<2){if(typeof e=="string")return this.node()[e];for(t in e)this.each(ot(t,e[t]));return this}return this.each(ot(e,t))},K.text=function(e){return arguments.length?this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}:e==null?function(){this.textContent=""}:function(){this.textContent=e}):this.node().textContent},K.html=function(e){return arguments.length?this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e}):this.node().innerHTML},K.append=function(e){return e=ut(e),this.select(function(){return this.appendChild(e.apply(this,arguments))})},K.insert=function(e,t){return e=ut(e),t=Q(t),this.select(function(){return this.insertBefore(e.apply(this,arguments),t.apply(this,arguments)||null)})},K.remove=function(){return this.each(at)},K.data=function(e,t){function o(e,n){var r,i=e.length,s=n.length,o=Math.min(i,s),l=new Array(s),c=new Array(s),h=new Array(i),p,d;if(t){var v=new S,m=new Array(i),g;for(r=-1;++r<i;)v.has(g=t.call(p=e[r],p.__data__,r))?h[r]=p:v.set(g,p),m[r]=g;for(r=-1;++r<s;)(p=v.get(g=t.call(n,d=n[r],r)))?p!==!0&&(l[r]=p,p.__data__=d):c[r]=ft(d),v.set(g,!0);for(r=-1;++r<i;)v.get(m[r])!==!0&&(h[r]=e[r])}else{for(r=-1;++r<o;)p=e[r],d=n[r],p?(p.__data__=d,l[r]=p):c[r]=ft(d);for(;r<s;++r)c[r]=ft(n[r]);for(;r<i;++r)h[r]=e[r]}c.update=l,c.parentNode=l.parentNode=h.parentNode=e.parentNode,u.push(c),a.push(l),f.push(h)}var n=-1,r=this.length,i,s;if(!arguments.length){e=new Array(r=(i=this[0]).length);while(++n<r)if(s=i[n])e[n]=s.__data__;return e}var u=pt([]),a=X([]),f=X([]);if(typeof e=="function")while(++n<r)o(i=this[n],e.call(i,i.parentNode.__data__,n));else while(++n<r)o(i=this[n],e);return a.enter=function(){return u},a.exit=function(){return f},a},K.datum=function(e){return arguments.length?this.property("__data__",e):this.property("__data__")},K.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=lt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]),n.parentNode=(r=this[s]).parentNode;for(var u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i,i.__data__,u,s)&&n.push(i)}return X(t)},K.order=function(){for(var e=-1,t=this.length;++e<t;)for(var n=this[e],r=n.length-1,i=n[r],s;--r>=0;)if(s=n[r])i&&i!==s.nextSibling&&i.parentNode.insertBefore(s,i),i=s;return this},K.sort=function(e){e=ct.apply(this,arguments);for(var t=-1,n=this.length;++t<n;)this[t].sort(e);return this.order()},K.each=function(e){return ht(this,function(t,n,r){e.call(t,t.__data__,n,r)})},K.call=function(e){var t=n(arguments);return e.apply(t[0]=this,t),this},K.empty=function(){return!this.node()},K.node=function(){for(var e=0,t=this.length;e<t;e++)for(var n=this[e],r=0,i=n.length;r<i;r++){var s=n[r];if(s)return s}return null},K.size=function(){var e=0;return ht(this,function(){++e}),e};var dt=[];e.selection.enter=pt,e.selection.enter.prototype=dt,dt.append=K.append,dt.empty=K.empty,dt.node=K.node,dt.call=K.call,dt.size=K.size,dt.select=function(e){var t=[],n,r,i,s,o;for(var u=-1,a=this.length;++u<a;){i=(s=this[u]).update,t.push(n=[]),n.parentNode=s.parentNode;for(var f=-1,l=s.length;++f<l;)(o=s[f])?(n.push(i[f]=r=e.call(s.parentNode,o.__data__,f,u)),r.__data__=o.__data__):n.push(null)}return X(t)},dt.insert=function(e,t){return arguments.length<2&&(t=vt(this)),K.insert.call(this,e,t)},e.select=function(e){var t;return typeof e=="string"?(t=[V(e,r)],t.parentNode=r.documentElement):(t=[e],t.parentNode=i(e)),X([t])},e.selectAll=function(e){var t;return typeof e=="string"?(t=n($(e,r)),t.parentNode=r.documentElement):(t=e,t.parentNode=null),X([t])},K.on=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t=!1);for(n in e)this.each(mt(n,e[n],t));return this}if(r<2)return(r=this.node()["__on"+e])&&r._;n=!1}return this.each(mt(e,t,n))};var gt=e.map({mouseenter:"mouseover",mouseleave:"mouseout"});r&&gt.forEach(function(e){"on"+e in r&&gt.remove(e)});var wt,Et=0;e.mouse=function(e){return Tt(e,R())};var xt=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;e.touch=function(e,t,n){arguments.length<3&&(n=t,t=R().changedTouches);if(t)for(var r=0,i=t.length,s;r<i;++r)if((s=t[r]).identifier===n)return Tt(e,s)},e.behavior.drag=function(){function o(){this.on("mousedown.drag",r).on("touchstart.drag",i)}function u(r,i,s,o,u){return function(){function b(){var e=i(l,p),t,n;if(!e)return;t=e[0]-y[0],n=e[1]-y[1],h|=t|n,y=e,c({type:"drag",x:e[0]+v[0],y:e[1]+v[1],dx:t,dy:n})}function w(){if(!i(l,p))return;m.on(o+d,null).on(u+d,null),g(h&&e.event.target===f),c({type:"dragend"})}var a=this,f=e.event.target,l=a.parentNode,c=t.of(a,arguments),h=0,p=r(),d=".drag"+(p==null?"":"-"+p),v,m=e.select(s(f)).on(o+d,b).on(u+d,w),g=St(f),y=i(l,p);n?(v=n.apply(a,arguments),v=[v.x-y[0],v.y-y[1]]):v=[0,0],c({type:"dragstart"})}}var t=U(o,"drag","dragstart","dragend"),n=null,r=u(j,e.mouse,s,"mousemove","mouseup"),i=u(Nt,e.touch,D,"touchmove","touchend");return o.origin=function(e){return arguments.length?(n=e,o):n},e.rebind(o,t,"on")},e.touches=function(e,t){return arguments.length<2&&(t=R().touches),t?n(t).map(function(t){var n=Tt(e,t);return n.identifier=t.identifier,n}):[]};var Ct=1e-6,kt=Ct*Ct,Lt=Math.PI,At=2*Lt,Ot=At-Ct,Mt=Lt/2,_t=Lt/180,Dt=180/Lt,Ut=Math.SQRT2,zt=2,Wt=4;e.interpolateZoom=function(e,t){function y(e){var t=e*g;if(m){var s=It(d),o=i/(zt*c)*(s*qt(Ut*t+d)-Ft(d));return[n+o*a,r+o*f,i*s/It(Ut*t+d)]}return[n+e*a,r+e*f,i*Math.exp(Ut*t)]}var n=e[0],r=e[1],i=e[2],s=t[0],o=t[1],u=t[2],a=s-n,f=o-r,l=a*a+f*f,c=Math.sqrt(l),h=(u*u-i*i+Wt*l)/(2*i*zt*c),p=(u*u-i*i-Wt*l)/(2*u*zt*c),d=Math.log(Math.sqrt(h*h+1)-h),v=Math.log(Math.sqrt(p*p+1)-p),m=v-d,g=(m||Math.log(u/i))/Ut;return y.duration=g*1e3,y},e.behavior.zoom=function(){function S(e){e.on(c,_).on($t+".zoom",P).on("dblclick.zoom",H).on(v,D)}function x(e){return[(e[0]-t.x)/t.k,(e[1]-t.y)/t.k]}function T(e){return[e[0]*t.k+t.x,e[1]*t.k+t.y]}function N(e){t.k=Math.max(a[0],Math.min(a[1],e))}function C(e,n){n=T(n),t.x+=e[0]-n[0],t.y+=e[1]-n[1]}function k(n,r,s,o){n.__chart__={x:t.x,y:t.y,k:t.k},N(Math.pow(2,o)),C(i=r,s),n=e.select(n),f>0&&(n=n.transition().duration(f)),n.call(S.event)}function L(){b&&b.domain(y.range().map(function(e){return(e-t.x)/t.k}).map(y.invert)),E&&E.domain(w.range().map(function(e){return(e-t.y)/t.k}).map(w.invert))}function A(e){l++||e({type:"zoomstart"})}function O(e){L(),e({type:"zoom",scale:t.k,translate:[t.x,t.y]})}function M(e){--l||e({type:"zoomend"}),i=null}function _(){function f(){i=1,C(e.mouse(t),u),O(r)}function l(){o.on(h,null).on(p,null),a(i&&e.event.target===n),M(r)}var t=this,n=e.event.target,r=g.of(t,arguments),i=0,o=e.select(s(t)).on(h,f).on(p,l),u=x(e.mouse(t)),a=St(t);Sf.call(t),A(r)}function D(){function d(){var r=e.touches(n);return o=t.k,r.forEach(function(e){e.identifier in i&&(i[e.identifier]=x(e))}),r}function y(){var r=e.event.target;e.select(r).on(a,b).on(f,w),l.push(r);var o=e.event.changedTouches;for(var u=0,c=o.length;u<c;++u)i[o[u].identifier]=null;var h=d(),p=Date.now();if(h.length===1){if(p-m<500){var v=h[0];k(n,v,i[v.identifier],Math.floor(Math.log(t.k)/Math.LN2)+1),q()}m=p}else if(h.length>1){var v=h[0],g=h[1],y=v[0]-g[0],E=v[1]-g[1];s=y*y+E*E}}function b(){var t=e.touches(n),u,a,f,l;Sf.call(n);for(var c=0,h=t.length;c<h;++c,l=null){f=t[c];if(l=i[f.identifier]){if(a)break;u=f,a=l}}if(l){var p=(p=f[0]-u[0])*p+(p=f[1]-u[1])*p,d=s&&Math.sqrt(p/s);u=[(u[0]+f[0])/2,(u[1]+f[1])/2],a=[(a[0]+l[0])/2,(a[1]+l[1])/2],N(d*o)}m=null,C(u,a),O(r)}function w(){if(e.event.touches.length){var t=e.event.changedTouches;for(var n=0,s=t.length;n<s;++n)delete i[t[n].identifier];for(var o in i)return void d()}e.selectAll(l).on(u,null),h.on(c,_).on(v,D),p(),M(r)}var n=this,r=g.of(n,arguments),i={},s=0,o,u=".zoom-"+e.event.changedTouches[0].identifier,a="touchmove"+u,f="touchend"+u,l=[],h=e.select(n),p=St(n);y(),A(r),h.on(c,null).on(v,y)}function P(){var r=g.of(this,arguments);d?clearTimeout(d):(n=x(i=o||e.mouse(this)),Sf.call(this),A(r)),d=setTimeout(function(){d=null,M(r)},50),q(),N(Math.pow(2,Vt()*.002)*t.k),C(i,n),O(r)}function H(){var n=e.mouse(this),r=Math.log(t.k)/Math.LN2;k(this,n,x(n),e.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}var t={x:0,y:0,k:1},n,i,o,u=[960,500],a=Xt,f=250,l=0,c="mousedown.zoom",h="mousemove.zoom",p="mouseup.zoom",d,v="touchstart.zoom",m,g=U(S,"zoomstart","zoom","zoomend"),y,b,w,E;return $t||($t="onwheel"in r?(Vt=function(){return-e.event.deltaY*(e.event.deltaMode?120:1)},"wheel"):"onmousewheel"in r?(Vt=function(){return e.event.wheelDelta},"mousewheel"):(Vt=function(){return-e.event.detail},"MozMousePixelScroll")),S.event=function(n){n.each(function(){var n=g.of(this,arguments),r=t;kf?e.select(this).transition().each("start.zoom",function(){t=this.__chart__||{x:0,y:0,k:1},A(n)}).tween("zoom:zoom",function(){var s=u[0],o=u[1],a=i?i[0]:s/2,f=i?i[1]:o/2,l=e.interpolateZoom([(a-t.x)/t.k,(f-t.y)/t.k,s/t.k],[(a-r.x)/r.k,(f-r.y)/r.k,s/r.k]);return function(e){var r=l(e),i=s/r[2];this.__chart__=t={x:a-r[0]*i,y:f-r[1]*i,k:i},O(n)}}).each("interrupt.zoom",function(){M(n)}).each("end.zoom",function(){M(n)}):(this.__chart__=t,A(n),O(n),M(n))})},S.translate=function(e){return arguments.length?(t={x:+e[0],y:+e[1],k:t.k},L(),S):[t.x,t.y]},S.scale=function(e){return arguments.length?(t={x:t.x,y:t.y,k:+e},L(),S):t.k},S.scaleExtent=function(e){return arguments.length?(a=e==null?Xt:[+e[0],+e[1]],S):a},S.center=function(e){return arguments.length?(o=e&&[+e[0],+e[1]],S):o},S.size=function(e){return arguments.length?(u=e&&[+e[0],+e[1]],S):u},S.duration=function(e){return arguments.length?(f=+e,S):f},S.x=function(e){return arguments.length?(b=e,y=e.copy(),t={x:0,y:0,k:1},S):b},S.y=function(e){return arguments.length?(E=e,w=e.copy(),t={x:0,y:0,k:1},S):E},e.rebind(S,g,"on")};var Xt=[0,Infinity],Vt,$t;e.color=Jt,Jt.prototype.toString=function(){return this.rgb()+""},e.hsl=Kt;var Qt=Kt.prototype=new Jt;Qt.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new Kt(this.h,this.s,this.l/e)},Qt.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new Kt(this.h,this.s,e*this.l)},Qt.rgb=function(){return Gt(this.h,this.s,this.l)},e.hcl=Yt;var Zt=Yt.prototype=new Jt;Zt.brighter=function(e){return new Yt(this.h,this.c,Math.min(100,this.l+nn*(arguments.length?e:1)))},Zt.darker=function(e){return new Yt(this.h,this.c,Math.max(0,this.l-nn*(arguments.length?e:1)))},Zt.rgb=function(){return en(this.h,this.c,this.l).rgb()},e.lab=tn;var nn=18,rn=.95047,sn=1,on=1.08883,un=tn.prototype=new Jt;un.brighter=function(e){return new tn(Math.min(100,this.l+nn*(arguments.length?e:1)),this.a,this.b)},un.darker=function(e){return new tn(Math.max(0,this.l-nn*(arguments.length?e:1)),this.a,this.b)},un.rgb=function(){return an(this.l,this.a,this.b)},e.rgb=pn;var mn=pn.prototype=new Jt;mn.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;return!t&&!n&&!r?new pn(i,i,i):(t&&t<i&&(t=i),n&&n<i&&(n=i),r&&r<i&&(r=i),new pn(Math.min(255,t/e),Math.min(255,n/e),Math.min(255,r/e)))},mn.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new pn(e*this.r,e*this.g,e*this.b)},mn.hsl=function(){return bn(this.r,this.g,this.b)},mn.toString=function(){return"#"+gn(this.r)+gn(this.g)+gn(this.b)};var xn=e.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});xn.forEach(function(e,t){xn.set(e,dn(t))}),e.functor=Tn,e.xhr=Nn(D),e.dsv=function(e,t){function i(e,n,r){arguments.length<3&&(r=n,n=null);var i=Cn(e,t,n==null?s:o(n),r);return i.row=function(e){return arguments.length?i.response((n=e)==null?s:o(e)):n},i}function s(e){return i.parse(e.responseText)}function o(e){return function(t){return i.parse(t.responseText,e)}}function u(t){return t.map(a).join(e)}function a(e){return n.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var n=new RegExp('["'+e+"\n]"),r=e.charCodeAt(0);return i.parse=function(e,t){var n;return i.parseRows(e,function(e,r){if(n)return n(e,r-1);var i=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}");n=t?function(e,n){return t(i(e),n)}:i})},i.parseRows=function(e,t){function c(){if(u>=o)return i;if(l)return l=!1,n;var t=u;if(e.charCodeAt(t)===34){var s=t;while(s++<o)if(e.charCodeAt(s)===34){if(e.charCodeAt(s+1)!==34)break;++s}u=s+2;var a=e.charCodeAt(s+1);return a===13?(l=!0,e.charCodeAt(s+2)===10&&++u):a===10&&(l=!0),e.slice(t+1,s).replace(/""/g,'"')}while(u<o){var a=e.charCodeAt(u++),f=1;if(a===10)l=!0;else if(a===13)l=!0,e.charCodeAt(u)===10&&(++u,++f);else if(a!==r)continue;return e.slice(t,u-f)}return e.slice(t)}var n={},i={},s=[],o=e.length,u=0,a=0,f,l;while((f=c())!==i){var h=[];while(f!==n&&f!==i)h.push(f),f=c();if(t&&(h=t(h,a++))==null)continue;s.push(h)}return s},i.format=function(t){if(Array.isArray(t[0]))return i.formatRows(t);var n=new _,r=[];return t.forEach(function(e){for(var t in e)n.has(t)||r.push(n.add(t))}),[r.map(a).join(e)].concat(t.map(function(t){return r.map(function(e){return a(t[e])}).join(e)})).join("\n")},i.formatRows=function(e){return e.map(u).join("\n")},i},e.csv=e.dsv(",","text/csv"),e.tsv=e.dsv("	","text/tab-separated-values");var An,On,Mn,_n,Dn,Pn=this[H(this,"requestAnimationFrame")]||function(e){setTimeout(e,17)};e.timer=function(e,t,n){var r=arguments.length;r<2&&(t=0),r<3&&(n=Date.now());var i=n+t,s={c:e,t:i,f:!1,n:null};On?On.n=s:An=s,On=s,Mn||(_n=clearTimeout(_n),Mn=1,Pn(Hn))},e.timer.flush=function(){Bn(),jn()},e.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};var In=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(qn);e.formatPrefix=function(t,n){var r=0;return t&&(t<0&&(t*=-1),n&&(t=e.round(t,Fn(t,n))),r=1+Math.floor(1e-12+Math.log(t)/Math.LN10),r=Math.max(-24,Math.min(24,Math.floor((r-1)/3)*3))),In[8+r/3]};var Un=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,zn=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,n){return(t=e.round(t,Fn(t,n))).toFixed(Math.max(0,Math.min(20,Fn(t*(1+1e-15),n))))}}),Xn=e.time={},Vn=Date;$n.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(){Jn.setUTCDate.apply(this._,arguments)},setDay:function(){Jn.setUTCDay.apply(this._,arguments)},setFullYear:function(){Jn.setUTCFullYear.apply(this._,arguments)},setHours:function(){Jn.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Jn.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Jn.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Jn.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Jn.setUTCSeconds.apply(this._,arguments)},setTime:function(){Jn.setTime.apply(this._,arguments)}};var Jn=Date.prototype;Xn.year=Kn(function(e){return e=Xn.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),Xn.years=Xn.year.range,Xn.years.utc=Xn.year.utc.range,Xn.day=Kn(function(e){var t=new Vn(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),Xn.days=Xn.day.range,Xn.days.utc=Xn.day.utc.range,Xn.dayOfYear=function(e){var t=Xn.year(e);return Math.floor((e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(e,t){t=7-t;var n=Xn[e]=Kn(function(e){return(e=Xn.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(e){var n=Xn.year(e).getDay();return Math.floor((Xn.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});Xn[e+"s"]=n.range,Xn[e+"s"].utc=n.utc.range,Xn[e+"OfYear"]=function(e){var n=Xn.year(e).getDay();return Math.floor((Xn.dayOfYear(e)+(n+t)%7)/7)}}),Xn.week=Xn.sunday,Xn.weeks=Xn.sunday.range,Xn.weeks.utc=Xn.sunday.utc.range,Xn.weekOfYear=Xn.sundayOfYear;var Yn={"-":"",_:" ",0:"0"},Zn=/^\s*\d+/,er=/^%/;e.locale=function(e){return{numberFormat:Rn(e),timeFormat:Gn(e)}};var Er=e.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"]});e.format=Er.numberFormat,e.geo={},Sr.prototype={s:0,t:0,add:function(e){Tr(e,this.t,xr),Tr(xr.s,this.s,this),this.s?this.t+=xr.t:this.s=xr.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xr=new Sr;e.geo.stream=function(e,t){e&&Cr.hasOwnProperty(e.type)?Cr[e.type](e,t):Nr(e,t)};var Cr={Feature:function(e,t){Nr(e.geometry,t)},FeatureCollection:function(e,t){var n=e.features,r=-1,i=n.length;while(++r<i)Nr(n[r].geometry,t)}},kr={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){Lr(e.coordinates,t,0)},MultiLineString:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)Lr(n[r],t,0)},Polygon:function(e,t){Ar(e.coordinates,t)},MultiPolygon:function(e,t){var n=e.coordinates,r=-1,i=n.length;while(++r<i)Ar(n[r],t)},GeometryCollection:function(e,t){var n=e.geometries,r=-1,i=n.length;while(++r<i)Nr(n[r],t)}};e.geo.area=function(t){return Or=0,e.geo.stream(t,_r),Or};var Or,Mr=new Sr,_r={sphere:function(){Or+=4*Lt},point:j,lineStart:j,lineEnd:j,polygonStart:function(){Mr.reset(),_r.lineStart=Dr},polygonEnd:function(){var e=2*Mr;Or+=e<0?4*Lt+e:e,_r.lineStart=_r.lineEnd=_r.point=j}};e.geo.bounds=function(){function p(e,s){l.push(c=[t=e,r=e]),s<n&&(n=s),s>i&&(i=s)}function d(e,o){var u=Pr([e*_t,o*_t]);if(a){var f=Br(a,u),l=[f[1],-f[0],0],c=Br(l,f);Ir(c),c=qr(c);var h=e-s,d=h>0?1:-1,v=c[0]*Dt*d,m=b(h)>180;if(m^(d*s<v&&v<d*e)){var g=c[1]*Dt;g>i&&(i=g)}else if(v=(v+360)%360-180,m^(d*s<v&&v<d*e)){var g=-c[1]*Dt;g<n&&(n=g)}else o<n&&(n=o),o>i&&(i=o);m?e<s?E(t,e)>E(t,r)&&(r=e):E(e,r)>E(t,r)&&(t=e):r>=t?(e<t&&(t=e),e>r&&(r=e)):e>s?E(t,e)>E(t,r)&&(r=e):E(e,r)>E(t,r)&&(t=e)}else p(e,o);a=u,s=e}function v(){h.point=d}function m(){c[0]=t,c[1]=r,h.point=p,a=null}function g(e,t){if(a){var n=e-s;f+=b(n)>180?n+(n>0?360:-360):n}else o=e,u=t;_r.point(e,t),d(e,t)}function y(){_r.lineStart()}function w(){g(o,u),_r.lineEnd(),b(f)>Ct&&(t=-(r=180)),c[0]=t,c[1]=r,a=null}function E(e,t){return(t-=e)<0?t+360:t}function S(e,t){return e[0]-t[0]}function x(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var t,n,r,i,s,o,u,a,f,l,c,h={point:p,lineStart:v,lineEnd:m,polygonStart:function(){h.point=g,h.lineStart=y,h.lineEnd=w,f=0,_r.polygonStart()},polygonEnd:function(){_r.polygonEnd(),h.point=p,h.lineStart=v,h.lineEnd=m,Mr<0?(t=-(r=180),n=-(i=90)):f>Ct?i=90:f<-Ct&&(n=-90),c[0]=t,c[1]=r}};return function(s){i=r=-(t=n=Infinity),l=[],e.geo.stream(s,h);var o=l.length;if(o){l.sort(S);for(var u=1,a=l[0],f,p=[a];u<o;++u)f=l[u],x(f[0],a)||x(f[1],a)?(E(a[0],f[1])>E(a[0],a[1])&&(a[1]=f[1]),E(f[0],a[1])>E(a[0],a[1])&&(a[0]=f[0])):p.push(a=f);var d=-Infinity,v;for(var o=p.length-1,u=0,a=p[o],f;u<=o;a=f,++u)f=p[u],(v=E(a[1],f[0]))>d&&(d=v,t=f[0],r=a[1])}return l=c=null,t===Infinity||n===Infinity?[[NaN,NaN],[NaN,NaN]]:[[t,n],[r,i]]}}(),e.geo.centroid=function(t){Ur=zr=Wr=Xr=Vr=$r=Jr=Kr=Qr=Gr=Yr=0,e.geo.stream(t,Zr);var n=Qr,r=Gr,i=Yr,s=n*n+r*r+i*i;if(s<kt){n=$r,r=Jr,i=Kr,zr<Ct&&(n=Wr,r=Xr,i=Vr),s=n*n+r*r+i*i;if(s<kt)return[NaN,NaN]}return[Math.atan2(r,n)*Dt,jt(i/Math.sqrt(s))*Dt]};var Ur,zr,Wr,Xr,Vr,$r,Jr,Kr,Qr,Gr,Yr,Zr={sphere:j,point:ei,lineStart:ni,lineEnd:ri,polygonStart:function(){Zr.lineStart=ii},polygonEnd:function(){Zr.lineStart=ni}},di=li(oi,vi,gi,[-Lt,-Lt/2]),Ei=1e9;e.geo.clipExtent=function(){var e,t,n,r,i,s,o={stream:function(e){return i&&(i.valid=!1),i=s(e),i.valid=!0,i},extent:function(u){return arguments.length?(s=Si(e=+u[0][0],t=+u[0][1],n=+u[1][0],r=+u[1][1]),i&&(i.valid=!1,i=null),o):[[e,t],[n,r]]}};return o.extent([[0,0],[960,500]])},(e.geo.conicEqualArea=function(){return xi(Ti)}).raw=Ti,e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-0.6,38.7]).parallels([29.5,45.5]).scale(1070)},e.geo.albersUsa=function(){function f(e){var t=e[0],n=e[1];return i=null,(o(t,n),i)||(u(t,n),i)||a(t,n),i}var t=e.geo.albers(),n=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),r=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),i,s={point:function(e,t){i=[e,t]}},o,u,a;return f.invert=function(e){var i=t.scale(),s=t.translate(),o=(e[0]-s[0])/i,u=(e[1]-s[1])/i;return(u>=.12&&u<.234&&o>=-0.425&&o<-0.214?n:u>=.166&&u<.234&&o>=-0.214&&o<-0.115?r:t).invert(e)},f.stream=function(e){var i=t.stream(e),s=n.stream(e),o=r.stream(e);return{point:function(e,t){i.point(e,t),s.point(e,t),o.point(e,t)},sphere:function(){i.sphere(),s.sphere(),o.sphere()},lineStart:function(){i.lineStart(),s.lineStart(),o.lineStart()},lineEnd:function(){i.lineEnd(),s.lineEnd(),o.lineEnd()},polygonStart:function(){i.polygonStart(),s.polygonStart(),o.polygonStart()},polygonEnd:function(){i.polygonEnd(),s.polygonEnd(),o.polygonEnd()}}},f.precision=function(e){return arguments.length?(t.precision(e),n.precision(e),r.precision(e),f):t.precision()},f.scale=function(e){return arguments.length?(t.scale(e),n.scale(e*.35),r.scale(e),f.translate(t.translate())):t.scale()},f.translate=function(e){if(!arguments.length)return t.translate();var i=t.scale(),l=+e[0],c=+e[1];return o=t.translate(e).clipExtent([[l-.455*i,c-.238*i],[l+.455*i,c+.238*i]]).stream(s).point,u=n.translate([l-.307*i,c+.201*i]).clipExtent([[l-.425*i+Ct,c+.12*i+Ct],[l-.214*i-Ct,c+.234*i-Ct]]).stream(s).point,a=r.translate([l-.205*i,c+.212*i]).clipExtent([[l-.214*i+Ct,c+.166*i+Ct],[l-.115*i-Ct,c+.234*i-Ct]]).stream(s).point,f},f.scale(1070)};var Ni,Ci,ki={point:j,lineStart:j,lineEnd:j,polygonStart:function(){Ci=0,ki.lineStart=Li},polygonEnd:function(){ki.lineStart=ki.lineEnd=ki.point=j,Ni+=b(Ci/2)}},Ai,Oi,Mi,_i,Di={point:Pi,lineStart:j,lineEnd:j,polygonStart:j,polygonEnd:j},ji={point:Fi,lineStart:Ii,lineEnd:qi,polygonStart:function(){ji.lineStart=Ri},polygonEnd:function(){ji.point=Fi,ji.lineStart=Ii,ji.lineEnd=qi}};e.geo.path=function(){function u(n){if(n){typeof t=="function"&&s.pointRadius(+t.apply(this,arguments));if(!o||!o.valid)o=i(s);e.geo.stream(n,o)}return s.result()}function a(){return o=null,u}var t=4.5,n,r,i,s,o;return u.area=function(t){return Ni=0,e.geo.stream(t,i(ki)),Ni},u.centroid=function(t){return Wr=Xr=Vr=$r=Jr=Kr=Qr=Gr=Yr=0,e.geo.stream(t,i(ji)),Yr?[Qr/Yr,Gr/Yr]:Kr?[$r/Kr,Jr/Kr]:Vr?[Wr/Vr,Xr/Vr]:[NaN,NaN]},u.bounds=function(t){return Mi=_i=-(Ai=Oi=Infinity),e.geo.stream(t,i(Di)),[[Ai,Oi],[Mi,_i]]},u.projection=function(e){return arguments.length?(i=(n=e)?e.stream||Wi(e):D,a()):n},u.context=function(e){return arguments.length?(s=(r=e)==null?new Hi:new Ui(e),typeof t!="function"&&s.pointRadius(t),a()):r},u.pointRadius=function(e){return arguments.length?(t=typeof e=="function"?e:(s.pointRadius(+e),+e),u):t},u.projection(e.geo.albersUsa()).context(null)},e.geo.transform=function(e){return{stream:function(t){var n=new Xi(t);for(var r in e)n[r]=e[r];return n}}},Xi.prototype={point:function(e,t){this.stream.point(e,t)},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()}},e.geo.projection=$i,e.geo.projectionMutator=Ji,(e.geo.equirectangular=function(){return $i(Qi)}).raw=Qi.invert=Qi,e.geo.rotation=function(e){function t(t){return t=e(t[0]*_t,t[1]*_t),t[0]*=Dt,t[1]*=Dt,t}return e=Yi(e[0]%360*_t,e[1]*_t,e.length>2?e[2]*_t:0),t.invert=function(t){return t=e.invert(t[0]*_t,t[1]*_t),t[0]*=Dt,t[1]*=Dt,t},t},Gi.invert=Qi,e.geo.circle=function(){function i(){var t=typeof e=="function"?e.apply(this,arguments):e,n=Yi(-t[0]*_t,-t[1]*_t,0).invert,i=[];return r(null,null,1,{point:function(e,t){i.push(e=n(e,t)),e[0]*=Dt,e[1]*=Dt}}),{type:"Polygon",coordinates:[i]}}var e=[0,0],t,n=6,r;return i.origin=function(t){return arguments.length?(e=t,i):e},i.angle=function(e){return arguments.length?(r=ns((t=+e)*_t,n*_t),i):t},i.precision=function(e){return arguments.length?(r=ns(t*_t,(n=+e)*_t),i):n},i.angle(90)},e.geo.distance=function(e,t){var n=(t[0]-e[0])*_t,r=e[1]*_t,i=t[1]*_t,s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),a=Math.cos(r),f=Math.sin(i),l=Math.cos(i),c;return Math.atan2(Math.sqrt((c=l*s)*c+(c=a*f-u*l*o)*c),u*f+a*l*o)},e.geo.graticule=function(){function y(){return{type:"MultiLineString",coordinates:w()}}function w(){return e.range(Math.ceil(i/c)*c,r,c).map(v).concat(e.range(Math.ceil(a/h)*h,u,h).map(m)).concat(e.range(Math.ceil(n/f)*f,t,f).filter(function(e){return b(e%c)>Ct}).map(p)).concat(e.range(Math.ceil(o/l)*l,s,l).filter(function(e){return b(e%h)>Ct}).map(d))}var t,n,r,i,s,o,u,a,f=10,l=f,c=90,h=360,p,d,v,m,g=2.5;return y.lines=function(){return w().map(function(e){return{type:"LineString",coordinates:e}})},y.outline=function(){return{type:"Polygon",coordinates:[v(i).concat(m(u).slice(1),v(r).reverse().slice(1),m(a).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.majorExtent(e).minorExtent(e):y.minorExtent()},y.majorExtent=function(e){return arguments.length?(i=+e[0][0],r=+e[1][0],a=+e[0][1],u=+e[1][1],i>r&&(e=i,i=r,r=e),a>u&&(e=a,a=u,u=e),y.precision(g)):[[i,a],[r,u]]},y.minorExtent=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],s=+e[1][1],n>t&&(e=n,n=t,t=e),o>s&&(e=o,o=s,s=e),y.precision(g)):[[n,o],[t,s]]},y.step=function(e){return arguments.length?y.majorStep(e).minorStep(e):y.minorStep()},y.majorStep=function(e){return arguments.length?(c=+e[0],h=+e[1],y):[c,h]},y.minorStep=function(e){return arguments.length?(f=+e[0],l=+e[1],y):[f,l]},y.precision=function(e){return arguments.length?(g=+e,p=is(o,s,90),d=ss(n,t,g),v=is(a,u,90),m=ss(i,r,g),y):g},y.majorExtent([[-180,-90+Ct],[180,90-Ct]]).minorExtent([[-180,-80-Ct],[180,80+Ct]])},e.geo.greatArc=function(){function s(){return{type:"LineString",coordinates:[n||t.apply(this,arguments),i||r.apply(this,arguments)]}}var t=os,n,r=us,i;return s.distance=function(){return e.geo.distance(n||t.apply(this,arguments),i||r.apply(this,arguments))},s.source=function(e){return arguments.length?(t=e,n=typeof e=="function"?null:e,s):t},s.target=function(e){return arguments.length?(r=e,i=typeof e=="function"?null:e,s):r},s.precision=function(){return arguments.length?s:0},s},e.geo.interpolate=function(e,t){return as(e[0]*_t,e[1]*_t,t[0]*_t,t[1]*_t)},e.geo.length=function(t){return fs=0,e.geo.stream(t,ls),fs};var fs,ls={sphere:j,point:j,lineStart:cs,lineEnd:j,polygonStart:j,polygonEnd:j},ps=hs(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(e.geo.azimuthalEqualArea=function(){return $i(ps)}).raw=ps;var ds=hs(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},D);(e.geo.azimuthalEquidistant=function(){return $i(ds)}).raw=ds,(e.geo.conicConformal=function(){return xi(vs)}).raw=vs,(e.geo.conicEquidistant=function(){return xi(ms)}).raw=ms;var gs=hs(function(e){return 1/e},Math.atan);(e.geo.gnomonic=function(){return $i(gs)}).raw=gs,ys.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-Mt]},(e.geo.mercator=function(){return bs(ys)}).raw=ys;var ws=hs(function(){return 1},Math.asin);(e.geo.orthographic=function(){return $i(ws)}).raw=ws;var Es=hs(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(e.geo.stereographic=function(){return $i(Es)}).raw=Es,Ss.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Mt]},(e.geo.transverseMercator=function(){var e=bs(Ss),t=e.center,n=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):(e=t(),[e[1],-e[0]])},e.rotate=function(e){return e?n([e[0],e[1],e.length>2?e[2]+90:90]):(e=n(),[e[0],e[1],e[2]-90])},n([0,0,90])}).raw=Ss,e.geom={},e.geom.hull=function(e){function r(e){if(e.length<3)return[];var r=Tn(t),i=Tn(n),s,o=e.length,u=[],a=[];for(s=0;s<o;s++)u.push([+r.call(this,e[s],s),+i.call(this,e[s],s),s]);u.sort(Cs);for(s=0;s<o;s++)a.push([u[s][0],-u[s][1]]);var f=Ns(u),l=Ns(a),c=l[0]===f[0],h=l[l.length-1]===f[f.length-1],p=[];for(s=f.length-1;s>=0;--s)p.push(e[u[f[s]][2]]);for(s=+c;s<l.length-h;++s)p.push(e[u[l[s]][2]]);return p}var t=xs,n=Ts;return arguments.length?r(e):(r.x=function(e){return arguments.length?(t=e,r):t},r.y=function(e){return arguments.length?(n=e,r):n},r)},e.geom.polygon=function(e){return W(e,ks),e};var ks=e.geom.polygon.prototype=[];ks.area=function(){var e=-1,t=this.length,n,r=this[t-1],i=0;while(++e<t)n=r,r=this[e],i+=n[1]*r[0]-n[0]*r[1];return i*.5},ks.centroid=function(e){var t=-1,n=this.length,r=0,i=0,s,o=this[n-1],u;arguments.length||(e=-1/(6*this.area()));while(++t<n)s=o,o=this[t],u=s[0]*o[1]-o[0]*s[1],r+=(s[0]+o[0])*u,i+=(s[1]+o[1])*u;return[r*e,i*e]},ks.clip=function(e){var t,n=Os(e),r=-1,i=this.length-Os(this),s,o,u=this[i-1],a,f,l;while(++r<i){t=e.slice(),e.length=0,a=this[r],f=t[(o=t.length-n)-1],s=-1;while(++s<o)l=t[s],Ls(l,u,a)?(Ls(f,u,a)||e.push(As(f,l,u,a)),e.push(l)):Ls(f,u,a)&&e.push(As(f,l,u,a)),f=l;n&&e.push(e[0]),u=a}return e};var Ms,_s,Ds,Ps=[],Hs,Bs,js=[];Xs.prototype.prepare=function(){var e=this.edges,t=e.length,n;while(t--)n=e[t].edge,(!n.b||!n.a)&&e.splice(t,1);return e.sort($s),e.length},ro.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}},io.prototype={insert:function(e,t){var n,r,i;if(e){t.P=e,t.N=e.N,e.N&&(e.N.P=t),e.N=t;if(e.R){e=e.R;while(e.L)e=e.L;e.L=t}else e.R=t;n=e}else this._?(e=ao(this._),t.P=null,t.N=e,e.P=e.L=t,n=e):(t.P=t.N=null,this._=t,n=null);t.L=t.R=null,t.U=n,t.C=!0,e=t;while(n&&n.C)r=n.U,n===r.L?(i=r.R,i&&i.C?(n.C=i.C=!1,r.C=!0,e=r):(e===n.R&&(oo(this,n),e=n,n=e.U),n.C=!1,r.C=!0,uo(this,r))):(i=r.L,i&&i.C?(n.C=i.C=!1,r.C=!0,e=r):(e===n.L&&(uo(this,n),e=n,n=e.U),n.C=!1,r.C=!0,oo(this,r))),n=e.U;this._.C=!1},remove:function(e){e.N&&(e.N.P=e.P),e.P&&(e.P.N=e.N),e.N=e.P=null;var t=e.U,n,r=e.L,i=e.R,s,o;r?i?s=ao(i):s=r:s=i,t?t.L===e?t.L=s:t.R=s:this._=s,r&&i?(o=s.C,s.C=e.C,s.L=r,r.U=s,s!==i?(t=s.U,s.U=e.U,e=s.R,t.L=e,s.R=i,i.U=s):(s.U=t,t=s,e=s.R)):(o=e.C,e=s),e&&(e.U=t);if(o)return;if(e&&e.C){e.C=!1;return}do{if(e===this._)break;if(e===t.L){n=t.R,n.C&&(n.C=!1,t.C=!0,oo(this,t),n=t.R);if(n.L&&n.L.C||n.R&&n.R.C){if(!n.R||!n.R.C)n.L.C=!1,n.C=!0,uo(this,n),n=t.R;n.C=t.C,t.C=n.R.C=!1,oo(this,t),e=this._;break}}else{n=t.L,n.C&&(n.C=!1,t.C=!0,uo(this,t),n=t.L);if(n.L&&n.L.C||n.R&&n.R.C){if(!n.L||!n.L.C)n.R.C=!1,n.C=!0,oo(this,n),n=t.L;n.C=t.C,t.C=n.L.C=!1,uo(this,t),e=this._;break}}n.C=!0,e=t,t=t.U}while(!e.C);e&&(e.C=!1)}},e.geom.voronoi=function(e){function o(e){var t=new Array(e.length),n=s[0][0],r=s[0][1],i=s[1][0],o=s[1][1];return fo(u(e),s).cells.forEach(function(s,u){var a=s.edges,f=s.site,l=t[u]=a.length?a.map(function(e){var t=e.start();return[t.x,t.y]}):f.x>=n&&f.x<=i&&f.y>=r&&f.y<=o?[[n,o],[i,o],[i,r],[n,r]]:[];l.point=e[u]}),t}function u(e){return e.map(function(e,t){return{x:Math.round(r(e,t)/Ct)*Ct,y:Math.round(i(e,t)/Ct)*Ct,i:t}})}var t=xs,n=Ts,r=t,i=n,s=co;return e?o(e):(o.links=function(e){return fo(u(e)).edges.filter(function(e){return e.l&&e.r}).map(function(t){return{source:e[t.l.i],target:e[t.r.i]}})},o.triangles=function(e){var t=[];return fo(u(e)).cells.forEach(function(n,r){var i=n.site,s=n.edges.sort($s),o=-1,u=s.length,a,f,l=s[u-1].edge,c=l.l===i?l.r:l.l;while(++o<u)a=l,f=c,l=s[o].edge,c=l.l===i?l.r:l.l,r<f.i&&r<c.i&&ho(i,f,c)<0&&t.push([e[r],e[f.i],e[c.i]])}),t},o.x=function(e){return arguments.length?(r=Tn(t=e),o):t},o.y=function(e){return arguments.length?(i=Tn(n=e),o):n},o.clipExtent=function(e){return arguments.length?(s=e==null?co:e,o):s===co?null:s},o.size=function(e){return arguments.length?o.clipExtent(e&&[[0,0],e]):s===co?null:s&&s[1]},o)};var co=[[-1e6,-1e6],[1e6,1e6]];e.geom.delaunay=function(t){return e.geom.voronoi().triangles(t)},e.geom.quadtree=function(e,t,n,r,i){function a(e){function T(e,t,n,r,i,s,o,u){if(isNaN(n)||isNaN(r))return;if(e.leaf){var a=e.x,f=e.y;if(a!=null)if(b(a-n)+b(f-r)<.01)N(e,t,n,r,i,s,o,u);else{var l=e.point;e.x=e.y=e.point=null,N(e,l,a,f,i,s,o,u),N(e,t,n,r,i,s,o,u)}else e.x=n,e.y=r,e.point=t}else N(e,t,n,r,i,s,o,u)}function N(e,t,n,r,i,s,o,u){var a=(i+o)*.5,f=(s+u)*.5,l=n>=a,c=r>=f,h=c<<1|l;e.leaf=!1,e=e.nodes[h]||(e.nodes[h]=mo()),l?i=a:o=a,c?s=f:u=f,T(e,t,n,r,i,s,o,u)}var a,f=Tn(s),l=Tn(o),c,h,p,d,v,m,g,y;if(t!=null)v=t,m=n,g=r,y=i;else{g=y=-(v=m=Infinity),c=[],h=[],d=e.length;if(u)for(p=0;p<d;++p)a=e[p],a.x<v&&(v=a.x),a.y<m&&(m=a.y),a.x>g&&(g=a.x),a.y>y&&(y=a.y),c.push(a.x),h.push(a.y);else for(p=0;p<d;++p){var w=+f(a=e[p],p),E=+l(a,p);w<v&&(v=w),E<m&&(m=E),w>g&&(g=w),E>y&&(y=E),c.push(w),h.push(E)}}var S=g-v,x=y-m;S>x?y=m+S:g=v+x;var C=mo();C.add=function(e){T(C,e,+f(e,++p),+l(e,p),v,m,g,y)},C.visit=function(e){go(e,C,v,m,g,y)},C.find=function(e){return yo(C,e[0],e[1],v,m,g,y)},p=-1;if(t==null){while(++p<d)T(C,e[p],c[p],h[p],v,m,g,y);--p}else e.forEach(C.add);return c=h=e=a=null,C}var s=xs,o=Ts,u;return(u=arguments.length)?(s=po,o=vo,u===3&&(i=n,r=t,n=t=0),a(e)):(a.x=function(e){return arguments.length?(s=e,a):s},a.y=function(e){return arguments.length?(o=e,a):o},a.extent=function(e){return arguments.length?(e==null?t=n=r=i=null:(t=+e[0][0],n=+e[0][1],r=+e[1][0],i=+e[1][1]),a):t==null?null:[[t,n],[r,i]]},a.size=function(e){return arguments.length?(e==null?t=n=r=i=null:(t=n=0,r=+e[0],i=+e[1]),a):t==null?null:[r-t,i-n]},a)},e.interpolateRgb=bo,e.interpolateObject=wo,e.interpolateNumber=Eo,e.interpolateString=So;var xo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,To=new RegExp(xo.source,"g");e.interpolate=No,e.interpolators=[function(e,t){var n=typeof t;return(n==="string"?xn.has(t)||/^(#|rgb\(|hsl\()/.test(t)?bo:So:t instanceof Jt?bo:Array.isArray(t)?Co:n==="object"&&isNaN(t)?wo:Eo)(e,t)}],e.interpolateArray=Co;var ko=function(){return D},Lo=e.map({linear:ko,poly:Bo,quad:function(){return Do},cubic:function(){return Po},sin:function(){return jo},exp:function(){return Fo},circle:function(){return Io},elastic:qo,back:Ro,bounce:function(){return Uo}}),Ao=e.map({"in":D,out:Mo,"in-out":_o,"out-in":function(e){return _o(Mo(e))}});e.ease=function(e){var n=e.indexOf("-"),r=n>=0?e.slice(0,n):e,i=n>=0?e.slice(n+1):"in";return r=Lo.get(r)||ko,i=Ao.get(i)||D,Oo(i(r.apply(null,t.call(arguments,1))))},e.interpolateHcl=zo,e.interpolateHsl=Wo,e.interpolateLab=Xo,e.interpolateRound=Vo,e.transform=function(t){var n=r.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){if(e!=null){n.setAttribute("transform",e);var t=n.transform.baseVal.consolidate()}return new $o(t?t.matrix:Go)})(t)},$o.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Go={a:1,b:0,c:0,d:1,e:0,f:0};e.interpolateTransform=Yo,e.layout={},e.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n<r)t.push(tu(e[n]));return t}},e.layout.chord=function(){function l(){var t={},l=[],h=e.range(s),p=[],d,v,m,g,y;n=[],r=[],d=0,g=-1;while(++g<s){v=0,y=-1;while(++y<s)v+=i[g][y];l.push(v),p.push(e.range(s)),d+=v}u&&h.sort(function(e,t){return u(l[e],l[t])}),a&&p.forEach(function(e,t){e.sort(function(e,n){return a(i[t][e],i[t][n])})}),d=(At-o*s)/d,v=0,g=-1;while(++g<s){m=v,y=-1;while(++y<s){var b=h[g],w=p[b][y],E=i[b][w],S=v,x=v+=E*d;t[b+"-"+w]={index:b,subindex:w,startAngle:S,endAngle:x,value:E}}r[b]={index:b,startAngle:m,endAngle:v,value:(v-m)/d},v+=o}g=-1;while(++g<s){y=g-1;while(++y<s){var T=t[g+"-"+y],N=t[y+"-"+g];(T.value||N.value)&&n.push(T.value<N.value?{source:N,target:T}:{source:T,target:N})}}f&&c()}function c(){n.sort(function(e,t){return f((e.source.value+e.target.value)/2,(t.source.value+t.target.value)/2)})}var t={},n,r,i,s,o=0,u,a,f;return t.matrix=function(e){return arguments.length?(s=(i=e)&&i.length,n=r=null,t):i},t.padding=function(e){return arguments.length?(o=e,n=r=null,t):o},t.sortGroups=function(e){return arguments.length?(u=e,n=r=null,t):u},t.sortSubgroups=function(e){return arguments.length?(a=e,n=null,t):a},t.sortChords=function(e){return arguments.length?(f=e,n&&c(),t):f},t.chords=function(){return n||l(),n},t.groups=function(){return r||l(),r},t},e.layout.force=function(){function y(e){return function(t,n,r,i){if(t.point!==e){var s=t.cx-e.x,o=t.cy-e.y,u=i-n,a=s*s+o*o;if(u*u/h<a){if(a<l){var f=t.charge/a;e.px-=s*f,e.py-=o*f}return!0}if(t.point&&a&&a<l){var f=t.pointCharge/a;e.px-=s*f,e.py-=o*f}}return!t.charge}}function b(n){n.px=e.event.x,n.py=e.event.y,t.resume()}var t={},n=e.dispatch("start","tick","end"),r=[1,1],i,s,o=.9,u=fu,a=lu,f=-30,l=cu,c=.1,h=.64,p=[],d=[],v,m,g;return t.tick=function(){if((s*=.99)<.005)return n.end({type:"end",alpha:s=0}),!0;var t=p.length,i=d.length,u,a,l,h,b,w,E,S,x;for(a=0;a<i;++a){l=d[a],h=l.source,b=l.target,S=b.x-h.x,x=b.y-h.y;if(w=S*S+x*x)w=s*m[a]*((w=Math.sqrt(w))-v[a])/w,S*=w,x*=w,b.x-=S*(E=h.weight/(b.weight+h.weight)),b.y-=x*E,h.x+=S*(E=1-E),h.y+=x*E}if(E=s*c){S=r[0]/2,x=r[1]/2,a=-1;if(E)while(++a<t)l=p[a],l.x+=(S-l.x)*E,l.y+=(x-l.y)*E}if(f){au(u=e.geom.quadtree(p),s,g),a=-1;while(++a<t)(l=p[a]).fixed||u.visit(y(l))}a=-1;while(++a<t)l=p[a],l.fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*o,l.y-=(l.py-(l.py=l.y))*o);n.tick({type:"tick",alpha:s})},t.nodes=function(e){return arguments.length?(p=e,t):p},t.links=function(e){return arguments.length?(d=e,t):d},t.size=function(e){return arguments.length?(r=e,t):r},t.linkDistance=function(e){return arguments.length?(u=typeof e=="function"?e:+e,t):u},t.distance=t.linkDistance,t.linkStrength=function(e){return arguments.length?(a=typeof e=="function"?e:+e,t):a},t.friction=function(e){return arguments.length?(o=+e,t):o},t.charge=function(e){return arguments.length?(f=typeof e=="function"?e:+e,t):f},t.chargeDistance=function(e){return arguments.length?(l=e*e,t):Math.sqrt(l)},t.gravity=function(e){return arguments.length?(c=+e,t):c},t.theta=function(e){return arguments.length?(h=e*e,t):Math.sqrt(h)},t.alpha=function(r){return arguments.length?(r=+r,s?r>0?s=r:s=0:r>0&&(n.start({type:"start",alpha:s=r}),e.timer(t.tick)),t):s},t.start=function(){function h(t,r){if(!l){l=new Array(n);for(u=0;u<n;++u)l[u]=[];for(u=0;u<i;++u){var s=d[u];l[s.source.index].push(s.target),l[s.target.index].push(s.source)}}var o=l[e],u=-1,a=o.length,f;while(++u<a)if(!isNaN(f=o[u][t]))return f;return Math.random()*r}var e,n=p.length,i=d.length,s=r[0],o=r[1],l,c;for(e=0;e<n;++e)(c=p[e]).index=e,c.weight=0;for(e=0;e<i;++e)c=d[e],typeof c.source=="number"&&(c.source=p[c.source]),typeof c.target=="number"&&(c.target=p[c.target]),++c.source.weight,++c.target.weight;for(e=0;e<n;++e)c=p[e],isNaN(c.x)&&(c.x=h("x",s)),isNaN(c.y)&&(c.y=h("y",o)),isNaN(c.px)&&(c.px=c.x),isNaN(c.py)&&(c.py=c.y);v=[];if(typeof u=="function")for(e=0;e<i;++e)v[e]=+u.call(this,d[e],e);else for(e=0;e<i;++e)v[e]=u;m=[];if(typeof a=="function")for(e=0;e<i;++e)m[e]=+a.call(this,d[e],e);else for(e=0;e<i;++e)m[e]=a;g=[];if(typeof f=="function")for(e=0;e<n;++e)g[e]=+f.call(this,p[e],e);else for(e=0;e<n;++e)g[e]=f;return t.resume()},t.resume=function(){return t.alpha(.1)},t.stop=function(){return t.alpha(0)},t.drag=function(){i||(i=e.behavior.drag().origin(D).on("dragstart.force",iu).on("drag.force",b).on("dragend.force",su));if(!arguments.length)return i;this.on("mouseover.force",ou).on("mouseout.force",uu).call(i)},e.rebind(t,n,"on")};var fu=20,lu=1,cu=Infinity;e.layout.hierarchy=function(){function r(i){var s=[i],o=[],u;i.depth=0;while((u=s.pop())!=null){o.push(u);if((f=t.call(r,u,u.depth))&&(a=f.length)){var a,f,l;while(--a>=0)s.push(l=f[a]),l.parent=u,l.depth=u.depth+1;n&&(u.value=0),u.children=f}else n&&(u.value=+n.call(r,u,u.depth)||0),delete u.children}return du(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),o}var e=gu,t=vu,n=mu;return r.sort=function(t){return arguments.length?(e=t,r):e},r.children=function(e){return arguments.length?(t=e,r):t},r.value=function(e){return arguments.length?(n=e,r):n},r.revalue=function(e){return n&&(pu(e,function(e){e.children&&(e.value=0)}),du(e,function(e){var t;e.children||(e.value=+n.call(r,e,e.depth)||0);if(t=e.parent)t.value+=e.value})),e},r},e.layout.partition=function(){function r(e,t,n,i){var s=e.children;e.x=t,e.y=e.depth*i,e.dx=n,e.dy=i;if(s&&(u=s.length)){var o=-1,u,a,f;n=e.value?n/e.value:0;while(++o<u)r(a=s[o],t,f=a.value*n,i),t+=f}}function i(e){var t=e.children,n=0;if(t&&(s=t.length)){var r=-1,s;while(++r<s)n=Math.max(n,i(t[r]))}return 1+n}function s(e,s){var o=t.call(this,e,s);return r(o[0],0,n[0],n[1]/i(o[0])),o}var t=e.layout.hierarchy(),n=[1,1];return s.size=function(e){return arguments.length?(n=e,s):n},hu(s,t)},e.layout.pie=function(){function o(u){var a=u.length,f=u.map(function(e,n){return+t.call(o,e,n)}),l=+(typeof r=="function"?r.apply(this,arguments):r),c=(typeof i=="function"?i.apply(this,arguments):i)-l,h=Math.min(Math.abs(c)/a,+(typeof s=="function"?s.apply(this,arguments):s)),p=h*(c<0?-1:1),d=(c-a*p)/e.sum(f),v=e.range(a),m=[],g;return n!=null&&v.sort(n===bu?function(e,t){return f[t]-f[e]}:function(e,t){return n(u[e],u[t])}),v.forEach(function(e){m[e]={data:u[e],value:g=f[e],startAngle:l,endAngle:l+=g*d+p,padAngle:h}}),m}var t=Number,n=bu,r=0,i=At,s=0;return o.value=function(e){return arguments.length?(t=e,o):t},o.sort=function(e){return arguments.length?(n=e,o):n},o.startAngle=function(e){return arguments.length?(r=e,o):r},o.endAngle=function(e){return arguments.length?(i=e,o):i},o.padAngle=function(e){return arguments.length?(s=e,o):s},o};var bu={};e.layout.stack=function(){function u(a,f){if(!(v=a.length))return a;var l=a.map(function(e,n){return t.call(u,e,n)}),c=l.map(function(e){return e.map(function(e,t){return[s.call(u,e,t),o.call(u,e,t)]})}),h=n.call(u,c,f);l=e.permute(l,h),c=e.permute(c,h);var p=r.call(u,c,f),d=l[0].length,v,m,g,y;for(g=0;g<d;++g){i.call(u,l[0][g],y=p[g],c[0][g][1]);for(m=1;m<v;++m)i.call(u,l[m][g],y+=c[m-1][g][1],c[m][g][1])}return a}var t=D,n=Nu,r=Cu,i=Su,s=wu,o=Eu;return u.values=function(e){return arguments.length?(t=e,u):t},u.order=function(e){return arguments.length?(n=typeof e=="function"?e:xu.get(e)||Nu,u):n},u.offset=function(e){return arguments.length?(r=typeof e=="function"?e:Tu.get(e)||Cu,u):r},u.x=function(e){return arguments.length?(s=e,u):s},u.y=function(e){return arguments.length?(o=e,u):o},u.out=function(e){return arguments.length?(i=e,u):i},u};var xu=e.map({"inside-out":function(t){var n=t.length,r,i,s=t.map(ku),o=t.map(Lu),u=e.range(n).sort(function(e,t){return s[e]-s[t]}),a=0,f=0,l=[],c=[];for(r=0;r<n;++r)i=u[r],a<f?(a+=o[i],l.push(i)):(f+=o[i],c.push(i));return c.reverse().concat(l)},reverse:function(t){return e.range(t.length).reverse()},"default":Nu}),Tu=e.map({silhouette:function(e){var t=e.length,n=e[0].length,r=[],i=0,s,o,u,a=[];for(o=0;o<n;++o){for(s=0,u=0;s<t;s++)u+=e[s][o][1];u>i&&(i=u),r.push(u)}for(o=0;o<n;++o)a[o]=(i-r[o])/2;return a},wiggle:function(e){var t=e.length,n=e[0],r=n.length,i,s,o,u,a,f,l,c,h,p=[];p[0]=c=h=0;for(s=1;s<r;++s){for(i=0,u=0;i<t;++i)u+=e[i][s][1];for(i=0,a=0,l=n[s][0]-n[s-1][0];i<t;++i){for(o=0,f=(e[i][s][1]-e[i][s-1][1])/(2*l);o<i;++o)f+=(e[o][s][1]-e[o][s-1][1])/l;a+=f*e[i][s][1]}p[s]=c-=u?a/u*l:0,c<h&&(h=c)}for(s=0;s<r;++s)p[s]-=h;return p},expand:function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,u=[];for(s=0;s<n;++s){for(i=0,o=0;i<t;i++)o+=e[i][s][1];if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)u[s]=0;return u},zero:Cu});e.layout.histogram=function(){function s(s,o){var u=[],a=s.map(n,this),f=r.call(this,a,o),l=i.call(this,f,a,o),c,o=-1,h=a.length,p=l.length-1,d=t?1:1/h,v;while(++o<p)c=u[o]=[],c.dx=l[o+1]-(c.x=l[o]),c.y=0;if(p>0){o=-1;while(++o<h)v=a[o],v>=f[0]&&v<=f[1]&&(c=u[e.bisect(l,v,1,p)-1],c.y+=d,c.push(s[o]))}return u}var t=!0,n=Number,r=_u,i=Ou;return s.value=function(e){return arguments.length?(n=e,s):n},s.range=function(e){return arguments.length?(r=Tn(e),s):r},s.bins=function(e){return arguments.length?(i=typeof e=="number"?function(t){return Mu(t,e)}:Tn(e),s):i},s.frequency=function(e){return arguments.length?(t=!!e,s):t},s},e.layout.pack=function(){function s(e,s){var o=t.call(this,e,s),u=o[0],a=r[0],f=r[1],l=i==null?Math.sqrt:typeof i=="function"?i:function(){return i};u.x=u.y=0,du(u,function(e){e.r=+l(e.value)}),du(u,ju);if(n){var c=n*(i?1:Math.max(2*u.r/a,2*u.r/f))/2;du(u,function(e){e.r+=c}),du(u,ju),du(u,function(e){e.r-=c})}return qu(u,a/2,f/2,i?1:1/Math.max(2*u.r/a,2*u.r/f)),o}var t=e.layout.hierarchy().sort(Du),n=0,r=[1,1],i;return s.size=function(e){return arguments.length?(r=e,s):r},s.radius=function(e){return arguments.length?(i=e==null||typeof e=="function"?e:+e,s):i},s.padding=function(e){return arguments.length?(n=+e,s):n},hu(s,t)},e.layout.tree=function(){function s(e,s){var f=t.call(this,e,s),c=f[0],h=o(c);du(h,u),h.parent.m=-h.z,pu(h,a);if(i)pu(c,l);else{var p=c,d=c,v=c;pu(c,function(e){e.x<p.x&&(p=e),e.x>d.x&&(d=e),e.depth>v.depth&&(v=e)});var m=n(p,d)/2-p.x,g=r[0]/(d.x+n(d,p)/2+m),y=r[1]/(v.depth||1);pu(c,function(e){e.x=(e.x+m)*g,e.y=e.depth*y})}return f}function o(e){var t={A:null,children:[e]},n=[t],r;while((r=n.pop())!=null)for(var i=r.children,s,o=0,u=i.length;o<u;++o)n.push((i[o]=s={_:i[o],parent:r,children:(s=i[o].children)&&s.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=s);return t.children[0]}function u(e){var t=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(t.length){Vu(e);var s=(t[0].z+t[t.length-1].z)/2;i?(e.z=i.z+n(e._,i._),e.m=e.z-s):e.z=s}else i&&(e.z=i.z+n(e._,i._));e.parent.A=f(e,i,e.parent.A||r[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function f(e,t,r){if(t){var i=e,s=e,o=t,u=i.parent.children[0],a=i.m,f=s.m,l=o.m,c=u.m,h;while(o=Wu(o),i=zu(i),o&&i)u=zu(u),s=Wu(s),s.a=e,h=o.z+l-i.z-a+n(o._,i._),h>0&&(Xu($u(o,e,r),e,h),a+=h,f+=h),l+=o.m,a+=i.m,c+=u.m,f+=s.m;o&&!Wu(s)&&(s.t=o,s.m+=l-f),i&&!zu(u)&&(u.t=i,u.m+=a-c,r=e)}return r}function l(e){e.x*=r[0],e.y=e.depth*r[1]}var t=e.layout.hierarchy().sort(null).value(null),n=Uu,r=[1,1],i=null;return s.separation=function(e){return arguments.length?(n=e,s):n},s.size=function(e){return arguments.length?(i=(r=e)==null?l:null,s):i?null:r},s.nodeSize=function(e){return arguments.length?(i=(r=e)==null?null:l,s):i?r:null},hu(s,t)},e.layout.cluster=function(){function s(e,s){var o=t.call(this,e,s),u=o[0],a,f=0;du(u,function(e){var t=e.children;t&&t.length?(e.x=Ku(t),e.y=Ju(t)):(e.x=a?f+=n(e,a):0,e.y=0,a=e)});var l=Qu(u),c=Gu(u),h=l.x-n(l,c)/2,p=c.x+n(c,l)/2;return du(u,i?function(e){e.x=(e.x-u.x)*r[0],e.y=(u.y-e.y)*r[1]}:function(e){e.x=(e.x-h)/(p-h)*r[0],e.y=(1-(u.y?e.y/u.y:1))*r[1]}),o}var t=e.layout.hierarchy().sort(null).value(null),n=Uu,r=[1,1],i=!1;return s.separation=function(e){return arguments.length?(n=e,s):n},s.size=function(e){return arguments.length?(i=(r=e)==null,s):i?null:r},s.nodeSize=function(e){return arguments.length?(i=(r=e)!=null,s):i?r:null},hu(s,t)},e.layout.treemap=function(){function l(e,t){var n=-1,r=e.length,i,s;while(++n<r)s=(i=e[n]).value*(t<0?0:t),i.area=isNaN(s)||s<=0?0:s}function c(e){var t=e.children;if(t&&t.length){var n=s(e),r=[],i=t.slice(),o,u=Infinity,f,h=a==="slice"?n.dx:a==="dice"?n.dy:a==="slice-dice"?e.depth&1?n.dy:n.dx:Math.min(n.dx,n.dy),v;l(i,n.dx*n.dy/e.value),r.area=0;while((v=i.length)>0)r.push(o=i[v-1]),r.area+=o.area,a!=="squarify"||(f=p(r,h))<=u?(i.pop(),u=f):(r.area-=r.pop().area,d(r,h,n,!1),h=Math.min(n.dx,n.dy),r.length=r.area=0,u=Infinity);r.length&&(d(r,h,n,!0),r.length=r.area=0),t.forEach(c)}}function h(e){var t=e.children;if(t&&t.length){var n=s(e),r=t.slice(),i,o=[];l(r,n.dx*n.dy/e.value),o.area=0;while(i=r.pop())o.push(i),o.area+=i.area,i.z!=null&&(d(o,i.z?n.dx:n.dy,n,!r.length),o.length=o.area=0);t.forEach(h)}}function p(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++o<u){if(!(r=e[o].area))continue;r<s&&(s=r),r>i&&(i=r)}return n*=n,t*=t,n?Math.max(t*i*f/n,n/(t*s*f)):Infinity}function d(e,t,r,i){var s=-1,o=e.length,u=r.x,a=r.y,f=t?n(e.area/t):0,l;if(t==r.dx){if(i||f>r.dy)f=r.dy;while(++s<o)l=e[s],l.x=u,l.y=a,l.dy=f,u+=l.dx=Math.min(r.x+r.dx-u,f?n(l.area/f):0);l.z=!0,l.dx+=r.x+r.dx-u,r.y+=f,r.dy-=f}else{if(i||f>r.dx)f=r.dx;while(++s<o)l=e[s],l.x=u,l.y=a,l.dx=f,a+=l.dy=Math.min(r.y+r.dy-a,f?n(l.area/f):0);l.z=!1,l.dy+=r.y+r.dy-a,r.x+=f,r.dx-=f}}function v(e){var n=u||t(e),i=n[0];return i.x=0,i.y=0,i.dx=r[0],i.dy=r[1],u&&t.revalue(i),l([i],i.dx*i.dy/i.value),(u?h:c)(i),o&&(u=n),n}var t=e.layout.hierarchy(),n=Math.round,r=[1,1],i=null,s=Yu,o=!1,u,a="squarify",f=.5*(1+Math.sqrt(5));return v.size=function(e){return arguments.length?(r=e,v):r},v.padding=function(e){function t(t){var n=e.call(v,t,t.depth);return n==null?Yu(t):Zu(t,typeof n=="number"?[n,n,n,n]:n)}function n(t){return Zu(t,e)}if(!arguments.length)return i;var r;return s=(i=e)==null?Yu:(r=typeof e)==="function"?t:r==="number"?(e=[e,e,e,e],n):n,v},v.round=function(e){return arguments.length?(n=e?Math.round:Number,v):n!=Number},v.sticky=function(e){return arguments.length?(o=e,u=null,v):o},v.ratio=function(e){return arguments.length?(f=e,v):f},v.mode=function(e){return arguments.length?(a=e+"",v):a},hu(v,t)},e.random={normal:function(e,t){var n=arguments.length;return n<2&&(t=1),n<1&&(e=0),function(){var n,r,i;do n=Math.random()*2-1,r=Math.random()*2-1,i=n*n+r*r;while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var n=e.random.irwinHall(t);return function(){return n()/t}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random();return t}}},e.scale={};var sa={floor:D,ceil:D};e.scale.linear=function(){return ua([0,1],[0,1],No,!1)};var pa={s:1,g:1,p:1,r:1,e:1};e.scale.log=function(){return ma(e.scale.linear().domain([0,1]),10,!0,[1,10])};var ga=e.format(".0e"),ya={floor:function(e){return-Math.ceil(-e)},ceil:function(e){return-Math.floor(-e)}};e.scale.pow=function(){return ba(e.scale.linear(),1,[0,1])},e.scale.sqrt=function(){return e.scale.pow().exponent(.5)},e.scale.ordinal=function(){return Ea([],{t:"range",a:[[]]})},e.scale.category10=function(){return e.scale.ordinal().range(Sa)},e.scale.category20=function(){return e.scale.ordinal().range(xa)},e.scale.category20b=function(){return e.scale.ordinal().range(Ta)},e.scale.category20c=function(){return e.scale.ordinal().range(Na)};var Sa=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(vn),xa=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(vn),Ta=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(vn),Na=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(vn);e.scale.quantile=function(){return Ca([],[])},e.scale.quantize=function(){return ka(0,1,[0,1])},e.scale.threshold=function(){return La([.5],[0,1])},e.scale.identity=function(){return Aa([0,1])},e.svg={},e.svg.arc=function(){function u(){var u=Math.max(0,+e.apply(this,arguments)),f=Math.max(0,+t.apply(this,arguments)),l=i.apply(this,arguments)-Mt,c=s.apply(this,arguments)-Mt,h=Math.abs(c-l),p=l>c?0:1;f<u&&(d=f,f=u,u=d);if(h>=Ot)return a(f,p)+(u?a(u,1-p):"")+"Z";var d,v,m,g,y=0,b=0,w,E,S,x,T,N,C,k,L=[];if(g=(+o.apply(this,arguments)||0)/2)m=r===Ma?Math.sqrt(u*u+f*f):+r.apply(this,arguments),p||(b*=-1),f&&(b=jt(m/f*Math.sin(g))),u&&(y=jt(m/u*Math.sin(g)));if(f){w=f*Math.cos(l+b),E=f*Math.sin(l+b),S=f*Math.cos(c-b),x=f*Math.sin(c-b);var A=Math.abs(c-l-2*b)<=Lt?0:1;if(b&&ja(w,E,S,x)===p^A){var O=(l+c)/2;w=f*Math.cos(O),E=f*Math.sin(O),S=x=null}}else w=E=0;if(u){T=u*Math.cos(c-y),N=u*Math.sin(c-y),C=u*Math.cos(l+y),k=u*Math.sin(l+y);var M=Math.abs(l-c+2*y)<=Lt?0:1;if(y&&ja(T,N,C,k)===1-p^M){var _=(l+c)/2;T=u*Math.cos(_),N=u*Math.sin(_),C=k=null}}else T=N=0;if((d=Math.min(Math.abs(f-u)/2,+n.apply(this,arguments)))>.001){v=u<f^p?0:1;var D=C==null?[T,N]:S==null?[w,E]:As([w,E],[C,k],[S,x],[T,N]),P=w-D[0],H=E-D[1],B=S-D[0],j=x-D[1],F=1/Math.sin(Math.acos((P*B+H*j)/(Math.sqrt(P*P+H*H)*Math.sqrt(B*B+j*j)))/2),I=Math.sqrt(D[0]*D[0]+D[1]*D[1]);if(S!=null){var q=Math.min(d,(f-I)/(F+1)),R=Fa(C==null?[T,N]:[C,k],[w,E],f,q,p),U=Fa([S,x],[T,N],f,q,p);d===q?L.push("M",R[0],"A",q,",",q," 0 0,",v," ",R[1],"A",f,",",f," 0 ",1-p^ja(R[1][0],R[1][1],U[1][0],U[1][1]),",",p," ",U[1],"A",q,",",q," 0 0,",v," ",U[0]):L.push("M",R[0],"A",q,",",q," 0 1,",v," ",U[0])}else L.push("M",w,",",E);if(C!=null){var z=Math.min(d,(u-I)/(F-1)),W=Fa([w,E],[C,k],u,-z,p),X=Fa([T,N],S==null?[w,E]:[S,x],u,-z,p);d===z?L.push("L",X[0],"A",z,",",z," 0 0,",v," ",X[1],"A",u,",",u," 0 ",p^ja(X[1][0],X[1][1],W[1][0],W[1][1]),",",1-p," ",W[1],"A",z,",",z," 0 0,",v," ",W[0]):L.push("L",X[0],"A",z,",",z," 0 0,",v," ",W[0])}else L.push("L",T,",",N)}else L.push("M",w,",",E),S!=null&&L.push("A",f,",",f," 0 ",A,",",p," ",S,",",x),L.push("L",T,",",N),C!=null&&L.push("A",u,",",u," 0 ",M,",",1-p," ",C,",",k);return L.push("Z"),L.join("")}function a(e,t){return"M0,"+e+"A"+e+","+e+" 0 1,"+t+" 0,"+ -e+"A"+e+","+e+" 0 1,"+t+" 0,"+e}var e=_a,t=Da,n=Oa,r=Ma,i=Pa,s=Ha,o=Ba;return u.innerRadius=function(t){return arguments.length?(e=Tn(t),u):e},u.outerRadius=function(e){return arguments.length?(t=Tn(e),u):t},u.cornerRadius=function(e){return arguments.length?(n=Tn(e),u):n},u.padRadius=function(e){return arguments.length?(r=e==Ma?Ma:Tn(e),u):r},u.startAngle=function(e){return arguments.length?(i=Tn(e),u):i},u.endAngle=function(e){return arguments.length?(s=Tn(e),u):s},u.padAngle=function(e){return arguments.length?(o=Tn(e),u):o},u.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +s.apply(this,arguments))/2-Mt;return[Math.cos(r)*n,Math.sin(r)*n]},u};var Ma="auto";e.svg.line=function(){return Ia(D)};var qa=e.map({linear:Ra,"linear-closed":Ua,step:za,"step-before":Wa,"step-after":Xa,basis:Ga,"basis-open":Ya,"basis-closed":Za,bundle:ef,cardinal:Ja,"cardinal-open":Va,"cardinal-closed":$a,monotone:lf});qa.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var nf=[0,2/3,1/3,0],rf=[0,1/3,2/3,0],sf=[0,1/6,2/3,1/6];e.svg.line.radial=function(){var e=Ia(cf);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},Wa.reverse=Xa,Xa.reverse=Wa,e.svg.area=function(){return hf(D)},e.svg.area.radial=function(){var e=hf(cf);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},e.svg.chord=function(){function s(n,r){var i=o(this,e,n,r),s=o(this,t,n,r);return"M"+i.p0+a(i.r,i.p1,i.a1-i.a0)+(u(i,s)?f(i.r,i.p1,i.r,i.p0):f(i.r,i.p1,s.r,s.p0)+a(s.r,s.p1,s.a1-s.a0)+f(s.r,s.p1,i.r,i.p0))+"Z"}function o(e,t,s,o){var u=t.call(e,s,o),a=n.call(e,u,o),f=r.call(e,u,o)-Mt,l=i.call(e,u,o)-Mt;return{r:a,a0:f,a1:l,p0:[a*Math.cos(f),a*Math.sin(f)],p1:[a*Math.cos(l),a*Math.sin(l)]}}function u(e,t){return e.a0==t.a0&&e.a1==t.a1}function a(e,t,n){return"A"+e+","+e+" 0 "+ +(n>Lt)+",1 "+t}function f(e,t,n,r){return"Q 0,0 "+r}var e=os,t=us,n=pf,r=Pa,i=Ha;return s.radius=function(e){return arguments.length?(n=Tn(e),s):n},s.source=function(t){return arguments.length?(e=Tn(t),s):e},s.target=function(e){return arguments.length?(t=Tn(e),s):t},s.startAngle=function(e){return arguments.length?(r=Tn(e),s):r},s.endAngle=function(e){return arguments.length?(i=Tn(e),s):i},s},e.svg.diagonal=function(){function r(r,i){var s=e.call(this,r,i),o=t.call(this,r,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];return a=a.map(n),"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var e=os,t=us,n=df;return r.source=function(t){return arguments.length?(e=Tn(t),r):e},r.target=function(e){return arguments.length?(t=Tn(e),r):t},r.projection=function(e){return arguments.length?(n=e,r):n},r},e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),n=df,r=t.projection;return t.projection=function(e){return arguments.length?r(vf(n=e)):n},t},e.svg.symbol=function(){function n(n,r){return(bf.get(e.call(this,n,r))||yf)(t.call(this,n,r))}var e=gf,t=mf;return n.type=function(t){return arguments.length?(e=Tn(t),n):e},n.size=function(e){return arguments.length?(t=Tn(e),n):t},n};var bf=e.map({circle:yf,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Ef)),n=t*Ef;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/wf),n=t*wf/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/wf),n=t*wf/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});e.svg.symbolTypes=bf.keys();var wf=Math.sqrt(3),Ef=Math.tan(30*_t);K.transition=function(e){var t=kf||++Cf,n=Mf(e),r=[],i,s,o=Lf||{time:Date.now(),ease:Ho,delay:0,duration:250};for(var u=-1,a=this.length;++u<a;){r.push(i=[]);for(var f=this[u],l=-1,c=f.length;++l<c;)(s=f[l])&&_f(s,l,n,t,o),i.push(s)}return Tf(r,n,t)},K.interrupt=function(e){return this.each(e==null?Sf:xf(Mf(e)))};var Sf=xf(Mf()),Nf=[],Cf=0,kf,Lf;Nf.call=K.call,Nf.empty=K.empty,Nf.node=K.node,Nf.size=K.size,e.transition=function(t,n){return t&&t.transition?kf?t.transition(n):t:e.selection().transition(t)},e.transition.prototype=Nf,Nf.select=function(e){var t=this.id,n=this.namespace,r=[],i,s,o;e=Q(e);for(var u=-1,a=this.length;++u<a;){r.push(i=[]);for(var f=this[u],l=-1,c=f.length;++l<c;)(o=f[l])&&(s=e.call(o,o.__data__,l,u))?("__data__"in o&&(s.__data__=o.__data__),_f(s,l,n,t,o[n][t]),i.push(s)):i.push(null)}return Tf(r,n,t)},Nf.selectAll=function(e){var t=this.id,n=this.namespace,r=[],i,s,o,u,a;e=G(e);for(var f=-1,l=this.length;++f<l;)for(var c=this[f],h=-1,p=c.length;++h<p;)if(o=c[h]){a=o[n][t],s=e.call(o,o.__data__,h,f),r.push(i=[]);for(var d=-1,v=s.length;++d<v;)(u=s[d])&&_f(u,d,n,t,a),i.push(u)}return Tf(r,n,t)},Nf.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=lt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]);for(var r=this[s],u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i,i.__data__,u,s)&&n.push(i)}return Tf(t,this.namespace,this.id)},Nf.tween=function(e,t){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(e):ht(this,t==null?function(t){t[r][n].tween.remove(e)}:function(i){i[r][n].tween.set(e,t)})},Nf.attr=function(t,n){function s(){this.removeAttribute(i)}function o(){this.removeAttributeNS(i.space,i.local)}function u(e){return e==null?s:(e+="",function(){var t=this.getAttribute(i),n;return t!==e&&(n=r(t,e),function(e){this.setAttribute(i,n(e))})})}function a(e){return e==null?o:(e+="",function(){var t=this.getAttributeNS(i.space,i.local),n;return t!==e&&(n=r(t,e),function(e){this.setAttributeNS(i.space,i.local,n(e))})})}if(arguments.length<2){for(n in t)this.attr(n,t[n]);return this}var r=t=="transform"?Yo:No,i=e.ns.qualify(t);return Af(this,"attr."+t,n,i.local?a:u)},Nf.attrTween=function(t,n){function i(e,t){var i=n.call(this,e,t,this.getAttribute(r));return i&&function(e){this.setAttribute(r,i(e))}}function s(e,t){var i=n.call(this,e,t,this.getAttributeNS(r.space,r.local));return i&&function(e){this.setAttributeNS(r.space,r.local,i(e))}}var r=e.ns.qualify(t);return this.tween("attr."+t,r.local?s:i)},Nf.style=function(e,t,n){function i(){this.style.removeProperty(e)}function o(t){return t==null?i:(t+="",function(){var r=s(this).getComputedStyle(this,null).getPropertyValue(e),i;return r!==t&&(i=No(r,t),function(t){this.style.setProperty(e,i(t),n)})})}var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t="");for(n in e)this.style(n,e[n],t);return this}n=""}return Af(this,"style."+e,t,o)},Nf.styleTween=function(e,t,n){function r(r,i){var o=t.call(this,r,i,s(this).getComputedStyle(this,null).getPropertyValue(e));return o&&function(t){this.style.setProperty(e,o(t),n)}}return arguments.length<3&&(n=""),this.tween("style."+e,r)},Nf.text=function(e){return Af(this,"text",e,Of)},Nf.remove=function(){var e=this.namespace;return this.each("end.transition",function(){var t;this[e].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Nf.ease=function(t){var n=this.id,r=this.namespace;return arguments.length<1?this.node()[r][n].ease:(typeof t!="function"&&(t=e.ease.apply(e,arguments)),ht(this,function(e){e[r][n].ease=t}))},Nf.delay=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].delay:ht(this,typeof e=="function"?function(r,i,s){r[n][t].delay=+e.call(r,r.__data__,i,s)}:(e=+e,function(r){r[n][t].delay=e}))},Nf.duration=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].duration:ht(this,typeof e=="function"?function(r,i,s){r[n][t].duration=Math.max(1,e.call(r,r.__data__,i,s))}:(e=Math.max(1,e),function(r){r[n][t].duration=e}))},Nf.each=function(t,n){var r=this.id,i=this.namespace;if(arguments.length<2){var s=Lf,o=kf;try{kf=r,ht(this,function(e,n,s){Lf=e[i][r],t.call(e,e.__data__,n,s)})}finally{Lf=s,kf=o}}else ht(this,function(s){var o=s[i][r];(o.event||(o.event=e.dispatch("start","end","interrupt"))).on(t,n)});return this},Nf.transition=function(){var e=this.id,t=++Cf,n=this.namespace,r=[],i,s,o,u;for(var a=0,f=this.length;a<f;a++){r.push(i=[]);for(var s=this[a],l=0,c=s.length;l<c;l++){if(o=s[l])u=o[n][e],_f(o,l,n,t,{time:u.time,ease:u.ease,delay:u.delay+u.duration,duration:u.duration});i.push(o)}}return Tf(r,n,t)},e.svg.axis=function(){function f(f){f.each(function(){var f=e.select(this),l=this.__chart__||t,c=this.__chart__=t.copy(),h=u==null?c.ticks?c.ticks.apply(c,o):c.domain():u,p=a==null?c.tickFormat?c.tickFormat.apply(c,o):D:a,d=f.selectAll(".tick").data(h,c),v=d.enter().insert("g",".domain").attr("class","tick").style("opacity",Ct),m=e.transition(d.exit()).style("opacity",Ct).remove(),g=e.transition(d.order()).style("opacity",1),y=Math.max(r,0)+s,b,w=ta(c),E=f.selectAll(".domain").data([0]),S=(E.enter().append("path").attr("class","domain"),e.transition(E));v.append("line"),v.append("text");var x=v.select("line"),T=g.select("line"),N=d.select("text").text(p),C=v.select("text"),k=g.select("text"),L=n==="top"||n==="left"?-1:1,A,O,M,_;n==="bottom"||n==="top"?(b=Hf,A="x",M="y",O="x2",_="y2",N.attr("dy",L<0?"0em":".71em").style("text-anchor","middle"),S.attr("d","M"+w[0]+","+L*i+"V0H"+w[1]+"V"+L*i)):(b=Bf,A="y",M="x",O="y2",_="x2",N.attr("dy",".32em").style("text-anchor",L<0?"end":"start"),S.attr("d","M"+L*i+","+w[0]+"H0V"+w[1]+"H"+L*i)),x.attr(_,L*r),C.attr(M,L*y),T.attr(O,0).attr(_,L*r),k.attr(A,0).attr(M,L*y);if(c.rangeBand){var P=c,H=P.rangeBand()/2;l=c=function(e){return P(e)+H}}else l.rangeBand?l=c:m.call(b,c,l);v.call(b,l,c),g.call(b,c,c)})}var t=e.scale.linear(),n=Df,r=6,i=6,s=3,o=[10],u=null,a;return f.scale=function(e){return arguments.length?(t=e,f):t},f.orient=function(e){return arguments.length?(n=e in Pf?e+"":Df,f):n},f.ticks=function(){return arguments.length?(o=arguments,f):o},f.tickValues=function(e){return arguments.length?(u=e,f):u},f.tickFormat=function(e){return arguments.length?(a=e,f):a},f.tickSize=function(e){var t=arguments.length;return t?(r=+e,i=+arguments[t-1],f):r},f.innerTickSize=function(e){return arguments.length?(r=+e,f):r},f.outerTickSize=function(e){return arguments.length?(i=+e,f):i},f.tickPadding=function(e){return arguments.length?(s=+e,f):s},f.tickSubdivide=function(){return arguments.length&&f},f};var Df="bottom",Pf={top:1,right:1,bottom:1,left:1};e.svg.brush=function(){function h(t){t.each(function(){var t=e.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",m).on("touchstart.brush",m),i=t.selectAll(".background").data([0]);i.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 s=t.selectAll(".resize").data(c,D);s.exit().remove(),s.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return jf[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",h.empty()?"none":null);var o=e.transition(t),u=e.transition(i),a;n&&(a=ta(n),u.attr("x",a[0]).attr("width",a[1]-a[0]),d(o)),r&&(a=ta(r),u.attr("y",a[0]).attr("height",a[1]-a[0]),v(o)),p(o)})}function p(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+i[+/e$/.test(e)]+","+o[+/^s/.test(e)]+")"})}function d(e){e.select(".extent").attr("x",i[0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",i[1]-i[0])}function v(e){e.select(".extent").attr("y",o[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",o[1]-o[0])}function m(){function O(){e.event.keyCode==32&&(S||(T=null,N[0]-=i[1],N[1]-=o[1],S=2),q())}function M(){e.event.keyCode==32&&S==2&&(N[0]+=i[1],N[1]+=o[1],S=0,q())}function _(){var t=e.mouse(c),s=!1;C&&(t[0]+=C[0],t[1]+=C[1]),S||(e.event.altKey?(T||(T=[(i[0]+i[1])/2,(o[0]+o[1])/2]),N[0]=i[+(t[0]<T[0])],N[1]=o[+(t[1]<T[1])]):T=null),w&&D(t,n,0)&&(d(y),s=!0),E&&D(t,r,1)&&(v(y),s=!0),s&&(p(y),g({type:"brush",mode:S?"move":"resize"}))}function D(e,t,n){var r=ta(t),s=r[0],c=r[1],h=N[n],p=n?o:i,d=p[1]-p[0],v,m;S&&(s-=h,c-=d+h),v=(n?l:f)?Math.max(s,Math.min(c,e[n])):e[n],S?m=(v+=h)+d:(T&&(h=Math.max(s,Math.min(c,2*T[n]-v))),h<v?(m=v,v=h):m=h);if(p[0]!=v||p[1]!=m)return n?a=null:u=null,p[0]=v,p[1]=m,!0}function P(){_(),y.style("pointer-events","all").selectAll(".resize").style("display",h.empty()?"none":null),e.select("body").style("cursor",null),k.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),x(),g({type:"brushend"})}var c=this,m=e.select(e.event.target),g=t.of(c,arguments),y=e.select(c),b=m.datum(),w=!/^(n|s)$/.test(b)&&n,E=!/^(e|w)$/.test(b)&&r,S=m.classed("extent"),x=St(c),T,N=e.mouse(c),C,k=e.select(s(c)).on("keydown.brush",O).on("keyup.brush",M);e.event.changedTouches?k.on("touchmove.brush",_).on("touchend.brush",P):k.on("mousemove.brush",_).on("mouseup.brush",P),y.interrupt().selectAll("*").interrupt();if(S)N[0]=i[0]-N[0],N[1]=o[0]-N[1];else if(b){var L=+/w$/.test(b),A=+/^n/.test(b);C=[i[1-L]-N[0],o[1-A]-N[1]],N[0]=i[L],N[1]=o[A]}else e.event.altKey&&(T=N.slice());y.style("pointer-events","none").selectAll(".resize").style("display",null),e.select("body").style("cursor",m.style("cursor")),g({type:"brushstart"}),_()}var t=U(h,"brushstart","brush","brushend"),n=null,r=null,i=[0,0],o=[0,0],u,a,f=!0,l=!0,c=Ff[0];return h.event=function(n){n.each(function(){var n=t.of(this,arguments),r={x:i,y:o,i:u,j:a},s=this.__chart__||r;this.__chart__=r,kf?e.select(this).transition().each("start.brush",function(){u=s.i,a=s.j,i=s.x,o=s.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=Co(i,r.x),t=Co(o,r.y);return u=a=null,function(s){i=r.x=e(s),o=r.y=t(s),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){u=r.i,a=r.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},h.x=function(e){return arguments.length?(n=e,c=Ff[!n<<1|!r],h):n},h.y=function(e){return arguments.length?(r=e,c=Ff[!n<<1|!r],h):r},h.clamp=function(e){return arguments.length?(n&&r?(f=!!e[0],l=!!e[1]):n?f=!!e:r&&(l=!!e),h):n&&r?[f,l]:n?f:r?l:null},h.extent=function(e){var t,s,f,l,c;if(!arguments.length)return n&&(u?(t=u[0],s=u[1]):(t=i[0],s=i[1],n.invert&&(t=n.invert(t),s=n.invert(s)),s<t&&(c=t,t=s,s=c))),r&&(a?(f=a[0],l=a[1]):(f=o[0],l=o[1],r.invert&&(f=r.invert(f),l=r.invert(l)),l<f&&(c=f,f=l,l=c))),n&&r?[[t,f],[s,l]]:n?[t,s]:r&&[f,l];if(n){t=e[0],s=e[1],r&&(t=t[0],s=s[0]),u=[t,s],n.invert&&(t=n(t),s=n(s)),s<t&&(c=t,t=s,s=c);if(t!=i[0]||s!=i[1])i=[t,s]}if(r){f=e[0],l=e[1],n&&(f=f[1],l=l[1]),a=[f,l],r.invert&&(f=r(f),l=r(l)),l<f&&(c=f,f=l,l=c);if(f!=o[0]||l!=o[1])o=[f,l]}return h},h.clear=function(){return h.empty()||(i=[0,0],o=[0,0],u=a=null),h},h.empty=function(){return!!n&&i[0]==i[1]||!!r&&o[0]==o[1]},e.rebind(h,t,"on")};var jf={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ff=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],If=Xn.format=Er.timeFormat,qf=If.utc,Rf=qf("%Y-%m-%dT%H:%M:%S.%LZ");If.iso=Date.prototype.toISOString&&+(new Date("2000-01-01T00:00:00.000Z"))?Uf:Rf,Uf.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Uf.toString=Rf.toString,Xn.second=Kn(function(e){return new Vn(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()}),Xn.seconds=Xn.second.range,Xn.seconds.utc=Xn.second.utc.range,Xn.minute=Kn(function(e){return new Vn(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()}),Xn.minutes=Xn.minute.range,Xn.minutes.utc=Xn.minute.utc.range,Xn.hour=Kn(function(e){var t=e.getTimezoneOffset()/60;return new Vn((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()}),Xn.hours=Xn.hour.range,Xn.hours.utc=Xn.hour.utc.range,Xn.month=Kn(function(e){return e=Xn.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),Xn.months=Xn.month.range,Xn.months.utc=Xn.month.utc.range;var Xf=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Vf=[[Xn.second,1],[Xn.second,5],[Xn.second,15],[Xn.second,30],[Xn.minute,1],[Xn.minute,5],[Xn.minute,15],[Xn.minute,30],[Xn.hour,1],[Xn.hour,3],[Xn.hour,6],[Xn.hour,12],[Xn.day,1],[Xn.day,2],[Xn.week,1],[Xn.month,1],[Xn.month,3],[Xn.year,1]],$f=If.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&e.getDate()!=1}],["%b %d",function(e){return e.getDate()!=1}],["%B",function(e){return e.getMonth()}],["%Y",oi]]),Jf={range:function(t,n,r){return e.range(Math.ceil(t/r)*r,+n,r).map(Wf)},floor:D,ceil:D};Vf.year=Xn.year,Xn.scale=function(){return zf(e.scale.linear(),Vf,$f)};var Kf=Vf.map(function(e){return[e[0].utc,e[1]]}),Qf=qf.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],["%b %d",function(e){return e.getUTCDate()!=1}],["%B",function(e){return e.getUTCMonth()}],["%Y",oi]]);Kf.year=Xn.year.utc,Xn.scale.utc=function(){return zf(e.scale.linear(),Kf,Qf)},e.text=Nn(function(e){return e.responseText}),e.json=function(e,t){return Cn(e,"application/json",Gf,t)},e.html=function(e,t){return Cn(e,"text/html",Yf,t)},e.xml=Nn(function(e){return e.responseXML}),typeof define=="function"&&define.amd?define("d3",e):typeof module=="object"&&module.exports&&(module.exports=e),this.d3=e}(),define("js/util/system",["require","exports","module"],function(e,t){"use strict";var n=window.navigator.platform.indexOf("Mac")===0;t.isMac=n}),define("js/scrim/TransformScrim",["require","exports","module","d3","immutable","js/util/system"],function(e,t,n){"use strict";var r=e("d3"),i=e("immutable"),s=e("js/util/system"),o=1,u=function(e,t){this._flux=t,this._dragging=!1;var n=r.select(e);n.append("g").classed("transform-control-group",!0),n.append("g").classed("selection-bounds",!0),n.append("g").classed("rotation-compass",!0)};u.prototype._buildBoundsData=function(e){var t=s.isMac?0:this._scale;return e.map(function(e){return!e||e.width===0&&e.height===0?[]:[{x:e.left+t,y:e.top+t,key:"nw"},{x:e.left+t+e.width/2,y:e.top+t,key:"n"},{x:e.right+t,y:e.top+t,key:"ne"},{x:e.right+t,y:e.top+t+e.height/2,key:"e"},{x:e.right+t,y:e.bottom+t,key:"se"},{x:e.left+t+e.width/2,y:e.bottom+t,key:"s"},{x:e.left+t,y:e.bottom+t,key:"sw"},{x:e.left+t,y:e.top+t+e.height/2,key:"w"}]})},u.prototype.update=function(e,t,n){if(this._dragging&&!n)return;var i=r.select(e),s=r.transform(r.select(e).attr("transform"));this._scale=1/s.scale[0],i.selectAll(".transform-control-group").attr("transform",null),i.selectAll(".anchor-points").remove(),i.selectAll(".rotate-areas").remove(),i.selectAll(".selection-bounds").remove(),i.selectAll(".selection-parent-bounds").remove();if(!t.bounds||t.hidden)return;this._oldBounds=this._bounds,this._bounds=t.bounds,this._el=e;var o=this._buildBoundsData([this._bounds.normalize()])[0];if(t.parentBounds){var u=this._buildBoundsData(t.parentBounds);this._drawParentBounds(u)}t.noRotation||this._drawRotationCorners(o),this._drawSelectionBounds(o),t.noResize||this._drawResizeAnchors(o)},u.prototype.destroy=function(e){r.select(e).selectAll(".transform-control-group").remove()},u.prototype.clear=function(e){r.select(e).selectAll(".transform-control-group").selectAll("*").remove()},u.prototype._startResizing=function(e){if(r.event.sourceEvent.which!==o)return;this._dragging=!0,this._dragCorner=e.key,this._initialBounds=this._bounds,this._quadrantBounds=this._bounds},u.prototype._startRotating=function(e){if(r.event.sourceEvent.which!==o)return;this._dragging=!0,r.select(this._el).selectAll(".selection-parent-bounds").remove(),r.select("#"+e.key+"-resize").classed("anchor-dragging",!0),this._initialBounds=this._bounds,this._currentAngle=0,this._initialAngle=Math.atan2(e.y-this._initialBounds.yCenter,e.x-this._initialBounds.xCenter)*180/Math.PI},u.prototype._rotateBounds=function(){if(!this._dragging)return;var e=r.event.sourceEvent.shiftKey,t=r.event.x-this._initialBounds.xCenter,n=r.event.y-this._initialBounds.yCenter,i=Math.atan2(n,t)*180/Math.PI,s=(this._currentAngle+i-this._initialAngle)%360;e&&(s=Math.round(s/45)*45),s=s===0?0:s,this._currentAngle=s;var o="rotate("+s+" "+this._initialBounds.xCenter+","+this._initialBounds.yCenter+")";r.select(this._el).selectAll(".transform-control-group").attr("transform",o),this._drawCompass(s)},u.prototype._simpleDragBounds=function(e){var t=this._initialBounds;switch(e){case"nw":t=this._initialBounds.merge({left:r.event.x,top:r.event.y});break;case"n":t=this._initialBounds.set("top",r.event.y);break;case"ne":t=this._initialBounds.merge({right:r.event.x,top:r.event.y});break;case"e":t=this._initialBounds.set("right",r.event.x);break;case"se":t=this._initialBounds.merge({right:r.event.x,bottom:r.event.y});break;case"s":t=this._initialBounds.set("bottom",r.event.y);break;case"sw":t=this._initialBounds.merge({left:r.event.x,bottom:r.event.y});break;case"w":t=this._initialBounds.set("left",r.event.x)}return t},u.prototype._updateDragCorner=function(e,t){var n=e.normalize(),i;t?(i={left:this._initialBounds.xCenter,right:this._initialBounds.xCenter,top:this._initialBounds.yCenter,bottom:this._initialBounds.yCenter},r.event.x>=i.right&&(this._dragCorner=this._dragCorner.replace("w","e")),r.event.x<=i.right&&(this._dragCorner=this._dragCorner.replace("e","w")),r.event.y>=i.bottom&&(this._dragCorner=this._dragCorner.replace("n","s")),r.event.y<=i.bottom&&(this._dragCorner=this._dragCorner.replace("s","n"))):(i=this._quadrantBounds,n.left>=i.right&&(this._dragCorner=this._dragCorner.replace("w","e"),this._quadrantBounds=this._quadrantBounds.merge({left:this._quadrantBounds.right,right:this._quadrantBounds.right+this._quadrantBounds.width})),n.right<=i.left&&(this._dragCorner=this._dragCorner.replace("e","w"),this._quadrantBounds=this._quadrantBounds.merge({right:this._quadrantBounds.left,left:this._quadrantBounds.left-this._quadrantBounds.width})),n.top>=i.bottom&&(this._dragCorner=this._dragCorner.replace("n","s"),this._quadrantBounds=this._quadrantBounds.merge({top:this._quadrantBounds.bottom,bottom:this._quadrantBounds.bottom+this._quadrantBounds.height})),n.bottom<=i.top&&(this._dragCorner=this._dragCorner.replace("s","n"),this._quadrantBounds=this._quadrantBounds.merge({bottom:this._quadrantBounds.top,top:this._quadrantBounds.top-this._quadrantBounds.height})))},u.prototype._calculateModifiedBounds=function(e,t,n,r){if(!n&&!r)return e;var i=e.width,s=e.height,o=0,u=0,a=e;if(n)switch(t){case"n":case"e":case"s":case"w":var f=0;if(t==="n"||t==="s")f=e.height/this._initialBounds.height,i=this._initialBounds.width*f;else if(t==="e"||t==="w")f=e.width/this._initialBounds.width,s=this._initialBounds.height*f;break;case"nw":case"ne":case"se":case"sw":var l=e.width/this._initialBounds.width,c=e.height/this._initialBounds.height,h=this._initialBounds.width/this._initialBounds.height,p=r?1:Math.sign(c)*Math.sign(l);c<l?i=p*e.height*h:s=p*e.width/h}o=s-this._initialBounds.height,u=i-this._initialBounds.width;switch(t){case"nw":n&&(a=a.merge({left:a.right-i,top:a.bottom-s})),r&&(a=a.merge({bottom:a.bottom+o,right:a.right+u}));break;case"n":n&&(a=a.merge({left:a.left-u/2,right:a.right+u/2})),r&&(a=a.set("bottom",this._initialBounds.bottom+o));break;case"ne":n&&(a=a.merge({right:a.left+i,top:a.bottom-s})),r&&(a=a.merge({bottom:a.bottom+o,left:a.left-u}));break;case"e":n&&(a=a.merge({top:a.top-o/2,bottom:a.bottom+o/2})),r&&(a=a.set("left",this._initialBounds.left-u));break;case"se":n&&(a=a.merge({right:a.left+i,bottom:a.top+s})),r&&(a=a.merge({top:a.top-o,left:a.left-u}));break;case"s":n&&(a=a.merge({left:a.left-u/2,right:a.right+u/2})),r&&(a=a.set("top",this._initialBounds.top-o));break;case"sw":n&&(a=a.merge({left:a.right-i,bottom:a.top+s})),r&&(a=a.merge({top:a.top-o,right:a.right+u}));break;case"w":n&&(a=a.merge({top:a.top-o/2,bottom:a.bottom+o/2})),r&&(a=a.set("right",this._initialBounds.right+u))}return a},u.prototype._resizeBounds=function(e){if(!this._dragging)return;var t=this._flux.store("application").getCurrentDocument(),n=t.layers.selected,s=n.some(function(e){return e.proportionalScaling}),o=r.event.sourceEvent.shiftKey||s,u=r.event.sourceEvent.altKey,a=this._simpleDragBounds(e.key);this._updateDragCorner(a,u);var f=this._calculateModifiedBounds(a,e.key,o,u),l=this._flux.store("application"),c=l.getCurrentDocument(),h=c?c.layers.selected:i.List(),p=h.some(function(e){return e.kind===e.layerKinds.GROUP});p||this._flux.actions.transform.setDragBoundsThrottled(c,f),this.update(this._el,{bounds:f},!0)},u.prototype._finishRotating=function(e){if(!this._dragging)return;this._dragging=!1,this._initialBounds=null,this._initialAngle=0,r.select("#"+e.key+"-resize").classed("anchor-dragging",!1),r.select(this._el).selectAll(".rotation-compass-part").remove();var t=this._flux.store("application"),n=t.getCurrentDocument();this._flux.actions.transform.rotate(n,this._currentAngle),this._currentAngle=0,this._dragCorner=null},u.prototype._finishResizing=function(){if(!this._dragging)return;r.select("#"+this._dragCorner+"-resize").classed("anchor-dragging",!1),this._dragging=!1,this._initialBounds=null,this._quadrantBounds=null,this._dragCorner=null;var e=this._flux.store("application"),t=e.getCurrentDocument();this._flux.actions.transform.setBounds(t,this._oldBounds,this._bounds)},u.prototype._drawRotationCorners=function(e){var t=r.select(this._el).selectAll(".transform-control-group"),n=t.selectAll(".rotate-anchor").data(e,function(e){return e.key}),i=this._scale,s=r.behavior.drag().origin(function(e){return e}).on("dragstart",this._startRotating.bind(this)).on("drag",this._rotateBounds.bind(this)).on("dragend",this._finishRotating.bind(this)),o=this._flux.store("ui").getRootSize(),u=.25*o,a=1*o,f=function(e){var t,n;switch(e.key){case"nw":t=3,n=4;break;case"ne":t=0,n=1;break;case"se":t=1,n=2;break;case"sw":t=2,n=3;break;default:t=0,n=0}t=t*Math.PI/2,n=n*Math.PI/2;var s=r.svg.arc().innerRadius(u*i).outerRadius(a*i).startAngle(t).endAngle(n);return s(e)};n.enter().append("path").classed("rotate-areas",!0).attr("d",function(e){return f(e)}).attr("id",function(e){return e.key+"-rotate"}).attr("transform",function(e){return"translate("+e.x+","+e.y+")"}).on("mouseover",function(){r.select(this).classed("rotate-area-hover",!0)}).on("mouseout",function(){r.select(this).classed("rotate-area-hover",!1)}).on("mousedown",function(){r.event.stopPropagation()}).call(s),n.exit().remove()},u.prototype._drawParentBounds=function(e){var t=r.select(this._el).selectAll(".transform-control-group"),n=t.selectAll(".parent-bounds").data(e.toArray()),i=1;n.enter().append("polygon").attr("points",function(e){return e.map(function(e){return[e.x,e.y].join(",")}).join(" ")}).classed("selection-parent-bounds",!0).style("stroke-width",i*this._scale).style("pointer-events","none"),n.exit().remove()},u.prototype._drawSelectionBounds=function(e){var t=r.select(this._el).selectAll(".transform-control-group"),n=t.selectAll(".transform-bounds").data([e]),i=1.5;n.enter().append("polygon").attr("points",function(e){return e.map(function(e){return[e.x,e.y].join(",")}).join(" ")}).classed("selection-bounds",!0).style("stroke-width",i*this._scale).style("pointer-events","none"),n.exit().remove()},u.prototype._drawResizeAnchors=function(e){var t=r.select(this._el).selectAll(".transform-control-group"),n=t.selectAll(".transform-anchor").data(e,function(e){return e.key}),i=this._scale,s=this._dragCorner,o=this._flux.store("ui").getRootSize(),u=.35*o,a=.5*o,f=1,l=r.behavior.drag().origin(function(e){return e}).on("dragstart",this._startResizing.bind(this)).on("drag",this._resizeBounds.bind(this)).on("dragend",this._finishResizing.bind(this));n.enter().append("circle").classed("anchor-points",!0).classed("anchor-dragging",function(e){return e.key===s}).attr("id",function(e){return e.key+"-resize"}).attr("cx",function(e){return e.x}).attr("cy",function(e){return e.y}).attr("r",u*i).style("stroke-width",f*i).style("cursor",function(e){return e.key+"-resize"}).on("mouseover",function(){r.select(this).attr("r",a*i).classed("anchor-hover",!0)}).on("mouseout",function(){r.select(this).attr("r",u*i).classed("anchor-hover",!1)}).on("mousedown",function(){r.event.stopPropagation()}).call(l),n.exit().remove()},u.prototype._drawCompass=function(e){var t=r.select(this._el).selectAll(".rotation-compass"),n="rotate("+e+" "+this._initialBounds.xCenter+" "+this._initialBounds.yCenter+")",i=this._scale,s=this._initialBounds.xCenter,o=this._initialBounds.yCenter;t.selectAll(".rotation-compass-part").remove();var u=this._flux.store("ui").getRootSize(),a=1,f=2.083*u,l=.833*u,c=.833*u,h=.417*u,p=r.svg.arc().innerRadius(0).outerRadius(f*i).startAngle(Math.PI/2).endAngle((e+90)*Math.PI/180);t.append("line").classed("rotation-compass-part",!0).classed("rotation-compass-horizon",!0).attr("x1",this._initialBounds.left-l*i).attr("y1",o).attr("x2",this._initialBounds.right+l*i).attr("y2",o).style("stroke-width",a*i),t.append("line").classed("rotation-compass-part",!0).classed("rotation-compass-horizon",!0).attr("x1",s).attr("y1",o-c*i).attr("x2",s).attr("y2",o+c*i).style("stroke-width",a*i),this._initialBounds.width/2>f*i&&t.append("circle").classed("rotation-compass-part",!0).classed("rotation-compass-circle",!0).attr("cx",s).attr("cy",o).attr("r",f*i).style("stroke-width",a*i),t.append("path").classed("rotation-compass-part",!0).classed("rotation-compass-arc",!0).attr("d",p()).attr("transform",function(){return"translate("+s+","+o+")"}).style("stroke-width",a*i),t.append("circle").classed("rotation-compass-part",!0).classed("rotation-compass-center",!0).attr("cx",s).attr("cy",o).attr("r",h*i).style("stroke-width",a*i),t.append("line").classed("rotation-compass-part",!0).classed("rotation-compass-rotate-line",!0).attr("x1",s).attr("y1",o).attr("x2",this._initialBounds.right+l*i).attr("y2",o).attr("transform",n).style("stroke-width",a*i)},u.prototype._bounds=null,u.prototype._oldBounds=null,u.prototype._el=null,u.prototype._flux=null,u.prototype._initialBounds=null,u.prototype._quadrantBounds=null,u.prototype._initialAngle=0,u.prototype._currentAngle=0,u.prototype._scale=null,u.prototype._dragCorner=null,u.prototype._dragging=null,n.exports=u}),define("jsx!js/jsx/tools/TransformOverlay",["require","exports","module","react","fluxxor","immutable","lodash","js/models/bounds","js/scrim/TransformScrim"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=i.StoreWatchMixin,u=e("immutable"),a=e("lodash"),f=e("js/models/bounds"),l=e("js/scrim/TransformScrim"),c=!1,h=200,p=r.createClass({displayName:"TransformOverlay",mixins:[s,o("tool","document","application","ui")],_transformScrim:null,_drawDebounced:null,getStateFromFlux:function(){var e=this.getFlux(),t=e.store("application"),n=e.store("tool"),r=t.getCurrentDocument(),i=r?r.layers.selected:u.List(),s=r?this._getSelectedParentBounds(r.layers):u.List(),o=n.getCurrentTool(),a=n.getModalToolState(),l=a||(o?o.hideTransformOverlay:!1),h=(o?o.hideTransformControls:!1)||(r?this._resizeLocked(r.layers):!0),p=(o?o.hideTransformControls:!1)||(r?this._rotationLocked(r.layers):!0),d;if(c){var v=r&&r.layers.selected.filterNot(function(e){return e.isArtboard}).map(function(e){return r.layers.childBounds(e)},this).filter(function(e){return e&&e.area>0});d=r&&f.union(v)}else d=r&&r.layers.selectedAreaBounds;return{layers:i,parentBounds:s,bounds:d,hidden:l,noResize:h,noRotation:p}},componentDidMount:function(){var e=this.getDOMNode();this._transformScrim=new l(e,this.getFlux()),this._drawDebounced=a.debounce(this.drawOverlay,h),this._drawDebounced()},componentDidUpdate:function(){this._drawDebounced()},componentWillUnmount:function(){this._transformScrim.destroy(this.getDOMNode())},drawOverlay:function(){if(!this.isMounted())return;this._transformScrim.update(this.getDOMNode(),this.state)},clearOverlay:function(){this._transformScrim.clear(this.getDOMNode())},render:function(){return r.createElement("g",{transform:this.props.transformString})},_getSelectedParentBounds:function(e){return u.List(e.selected.reduce(function(t,n){var r=e.parent(n);if(r){var i=e.childBounds(r);i&&t.add(i)}return t},new Set))},_bothLocked:function(e){var t=e.selected;return t.first()&&t.first().isBackground||t.size>1&&t.some(function(e){return e.isArtboard})||t.some(function(t){return t.kind===t.layerKinds.ADJUSTMENT||e.hasLockedDescendant(t)||e.hasLockedAncestor(t)})||t.every(function(e){return!e.visible})},_rotationLocked:function(e){var t=e.selected;return this._bothLocked(e)||t.some(function(e){return e.isArtboard})},_resizeLocked:function(e){var t=e.selected;return this._bothLocked(e)||t.some(function(e){return e.kind===e.layerKinds.TEXT})}});n.exports=p}),define("jsx!js/jsx/Scrim",["require","exports","module","react","fluxxor","adapter/os","jsx!js/jsx/tools/TransformOverlay"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=i.StoreWatchMixin,u=e("adapter/os"),a=e("jsx!js/jsx/tools/TransformOverlay"),f=r.createClass({displayName:"Scrim",mixins:[s,o("tool","ui","application")],_handleClick:function(e){var t=this.state.current;t&&t.onClick&&t.onClick.call(this,e)},_handleDoubleClick:function(e){var t=this.state.current,n=this.getFlux();if(!n.store("application").getCurrentDocument()){n.actions.menu.native({commandID:20});return}t&&t.onDoubleClick&&t.onDoubleClick.call(this,e)},_handleMouseDown:function(e){var t=this.state.current;window.document.activeElement!==window.document.body&&window.document.activeElement.blur(),t&&t.onMouseDown&&t.onMouseDown.call(this,e)},_handleMouseUp:function(e){var t=this.state.current;t&&t.onMouseUp&&t.onMouseUp.call(this,e)},_handleMouseMove:function(e){var t=this.state.current;t&&t.onMouseMove&&t.onMouseMove.call(this,e)},_handleKeyUp:function(e){if(e.target!==window.document.body)return;u.resetCursor();var t=this.state.current;t&&t.onKeyUp&&t.onKeyUp.call(this,e)},_handleKeyDown:function(e){if(e.target!==window.document.body)return;u.resetCursor();var t=this.state.current;t&&t.onKeyDown&&t.onKeyDown.call(this,e)},getStateFromFlux:function(){var e=this.getFlux(),t=e.store("tool").getState(),n=e.store("ui").getState(),r=e.store("application").getCurrentDocument();return{current:t.current,transform:n.inverseTransformMatrix,overlaysEnabled:n.overlaysEnabled,document:r}},componentWillMount:function(){window.addEventListener("adapterKeydown",this._handleKeyDown),window.addEventListener("adapterKeyup",this._handleKeyUp)},componentWillUnmount:function(){window.removeEventListener("adapterKeydown",this._handleKeyDown),window.removeEventListener("adapterKeyup",this._handleKeyUp)},_renderToolOverlay:function(e){var t=this.state.current;if(t&&t.toolOverlay){var n=t.toolOverlay;return r.createElement(n,{transformString:e,ref:"toolOverlay"})}return null},_renderTransformOverlay:function(e){return r.createElement(a,{transformString:e,ref:"transformOverlay"})},_getTransformString:function(e){return e?"matrix("+e.join(",")+")":""},render:function(){var e=this.state.document,t=e&&e.unsupported,n=this.state.transform,i=!t&&this.state.overlaysEnabled,s=this._getTransformString(n),o=i&&n?this._renderToolOverlay(s):null,u=i&&n?this._renderTransformOverlay(s):null;return r.createElement("div",{ref:"scrim",className:"scrim",onClick:!t&&this._handleClick,onDoubleClick:!t&&this._handleDoubleClick,onMouseDown:!t&&this._handleMouseDown,onMouseMove:!t&&this._handleMouseMove,onMouseUp:!t&&this._handleMouseUp},r.createElement("svg",{width:"100%",height:"100%"},r.createElement("g",{id:"overlay",width:"100%",height:"100%"},o,u)))}});n.exports=f}),define("jsx!js/jsx/shared/SplitButton",["require","exports","module","react","jsx!js/jsx/shared/SVGIcon"],function(e,t,n){"use strict";var r=e("react"),i=e("jsx!js/jsx/shared/SVGIcon"),s=r.createClass({displayName:"SplitButtonItem",mixins:[r.addons.PureRenderMixin],propTypes:{id:r.PropTypes.string,onChange:r.PropTypes.func,selected:r.PropTypes.bool,disabled:r.PropTypes.bool},render:function(){var e=r.addons.classSet({"split-button__item__selected":this.props.selected,"split-button__item__disabled":this.props.disabled,"split-button__item":!0});return e+=" "+(this.props.className||""),r.createElement("li",{className:e,id:this.props.id,title:this.props.title,onClick:this.props.disabled?null:this.props.onClick},r.createElement(i,{viewBox:"0 0 24 24",CSSID:this.props.iconId}))}}),o=r.createClass({displayName:"SplitButtonList",mixins:[r.addons.PureRenderMixin],render:function(){var e=r.Children.count(this.props.children),t=r.addons.classSet({"column-12":e<4,"column-14":e>=4,"button-radio":!0});return r.createElement("ul",{className:t},this.props.children)}});n.exports.SplitButtonList=o,n.exports.SplitButtonItem=s}),define("jsx!js/jsx/sections/transform/AlignDistribute",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/SplitButton","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("jsx!js/jsx/shared/SplitButton"),a=u.SplitButtonList,f=u.SplitButtonItem,l=e("i18n!nls/strings"),c=r.createClass({displayName:"AlignDistribute",mixins:[s],propTypes:{document:r.PropTypes.object},_alignLeft:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.alignLeft(e,t)},_alignRight:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.alignRight(e,t)},_alignHCenter:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.alignHCenter(e,t)},_alignTop:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.alignTop(e,t)},_alignBottom:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.alignBottom(e,t)},_alignVCenter:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.alignVCenter(e,t)},_distributeX:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.distributeX(e,t)},_distributeY:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.distributeY(e,t)},_disabled:function(e,t){return e.unsupporetd||t.isEmpty()||t.some(function(n){return n.isBackground||n.kind===n.layerKinds.ADJUSTMENT||e.layers.ancestors(n).some(function(e){return n!==e&&t.contains(e)})})||t.every(function(t){return e.layers.isEmptyGroup(t)})},render:function(){var e=this.props.document,t=e?e.layers.selected:o.List(),n=!e||this._disabled(e,t),i=n||t.size<2,s=n||t.size<3;return r.createElement("div",{className:"header-alignment"},r.createElement(a,null,r.createElement(f,{title:l.TOOLTIPS.DISTRIBUTE_HORIZONTALLY,className:"button-align-distribute",iconId:"distribute-horizontally",disabled:s,onClick:this._distributeX}),r.createElement(f,{title:l.TOOLTIPS.DISTRIBUTE_VERTICALLY,className:"button-align-distribute",iconId:"distribute-vertically",disabled:s,onClick:this._distributeY}),r.createElement(f,{title:l.TOOLTIPS.ALIGN_LEFT,className:"button-align-distribute",iconId:"align-left",disabled:i,onClick:this._alignLeft}),r.createElement(f,{title:l.TOOLTIPS.ALIGN_CENTER,className:"button-align-distribute",iconId:"align-center",disabled:i,onClick:this._alignHCenter}),r.createElement(f,{title:l.TOOLTIPS.ALIGN_RIGHT,className:"button-align-distribute",iconId:"align-right",disabled:i,onClick:this._alignRight}),r.createElement(f,{title:l.TOOLTIPS.ALIGN_TOP,className:"button-align-distribute",iconId:"align-top",disabled:i,onClick:this._alignTop}),r.createElement(f,{title:l.TOOLTIPS.ALIGN_MIDDLE,className:"button-align-distribute",iconId:"align-middle",disabled:i,onClick:this._alignVCenter}),r.createElement(f,{title:l.TOOLTIPS.ALIGN_BOTTOM,className:"button-align-distribute",iconId:"align-bottom",disabled:i,onClick:this._alignBottom})))}});n.exports=c}),define("jsx!js/jsx/shared/Gutter",["require","exports","module","react"],function(e,t,n){"use strict";var r=e("react"),i=r.createClass({displayName:"Gutter",mixins:[r.addons.PureRenderMixin],render:function(){var e=this.props.size||"column-1";return r.createElement("div",{className:e}," ")}});n.exports=i}),define("jsx!js/jsx/shared/Label",["require","exports","module","react"],function(e,t,n){"use strict";var r=e("react"),i=r.createClass({displayName:"Label",mixins:[r.addons.PureRenderMixin],render:function(){var e=this.props.size||"column-6";return e+=" label-medium",r.createElement("label",r.__spread({},this.props,{ref:"label",className:e}),this.props.children)}});n.exports=i}),function(t,n){typeof exports=="object"&&typeof module=="object"?module.exports=n():typeof define=="function"&&define.amd?define("mathjs",n):typeof exports=="object"?exports.math=n():t.math=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var t={};return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function s(e){if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var t={},o={matrix:"matrix",number:"number",precision:64,epsilon:1e-14};t.config=function(e){if(e){r.deepExtend(o,e),e.precision&&t.type.BigNumber.config({precision:e.precision}),n(4)(t,o);if(e.number&&e.number.defaultType)throw new Error("setting `number.defaultType` is deprecated. Use `number` instead.");if(e.number&&e.number.precision)throw new Error("setting `number.precision` is deprecated. Use `precision` instead.");if(e.matrix&&e.matrix.defaultType)throw new Error("setting `matrix.defaultType` is deprecated. Use `matrix` instead.");if(e.matrix&&e.matrix["default"])throw new Error("setting `matrix.default` is deprecated. Use `matrix` instead.");if(e.decimals)throw new Error("setting `decimals` is deprecated. Use `precision` instead.")}return r.clone(o)},t.create=s;var u=n(5).constructor();u.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},u.fromJSON=function(e){return new u(e.value)},typeof u.prototype.clone!="function"&&(u.prototype.clone=function(){return this});if(typeof u.convert=="function")throw new Error("Cannot add function convert to BigNumber: function already exists");return u.convert=function(e){return i(e)>15?e:new u(e)},t.error=n(6),t.type={},t.type.Complex=n(7),t.type.Range=n(8),t.type.Index=n(9),t.type.Matrix=n(10)(o),t.type.Unit=n(11),t.type.Help=n(12),t.type.ResultSet=n(13),t.type.BigNumber=u,t.collection=n(14)(t,o),t.type.CcsMatrix=n(15)(t,o),t.type.CrsMatrix=n(16)(t,o),t.type.DenseMatrix=n(17)(t,o),t.type.Matrix._storage.ccs=t.type.CcsMatrix,t.type.Matrix._storage.crs=t.type.CrsMatrix,t.type.Matrix._storage.dense=t.type.DenseMatrix,t.type.Matrix._storage["default"]=t.type.DenseMatrix,t.expression={},t.expression.node=n(18),t.expression.parse=n(19)(t,o),t.expression.Parser=n(20)(t,o),t.expression.docs=n(21),t.json={reviver:n(22)(t,o)},n(34)(t,o),n(35)(t,o),n(36)(t,o),n(37)(t,o),n(38)(t,o),n(39)(t,o),n(40)(t,o),n(41)(t,o),n(42)(t,o),n(43)(t,o),n(44)(t,o),n(45)(t,o),n(46)(t,o),n(47)(t,o),n(48)(t,o),n(49)(t,o),n(50)(t,o),n(51)(t,o),n(52)(t,o),n(53)(t,o),n(54)(t,o),n(55)(t,o),n(56)(t,o),n(57)(t,o),n(58)(t,o),n(59)(t,o),n(60)(t,o),n(61)(t,o),n(62)(t,o),n(63)(t,o),n(64)(t,o),n(65)(t,o),n(66)(t,o),n(67)(t,o),n(68)(t,o),n(69)(t,o),n(70)(t,o),n(71)(t,o),n(72)(t,o),n(73)(t,o),n(74)(t,o),n(75)(t,o),n(76)(t,o),n(77)(t,o),n(78)(t,o),n(79)(t,o),n(80)(t,o),n(81)(t,o),n(82)(t,o),n(83)(t,o),n(84)(t,o),n(85)(t,o),n(86)(t,o),n(87)(t,o),n(88)(t,o),n(89)(t,o),n(90)(t,o),n(91)(t,o),n(92)(t,o),n(93)(t,o),n(94)(t,o),n(95)(t,o),n(96)(t,o),n(97)(t,o),n(98)(t,o),n(99)(t,o),n(100)(t,o),n(101)(t,o),n(102)(t,o),n(103)(t,o),n(104)(t,o),n(105)(t,o),n(106)(t,o),n(107)(t,o),n(108)(t,o),n(109)(t,o),n(110)(t,o),n(111)(t,o),n(112)(t,o),n(113)(t,o),n(114)(t,o),n(115)(t,o),n(116)(t,o),n(117)(t,o),n(118)(t,o),n(119)(t,o),n(120)(t,o),n(121)(t,o),n(122)(t,o),n(123)(t,o),n(124)(t,o),n(125)(t,o),n(126)(t,o),n(127)(t,o),n(128)(t,o),n(129)(t,o),n(130)(t,o),n(131)(t,o),n(132)(t,o),n(133)(t,o),n(134)(t,o),n(135)(t,o),n(136)(t,o),n(137)(t,o),n(138)(t,o),n(139)(t,o),n(140)(t,o),n(141)(t,o),n(142)(t,o),n(143)(t,o),n(144)(t,o),n(145)(t,o),n(146)(t,o),n(147)(t,o),n(148)(t,o),n(149)(t,o),n(150)(t,o),n(151)(t,o),n(152)(t,o),n(153)(t,o),n(154)(t,o),n(155)(t,o),n(156)(t,o),n(157)(t,o),n(158)(t,o),n(159)(t,o),n(160)(t,o),n(161)(t,o),n(162)(t,o),n(163)(t,o),n(164)(t,o),n(165)(t,o),n(166)(t,o),t.ifElse=function(){throw new Error("Function ifElse is deprecated. Use the conditional operator instead.")},n(4)(t,o),t.expression.transform={concat:n(23)(t,o),filter:n(24)(t,o),forEach:n(25)(t,o),index:n(26)(t,o),map:n(27)(t,o),max:n(28)(t,o),mean:n(29)(t,o),min:n(30)(t,o),range:n(31)(t,o),subset:n(32)(t,o)},t.chaining={},t.chaining.Chain=n(33)(t,o),t.chaining.Selector=t.chaining.Chain,t.config(o),t.config(e),t}var r=n(2),i=n(3).digits,o=s();typeof window!="undefined"&&(window.mathjs=o),e.exports=o},function(e,t,n){"use strict";t.clone=function r(e){var t=typeof e;if(t==="number"||t==="string"||t==="boolean"||e===null||e===undefined)return e;if(typeof e.clone=="function")return e.clone();if(Array.isArray(e))return e.map(function(e){return r(e)});if(e instanceof Number)return new Number(e.valueOf());if(e instanceof String)return new String(e.valueOf());if(e instanceof Boolean)return new Boolean(e.valueOf());if(e instanceof Date)return new Date(e.valueOf());if(e instanceof RegExp)throw new TypeError("Cannot clone "+e);var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=r(e[i]));return n},t.extend=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},t.deepExtend=function i(e,t){if(Array.isArray(t))throw new TypeError("Arrays are not supported by deepExtend");for(var n in t)if(t.hasOwnProperty(n))if(t[n]&&t[n].constructor===Object)e[n]===undefined&&(e[n]={}),e[n].constructor===Object?i(e[n],t[n]):e[n]=t[n];else{if(Array.isArray(t[n]))throw new TypeError("Arrays are not supported by deepExtend");e[n]=t[n]}return e},t.deepEqual=function(n,r){var i,s,o;if(Array.isArray(n)){if(!Array.isArray(r))return!1;if(n.length!=r.length)return!1;for(s=0,o=n.length;s<o;s++)if(!t.deepEqual(n[s],r[s]))return!1;return!0}if(n instanceof Object){if(!Array.isArray(r)&&r instanceof Object){for(i in n)if(!t.deepEqual(n[i],r[i]))return!1;for(i in r)if(!t.deepEqual(n[i],r[i]))return!1;return!0}return!1}return typeof n==typeof r&&n==r},t.canDefineProperty=function(){try{if(Object.defineProperty)return Object.defineProperty({},"x",{}),!0}catch(e){}return!1},t.lazy=function(e,n,r){if(t.canDefineProperty()){var i=!0,s;Object.defineProperty(e,n,{get:function(){return i&&(s=r(),i=!1),s},set:function(e){s=e,i=!1}})}else e[n]=r()}},function(e,t,n){"use strict";var r=n(167);t.isNumber=function(e){return e instanceof Number||typeof e=="number"},t.isInteger=function(e){return e==Math.round(e)},t.sign=function(e){return e>0?1:e<0?-1:0},t.format=function(e,n){if(typeof n=="function")return n(e);if(e===Infinity)return"Infinity";if(e===-Infinity)return"-Infinity";if(isNaN(e))return"NaN";var r="auto",i=undefined;n&&(n.notation&&(r=n.notation),t.isNumber(n)?i=n:n.precision&&(i=n.precision));switch(r){case"fixed":return t.toFixed(e,i);case"exponential":return t.toExponential(e,i);case"auto":return t.toPrecision(e,i,n&&n.exponential).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return e!=="."?e+t:t});default:throw new Error('Unknown notation "'+r+'". '+'Choose "auto", "exponential", or "fixed".')}},t.toExponential=function(e,t){return(new r(e)).toExponential(t)},t.toFixed=function(e,t){return(new r(e)).toFixed(t)},t.toPrecision=function(e,t,n){return(new r(e)).toPrecision(t,n)},t.digits=function(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length},t.DBL_EPSILON=Number.EPSILON||2.220446049250313e-16,t.nearlyEqual=function(e,n,r){if(r==null)return e==n;if(e==n)return!0;if(isNaN(e)||isNaN(n))return!1;if(isFinite(e)&&isFinite(n)){var i=Math.abs(e-n);return i<t.DBL_EPSILON?!0:i<=Math.max(Math.abs(e),Math.abs(n))*r}return!1}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(2),i=n(168),s=n(7),o=e.type.BigNumber;e["true"]=!0,e["false"]=!1,e["null"]=null,e.uninitialized=n(169).UNINITIALIZED,t.number==="bignumber"?(e.Infinity=new o(Infinity),e.NaN=new o(NaN),r.lazy(e,"pi",function(){return i.pi(t.precision)}),r.lazy(e,"tau",function(){return i.tau(t.precision)}),r.lazy(e,"e",function(){return i.e(t.precision)}),r.lazy(e,"phi",function(){return i.phi(t.precision)}),r.lazy(e,"E",function(){return e.e}),r.lazy(e,"LN2",function(){return(new o(2)).ln()}),r.lazy(e,"LN10",function(){return(new o(10)).ln()}),r.lazy(e,"LOG2E",function(){return(new o(1)).div((new o(2)).ln())}),r.lazy(e,"LOG10E",function(){return(new o(1)).div((new o(10)).ln())}),r.lazy(e,"PI",function(){return e.pi}),r.lazy(e,"SQRT1_2",function(){return(new o("0.5")).sqrt()}),r.lazy(e,"SQRT2",function(){return(new o(2)).sqrt()})):(e.Infinity=Infinity,e.NaN=NaN,e.pi=Math.PI,e.tau=Math.PI*2,e.e=Math.E,e.phi=1.618033988749895,e.E=e.e,e.LN2=Math.LN2,e.LN10=Math.LN10,e.LOG2E=Math.LOG2E,e.LOG10E=Math.LOG10E,e.PI=e.pi,e.SQRT1_2=Math.SQRT1_2,e.SQRT2=Math.SQRT2),e.i=new s(0,1),e.version=n(170)}},function(e,t,n){var r=n(340);e.exports=r},function(e,t,n){"use strict";t.ArgumentsError=n(171),t.DimensionError=n(172),t.IndexError=n(173),t.UnsupportedTypeError=n(174)},function(e,t,n){"use strict";function f(e,t){if(!(this instanceof f))throw new SyntaxError("Constructor must be called with the new operator");switch(arguments.length){case 0:this.re=0,this.im=0;break;case 1:var n=arguments[0];if(typeof n=="object"){if("re"in n&&"im"in n){var r=new f(n.re,n.im);this.re=r.re,this.im=r.im;break}if("r"in n&&"phi"in n){var r=f.fromPolar(n.r,n.phi);this.re=r.re,this.im=r.im;break}}throw new SyntaxError("Object with the re and im or r and phi properties expected.");case 2:if(!o(e)||!o(t))throw new TypeError("Two numbers expected in Complex constructor");this.re=e,this.im=t;break;default:throw new SyntaxError("One, two or three arguments expected in Complex constructor")}}function p(){while(h==" "||h=="	")m()}function d(e){return e>="0"&&e<="9"||e=="."}function v(e){return e>="0"&&e<="9"}function m(){c++,h=l.charAt(c)}function g(e){c=e,h=l.charAt(c)}function y(){var e="",t;t=c,h=="+"?m():h=="-"&&(e+=h,m());if(!d(h))return g(t),null;if(h=="."){e+=h,m();if(!v(h))return g(t),null}else{while(v(h))e+=h,m();h=="."&&(e+=h,m())}while(v(h))e+=h,m();if(h=="E"||h=="e"){e+=h,m();if(h=="+"||h=="-")e+=h,m();if(!v(h))return g(t),null;while(v(h))e+=h,m()}return e}function b(){var e=l.charAt(c+1);if(h=="I"||h=="i")return m(),"1";if(h!="+"&&h!="-"||e!="I"&&e!="i")return null;var t=h=="+"?"1":"-1";return m(),m(),t}var r=n(175),i=n(11),s=r.number,o=r.number.isNumber,u=i.isUnit,a=r.string.isString;f.isComplex=function(e){return e instanceof f};var l,c,h;f.parse=function(e){l=e,c=-1,h="";if(!a(l))return null;m(),p();var t=y();if(t){if(h=="I"||h=="i")return m(),p(),h?null:new f(0,Number(t));p();var n=h;if(n!="+"&&n!="-")return p(),h?null:new f(Number(t),0);m(),p();var r=y();if(r){if(h!="I"&&h!="i")return null;m()}else{r=b();if(!r)return null}return n=="-"&&(r[0]=="-"?r="+"+r.substring(1):r="-"+r),m(),p(),h?null:new f(Number(t),Number(r))}return t=b(),t?(p(),h?null:new f(0,Number(t))):null},f.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if(typeof t=="object")return f.fromPolar(t.r,t.phi);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var n=arguments[0],r=arguments[1];if(o(n)){u(r)&&r.hasBase(i.BASE_UNITS.ANGLE)&&(r=r.toNumber("rad"));if(o(r))return new f(n*Math.cos(r),n*Math.sin(r));throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.");default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},f.prototype.toPolar=function(){return{r:Math.sqrt(this.re*this.re+this.im*this.im),phi:Math.atan2(this.im,this.re)}},f.prototype.clone=function(){return new f(this.re,this.im)},f.prototype.equals=function(e){return this.re===e.re&&this.im===e.im},f.prototype.format=function(e){var t="",n=this.im,r=this.re,i=s.format(this.re,e),u=s.format(this.im,e),a=o(e)?e:e?e.precision:null;if(a!==null){var f=Math.pow(10,-a);Math.abs(r/n)<f&&(r=0),Math.abs(n/r)<f&&(n=0)}return n==0?t=i:r==0?n==1?t="i":n==-1?t="-i":t=u+"i":n>0?n==1?t=i+" + i":t=i+" + "+u+"i":n==-1?t=i+" - i":t=i+" - "+u.substring(1)+"i",t},f.prototype.toString=function(){return this.format()},f.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},f.fromJSON=function(e){return new f(e)},f.prototype.valueOf=f.prototype.toString,e.exports=f},function(e,t,n){"use strict";function u(e,t,n){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");if(e!=null&&!i.isNumber(e))throw new TypeError("Parameter start must be a number");if(t!=null&&!i.isNumber(t))throw new TypeError("Parameter end must be a number");if(n!=null&&!i.isNumber(n))throw new TypeError("Parameter step must be a number");this.start=e!=null?parseFloat(e):0,this.end=t!=null?parseFloat(t):0,this.step=n!=null?parseFloat(n):1}var r=n(175),i=r.number,s=r.string,o=r.array;u.parse=function(e){if(!s.isString(e))return null;var t=e.split(":"),n=t.map(function(e){return parseFloat(e)}),r=n.some(function(e){return isNaN(e)});if(r)return null;switch(n.length){case 2:return new u(n[0],n[1]);case 3:return new u(n[0],n[2],n[1]);default:return null}},u.prototype.clone=function(){return new u(this.start,this.end,this.step)},u.isRange=function(e){return e instanceof u},u.prototype.size=function(){var e=0,t=this.start,n=this.step,r=this.end,s=r-t;return i.sign(n)==i.sign(s)?e=Math.ceil(s/n):s==0&&(e=0),isNaN(e)&&(e=0),[e]},u.prototype.min=function(){var e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:undefined},u.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:undefined},u.prototype.forEach=function(e){var t=this.start,n=this.step,r=this.end,i=0;if(n>0)while(t<r)e(t,i,this),t+=n,i++;else if(n<0)while(t>r)e(t,i,this),t+=n,i++},u.prototype.map=function(e){var t=[];return this.forEach(function(n,r,i){t[r]=e(n,r,i)}),t},u.prototype.toArray=function(){var e=[];return this.forEach(function(t,n){e[n]=t}),e},u.prototype.valueOf=function(){return this.toArray()},u.prototype.format=function(e){var t=i.format(this.start,e);return this.step!=1&&(t+=":"+i.format(this.step,e)),t+=":"+i.format(this.end,e),t},u.prototype.toString=function(){return this.format()},u.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},u.fromJSON=function(e){return new u(e.start,e.end,e.step)},e.exports=u},function(e,t,n){"use strict";function f(e){if(!(this instanceof f))throw new SyntaxError("Constructor must be called with the new operator");this._ranges=[],this._isScalar=!0;for(var t=0,n=arguments.length;t<n;t++){var r=arguments[t];if(r instanceof i)this._ranges.push(r),this._isScalar=!1;else if(a(r))this._ranges.push(l(r)),this._isScalar=!1;else if(o(r))this._ranges.push(l([r,r+1]));else{var s=r.valueOf();if(!a(s))throw new TypeError("Ranges must be an Array, Number, or Range");this._ranges.push(l(s)),this._isScalar=!1}}}function l(e){var t=e.length;for(var n=0;n<t;n++)if(!o(e[n])||!u(e[n]))throw new TypeError("Index parameters must be integer numbers");switch(e.length){case 2:return new i(e[0],e[1]);case 3:return new i(e[0],e[1],e[2]);default:throw new SyntaxError("Wrong number of arguments in Index (2 or 3 expected)")}}var r=n(175),i=n(8),s=r.number,o=s.isNumber,u=s.isInteger,a=Array.isArray;f.prototype.clone=function(){var e=new f;return e._ranges=r.object.clone(this._ranges),e._isScalar=this._isScalar,e},f.isIndex=function(e){return e instanceof f},f.create=function(e){var t=new f;return f.apply(t,e),t},f.prototype.size=function(){var e=[];for(var t=0,n=this._ranges.length;t<n;t++){var r=this._ranges[t];e[t]=r.size()[0]}return e},f.prototype.max=function(){var e=[];for(var t=0,n=this._ranges.length;t<n;t++){var r=this._ranges[t];e[t]=r.max()}return e},f.prototype.min=function(){var e=[];for(var t=0,n=this._ranges.length;t<n;t++){var r=this._ranges[t];e[t]=r.min()}return e},f.prototype.forEach=function(e){for(var t=0,n=this._ranges.length;t<n;t++)e(this._ranges[t],t,this)},f.prototype.range=function(e){return this._ranges[e]||null},f.prototype.isScalar=function(){return this._isScalar},f.prototype.toArray=function(){var e=[];for(var t=0,n=this._ranges.length;t<n;t++){var r=this._ranges[t],i=[],s=r.start,o=r.end,u=r.step;if(u>0)while(s<o)i.push(s),s+=u;else if(u<0)while(s>o)i.push(s),s+=u;e.push(i)}return e},f.prototype.valueOf=f.prototype.toArray,f.prototype.toString=function(){var e=[];for(var t=0,n=this._ranges.length;t<n;t++){var r=this._ranges[t],i=s.format(r.start);r.step!=1&&(i+=":"+s.format(r.step)),i+=":"+s.format(r.end),e.push(i)}return"["+e.join(", ")+"]"},f.prototype.toJSON=function(){return{mathjs:"Index",ranges:this._ranges}},f.fromJSON=function(e){return f.create(e.ranges)},e.exports=f},function(e,t,n){"use strict";var r=n(176),i=r.isString;e.exports=function(e){function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator")}return t.isMatrix=function(e){return e instanceof t},t.storage=function(e){if(!i(e))throw new TypeError("format must be a string value");var n=t._storage[e];if(!n)throw new SyntaxError("Unsupported matrix storage format: "+e);return n},t._storage={},t.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},t.prototype.subset=function(e,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},t.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},t.prototype.set=function(e,t,n){throw new Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},t.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},t.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},t.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},t.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},t.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},t.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},t.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},t.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},t.prototype.transpose=function(){throw new Error("Cannot invoke transpose on a Matrix interface")},t.prototype.trace=function(){throw new Error("Cannot invoke transpose on a Matrix interface")},t.prototype.multiply=function(e){throw new Error("Cannot invoke multiply on a Matrix interface")},t}},function(e,t,n){"use strict";function a(e,t){if(!(this instanceof a))throw new Error("Constructor must be called with the new operator");if(e!=undefined&&!o(e))throw new TypeError("First parameter in Unit constructor must be a number");if(t!=undefined&&(!u(t)||t==""))throw new TypeError("Second parameter in Unit constructor must be a string");if(t!=undefined){var n=b(t);if(!n)throw new SyntaxError('Unknown unit "'+t+'"');this.unit=n.unit,this.prefix=n.prefix}else this.unit=T,this.prefix=E;this.value=e!=undefined?this._normalize(e):null,this.fixPrefix=!1}function h(){while(c==" "||c=="	")v()}function p(e){return e>="0"&&e<="9"||e=="."}function d(e){return e>="0"&&e<="9"}function v(){l++,c=f.charAt(l)}function m(e){l=e,c=f.charAt(l)}function g(){var e="",t;t=l,c=="+"?v():c=="-"&&(e+=c,v());if(!p(c))return m(t),null;if(c=="."){e+=c,v();if(!d(c))return m(t),null}else{while(d(c))e+=c,v();c=="."&&(e+=c,v())}while(d(c))e+=c,v();if(c=="E"||c=="e"){e+=c,v();if(c=="+"||c=="-")e+=c,v();if(!d(c))return m(t),null;while(d(c))e+=c,v()}return e}function y(){var e="";h();while(c&&c!=" "&&c!="	")e+=c,v();return e||null}function b(e){for(var t in N)if(N.hasOwnProperty(t)&&s.endsWith(e,t)){var n=N[t],r=e.length-t.length,i=e.substring(0,r),o=n.prefixes[i];if(o!==undefined)return{unit:n,prefix:o}}return null}var r=n(175),i=r.number,s=r.string,o=r.number.isNumber,u=r.string.isString,f,l,c;a.parse=function(e){f=e,l=-1,c="";if(!u(f))return null;v(),h();var t=g(),n;if(t){n=y(),v(),h();if(c)return null;if(t&&n)try{return new a(Number(t),n)}catch(r){}}else{n=y(),v(),h();if(c)return null;if(n)try{return new a(null,n)}catch(r){}}return null},a.isUnit=function(e){return e instanceof a},a.prototype.clone=function(){var e=new a;for(var t in this)this.hasOwnProperty(t)&&(e[t]=this[t]);return e},a.prototype._normalize=function(e){return(e+this.unit.offset)*this.unit.value*this.prefix.value},a.prototype._denormalize=function(e,t){return t==undefined?e/this.unit.value/this.prefix.value-this.unit.offset:e/this.unit.value/t-this.unit.offset},a.isValuelessUnit=function(e){return b(e)!=null},a.prototype.hasBase=function(e){return this.unit.base===e},a.prototype.equalBase=function(e){return this.unit.base===e.unit.base},a.prototype.equals=function(e){return this.equalBase(e)&&this.value==e.value},a.prototype.to=function(e){var t,n=this.value==null?this._normalize(1):this.value;if(u(e)){t=new a(null,e);if(!this.equalBase(t))throw new Error("Units do not match");return t.value=n,t.fixPrefix=!0,t}if(e instanceof a){if(!this.equalBase(e))throw new Error("Units do not match");if(e.value!==null)throw new Error("Cannot convert to a unit with a value");return t=e.clone(),t.value=n,t.fixPrefix=!0,t}throw new Error("String or Unit expected as parameter")},a.prototype.toNumber=function(e){var t=this.to(e);return t._denormalize(t.value,t.prefix.value)},a.prototype.toString=function(){return this.format()},a.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.prefix.name+this.unit.name,fixPrefix:this.fixPrefix}},a.fromJSON=function(e){var t=new a(e.value,e.unit);return t.fixPrefix=e.fixPrefix||!1,t},a.prototype.valueOf=a.prototype.toString,a.prototype.format=function(e){var t,n;if(this.value!==null&&!this.fixPrefix){var r=this._bestPrefix();t=this._denormalize(this.value,r.value),n=i.format(t,e)+" ",n+=r.name+this.unit.name}else t=this._denormalize(this.value),n=this.value!==null?i.format(t,e)+" ":"",n+=this.prefix.name+this.unit.name;return n},a.prototype._bestPrefix=function(){var e=Math.abs(this.value/this.unit.value),t=E,n=Math.abs(Math.log(e/t.value)/Math.LN10-1.2),r=this.unit.prefixes;for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];if(s.scientific){var o=Math.abs(Math.log(e/s.value)/Math.LN10-1.2);o<n&&(t=s,n=o)}}return t};var w={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-42,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}}},E={name:"",value:1,scientific:!0},S={NONE:{},LENGTH:{},MASS:{},TIME:{},CURRENT:{},TEMPERATURE:{},LUMINOUS_INTENSITY:{},AMOUNT_OF_SUBSTANCE:{},FORCE:{},SURFACE:{},VOLUME:{},ANGLE:{},BIT:{}},x={},T={name:"",base:x,value:1,offset:0},N={meter:{name:"meter",base:S.LENGTH,prefixes:w.LONG,value:1,offset:0},inch:{name:"inch",base:S.LENGTH,prefixes:w.NONE,value:.0254,offset:0},foot:{name:"foot",base:S.LENGTH,prefixes:w.NONE,value:.3048,offset:0},yard:{name:"yard",base:S.LENGTH,prefixes:w.NONE,value:.9144,offset:0},mile:{name:"mile",base:S.LENGTH,prefixes:w.NONE,value:1609.344,offset:0},link:{name:"link",base:S.LENGTH,prefixes:w.NONE,value:.201168,offset:0},rod:{name:"rod",base:S.LENGTH,prefixes:w.NONE,value:5.02921,offset:0},chain:{name:"chain",base:S.LENGTH,prefixes:w.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:S.LENGTH,prefixes:w.NONE,value:1e-10,offset:0},m:{name:"m",base:S.LENGTH,prefixes:w.SHORT,value:1,offset:0},"in":{name:"in",base:S.LENGTH,prefixes:w.NONE,value:.0254,offset:0},ft:{name:"ft",base:S.LENGTH,prefixes:w.NONE,value:.3048,offset:0},yd:{name:"yd",base:S.LENGTH,prefixes:w.NONE,value:.9144,offset:0},mi:{name:"mi",base:S.LENGTH,prefixes:w.NONE,value:1609.344,offset:0},li:{name:"li",base:S.LENGTH,prefixes:w.NONE,value:.201168,offset:0},rd:{name:"rd",base:S.LENGTH,prefixes:w.NONE,value:5.02921,offset:0},ch:{name:"ch",base:S.LENGTH,prefixes:w.NONE,value:20.1168,offset:0},mil:{name:"mil",base:S.LENGTH,prefixes:w.NONE,value:254e-7,offset:0},m2:{name:"m2",base:S.SURFACE,prefixes:w.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:S.SURFACE,prefixes:w.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:S.SURFACE,prefixes:w.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:S.SURFACE,prefixes:w.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:S.SURFACE,prefixes:w.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:S.SURFACE,prefixes:w.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:S.SURFACE,prefixes:w.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:S.SURFACE,prefixes:w.NONE,value:6.4516e-10,offset:0},m3:{name:"m3",base:S.VOLUME,prefixes:w.CUBIC,value:1,offset:0},L:{name:"L",base:S.VOLUME,prefixes:w.SHORT,value:.001,offset:0},l:{name:"l",base:S.VOLUME,prefixes:w.SHORT,value:.001,offset:0},litre:{name:"litre",base:S.VOLUME,prefixes:w.LONG,value:.001,offset:0},cuin:{name:"cuin",base:S.VOLUME,prefixes:w.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:S.VOLUME,prefixes:w.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:S.VOLUME,prefixes:w.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:S.VOLUME,prefixes:w.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:S.VOLUME,prefixes:w.NONE,value:15e-6,offset:0},drop:{name:"drop",base:S.VOLUME,prefixes:w.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:S.VOLUME,prefixes:w.NONE,value:5e-8,offset:0},minim:{name:"minim",base:S.VOLUME,prefixes:w.NONE,value:6.161152e-8,offset:0},fluiddram:{name:"fluiddram",base:S.VOLUME,prefixes:w.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:S.VOLUME,prefixes:w.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:S.VOLUME,prefixes:w.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:S.VOLUME,prefixes:w.NONE,value:1e-6,offset:0},cup:{name:"cup",base:S.VOLUME,prefixes:w.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:S.VOLUME,prefixes:w.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:S.VOLUME,prefixes:w.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:S.VOLUME,prefixes:w.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:S.VOLUME,prefixes:w.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:S.VOLUME,prefixes:w.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:S.VOLUME,prefixes:w.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:S.VOLUME,prefixes:w.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:S.VOLUME,prefixes:w.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:S.VOLUME,prefixes:w.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:S.VOLUME,prefixes:w.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:S.VOLUME,prefixes:w.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:S.VOLUME,prefixes:w.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:S.VOLUME,prefixes:w.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:S.VOLUME,prefixes:w.NONE,value:.1173478,offset:0},obl:{name:"obl",base:S.VOLUME,prefixes:w.NONE,value:.1589873,offset:0},g:{name:"g",base:S.MASS,prefixes:w.SHORT,value:.001,offset:0},gram:{name:"gram",base:S.MASS,prefixes:w.LONG,value:.001,offset:0},ton:{name:"ton",base:S.MASS,prefixes:w.SHORT,value:907.18474,offset:0},tonne:{name:"tonne",base:S.MASS,prefixes:w.SHORT,value:1e3,offset:0},grain:{name:"grain",base:S.MASS,prefixes:w.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:S.MASS,prefixes:w.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:S.MASS,prefixes:w.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:S.MASS,prefixes:w.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:S.MASS,prefixes:w.NONE,value:45.359237,offset:0},stick:{name:"stick",base:S.MASS,prefixes:w.NONE,value:.115,offset:0},stone:{name:"stone",base:S.MASS,prefixes:w.NONE,value:6350,offset:0},gr:{name:"gr",base:S.MASS,prefixes:w.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:S.MASS,prefixes:w.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:S.MASS,prefixes:w.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:S.MASS,prefixes:w.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:S.MASS,prefixes:w.NONE,value:45.359237,offset:0},s:{name:"s",base:S.TIME,prefixes:w.SHORT,value:1,offset:0},min:{name:"min",base:S.TIME,prefixes:w.NONE,value:60,offset:0},h:{name:"h",base:S.TIME,prefixes:w.NONE,value:3600,offset:0},second:{name:"second",base:S.TIME,prefixes:w.LONG,value:1,offset:0},sec:{name:"sec",base:S.TIME,prefixes:w.LONG,value:1,offset:0},minute:{name:"minute",base:S.TIME,prefixes:w.NONE,value:60,offset:0},hour:{name:"hour",base:S.TIME,prefixes:w.NONE,value:3600,offset:0},day:{name:"day",base:S.TIME,prefixes:w.NONE,value:86400,offset:0},rad:{name:"rad",base:S.ANGLE,prefixes:w.NONE,value:1,offset:0},deg:{name:"deg",base:S.ANGLE,prefixes:w.NONE,value:.017453292519943295,offset:0},grad:{name:"grad",base:S.ANGLE,prefixes:w.NONE,value:.015707963267948967,offset:0},cycle:{name:"cycle",base:S.ANGLE,prefixes:w.NONE,value:6.283185307179586,offset:0},A:{name:"A",base:S.CURRENT,prefixes:w.SHORT,value:1,offset:0},ampere:{name:"ampere",base:S.CURRENT,prefixes:w.LONG,value:1,offset:0},K:{name:"K",base:S.TEMPERATURE,prefixes:w.NONE,value:1,offset:0},degC:{name:"degC",base:S.TEMPERATURE,prefixes:w.NONE,value:1,offset:273.15},degF:{name:"degF",base:S.TEMPERATURE,prefixes:w.NONE,value:1/1.8,offset:459.67},degR:{name:"degR",base:S.TEMPERATURE,prefixes:w.NONE,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:S.TEMPERATURE,prefixes:w.NONE,value:1,offset:0},celsius:{name:"celsius",base:S.TEMPERATURE,prefixes:w.NONE,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:S.TEMPERATURE,prefixes:w.NONE,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:S.TEMPERATURE,prefixes:w.NONE,value:1/1.8,offset:0},mol:{name:"mol",base:S.AMOUNT_OF_SUBSTANCE,prefixes:w.NONE,value:1,offset:0},mole:{name:"mole",base:S.AMOUNT_OF_SUBSTANCE,prefixes:w.NONE,value:1,offset:0},cd:{name:"cd",base:S.LUMINOUS_INTENSITY,prefixes:w.NONE,value:1,offset:0},candela:{name:"candela",base:S.LUMINOUS_INTENSITY,prefixes:w.NONE,value:1,offset:0},N:{name:"N",base:S.FORCE,prefixes:w.SHORT,value:1,offset:0},newton:{name:"newton",base:S.FORCE,prefixes:w.LONG,value:1,offset:0},lbf:{name:"lbf",base:S.FORCE,prefixes:w.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:S.FORCE,prefixes:w.NONE,value:4.4482216152605,offset:0},b:{name:"b",base:S.BIT,prefixes:w.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:S.BIT,prefixes:w.BINARY_LONG,value:1,offset:0},B:{name:"B",base:S.BIT,prefixes:w.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:S.BIT,prefixes:w.BINARY_LONG,value:8,offset:0}},C={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",litres:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",seconds:"second",minutes:"minute",hours:"hour",days:"day",radians:"rad",degrees:"deg",gradients:"grad",cycles:"cycle",amperes:"ampere",moles:"mole"};for(var k in C)if(C.hasOwnProperty(k)){var L=N[C[k]],A=Object.create(L);A.name=k,N[k]=A}N.lt=N.l,N.liter=N.litre,N.liters=N.litres,N.lb=N.lbm,N.lbs=N.lbm,a.PREFIXES=w,a.BASE_UNITS=S,a.UNITS=N,e.exports=a},function(e,t,n){"use strict";function o(e){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}var r=n(175),i=r.object,s=r.string;o.isHelp=function(e){return e instanceof o},o.prototype.toText=function(e){var t=this.doc||{},n="\n";t.name&&(n+="Name: "+t.name+"\n\n"),t.category&&(n+="Category: "+t.category+"\n\n"),t.description&&(n+="Description:\n    "+t.description+"\n\n"),t.syntax&&(n+="Syntax:\n    "+t.syntax.join("\n    ")+"\n\n");if(t.examples){var r=e&&e.parser();n+="Examples:\n";for(var i=0;i<t.examples.length;i++){var u=t.examples[i];n+="    "+u+"\n";if(r){var a;try{a=r.eval(u)}catch(f){a=f}a!==undefined&&!(a instanceof o)&&(n+="        "+s.format(a,{precision:14})+"\n")}}n+="\n"}return t.seealso&&(n+="See also: "+t.seealso.join(", ")+"\n"),n},o.prototype.toString=function(){return this.toText()},o.prototype.toJSON=function(){var e=i.clone(this.doc);return e.mathjs="Help",e},o.fromJSON=function(e){var t={};for(var n in e)n!=="mathjs"&&(t[n]=e[n]);return new o(t)},o.prototype.valueOf=o.prototype.toString,e.exports=o},function(e,t,n){"use strict";function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}r.prototype.valueOf=function(){return this.entries},r.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},r.fromJSON=function(e){return new r(e.entries)},e.exports=r},function(e,t,n){"use strict";var r=n(175),i=n(173),s=n(172),o=r.array,u=r.array.isArray;e.exports=function(e){function a(e,t,n){var r,i,s,o;if(t<=0){if(!u(e[0])){s=e[0];for(r=1;r<e.length;r++)s=n(s,e[r]);return s}o=f(e),i=[];for(r=0;r<o.length;r++)i[r]=a(o[r],t-1,n);return i}i=[];for(r=0;r<e.length;r++)i[r]=a(e[r],t-1,n);return i}function f(e){var t=e.length,n=e[0].length,r,i,s=[];for(i=0;i<n;i++){var o=[];for(r=0;r<t;r++)o.push(e[r][i]);s.push(o)}return s}var t=e.type.Matrix,n={};return n.argsToArray=function(e){if(e.length===0)return[];if(e.length==1){var n=e[0];return n instanceof t&&(n=n.valueOf()),u(n)||(n=[n]),n}return r.array.argsToArray(e)},n.isCollection=function(e){return u(e)||e instanceof t},n.deepMap=function l(e,t,n){return e&&typeof e.map=="function"?e.map(function(e){return l(e,t,n)}):t(e)},n.deepMap2=function c(n,r,i){var o,a,f;if(u(n))if(u(r)){if(n.length!=r.length)throw new s(n.length,r.length);o=[],a=n.length;for(f=0;f<a;f++)o[f]=c(n[f],r[f],i)}else{if(r instanceof t)return o=c(n,r.valueOf(),i),e.matrix(o);o=[],a=n.length;for(f=0;f<a;f++)o[f]=c(n[f],r,i)}else{if(n instanceof t)return r instanceof t?(o=c(n.valueOf(),r.valueOf(),i),e.matrix(o)):(o=c(n.valueOf(),r,i),e.matrix(o));if(u(r)){o=[],a=r.length;for(f=0;f<a;f++)o[f]=c(n,r[f],i)}else{if(r instanceof t)return o=c(n,r.valueOf(),i),e.matrix(o);o=i(n,r)}}return o},n.reduce=function(n,r,s){var f=u(n)?o.size(n):n.size();if(r<0)throw new i(r);if(r>=f.length)throw new i(r,f.length);return n instanceof t?e.matrix(a(n.valueOf(),r,s)):a(n,r,s)},n.deepForEach=function h(e,n){e instanceof t&&(e=e.valueOf());for(var r=0,i=e.length;r<i;r++){var s=e[r];u(s)?h(s,n):n(s)}},n}},function(e,t,n){"use strict";var r=n(175),i=n(172),s=r.array,o=r.object,u=r.string,a=r.number,f=Array.isArray,l=r.number.isNumber,c=r.number.isInteger,h=s.validateIndex;e.exports=function(e){function d(e){if(!(this instanceof d))throw new SyntaxError("Constructor must be called with the new operator");if(e instanceof p)e.type==="CcsMatrix"?(this._values=o.clone(e._values),this._index=o.clone(e._index),this._ptr=o.clone(e._ptr),this._size=o.clone(e._size)):v(this,e.valueOf());else if(e&&f(e.values)&&f(e.index)&&f(e.ptr)&&f(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size;else if(f(e))v(this,e);else{if(e)throw new TypeError("Unsupported type of data ("+r.types.type(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0]}}var t=e.type.Index,n=e.type.BigNumber,p=e.type.Matrix,v=function(t,n){t._values=[],t._index=[],t._ptr=[];var r=n.length,i=0;if(r>0){var s=0;do{t._ptr.push(t._values.length);for(var o=0;o<r;o++){var u=n[o];if(f(u)){s===0&&i<u.length&&(i=u.length);if(s<u.length){var a=u[s];e.equal(a,0)||(t._values.push(a),t._index.push(o))}}else s===0&&i<1&&(i=1),e.equal(u,0)||(t._values.push(u),t._index.push(o))}s++}while(s<i)}t._ptr.push(t._values.length),t._size=[r,i]};d.prototype=new e.type.Matrix,d.prototype.type="CcsMatrix",d.prototype.storage=function(){return"ccs"},d.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return m(this,e);case 2:case 3:return g(this,e,t,n);default:throw new SyntaxError("Wrong number of arguments")}};var m=function(e,n){if(n instanceof t){var r=n.isScalar();if(r)return e.get(n.min());var s=n.size();if(s.length!=e._size.length)throw new i(s.length,e._size.length);var o=n.min(),u=n.max();for(var a=0,f=e._size.length;a<f;a++)h(o[a],e._size[a]),h(u[a],e._size[a]);var l=function(e){return e};return S(e,o[0],u[0],o[1],u[1],l,!1)}throw new TypeError("Invalid index")},g=function(e,n,r,u){if(n instanceof t){var a=n.size(),f=n.isScalar(),l;r instanceof p?(l=r.size(),r=r.toArray()):l=s.size(r);if(f){if(l.length!==0)throw new TypeError("Scalar expected");e.set(n.min(),r,u)}else{if(a.length!==1&&a.length!==2)throw new i(a.length,e._size.length,"<");if(l.length<a.length){var c=0,h=0;while(a[c]===1&&l[c]===1)c++;while(a[c]===1)h++,c++;r=s.unsqueeze(r,a.length,h,l)}if(!o.deepEqual(a,l))throw new i(a,l,">");var d=n.min()[0],v=n.min()[1],m=l[0],g=l[1];for(var y=0;y<m;y++)for(var b=0;b<g;b++){var w=r[y][b];e.set([y+d,b+v],w,u)}}return e}throw new TypeError("Invalid index")};d.prototype.get=function(e){if(!f(e))throw new TypeError("Array expected");if(e.length!=this._size.length)throw new i(e.length,this._size.length);var t=e[0],n=e[1];h(t,this._size[0]),h(n,this._size[1]);var r=y(t,this._ptr[n],this._ptr[n+1],this._index);return r<this._ptr[n+1]&&this._index[r]===t?o.clone(this._values[r]):0},d.prototype.set=function(t,n,r){if(!f(t))throw new TypeError("Array expected");if(t.length!=this._size.length)throw new i(t.length,this._size.length);var s=t[0],o=t[1],u=this._size[0],a=this._size[1];if(s>u-1||o>a-1)E(this,Math.max(s+1,u),Math.max(o+1,a),r),u=this._size[0],a=this._size[1];h(s,u),h(o,a);var l=y(s,this._ptr[o],this._ptr[o+1],this._index);return l<this._ptr[o+1]&&this._index[l]===s?e.equal(n,0)?b(l,o,this._values,this._index,this._ptr):this._values[l]=n:w(l,s,o,n,this._values,this._index,this._ptr),this};var y=function(e,t,n,r){if(n-t===0||e>r[n-1])return n;while(t<n){var i=~~((t+n)/2),s=r[i];if(e<s)n=i;else{if(!(e>s))return i;t=i+1}}return t},b=function(e,t,n,r,i){n.splice(e,1),r.splice(e,1);for(var s=t+1;s<i.length;s++)i[s]--},w=function(e,t,n,r,i,s,o){i.splice(e,0,r),s.splice(e,0,t);for(var u=n+1;u<o.length;u++)o[u]++};d.prototype.resize=function(e,t,n){if(!f(e))throw new TypeError("Array expected");if(e.length!==2)throw new Error("Only two dimensions matrix are supported");e.forEach(function(t){if(!a.isNumber(t)||!a.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+u.format(e)+")")});var r=n?this.clone():this;return E(r,e[0],e[1],t)};var E=function(t,n,r,i){var s=i||0,o=!e.equal(s,0),u=t._size[0],a=t._size[1],f,l,c;if(r>a){for(l=a;l<r;l++){t._ptr[l]=t._values.length;if(o)for(f=0;f<u;f++)t._values.push(s),t._index.push(f)}t._ptr[r]=t._values.length}else r<a&&(t._ptr.splice(r+1,a-r),t._values.splice(t._ptr[r],t._values.length),t._index.splice(t._ptr[r],t._index.length));a=r;if(n>u){if(o){var h=0;for(l=0;l<a;l++){t._ptr[l]=t._ptr[l]+h,c=t._ptr[l+1]+h;var p=0;for(f=u;f<n;f++,p++)t._values.splice(c+p,0,s),t._index.splice(c+p,0,f),h++}t._ptr[a]=t._values.length}}else if(n<u){var d=0;for(l=0;l<a;l++){t._ptr[l]=t._ptr[l]-d;var v=t._ptr[l],m=t._ptr[l+1]-d;for(c=v;c<m;c++)f=t._index[c],f>n-1&&(t._values.splice(c,1),t._index.splice(c,1),d++)}t._ptr[l]=t._values.length}return t._size[0]=n,t._size[1]=r,t};d.prototype.clone=function(){var e=new d({values:o.clone(this._values),index:o.clone(this._index),ptr:o.clone(this._ptr),size:o.clone(this._size)});return e},d.prototype.size=function(){return o.clone(this._size)},d.prototype.map=function(e,t){var n=this,r=this._size[0],i=this._size[1],s=function(t,r,i){return e(t,[r,i],n)};return S(this,0,r-1,0,i-1,s,t)};var S=function(t,n,r,i,s,o,u){var a=[],f=[],l=[],c=function(t,n,r){t=o(t,n,r),e.equal(t,0)||(a.push(t),f.push(n))};for(var h=i;h<=s;h++){l.push(a.length);var p=t._ptr[h],v=t._ptr[h+1],m=n;for(var g=p;g<v;g++){var y=t._index[g];if(y>=n&&y<=r){if(!u)for(var b=m;b<y;b++)c(0,b-n,h-i);c(t._values[g],y-n,h-i)}m=y+1}if(!u)for(var w=m;w<=r;w++)c(0,w-n,h-i)}return l.push(a.length),new d({values:a,index:f,ptr:l,size:[r-n+1,s-i+1]})};d.prototype.forEach=function(e,t){var n=this,r=this._size[0],i=this._size[1];for(var s=0;s<i;s++){var o=this._ptr[s],u=this._ptr[s+1],a=0;for(var f=o;f<u;f++){var l=this._index[f];if(!t)for(var c=a;c<l;c++)e(0,[c,s],n);e(this._values[f],[l,s],n),a=l+1}if(!t)for(var h=a;h<r;h++)e(0,[h,s],n)}},d.prototype.toArray=function(){return x(this,!0)},d.prototype.valueOf=function(){return x(this,!1)};var x=function(e,t){var n=[],r=e._size[0],i=e._size[1];for(var s=0;s<i;s++){var u=e._ptr[s],a=e._ptr[s+1],f=0;for(var l=u;l<a;l++){var c=e._index[l];for(var h=f;h<c;h++)(n[h]=n[h]||[])[s]=0;(n[c]=n[c]||[])[s]=t?o.clone(e._values[l]):e._values[l],f=c+1}for(var p=f;p<r;p++)(n[p]=n[p]||[])[s]=0}return n};d.prototype.format=function(e){var t=this._size[0],n=this._size[1],r="CCS ["+u.format(t,e)+" x "+u.format(n,e)+"] density: "+u.format(this._values.length/(t*n),e)+"\n";for(var i=0;i<n;i++){var s=this._ptr[i],o=this._ptr[i+1];for(var a=s;a<o;a++){var f=this._index[a];r+="\n    ("+u.format(f,e)+", "+u.format(i,e)+") ==> "+u.format(this._values[a],e)}}return r},d.prototype.toString=function(){return u.format(this.toArray())},d.prototype.toJSON=function(){return{mathjs:"CcsMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size}},d.prototype.transpose=function(){var t=this._size[0],n=this._size[1];if(n===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+u.format(this._size)+")");return new e.type.CrsMatrix({values:o.clone(this._values),index:o.clone(this._index),ptr:o.clone(this._ptr),size:[n,t]})},d.prototype.diagonal=function(e){if(e){e instanceof n&&(e=e.toNumber());if(!l(e)||!c(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,i=this._size[0],s=this._size[1],u=Math.min(i-r,s-t),a=[];for(var f=t;f<s&&a.length<u;f++){var h=this._ptr[f],p=this._ptr[f+1],d=!1;for(var v=h;v<p;v++){var m=this._index[v];if(m===f-t+r){d=!0,a.push(o.clone(this._values[v]));break}if(m>f-t+r)break}!d&&a.length<u&&a.push(0)}return a},d.fromJSON=function(e){return new d(e)},d.diagonal=function(t,r,i){if(!f(t))throw new TypeError("Array expected, size parameter");if(t.length!==2)throw new Error("Only two dimensions matrix are supported");t=t.map(function(e){e instanceof n&&(e=e.toNumber());if(!l(e)||!c(e)||e<1)throw new Error("Size values must be positive integers");return e});if(i){i instanceof n&&(i=i.toNumber());if(!l(i)||!c(i))throw new TypeError("The parameter k must be an integer number")}else i=0;var s=i>0?i:0,o=i<0?-i:0,u=t[0],a=t[1],h=Math.min(u-o,a-s),p;if(f(r)){if(r.length!==h)throw new Error("Invalid value array length");p=function(e){return r[e]}}else p=function(){return r};var v=[],m=[],g=[];for(var y=0;y<a;y++){g.push(v.length);var b=y-s;if(b>=0&&b<h){var w=p(b);e.equal(w,0)||(m.push(b+o),v.push(w))}}return g.push(v.length),new d({values:v,index:m,ptr:g,size:[u,a]})},d.prototype.trace=function(){var t=this._size,n=t[0],r=t[1];if(n===r){var i=0;if(this._values.length>0)for(var s=0;s<r;s++){var o=this._ptr[s],a=this._ptr[s+1];for(var f=o;f<a;f++){var l=this._index[f];if(l===s){i=e.add(i,this._values[f]);break}if(l>s)break}}return i}throw new RangeError("Matrix must be square (size: "+u.format(t)+")")},d.prototype.multiply=function(t){var n=this._size[0],r=this._size[1];if(t instanceof p){var i=t.size();if(i.length===1)return T(this,i[0],1,function(e){return t.get([e])});if(i.length===2)return T(this,i[0],i[1],function(e,n){return t.get([e,n])});throw new Error("Can only multiply a 1 or 2 dimensional matrix (value has "+i.length+" dimensions)")}if(f(t)){var o=s.size(t);if(o.length===1)return T(this,o[0],1,function(e){return t[e]});if(o.length===2)return T(this,o[0],o[1],function(e,n){return t[e][n]});throw new Error("Can only multiply a 1 or 2 dimensional matrix (value has "+o.length+" dimensions)")}var u=function(n){return e.multiply(n,t)};return S(this,0,n-1,0,r-1,u,!1)};var T=function(t,n,r,i){var s=t._size[0],o=t._size[1];if(o!==n)throw new RangeError("Dimension mismatch in multiplication. Columns of A must match length of B (A is "+s+"x"+o+", B is "+n+", "+o+" != "+n+")");var u=[],a=[],f=[],l=[];for(var c=0;c<s;c++)l[c]=0;for(var h=0;h<r;h++){f.push(u.length);for(var p=0;p<o;p++){var v=t._ptr[p],m=t._ptr[p+1];for(var g=v;g<m;g++){var y=t._index[g];l[y]=e.add(l[y],e.multiply(t._values[g],i(p,h)))}}for(var b=0;b<s;b++)e.equal(l[b],0)||(u.push(l[b]),a.push(b)),l[b]=0}return f.push(u.length),s===1&&r===1?u.length===1?u[0]:0:new d({values:u,index:a,ptr:f,size:[s,r]})};return d}},function(e,t,n){"use strict";var r=n(175),i=n(172),s=r.array,o=r.object,u=r.string,a=r.number,f=Array.isArray,l=r.number.isNumber,c=r.number.isInteger,h=s.validateIndex;e.exports=function(e){function d(e){if(!(this instanceof d))throw new SyntaxError("Constructor must be called with the new operator");if(e instanceof p)e.type==="CrsMatrix"?(this._values=o.clone(e._values),this._index=o.clone(e._index),this._ptr=o.clone(e._ptr),this._size=o.clone(e._size)):v(this,e.valueOf());else if(e&&f(e.values)&&f(e.index)&&f(e.ptr)&&f(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size;else if(f(e))v(this,e);else{if(e)throw new TypeError("Unsupported type of data ("+r.types.type(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0]}}var t=e.type.Index,n=e.type.BigNumber,p=e.type.Matrix,v=function(t,n){t._values=[],t._index=[],t._ptr=[];var r=n.length,i=0;for(var s=0;s<r;s++){t._ptr.push(t._values.length);var o=n[s];if(f(o)){o.length>i&&(i=o.length);for(var u=0;u<o.length;u++){var a=o[u];e.equal(a,0)||(t._values.push(a),t._index.push(u))}}else s===0&&i<1&&(i=1),e.equal(o,0)||(t._values.push(o),t._index.push(0))}t._ptr.push(t._values.length),t._size=[r,i]};d.prototype=new e.type.Matrix,d.prototype.type="CrsMatrix",d.prototype.storage=function(){return"crs"},d.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return m(this,e);case 2:case 3:return g(this,e,t,n);default:throw new SyntaxError("Wrong number of arguments")}};var m=function(e,n){if(n instanceof t){var r=n.isScalar();if(r)return e.get(n.min());var s=n.size();if(s.length!=e._size.length)throw new i(s.length,e._size.length);var o=n.min(),u=n.max();for(var a=0,f=e._size.length;a<f;a++)h(o[a],e._size[a]),h(u[a],e._size[a]);var l=function(e){return e};return S(e,o[0],u[0],o[1],u[1],l,!1)}throw new TypeError("Invalid index")},g=function(e,n,r,u){if(n instanceof t){var a=n.size(),f=n.isScalar(),l;r instanceof p?(l=r.size(),r=r.toArray()):l=s.size(r);if(f){if(l.length!==0)throw new TypeError("Scalar expected");e.set(n.min(),r,u)}else{if(a.length!==1&&a.length!==2)throw new i(a.length,e._size.length,"<");if(l.length<a.length){var c=0,h=0;while(a[c]===1&&l[c]===1)c++;while(a[c]===1)h++,c++;r=s.unsqueeze(r,a.length,h,l)}if(!o.deepEqual(a,l))throw new i(a,l,">");var d=n.min()[0],v=n.min()[1],m=l[0],g=l[1];for(var y=0;y<m;y++)for(var b=0;b<g;b++){var w=r[y][b];e.set([y+d,b+v],w,u)}}return e}throw new TypeError("Invalid index")};d.prototype.get=function(e){if(!f(e))throw new TypeError("Array expected");if(e.length!=this._size.length)throw new i(e.length,this._size.length);var t=e[0],n=e[1];h(t,this._size[0]),h(n,this._size[1]);var r=y(n,this._ptr[t],this._ptr[t+1],this._index);return r<this._ptr[t+1]&&this._index[r]===n?o.clone(this._values[r]):0},d.prototype.set=function(t,n,r){if(!f(t))throw new TypeError("Array expected");if(t.length!=this._size.length)throw new i(t.length,this._size.length);var s=t[0],o=t[1],u=this._size[0],a=this._size[1];if(s>u-1||o>a-1)E(this,Math.max(s+1,u),Math.max(o+1,a),r),u=this._size[0],a=this._size[1];h(s,u),h(o,a);var l=y(o,this._ptr[s],this._ptr[s+1],this._index);return l<this._ptr[s+1]&&this._index[l]===o?e.equal(n,0)?b(l,s,this._values,this._index,this._ptr):this._values[l]=n:w(l,s,o,n,this._values,this._index,this._ptr),this};var y=function(e,t,n,r){if(n-t===0||e>r[n-1])return n;while(t<n){var i=~~((t+n)/2),s=r[i];if(e<s)n=i;else{if(!(e>s))return i;t=i+1}}return t},b=function(e,t,n,r,i){n.splice(e,1),r.splice(e,1);for(var s=t+1;s<i.length;s++)i[s]--},w=function(e,t,n,r,i,s,o){i.splice(e,0,r),s.splice(e,0,n);for(var u=t+1;u<o.length;u++)o[u]++};d.prototype.resize=function(e,t,n){if(!f(e))throw new TypeError("Array expected");if(e.length!==2)throw new Error("Only two dimensions matrix are supported");e.forEach(function(t){if(!a.isNumber(t)||!a.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+u.format(e)+")")});var r=n?this.clone():this;return E(r,e[0],e[1],t)};var E=function(t,n,r,i){var s=i||0,o=!e.equal(s,0),u=t._size[0],a=t._size[1],f,l,c;if(n>u){for(f=u;f<n;f++){t._ptr[f]=t._values.length;if(o)for(l=0;l<a;l++)t._values.push(s),t._index.push(l)}t._ptr[n]=t._values.length}else n<u&&(t._ptr.splice(n+1,u-n),t._values.splice(t._ptr[n],t._values.length),t._index.splice(t._ptr[n],t._index.length));u=n;if(r>a){if(o){var h=0;for(f=0;f<u;f++){t._ptr[f]=t._ptr[f]+h,c=t._ptr[f+1]+h;var p=0;for(l=a;l<r;l++,p++)t._values.splice(c+p,0,s),t._index.splice(c+p,0,l),h++}t._ptr[u]=t._values.length}}else if(r<a){var d=0;for(f=0;f<u;f++){t._ptr[f]=t._ptr[f]-d;var v=t._ptr[f],m=t._ptr[f+1]-d;for(c=v;c<m;c++)l=t._index[c],l>r-1&&(t._values.splice(c,1),t._index.splice(c,1),d++)}t._ptr[f]=t._values.length}return t._size[0]=n,t._size[1]=r,t};d.prototype.clone=function(){var e=new d({values:o.clone(this._values),index:o.clone(this._index),ptr:o.clone(this._ptr),size:o.clone(this._size)});return e},d.prototype.size=function(){return o.clone(this._size)},d.prototype.map=function(e,t){var n=this,r=this._size[0],i=this._size[1],s=function(t,r,i){return e(t,[r,i],n)};return S(this,0,r-1,0,i-1,s,t)};var S=function(t,n,r,i,s,o,u){var a=[],f=[],l=[],c=function(t,n,r){t=o(t,n,r),e.equal(t,0)||(a.push(t),f.push(r))};for(var h=n;h<=r;h++){l.push(a.length);var p=t._ptr[h],v=t._ptr[h+1],m=i;for(var g=p;g<v;g++){var y=t._index[g];if(y>=i&&y<=s){if(!u)for(var b=m;b<y;b++)c(0,h-n,b-i);c(t._values[g],h-n,y-i)}m=y+1}if(!u)for(var w=m;w<=s;w++)c(0,h-n,w-i)}return l.push(a.length),new d({values:a,index:f,ptr:l,size:[r-n+1,s-i+1]})};d.prototype.forEach=function(e,t){var n=this,r=this._size[0],i=this._size[1];for(var s=0;s<r;s++){var o=this._ptr[s],u=this._ptr[s+1],a=0;for(var f=o;f<u;f++){var l=this._index[f];if(!t)for(var c=a;c<l;c++)e(0,[s,c],n);e(this._values[f],[s,l],n),a=l+1}if(!t)for(var h=a;h<i;h++)e(0,[s,h],n)}},d.prototype.toArray=function(){return x(this,!0)},d.prototype.valueOf=function(){return x(this,!1)};var x=function(e,t){var n=[],r=e._size[0],i=e._size[1];for(var s=0;s<r;s++){var u=n[s]=[],a=e._ptr[s],f=e._ptr[s+1],l=0;for(var c=a;c<f;c++){var h=e._index[c];for(var p=l;p<h;p++)u[p]=0;u[h]=t?o.clone(e._values[c]):e._values[c],l=h+1}for(var d=l;d<i;d++)u[d]=0}return n};d.prototype.format=function(e){var t=this._size[0],n=this._size[1],r="CRS ["+u.format(t,e)+" x "+u.format(n,e)+"] density: "+u.format(this._values.length/(t*n),e)+"\n";for(var i=0;i<t;i++){var s=this._ptr[i],o=this._ptr[i+1];for(var a=s;a<o;a++){var f=this._index[a];r+="\n    ("+u.format(i,e)+", "+u.format(f,e)+") ==> "+u.format(this._values[a],e)}}return r},d.prototype.toString=function(){return u.format(this.toArray())},d.prototype.toJSON=function(){return{mathjs:"CrsMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size}},d.prototype.transpose=function(){var t=this._size[0],n=this._size[1];if(n===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+u.format(this._size)+")");return new e.type.CcsMatrix({values:o.clone(this._values),index:o.clone(this._index),ptr:o.clone(this._ptr),size:[n,t]})},d.prototype.diagonal=function(e){if(e){e instanceof n&&(e=e.toNumber());if(!l(e)||!c(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,i=this._size[0],s=this._size[1],u=Math.min(i-r,s-t),a=[];for(var f=r;f<i&&a.length<u;f++){var h=this._ptr[f],p=this._ptr[f+1],d=!1;for(var v=h;v<p;v++){var m=this._index[v];if(m===f+t-r){d=!0,a.push(o.clone(this._values[v]));break}if(m>f+t-r)break}!d&&a.length<u&&a.push(0)}return a},d.fromJSON=function(e){return new d(e)},d.diagonal=function(t,r,i){if(!f(t))throw new TypeError("Array expected, size parameter");if(t.length!==2)throw new Error("Only two dimensions matrix are supported");t=t.map(function(e){e instanceof n&&(e=e.toNumber());if(!l(e)||!c(e)||e<1)throw new Error("Size values must be positive integers");return e});if(i){i instanceof n&&(i=i.toNumber());if(!l(i)||!c(i))throw new TypeError("The parameter k must be an integer number")}else i=0;var s=i>0?i:0,o=i<0?-i:0,u=t[0],a=t[1],h=Math.min(u-o,a-s),p;if(f(r)){if(r.length!==h)throw new Error("Invalid value array length");p=function(e){return r[e]}}else p=function(){return r};var v=[],m=[],g=[];for(var y=0;y<u;y++){g.push(v.length);var b=y-o;if(b>=0&&b<h){var w=p(b);e.equal(w,0)||(m.push(b+s),v.push(w))}}return g.push(v.length),new d({values:v,index:m,ptr:g,size:[u,a]})},d.prototype.trace=function(){var t=this._size,n=t[0],r=t[1];if(n===r){var i=0;if(this._values.length>0)for(var s=0;s<n;s++){var o=this._ptr[s],a=this._ptr[s+1];for(var f=o;f<a;f++){var l=this._index[f];if(s===l){i=e.add(i,this._values[f]);break}if(l>s)break}}return i}throw new RangeError("Matrix must be square (size: "+u.format(t)+")")},d.prototype.multiply=function(t){var n=this._size[0],r=this._size[1];if(t instanceof p){var i=t.size();if(i.length===1)return T(this,i[0],1,function(e){return t.get([e])});if(i.length===2)return T(this,i[0],i[1],function(e,n){return t.get([e,n])});throw new Error("Can only multiply a 1 or 2 dimensional matrix (value has "+i.length+" dimensions)")}if(f(t)){var o=s.size(t);if(o.length===1)return T(this,o[0],1,function(e){return t[e]});if(o.length===2)return T(this,o[0],o[1],function(e,n){return t[e][n]});throw new Error("Can only multiply a 1 or 2 dimensional matrix (value has "+o.length+" dimensions)")}var u=function(n){return e.multiply(n,t)};return S(this,0,n-1,0,r-1,u,!1)};var T=function(t,n,r,i){var s=t._size[0],o=t._size[1];if(o!==n)throw new RangeError("Dimension mismatch in multiplication. Columns of A must match length of B (A is "+s+"x"+o+", B is "+n+", "+o+" != "+n+")");var u=[],a=[],f=[];for(var l=0;l<s;l++){f.push(u.length);var c=t._ptr[l],h=t._ptr[l+1];for(var p=0;p<r;p++){var v=0;for(var m=c;m<h;m++){var g=t._index[m];v=e.add(v,e.multiply(t._values[m],i(g,p)))}e.equal(v,0)||(u.push(v),a.push(p))}}return f.push(u.length),s===1&&r===1?u.length===1?u[0]:0:new d({values:u,index:a,ptr:f,size:[s,r]})};return d}},function(e,t,n){"use strict";var r=n(175),i=n(172),s=r.string,o=r.array,u=r.object,a=Array.isArray,f=r.number.isNumber,l=r.number.isInteger,c=o.validateIndex;e.exports=function(e){function p(e){if(!(this instanceof p))throw new SyntaxError("Constructor must be called with the new operator");if(e instanceof h)e.type==="DenseMatrix"?(this._data=u.clone(e._data),this._size=u.clone(e._size)):(this._data=e.toArray(),this._size=e.size());else if(e&&a(e.data)&&a(e.size))this._data=e.data,this._size=e.size;else if(a(e))this._data=C(e),this._size=o.size(this._data);else{if(e)throw new TypeError("Unsupported type of data ("+r.types.type(e)+")");this._data=[],this._size=[0]}}function d(e,n){if(n instanceof t){var r=n.isScalar();if(r)return e.get(n.min());var s=n.size();if(s.length!=e._size.length)throw new i(s.length,e._size.length);var o=n.min(),u=n.max();for(var a=0,f=e._size.length;a<f;a++)c(o[a],e._size[a]),c(u[a],e._size[a]);return new p(v(e._data,n,s.length,0))}throw new TypeError("Invalid index")}function v(e,t,n,r){var i=r==n-1,s=t.range(r);return i?s.map(function(t){return e[t]}):s.map(function(i){var s=e[i];return v(s,t,n,r+1)})}function m(n,r,s,a){if(r instanceof t){var f=r.size(),l=r.isScalar(),c;s instanceof e.type.Matrix?(c=s.size(),s=s.valueOf()):c=o.size(s);if(l){if(c.length!==0)throw new TypeError("Scalar expected");n.set(r.min(),s,a)}else{if(f.length<n._size.length)throw new i(f.length,n._size.length,"<");if(c.length<f.length){var h=0,p=0;while(f[h]===1&&c[h]===1)h++;while(f[h]===1)p++,h++;s=o.unsqueeze(s,f.length,p,c)}if(!u.deepEqual(f,c))throw new i(f,c,">");var d=r.max().map(function(e){return e+1});b(n,d,a);var v=f.length,m=0;g(n._data,r,s,v,m)}return n}throw new TypeError("Invalid index")}function g(e,t,n,r,i){var s=i==r-1,o=t.range(i);s?o.forEach(function(t,r){c(t),e[t]=n[r]}):o.forEach(function(s,o){c(s),g(e[s],t,n[o],r,i+1)})}function b(e,t,n){var r=u.clone(e._size),i=!1;while(r.length<t.length)r.push(0),i=!0;for(var s=0,o=t.length;s<o;s++)t[s]>r[s]&&(r[s]=t[s],i=!0);i&&y(e,r,n)}function C(t){for(var n=0,r=t.length;n<r;n++){var i=t[n];a(i)?t[n]=C(i):i instanceof e.type.Matrix&&(t[n]=C(i.valueOf()))}return t}var t=e.type.Index,n=e.type.BigNumber,h=e.type.Matrix;p.prototype=new e.type.Matrix,p.prototype.type="DenseMatrix",p.prototype.storage=function(){return"dense"},p.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return d(this,e);case 2:case 3:return m(this,e,t,n);default:throw new SyntaxError("Wrong number of arguments")}},p.prototype.get=function(e){if(!a(e))throw new TypeError("Array expected");if(e.length!=this._size.length)throw new i(e.length,this._size.length);for(var t=0;t<e.length;t++)c(e[t],this._size[t]);var n=this._data;for(var r=0,s=e.length;r<s;r++){var o=e[r];c(o,n.length),n=n[o]}return u.clone(n)},p.prototype.set=function(e,t,n){if(!a(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new i(e.length,this._size.length,"<");var r,s,o,u=e.map(function(e){return e+1});b(this,u,n);var f=this._data;for(r=0,s=e.length-1;r<s;r++)o=e[r],c(o,f.length),f=f[o];return o=e[e.length-1],c(o,f.length),f[o]=t,this},p.prototype.resize=function(e,t,n){if(!a(e))throw new TypeError("Array expected");var r=n?this.clone():this;return y(r,e,t)};var y=function(e,t,n){if(t.length===0){var r=e._data;while(a(r))r=r[0];return u.clone(r)}return e._size=u.clone(t),e._data=o.resize(e._data,e._size,n),e};p.prototype.clone=function(){var e=new p({data:u.clone(this._data),size:u.clone(this._size)});return e},p.prototype.size=function(){return this._size},p.prototype.map=function(e){var t=this,n=function(r,i){return a(r)?r.map(function(e,t){return n(e,i.concat(t))}):e(r,i,t)};return new p({data:n(this._data,[]),size:u.clone(this._size)})},p.prototype.forEach=function(e){var t=this,n=function(r,i){a(r)?r.forEach(function(e,t){n(e,i.concat(t))}):e(r,i,t)};n(this._data,[])},p.prototype.toArray=function(){return u.clone(this._data)},p.prototype.valueOf=function(){return this._data},p.prototype.format=function(e){return s.format(this._data,e)},p.prototype.toString=function(){return s.format(this._data)},p.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size}},p.prototype.transpose=function(){switch(this._size.length){case 1:return this.clone();case 2:var e=this._size[0],t=this._size[1];if(t===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+s.format(this._size)+")");var n=[],r;for(var i=0;i<t;i++){r=n[i]=[];for(var o=0;o<e;o++)r[o]=u.clone(this._data[o][i])}return new p({data:n,size:[t,e]});default:throw new RangeError("Matrix must be two dimensional (size: "+s.format(this._size)+")")}},p.prototype.diagonal=function(e){if(e){e instanceof n&&(e=e.toNumber());if(!f(e)||!l(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,i=this._size[0],s=this._size[1],o=Math.min(i-r,s-t),a=[];for(var c=0;c<o;c++)a[c]=u.clone(this._data[c+r][c+t]);return a},p.diagonal=function(e,t,r,i){if(!a(e))throw new TypeError("Array expected, size parameter");if(e.length!==2)throw new Error("Only two dimensions matrix are supported");e=e.map(function(e){e instanceof n&&(e=e.toNumber());if(!f(e)||!l(e)||e<1)throw new Error("Size values must be positive integers");return e});if(r){r instanceof n&&(r=r.toNumber());if(!f(r)||!l(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var s=r>0?r:0,u=r<0?-r:0,c=e[0],h=e[1],d=Math.min(c-u,h-s),v;if(a(t)){if(t.length!==d)throw new Error("Invalid value array length");v=function(e){return t[e]}}else v=function(){return t};var m=[];if(e.length>0){m=o.resize(m,e,i);for(var g=0;g<d;g++)m[g+u][g+s]=v(g)}return new p({data:m,size:[c,h]})},p.prototype.trace=function(){var t=this._size,n=this._data;switch(t.length){case 1:if(t[0]==1)return u.clone(n[0]);throw new RangeError("Matrix must be square (size: "+s.format(t)+")");case 2:var r=t[0],i=t[1];if(r===i){var o=0;for(var a=0;a<r;a++)o=e.add(o,n[a][a]);return o}throw new RangeError("Matrix must be square (size: "+s.format(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+s.format(t)+")")}},p.fromJSON=function(e){return new p(e)},p.prototype.multiply=function(e){switch(this._size.length){case 1:return w(this,this._size[0],e);case 2:return x(this,this._size[0],this._size[1],e);default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (matrix has "+this._size.length+" dimensions)")}};var w=function(t,n,r){if(r instanceof h){var i=r.size();if(i.length===1){if(i[0]!==n)throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length.");return E(t,n,function(e){return r.get([e])})}if(i.length===2){if(i[0]!==n)throw new RangeError("Dimension mismatch in multiplication. Matrix rows and Vector length must be equal.");return S(t,n,i[1],function(e,t){return r.get([e,t])})}throw new Error("Can only multiply a 1 or 2 dimensional matrix (value has "+i.length+" dimensions)")}if(a(r)){var s=o.size(r);if(s.length===1){if(s[0]!==n)throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length.");return E(t,n,function(e){return r[e]})}if(s.length===2){if(s[0]!==n)throw new RangeError("Dimension mismatch in multiplication. Matrix rows and Vector length must be equal.");return S(t,n,s[1],function(e,t){return r[e][t]})}throw new Error("Can only multiply a 1 or 2 dimensional matrix (value has "+s.length+" dimensions)")}return t.map(function(t){return e.multiply(r,t)})},E=function(t,n,r){if(n===0)throw new Error("Cannot multiply two empty vectors");var i=0;for(var s=0;s<n;s++)i=e.add(i,e.multiply(t._data[s],r(s)));return i},S=function(t,n,r,i){var s=[];for(var o=0;o<r;o++){var u=0;for(var a=0;a<n;a++)u=e.add(u,e.multiply(t._data[a],i(a,o)));s[o]=u}return r===1?s[0]:new p({data:s,size:[r]})},x=function(t,n,r,i){if(i instanceof h){var s=i.size();if(s.length===1){if(s[0]!==r)throw new RangeError("Dimension mismatch in multiplication. Matrix columns must match vector length.");return T(t,n,r,function(e){return i.get([e])})}if(s.length===2){if(s[0]!==r)throw new RangeError("Dimension mismatch in multiplication. Columns of A must match length of B (A is "+n+"x"+r+", B is "+s[0]+", "+r+" != "+s[0]+")");return N(t,n,r,s[1],function(e,t){return i.get([e,t])})}throw new Error("Can only multiply a 1 or 2 dimensional matrix (value has "+s.length+" dimensions)")}if(a(i)){var u=o.size(i);if(u.length===1){if(u[0]!==r)throw new RangeError("Dimension mismatch in multiplication. Matrix columns must match vector length.");return T(t,n,r,function(e){return i[e]})}if(u.length===2){if(u[0]!==r)throw new RangeError("Dimension mismatch in multiplication. Columns of A must match length of B (A is "+n+"x"+r+", B is "+u[0]+", "+r+" != "+u[0]+")");return N(t,n,r,u[1],function(e,t){return i[e][t]})}throw new Error("Can only multiply a 1 or 2 dimensional matrix (value has "+u.length+" dimensions)")}return t.map(function(t){return e.multiply(i,t)})},T=function(t,n,r,i){var s=[];for(var o=0;o<n;o++){var u=t._data[o],a=0;for(var f=0;f<r;f++)a=e.add(a,e.multiply(u[f],i(f)));s[o]=a}return n===1?s[0]:new p({data:s,size:[n]})},N=function(t,n,r,i,s){var o=[];for(var u=0;u<n;u++){var a=t._data[u];o[u]=[];for(var f=0;f<i;f++){var l=0;for(var c=0;c<r;c++)l=e.add(l,e.multiply(a[c],s(c,f)));o[u][f]=l}}return n===1&&i===1?o[0][0]:new p({data:o,size:[n,i]})};return p}},function(e,t,n){"use strict";t.ArrayNode=n(177),t.AssignmentNode=n(178),t.BlockNode=n(179),t.ConditionalNode=n(180),t.ConstantNode=n(181),t.IndexNode=n(182),t.FunctionAssignmentNode=n(183),t.FunctionNode=n(184),t.Node=n(185),t.OperatorNode=n(186),t.RangeNode=n(187),t.SymbolNode=n(188),t.UpdateNode=n(189)},function(e,t,n){"use strict";var r=n(175),i=n(171),s=r.string.isString,o=Array.isArray,u=n(177),a=n(178),f=n(179),l=n(180),c=n(181),h=n(183),p=n(182),d=n(186),v=n(184),m=n(187),g=n(188),y=n(189);e.exports=function(e){function r(e,r){if(arguments.length!=1&&arguments.length!=2)throw new i("parse",arguments.length,1,2);S=r&&r.nodes?r.nodes:{};if(s(e))return x=e,R();if(o(e)||e instanceof t)return n.deepMap(e,function(e){if(!s(e))throw new TypeError("String expected");return x=e,R()});throw new TypeError("String or matrix expected")}function O(){T=0,N=x.charAt(0),L=0,A=null}function M(){T++,N=x.charAt(T)}function _(){return x.charAt(T+1)}function D(){return x.charAt(T+2)}function P(){k=b.NULL,C="";while(N==" "||N=="	"||N=="\n"&&L)M();if(N=="#")while(N!="\n"&&N!="")M();if(N==""){k=b.DELIMITER;return}if(N=="\n"&&!L){k=b.DELIMITER,C=N,M();return}var e=N+_(),t=e+D();if(t.length==3&&w[t]){k=b.DELIMITER,C=t,M(),M(),M();return}if(e.length==2&&w[e]){k=b.DELIMITER,C=e,M(),M();return}if(w[N]){k=b.DELIMITER,C=N,M();return}if(I(N)){k=b.NUMBER;if(N==".")C+=N,M(),q(N)||(k=b.UNKNOWN);else{while(q(N))C+=N,M();N=="."&&(C+=N,M())}while(q(N))C+=N,M();e=_();if((N=="E"||N=="e")&&(q(e)||e=="-"||e=="+")){C+=N,M();if(N=="+"||N=="-")C+=N,M();q(N)||(k=b.UNKNOWN);while(q(N))C+=N,M()}return}if(F(N)){while(F(N)||q(N))C+=N,M();E[C]?k=b.DELIMITER:k=b.SYMBOL;return}k=b.UNKNOWN;while(N!="")C+=N,M();throw yt('Syntax error in part "'+C+'"')}function H(){do P();while(C=="\n")}function B(){L++}function j(){L--}function F(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e=="_"}function I(e){return e>="0"&&e<="9"||e=="."}function q(e){return e>="0"&&e<="9"}function R(){O(),P();var e=U();if(C!="")throw k==b.DELIMITER?bt("Unexpected operator "+C):yt('Unexpected part "'+C+'"');return e}function U(){var e,t=[],n;if(C=="")return new c("undefined","undefined");C!="\n"&&C!=";"&&(e=z());while(C=="\n"||C==";")t.length==0&&e&&(n=C!=";",t.push({node:e,visible:n})),P(),C!="\n"&&C!=";"&&C!=""&&(e=z(),n=C!=";",t.push({node:e,visible:n}));return t.length>0?new f(t):e}function z(){if(k==b.SYMBOL&&C=="function")throw yt('Deprecated keyword "function". Functions can now be assigned without it, like "f(x) = x^2".');return W()}function W(){var e,t,n,r,i=X();if(C=="="){if(i instanceof g)return e=i.name,H(),n=W(),new a(e,n);if(i instanceof p)return H(),n=W(),new y(i,n);if(i instanceof v){r=!0,t=[],e=i.name,i.args.forEach(function(e,n){e instanceof g?t[n]=e.name:r=!1});if(r)return H(),n=W(),new h(e,t,n)}throw yt("Invalid left hand side of assignment operator =")}return i}function X(){var e=V();while(C=="?"){var t=A;A=L,H();var n=e,r=V();if(C!=":")throw yt("False part of conditional expression expected");A=null,H();var i=X();e=new l(n,r,i),A=t}return e}function V(){var e=$();while(C=="or")H(),e=new d("or","or",[e,$()]);return e}function $(){var e=J();while(C=="xor")H(),e=new d("xor","xor",[e,J()]);return e}function J(){var e=K();while(C=="and")H(),e=new d("and","and",[e,K()]);return e}function K(){var e=Q();while(C=="|")H(),e=new d("|","bitOr",[e,Q()]);return e}function Q(){var e=G();while(C=="^|")H(),e=new d("^|","bitXor",[e,G()]);return e}function G(){var e=Y();while(C=="&")H(),e=new d("&","bitAnd",[e,Y()]);return e}function Y(){var e,t,n,r,i;e=Z(),t={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};while(C in t)n=C,r=t[n],H(),i=[e,Z()],e=new d(n,r,i);return e}function Z(){var e,t,n,r,i;e=et(),t={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};while(C in t)n=C,r=t[n],H(),i=[e,et()],e=new d(n,r,i);return e}function et(){var e,t,n,r,i;e=tt(),t={to:"to","in":"to"};while(C in t)n=C,r=t[n],H(),i=[e,tt()],e=new d(n,r,i);return e}function tt(){var e,t=[];C==":"?e=new c("1","number"):e=nt();if(C==":"&&A!==L){t.push(e);while(C==":"&&t.length<3)H(),C==")"||C=="]"||C==","||C==""?t.push(new g("end")):t.push(nt());t.length==3?e=new m(t[0],t[2],t[1]):e=new m(t[0],t[1])}return e}function nt(){var e,t,n,r,i;e=rt(),t={"+":"add","-":"subtract"};while(C in t)n=C,r=t[n],H(),i=[e,rt()],e=new d(n,r,i);return e}function rt(){var e,t,n,r,i;e=it(),t={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};if(C in t)while(C in t)n=C,r=t[n],H(),i=[e,it()],e=new d(n,r,i);if(k==b.SYMBOL||C=="in"&&e instanceof c||k==b.NUMBER&&!(e instanceof c)||C=="("||C=="[")e=new d("*","multiply",[e,rt()]);return e}function it(){var e,t,n={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"}[C];return n?(e=C,H(),t=[it()],new d(e,n,t)):st()}function st(){var e,t,n,r;e=ot();if(C=="^"||C==".^")t=C,n=t=="^"?"pow":"dotPow",H(),r=[e,it()],e=new d(t,n,r);return e}function ot(){var e,t,n,r,i;e=ut(),t={"!":"factorial","'":"transpose"};while(C in t)n=C,r=t[n],P(),i=[e],e=new d(n,r,i);return e}function ut(){var e=[],t;if(k==b.SYMBOL&&S[C]){t=S[C],P();if(C=="("){e=[],B(),P();if(C!=")"){e.push(X());while(C==",")P(),e.push(X())}if(C!=")")throw yt("Parenthesis ) expected");j(),P()}return new t(e)}return at()}function at(){var e,t;return k==b.SYMBOL||k==b.DELIMITER&&C in E?(t=C,P(),e=ft(t),e=lt(e),e):ct()}function ft(e){var t;if(C=="("){t=[],B(),P();if(C!=")"){t.push(X());while(C==",")P(),t.push(X())}if(C!=")")throw yt("Parenthesis ) expected");return j(),P(),new v(e,t)}return new g(e)}function lt(e){var t;while(C=="["){t=[],B(),P();if(C!="]"){t.push(X());while(C==",")P(),t.push(X())}if(C!="]")throw yt("Parenthesis ] expected");j(),P(),e=new p(e,t)}return e}function ct(){var e,t,n;if(C=='"'){t="",n="";while(N!=""&&(N!='"'||n=="\\"))t+=N,n=N,M();P();if(C!='"')throw yt('End of string " expected');return P(),e=new c(t,"string"),e=lt(e),e}return ht()}function ht(){var e,t,n,r;if(C=="["){B(),P();if(C!="]"){var i=pt();if(C==";"){n=1,t=[i];while(C==";")P(),t[n]=pt(),n++;if(C!="]")throw yt("End of matrix ] expected");j(),P(),r=t[0].nodes.length;for(var s=1;s<n;s++)if(t[s].nodes.length!=r)throw bt("Column dimensions mismatch ("+t[s].nodes.length+" != "+r+")");e=new u(t)}else{if(C!="]")throw yt("End of matrix ] expected");j(),P(),e=i}}else j(),P(),e=new u([]);return e}return dt()}function pt(){var e=[W()],t=1;while(C==",")P(),e[t]=W(),t++;return new u(e)}function dt(){var e;return k==b.NUMBER?(e=C,P(),new c(e,"number")):vt()}function vt(){var e;if(C=="("){B(),P(),e=W();if(C!=")")throw yt("Parenthesis ) expected");return j(),P(),e}return mt()}function mt(){throw C==""?yt("Unexpected end of expression"):yt("Value expected")}function gt(){return T-C.length+1}function yt(e){var t=gt(),n=new SyntaxError(e+" (char "+t+")");return n["char"]=t,n}function bt(e){var t=gt(),n=new Error(e+" (char "+t+")");return n["char"]=t,n}var t=e.type.Matrix,n=e.collection,b={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},w={",":!0,"(":!0,")":!0,"[":!0,"]":!0,'"':!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"'":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,"in":!0,and:!0,xor:!0,or:!0,not:!0},S={},x="",T=0,N="",C="",k=b.NULL,L=0,A=null;return r}},function(e,t,n){"use strict";e.exports=function(e){function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.scope={}}var t=e.expression.parse;return n.prototype.parse=function(e){throw new Error("Parser.parse is deprecated. Use math.parse instead.")},n.prototype.compile=function(e){throw new Error("Parser.compile is deprecated. Use math.compile instead.")},n.prototype.eval=function(n){return t(n).compile(e).eval(this.scope)},n.prototype.get=function(e){return this.scope[e]},n.prototype.set=function(e,t){return this.scope[e]=t},n.prototype.remove=function(e){delete this.scope[e]},n.prototype.clear=function(){for(var e in this.scope)this.scope.hasOwnProperty(e)&&delete this.scope[e]},n}},function(e,t,n){t.e=n(190),t.E=n(190),t["false"]=n(191),t.i=n(192),t.Infinity=n(193),t.LN2=n(194),t.LN10=n(195),t.LOG2E=n(196),t.LOG10E=n(197),t.NaN=n(198),t["null"]=n(199),t.pi=n(200),t.PI=n(200),t.phi=n(201),t.SQRT1_2=n(202),t.SQRT2=n(203),t.tau=n(204),t["true"]=n(205),t.version=n(206),t.abs=n(210),t.add=n(211),t.ceil=n(212),t.cube=n(213),t.divide=n(214),t.dotDivide=n(215),t.dotMultiply=n(216),t.dotPow=n(217),t.exp=n(218),t.fix=n(219),t.floor=n(220),t.gcd=n(221),t.lcm=n(222),t.log=n(223),t.log10=n(224),t.mod=n(225),t.multiply=n(226),t.norm=n(227),t.nthRoot=n(228),t.pow=n(229),t.round=n(230),t.sign=n(231),t.sqrt=n(232),t.square=n(233),t.subtract=n(234),t.unaryMinus=n(235),t.unaryPlus=n(236),t.xgcd=n(237),t.bitAnd=n(238),t.bitNot=n(239),t.bitOr=n(240),t.bitXor=n(241),t.leftShift=n(242),t.rightArithShift=n(243),t.rightLogShift=n(244),t.arg=n(245),t.conj=n(246),t.re=n(247),t.im=n(248),t.bignumber=n(249),t["boolean"]=n(250),t.complex=n(251),t.index=n(252),t.matrix=n(253),t.number=n(254),t.string=n(255),t.unit=n(256),t.eval=n(257),t.help=n(258),t.and=n(259),t.not=n(260),t.or=n(261),t.xor=n(262),t.concat=n(263),t.cross=n(264),t.det=n(265),t.diag=n(266),t.dot=n(267),t.eye=n(268),t.flatten=n(269),t.inv=n(270),t.ones=n(271),t.range=n(272),t.resize=n(273),t.size=n(274),t.squeeze=n(275),t.subset=n(276),t.trace=n(277),t.transpose=n(278),t.zeros=n(279),t.combinations=n(280),t.factorial=n(281),t.gamma=n(282),t.permutations=n(283),t.pickRandom=n(284),t.random=n(285),t.randomInt=n(286),t.compare=n(287),t.deepEqual=n(288),t.equal=n(289),t.larger=n(290),t.largerEq=n(291),t.smaller=n(292),t.smallerEq=n(293),t.unequal=n(294),t.max=n(295),t.mean=n(296),t.median=n(297),t.min=n(298),t.prod=n(299),t.std=n(300),t.sum=n(301),t["var"]=n(302),t.acos=n(303),t.acosh=n(304),t.acot=n(305),t.acoth=n(306),t.acsc=n(307),t.acsch=n(308),t.asec=n(309),t.asech=n(310),t.asin=n(311),t.asinh=n(312),t.atan=n(313),t.atanh=n(314),t.atan2=n(315),t.cos=n(316),t.cosh=n(317),t.cot=n(318),t.coth=n(319),t.csc=n(320),t.csch=n(321),t.sec=n(322),t.sech=n(323),t.sin=n(324),t.sinh=n(325),t.tan=n(326),t.tanh=n(327),t.to=n(328),t.clone=n(329),t.map=n(330),t.filter=n(331),t.forEach=n(332),t.format=n(333),t["import"]=n(334),t.sort=n(335),t["typeof"]=n(336)},function(e,t,n){"use strict";e.exports=function(e){function t(t,n){var r=n&&n.mathjs,i=e.type[r];return i&&i.fromJSON?i.fromJSON(n):n}return t}},function(e,t,n){"use strict";var r=n(5),i=n(208).transform,s=n(3).isNumber,o=n(169).argsToArray;e.exports=function(e){var t=function(){var t=o(arguments),n=t.length-1,u=t[n];s(u)?t[n]=u-1:u instanceof r&&(t[n]=u.minus(1));try{return e.concat.apply(e,t)}catch(a){throw i(a)}};return e.concat.transform=t,t}},function(e,t,n){"use strict";var r=n(188),i=n(209).isBoolean,s=n(169).argsToArray,o=n(171);e.exports=function(e){var t=e.filter,n=function(e,n,i){if(e.length!==2)throw new o("filter",arguments.length,2);var s=e[0].compile(n).eval(i),u;if(e[1]instanceof r)u=e[1].compile(n).eval(i);else{var a=i||{},f=e[1].filter(function(e){return e instanceof r&&!(e.name in n)&&!(e.name in a)})[0],l=Object.create(a),c=e[1].compile(n);if(!f)throw new Error("No undefined variable found in filter equation");var h=f.name;u=function(e){return l[h]=e,c.eval(l)}}return t(s,u)};return n.rawArgs=!0,e.filter.transform=n,n}},function(e,t,n){"use strict";e.exports=function(e){function r(e,t,n){var r=function(e,i){Array.isArray(e)?e.forEach(function(e,t){r(e,i.concat(t+1))}):t(e,i,n)};r(e,[])}var t=e.type.Matrix,n=function(n,i){if(arguments.length!=2)throw new e.error.ArgumentsError("forEach",arguments.length,2);if(Array.isArray(n))r(n,i,n);else{if(!(n instanceof t))throw new e.error.UnsupportedTypeError("forEach",e["typeof"](n));r(n.valueOf(),i,n)}};return e.forEach.transform=n,n}},function(e,t,n){"use strict";var r=n(5),i=n(8),s=n(9),o=n(3).isNumber;e.exports=function(e){var t=function(){var e=[];for(var t=0,n=arguments.length;t<n;t++){var u=arguments[t];if(u instanceof i)u.start--,u.end-=u.step>0?0:2;else if(o(u))u--;else{if(!(u instanceof r))throw new TypeError("Ranges must be a Number or Range");u=u.toNumber()-1}e[t]=u}var a=new s;return s.apply(a,e),a};return e.index.transform=t,t}},function(e,t,n){"use strict";e.exports=function(e){function r(e,t,n){var r=function(e,i){return Array.isArray(e)?e.map(function(e,t){return r(e,i.concat(t+1))}):t(e,i,n)};return r(e,[])}var t=e.type.Matrix,n=function(n,i){if(arguments.length!=2)throw new e.error.ArgumentsError("map",arguments.length,2);if(Array.isArray(n))return r(n,i,n);if(n instanceof t)return e.matrix(r(n.valueOf(),i,n));throw new e.error.UnsupportedTypeError("map",e["typeof"](n))};return e.map.transform=n,n}},function(e,t,n){"use strict";var r=n(5),i=n(208).transform,s=n(3).isNumber,o=n(169).argsToArray;e.exports=function(e){var t=e.collection.isCollection,n=function(){var n=o(arguments);if(n.length==2&&t(n[0])){var u=n[1];s(u)?n[1]=u-1:u instanceof r&&(n[1]=u.minus(1))}try{return e.max.apply(e,n)}catch(a){throw i(a)}};return e.max.transform=n,n}},function(e,t,n){"use strict";var r=n(5),i=n(208).transform,s=n(3).isNumber,o=n(169).argsToArray;e.exports=function(e){var t=e.collection.isCollection,n=function(){var n=o(arguments);if(n.length==2&&t(n[0])){var u=n[1];s(u)?n[1]=u-1:u instanceof r&&(n[1]=u.minus(1))}try{return e.mean.apply(e,n)}catch(a){throw i(a)}};return e.mean.transform=n,n}},function(e,t,n){"use strict";var r=n(5),i=n(208).transform,s=n(3).isNumber,o=n(169).argsToArray;e.exports=function(e){var t=e.collection.isCollection,n=function(){var n=o(arguments);if(n.length==2&&t(n[0])){var u=n[1];s(u)?n[1]=u-1:u instanceof r&&(n[1]=u.minus(1))}try{return e.min.apply(e,n)}catch(a){throw i(a)}};return e.min.transform=n,n}},function(e,t,n){"use strict";var r=n(209).isBoolean,i=n(169).argsToArray;e.exports=function(e){var t=function(){var t=i(arguments),n=t.length-1,s=t[n];return r(s)||t.push(!0),e.range.apply(e,t)};return e.range.transform=t,t}},function(e,t,n){"use strict";var r=n(208).transform,i=n(209).isBoolean,s=n(169).argsToArray;e.exports=function(e){var t=function(){try{return e.subset.apply(e,s(arguments))}catch(t){throw r(t)}};return e.subset.transform=t,t}},function(e,t,n){"use strict";e.exports=function(e){function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");e instanceof r?this.value=e.value:this.value=e}function i(e,t){var n=Array.prototype.slice;typeof t=="function"?r.prototype[e]=function(){var e=[this.value].concat(n.call(arguments,0));return new r(t.apply(this,e))}:r.prototype[e]=new r(t)}var t=n(176);r.prototype.done=function(){return this.value},r.prototype.valueOf=function(){return this.value},r.prototype.toString=function(){return t.format(this.value)},r.createProxy=i;for(var s in e)e.hasOwnProperty(s)&&i(s,e[s]);return r}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=e.collection,s=i.isCollection,o=t.number.isNumber,u=t.string.isString,a=t["boolean"].isBoolean;e.bignumber=function f(t){if(arguments.length>1)throw new e.error.ArgumentsError("bignumber",arguments.length,0,1);if(t instanceof r||o(t)||u(t))return new r(t);if(a(t)||t===null)return new r(+t);if(s(t))return i.deepMap(t,f);if(arguments.length==0)return new r(0);throw new e.error.UnsupportedTypeError("bignumber",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=e.collection,s=i.isCollection,o=t.number.isNumber,u=t.string.isString;e["boolean"]=function a(t){if(arguments.length!=1)throw new e.error.ArgumentsError("boolean",arguments.length,0,1);if(t==="true"||t===!0)return!0;if(t==="false"||t===!1||t===null)return!1;if(t instanceof Boolean)return t==1;if(o(t))return t!==0;if(t instanceof r)return!t.isZero();if(u(t)){var n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;var f=Number(t);if(t!=""&&!isNaN(f))return f!==0}if(s(t))return i.deepMap(t,a);throw new SyntaxError(t.toString()+" is no valid boolean")}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=s.isCollection,u=t.number.isNumber,a=t.string.isString,f=i.isComplex;e.complex=function l(t){switch(arguments.length){case 0:return new i(0,0);case 1:var n=arguments[0];if(u(n))return new i(n,0);if(n instanceof r)return new i(n.toNumber(),0);if(f(n))return n.clone();if(a(n)){var c=i.parse(n);if(c)return c;throw new SyntaxError('String "'+n+'" is no valid complex number')}if(o(n))return s.deepMap(n,l);if(typeof n=="object"){if("re"in n&&"im"in n)return new i(n.re,n.im);if("r"in n&&"phi"in n)return i.fromPolar(n.r,n.phi)}throw new TypeError("Two numbers, single string or an fitting object expected in function complex");case 2:var h=arguments[0],p=arguments[1];h instanceof r&&(h=h.toNumber()),p instanceof r&&(p=p.toNumber());if(u(h)&&u(p))return new i(h,p);throw new TypeError("Two numbers or a single string expected in function complex");default:throw new e.error.ArgumentsError("complex",arguments.length,0,2)}}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(9);e.index=function(e){var t=Array.prototype.slice.apply(arguments).map(function(e){return e instanceof r?e.toNumber():Array.isArray(e)?e.map(function(e){return e instanceof r?e.toNumber():e}):e}),n=new i;return i.apply(n,t),n}}},function(e,t,n){"use strict";var r=n(176),i=Array.isArray,s=r.isString;e.exports=function(e){var t=e.type.Matrix;e.matrix=function(r,o){switch(arguments.length){case 0:r=[],o="default";break;case 1:i(r)?o="default":r instanceof t?o=r.storage():s(r)&&(o=r,r=[]);break;case 2:if(!i(r)&&!(r instanceof t))throw new TypeError("data must be an array value or Matrix instance");break;default:throw new e.error.ArgumentsError("matrix",arguments.length,0,2)}var u=t.storage(o);return new u(r)}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=e.type.Unit,s=e.collection,o=s.isCollection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=t.string.isString;e.number=function l(t,n){switch(arguments.length){case 0:return 0;case 1:if(o(t))return s.deepMap(t,l);if(t instanceof r)return t.toNumber();if(f(t)){var c=Number(t);isNaN(c)&&(c=Number(t.valueOf()));if(isNaN(c))throw new SyntaxError(t.toString()+" is no valid number");return c}if(a(t)||t===null)return+t;if(u(t))return t;if(t instanceof i)throw new Error("Second argument with valueless unit expected");throw new e.error.UnsupportedTypeError("number",e["typeof"](t));case 2:if(t instanceof i&&f(n)||n instanceof i)return t.toNumber(n);throw new e.error.UnsupportedTypeError("number",e["typeof"](t),e["typeof"](n));default:throw new e.error.ArgumentsError("number",arguments.length,0,1)}}}},function(e,t,n){"use strict";e.exports=function(e){var t=e.expression.Parser;e.parser=function(){return new t}}},function(e,t,n){"use strict";e.exports=function(e){e.chain=function(t){return new e.chaining.Chain(t)},e.select=function(t){return console&&typeof console.log=="function"&&console.log('WARNING: Function "select" is renamed to "chain". It will be deprecated in v2.0.'),e.select=e.chain,e.chaining.Chain.prototype.select=e.select,e.chain(t)}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.collection,i=t.number,s=t.number.isNumber,o=r.isCollection;e.string=function u(t){switch(arguments.length){case 0:return"";case 1:if(s(t))return i.format(t);if(o(t))return r.deepMap(t,u);if(t===null)return"null";return t.toString();default:throw new e.error.ArgumentsError("string",arguments.length,0,1)}}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(11),s=e.collection,o=s.isCollection,u=t.string.isString;e.unit=function a(t){switch(arguments.length){case 1:var n=arguments[0];if(n instanceof i)return n.clone();if(u(n)){if(i.isValuelessUnit(n))return new i(null,n);var f=i.parse(n);if(f)return f;throw new SyntaxError('String "'+n+'" is no valid unit')}if(o(t))return s.deepMap(t,a);throw new TypeError("A string or a number and string expected in function unit");case 2:return arguments[0]instanceof r?new i(arguments[0].toNumber(),arguments[1]):new i(arguments[0],arguments[1]);default:throw new e.error.ArgumentsError("unit",arguments.length,1,2)}}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.expression.parse,s=e.collection,o=r.string.isString,u=s.isCollection;e.compile=function(n){if(arguments.length!=1)throw new e.error.ArgumentsError("compile",arguments.length,1);if(o(n))return i(n).compile(e);if(u(n))return s.deepMap(n,function(t){return i(t).compile(e)});throw new TypeError("String, array, or matrix expected")}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.expression.parse,i=e.collection,s=t.string.isString,o=i.isCollection;e.eval=function(n,u){if(arguments.length!=1&&arguments.length!=2)throw new e.error.ArgumentsError("eval",arguments.length,1,2);u=u||{};if(s(n))return r(n).compile(e).eval(u);if(o(n))return i.deepMap(n,function(t){return r(t).compile(e).eval(u)});throw new TypeError("String, array, or matrix expected")}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(12);e.help=function(r){if(arguments.length!=1)throw new SyntaxError("Wrong number of arguments in function help ("+arguments.length+" provided, 1 expected)");var i=null;if(r instanceof String||typeof r=="string")i=r;else{var s;for(s in e)if(e.hasOwnProperty(s)&&r===e[s]){i=s;break}}var o=e.expression.docs[i];if(!i)throw new Error('Cannot find "'+r+'" in math.js');if(!o)throw new Error('No documentation found on "'+i+'"');return new t(o)}}},function(e,t,n){"use strict";e.exports=function(e,t){var n=e.expression.parse;e.parse=function(t,r){return n.apply(n,arguments)}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t.boolean.isBoolean,a=i.isComplex,f=s.isCollection;e.abs=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("abs",arguments.length,1);if(o(t))return Math.abs(t);if(a(t)){var n=Math.abs(t.re),i=Math.abs(t.im);if(n>=i){var c=i/n;return n*Math.sqrt(1+c*c)}var h=n/i;return i*Math.sqrt(1+h*h)}if(t instanceof r)return t.abs();if(f(t))return s.deepMap(t,l,!0);if(u(t)||t===null)return Math.abs(t);throw new e.error.UnsupportedTypeError("abs",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t["boolean"].isBoolean,a=t.number.isNumber,f=t.string.isString,l=i.isComplex,c=s.isUnit,h=o.isCollection;e.add=function p(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("add",arguments.length,2);if(a(t)){if(a(n))return t+n;if(l(n))return new i(t+n.re,n.im)}if(l(t)){if(l(n))return new i(t.re+n.re,t.im+n.im);if(a(n))return new i(t.re+n,t.im)}if(c(t)&&c(n)){if(t.value==null)throw new Error("Parameter x contains a unit with undefined value");if(n.value==null)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw new Error("Units do not match");var s=t.clone();return s.value+=n.value,s.fixPrefix=!1,s}if(t instanceof r){if(a(n))n=r.convert(n);else if(u(n)||n===null)n=new r(n?1:0);return n instanceof r?t.plus(n):p(t.toNumber(),n)}if(n instanceof r){if(a(t))t=r.convert(t);else if(u(t)||t===null)t=new r(t?1:0);return t instanceof r?t.plus(n):p(t,n.toNumber())}if(h(t)||h(n))return o.deepMap2(t,n,p);if(f(t)||f(n))return t+n;if(u(t)||t===null)return p(+t,n);if(u(n)||n===null)return p(t,+n);throw new e.error.UnsupportedTypeError("add",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=s.isCollection,f=i.isComplex;e.ceil=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("ceil",arguments.length,1);if(o(t))return Math.ceil(t);if(f(t))return new i(Math.ceil(t.re),Math.ceil(t.im));if(t instanceof r)return t.ceil();if(a(t))return s.deepMap(t,l,!0);if(u(t)||t===null)return Math.ceil(t);throw new e.error.UnsupportedTypeError("ceil",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection;e.cube=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("cube",arguments.length,1);if(o(t))return t*t*t;if(a(t))return e.multiply(e.multiply(t,t),t);if(t instanceof r)return t.times(t).times(t);if(f(t))return s.deepMap(t,l);if(u(t)||t===null)return l(+t);throw new e.error.UnsupportedTypeError("cube",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){function c(e,t){var n=t.re*t.re+t.im*t.im;return n!=0?new i((e.re*t.re+e.im*t.im)/n,(e.im*t.re-e.re*t.im)/n):new i(e.re!=0?e.re/0:0,e.im!=0?e.im/0:0)}var t=n(175),r=e.type.BigNumber,i=n(7),s=e.type.Matrix,o=n(11),u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=o.isUnit;e._divide=function h(t,n){if(u(t)){if(u(n))return t/n;if(f(n))return c(new i(t,0),n)}if(f(t)){if(f(n))return c(t,n);if(u(n))return c(t,new i(n,0))}if(t instanceof r){if(u(n))n=r.convert(n);else if(a(n)||n===null)n=new r(n?1:0);return n instanceof r?t.div(n):h(t.toNumber(),n)}if(n instanceof r){if(u(t))t=r.convert(t);else if(a(t)||t===null)t=new r(t?1:0);return t instanceof r?t.div(n):h(t,n.toNumber())}if(l(t)&&u(n)){var s=t.clone();return s.value=(s.value===null?s._normalize(1):s.value)/n,s}if(a(t)||t===null)return h(+t,n);if(a(n)||n===null)return h(t,+n);throw new e.error.UnsupportedTypeError("divide",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){var t=e.collection,n=t.isCollection;e.divide=function(r,i){if(arguments.length!=2)throw new e.error.ArgumentsError("divide",arguments.length,2);return n(r)?n(i)?e.multiply(r,e.inv(i)):t.deepMap2(r,i,e._divide):n(i)?e.multiply(r,e.inv(i)):e._divide(r,i)}}},function(e,t,n){"use strict";e.exports=function(e){var t=e.collection;e.dotDivide=function(r,i){if(arguments.length!=2)throw new e.error.ArgumentsError("dotDivide",arguments.length,2);return t.deepMap2(r,i,e.divide)},e.edivide=function(){throw new Error("Function edivide is renamed to dotDivide")}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.collection;e.dotMultiply=function(n,i){if(arguments.length!=2)throw new e.error.ArgumentsError("dotMultiply",arguments.length,2);return r.deepMap2(n,i,e.multiply)},e.emultiply=function(){throw new Error("Function emultiply is renamed to dotMultiply")}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.collection;e.dotPow=function(n,i){if(arguments.length!=2)throw new e.error.ArgumentsError("dotPow",arguments.length,2);return r.deepMap2(n,i,e.pow)},e.epow=function(){throw new Error("Function epow is renamed to dotPow")}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.type.Matrix,o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=o.isCollection;e.exp=function c(t){if(arguments.length!=1)throw new e.error.ArgumentsError("exp",arguments.length,1);if(u(t))return Math.exp(t);if(f(t)){var n=Math.exp(t.re);return new i(n*Math.cos(t.im),n*Math.sin(t.im))}if(t instanceof r)return t.exp();if(l(t))return o.deepMap(t,c);if(a(t)||t===null)return Math.exp(t);throw new e.error.UnsupportedTypeError("exp",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection;e.fix=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("fix",arguments.length,1);if(o(t))return t>0?Math.floor(t):Math.ceil(t);if(a(t))return new i(t.re>0?Math.floor(t.re):Math.ceil(t.re),t.im>0?Math.floor(t.im):Math.ceil(t.im));if(t instanceof r)return t.isNegative()?t.ceil():t.floor();if(f(t))return s.deepMap(t,l,!0);if(u(t)||t===null)return l(+t);throw new e.error.UnsupportedTypeError("fix",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection;e.floor=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("floor",arguments.length,1);if(o(t))return Math.floor(t);if(a(t))return new i(Math.floor(t.re),Math.floor(t.im));if(t instanceof r)return t.floor();if(f(t))return s.deepMap(t,l,!0);if(u(t)||t===null)return l(+t);throw new e.error.UnsupportedTypeError("floor",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){function f(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");var n=new r(0);while(!t.isZero()){var i=e.mod(t);e=t,t=i}return e.lt(n)?e.neg():e}var t=n(175),r=e.type.BigNumber,i=e.collection,s=t.number.isNumber,o=t["boolean"].isBoolean,u=t.number.isInteger,a=i.isCollection;e.gcd=function l(t){var n=arguments[0],c=arguments[1],h;if(arguments.length==2){if(s(n)&&s(c)){if(!u(n)||!u(c))throw new Error("Parameters in function gcd must be integer numbers");while(c!=0)h=n%c,n=c,c=h;return n<0?-n:n}if(a(n)||a(c))return i.deepMap2(n,c,l);if(n instanceof r){if(s(c))c=r.convert(c);else if(o(c)||c===null)c=new r(c?1:0);return c instanceof r?f(n,c):l(n.toNumber(),c)}if(c instanceof r){if(s(n))n=r.convert(n);else if(o(n)||n===null)n=new r(n?1:0);return n instanceof r?f(n,c):l(n.toNumber(),c)}if(o(n)||n===null)return l(+n,c);if(o(c)||c===null)return l(n,+c);throw new e.error.UnsupportedTypeError("gcd",e["typeof"](n),e["typeof"](c))}if(arguments.length>2){for(var p=1;p<arguments.length;p++)n=l(n,arguments[p]);return n}throw new SyntaxError("Function gcd expects two or more arguments")}}},function(e,t,n){"use strict";e.exports=function(e){function f(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero()||t.isZero())return new r(0);var n=e.times(t);while(!t.isZero()){var i=t;t=e.mod(i),e=i}return n.div(e).abs()}var t=n(175),r=e.type.BigNumber,i=e.collection,s=t.number.isNumber,o=t["boolean"].isBoolean,u=t.number.isInteger,a=i.isCollection;e.lcm=function l(t){var n=arguments[0],c=arguments[1],h;if(arguments.length==2){if(s(n)&&s(c)){if(!u(n)||!u(c))throw new Error("Parameters in function lcm must be integer numbers");if(n==0||c==0)return 0;var p=n*c;while(c!=0)h=c,c=n%h,n=h;return Math.abs(p/n)}if(a(n)||a(c))return i.deepMap2(n,c,l);if(n instanceof r){if(s(c))c=r.convert(c);else if(o(c)||c===null)c=new r(c?1:0);return c instanceof r?f(n,c):l(n.toNumber(),c)}if(c instanceof r){if(s(n))n=r.convert(n);else if(o(n)||n===null)n=new r(n?1:0);return n instanceof r?f(n,c):l(n.toNumber(),c)}if(o(n)||n===null)return l(+n,c);if(o(c)||c===null)return l(n,+c);throw new e.error.UnsupportedTypeError("lcm",e["typeof"](n),e["typeof"](c))}if(arguments.length>2){for(var d=1;d<arguments.length;d++)n=l(n,arguments[d]);return n}throw new SyntaxError("Function lcm expects two or more arguments")}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection;e.log=function l(t,n){if(arguments.length==1){if(o(t))return t>=0?Math.log(t):l(new i(t,0));if(a(t))return new i(Math.log(Math.sqrt(t.re*t.re+t.im*t.im)),Math.atan2(t.im,t.re));if(t instanceof r)return t.isNegative()?l(t.toNumber()):t.ln();if(f(t))return s.deepMap(t,l);if(u(t)||t===null)return l(+t);throw new e.error.UnsupportedTypeError("log",e["typeof"](t))}if(arguments.length==2)return e.divide(l(t),l(n));throw new e.error.ArgumentsError("log",arguments.length,1,2)}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection;e.log10=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("log10",arguments.length,1);if(o(t))return t>=0?Math.log(t)/Math.LN10:l(new i(t,0));if(t instanceof r)return t.isNegative()?l(t.toNumber()):t.log();if(a(t))return new i(Math.log(Math.sqrt(t.re*t.re+t.im*t.im))/Math.LN10,Math.atan2(t.im,t.re)/Math.LN10);if(f(t))return s.deepMap(t,l);if(u(t)||t===null)return l(+t);throw new e.error.UnsupportedTypeError("log10",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){function a(e,t){if(t>0)return e-t*Math.floor(e/t);if(t==0)return e;throw new Error("Cannot calculate mod for a negative divisor")}var t=n(175),r=e.type.BigNumber,i=e.collection,s=t.number.isNumber,o=t["boolean"].isBoolean,u=i.isCollection;e.mod=function f(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("mod",arguments.length,2);if(s(t)&&s(n))return a(t,n);if(t instanceof r){if(s(n))n=r.convert(n);else if(o(n)||n===null)n=new r(n?1:0);return n instanceof r?n.isZero()?t:t.mod(n):f(t.toNumber(),n)}if(n instanceof r){if(s(t))t=r.convert(t);else if(o(t)||t===null)t=new r(t?1:0);return t instanceof r?n.isZero()?t:t.mod(n):f(t,n.toNumber())}if(u(t)||u(n))return i.deepMap2(t,n,f);if(o(t)||t===null)return f(+t,n);if(o(n)||n===null)return f(t,+n);throw new e.error.UnsupportedTypeError("mod",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){function p(e,t){return e.im==0?t.im==0?new i(e.re*t.re,0):t.re==0?new i(0,e.re*t.im):new i(e.re*t.re,e.re*t.im):e.re==0?t.im==0?new i(0,e.im*t.re):t.re==0?new i(-e.im*t.im,0):new i(-e.im*t.im,e.im*t.re):t.im==0?new i(e.re*t.re,e.im*t.re):t.re==0?new i(-e.im*t.im,e.re*t.im):new i(e.re*t.re-e.im*t.im,e.re*t.im+e.im*t.re)}var t=n(175),r=e.type.BigNumber,i=n(7),s=e.type.Matrix,o=n(11),u=e.collection,a=t.number.isNumber,f=t["boolean"].isBoolean,l=i.isComplex,c=Array.isArray,h=o.isUnit;e.multiply=function d(t,n){var o;if(arguments.length!=2)throw new e.error.ArgumentsError("multiply",arguments.length,2);if(a(t)){if(a(n))return t*n;if(l(n))return p(new i(t,0),n);if(h(n))return o=n.clone(),o.value=o.value===null?o._normalize(t):o.value*t,o}if(l(t)){if(a(n))return p(t,new i(n,0));if(l(n))return p(t,n)}if(t instanceof r){if(a(n))n=r.convert(n);else if(f(n)||n===null)n=new r(n?1:0);return n instanceof r?t.times(n):d(t.toNumber(),n)}if(n instanceof r){if(a(t))t=r.convert(t);else if(f(t)||t===null)t=new r(t?1:0);return t instanceof r?t.times(n):d(t,n.toNumber())}if(h(t)&&a(n))return o=t.clone(),o.value=o.value===null?o._normalize(n):o.value*n,o;if(c(t)){var v=e.matrix(t),m=v.multiply(n);return m instanceof s?n instanceof s?m:m.valueOf():m}if(t instanceof s)return t.multiply(n);if(c(n))return u.deepMap2(t,n,d);if(n instanceof s){var g=function(e){return d(t,e)};return u.deepMap(n,g,!0)}if(f(t)||t===null)return d(+t,n);if(f(n)||n===null)return d(t,+n);throw new e.error.UnsupportedTypeError("multiply",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.type.Matrix,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=Array.isArray;e.norm=function l(t,n){if(arguments.length<1||arguments.length>2)throw new e.error.ArgumentsError("abs",arguments.length,1,2);if(o(t))return Math.abs(t);if(a(t)){var i=Math.abs(t.re),c=Math.abs(t.im);if(i>=c){var h=c/i;return i*Math.sqrt(1+h*h)}var p=i/c;return c*Math.sqrt(1+p*p)}if(t instanceof r)return t.abs();if(u(t)||t===null)return Math.abs(t);if(f(t))return l(e.matrix(t),n);if(t instanceof s){var d=t.size();n==null&&(n=2);if(d.length==1){if(n===Number.POSITIVE_INFINITY||n==="inf"){var v;return t.forEach(function(t){var n=e.abs(t);if(!v||e.larger(n,v))v=n},!0),v}if(n===Number.NEGATIVE_INFINITY||n==="-inf"){var v;return t.forEach(function(t){var n=e.abs(t);if(!v||e.smaller(n,v))v=n},!0),v}if(n==="fro")return l(t);if(o(n)&&!isNaN(n)){if(!e.equal(n,0)){var v=0;return t.forEach(function(t){v=e.add(e.pow(e.abs(t),n),v)},!0),e.pow(v,1/n)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}if(d.length==2){if(n==1){var m=[];return t.forEach(function(t,n){var r=n[1];m[r]=e.add(m[r]||0,e.abs(t))},!0),e.max(m)}if(n==Number.POSITIVE_INFINITY||n==="inf"){var g=[];return t.forEach(function(t,n){var r=n[0];g[r]=e.add(g[r]||0,e.abs(t))},!0),e.max(g)}if(n==="fro")return e.sqrt(t.transpose().multiply(t).trace());throw n==2?new Error("Unsupported parameter value, missing implementation of matrix singular value decomposition"):new Error("Unsupported parameter value")}}throw new e.error.UnsupportedTypeError("norm",t)}}},function(e,t,r){"use strict";e.exports=function(e){function f(e,t){var n=t!=undefined?t:2,r=n<0;r&&(n=-n);if(n==0)throw new Error("Root must be non-zero");if(e<0&&Math.abs(n)%2!=1)throw new Error("Root must be odd when a is negative.");if(e==0)return 0;if(!Number.isFinite(e))return r?0:e;var i=1e-16,s=1,o=0,u=100;do{var a=(e/Math.pow(s,n-1)-s)/n;s+=a,o++}while(Math.abs(a)>i&&o<u);return r?1/s:s}function l(e,t){var n=t!=undefined?t:new i(2),r=new i(0),s=new i(1),o=n.isNegative();o&&(n=n.negated());if(n.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!n.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return r;if(!e.isFinite())return o?r:e;var u=s,a=0,f=100;do{var l=u,c=e.div(u.pow(n.minus(1))).minus(u).div(n);u=u.plus(c),a++}while(!u.equals(l)&&a<f);return o?s.div(u):u}var t=r(175),i=e.type.BigNumber,s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=s.isCollection;e.nthRoot=function c(t,r){if(arguments.length!=1&&arguments.length!=2)throw new e.error.ArgumentsError("nthRoot",arguments.length,1,2);switch(arguments.length){case 1:if(o(t))return f(t);if(t instanceof i)return l(t);if(a(t))return s.deepMap(x,c);if(u(t)||t===null)return c(+t);break;case 2:if(o(t)){if(o(r))return f(t,r);if(r instanceof i)return t=i.convert(t),t instanceof i?l(t,r):f(t,r.toNumber())}else{if(t instanceof i)return o(r)&&(r=i.convert(r)),r instanceof i?l(t,r):f(t.toNumber(),r);if(a(t)&&!a(r))return s.deepMap2(t,r,c)}if(u(t)||t===null)return c(+t,r);if(u(r)||r===null)return c(t,+r);break;default:throw new e.error.ArgumentsError("nthRoot",arguments.length,1,2)}if(u(x)||x===null)return arguments.length==2?c(+x,n):c(+x);throw new e.error.UnsupportedTypeError("nthRoot",e["typeof"](t),e["typeof"](r))}}},function(e,t,n){"use strict";e.exports=function(e){function h(t,n){var r=e.log(t),i=e.multiply(r,n);return e.exp(i)}var t=n(175),r=e.type.BigNumber,i=n(7),s=e.type.Matrix,o=t.array,u=t.number.isNumber,a=t.boolean.isBoolean,f=Array.isArray,l=t.number.isInteger,c=i.isComplex;e.pow=function p(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("pow",arguments.length,2);if(u(t)){if(u(n))return l(n)||t>=0?Math.pow(t,n):h(new i(t,0),new i(n,0));if(c(n))return h(new i(t,0),n)}if(c(t)){if(u(n))return h(t,new i(n,0));if(c(n))return h(t,n)}if(t instanceof r){if(u(n))n=r.convert(n);else if(a(n)||n===null)n=new r(n?1:0);return n instanceof r?n.isInteger()||!t.isNegative()?t.pow(n):p(t.toNumber(),n.toNumber()):p(t.toNumber(),n)}if(n instanceof r){if(u(t))t=r.convert(t);else if(a(t)||t===null)t=new r(t?1:0);return t instanceof r?n.isInteger()&&!t.isNegative()?t.pow(n):p(t.toNumber(),n.toNumber()):p(t,n.toNumber())}if(f(t)){if(!u(n)||!l(n)||n<0)throw new TypeError("For A^b, b must be a positive integer (value is "+n+")");var d=o.size(t);if(d.length!=2)throw new Error("For A^b, A must be 2 dimensional (A has "+d.length+" dimensions)");if(d[0]!=d[1])throw new Error("For A^b, A must be square (size is "+d[0]+"x"+d[1]+")");var v=e.eye(d[0]).valueOf(),m=t;while(n>=1)(n&1)==1&&(v=e.multiply(m,v)),n>>=1,m=e.multiply(m,m);return v}if(t instanceof s)return e.matrix(p(t.valueOf(),n));if(a(t)||t===null)return p(+t,n);if(a(n)||n===null)return p(t,+n);throw new e.error.UnsupportedTypeError("pow",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){function h(e,t){return parseFloat(c(e,t))}var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t.number.isInteger,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isCollection,c=t.number.toFixed;e.round=function p(t,n){if(arguments.length!=1&&arguments.length!=2)throw new e.error.ArgumentsError("round",arguments.length,1,2);if(n==undefined){if(o(t))return Math.round(t);if(f(t))return new i(Math.round(t.re),Math.round(t.im));if(t instanceof r)return t.toDecimalPlaces(0);if(l(t))return s.deepMap(t,p);if(a(t)||t===null)return Math.round(t);throw new e.error.UnsupportedTypeError("round",e["typeof"](t))}if(!o(n)||!u(n)){if(!(n instanceof r)){if(a(n)||t===null)return p(t,+n);throw new TypeError("Number of decimals in function round must be an integer")}n=parseFloat(n.valueOf())}if(n<0||n>15)throw new Error("Number of decimals in function round must be in te range of 0-15");if(o(t))return h(t,n);if(f(t))return new i(h(t.re,n),h(t.im,n));if(t instanceof r)return t.toDecimalPlaces(n);if(l(t)||l(n))return s.deepMap2(t,n,p);if(a(t)||t===null)return p(+t,n);throw new e.error.UnsupportedTypeError("round",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isCollection;e.sign=function c(t){if(arguments.length!=1)throw new e.error.ArgumentsError("sign",arguments.length,1);if(u(t))return o.sign(t);if(f(t)){var n=Math.sqrt(t.re*t.re+t.im*t.im);return new i(t.re/n,t.im/n)}if(t instanceof r)return new r(t.cmp(0));if(l(t))return s.deepMap(t,c,!0);if(a(t)||t===null)return o.sign(t);throw new e.error.UnsupportedTypeError("sign",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection;e.sqrt=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("sqrt",arguments.length,1);if(o(t))return t>=0?Math.sqrt(t):l(new i(t,0));if(a(t)){var n=Math.sqrt(t.re*t.re+t.im*t.im),c,h;return t.re>=0?c=.5*Math.sqrt(2*(n+t.re)):c=Math.abs(t.im)/Math.sqrt(2*(n-t.re)),t.re<=0?h=.5*Math.sqrt(2*(n-t.re)):h=Math.abs(t.im)/Math.sqrt(2*(n+t.re)),t.im>=0?new i(c,h):new i(c,-h)}if(t instanceof r)return t.isNegative()?l(t.toNumber()):t.sqrt();if(f(t))return s.deepMap(t,l,!0);if(u(t)||t===null)return l(+t);throw new e.error.UnsupportedTypeError("sqrt",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection;e.square=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("square",arguments.length,1);if(o(t))return t*t;if(a(t))return e.multiply(t,t);if(t instanceof r)return t.times(t);if(f(t))return s.deepMap(t,l,!0);if(u(t)||t===null)return t*t;throw new e.error.UnsupportedTypeError("square",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.type.Matrix,o=n(11),u=e.collection,a=t["boolean"].isBoolean,f=t.number.isNumber,l=i.isComplex,c=o.isUnit,h=u.isCollection;e.subtract=function p(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("subtract",arguments.length,2);if(f(t)){if(f(n))return t-n;if(l(n))return new i(t-n.re,-n.im)}else if(l(t)){if(f(n))return new i(t.re-n,t.im);if(l(n))return new i(t.re-n.re,t.im-n.im)}if(t instanceof r){if(f(n))n=r.convert(n);else if(a(n)||n===null)n=new r(n?1:0);return n instanceof r?t.minus(n):p(t.toNumber(),n)}if(n instanceof r){if(f(t))t=r.convert(t);else if(a(t)||t===null)t=new r(t?1:0);return t instanceof r?t.minus(n):p(t,n.toNumber())}if(c(t)&&c(n)){if(t.value==null)throw new Error("Parameter x contains a unit with undefined value");if(n.value==null)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw new Error("Units do not match");var s=t.clone();return s.value-=n.value,s.fixPrefix=!1,s}if(h(t)||h(n))return u.deepMap2(t,n,p);if(a(t)||t===null)return p(+t,n);if(a(n)||n===null)return p(t,+n);throw new e.error.UnsupportedTypeError("subtract",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r["boolean"].isBoolean,l=r.string.isString,c=s.isComplex,h=o.isUnit,p=u.isCollection;e.unaryMinus=function d(n){if(arguments.length!=1)throw new e.error.ArgumentsError("unaryMinus",arguments.length,1);if(a(n))return-n;if(c(n))return new s(-n.re,-n.im);if(n instanceof i)return n.neg();if(h(n)){var r=n.clone();return r.value=-n.value,r}if(p(n))return u.deepMap(n,d,!0);if(f(n)||l(n)||n===null)return t.number=="bignumber"?new i(-n):-n;throw new e.error.UnsupportedTypeError("unaryMinus",e["typeof"](n))},e.unary=function(){throw new Error("Function unary is deprecated. Use unaryMinus instead.")}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r["boolean"].isBoolean,l=r.string.isString,c=s.isComplex,h=o.isUnit,p=u.isCollection;e.unaryPlus=function d(n){if(arguments.length!=1)throw new e.error.ArgumentsError("unaryPlus",arguments.length,1);if(a(n))return n;if(c(n))return n.clone();if(n instanceof i)return n;if(h(n))return n.clone();if(p(n))return u.deepMap(n,d,!0);if(f(n)||l(n)||n===null)return t.number=="bignumber"?new i(+n):+n;throw new e.error.UnsupportedTypeError("unaryPlus",e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e,t){function f(n,r){var i,s,o,u=0,a=1,f=1,l=0;while(r)s=Math.floor(n/r),o=n%r,i=u,u=a-s*u,a=i,i=f,f=l-s*f,l=i,n=r,r=o;var c;return n<0?c=[-n,-a,-l]:c=[n,n?a:0,l],t.matrix==="array"?c:e.matrix(c)}function l(n,r){var i,o,u,a=new s(0),f=new s(0),l=new s(1),c=new s(1),h=new s(0);while(!r.isZero())o=n.div(r).floor(),u=n.mod(r),i=f,f=l.minus(o.times(f)),l=i,i=c,c=h.minus(o.times(c)),h=i,n=r,r=u;var p;return n.lt(a)?p=[n.neg(),l.neg(),h.neg()]:p=[n,n.isZero()?0:l,h],t.matrix==="array"?p:e.matrix(p)}var r=n(175),i=e.type.Matrix,s=e.type.BigNumber,o=r.number.isNumber,u=r["boolean"].isBoolean,a=r.number.isInteger;e.xgcd=function c(t,n){if(arguments.length==2){if(o(t)&&o(n)){if(!a(t)||!a(n))throw new Error("Parameters in function xgcd must be integer numbers");return f(t,n)}if(t instanceof s){if(o(n))n=s.convert(n);else if(u(n)||n===null)n=new s(n?1:0);return n instanceof s?l(t,n):c(t.toNumber(),n)}if(n instanceof s){if(o(t))t=s.convert(t);else if(u(t)||t===null)t=new s(t?1:0);return t instanceof s?l(t,n):c(t.toNumber(),n)}if(u(t)||t===null)return c(+t,n);if(u(n)||n===null)return c(t,+n);throw new e.error.UnsupportedTypeError("xgcd",e["typeof"](t),e["typeof"](n))}throw new SyntaxError("Function xgcd expects two arguments")}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=n(11),u=e.collection,a=r["boolean"].isBoolean,f=r.number.isInteger,l=r.number.isNumber,c=u.isCollection,h=r.bignumber.and;e.bitAnd=function p(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("bitAnd",arguments.length,2);if(l(t)&&l(n)){if(!f(t)||!f(n))throw new Error("Parameters in function bitAnd must be integer numbers");return t&n}if(c(t)||c(n))return u.deepMap2(t,n,p);if(a(t)||t===null)return p(+t,n);if(a(n)||n===null)return p(t,+n);if(t instanceof i)return l(n)&&(n=i.convert(n)),n instanceof i?h(t,n):p(t.toNumber(),n);if(n instanceof i)return l(t)&&(t=i.convert(t)),t instanceof i?h(t,n):p(t,n.toNumber());throw new e.error.UnsupportedTypeError("bitAnd",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=n(11),u=e.collection,a=r["boolean"].isBoolean,f=r.number.isInteger,l=r.number.isNumber,c=u.isCollection,h=r.bignumber.not;e.bitNot=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("bitNot",arguments.length,1);if(l(t)){if(!f(t))throw new Error("Parameter in function bitNot must be integer numbers");return~t}if(t instanceof i)return h(t);if(c(t))return u.deepMap(t,p);if(a(t)||t===null)return p(+t);throw new e.error.UnsupportedTypeError("bitNot",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=n(11),u=e.collection,a=r["boolean"].isBoolean,f=r.number.isInteger,l=r.number.isNumber,c=u.isCollection,h=r.bignumber.or;e.bitOr=function p(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("bitOr",arguments.length,2);if(l(t)&&l(n)){if(!f(t)||!f(n))throw new Error("Parameters in function bitOr must be integer numbers");return t|n}if(c(t)||c(n))return u.deepMap2(t,n,p);if(a(t)||t===null)return p(+t,n);if(a(n)||n===null)return p(t,+n);if(t instanceof i)return l(n)&&(n=i.convert(n)),n instanceof i?h(t,n):p(t.toNumber(),n);if(n instanceof i)return l(t)&&(t=i.convert(t)),t instanceof i?h(t,n):p(t,n.toNumber());throw new e.error.UnsupportedTypeError("bitOr",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=n(11),u=e.collection,a=r["boolean"].isBoolean,f=r.number.isInteger,l=r.number.isNumber,c=u.isCollection,h=r.bignumber.xor;e.bitXor=function p(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("bitXor",arguments.length,2);if(l(t)&&l(n)){if(!f(t)||!f(n))throw new Error("Parameters in function bitXor must be integer numbers");return t^n}if(c(t)||c(n))return u.deepMap2(t,n,p);if(a(t)||t===null)return p(+t,n);if(a(n)||n===null)return p(t,+n);if(t instanceof i)return l(n)&&(n=i.convert(n)),n instanceof i?h(t,n):p(t.toNumber(),n);if(n instanceof i)return l(t)&&(t=i.convert(t)),t instanceof i?h(t,n):p(t,n.toNumber());throw new e.error.UnsupportedTypeError("bitXor",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=n(11),u=e.collection,a=r["boolean"].isBoolean,f=r.number.isInteger,l=r.number.isNumber,c=u.isCollection,h=r.bignumber.leftShift;e.leftShift=function p(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("leftShift",arguments.length,2);if(l(t)){if(l(n)){if(!f(t)||!f(n))throw new Error("Parameters in function leftShift must be integer numbers");return t<<n}if(n instanceof i)return h(i.convert(t),n)}if(l(n)){if(isFinite(n)&&!f(n))throw new Error("Parameters in function leftShift must be integer numbers");if(t instanceof i){if(t.isFinite()&&!t.isInteger())throw new Error("Parameters in function leftShift must be integer numbers");return t.isNaN()||isNaN(n)||n<0?new i(NaN):n==0||t.isZero()?t:n==Infinity&&!t.isFinite()?new i(NaN):n<55?t.times(Math.pow(2,n)+""):(n=i.convert(n),h(t,n))}}if(c(t)&&l(n))return u.deepMap2(t,n,p);if(a(t)||t===null)return p(+t,n);if(a(n)||n===null)return p(t,+n);if(t instanceof i)return n instanceof i?h(t,n):p(t.toNumber(),n);if(n instanceof i)return p(t,n.toNumber());throw new e.error.UnsupportedTypeError("leftShift",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=n(11),u=e.collection,a=r["boolean"].isBoolean,f=r.number.isInteger,l=r.number.isNumber,c=u.isCollection,h=r.bignumber.rightShift;e.rightArithShift=function p(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("rightArithShift",arguments.length,2);if(l(t)){if(l(n)){if(!f(t)||!f(n))throw new Error("Parameters in function rightArithShift must be integer numbers");return t>>n}if(n instanceof i)return h(i.convert(t),n)}if(l(n)){if(isFinite(n)&&!f(n))throw new Error("Parameters in function rightArithShift must be integer numbers");if(t instanceof i){if(t.isFinite()&&!t.isInteger())throw new Error("Parameters in function rightArithShift must be integer numbers");return t.isNaN()||isNaN(n)||n<0?new i(NaN):n==Infinity?t.isNegative()?new i(-1):t.isFinite()?new i(0):new i(NaN):n<55?t.div(Math.pow(2,n)+"").floor():(n=i.convert(n),h(t,n))}}if(c(t)&&l(n))return u.deepMap2(t,n,p);if(a(t)||t===null)return p(+t,n);if(a(n)||n===null)return p(t,+n);if(t instanceof i)return n instanceof i?h(t,n):p(t.toNumber(),n);if(n instanceof i)return p(t,n.toNumber());throw new e.error.UnsupportedTypeError("rightArithShift",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.Matrix,s=n(11),o=e.collection,u=r["boolean"].isBoolean,a=r.number.isInteger,f=r.number.isNumber,l=o.isCollection;e.rightLogShift=function c(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("rightLogShift",arguments.length,2);if(f(t)&&f(n)){if(!a(t)||!a(n))throw new Error("Parameters in function rightLogShift must be integer numbers");return t>>>n}if(l(t)&&f(n))return o.deepMap2(t,n,c);if(u(t)||t===null)return c(+t,n);if(u(n)||n===null)return c(t,+n);throw new e.error.UnsupportedTypeError("rightLogShift",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=s.isCollection,f=i.isComplex;e.arg=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("arg",arguments.length,1);if(o(t))return Math.atan2(0,t);if(f(t))return Math.atan2(t.im,t.re);if(a(t))return s.deepMap(t,l);if(u(t)||t===null)return l(+t);if(t instanceof r)return l(t.toNumber());throw new e.error.UnsupportedTypeError("arg",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.object,u=t.number.isNumber,a=t["boolean"].isBoolean,f=s.isCollection,l=i.isComplex;e.conj=function c(t){if(arguments.length!=1)throw new e.error.ArgumentsError("conj",arguments.length,1);return u(t)?t:t instanceof r?new r(t):l(t)?new i(t.re,-t.im):f(t)?s.deepMap(t,c):a(t)||t===null?+t:o.clone(t)}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.object,u=t.number.isNumber,a=t["boolean"].isBoolean,f=s.isCollection,l=i.isComplex;e.re=function c(t){if(arguments.length!=1)throw new e.error.ArgumentsError("re",arguments.length,1);return u(t)?t:t instanceof r?new r(t):l(t)?t.re:f(t)?s.deepMap(t,c):a(t)||t===null?+t:o.clone(t)}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=s.isCollection,f=i.isComplex;e.im=function l(t){if(arguments.length!=1)throw new e.error.ArgumentsError("im",arguments.length,1);return o(t)?0:t instanceof r?new r(0):f(t)?t.im:a(t)?s.deepMap(t,l):u(t)||t===null?0:0}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection;e.and=function h(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("and",arguments.length,2);if((u(t)||a(t)||t===null)&&(u(n)||a(n)||n===null))return!!t&&!!n;if(f(t))return t.re==0&&t.im==0?!1:h(!0,n);if(f(n))return n.re==0&&n.im==0?!1:h(t,!0);if(t instanceof r)return t.isZero()||t.isNaN()?!1:h(!0,n);if(n instanceof r)return n.isZero()||n.isNaN()?!1:h(t,!0);if(l(t))return t.value===null||t.value==0?!1:h(!0,n);if(l(n))return n.value===null||n.value==0?!1:h(t,!0);if(c(t)||c(n))return o.deepMap2(t,n,h);throw new e.error.UnsupportedTypeError("and",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection;e.not=function h(t){if(arguments.length!=1)throw new e.error.ArgumentsError("not",arguments.length,1);if(u(t)||a(t)||t===null)return!t;if(f(t))return t.re==0&&t.im==0;if(t instanceof r)return t.isZero()||t.isNaN();if(l(t))return t.value===null||t.value==0;if(c(t))return o.deepMap(t,h);throw new e.error.UnsupportedTypeError("not",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection;e.or=function h(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("or",arguments.length,2);if((u(t)||a(t)||t===null)&&(u(n)||a(n)||n===null))return!!t||!!n;if(f(t))return t.re==0&&t.im==0?h(!1,n):!0;if(f(n))return n.re==0&&n.im==0?h(t,!1):!0;if(t instanceof r)return t.isZero()||t.isNaN()?h(!1,n):!0;if(n instanceof r)return n.isZero()||n.isNaN()?h(t,!1):!0;if(l(t))return t.value===null||t.value==0?h(!1,n):!0;if(l(n))return n.value===null||n.value==0?h(t,!1):!0;if(c(t)||c(n))return o.deepMap2(t,n,h);throw new e.error.UnsupportedTypeError("or",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection;e.xor=function h(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("xor",arguments.length,2);if((u(t)||a(t)||t===null)&&(u(n)||a(n)||n===null))return!!(!!t^!!n);if(f(t))return h(t.re!=0||t.im!=0,n);if(f(n))return h(t,n.re!=0||n.im!=0);if(t instanceof r)return h(!t.isZero()&&!t.isNaN(),n);if(n instanceof r)return h(t,!n.isZero()&&!n.isNaN());if(l(t))return h(t.value!==null&&t.value!=0,n);if(l(n))return h(t,n.value!==null&&n.value!=0);if(c(t)||c(n))return o.deepMap2(t,n,h);throw new e.error.UnsupportedTypeError("xor",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){function c(t,n,r,i){if(i<r){if(t.length!=n.length)throw new e.error.DimensionError(t.length,n.length);var s=[];for(var o=0;o<t.length;o++)s[o]=c(t[o],n[o],r,i+1);return s}return t.concat(n)}var t=n(175),r=n(5),i=e.type.Matrix,s=e.collection,o=t.object,u=t.array,a=t.number.isNumber,f=t.number.isInteger,l=s.isCollection;e.concat=function(n){var s,h=arguments.length,p=-1,d,v=!1,m=[];for(s=0;s<h;s++){var g=arguments[s];g instanceof i&&(v=!0);if(s==h-1&&(a(g)||g instanceof r)){d=p,p=g.valueOf();if(!f(p))throw new TypeError("Integer number expected for dimension");if(p<0)throw new e.error.IndexError(p);if(s>0&&p>d)throw new e.error.IndexError(p,d+1)}else{if(!l(g))throw new e.error.UnsupportedTypeError("concat",e["typeof"](g));var y=o.clone(g).valueOf(),b=u.size(g.valueOf());m[s]=y,d=p,p=b.length-1;if(s>0&&p!=d)throw new e.error.DimensionError(d+1,p+1)}}if(m.length==0)throw new SyntaxError("At least one matrix expected");var w=m.shift();while(m.length)w=c(w,m.shift(),p,0);return v?e.matrix(w):w}}},function(e,t,n){"use strict";e.exports=function(e){function i(n,r){var i=t.size(n),s=t.size(r);if(i.length!=1||s.length!=1||i[0]!=3||s[0]!=3)throw new RangeError("Vectors with length 3 expected (Size A = ["+i.join(", ")+"], B = ["+s.join(", ")+"])");return[e.subtract(e.multiply(n[1],r[2]),e.multiply(n[2],r[1])),e.subtract(e.multiply(n[2],r[0]),e.multiply(n[0],r[2])),e.subtract(e.multiply(n[0],r[1]),e.multiply(n[1],r[0]))]}var t=n(169),r=e.type.Matrix;e.cross=function(n,s){if(n instanceof r){if(s instanceof r)return e.matrix(i(n.toArray(),s.toArray()));if(Array.isArray(s))return e.matrix(i(n.toArray(),s))}else if(Array.isArray(n)){if(s instanceof r)return e.matrix(i(n,s.toArray()));if(Array.isArray(s))return i(n,s)}throw new e.error.UnsupportedTypeError("cross",e["typeof"](n),e["typeof"](s))}}},function(e,t,n){"use strict";e.exports=function(e){function o(t,n,r){if(n==1)return i.clone(t[0][0]);if(n==2)return e.subtract(e.multiply(t[0][0],t[1][1]),e.multiply(t[1][0],t[0][1]));var s=function(t){var n,r,i=new Array(t.length),s=0;for(n=1;n<t.length;n++)s=e.add(s,t[n][n]);for(n=0;n<t.length;n++){i[n]=new Array(t.length),i[n][n]=e.unaryMinus(s);for(r=0;r<n;r++)i[n][r]=0;for(r=n+1;r<t.length;r++)i[n][r]=t[n][r];n+1<t.length&&(s=e.subtract(s,t[n+1][n+1]))}return i},o=t;for(var u=0;u<n-1;u++)o=e.multiply(s(o),t);return n%2==0?e.unaryMinus(o[0][0]):o[0][0]}var t=n(175),r=e.type.Matrix,i=t.object,s=t.string;e.det=function(n){if(arguments.length!=1)throw new e.error.ArgumentsError("det",arguments.length,1);var u;n instanceof r?u=n.size():n instanceof Array?(n=e.matrix(n),u=n.size()):u=[];switch(u.length){case 0:return i.clone(n);case 1:if(u[0]==1)return i.clone(n.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+s.format(u)+")");case 2:var a=u[0],f=u[1];if(a==f)return o(n.clone().valueOf(),a,f);throw new RangeError("Matrix must be square (size: "+s.format(u)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+s.format(u)+")")}}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=e.type.Matrix,s=t.object,o=t.array,u=o.isArray,a=t.number.isNumber,f=t.string.isString,l=t.number.isInteger;e.diag=function(n,c,h){if(arguments.length===0||arguments.length>3)throw new e.error.ArgumentsError("diag",arguments.length,1,3);switch(arguments.length){case 1:c=0,h=undefined;break;case 2:f(arguments[1])&&(h=arguments[1],c=0)}if(!(n instanceof i)&&!u(n))throw new TypeError("First parameter in function diag must be a Matrix or Array");c instanceof r&&(c=c.toNumber());if(!a(c)||!l(c))throw new TypeError("Second parameter in function diag must be an integer");if(h&&!f(h))throw new TypeError("Third parameter in function diag must be a String");var p=c>0?c:0,d=c<0?-c:0,v,m,g,y,b,w;n instanceof i?(y=n.valueOf(),h=h||n.storage(),v=n.size()):(y=n,v=o.size(n));if(h){if(v.length===1){m=y[0]instanceof r?new r(0):0;var E=[y.length+d,y.length+p],S=i.storage(h);return S.diagonal(E,y,c,m)}if(v.length===2)return g=n.diagonal(c),e.matrix(g,h);throw new RangeError("Matrix for function diag must be 2 dimensional")}switch(v.length){case 1:m=y[0]instanceof r?new r(0):0;var x=[];o.resize(x,[y.length+d,y.length+p],m),w=y.length;for(b=0;b<w;b++)x[b+d][b+p]=s.clone(y[b]);return x;case 2:g=[],w=Math.min(v[0]-d,v[1]-p);for(b=0;b<w;b++)g[b]=s.clone(y[b+d][b+p]);return g;default:throw new RangeError("Matrix for function diag must be 2 dimensional")}}}},function(e,t,n){"use strict";e.exports=function(e){function i(n,r){var i=t.size(n),s=t.size(r),o=i[0];if(i.length!==1||s.length!==1)throw new RangeError("Vector expected");if(i[0]!=s[0])throw new RangeError("Vectors must have equal length ("+i[0]+" != "+s[0]+")");if(o==0)throw new RangeError("Cannot calculate the dot product of empty vectors");var u=0;for(var a=0;a<o;a++)u=e.add(u,e.multiply(n[a],r[a]));return u}var t=n(169),r=e.type.Matrix;e.dot=function(n,s){if(n instanceof r){if(s instanceof r)return i(n.toArray(),s.toArray());if(Array.isArray(s))return i(n.toArray(),s)}else if(Array.isArray(n)){if(s instanceof r)return i(n,s.toArray());if(Array.isArray(s))return i(n,s)}throw new e.error.UnsupportedTypeError("dot",e["typeof"](n),e["typeof"](s))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=e.collection,u=r.array,a=r.number.isNumber,f=r.number.isInteger,l=r.string.isString,c=Array.isArray;e.eye=function(r,h){var p=o.argsToArray(arguments),d;p.length>0&&l(p[p.length-1])?(d=p[p.length-1],p=o.argsToArray(p.slice(0,p.length-1))):r instanceof s?d=r.storage():!c(r)&&t.matrix==="matrix"&&(d="default");if(p.length==1)p[1]=p[0];else if(p.length>2)throw new e.error.ArgumentsError("eye",p.length,0,2);var v=!1;p=p.map(function(e){e instanceof i&&(v=!0,e=e.toNumber());if(!a(e)||!f(e)||e<0)throw new Error("Parameters in function eye must be positive integers");return e});var m=v?new i(1):1,g=v?new i(0):0;if(d){if(p.length===0)return e.matrix(d);var y=s.storage(d);return y.diagonal(p,m,0,g)}var b=[];if(p.length>0){b=u.resize(b,p,g);var w=e.min(p);for(var E=0;E<w;E++)b[E][E]=m}return b}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.Matrix,s=r.object,o=r.array,u=Array.isArray;e.flatten=function(n){if(arguments.length!==1)throw new e.error.ArgumentsError("flatten",arguments.length,1);if(n instanceof i){var r=s.clone(n.toArray()),a=o.flatten(r);return e.matrix(a)}if(u(n))return o.flatten(s.clone(n));throw new e.error.UnsupportedTypeError("flatten",e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){function i(t,n,r){var i,s,o,u,a;if(n==1){u=t[0][0];if(u==0)throw Error("Cannot calculate inverse, determinant is zero");return[[e._divide(1,u)]]}if(n==2){var f=e.det(t);if(f==0)throw Error("Cannot calculate inverse, determinant is zero");return[[e._divide(t[1][1],f),e._divide(e.unaryMinus(t[0][1]),f)],[e._divide(e.unaryMinus(t[1][0]),f),e._divide(t[0][0],f)]]}var l=t.concat();for(i=0;i<n;i++)l[i]=l[i].concat();var c=e.eye(n).valueOf();for(var h=0;h<r;h++){i=h;while(i<n&&l[i][h]==0)i++;if(i==n||l[i][h]==0)throw Error("Cannot calculate inverse, determinant is zero");i!=h&&(a=l[h],l[h]=l[i],l[i]=a,a=c[h],c[h]=c[i],c[i]=a);var p=l[h],d=c[h];for(i=0;i<n;i++){var v=l[i],m=c[i];if(i!=h){if(v[h]!=0){o=e._divide(e.unaryMinus(v[h]),p[h]);for(s=h;s<r;s++)v[s]=e.add(v[s],e.multiply(o,p[s]));for(s=0;s<r;s++)m[s]=e.add(m[s],e.multiply(o,d[s]))}}else{o=p[h];for(s=h;s<r;s++)v[s]=e._divide(v[s],o);for(s=0;s<r;s++)m[s]=e._divide(m[s],o)}}}return c}var t=n(175),r=e.type.Matrix;e.inv=function(s){if(arguments.length!=1)throw new e.error.ArgumentsError("inv",arguments.length,1);var o=e.size(s).valueOf();switch(o.length){case 0:return e._divide(1,s);case 1:if(o[0]==1)return s instanceof r?e.matrix([e._divide(1,s.valueOf()[0])]):[e._divide(1,s[0])];throw new RangeError("Matrix must be square (size: "+t.string.format(o)+")");case 2:var u=o[0],a=o[1];if(u==a)return s instanceof r?e.matrix(i(s.valueOf(),u,a),s.storage()):i(s,u,a);throw new RangeError("Matrix must be square (size: "+t.string.format(o)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+t.string.format(o)+")")}}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=e.collection,u=r.array,a=r.number.isNumber,f=r.number.isInteger,l=r.string.isString,c=Array.isArray;e.ones=function(r,h){var p=o.argsToArray(arguments),d;p.length>0&&l(p[p.length-1])?(d=p[p.length-1],p=o.argsToArray(p.slice(0,p.length-1))):r instanceof s?d=r.storage():!c(r)&&t.matrix==="matrix"&&(d="default");var v=!1;p=p.map(function(e){e instanceof i&&(v=!0,e=e.toNumber());if(!a(e)||!f(e)||e<0)throw new Error("Parameters in function eye must be positive integers");return e});var m=v?new i(1):1;if(d){var g=e.matrix(d);return p.length>0?g.resize(p,m):g}var y=[];return p.length>0?u.resize(y,p,m):y}}},function(e,t,n){"use strict";e.exports=function(e,t){function l(e,t,n){var r=[],i=e;if(n>0)while(i<t)r.push(i),i+=n;else if(n<0)while(i>t)r.push(i),i+=n;return r}function c(e,t,n){var r=[],i=e;if(n>0)while(i<=t)r.push(i),i+=n;else if(n<0)while(i>=t)r.push(i),i+=n;return r}function h(e,t,n){var r=[],s=e.clone(),o=new i(0);if(n.gt(o))while(s.lt(t))r.push(s),s=s.plus(n);else if(n.lt(o))while(s.gt(t))r.push(s),s=s.plus(n);return r}function p(e,t,n){var r=[],s=e.clone(),o=new i(0);if(n.gt(o))while(s.lte(t))r.push(s),s=s.plus(n);else if(n.lt(o))while(s.gte(t))r.push(s),s=s.plus(n);return r}function d(e){var n=e.split(":"),r=null;if(t.number==="bignumber")try{r=n.map(function(e){return new i(e)})}catch(s){return null}else{r=n.map(function(e){return Number(e)});var o=r.some(function(e){return isNaN(e)});if(o)return null}switch(r.length){case 2:return{start:r[0],end:r[1],step:1};case 3:return{start:r[0],end:r[2],step:r[1]};default:return null}}var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=e.collection,u=r["boolean"].isBoolean,a=r.string.isString,f=r.number.isNumber;e.range=function(r){var s=Array.prototype.slice.call(arguments),o,v,m,g=!1;u(s[s.length-1])&&(g=s.pop()?!0:!1);switch(s.length){case 1:if(!a(s[0]))throw new TypeError("Two or three numbers or a single string expected in function range");var y=d(s[0]);if(!y)throw new SyntaxError('String "'+s[0]+'" is no valid range');o=y.start,v=y.end,m=y.step;break;case 2:o=s[0],v=s[1],m=1;break;case 3:o=s[0],v=s[1],m=s[2];break;case 4:throw new TypeError("Parameter includeEnd must be a boolean");default:throw new e.error.ArgumentsError("range",arguments.length,2,4)}if(!!f(o)||o instanceof i){if(!!f(v)||v instanceof i){if(!!f(m)||m instanceof i){if(o instanceof i||v instanceof i||m instanceof i){var b=!0;o instanceof i||(o=i.convert(o)),v instanceof i||(v=i.convert(v)),m instanceof i||(m=i.convert(m));if(!(o instanceof i)||!(v instanceof i)||!(m instanceof i))b=!1,o instanceof i&&(o=o.toNumber()),v instanceof i&&(v=v.toNumber()),m instanceof i&&(m=m.toNumber())}var w=b?g?p:h:g?c:l,E=w(o,v,m);return t.matrix==="array"?E:e.matrix(E)}throw new TypeError("Parameter step must be a number")}throw new TypeError("Parameter end must be a number")}throw new TypeError("Parameter start must be a number")}}},function(e,t,n){"use strict";e.exports=function(e,t){function p(t,n,r){if(r!==undefined){if(!f(r)||r.length!==1)throw new TypeError("Single character expected as defaultValue")}else r=" ";if(n.length!==1)throw new e.error.DimensionError(n.length,1);var i=n[0];if(!l(i)||!c(i))throw new TypeError("Invalid size, must contain positive integers (size: "+a.format(n)+")");if(t.length>i)return t.substring(0,i);if(t.length<i){var s=t;for(var o=0,u=i-t.length;o<u;o++)s+=r;return s}return t}var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=r.array,u=r.object.clone,a=r.string,f=r.string.isString,l=r.number.isNumber,c=r.number.isInteger,h=o.isArray;e.resize=function(r,a,l){if(arguments.length!=2&&arguments.length!=3)throw new e.error.ArgumentsError("resize",arguments.length,2,3);a instanceof s&&(a=a.valueOf()),a.length&&a[0]instanceof i&&(a=a.map(function(e){return e instanceof i?e.toNumber():e}));if(r instanceof s)return r.resize(a,l,!0);if(f(r))return p(r,a,l);var c=h(r)?!1:t.matrix!=="array";if(a.length==0){while(h(r))r=r[0];return u(r)}h(r)||(r=[r]),r=u(r);var d=o.resize(r,a,l);return c?e.matrix(d):d}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.type.Matrix,a=r.array,f=r.number.isNumber,l=r["boolean"].isBoolean,c=r.string.isString,h=s.isComplex,p=o.isUnit;e.size=function(r){if(arguments.length!=1)throw new e.error.ArgumentsError("size",arguments.length,1);var s=t.matrix==="array";if(f(r)||h(r)||p(r)||l(r)||r==null||r instanceof i)return s?[]:e.matrix([]);if(c(r))return s?[r.length]:e.matrix([r.length]);if(Array.isArray(r))return a.size(r);if(r instanceof u)return e.matrix(r.size());throw new e.error.UnsupportedTypeError("size",e["typeof"](r))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.Matrix,i=t.object,s=t.array,o=Array.isArray;e.squeeze=function(n){if(arguments.length!=1)throw new e.error.ArgumentsError("squeeze",arguments.length,1);if(o(n))return s.squeeze(i.clone(n));if(n instanceof r){var u=s.squeeze(n.toArray());return o(u)?e.matrix(u):u}return i.clone(n)}}},function(e,t,n){"use strict";e.exports=function(e,t){function f(t,n){var r,s;if(a(t))return r=e.matrix(t),s=r.subset(n),s&&s.valueOf();if(t instanceof i)return t.subset(n);if(u(t))return l(t,n);throw new e.error.UnsupportedTypeError("subset",e["typeof"](t))}function l(t,n){if(n instanceof s){if(n.size().length!=1)throw new e.error.DimensionError(n.size().length,1);var r=t.length;o.validateIndex(n.min()[0],r),o.validateIndex(n.max()[0],r);var i=n.range(0),u="";return i.forEach(function(e){u+=t.charAt(e)}),u}throw new TypeError("Index expected")}function c(t,n,r,s){var o;if(a(t))return o=e.matrix(e.clone(t)),o.subset(n,r,s),o.valueOf();if(t instanceof i)return t.clone().subset(n,r,s);if(u(t))return h(t,n,r,s);throw new e.error.UnsupportedTypeError("subset",e["typeof"](t))}function h(t,n,r,i){if(n instanceof s){if(n.size().length!=1)throw new e.error.DimensionError(n.size().length,1);if(i!==undefined){if(!u(i)||i.length!==1)throw new TypeError("Single character expected as defaultValue")}else i=" ";var a=n.range(0),f=a.size()[0];if(f!=r.length)throw new e.error.DimensionError(a.size()[0],r.length);var l=t.length;o.validateIndex(n.min()[0]),o.validateIndex(n.max()[0]);var c=[];for(var h=0;h<l;h++)c[h]=t.charAt(h);a.forEach(function(e,t){c[e]=r.charAt(t)});if(c.length>l)for(h=l-1,f=c.length;h<f;h++)c[h]||(c[h]=i);return c.join("")}throw new TypeError("Index expected")}var r=n(175),i=e.type.Matrix,s=n(9),o=r.array,u=r.string.isString,a=Array.isArray;e.subset=function(n,r,i,s){switch(arguments.length){case 2:return f(arguments[0],arguments[1]);case 3:case 4:return c(arguments[0],arguments[1],arguments[2],arguments[3]);default:throw new e.error.ArgumentsError("subset",arguments.length,2,4)}}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.Matrix,i=t.object,s=t.array,o=t.string;e.trace=function(n){if(arguments.length!=1)throw new e.error.ArgumentsError("trace",arguments.length,1);if(n instanceof r)return n.trace();var u;n instanceof Array?u=s.size(n):u=[];switch(u.length){case 0:return i.clone(n);case 1:if(u[0]==1)return i.clone(n[0]);throw new RangeError("Array must be square (size: "+o.format(u)+")");case 2:var a=u[0],f=u[1];if(a==f){var l=0;for(var c=0;c<n.length;c++)l=e.add(l,n[c][c]);return l}throw new RangeError("Array must be square (size: "+o.format(u)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+o.format(u)+")")}}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.Matrix,i=t.object,s=t.string;e.transpose=function(n){if(arguments.length!=1)throw new e.error.ArgumentsError("transpose",arguments.length,1);var o=e.size(n).valueOf();switch(o.length){case 0:return i.clone(n);case 1:return i.clone(n);case 2:if(n instanceof r)return n.transpose();var u=o[1],a=o[0],f=n.valueOf(),l=[],c,h=i.clone;if(u===0)throw new RangeError("Cannot transpose a 2D matrix with no rows(size: "+s.format(o)+")");for(var p=0;p<u;p++){c=l[p]=[];for(var d=0;d<a;d++)c[d]=h(f[d][p])}return l;default:throw new RangeError("Matrix must be two dimensional (size: "+s.format(o)+")")}}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.type.Matrix,o=e.collection,u=r.array,a=r.number.isNumber,f=r.number.isInteger,l=r.string.isString,c=Array.isArray;e.zeros=function(r){var h=o.argsToArray(arguments),p;h.length>0&&l(h[h.length-1])?(p=h[h.length-1],h=o.argsToArray(h.slice(0,h.length-1))):r instanceof s?p=r.storage():!c(r)&&t.matrix==="matrix"&&(p="default");var d=!1;h=h.map(function(e){e instanceof i&&(d=!0,e=e.toNumber());if(!a(e)||!f(e)||e<0)throw new Error("Parameters in function eye must be positive integers");return e});var v=d?new i(0):0;if(p){var m=e.matrix(p);return h.length>0?m.resize(h,v):m}var g=[];return h.length>0?u.resize(g,h,v):g}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=e.collection,o=r.number.isNumber,u=r["boolean"].isBoolean,a=r.number.isInteger,f=s.isCollection;e.factorial=function p(n){var a,d,v;if(arguments.length!=1)throw new e.error.ArgumentsError("factorial",arguments.length,1);if(o(n))return n!==Number.POSITIVE_INFINITY?e.gamma(n+1):Math.sqrt(2*Math.PI);if(n instanceof i){if(!l(n))return n.isNegative()||n.isFinite()?e.gamma(n.plus(1)):r.bignumber.tau(t.precision).sqrt();n=n.toNumber();if(n<h.length)return i.convert(h[n]).toSD(t.precision);var m=t.precision+(Math.log(n)|0),g=i.constructor({precision:m});n-=h.length;if(v=c[m]){if(v[n])return new i(v[n].toPrecision(t.precision));d=v[v.length-1]}else v=c[m]=[],d=(new g(h[h.length-1])).toSD(m);var y=new g(1);a=new g(v.length+h.length);for(var b=v.length;b<n;++b)v[b]=d=d.times(a),a=a.plus(y);return v[n]=d.times(a),new i(v[n].toPrecision(t.precision))}if(u(n)||n===null)return 1;if(f(n))return s.deepMap(n,p);throw new e.error.UnsupportedTypeError("factorial",e["typeof"](n))};var l=function(e){return e.isInteger()&&(!e.isNegative()||e.isZero())},c=[],h=[1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368e3,20922789888e3,355687428096e3,6402373705728e3,0x1b02b9306890000,243290200817664e4]}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=e.collection,u=r["boolean"].isBoolean,a=s.isComplex,f=r.number.isNumber,l=r.number.isInteger,c=o.isCollection;e.gamma=function p(t){var n,r,d=4.7421875;if(arguments.length!=1)throw new e.error.ArgumentsError("gamma",arguments.length,1);if(f(t)){if(l(t)){if(t<=0)return isFinite(t)?Infinity:NaN;if(t>171)return Infinity;var v=t-2,m=t-1;while(v>1)m*=v,v--;return m==0&&(m=1),m}if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*p(1-t));if(t>=171.35)return Infinity;if(t>85){var g=t*t,y=g*t,b=y*t,w=b*t;return Math.sqrt(2*Math.PI/t)*Math.pow(t/Math.E,t)*(1+1/(12*t)+1/(288*g)-139/(51840*y)-571/(2488320*b)+163879/(209018880*w)+5246819/(75246796800*w*t))}--t,r=h[0];for(var E=1;E<h.length;++E)r+=h[E]/(t+E);return n=t+d+.5,Math.sqrt(2*Math.PI)*Math.pow(n,t+.5)*Math.exp(-n)*r}if(a(t)){if(t.im==0)return p(t.re);t=new s(t.re-1,t.im),r=new s(h[0],0);for(var E=1;E<h.length;++E){var S=t.re+E,x=S*S+t.im*t.im;x!=0?(r.re+=h[E]*S/x,r.im+=-(h[E]*t.im)/x):r.re=h[E]<0?-Infinity:Infinity}n=new s(t.re+d+.5,t.im);var T=Math.sqrt(2*Math.PI);t.re+=.5;var N=e.pow(n,t);N.im==0?N.re*=T:N.re==0?N.im*=T:(N.re*=T,N.im*=T);var C=Math.exp(-n.re);return n.re=C*Math.cos(-n.im),n.im=C*Math.sin(-n.im),e.multiply(e.multiply(N,n),r)}if(t instanceof i){if(t.isInteger())return t.isNegative()||t.isZero()?new i(Infinity):e.factorial(t.minus(1));if(!t.isFinite())return new i(t.isNegative()?NaN:Infinity)}if(u(t)||t===null)return t?1:Infinity;if(c(t))return o.deepMap(t,p);throw new e.error.UnsupportedTypeError("gamma",e["typeof"](t))};var h=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-0.4919138160976202,3399464998481189e-20,4652362892704858e-20,-0.00009837447530487956,.0001580887032249125,-0.00021026444172410488,.00021743961811521265,-0.0001643181065367639,8441822398385275e-20,-0.000026190838401581408,36899182659531625e-22]}},function(e,t,n){"use strict";e.exports=function(e){var t=n(337)(e);e.random=t("uniform").random}},function(e,t,n){"use strict";e.exports=function(e){var t=n(337)(e);e.randomInt=t("uniform").randomInt}},function(e,t,n){"use strict";e.exports=function(e){var t=n(337)(e);e.pickRandom=t("uniform").pickRandom}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=t.number.isNumber,s=t.number.isInteger;e.permutations=function(n,u){var a,f,l=arguments.length;if(l>2)throw new e.error.ArgumentsError("permutations",arguments.length,2);if(i(n)){if(!s(n)||n<0)throw new TypeError("Positive integer value expected in function permutations");if(l==1)return e.factorial(n);if(l==2&&i(u)){if(!s(u)||u<0)throw new TypeError("Positive integer value expected in function permutations");if(u>n)throw new TypeError("second argument k must be less than or equal to first argument n");a=1;for(f=n-u+1;f<=n;f++)a*=f;return a}}if(n instanceof r){if(u===undefined&&o(n))return e.factorial(n);u=r.convert(u);if(u instanceof r&&!!o(n)&&!!o(u)){if(u.gt(n))throw new TypeError("second argument k must be less than or equal to first argument n");a=new r(1);for(f=n.minus(u).plus(1);f.lte(n);f=f.plus(1))a=a.times(f);return a}throw new TypeError("Positive integer value expected in function permutations")}throw new e.error.UnsupportedTypeError("permutations",e["typeof"](n))};var o=function(e){return e.isInteger()&&e.gte(0)}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=e.collection,s=t.number.isNumber,o=t.number.isInteger;e.combinations=function(n,i){var a,f,l,c,h=arguments.length;if(h!=2)throw new e.error.ArgumentsError("combinations",arguments.length,2);if(s(n)){if(!o(n)||n<0)throw new TypeError("Positive integer value enpected in function combinations");if(i>n)throw new TypeError("k must be less than or equal to n");a=Math.max(i,n-i),f=1;for(l=1;l<=n-a;l++)f=f*(a+l)/l;return f}if(n instanceof r){i=r.convert(i);if(i instanceof r&&!!u(n)&&!!u(i)){if(i.gt(n))throw new TypeError("k must be less than n in function combinations");a=n.minus(i),i.lt(a)&&(a=i),f=new r(1);for(l=new r(1),c=n.minus(a);l.lte(c);l=l.plus(1))f=f.times(a.plus(l)).dividedBy(l);return f}throw new TypeError("Positive integer value expected in function combinations")}throw new e.error.UnsupportedTypeError("combinations",e["typeof"](n))};var u=function(e){return e.isInteger()&&e.gte(0)}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r.number.nearlyEqual,l=r["boolean"].isBoolean,c=r.string.isString,h=s.isComplex,p=o.isUnit,d=u.isCollection;e.compare=function v(n,r){if(arguments.length!=2)throw new e.error.ArgumentsError("compare",arguments.length,2);if(a(n)&&a(r))return f(n,r,t.epsilon)?0:n>r?1:-1;if(n instanceof i){if(a(r))r=i.convert(r);else if(l(r)||r===null)r=new i(r?1:0);return r instanceof i?new i(n.cmp(r)):v(n.toNumber(),r)}if(r instanceof i){if(a(n))n=i.convert(n);else if(l(n)||n===null)n=new i(n?1:0);return n instanceof i?new i(n.cmp(r)):v(n,r.toNumber())}if(p(n)&&p(r)){if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return n.value>r.value?1:n.value<r.value?-1:0}if(d(n)||d(r))return u.deepMap2(n,r,v);if(c(n)||c(r))return n>r?1:n<r?-1:0;if(l(n)||n===null)return v(+n,r);if(l(r)||r===null)return v(n,+r);throw h(n)||h(r)?new TypeError("No ordering relation is defined for complex numbers"):new e.error.UnsupportedTypeError("compare",e["typeof"](n),e["typeof"](r))}}},function(e,t,n){"use strict";e.exports=function(e){function i(t,n){if(r(t)){if(r(n)){var s=t.length;if(s!==n.length)return!1;for(var o=0;o<s;o++)if(!i(t[o],n[o]))return!1;return!0}return!1}return r(n)?!1:e.equal(t,n)}var t=e.collection,n=t.isCollection,r=Array.isArray;e.deepEqual=function(r,s){if(arguments.length!=2)throw new e.error.ArgumentsError("deepEqual",arguments.length,2);return n(r)||n(s)?i(r.valueOf(),s.valueOf()):e.equal(r,s)}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r.number.nearlyEqual,l=r["boolean"].isBoolean,c=r.string.isString,h=s.isComplex,p=o.isUnit,d=u.isCollection;e.equal=function v(n,r){if(arguments.length!=2)throw new e.error.ArgumentsError("equal",arguments.length,2);if(a(n)){if(a(r))return f(n,r,t.epsilon);if(h(r))return f(n,r.re,t.epsilon)&&f(r.im,0,t.epsilon)}if(h(n)){if(a(r))return f(n.re,r,t.epsilon)&&f(n.im,0,t.epsilon);if(h(r))return f(n.re,r.re,t.epsilon)&&f(n.im,r.im,t.epsilon)}if(n instanceof i)return a(r)?r=i.convert(r):l(r)&&(r=new i(r?1:0)),r instanceof i?n.eq(r):v(n.toNumber(),r);if(r instanceof i)return a(n)?n=i.convert(n):l(n)&&(n=new i(n?1:0)),n instanceof i?n.eq(r):v(n,r.toNumber());if(p(n)&&p(r)){if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return n.value==r.value}if(d(n)||d(r))return u.deepMap2(n,r,v);if(c(n)||c(r))return n==r;if(l(n))return v(+n,r);if(l(r))return v(n,+r);if(n===null)return r===null;if(r===null)return n===null;if(n===undefined)return r===undefined;if(r===undefined)return n===undefined;throw new e.error.UnsupportedTypeError("equal",e["typeof"](n),e["typeof"](r))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r.number.nearlyEqual,l=r["boolean"].isBoolean,c=r.string.isString,h=s.isComplex,p=o.isUnit,d=u.isCollection;e.larger=function v(n,r){if(arguments.length!=2)throw new e.error.ArgumentsError("larger",arguments.length,2);if(a(n)&&a(r))return!f(n,r,t.epsilon)&&n>r;if(n instanceof i){if(a(r))r=i.convert(r);else if(l(r)||r===null)r=new i(r?1:0);return r instanceof i?n.gt(r):v(n.toNumber(),r)}if(r instanceof i){if(a(n))n=i.convert(n);else if(l(n)||n===null)n=new i(n?1:0);return n instanceof i?n.gt(r):v(n,r.toNumber())}if(p(n)&&p(r)){if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return n.value>r.value}if(d(n)||d(r))return u.deepMap2(n,r,v);if(c(n)||c(r))return n>r;if(l(n)||n===null)return v(+n,r);if(l(r)||r===null)return v(n,+r);throw h(n)||h(r)?new TypeError("No ordering relation is defined for complex numbers"):new e.error.UnsupportedTypeError("larger",e["typeof"](n),e["typeof"](r))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r.number.nearlyEqual,l=r["boolean"].isBoolean,c=r.string.isString,h=s.isComplex,p=o.isUnit,d=u.isCollection;e.largerEq=function v(n,r){if(arguments.length!=2)throw new e.error.ArgumentsError("largerEq",arguments.length,2);if(a(n)&&a(r))return f(n,r,t.epsilon)||n>r;if(n instanceof i){if(a(r))r=i.convert(r);else if(l(r)||r===null)r=new i(r?1:0);return r instanceof i?n.gte(r):v(n.toNumber(),r)}if(r instanceof i){if(a(n))n=i.convert(n);else if(l(n)||n===null)n=new i(n?1:0);return n instanceof i?n.gte(r):v(n,r.toNumber())}if(p(n)&&p(r)){if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return n.value>=r.value}if(d(n)||d(r))return u.deepMap2(n,r,v);if(c(n)||c(r))return n>=r;if(l(n)||n===null)return v(+n,r);if(l(r)||r===null)return v(n,+r);throw h(n)||h(r)?new TypeError("No ordering relation is defined for complex numbers"):new e.error.UnsupportedTypeError("largerEq",e["typeof"](n),e["typeof"](r))},e.largereq=function(){throw new Error("Function largereq is renamed to largerEq")}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r.number.nearlyEqual,l=r["boolean"].isBoolean,c=r.string.isString,h=s.isComplex,p=o.isUnit,d=u.isCollection;e.smaller=function v(n,r){if(arguments.length!=2)throw new e.error.ArgumentsError("smaller",arguments.length,2);if(a(n)&&a(r))return!f(n,r,t.epsilon)&&n<r;if(n instanceof i){if(a(r))r=i.convert(r);else if(l(r)||r===null)r=new i(r?1:0);return r instanceof i?n.lt(r):v(n.toNumber(),r)}if(r instanceof i){if(a(n))n=i.convert(n);else if(l(n)||n===null)n=new i(n?1:0);return n instanceof i?n.lt(r):v(n,r.toNumber())}if(p(n)&&p(r)){if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return n.value<r.value}if(d(n)||d(r))return u.deepMap2(n,r,v);if(c(n)||c(r))return n<r;if(l(n)||n===null)return v(+n,r);if(l(r)||r===null)return v(n,+r);throw h(n)||h(r)?new TypeError("No ordering relation is defined for complex numbers"):new e.error.UnsupportedTypeError("smaller",e["typeof"](n),e["typeof"](r))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r.number.nearlyEqual,l=r["boolean"].isBoolean,c=r.string.isString,h=s.isComplex,p=o.isUnit,d=u.isCollection;e.smallerEq=function v(n,r){if(arguments.length!=2)throw new e.error.ArgumentsError("smallerEq",arguments.length,2);if(a(n)&&a(r))return f(n,r,t.epsilon)||n<r;if(n instanceof i){if(a(r))r=i.convert(r);else if(l(r)||r===null)r=new i(r?1:0);return r instanceof i?n.lte(r):v(n.toNumber(),r)}if(r instanceof i){if(a(n))n=i.convert(n);else if(l(n)||n===null)n=new i(n?1:0);return n instanceof i?n.lte(r):v(n,r.toNumber())}if(p(n)&&p(r)){if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return n.value<=r.value}if(d(n)||d(r))return u.deepMap2(n,r,v);if(c(n)||c(r))return n<=r;if(l(n)||n===null)return v(+n,r);if(l(r)||r===null)return v(n,+r);throw h(n)||h(r)?new TypeError("No ordering relation is defined for complex numbers"):new e.error.UnsupportedTypeError("smallerEq",e["typeof"](n),e["typeof"](r))},e.smallereq=function(){throw new Error("Function smallereq is renamed to smallerEq")}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r.number.nearlyEqual,l=r["boolean"].isBoolean,c=r.string.isString,h=s.isComplex,p=o.isUnit,d=u.isCollection;e.unequal=function v(n,r){if(arguments.length!=2)throw new e.error.ArgumentsError("unequal",arguments.length,2);if(a(n)){if(a(r))return!f(n,r,t.epsilon);if(h(r))return!f(n,r.re,t.epsilon)||!f(r.im,0,t.epsilon)}if(h(n)){if(a(r))return!f(n.re,r,t.epsilon)||!f(n.im,0,t.epsilon);if(h(r))return!f(n.re,r.re,t.epsilon)||!f(n.im,r.im,t.epsilon)}if(n instanceof i)return a(r)?r=i.convert(r):l(r)&&(r=new i(r?1:0)),r instanceof i?!n.eq(r):v(n.toNumber(),r);if(r instanceof i)return a(n)?n=i.convert(n):l(n)&&(n=new i(n?1:0)),n instanceof i?!n.eq(r):v(n,r.toNumber());if(p(n)&&p(r)){if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return n.value!=r.value}if(d(n)||d(r))return u.deepMap2(n,r,v);if(c(n)||c(r))return n!=r;if(l(n))return v(+n,r);if(l(r))return v(n,+r);if(n===null)return r!==null;if(r===null)return n!==null;if(n===undefined)return r!==undefined;if(r===undefined)return n!==undefined;throw new e.error.UnsupportedTypeError("unequal",e["typeof"](n),e["typeof"](r))}}},function(e,t,n){"use strict";e.exports=function(e){function i(t,n){return e.smaller(t,n)?t:n}function s(t){var r=undefined;n.deepForEach(t,function(t){if(r===undefined||e.smaller(t,r))r=t});if(r===undefined)throw new Error("Cannot calculate min of an empty array");return r}var t=e.type.Matrix,n=e.collection,r=n.isCollection;e.min=function(t){if(arguments.length==0)throw new SyntaxError("Function min requires one or more parameters (0 provided)");if(r(t)){if(arguments.length==1)return s(t);if(arguments.length==2)return n.reduce(arguments[0],arguments[1],i);throw new SyntaxError("Wrong number of parameters")}return s(arguments)}}},function(e,t,n){"use strict";e.exports=function(e){function i(t,n){return e.larger(t,n)?t:n}function s(t){var r=undefined;n.deepForEach(t,function(t){if(r===undefined||e.larger(t,r))r=t});if(r===undefined)throw new Error("Cannot calculate max of an empty array");return r}var t=e.type.Matrix,n=e.collection,r=n.isCollection;e.max=function(t){if(arguments.length==0)throw new SyntaxError("Function max requires one or more parameters (0 provided)");if(r(t)){if(arguments.length==1)return s(t);if(arguments.length==2)return n.reduce(arguments[0],arguments[1],i);throw new SyntaxError("Wrong number of parameters")}return s(arguments)}}},function(e,t,n){"use strict";e.exports=function(e){function u(t,n){var i=r.reduce(t,n,e.add),u=o(t)?s(t):t.size();return e.divide(i,u[n])}function a(t){var n=0,i=0;r.deepForEach(t,function(t){n=e.add(n,t),i++});if(i===0)throw new Error("Cannot calculate mean of an empty array");return e.divide(n,i)}var t=e.type.Matrix,r=e.collection,i=r.isCollection,s=n(169).size,o=Array.isArray;e.mean=function(t){if(arguments.length==0)throw new SyntaxError("Function mean requires one or more parameters (0 provided)");if(i(t)){if(arguments.length==1)return a(t);if(arguments.length==2)return u(arguments[0],arguments[1]);throw new SyntaxError("Wrong number of parameters")}return a(arguments)}}},function(e,t,n){"use strict";e.exports=function(e){function f(t){var n=a(t);n.sort(e.compare);var s=n.length;if(s==0)throw new Error("Cannot calculate median of an empty array");if(s%2==0){var u=n[s/2-1],f=n[s/2];if(!!o(u)||u instanceof i||u instanceof r){if(!!o(f)||f instanceof i||f instanceof r)return e.divide(e.add(u,f),2);throw new e.error.UnsupportedTypeError("median",e["typeof"](f))}throw new e.error.UnsupportedTypeError("median",e["typeof"](u))}var l=n[(s-1)/2];if(!!o(l)||l instanceof i||l instanceof r)return l;throw new e.error.UnsupportedTypeError("median",e["typeof"](l))}var t=e.type.Matrix,r=n(11),i=e.type.BigNumber,s=e.collection,o=n(3).isNumber,u=s.isCollection,a=n(169).flatten;e.median=function(t){if(arguments.length==0)throw new SyntaxError("Function median requires one or more parameters (0 provided)");if(u(t)){if(arguments.length==1)return f(t.valueOf());throw arguments.length==2?new Error("median(A, dim) is not yet supported"):new SyntaxError("Wrong number of parameters")}return f(Array.prototype.slice.call(arguments))}}},function(e,t,n){"use strict";e.exports=function(e){function i(t){var r=undefined;n.deepForEach(t,function(t){r=r===undefined?t:e.multiply(r,t)});if(r===undefined)throw new Error("Cannot calculate prod of an empty array");return r}var t=e.type.Matrix,n=e.collection,r=n.isCollection;e.prod=function(t){if(arguments.length==0)throw new SyntaxError("Function prod requires one or more parameters (0 provided)");if(r(t)){if(arguments.length==1)return i(t);throw arguments.length==2?new Error("prod(A, dim) is not yet supported"):new SyntaxError("Wrong number of parameters")}return i(arguments)}}},function(e,t,n){"use strict";e.exports=function(e){e.std=function(n,r){if(arguments.length==0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");var i=e["var"].apply(null,arguments);return e.sqrt(i)}}},function(e,t,n){"use strict";e.exports=function(e){function i(t){var r=undefined;n.deepForEach(t,function(t){r=r===undefined?t:e.add(r,t)});if(r===undefined)throw new Error("Cannot calculate sum of an empty array");return r}var t=e.type.Matrix,n=e.collection,r=n.isCollection;e.sum=function(t){if(arguments.length==0)throw new SyntaxError("Function sum requires one or more parameters (0 provided)");if(r(t)){if(arguments.length==1)return i(t);throw arguments.length==2?new Error("sum(A, dim) is not yet supported"):new SyntaxError("Wrong number of parameters")}return i(arguments)}}},function(e,t,n){"use strict";e.exports=function(e){function a(t,n){var s=0,o=0;i.deepForEach(t,function(t){s=e.add(s,t),o++});if(o===0)throw new Error("Cannot calculate var of an empty array");var u=e.divide(s,o);s=0,i.deepForEach(t,function(t){var n=e.subtract(t,u);s=e.add(s,e.multiply(n,n))});switch(n){case"uncorrected":return e.divide(s,o);case"biased":return e.divide(s,o+1);case"unbiased":var a=s instanceof r?new r(0):0;return o==1?a:e.divide(s,o-1);default:throw new Error('Unknown normalization "'+n+'". '+'Choose "unbiased" (default), "uncorrected", or "biased".')}}var t=e.type.Matrix,r=e.type.BigNumber,i=e.collection,s=i.isCollection,o=n(176).isString,u="unbiased";e["var"]=function(t,n){if(arguments.length==0)throw new SyntaxError("Function var requires one or more parameters (0 provided)");if(s(t)){if(arguments.length==1)return a(t,u);if(arguments.length==2){if(!o(n))throw new Error("String expected for parameter normalization");return a(t,n)}throw new SyntaxError("Wrong number of parameters")}return a(arguments,u)}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection,l=t.bignumber.arccos_arcsec;e.acos=function c(t){if(arguments.length!=1)throw new e.error.ArgumentsError("acos",arguments.length,1);if(o(t))return t>=-1&&t<=1?Math.acos(t):c(new i(t,0));if(a(t)){var n=new i(t.im*t.im-t.re*t.re+1,-2*t.re*t.im),h=e.sqrt(n),p=new i(h.re-t.im,h.im+t.re),d=e.log(p);return new i(1.5707963267948966-d.im,d.re)}if(f(t))return s.deepMap(t,c);if(u(t)||t===null)return Math.acos(t);if(t instanceof r)return l(t,r,!1);throw new e.error.UnsupportedTypeError("acos",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.acosh_asinh_asech_acsch;e.acosh=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("acosh",arguments.length,1);if(u(t))return t>=1?Math.log(Math.sqrt(t*t-1)+t):t<=-1?new i(Math.log(Math.sqrt(t*t-1)-t),Math.PI):p(new i(t,0));if(f(t)){var n,s=e.acos(t);return s.im<=0?(n=s.re,s.re=-s.im,s.im=n):(n=s.im,s.im=-s.re,s.re=n),s}if(c(t))return o.deepMap(t,p);if(a(t)||t===null)return t?0:new i(0,1.5707963267948966);if(t instanceof r)return h(t,r,!1,!1);throw new e.error.UnsupportedTypeError("acosh",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection,l=t.bignumber.arctan_arccot;e.acot=function h(t){if(arguments.length!=1)throw new e.error.ArgumentsError("acot",arguments.length,1);if(o(t))return t?Math.atan(1/t):c;if(a(t)){if(t.im==0)return new i(t.re?Math.atan(1/t.re):c,0);var n=t.re*t.re+t.im*t.im;return t=n!=0?new i(t.re=t.re/n,t.im=-t.im/n):new i(t.re!=0?t.re/0:0,t.im!=0?-(t.im/0):0),e.atan(t)}if(f(t))return s.deepMap(t,h);if(u(t)||t===null)return t?.7853981633974483:c;if(t instanceof r)return l(t,r,!0);throw new e.error.UnsupportedTypeError("acot",e["typeof"](t))};var c=1.5707963267948966}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.atanh_acoth;e.acoth=function d(t){if(arguments.length!=1)throw new e.error.ArgumentsError("acoth",arguments.length,1);if(u(t))return t>=1||t<=-1?isFinite(t)?(Math.log((t+1)/t)+Math.log(t/(t-1)))/2:0:t?d(new i(t,0)):new i(0,p);if(f(t)){if(t.re==0&&t.im==0)return new i(0,p);var n=t.re*t.re+t.im*t.im;return t=n!=0?new i(t.re/n,-t.im/n):new i(t.re!=0?t.re/0:0,t.im!=0?-(t.im/0):0),e.atanh(t)}if(c(t))return o.deepMap(t,d);if(a(t)||t===null)return t?Infinity:new i(0,p);if(t instanceof r)return h(t,r,!0);throw new e.error.UnsupportedTypeError("acoth",e["typeof"](t))};var p=1.5707963267948966}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection,l=t.bignumber.arcsin_arccsc;e.acsc=function h(t){if(arguments.length!=1)throw new e.error.ArgumentsError("acsc",arguments.length,1);if(o(t))return t<=-1||t>=1?Math.asin(1/t):h(new i(t,0));if(a(t)){if(t.re==0&&t.im==0)return new i(c,Infinity);var n=t.re*t.re+t.im*t.im;return t=n!=0?new i(t.re=t.re/n,t.im=-t.im/n):new i(t.re!=0?t.re/0:0,t.im!=0?-(t.im/0):0),e.asin(t)}if(f(t))return s.deepMap(t,h);if(u(t)||t===null)return t?c:new i(c,Infinity);if(t instanceof r)return l(t,r,!0);throw new e.error.UnsupportedTypeError("acsc",e["typeof"](t))};var c=1.5707963267948966}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.acosh_asinh_asech_acsch;e.acsch=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("acsch",arguments.length,1);if(u(t))return t=1/t,Math.log(t+Math.sqrt(t*t+1));if(f(t)){if(t.im==0)return t=t.re!=0?Math.log(t.re+Math.sqrt(t.re*t.re+1)):Infinity,new i(t,0);var n=t.re*t.re+t.im*t.im;return t=n!=0?new i(t.re/n,-t.im/n):new i(t.re!=0?t.re/0:0,t.im!=0?-(t.im/0):0),e.asinh(t)}if(c(t))return o.deepMap(t,p);if(a(t)||t===null)return t?.881373587019543:Infinity;if(t instanceof r)return h(t,r,!0,!0);throw new e.error.UnsupportedTypeError("acsch",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection,l=t.bignumber.arccos_arcsec;e.asec=function c(t){if(arguments.length!=1)throw new e.error.ArgumentsError("asec",arguments.length,1);if(o(t))return t<=-1||t>=1?Math.acos(1/t):c(new i(t,0));if(a(t)){if(t.re==0&&t.im==0)return new i(0,Infinity);var n=t.re*t.re+t.im*t.im;return t=n!=0?new i(t.re=t.re/n,t.im=-t.im/n):new i(t.re!=0?t.re/0:0,t.im!=0?-(t.im/0):0),e.acos(t)}if(f(t))return s.deepMap(t,c);if(u(t)||t===null)return t?0:new i(0,Infinity);if(t instanceof r)return l(t,r,!0);throw new e.error.UnsupportedTypeError("asec",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.acosh_asinh_asech_acsch;e.asech=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("asech",arguments.length,1);if(u(t)){if(t<=1&&t>=-1){t=1/t;var n=Math.sqrt(t*t-1);return t>0?Math.log(n+t):new i(Math.log(n-t),Math.PI)}return p(new i(t,0))}if(f(t)){if(t.re==0&&t.im==0)return new i(Infinity,0);var s=t.re*t.re+t.im*t.im;return t=s!=0?new i(t.re/s,-t.im/s):new i(t.re!=0?t.re/0:0,t.im!=0?-(t.im/0):0),e.acosh(t)}if(c(t))return o.deepMap(t,p);if(a(t)||t===null)return t?0:Infinity;if(t instanceof r)return h(t,r,!1,!0);throw new e.error.UnsupportedTypeError("asech",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection,l=t.bignumber.arcsin_arccsc;e.asin=function c(t){if(arguments.length!=1)throw new e.error.ArgumentsError("asin",arguments.length,1);if(o(t))return t>=-1&&t<=1?Math.asin(t):c(new i(t,0));if(a(t)){var n=t.re,h=t.im,p=new i(h*h-n*n+1,-2*n*h),d=e.sqrt(p),v=new i(d.re-h,d.im+n),m=e.log(v);return new i(m.im,-m.re)}if(f(t))return s.deepMap(t,c,!0);if(u(t)||t===null)return Math.asin(t);if(t instanceof r)return l(t,r,!1);throw new e.error.UnsupportedTypeError("asin",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.acosh_asinh_asech_acsch;e.asinh=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("asinh",arguments.length,1);if(u(t))return Math.log(Math.sqrt(t*t+1)+t);if(f(t)){var n=t.im;t.im=-t.re,t.re=n;var i=e.asin(t);return t.re=-t.im,t.im=n,n=i.re,i.re=-i.im,i.im=n,i}if(c(t))return o.deepMap(t,p,!0);if(a(t)||t===null)return t?.881373587019543:0;if(t instanceof r)return h(t,r,!0,!1);throw new e.error.UnsupportedTypeError("asinh",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection,l=t.bignumber.arctan_arccot;e.atan=function c(t){if(arguments.length!=1)throw new e.error.ArgumentsError("atan",arguments.length,1);if(o(t))return Math.atan(t);if(a(t)){if(t.re==0){if(t.im==1)return new i(0,Infinity);if(t.im==-1)return new i(0,-Infinity)}var n=t.re,h=t.im,p=n*n+(1-h)*(1-h),d=new i((1-h*h-n*n)/p,-2*n/p),v=e.log(d);return new i(-0.5*v.im,.5*v.re)}if(f(t))return s.deepMap(t,c,!0);if(u(t)||t===null)return Math.atan(t);if(t instanceof r)return l(t,r,!1);throw new e.error.UnsupportedTypeError("atan",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=e.collection,o=t.number.isNumber,u=t["boolean"].isBoolean,a=i.isComplex,f=s.isCollection,l=t.bignumber.arctan2;e.atan2=function c(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("atan2",arguments.length,2);if(o(t)){if(o(n))return Math.atan2(t,n);if(n instanceof r)return l(new r(t),n,r)}if(f(t)||f(n))return s.deepMap2(t,n,c);if(u(t)||t===null)return c(t?1:0,n);if(u(n)||n===null)return c(t,n?1:0);if(t instanceof r)return o(n)?l(t,new r(n),r):n instanceof r?l(t,n,r):c(t.toNumber(),n);if(n instanceof r)return t instanceof r?l(t,n,r):c(t,n.toNumber());throw new e.error.UnsupportedTypeError("atan2",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.atanh_acoth;e.atanh=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("atanh",arguments.length,1);if(u(t))return t<=1&&t>=-1?Math.log((1+t)/(1-t))/2:p(new i(t,0));if(f(t)){var n=t.re>1&&t.im==0,s=1-t.re,l=1+t.re,d=s*s+t.im*t.im;t=d!=0?new i((l*s-t.im*t.im)/d,(t.im*s+l*t.im)/d):new i(t.re!=-1?t.re/0:0,t.im!=0?t.im/0:0);var v=t.re;return t.re=Math.log(Math.sqrt(t.re*t.re+t.im*t.im))/2,t.im=Math.atan2(t.im,v)/2,n&&(t.im=-t.im),t}if(c(t))return o.deepMap(t,p,!0);if(a(t)||t===null)return t?Infinity:0;if(t instanceof r)return h(t,r,!1);throw new e.error.UnsupportedTypeError("atanh",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r["boolean"].isBoolean,l=s.isComplex,c=o.isUnit,h=u.isCollection,p=r.bignumber.cos_sin_sec_csc;e.cos=function d(t){if(arguments.length!=1)throw new e.error.ArgumentsError("cos",arguments.length,1);if(a(t))return Math.cos(t);if(l(t))return new s(Math.cos(t.re)*e.cosh(-t.im),Math.sin(t.re)*e.sinh(-t.im));if(c(t)){if(!t.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.cos(t.value)}if(h(t))return u.deepMap(t,d);if(f(t)||t===null)return Math.cos(t);if(t instanceof i)return p(t,i,0,!1);throw new e.error.UnsupportedTypeError("cos",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.cosh_sinh_csch_sech;e.cosh=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("cosh",arguments.length,1);if(u(t))return(Math.exp(t)+Math.exp(-t))/2;if(f(t)){var n=Math.exp(t.re),d=Math.exp(-t.re);return new i(Math.cos(t.im)*(n+d)/2,Math.sin(t.im)*(n-d)/2)}if(l(t)){if(!t.hasBase(s.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cosh is no angle");return p(t.value)}if(c(t))return o.deepMap(t,p);if(a(t)||t===null)return p(t?1:0);if(t instanceof r)return h(t,r,!1,!1);throw new e.error.UnsupportedTypeError("cosh",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r["boolean"].isBoolean,l=s.isComplex,c=o.isUnit,h=u.isCollection,p=r.bignumber.tan_cot;e.cot=function d(t){if(arguments.length!=1)throw new e.error.ArgumentsError("cot",arguments.length,1);if(a(t))return 1/Math.tan(t);if(l(t)){var n=Math.exp(-4*t.im)-2*Math.exp(-2*t.im)*Math.cos(2*t.re)+1;return new s(2*Math.exp(-2*t.im)*Math.sin(2*t.re)/n,(Math.exp(-4*t.im)-1)/n)}if(c(t)){if(!t.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return 1/Math.tan(t.value)}if(h(t))return u.deepMap(t,d);if(f(t)||t===null)return d(+t);if(t instanceof i)return p(t,i,!0);throw new e.error.UnsupportedTypeError("cot",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.tanh_coth;e.coth=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("coth",arguments.length,1);if(u(t)){var n=Math.exp(2*t);return(n+1)/(n-1)}if(f(t)){var d=Math.exp(2*t.re),v=d*Math.cos(2*t.im),m=d*Math.sin(2*t.im),g=(v-1)*(v-1)+m*m;return new i(((v+1)*(v-1)+m*m)/g,-2*m/g)}if(l(t)){if(!t.hasBase(s.BASE_UNITS.ANGLE))throw new TypeError("Unit in function coth is no angle");return p(t.value)}if(c(t))return o.deepMap(t,p);if(a(t)||t===null)return p(t?1:0);if(t instanceof r)return h(t,r,!0);throw new e.error.UnsupportedTypeError("coth",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r["boolean"].isBoolean,l=s.isComplex,c=o.isUnit,h=u.isCollection,p=r.bignumber.cos_sin_sec_csc;e.csc=function d(t){if(arguments.length!=1)throw new e.error.ArgumentsError("csc",arguments.length,1);if(a(t))return 1/Math.sin(t);if(l(t)){var n=.25*(Math.exp(-2*t.im)+Math.exp(2*t.im))-.5*Math.cos(2*t.re);return new s(.5*Math.sin(t.re)*(Math.exp(-t.im)+Math.exp(t.im))/n,.5*Math.cos(t.re)*(Math.exp(-t.im)-Math.exp(t.im))/n)}if(c(t)){if(!t.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return 1/Math.sin(t.value)}if(h(t))return u.deepMap(t,d);if(f(t)||t===null)return d(+t);if(t instanceof i)return p(t,i,1,!0);throw new e.error.UnsupportedTypeError("csc",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number,a=t.number.isNumber,f=t["boolean"].isBoolean,l=i.isComplex,c=s.isUnit,h=o.isCollection,p=t.bignumber.cosh_sinh_csch_sech;e.csch=function d(t){if(arguments.length!=1)throw new e.error.ArgumentsError("csch",arguments.length,1);if(a(t))return t==0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(t)-Math.exp(-t)))*u.sign(t);if(l(t)){var n=Math.exp(t.re),v=Math.exp(-t.re),m=Math.cos(t.im)*(n-v),g=Math.sin(t.im)*(n+v),y=m*m+g*g;return new i(2*m/y,-2*g/y)}if(c(t)){if(!t.hasBase(s.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csch is no angle");return d(t.value)}if(h(t))return o.deepMap(t,d);if(f(t)||t===null)return d(t?1:0);if(t instanceof r)return p(t,r,!0,!0);throw new e.error.UnsupportedTypeError("csch",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r["boolean"].isBoolean,l=s.isComplex,c=o.isUnit,h=u.isCollection,p=r.bignumber.cos_sin_sec_csc;e.sec=function d(t){if(arguments.length!=1)throw new e.error.ArgumentsError("sec",arguments.length,1);if(a(t))return 1/Math.cos(t);if(l(t)){var n=.25*(Math.exp(-2*t.im)+Math.exp(2*t.im))+.5*Math.cos(2*t.re);return new s(.5*Math.cos(t.re)*(Math.exp(-t.im)+Math.exp(t.im))/n,.5*Math.sin(t.re)*(Math.exp(t.im)-Math.exp(-t.im))/n)}if(c(t)){if(!t.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return 1/Math.cos(t.value)}if(h(t))return u.deepMap(t,d);if(f(t)||t===null)return d(+t);if(t instanceof i)return p(t,i,0,!0);throw new e.error.UnsupportedTypeError("sec",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.cosh_sinh_csch_sech;e.sech=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("sech",arguments.length,1);if(u(t))return 2/(Math.exp(t)+Math.exp(-t));if(f(t)){var n=Math.exp(t.re),d=Math.exp(-t.re),v=Math.cos(t.im)*(n+d),m=Math.sin(t.im)*(n-d),g=v*v+m*m;return new i(2*v/g,-2*m/g)}if(l(t)){if(!t.hasBase(s.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sech is no angle");return p(t.value)}if(c(t))return o.deepMap(t,p);if(a(t)||t===null)return p(t?1:0);if(t instanceof r)return h(t,r,!1,!0);throw new e.error.UnsupportedTypeError("sech",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r["boolean"].isBoolean,l=s.isComplex,c=o.isUnit,h=u.isCollection,p=r.bignumber.cos_sin_sec_csc;e.sin=function d(t){if(arguments.length!=1)throw new e.error.ArgumentsError("sin",arguments.length,1);if(a(t))return Math.sin(t);if(l(t))return new s(Math.sin(t.re)*e.cosh(-t.im),Math.cos(t.re)*e.sinh(t.im));if(c(t)){if(!t.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sin is no angle");return Math.sin(t.value)}if(h(t))return u.deepMap(t,d,!0);if(f(t)||t===null)return Math.sin(t);if(t instanceof i)return p(t,i,1,!1);throw new e.error.UnsupportedTypeError("sin",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.cosh_sinh_csch_sech;e.sinh=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("sinh",arguments.length,1);if(u(t))return Math.abs(t)<1?t+t*t*t/6+t*t*t*t*t/120:(Math.exp(t)-Math.exp(-t))/2;if(f(t)){var n=Math.cos(t.im),d=Math.sin(t.im),v=Math.exp(t.re),m=Math.exp(-t.re);return new i(n*(v-m)/2,d*(v+m)/2)}if(l(t)){if(!t.hasBase(s.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sinh is no angle");return p(t.value)}if(c(t))return o.deepMap(t,p,!0);if(a(t)||t===null)return p(t?1:0);if(t instanceof r)return h(t,r,!0,!1);throw new e.error.UnsupportedTypeError("sinh",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(175),i=e.type.BigNumber,s=n(7),o=n(11),u=e.collection,a=r.number.isNumber,f=r["boolean"].isBoolean,l=s.isComplex,c=o.isUnit,h=u.isCollection,p=r.bignumber.tan_cot;e.tan=function d(t){if(arguments.length!=1)throw new e.error.ArgumentsError("tan",arguments.length,1);if(a(t))return Math.tan(t);if(l(t)){var n=Math.exp(-4*t.im)+2*Math.exp(-2*t.im)*Math.cos(2*t.re)+1;return new s(2*Math.exp(-2*t.im)*Math.sin(2*t.re)/n,(1-Math.exp(-4*t.im))/n)}if(c(t)){if(!t.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return Math.tan(t.value)}if(h(t))return u.deepMap(t,d,!0);if(f(t)||t===null)return Math.tan(t);if(t instanceof i)return p(t,i,!1);throw new e.error.UnsupportedTypeError("tan",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=e.type.BigNumber,i=n(7),s=n(11),o=e.collection,u=t.number.isNumber,a=t["boolean"].isBoolean,f=i.isComplex,l=s.isUnit,c=o.isCollection,h=t.bignumber.tanh_coth;e.tanh=function p(t){if(arguments.length!=1)throw new e.error.ArgumentsError("tanh",arguments.length,1);if(u(t)){var n=Math.exp(2*t);return(n-1)/(n+1)}if(f(t)){var d=Math.exp(2*t.re),v=d*Math.cos(2*t.im),m=d*Math.sin(2*t.im),g=(v+1)*(v+1)+m*m;return new i(((v-1)*(v+1)+m*m)/g,m*2/g)}if(l(t)){if(!t.hasBase(s.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tanh is no angle");return p(t.value)}if(c(t))return o.deepMap(t,p,!0);if(a(t)||t===null)return p(t?1:0);if(t instanceof r)return h(t,r,!1);throw new e.error.UnsupportedTypeError("tanh",e["typeof"](t))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=n(11),i=e.collection,s=t.string.isString,o=r.isUnit,u=i.isCollection;e.to=function a(t,n){if(arguments.length!=2)throw new e.error.ArgumentsError("to",arguments.length,2);if(o(t))if(o(n)||s(n))return t.to(n);if(u(t)||u(n))return i.deepMap2(t,n,a);throw new e.error.UnsupportedTypeError("to",e["typeof"](t),e["typeof"](n))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=t.object;e.clone=function(n){if(arguments.length!=1)throw new e.error.ArgumentsError("clone",arguments.length,1);return r.clone(n)}}},function(e,t,n){"use strict";e.exports=function(e){function n(e,t){if(typeof t=="function")return e.filter(function(e){return t(e)});if(t instanceof RegExp)return e.filter(function(e){return t.test(e)});throw new TypeError("Function or RegExp expected")}var t=e.type.Matrix;e.filter=function(r,i){if(arguments.length!==2)throw new e.error.ArgumentsError("filter",arguments.length,2);if(r instanceof t){var s=r.size();if(s.length>1)throw new Error("Only one dimensional matrices supported");return e.matrix(n(r.toArray(),i))}if(Array.isArray(r))return n(r,i);throw new e.error.UnsupportedTypeError("filter",e["typeof"](r),e["typeof"](compare))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=t.string;e.format=function(n,i){var s=arguments.length;if(s!==1&&s!==2)throw new e.error.ArgumentsError("format",s,1,2);return r.format(n,i)}}},function(e,t,n){"use strict";e.exports=function(e){function f(t,n,r){if(r.override||e[t]===undefined)r.wrap&&typeof n=="function"?(e[t]=function(){var t=[];for(var r=0,i=arguments.length;r<i;r++){var s=arguments[r];t[r]=s&&s.valueOf()}return n.apply(e,t)},n&&n.transform&&(e[t].transform=n.transform)):e[t]=n,n&&n.transform&&(e.expression.transform[t]=n.transform),e.chaining.Chain.createProxy(t,n)}function l(e){return typeof e=="function"||s(e)||o(e)||u(e)||a(e)}var t=n(175),r=n(7),i=n(11),s=t.number.isNumber,o=t.string.isString,u=r.isComplex,a=i.isUnit;e["import"]=function c(t,r){var i=arguments.length;if(i!=1&&i!=2)throw new e.error.ArgumentsError("import",i,1,2);var s,u={override:r&&r.override||!1,wrap:r&&r.wrap||!1};if(o(t)){var a=n(207)(t);c(a,r)}else{if(typeof t!="object")throw new TypeError("Object or module name expected");for(s in t)if(t.hasOwnProperty(s)){var h=t[s];l(h)?f(s,h,u):c(h,r)}}}}},function(e,t,n){"use strict";e.exports=function(e){function n(e,t){var n=function(r,i){return Array.isArray(r)?r.map(function(e,t){return n(e,i.concat(t))}):t(r,i,e)};return n(e,[])}var t=e.type.Matrix;e.map=function(r,i){if(arguments.length!=2)throw new e.error.ArgumentsError("map",arguments.length,2);if(Array.isArray(r))return n(r,i);if(r instanceof t)return r.map(i);throw new e.error.UnsupportedTypeError("map",e["typeof"](r))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(175),r=t.string.isString;e.print=function(n,i,s){var o=arguments.length;if(o!=2&&o!=3)throw new e.error.ArgumentsError("print",o,2,3);if(!r(n))throw new TypeError("String expected as first parameter in function format");if(i instanceof Object)return n.replace(/\$([\w\.]+)/g,function(t,n){var o=n.split("."),u=i[o.shift()];while(o.length&&u!==undefined){var a=o.shift();u=a?u[a]:u+"."}return u!==undefined?r(u)?u:e.format(u,s):t});throw new TypeError("Object expected as second parameter in function format")}}},function(e,t,n){"use strict";e.exports=function(e){var t=e.type.Matrix;e.sort=function(n,r){var i=null;if(arguments.length===1)i=e.compare;else{if(arguments.length!==2)throw new e.error.ArgumentsError("sort",arguments.length,1,2);if(typeof r=="function")i=r;else if(r==="asc")i=e.compare;else{if(r!=="desc")throw new e.error.UnsupportedTypeError("sort",e["typeof"](n),e["typeof"](r));i=function(t,n){return-e.compare(t,n)}}}if(n instanceof t){var s=n.size();if(s.length>1)throw new Error("Only one dimensional matrices supported");return e.matrix(n.toArray().sort(i))}if(Array.isArray(n))return n.sort(i);throw new e.error.UnsupportedTypeError("sort",e["typeof"](n),e["typeof"](r))}}},function(e,t,n){"use strict";e.exports=function(e){var t=n(338),r=n(7),i=e.type.Matrix,s=n(11),o=n(9),u=n(8),a=n(12);e["typeof"]=function(f){if(arguments.length!=1)throw new e.error.ArgumentsError("typeof",arguments.length,1);var l=t.type(f);if(l==="object"){if(f instanceof r)return"complex";if(f instanceof i)return"matrix";if(f instanceof s)return"unit";if(f instanceof o)return"index";if(f instanceof u)return"range";if(f instanceof a)return"help";if(f instanceof e.type.BigNumber)return"bignumber";if(f instanceof e.chaining.Chain)return"chain"}return l}}},function(e,t,n){"use strict";e.exports=function(e){function n(e,t){var n=function(r,i){Array.isArray(r)?r.forEach(function(e,t){n(e,i.concat(t))}):t(r,i,e)};n(e,[])}var t=e.type.Matrix;e.forEach=function(r,i){if(arguments.length!=2)throw new e.error.ArgumentsError("forEach",arguments.length,2);if(Array.isArray(r))return n(r,i);if(r instanceof t)return r.forEach(i);throw new e.error.UnsupportedTypeError("forEach",e["typeof"](r))}}},function(e,t,n){"use strict";function r(e){var t=String(e).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number");var n=t[1],r=t[2],i=parseFloat(t[4]||"0"),s=r.indexOf(".");i+=s!==-1?s-1:r.length-1,this.sign=n,this.coefficients=r.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)}),this.coefficients.length===0&&(this.coefficients.push(0),i++),this.exponent=i}function i(e){var t=[];for(var n=0;n<e;n++)t.push(0);return t}r.prototype.toFixed=function(e){var t=this.roundDigits(this.exponent+1+(e||0)),n=t.coefficients,r=t.exponent+1,s=r+(e||0);return n.length<s&&(n=n.concat(i(s-n.length))),r<0&&(n=i(-r+1).concat(n),r=1),e&&n.splice(r,0,r===0?"0.":"."),this.sign+n.join("")},r.prototype.toExponential=function(e){var t=e?this.roundDigits(e):this.clone(),n=t.coefficients,r=t.exponent;n.length<e&&(n=n.concat(i(e-n.length)));var s=n.shift();return this.sign+s+(n.length>0?"."+n.join(""):"")+"e"+(r>=0?"+":"")+r},r.prototype.toPrecision=function(e,t){var n=t&&t.lower!==undefined?t.lower:.001,r=t&&t.upper!==undefined?t.upper:1e5,s=Math.abs(Math.pow(10,this.exponent));if(s<n||s>=r)return this.toExponential(e);var o=e?this.roundDigits(e):this.clone(),u=o.coefficients,a=o.exponent;u.length<e&&(u=u.concat(i(e-u.length))),u=u.concat(i(a-u.length+1+(u.length<e?e-u.length:0))),u=i(-a).concat(u);var f=a>0?a:0;return f<u.length-1&&u.splice(f+1,0,"."),this.sign+u.join("")},r.prototype.clone=function(){var e=new r("0");return e.sign=this.sign,e.coefficients=this.coefficients.slice(0),e.exponent=this.exponent,e},r.prototype.roundDigits=function(e){var t=this.clone(),n=t.coefficients;while(e<=0)n.unshift(0),t.exponent++,e++;if(n.length>e){var r=n.splice(e);if(r[0]>=5){var i=e-1;n[i]++;while(n[i]===10)n.pop(),i===0&&(n.unshift(0),t.exponent++,i++),i--,n[i]++}}return t},e.exports=r},function(e,t,n){"use strict";function u(e,n,r){var i=e.constructor,s,o,u=+(e.s<0),f=+(n.s<0);if(u){s=a(t.not(e));for(var l=0;l<s.length;++l)s[l]^=1}else s=a(e);if(f){o=a(t.not(n));for(var l=0;l<o.length;++l)o[l]^=1}else o=a(n);var c,h,p;s.length<=o.length?(c=s,h=o,p=u):(c=o,h=s,p=f);var d=c.length,v=h.length,m=r(u,f)^1,g=new i(m^1),y=i.ONE,b=new i(2),w=i.precision;i.config({precision:1e9});while(d>0)r(c[--d],h[--v])==m&&(g=g.plus(y)),y=y.times(b);while(v>0)r(p,h[--v])==m&&(g=g.plus(y)),y=y.times(b);return i.config({precision:w}),m==0&&(g.s=-g.s),g}function a(e){var t=e.c,n=t[0]+"";for(var r=1;r<t.length;++r){var i=t[r]+"";for(var s=7-i.length;s--;)i="0"+i;n+=i}var o;for(o=n.length-1;n.charAt(o)=="0";--o);var u=e.e,a=n.slice(0,o+1||1),f=a.length;if(u>0)if(++u>f)for(u-=f;u--;a+="0");else u<f&&(a=a.slice(0,u)+"."+a.slice(u));var l=[0];for(var r=0;r<a.length;){for(var c=l.length;c--;l[c]*=10);l[0]+=a.charAt(r++)<<0;for(var o=0;o<l.length;++o)l[o]>1&&(l[o+1]==null&&(l[o+1]=0),l[o+1]+=l[o]>>1,l[o]&=1)}return l.reverse()}function f(e,n){var r=n.precision,i=-(r+4),s=r+8-e.e,o=25-e.e,u=Math.max(Math.log(r+2)*1.442695|5,5);n.config({precision:o});var a=0,f=new n(Math.asin(e.toNumber())+"");do{var l=t.cos_sin_sec_csc(f,n,1,!1),c=d(l);l.isZero()||(l.s=f.s);var h=l.minus(e).div(c);f=f.minus(h),o=Math.min(2*o,s),n.config({precision:o})}while(2*h.e>=i&&!h.isZero()&&++a<=u);if(a==u)throw new Error("asin() failed to converge to the requested accuracy.Try with a higher precision.");return n.config({precision:r}),f.toDP(r-1)}function l(e,t){var n=e.constructor;n.config({precision:t+Math.log(t)|4});var r=new n(1),i=e,s=NaN,o=e.times(e),u=e,a=new n(r),f=new n(r),l=new n(r);for(var c=3;!i.equals(s);c+=2)u=u.times(o),a=a.times(l),f=f.times(l.plus(r)),s=i,l=new n(c),i=i.plus(u.times(a).div(l.times(f)));return n.config({precision:t}),i.toDP(t-1)}function c(e){var t=e,n=NaN,r=e.times(e),i=e,s=!0;for(var o=3;!t.equals(n);o+=2)i=i.times(r),n=t,s=!s,t=s?t.plus(i.div(o)):t.minus(i.div(o));return t}function h(e,t){var n=e.constructor.ONE,r=e,i=NaN,s=e.times(e),o=t?r:r=n,u=n,a=!0;for(var f=t;!r.equals(i);f+=2)o=o.times(s),u=u.times(f+1).times(f+2),i=r,a=!a,r=a?r.plus(o.div(u)):r.minus(o.div(u));return r}function p(e,n,r){var i=t.pi(n+2),s=t.tau(n);if(e.abs().lte(i.toDP(e.dp())))return[e,!1];var o=e.constructor;if(e.div(i.toDP(e.dp())).toNumber()%2==0)return[new o(r^1),!0];var u=e.mod(s);return u.toDP(e.dp(),1).isZero()?[new o(r^1),!0]:(u.gt(i)&&(r?(u=u.minus(i),u.s=-u.s):u=s.minus(u)),u.constructor=o,[u,!1])}function d(e){var t=e.constructor,n=t.precision;t.config({precision:n+2});var r=t.ONE.minus(e.times(e)).sqrt();return t.config({precision:n}),r.toDP(n-1)}var r=n(5),i=n(3).isNumber,s=n(3).digits,o=n(339).memoize;t.isBigNumber=function(e){return e instanceof r},t.e=o(function(e){var t=r.constructor({precision:e});return(new t(1)).exp()}),t.phi=o(function(e){var t=r.constructor({precision:e});return(new t(1)).plus((new t(5)).sqrt()).div(2)}),t.pi=o(function(e){var t=r.constructor({precision:e+4}),n=(new t(4)).times(c((new t(1)).div(5))).minus(c((new t(1)).div(239)));return t.config({precision:e}),(new t(4)).times(n)}),t.tau=o(function(e){var n=t.pi(e+2),i=r.constructor({precision:e});return(new i(2)).times(n)}),t.and=function(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Parameters in function bitAnd must be integer numbers");var n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()==t.isNegtive()?e:new n(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new n(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new n(0):e}return u(e,t,function(e,t){return e&t})},t.leftShift=function(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Parameters in function leftShift must be integer numbers");var n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:!e.isFinite()&&!t.isFinite()?new n(NaN):t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times((new n(2)).pow(t))},t.not=function(e){if(e.isFinite()&&!e.isInteger())throw new Error("Parameter in function bitNot must be integer numbers");var t=e.constructor,n=t.precision;t.config({precision:1e9});var e=e.plus(t.ONE);return e.s=-e.s||null,t.config({precision:n}),e},t.or=function(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Parameters in function bitOr must be integer numbers");var n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);var r=new n(-1);return e.isZero()||t.eq(r)||e.eq(t)?t:t.isZero()||e.eq(r)?e:!e.isFinite()||!t.isFinite()?!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?r:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e:u(e,t,function(e,t){return e|t})},t.rightShift=function(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Parameters in function rightArithShift must be integer numbers");var n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div((new n(2)).pow(t)).floor():e.isNegative()?new n(-1):e.isFinite()?new n(0):new n(NaN)},t.xor=function(e,n){if(e.isFinite()&&!e.isInteger()||n.isFinite()&&!n.isInteger())throw new Error("Parameters in function bitXor must be integer numbers");var r=e.constructor;if(e.isNaN()||n.isNaN())return new r(NaN);if(e.isZero())return n;if(n.isZero())return e;if(e.eq(n))return new r(0);var i=new r(-1);return e.eq(i)?t.not(n):n.eq(i)?t.not(e):!e.isFinite()||!n.isFinite()?!e.isFinite()&&!n.isFinite()?i:new r(e.isNegative()==n.isNegative()?Infinity:-Infinity):u(e,n,function(e,t){return e^t})},t.arccos_arcsec=function(e,n,r){var i=n.precision;if(r){if(e.abs().lt(n.ONE))throw new Error("asec() only has non-complex values for |x| >= 1.")}else if(e.abs().gt(n.ONE))throw new Error("acos() only has non-complex values for |x| <= 1.");if(e.eq(-1))return t.pi(i);n.config({precision:i+4}),r&&(e=n.ONE.div(e));var s=t.arctan_arccot(n.ONE.minus(e.times(e)).sqrt().div(e.plus(n.ONE)),n).times(2);return n.config({precision:i}),s.toDP(i-1)},t.arcsin_arccsc=function(e,n,r){if(e.isNaN())return new n(NaN);var i=n.precision,s=e.abs();if(r){if(s.lt(n.ONE))throw new Error("acsc() only has non-complex values for |x| >= 1.");n.config({precision:i+2}),e=n.ONE.div(e),n.config({precision:i}),s=e.abs()}else if(s.gt(n.ONE))throw new Error("asin() only has non-complex values for |x| <= 1.");if(s.gt(.8)){n.config({precision:i+4});var o=e.s,u=t.pi(i+4).div(2);return e=u.minus(t.arcsin_arccsc(n.ONE.minus(e.times(e)).sqrt(),n)),e.s=o,e.constructor=n,n.config({precision:i}),e.toDP(i-1)}var a=s.gt(.58);a&&(n.config({precision:i+8}),e=e.div((new n(2)).sqrt().times(n.ONE.minus(e.times(e)).sqrt().plus(n.ONE).sqrt())),n.config({precision:i}));var c=i<=60||e.dp()<=Math.log(i)&&e.lt(.05)?l(e,i):f(e,n);return a?c.times(2):c},t.arctan_arccot=function(e,n,r){if(e.isNaN())return new n(NaN);if(!r&&e.isZero()||r&&!e.isFinite())return new n(0);var i=n.precision;if(!r&&!e.isFinite()||r&&e.isZero()){var s=t.pi(i+2).div(2).toDP(i-1);return s.constructor=n,s.s=e.s,s}n.config({precision:i+4}),r&&(e=n.ONE.div(e));var o=e.abs();if(o.lte(.875)){var u=c(e);return u.constructor=n,n.config({precision:i}),u.toDP(n.precision-1)}if(o.gte(1.143)){var s=t.pi(i+4).div(2),u=s.minus(c(n.ONE.div(o)));return u.s=e.s,u.constructor=n,n.config({precision:i}),u.toDP(n.precision-1)}return e=e.div(e.times(e).plus(1).sqrt()),n.config({precision:i}),t.arcsin_arccsc(e,n)},t.arctan2=function(e,n,r){var i=r.precision;if(n.isZero()){if(e.isZero())return new r(NaN);var s=t.pi(i+2).div(2).toDP(i-1);return s.constructor=r,s.s=e.s,s}r.config({precision:i+2});var o=t.arctan_arccot(e.div(n),r,!1);if(n.isNegative()){var u=t.pi(i+2);o=e.isNegative()?o.minus(u):o.plus(u)}return o.constructor=r,r.config({precision:i}),o.toDP(i-1)},t.acosh_asinh_asech_acsch=function(e,t,n,r){if(e.isNaN())return new t(NaN);if(r&&e.isZero())return new t(Infinity);if(!n)if(r){if(e.isNegative()||e.gt(t.ONE))throw new Error("asech() only has non-complex values for 0 <= x <= 1.")}else if(e.lt(t.ONE))throw new Error("acosh() only has non-complex values for x >= 1.");var i=t.precision;t.config({precision:i+4});var s=new t(e);s.constructor=t,r&&(s=t.ONE.div(s));var o=n?s.times(s).plus(t.ONE):s.times(s).minus(t.ONE),u=s.plus(o.sqrt()).ln();return t.config({precision:i}),new t(u.toPrecision(i))},t.atanh_acoth=function(e,t,n){if(e.isNaN())return new t(NaN);var r=e.abs();if(r.eq(t.ONE))return new t(e.isNegative()?-Infinity:Infinity);if(r.gt(t.ONE)){if(!n)throw new Error("atanh() only has non-complex values for |x| <= 1.")}else if(n)throw new Error("acoth() has complex values for |x| < 1.");if(e.isZero())return new t(0);var i=t.precision;t.config({precision:i+4});var s=new t(e);s.constructor=t,n&&(s=t.ONE.div(s));var o=t.ONE.plus(s).div(t.ONE.minus(s)).ln().div(2);return t.config({precision:i}),new t(o.toPrecision(i))},t.cos_sin_sec_csc=function(e,t,n,r){if(e.isNaN()||!e.isFinite())return new t(NaN);var i=t.precision,s=new t(e),o=s.isNegative();o&&(s.s=-s.s);var u=i+(Math.log(i)|0)+3;t.config({precision:u}),s=p(s,u,n),s[0].constructor=t;if(s[1])return s=s[0],r&&s.isZero()&&(s=new t(Infinity)),t.config({precision:i}),s;var a;s=s[0];if(n){a=h(s.div(3125),n),t.config({precision:Math.min(u,i+15)});var f=new t(5),l=new t(16),c=new t(20);for(var d=0;d<5;++d){var v=a.times(a),m=v.times(a),g=m.times(v);a=l.times(g).minus(c.times(m)).plus(f.times(a))}o&&(a.s=-a.s)}else{var y,b;s.abs().lt(t.ONE)?(y=64,b=3):(y=256,b=4),a=h(s.div(y),n),t.config({precision:Math.min(u,i+8)});var w=new t(8);for(;b>0;--b){var v=a.times(a),E=v.times(v);a=w.times(E.minus(v)).plus(t.ONE)}}return r&&(a=a.e<=-i?new t(Infinity):t.ONE.div(a)),t.config({precision:i}),a.toDP(i-1)},t.tan_cot=function(e,n,r){if(e.isNaN())return new n(NaN);var i=n.precision,s=t.pi(i+2),o=s.div(2).toDP(i-1);s=s.toDP(i-1);var u=p(e,i,1)[0];if(u.abs().eq(s))return new n(Infinity);n.config({precision:i+4});var a=t.cos_sin_sec_csc(u,n,1,!1),f=d(a);a=a.toDP(i),f=f.toDP(i),u.eq(e)?u.gt(o)&&(f.s=-f.s):s.minus(u.abs()).gt(o)&&(f.s=-f.s);var l=r?f.div(a):a.div(f);return n.config({precision:i}),new n(l.toPrecision(i))},t.cosh_sinh_csch_sech=function(e,t,n,r){if(e.isNaN())return new t(NaN);if(!e.isFinite())return r?new t(0):new t(n?e:Infinity);var i=t.precision;t.config({precision:i+4});var s=new t(e);return s.constructor=t,s=s.exp(),s=n?s.minus(t.ONE.div(s)):s.plus(t.ONE.div(s)),s=r?(new t(2)).div(s):s.div(2),t.config({precision:i}),new t(s.toPrecision(i))},t.tanh_coth=function(e,t,n){if(e.isNaN())return new t(NaN);if(!e.isFinite())return new t(e.s);var r=t.precision;t.config({precision:r+4});var i=new t(e);i.constructor=t;var s=i.exp(),o=t.ONE.div(s),u=s.minus(o);return u=n?s.plus(o).div(u):u.div(s.plus(o)),t.config({precision:r}),u.toDP(r-1)},t.format=function(e,n){if(typeof n=="function")return n(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r="auto",s=undefined;n!==undefined&&(n.notation&&(r=n.notation),i(n)?s=n:n.precision&&(s=n.precision));switch(r){case"fixed":return t.toFixed(e,s);case"exponential":return t.toExponential(e,s);case"auto":var o=.001,u=1e5;n&&n.exponential&&(n.exponential.lower!==undefined&&(o=n.exponential.lower),n.exponential.upper!==undefined&&(u=n.exponential.upper));var a={toExpNeg:e.constructor.toExpNeg,toExpPos:e.constructor.toExpPos};e.constructor.config({toExpNeg:Math.round(Math.log(o)/Math.LN10),toExpPos:Math.round(Math.log(u)/Math.LN10)});if(e.isZero())return"0";var f,l=e.abs();return l.gte(o)&&l.lt(u)?f=e.toSignificantDigits(s).toFixed():f=t.toExponential(e,s),f.replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return e!=="."?e+t:t});default:throw new Error('Unknown notation "'+r+'". '+'Choose "auto", "exponential", or "fixed".')}},t.toExponential=function(e,t){return t!==undefined?e.toExponential(t-1):e.toExponential()},t.toFixed=function(e,t){return e.toFixed(t||0)}},function(e,t,n){"use strict";function l(e){var t=[];while(f(e))t.push(e.length),e=e[0];return t}function c(e,t,n){var r,i=e.length;if(i!=t[n])throw new u(i,t[n]);if(n<t.length-1){var s=n+1;for(r=0;r<i;r++){var o=e[r];if(!f(o))throw new u(t.length-1,t.length,"<");c(e[r],t,s)}}else for(r=0;r<i;r++)if(f(e[r]))throw new u(t.length+1,t.length,">")}function h(e,n,r,i){var o,u,a=e.length,l=n[r],c=Math.min(a,l);e.length=l;if(r<n.length-1){var p=r+1;for(o=0;o<c;o++)u=e[o],f(u)||(u=[u],e[o]=u),h(u,n,p,i);for(o=c;o<l;o++)u=[],e[o]=u,h(u,n,p,i)}else{for(o=0;o<c;o++)while(f(e[o]))e[o]=e[o][0];if(i!==t.UNINITIALIZED)for(o=c;o<l;o++)e[o]=s.clone(i)}}function p(e,t,n){var r,i;if(n<t){var s=n+1;for(r=0,i=e.length;r<i;r++)e[r]=p(e[r],t,s)}else while(f(e))e=e[0];return e}function d(e,t,n){var r,i;if(f(e)){var s=n+1;for(r=0,i=e.length;r<i;r++)e[r]=d(e[r],t,s)}else for(var o=n;o<t;o++)e=[e];return e}var r=n(3),i=n(176),s=n(2),o=n(338),u=n(172),a=n(173),f=Array.isArray;t.size=function(e){var n=l(e);return t.validate(e,n),n},t.validate=function(e,t){var n=t.length==0;if(n){if(f(e))throw new u(e.length,0)}else c(e,t,0)},t.validateIndex=function(e,t){if(!r.isNumber(e)||!r.isInteger(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0)throw new a(e);if(t!==undefined&&e>=t)throw new a(e,t)},t.UNINITIALIZED={},t.resize=function(e,t,n){if(!f(e)||!f(t))throw new TypeError("Array expected");if(t.length===0)throw new Error("Resizing to scalar is not supported");t.forEach(function(e){if(!r.isNumber(e)||!r.isInteger(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+i.format(t)+")")});var s=n!==undefined?n:0;return h(e,t,0,s),e},t.squeeze=function(e,n){var r=n||t.size(e);while(f(e)&&e.length===1)e=e[0],r.shift();var i=r.length;while(r[i-1]===1)i--;return i<r.length&&(e=p(e,i,0),r.length=i),e},t.unsqueeze=function(e,n,r,i){var s=i||t.size(e);if(r)for(var o=0;o<r;o++)e=[e],s.unshift(1);e=d(e,n,0);while(s.length<n)s.push(1);return e},t.flatten=function(e){var t=e,n=Array.isArray;while(n(t[0])){var r=[];for(var i=0,s=t.length;i<s;i++)r=r.concat.apply(r,t[i]);t=r}return t},t.argsToArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)t[n]=e[n];return t},t.isArray=f},function(e,t,n){e.exports="1.5.2"},function(e,t,n){"use strict";function r(e,t,n,i){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=n,this.max=i,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+n+(i!=undefined?"-"+i:"")+" expected)",this.stack=(new Error).stack}r.prototype=new Error,r.prototype.constructor=Error,r.prototype.name="ArgumentsError",e.exports=r},function(e,t,n){"use strict";function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}r.prototype=new RangeError,r.prototype.constructor=RangeError,r.prototype.name="DimensionError",e.exports=r},function(e,t,n){"use strict";function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=n),this.min!==undefined&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==undefined&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=(new Error).stack}r.prototype=new RangeError,r.prototype.constructor=RangeError,r.prototype.name="IndexError",e.exports=r},function(e,t,n){"use strict";function r(e,t){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.types=Array.prototype.splice.call(arguments,1),e?this.types.length==0?this.message="Unsupported type of argument in function "+e:this.message="Function "+e+"("+this.types.join(", ")+") not supported":this.message="Unsupported type of argument",this.stack=(new Error).stack}r.prototype=new TypeError,r.prototype.constructor=TypeError,r.prototype.name="UnsupportedTypeError",e.exports=r},function(e,t,n){"use strict";t.array=n(169),t["boolean"]=n(209),t.number=n(3),t.bignumber=n(168),t.object=n(2),t.string=n(176),t.types=n(338)},function(e,t,n){"use strict";function o(e,n){if(Array.isArray(e)){var r="[",i=e.length;for(var s=0;s<i;s++)s!=0&&(r+=", "),r+=o(e[s],n);return r+="]",r}return t.format(e,n)}var r=n(3),i=n(168),s=n(5);t.isString=function(e){return e instanceof String||typeof e=="string"},t.endsWith=function(e,t){var n=e.length-t.length,r=e.length;return e.substring(n,r)===t},t.format=function(e,n){return r.isNumber(e)?r.format(e,n):e instanceof s?i.format(e,n):Array.isArray(e)?o(e,n):t.isString(e)?'"'+e+'"':typeof e=="function"?e.syntax?e.syntax+"":"function":e instanceof Object?typeof e.format=="function"?e.format(n):e.toString():String(e)}},function(e,t,n){"use strict";function u(e){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");this.nodes=e||[];if(!s(this.nodes)||!this.nodes.every(o))throw new TypeError("Array containing Nodes expected")}var r=n(185),i=n(176),s=Array.isArray,o=r.isNode;u.prototype=new r,u.prototype.type="ArrayNode",u.prototype._compile=function(e){var t=e.math.config().matrix!=="array",n=this.nodes.map(function(t){return t._compile(e)});return(t?"math.matrix([":"[")+n.join(",")+(t?"])":"]")},u.prototype.forEach=function(e){for(var t=0;t<this.nodes.length;t++){var n=this.nodes[t];e(n,"nodes["+t+"]",this)}},u.prototype.map=function(e){var t=[];for(var n=0;n<this.nodes.length;n++)t[n]=this._ifNode(e(this.nodes[n],"nodes["+n+"]",this));return new u(t)},u.prototype.clone=function(){return new u(this.nodes.slice(0))},u.prototype.toString=function(){return i.format(this.nodes)},u.prototype._toTex=function(e){this.latexType=this.latexType||"bmatrix";var t="\\begin{"+this.latexType+"}";return this.nodes.forEach(function(n){n.nodes?t+=n.nodes.map(function(t){return t.toTex(e)}).join("&"):t+=n.toTex(e),t+="\\\\"}),t+="\\end{"+this.latexType+"}",t},e.exports=u},function(e,t,n){"use strict";function f(e,t){if(!(this instanceof f))throw new SyntaxError("Constructor must be called with the new operator");if(!a(e))throw new TypeError('String expected for parameter "name"');if(!(t instanceof r))throw new TypeError('Node expected for parameter "expr"');if(e in s)throw new Error('Illegal symbol name, "'+e+'" is a reserved keyword');this.name=e,this.expr=t}var r=n(185),i=n(177),s=n(341),o=n(342),u=n(343),a=n(176).isString;f.prototype=new r,f.prototype.type="AssignmentNode",f.prototype._compile=function(e){return'scope["'+this.name+'"] = '+this.expr._compile(e)+""},f.prototype.forEach=function(e){e(this.expr,"expr",this)},f.prototype.map=function(e){return new f(this.name,this._ifNode(e(this.expr,"expr",this)))},f.prototype.clone=function(){return new f(this.name,this.expr)},f.prototype.toString=function(){var e=o.getPrecedence(this),t=o.getPrecedence(this.expr),n=this.expr.toString();return t!==null&&t<=e&&(n="("+n+")"),this.name+" = "+n},f.prototype._toTex=function(e){var t=o.getPrecedence(this),n=o.getPrecedence(this.expr),r=this.expr.toTex(e);n!==null&&n<=t?r=u.addBraces(r,!0):r=u.addBraces(r,!1);var s;return this.expr instanceof i&&(s=["\\mathbf{","}"]),u.addBraces(u.toSymbol(this.name),s)+"="+r},e.exports=f},function(e,t,n){"use strict";function o(e){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map(function(e){var t=e&&e.node,n=e&&e.visible!==undefined?e.visible:!0;if(t instanceof r){if(!s(n))throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:n}}throw new TypeError('Property "node" must be a Node')})}var r=n(185),i=n(13),s=n(209).isBoolean;o.prototype=new r,o.prototype.type="BlockNode",o.prototype._compile=function(e){e.ResultSet=i;var t=this.blocks.map(function(t){var n=t.node._compile(e);return t.visible?"results.push("+n+");":n+";"});return"(function () {var results = [];"+t.join("")+"return new ResultSet(results);"+"})()"},o.prototype.forEach=function(e){for(var t=0;t<this.blocks.length;t++)e(this.blocks[t].node,"blocks["+t+"].node",this)},o.prototype.map=function(e){var t=[];for(var n=0;n<this.blocks.length;n++){var r=this.blocks[n],i=this._ifNode(e(r.node,"blocks["+n+"].node",this));t[n]={node:i,visible:r.visible}}return new o(t)},o.prototype.clone=function(){var e=this.blocks.map(function(e){return{node:e.node,visible:e.visible}});return new o(e)},o.prototype.toString=function(){return this.blocks.map(function(e){return e.node.toString()+(e.visible?"":";")}).join("\n")},o.prototype._toTex=function(e){return this.blocks.map(function(t){return t.node.toTex(e)+(t.visible?"":";")}).join("\n")},e.exports=o},function(e,t,n){"use strict";function p(e,t,n){if(!(this instanceof p))throw new SyntaxError("Constructor must be called with the new operator");if(!(e instanceof r))throw new TypeError("Parameter condition must be a Node");if(!(t instanceof r))throw new TypeError("Parameter trueExpr must be a Node");if(!(n instanceof r))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=n}var r=n(185),i=n(343),s=n(5),o=n(7),u=n(11),a=n(175),f=n(342),l=a.string.isString,c=a.number.isNumber,h=a["boolean"].isBoolean;p.prototype=new r,p.prototype.type="ConditionalNode",p.prototype._compile=function(e){return e.testCondition=function(t){if(c(t)||h(t)||l(t))return t?!0:!1;if(t instanceof s)return t.isZero()?!1:!0;if(t instanceof o)return t.re||t.im?!0:!1;if(t instanceof u)return t.value?!0:!1;if(t===null||t===undefined)return!1;throw new TypeError('Unsupported type of condition "'+e.math["typeof"](t)+'"')},"testCondition("+this.condition._compile(e)+") ? "+"( "+this.trueExpr._compile(e)+") : "+"( "+this.falseExpr._compile(e)+")"},p.prototype.forEach=function(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)},p.prototype.map=function(e){return new p(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))},p.prototype.clone=function(){return new p(this.condition,this.trueExpr,this.falseExpr)},p.prototype.toString=function(){var e=f.getPrecedence(this),t=this.condition.toString(),n=f.getPrecedence(this.condition);if(this.condition.type==="OperatorNode"||n!==null&&n<=e)t="("+t+")";var r=this.trueExpr.toString(),i=f.getPrecedence(this.trueExpr);if(this.trueExpr.type==="OperatorNode"||i!==null&&i<=e)r="("+r+")";var s=this.falseExpr.toString(),o=f.getPrecedence(this.falseExpr);if(this.falseExpr.type==="OperatorNode"||o!==null&&o<=e)s="("+s+")";return t+" ? "+r+" : "+s},p.prototype._toTex=function(e){var t=i.addBraces(this.trueExpr.toTex(e))+", &\\quad"+i.addBraces("\\text{if}\\;"+this.condition.toTex(e))+"\\\\"+(i.addBraces(this.falseExpr.toTex(e))+", &\\quad"+i.addBraces("\\text{otherwise}"));return i.addBraces(t,["\\left\\{\\begin{array}{l l}","\\end{array}\\right."])},e.exports=p},function(e,t,n){"use strict";function u(e,t){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");if(t){if(!o(t))throw new TypeError('String expected for parameter "valueType"');if(!o(e))throw new TypeError('String expected for parameter "value"');this.value=e,this.valueType=t}else this.value=e+"",this.valueType=s(e);if(!a[this.valueType])throw new TypeError('Unsupported type of value "'+this.valueType+'"')}var r=n(185),i=n(5),s=n(338).type,o=n(176).isString,a={number:!0,string:!0,"boolean":!0,"undefined":!0,"null":!0};u.prototype=new r,u.prototype.type="ConstantNode",u.prototype._compile=function(e){switch(this.valueType){case"number":return e.math.config().number==="bignumber"?'math.bignumber("'+this.value+'")':this.value.replace(/^(0*)[0-9]/,function(e,t){return e.substring(t.length)});case"string":return'"'+this.value+'"';case"boolean":return this.value;case"undefined":return this.value;case"null":return this.value;default:throw new TypeError('Unsupported type of constant "'+this.valueType+'"')}},u.prototype.forEach=function(e){},u.prototype.map=function(e){return this.clone()},u.prototype.clone=function(){return new u(this.value,this.valueType)},u.prototype.toString=function(){switch(this.valueType){case"string":return'"'+this.value+'"';default:return this.value}},u.prototype._toTex=function(e){var t=this.value,n;switch(this.valueType){case"string":return"\\text{"+t+"}";case"number":n=t.toLowerCase().indexOf("e");if(n!==-1)return t.substring(0,n)+" \\cdot 10^{"+t.substring(n+1)+"}";return t;default:return t}},e.exports=u},function(e,t,n){"use strict";function l(e,t){if(!(this instanceof l))throw new SyntaxError("Constructor must be called with the new operator");if(!(e instanceof r))throw new TypeError('Node expected for parameter "object"');if(!f(t)||!t.every(a))throw new TypeError('Array containing Nodes expected for parameter "ranges"');this.object=e,this.ranges=t}var r=n(185),i=n(187),s=n(188),o=n(5),u=n(8),a=r.isNode,f=Array.isArray;l.prototype=new r,l.prototype.type="IndexNode",l.prototype._compile=function(e){return this.compileSubset(e)},l.prototype.compileSubset=function(e,t){function n(e){return e instanceof s&&e.name=="end"}var r=!1,a=this.ranges.map(function(e){var t=e.filter(n).length>0;return r=t?t:r,t});e.range=function(e,t,n){return new u(e instanceof o?e.toNumber():e,t instanceof o?t.toNumber():t,n instanceof o?n.toNumber():n)};var f=this.ranges.map(function(t,n){var r=a[n];return t instanceof i?r?(e.args.end=!0,"(function () {  var end = size["+n+"];"+"  return range("+"    "+t.start._compile(e)+", "+"    "+t.end._compile(e)+", "+"    "+(t.step?t.step._compile(e):"1")+"  );"+"})()"):"range("+t.start._compile(e)+", "+t.end._compile(e)+", "+(t.step?t.step._compile(e):"1")+")":r?(e.args.end=!0,"(function () {  var end = size["+n+"];"+"  return "+t._compile(e)+";"+"})()"):t._compile(e)});return r?"(function () {  var obj = "+this.object._compile(e)+";"+"  var size = math.size(obj).valueOf();"+"  return math.subset("+"    obj, "+"    math.index("+f.join(", ")+")"+"    "+(t?", "+t:"")+"  );"+"})()":"math.subset("+this.object._compile(e)+","+"math.index("+f.join(", ")+")"+(t?", "+t:"")+")"},l.prototype.forEach=function(e){e(this.object,"object",this);for(var t=0;t<this.ranges.length;t++)e(this.ranges[t],"ranges["+t+"]",this)},l.prototype.map=function(e){var t=this._ifNode(e(this.object,"object",this)),n=[];for(var r=0;r<this.ranges.length;r++)n[r]=this._ifNode(e(this.ranges[r],"ranges["+r+"]",this));return new l(t,n)},l.prototype.objectName=function(){return this.object.name},l.prototype.clone=function(){return new l(this.object,this.ranges.slice(0))},l.prototype.toString=function(){return this.object.toString()+"["+this.ranges.join(", ")+"]"},l.prototype._toTex=function(e){return this.object.toTex(e)+"["+this.ranges.join(", ")+"]"},e.exports=l},function(e,t,n){"use strict";function f(e,t,n){if(!(this instanceof f))throw new SyntaxError("Constructor must be called with the new operator");if(!u(e))throw new TypeError('String expected for parameter "name"');if(!a(t)||!t.every(u))throw new TypeError('Array containing strings expected for parameter "params"');if(!(n instanceof r))throw new TypeError('Node expected for parameter "expr"');if(e in i)throw new Error('Illegal function name, "'+e+'" is a reserved keyword');this.name=e,this.params=t,this.expr=n}var r=n(185),i=n(341),s=n(343),o=n(342),u=n(176).isString,a=Array.isArray;f.prototype=new r,f.prototype.type="FunctionAssignmentNode",f.prototype._compile=function(e){return this.params.forEach(function(t){e.args[t]=!0}),'scope["'+this.name+'"] = '+"  (function () {"+"    var fn = function "+this.name+"("+this.params.join(",")+") {"+"      if (arguments.length != "+this.params.length+") {"+'        throw new SyntaxError("Wrong number of arguments in function '+this.name+' (" + arguments.length + " provided, '+this.params.length+' expected)");'+"      }"+"      return "+this.expr._compile(e)+""+"    };"+'    fn.syntax = "'+this.name+"("+this.params.join(", ")+')";'+"    return fn;"+"  })();"},f.prototype.forEach=function(e){e(this.expr,"expr",this)},f.prototype.map=function(e){var t=this._ifNode(e(this.expr,"expr",this));return new f(this.name,this.params.slice(0),t)},f.prototype.clone=function(){return new f(this.name,this.params.slice(0),this.expr)},f.prototype.toString=function(){var e=o.getPrecedence(this),t=o.getPrecedence(this.expr),n=this.expr.toString();return t!==null&&t<=e&&(n="("+n+")"),"function "+this.name+"("+this.params.join(", ")+") = "+n},f.prototype._toTex=function(e){var t=o.getPrecedence(this),n=o.getPrecedence(this.expr),r=this.expr.toTex(e);return n!==null&&n<=t?r=s.addBraces(r,!0):r=s.addBraces(r,!1),s.toFunction(this.name)+s.addBraces(this.params.map(s.toSymbol).join(", "),!0)+"="+r},e.exports=f},function(e,t,n){"use strict";function a(e,t){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(typeof e!="string")throw new TypeError('string expected for parameter "name"');if(!u(t)||!t.every(o))throw new TypeError('Array containing Nodes expected for parameter "args"');this.name=e,this.args=t||[]}var r=n(185),i=n(188),s=n(343),o=r.isNode,u=Array.isArray;a.prototype=new r,a.prototype.type="FunctionNode",a.prototype._compile=function(e){var t=e.math[this.name],n=typeof t=="function"&&t.rawArgs==1,r=this.args.map(function(t){return t._compile(e)});if(n){var s;do s="p"+Math.round(Math.random()*1e4);while(s in e);return e[s]=this.args,'("'+this.name+'" in scope ? '+'scope["'+this.name+'"]('+r.join(", ")+") : "+'math["'+this.name+'"]'+"("+s+", math, scope))"}var o=new i(this.name);return o._compile(e)+"("+r.join(", ")+")"},a.prototype.forEach=function(e){for(var t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)},a.prototype.map=function(e){var t=[];for(var n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new a(this.name,t)},a.prototype.clone=function(){return new a(this.name,this.args.slice(0))},a.prototype.toString=function(){return this.name+"("+this.args.join(", ")+")"},a.prototype._toTex=function(e){return s.toArgs(this,e)},a.prototype.getIdentifier=function(){return this.type+":"+this.name},e.exports=a},function(e,t,n){"use strict";function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator")}function s(e){for(var t in e)if(e.hasOwnProperty(t)&&t in r)throw new Error('Scope contains an illegal symbol, "'+t+'" is a reserved keyword')}function o(e){var t=Object.create(e);if(e.expression&&e.expression.transform)for(var n in e.expression.transform)e.expression.transform.hasOwnProperty(n)&&(t[n]=e.expression.transform[n]);return t}var r=n(341);i.prototype.eval=function(){throw new Error("Node.eval is deprecated. Use Node.compile(math).eval([scope]) instead.")},i.prototype.type="Node",i.prototype.compile=function(e){if(e instanceof Object){var t={math:o(e),args:{},_validateScope:s},n=this._compile(t),r=Object.keys(t).map(function(e){return"    var "+e+' = defs["'+e+'"];'}),i=r.join(" ")+"return {"+'  "eval": function (scope) {'+"    if (scope) _validateScope(scope);"+"    scope = scope || {};"+"    return "+n+";"+"  }"+"};",u=new Function("defs",i);return u(t)}throw new TypeError("Object expected for parameter math")},i.prototype._compile=function(e){throw new Error("Cannot compile a Node interface")},i.prototype.forEach=function(e){throw new Error("Cannot run forEach on a Node interface")},i.prototype.map=function(e){throw new Error("Cannot run map on a Node interface")},i.prototype._ifNode=function(e){if(e instanceof i)return e;throw new TypeError("Callback function must return a Node")},i.prototype.traverse=function(e){function t(e,n){e.forEach(function(e,r,i){n(e,r,i),t(e,n)})}e(this,null,null),t(this,e)},i.prototype.transform=function(e){function n(e,t){return e.map(function(e,r,i){var s=t(e,r,i);return s!==e?s:n(e,t)})}var t=e(this,null,null);return t!==this?t:n(this,e)},i.prototype.filter=function(e){var t=[];return this.traverse(function(n,r,i){e(n,r,i)&&t.push(n)}),t},i.prototype.find=function(){throw new Error("Function Node.find is deprecated. Use Node.filter instead.")},i.prototype.match=function(){throw new Error("Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.")},i.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},i.prototype.toString=function(){return""},i.prototype.toTex=function(e){var t;this.type==="ArrayNode"&&delete this.latexType;if(typeof e=="object")this.type==="FunctionNode"&&e.hasOwnProperty(this.name)&&(t=e[this.name](this,e));else if(typeof e=="function")t=e(this,e);else if(typeof e=="string"&&this.type==="ArrayNode")this.latexType=e;else if(typeof e!="undefined")throw new TypeError("Object or function expected as callback");return typeof t!="undefined"?t:this._toTex(e)},i.prototype._toTex=function(){if(this.type==="Node")return"";throw new Error("_toTex not implemented for this Node")},i.prototype.getIdentifier=function(){return this.type},i.isNode=function(e){return e instanceof i},e.exports=i},function(e,t,n){"use strict";function c(e,t,n){if(!(this instanceof c))throw new SyntaxError("Constructor must be called with the new operator");if(typeof e!="string")throw new TypeError('string expected for parameter "op"');if(typeof t!="string")throw new TypeError('string expected for parameter "fn"');if(!f(n)||!n.every(l))throw new TypeError('Array containing Nodes expected for parameter "args"');this.op=e,this.fn=t,this.args=n||[]}function h(e,t){var n=a.getPrecedence(e),r=a.getAssociativity(e);switch(t.length){case 1:var i=a.getPrecedence(t[0]);if(i===null)return[!1];if(i<=n)return[!0];return[!1];case 2:var s,o=a.getPrecedence(t[0]),u=a.isAssociativeWith(e,t[0]);o===null?s=!1:o===n&&r==="right"&&!u?s=!0:o<n?s=!0:s=!1;var f,l=a.getPrecedence(t[1]),c=a.isAssociativeWith(e,t[1]);return l===null?f=!1:l===n&&r==="left"&&!c?f=!0:l<n?f=!0:f=!1,[s,f];default:var h=[];return t.forEach(function(){h.push(!0)}),h}}var r=n(185),i=n(181),s=n(188),o=n(184),u=n(343),a=n(342),f=Array.isArray,l=r.isNode;c.prototype=new r,c.prototype.type="OperatorNode",c.prototype._compile=function(e){if(this.fn in e.math){var t=this.args.map(function(t){return t._compile(e)});return"math."+this.fn+"("+t.join(", ")+")"}throw new Error("Function "+this.fn+' missing in provided namespace "math"')},c.prototype.forEach=function(e){for(var t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)},c.prototype.map=function(e){var t=[];for(var n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new c(this.op,this.fn,t)},c.prototype.clone=function(){return new c(this.op,this.fn,this.args.slice(0))},c.prototype.toString=function(){var e=this.args,t=h(this,e);switch(e.length){case 1:var n=a.getAssociativity(this),r=e[0].toString();t[0]&&(r="("+r+")");if(n==="right")return this.op+r;if(n==="left")return r+this.op;return r+this.op;case 2:var i=e[0].toString(),s=e[1].toString();return t[0]&&(i="("+i+")"),t[1]&&(s="("+s+")"),i+" "+this.op+" "+s;default:return this.fn+"("+this.args.join(", ")+")"}},c.prototype._toTex=function(e){var t=this.args,n=h(this,t),r=u.toOperator(this.op);switch(t.length){case 1:var i=a.getAssociativity(this),s=t[0].toTex(e);n[0]&&(s=u.addBraces(s,!0));if(i==="right")return r+s;if(i==="left")return s+r;return s+r;case 2:var o=t[0],f=u.addBraces(o.toTex(e),n[0]),l=t[1],c=u.addBraces(l.toTex(e),n[1]);switch(this.getIdentifier()){case"OperatorNode:divide":return r+f+c;case"OperatorNode:to":c=u.toUnit(l.toTex(e)),c=u.addBraces(c,n[1])}return f+" "+r+" "+c;default:var p=this.args.map(u.toSymbol).join(", ");return u.toFunction(this.fn)+u.addBraces(p,!0)}},c.prototype.getIdentifier=function(){return this.type+":"+this.fn},e.exports=c},function(e,t,n){"use strict";function o(e,t,n){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(!s(e))throw new TypeError("Node expected");if(!s(t))throw new TypeError("Node expected");if(n&&!s(n))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=t,this.step=n||null}var r=n(185),i=n(342),s=r.isNode;o.prototype=new r,o.prototype.type="RangeNode",o.prototype._compile=function(e){return"math.range("+this.start._compile(e)+", "+this.end._compile(e)+(this.step?", "+this.step._compile(e):"")+")"},o.prototype.forEach=function(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)},o.prototype.map=function(e){return new o(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))},o.prototype.clone=function(){return new o(this.start,this.end,this.step&&this.step)},o.prototype.toString=function(){var e=i.getPrecedence(this),t,n=this.start.toString(),r=i.getPrecedence(this.start);r!==null&&r<=e&&(n="("+n+")"),t=n;if(this.step){var s=this.step.toString(),o=i.getPrecedence(this.step);o!==null&&o<=e&&(s="("+s+")"),t+=":"+s}var u=this.end.toString(),a=i.getPrecedence(this.end);return a!==null&&a<=e&&(u="("+u+")"),t+=":"+u,t},o.prototype._toTex=function(e){var t=this.start.toTex(e);return this.step&&(t+=":"+this.step.toTex(e)),t+=":"+this.end.toTex(e),t},e.exports=o},function(e,t,n){"use strict";function u(e){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");if(!o(e))throw new TypeError('String expected for parameter "name"');this.name=e}function a(e){throw new Error("Undefined symbol "+e)}var r=n(185),i=n(11),s=n(343),o=n(176).isString;u.prototype=new r,u.prototype.type="SymbolNode",u.prototype._compile=function(e){return e.undef=a,e.Unit=i,this.name in e.args?this.name:this.name in e.math?'("'+this.name+'" in scope ? scope["'+this.name+'"] : math["'+this.name+'"])':'("'+this.name+'" in scope ? scope["'+this.name+'"] : '+(i.isValuelessUnit(this.name)?'new Unit(null, "'+this.name+'")':'undef("'+this.name+'")')+")"},u.prototype.forEach=function(e){},u.prototype.map=function(e){return this.clone()},u.prototype.clone=function(){return new u(this.name)},u.prototype.toString=function(){return this.name},u.prototype._toTex=function(e){return s.toSymbol(this.name,e)},e.exports=u},function(e,t,n){"use strict";function s(e,t){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(!(e instanceof i))throw new TypeError('Expected IndexNode for parameter "index"');if(!(t instanceof r))throw new TypeError('Expected Node for parameter "expr"');this.index=e,this.expr=t}var r=n(185),i=n(182);s.prototype=new r,s.prototype.type="UpdateNode",s.prototype._compile=function(e){var t=this.index.objectName()in e.args?this.name+" = ":'scope["'+this.index.objectName()+'"]',n=this.index.compileSubset(e,this.expr._compile(e));return t+" = "+n},s.prototype.forEach=function(e){e(this.index,"index",this),e(this.expr,"expr",this)},s.prototype.map=function(e){return new s(this._ifNode(e(this.index,"index",this)),this._ifNode(e(this.expr,"expr",this)))},s.prototype.clone=function(){return new s(this.index,this.expr)},s.prototype.toString=function(){return this.index.toString()+" = "+this.expr.toString()},s.prototype._toTex=function(e){return this.index.toTex(e)+" = "+this.expr.toTex(e)},e.exports=s},function(e,t,n){e.exports={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]}},function(e,t,n){e.exports={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]}},function(e,t,n){e.exports={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]}},function(e,t,n){e.exports={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]}},function(e,t,n){e.exports={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]}},function(e,t,n){e.exports={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]}},function(e,t,n){e.exports={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]}},function(e,t,n){e.exports={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]}},function(e,t,n){e.exports={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]}},function(e,t,n){e.exports={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]}},function(e,t,n){e.exports={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]}},function(e,t,n){e.exports={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["tau"],seealso:[]}},function(e,t,n){e.exports={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]}},function(e,t,n){e.exports={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]}},function(e,t,n){e.exports={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]}},function(e,t,n){e.exports={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]}},function(e,t,n){e.exports={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]}},function(e,t,n){function i(e){return n(s(e))}function s(e){return r[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var r={"./clone":158,"./clone.js":158,"./filter":159,"./filter.js":159,"./forEach":166,"./forEach.js":166,"./format":160,"./format.js":160,"./import":161,"./import.js":161,"./map":162,"./map.js":162,"./print":163,"./print.js":163,"./sort":164,"./sort.js":164,"./typeof":165,"./typeof.js":165};i.keys=function(){return Object.keys(r)},i.resolve=s,e.exports=i,i.id=207},function(e,t,n){var r=n(172),i=n(173);t.transform=function(e){return e instanceof i?new i(e.index+1,e.min+1,e.max+1):e}},function(e,t,n){"use strict";t.isBoolean=function(e){return e instanceof Boolean||typeof e=="boolean"}},function(e,t,n){e.exports={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]}},function(e,t,n){e.exports={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i",'"hello" + " world"',"3 cm + 2 inch"],seealso:["subtract"]}},function(e,t,n){e.exports={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]}},function(e,t,n){e.exports={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]}},function(e,t,n){e.exports={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]}},function(e,t,n){e.exports={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]}},function(e,t,n){e.exports={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]}},function(e,t,n){e.exports={name:"dotpow",category:"Operators",syntax:["x .^ y","dotpow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]}},function(e,t,n){e.exports={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x))   # Euler's formula"],seealso:["pow","log"]}},function(e,t,n){e.exports={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]}},function(e,t,n){e.exports={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]}},function(e,t,n){e.exports={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]}},function(e,t,n){e.exports={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]}},function(e,t,n){e.exports={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log10"]}},function(e,t,n){e.exports={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]}},function(e,t,n){e.exports={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","function isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]}},function(e,t,n){e.exports={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]}},function(e,t,n){e.exports={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i))","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)","norm([[1, 2], [3, 4]], 'inf')","norm([[1, 2], [3, 4]], 'fro')"]}},function(e,t,n){e.exports={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["sqrt","pow"]}},function(e,t,n){e.exports={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3 = 8","2*2*2","1 + e ^ (pi * i)"],seealso:["multiply"]}},function(e,t,n){e.exports={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]}},function(e,t,n){e.exports={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]}},function(e,t,n){e.exports={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","multiply"]}},function(e,t,n){e.exports={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]}},function(e,t,n){e.exports={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]}},function(e,t,n){e.exports={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]}},function(e,t,n){e.exports={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]}},function(e,t,n){e.exports={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]}},function(e,t,n){e.exports={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]}},function(e,t,n){e.exports={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]}},function(e,t,n){e.exports={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]}},function(e,t,n){e.exports={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]}},function(e,t,n){e.exports={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]}},function(e,t,n){e.exports={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","leftShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]}},function(e,t,n){e.exports={name:"rightLogShift",category:"Bitwise",syntax:["x >> y","leftShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]}},function(e,t,n){e.exports={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]}},function(e,t,n){e.exports={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]}},function(e,t,n){e.exports={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]}},function(e,t,n){e.exports={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]}},function(e,t,n){e.exports={name:"bignumber",category:"Type",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","index","matrix","string","unit"]}},function(e,t,n){e.exports={name:"boolean",category:"Type",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]}},function(e,t,n){e.exports={name:"complex",category:"Type",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]}},function(e,t,n){e.exports={name:"index",category:"Type",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["[]","[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[0:2, 0:2] = ones(2, 2)"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]}},function(e,t,n){e.exports={name:"matrix",category:"Type",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()","matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])"],seealso:["bignumber","boolean","complex","index","number","string","unit"]}},function(e,t,n){e.exports={name:"number",category:"Type",syntax:["x","number(x)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number("52cm", "m")'],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]}},function(e,t,n){e.exports={name:"string",category:"Type",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]}},function(e,t,n){e.exports={name:"unit",category:"Type",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]}},function(e,t,n){e.exports={name:"eval",category:"Expression",syntax:["eval(expression)","eval([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['eval("2 + 3")','eval("sqrt(" + 4 + ")")'],seealso:[]}},function(e,t,n){e.exports={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]}},function(e,t,n){e.exports={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]}},function(e,t,n){e.exports={name:"not",category:"Logical",syntax:["!x","not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["!true","not false","!2","!0"],seealso:["and","or","xor"]}},function(e,t,n){e.exports={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]}},function(e,t,n){e.exports={name:"xor",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 or 4"],seealso:["not","and","or"]}},function(e,t,n){e.exports={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","eye","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0],  [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4],  [5, 6, 7])"],seealso:["multiply","dot"]}},function(e,t,n){e.exports={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","eye","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","eye","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"dot",category:"Matrix",syntax:["dot(A, B)"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]}},function(e,t,n){e.exports={name:"eye",category:"Matrix",syntax:["eye(n)","eye(m, n)","eye([m, n])","eye"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["eye(3)","eye(3, 5)","a = [1, 2, 3; 4, 5, 6]","eye(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]}},function(e,t,n){e.exports={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","eye","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])","ones"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","eye","inv","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","eye","inv","ones","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze"]}},function(e,t,n){e.exports={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","det","diag","eye","inv","ones","range","squeeze","subset","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","eye","inv","ones","range","size","subset","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of a matrix or string. Indexes are one-based. Both the ranges lower-bound and upper-bound are included.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","trace","transpose","zeros"]}},function(e,t,n){e.exports={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},function(e,t,n){e.exports={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","trace","zeros"]}},function(e,t,n){e.exports={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])","zeros"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","trace","transpose"]}},function(e,t,n){e.exports={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["permutations","factorial"]}},function(e,t,n){e.exports={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","permutations","gamma"]}},function(e,t,n){e.exports={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]}},function(e,t,n){e.exports={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","factorial"]}},function(e,t,n){e.exports={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])"],seealso:["random","randomInt"]}},function(e,t,n){e.exports={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]}},function(e,t,n){e.exports={name:"randInt",category:"Probability",syntax:["randInt()","randInt(max)","randInt(min, max)","randInt(size)","randInt(size, max)","randInt(size, min, max)"],description:"Return a random integer number",examples:["randInt()","randInt(10, 20)","randInt([2, 3], 10)"],seealso:["pickRandom","random"]}},function(e,t,n){e.exports={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 if x is larger than y, -1 if x is smaller than y, and 0 if x and y are equal.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq"]}},function(e,t,n){e.exports={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["[1,3,4] == [1,3,4]","[1,3,4] == [1,3]"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]}},function(e,t,n){e.exports={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]}},function(e,t,n){e.exports={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]}},function(e,t,n){e.exports={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 > 1+1","2 >= 1+1","a = 3.2","b = 6-2.8","(a > b)"],seealso:["equal","unequal","smallerEq","smaller","largerEq","compare"]}},function(e,t,n){e.exports={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]}},function(e,t,n){e.exports={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 1+1","2 <= 1+1","a = 3.2","b = 6-2.8","(a < b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]}},function(e,t,n){e.exports={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]}},function(e,t,n){e.exports={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dim)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","var"]}},function(e,t,n){e.exports={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dim)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","var"]}},function(e,t,n){e.exports={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","var"]}},function(e,t,n){e.exports={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dim)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","var"]}},function(e,t,n){e.exports={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","var"]}},function(e,t,n){e.exports={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(var(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","sum","var"]}},function(e,t,n){e.exports={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","var"]}},function(e,t,n){e.exports={name:"var",category:"Statistics",syntax:["var(a, b, c, ...)","var(A)","var(A, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["var(2, 4, 6)","var([2, 4, 6, 8])",'var([2, 4, 6, 8], "uncorrected")','var([2, 4, 6, 8], "biased")',"var([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]}},function(e,t,n){e.exports={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]}},function(e,t,n){e.exports={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]}},function(e,t,n){e.exports={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]}},function(e,t,n){e.exports={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(0.5)"],seealso:["acsch","asech"]}},function(e,t,n){e.exports={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(0.5)","acsc(csc(0.5))","acsc(2)"],seealso:["csc","asin","asec"]}},function(e,t,n){e.exports={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]}},function(e,t,n){e.exports={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]}},function(e,t,n){e.exports={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]}},function(e,t,n){e.exports={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(2.3))"],seealso:["sin","acos","atan"]}},function(e,t,n){e.exports={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]}},function(e,t,n){e.exports={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(2.3))"],seealso:["tan","acos","asin"]}},function(e,t,n){e.exports={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]}},function(e,t,n){e.exports={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]}},function(e,t,n){e.exports={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]}},function(e,t,n){e.exports={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]}},function(e,t,n){e.exports={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]}},function(e,t,n){e.exports={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]}},function(e,t,n){e.exports={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]}},function(e,t,n){e.exports={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]}},function(e,t,n){e.exports={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]}},function(e,t,n){e.exports={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]}},function(e,t,n){e.exports={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]}},function(e,t,n){e.exports={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]}},function(e,t,n){e.exports={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]}},function(e,t,n){e.exports={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]}},function(e,t,n){e.exports={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]}},function(e,t,n){e.exports={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]}},function(e,t,n){e.exports={name:"map",category:"Utils",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], function(val) { return value * value })"],seealso:["filter","forEach"]}},function(e,t,n){e.exports={name:"filter",category:"Utils",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]}},function(e,t,n){e.exports={name:"forEach",category:"Utils",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["forEach([1, 2, 3], function(val) { console.log(val) })"],seealso:["map","sort","filter"]}},function(e,t,n){e.exports={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]}},function(e,t,n){e.exports={name:"import",category:"Utils",syntax:["import(string)"],description:"Import functions from a file.",examples:['import("numbers")','import("./mylib.js")'],seealso:[]}},function(e,t,n){e.exports={name:"sort",category:"Utils",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc" or "desc", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"])',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)'],seealso:["map","filter","forEach"]}},function(e,t,n){e.exports={name:"typeof",category:"Utils",syntax:["typeof(x)"],description:"Get the type of a variable.",examples:["typeof(3.5)","typeof(2 - 4i)","typeof(45 deg)",'typeof("hello world")'],seealso:[]}},function(e,t,n){"use strict";e.exports=function(e){function o(n){if(!u.hasOwnProperty(n))throw new Error("Unknown distribution "+n);var i=Array.prototype.slice.call(arguments,1),o=u[n].apply(this,i);return function(n){var i={random:function(n,r,i){var u,f,l;if(arguments.length>3)throw new e.error.ArgumentsError("random",arguments.length,0,3);arguments.length===1?s(n)?u=n:l=n:arguments.length===2?s(n)?(u=n,l=r):(f=n,l=r):(u=n,f=r,l=i),l===undefined&&(l=1),f===undefined&&(f=0);if(u!==undefined){var c=a(u.valueOf(),f,l,o);return u instanceof t?e.matrix(c):c}return o(f,l)},randomInt:function(n,r,i){var o,f,l;if(arguments.length>3||arguments.length<1)throw new e.error.ArgumentsError("randomInt",arguments.length,1,3);arguments.length===1?s(n)?o=n:l=n:arguments.length===2?s(n)?(o=n,l=r):(f=n,l=r):(o=n,f=r,l=i),f===undefined&&(f=0);if(o!==undefined){var c=a(o.valueOf(),f,l,u);return o instanceof t?e.matrix(c):c}return u(f,l)},pickRandom:function(n){if(arguments.length!==1)throw new e.error.ArgumentsError("pickRandom",arguments.length,1);if(n instanceof t)n=n.valueOf();else if(!Array.isArray(n))throw new e.error.UnsupportedTypeError("pickRandom",e["typeof"](n));if(r.size(n).length>1)throw new Error("Only one dimensional vectors supported");return n[Math.floor(Math.random()*n.length)]}},o=function(e,t){return e+n()*(t-e)},u=function(e,t){return Math.floor(e+n()*(t-e))},a=function(e,t,n,r){var i=[],s,o;e=e.slice(0);if(e.length>1)for(o=0,s=e.shift();o<s;o++)i.push(a(e,t,n,r));else for(o=0,s=e.shift();o<s;o++)i.push(r(t,n));return i};return i}(o)}var t=e.type.Matrix,r=n(169),i=e.collection,s=i.isCollection,u={uniform:function(){return Math.random},normal:function(){return function(){var e,t,n=-1;while(n<0||n>1)e=Math.random(),t=Math.random(),n=1/6*Math.pow(-2*Math.log(e),.5)*Math.cos(2*Math.PI*t)+.5;return n}}};return o}},function(e,t,n){"use strict";t.type=function(e){var t=typeof e;if(t==="object"){if(e===null)return"null";if(e instanceof Boolean)return"boolean";if(e instanceof Number)return"number";if(e instanceof String)return"string";if(Array.isArray(e))return"array";if(e instanceof Date)return"date";if(e instanceof Function)return"function";if(e instanceof RegExp)return"regexp"}return t}},function(e,t,n){t.memoize=function(e){return function t(){typeof t.cache!="object"&&(t.cache={});var n=JSON.stringify(arguments);return n in t.cache?t.cache[n]:t.cache[n]=e.apply(e,arguments)}}},function(e,t,n){var r;(function(i){"use strict";function x(e){var t,n,r=1,i=e.length,s=e[0]+"";for(;r<i;r++){t=e[r]+"";for(n=m-t.length;n--;)t="0"+t;s+=t}for(i=s.length;s.charCodeAt(--i)===48;);return s.slice(0,i+1||1)}function T(e,t,n,r){var i,s,o,u,a;for(s=1,o=e[0];o>=10;o/=10,s++);return o=t-s,o<0?(o+=m,i=0):(i=Math.ceil((o+1)/m),o%=m),s=h(10,m-o),a=e[i]%s|0,r==null?o<3?(o==0?a=a/100|0:o==1&&(a=a/10|0),u=n<4&&a==99999||n>3&&a==49999||a==5e4||a==0):u=(n<4&&a+1==s||n>3&&a+1==s/2)&&(e[i+1]/s/100|0)==h(10,o-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:o<4?(o==0?a=a/1e3|0:o==1?a=a/100|0:o==2&&(a=a/10|0),u=(r||n<4)&&a==9999||!r&&n>3&&a==4999):u=((r||n<4)&&a+1==s||!r&&n>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==h(10,o-3)-1,u}function N(e,t,n){var r=e.constructor;return t==null||((p=t<0||t>8)||t!==0&&(r["errors"]?parseInt:parseFloat)(t)!=t)&&!M(r,"rounding mode",t,n,0)?r.rounding:t|0}function C(e,t,n,r){var i=e.constructor;return!(p=t<(r||0)||t>=w+1)&&(t===0||(i["errors"]?parseInt:parseFloat)(t)==t)||M(i,"argument",t,n,0)}function L(e,t){var n,r,i,s,o,u,a,l=0,c=0,p=0,d=e.constructor,v=d.ONE,m=d.rounding,g=d.precision;if(!e.c||!e.c[0]||e.e>17)return new d(e.c?e.c[0]?e.s<0?0:1/0:v:e.s?e.s<0?0:e:NaN);t==null?(f=!1,o=g):o=t,a=new d(.03125);while(e.e>-2)e=e.times(a),p+=5;r=Math.log(h(2,p))/Math.LN10*2+5|0,o+=r,n=s=u=new d(v),d.precision=o;for(;;){s=P(s.times(e),o,1),n=n.times(++c),a=u.plus(k(s,n,o,1));if(x(a.c).slice(0,o)===x(u.c).slice(0,o)){i=p;while(i--)u=P(u.times(u),o,1);if(t!=null)return d.precision=g,u;if(!(l<3&&T(u.c,o-r,m,l)))return P(u,d.precision=g,m,f=!0);d.precision=o+=10,n=s=a=new d(v),c=0,l++}u=a}}function A(e,t,n,r){var i,s,o=e.constructor,u=(e=new o(e)).e;t==null?n=0:(P(e,++t,n),n=r?t:t+e.e-u),u=e.e,i=x(e.c);if(r==1||r==2&&(t<=u||u<=o.toExpNeg)){for(;i.length<n;i+="0");i.length>1&&(i=i.charAt(0)+"."+i.slice(1)),i+=(u<0?"e":"e+")+u}else{r=i.length;if(u<0){s=n-r;for(;++u;i="0"+i);i="0."+i}else if(++u>r){s=n-u;for(u-=r;u--;i+="0");s>0&&(i+=".")}else s=n-r,u<r?i=i.slice(0,u)+"."+i.slice(u):s>0&&(i+=".");if(s>0)for(;s--;i+="0");}return e.s<0&&e.c[0]?"-"+i:i}function O(e){var t=e.length-1,n=t*m+1;if(t=e[t]){for(;t%10==0;t/=10,n--);for(t=e[0];t>=10;t/=10,n++);}return n}function M(e,t,n,r,i){if(e.errors){var s=new Error((r||["new Decimal","cmp","div","eq","gt","gte","lt","lte","minus","mod","plus","times","toFraction","pow","random","log","sqrt","toNearest","divToInt"][l?l<0?-l:l:1/l<0?1:0])+"() "+(["number type has more than 15 significant digits","LN10 out of digits"][t]||t+([p?" out of range":" not an integer"," not a boolean or binary digit"][i]||""))+": "+n);throw s.name="Decimal Error",p=l=0,s}}function _(e,t,n){var r=new e(e.ONE);for(f=!1;;){n&1&&(r=r.times(t)),n>>=1;if(!n)break;t=t.times(t)}return f=!0,r}function D(e,t){var n,r,i,s,o,u,a,l,c,h,p,d=1,v=10,m=e,g=m.c,y=m.constructor,b=y.ONE,w=y.rounding,E=y.precision;if(m.s<0||!g||!g[0]||!m.e&&g[0]==1&&g.length==1)return new y(g&&!g[0]?-1/0:m["s"]!=1?NaN:g?0:m);t==null?(f=!1,a=E):a=t,y.precision=a+=v,n=x(g),r=n.charAt(0);if(!(Math.abs(s=m.e)<15e14))return m=new y(r+"."+n.slice(1)),a+2>S.length&&M(y,1,a+2,"ln"),m=D(m,a-v).plus((new y(S.slice(0,a+2))).times(s+"")),y.precision=E,t==null?P(m,E,w,f=!0):m;while(r<7&&r!=1||r==1&&n.charAt(1)>3)m=m.times(e),n=x(m.c),r=n.charAt(0),d++;s=m.e,r>1?(m=new y("0."+n),s++):m=new y(r+"."+n.slice(1)),h=m,l=o=m=k(m.minus(b),m.plus(b),a,1),p=P(m.times(m),a,1),i=3;for(;;){o=P(o.times(p),a,1),c=l.plus(k(o,new y(i),a,1));if(x(c.c).slice(0,a)===x(l.c).slice(0,a)){l=l.times(2),s!==0&&(a+2>S.length&&M(y,1,a+2,"ln"),l=l.plus((new y(S.slice(0,a+2))).times(s+""))),l=k(l,new y(d),a,1);if(t!=null)return y.precision=E,l;if(!T(l.c,a-v,w,u))return P(l,y.precision=E,w,f=!0);y.precision=a+=v,c=o=m=k(h.minus(b),h.plus(b),a,1),p=P(m.times(m),a,1),i=u=1}l=c,i+=2}}function P(e,t,n,r){var i,s,o,u,a,l,p,d,g=e.constructor;e:if(t!=null){if(!(p=e.c))return e;for(i=1,u=p[0];u>=10;u/=10,i++);s=t-i;if(s<0)s+=m,o=t,a=p[d=0],l=a/h(10,i-o-1)%10|0;else{d=Math.ceil((s+1)/m);if(d>=p.length){if(!r)break e;for(;p.length<=d;p.push(0));a=l=0,i=1,s%=m,o=s-m+1}else{a=u=p[d];for(i=1;u>=10;u/=10,i++);s%=m,o=s-m+i,l=o<0?0:c(a/h(10,i-o-1)%10)}}r=r||t<0||p[d+1]!=null||(o<0?a:a%h(10,i-o-1)),r=n<4?(l||r)&&(n==0||n==(e["s"]<0?3:2)):l>5||l==5&&(n==4||r||n==6&&(s>0?o>0?a/h(10,i-o):0:p[d-1])%10&1||n==(e["s"]<0?8:7));if(t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=h(10,t%m),e.e=-t||0):p[0]=e.e=0,e;s==0?(p.length=d,u=1,d--):(p.length=d+1,u=h(10,m-s),p[d]=o>0?(a/h(10,i-o)%h(10,o)|0)*u:0);if(r)for(;;){if(d==0){for(s=1,o=p[0];o>=10;o/=10,s++);o=p[0]+=u;for(u=1;o>=10;o/=10,u++);s!=u&&(e.e++,p[0]==v&&(p[0]=1));break}p[d]+=u;if(p[d]!=v)break;p[d--]=0,u=1}for(s=p.length;p[--s]===0;p.pop());}return f&&(e.e>g.maxE?e.c=e.e=null:e.e<g.minE&&(e.c=[e.e=0])),e}var s,o,u,a=i.crypto,f=!0,l=0,c=Math.floor,h=Math.pow,p,d=Object.prototype.toString,v=1e7,m=7,g="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",y={},b=9e15,w=1e9,E=3e3,S="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058";y.absoluteValue=y.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),P(e)},y.ceil=function(){return P(new this.constructor(this),this.e+1,2)},y.comparedTo=y.cmp=function(e,t){var n,r=this,i=r.c,s=(l=-l,e=new r.constructor(e,t),e.c),o=r.s,u=e.s,a=r.e,f=e.e;if(!o||!u)return null;n=i&&!i[0],t=s&&!s[0];if(n||t)return n?t?0:-u:o;if(o!=u)return o;n=o<0;if(!i||!s)return a==f?0:!i^n?1:-1;if(a!=f)return a>f^n?1:-1;for(o=-1,u=(a=i.length)<(f=s.length)?a:f;++o<u;)if(i[o]!=s[o])return i[o]>s[o]^n?1:-1;return a==f?0:a>f^n?1:-1},y.decimalPlaces=y.dp=function(){var e,t,n=null;if(e=this.c){n=((t=e.length-1)-c(this.e/m))*m;if(t=e[t])for(;t%10==0;t/=10,n--);n<0&&(n=0)}return n},y.dividedBy=y.div=function(e,t){return l=2,k(this,new this.constructor(e,t))},y.dividedToIntegerBy=y.divToInt=function(e,t){var n=this,r=n.constructor;return l=18,P(k(n,new r(e,t),0,1,1),r.precision,r.rounding)},y.equals=y.eq=function(e,t){return l=3,this.cmp(e,t)===0},y.exponential=y.exp=function(){return L(this)},y.floor=function(){return P(new this.constructor(this),this.e+1,3)},y.greaterThan=y.gt=function(e,t){return l=4,this.cmp(e,t)>0},y.greaterThanOrEqualTo=y.gte=function(e,t){return l=5,t=this.cmp(e,t),t==1||t===0},y.isFinite=function(){return!!this.c},y.isInteger=y.isInt=function(){return!!this.c&&c(this.e/m)>this.c.length-2},y.isNaN=function(){return!this.s},y.isNegative=y.isNeg=function(){return this.s<0},y.isZero=function(){return!!this.c&&this["c"][0]==0},y.lessThan=y.lt=function(e,t){return l=6,this.cmp(e,t)<0},y.lessThanOrEqualTo=y.lte=function(e,t){return l=7,t=this.cmp(e,t),t==-1||t===0},y.logarithm=y.log=function(e,t){var n,r,i,s,o,u,a,c,h,p=this,d=p.constructor,v=d.precision,m=d.rounding,g=5;if(e==null)e=new d(10),n=!0;else{l=15,e=new d(e,t),r=e.c;if(e.s<0||!r||!r[0]||!e.e&&r[0]==1&&r.length==1)return new d(NaN);n=e.eq(10)}r=p.c;if(p.s<0||!r||!r[0]||!p.e&&r[0]==1&&r.length==1)return new d(r&&!r[0]?-1/0:p["s"]!=1?NaN:r?0:1/0);o=n&&(s=r[0],r.length>1||s!=1&&s!=10&&s!=100&&s!=1e3&&s!=1e4&&s!=1e5&&s!=1e6),f=!1,a=v+g,c=a+10,u=D(p,a),n?(c>S.length&&M(d,1,c,"log"),i=new d(S.slice(0,c))):i=D(e,a),h=k(u,i,a,1);if(T(h.c,s=v,m))do{a+=10,u=D(p,a),n?(c=a+10,c>S.length&&M(d,1,c,"log"),i=new d(S.slice(0,c))):i=D(e,a),h=k(u,i,a,1);if(!o){+x(h["c"]).slice(s+1,s+15)+1==1e14&&(h=P(h,v+1,0));break}}while(T(h.c,s+=10,m));return f=!0,P(h,v,m)},y.minus=function(e,t){var n,r,i,s,o=this,u=o.constructor,a=o.s;l=8,e=new u(e,t),t=e.s;if(!a||!t)return new u(NaN);if(a!=t)return e.s=-t,o.plus(e);var h=o.c,p=e.c,d=c(e.e/m),g=c(o.e/m),y=u.precision,b=u.rounding;if(!g||!d){if(!h||!p)return h?(e.s=-t,e):new u(p?o:NaN);if(!h[0]||!p[0])return o=p[0]?(e.s=-t,e):new u(h[0]?o:b==3?0:0),f?P(o,y,b):o}h=h.slice(),r=h.length;if(a=g-d){(s=a<0)?(a=-a,n=h,r=p.length):(d=g,n=p),(g=Math.ceil(y/m))>r&&(r=g),a>(r+=2)&&(a=r,n.length=1),n.reverse();for(t=a;t--;n.push(0));n.reverse()}else{if(s=r<(i=p.length))i=r;for(a=t=0;t<i;t++)if(h[t]!=p[t]){s=h[t]<p[t];break}}s&&(n=h,h=p,p=n,e.s=-e.s);if((t=-((i=h.length)-p.length))>0)for(;t--;h[i++]=0);for(g=v-1,t=p.length;t>a;){if(h[--t]<p[t]){for(r=t;r&&!h[--r];h[r]=g);--h[r],h[t]+=v}h[t]-=p[t]}for(;h[--i]==0;h.pop());for(;h[0]==0;h.shift(),--d);h[0]||(h=[d=0],e.s=b==3?-1:1),e.c=h;for(a=1,t=h[0];t>=10;t/=10,a++);return e.e=a+d*m-1,f?P(e,y,b):e},y.modulo=y.mod=function(e,t){var n,r,i=this,s=i.constructor,o=s.modulo;return l=9,e=new s(e,t),t=e.s,n=!i.c||!t||e.c&&!e.c[0],n||!e.c||i.c&&!i.c[0]?n?new s(NaN):P(new s(i),s.precision,s.rounding):(f=!1,o==9?(e.s=1,r=k(i,e,0,3,1),e.s=t,r.s*=t):r=k(i,e,0,o,1),r=r.times(e),f=!0,i.minus(r))},y.naturalLogarithm=y.ln=function(){return D(this)},y.negated=y.neg=function(){var e=new this.constructor(this);return e.s=-e.s||null,P(e)},y.plus=function(e,t){var n,r=this,i=r.constructor,s=r.s;l=10,e=new i(e,t),t=e.s;if(!s||!t)return new i(NaN);if(s!=t)return e.s=-t,r.minus(e);var o=r.c,u=e.c,a=c(e.e/m),h=c(r.e/m),p=i.precision,d=i.rounding;if(!h||!a){if(!o||!u)return new i(s/0);if(!o[0]||!u[0])return r=u[0]?e:new i(o[0]?r:s*0),f?P(r,p,d):r}o=o.slice();if(s=h-a){s<0?(s=-s,n=o,t=u.length):(a=h,n=u,t=o.length),(h=Math.ceil(p/m))>t&&(t=h),s>++t&&(s=t,n.length=1);for(n.reverse();s--;n.push(0));n.reverse()}o.length-u.length<0&&(n=u,u=o,o=n);for(s=u.length,t=0,h=v;s;o[s]%=h)t=(o[--s]=o[s]+u[s]+t)/h|0;t&&(o.unshift(t),++a);for(s=o.length;o[--s]==0;o.pop());e.c=o;for(s=1,t=o[0];t>=10;t/=10,s++);return e.e=s+a*m-1,f?P(e,p,d):e},y.precision=y.sd=function(e){var t=null,n=this;return e!=t&&e!==!!e&&e!==1&&e!==0&&M(n.constructor,"argument",e,"precision",1),n.c&&(t=O(n.c),e&&n.e+1>t&&(t=n.e+1)),t},y.round=function(){var e=this,t=e.constructor;return P(new t(e),e.e+1,t.rounding)},y.squareRoot=y.sqrt=function(){var e,t,n,r,i,s,o=this,u=o.c,a=o.s,l=o.e,h=o.constructor,p=new h(.5);if(a!==1||!u||!u[0])return new h(!a||a<0&&(!u||u[0])?NaN:u?o:1/0);f=!1,a=Math.sqrt(+o),a==0||a==1/0?(t=x(u),(t.length+l)%2==0&&(t+="0"),a=Math.sqrt(t),l=c((l+1)/2)-(l<0||l%2),a==1/0?t="1e"+l:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+l),r=new h(t)):r=new h(a.toString()),n=(l=h.precision)+3;for(;;){s=r,r=p.times(s.plus(k(o,s,n+2,1)));if(x(s.c).slice(0,n)===(t=x(r.c)).slice(0,n)){t=t.slice(n-3,n+1);if(!(t=="9999"||!i&&t=="4999")){if(!+t||!+t.slice(1)&&t.charAt(0)=="5")P(r,l+1,1),e=!r.times(r).eq(o);break}if(!i){P(s,l+1,0);if(s.times(s).eq(o)){r=s;break}}n+=4,i=1}}return f=!0,P(r,l,h.rounding,e)},y.times=function(e,t){var n,r,i=this,s=i.constructor,o=i.c,u=(l=11,e=new s(e,t),e.c),a=c(i.e/m),h=c(e.e/m),p=i.s;t=e.s,e.s=p==t?1:-1;if(!a&&(!o||!o[0])||!h&&(!u||!u[0]))return new s(!p||!t||o&&!o[0]&&!u||u&&!u[0]&&!o?NaN:!o||!u?e.s/0:e.s*0);r=a+h,p=o.length,t=u.length,p<t&&(n=o,o=u,u=n,h=p,p=t,t=h);for(h=p+t,n=[];h--;n.push(0));for(a=t-1;a>-1;a--){t=0;for(h=p+a;h>a;)t=n[h]+u[a]*o[h-a-1]+t,n[h--]=t%v|0,t=t/v|0;n[h]=(n[h]+t)%v|0}t?++r:n[0]||n.shift();for(h=n.length;!n[--h];n.pop());e.c=n;for(p=1,t=n[0];t>=10;t/=10,p++);return e.e=p+r*m-1,f?P(e,s.precision,s.rounding):e},y.toDecimalPlaces=y.toDP=function(e,t){var n=this;return n=new n.constructor(n),e==null||!C(n,e,"toDP")?n:P(n,(e|0)+n.e+1,N(n,t,"toDP"))},y.toExponential=function(e,t){var n=this;return n.c?A(n,e!=null&&C(n,e,"toExponential")?e|0:null,e!=null&&N(n,t,"toExponential"),1):n.toString()},y.toFixed=function(e,t){var n,r=this,i=r.constructor,s=i.toExpNeg,o=i.toExpPos;return e!=null&&(e=C(r,e,n="toFixed")?r.e+(e|0):null,t=N(r,t,n)),i.toExpNeg=-(i.toExpPos=1/0),e==null||!r.c?n=r.toString():(n=A(r,e,t),r.s<0&&r.c&&(r.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace("-",""))),i.toExpNeg=s,i.toExpPos=o,n},y.toFormat=function(e,t){var n=this;if(!n.c)return n.toString();var r,i=n.s<0,s=n.constructor.format,o=s.groupSeparator,u=+s.groupSize,a=+s.secondaryGroupSize,f=n.toFixed(e,t).split("."),l=f[0],c=f[1],h=i?l.slice(1):l,p=h.length;a&&(p-=(r=u,u=a,a=r));if(u>0&&p>0){r=p%u||u,l=h.substr(0,r);for(;r<p;r+=u)l+=o+h.substr(r,u);a>0&&(l+=o+h.slice(r)),i&&(l="-"+l)}return c?l+s.decimalSeparator+((a=+s.fractionGroupSize)?c.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+s.fractionGroupSeparator):c):l},y.toFraction=function(e){var t,n,r,i,s,o,u,a,d=this,v=d.constructor,g=t=new v(v.ONE),y=o=new v(0),b=d.c,w=new v(y);if(!b)return d.toString();r=w.e=O(b)-d.e-1,w.c[0]=h(10,(u=r%m)<0?m+u:u);if(e==null||(!(l=12,s=new v(e)).s||(p=s.cmp(g)<0||!s.c)||v.errors&&c(s.e/m)<s.c.length-1)&&!M(v,"max denominator",e,"toFraction",0)||(e=s).cmp(w)>0)e=r>0?w:g;f=!1,s=new v(x(b)),u=v.precision,v.precision=r=b.length*m*2;for(;;){a=k(s,w,0,1,1),n=t.plus(a.times(y));if(n["cmp"](e)==1)break;t=y,y=n,g=o.plus(a.times(n=g)),o=n,w=s.minus(a.times(n=w)),s=n}return n=k(e.minus(t),y,0,1,1),o=o.plus(n.times(g)),t=t.plus(n.times(y)),o.s=g.s=d.s,i=k(g,y,r,1).minus(d).abs().cmp(k(o,t,r,1).minus(d).abs())<1?[g+"",y+""]:[o+"",t+""],f=!0,v.precision=u,i},y.toNearest=function(e,t){var n=this,r=n.constructor;return n=new r(n),e==null?(e=new r(r.ONE),t=r.rounding):(l=17,e=new r(e),t=N(n,t,"toNearest")),e.c?n.c&&(e.c[0]?(f=!1,n=k(n,e,0,t<4?[4,5,7,8][t]:t,1).times(e),f=!0,P(n)):n.c=[n.e=0]):n.s&&(e.s&&(e.s=n.s),n=e),n},y.toNumber=function(){var e=this;return+e||(e.s?0*e.s:NaN)},y.toPower=y.pow=function(e,t){var n,r,i,s,o=this,u=o.constructor,a=o.s,p=+(l=13,e=new u(e,t)),d=p<0?-p:p,v=u.precision,g=u.rounding;if(!o.c||!e.c||(i=!o.c[0])||!e.c[0])return new u(h(i?a*0:+o,p));o=new u(o),n=o.c.length;if(!o.e&&o["c"][0]==o["s"]&&n==1)return o;t=e.c.length-1;if(!e.e&&e["c"][0]==e["s"]&&!t)s=P(o,v,g);else{r=c(e.e/m),i=r>=t;if(!i&&a<0)s=new u(NaN);else{if(i&&n*m*d<E){s=_(u,o,d);if(e.s<0)return u.ONE.div(s)}else{a=a<0&&e.c[Math.max(r,t)]&1?-1:1,t=h(+o,p),r=t==0||!isFinite(t)?c(p*(Math.log("0."+x(o.c))/Math.LN10+o.e+1)):(new u(t+"")).e;if(r>u.maxE+1||r<u.minE-1)return new u(r>0?a/0:0);f=!1,u.rounding=o.s=1,d=Math.min(12,(r+"").length),s=L(e.times(D(o,v+d)),v),s=P(s,v+5,1),T(s.c,v,g)&&(r=v+10,s=P(L(e.times(D(o,r+d)),r),r+5,1),+x(s["c"]).slice(v+1,v+15)+1==1e14&&(s=P(s,v+1,0))),s.s=a,f=!0,u.rounding=g}s=P(s,v,g)}}return s},y.toPrecision=function(e,t){var n=this;return e!=null&&C(n,e,"toPrecision",1)&&n.c?A(n,--e|0,N(n,t,"toPrecision"),2):n.toString()},y.toSignificantDigits=y.toSD=function(e,t){var n=this,r=n.constructor;return n=new r(n),e==null||!C(n,e,"toSD",1)?P(n,r.precision,r.rounding):P(n,e|0,N(n,t,"toSD"))},y.toString=function(e){var t,n,r,i=this,o=i.constructor,u=i.e;if(u===null)n=i.s?"Infinity":"NaN";else{if(e===t&&(u<=o.toExpNeg||u>=o.toExpPos))return A(i,null,o.rounding,1);n=x(i.c);if(u<0){for(;++u;n="0"+n);n="0."+n}else if(r=n.length,u>0)if(++u>r)for(u-=r;u--;n+="0");else u<r&&(n=n.slice(0,u)+"."+n.slice(u));else{t=n.charAt(0);if(r>1)n=t+"."+n.slice(1);else if(t=="0")return t}if(e!=null)if((p=!(e>=2&&e<65))||e!=(e|0)&&!!o.errors)M(o,"base",e,"toString",0);else{n=s(o,n,e|0,10,i.s);if(n=="0")return n}}return i.s<0?"-"+n:n},y.truncated=y.trunc=function(){return P(new this.constructor(this),this.e+1,1)},y.valueOf=y.toJSON=function(){return this.toString()},s=function(){function e(e,t,n){var r,i=[0],s,o=0,u=e.length;for(;o<u;){for(s=i.length;s--;i[s]*=t);i[r=0]+=g.indexOf(e.charAt(o++));for(;r<i.length;r++)i[r]>n-1&&(i[r+1]==null&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}return function(t,n,r,i,s){var o,u,a,f,l,c,h=n.indexOf("."),p=t.precision,d=t.rounding;i<37&&(n=n.toLowerCase()),h>=0&&(n=n.replace(".",""),c=new t(i),f=_(t,c,n.length-h),c.c=e(f.toFixed(),10,r),c.e=c.c.length),l=e(n,i,r),o=u=l.length;for(;l[--u]==0;l.pop());if(!l[0])return"0";h<0?o--:(f.c=l,f.e=o,f.s=s,f=k(f,c,p,d,0,r),l=f.c,a=f.r,o=f.e),h=l[p],u=r/2,a=a||l[p+1]!=null;if(d<4?(h!=null||a)&&(d==0||d==(f["s"]<0?3:2)):h>u||h==u&&(d==4||a||d==6&&l[p-1]&1||d==(f["s"]<0?8:7))){l.length=p;for(--r;++l[--p]>r;)l[p]=0,p||(++o,l.unshift(1))}else l.length=p;for(u=l.length;!l[--u];);for(h=0,n="";h<=u;n+=g.charAt(l[h++]));if(o<0){for(;++o;n="0"+n);n="0."+n}else{h=n.length;if(++o>h)for(o-=h;o--;n+="0");else o<h&&(n=n.slice(0,o)+"."+n.slice(o))}return n}}();var k=function(){function e(e,t,n){var r,i=0,s=e.length;for(e=e.slice();s--;)r=e[s]*t+i,e[s]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,s;if(n!=r)s=n>r?1:-1;else for(i=s=0;i<n;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}function n(e,t,n,r){var i=0;for(;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.shift());}return function(r,i,s,o,u,a){var f,l,h,p,d,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M=r.constructor,_=r["s"]==i["s"]?1:-1,D=r.c,H=i.c;if(!D||!D[0]||!H||!H[0])return new M(!r.s||!i.s||(D?H&&D[0]==H[0]:!H)?NaN:D&&D[0]==0||!H?_*0:_/0);a?(p=1,l=r.e-i.e):(a=v,p=m,l=c(r.e/p)-c(i.e/p)),A=H.length,k=D.length,w=new M(_),E=w.c=[];for(h=0;H[h]==(D[h]||0);h++);H[h]>(D[h]||0)&&l--,s==null?(_=s=M.precision,o=M.rounding):u?_=s+(r.e-i.e)+1:_=s;if(_<0)E.push(1),d=!0;else{_=_/p+2|0,h=0;if(A==1){g=0,H=H[0],_++;for(;(h<k||g)&&_--;h++)N=g*a+(D[h]||0),E[h]=N/H|0,g=N%H|0;d=g||h<k}else{g=a/(H[0]+1)|0,g>1&&(H=e(H,g,a),D=e(D,g,a),A=H.length,k=D.length),C=A,S=D.slice(0,A),x=S.length;for(;x<A;S[x++]=0);O=H.slice(),O.unshift(0),L=H[0],H[1]>=a/2&&L++;do g=0,f=t(H,S,A,x),f<0?(T=S[0],A!=x&&(T=T*a+(S[1]||0)),g=T/L|0,g>1?(g>=a&&(g=a-1),y=e(H,g,a),b=y.length,x=S.length,f=t(y,S,b,x),f==1&&(g--,n(y,A<b?O:H,b,a))):(g==0&&(f=g=1),y=H.slice()),b=y.length,b<x&&y.unshift(0),n(S,y,x,a),f==-1&&(x=S.length,f=t(H,S,A,x),f<1&&(g++,n(S,A<x?O:H,x,a))),x=S.length):f===0&&(g++,S=[0]),E[h++]=g,f&&S[0]?S[x++]=D[C]||0:(S=[D[C]],x=1);while((C++<k||S[0]!=null)&&_--);d=S[0]!=null}E[0]||E.shift()}if(p==1)w.e=l,w.r=+d;else{for(h=1,_=E[0];_>=10;_/=10,h++);w.e=h+l*p-1,P(w,u?s+w.e+1:s,o,d)}return w}}();o=function(){function e(e){var t,n,r,i=this,s="config",o=i.errors?parseInt:parseFloat;return e==n||typeof e!="object"&&!M(i,"object expected",e,s)?i:((r=e[t="precision"])!=n&&((p=r<1||r>w)||o(r)!=r?M(i,t,r,s,0):i[t]=r|0),(r=e[t="rounding"])!=n&&((p=r<0||r>8)||o(r)!=r?M(i,t,r,s,0):i[t]=r|0),(r=e[t="toExpNeg"])!=n&&((p=r<-b||r>0)||o(r)!=r?M(i,t,r,s,0):i[t]=c(r)),(r=e[t="toExpPos"])!=n&&((p=r<0||r>b)||o(r)!=r?M(i,t,r,s,0):i[t]=c(r)),(r=e[t="minE"])!=n&&((p=r<-b||r>0)||o(r)!=r?M(i,t,r,s,0):i[t]=c(r)),(r=e[t="maxE"])!=n&&((p=r<0||r>b)||o(r)!=r?M(i,t,r,s,0):i[t]=c(r)),(r=e[t="errors"])!=n&&(r===!!r||r===1||r===0?(p=l=0,i[t]=!!r):M(i,t,r,s,1)),(r=e[t="crypto"])!=n&&(r===!!r||r===1||r===0?i[t]=!!r&&!!a&&typeof a=="object":M(i,t,r,s,1)),(r=e[t="modulo"])!=n&&((p=r<0||r>9)||o(r)!=r?M(i,t,r,s,0):i[t]=r|0),(e=e[t="format"])!=n&&(typeof e=="object"?i[t]=e:M(i,"format object expected",e,s)),i)}function t(e){return(new this(e)).exp()}function n(e){return(new this(e)).ln()}function r(e,t){return(new this(e)).log(t)}function i(e,t,n){var r,i,s=0;d.call(t[0])=="[object Array]"&&(t=t[0]),r=new e(t[0]);for(;++s<t.length;){i=new e(t[s]);if(!i.s){r=i;break}r[n](i)&&(r=i)}return r}function o(){return i(this,arguments,"lt")}function u(){return i(this,arguments,"gt")}function E(e,t){return(new this(e)).pow(t)}function S(e){var t,n,r,i=0,s=[],o=this,u=new o(o.ONE);e==null||!C(u,e,"random")?e=o.precision:e|=0,n=Math.ceil(e/m);if(o.crypto)if(a&&a.getRandomValues){t=a.getRandomValues(new Uint32Array(n));for(;i<n;)r=t[i],r>=429e7?t[i]=a.getRandomValues(new Uint32Array(1))[0]:s[i++]=r%1e7}else if(a&&a.randomBytes){t=a.randomBytes(n*=4);for(;i<n;)r=t[i]+(t[i+1]<<8)+(t[i+2]<<16)+((t[i+3]&127)<<24),r>=214e7?a.randomBytes(4).copy(t,i):(s.push(r%1e7),i+=4);i=n/4}else M(o,"crypto unavailable",a,"random");if(!i)for(;i<n;)s[i++]=Math.random()*1e7|0;n=s[--i],e%=m,n&&e&&(r=h(10,m-e),s[i]=(n/r|0)*r);for(;s[i]===0;i--)s.pop();if(i<0)s=[n=0];else{n=-1;for(;s[0]===0;)s.shift(),n-=m;for(i=1,r=s[0];r>=10;)r/=10,i++;i<m&&(n-=m-i)}return u.e=n,u.c=s,u}function x(e){return(new this(e)).sqrt()}function T(i){function s(e,t){var n=this;if(n instanceof s){n.constructor=s;if(e instanceof s){if(t==null)return l=0,n.s=e.s,n.e=e.e,n.c=(e=e.c)?e.slice():e,n;if(t==10)return P(new s(e),s.precision,s.rounding);e+=""}return v(s,n,e,t)}return M(s,"Decimal called without new",e),new s(e,t)}return s.precision=20,s.rounding=4,s.modulo=1,s.toExpNeg=-7,s.toExpPos=21,s.minE=-b,s.maxE=b,s.errors=!0,s.crypto=!1,s.format={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},s.prototype=y,s.ONE=new s(1),s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=e,s.constructor=T,s.exp=t,s.ln=n,s.log=r,s.max=o,s.min=u,s.pow=E,s.sqrt=x,s.random=S,i!=null&&s.config(i),s}var v=function(){var e=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,t=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};return function(n,r,i,o){var u,a,c,h,v,y;typeof i!="string"&&(i=(h=typeof i=="number"||d.call(i)=="[object Number]")&&i===0&&1/i<0?"-0":i+""),v=i;if(o==null&&e.test(i))r.s=i.charCodeAt(0)===45?(i=i.slice(1),-1):1;else{if(o==10)return P(new n(i),n.precision,n.rounding);i=t.call(i).replace(/^\+(?!-)/,""),r.s=i.charCodeAt(0)===45?(i=i.replace(/^-(?!-)/,""),-1):1,o!=null?o!=(o|0)&&!!n.errors||(p=!(o>=2&&o<65))?(M(n,"base",o,0,0),y=e.test(i)):(u="["+g.slice(0,o|=0)+"]+",i=i.replace(/\.$/,"").replace(/^\./,"0."),(y=(new RegExp("^"+u+"(?:\\."+u+")?$",o<37?"i":"")).test(i))?(h&&(i.replace(/^0\.0*|\./,"").length>15&&M(n,0,v),h=!h),i=s(n,i,10,o,r.s)):i!="Infinity"&&i!="NaN"&&(M(n,"not a base "+o+" number",v),i="NaN")):y=e.test(i);if(!y)return r.c=r.e=null,i!="Infinity"&&(i!="NaN"&&M(n,"not a number",v),r.s=null),l=0,r}(a=i.indexOf("."))>-1&&(i=i.replace(".","")),(c=i.search(/e/i))>0?(a<0&&(a=c),a+=+i.slice(c+1),i=i.substring(0,c)):a<0&&(a=i.length);for(c=0;i.charCodeAt(c)===48;c++);for(o=i.length;i.charCodeAt(--o)===48;);i=i.slice(c,o+1);if(i){o=i.length,h&&o>15&&M(n,0,v),r.e=a=a-c-1,r.c=[],c=(a+1)%m,a<0&&(c+=m);if(c<o){c&&r.c.push(+i.slice(0,c));for(o-=m;c<o;)r.c.push(+i.slice(c,c+=m));i=i.slice(c),c=m-i.length}else c-=o;for(;c--;i+="0");r.c.push(+i),f&&(r.e>n.maxE?r.c=r.e=null:r.e<n.minE&&(r.c=[r.e=0]))}else r.c=[r.e=0];return l=0,r}}();return T()}(),r=function(){return o}.call(t,n,t,e),r===undefined||!(e.exports=r)})(this)},function(e,t,n){"use strict";e.exports={end:!0}},function(e,t,n){"use strict";function i(e){var t=e.getIdentifier();for(var n=0;n<r.length;n++)if(t in r[n])return n;return null}function s(e){var t=e.getIdentifier(),n=i(e);if(n===null)return null;var s=r[n][t];if(s.hasOwnProperty("associativity")){if(s.associativity==="left")return"left";if(s.associativity==="right")return"right";throw Error("'"+t+"' has the invalid associativity '"+s.associativity+"'.")}return null}function o(e,t){var n=e.getIdentifier(),s=t.getIdentifier(),o=i(e);if(o===null)return null;var u=r[o][n];if(u.hasOwnProperty("associativeWith")&&u.associativeWith instanceof Array){for(var a=0;a<u.associativeWith.length;a++)if(u.associativeWith[a]===s)return!0;return!1}return null}var r=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{}},{"OperatorNode:or":{associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{associativity:"left",associativeWith:[]}},{"OperatorNode:and":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{associativity:"left",associativeWith:[]},"OperatorNode:unequal":{associativity:"left",associativeWith:[]},"OperatorNode:smaller":{associativity:"left",associativeWith:[]},"OperatorNode:larger":{associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{associativity:"left",associativeWith:[]}},{"OperatorNode:to":{associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{associativity:"left",associativeWith:[]},"OperatorNode:dotMultiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{associativity:"left",associativeWith:[]},"OperatorNode:mod":{associativity:"left",associativeWith:[]}},{"OperatorNode:unaryPlus":{associativity:"right"},"OperatorNode:unaryMinus":{associativity:"right"},"OperatorNode:bitNot":{associativity:"right"},"OperatorNode:not":{associativity:"right"}},{"OperatorNode:pow":{associativity:"right",associativeWith:[]},"OperatorNode:dotPow":{associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{associativity:"left"}},{"OperatorNode:transpose":{associativity:"left"}}];e.exports.properties=r,e.exports.getPrecedence=i,e.exports.getAssociativity=s,e.exports.isAssociativeWith=o},function(e,t,n){"use strict";function m(){var e=Array.prototype.slice.call(arguments),t;for(var n=0,r=e.length;n<r;n++){t=e[n];for(var i in t)t.hasOwnProperty(i)&&(v[i]=t[i])}}function g(e,t){return typeof e[t]!="undefined"}function y(e){return function(t){return g(e,t)}}function b(e){return function(n){if(typeof e[n]=="boolean")e[n]===!0?n="\\"+n:n="\\mathrm{"+n+"}";else if(typeof e[n]=="string")n=e[n];else if(typeof n=="string"){var r=n.indexOf("_");r!==-1&&(n=t.toSymbol(n.substring(0,r))+"_{"+t.toSymbol(n.substring(r+1))+"}")}return n}}var r=n(177),i=n(186),s=n(188),o=n(181),u={Alpha:"A",alpha:!0,Beta:"B",beta:!0,Gamma:!0,gamma:!0,Delta:!0,delta:!0,Epsilon:"E",epsilon:!0,varepsilon:!0,Zeta:"Z",zeta:!0,Eta:"H",eta:!0,Theta:!0,theta:!0,vartheta:!0,Iota:"I",iota:!0,Kappa:"K",kappa:!0,varkappa:!0,Lambda:!0,lambda:!0,Mu:"M",mu:!0,Nu:"N",nu:!0,Xi:!0,xi:!0,Omicron:"O",omicron:!0,Pi:!0,pi:!0,varpi:!0,Rho:"P",rho:!0,varrho:!0,Sigma:!0,sigma:!0,varsigma:!0,Tau:"T",tau:!0,Upsilon:!0,upsilon:!0,Phi:!0,phi:!0,varphi:!0,Chi:"X",chi:!0,Psi:!0,psi:!0,Omega:!0,omega:!0},a={dots:!0,ldots:!0,cdots:!0,vdots:!0,ddots:!0,idots:!0},f={"true":"\\mathrm{True}","false":"\\mathrm{False}"},l={inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:!0,"undefined":"\\mathbf{?}"},c={acos:"\\cos^{-1}",arccos:"\\cos^{-1}",cos:!0,csc:!0,csch:!1,exp:!0,ker:!0,limsup:!0,min:!0,sinh:!0,asin:"\\sin^{-1}",arcsin:"\\sin^{-1}",cosh:!0,deg:!0,gcd:!0,lg:!0,ln:!0,Pr:!0,sup:!0,atan:"\\tan^{-1}",atan2:"\\tan2^{-1}",arctan:"\\tan^{-1}",cot:!0,det:!0,hom:!0,log:!0,log10:"\\log_{10}",sec:!0,sech:!1,tan:!0,arg:!0,coth:!0,dim:!0,inf:!0,max:!0,sin:!0,tanh:!0,fix:!1,lcm:!1,sign:!1,xgcd:!1,unaryMinus:!1,unaryPlus:!1,complex:!1,conj:!1,im:!1,re:!1,diag:!1,resize:!1,size:!1,squeeze:!1,subset:!1,index:!1,ones:!1,zeros:!1,range:!1,random:!1,mean:"\\mu",median:!1,prod:!1,std:"\\sigma","var":"\\sigma^2"},h={sqrt:!0,inv:!0,"int":"\\int",Int:"\\int",integrate:"\\int",eigenvalues:"\\lambda",liminf:!0,lim:!0,exp:"e^",sum:!0,eye:"\\mathbf{I}"},p={"<=":"\\leq",">=":"\\geq","!=":"\\neq","in":!0,"*":"\\cdot","/":"\\frac",mod:"\\bmod",to:"\\rightarrow"},d={deg:"^{\\circ}"},v={};m(c,h,u,a,f,l),t.isSymbol=y(v),t.toSymbol=b(v),t.isFunction=y(c),t.toFunction=b(c),t.isCurlyFunction=y(h),t.toCurlyFunction=b(h),t.isOperator=y(p),t.toOperator=b(p),t.isUnit=y(d),t.toUnit=function(){var e=b(d);return function(n,r){return t.isUnit(n)?e(n):(r?"":"\\,")+"\\mathrm{"+n+"}"}}(),t.addBraces=function(e,t,n){if(t===null)return e;var r=["",""];n=n||"normal",typeof t=="undefined"||t===!1?r=["{","}"]:t===!0?(r=["(",")"],n="lr"):Array.isArray(t)&&t.length===2?r=t:r=[t,t];switch(n){case"normal":case!1:return r[0]+e+r[1];case"lr":return"\\left"+r[0]+"{"+e+"}"+"\\right"+r[1];case"be":return"\\begin{"+r[0]+"}"+e+"\\end{"+r[1]+"}"}return r[0]+e+r[1]},t.toArgs=function(e,n){var u=e.name,a=e.args,f=t.toSymbol(e.name),l=null,c=null,h=!1,p=!1,d="",v="",m=null;switch(u){case"add":m="+";break;case"subtract":m="-";break;case"larger":m=">";break;case"largerEq":m=">=";break;case"smaller":m="<";break;case"smallerEq":m="<=";break;case"unequal":m="!=";break;case"equal":m="=";break;case"mod":m="mod";break;case"multiply":m="*";break;case"pow":m="^";break;case"concat":m="||";break;case"factorial":m="!";break;case"permutations":if(a.length!==1){var g=a[0].toTex(n),y=a[1].toTex(n);return"\\frac{"+g+"!}{\\left("+g+" - "+y+"\\right)!}"}if(!(a[0]instanceof s||a[0]instanceof o))return"{\\left("+a[0].toTex(n)+"\\right)!}";m="!";break;case"combinations":m="\\choose";break;case"abs":c="|",h="lr";break;case"norm":c="\\|",h="lr";if(a.length===2){var b=a[1].toTex(n);b==="\\text{inf}"?b="\\infty":b==="\\text{-inf}"?b="{- \\infty}":b==="\\text{fro}"&&(b="F"),v="_{"+b+"}",a=[a[0]]}break;case"ceil":c=["\\lceil","\\rceil"],h="lr";break;case"floor":c=["\\lfloor","\\rfloor"],h="lr";break;case"round":c=["\\lfloor","\\rceil"],h="lr",a.length===2&&(v="_"+t.addBraces(a[1].toTex(n)),a=[a[0]]);break;case"inv":v="^{-1}";break;case"transpose":v="^{T}",c=!1;break;case"log":var w="e";a.length===2&&(w=a[1].toTex(n),f="\\log_{"+w+"}",a=[a[0]]),w==="e"&&(f="\\ln"),p=!0;break;case"square":v="^{2}";break;case"cube":v="^{3}";break;case"eye":p=!0,c=!1,f+="_";break;case"det":if(e.args[0]instanceof r){e.args[0].latexType="vmatrix";var E=e.args[0].toTex(n);return delete e.args[0].latexType,E}c="vmatrix",h="be";break;default:p=!0}return m!==null?(c=m==="+"||m==="-",l=(new i(m,u,a)).toTex(n)):m=", ",c===null&&!t.isCurlyFunction(u)&&(c=!0),l=l||a.map(function(e){return"{"+e.toTex(n)+"}"}).join(m),d+(p?f:"")+t.addBraces(l,c,h)+v}}])}),define("adapter/ps",["require","exports","module","bluebird"],function(e,t){"use strict";var n=e("bluebird"),r=n.promisifyAll(_spaces.ps),i=function(e,t){return e=e||!1,t=t||{invalidateMenus:!0},r.endModalToolStateAsync(e).then(function(){return r.processQueuedCommandsAsync(t)})},s=function(e){return r.performMenuCommandAsync(e)},o=function(e,t,n){var i={category:e,subcategory:t,event:n};return r.logHeadlightsEventAsync(i)};t.endModalToolState=i,t.performMenuCommand=s,t.logHeadlightsEvent=o}),function(e,t){typeof module=="object"&&module.exports&&typeof require=="function"?module.exports=t():typeof define=="function"&&typeof define.amd=="object"?define("loglevel",t):e.log=t()}(this,function(){function r(e){return typeof console===n?!1:console[e]!==undefined?i(console,e):console.log!==undefined?i(console,"log"):t}function i(e,t){var n=e[t];if(typeof n.bind=="function")return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(r){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function s(t,r){return function(){typeof console!==n&&(u(r),e[t].apply(e,arguments))}}function u(n){for(var r=0;r<o.length;r++){var i=o[r];e[i]=r<n?t:e.methodFactory(i,n)}}function a(e){var t=(o[e]||"silent").toUpperCase();try{window.localStorage.loglevel=t;return}catch(n){}try{window.document.cookie="loglevel="+t+";"}catch(n){}}function f(){var t;try{t=window.localStorage.loglevel}catch(r){}if(typeof t===n)try{t=/loglevel=([^;]+)/.exec(window.document.cookie)[1]}catch(r){}e.levels[t]===undefined&&(t="WARN"),e.setLevel(e.levels[t])}var e={},t=function(){},n="undefined",o=["trace","debug","info","warn","error"];e.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},e.methodFactory=function(e,t){return r(e)||s(e,t)},e.setLevel=function(t){typeof t=="string"&&e.levels[t.toUpperCase()]!==undefined&&(t=e.levels[t.toUpperCase()]);if(!(typeof t=="number"&&t>=0&&t<=e.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;a(t),u(t);if(typeof console===n&&t<e.levels.SILENT)return"No console available for logging"},e.enableAll=function(){e.setLevel(e.levels.TRACE)},e.disableAll=function(){e.setLevel(e.levels.SILENT)};var l=typeof window!==n?window.log:undefined;return e.noConflict=function(){return typeof window!==n&&window.log===e&&(window.log=l),e},f(),e}),define("js/util/global",["require","exports","module"],function(e,t){"use strict";var n=!!window.__PG_DEBUG__;t.debug=n}),define("js/util/log",["require","exports","module","loglevel","./global"],function(e,t,n){"use strict";var r=e("loglevel"),i=e("./global");i.debug?r.enableAll():r.setLevel(r.levels.INFO),r.hasOwnProperty("table")||(r.table=console.table.bind(console)),n.exports=r}),define("js/jsx/mixin/Focusable",["require","exports","module","adapter/os","adapter/ps","js/util/log"],function(e,t,n){"use strict";var r=e("adapter/os"),i=e("adapter/ps"),s=e("js/util/log");n.exports={acquireFocus:function(){i.endModalToolState(!0).catch(function(e){var t=e instanceof Error?e.stack||e.message:e;s.error("Failed to end modal tool state:",t)}),r.acquireKeyboardFocus().catch(function(e){var t=e instanceof Error?e.stack||e.message:e;s.error("Failed to acquire keyboard focus:",t)})},componentDidMount:function(){this.getDOMNode().addEventListener("mousedown",this.acquireFocus)},componentWillUnmount:function(){this.getDOMNode().removeEventListener("mousedown",this.acquireFocus)}}}),define("js/util/math",["require","exports","module","mathjs","lodash"],function(e,t){"use strict";var n=e("mathjs"),r=e("lodash"),i=function(e){return/^(\-|\+)?(\d+|\d*\.\d+|Infinity)$/.test(e)?Number(e):null},s=function(e,t){return r.isFinite(e)?e.toString():typeof t=="string"?t:""},o=function(e){return e.substr(-2)==="px"?i(e.substring(0,e.length-2)):null},u=function(e,t){return n.round(n.round(e*t,0)/t,4)},a=1-.99999,f=function(e,t){var n=e*e+t*t,r=1-n,i=Math.abs(r);return i>a},l=function(e){return e.tx===0&&e.ty===0&&!f(e.yx,e.yy)&&!f(e.xx,e.xy)},c=function(e,t,n){return e<t?t:e>n?n:e};t.parseNumber=i,t.formatNumber=s,t.pixelDimensionToNumber=o,t.normalize=u,t.isRotation=l,t.clamp=c}),define("js/util/collection",["require","exports","module","immutable"],function(e,t){"use strict";var n=e("immutable"),r=function(e,t,r){typeof t!="function"&&(r=t,t=n.is),r===undefined&&(r=null);if(!e||e.isEmpty())return r;var i=e.get(0);if(e.size===1)return i;var s=e.rest().some(function(e){return!t(i,e)});return s?r:i},i=function(e,t,r){return e.map(function(e){if(e){if(e.hasOwnProperty(t)||e[t])return e[t];if(e instanceof n.Iterable)return e.get(t,r)}return r})},s=function(e,t){return e.map(function(e){return n.Map(t.reduce(function(t,r){if(e){if(e.hasOwnProperty(r)||e[r])return t.set(r,e[r]);if(e instanceof n.Iterable&&e.has(r))return t.set(r,e.get(r))}return t},new Map))})},o=function(e,t){if(e.isEmpty())return n.List();var r=i(e,"size",0).max();return n.Range(0,r).map(function(n){return e.map(function(e){return e.get(n,t)})})},u=function(e,t){return e.filter(function(e){return t.contains(e)})},a=function(e,t){return e.filter(function(e){return!t.contains(e)})};t.uniformValue=r,t.zip=o,t.pluck=i,t.pluckAll=s,t.intersection=u,t.difference=a}),define("js/util/headlights",["require","exports","module","bluebird","adapter/ps","./global"],function(e,t){"use strict";var n=e("bluebird"),r=e("adapter/ps"),i=e("./global"),s=function(e,t,s){return i.debug?n.resolve():r.logHeadlightsEvent(e,t,s)};t.logEvent=s}),define("jsx!js/jsx/shared/NumberInput",["require","exports","module","react","immutable","mathjs","lodash","../mixin/Focusable","js/util/math","js/util/collection","i18n!nls/strings","adapter/os","js/util/headlights","js/util/log"],function(e,t,n){"use strict";var r=e("react"),i=e("immutable"),s=e("mathjs"),o=e("lodash"),u=e("../mixin/Focusable"),a=e("js/util/math"),f=e("js/util/collection"),l=e("i18n!nls/strings"),c=e("adapter/os"),h=e("js/util/headlights"),p=e("js/util/log"),d=r.createClass({displayName:"NumberInput",mixins:[u],propTypes:{value:r.PropTypes.oneOfType([r.PropTypes.number,r.PropTypes.string,r.PropTypes.instanceOf(i.Iterable)]),special:r.PropTypes.string,onChange:r.PropTypes.func.isRequired,step:r.PropTypes.number,bigstep:r.PropTypes.number,min:r.PropTypes.number,max:r.PropTypes.number,precision:r.PropTypes.number,disabled:r.PropTypes.bool},getDefaultProps:function(){return{value:null,step:1,bigstep:10,min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,onChange:o.identity,precision:1,disabled:!1}},getInitialState:function(){var e=this._formatValue(this.props.value);return{rawValue:e,dirty:!1}},componentWillReceiveProps:function(e){var t=this._formatValue(e.value),n=this.refs.input.getDOMNode(),r=window.document.activeElement===n&&n.selectionStart===0&&n.selectionEnd===n.value.length;this.setState({rawValue:t,select:r})},shouldComponentUpdate:function(e,t){return t.rawValue!==this.state.rawValue||t.dirty!==this.state.dirty||e.disabled!==this.props.disabled||!i.is(e.value,this.props.value)},componentDidUpdate:function(){if(this.state.select){var e=this.refs.input.getDOMNode();window.document.activeElement===e&&e.setSelectionRange(0,e.value.length),this.setState({select:!1})}},_extractValue:function(e){if(this.props.special&&e===this.props.special)return e;var t;try{t=s.eval(e),t=a.parseNumber(t)}catch(n){t=null}return o.isFinite(t)?t:null},_formatValue:function(e){if(i.Iterable.isIterable(e)){if(e.isEmpty())return"";e=f.uniformValue(e);if(e===null)return l.TRANSFORM.MIXED}switch(typeof e){case"number":return String(s.round(e,this.props.precision));case"string":return e;default:return""}},_handleChange:function(e){this.setState({rawValue:e.target.value,select:!1,dirty:!0})},_releaseFocus:function(){this.refs.input.getDOMNode().blur(),c.releaseKeyboardFocus().catch(function(e){var t=e instanceof Error?e.stack||e.message:e;p.error("Failed to release keyboard focus on reset:",t)})},_reset:function(e){if(this.state.dirty){var t=this._formatValue(this.props.value);this.setState({rawValue:t,dirty:!1,select:!0})}else this._releaseFocus();e.stopPropagation()},_commit:function(e,t,n){if(n||this.state.dirty){typeof t=="number"&&(t>this.props.max&&(t=this.props.max),t<this.props.min&&(t=this.props.min));var r=this._formatValue(t);this.setState({dirty:!1,select:!0,rawValue:r});var s=this.props.value;if(i.Iterable.isIterable(s)&&t===f.uniformValue(s)||t===s)return;e.target.value.match(/[\-+/*]/)&&h.logEvent("edit","transform","math-operator"),this.props.onChange(e,t)}else this._releaseFocus();e.stopPropagation()},_handleKeyDown:function(e){var t=e.key;if(t==="Escape"){this._reset(e);return}var n,r,i;switch(t){case"Return":case"Enter":n=this._extractValue(e.target.value),n===null?this._reset(e):this._commit(e,n);break;case"ArrowUp":case"ArrowDown":n=this._extractValue(e.target.value),n===null?this._reset(e):typeof n=="number"&&(r=t==="ArrowUp"?1:-1,r*=e.shiftKey?this.props.bigstep:1,i=this.props.step*r,n+=i,this.setState({select:!0}),this._commit(e,n,!0)),e.preventDefault()}this.props.onKeyDown&&this.props.onKeyDown(e)},_handleFocus:function(e){var t=this.refs.input.getDOMNode();t.selectionStart=0,t.selectionEnd=e.target.value.length,this.props.onFocus&&this.props.onFocus(e)},_handleBlur:function(e){var t=this._extractValue(e.target.value);if(t===null){var n=this._formatValue(this.props.value);this.setState({rawValue:n,dirty:!1})}else this._commit(e,t,!0);this.props.onBlur&&this.props.onBlur(e)},render:function(){var e=this.props.size||"column-4",t=r.addons.classSet({"number-input__dirty":this.state.dirty,"number-input__clean":!this.state.dirty});return t+=" "+e+" number-input",r.createElement("input",r.__spread({},this.props,{type:"text",ref:"input",className:t,disabled:this.props.disabled,value:this.state.rawValue,onChange:this._handleChange,onFocus:this._handleFocus,onBlur:this._handleBlur,onKeyDown:this._handleKeyDown}))}});n.exports=d}),define("jsx!js/jsx/Shared/SVGIcon",["require","exports","module","react"],function(e,t,n){"use strict";var r=e("react"),i=r.createClass({displayName:"SVGIcon",_getDefaultIconPath:function(){return"img/ico-"+this.props.CSSID+".svg#"+this.props.CSSID},_setLinkAttribute:function(e){var t;this.props.hasOwnProperty("iconPath")?t=this.props.iconPath+"#"+this.props.CSSID:t=this._getDefaultIconPath(),e.setAttributeNS("http://www.w3.org/1999/xlink","href",t)},shouldComponentUpdate:function(e){return e.iconPath!==this.props.iconPath||e.CSSID!==this.props.CSSID},componentDidMount:function(){var e=this.getDOMNode(),t=window.document.createElementNS("http://www.w3.org/2000/svg","use");this._setLinkAttribute(t),e.appendChild(t)},componentDidUpdate:function(){var e=this.getDOMNode().querySelector("use");this._setLinkAttribute(e)},render:function(){return this.props.hasOwnProperty("className")||(this.props.className=""),r.createElement("svg",{viewBox:this.props.viewBox,className:this.props.className})}});n.exports=i}),define("jsx!js/jsx/shared/ToggleButton",["require","exports","module","react","jsx!js/jsx/Shared/SVGIcon","immutable","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("jsx!js/jsx/Shared/SVGIcon"),s=e("immutable"),o=e("js/util/collection"),u=function(e){return!!(e===!0||s.Iterable.isIterable(e)&&o.uniformValue(e))},a=r.createClass({displayName:"ToggleButton",mixins:[r.addons.PureRenderMixin],propTypes:{selected:r.PropTypes.oneOfType([r.PropTypes.bool,r.PropTypes.instanceOf(s.Iterable)])},getDefaultProps:function(){return{disabled:!1}},render:function(){var e=u(this.props.selected),t=this.props.size||"column-1",n=this.props.buttonType||"default",s=this.props.className,o={"button-toggle":!0,"button-toggle__disabled":this.props.disabled};o[t]=!0,s&&(o[s]=!0);var a=r.addons.classSet(o),f=this.props.selectedButtonType;return e&&f&&(n=f),r.createElement("div",{title:this.props.title,"data-type":n,"data-selected":e,className:a,onClick:!this.props.disabled&&this.handleClick.bind(this,!e)},r.createElement(i,{viewBox:"0 0 24 24",CSSID:n}))},handleClick:function(e,t){this.props.onClick&&this.props.onClick(t,e)}});n.exports=a}),define("jsx!js/jsx/sections/transform/Size",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/Label","jsx!js/jsx/shared/NumberInput","jsx!js/jsx/shared/ToggleButton","i18n!nls/strings","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("jsx!js/jsx/shared/Gutter"),a=e("jsx!js/jsx/shared/Label"),f=e("jsx!js/jsx/shared/NumberInput"),l=e("jsx!js/jsx/shared/ToggleButton"),c=e("i18n!nls/strings"),h=e("js/util/collection"),p=32768,d=r.createClass({displayName:"Size",mixins:[s],shouldComponentUpdate:function(e){var t=function(e){return e.document?e.document.layers.selectedChildBounds:null},n=function(e){if(!e.document)return null;var t=e.document.layers.selected;return h.pluckAll(t,["kind","locked","isBackground","proportionalScaling"])},r=function(e){return e.document?e.document.bounds:null};return!o.is(r(this.props),r(e))||!o.is(t(this.props),t(e))||!o.is(n(this.props),n(e))},_handleWidthChange:function(e,t){var n=this.props.document;if(!n)return;this.getFlux().actions.transform.setSizeThrottled(n,n.layers.selected,{w:t})},_handleHeightChange:function(e,t){var n=this.props.document;if(!n)return;this.getFlux().actions.transform.setSizeThrottled(n,n.layers.selected,{h:t})},_handleProportionChange:function(e,t){var n=this.props.document;if(!n)return;this.getFlux().actions.layers.setProportional(n,n.layers.selected,t)},_disabled:function(e,t,n){var r=e.layers,i=t.filter(function(e){return e.isArtboard});return e.unsupported||t.isEmpty()&&e.layers.hasArtboard||!t.isEmpty()&&n.isEmpty()||t.some(function(t){var n=r.childBounds(t);return t.isBackground||t.kind===t.layerKinds.ADJUSTMENT||t.kind===t.layerKinds.TEXT||!n||n.empty||!t.isArtboard&&e.layers.isEmptyGroup(t)})||i.size!==t.size&&i.size!==0},render:function(){var e=this.props.document,t=e?e.bounds:null,n=e?e.layers.selected:o.List(),i=e?e.layers.selectedChildBounds:o.List(),s=null,d=e.layers.hasArtboard,v=!e||this._disabled(e,n,i),m=n.map(function(e){return e.proportionalScaling});if(n.isEmpty()||v)v||(i=t&&!d?o.List.of(t):i),s=r.createElement(u,{size:"column-4"});else{var g="toggle-connected",y="toggle-disconnected";s=r.createElement(l,{size:"column-4",buttonType:y,title:c.TOOLTIPS.LOCK_PROPORTIONAL_TRANSFORM,selected:m,selectedButtonType:g,onClick:this._handleProportionChange})}var b=h.pluck(i,"width"),w=h.pluck(i,"height");return r.createElement("div",{className:"formline"},r.createElement(a,{title:c.TOOLTIPS.SET_WIDTH},c.TRANSFORM.W),r.createElement(u,null),r.createElement(f,{disabled:v,value:b,onChange:this._handleWidthChange,ref:"width",min:1,size:"column-5"}),s,r.createElement(a,{size:"column-1",title:c.TOOLTIPS.SET_HEIGHT},c.TRANSFORM.H),r.createElement(u,null),r.createElement(f,{value:w,disabled:v,onChange:this._handleHeightChange,ref:"height",min:1,max:p,size:"column-5"}),r.createElement(u,null))}});n.exports=d}),define("jsx!js/jsx/sections/transform/Position",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/Label","jsx!js/jsx/shared/NumberInput","i18n!nls/strings","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("jsx!js/jsx/shared/Gutter"),a=e("jsx!js/jsx/shared/Label"),f=e("jsx!js/jsx/shared/NumberInput"),l=e("i18n!nls/strings"),c=e("js/util/collection"),h=32768,p=-32768,d=r.createClass({displayName:"Position",mixins:[s],shouldComponentUpdate:function(e){var t=function(e){return e.document?e.document.layers.selectedChildBounds:null},n=function(e){if(!e.document)return null;var t=e.document.layers.selected;return c.pluckAll(t,["kind","locked","isBackground"])};return!o.is(t(this.props),t(e))||!o.is(n(this.props),n(e))},_handleLeftChange:function(e,t){var n=this.props.document;if(!n)return;this.getFlux().actions.transform.setPositionThrottled(n,n.layers.selected,{x:t})},_handleTopChange:function(e,t){var n=this.props.document;if(!n)return;this.getFlux().actions.transform.setPositionThrottled(n,n.layers.selected,{y:t})},_disabled:function(e,t){var n=e.layers,r=t.filter(function(e){return e.isArtboard});return e.unsupported||t.isEmpty()||t.some(function(t){var r=n.childBounds(t);return t.isBackground||t.kind===t.layerKinds.ADJUSTMENT||!r||r.empty||!t.isArtboard&&e.layers.isEmptyGroup(t)})||r.size!==t.size&&r.size!==0},render:function(){var e=this.props.document,t=e?e.layers.selected:o.List(),n=e?e.layers.selectedChildBounds:o.List(),i=!e||this._disabled(e,t),s=c.pluck(n,"top"),d=c.pluck(n,"left");return r.createElement("div",{className:"formline"},r.createElement(a,{title:l.TOOLTIPS.SET_X_POSITION},l.TRANSFORM.X),r.createElement(u,null),r.createElement(f,{disabled:i,value:d,onChange:this._handleLeftChange,ref:"left",min:p,max:h,size:"column-5"}),r.createElement(u,{size:"column-4"}),r.createElement(a,{title:l.TOOLTIPS.SET_Y_POSITION,size:"column-1"},l.TRANSFORM.Y),r.createElement(u,null),r.createElement(f,{disabled:i,value:s,onChange:this._handleTopChange,ref:"top",min:p,max:h,size:"column-5"}),r.createElement(u,null))}});n.exports=d}),define("jsx!js/jsx/sections/transform/Rotate",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/NumberInput","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("jsx!js/jsx/shared/NumberInput"),a=e("js/util/collection"),f=r.createClass({displayName:"Rotate",mixins:[s],propTypes:{document:r.PropTypes.object,layers:r.PropTypes.arrayOf(r.PropTypes.object)},_lastAngle:null,componentWillReceiveProps:function(){this.setState({undo:!1})},getInitialState:function(){return{undo:!1}},shouldComponentUpdate:function(e,t){if(t.undo)return!0;var n=function(e){return!e||e.empty},r=this.props.document,i=e.document,s=r?r.layers.selected:o.List(),u=i?i.layers.selected:o.List(),f=a.pluck(s,"id"),l=a.pluck(u,"id"),c=a.pluck(s,"bounds"),h=a.pluck(u,"bounds"),p=c.some(n)!==h.some(n);return!o.is(f,l)||p},componentWillUpdate:function(){this._lastAngle=0},_handleHistoryStateChange:function(){this.setState({undo:!0})},componentWillMount:function(){this.getFlux().store("history").on("change",this._handleHistoryStateChange)},componentWillUnmount:function(){this.getFlux().store("history").off("change",this._handleHistoryStateChange)},_rotateLayer:function(e,t){var n=this.props.document,r=t%360,i=r-this._lastAngle;i!==0&&this.getFlux().actions.transform.rotate(n,i),this._lastAngle=t},_disabled:function(e,t){var n=e.layers;return e.unsupported||t.isEmpty()||t.some(function(e){var t=n.childBounds(e);return e.isBackground||e.kind===e.layerKinds.ADJUSTMENT||!t||t.empty||e.isArtboard})||t.every(function(t){return e.layers.isEmptyGroup(t)})},render:function(){var e=this.props.document,t=e?e.layers.selected:o.List(),n=!e||this._disabled(e,t);return r.createElement(u,{disabled:n,value:n?"":"0",onChange:this._rotateLayer,step:1,bigstep:15,ref:"rotate",size:"column-3"})}});n.exports=f}),define("jsx!js/jsx/sections/transform/RotateFlip",["require","exports","module","react","fluxxor","immutable","jsx!./Rotate","jsx!js/jsx/shared/Label","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/SplitButton","i18n!nls/strings","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("jsx!./Rotate"),a=e("jsx!js/jsx/shared/Label"),f=e("jsx!js/jsx/shared/Gutter"),l=e("jsx!js/jsx/shared/SplitButton"),c=l.SplitButtonList,h=l.SplitButtonItem,p=e("i18n!nls/strings"),d=e("js/util/collection"),v=r.createClass({displayName:"RotateFlip",mixins:[s],propTypes:{document:r.PropTypes.object,layers:r.PropTypes.arrayOf(r.PropTypes.object)},shouldComponentUpdate:function(e){var t=this.props.document,n=e.document,r=t?t.layers.selected:o.List(),i=n?n.layers.selected:o.List(),s=d.pluckAll(r,["id","bounds"]),u=d.pluckAll(i,["id","bounds"]);return!o.is(s,u)},_flipX:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.flipX(e,t)},_flipY:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.flipY(e,t)},_swapLayers:function(){var e=this.props.document,t=e.layers.selected;this.getFlux().actions.transform.swapLayers(e,t)},_flipDisabled:function(e,t){var n=e.layers;return e.unsupported||t.isEmpty()||t.some(function(e){var t=n.childBounds(e);return e.isBackground||e.kind===e.layerKinds.ADJUSTMENT||!t||t.empty||e.isArtboard})||t.every(function(t){return e.layers.isEmptyGroup(t)})},_swapDisabled:function(e,t){return e.unsupported||t.size!==2||t.some(function(t){return!t.isArtboard&&e.layers.isEmptyGroup(t)})||t.first().isArtboard!==t.last().isArtboard},render:function(){var e=this.props.document,t=e?e.layers.selected:o.List(),n=e?e.layers.selectedNormalized:o.List(),i=!e||this._flipDisabled(e,t),s=i||this._swapDisabled(e,n);return r.createElement("div",{className:"formline"},r.createElement(a,{title:p.TOOLTIPS.SET_ROTATION},p.TRANSFORM.ROTATE),r.createElement(f,null),r.createElement(u,r.__spread({},this.props)),r.createElement(f,null),r.createElement(c,null,r.createElement(h,{title:p.TOOLTIPS.FLIP_HORIZONTAL,iconId:"flip-horizontal",selected:!1,disabled:i,onClick:this._flipX}),r.createElement(h,{title:p.TOOLTIPS.FLIP_VERTICAL,iconId:"flip-vertical",selected:!1,disabled:i,onClick:this._flipY}),r.createElement(h,{title:p.TOOLTIPS.SWAP_POSITION,iconId:"swap",selected:!1,disabled:s,onClick:this._swapLayers})),r.createElement(f,null))}});n.exports=v}),define("jsx!js/jsx/sections/transform/TransformPanel",["require","exports","module","react","jsx!./AlignDistribute","jsx!./Size","jsx!./Position","jsx!./RotateFlip"],function(e,t,n){"use strict";var r=e("react"),i=e("jsx!./AlignDistribute"),s=e("jsx!./Size"),o=e("jsx!./Position"),u=e("jsx!./RotateFlip"),a=r.createClass({displayName:"TransformPanel",render:function(){return r.createElement("section",{className:"transform section"},r.createElement("header",{className:"section-header"},r.createElement(i,r.__spread({},this.props))),r.createElement("div",{className:"section-container transform__body"},r.createElement(s,r.__spread({},this.props)),r.createElement(o,r.__spread({},this.props)),r.createElement(u,r.__spread({},this.props))))}});n.exports=a}),define("jsx!js/jsx/shared/TitleHeader",["require","exports","module","react","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("i18n!nls/strings"),s=r.createClass({displayName:"TitleHeader",mixins:[r.addons.PureRenderMixin],propTypes:{title:r.PropTypes.string.isRequired,visible:r.PropTypes.bool,onDoubleClick:r.PropTypes.func},render:function(){var e=this.props.title;return this.props.onDoubleClick&&!this.props.disabled&&(this.props.visible?e+=i.TOOLTIPS.SECTION_COLLAPSE:e+=i.TOOLTIPS.SECTION_EXPAND),r.createElement("header",{className:"section-header",onDoubleClick:this.props.onDoubleClick},r.createElement("div",{className:"section-title",title:e},r.createElement("h2",null,this.props.title),this.props.children))}});n.exports=s}),define("jsx!js/jsx/shared/TextInput",["require","exports","module","react","immutable","lodash","adapter/os","../mixin/Focusable","js/util/log"],function(e,t,n){"use strict";var r=e("react"),i=e("immutable"),s=e("lodash"),o=e("adapter/os"),u=e("../mixin/Focusable"),a=e("js/util/log"),f={simple:"column-4",percent:"column-3",degree:"column-3",color:"column-11",shadow:"column-9",radii:"column-3",size:"column-2",combo:"column-16 button-combo",smallCombo:"column-12 button-combo",mediumCombo:"column-14 button-combo"},l=r.createClass({displayName:"TextInput",mixins:[u],propTypes:{value:r.PropTypes.string.isRequired,onChange:r.PropTypes.func.isRequired,onDOMChange:r.PropTypes.func,onFocus:r.PropTypes.func,editable:r.PropTypes.bool},getDefaultProps:function(){return{value:"",onChange:s.identity,onDOMChange:s.identity,onFocus:s.identity,editable:!1,live:!1,continuous:!1}},getInitialState:function(){return{editing:!1,value:this.props.value,select:!1}},shouldComponentUpdate:function(e,t){return!i.is(this.props.value,e.value)||!i.is(this.state.value,t.value)||this.state.editing!==t.editing},componentWillReceiveProps:function(e){e.hasOwnProperty("value")&&this.setState({value:e.value});var t=this.refs.input.getDOMNode();window.document.activeElement===t&&t.selectionStart===0&&t.selectionEnd===t.value.length&&this.setState({select:!0})},componentDidUpdate:function(){if(this.state.select){var e=this.refs.input.getDOMNode();window.document.activeElement===e&&e.setSelectionRange(0,e.value.length),this.setState({select:!1})}},_handleChange:function(e){var t=e.target.value;this.setState({value:t,editing:!0,select:!1}),this.state.editing&&this.props.live&&this.props.continuous&&this.props.onChange(e,t),this.props.onDOMChange(e)},_releaseFocus:function(){o.releaseKeyboardFocus().bind(this).finally(function(){this.refs.input.getDOMNode().blur()}).catch(function(e){var t=e instanceof Error?e.stack||e.message:e;a.error("Failed to release keyboard focus:",t)})},_reset:function(e){this.setState({value:this.props.value,editing:!1,select:!0}),e.stopPropagation(),this._releaseFocus()},_commit:function(e){var t=e.target.value;this.setState({value:t,editing:!1}),e.stopPropagation(),this.props.onChange(e,t),this.state.editing?this.setState({select:!0}):this._releaseFocus()},_handleFocus:function(e){var t=this.refs.input.getDOMNode();t.selectionStart=0,t.selectionEnd=e.target.value.length,this.props.onFocus(e)},_handleBlur:function(e){this.state.editing&&this._commit(e,!0),this.props.onBlur&&this.props.onBlur(e)},_handleKeyDown:function(e){var t=e.key;switch(t){case"Escape":this._reset(e);break;case"Return":case"Enter":this._commit(e)}this.props.onKeyDown&&this.props.onKeyDown(e)},_beginEdit:function(){if(!this.props.editable)return;var e=this.refs.input.getDOMNode();e.removeAttribute("readOnly"),e.removeAttribute("disabled"),e.focus(),this.setState({editing:!0,select:!0}),this.acquireFocus()},_handleDoubleClick:function(e){this.props.singleClick||this._beginEdit(),this.props.onDoubleClick&&this.props.onDoubleClick(e)},_handleClick:function(e){this.props.singleClick&&this._beginEdit(),this.props.onClick&&this.props.onClick(e)},_handleMouseDown:function(e){e.stopPropagation()},render:function(){var e={};f.hasOwnProperty()&&(e[f[this.props.valueType]]=!0),this.props.className&&(e[this.props.className]=!0),this.props.size&&(e[this.props.size]=!0);var t=r.addons.classSet(e);return this.state.editing||this.props.live?r.createElement("input",r.__spread({},this.props,{type:"text",ref:"input",readOnly:!1,value:this.state.value,className:t,onChange:this._handleChange,onKeyDown:this._handleKeyDown,onFocus:this._handleFocus,onBlur:this._handleBlur,onPaste:this._handleChange,onMouseDown:this._handleMouseDown})):r.createElement("input",r.__spread({},this.props,{type:"text",tabIndex:"-1",ref:"input",value:this.state.value,disabled:"disabled",readOnly:!0,className:t,onDoubleClick:this._handleDoubleClick,onClick:this._handleClick}))},isEditing:function(){return this.state.editing||this.props.live}});n.exports=l}),define("jsx!js/jsx/shared/Select",["require","exports","module","react","immutable"],function(e,t,n){"use strict";var r=e("react"),i=e("immutable"),s=20,o=r.createClass({displayName:"Option",propTypes:{value:r.PropTypes.shape({id:r.PropTypes.string.isRequired,title:r.PropTypes.string.isRequired,style:r.PropTypes.object}).isRequired,selected:r.PropTypes.bool,next:r.PropTypes.string,prev:r.PropTypes.string},shouldComponentUpdate:function(e){return this.props.selected!==e.selected},render:function(){var e=this.props.value,t=e.id,n=e.style,i=r.addons.classSet({select__option:!0,select__option__selected:this.props.selected});return r.createElement("li",{"data-id":t,className:i,style:n},e.title)}}),u=r.createClass({displayName:"Select",propTypes:{options:r.PropTypes.instanceOf(i.Iterable).isRequired,defaultSelected:r.PropTypes.string,sorted:r.PropTypes.bool},shouldComponentUpdate:function(e,t){return this.state.mounted!==t.mounted||this.state.selected!==t.selected||!i.is(this.props.options,e.options)},_findIndex:function(e,t){if(!this.props.sorted)return e.findIndex(function(e){return e.id===t});if(e.isEmpty())return-1;var n=e.size,r=0,i=n,s=Math.floor(i/2),o;while(r<s&&s<i){o=e.get(s).id;if(o<t)r=s,s+=Math.floor((i-s)/2);else{if(!(o>t))return s;i=s,s=r+Math.floor((s-r)/2)}}return-1},componentWillReceiveProps:function(e){var t=this.state.selected,n=this._findIndex(e.options,t);n===-1&&!e.options.isEmpty()&&this._setSelected(e.options.get(0).id)},getDefaultProps:function(){return{defaultSelected:null,onChange:function(){}}},getInitialState:function(){return{mounted:!1,selected:this.props.defaultSelected}},_setSelected:function(e){e!==this.state.selected&&(this.setState({selected:e}),this.props.onChange(e))},_setSelectedFromMouseEvent:function(e){var t=e.target,n=t.attributes["data-id"];n&&n.value&&this._setSelected(n.value)},_selectNextPrev:function(e,t){var n=this.state.selected;if(!n){n=this.props.options.get(t).id,this._setSelected(n),this._scrollTo(n);return}var r=this.refs[n];if(!r){n=this.props.options.get(t).id,this._setSelected(n),this._scrollTo(n);return}var i=r.props[e];if(!i)return;this._setSelected(i)},selectNext:function(){return this._selectNextPrev("next",0)},selectPrev:function(){return this._selectNextPrev("prev",this.props.options.size-1)},close:function(e){this.props.onClose(e)},_handleClick:function(e){this._setSelectedFromMouseEvent(e),this.props.onClose(e),this.props.onClick&&this.props.onClick(e)},_currentClientX:null,_currentClientY:null,_handleMouseMove:function(e){if(e.clientX!==this._currentClientX||e.clientY!==this._currentClientY)this._currentClientX=e.clientX,this._currentClientY=e.clientY,this._setSelectedFromMouseEvent(e);this.props.onMouseMove&&this.props.onMouseMove(e)},_getOptions:function(){var e=!this.state.mounted;if(!e)return this.props.options;var t=this.state.selected;if(!t)return this.props.options;var n=this._findIndex(this.props.options,t);if(n<0)return this.props.options;var r=this.props.options.size,i=Math.round(s/2),o,u;return n<i?(o=0,u=Math.min(s,r)):r-i<n?(o=Math.max(0,r-i),u=r):(o=n-i,u=n+i),this.props.options.slice(o,u)},render:function(){var e=this.state.selected,t=this._getOptions(),n=t.size,i=t.map(function(i,s){var u=i.id,a=u===e,f=s+1<n?t.get(s+1).id:null,l=s>0?t.get(s-1).id:null;return r.createElement(o,{ref:u,key:u,value:i,selected:a,next:f,prev:l})},this);return r.createElement("ul",r.__spread({},this.props,{className:"select",onClick:this._handleClick,onMouseMove:this._handleMouseMove}),i.toArray())},_scrollToIfNeeded:function(e){if(!e)return;var t=this.refs[e];if(!t)return;var n=t.getDOMNode(),r=n.getBoundingClientRect(),i=r.top,s=r.bottom,o=n.offsetParent,u=o.offsetTop,a=u+o.offsetHeight;i<u?n.offsetParent.scrollTop=n.offsetTop:a<Math.round(s)&&(n.offsetParent.scrollTop=n.offsetTop-n.offsetParent.offsetHeight+n.offsetHeight)},_scrollTo:function(e){if(!e)return;var t=this.refs[e];if(!t)return;var n=t.getDOMNode();n.offsetParent.scrollTop=n.offsetTop-n.offsetParent.offsetHeight/2+n.offsetHeight/2},componentDidMount:function(){window.setTimeout(function(){this.isMounted()&&this.setState({mounted:!0})}.bind(this),100),this._scrollTo(this.state.selected)},componentDidUpdate:function(e,t){this.state.mounted&&(t.mounted?this.state.selected&&this._scrollToIfNeeded(this.state.selected):this._scrollTo(this.state.selected))}});n.exports=u}),define("jsx!js/jsx/shared/Dialog",["require","exports","module","react","fluxxor","adapter/os","lodash","js/util/math"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=i.StoreWatchMixin,u=e("adapter/os"),a=e("lodash"),f=e("js/util/math"),l={CENTER:"center",TARGET:"target"},c=r.createClass({displayName:"Dialog",mixins:[s,o("dialog")],propTypes:{id:r.PropTypes.string.isRequired,onOpen:r.PropTypes.func,onClose:r.PropTypes.func,disabled:r.PropTypes.bool,modal:r.PropTypes.bool,className:r.PropTypes.string,position:r.PropTypes.string,dismissOnDialogOpen:r.PropTypes.bool,dismissOnDocumentChange:r.PropTypes.bool,dismissOnSelectionTypeChange:r.PropTypes.bool,dismissOnWindowClick:r.PropTypes.bool,dismissOnWindowResize:r.PropTypes.bool,dismissOnCanvasClick:r.PropTypes.bool,dismissOnKeys:r.PropTypes.arrayOf(r.PropTypes.object)},getDefaultProps:function(){return{onOpen:a.identity,onClose:a.identity,disabled:!1,modal:!1,position:l.TARGET,dismissOnDialogOpen:!0,dismissOnDocumentChange:!0,dismissOnSelectionTypeChange:!1,dismissOnWindowClick:!0,dismissOnWindowResize:!0,dismissOnCanvasClick:!1}},statics:{POSITION_METHODS:l},getStateFromFlux:function(){var e=this.getFlux(),t=e.store("dialog"),n=t.getState(),r=n.openDialogs;return{open:r.has(this.props.id)}},componentWillMount:function(){this.getFlux().actions.dialog.registerDialog(this.props.id,this._getDismissalPolicy())},_getDismissalPolicy:function(){return{dialogOpen:this.props.dismissOnDialogOpen,documentChange:this.props.dismissOnDocumentChange,selectionTypeChange:this.props.dismissOnSelectionTypeChange}},toggle:function(e){var t=this.getFlux(),n=this.props.id;this.state.open?t.actions.dialog.closeDialog(n):this.props.disabled||(this.setState({target:e.target}),t.actions.dialog.openDialog(n,this._getDismissalPolicy())),e.stopPropagation()},_handleWindowClick:function(e){if(!this.state.open)return;var t=this.getDOMNode();if(!t)return;var n=t.getBoundingClientRect();if(n.left<=e.x&&e.x<=n.right&&n.top<=e.y&&e.y<=n.bottom)return;this.toggle(e)},_handleWindowResize:function(e){window.removeEventListener("resize",this._handleWindowResize),this.toggle(e)},_positionDialog:function(e){if(this.props.position===l.TARGET){if(!this.state.target)throw new Error("Could not determine target by which to render this dialog: "+this.displayName());var t=e.getBoundingClientRect(),n=window.document.documentElement.clientHeight,r=window.getComputedStyle(e),i=f.pixelDimensionToNumber(r.marginTop),s=f.pixelDimensionToNumber(r.marginBottom),o=this.state.target.getBoundingClientRect(),u=o.bottom,a=u+t.height;a>n&&(t.height+i+s<o.top?u=o.top-t.height-i-s:u=n-t.height-i-s),e.style.top=u+"px"}},_addListeners:function(){this.props.dismissOnWindowClick?window.addEventListener("click",this._handleWindowClick):this.props.dismissOnCanvasClick&&u.once(u.eventKind.EXTERNAL_MOUSE_DOWN,this.toggle),this.props.dismissOnWindowResize&&window.addEventListener("resize",this._handleWindowResize);if(this.props.dismissOnKeys&&a.isArray(this.props.dismissOnKeys)){var e=this.getFlux();this.props.dismissOnKeys.forEach(function(t){e.actions.shortcuts.addShortcut(t.key,t.modifiers||{},this.toggle,this.props.id+t.key,!0)},this)}},_removeListeners:function(){this.props.dismissOnWindowClick&&window.removeEventListener("click",this._handleWindowClick),this.props.dismissOnWindowResize&&window.removeEventListener("resize",this._handleWindowResize);if(this.props.dismissOnKeys&&a.isArray(this.props.dismissOnKeys)){var e=this.getFlux();this.props.dismissOnKeys.forEach(function(t){e.actions.shortcuts.removeShortcut(this.props.id+t.key)},this)}},render:function(){var e,t=this.props.position===l.CENTER?"dialog__center":"dialog__target",n=r.addons.classSet(t,this.props.className||""),i={className:n};return this.state.open?(this.props.modal||(i.open=!0),e=this.props.children):e=null,r.createElement("dialog",r.__spread({},i),e)},componentDidUpdate:function(e,t){var n=this.getDOMNode();this.state.open&&!t.open?(this.props.modal&&n.showModal(),this._addListeners(),this._positionDialog(n),this.props.onOpen()):!this.state.open&&t.open&&(this._removeListeners(),this.props.modal&&n.open&&n.close(),this.props.onClose())},componentWillUnmount:function(){this.state.open&&(this._removeListeners(),this.getFlux().actions.dialog.closeDialog(this.props.id)),this.getFlux().actions.dialog.deregisterDialog(this.props.id)},isOpen:function(){return this.state.open}});n.exports=c}),define("jsx!js/jsx/shared/Datalist",["require","exports","module","react","immutable","lodash","jsx!js/jsx/shared/TextInput","jsx!js/jsx/shared/Select","jsx!js/jsx/shared/Dialog"],function(e,t,n){"use strict";var r=e("react"),i=e("immutable"),s=e("lodash"),o=e("jsx!js/jsx/shared/TextInput"),u=e("jsx!js/jsx/shared/Select"),a=e("jsx!js/jsx/shared/Dialog"),f=r.createClass({displayName:"Datalist",propTypes:{options:r.PropTypes.instanceOf(i.Iterable)},getDefaultProps:function(){return{onChange:s.identity,defaultSelected:null}},getInitialState:function(){return{active:!1,filter:null,id:this.props.defaultSelected}},_handleInputClick:function(e){if(this.props.disabled)return;this.state.active||this.setState({active:!0,filter:null});var t=this.refs.dialog;if(!t)return;t.isOpen()?e.stopPropagation():t.toggle(e)},_handleInputFocus:function(e){var t=this.refs.select;t||this.state.active||this.setState({active:!0,filter:null}),this.props.onFocus&&this.props.onFocus(e)},_handleInputBlur:function(e){var t=this.refs.dialog;if(!t)return;t.isOpen()&&t.toggle(e)},_handleInputKeyDown:function(e){var t=this.refs.dialog,n=this.refs.select;if(!n)switch(e.key){case"Escape":return;case"Enter":case"Return":case"Space":case"ArrowUp":case"ArrowDown":this._handleInputClick(e);return}switch(e.key){case"ArrowUp":n.selectPrev(),e.stopPropagation();break;case"ArrowDown":n.selectNext(),e.stopPropagation();break;case"Enter":case"Return":case"Space":case"Escape":n.close(e),t&&t.isOpen()&&t.toggle(e)}this.props.onKeyDown&&this.props.onKeyDown(e)},_handleSelectChange:function(e){this.setState({id:e}),this.props.onChange(e)},_handleSelectClose:function(e){var t=this.refs.dialog;t&&t.isOpen()&&t.toggle(e),this.setState({active:!1})},_handleDialogClose:function(){this.setState({active:!1})},_handleInputChange:function(e,t){this.setState({filter:t})},_handleInputDOMChange:function(e){var t=this.refs.select;t||this._handleInputClick(e)},render:function(){var e=this.props.value||"",t=this.state.filter,n=this.state.active&&t!==null?t:e,i=t?t.toLowerCase():"",s=this.props.options,f=s&&s.filter(function(e){return e.title.toLowerCase().indexOf(i)>-1&&e.hidden!==!0}),l=f&&r.createElement(a,{ref:"dialog",id:"datalist-"+this.props.list,className:this.props.className,onClose:this._handleDialogClose},r.createElement(u,{ref:"select",options:f,defaultSelected:this.props.defaultSelected,sorted:this.props.sorted,onChange:this._handleSelectChange,onClose:this._handleSelectClose}));return r.createElement("div",{className:"drop-down"},r.createElement(o,{disabled:this.props.disabled,editable:!this.props.disabled,size:this.props.size,live:!0,continuous:!0,value:n,onFocus:this._handleInputFocus,onBlur:this._handleInputBlur,onKeyDown:this._handleInputKeyDown,onChange:this._handleInputChange,onDOMChange:this._handleInputDOMChange,onClick:this._handleInputClick}),l)}});n.exports=f}),define("jsx!js/jsx/sections/style/BlendMode",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/Datalist","i18n!nls/strings","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("jsx!js/jsx/shared/Datalist"),a=e("i18n!nls/strings"),f=e("js/util/collection"),l=o.OrderedMap({normal:{id:"normal",title:a.STYLE.BLEND.NORMAL},dissolve:{id:"dissolve",title:a.STYLE.BLEND.DISSOLVE},darken:{id:"darken",title:a.STYLE.BLEND.DARKEN},lighten:{id:"lighten",title:a.STYLE.BLEND.LIGHTEN},screen:{id:"screen",title:a.STYLE.BLEND.SCREEN},overlay:{id:"overlay",title:a.STYLE.BLEND.OVERLAY},multiply:{id:"multiply",title:a.STYLE.BLEND.MULTIPLY},colorBurn:{id:"colorBurn",title:a.STYLE.BLEND.COLORBURN},linearBurn:{id:"linearBurn",title:a.STYLE.BLEND.LINEARBURN},darkerColor:{id:"darkerColor",title:a.STYLE.BLEND.DARKERCOLOR},passThrough:{id:"passThrough",title:a.STYLE.BLEND.PASSTHROUGH},colorDodge:{id:"colorDodge",title:a.STYLE.BLEND.COLORDODGE,hidden:!0},linearDodge:{id:"linearDodge",title:a.STYLE.BLEND.LINEARDODGE,hidden:!0},lighterColor:{id:"lighterColor",title:a.STYLE.BLEND.LIGHTERCOLOR,hidden:!0},softLight:{id:"softLight",title:a.STYLE.BLEND.SOFTLIGHT,hidden:!0},hardLight:{id:"hardLight",title:a.STYLE.BLEND.HARDLIGHT,hidden:!0},vividLight:{id:"vividLight",title:a.STYLE.BLEND.VIVIDLIGHT,hidden:!0},linearLight:{id:"linearLight",title:a.STYLE.BLEND.LINEARLIGHT,hidden:!0},pinLight:{id:"pinLight",title:a.STYLE.BLEND.PINLIGHT,hidden:!0},hardMix:{id:"hardMix",title:a.STYLE.BLEND.HARDMIX,hidden:!0},difference:{id:"difference",title:a.STYLE.BLEND.DIFFERENCE,hidden:!0},exclusion:{id:"exclusion",title:a.STYLE.BLEND.EXCLUSION,hidden:!0},blendSubtraction:{id:"blendSubtraction",title:a.STYLE.BLEND.SUBTRACT,hidden:!0},blendDivide:{id:"blendDivide",title:a.STYLE.BLEND.DIVIDE,hidden:!0},hue:{id:"hue",title:a.STYLE.BLEND.HUE,hidden:!0},saturation:{id:"saturation",title:a.STYLE.BLEND.SATURATION,hidden:!0},color:{id:"color",title:a.STYLE.BLEND.COLOR,hidden:!0},luminosity:{id:"luminosity",title:a.STYLE.BLEND.LUMINOSITY,hidden:!0}}),c=r.createClass({displayName:"BlendMode",mixins:[s],shouldComponentUpdate:function(e){var t=function(e){return f.pluckAll(e.layers,["id","blendMode"])};return!o.is(t(this.props),t(e))},getDefaultProps:function(){return{id:"main"}},_handleChange:function(e){this.getFlux().actions.layers.setBlendModeThrottled(this.props.document,this.props.layers,e)},render:function(){var e=this.props.layers,t=f.pluck(e,"blendMode"),n=f.uniformValue(t),i=l.has(n)?l.get(n).title:t.size>1?a.TRANSFORM.MIXED:n,s=e.every(function(e){return e.kind===e.layerKinds.GROUP}),o=l.update("passThrough",function(e){return e.hidden=!s,e}).toList();return this.props.disabled&&(i=null),r.createElement(u,{list:"blendmodes-"+this.props.id,disabled:this.props.disabled,className:"dialog-blendmodes",options:o,value:i,defaultSelected:n,size:"column-9",onChange:this._handleChange,onFocus:this.props.onFocus})}});n.exports=c}),define("jsx!js/jsx/sections/style/Opacity",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/NumberInput","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("jsx!js/jsx/shared/NumberInput"),a=e("js/util/collection"),f=r.createClass({displayName:"Opacity",mixins:[s],shouldComponentUpdate:function(e){var t=function(e){return a.pluckAll(e.layers,["id","opacity"])};return!o.is(t(this.props),t(e))},_handleOpacityChange:function(e,t){this.getFlux().actions.layers.setOpacityThrottled(this.props.document,this.props.layers,t)},render:function(){var e=a.pluck(this.props.layers,"opacity");return r.createElement(u,{value:e,onChange:this._handleOpacityChange,onFocus:this.props.onFocus,min:0,max:100,disabled:this.props.disabled,size:"column-4"})}});n.exports=f}),define("jsx!js/jsx/sections/style/Blend",["require","exports","module","react","immutable","jsx!./BlendMode","jsx!./Opacity","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/Label","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("immutable"),s=e("jsx!./BlendMode"),o=e("jsx!./Opacity"),u=e("jsx!js/jsx/shared/Gutter"),a=e("jsx!js/jsx/shared/Label"),f=e("i18n!nls/strings"),l=r.createClass({displayName:"Blend",shouldComponentUpdate:function(e){return!i.is(this.props.document.layers,e.document.layers)},render:function(){var e=this.props.document.layers.selected.filterNot(function(e){return e.isBackground});return e.isEmpty()?null:r.createElement("div",{className:"formline"},r.createElement(a,{title:f.TOOLTIPS.SET_OPACITY},f.STYLE.OPACITY),r.createElement(u,null),r.createElement(o,r.__spread({},this.props,{layers:e})),r.createElement(u,null),r.createElement(s,r.__spread({},this.props,{layers:e})),r.createElement(u,{size:"column-2"}))}});n.exports=l}),define("jsx!js/jsx/sections/style/Combine",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/Label","jsx!js/jsx/shared/SplitButton","i18n!nls/strings","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor").FluxMixin(r),s=e("immutable"),o=e("jsx!js/jsx/shared/Gutter"),u=e("jsx!js/jsx/shared/Label"),a=e("jsx!js/jsx/shared/SplitButton"),f=a.SplitButtonList,l=a.SplitButtonItem,c=e("i18n!nls/strings"),h=e("js/util/collection"),p=r.createClass({displayName:"Combine",mixins:[i],propTypes:{document:r.PropTypes.object.isRequired,layers:r.PropTypes.instanceOf(s.Iterable).isRequired},shouldComponentUpdate:function(e){var t=function(e){return h.pluckAll(e.document.layers.selected,["id"])};return!s.is(t(this.props),t(e))},_combineUnion:function(){this.getFlux().actions.shapes.combineUnion(this.props.document,this.props.layers)},_combineSubtract:function(){this.getFlux().actions.shapes.combineSubtract(this.props.document,this.props.layers)},_combineIntersect:function(){this.getFlux().actions.shapes.combineIntersect(this.props.document,this.props.layers)},_combineDifference:function(){this.getFlux().actions.shapes.combineDifference(this.props.document,this.props.layers)},render:function(){return this.props.document.layers.selected.size!==this.props.layers.size?null:r.createElement("div",{className:"formline vector-operations"},r.createElement(u,{title:c.TOOLTIPS.SET_COMBINATION},c.STYLE.VECTOR.COMBINE),r.createElement(o,null),r.createElement(f,null,r.createElement(l,{iconId:"xor-union",disabled:this.props.disabled,onClick:this._combineUnion,onFocus:this.props.onFocus,title:c.TOOLTIPS.UNITE_SHAPE}),r.createElement(l,{iconId:"xor-subtract",disabled:this.props.disabled,onClick:this._combineSubtract,onFocus:this.props.onFocus,title:c.TOOLTIPS.SUBTRACT_SHAPE}),r.createElement(l,{iconId:"xor-intersect",disabled:this.props.disabled,onClick:this._combineIntersect,onFocus:this.props.onFocus,title:c.TOOLTIPS.INTERSECT_SHAPE}),r.createElement(l,{iconId:"xor-difference",disabled:this.props.disabled,onClick:this._combineDifference,onFocus:this.props.onFocus,title:c.TOOLTIPS.DIFFERENCE_SHAPE})),r.createElement(o,null))}});n.exports=p}),define("jsx!js/jsx/shared/Range",["require","exports","module","react","immutable","js/util/collection","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("immutable"),s=e("js/util/collection"),o=e("i18n!nls/strings"),u=r.createClass({displayName:"Range",propTypes:{disabled:r.PropTypes.bool,min:r.PropTypes.number,max:r.PropTypes.number,value:r.PropTypes.oneOfType([r.PropTypes.number,r.PropTypes.instanceOf(i.Iterable)]),onChange:r.PropTypes.func},getDefaultProps:function(){return{disabled:!1}},shouldComponentUpdate:function(e){return this.props.disabled!==e.disabled||this.props.min!==e.min||this.props.max!==e.max||!i.is(this.props.value,e.value)},_handleMouseUp:function(e){this.refs.range.getDOMNode().blur(),this.props.onMouseUp&&this.props.onMouseUp(e)},render:function(){var e=this.props.value,t=this.props.size||"column-9";return t+=" range",i.Iterable.isIterable(e)&&(e=s.uniformValue(e)||0),r.createElement("div",{title:o.TOOLTIPS.SET_RADIUS_SLIDER,className:t},r.createElement("input",r.__spread({},this.props,{ref:"range",onMouseUp:this._handleMouseUp,tabIndex:"-1",type:"range",value:e})))},componentDidUpdate:function(e){if(this.props.max!==e.max){var t=this.refs.range.getDOMNode(),n=t.nextSibling,r=t.parentNode;r.removeChild(t),n?r.insertBefore(t,n):r.appendChild(t)}}});n.exports=u}),define("js/jsx/mixin/Coalesce",["require","exports","module"],function(e,t,n){"use strict";n.exports={_coalescing:!1,_coalesce:!1,startCoalescing:function(){this._coalescing=!0,this._coalesce=!1},stopCoalescing:function(){this._coalescing=!1},shouldCoalesce:function(){var e=this._coalescing?this._coalesce:!1;return this._coalescing&&!e&&(this._coalesce=!0),e}}}),define("jsx!js/jsx/sections/style/Radius",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/Label","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/NumberInput","jsx!js/jsx/shared/Range","js/jsx/mixin/Coalesce","js/util/math","i18n!nls/strings","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("jsx!js/jsx/shared/Label"),a=e("jsx!js/jsx/shared/Gutter"),f=e("jsx!js/jsx/shared/NumberInput"),l=e("jsx!js/jsx/shared/Range"),c=e("js/jsx/mixin/Coalesce"),h=e("js/util/math"),p=e("i18n!nls/strings"),d=e("js/util/collection"),v=r.createClass({displayName:"Radius",mixins:[s,c],propTypes:{document:r.PropTypes.object.isRequired,layers:r.PropTypes.instanceOf(o.Iterable).isRequired},shouldComponentUpdate:function(e){var t=function(e){var t=e.layers;return d.pluckAll(t,["id","bounds","radii"])};return!o.is(t(this.props),t(e))},_handleRadiusChange:function(e,t,n){n===undefined&&(n=h.parseNumber(t.target.value));var r=this.shouldCoalesce();this.getFlux().actions.transform.setRadiusThrottled(this.props.document,e,n,r)},render:function(){var e=this.props.layers.filter(function(e){return e.radii});if(e.isEmpty())return null;var t=d.pluck(e,"radii").map(function(e){return e.scalar||0}),n=d.pluck(e,"bounds").toSeq().filter(function(e){return!!e}).reduce(function(e,t){return e.concat(o.List.of(t.width/2,t.height/2))},o.List()).min();return r.createElement("div",{className:"formline"},r.createElement(u,{title:p.TOOLTIPS.SET_RADIUS},p.TRANSFORM.RADIUS),r.createElement(a,null),r.createElement(f,{size:"column-4",disabled:this.props.disabled,value:t,onChange:this._handleRadiusChange.bind(this,e)}),r.createElement(a,null),r.createElement(l,{disabled:this.props.disabled,min:0,max:n,value:t,onMouseDown:this.startCoalescing,onMouseUp:this.stopCoalescing,onChange:this._handleRadiusChange.bind(this,e)}),r.createElement(a,null))}});n.exports=v}),define("jsx!js/jsx/sections/style/Vector",["require","exports","module","react","jsx!js/jsx/shared/Gutter","i18n!nls/strings","jsx!./Combine","jsx!./Radius"],function(e,t,n){"use strict";var r=e("react"),i=e("jsx!js/jsx/shared/Gutter"),s=e("i18n!nls/strings"),o=e("jsx!./Combine"),u=e("jsx!./Radius"),a=r.createClass({displayName:"Vector",render:function(){var e=this.props.document.layers.selected.filter(function(e){return e.kind===e.layerKinds.VECTOR});return e.isEmpty()?null:r.createElement("div",null,r.createElement("header",{className:"sub-header"},r.createElement("h3",null,s.STYLE.VECTOR.TITLE),r.createElement(i,null),r.createElement("hr",{className:"sub-header-rule"})),r.createElement(o,r.__spread({},this.props,{layers:e})),r.createElement(u,r.__spread({},this.props,{layers:e})))}});n.exports=a}),function(){function a(e,t){e=e?e:"",t=t||{};if(e instanceof a)return e;if(!(this instanceof a))return new a(e,t);var r=f(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=i(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=r.ok,this._tc_id=n++}function f(e){var t={r:0,g:0,b:0},n=1,r=!1,i=!1;return typeof e=="string"&&(e=W(e)),typeof e=="object"&&(e.hasOwnProperty("r")&&e.hasOwnProperty("g")&&e.hasOwnProperty("b")?(t=l(e.r,e.g,e.b),r=!0,i=String(e.r).substr(-1)==="%"?"prgb":"rgb"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("v")?(e.s=q(e.s),e.v=q(e.v),t=d(e.h,e.s,e.v),r=!0,i="hsv"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("l")&&(e.s=q(e.s),e.l=q(e.l),t=h(e.h,e.s,e.l),r=!0,i="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=D(n),{ok:r,format:e.format||i,r:s(255,o(t.r,0)),g:s(255,o(t.g,0)),b:s(255,o(t.b,0)),a:n}}function l(e,t,n){return{r:P(e,255)*255,g:P(t,255)*255,b:P(n,255)*255}}function c(e,t,n){e=P(e,255),t=P(t,255),n=P(n,255);var r=o(e,t,n),i=s(e,t,n),u,a,f=(r+i)/2;if(r==i)u=a=0;else{var l=r-i;a=f>.5?l/(2-r-i):l/(r+i);switch(r){case e:u=(t-n)/l+(t<n?6:0);break;case t:u=(n-e)/l+2;break;case n:u=(e-t)/l+4}u/=6}return{h:u,s:a,l:f}}function h(e,t,n){function o(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var r,i,s;e=P(e,360),t=P(t,100),n=P(n,100);if(t===0)r=i=s=n;else{var u=n<.5?n*(1+t):n+t-n*t,a=2*n-u;r=o(a,u,e+1/3),i=o(a,u,e),s=o(a,u,e-1/3)}return{r:r*255,g:i*255,b:s*255}}function p(e,t,n){e=P(e,255),t=P(t,255),n=P(n,255);var r=o(e,t,n),i=s(e,t,n),u,a,f=r,l=r-i;a=r===0?0:l/r;if(r==i)u=0;else{switch(r){case e:u=(t-n)/l+(t<n?6:0);break;case t:u=(n-e)/l+2;break;case n:u=(e-t)/l+4}u/=6}return{h:u,s:a,v:f}}function d(e,t,n){e=P(e,360)*6,t=P(t,100),n=P(n,100);var i=r.floor(e),s=e-i,o=n*(1-t),u=n*(1-s*t),a=n*(1-(1-s)*t),f=i%6,l=[n,u,o,o,a,n][f],c=[a,n,n,u,o,o][f],h=[o,o,a,n,n,u][f];return{r:l*255,g:c*255,b:h*255}}function v(e,t,n,r){var s=[I(i(e).toString(16)),I(i(t).toString(16)),I(i(n).toString(16))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0):s.join("")}function m(e,t,n,r){var s=[I(R(r)),I(i(e).toString(16)),I(i(t).toString(16)),I(i(n).toString(16))];return s.join("")}function g(e,t){t=t===0?0:t||10;var n=a(e).toHsl();return n.s-=t/100,n.s=H(n.s),a(n)}function y(e,t){t=t===0?0:t||10;var n=a(e).toHsl();return n.s+=t/100,n.s=H(n.s),a(n)}function b(e){return a(e).desaturate(100)}function w(e,t){t=t===0?0:t||10;var n=a(e).toHsl();return n.l+=t/100,n.l=H(n.l),a(n)}function E(e,t){t=t===0?0:t||10;var n=a(e).toRgb();return n.r=o(0,s(255,n.r-i(255*-(t/100)))),n.g=o(0,s(255,n.g-i(255*-(t/100)))),n.b=o(0,s(255,n.b-i(255*-(t/100)))),a(n)}function S(e,t){t=t===0?0:t||10;var n=a(e).toHsl();return n.l-=t/100,n.l=H(n.l),a(n)}function x(e,t){var n=a(e).toHsl(),r=(i(n.h)+t)%360;return n.h=r<0?360+r:r,a(n)}function T(e){var t=a(e).toHsl();return t.h=(t.h+180)%360,a(t)}function N(e){var t=a(e).toHsl(),n=t.h;return[a(e),a({h:(n+120)%360,s:t.s,l:t.l}),a({h:(n+240)%360,s:t.s,l:t.l})]}function C(e){var t=a(e).toHsl(),n=t.h;return[a(e),a({h:(n+90)%360,s:t.s,l:t.l}),a({h:(n+180)%360,s:t.s,l:t.l}),a({h:(n+270)%360,s:t.s,l:t.l})]}function k(e){var t=a(e).toHsl(),n=t.h;return[a(e),a({h:(n+72)%360,s:t.s,l:t.l}),a({h:(n+216)%360,s:t.s,l:t.l})]}function L(e,t,n){t=t||6,n=n||30;var r=a(e).toHsl(),i=360/n,s=[a(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,s.push(a(r));return s}function A(e,t){t=t||6;var n=a(e).toHsv(),r=n.h,i=n.s,s=n.v,o=[],u=1/t;while(t--)o.push(a({h:r,s:i,v:s})),s=(s+u)%1;return o}function _(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function D(e){e=parseFloat(e);if(isNaN(e)||e<0||e>1)e=1;return e}function P(e,t){j(e)&&(e="100%");var n=F(e);return e=s(t,o(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),r.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function H(e){return s(1,o(0,e))}function B(e){return parseInt(e,16)}function j(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function F(e){return typeof e=="string"&&e.indexOf("%")!=-1}function I(e){return e.length==1?"0"+e:""+e}function q(e){return e<=1&&(e=e*100+"%"),e}function R(e){return Math.round(parseFloat(e)*255).toString(16)}function U(e){return B(e)/255}function W(n){n=n.replace(e,"").replace(t,"").toLowerCase();var r=!1;if(O[n])n=O[n],r=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=z.rgb.exec(n))?{r:i[1],g:i[2],b:i[3]}:(i=z.rgba.exec(n))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=z.hsl.exec(n))?{h:i[1],s:i[2],l:i[3]}:(i=z.hsla.exec(n))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=z.hsv.exec(n))?{h:i[1],s:i[2],v:i[3]}:(i=z.hsva.exec(n))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=z.hex8.exec(n))?{a:U(i[1]),r:B(i[2]),g:B(i[3]),b:B(i[4]),format:r?"name":"hex8"}:(i=z.hex6.exec(n))?{r:B(i[1]),g:B(i[2]),b:B(i[3]),format:r?"name":"hex"}:(i=z.hex3.exec(n))?{r:B(i[1]+""+i[1]),g:B(i[2]+""+i[2]),b:B(i[3]+""+i[3]),format:r?"name":"hex"}:!1}var e=/^[\s,#]+/,t=/\s+$/,n=0,r=Math,i=r.round,s=r.min,o=r.max,u=r.random;a.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},setAlpha:function(e){return this._a=D(e),this._roundA=i(100*this._a)/100,this},toHsv:function(){var e=p(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=p(this._r,this._g,this._b),t=i(e.h*360),n=i(e.s*100),r=i(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=c(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=c(this._r,this._g,this._b),t=i(e.h*360),n=i(e.s*100),r=i(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return v(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return m(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(P(this._r,255)*100)+"%",g:i(P(this._g,255)*100)+"%",b:i(P(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+i(P(this._r,255)*100)+"%, "+i(P(this._g,255)*100)+"%, "+i(P(this._b,255)*100)+"%)":"rgba("+i(P(this._r,255)*100)+"%, "+i(P(this._g,255)*100)+"%, "+i(P(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:M[v(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+m(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var i=a(e);n=i.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,i=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="name");if(i)return e==="name"&&this._a===0?this.toName():this.toRgbString();e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString());if(e==="hex"||e==="hex6")n=this.toHexString();return e==="hex3"&&(n=this.toHexString(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString()},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(w,arguments)},brighten:function(){return this._applyModification(E,arguments)},darken:function(){return this._applyModification(S,arguments)},desaturate:function(){return this._applyModification(g,arguments)},saturate:function(){return this._applyModification(y,arguments)},greyscale:function(){return this._applyModification(b,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(L,arguments)},complement:function(){return this._applyCombination(T,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(N,arguments)},tetrad:function(){return this._applyCombination(C,arguments)}},a.fromRatio=function(e,t){if(typeof e=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=q(e[r]));e=n}return a(e,t)},a.equals=function(e,t){return!e||!t?!1:a(e).toRgbString()==a(t).toRgbString()},a.random=function(){return a.fromRatio({r:u(),g:u(),b:u()})},a.mix=function(e,t,n){n=n===0?0:n||50;var r=a(e).toRgb(),i=a(t).toRgb(),s=n/100,o=s*2-1,u=i.a-r.a,f;o*u==-1?f=o:f=(o+u)/(1+o*u),f=(f+1)/2;var l=1-f,c={r:i.r*f+r.r*l,g:i.g*f+r.g*l,b:i.b*f+r.b*l,a:i.a*s+r.a*(1-s)};return a(c)},a.readability=function(e,t){var n=a(e),r=a(t),i=n.toRgb(),s=r.toRgb(),o=n.getBrightness(),u=r.getBrightness(),f=Math.max(i.r,s.r)-Math.min(i.r,s.r)+Math.max(i.g,s.g)-Math.min(i.g,s.g)+Math.max(i.b,s.b)-Math.min(i.b,s.b);return{brightness:Math.abs(o-u),color:f}},a.isReadable=function(e,t){var n=a.readability(e,t);return n.brightness>125&&n.color>500},a.mostReadable=function(e,t){var n=null,r=0,i=!1;for(var s=0;s<t.length;s++){var o=a.readability(e,t[s]),u=o.brightness>125&&o.color>500,f=3*(o.brightness/125)+o.color/500;if(u&&!i||u&&i&&f>r||!u&&!i&&f>r)i=u,r=f,n=a(t[s])}return n};var O=a.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},M=a.hexNames=_(O),z=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();typeof module!="undefined"&&module.exports?module.exports=a:typeof define=="function"&&define.amd?define("tinycolor",[],function(){return a}):window.tinycolor=a}(),define("js/models/color",["require","exports","module","immutable","mathjs","js/util/object","js/util/math"],function(e,t,n){"use strict";var r=e("immutable"),i=e("mathjs"),s=e("js/util/object"),o=e("js/util/math"),u=r.Record({r:0,g:0,b:0,a:1});u.DEFAULT=new u,u.fromPhotoshopColorObj=function(e,t){return new u({r:e.red,g:e.grain,b:e.blue,a:t?i.round(t/100,4):1})},u.fromTinycolor=function(e){return new u(e.toRgb())},Object.defineProperties(u.prototype,s.cachedGetSpecs({opacity:function(){return i.round(this.a*100,0)}})),u.prototype.setAlpha=function(e){return e instanceof u&&(e=e.a),this.set("a",e)},u.prototype.setOpaque=function(e){return this.merge({r:e.r,g:e.g,b:e.b})},u.prototype.normalizeAlpha=function(){return this.set("a",o.normalize(this.a,255))},u.prototype.setOpacity=function(e){return this.setAlpha(i.round(e/100,4))},u.prototype.opaque=function(){return this.delete("a")},n.exports=u}),define("jsx!js/jsx/shared/ColorPicker",["require","exports","module","react","tinycolor","immutable","lodash","js/models/color","js/util/math"],function(e,t,n){"use strict";var r=e("react"),i=r.addons.PureRenderMixin,s=r.addons.classSet,o=e("tinycolor"),u=e("immutable"),a=e("lodash"),f=e("js/models/color"),l=e("js/util/math"),c=u.Record({h:0,s:0,v:0,a:1}),h={propTypes:{onChange:r.PropTypes.func,max:r.PropTypes.number},getDefaultProps:function(){return{onChange:a.identity,max:1}},getInitialState:function(){return{active:!1}},componentDidMount:function(){window.document.addEventListener("mousemove",this._handleUpdate),window.document.addEventListener("touchmove",this._handleUpdate),window.document.addEventListener("mouseup",this._stopUpdates),window.document.addEventListener("touchend",this._stopUpdates)},componentWillUnmount:function(){window.document.removeEventListener("mousemove",this._handleUpdate),window.document.removeEventListener("touchmove",this._handleUpdate),window.document.removeEventListener("mouseup",this._stopUpdates),window.document.removeEventListener("touchend",this._stopUpdates)},_suppressClick:function(e){e.stopPropagation(),window.removeEventListener("click",this._suppressClick,!0)},_startUpdates:function(e){e.stopPropagation();var t=this._getPosition(e);this.setState({active:!0}),this._updatePosition(t.x,t.y),window.addEventListener("click",this._suppressClick,!0)},_handleUpdate:function(e){if(this.state.active){e.stopPropagation();var t=this._getPosition(e);this._updatePosition(t.x,t.y)}},_stopUpdates:function(){this.state.active&&this.setState({active:!1})},_getPosition:function(e){return e.touches&&(e=e.touches[0]),{x:e.clientX,y:e.clientY}},_getPercentageValue:function(e){return e/this.props.max*100+"%"},_getScaledValue:function(e){return l.clamp(e,0,1)*this.props.max}},p=r.createClass({displayName:"Slider",mixins:[h,i],propTypes:{vertical:r.PropTypes.bool.isRequired,value:r.PropTypes.number.isRequired,hue:r.PropTypes.number},getDefaultProps:function(){return{value:0}},_updatePosition:function(e,t){var n=this.getDOMNode().getBoundingClientRect(),r;this.props.vertical?r=(n.bottom-t)/n.height:r=(e-n.left)/n.width,r=this._getScaledValue(r),this.props.onChange(r)},_getSliderPositionCss:function(){var e={},t=this.props.vertical?"bottom":"left";return e[t]=this._getPercentageValue(this.props.value),e},_handleMouseDown:function(e){this.props.onMouseDown&&this.props.onMouseDown(e),this._startUpdates(e)},_handleMouseUp:function(e){this.props.onMouseUp&&this.props.onMouseUp(e)},render:function(){var e=s({"color-picker-slider":!0,"color-picker-slider__vertical":this.props.vertical,"color-picker-slider__horizontal":!this.props.vertical}),t;if(this.props.hasOwnProperty("hue")){var n=o({h:this.props.hue,s:1,v:1}).toHexString(),i="linear-gradient(to right, rgba(1, 1, 1, 0) 0%, "+n+" 100%)";t=r.createElement("div",{className:"color-picker-slider__track-overlay",style:{background:i}})}else t=null;return r.createElement("div",{className:e,onMouseUp:this._handleMouseUp,onMouseDown:this._handleMouseDown,onTouchStart:this._startUpdates},r.createElement("div",{className:"color-picker-slider__track"}),t,r.createElement("div",{className:"color-picker-slider__pointer",style:this._getSliderPositionCss()}))}}),d=r.createClass({displayName:"Map",mixins:[h,i],propTypes:{x:r.PropTypes.number,y:r.PropTypes.number,backgroundColor:r.PropTypes.string},getDefaultProps:function(){return{x:0,y:0,backgroundColor:"transparent"}},_updatePosition:function(e,t){var n=this.getDOMNode().getBoundingClientRect(),r=(e-n.left)/n.width,i=(n.bottom-t)/n.height;r=this._getScaledValue(r),i=this._getScaledValue(i),this.props.onChange(r,i)},_handleMouseDown:function(e){this.props.onMouseDown&&this.props.onMouseDown(e),this._startUpdates(e)},_handleMouseUp:function(e){this.props.onMouseUp&&this.props.onMouseUp(e)},render:function(){var e=s({"color-picker-map":!0,"color-picker-map__active":this.state.active});return r.createElement("div",{className:this.props.className+" "+e,onMouseUp:this._handleMouseUp,onMouseDown:this._handleMouseDown,onTouchStart:this._startUpdates},r.createElement("div",{className:"color-picker-map__background",style:{backgroundColor:this.props.backgroundColor}}),r.createElement("div",{className:"color-picker-map__pointer",style:{left:this._getPercentageValue(this.props.x),bottom:this._getPercentageValue(this.props.y)}}))}}),v=r.createClass({displayName:"ColorPicker",mixins:[i],propTypes:{color:r.PropTypes.instanceOf(f),onChange:r.PropTypes.func,onColorChange:r.PropTypes.func,onAlphaChange:r.PropTypes.func},getDefaultProps:function(){return{color:f.DEFAULT,onChange:a.identity,onAlphaChange:a.identity,onColorChange:a.identity}},getInitialState:function(){return{color:this._getHSVA(this.props.color)}},setColor:function(e,t){var n=this._getHSVA(e);this._update(n,t)},_getHSVA:function(e){return new c(o(e.toJS()).toHsv())},_getLuminosity:function(){var e=o(this.state.color.toJS()).greyscale().getBrightness();return e/255},_getBackgroundHue:function(){var e=this.state.color;return o({h:e.h,s:1,v:1}).toHexString()},_handleTransparencyChange:function(e){this._update({a:e})},_handleHueChange:function(e){this._update({h:e})},_handleSaturationValueChange:function(e,t){this._update({s:e,v:t})},_update:function(e,t){var n=this.state.color,r=n.merge(e);if(!u.is(n,r)){this.setState({color:r});if(!t){var i=o(r.toJS()),s=f.fromTinycolor(i);n.a!==r.a&&this.props.onAlphaChange(s),(n.h!==r.h||n.s!==r.s||n.v!==r.v)&&this.props.onColorChange(s),this.props.onChange(s)}}},_handleMouseDown:function(e){this.props.onMouseDown&&this.props.onMouseDown(e)},_handleMouseUp:function(e){this.props.onMouseUp&&this.props.onMouseUp(e)},render:function(){var e=this._getLuminosity(),t=this._getBackgroundHue(),n=this.state.color,i=s({"color-picker-map__dark":e<=.5,"color-picker-map__light":e>.5});return r.createElement("div",{className:"color-picker"},r.createElement(d,{x:n.s,y:n.v,max:1,className:i,backgroundColor:t,onMouseUp:this._handleMouseUp,onMouseDown:this._handleMouseDown,onChange:this._handleSaturationValueChange}),r.createElement("div",{className:"color-picker__hue-slider"},r.createElement(p,{vertical:!1,value:n.h,max:360,onMouseUp:this._handleMouseUp,onMouseDown:this._handleMouseDown,onChange:this._handleHueChange})),r.createElement("div",{className:"color-picker__transparency-slider"},r.createElement(p,{vertical:!1,value:n.a,hue:n.h,max:1,onMouseUp:this._handleMouseUp,onMouseDown:this._handleMouseDown,onChange:this._handleTransparencyChange})))}});n.exports=v}),define("jsx!js/jsx/shared/ColorInput",["require","exports","module","react","fluxxor","immutable","lodash","adapter/os","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/TextInput","jsx!js/jsx/shared/Dialog","jsx!js/jsx/shared/ColorPicker","js/models/color","js/jsx/mixin/Coalesce","i18n!nls/strings","tinycolor","js/util/collection","js/util/headlights"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("lodash"),a=e("adapter/os"),f=e("jsx!js/jsx/shared/Gutter"),l=e("jsx!js/jsx/shared/TextInput"),c=e("jsx!js/jsx/shared/Dialog"),h=e("jsx!js/jsx/shared/ColorPicker"),p=e("js/models/color"),d=e("js/jsx/mixin/Coalesce"),v=e("i18n!nls/strings"),m=e("tinycolor"),g=e("js/util/collection"),y=e("js/util/headlights"),b=[{key:a.eventKeyCode.ESCAPE,modifiers:null},{key:a.eventKeyCode.ENTER,modifiers:null}],w=r.createClass({displayName:"ColorInput",mixins:[s,d],propTypes:{id:r.PropTypes.string.isRequired,defaultValue:r.PropTypes.oneOfType([r.PropTypes.instanceOf(p),r.PropTypes.instanceOf(o.Iterable)]),onChange:r.PropTypes.func,onFocus:r.PropTypes.func,onColorChange:r.PropTypes.func,onAlphaChange:r.PropTypes.func,editable:r.PropTypes.bool,swatchOverlay:r.PropTypes.func},getDefaultProps:function(){return{defaultColor:p.DEFAULT,onChange:u.identity,onFocus:u.identity,onAlphaChange:u.identity,onColorChange:u.identity}},getInitialState:function(){return{format:null}},shouldComponentUpdate:function(e){return this.props!==e},updateColorPicker:function(e,t){var n=this.refs.colorpicker;n&&n.setColor(e,t)},_getID:function(){return"colorpicker-"+this.props.id},_handleInputChanged:function(e){var t=e.target.value,n=m(t),r=p.fromTinycolor(n),i;n.isValid()?(i=n.getFormat(),this.setState({format:i})):i="invalid",this.updateColorPicker(r,!0),this.props.onChange(r,!1),y.logEvent("edit","color-input",i)},_handleFocus:function(e){this.props.onFocus&&this.props.onFocus(e)},_handleColorChanged:function(e){var t=this.shouldCoalesce();this.props.onColorChange(e,t),t||y.logEvent("edit","color-input","palette-click")},_handleAlphaChanged:function(e){var t=this.shouldCoalesce();this.props.onAlphaChange(e,t),t||y.logEvent("edit","color-input","palette-alpha")},_handleInputClicked:function(e){var t=this.refs.dialog;t.isOpen()&&e.stopPropagation()},_toggleColorPicker:function(e){var t=this.refs.dialog;this.props.editable&&t&&t.toggle(e)},render:function(){var e=null,t={"color-input":!0},n=this.props.defaultValue,i=o.Iterable.isIterable(n)?n:o.List.of(n),s=g.uniformValue(i),a,d,y;if(s)typeof s=="string"?(a=s,d=p.DEFAULT,t["color-input__invalid-color"]=!0):(y=m(s.toJS()),d=s,a=y.toString(this.state.format));else{a=v.TRANSFORM.MIXED,t["color-input__mixed"]=!0,s=g.uniformValue(i.map(function(e){return u.isObject(e)&&e.opaque()}));if(!s){var w=g.uniformValue(g.pluck(i,"a"),null);w!==null&&(s=p.DEFAULT.set("a",w))}s?(y=m(s.toJS()),d=s):d=p.DEFAULT}return e=r.addons.classSet(t),r.createElement("div",{className:e},r.createElement("div",{className:"color-input__swatch__background",onClick:this._toggleColorPicker},r.createElement("div",{title:this.props.title,className:"color-input__swatch__color"},this.props.swatchOverlay(y))),r.createElement(f,null),r.createElement(c,{ref:"dialog",id:this._getID(),className:"color-picker__"+this.props.className,disabled:!this.props.editable,onClose:this._handleDialogClose,dismissOnKeys:b,dismissOnDocumentChange:!0,dismissOnSelectionTypeChange:!0,dismissOnWindowClick:!0},r.createElement(h,{ref:"colorpicker",color:d,onMouseDown:this.startCoalescing,onMouseUp:this.stopCoalescing,onAlphaChange:this._handleAlphaChanged,onColorChange:this._handleColorChanged})),r.createElement("div",{className:"compact-stats"},r.createElement("div",{className:"compact-stats__header"},r.createElement(l,{live:this.props.editable,editable:this.props.editable,value:a,singleClick:!0,onChange:this._handleInputChanged,onFocus:this._handleFocus,onClick:this._handleInputClicked,size:"column-15"})),this.props.children))},componentDidUpdate:function(e){var t=this.refs.dialog;if(t.isOpen()&&!o.is(this.props.context,e.context)){var n=this.refs.colorpicker.props.color;this.updateColorPicker(n,!0)}},_handleHistoryStateChange:function(){var e=this.refs.dialog;if(e.isOpen()){var t=this.refs.colorpicker.props.color;this.updateColorPicker(t,!0)}},componentWillMount:function(){this.getFlux().store("history").on("change",this._handleHistoryStateChange)},componentWillUnmount:function(){this.getFlux().store("history").off("change",this._handleHistoryStateChange)}});n.exports=w}),define("adapter/lib/color",["require","exports","module","../playobject"],function(e,t){"use strict";var n=e("../playobject"),r=function(e){var t,n,r;if(Array.isArray(e))t=e[0],n=e[1],r=e[2];else if(typeof e=="object"){if(e.hasOwnProperty("obj")&&e.hasOwnProperty("value"))return e;e.hasOwnProperty("grain")?(t=e.red,n=e.grain,r=e.blue):e.hasOwnProperty("_r")?(t=e._r,n=e._g,r=e._b):(t=e.r,n=e.g,r=e.b)}else typeof e=="number"&&(t=e>>16&255,n=e>>8&255,r=e&255);var i={red:t,green:n,blue:r};return{obj:"RGBColor",value:i}},i=function(e){return new n("set",{"null":{ref:"color",property:"foregroundColor"},to:r(e)})},s=function(e){return new n("set",{"null":{ref:"color",property:"backgroundColor"},to:r(e)})};t.colorObject=r,t.setForegroundColor=i,t.setBackgroundColor=s}),define("adapter/lib/textLayer",["require","exports","module","../playobject","./unit","./color","../util","./reference"],function(e,t){"use strict";var n=e("../playobject"),r=e("./unit"),i=e("./color").colorObject,s=e("../util").assert,o=e("./reference"),u=o.refersTo,a=o.wrapper("textLayer"),f=function(e,t,i,o){return s(u(e)==="textLayer","createText expects a textLayer reference"),new n("make",{"null":e,using:{obj:"textLayer",value:{textKey:t,textClickPoint:{obj:"paint",value:{horizontal:r.percent(i),vertical:r.percent(o)}},textStyleRange:[]}}})},l=function(e,t,r){return s(u(e)==="textLayer","setFace expects a textLayer reference"),e={ref:"textLayer",value:"$Trgt","enum":"$Ordn"},new n("set",{"null":{ref:[{ref:"property",property:"textStyle"},e]},to:{obj:"textStyle",value:{fontName:t,fontStyleName:r}}})},c=function(e,t){return s(u(e)==="textLayer","setPostScript expects a textLayer reference"),e={ref:"textLayer",value:"$Trgt","enum":"$Ordn"},new n("set",{"null":{ref:[{ref:"property",property:"textStyle"},e]},to:{obj:"textStyle",value:{fontPostScriptName:t}}})},h=function(e,t,i){return s(u(e)==="textLayer","setSize expects a textLayer reference"),e={ref:"textLayer",value:"$Trgt","enum":"$Ordn"},new n("set",{"null":{ref:[{ref:"property",property:"textStyle"},e]},to:{obj:"textStyle",value:{size:r[i](t)}}})},p=Object.defineProperties({},{LEFT:{value:"left",enumerable:!0},CENTER:{value:"center",enumerable:!0},RIGHT:{value:"right",enumerable:!0},JUSTIFY:{value:"justifyAll",enumerable:!0}}),d=function(e,t){return s(u(e)==="textLayer","setAlignment expects a textLayer reference"),e={ref:"textLayer",value:"$Trgt","enum":"$Ordn"},new n("set",{"null":{ref:[{ref:"property",property:"paragraphStyle"},e]},to:{obj:"paragraphStyle",value:{align:{"enum":"alignmentType",value:t}}}})},v=function(e,t,i,o){return s(u(e)==="textLayer","setLeading expects a textLayer reference"),e={ref:"textLayer",value:"$Trgt","enum":"$Ordn"},t===!1?new n("set",{"null":{ref:[{ref:"property",property:"textStyle"},e]},to:{obj:"textStyle",value:{autoLeading:t,leading:r[o](i)}}}):new n("set",{"null":{ref:[{ref:"property",property:"textStyle"},e]},to:{obj:"textStyle",value:{autoLeading:t}}})},m=function(e,t){return s(u(e)==="textLayer","setTracking expects a textLayer reference"),e={ref:"textLayer",value:"$Trgt","enum":"$Ordn"},new n("set",{"null":{ref:[{ref:"property",property:"textStyle"},e]},to:{obj:"textStyle",value:{tracking:t}}})},g=function(e,t){return s(u(e)==="textLayer","setColor expects a textLayer reference"),e={ref:"textLayer",value:"$Trgt","enum":"$Ordn"},new n("set",{"null":{ref:[{ref:"property",property:"textStyle"},e]},to:{obj:"textStyle",value:{color:i(t)}}})},y=function(e,t){return s(u(e)==="textLayer","setOrientation expects a textLayer reference"),new n("set",{"null":e,to:{"enum":"orientation",value:t}})},b=function(e,t){return s(u(e)==="textLayer","setAntiAlias expects a textLayer reference"),new n("set",{"null":e,to:{"enum":"antiAliasType",value:w[t]}})},w={none:"antiAliasNone",sharp:"antiAliasSharp",crisp:"antiAliasCrisp",strong:"antiAliasStrong",smooth:"antiAliasSmooth",macLcd:"antiAliasPlatformLCD",mac:"antiAliasPlatformGray"},E=function(e,t,o,a,f,l,c,h){return s(u(e)==="textLayer","setRangeAndChangeTextStyle expects a textLayer reference"),new n("set",{"null":e,to:{obj:"textLayer",value:{textStyleRange:[{obj:"textStyleRange",value:{from:t,to:o,textStyle:{obj:"textStyle",value:{fontName:a,fontStyleName:f,size:r[l](c),color:i(h)}}}}]}}})};t.referenceBy=a,t.createText=f,t.setPostScript=c,t.setFace=l,t.setSize=h,t.setAlignment=d,t.alignmentTypes=p,t.setLeading=v,t.setTracking=m,t.setColor=g,t.createText=f,t.setOrientation=y,t.setAntiAlias=b,t.setRangeAndChangeTextStyle=E}),define("jsx!js/jsx/sections/style/Type",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/Label","jsx!js/jsx/shared/NumberInput","jsx!js/jsx/shared/SplitButton","jsx!js/jsx/shared/Datalist","i18n!nls/strings","js/util/collection","jsx!js/jsx/shared/ColorInput","adapter/lib/textLayer"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=i.StoreWatchMixin,u=e("immutable"),a=e("jsx!js/jsx/shared/Gutter"),f=e("jsx!js/jsx/shared/Label"),l=e("jsx!js/jsx/shared/NumberInput"),c=e("jsx!js/jsx/shared/SplitButton"),h=c.SplitButtonList,p=c.SplitButtonItem,d=e("jsx!js/jsx/shared/Datalist"),v=e("i18n!nls/strings"),m=e("js/util/collection"),g=e("jsx!js/jsx/shared/ColorInput"),y=e("adapter/lib/textLayer"),b=r.createClass({displayName:"Type",mixins:[s,o("font")],shouldComponentUpdate:function(e,t){var n=function(e){return e?m.pluck(e.layers.selected,"text"):null},r=function(e){return e?m.pluck(e.layers.selected,"opacity"):null};return!u.is(n(this.props.document),n(e.document))||!u.is(r(this.props.document),r(e.document))||!u.is(this.state.typefaces,t.typefaces)},getStateFromFlux:function(){var e=this.getFlux().store("font"),t=e.getState();return t.typefaces=t.postScriptMap.entrySeq().sortBy(function(e){return e[0]}).map(function(e){var t=e[0],n=e[1];return{id:t,title:n.font,style:{}}}).toList(),t},_handleTypefaceChange:function(e){if(!e)return;var t=this.props.document,n=t.layers.selected.filter(function(e){return e.kind===e.layerKinds.TEXT}),r=this._getPostScriptFontFamily(e),i=this._getPostScriptFontStyle(e),s=this.getFlux();s.actions.type.setPostScriptThrottled(t,n,e,r,i)},_handleSizeChange:function(e,t){var n=this.props.document,r=this.getFlux(),i=n.layers.selected.filter(function(e){return e.kind===e.layerKinds.TEXT});r.actions.type.setSizeThrottled(n,i,t)},_handleColorChange:function(e,t){var n=this.props.document,r=this.getFlux(),i=n.layers.selected.filter(function(e){return e.kind===e.layerKinds.TEXT});r.actions.type.setColorThrottled(n,i,e,t)},_handleOpaqueColorChange:function(e,t){var n=this.props.document,r=this.getFlux(),i=n.layers.selected.filter(function(e){return e.kind===e.layerKinds.TEXT});r.actions.type.setColorThrottled(n,i,e,t,!0)},_handleAlphaChange:function(e,t){var n=this.props.document,r=this.getFlux(),i=n.layers.selected.filter(function(e){return e.kind===e.layerKinds.TEXT});r.actions.layers.setOpacityThrottled(n,i,e.opacity,t)},_handleTrackingChange:function(e,t){var n=this.props.document,r=this.getFlux(),i=n.layers.selected.filter(function(e){return e.kind===e.layerKinds.TEXT});r.actions.type.setTrackingThrottled(n,i,t)},_handleLeadingChange:function(e,t){var n=this.props.document,r=this.getFlux(),i=n.layers.selected.filter(function(e){return e.kind===e.layerKinds.TEXT});t===v.STYLE.TYPE.AUTO_LEADING&&(t=null),r.actions.type.setLeadingThrottled(n,i,t)},_handleAlignmentChange:function(e){var t=this.props.document,n=this.getFlux(),r=t.layers.selected.filter(function(e){return e.kind===e.layerKinds.TEXT});n.actions.type.setAlignmentThrottled(t,r,e)},_getCSSFontStyle:function(e){if(e){e=e.toLowerCase();if(e.indexOf("italic")>-1)return"italic";if(e.indexOf("oblique")>-1)return"oblique"}return"normal"},_getCSSFontWeight:function(e){if(e){e=e.toLowerCase();if(e.indexOf("bold")>-1||e.indexOf("black")>-1||e.indexOf("heavy")>-1)return e.indexOf("extra")>-1?900:e.indexOf("semi")>-1||e.indexOf("demi")>-1?500:700;if(e.indexOf("light")>-1)return 200}return 400},_getPostScriptFontName:function(e){if(!e)return null;var t=this.state.postScriptMap.get(e);return t&&t.font},_getPostScriptFontFamily:function(e){if(!e)return null;var t=this.state.postScriptMap.get(e);return t&&t.family},_getPostScriptFontStyle:function(e){if(!e)return null;var t=this._getPostScriptFontFamily(e),n=this.state.familyMap.get(t),r=this._getPostScriptFontName(e),i=n&&n.get(r);return i&&i.style},render:function(){var e=this.props.document,t=e.layers.selected;if(t.isEmpty())return null;var n=t.some(function(e){return e.kind===e.layerKinds.TEXT});if(!n)return null;var i=this.props.disabled||t.some(function(e){return e.text&&e.text.hasTransform}),s=t.reduce(function(e,t){if(t.text&&t.text.characterStyles){var n=t.opacity,r=t.text.characterStyles.map(function(e){return e.set("color",e.color.setOpacity(n))});e=e.concat(r)}return e},u.List());if(s.isEmpty())return null;var o=m.pluck(s,"postScriptName"),c=m.pluck(s,"textSize"),b=m.pluck(s,"color"),w=m.pluck(s,"tracking"),E=s.map(function(e){return!e||e.leading===null?v.STYLE.TYPE.AUTO_LEADING:e.leading}),S=m.pluck(t,"text"),x=m.pluck(S,"paragraphStyles").flatten(!0),T=m.pluck(x,"alignment"),N=m.uniformValue(T),C=m.pluck(S,"box"),k=m.uniformValue(C),L=m.uniformValue(o),A,O;o.isEmpty()?(A=null,O=null):L?(A=this._getPostScriptFontFamily(L),O=this._getPostScriptFontStyle(L)):(A=v.TRANSFORM.MIXED,O=null);var M=this.state.familyMap.get(A),_=M&&M.valueSeq().sortBy(function(e){return e.postScriptName}).map(function(e){var t=e.style,n=t;return{id:e.postScriptName,title:t,style:{fontFamily:A,fontStyle:this._getCSSFontStyle(n),fontWeight:this._getCSSFontWeight(n)}}},this).toList(),D=function(e){var t={fontFamily:A||"helvetica",fontStyle:this._getCSSFontStyle(O)||"regular",fontWeight:this._getCSSFontWeight(O)||400,fontSize:Math.min(m.uniformValue(c)||24,50)};return e&&(t.color=e.toRgbString()),r.createElement("div",{className:"type__preview",style:t},"Aa")}.bind(this);return r.createElement("div",{className:"type sub-section"},r.createElement("header",{className:"sub-header"},r.createElement("h3",null,v.STYLE.TYPE.TITLE),r.createElement(a,null),r.createElement("hr",{className:"sub-header-rule"}),r.createElement("div",{className:"button-cluster"})),r.createElement("div",{className:"formline"},r.createElement(f,{title:v.TOOLTIPS.SET_TYPEFACE},v.STYLE.TYPE.TYPEFACE),r.createElement(a,null),r.createElement(d,{className:"dialog-type-typefaces",sorted:!0,disabled:this.props.disabled,list:"typefaces",value:A||v.STYLE.TYPE.MISSING,defaultSelected:L,options:this.state.typefaces,onChange:this._handleTypefaceChange,size:"column-14"}),r.createElement(a,null)),r.createElement("div",{className:"formline"},r.createElement(f,{title:v.TOOLTIPS.SET_WEIGHT},v.STYLE.TYPE.WEIGHT),r.createElement(a,null),r.createElement(d,{className:"dialog-type-weights",sorted:!0,title:O,list:"weights",disabled:this.props.disabled||!O,value:O,defaultSelected:L,options:_,onChange:this._handleTypefaceChange,size:"column-14"}),r.createElement(a,null)),r.createElement("div",{className:"formline"},r.createElement(a,null),r.createElement(g,{id:"type",className:"type",context:m.pluck(this.props.document.layers.selected,"id"),title:v.TOOLTIPS.SET_TYPE_COLOR,editable:!this.props.disabled,defaultValue:b,onChange:this._handleColorChange,onColorChange:this._handleOpaqueColorChange,onAlphaChange:this._handleAlphaChange,swatchOverlay:D},r.createElement("div",{className:"compact-stats__body"},r.createElement("div",{className:"compact-stats__body__column"},r.createElement(f,{title:v.TOOLTIPS.SET_TYPE_SIZE,size:"column-4"},v.STYLE.TYPE.SIZE),r.createElement(l,{value:c,onChange:this._handleSizeChange,disabled:i})),r.createElement(a,null),r.createElement("div",{className:"compact-stats__body__column"},r.createElement(f,{size:"column-4",title:v.TOOLTIPS.SET_LETTERSPACING},v.STYLE.TYPE.LETTER),r.createElement(l,{value:w,disabled:i,onChange:this._handleTrackingChange,valueType:"size"})),r.createElement(a,null),r.createElement("div",{className:"compact-stats__body__column"},r.createElement(f,{size:"column-4",title:v.TOOLTIPS.SET_LINESPACING},v.STYLE.TYPE.LINE),r.createElement(l,{value:E,disabled:i,special:v.STYLE.TYPE.AUTO_LEADING,onChange:this._handleLeadingChange,valueType:"size"}))))),r.createElement("div",{className:"formline"},r.createElement(f,{title:v.TOOLTIPS.SET_TYPE_ALIGNMENT},v.STYLE.TYPE.ALIGN),r.createElement(a,null),r.createElement(h,null,r.createElement(p,{disabled:this.props.disabled,iconId:"text-left",selected:N==="left",onClick:this._handleAlignmentChange.bind(this,y.alignmentTypes.LEFT),title:v.TOOLTIPS.ALIGN_TYPE_LEFT}),r.createElement(p,{disabled:this.props.disabled,iconId:"text-center",selected:N==="center",onClick:this._handleAlignmentChange.bind(this,y.alignmentTypes.CENTER),title:v.TOOLTIPS.ALIGN_TYPE_CENTER}),r.createElement(p,{disabled:this.props.disabled,iconId:"text-right",selected:N==="right",onClick:this._handleAlignmentChange.bind(this,y.alignmentTypes.RIGHT),title:v.TOOLTIPS.ALIGN_TYPE_RIGHT}),r.createElement(p,{iconId:"text-justified",selected:N==="justifyAll",disabled:this.props.disabled||!k,onClick:this._handleAlignmentChange.bind(this,y.alignmentTypes.JUSTIFY),title:v.TOOLTIPS.ALIGN_TYPE_JUSTIFIED})),r.createElement(a,null)))}});n.exports=b}),define("jsx!js/jsx/sections/style/Shadow",["require","exports","module","react","fluxxor","immutable","lodash","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/Label","jsx!js/jsx/shared/Button","jsx!js/jsx/shared/SVGIcon","jsx!js/jsx/shared/NumberInput","jsx!js/jsx/shared/ColorInput","jsx!js/jsx/shared/ToggleButton","i18n!nls/strings","js/util/collection"],function(e,t){"use strict";var n=e("react"),r=e("fluxxor"),i=r.FluxMixin(n),s=e("immutable"),o=e("lodash"),u=e("jsx!js/jsx/shared/Gutter"),a=e("jsx!js/jsx/shared/Label"),f=e("jsx!js/jsx/shared/Button"),l=e("jsx!js/jsx/shared/SVGIcon"),c=e("jsx!js/jsx/shared/NumberInput"),h=e("jsx!js/jsx/shared/ColorInput"),p=e("jsx!js/jsx/shared/ToggleButton"),d=e("i18n!nls/strings"),v=e("js/util/collection"),m=n.createClass({displayName:"Shadow",mixins:[i],shouldComponentUpdate:function(e){var t=v.pluck(this.props.layers,"id").equals(v.pluck(e.layers,"id"));return!t||!s.is(this.props.shadows,e.shadows)||this.props.index!==e.index||this.props.readOnly!==e.readOnly},_colorChanged:function(e,t){this.getFlux().actions.layerEffects.setShadowColorThrottled(this.props.document,this.props.layers,this.props.index,e,t,!1,this.props.type)},_opaqueColorChanged:function(e,t){this.getFlux().actions.layerEffects.setShadowColorThrottled(this.props.document,this.props.layers,this.props.index,e,t,!0,this.props.type)},_alphaChanged:function(e,t){this.getFlux().actions.layerEffects.setShadowAlphaThrottled(this.props.document,this.props.layers,this.props.index,e.a,t,this.props.type)},_xChanged:function(e,t){this.getFlux().actions.layerEffects.setShadowXThrottled(this.props.document,this.props.layers,this.props.index,t,this.props.type)},_yChanged:function(e,t){this.getFlux().actions.layerEffects.setShadowYThrottled(this.props.document,this.props.layers,this.props.index,t,this.props.type)},_blurChanged:function(e,t){this.getFlux().actions.layerEffects.setShadowBlurThrottled(this.props.document,this.props.layers,this.props.index,t,this.props.type)},_spreadChanged:function(e,t){this.getFlux().actions.layerEffects.setShadowSpreadThrottled(this.props.document,this.props.layers,this.props.index,t,this.props.type)},_enabledChanged:function(e,t){this.getFlux().actions.layerEffects.setShadowEnabled(this.props.document,this.props.layers,this.props.index,t,this.props.type)},_downsampleShadows:function(e){return{colors:v.pluck(e,"color"),enabledFlags:v.pluck(e,"enabled"),xPositions:v.pluck(e,"x"),yPositions:v.pluck(e,"y"),blurs:v.pluck(e,"blur"),spreads:v.pluck(e,"spread")}},_stringHelper:function(e,t){return this.props.type==="dropShadow"?e:this.props.type==="innerShadow"?t:"error"},render:function(){var e=this._downsampleShadows(this.props.shadows),t=n.addons.classSet({"shadow-list__shadow":!0,"shadow-list__shadow__disabled":this.props.readOnly}),r=this._stringHelper(d.TOOLTIPS.SET_DROP_SHADOW_X_POSITION,d.TOOLTIPS.SET_DROP_SHADOW_X_POSITION),i=this._stringHelper(d.TOOLTIPS.SET_DROP_SHADOW_Y_POSITION,d.TOOLTIPS.SET_DROP_SHADOW_Y_POSITION),s=this._stringHelper(d.TOOLTIPS.SET_DROP_SHADOW_COLOR,d.TOOLTIPS.SET_INNER_SHADOW_COLOR),f=this._stringHelper(d.TOOLTIPS.SET_DROP_SHADOW_BLUR,d.TOOLTIPS.SET_INNER_SHADOW_BLUR),l=this._stringHelper(d.TOOLTIPS.SET_DROP_SHADOW_SPREAD,d.TOOLTIPS.SET_INNER_SHADOW_SPREAD),m=this._stringHelper(d.TOOLTIPS.TOGGLE_DROP_SHADOW,d.TOOLTIPS.TOGGLE_INNER_SHADOW),g=this._stringHelper(d.STYLE.DROP_SHADOW.X_POSITION,d.STYLE.INNER_SHADOW.X_POSITION),y=this._stringHelper(d.STYLE.DROP_SHADOW.Y_POSITION,d.STYLE.INNER_SHADOW.Y_POSITION),b=this._stringHelper(d.STYLE.DROP_SHADOW.BLUR,d.STYLE.INNER_SHADOW.BLUR),w=this._stringHelper(d.STYLE.DROP_SHADOW.SPREAD,d.STYLE.INNER_SHADOW.SPREAD),E=this.props.type,S=function(t){var r={};if(t){var i=E==="innerShadow"?"inset ":"";r.WebkitBoxShadow=i+v.uniformValue(e.xPositions,5)+"px "+v.uniformValue(e.yPositions,5)+"px "+v.uniformValue(e.blurs,0)+"px "+v.uniformValue(e.spreads,0)+"px "+t.toRgbString()}return n.createElement("div",{className:"shadow__preview"},n.createElement("div",{className:"shadow__square",style:r}))};return n.createElement("div",{className:t},n.createElement("div",{className:"formline"},n.createElement(u,null),n.createElement(h,{id:"shadow-"+this.props.type+"-"+this.props.index,className:"shadow",context:v.pluck(this.props.layers,"id"),title:s,editable:!this.props.readOnly,defaultValue:e.colors,onChange:this._colorChanged,onFocus:this.props.onFocus,onColorChange:this._opaqueColorChanged,onAlphaChange:this._alphaChanged,swatchOverlay:S},n.createElement("div",{className:"compact-stats__body"},n.createElement("div",{className:"compact-stats__body__column"},n.createElement(a,{title:r,size:"column-1"},g),n.createElement(c,{value:e.xPositions,onChange:this._xChanged,onFocus:this.props.onFocus,disabled:this.props.readOnly,size:"column-3"})),n.createElement("div",{className:"compact-stats__body__column"},n.createElement(a,{title:i,size:"column-1"},y),n.createElement(c,{value:e.yPositions,onChange:this._yChanged,onFocus:this.props.onFocus,disabled:this.props.readOnly,size:"column-3"})),n.createElement("div",{className:"compact-stats__body__column"},n.createElement(a,{title:f,size:"column-2"},b),n.createElement(c,{value:e.blurs,onChange:this._blurChanged,onFocus:this.props.onFocus,disabled:this.props.readOnly,size:"column-3"})),n.createElement("div",{className:"compact-stats__body__column"},n.createElement(a,{title:l,size:"column-4"},w),n.createElement(c,{value:e.spreads,onChange:this._spreadChanged,onFocus:this.props.onFocus,disabled:this.props.readOnly,size:"column-3"})))),n.createElement(u,null),n.createElement(p,{title:m,name:"toggleDropShadowEnabled",buttonType:"layer-visibility",selected:e.enabledFlags,onFocus:this.props.onFocus,onClick:this.props.readOnly?o.noop:this._enabledChanged,size:"column-2"}),n.createElement(u,null)))}}),g=n.createClass({displayName:"DropShadowList",mixins:[i],propTypes:{max:n.PropTypes.number},_addDropShadow:function(e){this.getFlux().actions.layerEffects.addShadow(this.props.document,e,"dropShadow")},render:function(){var e=this.props.document,t=e.layers.selected.filter(function(e){return!e.isBackground});if(t.isEmpty())return null;var r=v.zip(v.pluck(t,"dropShadows")),i=r.map(function(e,r){return n.createElement(m,n.__spread({},this.props,{layers:t,key:r,index:r,readOnly:this.props.disabled,shadows:e,type:"dropShadow"}))},this);return n.createElement("div",{className:"shadow-list__container"},n.createElement("header",{className:"shadow-list__header sub-header"},n.createElement("h3",null,d.STYLE.DROP_SHADOW.TITLE),n.createElement(u,null),n.createElement("hr",{className:"sub-header-rule"}),n.createElement(f,{title:d.STYLE.DROP_SHADOW.ADD,className:"button-plus",disabled:i.size>=this.props.max,onClick:this._addDropShadow.bind(this,t)},n.createElement(l,{viewbox:"0 0 12 12",CSSID:"plus"}))),n.createElement("div",{className:"shadow-list__list-container"},i.toArray()))}}),y=n.createClass({displayName:"InnerShadowList",mixins:[i],propTypes:{max:n.PropTypes.number},_addInnerShadow:function(e){this.getFlux().actions.layerEffects.addShadow(this.props.document,e,"innerShadow")},render:function(){var e=this.props.document,t=e.layers.selected.filter(function(e){return!e.isBackground});if(t.isEmpty())return null;var r=v.zip(v.pluck(t,"innerShadows")),i=r.map(function(e,r){return n.createElement(m,n.__spread({},this.props,{layers:t,key:r,index:r,readOnly:this.props.disabled,shadows:e,type:"innerShadow"}))},this);return n.createElement("div",{className:"shadow-list__container"},n.createElement("header",{className:"shadow-list__header sub-header"},n.createElement("h3",null,d.STYLE.INNER_SHADOW.TITLE),n.createElement(u,null),n.createElement("hr",{className:"sub-header-rule"}),n.createElement(f,{title:d.STYLE.INNER_SHADOW.ADD,className:"button-plus",disabled:i.size>=this.props.max,onClick:this._addInnerShadow.bind(this,t)},n.createElement(l,{viewbox:"0 0 12 12",CSSID:"plus"}))),n.createElement("div",{className:"shadow-list__list-container"},i.toArray()))}});t.InnerShadowList=y,t.DropShadowList=g}),define("adapter/lib/shape",["require","exports","module","./color","./unit"],function(e,t){"use strict";var n=e("./color").colorObject,r=e("./unit"),i=function(e,t){if(e==="solidColorLayer")return{obj:"solidColorLayer",value:{color:n(t)}};if(e==="patternLayer")return{obj:"patternLayer",value:{pattern:{obj:"pattern",value:{ID:t[0],name:t[1]}}}}},s=function(e){return{obj:"strokeStyle",value:{fillEnabled:e,strokeStyleVersion:2}}},o=function(e){return{obj:"strokeStyle",value:{strokeEnabled:e,strokeStyleVersion:2}}},u=function(e,t){var n;return e==="rectangle"?n={top:r.pixels(t[0]),bottom:r.pixels(t[1]),left:r.pixels(t[2]),right:r.pixels(t[3]),topLeft:r.pixels(t[4]),topRight:r.pixels(t[5]),bottomLeft:r.pixels(t[6]),bottomRight:r.pixels(t[7]),unitValueQuadVersion:1}:e==="ellipse"&&(n={top:r.pixels(t[0]),bottom:r.pixels(t[1]),left:r.pixels(t[2]),right:r.pixels(t[3]),unitValueQuadVersion:1}),{obj:e,value:n}};t.shapeObject=u,t.fillContentsObject=i,t.shapeFillObject=s,t.shapeStrokeObject=o}),define("adapter/lib/contentLayer",["require","exports","module","../playobject","./reference","./unit","./shape","../util","./reference"],function(e,t){"use strict";var n=e("../playobject"),r=e("./reference").wrapper("contentLayer"),i=e("./unit"),s=e("./shape"),o=e("../util").assert,u=e("./reference").refersTo,a=Object.defineProperties({},{OUTSIDE:{value:"strokeStyleAlignOutside",writeable:!1,enumerable:!0},CENTER:{value:"strokeStyleAlignCenter",writeable:!1,enumerable:!0},INSIDE:{value:"strokeStyleAlignInside",writeable:!1,enumerable:!0}}),f={square:"strokeStyleSquareCap",round:"strokeStyleRoundCap",butt:"strokeStyleButtCap"},l={miter:"strokeStyleMiterJoin",round:"strokeStyleRoundJoin",bevel:"strokeStyleBevelJoin"},c={pBubbles:["b7334da0-122f-11d4-8bb5-e27e45023b5f","$$$/Presets/Patterns/Patterns_pat/Bubbles=Bubbles"],pTieDye:["1b29876b-58b7-11d4-b895-a898787104c1","$$$/Presets/Patterns/Patterns_pat/TieDye=Tie Dye"],pLaidhorizontal:["52a93427-f5d6-1172-a989-8dc82a43aa51","$$$/Presets/Patterns/Patterns_pat/Laidhorizontal=Laid-horizontal"],pFineGrain:["c02fddff-f05a-1172-9a0f-f7bad69dd4b0","$$$/Presets/Patterns/Patterns_pat/FineGrain=Fine Grain"],pGrayGranite:["f293c3d4-57f7-1177-b70c-a0459fa92660","$$$/Presets/Patterns/Patterns_pat/GrayGranite=Gray Granite"]},h=Object.defineProperties({},{SOLID_COLOR:{value:"solidColor",writeable:!1,enumerable:!0},GRADIENT:{value:"gradient",writeable:!1,enumerable:!0},PATTERN:{value:"pattern",writeable:!1,enumerable:!0}}),p=Object.defineProperties({},{ORIGIN_UNDEFINED:{value:-1,enumerable:!0,writeable:!1},ORIGIN_NONE:{value:0,enumerable:!0,writeable:!1},ORIGIN_RECT:{value:1,enumerable:!0,writeable:!1},ORIGIN_ROUNDED_RECT:{value:2,enumerable:!0,writeable:!1},ORIGIN_POLYGON:{value:3,enumerable:!0,writeable:!1},ORIGIN_LINE:{value:4,enumerable:!0,writeable:!1},ORIGIN_ELLIPSE:{value:5,enumerable:!0,writeable:!1},ORIGIN_CUSTOM:{value:6,enumerable:!0,writeable:!1}}),d=function(e,t){return o(u(e)==="contentLayer","setStrokeAlignment is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"shapeStyle",value:{strokeStyle:{obj:"strokeStyle",value:{strokeEnabled:!0,strokeStyleLineAlignment:{"enum":"strokeStyleLineAlignment",value:a[t]},strokeStyleVersion:2}}}}})},v=function(e,t){return o(u(e)==="contentLayer","setStrokeCap is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"shapeStyle",value:{strokeStyle:{obj:"strokeStyle",value:{strokeEnabled:!0,strokeStyleLineCapType:{"enum":"strokeStyleLineCapType",value:f[t]},strokeStyleVersion:2}}}}})},m=function(e,t){return o(u(e)==="contentLayer","setStrokeCorner is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"shapeStyle",value:{strokeStyle:{obj:"strokeStyle",value:{strokeEnabled:!0,strokeStyleLineJoinType:{"enum":"strokeStyleLineJoinType",value:l[t]},strokeStyleVersion:2}}}}})},g=function(e,t){o(u(e)==="contentLayer","setStrokeOpacity is passed a non-layer reference");var r={"null":e,to:{obj:"shapeStyle",value:{strokeStyle:{obj:"strokeStyle",value:{strokeEnabled:!0,strokeStyleOpacity:i.percent(t),strokeStyleVersion:2}}}}};return new n("set",r)},y=function(e,t){return o(u(e)==="contentLayer","setShapeFillTypeSolidColor is passed a non-layer reference"),t===null?w(e):new n("set",{"null":e,to:{obj:"shapeStyle",value:{fillContents:s.fillContentsObject("solidColorLayer",t),strokeStyle:s.shapeFillObject(!0)}}})},b=function(e,t){o(u(e)==="contentLayer","setStrokeFillTypeSolidColor is passed a non-layer reference");if(t===null)return E(e);var r={"null":e,to:{obj:"shapeStyle",value:{strokeStyle:{obj:"strokeStyle",value:{strokeEnabled:!0,strokeStyleContent:s.fillContentsObject("solidColorLayer",t),strokeStyleVersion:2}}}}};return t.hasOwnProperty("a")&&(r.to.value.strokeStyle.value.strokeStyleOpacity=i.percent(t.a*100)),new n("set",r)},w=function(e){return new n("set",{"null":e,to:{obj:"shapeStyle",value:{strokeStyle:s.shapeFillObject(!1)}}})},E=function(e){return new n("set",{"null":e,to:{obj:"shapeStyle",value:{strokeStyle:s.shapeStrokeObject(!1)}}})},S=function(e,t){return o(u(e)==="contentLayer","setShapeStrokeWidth is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"shapeStyle",value:{strokeStyle:{obj:"strokeStyle",value:{strokeEnabled:!0,strokeStyleLineWidth:i.pixels(t),strokeStyleVersion:2}}}}})},x=function(e,t,r){return o(u(e)==="contentLayer","setStrokeFillTypePattern is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"shapeStyle",value:{strokeStyle:{obj:"strokeStyle",value:{strokeEnabled:!0,strokeStyleContent:{obj:"patternLayer",value:{align:!0,pattern:{obj:"pattern",value:{ID:c[t][0],name:c[t][1]}},phase:{obj:"paint",value:{horizontal:0,vertical:0}},scale:i.percent(r)}},strokeStyleVersion:2}}}}})},T=function(e,t,r){return o(u(e)==="contentLayer","setShapeFillTypePattern is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"shapeStyle",value:{fillContents:{obj:"patternLayer",value:{align:!0,pattern:{obj:"pattern",value:{ID:c[t][0],name:c[t][1]}},phase:{obj:"paint",value:{horizontal:0,vertical:0}},scale:i.percent(r)}},strokeStyle:s.shapeFillStrokeStyle(!0)}}})},N=function(e){return o(u(e)==="contentLayer","deleteShapeStyle is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"deleteShapeStyle",value:{}}})},C=function(e,t,r){return o(u(e)==="contentLayer","moveShape is passed a non-layer reference"),new n("set",{"null":e,to:{obj:"offset",value:{horizontal:i.distance(t),vertical:i.distance(r)}}})},k=function(e,t,r,h,p,d,v,m,g,y,b,w,E){o(u(e)==="contentLayer","createShape is passed a non-layer reference");var S;return r==="patternLayer"&&(S=h,h=[c[S][0],c[S][1]]),d==="patternLayer"&&(S=v,v=[c[S][0],c[S][1]]),new n("make",{"null":e,using:{obj:"contentLayer",value:{shape:s.shapeObj(w,E),strokeStyle:{obj:"strokeStyle",value:{fillEnabled:t,strokeEnabled:p,strokeStyleBlendMode:{"enum":"blendMode",value:"normal"},strokeStyleContent:s.fillContentsObject(d,v),strokeStyleLineAlignment:{"enum":"strokeStyleLineAlignment",value:a[m]},strokeStyleLineCapType:{"enum":"strokeStyleLineCapType",value:f[g]},strokeStyleLineDashOffset:i.points(0),strokeStyleLineDashSet:[],strokeStyleLineJoinType:{"enum":"strokeStyleLineJoinType",value:l[y]},strokeStyleLineWidth:i.points(b),strokeStyleMiterLimit:100,strokeStyleOpacity:i.percent(100),strokeStyleResolution:72,strokeStyleScaleLock:!1,strokeStyleStrokeAdjust:!1,strokeStyleVersion:2}},type:s.fillContentsObject(r,h)}}})},L=function(e,t,r,i){return t=t||e,r=r||e,i=i||e,new n("changePathDetails",{keyActionChangeAllCorners:!0,keyOriginRRectRadii:{obj:"radii",value:{topLeft:{unit:"pixelsUnit",value:e},topRight:{unit:"pixelsUnit",value:t},bottomLeft:{unit:"pixelsUnit",value:i},bottomRight:{unit:"pixelsUnit",value:r},unitValueQuadVersion:1}},keyOriginType:p.ORIGIN_RECT})};t.referenceBy=r,t.contentTypes=h,t.alignmentTypes=a,t.originTypes=p,t.setStrokeAlignment=d,t.setStrokeCap=v,t.setStrokeCorner=m,t.setStrokeOpacity=g,t.setShapeFillTypeSolidColor=y,t.setStrokeFillTypeSolidColor=b,t.setShapeStrokeWidth=S,t.setStrokeFillTypePattern=x,t.setShapeFillTypePattern=T,t.deleteShapeStyle=N,t.moveShape=C,t.createShape=k,t.setRadius=L}),define("jsx!js/jsx/sections/style/Fill",["require","exports","module","react","fluxxor","lodash","immutable","js/models/color","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/Label","jsx!js/jsx/shared/Button","jsx!js/jsx/shared/SVGIcon","jsx!js/jsx/shared/NumberInput","jsx!js/jsx/shared/ColorInput","jsx!js/jsx/shared/ToggleButton","adapter/lib/contentLayer","i18n!nls/strings","js/util/collection"],function(e,t){"use strict";var n=e("react"),r=e("fluxxor"),i=r.FluxMixin(n),s=e("lodash"),o=e("immutable"),u=e("js/models/color"),a=e("jsx!js/jsx/shared/Gutter"),f=e("jsx!js/jsx/shared/Label"),l=e("jsx!js/jsx/shared/Button"),c=e("jsx!js/jsx/shared/SVGIcon"),h=e("jsx!js/jsx/shared/NumberInput"),p=e("jsx!js/jsx/shared/ColorInput"),d=e("jsx!js/jsx/shared/ToggleButton"),v=e("adapter/lib/contentLayer"),m=e("i18n!nls/strings"),g=e("js/util/collection"),y=n.createClass({displayName:"Fill",mixins:[i],shouldComponentUpdate:function(e){var t=g.pluck(this.props.layers,"id").equals(g.pluck(e.layers,"id"));return!t||!o.is(this.props.fills,e.fills)||this.props.index!==e.index||this.props.readOnly!==e.readOnly},_toggleFillEnabled:function(e,t){var n=this.props.fills.find(function(e){return e&&s.isObject(e.color)});this.getFlux().actions.shapes.setFillEnabled(this.props.document,this.props.layers,this.props.index,n&&n.color||u.DEFAULT,t)},_opacityChanged:function(e,t){this.getFlux().actions.shapes.setFillOpacityThrottled(this.props.document,this.props.layers,this.props.index,t)},_colorChanged:function(e,t){this.getFlux().actions.shapes.setFillColorThrottled(this.props.document,this.props.layers,this.props.index,e,t)},_opaqueColorChanged:function(e,t){this.getFlux().actions.shapes.setFillColorThrottled(this.props.document,this.props.layers,this.props.index,e,t,!0,!0)},_alphaChanged:function(e,t){this.getFlux().actions.shapes.setFillOpacityThrottled(this.props.document,this.props.layers,this.props.index,e.opacity,t)},_downsampleFills:function(e){var t=e.map(function(e){return e?e.type===v.contentTypes.SOLID_COLOR?e.color:e.type:null}),n=g.pluck(e,"color").map(function(e){return e&&e.opacity}),r=g.pluck(e,"enabled",!1);return{colors:t,opacityPercentages:n,enabledFlags:r}},render:function(){var e=this._downsampleFills(this.props.fills),t=n.addons.classSet({"fill-list__fill":!0,"fill-list__fill__disabled":this.props.readOnly}),r=function(e){var t={height:"100%",width:"100%"};return e&&(t.backgroundColor=e.toRgbString()),n.createElement("div",{className:"fill__preview",style:t})};return n.createElement("div",{className:t},n.createElement("div",{className:"formline"},n.createElement(a,null),n.createElement(p,{id:"fill-"+this.props.index,className:"fill",context:g.pluck(this.props.layers,"id"),title:m.TOOLTIPS.SET_FILL_COLOR,editable:!this.props.readOnly,defaultValue:e.colors,onChange:this._colorChanged,onColorChange:this._opaqueColorChanged,onAlphaChange:this._alphaChanged,onClick:this.props.readOnly?s.noop:this._toggleColorPicker,swatchOverlay:r},n.createElement("div",{className:"compact-stats__body"},n.createElement("div",{className:"compact-stats__body__column"},n.createElement(f,{title:m.TOOLTIPS.SET_FILL_OPACITY,size:"column-4"},m.STYLE.FILL.ALPHA),n.createElement(h,{value:e.opacityPercentages,onChange:this._opacityChanged,min:0,max:100,step:1,bigstep:10,disabled:this.props.readOnly,size:"column-3"})))),n.createElement(a,null),n.createElement(d,{title:m.TOOLTIPS.TOGGLE_FILL,name:"toggleFillEnabled",buttonType:"layer-visibility",selected:e.enabledFlags,onClick:this.props.readOnly?s.noop:this._toggleFillEnabled,size:"column-2"}),n.createElement(a,null)))}}),b=n.createClass({displayName:"FillList",mixins:[i],_addFill:function(e){this.getFlux().actions.shapes.addFill(this.props.document,e,u.DEFAULT)},render:function(){var e=this.props.document,t=e.layers.selected.filter(function(e){return e.kind===e.layerKinds.VECTOR});if(t.isEmpty())return null;var r=g.zip(g.pluck(t,"fills")),i=r.map(function(e,r){return n.createElement(y,n.__spread({},this.props,{key:r,index:r,readOnly:this.props.disabled,layers:t,fills:e}))},this),s=null;return r.isEmpty()&&(s=n.createElement(l,{className:"button-plus",onClick:this._addFill.bind(this,t)},n.createElement(c,{viewbox:"0 0 12 12",CSSID:"plus"}))),n.createElement("div",{className:"fill-list__container"},n.createElement("header",{className:"fill-list__header sub-header"},n.createElement("h3",null,m.STYLE.FILL.TITLE),n.createElement(a,null),n.createElement("hr",{className:"sub-header-rule"}),s),n.createElement("div",{className:"fill-list__list-container"},i.toArray()))}});t.Fill=y,t.FillList=b}),define("jsx!js/jsx/sections/style/StrokeAlignment",["require","exports","module","react","fluxxor","immutable","jsx!js/jsx/shared/Datalist","i18n!nls/strings","js/util/collection"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("jsx!js/jsx/shared/Datalist"),a=e("i18n!nls/strings"),f=e("js/util/collection"),l=o.OrderedMap({INSIDE:{id:"INSIDE",title:a.STYLE.STROKE.ALIGNMENT_MODES.INSIDE},CENTER:{id:"CENTER",title:a.STYLE.STROKE.ALIGNMENT_MODES.CENTER},OUTSIDE:{id:"OUTSIDE",title:a.STYLE.STROKE.ALIGNMENT_MODES.OUTSIDE}}),c=l.toList(),h=r.createClass({displayName:"StrokeAlignment",mixins:[s],shouldComponentUpdate:function(e){var t=f.pluck(this.props.layers,"id").equals(f.pluck(e.layers,"id"));return!t||!o.is(this.props.strokes,e.strokes)||this.props.index!==e.index||this.props.readOnly!==e.readOnly},getDefaultProps:function(){return{id:"main"}},_handleChange:function(e){this.getFlux().actions.shapes.setStrokeAlignmentThrottled(this.props.document,this.props.layers,this.props.index,e)},render:function(){var e=f.pluck(this.props.strokes,"alignment"),t=f.uniformValue(e),n=l.has(t)?l.get(t).title:e.size>1?a.TRANSFORM.MIXED:t;return this.props.disabled&&(n=null),r.createElement(u,{list:"alignment-"+this.props.id,disabled:this.props.readOnly,className:"dialog-stroke-alignment",options:c,value:n,defaultSelected:t,size:"column-9",onChange:this._handleChange,onFocus:this.props.onFocus})}});n.exports=h}),define("jsx!js/jsx/sections/style/Stroke",["require","exports","module","react","fluxxor","lodash","immutable","js/models/color","jsx!./StrokeAlignment","jsx!js/jsx/shared/Gutter","jsx!js/jsx/shared/Label","jsx!js/jsx/shared/Button","jsx!js/jsx/shared/SVGIcon","jsx!js/jsx/shared/NumberInput","jsx!js/jsx/shared/ColorInput","jsx!js/jsx/shared/ToggleButton","adapter/lib/contentLayer","i18n!nls/strings","js/util/collection"],function(e,t){"use strict";var n=e("react"),r=e("fluxxor"),i=r.FluxMixin(n),s=e("lodash"),o=e("immutable"),u=e("js/models/color"),a=e("jsx!./StrokeAlignment"),f=e("jsx!js/jsx/shared/Gutter"),l=e("jsx!js/jsx/shared/Label"),c=e("jsx!js/jsx/shared/Button"),h=e("jsx!js/jsx/shared/SVGIcon"),p=e("jsx!js/jsx/shared/NumberInput"),d=e("jsx!js/jsx/shared/ColorInput"),v=e("jsx!js/jsx/shared/ToggleButton"),m=e("adapter/lib/contentLayer"),g=e("i18n!nls/strings"),y=e("js/util/collection"),b=n.createClass({displayName:"Stroke",mixins:[i],shouldComponentUpdate:function(e){var t=y.pluck(this.props.layers,"id").equals(y.pluck(e.layers,"id"));return!t||!o.is(this.props.strokes,e.strokes)||this.props.index!==e.index||this.props.readOnly!==e.readOnly},_toggleStrokeEnabled:function(e,t){var n=this.props.strokes.find(function(e){return e&&s.isObject(e.color)});this.getFlux().actions.shapes.setStrokeEnabled(this.props.document,this.props.layers,this.props.index,n&&n.color||u.DEFAULT,t)},_widthChanged:function(e,t){this.getFlux().actions.shapes.setStrokeWidthThrottled(this.props.document,this.props.layers,this.props.index,t)},_opacityChanged:function(e,t){this.getFlux().actions.shapes.setStrokeOpacityThrottled(this.props.document,this.props.layers,this.props.index,t)},_alphaChanged:function(e,t){this.getFlux().actions.shapes.setStrokeOpacityThrottled(this.props.document,this.props.layers,this.props.index,e.opacity,t)},_opaqueColorChanged:function(e,t){this.getFlux().actions.shapes.setStrokeColorThrottled(this.props.document,this.props.layers,this.props.index,e,t,!0,!0)},_colorChanged:function(e,t){this.getFlux().actions.shapes.setStrokeColorThrottled(this.props.document,this.props.layers,this.props.index,e,t)},_downsampleStrokes:function(e){var t=e.map(function(e){return e?e.type===m.contentTypes.SOLID_COLOR?e.color:e.type:null}),n=y.pluck(e,"width",0).map(function(e){return e?Math.ceil(e*100)/100:0}),r=y.pluck(e,"color").map(function(e){return e&&e.opacity}),i=y.pluck(e,"enabled",!1);return{colors:t,widths:n,opacityPercentages:r,enabledFlags:i}},render:function(){var e=this._downsampleStrokes(this.props.strokes),t=n.addons.classSet({"stroke-list__stroke":!0,"stroke-list__stroke__disabled":this.props.readOnly}),r=function(t){var r={width:"100%",height:(y.uniformValue(e.widths)||0)+"%"};return t&&(r.backgroundColor=t.toRgbString()),n.createElement("div",{className:"stroke__preview",style:r})};return n.createElement("div",{className:t},n.createElement("div",{className:"formline"},n.createElement(f,null),n.createElement(d,{id:"stroke-"+this.props.index,className:"stroke",context:y.pluck(this.props.layers,"id"),title:g.TOOLTIPS.SET_STROKE_COLOR,editable:!this.props.readOnly,defaultValue:e.colors,onChange:this._colorChanged,onFocus:this.props.onFocus,onColorChange:this._opaqueColorChanged,onAlphaChange:this._alphaChanged,onClick:this.props.readOnly?s.noop:this._toggleColorPicker,swatchOverlay:r},n.createElement("div",{className:"compact-stats__body"},n.createElement("div",{className:"compact-stats__body__column"},n.createElement(l,{title:g.TOOLTIPS.SET_STROKE_OPACITY,size:"column-4"},g.STYLE.STROKE.ALPHA),n.createElement(p,{value:e.opacityPercentages,onChange:this._opacityChanged,onFocus:this.props.onFocus,min:0,max:100,step:1,bigstep:10,disabled:this.props.readOnly,size:"column-3"})),n.createElement(f,null),n.createElement("div",{className:"compact-stats__body__column"},n.createElement(l,{title:g.TOOLTIPS.SET_STROKE_SIZE,size:"column-4"},g.STYLE.STROKE.SIZE),n.createElement(p,{value:e.widths,onChange:this._widthChanged,onFocus:this.props.onFocus,min:0,step:1,bigstep:5,disabled:this.props.readOnly,size:"column-3"})),n.createElement(f,null),n.createElement("div",{className:"compact-stats__body__column"},n.createElement(l,{title:g.TOOLTIPS.SET_STROKE_ALIGNMENT,size:"column-4"},g.STYLE.STROKE.ALIGNMENT),n.createElement(a,n.__spread({},this.props))))),n.createElement(f,null),n.createElement(v,{title:g.TOOLTIPS.TOGGLE_STROKE,name:"toggleStrokeEnabled",buttonType:"layer-visibility",selected:e.enabledFlags,onClick:this.props.readOnly?s.noop:this._toggleStrokeEnabled,size:"column-2"}),n.createElement(f,null)))}}),w=n.createClass({displayName:"StrokeList",mixins:[i],_addStroke:function(e){this.getFlux().actions.shapes.addStroke(this.props.document,e)},render:function(){var e=this.props.document,t=e.layers.selected.filter(function(e){return e.kind===e.layerKinds.VECTOR});if(t.isEmpty())return null;var r=y.zip(y.pluck(t,"strokes")),i=r.map(function(e,r){return n.createElement(b,n.__spread({},this.props,{key:r,index:r,readOnly:!1,layers:t,strokes:e}))},this),s=null;return r.isEmpty()&&(s=n.createElement(c,{className:"button-plus",onClick:this._addStroke.bind(this,t)},n.createElement(h,{viewbox:"0 0 12 12",CSSID:"plus"}))),n.createElement("div",{className:"stroke-list__container"},n.createElement("header",{className:"stroke-list__header sub-header"},n.createElement("h3",null,g.STYLE.STROKE.TITLE),n.createElement(f,null),n.createElement("hr",{className:"sub-header-rule"}),s),n.createElement("div",{className:"stroke-list__list-container"},i.toArray()))}});t.Stroke=b,t.StrokeList=w}),define("js/util/synchronization",["require","exports","module","bluebird"],function(e,t){"use strict";var n=e("bluebird"),r=function(e,t,r){var i=null,s=null;typeof t=="number"&&(r=t,t=undefined),r=r||0;var o=function(){if(!i){var u=t;u===undefined&&(u=this),i=(e.apply(u,arguments)||n.resolve()).delay(r).finally(function(){i=null,s&&o.apply(u,s)}),s=null}else s=arguments};return o},i=function(e,t,n,r){var i=null,s=null,o=null;typeof t=="number"&&(r=n,n=t,t=undefined),n=n||0,r=r||!1;var u=function(){var u=t;u===undefined&&(u=this),s=arguments,i?(window.clearTimeout(i),i=null):r&&(r=!1,o=e.apply(u,s).finally(function(){o=null})),i=window.setTimeout(function(){o=e.apply(u,s).finally(function(){o=null,i=null})},n)};return u};t.throttle=r,t.debounce=i}),define("jsx!js/jsx/sections/style/StylePanel",["require","exports","module","react","adapter/os","jsx!js/jsx/shared/TitleHeader","jsx!./Blend","jsx!./Vector","jsx!./Type","jsx!./Shadow","jsx!./Shadow","jsx!./Fill","jsx!./Stroke","i18n!nls/strings","js/util/synchronization"],function(e,t,n){"use strict";var r=e("react"),i=e("adapter/os"),s=e("jsx!js/jsx/shared/TitleHeader"),o=e("jsx!./Blend"),u=e("jsx!./Vector"),a=e("jsx!./Type"),f=e("jsx!./Shadow").DropShadowList,l=e("jsx!./Shadow").InnerShadowList,c=e("jsx!./Fill").FillList,h=e("jsx!./Stroke").StrokeList,p=e("i18n!nls/strings"),d=e("js/util/synchronization"),v=10,m=r.createClass({displayName:"StylePanel",_setTooltipThrottled:null,componentWillMount:function(){this._setTooltipThrottled=d.throttle(i.setTooltip,i,500)},_handleFocus:function(e){e.target.scrollIntoViewIfNeeded(),this.props.onFocus&&this.props.onFocus(e)},shouldComponentUpdate:function(e){return this.props.disabled!==e.disabled?!0:!e.visible&&!this.props.visible?!1:!0},_handleScroll:function(){this._setTooltipThrottled("")},render:function(){var e=r.addons.classSet({"section-container":!0,"section-container__collapsed":!this.props.visible}),t=r.addons.classSet({style:!0,section:!0,"section__sibling-collapsed":!this.props.visibleSibling}),n=this.props.document&&this.props.visible&&!this.props.disabled&&r.createElement("div",null,r.createElement(o,r.__spread({},this.props,{onFocus:this._handleFocus})),r.createElement(u,r.__spread({},this.props,{onFocus:this._handleFocus})),r.createElement(a,r.__spread({},this.props,{onFocus:this._handleFocus})),r.createElement(c,r.__spread({},this.props,{onFocus:this._handleFocus})),r.createElement(h,r.__spread({},this.props,{onFocus:this._handleFocus})),r.createElement(f,r.__spread({},this.props,{onFocus:this._handleFocus,max:v})),r.createElement(l,r.__spread({},this.props,{onFocus:this._handleFocus,max:v})));return r.createElement("section",{className:t,onScroll:this._handleScroll},r.createElement(s,{title:p.TITLE_STYLE,visible:this.props.visible,disabled:this.props.disabled,onDoubleClick:this.props.onVisibilityToggle}),r.createElement("div",{className:e},n))}});n.exports=m}),define("js/jsx/mixin/Draggable",["require","exports","module"],function(e,t,n){"use strict";var r=function(e){return{position:{top:e.state.clientY,left:e.state.clientX}}},i=function(e){return e.props.axis==="both"||e.props.axis==="y"},s=function(e){return e.props.axis==="both"||e.props.axis==="x"};n.exports={componentWillMount:function(){this.props.className=this.props.dragTargetClass},componentWillUnmount:function(){window.removeEventListener("mousemove",this._handleDragMove,!0),window.removeEventListener("mouseup",this._handleDragFinish,!0)},getDefaultProps:function(){return{axis:"both",start:{x:0,y:0},dragTargetClass:"drag_target",dragPlaceholderClass:"drag_placeholder"}},getInitialState:function(){return{dragging:!1,startX:0,startY:0,offsetX:0,offsetY:0,clientX:this.props.start.x,clientY:this.props.start.y,dragClass:this.props.dragTargetClass,dragStyle:{top:0,left:0}}},_handleDragStart:function(){window.addEventListener("mousemove",this._handleDragMove,!0),window.addEventListener("mouseup",this._handleDragFinish,!0),this.setState({dragStyle:{top:0,left:0}})},_handleDragMove:function(e){if(!this.state.dragging){var t=this.getDOMNode();this.setState({dragging:!0,offsetX:e.clientX,offsetY:e.clientY,clientX:this.props.start.x,clientY:this.props.start.y,startX:parseInt(t.style.left,10)||0,startY:parseInt(t.style.top,10)||0,dragClass:this.props.dragPlaceholderClass}),this.props.onDragStart&&this.props.onDragStart(this,e,r(this))}else{var n=this.state.startX+(e.clientX-this.state.offsetX),o=this.state.startY+(e.clientY-this.state.offsetY);this.setState({clientX:n,clientY:o,dragStyle:{top:i(this)?this.state.clientY:this.state.startY,left:s(this)?this.state.clientX:this.state.startX}}),this.props.onDragMove&&this.props.onDragMove(this,e,r(this))}},_handleDragFinish:function(e){window.removeEventListener("mousemove",this._handleDragMove,!0),window.removeEventListener("mouseup",this._handleDragFinish,!0);if(!this.state.dragging)return;this.setState({clientX:this.state.startX,clientY:this.state.startY,dragging:!1,dragClass:this.props.dragTargetClass}),this.props.onDragStop&&this.props.onDragStop(this,e,r(this))}}}),define("jsx!js/jsx/sections/pages/LayerFace",["require","exports","module","react","fluxxor","lodash","js/jsx/mixin/Draggable","jsx!js/jsx/shared/Button","jsx!js/jsx/shared/SVGIcon","jsx!js/jsx/shared/ToggleButton","jsx!js/jsx/shared/TextInput","js/util/system","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=r.addons.classSet,u=e("lodash"),a=e("js/jsx/mixin/Draggable"),f=e("jsx!js/jsx/shared/Button"),l=e("jsx!js/jsx/shared/SVGIcon"),c=e("jsx!js/jsx/shared/ToggleButton"),h=e("jsx!js/jsx/shared/TextInput"),p=e("js/util/system"),d=e("i18n!nls/strings"),v=r.createClass({displayName:"LayerFace",mixins:[s,a],_handleLayerNameChange:function(e,t){this.getFlux().actions.layers.rename(this.props.document,this.props.layer,t)},_skipToNextLayerName:function(e){e.stopPropagation()},_handleLayerClick:function(e){var t="select";if(e.shiftKey)t="addUpTo";else if(p.isMac?e.metaKey:e.ctrlKey){var n=this.props.layer.selected;n?t="deselect":t="add"}e.stopPropagation(),this.getFlux().actions.layers.select(this.props.document,this.props.layer,t)},_handleVisibilityToggle:function(e,t){this.getFlux().actions.layers.setVisibility(this.props.document,this.props.layer,!t),e.stopPropagation()},_handleLayerEdit:function(e){var t=this.props.layer;if(t.locked||!t.visible)return;this.getFlux().actions.superselect.editLayer(this.props.document,this.props.layer),e.stopPropagation()},_handleLockToggle:function(e,t){this.getFlux().actions.layers.setLocking(this.props.document,this.props.layer,t),e.stopPropagation()},_handleWheel:function(e){var t=this.refs.layerName;if(!t.isEditing()&&e.target===t.getDOMNode()&&e.deltaX){var n=e.nativeEvent,r=new window.WheelEvent(e.type,Object.create(n,{deltaX:{value:0},wheelDeltaX:{value:0},wheelDelta:{value:n.wheelDeltaY}}));e.preventDefault(),e.target.dispatchEvent(r)}},render:function(){var e=this.props.document,t=this.props.layer,n=e.layers,i=n.indexOf(t),s=!t.isBackground,a=n.hasInvisibleAncestor(t),p=n.hasLockedAncestor(t),v=t.selected,m=!v&&n.hasSelectedAncestor(t),g=i%2===0,y=!g,b=this.props.dragTarget===t,w=this.props.dropTarget===t,E=w&&this.props.dropAbove,S=w&&!this.props.dropAbove,x={face:!0,face__select_immediate:v,face__select_ancestor:m,face__invisible:a,face__locked:p,face__parity_even:g,face__parity_odd:y,face__drag_target:b,face__drop_target:w,face__drop_target_above:E,face__drop_target_below:S,face__group_start:t.kind===t.layerKinds.GROUP};x[this.state.dragClass]=!0;var T=u().range(n.depth(t)).map(function(e){var t="face__leash column-half",n=t+" depth-"+e;return r.createElement("div",{className:n,key:e})}).value(),N;this.props.dragTarget===this.props.layer?N=this.state.dragStyle:N={};var C=u.repeat("​",i),k="layer-";t.isArtboard?k+="artboard":t.kind===t.layerKinds.BACKGROUND?k+=t.layerKinds.PIXEL:t.kind===t.layerKinds.SMARTOBJECT&&t.isLinked?k+=t.kind+"-linked":k+=t.kind;var L=t.isBackground?null:r.createElement(c,{disabled:this.props.disabled,title:d.TOOLTIPS.SET_LAYER_VISIBILITY+C,className:"face__button_visibility",size:"column-2",buttonType:"layer-visibility",selected:!t.visible,onClick:this._handleVisibilityToggle});return r.createElement("div",{style:N,className:o(x),"data-layer-id":t.id,onClick:!this.props.disabled&&this._handleLayerClick,onMouseDown:!this.props.disabled&&this._handleDragStart},T,r.createElement(f,{title:d.LAYER_KIND[t.kind]+C,disabled:this.props.disabled,className:"face__kind","data-kind":t.isArtboard?"artboard":t.kind,onDoubleClick:this._handleLayerEdit},r.createElement(l,{CSSID:k,viewbox:"0 0 24 24"})),r.createElement("span",{className:"face__separator"},r.createElement(h,{title:t.name+C,className:"face__name",ref:"layerName",type:"text",value:t.name,editable:!this.props.disabled&&s,onKeyDown:this._skipToNextLayerName,onWheel:this._handleWheel,onChange:this._handleLayerNameChange}),L),r.createElement(c,{disabled:this.props.disabled,title:d.TOOLTIPS.LOCK_LAYER+C,className:"face__button_locked",size:"column-2",buttonType:"toggle-lock",selected:t.locked,onClick:this._handleLockToggle}))}});n.exports=v}),define("jsx!js/jsx/sections/pages/Layer",["require","exports","module","react","immutable","jsx!./LayerFace"],function(e,t,n){"use strict";var r=e("react"),i=e("immutable"),s=e("jsx!./LayerFace"),o=r.createClass({displayName:"Layer",shouldComponentUpdate:function(e){var t=function(e){var t=e.document,n=e.layer;return t&&t.layers.descendants(n)},n=function(e){var t=e.document,n=e.layer;return t&&t.layers.ancestors(n)};return this.props.dragTarget!==e.dragTarget||this.props.dropTarget!==e.dropTarget||this.props.dropAbove!==e.dropAbove||!i.is(n(this.props),n(e))||!i.is(t(this.props),t(e))},render:function(){var e=this.props.document,t=this.props.layer,n=e?e.layers.children(t):i.List(),u=n.toSeq().filter(function(e){return e.kind!==e.layerKinds.GROUPEND}).map(function(t){return r.createElement("li",{key:t.key},r.createElement(o,r.__spread({},this.props,{document:e,layer:t})))},this),a;u.isEmpty()?a=null:a=r.createElement("ul",null,u.toArray());var f=r.createElement(s,r.__spread({},this.props,{document:e,layer:t}));return r.createElement("div",null,f,a)}});n.exports=o}),define("jsx!js/jsx/sections/pages/PagesPanel",["require","exports","module","react","fluxxor","immutable","lodash","adapter/os","jsx!js/jsx/shared/TitleHeader","jsx!./Layer","js/util/math","i18n!nls/strings","js/util/collection","js/util/synchronization"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("immutable"),u=e("lodash"),a=e("adapter/os"),f=e("jsx!js/jsx/shared/TitleHeader"),l=e("jsx!./Layer"),c=e("js/util/math"),h=e("i18n!nls/strings"),p=e("js/util/collection"),d=e("js/util/synchronization"),v=10,m=function(e){var t=e.document;if(!t)return null;var n=t.layers.all;return p.pluck(n,"face")},g=r.createClass({displayName:"PagesPanel",mixins:[s],_setTooltipThrottled:null,_lowestNode:null,_bottomNodeBounds:null,componentWillMount:function(){this._setTooltipThrottled=d.throttle(a.setTooltip,a,500)},componentDidMount:function(){if(!this.props.document)return;this._scrollToSelection(this.props.document.layers.selected),this._updateLowestNode(),this._bottomNodeBounds=0},componentDidUpdate:function(e){var t=function(e){return e.document?e.document.layers.selected:o.List()},n=t(e),r=t(this.props),i=p.difference(r,n);this._scrollToSelection(i),i.isEmpty()||this._updateLowestNode()},shouldComponentUpdate:function(e,t){return this.props.disabled!==e.disabled?!0:this.state.dragTarget||t.dragTarget?!0:!this.props.visible&&!e.visible?!1:this.props.visible!==e.visible?!0:!o.is(m(this.props),m(e))},getInitialState:function(){return{}},_updateLowestNode:function(){if(!this.refs.parent)return;var e=this.refs.parent.getDOMNode(),t=e.querySelectorAll(".face");this._lowestNode=u.reduce(t,function(e,t){return e.getBoundingClientRect().bottom<t.getBoundingClientRect().bottom?t:e},t[0])},_scrollToSelection:function(e){if(e.size>0){var t=e.first(),n=this.refs.container.getDOMNode(),r=n.querySelector("[data-layer-id='"+t.id+"'");r&&r.scrollIntoViewIfNeeded()}},_validDropTarget:function(e,t,n){var r=this.props.document,i;if(t.isBackground&&!n)return!1;var s=e.some(function(e){return e.isArtboard});if(s&&(!n||!t.isArtboard)){var o=r.layers.ancestors(t).some(function(e){return e.isArtboard});if(o)return!1}var u=r.layers.depth(t),a=e.some(function(e){var t=r.layers.depth(e),i=r.layers.maxDescendantDepth(e)-t,s=n?0:1;return i+u+s>v});if(a)return!1;while(!e.isEmpty()){i=e.first(),e=e.shift();if(t===i)return!1;if(i.kind===i.layerKinds.GROUPEND&&n&&r.layers.indexOf(i)-r.layers.indexOf(t)===1)return!1;e=e.concat(r.layers.children(i))}return!0},_validDropTargetIndex:function(e,t){var n=this.props.document,r=c.parseNumber(this._lowestNode.getAttribute("data-layer-id")),i=n.layers.byID(r),s;if(t===0&&i&&i.isBackground)return!1;while(!e.isEmpty()){s=e.first(),e=e.shift();if(t===n.layers.indexOf(s))return!1;if(s.kind===s.layerKinds.GROUPEND&&n.layers.indexOf(s)-t===1)return!1;e=e.concat(n.layers.children(s))}return!0},_validDragTarget:function(e){return!e.isBackground},_getDraggingLayers:function(e){var t=this.props.document;return e.selected?t.layers.selected.filter(function(e){return this._validDragTarget(e)},this):o.List.of(e)},_handleStart:function(e){if(!this._validDragTarget(e.props.layer))return;this._bottomNodeBounds=(2*this._lowestNode.getBoundingClientRect().bottom+this._lowestNode.getBoundingClientRect().top)/3,this.setState({dragTarget:e.props.layer})},_handleDrag:function(e,t){if(!this._validDragTarget(e.props.layer))return;var n=t.y,r=e.getDOMNode(),i=this.refs.parent.getDOMNode(),s=i.querySelectorAll(".face"),o=null,a=!1,f=!1,l=this._getDraggingLayers(e.props.layer);u.some(s,function(e){if(e===r)return;var t=e.getBoundingClientRect(),i=(t.top+t.bottom)/2;if(t.top<=n&&n<t.bottom)return o=e,n>this._bottomNodeBounds&&this._validDropTargetIndex(l,0)&&(f=!0),n<=i?a=!0:a=!1,!0},this);if(!o){n>this._bottomNodeBounds&&this._validDropTargetIndex(l,0)&&this.setState({dropTarget:this._lowestNode,reallyBelow:!0});return}var h=this.props.document,p=c.parseNumber(o.getAttribute("data-layer-id")),d=h.layers.byID(p);this._validDropTarget(l,d,a)||(d=null),d!==this.state.dropTarget?this.setState({dropTarget:d,dropAbove:a,reallyBelow:f}):a!==this.state.dropAbove&&this.setState({dropAbove:a,reallyBelow:f})},_handleStop:function(e){if(this.state.dropTarget){var t=this.getFlux(),n=this.props.document,r=e.props.layer,i=[r.id],s=n.layers.indexOf(this.state.dropTarget)-(this.state.dropAbove?0:1);this.state.reallyBelow&&(s=0),i=p.pluck(this._getDraggingLayers(r),"id"),t.actions.layers.reorder(n.id,i,s).bind(this).finally(function(){this.setState({dragTarget:null,dropTarget:null,dropAbove:null,reallyBelow:null})})}else this.setState({dragTarget:null,dropAbove:null})},_handleContainerClick:function(){this.getFlux().actions.layers.deselectAll()},_handleScroll:function(){this._setTooltipThrottled("")},render:function(){var e=this.props.document,t,n,i;!e||!this.props.visible?(t=null,i=null):(n=e.layers.top.map(function(t){return r.createElement("li",{key:t.key},r.createElement(l,{disabled:this.props.disabled,document:e,layer:t,axis:"y",dragTargetClass:"face__target",dragPlaceholderClass:"face__placeholder",onDragStart:this._handleStart,onDragMove:this._handleDrag,onDragStop:this._handleStop,dragTarget:this.state.dragTarget,dropTarget:this.state.dropTarget,dropAbove:this.state.dropAbove,reallyBelow:this.state.reallyBelow}))},this).toArray(),i=r.createElement("ul",{ref:"parent",className:"layer-list"},n),t=r.createElement("div",{title:h.TOOLTIPS.LAYER_COUNT,className:"layer-count"},e.layers.selected.size,r.createElement("span",{className:"text-fancy"}," oƒ "),e.layers.count));var s=r.addons.classSet({"section-container":!0,"section-container__collapsed":!this.props.visible}),o=r.addons.classSet({pages:!0,section:!0,"section__sibling-collapsed":!this.props.visibleSibling});return r.createElement("section",{className:o,ref:"pagesSection",onScroll:this._handleScroll},r.createElement(f,{title:h.TITLE_PAGES,visible:this.props.visible,disabled:this.props.disabled,onDoubleClick:this.props.onVisibilityToggle},t),r.createElement("div",{ref:"container",className:s,onClick:this._handleContainerClick},i))}});n.exports=g}),define("js/util/path",["require","exports","module","./system","lodash"],function(e,t){"use strict";var n=e("./system"),r=e("lodash"),i=n.isMac?"/":"\\",s=function(e){var t=e.lastIndexOf(i);return t===-1?e:e.substring(t+1)},o=function(e){var t=function(e,t,n){return e.filter(function(e){return e[n]===t})},n=e.map(function(e){return e.split(i).reverse()}),s=n.map(function(e){var r=0,i,s=!1,o=n;while(!s&&r<e.length)i=e[r],o=t(o,i,r),o.length===1&&(s=!0),r++;return r});return n.map(function(e,t){return r.take(e,s[t]).reverse().join(i)})};t.sep=i,t.basename=s,t.getShortestUniquePaths=o}),define("jsx!js/jsx/sections/nodoc/RecentFiles",["require","exports","module","react","fluxxor","i18n!nls/strings","js/util/path","jsx!js/jsx/shared/TitleHeader"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("i18n!nls/strings"),u=e("js/util/path"),a=e("jsx!js/jsx/shared/TitleHeader"),f=10,l=r.createClass({displayName:"RecentFiles",mixins:[s],propTypes:{recentFiles:r.PropTypes.arrayOf(r.PropTypes.string).isRequired},_openFile:function(e,t){this.getFlux().actions.documents.open(e),t.stopPropagation()},render:function(){var e=this.props.recentFiles.slice(0,f),t=u.getShortestUniquePaths(e),n=t.map(function(e,t){var n=this.props.recentFiles[t];return r.createElement("li",{key:t,className:"link-list__item overflow-ellipsis",onClick:this._openFile.bind(this,n)},e)},this);return r.createElement("section",{className:"recent-files section"},r.createElement(a,{title:o.NO_DOC.RECENT_FILES_TITLE}),r.createElement("div",{className:"section-container"},r.createElement("ul",{className:"link-list__list"},n)))}});n.exports=l}),define("text!static/templates.json",[],function(){return'[\n    {\n        "id": "IPHONE_6",\n        "preset": "iPhone 6 (750, 1334)",\n        "width": 750,\n        "height": 1334\n    },\n    {\n        "id": "IPHONE_6_PLUS",\n        "preset": "iPhone 6 Plus (1242, 2208)",\n        "width": 1242,\n        "height": 2208\n    },\n    {\n        "id": "IPHONE_5",\n        "preset": "iPhone 5 (640, 1136)",\n        "width": 640,\n        "height": 1136\n    },\n    {\n        "id": "IPAD_12",\n        "preset": "iPad Mini (768, 1024)",\n        "width": 768,\n        "height": 1024\n    },\n    {\n        "id": "IPAD_34",\n        "preset": "iPad Retina (1536, 2048)",\n        "width": 1536,\n        "height": 2048\n    },\n    {\n        "id": "ANDROID_1080P",\n        "preset": "Android 1080p (1920, 1080)",\n        "width": 1920,\n        "height": 1080\n    },\n    {\n        "id": "MS_SURFACE_PRO",\n        "preset": "Microsoft Surface Pro (1920, 1080)",\n        "width": 1920,\n        "height": 1080\n    },\n    {\n        "id": "MS_SURFACE_PRO_3",\n        "preset": "Microsoft Surface Pro 3 (2160, 1440)",\n        "width": 2160,\n        "height": 1440\n    },\n    {\n        "id": "APPLE_WATCH_38MM",\n        "preset": "Apple Watch 38mm (272, 340)",\n        "width": 272,\n        "height": 340\n    },\n    {\n        "id": "APPLE_WATCH_42MM",\n        "preset": "Apple Watch 42mm (312, 390)",\n        "width": 312,\n        "height": 390\n    },\n    {\n        "id": "WEB_1440_900",\n        "preset": "Web (1440, 900)",\n        "width": 1440,\n        "height": 900\n    },\n    {\n        "id": "WEB_1920_1080",\n        "preset": "Web (1920, 1080)",\n        "width": 1920,\n        "height": 1080\n    }\n]\n'}),define("jsx!js/jsx/sections/nodoc/ArtboardPresets",["require","exports","module","react","fluxxor","i18n!nls/strings","jsx!js/jsx/shared/TitleHeader","text!static/templates.json"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("i18n!nls/strings"),u=e("jsx!js/jsx/shared/TitleHeader"),a=e("text!static/templates.json"),f=JSON.parse(a),l=r.createClass({displayName:"ArtboardPresets",mixins:[s],_openTemplate:function(e,t){var n={preset:e.preset};this.getFlux().actions.documents.createNew(n),t.stopPropagation()},render:function(){var e=f.map(function(e,t){return r.createElement("li",{key:t,className:"link-list__item",onClick:this._openTemplate.bind(this,e)},r.createElement("span",null,o.TEMPLATES[e.id]),r.createElement("span",null,e.width," x ",e.height))},this);return r.createElement("section",{className:"artboard-presets section"},r.createElement(u,{title:o.NO_DOC.ARTBOARD_PRESETS_TITLE}),r.createElement("div",{className:"section-container artboard-launcher__body"},r.createElement("ul",{className:"link-list__list"},e)))}});n.exports=l}),define("jsx!js/jsx/Properties",["require","exports","module","react","fluxxor","immutable","jsx!./sections/transform/TransformPanel","jsx!./sections/style/StylePanel","jsx!./sections/pages/PagesPanel","jsx!./sections/nodoc/RecentFiles","jsx!./sections/nodoc/ArtboardPresets"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=i.StoreWatchMixin,u=e("immutable"),a=e("jsx!./sections/transform/TransformPanel"),f=e("jsx!./sections/style/StylePanel"),l=e("jsx!./sections/pages/PagesPanel"),c=e("jsx!./sections/nodoc/RecentFiles"),h=e("jsx!./sections/nodoc/ArtboardPresets"),p=r.createClass({displayName:"Properties",mixins:[s,o("document","application","preferences")],getStateFromFlux:function(){var e=this.getFlux().store("application"),t=e.getCurrentDocument(),n=t&&t.unsupported,r=this.getFlux().store("preferences"),i=r.getState(),s=!n&&i.get("styleVisible",!0),o=n||i.get("pagesVisible",!0);return{activeDocumentInitialized:e.getState().activeDocumentInitialized,recentFilesInitialized:e.getState().recentFilesInitialized,recentFiles:e.getRecentFiles(),document:t,disabled:n,styleVisible:s,pagesVisible:o}},shouldComponentUpdate:function(e,t){return this.state.styleVisible!==t.styleVisible||this.state.pagesVisible!==t.pagesVisible||this.state.activeDocumentInitialized!==t.activeDocumentInitialized||this.state.recentFilesInitialized!==t.recentFilesInitialized||!u.is(this.state.document,t.document)||!t.document&&!u.is(this.state.recentFiles,t.recentFiles)},_handleVisibilityToggle:function(e){if(this.state.disabled)return;var t=e?"pagesVisible":"styleVisible",n=e?"styleVisible":"pagesVisible",r={};this.state[t]?(r[t]=!1,r[n]=!0):r[t]=!0,this.getFlux().actions.preferences.setPreferences(r),this.setState(r)},render:function(){var e=this.state.document,t=this.state.disabled;return this.state.activeDocumentInitialized&&e?r.createElement("div",{className:"properties"},r.createElement(a,{disabled:t,document:e}),r.createElement(f,{disabled:t,document:e,visible:this.state.styleVisible,visibleSibling:this.state.pagesVisible,onVisibilityToggle:this._handleVisibilityToggle.bind(this,!1)}),r.createElement(l,{disabled:t,document:e,visible:this.state.pagesVisible,visibleSibling:this.state.styleVisible,onVisibilityToggle:this._handleVisibilityToggle.bind(this,!0)})):this.state.recentFilesInitialized?r.createElement("div",{className:"properties"},r.createElement(c,{recentFiles:this.state.recentFiles||[]}),r.createElement(h,null)):r.createElement("div",{className:"properties"})}});n.exports=p}),define("jsx!js/jsx/DocumentHeader",["require","exports","module","react","fluxxor","jsx!js/jsx/shared/Button","jsx!js/jsx/shared/Gutter","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=i.StoreWatchMixin,u=e("jsx!js/jsx/shared/Button"),a=e("jsx!js/jsx/shared/Gutter"),f=e("i18n!nls/strings"),l=r.createClass({displayName:"DocumentHeader",mixins:[s,o("application","document")],getInitialState:function(){return{}},getStateFromFlux:function(){var e=this.getFlux().store("application"),t=e.getCurrentDocument(),n=e.getDocumentCount();return{document:t,count:n}},_moveBack:function(){this.getFlux().actions.documents.selectPreviousDocument()},_moveForward:function(){this.getFlux().actions.documents.selectNextDocument()},render:function(){var e=this.state.document,t=e&&e.dirty?"•":"",n=e?e.name:"",i=this.state.count<2,s=e&&e.unsupported&&r.createElement("span",{title:f.TOOLTIPS.UNSUPPORTED_FEATURES,className:"document-controls__unsupported"},"!"),o=r.addons.classSet({"document-container":!0,"document-container__withdoc":!!e}),l=r.addons.classSet({"document-controls__previous":!0,"document-controls__previous__disabled":i,"column-2":!0}),c=r.addons.classSet({"document-controls__next":!0,"document-controls__next__disabled":i,"column-2":!0});return r.createElement("div",{className:o},r.createElement("div",{className:"document-controls"},r.createElement(a,{size:"column-half"}),r.createElement(u,{title:f.TOOLTIPS.SELECT_PREVIOUS_DOCUMENT,className:l,onClick:this._moveBack}),r.createElement(a,null),r.createElement(u,{title:f.TOOLTIPS.SELECT_NEXT_DOCUMENT,className:c,onClick:this._moveForward})),r.createElement("div",{className:"document-header"},r.createElement("div",{className:"document-title",title:n},n,t,s)))}});n.exports=l}),define("jsx!js/jsx/shared/Carousel",["require","exports","module","react","fluxxor","adapter/os","js/util/synchronization","js/util/headlights","jsx!js/jsx/shared/SVGIcon","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=r.addons.CSSTransitionGroup,s=e("fluxxor"),o=s.FluxMixin(r),u=e("adapter/os"),a=e("js/util/synchronization"),f=e("js/util/headlights"),l=e("jsx!js/jsx/shared/SVGIcon"),c=e("i18n!nls/strings"),h=r.createClass({displayName:"Carousel",mixins:[o],propTypes:{items:r.PropTypes.arrayOf(r.PropTypes.node),wrapNavigation:r.PropTypes.bool,useContinueOnFirstSlide:r.PropTypes.bool,useDismissOnLastSlide:r.PropTypes.bool},_prevItemThrottled:null,_nextItemThrottled:null,componentWillMount:function(){this._prevItemThrottled=a.throttle(this._prevItem,this,700),this._nextItemThrottled=a.throttle(this._nextItem,this,700)},getInitialState:function(){return{index:0,direction:"forward"}},_gotoItem:function(e,t){this.setState({index:e,direction:this.state.index>e?"backward":"forward"}),t.stopPropagation()},_nextItem:function(e){var t=this.props.wrapNavigation?(this.state.index+1)%this.props.items.length:Math.min(this.state.index+1,this.props.items.length-1);this._gotoItem(t,e)},_prevItem:function(e){var t=this.state.index-1;t=this.props.wrapNavigation&&t<0?this.props.items.length+t:Math.max(t,0),this._gotoItem(t,e)},_handleClick:function(e){var t=this.getDOMNode();if(!t)return;var n=t.getBoundingClientRect();if(n.top<=e.clientY&&e.clientY<=n.bottom&&n.left<=e.clientX){var r=n.left+Math.floor(n.width/2);if(e.clientX<=r)return this._prevItem(e);if(e.clientX<=n.right)return this._nextItem(e)}},_buildNav:function(){if(!this.props.useContinueOnFirstSlide||this.state.index!==0)return this.props.items.map(function(e,t){var n=r.addons.classSet({current:t===this.state.index,dot:!0});return r.createElement("a",{key:"link"+t,className:n,onClick:this._gotoItem.bind(this,t)},r.createElement("span",null))},this)},_buildNextButton:function(){if(this.props.useContinueOnFirstSlide&&this.state.index===0)return r.createElement("a",{className:"carousel__slide-button__continue",onClick:this._gotoItem.bind(this,1)},c.FIRST_LAUNCH.CONTINUE);if(this.state.index<this.props.items.length-1)return r.createElement("a",{className:"carousel__slide-button__next",onClick:this._gotoItem.bind(this,this.state.index+1)},r.createElement(l,{viewBox:"0 0 6 10",CSSID:"carousel-right"}));if(this.props.useDismissOnLastSlide)return r.createElement("a",{className:"carousel__slide-button__started",onClick:this.props.dismissDialog},c.FIRST_LAUNCH.GET_STARTED)},_buildPreviousButton:function(){if(this.state.index>0)return r.createElement("a",{className:"carousel__slide-button__prev",onClick:this._gotoItem.bind(this,this.state.index-1)},r.createElement(l,{viewBox:"0 0 6 10",CSSID:"carousel-left"}))},render:function(){if(this.props.items.length===0)return null;var e=this.props.items[this.state.index],t=r.addons.cloneWithProps(e,{key:this.state.index,ref:e.ref}),n=r.addons.classSet(this.props.className,this.state.direction);return r.createElement("div",{className:n,onClick:this._handleClick},r.createElement(i,{transitionName:"carousel",component:"div"},t),r.createElement("div",{className:"carousel__nav"},this._buildPreviousButton(),this._buildNav(),this._buildNextButton()))},componentDidMount:function(){var e=this.getFlux();e.actions.shortcuts.addShortcut(u.eventKeyCode.ARROW_LEFT,{},this._prevItemThrottled,"L"+this.props.id,!0),e.actions.shortcuts.addShortcut(u.eventKeyCode.ARROW_RIGHT,{},this._nextItemThrottled,"R"+this.props.id,!0)},componentWillUnmount:function(){var e=this.getFlux();e.actions.shortcuts.removeShortcut("L"+this.props.id),e.actions.shortcuts.removeShortcut("R"+this.props.id),this.state.index<this.props.items.length-1?f.logEvent("UserInterface","introduction","earlyDismiss"):f.logEvent("UserInterface","introduction","dismissOnEnd")}});n.exports=h}),define("jsx!js/jsx/help/FirstLaunch",["require","exports","module","react","fluxxor","lodash","adapter","jsx!js/jsx/shared/Carousel","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("lodash"),u=e("adapter"),a=e("jsx!js/jsx/shared/Carousel"),f=e("i18n!nls/strings"),l=r.createClass({displayName:"FirstLaunch",mixins:[s],propTypes:{dismissDialog:r.PropTypes.func},getDefaultProps:function(){return{dismissDialog:o.identity}},_dismissDialog:function(e,t){e&&this.getFlux().actions.preferences.setPreference("showFirstLaunch",!1),o.isFunction(this.props.dismissDialog)&&this.props.dismissDialog(t)},_openURL:function(e,t){u.openURLInDefaultBrowser(e),t.stopPropagation()},render:function(){var e="https://www.adobe.com/go/designspace-twitter",t="https://www.adobe.com/go/designspace-forum",n="https://www.adobe.com/go/designspace-help.html",i="https://www.adobe.com/go/designspace-github",s=[r.createElement("div",{className:"carousel__slide__full"},r.createElement("h1",null,f.FIRST_LAUNCH.SLIDES[0].HEADLINE),r.createElement("h2",null,f.FIRST_LAUNCH.SLIDES[0].SUBHEAD),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[0].BODY)),r.createElement("div",{className:"carousel__slide"},r.createElement("div",{className:"carousel__slide__head"},r.createElement("img",{src:"img/first_launch/slide_2_head.png"})),r.createElement("div",{className:"carousel__slide__body"},r.createElement("h2",null,f.FIRST_LAUNCH.SLIDES[1].HEADLINE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[1].BODY))),r.createElement("div",{className:"carousel__slide"},r.createElement("div",{className:"carousel__slide__head"},r.createElement("ul",{className:"carousel__slide__head__list"},r.createElement("li",null,r.createElement("h3",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_SELECT.TITLE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_SELECT.BODY)),r.createElement("li",null,r.createElement("h3",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_VECTOR.TITLE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_VECTOR.BODY)),r.createElement("li",null,r.createElement("h3",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_MATH.TITLE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_MATH.BODY))),r.createElement("ul",{className:"carousel__slide__head__list"},r.createElement("li",null,r.createElement("h3",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_ARTBOARD.TITLE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_ARTBOARD.BODY)),r.createElement("li",null,r.createElement("h3",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_SWAP.TITLE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_SWAP.BODY)),r.createElement("li",null,r.createElement("h3",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_OS.TITLE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[2].FEATURE_OS.BODY,r.createElement("a",{onClick:this._openURL.bind(this,i)},"Github"),".")))),r.createElement("div",{className:"carousel__slide__body"},r.createElement("h2",null,f.FIRST_LAUNCH.SLIDES[2].HEADLINE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[2].BODY))),r.createElement("div",{className:"carousel__slide"},r.createElement("div",{className:"carousel__slide__head"},r.createElement("video",{autoPlay:"autoPlay",loop:"loop"},r.createElement("source",{src:"img/first_launch/getting-started-animation.ogg",type:"video/ogg"}))),r.createElement("div",{className:"carousel__slide__body"},r.createElement("h2",null,f.FIRST_LAUNCH.SLIDES[3].HEADLINE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[3].BODY))),r.createElement("div",{className:"carousel__slide"},r.createElement("div",{className:"carousel__slide__head links"},r.createElement("div",{className:"carousel__slide__block"},r.createElement("a",{className:"carousel__slide__block-link",onClick:this._openURL.bind(this,e)},r.createElement("div",{className:"block-link__image"},r.createElement("img",{src:"img/first_launch/twitter.svg"})),r.createElement("p",{className:"block-link__body"},"@psdesign"))),r.createElement("div",{className:"carousel__slide__block"},r.createElement("a",{className:"carousel__slide__block-link",onClick:this._openURL.bind(this,t)},r.createElement("div",{className:"block-link__image"},r.createElement("img",{src:"img/first_launch/ps_logo.svg"})),r.createElement("p",{className:"block-link__body"},"Forum"))),r.createElement("div",{className:"carousel__slide__block"},r.createElement("a",{className:"carousel__slide__block-link",onClick:this._openURL.bind(this,n)},r.createElement("div",{className:"block-link__image"},r.createElement("img",{src:"img/first_launch/help.png"})),r.createElement("p",{className:"block-link__body"},"Help")))),r.createElement("div",{className:"carousel__slide__body"},r.createElement("h2",null,f.FIRST_LAUNCH.SLIDES[4].HEADLINE),r.createElement("p",null,f.FIRST_LAUNCH.SLIDES[4].BODY)))];return r.createElement("div",{className:"first-launch__content"},r.createElement(a,{className:"first-launch__carousel",useContinueOnFirstSlide:!0,useDismissOnLastSlide:!0,dismissDialog:this._dismissDialog.bind(this,!0),items:s}))},componentWillUnmount:function(){this.getFlux().actions.preferences.setPreference("showFirstLaunch",!1)}});n.exports=l}),define("jsx!js/jsx/help/KeyboardShortcuts",["require","exports","module","react","lodash","js/util/system","i18n!nls/strings"],function(e,t,n){"use strict";var r=e("react"),i=e("lodash"),s=e("js/util/system"),o=e("i18n!nls/strings"),u=r.createClass({displayName:"KeyboardShortcuts",propTypes:{dismissDialog:r.PropTypes.func},getDefaultProps:function(){return{dismissDialog:i.identity}},_dismissDialog:function(e){i.isFunction(this.props.dismissDialog)&&this.props.dismissDialog(e)},render:function(){var e=o.KEYBOARD_SHORTCUTS,t=s.isMac?e.SELECT_TOOL.HOLD_SEL_MAC:e.SELECT_TOOL.HOLD_SEL_WIN,n=s.isMac?e.SELECT_TOOL.TARGET_LAYER_MAC:e.SELECT_TOOL.TARGET_LAYER_WIN;return r.createElement("div",{className:"keyboard-shortcut__content",onClick:this._dismissDialog},r.createElement("div",{className:"keyboard-shortcut__column-1"},r.createElement("h2",{className:"keyboard-shortcut__title"},e.TOOLS_TITLE),r.createElement("ul",{className:"keyboard-shortcut__list"},r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.TOOLS.SELECT),r.createElement("span",{className:"keyboard-shortcut__instr"},"V")),r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.TOOLS.RECTANGLE),r.createElement("span",{className:"keyboard-shortcut__instr"},"R")),r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.TOOLS.ELLIPSE),r.createElement("span",{className:"keyboard-shortcut__instr"},"E")),r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.TOOLS.PEN),r.createElement("span",{className:"keyboard-shortcut__instr"},"P")),r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.TOOLS.TYPE),r.createElement("span",{className:"keyboard-shortcut__instr"},"T")))),r.createElement("div",{className:"keyboard-shortcut__column-2"},r.createElement("h2",{className:"keyboard-shortcut__title"},e.SELECT_TITLE),r.createElement("ul",{className:"keyboard-shortcut__list"},r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.SELECT_TOOL.TARGET),r.createElement("span",{className:"keyboard-shortcut__instr"},e.SELECT_TOOL.TARGET_INSTRUCTION)),r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.SELECT_TOOL.EDIT_PATH),r.createElement("span",{className:"keyboard-shortcut__instr"},e.SELECT_TOOL.EDIT_PATH_INSTRUCTION)),r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.SELECT_TOOL.EDIT_SMART),r.createElement("span",{className:"keyboard-shortcut__instr"},e.SELECT_TOOL.EDIT_SMART_INSTRUCTION)),r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.SELECT_TOOL.BACK_OUT),r.createElement("span",{className:"keyboard-shortcut__instr"},e.SELECT_TOOL.BACK_OUT_INSTRUCTION)),r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.SELECT_TOOL.HOLD_SELECTION),r.createElement("span",{className:"keyboard-shortcut__instr"},t)),r.createElement("li",null,r.createElement("span",{className:"keyboard-shortcut__name"},e.SELECT_TOOL.TARGET_LAYER),r.createElement("span",{className:"keyboard-shortcut__instr"},n)))))}});n.exports=u}),define("jsx!js/jsx/Help",["require","exports","module","react","fluxxor","jsx!./shared/Dialog","jsx!./help/FirstLaunch","jsx!./help/KeyboardShortcuts","adapter/os"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("jsx!./shared/Dialog"),u=e("jsx!./help/FirstLaunch"),a=e("jsx!./help/KeyboardShortcuts"),f=e("adapter/os"),l="first-launch-dialog",c="keyboard-shortcut-dialog",h=r.createClass({displayName:"Help",mixins:[s],_closeFirstLaunch:function(){this.getFlux().actions.dialog.closeDialog(l)},_closeKeyboardShortcut:function(){this.getFlux().actions.dialog.closeDialog(c)},render:function(){return r.createElement("div",null,r.createElement(o,{id:l,modal:!0,position:o.POSITION_METHODS.CENTER,dismissOnCanvasClick:!0,dismissOnWindowClick:!0,dismissOnWindowResize:!1,dismissOnKeys:[{key:f.eventKeyCode.ESCAPE,modifiers:null}],className:"first-launch__dialog"},r.createElement(u,{dismissDialog:this._closeFirstLaunch})),r.createElement(o,{id:c,modal:!0,position:o.POSITION_METHODS.CENTER,dismissOnCanvasClick:!0,dismissOnWindowClick:!0,dismissOnWindowResize:!1,dismissOnKeys:[{key:f.eventKeyCode.ESCAPE,modifiers:null}],className:"keyboard-shortcut__dialog"},r.createElement(a,{dismissDialog:this._closeKeyboardShortcut})))}});n.exports=h}),define("jsx!js/jsx/Main",["require","exports","module","react","fluxxor","jsx!js/jsx/Toolbar","jsx!js/jsx/Scrim","jsx!js/jsx/Properties","jsx!js/jsx/DocumentHeader","jsx!js/jsx/Help"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=e("jsx!js/jsx/Toolbar"),u=e("jsx!js/jsx/Scrim"),a=e("jsx!js/jsx/Properties"),f=e("jsx!js/jsx/DocumentHeader"),l=e("jsx!js/jsx/Help"),c=["input","change","click","dblclick","mousedown","mousemove","mouseup","touchstart","touchmove","touchend","keydown","keypress","keyup","focus","blur","paste","selectionchange"],h=r.createClass({displayName:"Main",mixins:[s],getInitialState:function(){return{ready:!1,inputEnabled:!1}},_suppressBodyKeydown:function(e){e.target===window.document.body&&e.preventDefault()},_blockInput:function(e){e.stopPropagation()},_enableInput:function(){c.forEach(function(e){window.removeEventListener(e,this._blockInput,!0)},this)},_disableInput:function(){c.forEach(function(e){window.addEventListener(e,this._blockInput,!0)},this)},_handleControllerReady:function(){this.setState({ready:!0,active:!0})},_handleControllerLock:function(){this.setState({active:!1})},_handleControllerUnlock:function(){this.setState({active:!0})},componentWillMount:function(){window.document.body.addEventListener("keydown",this._suppressBodyKeydown,!0),this.props.controller.on("ready",this._handleControllerReady),this.props.controller.on("lock",this._handleControllerLock),this.props.controller.on("unlock",this._handleControllerUnlock),this._disableInput()},componentWillUnmount:function(){window.document.body.removeEventListener("keydown",this._suppressBodyKeydown),this.props.controller.off("ready",this._handleControllerReady),this.props.controller.off("lock",this._handleControllerLock),this.props.controller.off("unlock",this._handleControllerUnlock),this._enableInput()},componentDidUpdate:function(e,t){var n={propertiesWidth:this.refs.properties.getDOMNode().clientWidth,headerHeight:this.refs.docHeader.getDOMNode().clientHeight};this.getFlux().actions.ui.updatePanelSizes(n),this.getFlux().actions.tools.resetSuperselect(),this.state.ready&&(this.state.active&&!t.active?this._enableInput():!this.state.active&&t.active&&this._disableInput())},render:function(){var e=r.addons.classSet({main:!0,main__ready:this.state.ready});return r.createElement("div",{className:e},r.createElement(u,null),r.createElement(f,{ref:"docHeader"}),r.createElement(o,null),r.createElement(a,{ref:"properties"}),r.createElement(l,null))}});n.exports=h}),define("js/locks",["require","exports","module","lodash"],function(e,t,n){"use strict";var r=e("lodash"),i={PS_APP:"psApp",JS_APP:"jsApp",PS_DOC:"psDoc",JS_DOC:"jsDoc",PS_TOOL:"psTool",JS_TOOL:"jsTool",PS_MENU:"psMenu",JS_MENU:"jsMenu",JS_DIALOG:"jsDialog",JS_TYPE:"jsType",JS_POLICY:"jsPolicy",JS_SHORTCUT:"jsShortcut",JS_UI:"jsUI",JS_PREF:"jsPref"},s=r.values(i),o=[i.PS_APP,i.PS_DOC,i.PS_TOOL,i.PS_MENU],u=[i.JS_APP,i.JS_DOC,i.JS_TOOL,i.PS_MENU,i.JS_DIALOG];n.exports=i,n.exports.ALL_LOCKS=s,n.exports.ALL_PS_LOCKS=o,n.exports.ALL_JS_LOCKS=u}),define("js/events",["require","exports","module"],function(e,t,n){"use strict";n.exports={example:{SYNC_ACTION:"syncAction",ASYNC_ACTION_START:"asyncActionStart",ASYNC_ACTION_SUCCESS:"asyncActionSuccess",ASYNC_ACTION_FAIL:"asyncActionFail"},application:{HOST_VERSION:"hostVersion",UPDATE_RECENT_FILES:"updateRecentFiles",INITIALIZED:"appInitialized"},document:{SELECT_DOCUMENT:"selectDocument",OPEN_DOCUMENT:"openDocument",NEW_DOCUMENT:"newDocument",SAVE_DOCUMENT:"saveDocument",CLOSE_DOCUMENT:"closeDocument",DOCUMENT_RENAMED:"renameDocument",DOCUMENT_UPDATED:"updateDocument",CURRENT_DOCUMENT_UPDATED:"updateCurrentDocument",RESIZE_DOCUMENT:"resizeDocument",RESET_DOCUMENTS:"resetDocuments",ADD_LAYERS:"addLayers",GUIDES_VISIBILITY_CHANGED:"guidesVisibilityChanged",RESET_LAYERS:"resetLayers",RESET_LAYERS_BY_INDEX:"resetLayersByIndex",RESET_BOUNDS:"resetBounds",DELETE_LAYERS:"deleteLayers",SELECT_LAYERS_BY_ID:"selectLayersByID",SELECT_LAYERS_BY_INDEX:"selectLayersByIndex",RENAME_LAYER:"renameLayer",GROUP_SELECTED:"groupSelectedLayers",VISIBILITY_CHANGED:"layerVisibilityChanged",LOCK_CHANGED:"layerLockChanged",OPACITY_CHANGED:"opacityChanged",BLEND_MODE_CHANGED:"blendModeChanged",REORDER_LAYERS:"reorderLayers",REPOSITION_LAYERS:"repositionLayers",NUDGE_LAYERS:"nudgeLayers",LAYER_BOUNDS_CHANGED:"layerBoundsChanged",TRANSLATE_LAYERS:"translateLayers",RESIZE_LAYERS:"resizeLayers",SET_LAYERS_PROPORTIONAL:"setLayersProportional",FLIP_LAYERS:"flipLayers",STROKE_ENABLED_CHANGED:"strokeEnabledChanged",STROKE_WIDTH_CHANGED:"strokeWidthChanged",STROKE_COLOR_CHANGED:"strokeColorChanged",STROKE_OPACITY_CHANGED:"strokeOpacityChanged",STROKE_ALIGNMENT_CHANGED:"strokeAlignmentChanged",STROKE_ADDED:"strokeAdded",FILL_COLOR_CHANGED:"fillColorChanged",FILL_OPACITY_CHANGED:"fillOpacityChanged",FILL_ADDED:"fillAdded",LAYER_EFFECT_CHANGED:"layerEffectChanged",RADII_CHANGED:"radiiChanged",TYPE_FACE_CHANGED:"typeFaceChanged",TYPE_SIZE_CHANGED:"typeSizeChanged",TYPE_COLOR_CHANGED:"typeColorChanged",TYPE_TRACKING_CHANGED:"typeTrackingChanged",TYPE_LEADING_CHANGED:"typeLeadingChanged",TYPE_ALIGNMENT_CHANGED:"typeAlignmentChanged"},tool:{SELECT_TOOL:"selectTool",MODAL_STATE_CHANGE:"modalStateChange"},ui:{TRANSFORM_UPDATED:"transformUpdated",PANELS_RESIZED:"panelsResized",TOOLBAR_PINNED:"toolbarPinned",TOGGLE_OVERLAYS:"toggleOverlays",SUPERSELECT_MARQUEE:"superselectMarquee"},shortcut:{ADD_SHORTCUT:"addShortcut",REMOVE_SHORTCUT:"removeShortcut"},dialog:{REGISTER_DIALOG:"registerDialog",DEREGISTER_DIALOG:"deregisterDialog",OPEN_DIALOG:"openDialog",CLOSE_DIALOG:"closeDialog",CLOSE_ALL_DIALOGS:"closeAllDialogs"},font:{INIT_FONTS:"initFonts"},menus:{INIT_MENUS:"initMenus",UPDATE_MENUS:"updateMenus"},preferences:{SET_PREFERENCE:"setPreference",SET_PREFERENCES:"setPreferences",DELETE_PREFERENCE:"deletePreference",CLEAR_PREFERENCES:"clearPreferences"},history:{NEW_HISTORY_STATE:"newHistoryState",HISTORY_STATE_CHANGE:"historyStateChange"}}}),define("js/stores/application",["require","exports","module","lodash","fluxxor","../events"],function(e,t,n){"use strict";var r=e("lodash"),i=e("fluxxor"),s=e("../events"),o=i.createStore({_hostVersion:null,_initialized:null,_documentIDs:null,_selectedDocumentIndex:null,_selectedDocumentID:null,_recentFiles:null,initialize:function(){this._documentIDs=[],this._recentFiles=[],this._initialized=new Map,this.bindActions(s.application.HOST_VERSION,this.setHostVersion,s.application.INITIALIZED,this._setInitialized,s.application.UPDATE_RECENT_FILES,this._updateRecentFileList,s.document.DOCUMENT_UPDATED,this._updateDocument,s.document.CLOSE_DOCUMENT,this._closeDocument,s.document.RESET_DOCUMENTS,this._resetDocuments,s.document.SELECT_DOCUMENT,this._documentSelected)},getState:function(){return{hostVersion:this._hostVersion,activeDocumentInitialized:this._initialized.get("activeDocument"),recentFilesInitialized:this._initialized.get("recentFiles"),documentIDs:this._documentIDs,selectedDocumentIndex:this._selectedDocumentIndex,selectedDocumentID:this._documentIDs[this._selectedDocumentIndex]}},getCurrentDocumentID:function(){return this._selectedDocumentID},getRecentFiles:function(){return this._recentFiles},getCurrentDocument:function(){var e=this.flux.store("document");return e.getDocument(this._selectedDocumentID)},getDocumentCount:function(){return this._documentIDs.length},_getNextPrevDocument:function(e){if(this._selectedDocumentID===null)return null;var t=e?1:-1,n=this._selectedDocumentIndex+t;n===this._documentIDs.length?n=0:n===-1&&(n=this._documentIDs.length-1);var r=this.flux.store("document"),i=this._documentIDs[n];return r.getDocument(i)},getNextDocument:function(){return this._getNextPrevDocument(!0)},getPreviousDocument:function(){return this._getNextPrevDocument(!1)},setHostVersion:function(e){var t=[e.hostVersion.versionMajor,e.hostVersion.versionMinor,e.hostVersion.versionFix];this._hostVersion=t.join("."),this.emit("change")},_setInitialized:function(e){var t=e.item;t&&!this._initialized.get(t)&&(this._initialized.set(t,!0),this.emit("change"))},_updateDocumentPosition:function(e,t){var n=-1;this._documentIDs.some(function(t,r){if(t===e)return n=r,!0}),n>-1&&this._documentIDs.splice(n,1),this._documentIDs.splice(t,0,e)},_updateRecentFileList:function(e){this._recentFiles=r.compact(e.recentFiles),this.emit("change")},_updateDocument:function(e){this.waitFor(["document"],function(){var t=e.document,n=t.documentID,r=t.itemIndex-1;this._updateDocumentPosition(n,r),e.current&&(this._selectedDocumentID=n,this._selectedDocumentIndex=r),this.emit("change")})},_closeDocument:function(e){this.waitFor(["document"],function(){var t=e.documentID,n=e.selectedDocumentID,r=this._documentIDs.indexOf(t);if(r===-1)throw new Error("Closed document ID not found in index: "+t);this._documentIDs.splice(r,1);var i=this._documentIDs.length;if(i===0!=(n===null))throw new Error("Next selected document ID should be null iff there are no open documents");if(i===0){this._selectedDocumentID=null,this._selectedDocumentIndex=null;return}var s=this._documentIDs.indexOf(n);if(s===-1)throw new Error("Selected document ID not found in index: "+t);this._selectedDocumentID=n,this._selectedDocumentIndex=s,this.emit("change")})},_resetDocuments:function(e){this.waitFor(["document"],function(){e.documents.length===0?(this._documentIDs=[],this._selectedDocumentID=null,this._selectedDocumentIndex=null):this._documentIDs=e.documents.map(function(t,n){var r=t.document.documentID;return e.selectedDocumentID===r&&(this._selectedDocumentIndex=n,this._selectedDocumentID=r),r},this),this.emit("change")})},_documentSelected:function(e){this._selectedDocumentID=e.selectedDocumentID,this._selectedDocumentIndex=this._documentIDs.indexOf(e.selectedDocumentID),this.emit("change")}});n.exports=o}),define("js/util/unit",["require","exports","module"],function(e,t){"use strict";var n={rulerInches:1,pointsUnit:1/72,millimetersUnit:1/25.4,rulerCm:1/2.54},r=function(e,t){return{unit:e+"Unit",value:t}},i=function(e,t){var r=e.value,i=e.unit,s;if(i==="pixelsUnit")s=1;else{if(!n[i])return null;s=t*n[i]}return r*s};t.unit=r,t.toPixels=i,t.density=r.bind(null,"density"),t.pixels=r.bind(null,"pixels"),t.percent=r.bind(null,"percent"),t.angle=r.bind(null,"angle")}),define("js/models/radii",["require","exports","module","immutable","js/util/unit","js/util/object","adapter/lib/contentLayer"],function(e,t,n){"use strict";var r=e("immutable"),i=e("js/util/unit"),s=e("js/util/object"),o=e("adapter/lib/contentLayer"),u=r.Record({topLeft:0,topRight:0,bottomRight:0,bottomLeft:0});Object.defineProperties(u.prototype,s.cachedGetSpecs({scalar:function(){return this.topLeft===this.topRight&&this.topRight===this.bottomRight&&this.bottomRight===this.bottomLeft?this.topLeft:null}})),u.fromLayerDescriptor=function(e){if(!e.keyOriginType||e.keyOriginType.length===0)return null;var t=e.keyOriginType[0].value;if(t.keyShapeInvalidated)return null;var n={},r=t.keyOriginType;switch(r){case o.originTypes.ORIGIN_RECT:n.topLeft=0,n.topRight=0,n.bottomRight=0,n.bottomLeft=0;break;case o.originTypes.ORIGIN_ROUNDED_RECT:var a=t.keyOriginRRectRadii.value,f=s.getPath(e,"AGMStrokeStyleInfo.value.strokeStyleResolution");f===undefined&&(f=300),n.topLeft=i.toPixels(a.topLeft,f),n.topRight=i.toPixels(a.topRight,f),n.bottomRight=i.toPixels(a.bottomRight,f),n.bottomLeft=i.toPixels(a.bottomLeft,f);break;default:return null}return new u(n)},n.exports=u}),define("js/models/stroke",["require","exports","module","immutable","lodash","./color","../util/unit","js/util/object","adapter/lib/contentLayer","js/util/log"],function(e,t,n){"use strict";var r=e("immutable"),i=e("lodash"),s=e("./color"),o=e("../util/unit"),u=e("js/util/object"),a=e("adapter/lib/contentLayer"),f=e("js/util/log"),l=new Map([["patternLayer",a.contentTypes.PATTERN],["solidColorLayer",a.contentTypes.SOLID_COLOR],["gradientLayer",a.contentTypes.GRADIENT]]),c=new Map([[a.alignmentTypes.INSIDE,"INSIDE"],[a.alignmentTypes.CENTER,"CENTER"],[a.alignmentTypes.OUTSIDE,"OUTSIDE"]]),h=r.Record({type:null,enabled:!0,color:s.DEFAULT,width:5,alignment:null});h.fromStrokeStyleDescriptor=function(e){var t={},n=e.value,r=u.getPath(n,"strokeStyleContent.value.color.value"),f=u.getPath(n,"strokeStyleContent.obj"),p=n&&u.getPath(n,"strokeStyleOpacity.value"),d=n&&u.getPath(n,"strokeStyleLineAlignment.value");t.enabled=!n||n.strokeEnabled;if(!f||!l.has(f))throw new Error("Stroke type not supplied or type unknown");t.type=l.get(f);if(!i.has(n,"strokeStyleLineWidth"))throw new Error("Stroke width not provided");t.width=o.toPixels(n.strokeStyleLineWidth,n.strokeStyleResolution);if(t.width===null)throw new Error("Stroke width could not be converted to pixels");return t.type===a.contentTypes.SOLID_COLOR&&r&&i.isObject(r)&&(t.color=s.fromPhotoshopColorObj(r,p)),c.has(d)&&(t.alignment=c.get(d)),new h(t)},h.fromLayerDescriptor=function(e){if(e.AGMStrokeStyleInfo)try{var t=e.AGMStrokeStyleInfo,n=h.fromStrokeStyleDescriptor(t);return r.List.of(n)}catch(i){var s=i instanceof Error?i.stack||i.message:i;f.error("Failed to build stroke for layer "+e.layerID,s)}return r.List()},h.prototype.setStrokeProperties=function(e){return this.withMutations(function(t){e.color?(e.ignoreAlpha?t.color=t.color.setOpaque(e.color):t.color=e.color,t.type=a.contentTypes.SOLID_COLOR):i.isNumber(e.opacity)&&(t.color=t.color.setOpacity(e.opacity)),e.hasOwnProperty("width")&&(t.width=e.width),e.hasOwnProperty("enabled")&&(t.enabled=e.enabled),e.hasOwnProperty("alignment")&&(t.alignment=e.alignment)}.bind(this))},n.exports=h}),define("js/models/fill",["require","exports","module","immutable","./color","adapter/lib/layer","adapter/lib/contentLayer","js/util/object","js/util/log"],function(e,t,n){"use strict";var r=e("immutable"),i=e("./color"),s=e("adapter/lib/layer"),o=e("adapter/lib/contentLayer"),u=e("js/util/object"),a=e("js/util/log"),f=new Map([["patternLayer",o.contentTypes.PATTERN],["solidColorLayer",o.contentTypes.SOLID_COLOR],["gradientLayer",o.contentTypes.GRADIENT]]),l=r.Record({type:null,enabled:!0,color:i.DEFAULT});l.fromLayerDescriptor=function(e){var t=e.adjustment&&e.adjustment[0];if(e.layerKind===s.layerKinds.VECTOR&&t)try{var n={},c=u.getPath(t,"value.color.value"),h=t.obj;n.enabled=e.AGMStrokeStyleInfo&&e.fillEnabled||!e.AGMStrokeStyleInfo&&!!t;if(!h||!f.has(h))throw new Error("Fill type not supplied or type unknown");n.type=f.get(h);if(n.type===o.contentTypes.SOLID_COLOR&&typeof c=="object"){var p=e.fillOpacity;n.color=i.fromPhotoshopColorObj(c,p/255*100)}var d=new l(n);return r.List.of(d)}catch(v){var m=v instanceof Error?v.stack||v.message:v;a.error("Failed to build fill for layer "+e.layerID,m)}return r.List()},l.fromSetDescriptor=function(e){var t=u.getPath(e,"to.value.fillContents.value.color.value"),n=u.getPath(e,"to.value.fillContents.obj");return new l({color:i.fromPhotoshopColorObj(t),type:n})},l.prototype.setFillProperties=function(e){return this.withMutations(function(t){e.color?(e.ignoreAlpha?t.color=t.color.setOpaque(e.color):t.color=e.color,t.type=o.contentTypes.SOLID_COLOR):e.opacity&&(t.color=this.color.setOpacity(e.opacity)),t.enabled=e.enabled}.bind(this))},n.exports=l}),define("js/models/shadow",["require","exports","module","immutable","mathjs","lodash","./color","js/util/object"],function(e,t,n){"use strict";var r=e("immutable"),i=e("mathjs"),s=e("lodash"),o=e("./color"),u=e("js/util/object"),a=function(e,t){var n=e*(Math.PI/180);return{x:i.round(-Math.cos(n)*t,2),y:i.round(Math.sin(n)*t,2)}},f=function(e,t){return!s.isNumber(e)||!s.isNumber(t)?null:{distance:i.round(Math.sqrt(t*t+e*e),2),angle:i.round(Math.atan2(t,-e)*(180/Math.PI),2)}},l=r.Record({enabled:!0,color:o.DEFAULT,x:0,y:5,blur:5,spread:5,blendMode:"multiply"});l.prototype.toAdapterObject=function(){var e=f(this.x,this.y);return{enabled:this.enabled,color:this.color,opacity:this.color&&this.color.opacity,chokeMatte:this.spread,blur:this.blur,localLightingAngle:e&&e.angle,distance:e&&e.distance,useGlobalAngle:!1,blendMode:this.blendMode}},l.fromShadowDescriptor=function(e,t){var n={},r=e.value;n.enabled=r.enabled;var i=u.getPath(r,"opacity.value"),s=u.getPath(r,"color.value");n.color=o.fromPhotoshopColorObj(s,i);var f=u.getPath(r,"localLightingAngle.value"),c=u.getPath(r,"distance.value");u.getPath(r,"useGlobalAngle")&&(f=t);var h=a(f,c);return n.x=h.x,n.y=h.y,n.blur=u.getPath(r,"blur.value"),n.spread=u.getPath(r,"chokeMatte.value"),n.blendMode=u.getPath(r,"mode.value"),new l(n)},l.fromLayerDescriptor=function(e,t){var n=e.layerEffects;if(!n)return r.List();var i=u.getPath(e,"layerEffects.value."+t+"Multi");return i||(i=[u.getPath(e,"layerEffects.value."+t)]),r.List(i.reduce(function(t,n){return n.value.enabled=n.value.enabled&&e.layerFXVisible,n.value.present&&t.push(l.fromShadowDescriptor(n,e.globalAngle)),t},[]))},n.exports=l}),define("js/models/characterstyle",["require","exports","module","immutable","./color","js/util/object","js/util/unit"],function(e,t,n){"use strict";var r=e("immutable"),i=e("./color"),s=e("js/util/object"),o=e("js/util/unit"),u=r.Record({postScriptName:null,textSize:null,color:null,tracking:null,leading:null});u.fromCharacterStyleDescriptor=function(e,t,n,r){var s={},a=typeof e=="number"?e:e.resolution.value,f=t.opacity/255*100,l=n.textStyle.value,c=l.hasOwnProperty("color")?l.color.value:r.color.value;s.color=i.fromPhotoshopColorObj(c,f);var h=l.hasOwnProperty("size")?l.size:r.size;s.textSize=o.toPixels(h,a),s.postScriptName=l.hasOwnProperty("fontPostScriptName")?l.fontPostScriptName:r.fontPostScriptName;var p=l.hasOwnProperty("tracking")?l.tracking:r.tracking;if(typeof p!="number")throw new Error("Tracking is not a number:"+p);s.tracking=p;var d=l.hasOwnProperty("autoLeading")?l.autoLeading:r.autoLeading;if(typeof d!="boolean")throw new Error("Auto-leading is not a boolean:"+d);if(!d){var v=l.hasOwnProperty("leading")?l.leading:r.leading,m=o.toPixels(v,a);if(typeof m!="number")throw new Error("Leading is not a number:"+m);s.leading=m}return new u(s)},u.fromTextDescriptor=function(e,t,n){var i=n.textStyleRange,o;return i.length>0&&(o=s.getPath(i[0],"value.textStyle.value.baseParentStyle.value")),r.List(i).map(function(n){var r=n.value,i=s.getPath(r,"textStyle.value.baseParentStyle.value");return i=i||o,u.fromCharacterStyleDescriptor(e,t,r,i)})},n.exports=u}),define("js/models/paragraphstyle",["require","exports","module","immutable"],function(e,t,n){"use strict";var r=e("immutable"),i=r.Record({alignment:null});i.fromParagraphStyleDescriptor=function(e,t,n){var r={},s=n.paragraphStyle.value;return s.hasOwnProperty("align")&&(r.alignment=s.align.value),new i(r)},i.fromTextDescriptor=function(e,t,n){var s=n.paragraphStyleRange;return r.List(s).map(function(n){var r=n.value;return i.fromParagraphStyleDescriptor(e,t,r)})},n.exports=i}),define("js/models/text",["require","exports","module","immutable","./characterstyle","./paragraphstyle","js/util/math"],function(e,t,n){"use strict";var r=e("immutable"),i=e("./characterstyle"),s=e("./paragraphstyle"),o=e("js/util/math"),u=r.Record({characterStyles:null,paragraphStyles:null,box:null,hasTransform:!1});u.fromLayerDescriptor=function(e,t){if(!t.hasOwnProperty("textKey"))return null;var n={},r=t.textKey.value,a=r.textShape;if(a.length!==1)throw new Error("Too many text shapes!");if(r.hasOwnProperty("transform")){var f=r.transform.value;n.hasTransform=!o.isRotation(f)}return n.characterStyles=i.fromTextDescriptor(e,t,r),n.paragraphStyles=s.fromTextDescriptor(e,t,r),n.box=a[0].value.char.value==="box",new u(n)},n.exports=u}),define("js/models/layer",["require","exports","module","immutable","adapter/lib/layer","js/util/object","./bounds","./radii","./stroke","./fill","./shadow","./text"],function(e,t,n){"use strict";var r=e("immutable"),i=e("adapter/lib/layer"),s=e("js/util/object"),o=e("./bounds"),u=e("./radii"),a=e("./stroke"),f=e("./fill"),l=e("./shadow"),c=e("./text"),h=r.Record({id:null,key:null,name:null,visible:null,locked:null,selected:null,kind:null,bounds:null,isBackground:null,opacity:null,blendMode:"normal",strokes:null,radii:null,fills:null,dropShadows:null,innerShadows:null,text:null,layerKinds:i.layerKinds,proportionalScaling:null,isArtboard:null,isLinked:!1,hasLayerEffect:!1});h.layerKinds=i.layerKinds,Object.defineProperties(h.prototype,s.cachedGetSpecs({unsupported:function(){switch(this.kind){case i.layerKinds.VIDEO:case i.layerKinds["3D"]:return!0;default:return!1}},face:function(){var e=this;return new r.Map({id:e.id,name:e.name,visible:e.visible,locked:e.locked,selected:e.selected,kind:e.kind,isBackground:e.isBackground})},superSelectable:function(){return!this.locked&&this.kind!==this.layerKinds.ADJUSTMENT&&this.kind!==this.layerKinds.GROUPEND}}));var p=function(e){var t=e.layerLocking.value;return t.protectAll||t.protectComposite||t.protectPosition||t.protectTransparency},d=function(e){return Math.round(100*e.opacity/255)};h.fromGroupDescriptor=function(e,t,n,s){return new h({id:t,key:e+"."+t,name:s?"</Layer Group>":n,kind:s?i.layerKinds.GROUPEND:i.layerKinds.GROUP,visible:!0,locked:!1,isBackground:!1,opacity:100,selected:!0,fills:r.List(),strokes:r.List(),dropShadows:r.List(),innerShadows:r.List(),mode:"passThrough",proportionalScaling:!1,isArtboard:!1,isLinked:!1,hasLayerEffect:!1})},h.fromDescriptor=function(e,t,n){var i=t.layerID,v,m;e instanceof r.Record?(v=e.id,m=e.resolution):(v=e.documentID,m=s.getPath(e,"resolution.value"));var g={id:i,key:v+"."+i,name:t.name,kind:t.layerKind,visible:t.visible,locked:p(t),isBackground:t.background,opacity:d(t),selected:n,bounds:o.fromLayerDescriptor(t),radii:u.fromLayerDescriptor(t),strokes:a.fromLayerDescriptor(t),fills:f.fromLayerDescriptor(t),dropShadows:l.fromLayerDescriptor(t,"dropShadow"),innerShadows:l.fromLayerDescriptor(t,"innerShadow"),text:c.fromLayerDescriptor(m,t),proportionalScaling:t.proportionalScaling,isArtboard:t.artboardEnabled},y=s.getPath(t,"mode.value");y&&(g.blendMode=y);var b=s.getPath(t,"smartObject.value.placed.value");g.isLinked=b==="rasterizeLinked";var w=s.getPath(t,"layerEffects");return w&&(g.hasLayerEffect=!0),new h(g)},h.prototype.resetFromDescriptor=function(e,t){var n=t.resolution,r={name:e.name,kind:e.layerKind,visible:e.visible,locked:p(e),isBackground:e.background,opacity:d(e),bounds:o.fromLayerDescriptor(e),radii:u.fromLayerDescriptor(e),strokes:a.fromLayerDescriptor(e),fills:f.fromLayerDescriptor(e),dropShadows:l.fromLayerDescriptor(e,"dropShadow"),innerShadows:l.fromLayerDescriptor(e,"innerShadow"),text:c.fromLayerDescriptor(n,e),proportionalScaling:e.proportionalScaling,isArtboard:e.artboardEnabled},i=s.getPath(e,"mode.value");i&&(r.blendMode=i);var h=s.getPath(e,"smartObject.value.placed.value");r.isLinked=h==="rasterizeLinked";var v=s.getPath(e,"layerEffects");return v&&(r.hasLayerEffect=!0),this.merge(r)},n.exports=h}),define("js/models/layernode",["require","exports","module","immutable","adapter/lib/layer"],function(e,t,n){"use strict";var r=e("immutable"),i=e("adapter/lib/layer"),s=r.Record({id:null,children:null,parent:null,depth:null});s.fromLayers=function(e){var t=new Map,n=function(o,u,a){var f=[],l,c,h,p,d,v;while(u>=0){c=e.get(u--),h=c.id,p=c.kind,p===i.layerKinds.GROUP?(v=t.size,d=n(h,u,a+1),u-=t.size-v):d=null,l=new s({id:h,children:d,parent:o,depth:a}),t.set(h,l),f.push(l);if(p===i.layerKinds.GROUPEND)break}return r.List(f)},o=n(null,e.size-1,0);return{roots:o,nodes:r.Map(t)}},n.exports=s}),define("js/models/layerstructure",["require","exports","module","immutable","./layer","./layernode","./bounds","./radii","./stroke","./fill","./shadow","js/util/object","js/util/collection","js/util/log"],function(e,t,n){"use strict";var r=e("immutable"),i=e("./layer"),s=e("./layernode"),o=e("./bounds"),u=e("./radii"),a=e("./stroke"),f=e("./fill"),l=e("./shadow"),c=e("js/util/object"),h=e("js/util/collection"),p=e("js/util/log"),d=new Map([["dropShadow","dropShadow"],["innerShadow","innerShadow"]]),v=r.Record({layers:null,index:null});v.fromDescriptors=function(e,t){var n=e.targetLayers||[],s=n.reduce(function(e,t){return e[t.index+1]=!0,e},{}),o=t.reduce(function(t,n){var r=n.layerID,o=n.itemIndex,u=s[o];return t.set(r,i.fromDescriptor(e,n,u)),t},new Map);o=r.Map(o);var u=t.reverse().map(function(e){return e.layerID});return u=r.List(u),new v({layers:o,index:u})},v.prototype._replaceAncestorWithSiblingsOf=function(e,t,n){var r=this.parent(e);if(!r)return t;var i=function(e,t){return e.filter(function(e){return e!==t})};while(r&&!n.hasOwnProperty(r.id))t=i(t,r),n[r.id]=r,t=t.concat(this.children(r)),r=this.parent(r);return t},Object.defineProperties(v.prototype,c.cachedGetSpecs({_nodeInfo:function(){return s.fromLayers(this.all)},nodes:function(){return this._nodeInfo.nodes},roots:function(){return this._nodeInfo.roots},unsupported:function(){return this.layers.some(function(e){return e.unsupported})},reverseIndex:function(){var e=this.index.reduce(function(e,t,n){return e.set(t,n+1)},new Map);return r.Map(e)},all:function(){return this.index.map(this.byID,this)},count:function(){return this.all.filterNot(function(e){return e.kind===e.layerKinds.GROUPEND}).size},top:function(){return this.roots.toSeq().map(function(e){return this.byID(e.id)},this).filter(function(e){return e.kind!==e.layerKinds.GROUPEND}).toList()},selected:function(){return this.all.filter(function(e){return e.selected},this)},selectedChildBounds:function(){return this.selected.toSeq().map(function(e){return this.childBounds(e)},this).filter(function(e){return e&&e.area>0}).toList()},selectedAreaBounds:function(){return o.union(this.selectedChildBounds)},leaves:function(){return this.all.filter(function(e){return e.kind!==e.layerKinds.GROUPEND&&e.kind!==e.layerKinds.GROUP&&e.visible&&!this.hasLockedAncestor(e)},this)},selectable:function(){var e={};return this.selected.toSeq().reduce(function(t,n){return this._replaceAncestorWithSiblingsOf(n,t,e)},this.top,this).filter(function(t){return t.superSelectable&&t.visible&&!this.hasLockedAncestor(t)&&!e.hasOwnProperty(t.id)},this).toList()},allSelected:function(){return this.selected.flatMap(this.descendants,this).toOrderedSet()},hasArtboard:function(){return this.all.some(function(e){return e.isArtboard})},backgroundSelected:function(){var e=this.byIndex(1);return e&&e.isBackground&&e.selected},hasLinkedSmartObjects:function(){return this.all.some(function(e){return e.isLinked})},selectedNormalized:function(){var e=this.selected;return e.filterNot(function(t){return this.strictAncestors(t).some(function(t){return e.contains(t)})},this)},selectedLocked:function(){var e=this.selected;return e.isEmpty()||e.some(function(e){return e.isBackground||e.locked})},selectedLayersDeletable:function(){var e=this.allSelected,t=h.difference(this.all,e);return!e.isEmpty()&&!t.isEmpty()&&t.some(function(e){return e.kind!==e.layerKinds.GROUPEND&&e.kind!==e.layerKinds.GROUP})}})),v.prototype.byID=function(e){return this.layers.get(e,null)},v.prototype.byIndex=function(e){var t=this.index.get(e-1,null);return t===null?null:this.byID(t)},v.prototype.indexOf=function(e){return this.reverseIndex.get(e.id,null)},v.prototype.parent=function(e){var t=this.nodes.get(e.id,null);return!t||t.parent===null?null:this.byID(t.parent)},v.prototype.depth=function(e){var t=this.nodes.get(e.id,null);return t?t.depth:null},Object.defineProperty(v.prototype,"maxDescendantDepth",c.cachedLookupSpec(function(e){return this.descendants(e).map(this.depth,this).max()})),Object.defineProperty(v.prototype,"children",c.cachedLookupSpec(function(e){var t=this.nodes.get(e.id,null);return t&&t.children?t.children.map(function(e){return this.byID(e.id)},this):r.List()})),Object.defineProperty(v.prototype,"siblings",c.cachedLookupSpec(function(e){var t=this.parent(e);if(t){var n=this.children(t);return n.map(function(e){return this.byID(e.id)},this)}return this.top})),Object.defineProperty(v.prototype,"ancestors",c.cachedLookupSpec(function(e){return this.strictAncestors(e).push(e)})),Object.defineProperty(v.prototype,"strictAncestors",c.cachedLookupSpec(function(e){var t=this.parent(e);return t?this.ancestors(t):r.List()})),Object.defineProperty(v.prototype,"lockedAncestors",c.cachedLookupSpec(function(e){return this.ancestors(e).filter(function(e){return e.locked})})),Object.defineProperty(v.prototype,"descendants",c.cachedLookupSpec(function(e){return this.strictDescendants(e).push(e)})),Object.defineProperty(v.prototype,"strictDescendants",c.cachedLookupSpec(function(e){return this.children(e).toSeq().reverse().map(this.descendants,this).flatten(!0).toList()})),Object.defineProperty(v.prototype,"lockedDescendants",c.cachedLookupSpec(function(e){return this.descendants(e).filter(function(e){return e.locked})})),Object.defineProperty(v.prototype,"hasLockedAncestor",c.cachedLookupSpec(function(e){return this.ancestors(e).some(function(e){return e.locked})})),Object.defineProperty(v.prototype,"hasLockedDescendant",c.cachedLookupSpec(function(e){return this.descendants(e).some(function(e){return e.locked},this)})),Object.defineProperty(v.prototype,"hasSelectedAncestor",c.cachedLookupSpec(function(e){return this.ancestors(e).some(function(e){return e.selected})})),Object.defineProperty(v.prototype,"hasInvisibleAncestor",c.cachedLookupSpec(function(e){return this.ancestors(e).filter(function(e){return!e.visible})})),Object.defineProperty(v.prototype,"isEmptyGroup",c.cachedLookupSpec(function(e){return e.kind===e.layerKinds.GROUP&&this.children(e).filterNot(function(e){return e.kind===e.layerKinds.ADJUSTMENT||this.isEmptyGroup(e)},this).size===1})),Object.defineProperty(v.prototype,"childBounds",c.cachedLookupSpec(function(e){switch(e.kind){case e.layerKinds.GROUP:if(e.isArtboard)return e.bounds;var t=this.children(e).map(this.childBounds,this).filter(function(e){return e});return o.union(t);case e.layerKinds.GROUPEND:return null;default:return e.bounds}})),v.prototype.addLayers=function(e,t,n,s,o){var u=n?this.updateSelection(r.Set()):this,a=e.reduce(function(r,u,a){var f=r.layers,l=r.index,c=t[a],h=c.itemIndex-1,p=n&&a+1===e.length,d=i.fromDescriptor(o,c,p);if(s&&a===0){var v=Math.min(h,1);f=f.delete(this.index.get(v)),h===v?l=l.splice(h,1,u):l=l.delete(v).set(h,u)}else l=l.splice(h,0,u);return f=f.set(u,d),{layers:f,index:l}}.bind(this),{layers:u.layers,index:u.index});return u.merge(a)},v.prototype.resetLayers=function(e,t){var n=this.layers.withMutations(function(n){e.forEach(function(e){var r=e.layerID,i=e.descriptor,s=this.byID(r),o=s.resetFromDescriptor(i,t);n.set(r,o)},this)}.bind(this));return this.mergeDeep({layers:n})},v.prototype.replaceLayersByIndex=function(e,t){var n=this.index,r=this.layers.withMutations(function(r){t.forEach(function(t){var s=t.itemIndex,o=this.byIndex(s),u=i.fromDescriptor(e,t,o.selected);r.delete(o.id),r.set(u.id,u),n=n.set(s-1,u.id)},this)}.bind(this));return this.merge({layers:r,index:n})},v.prototype.resetBounds=function(e){var t=this.layers.withMutations(function(t){e.forEach(function(e){var n=e.layerID,r=e.descriptor,i=this.byID(n),s=i.bounds;if(!s)return;r.layerKind=i.kind,r.artboardEnabled=i.isArtboard;var o=i.bounds.resetFromDescriptor(r),u=i.set("bounds",o);t.set(n,u)},this)}.bind(this));return this.mergeDeep({layers:t})},v.prototype.setProperties=function(e,t){var n=r.Map(t),i=r.Map(e.reduce(function(e,t){return e.set(t,n),e}.bind(this),new Map));return this.mergeDeep({layers:i})},v.prototype._updateBounds=function(e){var t=e.map(function(e){return r.Map({bounds:e})});return this.mergeDeep({layers:t})},v.prototype.resizeLayers=function(e){var t=r.Map(e.reduce(function(e,t){var n=this.byID(t.layer.id);return n.bounds&&e.set(n.id,n.bounds.updateSizeAndPosition(t.x,t.y,t.w,t.h)),e}.bind(this),new Map));return this._updateBounds(t)},v.prototype.setLayersProportional=function(e,t){var n=r.Map(e.reduce(function(e,n){return e.set(n,r.Map({proportionalScaling:t}))},new Map));return this.mergeDeep({layers:n})},v.prototype.repositionLayers=function(e){var t=r.Map(e.reduce(function(e,t){var n=this.byID(t.layer.id);return n.bounds&&e.set(n.id,n.bounds.updatePosition(t.x,t.y)),e}.bind(this),new Map));return this._updateBounds(t)},v.prototype.updateBounds=function(e,t,n,i,s){var o=r.Map(e.reduce(function(e,r){var o=this.byID(r);return o.bounds&&e.set(r,o.bounds.updateSizeAndPosition(t,n,i,s)),e}.bind(this),new Map));return this._updateBounds(o)},v.prototype.translateLayers=function(e,t,n){var i=r.Map(e.reduce(function(e,r){var i=this.byID(r);if(i.bounds){var s=i.bounds.left+t,o=i.bounds.top+n;e.set(r,i.bounds.updatePosition(s,o))}return e}.bind(this),new Map));return this._updateBounds(i)},v.prototype.updateSelection=function(e){var t=this.layers.map(function(t){var n=e.has(t.id);return t.set("selected",n)});return this.set("layers",t)},v.prototype.updateOrder=function(e){var t=r.List(e).reverse();return this.merge({index:t})},v.prototype.deleteLayers=function(e){var t=h.difference(this.index,e).reverse(),n=this.updateOrder(t),r=n.layers.withMutations(function(t){e.forEach(function(e){t.delete(e)})});return n.merge({layers:r})},v.prototype.createGroup=function(e,t,n,s){var o=i.fromGroupDescriptor(e,t,s,!1),u=i.fromGroupDescriptor(e,n,"",!0),a=this.allSelected,f=a.map(this.indexOf,this),l=h.pluck(a,"id"),c=this.layers.size-f.last(),p=r.Seq([n,l,t]).flatten().reverse(),d=h.difference(this.index,l).reverse(),v=d.slice(0,c).concat(p).concat(d.slice(c)),m=this.layers.withMutations(function(e){e.set(t,o),e.set(n,u)}),g=this.merge({layers:m});return g=g.updateSelection(r.Set.of(t)).updateOrder(v),g},v.prototype.setBorderRadii=function(e,t){var n=new u(t),i=r.Map(e.reduce(function(e,t){return e.set(t,r.Map({radii:n}))},new Map));return this.mergeDeep({layers:i})},v.prototype.setFillProperties=function(e,t,n){var i=r.Map(e.reduce(function(e,r){var i=this.byID(r),s=i.fills.get(t);if(!s)throw new Error("Unable to set fill properties: no fill at index "+t);var o=s.setFillProperties(n),u=i.setIn(["fills",t],o);return e.set(r,u)},new Map,this));return this.mergeDeep({layers:i})},v.prototype.addFill=function(e,t){var n=f.fromSetDescriptor(t),i=r.Map(e.reduce(function(e,t){var i=this.byID(t),s=i.fills?i.fills.push(n):r.List.of(n);return e.set(t,r.Map({fills:s}))},new Map,this));return this.mergeDeep({layers:i})},v.prototype.setStrokeProperties=function(e,t,n){var i=r.Map(e.reduce(function(e,r){var i=this.byID(r),s=i.strokes.get(t);if(!s)throw new Error("Unable to set stroke properties: no stroke at index "+t);var o=s.setStrokeProperties(n),u=i.setIn(["strokes",t],o);return e.set(r,u)},new Map,this));return this.mergeDeep({layers:i})},v.prototype.addStroke=function(e,t,n){var i=a.fromStrokeStyleDescriptor(n),s=r.Map(e.reduce(function(e,n){var s=this.byID(n),o=s.strokes?s.strokes.set(t,i):r.List.of(i);return e.set(n,r.Map({strokes:o}))},new Map,this));return this.mergeDeep({layers:s})},v.prototype.setLayerEffectProperties=function(e,t,n,i){if(!d.has(n))throw new Error("Invalid layerEffectType supplied");var s;return n===d.get("dropShadow")?s=r.Map(e.reduce(function(e,n){var r=this.byID(n),s=t;t===null&&(s=r.dropShadows.size);var o=r.dropShadows.get(s);o||(o=new l);var u=o.merge(i),a=r.setIn(["dropShadows",s],u).set("hasLayerEffect",!0);return e.set(n,a)}.bind(this),new Map)):n===d.get("innerShadow")&&(s=r.Map(e.reduce(function(e,n){var r=this.byID(n),s=t;t===null&&(s=r.innerShadows.size);var o=r.innerShadows.get(s);o||(o=new l);var u=o.merge(i),a=r.setIn(["innerShadows",s],u).set("hasLayerEffect",!0);return e.set(n,a)}.bind(this),new Map))),this.mergeDeep({layers:s})},v.prototype.addLayerEffect=function(e,t,n,i){if(!d.has(n))throw new Error("Invalid layerEffectType supplied");var s;if(n===d.get("dropShadow")){var o=l.fromShadowDescriptor(i,"dropShadow");s=r.Map(e.reduce(function(e,n){var i=this.byID(n),s=i.dropShadows?i.dropShadows.set(t,o):r.List.of(o);return e.set(n,r.Map({dropShadows:s}))}.bind(this),new Map))}else if(n===d.get("innerShadow")){var u=l.fromShadowDescriptor(i,"innerShadow");s=r.Map(e.reduce(function(e,n){var i=this.byID(n),s=i.innerShadows?i.innerShadows.set(t,u):r.List.of(u);return e.set(n,r.Map({innerShadows:s}))}.bind(this),new Map))}return this.mergeDeep({layers:s})},v.prototype._setTextStyleProperties=function(e,t,n){var i=r.Map(t.reduce(function(t,r){var i=this.byID(r),s=i.text[e];if(s.isEmpty())throw new Error("Unable to set text style properties: no styles");s.size>1&&(p.warn("Multiple styles are unsupported. Reverting to a single style."),s=s.slice(0,1));var o=s.map(function(e){return e.merge(n)}),u=i.text.set(e,o),a=i.set("text",u);return t.set(r,a)},new Map,this));return this.set("layers",this.layers.merge(i))},v.prototype.setCharacterStyleProperties=function(e,t){return this._setTextStyleProperties("characterStyles",e,t)},v.prototype.setParagraphStyleProperties=function(e,t){return this._setTextStyleProperties("paragraphStyles",e,t)},n.exports=v}),define("js/models/document",["require","exports","module","immutable","js/util/object","./layerstructure","./bounds"],function(e,t,n){"use strict";var r=e("immutable"),i=e("js/util/object"),s=e("./layerstructure"),o=e("./bounds"),u=r.Record({id:null,dirty:null,name:null,hasBackgroundLayer:null,layers:null,bounds:null,resolution:null,mode:null,guidesVisible:null,smartGuidesVisible:null,currentHistoryState:null,historyStates:null,format:null});Object.defineProperties(u.prototype,i.cachedGetSpecs({unsupported:function(){return this.mode!=="RGBColor"?!0:this.layers.unsupported}})),u.fromDescriptors=function(e,t){var n={};return n.id=e.documentID,n.dirty=e.isDirty,n.hasBackgroundLayer=e.hasBackgroundLayer,n.name=e.title,n.resolution=e.resolution.value,n.mode=e.mode.value,n.guidesVisible=e.guidesVisibility,n.smartGuidesVisible=e.smartGuidesVisibility,n.bounds=o.fromDocumentDescriptor(e),n.layers=s.fromDescriptors(e,t),n.currentHistoryState=e.currentHistoryState,n.historyStates=e.historyStates,e.format&&(n.format=e.format),new u(n)},u.prototype.resize=function(e,t,n){return this.set("bounds",this.bounds.updateSize(e,t,n))},n.exports=u}),define("js/util/string",["require","exports","module"],function(e,t){"use strict";var n=function(e){var t=Array.prototype.slice.call(arguments,1),n=/\$\{(\d)\}/g;return e.replace(n,function(e,n){return t.hasOwnProperty(n)?t[n]:e})};t.format=n}),define("js/stores/document",["require","exports","module","fluxxor","immutable","lodash","../models/document","../events","js/util/string"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("immutable"),s=e("lodash"),o=e("../models/document"),u=e("../events"),a=e("js/util/string"),f=r.createStore({_openDocuments:null,initialize:function(){this._openDocuments={},this.bindActions(u.document.DOCUMENT_UPDATED,this._documentUpdated,u.document.SAVE_DOCUMENT,this._handleDocumentSaved,u.document.DOCUMENT_RENAMED,this._handleDocumentRenamed,u.document.RESET_DOCUMENTS,this._resetDocuments,u.document.CLOSE_DOCUMENT,this._closeDocument,u.document.ADD_LAYERS,this._handleLayerAdd,u.document.GUIDES_VISIBILITY_CHANGED,this._updateDocumentGuidesVisibility,u.document.RESET_LAYERS,this._handleLayerReset,u.document.RESET_LAYERS_BY_INDEX,this._handleLayerResetByIndex,u.document.RESET_BOUNDS,this._handleBoundsReset,u.document.REORDER_LAYERS,this._handleLayerReorder,u.document.SELECT_LAYERS_BY_ID,this._handleLayerSelectByID,u.document.SELECT_LAYERS_BY_INDEX,this._handleLayerSelectByIndex,u.document.VISIBILITY_CHANGED,this._handleVisibilityChanged,u.document.LOCK_CHANGED,this._handleLockChanged,u.document.OPACITY_CHANGED,this._handleOpacityChanged,u.document.BLEND_MODE_CHANGED,this._handleBlendModeChanged,u.document.RENAME_LAYER,this._handleLayerRenamed,u.document.DELETE_LAYERS,this._handleDeleteLayers,u.document.GROUP_SELECTED,this._handleGroupLayers,u.document.REPOSITION_LAYERS,this._handleLayerRepositioned,u.document.TRANSLATE_LAYERS,this._handleLayerTranslated,u.document.RESIZE_LAYERS,this._handleLayerResized,u.document.SET_LAYERS_PROPORTIONAL,this._handleSetLayersProportional,u.document.RESIZE_DOCUMENT,this._handleDocumentResized,u.document.LAYER_BOUNDS_CHANGED,this._handleLayerBoundsChanged,u.document.RADII_CHANGED,this._handleRadiiChanged,u.document.FILL_COLOR_CHANGED,this._handleFillPropertiesChanged,u.document.FILL_OPACITY_CHANGED,this._handleFillPropertiesChanged,u.document.FILL_ADDED,this._handleFillAdded,u.document.STROKE_ALIGNMENT_CHANGED,this._handleStrokePropertiesChanged,u.document.STROKE_ENABLED_CHANGED,this._handleStrokePropertiesChanged,u.document.STROKE_WIDTH_CHANGED,this._handleStrokePropertiesChanged,u.document.STROKE_COLOR_CHANGED,this._handleStrokePropertiesChanged,u.document.STROKE_OPACITY_CHANGED,this._handleStrokePropertiesChanged,u.document.STROKE_ADDED,this._handleStrokeAdded,u.document.LAYER_EFFECT_CHANGED,this._handleLayerEffectPropertiesChanged,u.document.TYPE_FACE_CHANGED,this._handleTypeFaceChanged,u.document.TYPE_SIZE_CHANGED,this._handleTypeSizeChanged,u.document.TYPE_COLOR_CHANGED,this._handleTypeColorChanged,u.document.TYPE_TRACKING_CHANGED,this._handleTypeTrackingChanged,u.document.TYPE_LEADING_CHANGED,this._handleTypeLeadingChanged,u.document.TYPE_ALIGNMENT_CHANGED,this._handleTypeAlignmentChanged,u.history.NEW_HISTORY_STATE,this._handleNewHistoryState)},getAllDocuments:function(){return this._openDocuments},getDocument:function(e){return this._openDocuments[e]||null},_makeDocument:function(e){var t=e.document,n=e.layers;return o.fromDescriptors(t,n)},_resetDocuments:function(e){this._openDocuments=e.documents.reduce(function(e,t){var n=this._makeDocument(t);return e[n.id]=n,e}.bind(this),{}),this.emit("change")},_setDocument:function(e,t){var n=this._openDocuments[e.id];if(i.is(n,e))return;t&&(e=e.set("dirty",!0)),this._openDocuments[e.id]=e,this.emit("change")},_documentUpdated:function(e){var t=this._makeDocument(e);this._setDocument(t)},_closeDocument:function(e){var t=e.documentID;delete this._openDocuments[t],this.emit("change")},_handleDocumentSaved:function(e){var t=e.documentID,n=this._openDocuments[t];this._openDocuments[t]=n.set("dirty",!1),this.emit("change")},_handleDocumentRenamed:function(e){var t=e.documentID,n={name:e.name,format:e.format},r=this._openDocuments[t],i=r.merge(n);this._setDocument(i)},_handleDocumentResized:function(e){var t=e.documentID,n=e.size,r=this._openDocuments[t],i=r.resize(n.w,n.h);this._setDocument(i,!0)},_handleLayerAdd:function(e){var t=e.documentID,n=e.layerIDs,r=e.descriptors,i=e.selected,s=e.replace,o=this._openDocuments[t],u=o.layers.addLayers(n,r,i,s,o),a=o.set("layers",u);this._setDocument(a,!0)},_updateDocumentGuidesVisibility:function(e){var t=e.documentID,n=s.pick(e,["guidesVisible","smartGuidesVisible"]),r=this._openDocuments[t],i=r.merge(n);this._setDocument(i,!0)},_handleLayerReset:function(e){var t=e.documentID,n=e.layers,r=this._openDocuments[t],i=r.layers.resetLayers(n,r),s=r.set("layers",i);this._setDocument(s,!0)},_handleBoundsReset:function(e){var t=e.documentID,n=e.bounds,r=this._openDocuments[t],i=r.layers.resetBounds(n),s=r.set("layers",i);this._setDocument(s,!0)},_handleLayerResetByIndex:function(e){var t=e.documentID,n=e.descriptors,r=this._openDocuments[t],i=r.layers.replaceLayersByIndex(r,n),s=r.set("layers",i);this._setDocument(s,!0)},_updateLayerProperties:function(e,t,n){var r=this._openDocuments[e],i=r.layers.setProperties(t,n),s=r.set("layers",i);this._setDocument(s,!0)},_handleVisibilityChanged:function(e){var t=e.documentID,n=e.layerID,r=i.List.of(n),s=e.visible;this._updateLayerProperties(t,r,{visible:s})},_handleLockChanged:function(e){var t=e.documentID,n=e.layerID,r=i.List.of(n),s=e.locked;this._updateLayerProperties(t,r,{locked:s})},_handleOpacityChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.opacity;this._updateLayerProperties(t,n,{opacity:r})},_handleBlendModeChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.mode;this._updateLayerProperties(t,n,{blendMode:r})},_handleLayerRenamed:function(e){var t=e.documentID,n=e.layerID,r=i.List.of(n),s=e.name;this._updateLayerProperties(t,r,{name:s})},_handleDeleteLayers:function(e){var t=e.documentID,n=e.layerIDs,r=this._openDocuments[t],i=r.layers.deleteLayers(n),s=r.set("layers",i);this._setDocument(s,!0)},_handleGroupLayers:function(e){var t=e.documentID,n=e.groupID,r=e.groupEndID,i=e.groupname,s=this._openDocuments[t],o=s.layers.createGroup(t,n,r,i),u=s.set("layers",o);this._setDocument(u,!0)},_handleLayerReorder:function(e){var t=e.documentID,n=e.layerIDs,r=this._openDocuments[t],i=r.layers.updateOrder(n),s=r.set("layers",i);this._setDocument(s,!0)},_updateLayerSelection:function(e,t){var n=this._openDocuments[e],r=n.layers.updateSelection(t),i=n.set("layers",r);this._setDocument(i,!0)},_handleLayerSelectByID:function(e){var t=e.documentID,n=i.Set(e.selectedIDs);this._updateLayerSelection(t,n)},_handleLayerSelectByIndex:function(e){var t=e.documentID,n=this._openDocuments[t],r=e.selectedIndices,s=i.Set(r.map(function(e){return n.layers.byIndex(e+1).id}));this._updateLayerSelection(t,s)},_handleLayerRepositioned:function(e){var t=e.documentID,n=this._openDocuments[t],r=n.layers.repositionLayers(e.positions),i=n.set("layers",r);this._setDocument(i,!0)},_handleLayerTranslated:function(e){var t=e.documentID,n=e.layerIDs,r=e.position,i=this._openDocuments[t],s=i.layers.translateLayers(n,r.x,r.y),o=i.set("layers",s);this._setDocument(o,!0)},_handleLayerResized:function(e){var t=e.documentID,n=this._openDocuments[t],r=n.layers.resizeLayers(e.sizes),i=n.set("layers",r);this._setDocument(i,!0)},_handleLayerBoundsChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.size,i=e.position,s=this._openDocuments[t],o=s.layers.updateBounds(n,i.left,i.top,r.w,r.h),u=s.set("layers",o);this._setDocument(u,!0)},_handleSetLayersProportional:function(e){var t=e.documentID,n=e.layerIDs,r=e.proportional,i=this._openDocuments[t],s=i.layers.setLayersProportional(n,r),o=i.set("layers",s);this._setDocument(o,!0)},_handleRadiiChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.radii,i=this._openDocuments[t],s=i.layers.setBorderRadii(n,r),o=i.set("layers",s);this._setDocument(o,!0)},_handleFillPropertiesChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.fillIndex,i=e.fillProperties,s=this._openDocuments[t],o=s.layers.setFillProperties(n,r,i),u=s.set("layers",o);this._setDocument(u,!0)},_handleFillAdded:function(e){var t=e.documentID,n=e.layerIDs,r=e.setDescriptor,i=this._openDocuments[t],s=i.layers.addFill(n,r),o=i.set("layers",s);this._setDocument(o,!0)},_handleStrokePropertiesChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.strokeIndex,i=e.strokeProperties,s=this._openDocuments[t],o=s.layers.setStrokeProperties(n,r,i),u=s.set("layers",o);this._setDocument(u,!0)},_handleStrokeAdded:function(e){var t=e.documentID,n=e.layerIDs,r=e.strokeIndex,i=e.strokeStyleDescriptor,s=this._openDocuments[t],o=s.layers.addStroke(n,r,i),u=s.set("layers",o);this._setDocument(u,!0)},_handleLayerEffectPropertiesChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.layerEffectIndex,i=e.layerEffectType,s=e.layerEffectProperties,o=this._openDocuments[t],u=o.layers.setLayerEffectProperties(n,r,i,s),a=o.set("layers",u);this._setDocument(a,!0)},_handleTypeFaceChanged:function(e){var t=e.family,n=e.style,r=this.flux.store("font"),i=r.getPostScriptFromFamilyStyle(t,n);if(!i){var s=a.format("Unable to find postscript font name for style {1} of family {0}",t,n);throw new Error(s)}var o=e.documentID,u=e.layerIDs,f=this._openDocuments[o],l=f.layers.setCharacterStyleProperties(u,{postScriptName:i}),c=f.set("layers",l);this._setDocument(c,!0)},_handleTypeSizeChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.size,i=this._openDocuments[t],s=i.layers.setCharacterStyleProperties(n,{textSize:r}),o=i.set("layers",s);this._setDocument(o,!0)},_handleTypeColorChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.color,i=r.opacity,s=r.opaque(),o=this._openDocuments[t],u=o.layers.setCharacterStyleProperties(n,{color:s}).setProperties(n,{opacity:i}),a=o.set("layers",u);this._setDocument(a,!0)},_handleTypeTrackingChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.tracking,i=this._openDocuments[t],s=i.layers.setCharacterStyleProperties(n,{tracking:r}),o=i.set("layers",s);this._setDocument(o,!0)},_handleTypeLeadingChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.leading,i=this._openDocuments[t],s=i.layers.setCharacterStyleProperties(n,{leading:r}),o=i.set("layers",s);this._setDocument(o,!0)},_handleTypeAlignmentChanged:function(e){var t=e.documentID,n=e.layerIDs,r=e.alignment,i=this._openDocuments[t],s=i.layers.setParagraphStyleProperties(n,{alignment:r}),o=i.set("layers",s);this._setDocument(o,!0)},_handleNewHistoryState:function(e){var t=e.documentID,n=this._openDocuments[t],r=n.merge({historyStates:e.totalStates,currentHistoryState:e.currentState});this._setDocument(r,!0)}});n.exports=f}),define("js/stores/font",["require","exports","module","fluxxor","immutable","../events","js/util/log"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("immutable"),s=e("../events"),o=e("js/util/log"),u=r.createStore({_familyMap:i.Map(),_postScriptMap:i.Map(),initialize:function(){this.bindActions(s.font.INIT_FONTS,this._handleInitFonts)},getState:function(){return{familyMap:this._familyMap,postScriptMap:this._postScriptMap}},getPostScriptFromFamilyStyle:function(e,t){var n=this._familyMap.get(e);if(!n)return null;var r=n.find(function(e){return e.style===t});return r&&r.postScriptName},_handleInitFonts:function(e){var t=e.fontFamilyName,n=e.fontName,r=e.fontStyleName,s=e.fontPostScriptName,u=i.Record({style:null,postScriptName:null});this._familyMap=i.fromJS(t.reduce(function(e,t,i){var a=n[i],f=r[i],l=s[i],c;return e.hasOwnProperty(t)||(e[t]={}),c=e[t],c.hasOwnProperty(a)?o.warn("Skipping duplicate font named %s in family %s with style",a,t,f):c[a]=new u({style:f,postScriptName:l}),e},{}));var a=i.Record({family:null,font:null});this._postScriptMap=i.Map(s.reduce(function(e,r,i){var s=t[i],o=n[i];return e.set(r,new a({family:s,font:o}))},new Map)),this.emit("change")}});n.exports=u}),define("adapter/ps/ui",["require","exports","module","eventEmitter","../util","bluebird"],function(e,t,n){"use strict";var r=e("eventEmitter"),i=e("../util"),s=e("bluebird"),o=s.promisifyAll(_spaces.ps.ui),u=o.widgetTypes.CONTROLBAR|o.widgetTypes.DOCUMENT_TABS|o.widgetTypes.PALETTE|o.widgetTypes.TOOLBAR,a=function(){r.call(this),this._menuEventHandler=this._menuEventHandler.bind(this),this._interactionEventHandler=this._interactionEventHandler.bind(this)};i.inherits(a,r),a.prototype._menuEventHandler=function(e,t,n){if(e){this.emit("error","Failed to handle menu event: "+e);return}this.emit("menu",{command:t,info:n})},a.prototype._interactionEventHandler=function(e,t,n){if(e){this.emit("error","Failed to handle interaction event: "+e);return}var r;switch(t){case"progress":r="interactionProgress";break;case"error":r="interactionError";break;case"options":r="interactionOptions";break;case"context":r="interactionContext";break;case"user":r="interactionUser";break;default:return}this.emit(r,{info:n})},a.prototype.overscrollMode=_spaces.ps.ui.overscrollMode,a.prototype.getOverscrollMode=function(){return o.getOverscrollModeAsync()},a.prototype.setOverscrollMode=function(e){var t={mode:e};return o.setOverscrollModeAsync(t)},a.prototype.getSuppressScrollbars=function(){return o.getSuppressScrollbarsAsync()},a.prototype.setSuppressScrollbars=function(e){return o.setSuppressScrollbarsAsync(e)},a.prototype.getSuppressTargetPaths=function(){return o.getSuppressTargetPathsAsync()},a.prototype.setSuppressTargetPaths=function(e){return o.setSuppressTargetPathsAsync(e)},a.prototype.setClassicChromeVisibility=function(e){return this.setSuppressScrollbars(!e).then(function(){o.setWidgetTypeVisibilityAsync(u,e)})},a.prototype.pointerPropagationMode=_spaces.ps.ui.pointerPropagationMode,a.prototype.keyboardPropagationMode=_spaces.ps.ui.keyboardPropagationMode,a.prototype.policyAction=_spaces.ps.ui.policyAction,a.prototype.commandKind=_spaces.ps.ui.commandKind,a.prototype.getPointerPropagationMode=function(){return o.getPointerPropagationModeAsync()},a.prototype.setPointerPropagationMode=function(e){return o.setPointerPropagationModeAsync(e)},a.prototype.getKeyboardPropagationMode=function(){return o.getKeyboardPropagationModeAsync()},a.prototype.setKeyboardPropagationMode=function(e){return o.setKeyboardPropagationModeAsync(e)},a.prototype.setPointerEventPropagationPolicy=function(e){return o.setPointerEventPropagationPolicyAsync({policyList:e})},a.prototype.setKeyboardEventPropagationPolicy=function(e){return o.setKeyboardEventPropagationPolicyAsync({policyList:e})},a.prototype.installMenu=function(e,t){return t===undefined&&(t=e,e={}),o.installMenuAsync(e,t)},a.prototype.setOverlayOffsets=function(e){return o.setOverlayOffsetsAsync({offset:e})};var f=new a;_spaces.setNotifier(_spaces.notifierGroup.MENU,{},f._menuEventHandler);var l=_spaces.notifierOptions.interaction;_spaces.setNotifier(_spaces.notifierGroup.INTERACTION,{notificationKind:l.OPTIONS+l.CONTEXT+l.ERROR},f._interactionEventHandler),n.exports=f}),define("adapter/lib/tool",["require","exports","module","../playobject"],function(e,t){"use strict";var n=e("../playobject"),r=function(e){return new n("select",{"null":{ref:e}})},i=function(e,t){return new n("set",{"null":{ref:e},to:{obj:"currentToolOptions",value:t}})},s=function(e){return new n("set",{"null":{ref:[{property:"generalPreferences",ref:"property"},{"enum":"ordinal",ref:"application",value:"targetEnum"}]},to:{obj:"generalPreferences",value:{legacyPathDrag:!0,vectorSelectionModifiesLayerSelection:e}}})},o=function(){return new n("reset",{"null":{ref:[{ref:null,property:"vectorToolMode"},{ref:"application","enum":"ordinal",value:"targetEnum"}]}})};t.setTool=r,t.setToolOptions=i,t.setDirectSelectOptionForAllLayers=s,t.resetShapeTool=o}),define("js/models/tool",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t,n,r,i,s,o,u,a){this.id=e,this.icon=e,this.name=t,this.nativeToolName=n,this.selectHandler=r||null,this.deselectHandler=i||null,this.keyboardPolicyList=s||[],this.pointerPolicyList=o||[],this.subToolList=u||[],this.hideTransformOverlay=a||!1,this.isMainTool=!0};r.prototype.id=null,r.prototype.icon=null,r.prototype.name=null,r.prototype.nativeToolName=null,r.prototype.isMainTool=null,r.prototype.selectHandler=null,r.prototype.deselectHandler=null,r.prototype.keyboardPolicyList=null,r.prototype.pointerPolicyList=null,r.prototype.subToolList=null,r.prototype.onClick=null,r.prototype.onDoubleClick=null,r.prototype.onMouseDown=null,r.prototype.onKeyPress=null,r.prototype.onKeyDown=null,r.prototype.activationKey=null,r.prototype.toolOverlay=null,r.prototype.hideTransformOverlay=null,r.prototype.hideTransformControls=null,n.exports=r}),define("js/util/key",["require","exports","module","js/util/system","adapter/os"],function(e,t){"use strict";var n=e("js/util/system"),r=e("adapter/os"),i=function(e){var t=r.eventModifiers.NONE;e.shift&&(t+=r.eventModifiers.SHIFT),e.control&&(t+=r.eventModifiers.CONTROL);if(e.alt||e.option)t+=r.eventModifiers.ALT;if(e.command){if(!n.isMac)throw new Error("Command is only a supported modifier on Mac");t+=r.eventModifiers.COMMAND}return t},s=function(e){var t=!!(e&r.eventModifiers.SHIFT),n=!!(e&r.eventModifiers.CONTROL),i=!!(e&r.eventModifiers.ALT),s=!!(e&r.eventModifiers.COMMAND),o={shift:t,control:n,alt:i,command:s};return o};t.modifiersToBits=i,t.bitsToModifiers=s}),define("js/models/eventpolicy",["require","exports","module","adapter/util","js/util/key"],function(e,t){"use strict";var n=e("adapter/util"),r=e("js/util/key"),i=function(e,t,n){this.action=e,this.eventKind=t,n&&(this.modifiers=r.modifiersToBits(n))};i.prototype.action=null,i.prototype.event=null,i.prototype.modifiers=null,i.prototype.toJSONObject=function(){return Object.keys(this).reduce(function(e,t){var n=this[t];return n!==null&&(e[t]=n),e}.bind(this),{})};var s=function(e,t,n,r){i.call(this,e,t,n);switch(typeof r){case"number":this.keyCode=r;break;case"string":this.keyChar=r;break;default:throw new Error("Missing key specification")}};n.inherits(s,i),s.prototype.keyCode=null;var o=function(e,t,n,r){i.call(this,e,t,n),r&&(this.area=[r.x,r.y,r.width,r.height])};n.inherits(o,i),o.prototype.area=null,t.KeyboardEventPolicy=s,t.PointerEventPolicy=o}),define("js/models/eventpolicyset",["require","exports","module","js/util/math"],function(e,t,n){"use strict";var r=e("js/util/math"),i=function(){this._policyLists={},this._policyListCounter=0};i.prototype._policyLists=null,i.prototype._policyListCounter=null,i.prototype.addPolicyList=function(e){var t=this._policyListCounter++;return this._policyLists[t]=e,t},i.prototype.removePolicyList=function(e){if(!this._policyLists.hasOwnProperty(e))throw new Error("Unknown policy ID: "+e);var t=this._policyLists[e];return delete this._policyLists[e],t},i.prototype.getMasterPolicyList=function(){return Object.keys(this._policyLists).map(r.parseNumber).sort().reduceRight(function(e,t){var n=this._policyLists[t],r=n.map(function(e){return e.toJSONObject()});return e=e.concat(r),e}.bind(this),[])},n.exports=i}),define("js/stores/policy",["require","exports","module","fluxxor","js/models/eventpolicyset"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("js/models/eventpolicyset"),s={};Object.defineProperties(s,{KEYBOARD:{value:"keyboard",writeable:!1,enumerable:!0},POINTER:{value:"pointer",writeable:!1,enumerable:!0}});var o=r.createStore({_policySets:null,initialize:function(){this._policySets=Object.keys(s).reduce(function(e,t){return e[s[t]]=new i,e}.bind(this),{})},removePolicyList:function(e,t){return this._policySets[e].removePolicyList(t)},removeKeyboardPolicyList:function(e){return this.removePolicyList(s.KEYBOARD,e)},removePointerPolicyList:function(e){return this.removePolicyList(s.POINTER,e)},addPolicyList:function(e,t){return this._policySets[e].addPolicyList(t)},addKeyboardPolicyList:function(e){return this.addPolicyList(s.KEYBOARD,e)},addPointerPolicyList:function(e){return this.addPolicyList(s.POINTER,e)},getMasterPolicyList:function(e){return this._policySets[e].getMasterPolicyList()},getMasterKeyboardPolicyList:function(){return this.getMasterPolicyList(s.KEYBOARD)},getMasterPointerPolicyList:function(){return this.getMasterPolicyList(s.POINTER)}});o.eventKind=s,n.exports=o}),define("js/actions/policy",["require","exports","module","bluebird","adapter/ps/ui","adapter/os","js/locks","js/stores/policy","js/models/eventpolicy"],function(e,t){"use strict";var n=e("bluebird"),r=e("adapter/ps/ui"),i=e("adapter/os"),s=e("js/locks"),o=e("js/stores/policy"),u=e("js/models/eventpolicy"),a=u.KeyboardEventPolicy,f=function(e,t,n){var s=e?r.policyAction.ALWAYS_PROPAGATE:r.policyAction.NEVER_PROPAGATE,o=i.eventKind.KEY_DOWN,u=new a(s,o,n,t);return this.transfer(y,[u],!0)},l=function(e,t){var n=this.flux.store("policy"),i=n.addPolicyList(e,t),s=n.getMasterPolicyList(e),u;return e===o.eventKind.KEYBOARD?u=r.setKeyboardEventPropagationPolicy:u=r.setPointerEventPropagationPolicy,u.call(r,s).catch(function(t){try{n.removePolicyList(e,i)}catch(r){}throw t}).return(i)},c=function(e,t,i){var s=this.flux.store("policy");if(s.removePolicyList(e,t)){if(i){var u=s.getMasterPolicyList(e),a;return e===o.eventKind.KEYBOARD?a=r.setKeyboardEventPropagationPolicy:a=r.setPointerEventPropagationPolicy,a.call(r,u)}return n.resolve()}return n.reject(new Error("No policies found for id: "+t))},h=function(e){return l.call(this,o.eventKind.KEYBOARD,e)},p=function(e,t){return c.call(this,o.eventKind.KEYBOARD,e,t)},d=function(e){return l.call(this,o.eventKind.POINTER,e)},v=function(e,t){return c.call(this,o.eventKind.POINTER,e,t)},m=function(){var e=r.keyboardPropagationMode.NEVER_PROPAGATE,t={defaultMode:e};return r.setKeyboardPropagationMode(t)},g={command:f,reads:[],writes:[s.PS_APP,s.JS_POLICY]},y={command:h,reads:[],writes:[s.PS_APP,s.JS_POLICY]},b={command:p,reads:[],writes:[s.PS_APP,s.JS_POLICY]},w={command:d,reads:[],writes:[s.PS_APP,s.JS_POLICY]},E={command:v,reads:[],writes:[s.PS_APP,s.JS_POLICY]},S={command:m,reads:[],writes:[s.PS_APP,s.JS_POLICY]};t.addKeydownPolicy=g,t.addKeyboardPolicies=y,t.removeKeyboardPolicies=b,t.addPointerPolicies=w,t.removePointerPolicies=E,t.beforeStartup=S}),define("js/actions/shortcuts",["require","exports","module","bluebird","adapter/os","js/events","js/locks","js/actions/policy"],function(e,t){"use strict";var n=e("bluebird"),r=e("adapter/os"),i=e("js/events"),s=e("js/locks"),o=e("js/actions/policy"),u=function(e,t,r,s,u){var a=this.flux.store("shortcut");return a.getByID(s)?n.resolve():(typeof e=="string"&&(e=e.toLowerCase()),this.transfer(o.addKeydownPolicy,!1,e,t).bind(this).then(function(n){var o={id:s,capture:!!u,key:e,modifiers:t,fn:r,policy:n};return this.dispatch(i.shortcut.ADD_SHORTCUT,o),n}))},a=function(e){var t=this.flux.store("shortcut"),r=t.getByID(e);return r?this.transfer(o.removeKeyboardPolicies,r.policy,!0).bind(this).then(function(){this.dispatch(i.shortcut.REMOVE_SHORTCUT,{id:e})}):n.resolve()},f=function(){var t=new n(function(t){e(["js/main"],function(e){t(e.controller)})});return t.bind(this).then(function(e){var t=this.flux.store("shortcut"),n=function(n){return function(i){if(!e.active)return;if(i.target!==window.document.body&&(i.detail.modifierBits===r.eventModifiers.NONE||i.detail.modifierBits===r.eventModifiers.SHIFT))return;var s=t.matchShortcuts(i.detail,n);s.forEach(function(e){e(i)})}};window.addEventListener("adapterKeydown",n(!0),!0),window.addEventListener("adapterKeydown",n(!1),!1),r.on(r.notifierKind.KEYBOARDFOCUS_CHANGED,function(e){e.isActive===!1&&window.document.activeElement.blur()})})},l={command:u,reads:[],writes:[s.PS_APP,s.JS_SHORTCUT,s.JS_POLICY]},c={command:a,reads:[],writes:[s.PS_APP,s.JS_SHORTCUT,s.JS_POLICY]},h={command:f,reads:[s.JS_SHORTCUT],writes:[]};t.addShortcut=l,t.removeShortcut=c,t.beforeStartup=h}),define("js/tools/superselect/vector",["require","exports","module","bluebird","adapter/util","adapter/ps","adapter/os","adapter/ps/ui","adapter/ps/descriptor","adapter/lib/tool","js/models/tool","js/actions/shortcuts","js/models/eventpolicy"],function(e,t,n){"use strict";var r=e("bluebird"),i=e("adapter/util"),s=e("adapter/ps"),o=e("adapter/os"),u=e("adapter/ps/ui"),a=e("adapter/ps/descriptor"),f=e("adapter/lib/tool"),l=e("js/models/tool"),c=e("js/actions/shortcuts"),h=e("js/models/eventpolicy"),p=h.KeyboardEventPolicy,d=3502,v=106,m=function(){var e=this.flux.store("application").getCurrentDocument(),t=u.setSuppressTargetPaths(!0),n=this.transfer(c.removeShortcut,"vectorBackspace"),i=this.transfer(c.removeShortcut,"vectorDelete");return r.join(t,n,i).bind(this).then(function(){e&&this.flux.actions.layers.resetLayers(e,e.layers.selected)})},g=function(){var e=function(e){return e.stopPropagation(),s.performMenuCommand(v).catch(function(){})},t=a.playObject(f.setDirectSelectOptionForAllLayers(!1)),n=u.setSuppressTargetPaths(!1),i=this.transfer(c.addShortcut,o.eventKeyCode.BACKSPACE,{},e,"vectorBackspace",!0),l=this.transfer(c.addShortcut,o.eventKeyCode.DELETE,{},e,"vectorDelete",!0),h=a.getProperty("document","targetPathVisibility");return r.join(h,t,n,i,l,function(e){if(!e)return s.performMenuCommand(d)})},y=function(){l.call(this,"superselectVector","Superselect - Direct Select","directSelectTool"),this.icon="directSelect",this.isMainTool=!1;var e=new p(u.policyAction.NEVER_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.ESCAPE),t=new p(u.policyAction.NEVER_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.ENTER),n=new p(u.policyAction.NEVER_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.BACKSPACE),r=new p(u.policyAction.NEVER_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.DELETE),i=new p(u.policyAction.ALWAYS_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.ARROW_LEFT),s=new p(u.policyAction.ALWAYS_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.ARROW_UP),a=new p(u.policyAction.ALWAYS_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.ARROW_RIGHT),f=new p(u.policyAction.ALWAYS_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.ARROW_DOWN);this.keyboardPolicyList=[e,t,n,r,i,f,a,s],this.selectHandler=g,this.deselectHandler=m,this.hideTransformOverlay=!0};i.inherits(y,l),y.prototype.onKeyDown=function(e){var t=this.getFlux(),n=t.store("tool"),r=e.detail;r.keyCode===27?t.actions.tools.select(n.getToolByID("newSelect")):r.keyCode===13&&t.actions.tools.select(n.getToolByID("newSelect"))},n.exports=y}),define("js/tools/superselect/type",["require","exports","module","adapter/util","adapter/ps/descriptor","adapter/os","adapter/ps/ui","js/models/tool","js/models/eventpolicy"],function(e,t,n){"use strict";var r=e("adapter/util"),i=e("adapter/ps/descriptor"),s=e("adapter/os"),o=e("adapter/ps/ui"),u=e("js/models/tool"),a=e("js/models/eventpolicy"),f=a.KeyboardEventPolicy,l=function(){var e=this.flux,t=e.store("tool");i.once("set",function(n){n.null.ref==="textLayer"&&n.to.obj==="textLayer"&&e.actions.tools.select(t.getToolByID("newSelect"))})},c=function(){u.call(this,"superselectType","Superselect-Type","typeCreateOrEditTool"),this.icon="typeCreateOrEdit";var e=new f(o.policyAction.NEVER_PROPAGATE,s.eventKind.KEY_DOWN,null,s.eventKeyCode.ESCAPE);this.keyboardPolicyList=[e],this.selectHandler=l,this.hideTransformOverlay=!0,this.isMainTool=!1};r.inherits(c,u),c.prototype.onKeyDown=function(e){var t=this.getFlux(),n=t.store("tool");e.detail.keyCode===27&&t.actions.tools.select(n.getToolByID("newSelect"))},n.exports=c}),define("js/util/ui",["require","exports","module","js/models/bounds"],function(e,t){"use strict";var n=e("js/models/bounds"),r=function(e,t){var r=Math.max(e.width/3,Math.min(100*t,e.width)),i=13*t,s=10*t;return new n({top:e.top-s-i,bottom:e.top-s,left:e.left,right:e.left+r})};t.getNameBadgeBounds=r}),define("jsx!js/jsx/tools/SuperselectOverlay",["require","exports","module","react","fluxxor","d3","lodash","js/util/system","js/util/ui"],function(e,t,n){"use strict";var r=e("react"),i=e("fluxxor"),s=i.FluxMixin(r),o=i.StoreWatchMixin,u=e("d3"),a=e("lodash"),f=e("js/util/system"),l=e("js/util/ui"),c=200,h=r.createClass({displayName:"SuperselectOverlay",mixins:[s,o("document","application","ui")],_leafBounds:!1,_currentMouseX:null,_currentMouseY:null,_currentMouseDown:null,_marqueeRect:null,_scrimGroup:null,_marqueeResult:null,_scale:null,_drawDebounced:null,getStateFromFlux:function(){var e=this.getFlux(),t=e.store("application"),n=e.store("tool"),r=e.store("ui"),i=r.getState(),s=n.getModalToolState(),o=t.getCurrentDocument();return{document:o,marqueeEnabled:i.marqueeEnabled,marqueeStart:i.marqueeStart,modalState:s}},componentWillMount:function(){window.addEventListener("adapterFlagsChanged",this._handleExternalKeyEvent),this._drawDebounced=a.debounce(this.drawOverlay,c)},componentWillUnmount:function(){window.removeEventListener("adapterFlagsChanged",this._handleExternalKeyEvent),window.removeEventListener("mousemove",this.marqueeUpdater),window.removeEventListener("mouseup",this.mouseUpHandler),window.removeEventListener("mousedown",this.mouseDownHandler)},componentDidMount:function(){this._currentMouseX=null,this._currentMouseY=null,this._marqueeResult=[],this.state.modalState||this._drawDebounced(),window.addEventListener("mousemove",this.marqueeUpdater),window.addEventListener("mouseup",this.mouseUpHandler),window.addEventListener("mousedown",this.mouseDownHandler)},componentDidUpdate:function(){this.state.modalState||this._drawDebounced()},marqueeUpdater:function(e){this.isMounted()&&(this._currentMouseX=e.x,this._currentMouseY=e.y,this.state.marqueeEnabled&&this.updateMarqueeRect())},drawOverlay:function(){if(!this.isMounted())return;var e=this.state.document,t=u.select(this.getDOMNode());t.selectAll(".superselect-bounds").remove(),t.selectAll(".superselect-marquee").remove(),t.selectAll(".artboard-adder").remove();if(!e)return null;this._scrimGroup=t.insert("g",".transform-control-group").classed("superselect-bounds",!0).attr("transform",this.props.transformString);var n=u.transform(this._scrimGroup.attr("transform")),r=e.layers;this._scale=1/n.scale[0],this.drawBoundRectangles(t,r),this._drawArtboardAdders(t,r),this.state.marqueeEnabled&&this.startSuperselectMarquee(t)},drawBoundRectangles:function(e,t){var n=t.indexOf.bind(t),r=this.state.marqueeEnabled,i=this._scale,s;this._leafBounds?(s=t.leaves.sortBy(n),u.select(".selection-parent-bounds").style("visibility","hidden")):(s=t.selectable.sortBy(n),u.select(".selection-parent-bounds").style("visibility","visible")),s.forEach(function(e){var n=t.childBounds(e);if(!n||n.empty)return;var s=f.isMac?0:i,o=this._scrimGroup.append("rect").attr("x",n.left+s).attr("y",n.top+s).attr("width",n.width).attr("height",n.height).attr("layer-id",e.id).attr("id","layer-"+e.id).classed("layer-bounds",!0);if(e.isArtboard){var a=l.getNameBadgeBounds(n,i),c=[{x:a.left,y:a.top},{x:a.right,y:a.top},{x:a.right,y:a.bottom},{x:a.left,y:a.bottom}],h=c.map(function(e){return e.x+","+e.y}).join(" "),p=this._scrimGroup.append("polygon").attr("points",h).attr("id","name-badge-"+e.id).classed("layer-bounds",!0);p.on("mouseover",function(){u.select("#layer-"+e.id).classed("layer-bounds-hover",!0).style("stroke-width",1*i)}).on("mouseout",function(){u.select("#layer-"+e.id).classed("layer-bounds-hover",!1).style("stroke-width",0)})}else!r&&!e.selected&&o.on("mouseover",function(){u.select(this).classed("layer-bounds-hover",!0).style("stroke-width",1*i)}).on("mouseout",function(){u.select(this).classed("layer-bounds-hover",!1).style("stroke-width",0)})},this);var o=this.getFlux().store("ui"),a=o.transformWindowToCanvas(this._currentMouseX,this._currentMouseY),c=s.findLast(function(e){var n=t.childBounds(e);if(!n)return;return!e.selected&&n.contains(a.x,a.y)},this);if(c){var h="#layer-"+c.id;u.select(h).classed("layer-bounds-hover",!0).style("stroke-width",1*i)}},startSuperselectMarquee:function(e){if(!this._currentMouseDown)return;var t=this.state.marqueeStart.x,n=this.state.marqueeStart.y,r=this._currentMouseX-t,i=this._currentMouseY-n,s=e.insert("g",".transform-control-group").classed("superselect-marquee",!0);r<0&&(t+=r,r=-r),i<0&&(n+=i,i=-i),this._marqueeRect=s.append("rect").attr("x",t).attr("y",n).attr("width",r).attr("height",i).classed("superselect-marquee",!0),this._marqueeResult=[],this.updateMarqueeRect()},mouseUpHandler:function(e){if(!this.isMounted())return;this._currentMouseDown=!1;if(this._marqueeRect){var t=this.getFlux().actions.superselect;t.marqueeSelect(this.state.document,this._marqueeResult,e.shiftKey),this._marqueeRect=null}},mouseDownHandler:function(){this._currentMouseDown=!0},updateMarqueeRect:function(){if(!this._marqueeRect)return;var e=this.getFlux().store("ui"),t=[],n=this._scale,r=this.state.marqueeStart.x,i=this.state.marqueeStart.y,s=this._currentMouseX,o=this._currentMouseY,a;r>s&&(a=r,r=s,s=a),i>o&&(a=i,i=o,o=a);var f=e.transformWindowToCanvas(r,i),l=e.transformWindowToCanvas(s,o);this._marqueeRect.attr("x",r).attr("y",i).attr("width",s-r).attr("height",o-i),u.selectAll(".layer-bounds").each(function(){var e=u.select(this),r=parseInt(e.attr("x")),i=parseInt(e.attr("y")),s=r+parseInt(e.attr("width")),o=i+parseInt(e.attr("height")),a=r<l.x&&s>f.x&&i<l.y&&o>f.y;a?(e.classed("marquee-hover",!0).style("stroke-width",1*n),t.push(parseInt(e.attr("layer-id")))):e.classed("marquee-hover",!1).style("stroke-width",0)}),this._marqueeResult=t},_handleExternalKeyEvent:function(e){var t=e.detail.modifiers,n=f.isMac?t.command:t.control;n&&!this._leafBounds?(this._leafBounds=!0,this.drawOverlay()):!n&&this._leafBounds&&(this._leafBounds=!1,this.drawOverlay())},_getNewArtboardBounds:function(e,t){var n=100,r;switch(t){case"n":r=e.merge({top:e.top-e.height-n,bottom:e.bottom-e.height-n});break;case"s":r=e.merge({top:e.top+e.height+n,bottom:e.bottom+e.height+n});break;case"w":r=e.merge({left:e.left-e.width-n,right:e.right-e.width-n});break;case"e":r=e.merge({left:e.left+e.width+n,right:e.right+e.width+n});break;default:throw new Error("Invalid direction passed to artboard bound calculation")}return r},_checkAndDrawArtboardAdder:function(e,t,n,r){var i=t.bounds,s=this._scale,o=this._getNewArtboardBounds(i,r),a=n.some(function(e){return o.intersects(e.bounds)});if(a)return;var f,l,c=50*s,h=3.5*s,p=13*s;switch(r){case"n":f=i.xCenter,l=i.top-c;break;case"s":f=i.xCenter,l=i.bottom+c;break;case"w":f=i.left-c,l=i.yCenter;break;case"e":f=i.right+c,l=i.yCenter}var d=this._scrimGroup.append("g").classed("artboard-adder",!0).style("stroke-width",1*s).on("mousedown",function(){u.event.stopPropagation()}).on("mouseup",function(){u.event.stopPropagation()}).on("click",function(){this.getFlux().actions.layers.createArtboard(o),u.event.stopPropagation()}.bind(this));d.append("line").attr("x1",f).attr("x2",f).attr("y1",l-h).attr("y2",l+h),d.append("line").attr("x1",f-h).attr("x2",f+h).attr("y1",l).attr("y2",l),d.append("circle").attr("cx",f).attr("cy",l).attr("r",p)},_drawArtboardAdders:function(e,t){var n=t.selected;if(n.size!==1||!n.first().isArtboard)return;var r=n.first(),i=t.all.filter(function(e){return e.isArtboard&&e!==r});this._checkAndDrawArtboardAdder(e,r,i,"n"),this._checkAndDrawArtboardAdder(e,r,i,"e"),this._checkAndDrawArtboardAdder(e,r,i,"s"),this._checkAndDrawArtboardAdder(e,r,i,"w")},render:function(){return r.createElement("g",null)}});n.exports=h}),define("js/tools/superselect",["require","exports","module","adapter/util","adapter/ps/descriptor","adapter/os","js/util/system","adapter/ps/ui","adapter/lib/tool","js/models/tool","js/models/eventpolicy","./superselect/vector","./superselect/type","lodash","jsx!js/jsx/tools/SuperselectOverlay"],function(e,t,n){"use strict";var r=e("adapter/util"),i=e("adapter/ps/descriptor"),s=e("adapter/os"),o=e("js/util/system"),u=e("adapter/ps/ui"),a=e("adapter/lib/tool"),f=e("js/models/tool"),l=e("js/models/eventpolicy"),c=l.KeyboardEventPolicy,h=l.PointerEventPolicy,p=e("./superselect/vector"),d=e("./superselect/type"),v=e("lodash"),m=e("jsx!js/jsx/tools/SuperselectOverlay"),g,y=function(){this.id="newSelect",this.icon="newSelect",this.name="Super Select",this.nativeToolName="moveTool",this.dragging=!1,this.dragEvent=null,this.activationKey="v";var e=function(){var e={$AtSl:!1,$ASGr:!1,$Abbx:!1};return i.playObject(a.setToolOptions("moveTool",e)).then(function(){u.setPointerPropagationMode({defaultMode:u.pointerPropagationMode.NEVER_PROPAGATE})})},t=function(){return u.setPointerPropagationMode({defaultMode:u.pointerPropagationMode.ALPHA_PROPAGATE})};this.selectHandler=e,this.deselectHandler=t;var n=new c(u.policyAction.NEVER_PROPAGATE,s.eventKind.KEY_DOWN,null,s.eventKeyCode.ESCAPE),r=new c(u.policyAction.NEVER_PROPAGATE,s.eventKind.KEY_DOWN,null,s.eventKeyCode.TAB),o=new c(u.policyAction.NEVER_PROPAGATE,s.eventKind.KEY_DOWN,null,s.eventKeyCode.ENTER),f=new c(u.policyAction.NEVER_PROPAGATE,s.eventKind.KEY_DOWN,null,s.eventKeyCode.ARROW_UP),l=new c(u.policyAction.NEVER_PROPAGATE,s.eventKind.KEY_DOWN,null,s.eventKeyCode.ARROW_DOWN),v=new c(u.policyAction.NEVER_PROPAGATE,s.eventKind.KEY_DOWN,null,s.eventKeyCode.ARROW_LEFT),m=new c(u.policyAction.NEVER_PROPAGATE,s.eventKind.KEY_DOWN,null,s.eventKeyCode.ARROW_RIGHT);this.keyboardPolicyList=[n,r,o,f,l,v,m];var y=new h(u.policyAction.NEVER_PROPAGATE,s.eventKind.LEFT_MOUSE_DOWN);this.pointerPolicyList=[y],g=!1,this.subToolList=[new p,new d]};r.inherits(y,f),y.prototype.onMouseDown=function(e){if(e.button!==0)return;this.dragging=!0,this.dragEvent=v.clone(e)},y.prototype.onMouseUp=function(e){var t=this.getFlux(),n=t.store("application"),r=n.getCurrentDocument(),i=!!this.dragEvent,s=!1;i&&(s=o.isMac?this.dragEvent.metaKey:this.dragEvent.ctrlKey),this.dragging=!1,this.dragEvent=null;if(!r||!i)return;t.actions.superselect.click(r,e.pageX,e.pageY,s,e.shiftKey)},y.prototype.onMouseMove=function(){if(!this.dragging)return;this.dragging=!1;var e=this.getFlux(),t=e.store("application"),n=t.getCurrentDocument();if(!n)return;var r=this.dragEvent,i={option:r.altKey,command:r.metaKey,shift:r.shiftKey,control:r.ctrlKey};this.dragEvent=null,e.actions.superselect.drag(n,r.pageX,r.pageY,i,g),g=!1},y.prototype.onClick=function(e){e.stopPropagation()},y.prototype.onDoubleClick=function(e){var t=this.getFlux(),n=t.store("application"),r=n.getCurrentDocument();if(!r)return;t.actions.superselect.doubleClick(r,e.pageX,e.pageY)},y.prototype.onKeyDown=function(e){var t=this.getFlux(),n=t.store("application"),r=n.getCurrentDocument();if(!r)return;var i=e.detail,u="";switch(i.keyCode){case s.eventKeyCode.ESCAPE:var a=o.isMac?i.modifiers.alt:i.modifiers.shift;t.actions.superselect.backOut(r,a);break;case s.eventKeyCode.TAB:var f=i.modifiers.shift;t.actions.superselect.nextSibling(r,f);break;case s.eventKeyCode.ENTER:t.actions.superselect.diveIn(r);break;case s.eventKeyCode.ARROW_UP:u="up";break;case s.eventKeyCode.ARROW_DOWN:u="down";break;case s.eventKeyCode.ARROW_LEFT:u="left";break;case s.eventKeyCode.ARROW_RIGHT:u="right"}if(u!==""){var l=i.modifiers.shift;t.actions.transform.nudgeLayersThrottled(u,l)}i.keyChar===" "&&(g=!0)},y.prototype.onKeyUp=function(e){var t=e.detail;t.keyChar===" "&&(g=!1)},y.prototype.toolOverlay=m,n.exports=y}),define("js/tools/rectangle",["require","exports","module","adapter/util","adapter/ps/descriptor","adapter/lib/tool","adapter/os","adapter/ps/ui","js/models/tool","js/models/eventpolicy"],function(e,t,n){"use strict";var r=e("adapter/util"),i=e("adapter/ps/descriptor"),s=e("adapter/lib/tool"),o=e("adapter/os"),u=e("adapter/ps/ui"),a=e("js/models/tool"),f=e("js/models/eventpolicy"),l=f.KeyboardEventPolicy,c=function(){var e={$Abbx:!1},t=s.setToolOptions("moveTool",e),n=s.resetShapeTool(),r=function(){return i.batchPlayObjects([n,t])},f=new l(u.policyAction.NEVER_PROPAGATE,o.eventKind.KEY_DOWN,{shift:!0},"U");a.call(this,"rectangle","Rectangle","rectangleTool",r),this.keyboardPolicyList=[f],this.activationKey="r",this.hideTransformControls=!0};r.inherits(c,a),c.prototype.onKeyDown=function(e){var t=this.getFlux(),n=t.store("tool"),r=e.detail;r.keyChar==="u"&&r.modifiers.shift&&t.actions.tools.select(n.getToolByID("ellipse"))},n.exports=c}),define("js/tools/ellipse",["require","exports","module","adapter/util","adapter/ps/descriptor","adapter/lib/tool","js/models/tool","adapter/os","adapter/ps/ui","js/models/eventpolicy"],function(e,t,n){"use strict";var r=e("adapter/util"),i=e("adapter/ps/descriptor"),s=e("adapter/lib/tool"),o=e("js/models/tool"),u=e("adapter/os"),a=e("adapter/ps/ui"),f=e("js/models/eventpolicy"),l=f.KeyboardEventPolicy,c=function(){var e=function(){return i.playObject(s.resetShapeTool())},t=new l(a.policyAction.NEVER_PROPAGATE,u.eventKind.KEY_DOWN,{shift:!0},"U");o.call(this,"ellipse","Ellipse","ellipseTool",e),this.keyboardPolicyList=[t],this.activationKey="e",this.hideTransformControls=!0};r.inherits(c,o),c.prototype.onKeyDown=function(e){var t=this.getFlux(),n=t.store("tool"),r=e.detail;r.keyChar==="u"&&r.modifiers.shift&&t.actions.tools.select(n.getToolByID("rectangle"))},n.exports=c}),define("js/tools/pen",["require","exports","module","bluebird","adapter/util","adapter/ps","adapter/os","adapter/ps/ui","adapter/lib/tool","adapter/ps/descriptor","js/models/tool","js/actions/shortcuts","js/models/eventpolicy"],function(e,t,n){"use strict";var r=e("bluebird"),i=e("adapter/util"),s=e("adapter/ps"),o=e("adapter/os"),u=e("adapter/ps/ui"),a=e("adapter/lib/tool"),f=e("adapter/ps/descriptor"),l=e("js/models/tool"),c=e("js/actions/shortcuts"),h=e("js/models/eventpolicy"),p=h.KeyboardEventPolicy,d=106,v=function(){l.call(this,"pen","Pen","penTool");var e=function(){var e=function(e){return e.stopPropagation(),s.performMenuCommand(d).catch(function(){})},t=a.resetShapeTool(),n=this.transfer(c.addShortcut,o.eventKeyCode.BACKSPACE,{},e,"penBackspace",!0),i=this.transfer(c.addShortcut,o.eventKeyCode.DELETE,{},e,"penDelete",!0),l=f.playObject(t),h=u.setSuppressTargetPaths(!1);return r.join(l,h,n,i)},t=function(){var e=u.setSuppressTargetPaths(!0),t=this.transfer(c.removeShortcut,"penBackspace"),n=this.transfer(c.removeShortcut,"penDelete");return r.join(e,t,n)},n=new p(u.policyAction.NEVER_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.BACKSPACE),i=new p(u.policyAction.NEVER_PROPAGATE,o.eventKind.KEY_DOWN,null,o.eventKeyCode.DELETE);this.keyboardPolicyList=[n,i],this.selectHandler=e,this.deselectHandler=t,this.activationKey="p",this.hideTransformControls=!0,this.hideTransformOverlay=!0};i.inherits(v,l),n.exports=v}),define("js/tools/type",["require","exports","module","adapter/util","js/models/tool"],function(e,t,n){"use strict";var r=e("adapter/util"),i=e("js/models/tool"),s=function(){i.call(this,"typeCreateOrEdit","Type","typeCreateOrEditTool"),this.activationKey="t",this.hideTransformControls=!0};r.inherits(s,i),n.exports=s}),define("js/stores/tool",["require","exports","module","fluxxor","lodash","js/tools/superselect","js/tools/rectangle","js/tools/ellipse","js/tools/pen","js/tools/type","../events"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("lodash"),s=e("js/tools/superselect"),o=e("js/tools/rectangle"),u=e("js/tools/ellipse"),a=e("js/tools/pen"),f=e("js/tools/type"),l=e("../events"),c=r.createStore({_allTools:null,_currentTool:null,_previousTool:null,_currentKeyboardPolicyID:null,_currentPointerPolicyID:null,_inModalToolState:null,initialize:function(){var e={},t=function(n){if(e.hasOwnProperty(n.id))throw new Error("Tool ID %s already in use.",n.id);e[n.id]={value:n,enumerable:!0,writeable:!1},n.subToolList.length>0&&n.subToolList.forEach(t)};t(new s),t(new o),t(new u),t(new a),t(new f),this._allTools=Object.defineProperties({},e),this.bindActions(l.tool.SELECT_TOOL,this._handleSelectTool,l.tool.MODAL_STATE_CHANGE,this._handleModalStateChange)},getState:function(){return{current:this._currentTool,previous:this._previousTool}},getModalToolState:function(){return this._inModalToolState},_handleSelectTool:function(e){var t=e.tool;this._previousTool=this._currentTool,this._currentTool=t,this._currentKeyboardPolicyID=e.keyboardPolicyListID,this._currentPointerPolicyID=e.pointerPolicyListID,this.emit("change")},_handleModalStateChange:function(e){this._inModalToolState=e.modalState},getCurrentTool:function(){return this._currentTool},getPreviousTool:function(){return this._previousTool},getCurrentKeyboardPolicyID:function(){return this._currentKeyboardPolicyID},getCurrentPointerPolicyID:function(){return this._currentPointerPolicyID},inferTool:function(e){var t=null;return Object.keys(this._allTools).some(function(n){var r=this._allTools[n];if(r.isMainTool&&r.nativeToolName===e)return t=r,!0},this),t},getDefaultTool:function(){return this._allTools.newSelect},getToolByID:function(e){return this._allTools[e]},getAllTools:function(){return i.values(this._allTools)}});n.exports=c}),define("js/models/menuitem",["require","exports","module","adapter/os","lodash","immutable","adapter/ps/ui","i18n!nls/strings","js/util/key","js/util/global"],function(e,t,n){"use strict";var r=e("adapter/os"),i=e("lodash"),s=e("immutable"),o=e("adapter/ps/ui"),u=e("i18n!nls/strings"),a=e("js/util/key"),f=e("js/util/global"),l=s.Record({type:null,id:null,itemID:null,label:null,submenu:null,submenuMap:null,command:null,commandKind:null,shortcut:null,enabled:null,checked:null}),c=function(e){var t=e.split("."),n=u.MENU;return t.forEach(function(t){if(!n.hasOwnProperty(t))throw new Error("Missing label for menu entry: "+e);n=n[t]}),n},h=function(e){var t=c(e);if(!t.hasOwnProperty("$MENU"))throw new Error("Missing label for menu: "+e);return t.$MENU};l.fromDescriptor=function(e,t,n){n===undefined&&(n={});var i={};if(e.separator)return i.type="separator",new l(i);if(!e.hasOwnProperty("id"))throw new Error("Missing menu id");i.id=e.id;var u;t===undefined?u=e.id:u=t+"."+e.id,i.id=u,i.itemID=e.id,e.hasOwnProperty("enabled")&&(i.enabled=e.enabled);if(e.hasOwnProperty("submenu")){i.label=h(u);var p=new Map,d=e.submenu;f.debug||(d=d.filter(function(e){return!e.debug})),d=d.map(function(e){var t=l.fromDescriptor(e,u,n);return t.type!=="separator"&&p.set(t.itemID,t),t},this),i.submenuMap=s.Map(p),i.submenu=s.List(d)}else i.label=c(u),i.command=u;e.hasOwnProperty("commandKind")&&(i.commandKind=o.commandKind[e.commandKind]);if(e.hasOwnProperty("shortcut")){var v=e.shortcut.keyChar,m=e.shortcut.keyCode,g=e.shortcut.modifiers||{},y=a.modifiersToBits(g),b;i.shortcut={modifiers:y};if(v&&m)throw new Error("Menu entry specifies both key char and code");if(v)i.shortcut.keyChar=v,b="char-"+v;else{if(!m)throw new Error("Menu entry does not specify a key for its shortcut");if(!r.eventKeyCode.hasOwnProperty(m))throw new Error("Menu entry specifies unknown key code: "+m);i.shortcut.keyCode=r.eventKeyCode[m],b="code-"+m}n.hasOwnProperty(b)||(n[b]={});if(n[b][y])throw new Error("Menu entry shortcut duplicate: "+b);n[b][y]=!0}return new l(i)},l.prototype.exportDescriptor=function(){var e=i.omit(this.toObject(),i.isNull);return delete e.submenuMap,this.submenu!==null&&(this.submenu.isEmpty()&&(e.enabled=!1),e.submenu=this.submenu.map(function(e){return e.exportDescriptor()}).toArray()),e},l.prototype.updateSubmenuProps=function(e,t){var n=this.submenuMap.get(e),r=this.submenu.indexOf(n);return n=n.merge(t),this.setIn(["submenu",r],n).setIn(["submenuMap",e],n)},l.prototype._update=function(e,t){var n=null,r=new Map;this.submenu!==null&&(n=this.submenu.map(function(n){var i=n._update(e,t);return r.set(i.itemID,i),i}));var i=e.get(this.id,s.List()),o;return i.isEmpty()?o=!1:o=i.every(function(e){return t[e]}),this.merge({enabled:o,submenu:n,submenuMap:r})},n.exports=l}),define("js/models/menubar",["require","exports","module","lodash","immutable","./menuitem","js/util/key","js/util/path","js/util/system"],function(e,t,n){"use strict";var r=e("lodash"),i=e("immutable"),s=e("./menuitem"),o=e("js/util/key"),u=e("js/util/path"),a=e("js/util/system"),f=i.Record({id:null,roots:null,enablers:null,actions:null,rootMap:null}),l=function(e,t,n,s){r.forEach(e,function(e,r){var o;s===undefined?o=r:o=s+"."+r;var u;if(e.hasOwnProperty("$enable-rule")){var a=e["$enable-rule"];u=i.List(a.split(","))}else u=i.List();n.set(o,u);if(e.hasOwnProperty("$action")){var f={$action:e.$action};e.hasOwnProperty("$payload")&&(f.$payload=e.$payload),t.set(o,f)}else r!=="$enable-rule"&&l(e,t,n,o)},this)},c=function(e,t,n){return n?{always:!0,"always-except-modal":!1}:{always:!0,"always-except-modal":!0,"have-document":t!==null,"supported-document":t!==null&&!t.unsupported,"psd-document":t!==null&&!t.unsupported&&t.format==="Photoshop","dirty-document":t!==null&&t.dirty,"layer-selected":t!==null&&!t.unsupported&&t.layers!==null&&t.layers.selected.size!==0,"layers-selected-2":t!==null&&!t.unsupported&&t.layers!==null&&t.layers.selectedNormalized.size===2,"layers-selected-2+":t!==null&&!t.unsupported&&t.layers!==null&&t.layers.selectedNormalized.size>1,"layers-selected-3+":t!==null&&!t.unsupported&&t.layers!==null&&t.layers.selectedNormalized.size>2,"layers-selected-all-shapes":t!==null&&!t.unsupported&&t.layers!==null&&t.layers.selected.every(function(e){return e.kind===e.layerKinds.VECTOR}),"no-background":t!==null&&!t.unsupported&&t.layers!==null&&!t.layers.backgroundSelected,"no-nesting":t!==null&&!t.unsupported&&t.layers!==null&&!t.layers.selected.some(function(e){return t.layers.ancestors(e).some(function(n){return e!==n&&t.layers.selected.contains(n)})}),"have-linked":t!==null&&!t.unsupported&&t.layers.hasLinkedSmartObjects,"multiple-documents":Object.keys(e).length>1,"earlier-history":t!==null&&t.currentHistoryState>2,"later-history":t!==null&&t.currentHistoryState<t.historyStates}},h=function(e,t,n){var i=t.FILE.NEW_FROM_TEMPLATE,s=r.findIndex(e.menu,function(e){return e.id==="FILE"}),o=e.menu[s],u=r.findIndex(o.submenu,function(e){return e.id==="NEW_FROM_TEMPLATE"}),a=o.submenu[u],f=a.submenu;n.forEach(function(e){var t=e.id,n=e.preset;f.push({id:t}),i[t]={"$enable-rule":"always-except-modal",$action:"documents.createNew",$payload:{preset:n}}})};f.fromJSONObjects=function(e,t,n){if(!e.hasOwnProperty("id")||!e.hasOwnProperty("menu"))throw new Error("Missing menu id and submenu");h(e,t,n);var r=e.id,o=new Map,u=i.List(e.menu.map(function(e){var t=s.fromDescriptor(e);return o.set(t.id,t),t})),a=new Map,c=new Map;return l(t,a,c),new f({id:r,roots:u,enablers:i.Map(c),actions:i.Map(a),rootMap:i.Map(o)})},f.prototype.updateMenuItems=function(e,t,n){var r=c(e,t,n),i=new Map,s=this.roots.map(function(e){var t=e._update(this.enablers,r);return i.set(t.id,t),t},this);return this.merge({roots:s,rootMap:i})},f.prototype.updateViewMenuItems=function(e){return this.updateSubmenuItems("VIEW",{TOGGLE_GUIDES:{checked:e&&e.guidesVisible?1:0},TOGGLE_SMART_GUIDES:{checked:e&&e.smartGuidesVisible?1:0}})},f.prototype.updateNonDocWindowMenuItems=function(e){return this.updateSubmenuItems("WINDOW",{TOGGLE_TOOLBAR:{checked:e.get("toolbarPinned",!0)?1:0}})},f.prototype.updateSubmenuItems=function(e,t){var n=this.getMenuItem(e),i=this.roots.indexOf(n);return n=r.reduce(t,function(e,t,n){return e.updateSubmenuProps(n,t)},n),this.merge({roots:this.roots.set(i,n),rootMap:this.rootMap.set(e,n)})},f.prototype.updateRecentFiles=function(e){var t="FILE.OPEN_RECENT",n=this.getMenuItem("FILE"),r=this.actions,o=this.enablers,a=this.getMenuItem(t),f=u.getShortestUniquePaths(e),l=e.slice(0,20).map(function(e,n){var u=t+"."+n,a=f[n],l=a.length<60?a:a.substr(0,30)+"…"+a.substr(-29),c={id:u,itemID:n.toString(),label:l,command:u};return o=o.set(u,i.List.of("always")),r=r.set(u,{$action:"documents.open",$payload:e,$dontLog:!0}),new s(c)}),c=a.merge({submenu:i.List(l),enabled:e.length>0}),h=n.update(function(e){var n=e.submenu,r=n.findIndex(function(e){return e.id===t}),i=n.set(r,c),s=e.submenuMap.set(t,c);return e.merge({submenu:i,submenuMap:s})}),p=this.roots.findIndex(function(e){return e.id==="FILE"}),d=this.roots.set(p,h),v=this.rootMap.set("FILE",h);return this.merge({roots:d,rootMap:v,actions:r,enablers:o})};var p={command:!0,option:!0},d={control:!0,alt:!0};f.prototype.updateOpenDocuments=function(e,t,n){var u=this.getMenuItem("WINDOW"),f=this.actions,l=this.enablers,c=a.isMac?p:d,h=o.modifiersToBits(c),v=r.values(e).map(function(e,r){var o=e.name,u=o.length<60?o:o.substr(0,30)+"…"+o.substr(-29),a="WINDOW.OPEN_DOCUMENT."+r,c={id:a,itemID:r.toString(),label:u,command:a,enabled:!n,checked:i.is(e,t)?"on":"off",shortcut:r<9?{keyChar:(r+1).toString(),modifiers:h}:null};return l=l.set(a,i.List.of("always")),f=f.set(a,{$action:"documents.selectDocument",$payload:e,$dontLog:!0}),new s(c)}),m=u.update(function(e){var t=e.submenu,n=t.takeUntil(function(e){return r.startsWith(e.id,"WINDOW.OPEN_DOCUMENT.")}),i=n.concat(v);return e.merge({submenu:i})}),g=this.roots.findIndex(function(e){return e.id==="WINDOW"}),y=this.roots.set(g,m),b=this.rootMap.set("WINDOW",m);return this.merge({roots:y,rootMap:b,actions:f,enablers:l})},f.prototype.getMenuAction=function(e){return this.actions.get(e)},f.prototype.getMenuDescriptor=function(){return{id:this.id,menu:this.roots.map(function(e){return e.exportDescriptor()}).toArray()}},f.prototype.getMenuItem=function(e){var t=e.split("."),n=t.shift(),r=this.rootMap.get(n,null),i=r;return t.forEach(function(e){i!==null&&(i=i.submenuMap.get(e,null))}),i},n.exports=f}),define("js/stores/menu",["require","exports","module","fluxxor","immutable","lodash","js/models/menubar","../events"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("immutable"),s=e("lodash"),o=e("js/models/menubar"),u=e("../events"),a=r.createStore({_applicationMenu:null,initialize:function(){this._applicationMenu=new o,this.bindActions(u.application.UPDATE_RECENT_FILES,this._updateRecentFiles,u.menus.INIT_MENUS,this._handleMenuInitialize,u.menus.UPDATE_MENUS,this._updateMenuItems,u.document.SELECT_DOCUMENT,this._updateMenuItems,u.document.DOCUMENT_UPDATED,this._updateMenuItems,u.document.SAVE_DOCUMENT,this._updateMenuItems,u.document.DOCUMENT_RENAMED,this._updateMenuItems,u.document.RESET_DOCUMENTS,this._updateMenuItems,u.document.CLOSE_DOCUMENT,this._updateMenuItems,u.document.ADD_LAYERS,this._updateMenuItems,u.document.GUIDES_VISIBILITY_CHANGED,this._updateMenuItems,u.document.RESET_LAYERS,this._updateMenuItems,u.document.RESET_LAYERS_BY_INDEX,this._updateMenuItems,u.document.RESET_BOUNDS,this._updateMenuItems,u.document.REORDER_LAYERS,this._updateMenuItems,u.document.SELECT_LAYERS_BY_ID,this._updateMenuItems,u.document.SELECT_LAYERS_BY_INDEX,this._updateMenuItems,u.document.VISIBILITY_CHANGED,this._updateMenuItems,u.document.LOCK_CHANGED,this._updateMenuItems,u.document.OPACITY_CHANGED,this._updateMenuItems,u.document.BLEND_MODE_CHANGED,this._updateMenuItems,u.document.RENAME_LAYER,this._updateMenuItems,u.document.DELETE_LAYERS,this._updateMenuItems,u.document.GROUP_SELECTED,this._updateMenuItems,u.document.REPOSITION_LAYERS,this._updateMenuItems,u.document.TRANSLATE_LAYERS,this._updateMenuItems,u.document.RESIZE_LAYERS,this._updateMenuItems,u.document.SET_LAYERS_PROPORTIONAL,this._updateMenuItems,u.document.RESIZE_DOCUMENT,this._updateMenuItems,u.document.RADII_CHANGED,this._updateMenuItems,u.document.FILL_COLOR_CHANGED,this._updateMenuItems,u.document.FILL_OPACITY_CHANGED,this._updateMenuItems,u.document.FILL_ADDED,this._updateMenuItems,u.document.STROKE_ALIGNMENT_CHANGED,this._updateMenuItems,u.document.STROKE_ENABLED_CHANGED,this._updateMenuItems,u.document.STROKE_WIDTH_CHANGED,this._updateMenuItems,u.document.STROKE_COLOR_CHANGED,this._updateMenuItems,u.document.STROKE_OPACITY_CHANGED,this._updateMenuItems,u.document.STROKE_ADDED,this._updateMenuItems,u.document.LAYER_EFFECT_CHANGED,this._updateMenuItems,u.document.TYPE_FACE_CHANGED,this._updateMenuItems,u.document.TYPE_SIZE_CHANGED,this._updateMenuItems,u.document.TYPE_COLOR_CHANGED,this._updateMenuItems,u.document.TYPE_TRACKING_CHANGED,this._updateMenuItems,u.document.TYPE_LEADING_CHANGED,this._updateMenuItems,u.document.TYPE_ALIGNMENT_CHANGED,this._updateMenuItems,u.dialog.OPEN_DIALOG,this._updateMenuItems,u.dialog.CLOSE_DIALOG,this._updateMenuItems,u.history.HISTORY_STATE_CHANGE,this._updateMenuItems,u.history.NEW_HISTORY_STATE,this._updateMenuItems,u.document.GUIDES_VISIBILITY_CHANGED,this._updateViewMenu,u.preferences.SET_PREFERENCE,this._updateNonDocWindowMenu)},getApplicationMenu:function(){return this._applicationMenu},_handleMenuInitialize:function(e){var t=e.menus,n=e.actions,r=e.templates;this._applicationMenu=o.fromJSONObjects(t,n,r),this.emit("change")},_updateMenuItemsHelper:s.debounce(function(e,t,n,r){var s=t.getCurrentDocument(),o=e.getAllDocuments(),u=n.getState().appIsModal,a=r.getState(),f=this._applicationMenu;this._applicationMenu=this._applicationMenu.updateMenuItems(o,s,u),this._applicationMenu=this._applicationMenu.updateOpenDocuments(o,s,u),this._applicationMenu=this._applicationMenu.updateViewMenuItems(s),this._applicationMenu=this._applicationMenu.updateNonDocWindowMenuItems(a),i.is(f,this._applicationMenu)||this.emit("change")},200),_updateMenuItems:function(){this.waitFor(["document","application","dialog","preferences"],this._updateMenuItemsHelper)},_updateRecentFiles:function(){this.waitFor(["application"],function(e){var t=e.getRecentFiles(),n=this._applicationMenu;this._applicationMenu=this._applicationMenu.updateRecentFiles(t),i.is(n,this._applicationMenu)||this.emit("change")}.bind(this))},_updateViewMenu:function(){this.waitFor(["document","application"],function(e,t){var n=t.getCurrentDocument(),r=this._applicationMenu;this._applicationMenu=this._applicationMenu.updateViewMenuItems(n),i.is(r,this._applicationMenu)||this.emit("change")}.bind(this))},_updateNonDocWindowMenu:function(){this.waitFor(["preferences"],function(e){var t=e.getState(),n=this._applicationMenu;this._applicationMenu=this._applicationMenu.updateNonDocWindowMenuItems(t),i.is(n,this._applicationMenu)||this.emit("change")}.bind(this))}});n.exports=a}),define("js/stores/preferences",["require","exports","module","fluxxor","immutable","../events","js/util/log"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("immutable"),s=e("../events"),o=e("js/util/log"),u="com.adobe.photoshop.prefs.index",a="com.adobe.photoshop.prefs.keys.",f=window.localStorage,l=function(e){return a+e},c=r.createStore({_preferences:null,initialize:function(){this._loadPreferences(),this.bindActions(s.preferences.SET_PREFERENCE,this._setPreference,s.preferences.SET_PREFERENCES,this._setPreferences,s.preferences.DELETE_PREFERENCE,this._deletePreference,s.preferences.CLEAR_PREFERENCES,this._clearPreferences)},getState:function(){return this._preferences},_loadPreferences:function(){var e=f.getItem(u);if(e===null){this._preferences=i.Map();return}try{var t=JSON.parse(e),n=t.reduce(function(e,t){var n=l(t),r=f.getItem(n),i=JSON.parse(r);return e.set(t,i)}.bind(this),new Map);this._preferences=i.Map(n)}catch(r){o.debug("Failed to load preferences index",r),this._saveIndex(i.Map())}},_saveIndex:function(e){var t=e.keySeq().toArray(),n=JSON.stringify(t);this._preferences=e,f.setItem(u,n),this.emit("change")},_setPreference:function(e){var t=e.key,n=e.value;try{var r=JSON.stringify(n),i=l(t);f.setItem(i,r),this._saveIndex(this._preferences.set(t,n)),this.emit("change")}catch(s){var u=s instanceof Error?s.stack||s.message:s;o.error("Failed to set preference",t,n,u)}},_setPreferences:function(e){var t=e.prefs;try{Object.keys(t).forEach(function(e){var n=t[e],r=JSON.stringify(n),i=l(e);f.setItem(i,r)}),this._saveIndex(this._preferences.merge(t)),this.emit("change")}catch(n){var r=n instanceof Error?n.stack||n.message:n;o.error("Failed to set preferences",t,r)}},_deletePreference:function(e){var t=e.key,n=l(t);f.removeItem(n),this._saveIndex(this._preferences.delete(t)),this.emit("change")},_clearPreferences:function(){this._preferences.keySeq().forEach(function(e){var t=l(e);f.removeItem(t)},this),this._saveIndex(i.Map()),this.emit("change")}});n.exports=c}),define("js/stores/ui",["require","exports","module","fluxxor","../events","js/util/log","js/util/math"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("../events"),s=e("js/util/log"),o=e("js/util/math"),u=r.createStore({_transformMatrix:null,_inverseTransformMatrix:null,_zoom:null,_centerOffsets:null,_overlaysEnabled:null,_rootSize:null,_marqueeEnabled:null,_marqueeStart:null,_propertiesWidth:null,_headerHeight:null,_toolbarWidth:null,initialize:function(){this.bindActions(i.ui.TRANSFORM_UPDATED,this._transformUpdated,i.ui.PANELS_RESIZED,this._handlePanelResize,i.ui.TOOLBAR_PINNED,this._handleToolbarPin,i.ui.SUPERSELECT_MARQUEE,this._handleMarqueeStart,i.ui.TOGGLE_OVERLAYS,this._handleOverlayToggle,i.document.DOCUMENT_UPDATED,this._handleLayersUpdated,i.document.RESET_BOUNDS,this._handleLayersUpdated,i.document.RESET_LAYERS,this._handleLayersUpdated),this._setRootSize(),this._overlaysEnabled=!0,this._marqueeEnabled=!1,this._propertiesWidth=0,this._headerHeight=0,this._toolbarWidth=0},getState:function(){return{transformMatrix:this._transformMatrix,inverseTransformMatrix:this._inverseTransformMatrix,zoomFactor:this._zoom,centerOffsets:this._centerOffsets,overlaysEnabled:this._overlaysEnabled,marqueeEnabled:this._marqueeEnabled,marqueeStart:this._marqueeStart}},zoomWindowToCanvas:function(e){return e*this._zoom},zoomCanvasToWindow:function(e){return e/this._zoom},transformWindowToCanvas:function(e,t){if(!this._transformMatrix)return{x:0,y:0};var n=this._transformMatrix,r=n[0],i=n[1],s=n[2],o=n[3],u=n[4],a=n[5],f=r*e+i*t+u,l=s*e+o*t+a;return{x:f,y:l}},transformCanvasToWindow:function(e,t){if(!this._inverseTransformMatrix)return{x:0,y:0};var n=this._inverseTransformMatrix,r=n[0],i=n[1],s=n[2],o=n[3],u=n[4],a=n[5],f=r*e+s*t+u,l=i*e+o*t+a;return{x:f,y:l}},_inverseOf:function(e){var t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],u=e[5],a=t*i-n*r;return a?(a=1/a,[i*a,-r*a,-n*a,t*a,(n*u-i*o)*a,(r*o-t*u)*a]):(s.warn("Window to canvas matrix not invertable."),null)},_setTransformObject:function(e){e?(this._transformMatrix=[e.xx,e.yx,e.xy,e.yy,e.tx,e.ty],this._inverseTransformMatrix=this._inverseOf(this._transformMatrix)):(this._transformMatrix=null,this._inverseTransformMatrix=null)},getRootSize:function(){return this._rootSize},_setRootSize:function(){var e=window.getComputedStyle(window.document.documentElement);this._rootSize=o.pixelDimensionToNumber(e.fontSize)},_setTransformMatrix:function(e){this._transformMatrix=e,this._inverseTransformMatrix=this._inverseOf(e)},_transformUpdated:function(e){e.transformMatrix?this._setTransformMatrix(e.transformMatrix):this._setTransformObject(e.transformObject),this._zoom=e.zoom,this._overlaysEnabled=!0,this.emit("change")},_recalculateCenterOffset:function(){this._centerOffsets={top:this._headerHeight,right:this._propertiesWidth+this._toolbarWidth,left:0,bottom:0}},_handlePanelResize:function(e){this._propertiesWidth=e.propertiesWidth,this._headerHeight=e.headerHeight,this._recalculateCenterOffset()},_handleToolbarPin:function(e){this._toolbarWidth=e.toolbarWidth,this._recalculateCenterOffset()},_handleOverlayToggle:function(e){this._overlaysEnabled=e.enabled,this.emit("change")},_handleLayersUpdated:function(){this.waitFor(["document"],function(){this._overlaysEnabled=!0,this.emit("change")})},_handleMarqueeStart:function(e){this._marqueeEnabled=e.enabled,this._marqueeStart=e.enabled?{x:e.x,y:e.y}:null,this.emit("change")}});n.exports=u}),define("js/stores/shortcut",["require","exports","module","fluxxor","js/events","js/util/key"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("js/events"),s=e("js/util/key"),o=r.createStore({_shortcuts:null,initialize:function(){this._shortcuts=[],this.bindActions(i.shortcut.ADD_SHORTCUT,this._handleAddShortcut,i.shortcut.REMOVE_SHORTCUT,this._handleRemoveShortcut)},_handleAddShortcut:function(e){e.id||(e.id=window.Symbol()),this._shortcuts.push(e)},_handleRemoveShortcut:function(e){var t=e.id,n=-1;this._shortcuts.some(function(e,r){if(e.id===t)return n=r,!0}),n>0&&this._shortcuts.splice(n,1)},matchShortcuts:function(e,t){var n=e.keyCode,r=e.keyChar;return this._shortcuts.reduce(function(i,o){if(o.key!==n&&o.key!==r||o.capture!==t)return i;var u=s.modifiersToBits(o.modifiers);return e.modifierBits!==u?i:(i.push(o.fn),i)},[])},getByID:function(e){var t;return this._shortcuts.some(function(n){if(n.id===e)return t=n,!0}),t},getState:function(){return{shortcuts:this._shortcuts}}});n.exports=o}),define("js/stores/example-one",["require","exports","module","fluxxor","../events"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("../events"),s=r.createStore({initialize:function(){this.bindActions(i.example.ASYNC_ACTION_START,this.start,i.example.ASYNC_ACTION_SUCCESS,this.success,i.example.ASYNC_ACTION_FAIL,this.fail,i.example.SYNC_ACTION,this.setCounter)},getState:function(){return{time:this.elapsedTime}},start:function(){this.elapsedTime=null,this.startTime=(new Date).getTime()},success:function(){var e=(new Date).getTime();this.elapsedTime=e-this.startTime,this.startTime=null,this.emit("change")},fail:function(){this.elapsedTime=null,this.startTime=null,this.emit("change")},startTime:null,elapsedTime:null,setCounter:function(e){var t=e.count;this.counter=t}});n.exports=s}),define("js/stores/example-two",["require","exports","module","fluxxor","../events"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("../events"),s=r.createStore({initialize:function(){this.bindActions(i.example.SYNC_ACTION,this.setCounter)},getState:function(){return{counter:this.counter}},counter:null,setCounter:function(){this.waitFor(["example-one"],function(e){var t=e.counter;this.counter=t*2,this.emit("change")})}});n.exports=s}),define("js/stores/dialog",["require","exports","module","fluxxor","immutable","lodash","../events","js/util/collection","js/util/log"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("immutable"),s=e("lodash"),o=e("../events"),u=e("js/util/collection"),a=e("js/util/log"),f=r.createStore({_openDialogs:i.Set(),_registeredDialogs:i.Map(),initialize:function(){this.bindActions(o.dialog.REGISTER_DIALOG,this._handleRegister,o.dialog.DEREGISTER_DIALOG,this._handleDeregister,o.dialog.OPEN_DIALOG,this._handleOpen,o.dialog.CLOSE_DIALOG,this._handleClose,o.dialog.CLOSE_ALL_DIALOGS,this._handleCloseAll,o.document.SELECT_LAYERS_BY_ID,this._handleSelectionChange,o.document.SELECT_LAYERS_BY_INDEX,this._handleSelectionChange,o.document.GROUP_SELECTED,this._handleSelectionChange,o.document.CLOSE_DOCUMENT,this._handleDocumentChange,o.document.SELECT_DOCUMENT,this._handleDocumentChange)},getState:function(){return{openDialogs:this._openDialogs,appIsModal:this._openDialogs.contains("first-launch-dialog")||this._openDialogs.contains("keyboard-shortcut-dialog")}},_getCurrentDocumentID:function(){var e=this.flux.store("application");return e.getCurrentDocumentID()},_getCurrentSelectionType:function(){var e=this.flux.store("application"),t=e.getCurrentDocument();if(!t)return null;var n=u.pluck(t.layers.selected,"kind");return u.uniformValue(n)},_handleRegister:function(e){var t=e.id,n={policy:i.Map(e.dismissalPolicy)};this._registeredDialogs=this._registeredDialogs.update(t,i.Map(),function(e){return e.merge(n)})},_handleDeregister:function(e){var t=e.id;this._registeredDialogs=this._registeredDialogs.delete(t),this._openDialogs.has(t)&&(this._openDialogs=this._openDialogs.delete(t),this.emit("change"))},_handleOpen:function(e){var t=e.id,n=i.Map({policy:i.Map(e.dismissalPolicy||{})});this._registeredDialogs.has(t)?n=this._registeredDialogs.get(t).merge(n):s.isEmpty(e.dismissalPolicy)&&a.warn("Opening an un-registered dialog without providing a dismissalPolicy"),n.getIn(["policy","documentChange"])&&(n=n.set("documentID",this._getCurrentDocumentID())),n.getIn(["policy","selectionTypeChange"])&&(n=n.set("selectionType",this._getCurrentSelectionType())),this._registeredDialogs=this._registeredDialogs.set(t,n),this._openDialogs=this._openDialogs.filterNot(function(e){return this._registeredDialogs.getIn([e,"policy","dialogOpen"],!1)},this).add(t),this.emit("change")},_handleClose:function(e){this._openDialogs=this._openDialogs.delete(e.id),this.emit("change")},_handleCloseAll:function(){this._openDialogs=this._openDialogs.clear(),this.emit("change")},_handleDocumentChange:function(){this.waitFor(["document","application"],function(){this._openDialogs=this._openDialogs.filterNot(function(e){var t=this._registeredDialogs.get(e);return t.get("policy").get("documentChange")&&t.get("documentID")!==this._getCurrentDocumentID()},this),this.emit("change")})},_handleSelectionChange:function(){this.waitFor(["document"],function(){this._openDialogs=this._openDialogs.filterNot(function(e){var t=this._registeredDialogs.get(e);return t.get("policy").get("selectionTypeChange")&&t.get("selectionType")!==this._getCurrentSelectionType()},this),this.emit("change")})}});n.exports=f}),define("js/stores/history",["require","exports","module","fluxxor","../events"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("../events"),s=r.createStore({initialize:function(){this.bindActions(i.history.HISTORY_STATE_CHANGE,this._handleHistoryStateChange)},_handleHistoryStateChange:function(){this.emit("change")}});n.exports=s}),define("js/stores/index",["require","exports","module","./application","./document","./font","./tool","./policy","./menu","./preferences","./ui","./shortcut","./example-one","./example-two","./dialog","./history"],function(e,t){"use strict";var n={application:e("./application"),document:e("./document"),font:e("./font"),tool:e("./tool"),policy:e("./policy"),menu:e("./menu"),preferences:e("./preferences"),ui:e("./ui"),shortcut:e("./shortcut"),"example-one":e("./example-one"),"example-two":e("./example-two"),dialog:e("./dialog"),history:e("./history")},r=function(){return Object.keys(n).reduce(function(e,t){var r=n[t];return e[t]=new r,e},{})};t.create=r}),define("js/actions/application",["require","exports","module","adapter/ps/descriptor","../events","js/locks"],function(e,t){"use strict";var n=e("adapter/ps/descriptor"),r=e("../events"),i=e("js/locks"),s=function(){return n.getProperty("application","hostVersion").bind(this).get("value").then(function(e){var t={hostVersion:e};this.dispatch(r.application.HOST_VERSION,t)})},o=function(){return n.getProperty("application","recentFilesAsStrings").bind(this).catch(function(){return[]}).then(function(e){var t={recentFiles:e};this.dispatch(r.application.UPDATE_RECENT_FILES,t),this.dispatch(r.application.INITIALIZED,{item:"recentFiles"})})},u=function(){return this.transfer(l)},a=function(){return this.transfer(l)},f={command:s,reads:[i.PS_APP],writes:[i.JS_APP]},l={command:o,reads:[i.PS_APP],writes:[i.JS_APP]},c={command:u,reads:[i.PS_APP],writes:[i.JS_APP]},h={command:a,reads:[i.PS_APP],writes:[i.JS_APP]};t.updateRecentFiles=l,t.afterStartup=c,t.onReset=h,t.hostVersion=f}),define("js/actions/dialog",["require","exports","module","../events","js/locks"],function(e,t){"use strict";var n=e("../events"),r=e("js/locks"),i=function(e,t){var r={id:e,dismissalPolicy:t};return this.dispatchAsync(n.dialog.REGISTER_DIALOG,r)},s=function(e){var t={id:e};return this.dispatchAsync(n.dialog.DEREGISTER_DIALOG,t)},o=function(e,t){var r={id:e,dismissalPolicy:t};return this.dispatchAsync(n.dialog.OPEN_DIALOG,r)},u=function(e){var t={id:e};return this.dispatchAsync(n.dialog.CLOSE_DIALOG,t)},a=function(){return this.dispatchAsync(n.dialog.CLOSE_DIALOG)},f={command:i,reads:[],writes:[r.JS_DIALOG]},l={command:s,reads:[],writes:[r.JS_DIALOG]},c={command:o,reads:[],writes:[r.JS_DIALOG]},h={command:u,reads:[],writes:[r.JS_DIALOG]},p={command:a,reads:[],writes:[r.JS_DIALOG]};t.registerDialog=f,t.deregisterDialog=l,t.openDialog=c,t.closeDialog=h,t.closeAllDialogs=p}),define("adapter/lib/photoshopEvent",["require","exports","module"],function(e,t){"use strict";var n=function(e){return e.hasOwnProperty("new")?e.new.obj:e.hasOwnProperty("null")?e.null.ref:null};t.targetOf=n}),define("adapter/lib/document",["require","exports","module","../playobject","./reference","./reference","./unit","../util","lodash"],function(e,t){"use strict";var n=e("../playobject"),r=e("./reference").wrapper("document"),i=e("./reference").refersTo,s=e("./unit"),o=e("../util").assert,u=e("lodash"),a=function(e,t){var r={pdfSelection:t.pdfSelection||"page",pageNumber:t.pageNumber||1,suppressWarnings:t.suppressWarnings||!1,name:t.name||e.name,bitDepth:t.bitDepth||8,box:t.box||"boundingBox",bAntiAlias:t.bAntiAlias||!0,bConstrainProportions:t.bConstrainProportions||!0,width:t.width||e.width,height:t.height||e.height,colorSpace:t.colorSpace||"RGBColorMode",resolution:t.resolution},i,o=e.path.lastIndexOf(".");o!==-1&&(o++,i=e.path.substring(o));var u={"null":e};return i==="ai"&&(u.as.obj="PDFGenericFormat",u.as.value.selection={"enum":"pdfSelection",value:r.pdfSelection},u.as.value.suppressWarnings=r.suppressWarnings,u.as.value.pageNumber=r.pageNumber,r.pdfSelection==="page"&&(u.as.value={antiAlias:r.bAntiAlias,constrainProportions:r.bConstrainProportions,crop:{"enum":"cropTo",value:a.cropTo[r.box]},depth:r.bitDepth,width:s.pixels(r.width),height:s.pixels(r.height),mode:{"enum":"colorSpace",value:a.mode[r.colorSpace]},name:r.name,resolution:s.density(r.resolution)})),new n("open",u)};a.cropTo={bounding:"boundingBox",media:"mediaBox",crop:"cropBox",bleed:"bleedBox",trim:"trimBox",art:"artBox"},a.mode={rgb:"RGBColorMode",gray:"grayscaleMode",cmyk:"CMYKColorMode",lab:"labColorMode"};var f=function(e,t){var r={documentID:e};return t&&(r.saving={"enum":"yesNo",value:t}),new n("close",r)},l=function(e,t){var r=e.lastIndexOf("."),i=e.lastIndexOf("/"),s,o,u,a,f={},c={},h={gifColorPalette:t.gifColorPalette||"exact",gifRowOrder:t.gifRowOrder||"normal",gifForcedColors:t.gifForcedColors||"blackAndWhite",gitTransparency:t.gitTransparency||!0,jpgExtendedQuality:t.jpgExtendedQuality||8,jpgFormatOptions:t.jpgFormatOptions||"standard",jpgProgressiveScans:t.jpgProgressiveScans||3,pngCompression:t.pngCompression,pngInterlace:t.pngInterlace,embedProfiles:t.embedProfiles||!1};return r!==-1&&(r++,s=e.substring(r)),i!==-1&&(i++,o=e.substring(i)),u=e.replace(o,""),s==="gif"?(f={obj:"GIFFormat",value:{interfaceIconFrameDimmed:l.gifRowOrder[h.gifRowOrder]}},c={obj:"indexedColorMode",value:{palette:{"enum":"colorPalette",value:l.gifColorPalette[h.gifColorPalette]},forcedColors:{"enum":"forcedColors",value:l.gifForcedColors[h.gifForcedColors]},transparency:h.gitTransparency}}):s==="psd"?f={obj:"photoshop35Format",value:{}}:s==="jpg"?f={obj:"JPEG",value:{extendedQuality:h.jpgExtendedQuality,matteColor:{"enum":"matteColor",value:"none"}}}:s==="png"&&(f={obj:"PNGFormat",value:{PNGInterlaceType:{"enum":"PNGInterlaceType",value:l.pngInterlace[h.pngInterlace]},compression:l.pngCompression[h.pngCompression]}}),a={as:f,"in":{path:e}},s==="gif"?(a.to=c,a.copy=!0):a.embedProfiles=h.embedProfiles,new n("make",a)};l.pngCompression={none:0,smallest:9},l.pngInterlace={none:"PNGInterlaceNone",interlaced:"PNGInterlaceAdam7"},l.gifColorPalette={exact:"exact",mac:"macintoshSystem",window:"windowsSystem",web:"web",localPerceptual:"perceptual",localSelective:"selective",localAdaptive:"adaptive",previous:"previous"},l.gifRowOrder={normal:!1,interlaced:!0},l.gifForcedColors={none:"none",blackAndWhite:"blackAndWhite",primaries:"primaries",web:"web"};var c=function(e){o(i(e)==="document","selectDocument is passed a non-document reference");var t={"null":e};return new n("select",t)};r.path=function(e){return{descriptor:{"null":e}}};var h=function(e){var t={width:e.width||7,height:e.width||5,resolution:e.resolution||72,fill:e.fill||"white",colorMode:e.colorMode||"RGBColorMode",depth:e.depth||8,colorProfile:e.colorProfile||"none",pixelAspectRatio:e.pixelAspectRatio||1},r={obj:"document",value:{width:s.distance(t.width),height:s.distance(t.height),resolution:s.density(t.resolution),fill:{"enum":"fill",value:t.fill},mode:{"class":t.colorMode},depth:t.depth,profile:t.colorProfile,pixelScaleFactor:t.pixelAspectRatio}},i={"new":r};return new n("make",i)},p=function(e){var t={"new":{obj:"document",value:{preset:e}}};return new n("make",t)},d=function(e,t,r,i){return r=r||"center",i=i||"center",new n("canvasSize",{canvasExtensionColorType:{"enum":"canvasExtensionColorType",value:"backgroundColor"},height:t,width:e,horizontal:{"enum":"horizontalLocation",value:r},vertical:{"enum":"verticalLocation",value:i}})},v=function(e,t){o(i(e)==="document","setTargetPathVisible is passed a non-document reference");var r={ref:[{ref:"property",property:"targetPathVisibility"},e]},s={"null":r,to:t};return new n("set",s)},m=function(e,t){o(i(e)==="document","setTargetPathVisible is passed a non-document reference");var r={ref:[{ref:"property",property:"artboards"},e]},s={"null":r,to:{autoNestEnabled:t,autoPositionEnabled:t}};return new n("set",s)},g=function(e){return{"null":{ref:[{ref:"property",property:e},{ref:"document","enum":"ordinal",value:"targetEnum"}]}}},y=g("guidesVisibility"),b=g("smartGuidesVisibility"),w=function(){return new n("get",y)},E=function(){return new n("get",b)},S=function(e){var t=u.clone(y);return t.to=e,new n("set",t)},x=function(e){var t=u.clone(b);return t.to=e,new n("set",t)};t.referenceBy=r,t.open=a,t.close=f,t.save=l,t.select=c,t.create=h,t.createWithPreset=p,t.resize=d,t.setArtboardAutoAttributes=m,t.setTargetPathVisible=v,t.getGuidesVisibility=w,t.getSmartGuidesVisibility=E,t.setGuidesVisibility=S,t.setSmartGuidesVisibility=x}),define("js/actions/history",["require","exports","module","bluebird","adapter/ps/descriptor","adapter/lib/photoshopEvent","js/locks","js/util/synchronization","js/events"],function(e,t){"use strict";var n=e("bluebird"),r=e("adapter/ps/descriptor"),i=e("adapter/lib/photoshopEvent"),s=e("js/locks"),o=e("js/util/synchronization"),u=e("js/events"),a=function(){var e=this.flux.store("application").getCurrentDocumentID();return e===null?n.resolve():r.get("historyState").bind(this).then(function(t){var n={documentID:e,name:t.name,totalStates:t.count,currentState:t.itemIndex};this.dispatch(u.history.NEW_HISTORY_STATE,n)})},f=function(){var e=this.flux.actions.documents.updateCurrentDocument,t=o.throttle(function(){return e().bind(this).then(function(){this.dispatch(u.history.HISTORY_STATE_CHANGE)})},this);return r.addListener("select",function(e){i.targetOf(e)==="historyState"&&t()}.bind(this)),r.addListener("historyState",function(e){var t=this.flux.store("application").getCurrentDocumentID();if(t===null)return;var n={documentID:t,name:e.name,totalStates:e.historyStates+1,currentState:e.currentHistoryState+1};this.dispatch(u.history.NEW_HISTORY_STATE,n)}.bind(this)),n.resolve()},l={command:a,reads:[s.PS_DOC],writes:[s.JS_DOC]},c={command:f,reads:[],writes:[]};t.updateHistoryState=l,t.beforeStartup=c}),define("adapter/lib/artboard",["require","exports","module","../playobject","./reference","../util"],function(e,t){"use strict";var n=e("../playobject"),r=e("./reference"),i=e("../util").assert,s=function(e,t){return t===undefined&&(t=e,e=r.wrapper("layer").target),new n("make",{"null":{ref:"layerSection"},from:e,artboardRect:{obj:"classFloatRect",value:t}})},o=function(e,t){return i(r.refersTo(e)==="layer","transformArtboard requires a layer reference"),new n("editArtboardEvent",{"null":e,artboard:{obj:"artboard",value:{artboardCanvasResize:{"enum":"artboardCanvasResize",value:"artboardCanvasResizeExpand"},artboardEnabled:!0,artboardRect:{obj:"classFloatRect",value:t}}}})};t.make=s,t.transform=o}),define("js/util/locking",["require","exports","module","lodash","immutable","bluebird","adapter/ps/descriptor","adapter/lib/document","adapter/lib/layer","js/util/collection"],function(e,t){"use strict";var n=e("lodash"),r=e("immutable"),i=e("bluebird"),s=e("adapter/ps/descriptor"),o=e("adapter/lib/document"),u=e("adapter/lib/layer"),a=e("js/util/collection"),f=function(e,t){return t.reduce(function(t,n){return t.union(e.layers.lockedAncestors(n)).union(e.layers.lockedDescendants(n))},r.OrderedSet())},l=function(e,t){return t.filterNot(function(e){return e.visible})},c=function(e,t,n){var r=a.pluck(t,"id").toArray(),i=u.referenceBy.id(r),s=o.referenceBy.id(e.id);return i.ref.push(s),u.setLocking(i,n)},h=function(e,t,n){var r=a.pluck(t,"id").toArray(),i=u.referenceBy.id(r),s=o.referenceBy.id(e.id);return i.ref.push(s),n?u.hide(i):u.show(i)},p=function(e,t,r,o,u){var p=f(e,t),d=l(e,t),v=n.isArray(r),m=v?r:[r],g=p.isEmpty(),y=d.isEmpty(),b=(g?0:1)+(y?0:1),w=(g?0:1)+(y?0:1);if(g&&y)return v?s.batchPlayObjects(m,o):s.playObject(r,o);if(!y){m.unshift(h(e,d,!1));var E=u?a.difference(d,t):d;E.isEmpty()?w--:m.push(h(e,E,!0))}if(!g){m.unshift(c(e,p,!1));var S=u?a.difference(p,t):p;S.isEmpty()?w--:m.push(c(e,S,!0))}return s.batchPlayObjects(m,o).then(function(e){if(e.length===m.length){var t=e.slice(b,e.length-w);return v?t:t[0]}i.reject(new Error("Failed to play actions while temporarily unlocking and showing layers"))})};t.playWithLockOverride=p}),define("js/util/layeractions",["require","exports","module","lodash","bluebird","adapter/ps/descriptor","adapter/lib/document","adapter/lib/layer","js/util/log","js/util/locking","js/util/collection"],function(e,t){"use strict";var n=e("lodash"),r=e("bluebird"),i=e("adapter/ps/descriptor"),s=e("adapter/lib/document"),o=e("adapter/lib/layer"),u=e("js/util/log"),a=e("js/util/locking"),f=e("js/util/collection"),l=function(e,t,r){var i=t;return e.forEach(function(e,i){var s=r[i];if(s>=0){if(!t.has(s))throw new Error("Could not find index "+s+" in layerActions");var o=t.get(s);n.isArray(o.playObject)?(o.response=o.response?o.response:[],o.response.push(e)):(o.response&&u.warn("layerAction has a singular action, but more than one response detected"),o.response=e)}}),i},c=function(e,t,u,c){var h=s.referenceBy.id(e.id),p=[],d=t.reduce(function(e,t,r){var i=o.referenceBy.id(t.layer.id);return e.push(o.select([h,i])),p.push(-1),n.isArray(t.playObject)?t.playObject.forEach(function(t){e.push(t),p.push(r)}):(e.push(t.playObject),p.push(r)),e},[]),v=e.layers.selected.map(function(e){return o.referenceBy.id(e.id)});d.push(o.select(v.unshift(h).toArray())),p.push(-1);var m;return u?m=a.playWithLockOverride(e,f.pluck(t,"layer"),d,c):m=i.batchPlayObjects(d,c),m.then(function(e){return e.length!==p.length?r.reject(new Error("Failed during selection dance")):l(e,t,p)})},h=function(e,t,n,r,i){var s=t.map(function(e){return{layer:e,playObject:n}});return c(e,s,r,i).then(function(e){return e.first().response})};t.playLayerActions=c,t.playSimpleLayerActions=h}),define("js/actions/layers",["require","exports","module","bluebird","immutable","lodash","adapter/lib/photoshopEvent","adapter/lib/artboard","adapter/ps/descriptor","adapter/lib/document","adapter/lib/layer","adapter/os","js/models/layer","js/util/collection","js/actions/documents","js/util/log","../events","./shortcuts","js/util/layeractions","js/locks","js/util/locking","js/util/headlights","i18n!nls/strings"],function(e,t){"use strict";var n=e("bluebird"),r=e("immutable"),i=e("lodash"),s=e("adapter/lib/photoshopEvent"),o=e("adapter/lib/artboard"),u=e("adapter/ps/descriptor"),a=e("adapter/lib/document"),f=e("adapter/lib/layer"),l=e("adapter/os"),c=e("js/models/layer"),h=e("js/util/collection"),p=e("js/actions/documents"),d=e("js/util/log"),v=e("../events"),m=e("./shortcuts"),g=e("js/util/layeractions"),y=e("js/locks"),b=e("js/util/locking"),w=e("js/util/headlights"),E=e("i18n!nls/strings"),S=9,x=["layerID","name","visible","layerLocking","itemIndex","background","boundsNoEffects","opacity","layerFXVisible","mode"],T=["adjustment","AGMStrokeStyleInfo","textKey","layerKind","keyOriginType","fillEnabled","fillOpacity","layerEffects","proportionalScaling","artboard","artboardEnabled","pathBounds","smartObject","globalAngle"],N=function(e){var t=e.reduce(function(e,t){return e.concat(x.map(function(e){return{reference:t,property:e}}))},[]),r=u.batchGetProperties(t).reduce(function(e,t,n){var r=n%x.length;r===0&&e.push({});var i=e[e.length-1],s=x[r];return i[s]=t,e},[]),s=e.reduce(function(e,t){return e.concat(T.map(function(e){return{reference:t,property:e}}))},[]),o=u.batchGetProperties(s,{continueOnError:!0}).then(function(e){var t=e[0];return t.reduce(function(e,t,n){var r=n%T.length;r===0&&e.push({});var i=e[e.length-1],s=T[r];return t&&t.hasOwnProperty(s)&&(i[s]=t[s]),e},[])});return n.join(r,o,function(e,t){return e.map(function(e,n){var r=t[n];return i.assign(e,r)})})},C=function(e,t,n,r){typeof t=="number"&&(t=[t]),n===undefined&&(n=!0);if(!r){r=t.length===1&&(e.layers.hasArtboard?e.layers.all.size===3:e.layers.all.size===1);if(r){var i=e.layers.hasArtboard?e.layers.byID(2):e.layers.all.first();r=i&&!i.isBackground&&i.bounds&&!i.bounds.area&&e.layers.hasArtboard&&i.selected&&e.layers.selected.size===1}}var s=t.map(function(t){return[a.referenceBy.id(e.id),f.referenceBy.id(t)]});return N(s).bind(this).then(function(i){var s={documentID:e.id,layerIDs:t,descriptors:i,selected:n,replace:r};this.dispatch(v.document.ADD_LAYERS,s)})},k=function(e,t){var n=t.map(function(t){return[a.referenceBy.id(e.id),f.referenceBy.id(t.id)]}).toArray();return N(n).bind(this).then(function(n){var r=0,i={documentID:e.id};i.layers=t.map(function(e){return{layerID:e.id,descriptor:n[r++]}}),this.dispatch(v.document.RESET_LAYERS,i)})},L=function(e){if(!e)return n.resolve();var t=e.layers.all.filter(function(e){return e.kind===e.layerKinds.SMARTOBJECT});return t.isEmpty()?n.resolve():this.transfer(mt,e,t)},A=function(e,t){var n=r.Iterable.isIterable(t)?t:r.List.of(t),i=n.map(function(t){var n=e.hasBackgroundLayer?t-1:t;return[a.referenceBy.id(e.id),f.referenceBy.index(n)]}).toArray();return N(i).bind(this).then(function(t){var n={documentID:e.id,descriptors:t};this.dispatch(v.document.RESET_LAYERS_BY_INDEX,n)})},O=function(e,t){var n=t.map(function(t){var n;return t.isArtboard?n="artboard":t.kind===t.layerKinds.VECTOR?n="pathBounds":n="boundsNoEffects",[a.referenceBy.id(e.id),f.referenceBy.id(t.id),{ref:"property",property:n}]}).toArray();return u.batchGet(n).bind(this).then(function(n){var r=0,i={documentID:e.id};i.bounds=t.map(function(e){return{layerID:e.id,descriptor:n[r++]}}),this.dispatch(v.document.RESET_BOUNDS,i)})},M=function(e,t,s){t instanceof c&&(t=r.List.of(t));if(e.unsupported)return n.resolve();var o={documentID:e.id},l=n.resolve();if(!s||s==="select")o.selectedIDs=h.pluck(t,"id"),l=this.dispatchAsync(v.document.SELECT_LAYERS_BY_ID,o);var p=t.map(function(e){return f.referenceBy.id(e.id)}).unshift(a.referenceBy.id(e.id)).toArray(),d=f.select(p,!1,s),m=u.playObject(d).bind(this).then(function(){s&&s!=="select"&&u.getProperty(a.referenceBy.id(e.id),"targetLayers").bind(this).then(function(e){o.selectedIndices=i.pluck(e,"index"),this.dispatch(v.document.SELECT_LAYERS_BY_INDEX,o)})});return n.join(l,m)},_=function(e,t,r){var i={documentID:e.id,layerID:t.id,name:r},s=this.dispatchAsync(v.document.RENAME_LAYER,i),o=[a.referenceBy.id(e.id),f.referenceBy.id(t.id)],l=f.rename(o,r),c=u.playObject(l);return n.join(s,c)},D=function(e){e===undefined&&(e=this.flux.store("application").getCurrentDocument());if(!e||e.unsupported||e.layers.all.size===1&&e.layers.all.first().isBackground)return n.resolve();var t={documentID:e.id,selectedIDs:[]},r=u.playObject(f.deselectAll()),i=this.dispatchAsync(v.document.SELECT_LAYERS_BY_ID,t);return n.join(i,r)},P=function(e){return e===undefined&&(e=this.flux.store("application").getCurrentDocument()),!e||e.unsupported||e.layers.all.isEmpty()?n.resolve():this.transfer(Z,e,e.layers.all)},H=function(e){e===undefined&&(e=this.flux.store("application").getCurrentDocument());if(!e||e.unsupported||e.layers.all.isEmpty()||!e.layers.selectedLayersDeletable)return n.resolve();var t=e.id,r=e.layers.allSelected,i=h.pluck(r,"id"),s=f.delete(f.referenceBy.current),o={documentID:t,layerIDs:i},u={historyStateInfo:{name:E.ACTIONS.DELETE_LAYERS,target:a.referenceBy.id(t)}},l=this.dispatchAsync(v.document.DELETE_LAYERS,o),c=b.playWithLockOverride(e,r,s,u,!0);return n.join(l,c)},B=function(e){var t=e.layers.selected;if(t.size===0)return n.resolve();if(e.layers.backgroundSelected)return n.resolve();var r=t.some(function(t){return e.layers.maxDescendantDepth(t)>S});return r?n.resolve():u.playObject(f.groupSelected()).bind(this).then(function(t){var n={documentID:e.id,groupID:t.layerSectionStart,groupEndID:t.layerSectionEnd,groupname:t.name};this.dispatch(v.document.GROUP_SELECTED,n)})},j=function(){var e=this.flux,t=e.store("application"),r=t.getCurrentDocument();return r?this.transfer(it,r):n.resolve()},F=function(e,t,r){var i={documentID:e.id,layerID:t.id,visible:r},s=r?f.show:f.hide,o=[a.referenceBy.id(e.id),f.referenceBy.id(t.id)],l=this.dispatchAsync(v.document.VISIBILITY_CHANGED,i),c=u.playObject(s.apply(this,[o]));return n.join(l,c)},I=function(e,t){return u.playObject(f.unlockBackground(t.id)).bind(this).then(function(t){var n=t.layerID;return this.transfer(pt,e,n,!0,!0)})},q=function(e,t,r){var i={documentID:e.id,layerID:t.id,locked:r},s=[a.referenceBy.id(e.id),f.referenceBy.id(t.id)],o=this.dispatchAsync(v.document.LOCK_CHANGED,i),l;return t.isBackground?l=I.call(this,e,t):l=u.playObject(f.setLocking(s,r)),n.join(o,l)},R=function(e,t,r,i){var s={documentID:e.id,layerIDs:h.pluck(t,"id"),opacity:r},o=t.map(function(t){var n=[a.referenceBy.id(e.id),f.referenceBy.id(t.id)];return f.setOpacity(n,r)}),u={historyStateInfo:{name:E.ACTIONS.CHANGE_LAYER_OPACITY,target:a.referenceBy.id(e.id),coalesce:!!i},paintOptions:{immediateUpdate:!0,quality:"draft"}},l=this.dispatchAsync(v.document.OPACITY_CHANGED,s),c=b.playWithLockOverride(e,t,o.toArray(),u);return n.join(l,c)},U=function(e){var t=this.flux.store("application"),r=t.getCurrentDocument();if(!r)return n.resolve();var i=r.layers.selected.map(function(t){return this.transfer(ut,r,t,e)},this).toArray();return n.all(i)},z=function(){return U.call(this,!0)},W=function(){return U.call(this,!1)},X=function(e){var t=e.numberOfLayers,n=e.hasBackgroundLayer?0:1,r=i.range(t,n-1,-1).map(function(t){return[a.referenceBy.id(e.documentID),f.referenceBy.index(t)]});return u.batchGetProperty(r,"layerID")},V=function(e,t,n){r.Iterable.isIterable(t)||(t=r.List.of(t));var i=a.referenceBy.id(e),s=t.map(function(e){return f.referenceBy.id(e)}).unshift(i).toArray(),o=f.referenceBy.index(n),l=f.reorder(s,o);return u.playObject(l).bind(this).then(function(){return u.get(i).bind(this).then(function(t){return X(t).then(function(t){var n={documentID:e,layerIDs:t};this.dispatch(v.document.REORDER_LAYERS,n)}.bind(this))})})},$=function(e,t,r){var i=a.referenceBy.id(e.id),s=h.pluck(t,"id"),o=s.map(function(e){return f.referenceBy.id(e)}).unshift(i).toArray(),u={historyStateInfo:{name:E.ACTIONS.SET_BLEND_MODE,target:a.referenceBy.id(e.id)}},l={documentID:e.id,layerIDs:s,mode:r},c=this.dispatchAsync(v.document.BLEND_MODE_CHANGED,l),p=b.playWithLockOverride(e,t,f.setBlendMode(o,r),u);return n.join(c,p)},J=function(e,t,r){t=t.filterNot(function(e){return e.kind===e.layerKinds.GROUPEND});var i=h.pluck(t,"id"),s={documentID:e.id,layerIDs:i,proportional:r},o={paintOptions:{immediateUpdate:!0,quality:"draft"},historyStateInfo:{name:E.ACTIONS.SET_PROPORTIONAL_SCALE,target:a.referenceBy.id(e.id)}},u=n.bind(this).then(function(){this.dispatch(v.document.SET_LAYERS_PROPORTIONAL,s)}),l=t.map(function(e){var t=f.referenceBy.id(e.id),n=f.setProportionalScaling(t,r);return{layer:e,playObject:n}},this),c=g.playLayerActions(e,l,!0,o);return n.join(u,c)},K={bottom:1960,top:0,right:1080,left:0},Q=function(e){var t=this.flux.store("application").getCurrentDocument(),n=t.layers.all.filter(function(e){return e.isArtboard}),r=f.referenceBy.none,i;if(e!==undefined)i=e.toJS();else if(n.isEmpty())r=f.referenceBy.current,i=K;else{var s=n.reduce(function(e,t){return t.bounds.right>e.bounds.right?t:e},n.first()),a=s.bounds.width+100;i={top:s.bounds.top,bottom:s.bounds.bottom,left:s.bounds.left+a,right:s.bounds.right+a}}var l=o.make(r,i);return u.playObject(l).bind(this).then(function(){return d.debug("Warning: calling updateDocument to add a single artboard is very slow!"),this.transfer(p.updateCurrentDocument)})},G=function(e,t,r){if(r.isEmpty())return n.resolve();var i=r.map(function(n){var r=a.referenceBy.id(e.id),i=a.referenceBy.id(t.id),s=f.referenceBy.id(n.id),o=[s,i];return f.duplicate(o,r)}),s={historyStateInfo:{name:E.ACTIONS.DUPLICATE_LAYERS,target:a.referenceBy.id(e.id)}};return u.batchPlayObjects(i.toArray(),s).bind(this).then(function(t){if(t.length===1&&typeof t[0].layerID=="number")return this.transfer(p.updateCurrentDocument);var n=h.pluck(t,"ID").reduce(function(e,t){return e.concat(t)},[]);return this.transfer(pt,e,n)})},Y=function(){var e=this.flux.store("application"),t=this.flux.store("tool");u.addListener("make",function(n){var r=s.targetOf(n),i;switch(r){case"layer":case"contentLayer":case"textLayer":i=e.getCurrentDocument();if(!i){d.warn("Received layer make event without a current document",n);return}typeof n.layerID=="number"?this.flux.actions.layers.addLayers(i,n.layerID):this.flux.actions.documents.updateCurrentDocument();var o=t.getCurrentTool();if(o){var u=o.id;w.logEvent("tools","create",u)}}}.bind(this)),u.addListener("set",function(t){var n=s.targetOf(t),r;switch(n){case"textLayer":r=e.getCurrentDocument();if(!r){d.warn("Received layer set event without a current document",t);return}this.flux.actions.layers.resetLayers(r,r.layers.selected)}}.bind(this)),u.addListener("selectedLayer",function(e){var t=this.flux.store("application"),n={documentID:t.getCurrentDocumentID(),selectedIDs:[e.layerID]};this.dispatch(v.document.SELECT_LAYERS_BY_ID,n)}.bind(this)),u.addListener("autoCanvasResizeShift",function(e){var t=this.flux.store("application"),n=t.getCurrentDocument();if(n!==null){var r={documentID:t.getCurrentDocumentID(),layerIDs:h.pluck(n.layers.all,"id"),position:{x:e.to.value.horizontal,y:e.to.value.vertical}};this.dispatch(v.document.TRANSLATE_LAYERS,r)}}.bind(this));var o=function(){var e=this.flux.store("application"),t=e.getCurrentDocument();if(t!==null){var n=t.layers.selected;this.flux.actions.layers.resetBounds(t,n)}}.bind(this);u.addListener("addTo",o),u.addListener("subtractFrom",o),u.addListener("interfaceWhite",o),u.addListener("pathOperation",function(e){if(e.command==="pathChange"){var t=this.flux.store("application"),n=t.getCurrentDocument(),s=n.layers,o=i.pluck(i.rest(e.null.ref),"id"),u=r.List(o.map(s.byID,s));this.flux.actions.layers.resetBounds(n,u)}}.bind(this)),u.addListener("delete",function(e){var t=this.flux.store("application"),n=this.flux.store("tool"),a=s.targetOf(e),f=t.getCurrentDocument();if(!f)return;if(a==="layer"){var l={documentID:f.id,layerIDs:r.List(e.layerID)||r.List()};this.dispatch(v.document.DELETE_LAYERS,l),u.getProperty("document","targetLayers").bind(this).then(function(e){var t=i.pluck(e,"index"),r={documentID:f.id,selectedIndices:t};this.dispatch(v.document.SELECT_LAYERS_BY_INDEX,r),this.flux.actions.tools.select(n.getDefaultTool())})}else a===null&&o()}.bind(this));var a=function(){var e=window.getSelection();e.type!=="Range"&&this.flux.actions.layers.deleteSelected()}.bind(this),f=this.transfer(m.addShortcut,l.eventKeyCode.BACKSPACE,{},a),c=this.transfer(m.addShortcut,l.eventKeyCode.DELETE,{},a);return n.join(f,c)},Z={command:M,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},et={command:_,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},tt={command:P,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},nt={command:D,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},rt={command:H,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},it={command:B,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},st={command:j,reads:[y.PS_DOC,y.JS_DOC,y.JS_APP],writes:[y.PS_DOC,y.JS_DOC]},ot={command:F,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},ut={command:q,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},at={command:R,reads:[],writes:[y.PS_DOC,y.JS_DOC]},ft={command:z,reads:[y.PS_DOC,y.JS_DOC,y.JS_APP],writes:[y.PS_DOC,y.JS_DOC]},lt={command:W,reads:[y.PS_DOC,y.JS_DOC,y.JS_APP],writes:[y.PS_DOC,y.JS_DOC]},ct={command:V,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},ht={command:$,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},pt={command:C,reads:[y.PS_DOC],writes:[y.JS_DOC]},dt={command:k,reads:[y.PS_DOC],writes:[y.JS_DOC]},vt={command:A,reads:[y.PS_DOC],writes:[y.JS_DOC]},mt={command:O,reads:[y.PS_DOC],writes:[y.JS_DOC]},gt={command:J,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},yt={command:L,reads:[y.PS_DOC],writes:[y.JS_DOC]},bt={command:Y,reads:[y.PS_DOC,y.PS_APP],writes:[y.JS_DOC,y.JS_SHORTCUT,y.JS_POLICY,y.PS_APP]},wt={command:Q,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]},Et={command:G,reads:[y.PS_DOC,y.JS_DOC],writes:[y.PS_DOC,y.JS_DOC]};t.select=Z,t.rename=et,t.selectAll=tt,t.deselectAll=nt,t.deleteSelected=rt,t.groupSelected=it,t.groupSelectedInCurrentDocument=st,t.setVisibility=ot,t.setLocking=ut,t.setOpacity=at,t.lockSelectedInCurrentDocument=ft,t.unlockSelectedInCurrentDocument=lt,t.reorder=ct,t.setBlendMode=ht,t.addLayers=pt,t.resetLayers=dt,t.resetLayersByIndex=vt,t.resetBounds=mt,t.setProportional=gt,t.beforeStartup=bt,t.createArtboard=wt,t.resetLinkedLayers=yt,t.duplicate=Et,t._getLayersByRef=N}),define("js/actions/preferences",["require","exports","module","../events","js/locks"],function(e,t){"use strict";var n=e("../events"),r=e("js/locks"),i=function(e,t){return this.dispatchAsync(n.preferences.SET_PREFERENCE,{key:e,value:t})},s=function(e){return this.dispatchAsync(n.preferences.SET_PREFERENCES,{prefs:e})},o=function(e){return this.dispatchAsync(n.preferences.DELETE_PREFERENCE,{key:e})},u=function(){return this.dispatchAsync(n.preferences.CLEAR_PREFERENCES)},a={command:i,reads:[],writes:[r.JS_PREF]},f={command:s,reads:[],writes:[r.JS_PREF]},l={command:o,reads:[],writes:[r.JS_PREF]},c={command:u,reads:[],writes:[r.JS_PREF]};t.setPreference=a,t.setPreferences=f,t.deletePreference=l,t.clearPreferences=c}),define("js/actions/ui",["require","exports","module","bluebird","adapter/ps/descriptor","adapter/ps/ui","js/events","js/locks","js/util/synchronization"],function(e,t){"use strict";var n=e("bluebird"),r=e("adapter/ps/descriptor"),i=e("adapter/ps/ui"),s=e("js/events"),o=e("js/locks"),u=e("js/util/synchronization"),a=function(){var e=this.flux.store("preferences").getState(),t=e.get("toolbarPinned",!0),n=!t;return this.flux.actions.preferences.setPreference("toolbarPinned",n)},f=function(){return n.join(r.get("transform"),r.getProperty("document","zoom")).bind(this).then(function(e){return[e[0].toWindow,e[1].value]}).catch(function(){return[null,null]}).then(function(e){var t={transformMatrix:e[0],zoom:e[1]};this.dispatch(s.ui.TRANSFORM_UPDATED,t)})},l=function(e){return r.getProperty("document","zoom").get("value").bind(this).catch(function(){return null}).then(function(t){var n={transformObject:e,zoom:t};this.dispatch(s.ui.TRANSFORM_UPDATED,n)})},c=function(e){return this.dispatchAsync(s.ui.PANELS_RESIZED,e).bind(this).then(function(){var e=this.flux.store("ui").getState().centerOffsets;return i.setOverlayOffsets(e)})},h=function(e){return this.dispatchAsync(s.ui.TOOLBAR_PINNED,{toolbarWidth:e}).bind(this).then(function(){var e=this.flux.store("ui").getState().centerOffsets;return i.setOverlayOffsets(e)})},p=function(e,t,n,r){return{x:n*e.xCenter/r+(t.right-t.left)/2,y:n*e.yCenter/r+(t.bottom-t.top)/2,z:n}},d=function(e,t){var i=window.devicePixelRatio,o=this.flux.store("ui").getState(),u=o.centerOffsets,a=1,f=this.dispatchAsync(s.ui.TOGGLE_OVERLAYS,{enabled:!1});if(t){var l=50,c=u.top+u.bottom,h=u.left+u.right,d=window.document.body.clientWidth-h-l*2,v=window.document.body.clientHeight-c-l*2,m=e.width/d,g=e.height/v;a=i/Math.max(m,g)}else a=o.zoomFactor;var y=p(e,u,a,i),b=n.delay(50).bind(this).then(function(){return r.play("setPanZoom",y)}).then(function(){return this.transfer(E)});return n.join(f,b)},v=function(e){var t=this.flux.store("application").getCurrentDocument(),r;if(!t)return n.resolve();switch(e.on){case"selection":r=t.layers.selectedAreaBounds;if(!r||r.empty)r=t.bounds;break;case"document":r=t.bounds;break;default:throw new Error("Unexpected 'on' value")}return this.transfer(x,r,e.zoomInto)},m=function(e){var t=this.flux.store("ui").getState().zoomFactor,n=e.zoomIn?t*2:t/2;return this.transfer(L,{zoom:n})},g=function(e){var t=this.flux.store("ui").getState(),i=this.flux.store("application").getCurrentDocument(),o=e.zoom,u=e.hasOwnProperty("pan")?e.pan:!0,a=i.layers.selectedAreaBounds,f={animate:!0,resize:!0,z:o};this.dispatch(s.ui.TOGGLE_OVERLAYS,{enabled:!1}),a&&a.width===0&&(u=!1);if(u&&a){var l=window.devicePixelRatio,c=t.centerOffsets,h=p(a,c,o,l);f.x=h.x,f.y=h.y}return n.delay(50).bind(this).then(function(){return r.play("setPanZoom",f)}).then(function(){return this.transfer(E)})},y=function(){var e=200,t=u.debounce(function(e){if(e.transform)return this.flux.actions.ui.setTransform(e.transform.value)},this,e,!1),o=u.debounce(function(){return this.flux.actions.tools.resetSuperselect()},this,e,!1);window.addEventListener("resize",function(e){o(e)}),r.addListener("scroll",function(e){this.dispatch(s.ui.TOGGLE_OVERLAYS,{enabled:!1}),t(e)}.bind(this));var a=i.setOverscrollMode(i.overscrollMode.ALWAYS_OVERSCROLL),f=i.setClassicChromeVisibility(!1),l=i.setSuppressTargetPaths(!0),c=this.transfer(E);return n.join(a,f,l,c)},b=function(){var e=this.flux.store("application").getCurrentDocument();return e?this.transfer(x,e.bounds,!1):n.resolve()},w=function(){return this.transfer(E)},E={command:f,reads:[o.PS_APP],writes:[o.JS_UI]},S={command:l,reads:[],writes:[o.JS_UI],modal:!0},x={command:d,reads:[o.PS_APP,o.JS_DOC],writes:[o.JS_UI]},T={command:v,reads:[o.PS_APP,o.JS_DOC],writes:[o.JS_UI]},N={command:c,reads:[o.JS_APP],writes:[o.JS_UI]},C={command:h,reads:[o.JS_APP],writes:[o.JS_UI]},k={command:m,reads:[o.JS_APP],writes:[o.JS_UI,o.PS_APP]},L={command:g,reads:[o.JS_APP],writes:[o.JS_UI,o.PS_APP]},A={command:y,reads:[],writes:[o.JS_UI,o.PS_APP]},O={command:b,reads:[o.PS_APP,o.JS_DOC],writes:[o.JS_UI]},M={command:w,reads:[o.PS_APP],writes:[o.JS_UI]},_={command:a,reads:[],writes:[]};t.togglePinnedToolbar=_,t.updateTransform=E,t.setTransform=S,t.updatePanelSizes=N,t.updateToolbarWidth=C,t.centerBounds=x,t.centerOn=T,t.beforeStartup=A,t.afterStartup=O,t.zoomInOut=k,t.zoom=L,t.onReset=M,t._priority=99}),define("text!static/menu-mac.json",[],function(){return'{\n    "id": "mac",\n    "menu": [\n        {\n            "id": "APPLICATION",\n            "submenu": [\n                {\n                    "id": "ABOUT_MAC"\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "HIDE_APPLICATION",\n                    "commandKind": "HIDE_APPLICATION",\n                    "shortcut": {\n                        "keyChar": "h",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "HIDE_OTHER_APPLICATIONS",\n                    "commandKind": "HIDE_OTHER_APPLICATIONS",\n                    "shortcut": {\n                        "keyChar": "h",\n                        "modifiers": {\n                            "command": true,\n                            "option": true\n                        }\n                    }\n                },\n                {\n                    "id": "SHOW_ALL",\n                    "commandKind": "HIDE_SHOW_ALL_APPLICATIONS"\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "QUIT_APPLICATION_MAC",\n                    "shortcut": {\n                        "keyChar": "q",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                }\n            ]\n        },\n        {\n            "id": "FILE",\n            "submenu": [\n                {\n                    "id": "NEW",\n                    "shortcut": {\n                        "keyChar": "n",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "NEW_EXTENDED",\n                    "shortcut": {\n                        "keyChar": "n",\n                        "modifiers": {\n                            "command": true,\n                            "option": true\n                        }\n                    }\n                },\n                {\n                    "id": "NEW_FROM_TEMPLATE",\n                    "submenu": []\n                },\n                {\n                    "id": "OPEN",\n                    "shortcut": {\n                        "keyChar": "o",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "OPEN_RECENT",\n                    "submenu": []\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "CLOSE",\n                    "shortcut": {\n                        "keyChar": "w",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "SAVE",\n                    "shortcut": {\n                        "keyChar": "s",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "SAVE_AS",\n                    "shortcut": {\n                        "keyChar": "s",\n                        "modifiers": {\n                            "command": true,\n                            "shift": true\n                        }\n                    }\n                },\n                {\n                    "id": "REVERT",\n                    "shortcut": {\n                        "keyCode": "KEY_F12"\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "PLACE_LINKED",\n                    "shortcut": {\n                        "keyChar": "p",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "PLACE_EMBEDDED",\n                    "shortcut": {\n                        "keyChar": "p",\n                        "modifiers": {\n                            "command": true,\n                            "shift": true\n                        }\n                    }\n                },\n                {\n                    "id": "PACKAGE"\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "PRINT",\n                    "shortcut": {\n                        "keyChar": "p",\n                        "modifiers": {\n                            "command": true,\n                            "option": true,\n                            "shift": true\n                        }\n                    }\n                }\n            ]\n        },\n        {\n            "id": "EDIT",\n            "submenu": [\n                {\n                    "id": "UNDO",\n                    "commandKind": "UNDO",\n                    "shortcut": {\n                        "keyChar": "z",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "REDO",\n                    "commandKind": "REDO",\n                    "shortcut": {\n                        "keyChar": "z",\n                        "modifiers": {\n                            "command": true,\n                            "shift": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "CUT",\n                    "commandKind": "CUT",\n                    "shortcut": {\n                        "keyChar": "x",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "COPY",\n                    "commandKind": "COPY",\n                    "shortcut": {\n                        "keyChar": "c",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "PASTE",\n                    "commandKind": "PASTE",\n                    "shortcut": {\n                        "keyChar": "v",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "DELETE"\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "SELECT_ALL",\n                    "commandKind": "SELECT_ALL",\n                    "shortcut": {\n                        "keyChar": "a",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "DESELECT",\n                    "shortcut": {\n                        "keyChar": "a",\n                        "modifiers": {\n                            "command": true,\n                            "shift": true\n                        }\n                    }\n                }\n            ]\n        },\n        {\n            "id": "LAYER",\n            "submenu": [\n                {\n                    "id": "COMBINE",\n                    "submenu": [\n                        {\n                            "id": "COMBINE_UNION"\n                        },\n                        {\n                            "id": "COMBINE_SUBTRACT"\n                        },\n                        {\n                            "id": "COMBINE_INTERSECT"\n                        },\n                        {\n                            "id": "COMBINE_DIFFERENCE"\n                        }\n                    ]\n                },\n                {\n                    "id": "TRANSFORM",\n                    "submenu": [\n                        {\n                            "id": "TRANSFORM_ROTATE_180"\n                        },\n                        {\n                            "id": "TRANSFORM_ROTATE_LEFT"\n                        },\n                        {\n                            "id": "TRANSFORM_ROTATE_RIGHT"\n                        }\n                    ]\n                },\n                {\n                    "separator": true\n                },    \n                {\n                    "id": "CREATE_ARTBOARD"\n                }\n            ]\n        },\n        {\n            "id": "ARRANGE",\n            "submenu": [\n                {\n                    "id": "DISTRIBUTE",\n                    "submenu": [\n                        {\n                            "id": "DISTRIBUTE_HORIZONTAL"\n                        },\n                        {\n                            "id": "DISTRIBUTE_VERTICAL"\n                        }\n                    ]\n                },\n                {\n                    "id": "ALIGN",\n                    "submenu": [\n                        {\n                            "id": "ALIGN_LEFT"\n                        },\n                        {\n                            "id": "ALIGN_CENTER"\n                        },\n                        {\n                            "id": "ALIGN_RIGHT"\n                        },\n                        {\n                            "separator": true\n                        },\n                        {\n                            "id": "ALIGN_TOP"\n                        },\n                        {\n                            "id": "ALIGN_MIDDLE"\n                        },\n                        {\n                            "id": "ALIGN_BOTTOM"\n                        }\n                    ]\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "FLIP_HORIZONTAL",\n                    "shortcut": {\n                        "keyChar": "/",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n\n                },\n                {\n                    "id": "FLIP_VERTICAL",\n                    "shortcut": {\n                        "keyChar": "/",\n                        "modifiers": {\n                            "command": true,\n                            "option": true\n                        }\n                    }\n\n                },\n                {\n                    "id": "SWAP_POSITION",\n                    "shortcut": {\n                        "keyChar": "/",\n                        "modifiers": {\n                            "command": true,\n                            "option": true,\n                            "shift": true\n                        }\n                    }\n\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "LOCK_LAYER",\n                    "shortcut": {\n                        "keyChar": "l",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "UNLOCK_LAYER",\n                    "shortcut": {\n                        "keyChar": "l",\n                        "modifiers": {\n                            "command": true,\n                            "option": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "GROUP_LAYERS",\n                    "shortcut": {\n                        "keyChar": "g",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "UNGROUP_LAYERS",\n                    "shortcut": {\n                        "keyChar": "g",\n                        "modifiers": {\n                            "command": true,\n                            "option": true\n\n                        }\n                    }\n                }\n            ]\n        },\n        {\n            "id": "VIEW",\n            "submenu": [\n                {\n                    "id": "ZOOM_IN",\n                    "shortcut": {\n                        "keyChar": "=",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "ZOOM_OUT",\n                    "shortcut": {\n                        "keyChar": "-",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "FIT_TO_WINDOW",\n                    "shortcut": {\n                        "keyChar": "0",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "ACTUAL_SIZE",\n                    "shortcut": {\n                        "keyChar": "1",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "ZOOM_TO_SELECTION",\n                    "shortcut": {\n                        "keyChar": "2",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "CENTER_SELECTION",\n                    "shortcut": {\n                        "keyChar": "3",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "TOGGLE_GUIDES"\n                },\n                {\n                    "id": "TOGGLE_SMART_GUIDES",\n                    "shortcut": {\n                        "keyChar": "g",\n                        "modifiers": {\n                            "command": true,\n                            "option": true,\n                            "shift": true\n                        }\n                    }\n                }\n            ]\n        },\n        {\n            "id": "WINDOW",\n            "submenu": [\n                {\n                    "id": "RETURN_TO_STANDARD",\n                    "shortcut": {\n                        "keyChar": "`",\n                        "modifiers": {\n                            "command": true,\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "TOGGLE_TOOLBAR"  \n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "NEXT_DOCUMENT",\n                    "shortcut": {\n                        "keyChar": "`",\n                        "modifiers": {\n                            "command": true\n                        }\n                    }\n                },\n                {\n                    "id": "PREVIOUS_DOCUMENT"\n                },\n                {\n                    "separator": true\n                }\n            ]\n        },\n        {\n            "id": "HELP",\n            "submenu": [\n                {\n                    "id": "HELPX"\n                },\n                {\n                    "id": "FORUM"\n                },\n                {\n                    "id": "TWITTER"\n                },\n\n                {\n                    "separator": true\n                },\n                {\n                    "id": "SHORTCUTS"\n                },\n                {\n                    "id": "OPEN_FIRST_LAUNCH"\n                },\n                {\n                    "separator": true,\n                    "debug": true\n                },\n                {\n                    "id": "RUN_TESTS",\n                    "shortcut": {\n                        "keyChar": "?",\n                        "modifiers": {\n                            "shift": true,\n                            "command": true,\n                            "control": true,\n                            "option": true\n                        }\n                    },\n                    "debug": true\n                },\n                {\n                    "id": "ACTION_FAILURE",\n                    "debug": true\n                },\n                {\n                    "id": "RESET_FAILURE",\n                    "debug": true\n                },\n                {\n                    "id": "UPDATE_CURRENT_DOCUMENT",\n                    "shortcut": {\n                        "keyChar": ";",\n                        "modifiers": {\n                            "command": true,\n                            "control": true,\n                            "option": true\n                        }\n                    },\n                    "debug": true\n                },\n                {\n                    "id": "RESET_RECESS",\n                    "shortcut": {\n                        "keyCode": "ESCAPE",\n                        "modifiers": {\n                            "shift": true,\n                            "command": true,\n                            "control": true,\n                            "option": true\n                        }\n                    },\n                    "debug": true\n                }\n            ]\n        }\n    ]\n}\n'}),define("text!static/menu-win.json",[],function(){return'{\n    "id": "win",\n    "menu": [\n        {\n            "id": "FILE",\n            "submenu": [\n                {\n                    "id": "NEW",\n                    "shortcut": {\n                        "keyChar": "n",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "NEW_EXTENDED",\n                    "shortcut": {\n                        "keyChar": "n",\n                        "modifiers": {\n                            "control": true,\n                            "alt": true\n                        }\n                    }\n                },\n                {\n                    "id": "NEW_FROM_TEMPLATE",\n                    "submenu": []\n                },\n                {\n                    "id": "OPEN",\n                    "shortcut": {\n                        "keyChar": "o",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "OPEN_RECENT",\n                    "submenu": []\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "CLOSE",\n                    "shortcut": {\n                        "keyChar": "w",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "SAVE",\n                    "shortcut": {\n                        "keyChar": "s",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "SAVE_AS",\n                    "shortcut": {\n                        "keyChar": "s",\n                        "modifiers": {\n                            "control": true,\n                            "shift": true\n                        }\n                    }\n                },\n                {\n                    "id": "REVERT",\n                    "shortcut": {\n                        "keyCode": "KEY_F12"\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "PLACE_LINKED",\n                    "shortcut": {\n                        "keyChar": "p",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "PLACE_EMBEDDED",\n                    "shortcut": {\n                        "keyChar": "p",\n                        "modifiers": {\n                            "control": true,\n                            "shift": true\n                        }\n                    }\n                },\n                {\n                    "id": "PACKAGE"\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "PRINT",\n                    "shortcut": {\n                        "keyChar": "p",\n                        "modifiers": {\n                            "control": true,\n                            "alt": true,\n                            "shift": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "QUIT_APPLICATION_WIN",\n                    "shortcut": {\n                        "keyChar": "q",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                }\n            ]\n        },\n        {\n            "id": "EDIT",\n            "submenu": [\n                {\n                    "id": "UNDO",\n                    "commandKind": "UNDO",\n                    "shortcut": {\n                        "keyChar": "z",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "REDO",\n                    "commandKind": "REDO",\n                    "shortcut": {\n                        "keyChar": "z",\n                        "modifiers": {\n                            "control": true,\n                            "shift": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "CUT",\n                    "commandKind": "CUT",\n                    "shortcut": {\n                        "keyChar": "x",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "COPY",\n                    "commandKind": "COPY",\n                    "shortcut": {\n                        "keyChar": "c",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "PASTE",\n                    "commandKind": "PASTE",\n                    "shortcut": {\n                        "keyChar": "v",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "DELETE"\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "SELECT_ALL",\n                    "commandKind": "SELECT_ALL",\n                    "shortcut": {\n                        "keyChar": "a",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "DESELECT",\n                    "shortcut": {\n                        "keyChar": "a",\n                        "modifiers": {\n                            "control": true,\n                            "shift": true\n                        }\n                    }\n                }\n            ]\n        },\n        {\n            "id": "LAYER",\n            "submenu": [\n                {\n                    "id": "COMBINE",\n                    "submenu": [\n                        {\n                            "id": "COMBINE_UNION"\n                        },\n                        {\n                            "id": "COMBINE_SUBTRACT"\n                        },\n                        {\n                            "id": "COMBINE_INTERSECT"\n                        },\n                        {\n                            "id": "COMBINE_DIFFERENCE"\n                        }\n                    ]\n                },\n                {\n                    "id": "TRANSFORM",\n                    "submenu": [\n                        {\n                            "id": "TRANSFORM_ROTATE_180"\n                        },\n                        {\n                            "id": "TRANSFORM_ROTATE_LEFT"\n                        },\n                        {\n                            "id": "TRANSFORM_ROTATE_RIGHT"\n                        }\n                    ]\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "CREATE_ARTBOARD"\n                }\n            ]\n        },\n        {\n            "id": "ARRANGE",\n            "submenu": [\n                {\n                    "id": "DISTRIBUTE",\n                    "submenu": [\n                        {\n                            "id": "DISTRIBUTE_HORIZONTAL"\n                        },\n                        {\n                            "id": "DISTRIBUTE_VERTICAL"\n                        }\n                    ]\n                },\n                {\n                    "id": "ALIGN",\n                    "submenu": [\n                        {\n                            "id": "ALIGN_LEFT"\n                        },\n                        {\n                            "id": "ALIGN_CENTER"\n                        },\n                        {\n                            "id": "ALIGN_RIGHT"\n                        },\n                        {\n                            "separator": true\n                        },\n                        {\n                            "id": "ALIGN_TOP"\n                        },\n                        {\n                            "id": "ALIGN_MIDDLE"\n                        },\n                        {\n                            "id": "ALIGN_BOTTOM"\n                        }\n                    ]\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "FLIP_HORIZONTAL",\n                    "shortcut": {\n                        "keyChar": "/",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }                    \n\n                },\n                {\n                    "id": "FLIP_VERTICAL",\n                    "shortcut": {\n                        "keyChar": "/",\n                        "modifiers": {\n                            "control": true,\n                            "alt": true\n                        }\n                    }                    \n\n                },\n                {\n                    "id": "SWAP_POSITION",\n                    "shortcut": {\n                        "keyChar": "/",\n                        "modifiers": {\n                            "control": true,\n                            "alt": true,\n                            "shift": true\n                        }\n                    }                    \n\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "LOCK_LAYER",\n                    "shortcut": {\n                        "keyChar": "l",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "UNLOCK_LAYER",\n                    "shortcut": {\n                        "keyChar": "l",\n                        "modifiers": {\n                            "control": true,\n                            "alt": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "GROUP_LAYERS",\n                    "shortcut": {\n                        "keyChar": "g",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "UNGROUP_LAYERS",\n                    "shortcut": {\n                        "keyChar": "g",\n                        "modifiers": {\n                            "control": true,\n                            "alt": true\n\n                        }\n                    }\n                }\n            ]\n        },\n        {\n            "id": "VIEW",\n            "submenu": [\n                {\n                    "id": "ZOOM_IN",\n                    "shortcut": {\n                        "keyChar": "=",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "ZOOM_OUT",\n                    "shortcut": {\n                        "keyChar": "-",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "FIT_TO_WINDOW",\n                    "shortcut": {\n                        "keyChar": "0",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "ACTUAL_SIZE",\n                    "shortcut": {\n                        "keyChar": "1",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "ZOOM_TO_SELECTION",\n                    "shortcut": {\n                        "keyChar": "2",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "CENTER_SELECTION",\n                    "shortcut": {\n                        "keyChar": "3",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "TOGGLE_GUIDES"\n                },\n                {\n                    "id": "TOGGLE_SMART_GUIDES",\n                    "shortcut": {\n                        "keyChar": "g",\n                        "modifiers": {\n                            "control": true,\n                            "alt": true,\n                            "shift": true\n                        }\n                    }\n                }\n            ]\n        },\n        {\n            "id": "WINDOW",\n            "submenu": [\n                {\n                    "id": "RETURN_TO_STANDARD",\n                    "shortcut": {\n                        "keyChar": "`",\n                        "modifiers": {\n                            "alt": true,\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "TOGGLE_TOOLBAR"  \n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "MINIMIZE",\n                    "shortcut": {\n                        "keyChar": "m",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "NEXT_DOCUMENT",\n                    "shortcut": {\n                        "keyChar": "`",\n                        "modifiers": {\n                            "control": true\n                        }\n                    }\n                },\n                {\n                    "id": "PREVIOUS_DOCUMENT"\n                },\n                {\n                    "separator": true\n                }\n            ]\n        },\n        {\n            "id": "HELP",\n            "submenu": [\n                {\n                    "id": "ABOUT_WIN"\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "HELPX"\n                },\n                {\n                    "id": "FORUM"\n                },\n                {\n                    "id": "TWITTER"\n                },\n                {\n                    "separator": true\n                },\n                {\n                    "id": "SHORTCUTS"\n                },\n                {\n                    "id": "OPEN_FIRST_LAUNCH"\n                },\n                {\n                    "separator": true,\n                    "debug": true\n                },\n                {\n                    "id": "RUN_TESTS",\n                    "shortcut": {\n                        "keyChar": "?",\n                        "modifiers": {\n                            "shift": true,\n                            "control": true,\n                            "alt": true\n                        }\n                    },\n                    "debug": true\n                },\n                {\n                    "id": "ACTION_FAILURE",\n                    "debug": true\n                },\n                {\n                    "id": "RESET_FAILURE",\n                    "debug": true\n                },\n                {\n                    "id": "UPDATE_CURRENT_DOCUMENT",\n                    "shortcut": {\n                        "keyChar": ";",\n                        "modifiers": {\n                            "shift": true,\n                            "control": true,\n                            "alt": true\n                        }\n                    },\n                    "debug": true\n                },\n                {\n                    "id": "RESET_RECESS",\n                    "shortcut": {\n                        "keyChar": "\'",\n                        "modifiers": {\n                            "shift": true,\n                            "control": true,\n                            "alt": true\n                        }\n                    },\n                    "debug": true\n                }\n            ]\n        }\n    ]\n}\n'}),define("text!static/menu-actions.json",[],function(){return'{\n    "APPLICATION": {\n        "$enable-rule": "always",\n        "ABOUT_MAC": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 1\n            },\n            "$enable-rule": "always-except-modal"\n        },\n        "HIDE_APPLICATION": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 7001\n            },\n            "$enable-rule": "always"\n        },\n        "HIDE_OTHER_APPLICATIONS": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 7002\n            },\n            "$enable-rule": "always"\n        },\n        "SHOW_ALL": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 7003\n            },\n            "$enable-rule": "always"\n        },\n        "QUIT_APPLICATION_MAC": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 36\n            },\n            "$enable-rule": "always"\n        }\n    },\n    "FILE": {\n        "$enable-rule": "always",\n        "NEW": {\n            "$action": "documents.createNew",\n            "$enable-rule": "always-except-modal"\n        },\n        "NEW_EXTENDED": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 10\n            },\n            "$enable-rule": "always-except-modal"\n        },\n        "NEW_FROM_TEMPLATE": {\n            "$enable-rule": "always-except-modal"\n        },\n        "OPEN": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 20\n            },\n            "$enable-rule": "always-except-modal"\n        },\n        "CLOSE": {\n            "$action": "documents.close",\n            "$enable-rule": "have-document"\n        },\n        "SAVE": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 30\n            },\n            "$enable-rule": "dirty-document"\n        },\n        "SAVE_AS": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 32\n            },\n            "$enable-rule": "have-document"\n        },\n        "REVERT": {\n            "$action": "documents.revertCurrentDocument",\n            "$payload": {\n                "commandID": 34\n            },\n            "$enable-rule": "dirty-document"\n        },\n        "OPEN_RECENT": {\n            "$enable-rule": "always-except-modal"\n        },\n        "PLACE_LINKED": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 3090\n            },\n            "$enable-rule": "supported-document"\n        },\n        "PLACE_EMBEDDED": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 1032\n            },\n            "$enable-rule": "supported-document"\n        },\n        "PACKAGE": {\n            "$action": "documents.packageDocument",\n            "$enable-rule": "psd-document,have-linked"\n        },\n        "PRINT": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 2101\n            },\n            "$enable-rule": "have-document"\n        },\n        "QUIT_APPLICATION_WIN": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 36\n            },\n            "$enable-rule": "always"\n        }\n    },\n    "EDIT": {\n        "$enable-rule": "always",\n        "CUT": {\n            "$action": "edit.cut",\n            "$payload": {\n                "preserveFocus": true\n            },\n            "$enable-rule": "always-except-modal"\n        },\n        "COPY": {\n            "$action": "edit.copy",\n            "$payload": {\n                "preserveFocus": true\n            },\n            "$enable-rule": "always-except-modal"\n        },\n        "PASTE": {\n            "$action": "edit.paste",\n            "$payload": {\n                "preserveFocus": true\n            },\n            "$enable-rule": "always-except-modal"\n        },\n        "UNDO": {\n            "$action": "edit.undo",\n            "$enable-rule": "have-document,earlier-history"\n        },\n        "REDO": {\n            "$action": "edit.redo",\n            "$enable-rule": "have-document,later-history"\n        },\n        "SELECT_ALL": {\n            "$action": "edit.selectAll",\n            "$payload": {\n                "preserveFocus": true\n            },\n            "$enable-rule": "have-document"\n        },\n        "DESELECT": {\n            "$action": "layers.deselectAll",\n            "$enable-rule": "layer-selected"\n        },\n        "DELETE": {\n            "$action": "layers.deleteSelected",\n            "$enable-rule": "layer-selected"\n        }\n    },\n    "LAYER": {\n        "$enable-rule": "always",\n        "TRANSFORM": {\n            "$enable-rule": "layer-selected",\n            "TRANSFORM_ROTATE_180": {\n                "$action": "transform.rotateLayersInCurrentDocument",\n                "$payload": {\n                    "angle": 180\n                },\n                "$enable-rule": "layer-selected"\n            },\n            "TRANSFORM_ROTATE_LEFT": {\n                "$action": "transform.rotateLayersInCurrentDocument",\n                "$payload": {\n                    "angle": -90\n                },\n                "$enable-rule": "layer-selected"\n            },\n            "TRANSFORM_ROTATE_RIGHT": {\n                "$action": "transform.rotateLayersInCurrentDocument",\n                "$payload": {\n                    "angle": 90\n                },\n                "$enable-rule": "layer-selected"\n            }\n        },\n        "COMBINE": {\n            "$enable-rule": "layers-selected-all-shapes",\n            "COMBINE_UNION": {\n                "$action": "shapes.combineUnionSelectedInCurrentDocument",\n                "$enable-rule": "layers-selected-all-shapes"\n            },\n            "COMBINE_SUBTRACT": {\n                "$action": "shapes.combineSubtractSelectedInCurrentDocument",\n                "$enable-rule": "layers-selected-all-shapes"\n            },\n            "COMBINE_INTERSECT": {\n                "$action": "shapes.combineIntersectSelectedInCurrentDocument",\n                "$enable-rule": "layers-selected-all-shapes"\n            },\n            "COMBINE_DIFFERENCE": {\n                "$action": "shapes.combineDifferenceSelectedInCurrentDocument",\n                "$enable-rule": "layers-selected-all-shapes"\n            }\n        },\n        "CREATE_ARTBOARD": {\n            "$action": "layers.createArtboard",\n            "$enable-rule": "supported-document"\n        }\n    },\n    "ARRANGE": {\n        "$enable-rule": "always",\n        "LOCK_LAYER": {\n            "$action": "layers.lockSelectedInCurrentDocument",\n            "$enable-rule": "layer-selected"\n        },\n        "UNLOCK_LAYER": {\n            "$action": "layers.unlockSelectedInCurrentDocument",\n            "$enable-rule": "layer-selected"\n        },\n        "FLIP_HORIZONTAL": {\n            "$action": "transform.flipXCurrentDocument",\n            "$enable-rule": "layer-selected"\n        },\n        "FLIP_VERTICAL": {\n            "$action": "transform.flipYCurrentDocument",\n            "$enable-rule": "layer-selected"\n        },\n        "SWAP_POSITION": {\n            "$action": "transform.swapLayersCurrentDocument",\n            "$enable-rule": "layers-selected-2,no-background,no-nesting"\n        },\n        "GROUP_LAYERS": {\n            "$action": "layers.groupSelectedInCurrentDocument",\n            "$enable-rule": "layer-selected,no-background"\n        },\n        "DISTRIBUTE": {\n            "$enable-rule": "layers-selected-3+,no-background,no-nesting",\n            "DISTRIBUTE_HORIZONTAL": {\n                "$action": "transform.distributeX",\n                "$enable-rule": "layers-selected-3+,no-background,no-nesting"\n            },\n            "DISTRIBUTE_VERTICAL": {\n                "$action": "transform.distributeY",\n                "$enable-rule": "layers-selected-3+,no-background,no-nesting"\n            }\n        },\n        "ALIGN": {\n            "$enable-rule": "layers-selected-2+,no-background,no-nesting",\n            "ALIGN_LEFT": {\n                "$action": "transform.alignLeft",\n                "$enable-rule": "layers-selected-2+,no-background,no-nesting"\n            },\n            "ALIGN_CENTER": {\n                "$action": "transform.alignHCenter",\n                "$enable-rule": "layers-selected-2+,no-background,no-nesting"\n            },\n            "ALIGN_RIGHT": {\n                "$action": "transform.alignRight",\n                "$enable-rule": "layers-selected-2+,no-background,no-nesting"\n            },\n            "ALIGN_TOP": {\n                "$action": "transform.alignTop",\n                "$enable-rule": "layers-selected-2+,no-background,no-nesting"\n            },\n            "ALIGN_MIDDLE": {\n                "$action": "transform.alignVCenter",\n                "$enable-rule": "layers-selected-2+,no-background,no-nesting"\n            },\n            "ALIGN_BOTTOM": {\n                "$action": "transform.alignBottom",\n                "$enable-rule": "layers-selected-2+,no-background,no-nesting"\n            }\n        }\n    },\n    "VIEW": {\n        "$enable-rule": "always",\n        "ZOOM_IN": {\n            "$action": "ui.zoomInOut",\n            "$payload": {\n                "zoomIn": true,\n                "preserveFocus": true\n            },\n            "$enable-rule": "have-document"\n        },\n        "ZOOM_OUT": {\n            "$action": "ui.zoomInOut",\n            "$payload": {\n                "zoomIn": false,\n                "preserveFocus": true\n            },\n            "$enable-rule": "have-document"\n        },\n        "FIT_TO_WINDOW": {\n            "$action": "ui.centerOn",\n            "$payload": {\n                "on": "document",\n                "zoomInto": true,\n                "preserveFocus": true\n            },\n            "$enable-rule": "have-document"\n        },\n        "ACTUAL_SIZE": {\n            "$action": "ui.zoom",\n            "$payload": {\n                "zoom": 1,\n                "pan": true,\n                "preserveFocus": true\n            },\n            "$enable-rule": "have-document"\n        },\n        "ZOOM_TO_SELECTION": {\n            "$action": "ui.centerOn",\n            "$payload": {\n                "on": "selection",\n                "zoomInto": true,\n                "preserveFocus": true\n            },\n            "$enable-rule": "layer-selected"\n        },\n        "CENTER_SELECTION": {\n            "$action": "ui.centerOn",\n            "$payload": {\n                "on": "selection",\n                "zoomInto": false,\n                "preserveFocus": true\n            },\n            "$enable-rule": "layer-selected"\n        },\n        "TOGGLE_GUIDES": {\n            "$action": "documents.toggleGuidesVisibility",\n            "$enable-rule": "supported-document"\n        },\n        "TOGGLE_SMART_GUIDES": {\n            "$action": "documents.toggleSmartGuidesVisibility",\n            "$enable-rule": "supported-document"\n        }\n    },\n    "WINDOW": {\n        "$enable-rule": "always",\n        "NEXT_DOCUMENT": {\n            "$action": "documents.selectNextDocument",\n            "$enable-rule": "multiple-documents"\n        },\n        "PREVIOUS_DOCUMENT": {\n            "$action": "documents.selectPreviousDocument",\n            "$enable-rule": "multiple-documents"\n        },\n        "TOGGLE_TOOLBAR": {\n            "$action": "ui.togglePinnedToolbar",\n            "$enable-rule": "always-except-modal"\n        },\n        "RETURN_TO_STANDARD": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 5999\n            },\n            "$enable-rule": "always"\n        }\n    },\n    "HELP": {\n        "$enable-rule": "always",\n        "ABOUT_WIN": {\n            "$action": "menu.native",\n            "$payload": {\n                "commandID": 1\n            },\n            "$enable-rule": "always-except-modal"\n        },\n        "RUN_TESTS": {\n            "$action": "menu.runTests",\n            "$enable-rule": "always-except-modal"\n        },\n        "ACTION_FAILURE": {\n            "$action": "menu.actionFailure",\n            "$enable-rule": "always-except-modal"\n        },\n        "RESET_FAILURE": {\n            "$action": "menu.resetFailure",\n            "$enable-rule": "always-except-modal"\n        },\n        "UPDATE_CURRENT_DOCUMENT": {\n            "$action": "documents.updateCurrentDocument",\n            "$enable-rule": "have-document"\n        },\n        "RESET_RECESS": {\n            "$action": "menu.resetRecess",\n            "$enable-rule": "always-except-modal"\n        },\n        "OPEN_FIRST_LAUNCH": {\n            "$action": "help.openFirstLaunch",\n            "$enable-rule": "always-except-modal"\n        },\n        "SHORTCUTS": {\n            "$action": "help.openKeyboardShortcuts",\n            "$enable-rule": "always-except-modal"\n        },\n        "TWITTER": {\n            "$action": "menu.openURL",\n            "$payload": {\n                "url": "https://www.adobe.com/go/designspace-twitter"\n            },\n            "$enable-rule": "always-except-modal"\n        },\n        "HELPX": {\n            "$action": "menu.openURL",\n            "$payload": {\n                "url": "https://www.adobe.com/go/designspace-help.html"\n            },\n            "$enable-rule": "always-except-modal"\n        },\n        "FORUM": {\n            "$action": "menu.openURL",\n            "$payload": {\n                "url": "https://www.adobe.com/go/designspace-forum"\n            },\n            "$enable-rule": "always-except-modal"\n        }\n    }\n}\n'}),define("js/actions/menu",["require","exports","module","bluebird","adapter","adapter/ps","adapter/ps/ui","js/events","js/locks","js/util/system","js/util/log","js/util/global","js/util/headlights","text!static/menu-mac.json","text!static/menu-win.json","text!static/menu-actions.json","text!static/templates.json"],function(e,t){"use strict";var n=e("bluebird"),r=e("adapter"),i=e("adapter/ps"),s=e("adapter/ps/ui"),o=e("js/events"),u=e("js/locks"),a=e("js/util/system"),f=e("js/util/log"),l=e("js/util/global"),c=e("js/util/headlights"),h=e("text!static/menu-mac.json"),p=e("text!static/menu-win.json"),d=e("text!static/menu-actions.json"),v=e("text!static/templates.json"),m=a.isMac?h:p,g=JSON.parse(m),y=JSON.parse(d),b=JSON.parse(v),w=function(e){if(!e.hasOwnProperty("commandID")){var t=new Error("Missing native menu command ID");return n.reject(t)}return e.commandId=e.commandID,i.performMenuCommand(e).then(function(t){if(l.debug&&!t)throw new Error("Menu command not available: "+e.commandID)})},E=function(e){if(!e.hasOwnProperty("url")){var t=new Error("Missing URL");return n.reject(t)}return r.openURLInDefaultBrowser(e.url)},S=function(){if(l.debug){var e=window.location.href,t=e.substring(0,e.lastIndexOf("src/index.html")),r=t+"test/index.html";window.setTimeout(function(){window.location.href=r},0)}return n.resolve()},x=function(){return n.reject()},T=!1,N=function(){return T=!0,n.reject()},C=function(e){var t=e.split("."),n=t[0],r=t[1],i=r+"Throttled",s=this.flux.actions[n][i];return s},k=function(){return window.location.reload(),n.resolve()},L=function(){this.flux.store("menu").on("change",function(){var e=this.flux.store("menu"),t=e.getApplicationMenu();if(t!==null){var n=t.getMenuDescriptor();s.installMenu(n)}}),this.dispatch(o.menus.INIT_MENUS,{menus:g,templates:b,actions:y});var t=new n(function(t){e(["js/main"],function(e){t(e.controller)})});return t.bind(this).then(function(e){s.on("menu",function(t){if(!e.active)return;var n=t.command,r=this.flux.store("menu"),i=r.getApplicationMenu().getMenuAction(n);if(!i){f.error("Unknown menu command:",n);return}var s=C.call(this,i.$action),o=i.$payload,u=i.$dontLog||!1,a=n.split("."),l=a.shift(),h=a.pop();(!o||!o.preserveFocus)&&window.document.activeElement.blur(),u||c.logEvent("menu",l,h),s(o)}.bind(this))})},A=function(){return this.dispatch(o.menus.INIT_MENUS,{menus:g,templates:b,actions:y}),T?n.reject():n.resolve()},O={command:w,reads:u.ALL_PS_LOCKS,writes:u.ALL_PS_LOCKS},M={command:w,reads:u.ALL_PS_LOCKS,writes:u.ALL_PS_LOCKS,modal:!0},_={command:E},D={command:S},P={command:x},H={command:N},B={command:k},j={command:L,reads:[u.JS_MENU],writes:[u.PS_MENU]},F={command:A,reads:[u.JS_MENU],writes:[u.PS_MENU]};t.native=O,t.nativeModal=M,t.openURL=_,t.runTests=D,t.actionFailure=P,t.resetFailure=H,t.resetRecess=B,t.beforeStartup=j,t.onReset=F}),define("js/actions/documents",["require","exports","module","bluebird","immutable","lodash","adapter/lib/photoshopEvent","adapter/ps/descriptor","adapter/lib/document","adapter/lib/layer","adapter/ps","./history","./layers","./application","./preferences","./ui","./menu","../events","js/locks","js/util/path","js/util/log","js/util/headlights","text!static/templates.json"],function(e,t){"use strict";var n=e("bluebird"),r=e("immutable"),i=e("lodash"),s=e("adapter/lib/photoshopEvent"),o=e("adapter/ps/descriptor"),u=e("adapter/lib/document"),a=e("adapter/lib/layer"),f=e("adapter/ps"),l=e("./history"),c=e("./layers"),h=e("./application"),p=e("./preferences"),d=e("./ui"),v=e("./menu"),m=e("../events"),g=e("js/locks"),y=e("js/util/path"),b=e("js/util/log"),w=e("js/util/headlights"),E=e("text!static/templates.json"),S=JSON.parse(E),x=["documentID","title","itemIndex","hasBackgroundLayer","numberOfLayers","resolution","width","height","mode","isDirty"],T=["targetLayers","guidesVisibility","smartGuidesVisibility","format"],N=1016,C=20,k="com.adobe.photoshop.spaces.design.preset",L=function(e){var t=function(t){return{reference:e,property:t}},r=x.map(t),s=o.batchGetProperties(r).reduce(function(e,t,n){var r=x[n];return e[r]=t,e},{}),u=o.batchGetOptionalProperties(e,T);return n.join(s,u,function(e,t){return i.merge(e,t)})},A=function(e){var t=e.numberOfLayers,n=e.hasBackgroundLayer?0:1,i=r.Range(t,n-1,-1).map(function(t){return[u.referenceBy.id(e.documentID),a.referenceBy.index(t)]});return c._getLayersByRef(i).then(function(t){return{document:e,layers:t}})},O=function(e){var t,r;if(e&&e.hasOwnProperty("preset"))t=e.preset,r=this.transfer(p.setPreference,k,t);else{var i=this.flux.store("preferences"),s=i.getState();t=s.get(k),t||(t=S[0].preset),r=n.resolve()}w.logEvent("file","newFromTemplate",t);var a=u.createWithPreset(t),f=o.playObject(a).bind(this).then(function(e){return this.transfer(rt,e.documentID)});return n.join(f,r)},M=function(e){this.dispatch(m.ui.TOGGLE_OVERLAYS,{enabled:!1});var t={path:e};return o.playObject(u.open(t,{})).bind(this).then(function(){var e=this.transfer(at),t=this.transfer(d.updateTransform),r=this.transfer(h.updateRecentFiles);return n.join(e,t,r)}).catch(function(){return f.performMenuCommand(C)})},_=function(e){e===undefined&&(e=this.flux.store("application").getCurrentDocument());if(!e)return n.resolve();this.dispatch(m.ui.TOGGLE_OVERLAYS,{enabled:!1});var t=u.close(e.id),r={interactionMode:o.interactionMode.DISPLAY};return n.delay(50).bind(this).then(function(){return o.playObject(t,r)}).then(function(){return this.transfer(it,e.id)},function(){})},D=function(){return o.getProperty("application","numberOfDocuments").bind(this).then(function(e){var t={};if(e===0){t.selectedDocumentID=null,t.documents=[],this.dispatch(m.document.RESET_DOCUMENTS,t);return}var r=i.range(1,e+1).map(function(e){var t=u.referenceBy.index(e);return L(t).then(A)}),s=n.all(r),a=u.referenceBy.current,f=o.getProperty(a,"documentID");return n.join(f,s,function(e,n){t.selectedDocumentID=e,t.documents=n,this.dispatch(m.document.RESET_DOCUMENTS,t)}.bind(this)).bind(this).then(function(){return this.transfer(l.updateHistoryState)})})},P=function(e,t){var r=i.range(1,t+1).filter(function(t){return t!==e}).map(function(e){var t=u.referenceBy.index(e);return L(t).bind(this).then(A).then(function(e){this.dispatch(m.document.DOCUMENT_UPDATED,e)})},this);return n.all(r)},H=function(){return o.getProperty("application","numberOfDocuments").bind(this).then(function(e){if(e===0){this.dispatch(m.menus.UPDATE_MENUS),this.dispatch(m.application.INITIALIZED,{item:"activeDocument"});return}var t=u.referenceBy.current;return L(t).bind(this).then(function(t){var r=A(t),i=o.get("historyState"),s=this.transfer(mt,t.documentID,!1),u=f.performMenuCommand(N);return n.join(r,i,u,s,function(e,t){e.current=!0,e.document.currentHistoryState=t.itemIndex,e.document.historyStates=t.count,this.dispatch(m.document.DOCUMENT_UPDATED,e),this.dispatch(m.application.INITIALIZED,{item:"activeDocument"})}.bind(this)).then(function(){return{currentIndex:t.itemIndex,docCount:e}})})})},B=function(){var e=u.referenceBy.current;return o.getProperty(e,"documentID").catch(function(){return null})},j=function(e){return B().bind(this).then(function(t){var r={documentID:e,selectedDocumentID:t};this.dispatch(m.document.CLOSE_DOCUMENT,r);var i=this.flux.store("application").getCurrentDocument(),s=this.transfer(c.resetLinkedLayers,i),o=this.transfer(l.updateHistoryState),u=this.transfer(h.updateRecentFiles),a=this.transfer(d.updateTransform);return n.join(s,a,o,u)})},F=function(e){var t=this.transfer(st,e),r=B(),i=this.transfer(d.updateTransform),s=this.transfer(mt,e,!1),o=n.join(r,t,function(e){var t={selectedDocumentID:e};this.dispatch(m.document.SELECT_DOCUMENT,t)}.bind(this));return n.join(o,i,s)},I=function(e){var t=u.referenceBy.id(e);return L(t).bind(this).then(function(e){var t=A(e),r=o.get("historyState");return n.join(t,r,function(e,t){e.current=!1,e.document.currentHistoryState=t.itemIndex,e.document.historyStates=t.count,this.dispatch(m.document.DOCUMENT_UPDATED,e)}.bind(this))})},q=function(){var e=u.referenceBy.current;return L(e).bind(this).then(function(e){var t=A(e),r=o.get("historyState");return n.join(t,r,function(e,t){e.current=!0,e.document.currentHistoryState=t.itemIndex,e.document.historyStates=t.count,this.dispatch(m.document.DOCUMENT_UPDATED,e)}.bind(this))})},R=function(e){return this.dispatch(m.ui.TOGGLE_OVERLAYS,{enabled:!1}),this.transfer(v.native,e)},U=function(e){var t=u.referenceBy.id(e.id);return o.playObject(u.select(t)).bind(this).then(function(){var t={selectedDocumentID:e.id};this.dispatch(m.document.SELECT_DOCUMENT,t)}).then(function(){var t=this.transfer(c.resetLinkedLayers,e),r=this.transfer(l.updateHistoryState),i=this.transfer(d.updateTransform),s=this.transfer(mt,e.id,!1),o=f.performMenuCommand(N);return n.join(t,i,r,s,o)})},z=function(){var e=this.flux.store("application"),t=e.getNextDocument();return t?(this.dispatch(m.ui.TOGGLE_OVERLAYS,{enabled:!1}),n.delay(50).bind(this).then(function(){return this.transfer(et,t)})):n.resolve()},W=function(){var e=this.flux.store("application"),t=e.getPreviousDocument();return t?(this.dispatch(m.ui.TOGGLE_OVERLAYS,{enabled:!1}),n.delay(50).bind(this).then(function(){this.transfer(et,t)})):n.resolve()},X=function(){var e=o.interactionMode.DISPLAY;return o.play("packageFile",{},{interactionMode:e}).catch(function(){})},V=function(){var e=this.flux.store("application").getCurrentDocument();if(!e)return n.resolve();var t=!e.guidesVisible,r=this.dispatchAsync(m.document.GUIDES_VISIBILITY_CHANGED,{documentID:e.id,guidesVisible:t}),i=u.setGuidesVisibility(t),s=o.playObject(i);return n.join(r,s)},$=function(){var e=this.flux.store("application").getCurrentDocument();if(!e)return n.resolve();var t=!e.smartGuidesVisible,r=this.dispatchAsync(m.document.GUIDES_VISIBILITY_CHANGED,{documentID:e.id,smartGuidesVisible:t}),i=u.setSmartGuidesVisibility(t),s=o.playObject(i);return n.join(r,s)},J=function(e,t){t&&b.warn("In current version of Design Space, we shouldn't enable artboard auto-nesting!");var n=u.referenceBy.id(e),r=u.setArtboardAutoAttributes(n,t);return o.playObject(r)},K=function(){var e=this.flux.store("application"),t=this.flux.store("document");return o.addListener("make",function(e){var t=s.targetOf(e);switch(t){case"document":if(typeof e.documentID!="number")throw new Error("Document created with no ID");this.flux.actions.documents.allocateDocument(e.documentID)}}.bind(this)),o.addListener("open",function(e){if(typeof e.documentID!="number")throw new Error("Document opened with no ID");this.flux.actions.documents.allocateDocument(e.documentID).bind(this).then(function(){this.flux.actions.application.updateRecentFiles()})}.bind(this)),o.addListener("select",function(t){var n,r;if(s.targetOf(t)==="document"){if(typeof t.documentID!="number")throw new Error("Selected document has no ID");n=this.flux.store("document").getDocument(t.documentID);if(!n)throw new Error("Document model missing during select document");r=e.getCurrentDocument(),r!==n&&this.flux.actions.documents.selectDocument(n)}}.bind(this)),o.addListener("save",function(e){var n=e.as,r=e.saveStage&&e.saveStage.value==="saveSucceeded";if(!r)return;var s=e.documentID,o=t.getDocument(s);if(!o){b.warn("Save event for unknown document ID",s);return}this.flux.actions.application.updateRecentFiles(),this.dispatch(m.document.SAVE_DOCUMENT,{documentID:s});if(!n)return;var u=e.in&&e.in.path,a=e.as.obj,f=y.basename(u);i.startsWith(a,"photoshop")&&(a="Photoshop"),this.dispatch(m.document.DOCUMENT_RENAMED,{documentID:s,format:a,name:f})}.bind(this)),o.addListener("paste",function(){this.flux.actions.documents.updateCurrentDocument()}.bind(this)),o.addListener("placeEvent",function(){this.flux.actions.documents.updateCurrentDocument()}.bind(this)),o.addListener("revert",function(){this.flux.actions.documents.updateCurrentDocument().bind(this).then(function(){this.dispatch(m.history.HISTORY_STATE_CHANGE)})}.bind(this)),o.addListener("drag",function(t){var n=e.getCurrentDocument();if(!n){b.warn("Received layer drag event without a current document",t);return}this.flux.actions.layers.addLayers(n,t.layerID)}.bind(this)),this.transfer(at)},Q=function(e){return e?this.transfer(ut,e.currentIndex,e.docCount):n.resolve()},G={command:O,reads:[g.PS_DOC,g.PS_APP,g.JS_PREF],writes:[g.JS_DOC,g.JS_APP,g.JS_UI,g.PS_DOC,g.JS_PREF]},Y={command:M,reads:[g.PS_DOC,g.PS_APP],writes:[g.JS_DOC,g.JS_APP,g.JS_UI]},Z={command:_,reads:[g.PS_DOC,g.PS_APP],writes:[g.JS_DOC,g.JS_APP,g.JS_UI]},et={command:U,reads:[g.PS_DOC,g.JS_DOC,g.PS_APP],writes:[g.PS_DOC,g.JS_DOC,g.JS_APP,g.JS_UI]},tt={command:z,reads:[g.PS_DOC,g.JS_DOC,g.PS_APP],writes:[g.PS_DOC,g.JS_DOC,g.JS_APP,g.JS_UI]},nt={command:W,reads:[g.PS_DOC,g.JS_DOC,g.PS_APP],writes:[g.PS_DOC,g.JS_DOC,g.JS_APP,g.JS_UI]},rt={command:F,reads:[g.PS_DOC,g.PS_APP],writes:[g.JS_DOC,g.JS_APP,g.JS_UI]},it={command:j,reads:[g.PS_DOC,g.PS_APP],writes:[g.JS_DOC,g.JS_APP,g.JS_UI]},st={command:I,reads:[g.PS_DOC],writes:[g.JS_DOC],lockUI:!0},ot={command:q,reads:[g.PS_DOC],writes:[g.JS_DOC],lockUI:!0},ut={command:P,reads:[g.PS_DOC],writes:[g.JS_DOC]},at={command:H,reads:[g.PS_DOC],writes:[g.JS_DOC]},ft={command:X,reads:[g.PS_DOC],writes:[]},lt={command:D,reads:[g.PS_DOC],writes:[g.JS_DOC,g.JS_APP]},ct={command:K,reads:[g.PS_DOC],writes:[g.JS_DOC]},ht={command:Q,reads:[g.PS_DOC],writes:[g.JS_DOC]},pt={command:R,reads:g.ALL_PS_LOCKS,writes:g.ALL_PS_LOCKS},dt={command:V,reads:[g.JS_DOC,g.PS_DOC],writes:[g.JS_DOC,g.PS_DOC]},vt={command:$,reads:[g.PS_DOC],writes:[g.JS_DOC]},mt={command:J,reads:[g.PS_DOC],writes:[g.JS_DOC]};t.createNew=G,t.open=Y,t.close=Z,t.selectDocument=et,t.selectNextDocument=tt,t.selectPreviousDocument=nt,t.allocateDocument=rt,t.disposeDocument=it,t.updateDocument=st,t.updateCurrentDocument=ot,t.revertCurrentDocument=pt,t.initActiveDocument=at,t.initInactiveDocuments=ut,t.packageDocument=ft,t.onReset=lt,t.beforeStartup=ct,t.afterStartup=ht,t.setAutoNesting=mt,t.toggleGuidesVisibility=dt,t.toggleSmartGuidesVisibility=vt,t._priority=-99}),define("js/actions/edit",["require","exports","module","immutable","adapter/os","../events","../locks","js/actions/layers","js/util/collection","js/util/headlights"],function(e,t){"use strict";var n=e("immutable"),r=e("adapter/os"),i=e("../events"),s=e("../locks"),o=e("js/actions/layers"),u=e("js/util/collection"),a=e("js/util/headlights"),f=103,l=104,c=105,h=1017,p=1961,d=1962,v="com.adobe.photoshop.spaces.design.layers",m=function(e){return e instanceof window.HTMLInputElement},g=function(e){switch(e.type){case"text":case"search":case"url":case"tel":case"password":return!0;default:return!1}},y=function(){return this.flux.actions.menu.nativeModal({commandID:f})},b=function(){return this.flux.actions.menu.nativeModal({commandID:l})},w=function(){return this.flux.actions.menu.nativeModal({commandID:c})},E=function(e){return e=e||!1,this.flux.actions.menu.nativeModal({commandID:h,waitForCompletion:e})},S=function(e){return r.hasKeyboardFocus().bind(this).then(function(t){var n=window.document.activeElement,i;if(t&&m(n))g(n)?(i=n.value.substring(n.selectionStart,n.selectionEnd),e&&n.setRangeText("")):i=n.value;else{var s=window.document.getSelection();s.type==="Range"&&(i=s.toString())}if(typeof i=="string"){var o=new window.Event(e?"cut":"copy",{bubbles:!0});return n.dispatchEvent(o),r.clipboardWrite(i)}if(this.flux.store("tool").getModalToolState())e?this.flux.actions.edit.nativeCut():this.flux.actions.edit.nativeCopy();else if(!e){var f=this.flux.store("application"),l=f.getCurrentDocument();if(!l||l.unsupported)return;var c=u.pluck(l.layers.selectedNormalized,"id"),h={document:l.id,layers:c},p=JSON.stringify(h);return a.logEvent("edit","layers","copy_layers"),r.clipboardWrite(p,v)}})},x=function(){return S.call(this,!0)},T=function(){return S.call(this,!1)},N=function(){return r.hasKeyboardFocus().bind(this).then(function(e){var t=window.document.activeElement;return e&&m(t)?r.clipboardRead().then(function(e){var n=e.data,r=e.format;if(r!=="string")return;if(g(t)){var i=t.selectionStart;t.setRangeText(n),t.setSelectionRange(i+n.length,i+n.length)}else t.value=n;var s=new window.Event("paste",{bubbles:!0});t.dispatchEvent(s)}):r.clipboardRead([v]).bind(this).then(function(e){var t=e.format;if(t!==v)return this.flux.actions.edit.nativePaste(),Promise.resolve();var r=this.flux.store("application"),i=r.getCurrentDocument();if(!i||i.unsupported)return;var s=e.data,u=JSON.parse(s),f=u.document,l=this.flux.store("document"),c=l.getDocument(f);if(!c||c.unsupported)return;var h=u.layers,p=n.List(h.reduce(function(e,t){var n=c.layers.byID(t);return n&&e.push(n),e},[]));return a.logEvent("edit","layers","paste_layers"),this.transfer(o.duplicate,i,c,p)})})},C=function(){return r.hasKeyboardFocus().bind(this).then(function(e){var t=window.document.activeElement;if(e&&m(t))g(t)&&t.setSelectionRange(0,t.value.length);else{var n=this.flux.store("tool");n.getModalToolState()?this.flux.actions.edit.nativeSelectAll():this.flux.actions.layers.selectAll()}})},k=function(){return this.dispatch(i.ui.TOGGLE_OVERLAYS,{enabled:!1}),this.flux.actions.menu.native({commandID:p})},L=function(){return this.dispatch(i.ui.TOGGLE_OVERLAYS,{enabled:!1}),this.flux.actions.menu.native({commandID:d})},A={command:x,modal:!0,reads:[],writes:[s.JS_DOC,s.PS_DOC]},O={command:T,modal:!0,reads:[s.JS_DOC],writes:[]},M={command:N,modal:!0,reads:[],writes:[s.JS_DOC,s.PS_DOC]},_={command:C,modal:!0,reads:[],writes:[]},D={command:y,modal:!0,reads:[],writes:[]},P={command:b,modal:!0,reads:[],writes:[]},H={command:w,modal:!0,reads:[],writes:[]},B={command:E,modal:!0,reads:[],writes:[]},j={command:k,reads:[],writes:[]},F={command:L,reads:[],writes:[]};t.nativeCut=D,t.nativeCopy=P,t.nativePaste=H,t.nativeSelectAll=B,t.cut=A,t.copy=O,t.paste=M,t.selectAll=_,t.undo=j,t.redo=F}),define("js/actions/example",["require","exports","module","bluebird","../events","js/locks"],function(e,t){"use strict";var n=e("bluebird"),r=e("../events"),i=e("js/locks"),s=function(e){var t={count:e};return this.dispatch(r.example.SYNC_ACTION,t),n.resolve()},o={command:s},u=function(e){return new n(function(t){var n={count:e};this.dispatch(r.example.ASYNC_ACTION_START,n),window.setTimeout(function(){this.dispatch(r.example.ASYNC_ACTION_SUCCESS,n),t()}.bind(this),100)}.bind(this))},a={command:u,writes:i.ALL_LOCKS},f={command:u,reads:i.ALL_LOCKS,writes:[]};t.syncAction=o,t.asyncActionReadOnly=f,t.asyncActionReadWrite=a}),define("js/actions/keyevents",["require","exports","module","bluebird","adapter/os","js/util/log","js/util/key"],function(e,t){"use strict";var n=e("bluebird"),r=e("adapter/os"),i=e("js/util/log"),s=e("js/util/key"),o=function(e){var t={modifierBits:e.modifiers,modifiers:s.bitsToModifiers(e.modifiers)};if(e.keyChar)t.keyChar=e.keyChar;else if(e.hasOwnProperty("keyCode"))t.keyCode=e.keyCode;else switch(e.eventKind){case r.eventKind.KEY_DOWN:case r.eventKind.KEY_UP:i.warn("Adapter key event has no key specification",e)}return t},u=function(){return r.on(r.notifierKind.EXTERNAL_KEYEVENT,function(e){var t;switch(e.eventKind){case r.eventKind.KEY_DOWN:t="adapterKeydown";break;case r.eventKind.KEY_UP:t="adapterKeyup";break;case r.eventKind.FLAGS_CHANGED:t="adapterFlagsChanged";break;default:return}var n=new window.CustomEvent(t,{bubbles:!0,detail:o(e)});window.document.activeElement.dispatchEvent(n)}),n.resolve()},a={command:u,reads:[],writes:[]};t.beforeStartup=a}),define("adapter/lib/layerEffect",["require","exports","module","lodash","../playobject","./reference","./reference","./unit","./color","../util"],function(e,t){"use strict";var n=e("lodash"),r=e("../playobject"),i=e("./reference").wrapper("layer"),s=e("./reference").refersTo,o=e("./unit"),u=e("./color"),a=e("../util").assert,f=function(e,t,n,i){var s={};return i?s[t]=n:s[t]={obj:t,value:n},new r("set",{"null":{ref:[{property:"layerEffects",ref:"property"},e]},to:{obj:"layerEffects",value:s}})},l=function(e,t,n){return new r("set",{"null":{ref:[{ref:null,property:t},{property:"layerEffects",ref:"property"},e]},to:n},{useExtendedReference:!0})},c=function(e){return{"enum":"blendMode",value:e}},h=function(e){var t={enabled:e.enabled===undefined?!0:e.enabled,useGlobalAngle:e.useGlobalAngle===undefined?!0:e.useGlobalAngle};return n.isObject(e.color)&&(t.color=u.colorObject(e.color)),n.isNumber(e.opacity)&&(t.opacity=o.percent(e.opacity)),n.isNumber(e.chokeMatte)&&(t.chokeMatte=o.pixels(e.chokeMatte)),n.isNumber(e.blur)&&(t.blur=o.pixels(e.blur)),n.isNumber(e.localLightingAngle)&&(t.localLightingAngle=o.degrees(e.localLightingAngle)),n.isNumber(e.distance)&&(t.distance=o.pixels(e.distance)),n.isString(e.blendMode)&&(t.mode=c(e.blendMode)),t},p=function(e){return{obj:"dropShadow",value:h(e)}},d=function(e){return{obj:"innerShadow",value:h(e)}},v=function(e,t){a(s(e)==="layer","setDropShadow is passed a non-layer reference");var n=t.map(function(e){return p(e)});return f(e,"dropShadowMulti",n,!0)},m=function(e,t){a(s(e)==="layer","setDropShadow is passed a non-layer reference");var n=t.map(function(e){return p(e)});return l(e,"dropShadowMulti",n,!0)},g=function(e,t){a(s(e)==="layer","setInnnerShadow is passed a non-layer reference");var n=t.map(function(e){return d(e)});return f(e,"innerShadowMulti",n,!0)},y=function(e,t){a(s(e)==="layer","setInnnerShadow is passed a non-layer reference");var n=t.map(function(e){return d(e)});return l(e,"innerShadowMulti",n,!0)},b=function(e,t,n){if(e==="innerShadow")return g(t,n);if(e==="dropShadow")return v(t,n)},w=function(e,t,n){if(e==="innerShadow")return y(t,n);if(e==="dropShadow")return m(t,n)};t.referenceBy=i,t.setLayerEffect=b,t.setExtendedLayerEffect=w}),define("js/actions/layereffects",["require","exports","module","lodash","immutable","bluebird","adapter/lib/layerEffect","adapter/lib/document","js/models/color","../events","js/locks","js/util/layeractions","i18n!nls/strings","js/util/collection"],function(e,t){"use strict";var n=e("lodash"),r=e("immutable"),i=e("bluebird"),s=e("adapter/lib/layerEffect"),o=e("adapter/lib/document"),u=e("js/models/color"),a=e("../events"),f=e("js/locks"),l=e("js/util/layeractions"),c=e("i18n!nls/strings"),h=e("js/util/collection"),p=function(e,t,r,i,u,f){var p=this.flux.store("document"),d={paintOptions:{immediateUpdate:!0,quality:"draft"},historyStateInfo:{name:c.ACTIONS.SET_LAYER_EFFECTS,target:o.referenceBy.id(e.id),coalesce:!!u}},v=a.document.LAYER_EFFECT_CHANGED,m=h.pluck(t,"id"),g=null;n.isNumber(r)&&(g=r);var y={documentID:e.id,layerIDs:m,layerEffectIndex:g,layerEffectType:f,layerEffectProperties:i};this.dispatch(v,y);var b=t.map(function(t){var n=p.getDocument(e.id).layers,r=n.byID(t.id),i;f==="dropShadow"?i=r.dropShadows:f==="innerShadow"&&(i=r.innerShadows);var o=i.map(function(e){return e.toAdapterObject()}).toArray(),u=s.referenceBy.id(t.id);return t.hasLayerEffect?{layer:t,playObject:s.setExtendedLayerEffect(f,u,o)}:{layer:t,playObject:s.setLayerEffect(f,u,o)}},this);return l.playLayerActions(e,b,!0,d)},d=function(e,t,r,i,s){var o=n.isObject(i)?i:{};return n.merge(o,{enabled:!0}),p.call(this,e,t,null,o,null,s)},v=function(e,t,n,r,i,s){return p.call(this,e,t,n,r,i,s)},m=function(e,t,n,s,o,u){var a,f,l=t.reduce(function(e,t){return t[u+"s"].has(n)?e.toUpdate.push(t):e.toAdd.push(t),e},{toUpdate:[],toAdd:[]});return l.toAdd.length>0?a=d.call(this,e,r.List(l.toAdd),n,s,u):a=i.resolve(),l.toUpdate.length>0?f=v.call(this,e,r.List(l.toUpdate),n,s,o,u):f=i.resolve(),i.join(a,f)},g=function(e,t,n){return d.call(this,e,t,0,null,n)},y=function(e,t,n,r,i){return m.call(this,e,t,n,{enabled:r},0,i)},b=function(e,t,n,s,o,a){return i.all(t.map(function(t){var i=t[a+"s"].get(n),f;return i?f=i.color.setAlpha(s):f=u.DEFAULT.set("a",s),m.call(this,e,r.List.of(t),n,{color:f},o,a)},this).toArray())},w=function(e,t,n,s,o,a,f){if(a)return i.all(t.map(function(t){var i=t[f+"s"].get(n),a;return i?a=i.color.setOpaque(s):a=u.DEFAULT,m.call(this,e,r.List.of(t),n,{color:a},o,f)},this).toArray());var l=s?s.normalizeAlpha():null;return m.call(this,e,t,n,{color:l},o,f)},E=function(e,t,n,r,i){return m.call(this,e,t,n,{x:r},null,i)},S=function(e,t,n,r,i){return m.call(this,e,t,n,{y:r},null,i)},x=function(e,t,n,r,i){return m.call(this,e,t,n,{blur:r},null,i)},T=function(e,t,n,r,i){return m.call(this,e,t,n,{spread:r},null,i)},N={command:g,reads:[f.PS_DOC,f.JS_DOC],writes:[f.PS_DOC,f.JS_DOC]},C={command:y,reads:[f.PS_DOC,f.JS_DOC],writes:[f.PS_DOC,f.JS_DOC]},k={command:b,reads:[f.PS_DOC,f.JS_DOC],writes:[f.PS_DOC,f.JS_DOC]},L={command:w,reads:[f.PS_DOC,f.JS_DOC],writes:[f.PS_DOC,f.JS_DOC]},A={command:E,reads:[f.PS_DOC,f.JS_DOC],writes:[f.PS_DOC,f.JS_DOC]},O={command:S,reads:[f.PS_DOC,f.JS_DOC],writes:[f.PS_DOC,f.JS_DOC]},M={command:x,reads:[f.PS_DOC,f.JS_DOC],writes:[f.PS_DOC,f.JS_DOC]},_={command:T,reads:[f.PS_DOC,f.JS_DOC],writes:[f.PS_DOC,f.JS_DOC]};t.addShadow=N,t.setShadowEnabled=C,t.setShadowAlpha=k,t.setShadowColor=L,t.setShadowX=A,t.setShadowY=O,t.setShadowBlur=M,t.setShadowSpread=_}),define("adapter/lib/path",["require","exports","module","../playobject"],function(e,t){"use strict";var n=e("../playobject"),r=function(){return new n("changePathDetails",{keyActionMode:0,keyOriginType:3})},i=function(){return new n("changePathDetails",{keyActionMode:1,keyOriginType:3})},s=function(){return new n("changePathDetails",{keyActionMode:2,keyOriginType:3})},o=function(){return new n("changePathDetails",{keyActionMode:3,keyOriginType:3})},u=function(){return new n("mergeLayersNew",{shapeOperation:{"enum":"shapeOperation",value:"add"}})},a=function(){return new n("mergeLayersNew",{shapeOperation:{"enum":"shapeOperation",value:"subtract"}})},f=function(){return new n("mergeLayersNew",{shapeOperation:{"enum":"shapeOperation",value:"interfaceIconFrameDimmed"}})},l=function(){return new n("mergeLayersNew",{shapeOperation:{"enum":"shapeOperation",value:"xor"}})};t.combinePathsUnion=r,t.combinePathsSubtract=i,t.combinePathsIntersect=s,t.combinePathsDifference=o,t.combineLayersUnion=u,t.combineLayersSubtract=a,t.combineLayersIntersect=f,t.combineLayersDifference=l}),define("js/actions/shapes",["require","exports","module","bluebird","immutable","adapter/ps/descriptor","adapter/lib/layer","adapter/lib/path","adapter/lib/document","adapter/lib/contentLayer","../events","js/locks","./layers","js/util/collection","js/util/object","js/util/layeractions","i18n!nls/strings"],function(e,t){"use strict";var n=e("bluebird"),r=e("immutable"),i=e("adapter/ps/descriptor"),s=e("adapter/lib/layer"),o=e("adapter/lib/path"),u=e("adapter/lib/document"),a=e("adapter/lib/contentLayer"),f=e("../events"),l=e("js/locks"),c=e("./layers"),h=e("js/util/collection"),p=e("js/util/object"),d=e("js/util/layeractions"),v=e("i18n!nls/strings"),m=function(e,t,n){return{paintOptions:{immediateUpdate:!0,quality:"draft"},historyStateInfo:{name:t,target:e,coalesce:!!n}}},g=function(e,t,n,r,i){var s={documentID:e.id,layerIDs:h.pluck(t,"id"),strokeIndex:n,strokeProperties:r};return this.dispatchAsync(i,s)},y=function(e,t,n,r,i){var s={documentID:e.id,layerIDs:h.pluck(t,"id"),fillIndex:n,fillProperties:r};return this.dispatchAsync(i,s)},b=function(e,t){return e.every(function(e){return e.strokes&&e.strokes.get(t)})},w=function(e,t,n){var o=s.referenceBy.id(h.pluck(t,"id").toArray());return i.batchGetProperty(o.ref,"AGMStrokeStyleInfo").bind(this).then(function(i){t.forEach(function(t,s){var o={documentID:e.id,strokeIndex:n,layerIDs:r.List.of(t.id),strokeStyleDescriptor:i[s]};this.dispatch(f.document.STROKE_ADDED,o)},this)})},E=function(e,t,n,r,i){return S.call(this,e,t,n,r,!1,i).bind(this).then(function(){return this.transfer(c.resetBounds,e,t)})},S=function(e,t,r,i,s,o,l){i=i?i.normalizeAlpha():null,o=o===undefined?!0:o;var c=i.toJS();l&&delete c.a;var h=a.referenceBy.current,p=a.setStrokeFillTypeSolidColor(h,o?c:null),y=u.referenceBy.id(e.id),E=m(y,v.ACTIONS.SET_STROKE_COLOR,s);if(b(t,r)){var S=g.call(this,e,t,r,{enabled:o,color:i,ignoreAlpha:l},f.document.STROKE_COLOR_CHANGED),x=d.playSimpleLayerActions(e,t,p,!0,E);return n.join(S,x)}return d.playSimpleLayerActions(e,t,p,!0,E).bind(this).then(function(){w.call(this,e,t,r)})},x=function(e,t,r,i){var s=a.referenceBy.current,o=a.setStrokeAlignment(s,i),l=u.referenceBy.id(e.id),h=m(l,v.ACTIONS.SET_STROKE_ALIGNMENT);if(b(t,r)){var p=g.call(this,e,t,r,{alignment:i,enabled:!0},f.document.STROKE_ALIGNMENT_CHANGED).bind(this).then(function(){return this.transfer(c.resetBounds,e,t)}),y=d.playSimpleLayerActions(e,t,o,!0,h);return n.join(p,y)}return d.playSimpleLayerActions(e,t,o,!0,h).bind(this).then(function(){w.call(this,e,t,r)})},T=function(e,t,r,i,s){var o=a.referenceBy.current,l=a.setStrokeOpacity(o,i),c=u.referenceBy.id(e.id),h=m(c,v.ACTIONS.SET_STROKE_OPACITY,s);if(b(t,r)){var p=g.call(this,e,t,r,{opacity:i,enabled:!0},f.document.STROKE_OPACITY_CHANGED),y=d.playSimpleLayerActions(e,t,l,!0,h);return n.join(p,y)}return d.playSimpleLayerActions(e,t,l,!0,h).bind(this).then(function(){w.call(this,e,t,r)})},N=function(e,t,r,i){var s=a.referenceBy.current,o=a.setShapeStrokeWidth(s,i),l=u.referenceBy.id(e.id),c=m(l,v.ACTIONS.SET_STROKE_WIDTH);if(b(t,r)){var h=g.call(this,e,t,r,{width:i,enabled:!0},f.document.STROKE_WIDTH_CHANGED),p=d.playSimpleLayerActions(e,t,o,!0,c);return n.join(h,p)}return d.playSimpleLayerActions(e,t,o,!0,c).bind(this).then(function(){w.call(this,e,t,r)})},C=function(e,t){var n=a.referenceBy.current,r=a.setShapeStrokeWidth(n,1),i=u.referenceBy.id(e.id),s=m(i,v.ACTIONS.ADD_STROKE);return d.playSimpleLayerActions(e,t,r,!0,s).bind(this).then(function(n){var r=p.getPath(n,"to.value.strokeStyle"),i={documentID:e.id,layerIDs:h.pluck(t,"id"),strokeStyleDescriptor:r,strokeIndex:0};this.dispatch(f.document.STROKE_ADDED,i)})},k=function(e,t,n,r,i){return L.call(this,e,t,n,r,!1,i)},L=function(e,t,r,i,o,l,c){i=i?i.normalizeAlpha():null,l=l===undefined?!0:l;var h=y.call(this,e,t,r,{color:i,enabled:l,ignoreAlpha:c},f.document.FILL_COLOR_CHANGED),p=a.referenceBy.current,g=s.referenceBy.current,b=a.setShapeFillTypeSolidColor(p,l?i:null),w=u.referenceBy.id(e.id),E=m(w,v.ACTIONS.SET_FILL_COLOR,o),S;if(l&&!c){var x=s.setFillOpacity(g,i.opacity);S=d.playSimpleLayerActions(e,t,[b,x],!0,E)}else S=d.playSimpleLayerActions(e,t,b,!0,E);return n.join(h,S)},A=function(e,t,r,i,o){var a=y.call(this,e,t,r,{opacity:i,enabled:!0},f.document.FILL_OPACITY_CHANGED),l=s.referenceBy.current,c=s.setFillOpacity(l,i),h=u.referenceBy.id(e.id),p=m(h,v.ACTIONS.SET_FILL_OPACITY,o),g=d.playSimpleLayerActions(e,t,c,!0,p);return n.join(a,g)},O=function(e,t,n){var r=a.referenceBy.current,i=a.setShapeFillTypeSolidColor(r,n),s=u.referenceBy.id(e.id),o=m(s,v.ACTIONS.ADD_FILL);return d.playSimpleLayerActions(e,t,i,!0,o).bind(this).then(function(n){var r={documentID:e.id,layerIDs:h.pluck(t,"id"),setDescriptor:n};this.dispatch(f.document.FILL_ADDED,r)})},M=function(e,t,r){var s;if(t.isEmpty())return n.resolve();if(t.size>1){var o={documentID:e.id,layerIDs:h.pluck(t.butLast(),"id")};s=this.dispatchAsync(f.document.DELETE_LAYERS,o)}else s=n.resolve();var a={historyStateInfo:{name:v.ACTIONS.COMBINE_SHAPES,target:u.referenceBy.id(e.id)}},l=i.playObject(r,a);return n.join(s,l).bind(this).then(function(){if(t.size>1){var n=e.layers.indexOf(t.last()),r=n-t.size+1;return this.transfer(c.resetLayersByIndex,e,r)}return this.transfer(c.resetLayers,e,t)})},_=function(e,t){return t.isEmpty()?n.resolve():t.size===1?M.call(this,e,t,o.combinePathsUnion()):M.call(this,e,t,o.combineLayersUnion())},D=function(e,t){return t.isEmpty()?n.resolve():t.size===1?M.call(this,e,t,o.combinePathsSubtract()):M.call(this,e,t,o.combineLayersSubtract())},P=function(e,t){return t.isEmpty()?n.resolve():t.size===1?M.call(this,e,t,o.combinePathsIntersect()):M.call(this,e,t,o.combineLayersIntersect())},H=function(e,t){return t.isEmpty()?n.resolve():t.size===1?M.call(this,e,t,o.combinePathsDifference()):M.call(this,e,t,o.combineLayersDifference())},B=function(){var e=this.flux.store("application"),t=e.getCurrentDocument();return t?this.transfer(Q,t,t.layers.selected):n.resolve()},j=function(){var e=this.flux.store("application"),t=e.getCurrentDocument();return t?this.transfer(G,t,t.layers.selected):n.resolve()},F=function(){var e=this.flux.store("application"),t=e.getCurrentDocument();return t?this.transfer(Y,t,t.layers.selected):n.resolve()},I=function(){var e=this.flux.store("application"),t=e.getCurrentDocument();return t?this.transfer(Z,t,t.layers.selected):n.resolve()},q={command:E,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},R={command:N,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},U={command:S,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},z={command:T,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},W={command:x,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},X={command:C,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},V={command:k,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},$={command:L,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},J={command:A,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},K={command:O,reads:[l.PS_DOC,l.JS_DOC],writes:[l.PS_DOC,l.JS_DOC]},Q={command:_,reads:[],writes:[l.PS_DOC,l.JS_DOC]},G={command:D,reads:[],writes:[l.PS_DOC,l.JS_DOC]},Y={command:P,reads:[],writes:[l.PS_DOC,l.JS_DOC]},Z={command:H,reads:[],writes:[l.PS_DOC,l.JS_DOC]},et={command:B,reads:[l.PS_DOC,l.JS_DOC,l.JS_APP],writes:[l.PS_DOC,l.JS_DOC]},tt={command:j,reads:[l.PS_DOC,l.JS_DOC,l.JS_APP],writes:[l.PS_DOC,l.JS_DOC]},nt={command:F,reads:[l.PS_DOC,l.JS_DOC,l.JS_APP],writes:[l.PS_DOC,l.JS_DOC]},rt={command:I,reads:[l.PS_DOC,l.JS_DOC,l.JS_APP],writes:[l.PS_DOC,l.JS_DOC]};t.setStrokeEnabled=q,t.setStrokeWidth=R,t.setStrokeColor=U,t.setStrokeOpacity=z,t.setStrokeAlignment=W,t.addStroke=X,t.setFillEnabled=V,t.setFillColor=$,t.setFillOpacity=J,t.addFill=K,t.combineUnion=Q,t.combineSubtract=G,t.combineIntersect=Y,t.combineDifference=Z,t.combineUnionSelectedInCurrentDocument=et,t.combineSubtractSelectedInCurrentDocument=tt,t.combineIntersectSelectedInCurrentDocument=nt,t.combineDifferenceSelectedInCurrentDocument=rt}),define("adapter/lib/hitTest",["require","exports","module","../playobject"],function(e,t){"use strict";var n=e("../playobject"),r=function(e,t){return new n("hitTest",{x:e,y:t})},i=function(e,t){return new n("colorSampler",{"null":{ref:"document","enum":"ordinal",value:"targetEnum"},samplePoint:{obj:"samplePoint",value:{horizontal:{unit:"distanceUnit",value:e},vertical:{unit:"distanceUnit",value:t}}}})};t.layerIDsAtPoint=r,t.colorSampleAtPoint=i}),define("js/actions/tools",["require","exports","module","bluebird","adapter/ps/descriptor","adapter/lib/tool","adapter/os","adapter/ps","../events","js/locks","./policy","./shortcuts"],function(e,t){"use strict";var n=e("bluebird"),r=e("adapter/ps/descriptor"),i=e("adapter/lib/tool"),s=e("adapter/os"),o=e("adapter/ps"),u=e("../events"),a=e("js/locks"),f=e("./policy"),l=e("./shortcuts"),c=function(e){var t=this.flux.store("tool"),r=e?e.keyboardPolicyList:[],i=e?e.pointerPolicyList:[],s=t.getCurrentKeyboardPolicyID(),o=t.getCurrentPointerPolicyID(),u;s!==null?u=this.transfer(f.removeKeyboardPolicies,s,!1):u=n.resolve();var a=u.bind(this).then(function(){return this.transfer(f.addKeyboardPolicies,r)}),l;o!==null?l=this.transfer(f.removePointerPolicies,o,!1):l=n.resolve();var c=l.bind(this).then(function(){return this.transfer(f.addPointerPolicies,i)});return n.join(a,c,function(t,n){return{tool:e,keyboardPolicyListID:t,pointerPolicyListID:n}}.bind(this))},h=function(e){var t=this.flux.store("tool");return o.endModalToolState(!0).bind(this).then(function(){var e=t.getCurrentTool();if(!e||!e.deselectHandler)return;return e.deselectHandler.call(this,e)}).then(function(){var t=e.nativeToolName,n=i.setTool(t);return r.playObject(n)}).then(function(){var t=e.selectHandler;if(!t)return;return t.call(this,e)}).then(function(){return s.resetCursor()}).then(function(){return c.call(this,e)}).then(function(e){this.dispatch(u.tool.SELECT_TOOL,e)})},p=function(){var e=this.flux.store("tool"),t=e.getCurrentTool();return!t||t.id!=="newSelect"?n.resolve():this.transfer(y,e.getToolByID("newSelect"))},d=function(){var e=this.flux.store("tool"),t;return r.getProperty("application","tool").bind(this).then(function(n){var r=n.enum;return t=e.inferTool(r),t||(t=e.getDefaultTool()),this.transfer(y,t)}).catch(function(n){var r=e.getDefaultTool();if(t===r)throw n;return this.transfer(y,r)})},v=function(e){var t=this.dispatchAsync(u.tool.MODAL_STATE_CHANGE,{modalState:e}),r;return e?r=this.dispatchAsync(u.ui.TOGGLE_OVERLAYS,{enabled:!1}):r=n.resolve(),n.join(t,r)},m=function(){var e=this.flux,t=this.flux.store("tool"),i=t.getAllTools();r.addListener("toolModalStateChanged",function(e){var t=e.state.value==="enter",n=this.flux.actions.tools.changeModalState(t);e.kind.value==="mouse"&&(t||n.delay(100).bind(this).then(function(){this.dispatchAsync(u.ui.TOGGLE_OVERLAYS,{enabled:!0})}))}.bind(this));var s=i.reduce(function(t,n){var r=n.activationKey;if(!r)return t;var i=function(){var t=e.store("application"),r=t.getCurrentDocument();(!r||!r.unsupported)&&e.actions.tools.select(n)},s=this.transfer(l.addShortcut,r,{},i);t.push(s);if(n.id==="rectangle"){var o=this.transfer(l.addShortcut,"U",{},i);t.push(o)}return t}.bind(this),[]),a=o.endModalToolState(!0),f=this.transfer(b),c=n.all(s);return n.join(a,f,c).bind(this).then(function(){return this.transfer(w,!1)})},g=function(){var e=this.transfer(b),t=o.endModalToolState(!0);return n.join(t,e).bind(this).then(function(){return this.transfer(w,!1)})},y={command:h,reads:[a.JS_APP,a.JS_TOOL,a.JS_SHORTCUT],writes:[a.PS_APP,a.JS_POLICY,a.PS_TOOL,a.JS_TOOL,a.JS_SHORTCUT]},b={command:d,reads:[a.JS_APP,a.PS_TOOL,a.JS_TOOL,a.JS_SHORTCUT],writes:[a.PS_APP,a.JS_POLICY,a.PS_TOOL,a.JS_TOOL,a.JS_SHORTCUT]},w={command:v,reads:[a.JS_APP],writes:a.ALL_PS_LOCKS.concat([a.JS_TOOL,a.JS_DOC]),modal:!0},E={command:p,reads:[a.JS_APP,a.JS_TOOL,a.JS_SHORTCUT],writes:[a.PS_APP,a.JS_POLICY,a.PS_TOOL,a.JS_TOOL,a.JS_SHORTCUT]},S={command:m,modal:!0,reads:[a.JS_APP,a.PS_TOOL,a.JS_TOOL],writes:a.ALL_PS_LOCKS.concat([a.JS_TOOL,a.JS_DOC,a.JS_SHORTCUT,a.JS_POLICY])},x={command:g,modal:!0,reads:[a.JS_APP,a.PS_TOOL,a.JS_TOOL,a.JS_SHORTCUT],writes:a.ALL_PS_LOCKS.concat([a.JS_TOOL,a.JS_DOC,a.JS_POLICY,a.JS_SHORTCUT])};t.resetSuperselect=E,t.select=y,t.initTool=b,t.changeModalState=w,t.beforeStartup=S,t.onReset=x,t._priority=0}),define("js/actions/superselect",["require","exports","module","bluebird","immutable","adapter/ps/descriptor","js/util/system","adapter/os","adapter/lib/hitTest","js/util/key","js/locks","js/events","./documents","./layers","./tools","js/util/collection","js/util/ui","js/util/headlights"],function(e,t){"use strict";var n=e("bluebird"),r=e("immutable"),i=e("adapter/ps/descriptor"),s=e("js/util/system"),o=e("adapter/os"),u=e("adapter/lib/hitTest"),a=e("js/util/key"),f=e("js/locks"),l=e("js/events"),c=e("./documents"),h=e("./layers"),p=e("./tools"),d=e("js/util/collection"),v=e("js/util/ui"),m=e("js/util/headlights"),g=function(e){return m.logEvent("tools","superselect",e)},y=function(e,t){return t.toSeq().map(e.children,e).flatten(!0).filter(function(e){return e.superSelectable}).toList()},b=function(e,t){return r.List(e.selected.reduce(function(n,r){var i=e.parent(r);return t&&!i?n.add(r):i?n.add(i):n},new Set))},w=function(e,t){if(e.all.isEmpty())return r.List();var n=e.selected;n.isEmpty()&&(n=e.top);var i=t?-1:1;return n=n.take(1),n.map(function(t){var n=e.siblings(t).filter(function(e){return e.superSelectable}),r=n.isEmpty()?0:n.indexOf(t),s=(r+i)%n.size;return n.get(s)})},E=function(e,t){var n=u.layerIDsAtPoint(e,t);return i.playObject(n).get("layersHit").then(function(e){return r.List(e)},function(){return r.List()})},S=function(e,t,n){return r.Set(e.all.reduce(function(r,i){var s;if(i.isArtboard){var o=this.flux.store("ui").zoomCanvasToWindow(1)*window.devicePixelRatio;s=v.getNameBadgeBounds(i.bounds,o)}else s=e.childBounds(i);return s&&s.contains(t,n)&&r.add(i),r},new Set,this))},x=function(e,t){return e.leaves.filter(function(e){return t.hasOwnProperty(e.id)})},T=function(e,t){var n=e.selected;return n.size!==1?!1:r.is(n.first(),t)},N=function(e,t){var n=e.selected.reduce(function(t,n){return e.ancestors(n).forEach(function(e){t.add(e)}),t},new Set),r=t.filter(function(e){return!e.locked&&e.kind!==e.layerKinds.GROUPEND&&!n.has(e)});return d.pluck(r,"id")},C=function(e,t,r,s){if(t.isBackground)return n.resolve();var u=t.layerKinds,a;if(!r||!s){var f=t.bounds;if(!f)return n.resolve();r=(f.right+f.left)/2,s=(f.top+f.bottom)/2;var l=this.flux.store("ui").transformCanvasToWindow(r,s);r=l.x,s=l.y}var h;switch(t.kind){case u.VECTOR:a=this.flux.store("tool").getToolByID("superselectVector"),g("edit_vector"),h=this.transfer(p.select,a).bind(this).then(function(){var e=o.eventKind.LEFT_MOUSE_DOWN,t=[r,s];return o.postEvent({eventKind:e,location:t})});break;case u.TEXT:a=this.flux.store("tool").getToolByID("superselectType"),g("edit_text"),h=this.transfer(p.select,a).bind(this).then(function(){var e=o.eventKind.LEFT_MOUSE_DOWN,t=[r,s];return o.postEvent({eventKind:e,location:t})});break;case u.SMARTOBJECT:var d={interactionMode:i.interactionMode.DISPLAY};g("edit_smart_object"),h=i.play("placedLayerEditContents",{},d).bind(this).then(function(){return this.transfer(c.updateCurrentDocument)},function(){});break;default:h=n.resolve()}return h},k=function(e,t,r,i,s){var o=this.flux.store("ui"),u=o.transformWindowToCanvas(t,r),a=e.layers;return E(u.x,u.y).bind(this).then(function(t){var r,o=S.call(this,a,u.x,u.y),f=d.pluck(o,"id").concat(t);f=f.sortBy(function(e){return t.indexOf(e)});if(i){var l=f.reduce(function(e,t){return e[t]=!0,e},{}),c=x(a,l);r=d.pluck(c,"id")}else{var p=a.selectable,v=d.intersection(p,o),m=d.pluck(v,"id");r=d.intersection(f,m)}if(!r.isEmpty()){var y=r.last(),b=a.byID(y),w="select";if(s&&b.selected){if(T(a,b))return g("deselect_all"),this.transfer(h.deselectAll,e).return(!1);w="deselect"}else s&&(w="add");return w==="select"&&b.selected?n.resolve(!0):(i?g("click_deep_"+w):g("click_"+w),this.transfer(h.select,e,b,w).return(!0))}return e.layers.selected.isEmpty()?n.resolve(!1):(g("deselect_all"),this.transfer(h.deselectAll,e).return(!1))})},L=function(e,t,r){var i=this.flux.store("ui"),s=i.transformWindowToCanvas(t,r),o=e.layers;return E(s.x,s.y).bind(this).then(function(i){var u=o.selected;u.isEmpty()&&(u=o.top);var a=y(o,u);if(a.isEmpty()){var f=o.selected,l=f.find(function(e){return i.contains(e.id)});return l?this.transfer(h.select,e,l).bind(this).then(function(){return g("double_click_edit"),this.transfer(R,e,l,t,r)}):n.resolve()}var c=S.call(this,o,s.x,s.y),p=d.intersection(a,c),v=d.pluck(p,"id"),m=d.intersection(i,v),b=m.last();if(!m.isEmpty())return g("double_click_select"),this.transfer(h.select,e,o.byID(b));var w=N(o,c);if(!w.isEmpty()){var E=w.last();return this.transfer(h.select,e,o.byID(E))}return n.resolve()})},A=function(e,t){var r=e.layers,i=b(r,t);return i.isEmpty()?t?n.resolve():(g("key_backout_deselect"),this.transfer(h.deselectAll,e)):(g("key_backout"),this.transfer(h.select,e,i))},O=function(e,t){var n=e.layers,r=w(n,t);return g("key_next_sibling"),this.transfer(h.select,e,r)},M=function(e){var t=e.layers,r=y(t,t.selected);if(r.isEmpty()){var i=t.selected;if(i.size===1){var s=i.get(0);return s.locked?n.resolve():(g("key_edit"),this.transfer(R,e,s))}return n.resolve()}return g("key_dive_in"),this.transfer(h.select,e,r.first())},_=null,D=function(e,t,n,r,u){var f=o.eventKind.LEFT_MOUSE_DOWN,c=[t,n],h=a.modifiersToBits(r),p=s.isMac?r.command:r.control,d=r.shift,v=r.option;if(u){this.dispatch(l.ui.TOGGLE_OVERLAYS,{enabled:!1});var m={eventKind:f,location:c,modifiers:h};return o.postEvent(m)}return d?this.dispatchAsync(l.ui.SUPERSELECT_MARQUEE,{x:t,y:n,enabled:!0}):this.transfer(H,e,t,n,p,r.shift).bind(this).then(function(r){if(r){_&&i.removeListener("move",_),_=function(){this.dispatch(l.ui.TOGGLE_OVERLAYS,{enabled:!0});if(!v){var t=this.flux.store("document"),n=t.getDocument(e.id);this.flux.actions.layers.resetBounds(n,n.layers.allSelected)}else this.flux.actions.documents.updateDocument(e.id)}.bind(this),i.once("move",_),this.dispatch(l.ui.TOGGLE_OVERLAYS,{enabled:!1});var s={eventKind:f,location:c,modifiers:h};return o.postEvent(s)}return this.dispatchAsync(l.ui.SUPERSELECT_MARQUEE,{x:t,y:n,enabled:!0})}).catch(function(){})},P=function(e,t,i){this.dispatch(l.ui.SUPERSELECT_MARQUEE,{enabled:!1});var s=r.List(t.map(e.layers.byID.bind(e.layers))),o=i?"add":"select";return s.isEmpty()&&!i?(g("marqueeDeselect"),this.transfer(h.deselectAll,e)):s.isEmpty()?n.resolve():(g("marqueeSelect"),this.transfer(h.select,e,s,o))},H={command:k,reads:[f.PS_DOC,f.JS_APP,f.JS_TOOL],writes:[f.PS_DOC,f.JS_DOC]},B={command:L,reads:f.ALL_LOCKS,writes:f.ALL_LOCKS},j={command:A,reads:[f.PS_DOC,f.JS_APP,f.JS_TOOL],writes:[f.PS_DOC,f.JS_DOC]},F={command:O,reads:[f.PS_DOC,f.JS_APP,f.JS_TOOL],writes:[f.PS_DOC,f.JS_DOC]},I={command:M,reads:f.ALL_LOCKS,writes:f.ALL_LOCKS},q={command:D,reads:[f.PS_DOC,f.JS_APP,f.JS_TOOL],writes:[f.PS_DOC,f.JS_DOC]},R={command:C,reads:f.ALL_LOCKS,writes:f.ALL_LOCKS},U={command:P,reads:[f.PS_DOC,f.JS_APP,f.JS_TOOL],writes:[f.PS_DOC,f.JS_DOC]};t.click=H,t.doubleClick=B,t.backOut=j,t.nextSibling=F,t.diveIn=I,t.drag=q,t.editLayer=R,t.marqueeSelect=U}),define("js/actions/transform",["require","exports","module","bluebird","immutable","adapter/ps/descriptor","adapter/lib/document","adapter/lib/layer","adapter/lib/artboard","adapter/lib/contentLayer","adapter/lib/unit","../events","js/locks","js/util/log","./layers","js/util/collection","js/util/locking","js/util/layeractions","js/util/headlights","i18n!nls/strings"],function(e,t){"use strict";var n=e("bluebird"),r=e("immutable"),i=e("adapter/ps/descriptor"),s=e("adapter/lib/document"),o=e("adapter/lib/layer"),u=e("adapter/lib/artboard"),a=e("adapter/lib/contentLayer"),f=e("adapter/lib/unit"),l=e("../events"),c=e("js/locks"),h=e("js/util/log"),p=e("./layers"),d=e("js/util/collection"),v=e("js/util/locking"),m=e("js/util/layeractions"),g=e("js/util/headlights"),y=e("i18n!nls/strings"),b={immediateUpdate:!0,quality:"draft"},w=function(e,t,n,i){var a=e.layers.childBounds(t),f=e.layers.descendants(t),l=n.hasOwnProperty("x")?n.x-a.left:0,c=n.hasOwnProperty("y")?n.y-a.top:0,h=s.referenceBy.id(e.id);return i=i||[],f.reduce(function(e,t){if(!t.bounds||t.bounds.empty)return e;var r=[h,o.referenceBy.id(t.id)],s;if(t.isArtboard){var a=n.hasOwnProperty("x")?n.x:t.bounds.left,f=n.hasOwnProperty("y")?n.y:t.bounds.top,p={top:f,bottom:f+t.bounds.height,left:a,right:a+t.bounds.width};i.push({layer:t,x:a,y:f}),s=u.transform(r,p)}else i.push({layer:t,x:t.bounds.left+l,y:t.bounds.top+c}),s=o.translate(r,l,c);return e.push({layer:t,playObject:s})},r.List(),this)},E=function(e,t,n){n=n||10;var i=e.layers.childBounds(t.get(0)),s=e.layers.childBounds(t.get(1)),o={left:Math.min(i.left,s.left),right:Math.max(i.right,s.right),top:Math.min(i.top,s.top),bottom:Math.max(i.bottom,s.bottom)},u=i.top+i.height/2,a=s.top+s.height/2,f=i.left+i.width/2,l=s.left+s.width/2,c=(o.bottom-o.top)/n,h=(o.right-o.left)/n,p=Math.abs(i.left-s.left)<h||Math.abs(i.right-s.right)<h||Math.abs(f-l)<h,d=Math.abs(i.top-s.top)<c||Math.abs(i.bottom-s.bottom)<c||Math.abs(u-a)<c,v=null,m=null,g=null,y=null;return p?(v=i.left,m=s.top,g=s.left,y=i.top):d?(v=o.left+o.right-i.right,g=o.left+o.right-s.right,m=i.top,y=s.top):(v=s.left,m=s.top,g=i.left,y=i.top),r.List.of({x:v,y:m},{x:g,y:y})},S=function(e,t,n){var r={};return n?t.hasOwnProperty("w")?(r.w=t.w,r.h=r.w*(e.height/e.width)):t.hasOwnProperty("h")?(r.h=t.h,r.w=r.h*(e.width/e.height)):(r.w=e.width,r.h=e.height):(r.w=t.hasOwnProperty("w")?t.w:e.width,r.h=t.hasOwnProperty("h")?t.h:e.height),r},x=function(e,t,n,i){var a=e.layers.childBounds(t),f=e.layers.descendants(t),l=s.referenceBy.id(e.id);i=i||[];var c=n.w?n.w/a.width:0,h=n.h?n.h/a.height:0;return f.reduce(function(e,r){if(!r.bounds||r.bounds.empty)return e;var s=[l,o.referenceBy.id(r.id)],f=r.bounds.top,p=r.bounds.left,d={},v={left:p,top:f},m=r.bounds.width/a.width,g=r.bounds.height/a.height,y;n.hasOwnProperty("w")&&(d.w=n.w*m,v.left=a.left+(p-a.left)*c),n.hasOwnProperty("h")&&(d.h=n.h*g,v.top=a.top+(f-a.top)*h);var b=S(r.bounds,d,t.proportionalScaling),w=b.w,E=b.h,x=v.left,T=v.top;if(r.isArtboard){var N={top:T,bottom:T+E,left:x,right:x+w};i.push({layer:r,w:w,h:E,x:x,y:T}),y=u.transform(s,N)}else i.push({layer:r,w:w,h:E,x:x,y:T}),y=o.setSize(s,w,E,!1,x,T);return e.push({layer:r,playObject:y})},r.List(),this)},T=function(e,t,i){t=t.filterNot(function(e){return e.kind===e.layerKinds.GROUPEND});var o={documentID:e.id,positions:[]},u={historyStateInfo:{name:y.ACTIONS.SET_LAYER_POSITION,target:s.referenceBy.id(e.id)}},a=this.dispatchAsync(l.document.REPOSITION_LAYERS,o),f=t.reduce(function(t,n){var r=w.call(this,e,n,i,o.positions);return t.concat(r)},r.List(),this),c=m.playLayerActions(e,f,!0,u);return n.join(a,c)},N=function(e,t){if(t.size!==2)throw new Error("Expected two layers");if(t.every(function(e){return e.kind===e.layerKinds.GROUPEND}))return n.resolve();var r=E(e,t),i=s.referenceBy.id(e.id),o={documentID:e.id,positions:[]},u=w.call(this,e,t.get(0),r.get(0),o.positions),a=w.call(this,e,t.get(1),r.get(1),o.positions),f=u.concat(a),c=n.bind(this).then(function(){this.dispatch(l.document.REPOSITION_LAYERS,o)}),h={historyStateInfo:{name:y.ACTIONS.SWAP_LAYERS,target:i}};g.logEvent("edit","layers","swap_layers");var p=m.playLayerActions(e,f,!0,h);return n.join(c,p)},C=function(e,t,n){var r=e.layers.selected,a=s.referenceBy.id(e.id),f=[a,o.referenceBy.current],l;if(r.size===1&&r.first().isArtboard){var c=n.normalize(),h={top:c.top,bottom:c.bottom,left:c.left,right:c.right};l=u.transform(f,h)}else{var d=n.width,v=n.height,m=n.top,g=n.left;l=o.setSize(f,d,v,!1,g,m)}return i.playObject(l).bind(this).then(function(){var t=r.flatMap(e.layers.descendants,e.layers);return this.transfer(p.resetBounds,e,t)}).catch(function(){})},k=function(e,t){var n=d.pluck(e.layers.selected,"id"),r=t.width,i=t.height,s=t.top,o=t.left;r<0&&(r=-r,o-=r),i<0&&(i=-i,s-=i);var u={documentID:e.id,layerIDs:n,size:{w:r,h:i},position:{top:s,left:o}};return this.dispatchAsync(l.document.LAYER_BOUNDS_CHANGED,u)},L=function(e,t,o){t=t.filterNot(function(n){return n.kind===n.layerKinds.GROUPEND||e.layers.strictAncestors(n).some(function(e){return t.contains(e)})},this);var u={documentID:e.id,sizes:[]},a={paintOptions:b,historyStateInfo:{name:y.ACTIONS.SET_LAYER_SIZE,target:s.referenceBy.id(e.id)}},c,h;if(t.isEmpty()){var p=S(e.bounds,o),d=p.w,v=f.pixels(d),g=p.h,w=f.pixels(g),E=s.resize(v,w,"left","top");u.size=p,c=this.dispatchAsync(l.document.RESIZE_DOCUMENT,u),h=i.playObject(E)}else{var T=t.reduce(function(t,n){var r=x.call(this,e,n,o,u.sizes);return t.concat(r)},r.List(),this);c=this.dispatchAsync(l.document.RESIZE_LAYERS,u),h=m.playLayerActions(e,T,!0,a)}return n.join(c,h)},A=function(e,t,n){if(t.isEmpty())throw new Error("Expected at least one layer");var r=t.find(function(e){return!e.isBackground});if(!r)throw new Error("flip was not provided a valid non-background layer");var i=o.referenceBy.id(r.id),u=o.flip(i,n),a={historyStateInfo:{name:y.ACTIONS.FLIP_LAYERS,target:s.referenceBy.id(e.id)}};return v.playWithLockOverride(e,t,u,a).bind(this).then(function(){var n=t.flatMap(e.layers.descendants,e.layers);return this.transfer(p.resetBounds,e,n)})},O=function(e,t){return A.call(this,e,t,"horizontal")},M=function(e,t){return A.call(this,e,t,"vertical")},_=function(){var e=this.flux.store("application"),t=e.getCurrentDocument(),r=t.layers.selected;return t?this.transfer(Z,t,r):n.resolve()},D=function(){var e=this.flux.store("application"),t=e.getCurrentDocument(),r=t.layers.selected;return t?this.transfer(et,t,r):n.resolve()},P=function(e,t,n){if(t.isEmpty())throw new Error("Expected at least one layer");var r=t.find(function(e){return!e.isBackground});if(!r)throw new Error("align was not provided a valid non-background layer");var i=o.referenceBy.id(r.id),u=o.align(i,n),a={historyStateInfo:{name:y.ACTIONS.ALIGN_LAYERS,target:s.referenceBy.id(e.id)}};return v.playWithLockOverride(e,t,u,a).bind(this).then(function(){var n=t.flatMap(e.layers.descendants,e.layers);return this.transfer(p.resetBounds,e,n)})},H=function(e,t){return!e&&!t&&(e=this.flux.store("application").getCurrentDocument(),t=e.layers.selected),P.call(this,e,t,"left")},B=function(e,t){return!e&&!t&&(e=this.flux.store("application").getCurrentDocument(),t=e.layers.selected),P.call(this,e,t,"right")},j=function(e,t){return!e&&!t&&(e=this.flux.store("application").getCurrentDocument(),t=e.layers.selected),P.call(this,e,t,"top")},F=function(e,t){return!e&&!t&&(e=this.flux.store("application").getCurrentDocument(),t=e.layers.selected),P.call(this,e,t,"bottom")},I=function(e,t){return!e&&!t&&(e=this.flux.store("application").getCurrentDocument(),t=e.layers.selected),P.call(this,e,t,"vCenter")},q=function(e,t){return!e&&!t&&(e=this.flux.store("application").getCurrentDocument(),t=e.layers.selected),P.call(this,e,t,"hCenter")},R=function(e,t,n){if(t.isEmpty())throw new Error("Expected at least one layer");var r=t.find(function(e){return!e.isBackground});if(!r)throw new Error("distribute was not provided a valid non-background layer");var i=o.referenceBy.id(r.id),u=o.distribute(i,n),a={historyStateInfo:{name:y.ACTIONS.DISTRIBUTE_LAYERS,target:s.referenceBy.id(e.id)}};return v.playWithLockOverride(e,t,u,a).bind(this).then(function(){var n=t.flatMap(e.layers.descendants,e.layers);return this.transfer(p.resetBounds,e,n)})},U=function(e,t){return!e&&!t&&(e=this.flux.store("application").getCurrentDocument(),t=e.layers.selected),R.call(this,e,t,"horizontally")},z=function(e,t){return!e&&!t&&(e=this.flux.store("application").getCurrentDocument(),t=e.layers.selected),R.call(this,e,t,"vertically")},W=function(e,t,r,i){var o=this.dispatchAsync(l.document.RADII_CHANGED,{documentID:e.id,layerIDs:d.pluck(t,"id"),radii:{topLeft:r,topRight:r,bottomRight:r,bottomLeft:r}}),u=a.setRadius(r),f={paintOptions:b,historyStateInfo:{name:y.ACTIONS.SET_RADIUS,target:s.referenceBy.id(e.id),coalesce:i}},c=v.playWithLockOverride(e,t,u,f);return n.join(o,c)},X=function(){var e=this.flux.store("application"),t=e.getCurrentDocument(),r=t.layers.selected;return!t||r.size!==2?n.resolve():this.transfer(ct,t,r)},V=function(e,t){var n=s.referenceBy.id(e.id),r=[n,o.referenceBy.current],i=o.rotate(r,t),u={historyStateInfo:{name:y.ACTIONS.ROTATE_LAYERS,target:s.referenceBy.id(e.id)}};return v.playWithLockOverride(e,e.layers.selected,i,u).bind(this).then(function(){var t=e.layers.selected,n=t.flatMap(e.layers.descendants,e.layers);return this.transfer(p.resetBounds,e,n)})},$=function(e){if(!e.hasOwnProperty("angle"))return h.error("Missing angle"),n.resolve();var t=this.flux.store("application"),r=t.getCurrentDocument();if(!r)return n.resolve();var i=e.angle;return this.transfer(dt,r,i)},J=function(e,t){var i=this.flux.store("application").getCurrentDocument(),o=i.layers.selected;if(o.isEmpty())return n.resolve();var u=o.some(function(e){return e.locked});if(u)return n.resolve();o=o.filterNot(function(e){return e.kind===e.layerKinds.GROUPEND});var a={historyStateInfo:{name:y.ACTIONS.NUDGE_LAYERS,target:s.referenceBy.id(i.id)}},f={documentID:i.id,positions:[]},c=0,h=0,p=10,d=1;switch(e){case"up":h=t?-p:-d;break;case"down":h=t?p:d;break;case"left":c=t?-p:-d;break;case"right":c=t?p:d}var v=o.reduce(function(e,t){var n=i.layers.childBounds(t),r={x:n.left+c,y:n.top+h},s=w.call(this,i,t,r,f.positions);return e.concat(s)},r.List(),this),g=this.dispatchAsync(l.document.REPOSITION_LAYERS,f),b=m.playLayerActions(i,v,!0,a);return n.join(b,g)},K={command:T,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},Q={command:L,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},G={command:C,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},Y={command:k,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},Z={command:O,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},et={command:M,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},tt={command:H,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},nt={command:B,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},rt={command:j,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},it={command:F,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},st={command:q,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},ot={command:I,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},ut={command:U,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},at={command:z,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},ft={command:_,reads:[c.PS_DOC,c.JS_DOC,c.JS_APP],writes:[c.PS_DOC,c.JS_DOC]},lt={command:D,reads:[c.PS_DOC,c.JS_DOC,c.JS_APP],writes:[c.PS_DOC,c.JS_DOC]},ct={command:N,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},ht={command:X,reads:[c.PS_DOC,c.JS_DOC,c.JS_APP],writes:[c.PS_DOC,c.JS_DOC]},pt={command:W,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},dt={command:V,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]},vt={command:$,reads:[c.PS_DOC,c.JS_DOC,c.JS_APP],writes:[c.PS_DOC,c.JS_DOC]},mt={command:J,reads:[c.PS_DOC,c.JS_DOC],writes:[c.PS_DOC,c.JS_DOC]};t.setPosition=K,t.setSize=Q,t.setDragBounds=Y,t.flipX=Z,t.flipY=et,t.flipXCurrentDocument=ft,t.flipYCurrentDocument=lt,t.alignLeft=tt,t.alignRight=nt,t.alignTop=rt,t.alignBottom=it,t.alignVCenter=ot,t.alignHCenter=st,t.distributeY=at,t.distributeX=ut,t.swapLayers=ct,t.swapLayersCurrentDocument=ht,t.setRadius=pt,t.setBounds=G,t.rotate=dt,t.rotateLayersInCurrentDocument=vt,t.nudgeLayers=mt}),define("js/actions/type",["require","exports","module","bluebird","adapter/lib/textLayer","adapter/ps/descriptor","adapter/lib/document","./layers","../events","js/locks","js/util/collection","js/util/locking","js/util/math","i18n!nls/strings"],function(e,t){"use strict";var n=e("bluebird"),r=e("adapter/lib/textLayer"),i=e("adapter/ps/descriptor"),s=e("adapter/lib/document"),o=e("./layers"),u=e("../events"),a=e("js/locks"),f=e("js/util/collection"),l=e("js/util/locking"),c=e("js/util/math"),h=e("i18n!nls/strings"),p=.04,d=5400,v=function(e,t,n){return{paintOptions:{immediateUpdate:!0,quality:"draft"},historyStateInfo:{name:t,target:s.referenceBy.id(e),coalesce:!!n}}},m=function(){return i.getProperty("application","fontList").bind(this).then(function(e){this.dispatch(u.font.INIT_FONTS,e.value)})},g=function(e,t,i,s,a){var c=f.pluck(t,"id"),p=c.map(r.referenceBy.id).toArray(),d=r.setPostScript(p,i),m=v(e.id,h.ACTIONS.SET_TYPE_FACE),g=this.dispatchAsync(u.ui.TOGGLE_OVERLAYS,{enabled:!1}).bind(this).then(function(){l.playWithLockOverride(e,t,d,m)}).then(function(){return this.transfer(o.resetBounds,e,t)}),y={documentID:e.id,layerIDs:c,postscript:i,family:s,style:a},b=this.dispatchAsync(u.document.TYPE_FACE_CHANGED,y);return n.join(b,g)},y=function(e,t,i,s){var a=f.pluck(t,"id"),c=a.map(r.referenceBy.id).toArray(),p=r.setFace(c,i,s),d=v(e.id,h.ACTIONS.SET_TYPE_FACE),m=this.dispatchAsync(u.ui.TOGGLE_OVERLAYS,{enabled:!1}).bind(this).then(function(){l.playWithLockOverride(e,t,p,d)}).then(function(){return this.transfer(o.resetBounds,e,t)}),g={documentID:e.id,layerIDs:a,family:i,style:s},y=this.dispatchAsync(u.document.TYPE_FACE_CHANGED,g);return n.join(y,m)},b=function(e,t,i,s,a){var c=f.pluck(t,"id"),p=c.map(r.referenceBy.id).toArray(),d=i.normalizeAlpha(),m=d.opaque(),g=r.setColor(p,m),y=v(e.id,h.ACTIONS.SET_TYPE_COLOR,s),b=l.playWithLockOverride(e,t,g,y),w;if(a)w=b;else{var E=Math.round(d.opacity),S=this.transfer(o.setOpacity,e,t,E,s);w=n.join(b,S)}var x={documentID:e.id,layerIDs:c,color:d},T=this.dispatchAsync(u.document.TYPE_COLOR_CHANGED,x);return n.join(T,w)},w=function(e,t,i){var s=f.pluck(t,"id"),a=s.map(r.referenceBy.id).toArray();i=c.clamp(i,p,d);var m=r.setSize(a,i,"px"),g=v(e.id,h.ACTIONS.SET_TYPE_SIZE),y=this.dispatchAsync(u.ui.TOGGLE_OVERLAYS,{enabled:!1}).bind(this).then(function(){l.playWithLockOverride(e,t,m,g)}).then(function(){return this.transfer(o.resetBounds,e,t)}),b={documentID:e.id,layerIDs:s,size:i},w=this.dispatchAsync(u.document.TYPE_SIZE_CHANGED,b);return n.join(w,y)},E=function(e,t,i){var s=f.pluck(t,"id"),a=s.map(r.referenceBy.id).toArray(),c=i/1e3,p=r.setTracking(a,c),d=v(e.id,h.ACTIONS.SET_TYPE_TRACKING),m=this.dispatchAsync(u.ui.TOGGLE_OVERLAYS,{enabled:!1}).bind(this).then(function(){l.playWithLockOverride(e,t,p,d)}).then(function(){return this.transfer(o.resetBounds,e,t)}),g={documentID:e.id,layerIDs:s,tracking:i},y=this.dispatchAsync(u.document.TYPE_TRACKING_CHANGED,g);return n.join(y,m)},S=function(e,t,i){var s=f.pluck(t,"id"),a=s.map(r.referenceBy.id).toArray(),c=i===null,p=r.setLeading(a,c,i,"px"),d=v(e.id,h.ACTIONS.SET_TYPE_LEADING),m=this.dispatchAsync(u.ui.TOGGLE_OVERLAYS,{enabled:!1}).bind(this).then(function(){l.playWithLockOverride(e,t,p,d)}).then(function(){return this.transfer(o.resetBounds,e,t)}),g={documentID:e.id,layerIDs:s,leading:i},y=this.dispatchAsync(u.document.TYPE_LEADING_CHANGED,g);return n.join(y,m)},x=function(e,t,i){var s=f.pluck(t,"id"),a=s.map(r.referenceBy.id).toArray(),c=r.setAlignment(a,i),p=v(e.id,h.ACTIONS.SET_TYPE_ALIGNMENT),d=this.dispatchAsync(u.ui.TOGGLE_OVERLAYS,{enabled:!1}).bind(this).then(function(){l.playWithLockOverride(e,t,c,p)}).then(function(){return this.transfer(o.resetBounds,e,t)}),m={documentID:e.id,layerIDs:s,alignment:i},g=this.dispatchAsync(u.document.TYPE_ALIGNMENT_CHANGED,m);return n.join(g,d)},T=function(){return m.call(this)},N=function(){return m.call(this)},C={command:g,reads:[],writes:[a.PS_DOC,a.JS_DOC]},k={command:y,reads:[],writes:[a.PS_DOC,a.JS_DOC]},L={command:b,reads:[],writes:[a.PS_DOC,a.JS_DOC]},A={command:w,reads:[],writes:[a.PS_DOC,a.JS_DOC]},O={command:E,reads:[],writes:[a.PS_DOC,a.JS_DOC]},M={command:S,reads:[],writes:[a.PS_DOC,a.JS_DOC]},_={command:x,reads:[],writes:[a.PS_DOC,a.JS_DOC]},D={command:T,reads:[a.PS_APP],writes:[a.JS_TYPE]},P={command:N,reads:[a.PS_APP],writes:[a.JS_TYPE]};t.setPostScript=C,t.setFace=k,t.setColor=L,t.setSize=A,t.setTracking=O,t.setLeading=M,t.setAlignment=_,t.afterStartup=D,t.onReset=P}),define("js/actions/help",["require","exports","module","bluebird","./dialog","js/locks"],function(e,t){"use strict";var n=e("bluebird"),r=e("./dialog"),i=e("js/locks"),s=function(){return this.transfer(r.openDialog,"first-launch-dialog")},o=function(){return this.transfer(r.openDialog,"keyboard-shortcut-dialog")},u=function(){var e=this.flux.store("preferences").getState();return e.get("showFirstLaunch",!0)?this.transfer(f):n.resolve()},a={command:u,reads:[i.JS_PREF],writes:[i.JS_DIALOG]},f={command:s,reads:[],writes:[i.JS_DIALOG]},l={command:o,reads:[],writes:[i.JS_DIALOG]};t.afterStartup=a,t.openFirstLaunch=f,t.openKeyboardShortcuts=l}),define("js/actions/index",["require","exports","module","./application","./dialog","./documents","./edit","./example","./history","./keyevents","./layers","./layereffects","./menu","./policy","./preferences","./shapes","./shortcuts","./superselect","./tools","./transform","./type","./ui","./help"],function(e,t,n){"use strict";n.exports={application:e("./application"),dialog:e("./dialog"),documents:e("./documents"),edit:e("./edit"),example:e("./example"),history:e("./history"),keyevents:e("./keyevents"),layers:e("./layers"),layerEffects:e("./layereffects"),menu:e("./menu"),policy:e("./policy"),preferences:e("./preferences"),shapes:e("./shapes"),shortcuts:e("./shortcuts"),superselect:e("./superselect"),tools:e("./tools"),transform:e("./transform"),type:e("./type"),ui:e("./ui"),help:e("./help")}}),define("js/util/async-dependency-queue",["require","exports","module","eventEmitter","bluebird","lodash","adapter/util"],function(e,t,n){"use strict";var r=e("eventEmitter"),i=e("bluebird"),s=e("lodash"),o=e("adapter/util"),u=function(e,t,n){t=s.union(t,n);var r={};r.promise=new i(function(e,t){r.resolve=e,r.reject=t}),this.id=u._idCounter++,this.fn=e,this.reads=t,this.writes=n,this.deferred=r};u._idCounter=0,u.prototype.fn=null,u.prototype.reads=null,u.prototype.writes=null,u.prototype.deferred=null,u.prototype.promise=null;var a=function(e){r.call(this),this._maxJobs=e,this._pending=[],this._current={}};o.inherits(a,r),a.prototype._pending=null,a.prototype._current=null,a.prototype._isPaused=!1,a.prototype.push=function(e,t,n){var r=new u(e,t,n);return this._pending.push(r),this._processNext(),r.deferred.promise},a.prototype.removeAll=function(){this._pending.forEach(function(e){e.deferred.reject(new Error("Job canceled before execution"))}),this._pending.length=0},a.prototype._checkLockConflicts=function(e,t){var n=Object.keys(this._current);return n.some(function(n){var r=this._current[n],i=r[e];return i.some(function(e){return e===t})},this)},a.prototype._checkLockSetConflicts=function(e,t){return t.some(function(t){return this._checkLockConflicts(e,t)},this)},a.prototype._checkWriteConflicts=function(e){return this._checkLockSetConflicts("reads",e)},a.prototype._checkReadConflicts=function(e){return this._checkLockSetConflicts("writes",e)},a.prototype._pickJob=function(){var e=this._pending.length,t,n,r,i;for(n=0;n<e;n++){t=this._pending[n],r=t.reads,i=t.writes;if(this._checkWriteConflicts(i))continue;if(this._checkReadConflicts(r))continue;return this._pending.splice(n,1),t}return null},a.prototype._processNext=function(){if(this._isPaused)return;if(this._pending.length===0)return;var e=Object.keys(this._current);if(e.length>=this._maxJobs)return;var t=this._pickJob();if(!t)return;this._current[t.id]=t,t.promise=t.fn().bind(this).then(function(e){t.deferred.resolve(e)},function(e){t.deferred.reject(e),this.emit("error",e)}).finally(function(){delete this._current[t.id],this._isPaused||this._processNext()}).done(),this._processNext()},a.prototype.pause=function(){this._isPaused=!0;var e=Object.keys(this._current);return e.length>0?i.settle(e.map(function(e){return this._current[e].promise},this)):i.resolve()},a.prototype.unpause=function(){this._isPaused=!1,this._processNext()},a.prototype.pending=function(){return this._pending.length},a.prototype.active=function(){return Object.keys(this._current).length},n.exports=a}),define("js/util/performance",["require","exports","module","lodash","js/util/log"],function(e,t){"use strict";var n=e("lodash"),r=e("js/util/log"),i={},s=function(e,t,n,r,s){i.hasOwnProperty(e)||(i[e]={});var o=i[e];o.hasOwnProperty(t)||(o[t]=[]),o[t].push({idle:r-n,executing:s-r})},o=function(e){var t=Object.keys(i).reduce(function(e,t){var n=i[t];return Object.keys(n).forEach(function(r){e[t+"."+r]=n[r]}),e},{}),s=function(e,t){return e+t},o=Object.keys(t).map(function(r){var i=t[r],o=i.length,u=n.pluck(i,e).sort(),a=n.max(u),f=u[Math.floor(u.length/2)],l=n.min(u),c=n.reduce(u,s),h=c/o;return{action:r,count:o,total:c,max:a,med:f,avg:h,min:l}});r.table(o),r.debug("Total: %d actions in %dms",n.size(o),n.chain(o).pluck("total").reduce(s).value())},u=function(){o("idle")},a=function(){o("executing")};t.recordAction=s,t.printIdleTimes=u,t.printExecTimes=a,t._actionTimes=i}),define("js/fluxcontroller",["require","exports","module","fluxxor","bluebird","eventEmitter","lodash","adapter/ps","adapter/util","./locks","./stores/index","./actions/index","./util/async-dependency-queue","./util/synchronization","./util/performance","./util/log","./util/global"],function(e,t,n){"use strict";var r=e("fluxxor"),i=e("bluebird"),s=e("eventEmitter"),o=e("lodash"),u=e("adapter/ps"),a=e("adapter/util"),f=e("./locks"),l=e("./stores/index"),c=e("./actions/index"),h=e("./util/async-dependency-queue"),p=e("./util/synchronization"),d=e("./util/performance"),v=e("./util/log"),m=e("./util/global"),g="Throttled",y=6400,b=function(e,t){var n=c[e],r=c[t],i=n._priority||0,s=r._priority||0;return s-i},w=function(e,t){return o.difference(e,t).length===0},E=function(e,t){var n=t.reads||f.ALL_LOCKS,r=t.writes||f.ALL_LOCKS,s=t.lockUI||!1,u=this,a;n=o.union(n,r);var l=Object.create(e,{transfer:{value:function(e){if(!e||!e.hasOwnProperty("command"))throw new Error("Incorrect next action; passed command directly?");var t=o.union(e.reads,e.writes)||f.ALL_LOCKS;if(!w(t,n))throw v.error("Missing read locks:",o.difference(t,n).join(", ")),new Error("Next action requires additional read locks");var i=e.writes||f.ALL_LOCKS;if(!w(i,r))throw v.error("Missing write locks:",o.difference(i,r).join(", ")),new Error("Next action requires additional write locks");s&&u.emit("lock");var a=Array.prototype.slice.call(arguments,1);return e.command.apply(this,a).finally(function(){s&&u.emit("unlock")})}},dispatchAsync:{value:function(e,t){return a.then(function(){this.dispatch(e,t)})}}});return a=i.bind(l),l},S=function(e){s.call(this);var t=window.navigator.hardwareConcurrency||8;this._actionQueue=new h(t);var n=this._synchronizeAllModules(c),i=l.create(),u=o.merge(i,e||{});this._flux=new r.Flux(u,n),this._resetHelper=p.throttle(this._resetWithDelay,this),this._actionReceivers=new Map};a.inherits(S,s),S.prototype._flux=null,S.prototype._running=!1,S.prototype._actionQueue=null,S.prototype._actionReceivers=null,Object.defineProperties(S.prototype,{flux:{enumerable:!0,get:function(){return this._flux}},active:{enumerable:!0,get:function(){return this._running&&!this._resetPending}}}),S.prototype._getActionReceiver=function(e,t){var n=this._actionReceivers.get(t);return n||(n=E.call(this,e,t),this._actionReceivers.set(t,n)),n},S.prototype._synchronize=function(e,t,n){var r=this,s=this._actionQueue,o=t[n],a=e+"."+n,l=o.command,c=o.reads||f.ALL_LOCKS,h=o.writes||f.ALL_LOCKS,p=o.lockUI||!1,g=o.modal||!1;return function(){var t=this.flux.store("tool"),f=Array.prototype.slice.call(arguments,0),y=Date.now(),b=r._getActionReceiver(this,o);v.debug("Enqueuing action %s; %d/%d",a,s.active(),s.pending());var w=s.push(function(){var o=Date.now(),c,h;return t.getModalToolState()&&!g?(v.debug("Killing modal state for action %s",a),h=u.endModalToolState(!0)):h=i.resolve(),h.bind(this).then(function(){v.debug("Executing action %s after waiting %dms; %d/%d",a,o-y,s.active(),s.pending()),p&&r.emit("lock");var e=l.apply(this,f);return e instanceof i||(c=new Error("Action did not return a promise"),c.returnValue=e,e=i.reject(c)),e}).tap(function(){var t=Date.now(),i=t-o,u=t-y;v.debug("Finished action %s in %dms with RTT %dms; %d/%d",a,i,u,s.active(),s.pending()),p&&r.emit("unlock"),m.debug&&d.recordAction(e,n,y,o,t)}).catch(function(e){var t=e instanceof Error?e.stack||e.message:e;throw v.error("Action "+a+" failed:",t),r._reset(e),e})}.bind(b),c,h);return w}},S.prototype._synchronizeModule=function(e,t){return Object.keys(t).reduce(function(n,r){if(r[0]==="_")return n[r]=t[r],n;var i=r+g,s=this._synchronize(e,t,r),o=p.throttle(s);return n[r]=s,n[i]=o,n}.bind(this),{})},S.prototype._synchronizeAllModules=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return t[n]=this._synchronizeModule(n,r),t}.bind(this),{})},S.prototype._invokeActionMethods=function(e,t){t=t||{};var n=Object.keys(c).filter(function(t){if(this._flux.actions[t].hasOwnProperty(e))return!0},this).sort(b).map(function(n){var r=this._flux.actions[n],s=r[e].call(r,t[n]);return i.all([n,s])},this);return i.all(n).reduce(function(e,t){return e[t[0]]=t[1],e},{})},S.prototype.start=function(){if(this._running)return i.reject(new Error("The flux instance is already running"));var e=this._invokeActionMethods("beforeStartup");return e.bind(this).then(function(e){return this.emit("ready"),this._invokeActionMethods("afterStartup",e)}).then(function(){this._running=!0}),e},S.prototype.stop=function(){return this._running?(this._running=!1,this.emit("lock"),this._invokeActionMethods("onShutdown")):i.reject(new Error("The flux instance is not running"))},S.prototype._resetPending=!1,S.prototype._resetRetryDelayInitial=200,S.prototype._resetRetryDelay=S.prototype._resetRetryDelayInitial,S.prototype._resetWithDelay=function(){var e=this._resetRetryDelay;return this._resetRetryDelay*=2,this._invokeActionMethods("onReset").bind(this).then(function(){this._resetPending=!1,this.emit("unlock")},function(e){var t=e instanceof Error?e.stack||e.message:e;v.warn("Reset failed:",t)}).delay(e).then(function(){this._resetPending||(this._resetRetryDelay=this._resetRetryDelayInitial)})},S.prototype._resetHelper=null,S.prototype._reset=function(e){this._actionQueue.removeAll();if(!this._running||this._resetRetryDelay>y){this.emit("error",{cause:e}),this._resetPending=!1,this._resetRetryDelay=this._resetRetryDelayInitial;return}this._resetPending=!0,this.emit("lock"),this._resetHelper()},n.exports=S}),define("js/main",["require","exports","module","react","bluebird","adapter","jsx!js/jsx/Main","./fluxcontroller","js/util/log","i18n!nls/strings","js/util/global"],function(e,t){"use strict";var n=e("react"),r=e("bluebird"),i=e("adapter"),s=e("jsx!js/jsx/Main"),o=e("./fluxcontroller"),u=e("js/util/log"),a=e("i18n!nls/strings"),f=e("js/util/global"),l=n.createFactory(s),c=new o,h=function(e){var t=e.cause,n=t instanceof Error?t.stack||t.message:t;u.error("Unrecoverable error:",n);if(f.debug)d();else{var r=a.ERR.UNRECOVERABLE;i.abort({message:r},function(e){var t=e instanceof Error?e.stack||e.message:e;u.error("Abort failed:",t)})}},p=function(){var e=Date.now(),t=i.version;u.info("Spaces plugin version: %d.%d.%d",t.major,t.minor,t.patch),c.on("error",h);var s={controller:c,flux:c.flux},o=c.start().then(function(){u.debug("Actions loaded: %dms",Date.now()-e)}),a=new r(function(t){n.render(new l(s),window.document.body,function(){u.debug("Main component mounted: %dms",Date.now()-e),t()})});r.join(a,o,function(){u.info("Startup complete: %dms",Date.now()-e)})},d=function(){c.off("error",h),c.stop()};f.debug&&(r.longStackTraces(),r.onPossiblyUnhandledRejection(function(e){throw e}),n.addons.Perf.start(),_spaces._debug.enableDebugContextMenu(!0,function(){})),window.document.readyState==="complete"?p():window.addEventListener("load",p),window.addEventListener("beforeunload",d),t.controller=c});