From 4d2361418658b49b1d3f3c661176bb58c292134f Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 30 Oct 2016 20:05:08 -0400 Subject: [PATCH 1/2] Update the background color to the new API. Now `BackgroundColor` provides a `newInstance()` method that takes publicAPI and model objects, making it a good minimal example. It also demonstrates how to import HTML fragments and CSS style from external files. See the `ToggleControl` and `Workbench` examples for usage. --- .../Native/BackgroundColor/body.html | 4 + src/Component/Native/BackgroundColor/index.js | 96 +++++++++++++------ .../Native/Composite/example/index.js | 10 +- .../Native/ToggleControl/example/index.js | 4 +- .../Native/Workbench/example/index.js | 10 +- style/ComponentNative/BackgroundColor.mcss | 11 +++ 6 files changed, 95 insertions(+), 40 deletions(-) create mode 100644 src/Component/Native/BackgroundColor/body.html create mode 100644 style/ComponentNative/BackgroundColor.mcss diff --git a/src/Component/Native/BackgroundColor/body.html b/src/Component/Native/BackgroundColor/body.html new file mode 100644 index 0000000000..90beb5272c --- /dev/null +++ b/src/Component/Native/BackgroundColor/body.html @@ -0,0 +1,4 @@ +
+
+
+
diff --git a/src/Component/Native/BackgroundColor/index.js b/src/Component/Native/BackgroundColor/index.js index fbbc663472..ae7856de68 100644 --- a/src/Component/Native/BackgroundColor/index.js +++ b/src/Component/Native/BackgroundColor/index.js @@ -1,36 +1,76 @@ -/* eslint-disable class-methods-use-this */ - -export default class NativeBackgroundColorComponent { - constructor(color, el) { - this.color = color; - this.setContainer(el); - this.previousColor = ''; - } - - /* - * We must not mess with the position properties of the style on the container - * we are given, or we will break the workbench layout functionality! Setting the - * background color is fine, however, as long as we don't use the setAttribute() - * approach to this. Also, we could always create our own container - * within the element we are given, and we can do whatever we want with that. - */ - - setContainer(el) { - if (this.el) { - this.el.style['background-color'] = this.previousColor; +import style from 'PVWStyle/ComponentNative/BackgroundColor.mcss'; +import htmlContent from './body.html'; +import CompositeClosureHelper from '../../../Common/Core/CompositeClosureHelper'; + +function backgroundColorComponent(publicAPI, model) { + publicAPI.resize = () => { + // When using this component as a template, respond + // to resize events by updating the DOM to match. + }; + + publicAPI.setContainer = (el) => { + if (model.container) { + while (model.container.firstChild) { + model.container.removeChild(model.container.firstChild); + } } - this.el = el; + model.container = el; + + if (model.container) { + // Create placeholder + model.container.innerHTML = htmlContent; + + // Apply style + const colorEle = model.container.querySelector('.bg-color-container'); + colorEle.classList.add(style.bgColorContainer); + colorEle.style.backgroundColor = model.color; + } + }; - if (el) { - this.previousColor = this.el.style['background-color']; - this.el.style['background-color'] = this.color; + publicAPI.setColor = (colorSpec) => { + let color = colorSpec; + if (typeof colorSpec !== 'string' || colorSpec === '') { + color = 'inherit'; + } + model.color = color; + if (model.container) { + model.container.querySelector('.bg-color-container').style.backgroundColor = model.color; } - } + }; + + // When removing this component, clean up its container and call the parent + // object's destroy method: + publicAPI.destroy = CompositeClosureHelper.chain(() => { + publicAPI.setContainer(null); + }, publicAPI.destroy); +} - render() {} +// ---------------------------------------------------------------------------- +// Object factory +// ---------------------------------------------------------------------------- - resize() {} +const DEFAULT_VALUES = { + container: null, + color: 'inherit', +}; - destroy() {} +// ---------------------------------------------------------------------------- + +export function extend(publicAPI, model, initialValues = {}) { + Object.assign(model, DEFAULT_VALUES, initialValues); + + CompositeClosureHelper.destroy(publicAPI, model); + CompositeClosureHelper.isA(publicAPI, model, 'VizComponent'); + CompositeClosureHelper.get(publicAPI, model, ['color', 'container']); + + backgroundColorComponent(publicAPI, model); } + +// ---------------------------------------------------------------------------- + +export const newInstance = CompositeClosureHelper.newInstance(extend); + +// ---------------------------------------------------------------------------- + +export default { newInstance, extend }; diff --git a/src/Component/Native/Composite/example/index.js b/src/Component/Native/Composite/example/index.js index 933041642c..0da0296e59 100644 --- a/src/Component/Native/Composite/example/index.js +++ b/src/Component/Native/Composite/example/index.js @@ -1,5 +1,5 @@ import CompositeComponent from '..'; -import BGColorComponent from '../../BackgroundColor'; +import BackgroundColor from '../../BackgroundColor'; // Load CSS require('normalize.css'); @@ -10,10 +10,10 @@ container.style.width = '100%'; container.style.height = '600px'; const composite = new CompositeComponent(); -const green = new BGColorComponent('green'); -const red = new BGColorComponent('red'); -const blue = new BGColorComponent('blue'); -const pink = new BGColorComponent('pink'); +const green = BackgroundColor.newInstance({ color:'green' }); +const red = BackgroundColor.newInstance({ color:'red' }); +const blue = BackgroundColor.newInstance({ color:'blue' }); +const pink = BackgroundColor.newInstance({ color:'pink' }); composite.addViewport(green); composite.addViewport(red); diff --git a/src/Component/Native/ToggleControl/example/index.js b/src/Component/Native/ToggleControl/example/index.js index 7db111439f..cd1e506657 100644 --- a/src/Component/Native/ToggleControl/example/index.js +++ b/src/Component/Native/ToggleControl/example/index.js @@ -7,8 +7,8 @@ import 'normalize.css'; const container = document.querySelector('.content'); container.style.height = '100vh'; -const green = new BGColorComponent('green'); -const red = new BGColorComponent('red'); +const green = BGColorComponent.newInstance({ color:'green' }); +const red = BGColorComponent.newInstance({ color:'red' }); const toggleView = new ToggleControlComponent(green, red); toggleView.setContainer(container); diff --git a/src/Component/Native/Workbench/example/index.js b/src/Component/Native/Workbench/example/index.js index ad52eb052f..055de01a40 100644 --- a/src/Component/Native/Workbench/example/index.js +++ b/src/Component/Native/Workbench/example/index.js @@ -15,11 +15,11 @@ const container = document.querySelector('.content'); container.style.height = '100vh'; container.style.width = '100vw'; -const green = new BGColor('green'); -const red = new BGColor('red'); -const blue = new BGColor('blue'); -const pink = new BGColor('pink'); -const gray = new BGColor('gray'); +const green = BGColor.newInstance({ color:'green' }); +const red = BGColor.newInstance({ color:'red' }); +const blue = BGColor.newInstance({ color:'blue' }); +const pink = BGColor.newInstance({ color:'pink' }); +const gray = BGColor.newInstance({ color:'gray' }); // const toggleView = new ToggleControl(green, red); diff --git a/style/ComponentNative/BackgroundColor.mcss b/style/ComponentNative/BackgroundColor.mcss new file mode 100644 index 0000000000..e78a7c5d5e --- /dev/null +++ b/style/ComponentNative/BackgroundColor.mcss @@ -0,0 +1,11 @@ +.bgColorContainer { + border-radius: 15px; + font-family: "Optima", "Linux Biolinum", "URW Classico", sans; + position: absolute; + top: 5px; + right: 5px; + bottom: 5px; + left: 5px; + pointer-events: none; + overflow: hidden; +} From 858038b8ee29cd770e02e65fde628b2561fcd306 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 31 Oct 2016 21:28:24 -0400 Subject: [PATCH 2/2] chore(dist): dist --- dist/ParaViewWeb.js | 213909 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 213762 insertions(+), 147 deletions(-) diff --git a/dist/ParaViewWeb.js b/dist/ParaViewWeb.js index 92bfe14e34..7323f23a8c 100644 --- a/dist/ParaViewWeb.js +++ b/dist/ParaViewWeb.js @@ -1,163 +1,213778 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){(function(t){e.exports=t.ParaViewWeb=n(278)}).call(t,function(){return this}())},function(e,t,n){t=e.exports=n(3)(),t.push([e.id,"/*!\n * Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome\n * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)\n */@font-face{font-family:FontAwesome;src:url("+n(713)+");src:url("+n(712)+"?#iefix&v=4.5.0) format('embedded-opentype'),url("+n(716)+") format('woff2'),url("+n(717)+") format('woff'),url("+n(715)+") format('truetype'),url("+n(714)+'#fontawesomeregular) format(\'svg\');font-weight:400;font-style:normal}.font-awesome_fa_2otTb{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.font-awesome_fa-lg_2-2uP{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.font-awesome_fa-2x_2Mgjx{font-size:2em}.font-awesome_fa-3x_1gdsS{font-size:3em}.font-awesome_fa-4x_2VkGW{font-size:4em}.font-awesome_fa-5x_QKikc{font-size:5em}.font-awesome_fa-fw_1FdA5{width:1.28571429em;text-align:center}.font-awesome_fa-ul_2XTDQ{padding-left:0;margin-left:2.14285714em;list-style-type:none}.font-awesome_fa-ul_2XTDQ>li{position:relative}.font-awesome_fa-li_1vepp{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.font-awesome_fa-li_1vepp.font-awesome_fa-lg_2-2uP{left:-1.85714286em}.font-awesome_fa-border_6EUMg{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.font-awesome_fa-pull-left_3jHfw{float:left}.font-awesome_fa-pull-right_20ZAt{float:right}.font-awesome_fa_2otTb.font-awesome_fa-pull-left_3jHfw{margin-right:.3em}.font-awesome_fa_2otTb.font-awesome_fa-pull-right_20ZAt{margin-left:.3em}.font-awesome_pull-right_1Mb60{float:right}.font-awesome_pull-left_30vXl{float:left}.font-awesome_fa_2otTb.font-awesome_pull-left_30vXl{margin-right:.3em}.font-awesome_fa_2otTb.font-awesome_pull-right_1Mb60{margin-left:.3em}.font-awesome_fa-spin_NsqCr{animation:font-awesome_fa-spin_NsqCr 2s infinite linear}.font-awesome_fa-pulse_1Vv2f{animation:font-awesome_fa-spin_NsqCr 1s infinite steps(8)}@keyframes font-awesome_fa-spin_NsqCr{0%{transform:rotate(0deg)}to{transform:rotate(359deg)}}.font-awesome_fa-rotate-90_1snKw{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);transform:rotate(90deg)}.font-awesome_fa-rotate-180_2hMM8{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);transform:rotate(180deg)}.font-awesome_fa-rotate-270_3eBDG{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);transform:rotate(270deg)}.font-awesome_fa-flip-horizontal_33SUC{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0,mirror=1);transform:scaleX(-1)}.font-awesome_fa-flip-vertical_klOOu{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2,mirror=1);transform:scaleY(-1)}:root .font-awesome_fa-flip-horizontal_33SUC,:root .font-awesome_fa-flip-vertical_klOOu,:root .font-awesome_fa-rotate-90_1snKw,:root .font-awesome_fa-rotate-180_2hMM8,:root .font-awesome_fa-rotate-270_3eBDG{filter:none}.font-awesome_fa-stack_3fqsM{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.font-awesome_fa-stack-1x_14Vb0,.font-awesome_fa-stack-2x_It5yP{position:absolute;left:0;width:100%;text-align:center}.font-awesome_fa-stack-1x_14Vb0{line-height:inherit}.font-awesome_fa-stack-2x_It5yP{font-size:2em}.font-awesome_fa-inverse_1e1EX{color:#fff}.font-awesome_fa-glass_34uit:before{content:"\\F000"}.font-awesome_fa-music_3f2s5:before{content:"\\F001"}.font-awesome_fa-search_1C7GK:before{content:"\\F002"}.font-awesome_fa-envelope-o_3EWEI:before{content:"\\F003"}.font-awesome_fa-heart_3DHYT:before{content:"\\F004"}.font-awesome_fa-star_2g4Ye:before{content:"\\F005"}.font-awesome_fa-star-o_3ty_o:before{content:"\\F006"}.font-awesome_fa-user_N3puO:before{content:"\\F007"}.font-awesome_fa-film_2qmKe:before{content:"\\F008"}.font-awesome_fa-th-large_2N4P8:before{content:"\\F009"}.font-awesome_fa-th_3f0mR:before{content:"\\F00A"}.font-awesome_fa-th-list_3qelJ:before{content:"\\F00B"}.font-awesome_fa-check_3DXVm:before{content:"\\F00C"}.font-awesome_fa-close_1zysR:before,.font-awesome_fa-remove_1MIYz:before,.font-awesome_fa-times_1Y-Cs:before{content:"\\F00D"}.font-awesome_fa-search-plus_9OGuc:before{content:"\\F00E"}.font-awesome_fa-search-minus_1j_Aj:before{content:"\\F010"}.font-awesome_fa-power-off_vPefe:before{content:"\\F011"}.font-awesome_fa-signal_1VxWh:before{content:"\\F012"}.font-awesome_fa-cog_30mdw:before,.font-awesome_fa-gear_yfzjv:before{content:"\\F013"}.font-awesome_fa-trash-o_2uFKh:before{content:"\\F014"}.font-awesome_fa-home_3Fr6e:before{content:"\\F015"}.font-awesome_fa-file-o_208AJ:before{content:"\\F016"}.font-awesome_fa-clock-o_3vfig:before{content:"\\F017"}.font-awesome_fa-road_2017v:before{content:"\\F018"}.font-awesome_fa-download_1TDS9:before{content:"\\F019"}.font-awesome_fa-arrow-circle-o-down_2M97h:before{content:"\\F01A"}.font-awesome_fa-arrow-circle-o-up_2aqY-:before{content:"\\F01B"}.font-awesome_fa-inbox_3bWnM:before{content:"\\F01C"}.font-awesome_fa-play-circle-o_3vU6r:before{content:"\\F01D"}.font-awesome_fa-repeat_27E0b:before,.font-awesome_fa-rotate-right_1E_3J:before{content:"\\F01E"}.font-awesome_fa-refresh_2AOlD:before{content:"\\F021"}.font-awesome_fa-list-alt_3nS4v:before{content:"\\F022"}.font-awesome_fa-lock_inyGT:before{content:"\\F023"}.font-awesome_fa-flag_1qWlx:before{content:"\\F024"}.font-awesome_fa-headphones_13olw:before{content:"\\F025"}.font-awesome_fa-volume-off_1llC2:before{content:"\\F026"}.font-awesome_fa-volume-down_1jTgZ:before{content:"\\F027"}.font-awesome_fa-volume-up_2XIXx:before{content:"\\F028"}.font-awesome_fa-qrcode_17ZaI:before{content:"\\F029"}.font-awesome_fa-barcode_1al4-:before{content:"\\F02A"}.font-awesome_fa-tag_2CMhy:before{content:"\\F02B"}.font-awesome_fa-tags_3kYb4:before{content:"\\F02C"}.font-awesome_fa-book_32JVT:before{content:"\\F02D"}.font-awesome_fa-bookmark_1s2Fl:before{content:"\\F02E"}.font-awesome_fa-print_y2Ezw:before{content:"\\F02F"}.font-awesome_fa-camera_Ls8dv:before{content:"\\F030"}.font-awesome_fa-font_1VH0X:before{content:"\\F031"}.font-awesome_fa-bold_11qyx:before{content:"\\F032"}.font-awesome_fa-italic_1Gtc3:before{content:"\\F033"}.font-awesome_fa-text-height_3db67:before{content:"\\F034"}.font-awesome_fa-text-width_2yBeb:before{content:"\\F035"}.font-awesome_fa-align-left_3DuVK:before{content:"\\F036"}.font-awesome_fa-align-center_M9xyY:before{content:"\\F037"}.font-awesome_fa-align-right_3Icru:before{content:"\\F038"}.font-awesome_fa-align-justify_maoNA:before{content:"\\F039"}.font-awesome_fa-list_3CT1m:before{content:"\\F03A"}.font-awesome_fa-dedent_3p5N-:before,.font-awesome_fa-outdent_34S6p:before{content:"\\F03B"}.font-awesome_fa-indent_2Y6xl:before{content:"\\F03C"}.font-awesome_fa-video-camera_2Tfna:before{content:"\\F03D"}.font-awesome_fa-image_l6mTT:before,.font-awesome_fa-photo_2f_lI:before,.font-awesome_fa-picture-o_3srts:before{content:"\\F03E"}.font-awesome_fa-pencil_3o0Fh:before{content:"\\F040"}.font-awesome_fa-map-marker_1Lc7q:before{content:"\\F041"}.font-awesome_fa-adjust_1uk96:before{content:"\\F042"}.font-awesome_fa-tint_23wIx:before{content:"\\F043"}.font-awesome_fa-edit_2ITK3:before,.font-awesome_fa-pencil-square-o_1jFx_:before{content:"\\F044"}.font-awesome_fa-share-square-o_1bC_y:before{content:"\\F045"}.font-awesome_fa-check-square-o_2eIdJ:before{content:"\\F046"}.font-awesome_fa-arrows_2tovc:before{content:"\\F047"}.font-awesome_fa-step-backward_1aJ3J:before{content:"\\F048"}.font-awesome_fa-fast-backward_rW1JQ:before{content:"\\F049"}.font-awesome_fa-backward_WWKjR:before{content:"\\F04A"}.font-awesome_fa-play_1vQTN:before{content:"\\F04B"}.font-awesome_fa-pause_33hRm:before{content:"\\F04C"}.font-awesome_fa-stop_1l1v_:before{content:"\\F04D"}.font-awesome_fa-forward_3jJNW:before{content:"\\F04E"}.font-awesome_fa-fast-forward_2JwE2:before{content:"\\F050"}.font-awesome_fa-step-forward_3NyZe:before{content:"\\F051"}.font-awesome_fa-eject_GA_Jm:before{content:"\\F052"}.font-awesome_fa-chevron-left_1EwAm:before{content:"\\F053"}.font-awesome_fa-chevron-right_3RxN_:before{content:"\\F054"}.font-awesome_fa-plus-circle_1SAMg:before{content:"\\F055"}.font-awesome_fa-minus-circle_Th8wG:before{content:"\\F056"}.font-awesome_fa-times-circle_JfW7D:before{content:"\\F057"}.font-awesome_fa-check-circle_PBRDH:before{content:"\\F058"}.font-awesome_fa-question-circle_33ykP:before{content:"\\F059"}.font-awesome_fa-info-circle_2ZdWr:before{content:"\\F05A"}.font-awesome_fa-crosshairs_18oYo:before{content:"\\F05B"}.font-awesome_fa-times-circle-o_3LLKK:before{content:"\\F05C"}.font-awesome_fa-check-circle-o_1CW2E:before{content:"\\F05D"}.font-awesome_fa-ban_1LOdy:before{content:"\\F05E"}.font-awesome_fa-arrow-left_2G_P0:before{content:"\\F060"}.font-awesome_fa-arrow-right_15DTA:before{content:"\\F061"}.font-awesome_fa-arrow-up_12gpU:before{content:"\\F062"}.font-awesome_fa-arrow-down_2zqoH:before{content:"\\F063"}.font-awesome_fa-mail-forward_2tQrw:before,.font-awesome_fa-share_3O8Dc:before{content:"\\F064"}.font-awesome_fa-expand_34Ihf:before{content:"\\F065"}.font-awesome_fa-compress_1JDdS:before{content:"\\F066"}.font-awesome_fa-plus_WEb-k:before{content:"\\F067"}.font-awesome_fa-minus_1WAd4:before{content:"\\F068"}.font-awesome_fa-asterisk_w7w6r:before{content:"\\F069"}.font-awesome_fa-exclamation-circle_2bbrU:before{content:"\\F06A"}.font-awesome_fa-gift_3bKvI:before{content:"\\F06B"}.font-awesome_fa-leaf_2B5Uf:before{content:"\\F06C"}.font-awesome_fa-fire_1qsDr:before{content:"\\F06D"}.font-awesome_fa-eye_3XRn0:before{content:"\\F06E"}.font-awesome_fa-eye-slash_18NEx:before{content:"\\F070"}.font-awesome_fa-exclamation-triangle_ttuT-:before,.font-awesome_fa-warning_32nGg:before{content:"\\F071"}.font-awesome_fa-plane_3L5mD:before{content:"\\F072"}.font-awesome_fa-calendar_1niuw:before{content:"\\F073"}.font-awesome_fa-random_2RH42:before{content:"\\F074"}.font-awesome_fa-comment_2koYW:before{content:"\\F075"}.font-awesome_fa-magnet_33k7m:before{content:"\\F076"}.font-awesome_fa-chevron-up_2R5R_:before{content:"\\F077"}.font-awesome_fa-chevron-down_746nC:before{content:"\\F078"}.font-awesome_fa-retweet_2ma5b:before{content:"\\F079"}.font-awesome_fa-shopping-cart_276KU:before{content:"\\F07A"}.font-awesome_fa-folder_2MMW6:before{content:"\\F07B"}.font-awesome_fa-folder-open_1a3bX:before{content:"\\F07C"}.font-awesome_fa-arrows-v_27J04:before{content:"\\F07D"}.font-awesome_fa-arrows-h_3EAQ6:before{content:"\\F07E"}.font-awesome_fa-bar-chart-o_BMSPQ:before,.font-awesome_fa-bar-chart_3LGib:before{content:"\\F080"}.font-awesome_fa-twitter-square_146CY:before{content:"\\F081"}.font-awesome_fa-facebook-square_3IbRT:before{content:"\\F082"}.font-awesome_fa-camera-retro_oM_mn:before{content:"\\F083"}.font-awesome_fa-key_3bV7M:before{content:"\\F084"}.font-awesome_fa-cogs_CqXH5:before,.font-awesome_fa-gears_3cjY1:before{content:"\\F085"}.font-awesome_fa-comments_2lUtO:before{content:"\\F086"}.font-awesome_fa-thumbs-o-up_3cD9j:before{content:"\\F087"}.font-awesome_fa-thumbs-o-down_3AeCO:before{content:"\\F088"}.font-awesome_fa-star-half_2zxdp:before{content:"\\F089"}.font-awesome_fa-heart-o_QI-Zl:before{content:"\\F08A"}.font-awesome_fa-sign-out_2IOU5:before{content:"\\F08B"}.font-awesome_fa-linkedin-square_3HkV4:before{content:"\\F08C"}.font-awesome_fa-thumb-tack_2gcw0:before{content:"\\F08D"}.font-awesome_fa-external-link_1ku_O:before{content:"\\F08E"}.font-awesome_fa-sign-in_1MYT-:before{content:"\\F090"}.font-awesome_fa-trophy_3CyBM:before{content:"\\F091"}.font-awesome_fa-github-square_1xm6W:before{content:"\\F092"}.font-awesome_fa-upload_wVRel:before{content:"\\F093"}.font-awesome_fa-lemon-o_2v3hR:before{content:"\\F094"}.font-awesome_fa-phone_1EiFR:before{content:"\\F095"}.font-awesome_fa-square-o_WbQ8x:before{content:"\\F096"}.font-awesome_fa-bookmark-o_1R5xe:before{content:"\\F097"}.font-awesome_fa-phone-square_3GkD1:before{content:"\\F098"}.font-awesome_fa-twitter_cyUBg:before{content:"\\F099"}.font-awesome_fa-facebook-f_3r4VF:before,.font-awesome_fa-facebook_f3EUw:before{content:"\\F09A"}.font-awesome_fa-github_MdgBC:before{content:"\\F09B"}.font-awesome_fa-unlock_XTSXp:before{content:"\\F09C"}.font-awesome_fa-credit-card_28S4q:before{content:"\\F09D"}.font-awesome_fa-feed_3tLbf:before,.font-awesome_fa-rss_3_EzS:before{content:"\\F09E"}.font-awesome_fa-hdd-o_3ZoO6:before{content:"\\F0A0"}.font-awesome_fa-bullhorn_3o7hz:before{content:"\\F0A1"}.font-awesome_fa-bell_26AZW:before{content:"\\F0F3"}.font-awesome_fa-certificate_11sLt:before{content:"\\F0A3"}.font-awesome_fa-hand-o-right_2G1w_:before{content:"\\F0A4"}.font-awesome_fa-hand-o-left_2KTOL:before{content:"\\F0A5"}.font-awesome_fa-hand-o-up_3xrkS:before{content:"\\F0A6"}.font-awesome_fa-hand-o-down_3cWAN:before{content:"\\F0A7"}.font-awesome_fa-arrow-circle-left_2CgFw:before{content:"\\F0A8"}.font-awesome_fa-arrow-circle-right_35XcE:before{content:"\\F0A9"}.font-awesome_fa-arrow-circle-up_FHcwE:before{content:"\\F0AA"}.font-awesome_fa-arrow-circle-down_1NJKi:before{content:"\\F0AB"}.font-awesome_fa-globe_2fYFX:before{content:"\\F0AC"}.font-awesome_fa-wrench_3snDo:before{content:"\\F0AD"}.font-awesome_fa-tasks_2_oS8:before{content:"\\F0AE"}.font-awesome_fa-filter_1q5k8:before{content:"\\F0B0"}.font-awesome_fa-briefcase_aikwY:before{content:"\\F0B1"}.font-awesome_fa-arrows-alt_1vqY9:before{content:"\\F0B2"}.font-awesome_fa-group_XbMo9:before,.font-awesome_fa-users_1PfY8:before{content:"\\F0C0"}.font-awesome_fa-chain_2QCgS:before,.font-awesome_fa-link_3kFkN:before{content:"\\F0C1"}.font-awesome_fa-cloud_2l8rd:before{content:"\\F0C2"}.font-awesome_fa-flask_3iTak:before{content:"\\F0C3"}.font-awesome_fa-cut_17wpt:before,.font-awesome_fa-scissors_1xAHX:before{content:"\\F0C4"}.font-awesome_fa-copy_a2GP3:before,.font-awesome_fa-files-o_2pUmI:before{content:"\\F0C5"}.font-awesome_fa-paperclip_d4foW:before{content:"\\F0C6"}.font-awesome_fa-floppy-o_1MBo6:before,.font-awesome_fa-save_10fTV:before{content:"\\F0C7"}.font-awesome_fa-square_N1IJZ:before{content:"\\F0C8"}.font-awesome_fa-bars_3WARK:before,.font-awesome_fa-navicon_3anpJ:before,.font-awesome_fa-reorder_2ukY7:before{content:"\\F0C9"}.font-awesome_fa-list-ul_3s6_2:before{content:"\\F0CA"}.font-awesome_fa-list-ol_AP-DO:before{content:"\\F0CB"}.font-awesome_fa-strikethrough_h0-a_:before{content:"\\F0CC"}.font-awesome_fa-underline_2PIFp:before{content:"\\F0CD"}.font-awesome_fa-table_2mEeT:before{content:"\\F0CE"}.font-awesome_fa-magic_qWQg_:before{content:"\\F0D0"}.font-awesome_fa-truck_1AsFs:before{content:"\\F0D1"}.font-awesome_fa-pinterest_1xKnl:before{content:"\\F0D2"}.font-awesome_fa-pinterest-square_3Yhwf:before{content:"\\F0D3"}.font-awesome_fa-google-plus-square_90VGD:before{content:"\\F0D4"}.font-awesome_fa-google-plus_1Tp-z:before{content:"\\F0D5"}.font-awesome_fa-money_32Lir:before{content:"\\F0D6"}.font-awesome_fa-caret-down_1crEO:before{content:"\\F0D7"}.font-awesome_fa-caret-up_2TwZv:before{content:"\\F0D8"}.font-awesome_fa-caret-left_39lOf:before{content:"\\F0D9"}.font-awesome_fa-caret-right_3p0nW:before{content:"\\F0DA"}.font-awesome_fa-columns_nToc3:before{content:"\\F0DB"}.font-awesome_fa-sort_F3dcY:before,.font-awesome_fa-unsorted_2nhbR:before{content:"\\F0DC"}.font-awesome_fa-sort-desc_3CQ5e:before,.font-awesome_fa-sort-down_3wTbK:before{content:"\\F0DD"}.font-awesome_fa-sort-asc_3MlT5:before,.font-awesome_fa-sort-up_Ad_bv:before{content:"\\F0DE"}.font-awesome_fa-envelope_3xnLD:before{content:"\\F0E0"}.font-awesome_fa-linkedin_25eMJ:before{content:"\\F0E1"}.font-awesome_fa-rotate-left_3mzU5:before,.font-awesome_fa-undo_hNldt:before{content:"\\F0E2"}.font-awesome_fa-gavel_2ttLP:before,.font-awesome_fa-legal_1C_3g:before{content:"\\F0E3"}.font-awesome_fa-dashboard_3bEM7:before,.font-awesome_fa-tachometer_3R5zx:before{content:"\\F0E4"}.font-awesome_fa-comment-o_2pEPg:before{content:"\\F0E5"}.font-awesome_fa-comments-o_hQJKS:before{content:"\\F0E6"}.font-awesome_fa-bolt_3iT3l:before,.font-awesome_fa-flash_1DU_v:before{content:"\\F0E7"}.font-awesome_fa-sitemap_QKmtm:before{content:"\\F0E8"}.font-awesome_fa-umbrella_3fE2k:before{content:"\\F0E9"}.font-awesome_fa-clipboard_1Wx9E:before,.font-awesome_fa-paste_3RUtK:before{content:"\\F0EA"}.font-awesome_fa-lightbulb-o_3MZxy:before{content:"\\F0EB"}.font-awesome_fa-exchange_1cgNj:before{content:"\\F0EC"}.font-awesome_fa-cloud-download_2fd-7:before{content:"\\F0ED"}.font-awesome_fa-cloud-upload_BCKnV:before{content:"\\F0EE"}.font-awesome_fa-user-md_3Unw6:before{content:"\\F0F0"}.font-awesome_fa-stethoscope_3TPjy:before{content:"\\F0F1"}.font-awesome_fa-suitcase_2ZK-F:before{content:"\\F0F2"}.font-awesome_fa-bell-o_3iuFm:before{content:"\\F0A2"}.font-awesome_fa-coffee_2tZxb:before{content:"\\F0F4"}.font-awesome_fa-cutlery_2dZZ2:before{content:"\\F0F5"}.font-awesome_fa-file-text-o_3vkBr:before{content:"\\F0F6"}.font-awesome_fa-building-o_1ML8l:before{content:"\\F0F7"}.font-awesome_fa-hospital-o_2dZPM:before{content:"\\F0F8"}.font-awesome_fa-ambulance_3oMTO:before{content:"\\F0F9"}.font-awesome_fa-medkit_3TuAD:before{content:"\\F0FA"}.font-awesome_fa-fighter-jet_2EPG4:before{content:"\\F0FB"}.font-awesome_fa-beer_25HMG:before{content:"\\F0FC"}.font-awesome_fa-h-square_iRMP3:before{content:"\\F0FD"}.font-awesome_fa-plus-square_28zW8:before{content:"\\F0FE"}.font-awesome_fa-angle-double-left_3Q7bL:before{content:"\\F100"}.font-awesome_fa-angle-double-right_2R24L:before{content:"\\F101"}.font-awesome_fa-angle-double-up_2GMJK:before{content:"\\F102"}.font-awesome_fa-angle-double-down_IlK-a:before{content:"\\F103"}.font-awesome_fa-angle-left_7b-ty:before{content:"\\F104"}.font-awesome_fa-angle-right_RfvDx:before{content:"\\F105"}.font-awesome_fa-angle-up_2xGkU:before{content:"\\F106"}.font-awesome_fa-angle-down_3nIhI:before{content:"\\F107"}.font-awesome_fa-desktop_7pHFF:before{content:"\\F108"}.font-awesome_fa-laptop_2QHxL:before{content:"\\F109"}.font-awesome_fa-tablet_eRAwh:before{content:"\\F10A"}.font-awesome_fa-mobile-phone_3tGZx:before,.font-awesome_fa-mobile_ry_56:before{content:"\\F10B"}.font-awesome_fa-circle-o_We1QB:before{content:"\\F10C"}.font-awesome_fa-quote-left_tgvF3:before{content:"\\F10D"}.font-awesome_fa-quote-right_2LbYu:before{content:"\\F10E"}.font-awesome_fa-spinner_1FgdF:before{content:"\\F110"}.font-awesome_fa-circle_RFG4V:before{content:"\\F111"}.font-awesome_fa-mail-reply_1ovuj:before,.font-awesome_fa-reply_1p4xy:before{content:"\\F112"}.font-awesome_fa-github-alt_PGZGn:before{content:"\\F113"}.font-awesome_fa-folder-o_28LsO:before{content:"\\F114"}.font-awesome_fa-folder-open-o_3Hbbz:before{content:"\\F115"}.font-awesome_fa-smile-o_3R1KH:before{content:"\\F118"}.font-awesome_fa-frown-o_1PJe6:before{content:"\\F119"}.font-awesome_fa-meh-o_1Yal3:before{content:"\\F11A"}.font-awesome_fa-gamepad_DQkX5:before{content:"\\F11B"}.font-awesome_fa-keyboard-o_1Zegg:before{content:"\\F11C"}.font-awesome_fa-flag-o_2paT4:before{content:"\\F11D"}.font-awesome_fa-flag-checkered_3Q50W:before{content:"\\F11E"}.font-awesome_fa-terminal_1y_ce:before{content:"\\F120"}.font-awesome_fa-code_373HL:before{content:"\\F121"}.font-awesome_fa-mail-reply-all_1el1h:before,.font-awesome_fa-reply-all_1XbQQ:before{content:"\\F122"}.font-awesome_fa-star-half-empty_NeM4g:before,.font-awesome_fa-star-half-full_3_GnR:before,.font-awesome_fa-star-half-o_1gMSG:before{content:"\\F123"}.font-awesome_fa-location-arrow_gFy0a:before{content:"\\F124"}.font-awesome_fa-crop_DFePA:before{content:"\\F125"}.font-awesome_fa-code-fork_rNRd0:before{content:"\\F126"}.font-awesome_fa-chain-broken_3nVk7:before,.font-awesome_fa-unlink_1hw62:before{content:"\\F127"}.font-awesome_fa-question_EAoIA:before{content:"\\F128"}.font-awesome_fa-info_2cQvQ:before{content:"\\F129"}.font-awesome_fa-exclamation_297uN:before{content:"\\F12A"}.font-awesome_fa-superscript_N7aMl:before{content:"\\F12B"}.font-awesome_fa-subscript_ZG4gQ:before{content:"\\F12C"}.font-awesome_fa-eraser_3NIuU:before{content:"\\F12D"}.font-awesome_fa-puzzle-piece_3lKWq:before{content:"\\F12E"}.font-awesome_fa-microphone_3_81_:before{content:"\\F130"}.font-awesome_fa-microphone-slash_1DyxC:before{content:"\\F131"}.font-awesome_fa-shield_1qKif:before{content:"\\F132"}.font-awesome_fa-calendar-o_1BLCm:before{content:"\\F133"}.font-awesome_fa-fire-extinguisher_3gz5K:before{content:"\\F134"}.font-awesome_fa-rocket_lfSov:before{content:"\\F135"}.font-awesome_fa-maxcdn_cD6Fn:before{content:"\\F136"}.font-awesome_fa-chevron-circle-left_1aac7:before{content:"\\F137"}.font-awesome_fa-chevron-circle-right_Evj_u:before{content:"\\F138"}.font-awesome_fa-chevron-circle-up_tTcaI:before{content:"\\F139"}.font-awesome_fa-chevron-circle-down_1oKtm:before{content:"\\F13A"}.font-awesome_fa-html5_3LZaq:before{content:"\\F13B"}.font-awesome_fa-css3_3hg4c:before{content:"\\F13C"}.font-awesome_fa-anchor_2-wZ3:before{content:"\\F13D"}.font-awesome_fa-unlock-alt_CLyLU:before{content:"\\F13E"}.font-awesome_fa-bullseye_6Sp1E:before{content:"\\F140"}.font-awesome_fa-ellipsis-h_4VBiE:before{content:"\\F141"}.font-awesome_fa-ellipsis-v_Ktjfe:before{content:"\\F142"}.font-awesome_fa-rss-square_4Vj2y:before{content:"\\F143"}.font-awesome_fa-play-circle_ECzau:before{content:"\\F144"}.font-awesome_fa-ticket_284VQ:before{content:"\\F145"}.font-awesome_fa-minus-square_3w_Do:before{content:"\\F146"}.font-awesome_fa-minus-square-o_qe1Jq:before{content:"\\F147"}.font-awesome_fa-level-up_7RnC1:before{content:"\\F148"}.font-awesome_fa-level-down_1rR4Q:before{content:"\\F149"}.font-awesome_fa-check-square_3Qxfb:before{content:"\\F14A"}.font-awesome_fa-pencil-square_3f_4W:before{content:"\\F14B"}.font-awesome_fa-external-link-square_3TfmM:before{content:"\\F14C"}.font-awesome_fa-share-square_4XEPu:before{content:"\\F14D"}.font-awesome_fa-compass_3kP2n:before{content:"\\F14E"}.font-awesome_fa-caret-square-o-down_1Ao-B:before,.font-awesome_fa-toggle-down_vVDIQ:before{content:"\\F150"}.font-awesome_fa-caret-square-o-up_1Lr5P:before,.font-awesome_fa-toggle-up_1j96l:before{content:"\\F151"}.font-awesome_fa-caret-square-o-right_Jc6ln:before,.font-awesome_fa-toggle-right_391jj:before{content:"\\F152"}.font-awesome_fa-eur_2JOH3:before,.font-awesome_fa-euro_1H752:before{content:"\\F153"}.font-awesome_fa-gbp_sXuSA:before{content:"\\F154"}.font-awesome_fa-dollar_1Qw2b:before,.font-awesome_fa-usd_1Cyf0:before{content:"\\F155"}.font-awesome_fa-inr_2v4ZE:before,.font-awesome_fa-rupee_3EdPr:before{content:"\\F156"}.font-awesome_fa-cny_3RNlL:before,.font-awesome_fa-jpy_CXaPK:before,.font-awesome_fa-rmb_vAGyw:before,.font-awesome_fa-yen_UH2C8:before{content:"\\F157"}.font-awesome_fa-rouble_fwC1R:before,.font-awesome_fa-rub_1c94U:before,.font-awesome_fa-ruble_1ms6_:before{content:"\\F158"}.font-awesome_fa-krw_xc7hv:before,.font-awesome_fa-won_1oqxL:before{content:"\\F159"}.font-awesome_fa-bitcoin_3h17C:before,.font-awesome_fa-btc_2EpsK:before{content:"\\F15A"}.font-awesome_fa-file_2_TBG:before{content:"\\F15B"}.font-awesome_fa-file-text_3uzzE:before{content:"\\F15C"}.font-awesome_fa-sort-alpha-asc_l6x9i:before{content:"\\F15D"}.font-awesome_fa-sort-alpha-desc_Au5Op:before{content:"\\F15E"}.font-awesome_fa-sort-amount-asc_a4pl1:before{content:"\\F160"}.font-awesome_fa-sort-amount-desc_sHYze:before{content:"\\F161"}.font-awesome_fa-sort-numeric-asc_2fl5U:before{content:"\\F162"}.font-awesome_fa-sort-numeric-desc_rZcNd:before{content:"\\F163"}.font-awesome_fa-thumbs-up_32LEl:before{content:"\\F164"}.font-awesome_fa-thumbs-down_115k7:before{content:"\\F165"}.font-awesome_fa-youtube-square_1HADK:before{content:"\\F166"}.font-awesome_fa-youtube_3PHGN:before{content:"\\F167"}.font-awesome_fa-xing_2fXmL:before{content:"\\F168"}.font-awesome_fa-xing-square_3AeWb:before{content:"\\F169"}.font-awesome_fa-youtube-play__uWZW:before{content:"\\F16A"}.font-awesome_fa-dropbox_1i2Rn:before{content:"\\F16B"}.font-awesome_fa-stack-overflow_2tkuN:before{content:"\\F16C"}.font-awesome_fa-instagram_1lV5f:before{content:"\\F16D"}.font-awesome_fa-flickr_3JrtG:before{content:"\\F16E"}.font-awesome_fa-adn_3a2Jf:before{content:"\\F170"}.font-awesome_fa-bitbucket_12Rp4:before{content:"\\F171"}.font-awesome_fa-bitbucket-square_Y0lMx:before{content:"\\F172"}.font-awesome_fa-tumblr_18aB6:before{content:"\\F173"}.font-awesome_fa-tumblr-square_3m4ld:before{content:"\\F174"}.font-awesome_fa-long-arrow-down_2His0:before{content:"\\F175"}.font-awesome_fa-long-arrow-up_vP_4l:before{content:"\\F176"}.font-awesome_fa-long-arrow-left_1Uldc:before{content:"\\F177"}.font-awesome_fa-long-arrow-right_1_jZV:before{content:"\\F178"}.font-awesome_fa-apple_3f0-D:before{content:"\\F179"}.font-awesome_fa-windows_2wDfa:before{content:"\\F17A"}.font-awesome_fa-android_1Wzt9:before{content:"\\F17B"}.font-awesome_fa-linux_3TBYa:before{content:"\\F17C"}.font-awesome_fa-dribbble_IliEV:before{content:"\\F17D"}.font-awesome_fa-skype_7ne23:before{content:"\\F17E"}.font-awesome_fa-foursquare_52T_Z:before{content:"\\F180"}.font-awesome_fa-trello_2ChtW:before{content:"\\F181"}.font-awesome_fa-female_q-oMT:before{content:"\\F182"}.font-awesome_fa-male_2PAqV:before{content:"\\F183"}.font-awesome_fa-gittip_2fxKq:before,.font-awesome_fa-gratipay_xLz4x:before{content:"\\F184"}.font-awesome_fa-sun-o_3QZ1O:before{content:"\\F185"}.font-awesome_fa-moon-o_ZwK6C:before{content:"\\F186"}.font-awesome_fa-archive_3FY1-:before{content:"\\F187"}.font-awesome_fa-bug_20yJn:before{content:"\\F188"}.font-awesome_fa-vk_1SLN3:before{content:"\\F189"}.font-awesome_fa-weibo_3q9BS:before{content:"\\F18A"}.font-awesome_fa-renren_27Rtg:before{content:"\\F18B"}.font-awesome_fa-pagelines_3FZd_:before{content:"\\F18C"}.font-awesome_fa-stack-exchange_1BbmA:before{content:"\\F18D"}.font-awesome_fa-arrow-circle-o-right_1lS0I:before{content:"\\F18E"}.font-awesome_fa-arrow-circle-o-left_270k0:before{content:"\\F190"}.font-awesome_fa-caret-square-o-left_3leFq:before,.font-awesome_fa-toggle-left_q8rS1:before{content:"\\F191"}.font-awesome_fa-dot-circle-o_fRUKP:before{content:"\\F192"}.font-awesome_fa-wheelchair_2sPWn:before{content:"\\F193"}.font-awesome_fa-vimeo-square_1nIhm:before{content:"\\F194"}.font-awesome_fa-try_1Olkg:before,.font-awesome_fa-turkish-lira_1bCbG:before{content:"\\F195"}.font-awesome_fa-plus-square-o_M6pBY:before{content:"\\F196"}.font-awesome_fa-space-shuttle_9kmJU:before{content:"\\F197"}.font-awesome_fa-slack_1EvN7:before{content:"\\F198"}.font-awesome_fa-envelope-square_3aqlc:before{content:"\\F199"}.font-awesome_fa-wordpress_2u9e0:before{content:"\\F19A"}.font-awesome_fa-openid_2QLde:before{content:"\\F19B"}.font-awesome_fa-bank_D8hxY:before,.font-awesome_fa-institution_2uHKo:before,.font-awesome_fa-university_3ECjv:before{content:"\\F19C"}.font-awesome_fa-graduation-cap_Y0mMc:before,.font-awesome_fa-mortar-board_1em7v:before{content:"\\F19D"}.font-awesome_fa-yahoo_33B-N:before{content:"\\F19E"}.font-awesome_fa-google_1QYVJ:before{content:"\\F1A0"}.font-awesome_fa-reddit_bwA4E:before{content:"\\F1A1"}.font-awesome_fa-reddit-square_3rRiq:before{content:"\\F1A2"}.font-awesome_fa-stumbleupon-circle_1TPid:before{content:"\\F1A3"}.font-awesome_fa-stumbleupon_14d1U:before{content:"\\F1A4"}.font-awesome_fa-delicious_3rkRQ:before{content:"\\F1A5"}.font-awesome_fa-digg_3bIOw:before{content:"\\F1A6"}.font-awesome_fa-pied-piper_1iXBb:before{content:"\\F1A7"}.font-awesome_fa-pied-piper-alt_3UjUa:before{content:"\\F1A8"}.font-awesome_fa-drupal_WQObj:before{content:"\\F1A9"}.font-awesome_fa-joomla_2UQVh:before{content:"\\F1AA"}.font-awesome_fa-language_DOnO2:before{content:"\\F1AB"}.font-awesome_fa-fax_1SV_d:before{content:"\\F1AC"}.font-awesome_fa-building_1FVgz:before{content:"\\F1AD"}.font-awesome_fa-child_2gTU4:before{content:"\\F1AE"}.font-awesome_fa-paw_NcsFR:before{content:"\\F1B0"}.font-awesome_fa-spoon_IxNyL:before{content:"\\F1B1"}.font-awesome_fa-cube_1Mq1-:before{content:"\\F1B2"}.font-awesome_fa-cubes_1tGnD:before{content:"\\F1B3"}.font-awesome_fa-behance_3mdMe:before{content:"\\F1B4"}.font-awesome_fa-behance-square_5ghK4:before{content:"\\F1B5"}.font-awesome_fa-steam_RIwxM:before{content:"\\F1B6"}.font-awesome_fa-steam-square_2QEJn:before{content:"\\F1B7"}.font-awesome_fa-recycle_-U8tZ:before{content:"\\F1B8"}.font-awesome_fa-automobile_3z3Dw:before,.font-awesome_fa-car_30pca:before{content:"\\F1B9"}.font-awesome_fa-cab_DDNE1:before,.font-awesome_fa-taxi_22WsM:before{content:"\\F1BA"}.font-awesome_fa-tree_3RDTB:before{content:"\\F1BB"}.font-awesome_fa-spotify_3UDVW:before{content:"\\F1BC"}.font-awesome_fa-deviantart_2ZxWy:before{content:"\\F1BD"}.font-awesome_fa-soundcloud_2ALXb:before{content:"\\F1BE"}.font-awesome_fa-database_1lI0N:before{content:"\\F1C0"}.font-awesome_fa-file-pdf-o_3kglo:before{content:"\\F1C1"}.font-awesome_fa-file-word-o_1UetZ:before{content:"\\F1C2"}.font-awesome_fa-file-excel-o_A4QBn:before{content:"\\F1C3"}.font-awesome_fa-file-powerpoint-o_rrLjs:before{content:"\\F1C4"}.font-awesome_fa-file-image-o_2lPT_:before,.font-awesome_fa-file-photo-o_2UoDO:before,.font-awesome_fa-file-picture-o_3Xjli:before{content:"\\F1C5"}.font-awesome_fa-file-archive-o_2Mk5P:before,.font-awesome_fa-file-zip-o_2FWRa:before{content:"\\F1C6"}.font-awesome_fa-file-audio-o_2PC2o:before,.font-awesome_fa-file-sound-o_1AcTq:before{content:"\\F1C7"}.font-awesome_fa-file-movie-o_VAP4m:before,.font-awesome_fa-file-video-o_34mPw:before{content:"\\F1C8"}.font-awesome_fa-file-code-o_1tJvu:before{content:"\\F1C9"}.font-awesome_fa-vine_26AR6:before{content:"\\F1CA"}.font-awesome_fa-codepen_2F2Jy:before{content:"\\F1CB"}.font-awesome_fa-jsfiddle_pH8-y:before{content:"\\F1CC"}.font-awesome_fa-life-bouy_3M9kq:before,.font-awesome_fa-life-buoy_-dMf6:before,.font-awesome_fa-life-ring_1x6lZ:before,.font-awesome_fa-life-saver_1NRqc:before,.font-awesome_fa-support_6Q01X:before{content:"\\F1CD"}.font-awesome_fa-circle-o-notch_cWGUO:before{content:"\\F1CE"}.font-awesome_fa-ra_2liTj:before,.font-awesome_fa-rebel_2UIOr:before{content:"\\F1D0"}.font-awesome_fa-empire_3Sw8V:before,.font-awesome_fa-ge_1f9_K:before{content:"\\F1D1"}.font-awesome_fa-git-square_DgHwD:before{content:"\\F1D2"}.font-awesome_fa-git_1dhi0:before{content:"\\F1D3"}.font-awesome_fa-hacker-news_CxkYC:before,.font-awesome_fa-y-combinator-square_lfSlT:before,.font-awesome_fa-yc-square_1Qf2g:before{content:"\\F1D4"}.font-awesome_fa-tencent-weibo_2-fdG:before{content:"\\F1D5"}.font-awesome_fa-qq_1OIck:before{content:"\\F1D6"}.font-awesome_fa-wechat_7Wqz8:before,.font-awesome_fa-weixin_2rvXg:before{content:"\\F1D7"}.font-awesome_fa-paper-plane_1JBzT:before,.font-awesome_fa-send_1PHOy:before{content:"\\F1D8"}.font-awesome_fa-paper-plane-o_Am7EP:before,.font-awesome_fa-send-o_1K3Am:before{content:"\\F1D9"}.font-awesome_fa-history_xEiAH:before{content:"\\F1DA"}.font-awesome_fa-circle-thin_OCNZt:before{content:"\\F1DB"}.font-awesome_fa-header_hMELn:before{content:"\\F1DC"}.font-awesome_fa-paragraph_2r_mD:before{content:"\\F1DD"}.font-awesome_fa-sliders_3eRoo:before{content:"\\F1DE"}.font-awesome_fa-share-alt_3jAY7:before{content:"\\F1E0"}.font-awesome_fa-share-alt-square_46dVM:before{content:"\\F1E1"}.font-awesome_fa-bomb_1WRhh:before{content:"\\F1E2"}.font-awesome_fa-futbol-o_Nqzpi:before,.font-awesome_fa-soccer-ball-o_3rmya:before{content:"\\F1E3"}.font-awesome_fa-tty_3BPj2:before{content:"\\F1E4"}.font-awesome_fa-binoculars_1vG29:before{content:"\\F1E5"}.font-awesome_fa-plug_1Lbxt:before{content:"\\F1E6"}.font-awesome_fa-slideshare_15ZAf:before{content:"\\F1E7"}.font-awesome_fa-twitch_MNLu3:before{content:"\\F1E8"}.font-awesome_fa-yelp_1c1W7:before{content:"\\F1E9"}.font-awesome_fa-newspaper-o_1ecUe:before{content:"\\F1EA"}.font-awesome_fa-wifi_dQ61U:before{content:"\\F1EB"}.font-awesome_fa-calculator_2q6GV:before{content:"\\F1EC"}.font-awesome_fa-paypal_3lmxL:before{content:"\\F1ED"}.font-awesome_fa-google-wallet_2K_aw:before{content:"\\F1EE"}.font-awesome_fa-cc-visa_2F8r8:before{content:"\\F1F0"}.font-awesome_fa-cc-mastercard_T8WQ_:before{content:"\\F1F1"}.font-awesome_fa-cc-discover_2QXm7:before{content:"\\F1F2"}.font-awesome_fa-cc-amex_2w-j8:before{content:"\\F1F3"}.font-awesome_fa-cc-paypal_gr0Zj:before{content:"\\F1F4"}.font-awesome_fa-cc-stripe_5ubxJ:before{content:"\\F1F5"}.font-awesome_fa-bell-slash_PIYu4:before{content:"\\F1F6"}.font-awesome_fa-bell-slash-o_PTM9c:before{content:"\\F1F7"}.font-awesome_fa-trash_-YVpH:before{content:"\\F1F8"}.font-awesome_fa-copyright_3Cj5D:before{content:"\\F1F9"}.font-awesome_fa-at_b7Ql8:before{content:"\\F1FA"}.font-awesome_fa-eyedropper_1rpAm:before{content:"\\F1FB"}.font-awesome_fa-paint-brush_3SJFh:before{content:"\\F1FC"}.font-awesome_fa-birthday-cake_-17FP:before{content:"\\F1FD"}.font-awesome_fa-area-chart_1fTy1:before{content:"\\F1FE"}.font-awesome_fa-pie-chart_2TXFj:before{content:"\\F200"}.font-awesome_fa-line-chart_20bFd:before{content:"\\F201"}.font-awesome_fa-lastfm_3sP7Z:before{content:"\\F202"}.font-awesome_fa-lastfm-square_3OBza:before{content:"\\F203"}.font-awesome_fa-toggle-off_2TP0s:before{content:"\\F204"}.font-awesome_fa-toggle-on_1ud4K:before{content:"\\F205"}.font-awesome_fa-bicycle_r_nn3:before{content:"\\F206"}.font-awesome_fa-bus_bm6kq:before{content:"\\F207"}.font-awesome_fa-ioxhost_yWiPs:before{content:"\\F208"}.font-awesome_fa-angellist_14KNT:before{content:"\\F209"}.font-awesome_fa-cc_VsUyp:before{content:"\\F20A"}.font-awesome_fa-ils_CYDSg:before,.font-awesome_fa-shekel_3RcTu:before,.font-awesome_fa-sheqel_2_Sde:before{content:"\\F20B"}.font-awesome_fa-meanpath_8Utkv:before{content:"\\F20C"}.font-awesome_fa-buysellads_3DmVj:before{content:"\\F20D"}.font-awesome_fa-connectdevelop_24BDl:before{content:"\\F20E"}.font-awesome_fa-dashcube_3gytt:before{content:"\\F210"}.font-awesome_fa-forumbee_1Xmr9:before{content:"\\F211"}.font-awesome_fa-leanpub_1qDwq:before{content:"\\F212"}.font-awesome_fa-sellsy_w39BK:before{content:"\\F213"}.font-awesome_fa-shirtsinbulk_3ht1E:before{content:"\\F214"}.font-awesome_fa-simplybuilt_1V2xv:before{content:"\\F215"}.font-awesome_fa-skyatlas_1HFEf:before{content:"\\F216"}.font-awesome_fa-cart-plus_zqpg9:before{content:"\\F217"}.font-awesome_fa-cart-arrow-down_vmvAL:before{content:"\\F218"}.font-awesome_fa-diamond_2YKSj:before{content:"\\F219"}.font-awesome_fa-ship_2d0Uf:before{content:"\\F21A"}.font-awesome_fa-user-secret_1JgJF:before{content:"\\F21B"}.font-awesome_fa-motorcycle_hAqgH:before{content:"\\F21C"}.font-awesome_fa-street-view_3xS1E:before{content:"\\F21D"}.font-awesome_fa-heartbeat_3SRsO:before{content:"\\F21E"}.font-awesome_fa-venus_3jRFX:before{content:"\\F221"}.font-awesome_fa-mars_2Le0W:before{content:"\\F222"}.font-awesome_fa-mercury_3-x4u:before{content:"\\F223"}.font-awesome_fa-intersex_26r-R:before,.font-awesome_fa-transgender_1hS0T:before{content:"\\F224"}.font-awesome_fa-transgender-alt_3_fBb:before{content:"\\F225"}.font-awesome_fa-venus-double_30rPd:before{content:"\\F226"}.font-awesome_fa-mars-double_3Xnoh:before{content:"\\F227"}.font-awesome_fa-venus-mars_2Ptfg:before{content:"\\F228"}.font-awesome_fa-mars-stroke_f9_Cu:before{content:"\\F229"}.font-awesome_fa-mars-stroke-v_1K5K9:before{content:"\\F22A"}.font-awesome_fa-mars-stroke-h_3azEl:before{content:"\\F22B"}.font-awesome_fa-neuter_1wUaY:before{content:"\\F22C"}.font-awesome_fa-genderless_3mEtZ:before{content:"\\F22D"}.font-awesome_fa-facebook-official_2NNdf:before{content:"\\F230"}.font-awesome_fa-pinterest-p_1Xpu_:before{content:"\\F231"}.font-awesome_fa-whatsapp_3G2qZ:before{content:"\\F232"}.font-awesome_fa-server_NVGtN:before{content:"\\F233"}.font-awesome_fa-user-plus_1UACc:before{content:"\\F234"}.font-awesome_fa-user-times_24FFx:before{content:"\\F235"}.font-awesome_fa-bed_1XbLs:before,.font-awesome_fa-hotel_3W6s_:before{content:"\\F236"}.font-awesome_fa-viacoin_3b4Ln:before{content:"\\F237"}.font-awesome_fa-train_2mIFj:before{content:"\\F238"}.font-awesome_fa-subway_mahNW:before{content:"\\F239"}.font-awesome_fa-medium_2UIgR:before{content:"\\F23A"}.font-awesome_fa-y-combinator_l4_A9:before,.font-awesome_fa-yc_2pwL9:before{content:"\\F23B"}.font-awesome_fa-optin-monster_2Vo1M:before{content:"\\F23C"}.font-awesome_fa-opencart_2P3qK:before{content:"\\F23D"}.font-awesome_fa-expeditedssl_1ay3x:before{content:"\\F23E"}.font-awesome_fa-battery-4_1qRp1:before,.font-awesome_fa-battery-full_2fsqT:before{content:"\\F240"}.font-awesome_fa-battery-3_3WHzS:before,.font-awesome_fa-battery-three-quarters_dBjV8:before{content:"\\F241"}.font-awesome_fa-battery-2_2Pgt2:before,.font-awesome_fa-battery-half_2taE9:before{content:"\\F242"}.font-awesome_fa-battery-1_1R1Ww:before,.font-awesome_fa-battery-quarter_1sRcE:before{content:"\\F243"}.font-awesome_fa-battery-0_1zrhu:before,.font-awesome_fa-battery-empty_2Mn-c:before{content:"\\F244"}.font-awesome_fa-mouse-pointer_DbB5u:before{content:"\\F245"}.font-awesome_fa-i-cursor_xvyzh:before{content:"\\F246"}.font-awesome_fa-object-group_3K3tV:before{content:"\\F247"}.font-awesome_fa-object-ungroup_1ylE-:before{content:"\\F248"}.font-awesome_fa-sticky-note_1dK3l:before{content:"\\F249"}.font-awesome_fa-sticky-note-o_2zvyB:before{content:"\\F24A"}.font-awesome_fa-cc-jcb_Q7v9N:before{content:"\\F24B"}.font-awesome_fa-cc-diners-club_338EC:before{content:"\\F24C"}.font-awesome_fa-clone_2LPS7:before{content:"\\F24D"}.font-awesome_fa-balance-scale_3o2it:before{content:"\\F24E"}.font-awesome_fa-hourglass-o_15XJL:before{content:"\\F250"}.font-awesome_fa-hourglass-1_2iRUs:before,.font-awesome_fa-hourglass-start_qhpOV:before{content:"\\F251"}.font-awesome_fa-hourglass-2_2V0b5:before,.font-awesome_fa-hourglass-half_cF0Po:before{content:"\\F252"}.font-awesome_fa-hourglass-3_2-ugV:before,.font-awesome_fa-hourglass-end_3l-g6:before{content:"\\F253"}.font-awesome_fa-hourglass_1Ar7q:before{content:"\\F254"}.font-awesome_fa-hand-grab-o_3I7_Y:before,.font-awesome_fa-hand-rock-o_1Tb8S:before{content:"\\F255"}.font-awesome_fa-hand-paper-o_2dp3p:before,.font-awesome_fa-hand-stop-o_37eq3:before{content:"\\F256"}.font-awesome_fa-hand-scissors-o_tLXdy:before{content:"\\F257"}.font-awesome_fa-hand-lizard-o_2afn0:before{content:"\\F258"}.font-awesome_fa-hand-spock-o_22lUn:before{content:"\\F259"}.font-awesome_fa-hand-pointer-o_3EDBr:before{content:"\\F25A"}.font-awesome_fa-hand-peace-o_3KVDU:before{content:"\\F25B"}.font-awesome_fa-trademark_1pZSQ:before{content:"\\F25C"}.font-awesome_fa-registered_2bkiQ:before{content:"\\F25D"}.font-awesome_fa-creative-commons_19SOu:before{content:"\\F25E"}.font-awesome_fa-gg_8EwZk:before{content:"\\F260"}.font-awesome_fa-gg-circle_ixSHX:before{content:"\\F261"}.font-awesome_fa-tripadvisor_3SR4I:before{content:"\\F262"}.font-awesome_fa-odnoklassniki_18Bc_:before{content:"\\F263"}.font-awesome_fa-odnoklassniki-square_2tvme:before{content:"\\F264"}.font-awesome_fa-get-pocket_1kDeB:before{content:"\\F265"}.font-awesome_fa-wikipedia-w_2bnVT:before{content:"\\F266"}.font-awesome_fa-safari_1d_gp:before{content:"\\F267"}.font-awesome_fa-chrome_2lYJX:before{content:"\\F268"}.font-awesome_fa-firefox_3G1uV:before{content:"\\F269"}.font-awesome_fa-opera_2EABz:before{content:"\\F26A"}.font-awesome_fa-internet-explorer_2e6T2:before{content:"\\F26B"}.font-awesome_fa-television_1MplB:before,.font-awesome_fa-tv_pyAzy:before{content:"\\F26C"}.font-awesome_fa-contao_1BTJ5:before{content:"\\F26D"}.font-awesome_fa-500px_2dpFP:before{content:"\\F26E"}.font-awesome_fa-amazon_1J6OF:before{content:"\\F270"}.font-awesome_fa-calendar-plus-o_up6cZ:before{content:"\\F271"}.font-awesome_fa-calendar-minus-o_2wY7J:before{content:"\\F272"}.font-awesome_fa-calendar-times-o_1jaLQ:before{content:"\\F273"}.font-awesome_fa-calendar-check-o_3xoZC:before{content:"\\F274"}.font-awesome_fa-industry_3LSV8:before{content:"\\F275"}.font-awesome_fa-map-pin_1mpnW:before{content:"\\F276"}.font-awesome_fa-map-signs_21LXb:before{content:"\\F277"}.font-awesome_fa-map-o_1CDpd:before{content:"\\F278"}.font-awesome_fa-map_18QCe:before{content:"\\F279"}.font-awesome_fa-commenting_2oYYM:before{content:"\\F27A"}.font-awesome_fa-commenting-o_2BRal:before{content:"\\F27B"}.font-awesome_fa-houzz_13-hb:before{content:"\\F27C"}.font-awesome_fa-vimeo_3vcPv:before{content:"\\F27D"}.font-awesome_fa-black-tie_34h9B:before{content:"\\F27E"}.font-awesome_fa-fonticons_aNgtF:before{content:"\\F280"}.font-awesome_fa-reddit-alien_3f_aH:before{content:"\\F281"}.font-awesome_fa-edge_3UUWF:before{content:"\\F282"}.font-awesome_fa-credit-card-alt_oOWN1:before{content:"\\F283"}.font-awesome_fa-codiepie_2amwQ:before{content:"\\F284"}.font-awesome_fa-modx__HnMH:before{content:"\\F285"}.font-awesome_fa-fort-awesome_1Pxvs:before{content:"\\F286"}.font-awesome_fa-usb_2-FsD:before{content:"\\F287"}.font-awesome_fa-product-hunt_3WqRr:before{content:"\\F288"}.font-awesome_fa-mixcloud_2e01G:before{content:"\\F289"}.font-awesome_fa-scribd_1bAIo:before{content:"\\F28A"}.font-awesome_fa-pause-circle_3wI6c:before{content:"\\F28B"}.font-awesome_fa-pause-circle-o_2MdRS:before{content:"\\F28C"}.font-awesome_fa-stop-circle_3aZ6V:before{content:"\\F28D"}.font-awesome_fa-stop-circle-o_2oIr6:before{content:"\\F28E"}.font-awesome_fa-shopping-bag_2mD0w:before{content:"\\F290"}.font-awesome_fa-shopping-basket_2ZYTJ:before{content:"\\F291"}.font-awesome_fa-hashtag_1sHh4:before{content:"\\F292"}.font-awesome_fa-bluetooth_1tJ1-:before{content:"\\F293"}.font-awesome_fa-bluetooth-b_LmWTh:before{content:"\\F294"}.font-awesome_fa-percent_3jbSX:before{content:"\\F295"}',""]), -t.locals={fa:"font-awesome_fa_2otTb","fa-lg":"font-awesome_fa-lg_2-2uP","fa-2x":"font-awesome_fa-2x_2Mgjx","fa-3x":"font-awesome_fa-3x_1gdsS","fa-4x":"font-awesome_fa-4x_2VkGW","fa-5x":"font-awesome_fa-5x_QKikc","fa-fw":"font-awesome_fa-fw_1FdA5","fa-ul":"font-awesome_fa-ul_2XTDQ","fa-li":"font-awesome_fa-li_1vepp","fa-border":"font-awesome_fa-border_6EUMg","fa-pull-left":"font-awesome_fa-pull-left_3jHfw","fa-pull-right":"font-awesome_fa-pull-right_20ZAt","pull-right":"font-awesome_pull-right_1Mb60","pull-left":"font-awesome_pull-left_30vXl","fa-spin":"font-awesome_fa-spin_NsqCr","fa-pulse":"font-awesome_fa-pulse_1Vv2f","fa-rotate-90":"font-awesome_fa-rotate-90_1snKw","fa-rotate-180":"font-awesome_fa-rotate-180_2hMM8","fa-rotate-270":"font-awesome_fa-rotate-270_3eBDG","fa-flip-horizontal":"font-awesome_fa-flip-horizontal_33SUC","fa-flip-vertical":"font-awesome_fa-flip-vertical_klOOu","fa-stack":"font-awesome_fa-stack_3fqsM","fa-stack-1x":"font-awesome_fa-stack-1x_14Vb0","fa-stack-2x":"font-awesome_fa-stack-2x_It5yP","fa-inverse":"font-awesome_fa-inverse_1e1EX","fa-glass":"font-awesome_fa-glass_34uit","fa-music":"font-awesome_fa-music_3f2s5","fa-search":"font-awesome_fa-search_1C7GK","fa-envelope-o":"font-awesome_fa-envelope-o_3EWEI","fa-heart":"font-awesome_fa-heart_3DHYT","fa-star":"font-awesome_fa-star_2g4Ye","fa-star-o":"font-awesome_fa-star-o_3ty_o","fa-user":"font-awesome_fa-user_N3puO","fa-film":"font-awesome_fa-film_2qmKe","fa-th-large":"font-awesome_fa-th-large_2N4P8","fa-th":"font-awesome_fa-th_3f0mR","fa-th-list":"font-awesome_fa-th-list_3qelJ","fa-check":"font-awesome_fa-check_3DXVm","fa-remove":"font-awesome_fa-remove_1MIYz","fa-close":"font-awesome_fa-close_1zysR","fa-times":"font-awesome_fa-times_1Y-Cs","fa-search-plus":"font-awesome_fa-search-plus_9OGuc","fa-search-minus":"font-awesome_fa-search-minus_1j_Aj","fa-power-off":"font-awesome_fa-power-off_vPefe","fa-signal":"font-awesome_fa-signal_1VxWh","fa-gear":"font-awesome_fa-gear_yfzjv","fa-cog":"font-awesome_fa-cog_30mdw","fa-trash-o":"font-awesome_fa-trash-o_2uFKh","fa-home":"font-awesome_fa-home_3Fr6e","fa-file-o":"font-awesome_fa-file-o_208AJ","fa-clock-o":"font-awesome_fa-clock-o_3vfig","fa-road":"font-awesome_fa-road_2017v","fa-download":"font-awesome_fa-download_1TDS9","fa-arrow-circle-o-down":"font-awesome_fa-arrow-circle-o-down_2M97h","fa-arrow-circle-o-up":"font-awesome_fa-arrow-circle-o-up_2aqY-","fa-inbox":"font-awesome_fa-inbox_3bWnM","fa-play-circle-o":"font-awesome_fa-play-circle-o_3vU6r","fa-rotate-right":"font-awesome_fa-rotate-right_1E_3J","fa-repeat":"font-awesome_fa-repeat_27E0b","fa-refresh":"font-awesome_fa-refresh_2AOlD","fa-list-alt":"font-awesome_fa-list-alt_3nS4v","fa-lock":"font-awesome_fa-lock_inyGT","fa-flag":"font-awesome_fa-flag_1qWlx","fa-headphones":"font-awesome_fa-headphones_13olw","fa-volume-off":"font-awesome_fa-volume-off_1llC2","fa-volume-down":"font-awesome_fa-volume-down_1jTgZ","fa-volume-up":"font-awesome_fa-volume-up_2XIXx","fa-qrcode":"font-awesome_fa-qrcode_17ZaI","fa-barcode":"font-awesome_fa-barcode_1al4-","fa-tag":"font-awesome_fa-tag_2CMhy","fa-tags":"font-awesome_fa-tags_3kYb4","fa-book":"font-awesome_fa-book_32JVT","fa-bookmark":"font-awesome_fa-bookmark_1s2Fl","fa-print":"font-awesome_fa-print_y2Ezw","fa-camera":"font-awesome_fa-camera_Ls8dv","fa-font":"font-awesome_fa-font_1VH0X","fa-bold":"font-awesome_fa-bold_11qyx","fa-italic":"font-awesome_fa-italic_1Gtc3","fa-text-height":"font-awesome_fa-text-height_3db67","fa-text-width":"font-awesome_fa-text-width_2yBeb","fa-align-left":"font-awesome_fa-align-left_3DuVK","fa-align-center":"font-awesome_fa-align-center_M9xyY","fa-align-right":"font-awesome_fa-align-right_3Icru","fa-align-justify":"font-awesome_fa-align-justify_maoNA","fa-list":"font-awesome_fa-list_3CT1m","fa-dedent":"font-awesome_fa-dedent_3p5N-","fa-outdent":"font-awesome_fa-outdent_34S6p","fa-indent":"font-awesome_fa-indent_2Y6xl","fa-video-camera":"font-awesome_fa-video-camera_2Tfna","fa-photo":"font-awesome_fa-photo_2f_lI","fa-image":"font-awesome_fa-image_l6mTT","fa-picture-o":"font-awesome_fa-picture-o_3srts","fa-pencil":"font-awesome_fa-pencil_3o0Fh","fa-map-marker":"font-awesome_fa-map-marker_1Lc7q","fa-adjust":"font-awesome_fa-adjust_1uk96","fa-tint":"font-awesome_fa-tint_23wIx","fa-edit":"font-awesome_fa-edit_2ITK3","fa-pencil-square-o":"font-awesome_fa-pencil-square-o_1jFx_","fa-share-square-o":"font-awesome_fa-share-square-o_1bC_y","fa-check-square-o":"font-awesome_fa-check-square-o_2eIdJ","fa-arrows":"font-awesome_fa-arrows_2tovc","fa-step-backward":"font-awesome_fa-step-backward_1aJ3J","fa-fast-backward":"font-awesome_fa-fast-backward_rW1JQ","fa-backward":"font-awesome_fa-backward_WWKjR","fa-play":"font-awesome_fa-play_1vQTN","fa-pause":"font-awesome_fa-pause_33hRm","fa-stop":"font-awesome_fa-stop_1l1v_","fa-forward":"font-awesome_fa-forward_3jJNW","fa-fast-forward":"font-awesome_fa-fast-forward_2JwE2","fa-step-forward":"font-awesome_fa-step-forward_3NyZe","fa-eject":"font-awesome_fa-eject_GA_Jm","fa-chevron-left":"font-awesome_fa-chevron-left_1EwAm","fa-chevron-right":"font-awesome_fa-chevron-right_3RxN_","fa-plus-circle":"font-awesome_fa-plus-circle_1SAMg","fa-minus-circle":"font-awesome_fa-minus-circle_Th8wG","fa-times-circle":"font-awesome_fa-times-circle_JfW7D","fa-check-circle":"font-awesome_fa-check-circle_PBRDH","fa-question-circle":"font-awesome_fa-question-circle_33ykP","fa-info-circle":"font-awesome_fa-info-circle_2ZdWr","fa-crosshairs":"font-awesome_fa-crosshairs_18oYo","fa-times-circle-o":"font-awesome_fa-times-circle-o_3LLKK","fa-check-circle-o":"font-awesome_fa-check-circle-o_1CW2E","fa-ban":"font-awesome_fa-ban_1LOdy","fa-arrow-left":"font-awesome_fa-arrow-left_2G_P0","fa-arrow-right":"font-awesome_fa-arrow-right_15DTA","fa-arrow-up":"font-awesome_fa-arrow-up_12gpU","fa-arrow-down":"font-awesome_fa-arrow-down_2zqoH","fa-mail-forward":"font-awesome_fa-mail-forward_2tQrw","fa-share":"font-awesome_fa-share_3O8Dc","fa-expand":"font-awesome_fa-expand_34Ihf","fa-compress":"font-awesome_fa-compress_1JDdS","fa-plus":"font-awesome_fa-plus_WEb-k","fa-minus":"font-awesome_fa-minus_1WAd4","fa-asterisk":"font-awesome_fa-asterisk_w7w6r","fa-exclamation-circle":"font-awesome_fa-exclamation-circle_2bbrU","fa-gift":"font-awesome_fa-gift_3bKvI","fa-leaf":"font-awesome_fa-leaf_2B5Uf","fa-fire":"font-awesome_fa-fire_1qsDr","fa-eye":"font-awesome_fa-eye_3XRn0","fa-eye-slash":"font-awesome_fa-eye-slash_18NEx","fa-warning":"font-awesome_fa-warning_32nGg","fa-exclamation-triangle":"font-awesome_fa-exclamation-triangle_ttuT-","fa-plane":"font-awesome_fa-plane_3L5mD","fa-calendar":"font-awesome_fa-calendar_1niuw","fa-random":"font-awesome_fa-random_2RH42","fa-comment":"font-awesome_fa-comment_2koYW","fa-magnet":"font-awesome_fa-magnet_33k7m","fa-chevron-up":"font-awesome_fa-chevron-up_2R5R_","fa-chevron-down":"font-awesome_fa-chevron-down_746nC","fa-retweet":"font-awesome_fa-retweet_2ma5b","fa-shopping-cart":"font-awesome_fa-shopping-cart_276KU","fa-folder":"font-awesome_fa-folder_2MMW6","fa-folder-open":"font-awesome_fa-folder-open_1a3bX","fa-arrows-v":"font-awesome_fa-arrows-v_27J04","fa-arrows-h":"font-awesome_fa-arrows-h_3EAQ6","fa-bar-chart-o":"font-awesome_fa-bar-chart-o_BMSPQ","fa-bar-chart":"font-awesome_fa-bar-chart_3LGib","fa-twitter-square":"font-awesome_fa-twitter-square_146CY","fa-facebook-square":"font-awesome_fa-facebook-square_3IbRT","fa-camera-retro":"font-awesome_fa-camera-retro_oM_mn","fa-key":"font-awesome_fa-key_3bV7M","fa-gears":"font-awesome_fa-gears_3cjY1","fa-cogs":"font-awesome_fa-cogs_CqXH5","fa-comments":"font-awesome_fa-comments_2lUtO","fa-thumbs-o-up":"font-awesome_fa-thumbs-o-up_3cD9j","fa-thumbs-o-down":"font-awesome_fa-thumbs-o-down_3AeCO","fa-star-half":"font-awesome_fa-star-half_2zxdp","fa-heart-o":"font-awesome_fa-heart-o_QI-Zl","fa-sign-out":"font-awesome_fa-sign-out_2IOU5","fa-linkedin-square":"font-awesome_fa-linkedin-square_3HkV4","fa-thumb-tack":"font-awesome_fa-thumb-tack_2gcw0","fa-external-link":"font-awesome_fa-external-link_1ku_O","fa-sign-in":"font-awesome_fa-sign-in_1MYT-","fa-trophy":"font-awesome_fa-trophy_3CyBM","fa-github-square":"font-awesome_fa-github-square_1xm6W","fa-upload":"font-awesome_fa-upload_wVRel","fa-lemon-o":"font-awesome_fa-lemon-o_2v3hR","fa-phone":"font-awesome_fa-phone_1EiFR","fa-square-o":"font-awesome_fa-square-o_WbQ8x","fa-bookmark-o":"font-awesome_fa-bookmark-o_1R5xe","fa-phone-square":"font-awesome_fa-phone-square_3GkD1","fa-twitter":"font-awesome_fa-twitter_cyUBg","fa-facebook-f":"font-awesome_fa-facebook-f_3r4VF","fa-facebook":"font-awesome_fa-facebook_f3EUw","fa-github":"font-awesome_fa-github_MdgBC","fa-unlock":"font-awesome_fa-unlock_XTSXp","fa-credit-card":"font-awesome_fa-credit-card_28S4q","fa-feed":"font-awesome_fa-feed_3tLbf","fa-rss":"font-awesome_fa-rss_3_EzS","fa-hdd-o":"font-awesome_fa-hdd-o_3ZoO6","fa-bullhorn":"font-awesome_fa-bullhorn_3o7hz","fa-bell":"font-awesome_fa-bell_26AZW","fa-certificate":"font-awesome_fa-certificate_11sLt","fa-hand-o-right":"font-awesome_fa-hand-o-right_2G1w_","fa-hand-o-left":"font-awesome_fa-hand-o-left_2KTOL","fa-hand-o-up":"font-awesome_fa-hand-o-up_3xrkS","fa-hand-o-down":"font-awesome_fa-hand-o-down_3cWAN","fa-arrow-circle-left":"font-awesome_fa-arrow-circle-left_2CgFw","fa-arrow-circle-right":"font-awesome_fa-arrow-circle-right_35XcE","fa-arrow-circle-up":"font-awesome_fa-arrow-circle-up_FHcwE","fa-arrow-circle-down":"font-awesome_fa-arrow-circle-down_1NJKi","fa-globe":"font-awesome_fa-globe_2fYFX","fa-wrench":"font-awesome_fa-wrench_3snDo","fa-tasks":"font-awesome_fa-tasks_2_oS8","fa-filter":"font-awesome_fa-filter_1q5k8","fa-briefcase":"font-awesome_fa-briefcase_aikwY","fa-arrows-alt":"font-awesome_fa-arrows-alt_1vqY9","fa-group":"font-awesome_fa-group_XbMo9","fa-users":"font-awesome_fa-users_1PfY8","fa-chain":"font-awesome_fa-chain_2QCgS","fa-link":"font-awesome_fa-link_3kFkN","fa-cloud":"font-awesome_fa-cloud_2l8rd","fa-flask":"font-awesome_fa-flask_3iTak","fa-cut":"font-awesome_fa-cut_17wpt","fa-scissors":"font-awesome_fa-scissors_1xAHX","fa-copy":"font-awesome_fa-copy_a2GP3","fa-files-o":"font-awesome_fa-files-o_2pUmI","fa-paperclip":"font-awesome_fa-paperclip_d4foW","fa-save":"font-awesome_fa-save_10fTV","fa-floppy-o":"font-awesome_fa-floppy-o_1MBo6","fa-square":"font-awesome_fa-square_N1IJZ","fa-navicon":"font-awesome_fa-navicon_3anpJ","fa-reorder":"font-awesome_fa-reorder_2ukY7","fa-bars":"font-awesome_fa-bars_3WARK","fa-list-ul":"font-awesome_fa-list-ul_3s6_2","fa-list-ol":"font-awesome_fa-list-ol_AP-DO","fa-strikethrough":"font-awesome_fa-strikethrough_h0-a_","fa-underline":"font-awesome_fa-underline_2PIFp","fa-table":"font-awesome_fa-table_2mEeT","fa-magic":"font-awesome_fa-magic_qWQg_","fa-truck":"font-awesome_fa-truck_1AsFs","fa-pinterest":"font-awesome_fa-pinterest_1xKnl","fa-pinterest-square":"font-awesome_fa-pinterest-square_3Yhwf","fa-google-plus-square":"font-awesome_fa-google-plus-square_90VGD","fa-google-plus":"font-awesome_fa-google-plus_1Tp-z","fa-money":"font-awesome_fa-money_32Lir","fa-caret-down":"font-awesome_fa-caret-down_1crEO","fa-caret-up":"font-awesome_fa-caret-up_2TwZv","fa-caret-left":"font-awesome_fa-caret-left_39lOf","fa-caret-right":"font-awesome_fa-caret-right_3p0nW","fa-columns":"font-awesome_fa-columns_nToc3","fa-unsorted":"font-awesome_fa-unsorted_2nhbR","fa-sort":"font-awesome_fa-sort_F3dcY","fa-sort-down":"font-awesome_fa-sort-down_3wTbK","fa-sort-desc":"font-awesome_fa-sort-desc_3CQ5e","fa-sort-up":"font-awesome_fa-sort-up_Ad_bv","fa-sort-asc":"font-awesome_fa-sort-asc_3MlT5","fa-envelope":"font-awesome_fa-envelope_3xnLD","fa-linkedin":"font-awesome_fa-linkedin_25eMJ","fa-rotate-left":"font-awesome_fa-rotate-left_3mzU5","fa-undo":"font-awesome_fa-undo_hNldt","fa-legal":"font-awesome_fa-legal_1C_3g","fa-gavel":"font-awesome_fa-gavel_2ttLP","fa-dashboard":"font-awesome_fa-dashboard_3bEM7","fa-tachometer":"font-awesome_fa-tachometer_3R5zx","fa-comment-o":"font-awesome_fa-comment-o_2pEPg","fa-comments-o":"font-awesome_fa-comments-o_hQJKS","fa-flash":"font-awesome_fa-flash_1DU_v","fa-bolt":"font-awesome_fa-bolt_3iT3l","fa-sitemap":"font-awesome_fa-sitemap_QKmtm","fa-umbrella":"font-awesome_fa-umbrella_3fE2k","fa-paste":"font-awesome_fa-paste_3RUtK","fa-clipboard":"font-awesome_fa-clipboard_1Wx9E","fa-lightbulb-o":"font-awesome_fa-lightbulb-o_3MZxy","fa-exchange":"font-awesome_fa-exchange_1cgNj","fa-cloud-download":"font-awesome_fa-cloud-download_2fd-7","fa-cloud-upload":"font-awesome_fa-cloud-upload_BCKnV","fa-user-md":"font-awesome_fa-user-md_3Unw6","fa-stethoscope":"font-awesome_fa-stethoscope_3TPjy","fa-suitcase":"font-awesome_fa-suitcase_2ZK-F","fa-bell-o":"font-awesome_fa-bell-o_3iuFm","fa-coffee":"font-awesome_fa-coffee_2tZxb","fa-cutlery":"font-awesome_fa-cutlery_2dZZ2","fa-file-text-o":"font-awesome_fa-file-text-o_3vkBr","fa-building-o":"font-awesome_fa-building-o_1ML8l","fa-hospital-o":"font-awesome_fa-hospital-o_2dZPM","fa-ambulance":"font-awesome_fa-ambulance_3oMTO","fa-medkit":"font-awesome_fa-medkit_3TuAD","fa-fighter-jet":"font-awesome_fa-fighter-jet_2EPG4","fa-beer":"font-awesome_fa-beer_25HMG","fa-h-square":"font-awesome_fa-h-square_iRMP3","fa-plus-square":"font-awesome_fa-plus-square_28zW8","fa-angle-double-left":"font-awesome_fa-angle-double-left_3Q7bL","fa-angle-double-right":"font-awesome_fa-angle-double-right_2R24L","fa-angle-double-up":"font-awesome_fa-angle-double-up_2GMJK","fa-angle-double-down":"font-awesome_fa-angle-double-down_IlK-a","fa-angle-left":"font-awesome_fa-angle-left_7b-ty","fa-angle-right":"font-awesome_fa-angle-right_RfvDx","fa-angle-up":"font-awesome_fa-angle-up_2xGkU","fa-angle-down":"font-awesome_fa-angle-down_3nIhI","fa-desktop":"font-awesome_fa-desktop_7pHFF","fa-laptop":"font-awesome_fa-laptop_2QHxL","fa-tablet":"font-awesome_fa-tablet_eRAwh","fa-mobile-phone":"font-awesome_fa-mobile-phone_3tGZx","fa-mobile":"font-awesome_fa-mobile_ry_56","fa-circle-o":"font-awesome_fa-circle-o_We1QB","fa-quote-left":"font-awesome_fa-quote-left_tgvF3","fa-quote-right":"font-awesome_fa-quote-right_2LbYu","fa-spinner":"font-awesome_fa-spinner_1FgdF","fa-circle":"font-awesome_fa-circle_RFG4V","fa-mail-reply":"font-awesome_fa-mail-reply_1ovuj","fa-reply":"font-awesome_fa-reply_1p4xy","fa-github-alt":"font-awesome_fa-github-alt_PGZGn","fa-folder-o":"font-awesome_fa-folder-o_28LsO","fa-folder-open-o":"font-awesome_fa-folder-open-o_3Hbbz","fa-smile-o":"font-awesome_fa-smile-o_3R1KH","fa-frown-o":"font-awesome_fa-frown-o_1PJe6","fa-meh-o":"font-awesome_fa-meh-o_1Yal3","fa-gamepad":"font-awesome_fa-gamepad_DQkX5","fa-keyboard-o":"font-awesome_fa-keyboard-o_1Zegg","fa-flag-o":"font-awesome_fa-flag-o_2paT4","fa-flag-checkered":"font-awesome_fa-flag-checkered_3Q50W","fa-terminal":"font-awesome_fa-terminal_1y_ce","fa-code":"font-awesome_fa-code_373HL","fa-mail-reply-all":"font-awesome_fa-mail-reply-all_1el1h","fa-reply-all":"font-awesome_fa-reply-all_1XbQQ","fa-star-half-empty":"font-awesome_fa-star-half-empty_NeM4g","fa-star-half-full":"font-awesome_fa-star-half-full_3_GnR","fa-star-half-o":"font-awesome_fa-star-half-o_1gMSG","fa-location-arrow":"font-awesome_fa-location-arrow_gFy0a","fa-crop":"font-awesome_fa-crop_DFePA","fa-code-fork":"font-awesome_fa-code-fork_rNRd0","fa-unlink":"font-awesome_fa-unlink_1hw62","fa-chain-broken":"font-awesome_fa-chain-broken_3nVk7","fa-question":"font-awesome_fa-question_EAoIA","fa-info":"font-awesome_fa-info_2cQvQ","fa-exclamation":"font-awesome_fa-exclamation_297uN","fa-superscript":"font-awesome_fa-superscript_N7aMl","fa-subscript":"font-awesome_fa-subscript_ZG4gQ","fa-eraser":"font-awesome_fa-eraser_3NIuU","fa-puzzle-piece":"font-awesome_fa-puzzle-piece_3lKWq","fa-microphone":"font-awesome_fa-microphone_3_81_","fa-microphone-slash":"font-awesome_fa-microphone-slash_1DyxC","fa-shield":"font-awesome_fa-shield_1qKif","fa-calendar-o":"font-awesome_fa-calendar-o_1BLCm","fa-fire-extinguisher":"font-awesome_fa-fire-extinguisher_3gz5K","fa-rocket":"font-awesome_fa-rocket_lfSov","fa-maxcdn":"font-awesome_fa-maxcdn_cD6Fn","fa-chevron-circle-left":"font-awesome_fa-chevron-circle-left_1aac7","fa-chevron-circle-right":"font-awesome_fa-chevron-circle-right_Evj_u","fa-chevron-circle-up":"font-awesome_fa-chevron-circle-up_tTcaI","fa-chevron-circle-down":"font-awesome_fa-chevron-circle-down_1oKtm","fa-html5":"font-awesome_fa-html5_3LZaq","fa-css3":"font-awesome_fa-css3_3hg4c","fa-anchor":"font-awesome_fa-anchor_2-wZ3","fa-unlock-alt":"font-awesome_fa-unlock-alt_CLyLU","fa-bullseye":"font-awesome_fa-bullseye_6Sp1E","fa-ellipsis-h":"font-awesome_fa-ellipsis-h_4VBiE","fa-ellipsis-v":"font-awesome_fa-ellipsis-v_Ktjfe","fa-rss-square":"font-awesome_fa-rss-square_4Vj2y","fa-play-circle":"font-awesome_fa-play-circle_ECzau","fa-ticket":"font-awesome_fa-ticket_284VQ","fa-minus-square":"font-awesome_fa-minus-square_3w_Do","fa-minus-square-o":"font-awesome_fa-minus-square-o_qe1Jq","fa-level-up":"font-awesome_fa-level-up_7RnC1","fa-level-down":"font-awesome_fa-level-down_1rR4Q","fa-check-square":"font-awesome_fa-check-square_3Qxfb","fa-pencil-square":"font-awesome_fa-pencil-square_3f_4W","fa-external-link-square":"font-awesome_fa-external-link-square_3TfmM","fa-share-square":"font-awesome_fa-share-square_4XEPu","fa-compass":"font-awesome_fa-compass_3kP2n","fa-toggle-down":"font-awesome_fa-toggle-down_vVDIQ","fa-caret-square-o-down":"font-awesome_fa-caret-square-o-down_1Ao-B","fa-toggle-up":"font-awesome_fa-toggle-up_1j96l","fa-caret-square-o-up":"font-awesome_fa-caret-square-o-up_1Lr5P","fa-toggle-right":"font-awesome_fa-toggle-right_391jj","fa-caret-square-o-right":"font-awesome_fa-caret-square-o-right_Jc6ln","fa-euro":"font-awesome_fa-euro_1H752","fa-eur":"font-awesome_fa-eur_2JOH3","fa-gbp":"font-awesome_fa-gbp_sXuSA","fa-dollar":"font-awesome_fa-dollar_1Qw2b","fa-usd":"font-awesome_fa-usd_1Cyf0","fa-rupee":"font-awesome_fa-rupee_3EdPr","fa-inr":"font-awesome_fa-inr_2v4ZE","fa-cny":"font-awesome_fa-cny_3RNlL","fa-rmb":"font-awesome_fa-rmb_vAGyw","fa-yen":"font-awesome_fa-yen_UH2C8","fa-jpy":"font-awesome_fa-jpy_CXaPK","fa-ruble":"font-awesome_fa-ruble_1ms6_","fa-rouble":"font-awesome_fa-rouble_fwC1R","fa-rub":"font-awesome_fa-rub_1c94U","fa-won":"font-awesome_fa-won_1oqxL","fa-krw":"font-awesome_fa-krw_xc7hv","fa-bitcoin":"font-awesome_fa-bitcoin_3h17C","fa-btc":"font-awesome_fa-btc_2EpsK","fa-file":"font-awesome_fa-file_2_TBG","fa-file-text":"font-awesome_fa-file-text_3uzzE","fa-sort-alpha-asc":"font-awesome_fa-sort-alpha-asc_l6x9i","fa-sort-alpha-desc":"font-awesome_fa-sort-alpha-desc_Au5Op","fa-sort-amount-asc":"font-awesome_fa-sort-amount-asc_a4pl1","fa-sort-amount-desc":"font-awesome_fa-sort-amount-desc_sHYze","fa-sort-numeric-asc":"font-awesome_fa-sort-numeric-asc_2fl5U","fa-sort-numeric-desc":"font-awesome_fa-sort-numeric-desc_rZcNd","fa-thumbs-up":"font-awesome_fa-thumbs-up_32LEl","fa-thumbs-down":"font-awesome_fa-thumbs-down_115k7","fa-youtube-square":"font-awesome_fa-youtube-square_1HADK","fa-youtube":"font-awesome_fa-youtube_3PHGN","fa-xing":"font-awesome_fa-xing_2fXmL","fa-xing-square":"font-awesome_fa-xing-square_3AeWb","fa-youtube-play":"font-awesome_fa-youtube-play__uWZW","fa-dropbox":"font-awesome_fa-dropbox_1i2Rn","fa-stack-overflow":"font-awesome_fa-stack-overflow_2tkuN","fa-instagram":"font-awesome_fa-instagram_1lV5f","fa-flickr":"font-awesome_fa-flickr_3JrtG","fa-adn":"font-awesome_fa-adn_3a2Jf","fa-bitbucket":"font-awesome_fa-bitbucket_12Rp4","fa-bitbucket-square":"font-awesome_fa-bitbucket-square_Y0lMx","fa-tumblr":"font-awesome_fa-tumblr_18aB6","fa-tumblr-square":"font-awesome_fa-tumblr-square_3m4ld","fa-long-arrow-down":"font-awesome_fa-long-arrow-down_2His0","fa-long-arrow-up":"font-awesome_fa-long-arrow-up_vP_4l","fa-long-arrow-left":"font-awesome_fa-long-arrow-left_1Uldc","fa-long-arrow-right":"font-awesome_fa-long-arrow-right_1_jZV","fa-apple":"font-awesome_fa-apple_3f0-D","fa-windows":"font-awesome_fa-windows_2wDfa","fa-android":"font-awesome_fa-android_1Wzt9","fa-linux":"font-awesome_fa-linux_3TBYa","fa-dribbble":"font-awesome_fa-dribbble_IliEV","fa-skype":"font-awesome_fa-skype_7ne23","fa-foursquare":"font-awesome_fa-foursquare_52T_Z","fa-trello":"font-awesome_fa-trello_2ChtW","fa-female":"font-awesome_fa-female_q-oMT","fa-male":"font-awesome_fa-male_2PAqV","fa-gittip":"font-awesome_fa-gittip_2fxKq","fa-gratipay":"font-awesome_fa-gratipay_xLz4x","fa-sun-o":"font-awesome_fa-sun-o_3QZ1O","fa-moon-o":"font-awesome_fa-moon-o_ZwK6C","fa-archive":"font-awesome_fa-archive_3FY1-","fa-bug":"font-awesome_fa-bug_20yJn","fa-vk":"font-awesome_fa-vk_1SLN3","fa-weibo":"font-awesome_fa-weibo_3q9BS","fa-renren":"font-awesome_fa-renren_27Rtg","fa-pagelines":"font-awesome_fa-pagelines_3FZd_","fa-stack-exchange":"font-awesome_fa-stack-exchange_1BbmA","fa-arrow-circle-o-right":"font-awesome_fa-arrow-circle-o-right_1lS0I","fa-arrow-circle-o-left":"font-awesome_fa-arrow-circle-o-left_270k0","fa-toggle-left":"font-awesome_fa-toggle-left_q8rS1","fa-caret-square-o-left":"font-awesome_fa-caret-square-o-left_3leFq","fa-dot-circle-o":"font-awesome_fa-dot-circle-o_fRUKP","fa-wheelchair":"font-awesome_fa-wheelchair_2sPWn","fa-vimeo-square":"font-awesome_fa-vimeo-square_1nIhm","fa-turkish-lira":"font-awesome_fa-turkish-lira_1bCbG","fa-try":"font-awesome_fa-try_1Olkg","fa-plus-square-o":"font-awesome_fa-plus-square-o_M6pBY","fa-space-shuttle":"font-awesome_fa-space-shuttle_9kmJU","fa-slack":"font-awesome_fa-slack_1EvN7","fa-envelope-square":"font-awesome_fa-envelope-square_3aqlc","fa-wordpress":"font-awesome_fa-wordpress_2u9e0","fa-openid":"font-awesome_fa-openid_2QLde","fa-institution":"font-awesome_fa-institution_2uHKo","fa-bank":"font-awesome_fa-bank_D8hxY","fa-university":"font-awesome_fa-university_3ECjv","fa-mortar-board":"font-awesome_fa-mortar-board_1em7v","fa-graduation-cap":"font-awesome_fa-graduation-cap_Y0mMc","fa-yahoo":"font-awesome_fa-yahoo_33B-N","fa-google":"font-awesome_fa-google_1QYVJ","fa-reddit":"font-awesome_fa-reddit_bwA4E","fa-reddit-square":"font-awesome_fa-reddit-square_3rRiq","fa-stumbleupon-circle":"font-awesome_fa-stumbleupon-circle_1TPid","fa-stumbleupon":"font-awesome_fa-stumbleupon_14d1U","fa-delicious":"font-awesome_fa-delicious_3rkRQ","fa-digg":"font-awesome_fa-digg_3bIOw","fa-pied-piper":"font-awesome_fa-pied-piper_1iXBb","fa-pied-piper-alt":"font-awesome_fa-pied-piper-alt_3UjUa","fa-drupal":"font-awesome_fa-drupal_WQObj","fa-joomla":"font-awesome_fa-joomla_2UQVh","fa-language":"font-awesome_fa-language_DOnO2","fa-fax":"font-awesome_fa-fax_1SV_d","fa-building":"font-awesome_fa-building_1FVgz","fa-child":"font-awesome_fa-child_2gTU4","fa-paw":"font-awesome_fa-paw_NcsFR","fa-spoon":"font-awesome_fa-spoon_IxNyL","fa-cube":"font-awesome_fa-cube_1Mq1-","fa-cubes":"font-awesome_fa-cubes_1tGnD","fa-behance":"font-awesome_fa-behance_3mdMe","fa-behance-square":"font-awesome_fa-behance-square_5ghK4","fa-steam":"font-awesome_fa-steam_RIwxM","fa-steam-square":"font-awesome_fa-steam-square_2QEJn","fa-recycle":"font-awesome_fa-recycle_-U8tZ","fa-automobile":"font-awesome_fa-automobile_3z3Dw","fa-car":"font-awesome_fa-car_30pca","fa-cab":"font-awesome_fa-cab_DDNE1","fa-taxi":"font-awesome_fa-taxi_22WsM","fa-tree":"font-awesome_fa-tree_3RDTB","fa-spotify":"font-awesome_fa-spotify_3UDVW","fa-deviantart":"font-awesome_fa-deviantart_2ZxWy","fa-soundcloud":"font-awesome_fa-soundcloud_2ALXb","fa-database":"font-awesome_fa-database_1lI0N","fa-file-pdf-o":"font-awesome_fa-file-pdf-o_3kglo","fa-file-word-o":"font-awesome_fa-file-word-o_1UetZ","fa-file-excel-o":"font-awesome_fa-file-excel-o_A4QBn","fa-file-powerpoint-o":"font-awesome_fa-file-powerpoint-o_rrLjs","fa-file-photo-o":"font-awesome_fa-file-photo-o_2UoDO","fa-file-picture-o":"font-awesome_fa-file-picture-o_3Xjli","fa-file-image-o":"font-awesome_fa-file-image-o_2lPT_","fa-file-zip-o":"font-awesome_fa-file-zip-o_2FWRa","fa-file-archive-o":"font-awesome_fa-file-archive-o_2Mk5P","fa-file-sound-o":"font-awesome_fa-file-sound-o_1AcTq","fa-file-audio-o":"font-awesome_fa-file-audio-o_2PC2o","fa-file-movie-o":"font-awesome_fa-file-movie-o_VAP4m","fa-file-video-o":"font-awesome_fa-file-video-o_34mPw","fa-file-code-o":"font-awesome_fa-file-code-o_1tJvu","fa-vine":"font-awesome_fa-vine_26AR6","fa-codepen":"font-awesome_fa-codepen_2F2Jy","fa-jsfiddle":"font-awesome_fa-jsfiddle_pH8-y","fa-life-bouy":"font-awesome_fa-life-bouy_3M9kq","fa-life-buoy":"font-awesome_fa-life-buoy_-dMf6","fa-life-saver":"font-awesome_fa-life-saver_1NRqc","fa-support":"font-awesome_fa-support_6Q01X","fa-life-ring":"font-awesome_fa-life-ring_1x6lZ","fa-circle-o-notch":"font-awesome_fa-circle-o-notch_cWGUO","fa-ra":"font-awesome_fa-ra_2liTj","fa-rebel":"font-awesome_fa-rebel_2UIOr","fa-ge":"font-awesome_fa-ge_1f9_K","fa-empire":"font-awesome_fa-empire_3Sw8V","fa-git-square":"font-awesome_fa-git-square_DgHwD","fa-git":"font-awesome_fa-git_1dhi0","fa-y-combinator-square":"font-awesome_fa-y-combinator-square_lfSlT","fa-yc-square":"font-awesome_fa-yc-square_1Qf2g","fa-hacker-news":"font-awesome_fa-hacker-news_CxkYC","fa-tencent-weibo":"font-awesome_fa-tencent-weibo_2-fdG","fa-qq":"font-awesome_fa-qq_1OIck","fa-wechat":"font-awesome_fa-wechat_7Wqz8","fa-weixin":"font-awesome_fa-weixin_2rvXg","fa-send":"font-awesome_fa-send_1PHOy","fa-paper-plane":"font-awesome_fa-paper-plane_1JBzT","fa-send-o":"font-awesome_fa-send-o_1K3Am","fa-paper-plane-o":"font-awesome_fa-paper-plane-o_Am7EP","fa-history":"font-awesome_fa-history_xEiAH","fa-circle-thin":"font-awesome_fa-circle-thin_OCNZt","fa-header":"font-awesome_fa-header_hMELn","fa-paragraph":"font-awesome_fa-paragraph_2r_mD","fa-sliders":"font-awesome_fa-sliders_3eRoo","fa-share-alt":"font-awesome_fa-share-alt_3jAY7","fa-share-alt-square":"font-awesome_fa-share-alt-square_46dVM","fa-bomb":"font-awesome_fa-bomb_1WRhh","fa-soccer-ball-o":"font-awesome_fa-soccer-ball-o_3rmya","fa-futbol-o":"font-awesome_fa-futbol-o_Nqzpi","fa-tty":"font-awesome_fa-tty_3BPj2","fa-binoculars":"font-awesome_fa-binoculars_1vG29","fa-plug":"font-awesome_fa-plug_1Lbxt","fa-slideshare":"font-awesome_fa-slideshare_15ZAf","fa-twitch":"font-awesome_fa-twitch_MNLu3","fa-yelp":"font-awesome_fa-yelp_1c1W7","fa-newspaper-o":"font-awesome_fa-newspaper-o_1ecUe","fa-wifi":"font-awesome_fa-wifi_dQ61U","fa-calculator":"font-awesome_fa-calculator_2q6GV","fa-paypal":"font-awesome_fa-paypal_3lmxL","fa-google-wallet":"font-awesome_fa-google-wallet_2K_aw","fa-cc-visa":"font-awesome_fa-cc-visa_2F8r8","fa-cc-mastercard":"font-awesome_fa-cc-mastercard_T8WQ_","fa-cc-discover":"font-awesome_fa-cc-discover_2QXm7","fa-cc-amex":"font-awesome_fa-cc-amex_2w-j8","fa-cc-paypal":"font-awesome_fa-cc-paypal_gr0Zj","fa-cc-stripe":"font-awesome_fa-cc-stripe_5ubxJ","fa-bell-slash":"font-awesome_fa-bell-slash_PIYu4","fa-bell-slash-o":"font-awesome_fa-bell-slash-o_PTM9c","fa-trash":"font-awesome_fa-trash_-YVpH","fa-copyright":"font-awesome_fa-copyright_3Cj5D","fa-at":"font-awesome_fa-at_b7Ql8","fa-eyedropper":"font-awesome_fa-eyedropper_1rpAm","fa-paint-brush":"font-awesome_fa-paint-brush_3SJFh","fa-birthday-cake":"font-awesome_fa-birthday-cake_-17FP","fa-area-chart":"font-awesome_fa-area-chart_1fTy1","fa-pie-chart":"font-awesome_fa-pie-chart_2TXFj","fa-line-chart":"font-awesome_fa-line-chart_20bFd","fa-lastfm":"font-awesome_fa-lastfm_3sP7Z","fa-lastfm-square":"font-awesome_fa-lastfm-square_3OBza","fa-toggle-off":"font-awesome_fa-toggle-off_2TP0s","fa-toggle-on":"font-awesome_fa-toggle-on_1ud4K","fa-bicycle":"font-awesome_fa-bicycle_r_nn3","fa-bus":"font-awesome_fa-bus_bm6kq","fa-ioxhost":"font-awesome_fa-ioxhost_yWiPs","fa-angellist":"font-awesome_fa-angellist_14KNT","fa-cc":"font-awesome_fa-cc_VsUyp","fa-shekel":"font-awesome_fa-shekel_3RcTu","fa-sheqel":"font-awesome_fa-sheqel_2_Sde","fa-ils":"font-awesome_fa-ils_CYDSg","fa-meanpath":"font-awesome_fa-meanpath_8Utkv","fa-buysellads":"font-awesome_fa-buysellads_3DmVj","fa-connectdevelop":"font-awesome_fa-connectdevelop_24BDl","fa-dashcube":"font-awesome_fa-dashcube_3gytt","fa-forumbee":"font-awesome_fa-forumbee_1Xmr9","fa-leanpub":"font-awesome_fa-leanpub_1qDwq","fa-sellsy":"font-awesome_fa-sellsy_w39BK","fa-shirtsinbulk":"font-awesome_fa-shirtsinbulk_3ht1E","fa-simplybuilt":"font-awesome_fa-simplybuilt_1V2xv","fa-skyatlas":"font-awesome_fa-skyatlas_1HFEf","fa-cart-plus":"font-awesome_fa-cart-plus_zqpg9","fa-cart-arrow-down":"font-awesome_fa-cart-arrow-down_vmvAL","fa-diamond":"font-awesome_fa-diamond_2YKSj","fa-ship":"font-awesome_fa-ship_2d0Uf","fa-user-secret":"font-awesome_fa-user-secret_1JgJF","fa-motorcycle":"font-awesome_fa-motorcycle_hAqgH","fa-street-view":"font-awesome_fa-street-view_3xS1E","fa-heartbeat":"font-awesome_fa-heartbeat_3SRsO","fa-venus":"font-awesome_fa-venus_3jRFX","fa-mars":"font-awesome_fa-mars_2Le0W","fa-mercury":"font-awesome_fa-mercury_3-x4u","fa-intersex":"font-awesome_fa-intersex_26r-R","fa-transgender":"font-awesome_fa-transgender_1hS0T","fa-transgender-alt":"font-awesome_fa-transgender-alt_3_fBb","fa-venus-double":"font-awesome_fa-venus-double_30rPd","fa-mars-double":"font-awesome_fa-mars-double_3Xnoh","fa-venus-mars":"font-awesome_fa-venus-mars_2Ptfg","fa-mars-stroke":"font-awesome_fa-mars-stroke_f9_Cu","fa-mars-stroke-v":"font-awesome_fa-mars-stroke-v_1K5K9","fa-mars-stroke-h":"font-awesome_fa-mars-stroke-h_3azEl","fa-neuter":"font-awesome_fa-neuter_1wUaY","fa-genderless":"font-awesome_fa-genderless_3mEtZ","fa-facebook-official":"font-awesome_fa-facebook-official_2NNdf","fa-pinterest-p":"font-awesome_fa-pinterest-p_1Xpu_","fa-whatsapp":"font-awesome_fa-whatsapp_3G2qZ","fa-server":"font-awesome_fa-server_NVGtN","fa-user-plus":"font-awesome_fa-user-plus_1UACc","fa-user-times":"font-awesome_fa-user-times_24FFx","fa-hotel":"font-awesome_fa-hotel_3W6s_","fa-bed":"font-awesome_fa-bed_1XbLs","fa-viacoin":"font-awesome_fa-viacoin_3b4Ln","fa-train":"font-awesome_fa-train_2mIFj","fa-subway":"font-awesome_fa-subway_mahNW","fa-medium":"font-awesome_fa-medium_2UIgR","fa-yc":"font-awesome_fa-yc_2pwL9","fa-y-combinator":"font-awesome_fa-y-combinator_l4_A9","fa-optin-monster":"font-awesome_fa-optin-monster_2Vo1M","fa-opencart":"font-awesome_fa-opencart_2P3qK","fa-expeditedssl":"font-awesome_fa-expeditedssl_1ay3x","fa-battery-4":"font-awesome_fa-battery-4_1qRp1","fa-battery-full":"font-awesome_fa-battery-full_2fsqT","fa-battery-3":"font-awesome_fa-battery-3_3WHzS","fa-battery-three-quarters":"font-awesome_fa-battery-three-quarters_dBjV8","fa-battery-2":"font-awesome_fa-battery-2_2Pgt2","fa-battery-half":"font-awesome_fa-battery-half_2taE9","fa-battery-1":"font-awesome_fa-battery-1_1R1Ww","fa-battery-quarter":"font-awesome_fa-battery-quarter_1sRcE","fa-battery-0":"font-awesome_fa-battery-0_1zrhu","fa-battery-empty":"font-awesome_fa-battery-empty_2Mn-c","fa-mouse-pointer":"font-awesome_fa-mouse-pointer_DbB5u","fa-i-cursor":"font-awesome_fa-i-cursor_xvyzh","fa-object-group":"font-awesome_fa-object-group_3K3tV","fa-object-ungroup":"font-awesome_fa-object-ungroup_1ylE-","fa-sticky-note":"font-awesome_fa-sticky-note_1dK3l","fa-sticky-note-o":"font-awesome_fa-sticky-note-o_2zvyB","fa-cc-jcb":"font-awesome_fa-cc-jcb_Q7v9N","fa-cc-diners-club":"font-awesome_fa-cc-diners-club_338EC","fa-clone":"font-awesome_fa-clone_2LPS7","fa-balance-scale":"font-awesome_fa-balance-scale_3o2it","fa-hourglass-o":"font-awesome_fa-hourglass-o_15XJL","fa-hourglass-1":"font-awesome_fa-hourglass-1_2iRUs","fa-hourglass-start":"font-awesome_fa-hourglass-start_qhpOV","fa-hourglass-2":"font-awesome_fa-hourglass-2_2V0b5","fa-hourglass-half":"font-awesome_fa-hourglass-half_cF0Po","fa-hourglass-3":"font-awesome_fa-hourglass-3_2-ugV","fa-hourglass-end":"font-awesome_fa-hourglass-end_3l-g6","fa-hourglass":"font-awesome_fa-hourglass_1Ar7q","fa-hand-grab-o":"font-awesome_fa-hand-grab-o_3I7_Y","fa-hand-rock-o":"font-awesome_fa-hand-rock-o_1Tb8S","fa-hand-stop-o":"font-awesome_fa-hand-stop-o_37eq3","fa-hand-paper-o":"font-awesome_fa-hand-paper-o_2dp3p","fa-hand-scissors-o":"font-awesome_fa-hand-scissors-o_tLXdy","fa-hand-lizard-o":"font-awesome_fa-hand-lizard-o_2afn0", -"fa-hand-spock-o":"font-awesome_fa-hand-spock-o_22lUn","fa-hand-pointer-o":"font-awesome_fa-hand-pointer-o_3EDBr","fa-hand-peace-o":"font-awesome_fa-hand-peace-o_3KVDU","fa-trademark":"font-awesome_fa-trademark_1pZSQ","fa-registered":"font-awesome_fa-registered_2bkiQ","fa-creative-commons":"font-awesome_fa-creative-commons_19SOu","fa-gg":"font-awesome_fa-gg_8EwZk","fa-gg-circle":"font-awesome_fa-gg-circle_ixSHX","fa-tripadvisor":"font-awesome_fa-tripadvisor_3SR4I","fa-odnoklassniki":"font-awesome_fa-odnoklassniki_18Bc_","fa-odnoklassniki-square":"font-awesome_fa-odnoklassniki-square_2tvme","fa-get-pocket":"font-awesome_fa-get-pocket_1kDeB","fa-wikipedia-w":"font-awesome_fa-wikipedia-w_2bnVT","fa-safari":"font-awesome_fa-safari_1d_gp","fa-chrome":"font-awesome_fa-chrome_2lYJX","fa-firefox":"font-awesome_fa-firefox_3G1uV","fa-opera":"font-awesome_fa-opera_2EABz","fa-internet-explorer":"font-awesome_fa-internet-explorer_2e6T2","fa-tv":"font-awesome_fa-tv_pyAzy","fa-television":"font-awesome_fa-television_1MplB","fa-contao":"font-awesome_fa-contao_1BTJ5","fa-500px":"font-awesome_fa-500px_2dpFP","fa-amazon":"font-awesome_fa-amazon_1J6OF","fa-calendar-plus-o":"font-awesome_fa-calendar-plus-o_up6cZ","fa-calendar-minus-o":"font-awesome_fa-calendar-minus-o_2wY7J","fa-calendar-times-o":"font-awesome_fa-calendar-times-o_1jaLQ","fa-calendar-check-o":"font-awesome_fa-calendar-check-o_3xoZC","fa-industry":"font-awesome_fa-industry_3LSV8","fa-map-pin":"font-awesome_fa-map-pin_1mpnW","fa-map-signs":"font-awesome_fa-map-signs_21LXb","fa-map-o":"font-awesome_fa-map-o_1CDpd","fa-map":"font-awesome_fa-map_18QCe","fa-commenting":"font-awesome_fa-commenting_2oYYM","fa-commenting-o":"font-awesome_fa-commenting-o_2BRal","fa-houzz":"font-awesome_fa-houzz_13-hb","fa-vimeo":"font-awesome_fa-vimeo_3vcPv","fa-black-tie":"font-awesome_fa-black-tie_34h9B","fa-fonticons":"font-awesome_fa-fonticons_aNgtF","fa-reddit-alien":"font-awesome_fa-reddit-alien_3f_aH","fa-edge":"font-awesome_fa-edge_3UUWF","fa-credit-card-alt":"font-awesome_fa-credit-card-alt_oOWN1","fa-codiepie":"font-awesome_fa-codiepie_2amwQ","fa-modx":"font-awesome_fa-modx__HnMH","fa-fort-awesome":"font-awesome_fa-fort-awesome_1Pxvs","fa-usb":"font-awesome_fa-usb_2-FsD","fa-product-hunt":"font-awesome_fa-product-hunt_3WqRr","fa-mixcloud":"font-awesome_fa-mixcloud_2e01G","fa-scribd":"font-awesome_fa-scribd_1bAIo","fa-pause-circle":"font-awesome_fa-pause-circle_3wI6c","fa-pause-circle-o":"font-awesome_fa-pause-circle-o_2MdRS","fa-stop-circle":"font-awesome_fa-stop-circle_3aZ6V","fa-stop-circle-o":"font-awesome_fa-stop-circle-o_2oIr6","fa-shopping-bag":"font-awesome_fa-shopping-bag_2mD0w","fa-shopping-basket":"font-awesome_fa-shopping-basket_2ZYTJ","fa-hashtag":"font-awesome_fa-hashtag_1sHh4","fa-bluetooth":"font-awesome_fa-bluetooth_1tJ1-","fa-bluetooth-b":"font-awesome_fa-bluetooth-b_LmWTh","fa-percent":"font-awesome_fa-percent_3jbSX"}},function(e,t,n){"use strict";e.exports=n(590)},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t=0&&b.splice(t,1)}function s(e){var t=document.createElement("style");return t.type="text/css",a(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",a(e,t),t}function u(e,t){var n,r,o;if(t.singleton){var a=y++;n=v||(v=s(t)),r=c.bind(null,n,a,!1),o=c.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(t),r=d.bind(null,n),o=function(){i(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(t),r=f.bind(null,n),o=function(){i(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}function c(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=_(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function d(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}var h={},p=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},g=p(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),m=p(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,y=0,b=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=g()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=o(e);return r(n,t),function(e){for(var a=[],i=0;i>>2]>>>24-a%4*8&255;t[r+a>>>2]|=i<<24-(r+a)%4*8}else for(var a=0;a>>2]=n[a>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],o=function(t){var t=t,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,t=18e3*(65535&t)+(t>>16)&r;var o=(n<<16)+t&r;return o/=4294967296,o+=.5,o*(e.random()>.5?1:-1)}},a=0;a>>2]>>>24-o%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new i.init(n,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new i.init(n,t)}},c=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,a=this.blockSize,s=4*a,l=o/s;l=t?e.ceil(l):e.max((0|l)-this._minBufferSize,0);var u=l*a,c=e.min(4*u,o);if(u){for(var f=0;f0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!0,premultipliedAlpha:!1};return this.el.getContext("webgl",e)||this.el.getContext("experimental-webgl",e)}},{key:"destroy",value:function(){this.el.parentNode.removeChild(this.el),this.el=null,this.width=null,this.height=null}},{key:"toDataURL",value:function(e,t){return this.el.toDataURL(e,t)}}]),e}();t["default"]=a},function(e,t,n){!function(r,o){e.exports=t=o(n(7))}(this,function(e){e.lib.Cipher||function(t){var n=e,r=n.lib,o=r.Base,a=r.WordArray,i=r.BufferedBlockAlgorithm,s=n.enc,l=(s.Utf8,s.Base64),u=n.algo,c=u.EvpKDF,f=r.Cipher=i.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?C:_}return function(t){return{encrypt:function(n,r,o){return e(r).encrypt(t,n,r,o)},decrypt:function(n,r,o){return e(r).decrypt(t,n,r,o)}}}}()}),d=(r.StreamCipher=f.extend({_doFinalize:function(){var e=this._process(!0);return e},blockSize:1}),n.mode={}),h=r.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=d.CBC=function(){function e(e,n,r){var o=this._iv;if(o){var a=o;this._iv=t}else var a=this._prevBlock;for(var i=0;i>>2];e.sigBytes-=t}},v=(r.BlockCipher=f.extend({cfg:f.cfg.extend({mode:p,padding:m}),reset:function(){f.reset.call(this);var e=this.cfg,t=e.iv,n=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=n.createEncryptor;else{var r=n.createDecryptor;this._minBufferSize=1}this._mode=r.call(n,this,t&&t.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else{var t=this._process(!0);e.unpad(t)}return t},blockSize:4}),r.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),y=n.format={},b=y.OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;if(n)var r=a.create([1398893684,1701076831]).concat(n).concat(t);else var r=t;return r.toString(l)},parse:function(e){var t=l.parse(e),n=t.words;if(1398893684==n[0]&&1701076831==n[1]){var r=a.create(n.slice(2,4));n.splice(0,4),t.sigBytes-=16}return v.create({ciphertext:t,salt:r})}},_=r.SerializableCipher=o.extend({cfg:o.extend({format:b}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var o=e.createEncryptor(n,r),a=o.finalize(t),i=o.cfg;return v.create({ciphertext:a,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var o=e.createDecryptor(n,r).finalize(t.ciphertext);return o},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),x=n.kdf={},w=x.OpenSSL={execute:function(e,t,n,r){r||(r=a.random(8));var o=c.create({keySize:t+n}).compute(e,r),i=a.create(o.words.slice(t),4*n);return o.sigBytes=4*t,v.create({key:o,iv:i,salt:r})}},C=r.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:w}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var o=r.kdf.execute(n,e.keySize,e.ivSize);r.iv=o.iv;var a=_.encrypt.call(this,e,t,o.key,r);return a.mixIn(o),a},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var o=r.kdf.execute(n,e.keySize,e.ivSize,t.salt);r.iv=o.iv;var a=_.decrypt.call(this,e,t,o.key,r);return a}})}()})},function(e,t,n){(function(e){"use strict";function n(e){return e.charAt(0).toUpperCase()+e.slice(1)}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.isA||(t.isA=[]),n&&t.isA.push(n),e.isA||(e.isA=function(e){return t.isA.indexOf(e)!==-1})}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];r.forEach(function(r){e["set"+n(r)]=function(e){t[r]=e}})}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];r.forEach(function(r){e["get"+n(r)]=function(){return t[r]}})}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.destroy;t.subscriptions||(t.subscriptions=[]),e.destroy=function(){for(n&&n();t.subscriptions&&t.subscriptions.length;)t.subscriptions.pop().unsubscribe();Object.keys(t).forEach(function(e){delete t[e]}),t.deleted=!0}}function s(t,r,o){function a(e){l[e]=null}function i(e){function t(){a(e)}return Object.freeze({unsubscribe:t})}var s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],l=[],u=t.destroy;t["fire"+n(o)]=function(){function n(){l.forEach(function(e){if(e)try{e.apply(t,i)}catch(n){console.log("Error event:",o,n)}})}for(var a=arguments.length,i=Array(a),u=0;u1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=l.length,s={id:a,variables:n,metadata:Object.assign({},o.defaultMetadata,r)},u={onDataReady:t,request:s};return l.push(u),e[f](s),i(u,null),{unsubscribe:function(){s.action="unsubscribe",e[f](s),l[a]=null},update:function(t,n){s.variables=[].concat(t),s.metadata=Object.assign({},s.metadata,n),e[f](s),i(u,null)}}},e["set"+n(r)]=function(e){o.set(t[d],e)||l.forEach(function(t){return i(t,e)})},e.destroy=c(a,e.destroy)}function d(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n={},r={};return e(r,n,t),Object.freeze(r)}}Object.defineProperty(t,"__esModule",{value:!0}),t.capitalize=n,t["default"]={chain:c,dataSubscriber:f,destroy:i,dynamicArray:u,event:s,fetch:l,get:a,isA:r,newInstance:d,set:o}}).call(t,n(24).setImmediate)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(675),s=r(i);t["default"]=a["default"].createClass({displayName:"CollapsibleWidget",propTypes:{children:a["default"].PropTypes.oneOfType([a["default"].PropTypes.object,a["default"].PropTypes.array]),onChange:a["default"].PropTypes.func,open:a["default"].PropTypes.bool,subtitle:a["default"].PropTypes.oneOfType([a["default"].PropTypes.object,a["default"].PropTypes.string,a["default"].PropTypes.array]),title:a["default"].PropTypes.string,visible:a["default"].PropTypes.bool,activeSubTitle:a["default"].PropTypes.bool,disableCollapse:a["default"].PropTypes.bool},getDefaultProps:function(){return{title:"",subtitle:"",open:!0,visible:!0,disableCollapse:!1}},getInitialState:function(){return{open:this.props.open}},toggleOpen:function(){if(!this.props.disableCollapse||!this.state.open){var e=!this.state.open;this.setState({open:e}),this.props.onChange&&this.props.onChange(e)}},isCollapsed:function(){return this.state.open===!1},isExpanded:function(){return this.state.open===!0},render:function(){var e={};return this.props.visible||(e.display="none"),a["default"].createElement("section",{className:s["default"].container,style:e},a["default"].createElement("div",{className:s["default"].header},a["default"].createElement("div",{onClick:this.toggleOpen},a["default"].createElement("i",{className:s["default"][this.state.open?"caret":"caretClosed"]}),a["default"].createElement("strong",{className:s["default"].title},this.props.title)),a["default"].createElement("span",{className:this.props.activeSubTitle?s["default"].subtitleActive:s["default"].subtitle},this.props.subtitle)),a["default"].createElement("div",{className:s["default"][this.state.open?"visibleContent":"hiddenContent"]},this.props.children))}})},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};e.exports=r},function(e,t,n){"use strict";function r(e){return"[object Array]"===C.call(e)}function o(e){return"[object ArrayBuffer]"===C.call(e)}function a(e){return"undefined"!=typeof FormData&&e instanceof FormData}function i(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function s(e){return"string"==typeof e}function l(e){return"number"==typeof e}function u(e){return"undefined"==typeof e}function c(e){return null!==e&&"object"==typeof e}function f(e){return"[object Date]"===C.call(e)}function d(e){return"[object File]"===C.call(e)}function h(e){return"[object Blob]"===C.call(e)}function p(e){return"[object Function]"===C.call(e)}function g(e){return c(e)&&p(e.pipe)}function m(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function v(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function y(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function b(e,t){if(null!==e&&"undefined"!=typeof e)if("object"==typeof e||r(e)||(e=[e]),r(e))for(var n=0,o=e.length;n1&&void 0!==arguments[1]&&arguments[1],n=v.get(e);return n&&!t||(n={timestamp:-1},v.set(e,n)),o(e,n),n}function i(e){return g.on(m,e)}function s(){g.emit(m)}function l(){return x}function u(){x||(window.addEventListener("resize",b),x=!0)}function c(){x&&(window.removeEventListener("resize",b),x=!1)}function f(){_+=1,s()}Object.defineProperty(t,"__esModule",{value:!0});var d=n(150),h=r(d),p=n(148),g=new h["default"],m="window.size.change",v=new WeakMap,y=["scrollWidth","scrollHeight","clientWidth","clientHeight"],b=(0,p.debounce)(f,250),_=0,x=!1;t["default"]={getSize:a,isListening:l,onSizeChange:i,startListening:u,stopListening:c,triggerChange:s}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},t.setImmediate="function"==typeof e?e:function(e){var n=u++,r=!(arguments.length<2)&&s.call(arguments,1);return l[n]=!0,a(function(){l[n]&&(r?e.apply(null,r):e.call(null),t.clearImmediate(n))}),n},t.clearImmediate="function"==typeof r?r:function(e){delete l[e]}}).call(t,n(24).setImmediate,n(24).clearImmediate)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(693),s=r(i);t["default"]=a["default"].createClass({displayName:"ToggleIconButtonWidget",propTypes:{alwaysOn:a["default"].PropTypes.bool,className:a["default"].PropTypes.string,icon:a["default"].PropTypes.string,name:a["default"].PropTypes.string,onChange:a["default"].PropTypes.func,toggle:a["default"].PropTypes.bool,value:a["default"].PropTypes.bool},getDefaultProps:function(){return{className:"",value:!0,icon:"fa-sun-o",toggle:!0,name:"toggle-button"}},getInitialState:function(){return{enabled:this.props.value}},componentWillReceiveProps:function(e){e.value!==this.state.enabled&&this.setState({enabled:e.value})},buttonClicked:function(){var e=this.props.toggle?!this.state.enabled:this.state.enabled;this.props.onChange&&this.props.onChange(e,this.props.name),this.props.toggle&&this.setState({enabled:e})},render:function(){var e=[this.props.icon,this.props.className];return e.push(this.state.enabled||this.props.alwaysOn?s["default"].enabledButton:s["default"].disabledButton),a["default"].createElement("i",{className:e.join(" "),onClick:this.buttonClicked})}})},function(e,t,n){"use strict";function r(e){return void 0!==e.ref}function o(e){return void 0!==e.key}var a=n(11),i=n(34),s=(n(8),n(224),Object.prototype.hasOwnProperty),l="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103,u={key:!0,ref:!0,__self:!0,__source:!0},c=function(e,t,n,r,o,a,i){var s={$$typeof:l,type:e,key:t,ref:n,props:i,_owner:a};return s};c.createElement=function(e,t,n){var a,l={},f=null,d=null,h=null,p=null;if(null!=t){r(t)&&(d=t.ref),o(t)&&(f=""+t.key),h=void 0===t.__self?null:t.__self,p=void 0===t.__source?null:t.__source;for(a in t)s.call(t,a)&&!u.hasOwnProperty(a)&&(l[a]=t[a])}var g=arguments.length-2;if(1===g)l.children=n;else if(g>1){for(var m=Array(g),v=0;v1){for(var b=Array(y),_=0;_t[0]?t.shift():(n.push(e.shift()),t.shift());return n}function o(e,t,n){var r={};return t.forEach(function(t){n&&void 0===e[t]&&void 0!==n[t]?r[t]=n[t]:r[t]=e[t],Array.isArray(r[t])&&(r[t]=r[t].map(function(e){return e}))}),r}function a(){return g+=1,{type:"empty",generation:g}}function i(e,t){return g+=1,{type:"partition",generation:g,partition:{variable:e,dividers:t.map(function(e){return o(e,["value","uncertainty","closeToLeft"],{closeToLeft:!1})})}}}function s(e){g+=1;var t={},n={type:"range",generation:g,range:{variables:t}};return Object.keys(e).forEach(function(n){t[n]=e[n].map(function(e){return o(e,["interval","endpoints","uncertainty"],{endpoints:"**"})}),t[n].sort(function(e,t){return e.interval[0]-t.interval[0]})}),n}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multi",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return g+=1,{type:"rule",generation:g,rule:{type:e,terms:t,roles:n}}}function u(e,t){var n=["or"];return t.forEach(function(t){n.push({type:"5C",terms:[t.interval[0],m[t.endpoints[0]],e,m[t.endpoints[1]],t.interval[1]]})}),2===n.length?n[1]:{type:"logical",terms:n}}function c(e){var t=["and"],n=e.range.variables;return Object.keys(n).forEach(function(e){t.push(u(e,n[e]))}),l("logical",t)}function f(e){var t=[],n=e.partition,r=n.dividers,o=n.variable,a=r.map(function(e,t,n){return 0===t?{type:"3L",terms:[o,e.closeToLeft?"<":"<=",e.value]}:{type:"5C",terms:[n[t-1].value,n[t-1].closeToLeft?"<":"<=",o,e.closeToLeft?"<":"<=",e.value]}}),i=r.slice(-1);for(a.push({type:"3R",terms:[i.value,i.closeToLeft?"<":"<=",o]});t.length0}return"partition"===e.type?n.indexOf(e.partition.variable)!==-1:(console.log("SelectionBuilder::hasField does not handle selection of type",e.type),!1)}Object.defineProperty(t,"__esModule",{value:!0});var g=0,m={o:"<","*":"<="},v=(t.ruleTypes={"3L":{terms:3,operators:{values:[["<","<="]],index:[1]},variable:0,values:[2]},"3R":{terms:3,operators:{values:[[">",">="]],index:[1]},variable:2,values:[0]},"5C":{terms:5,operators:{values:[["<","<="],["<","<="]],index:[1,3]},variable:2,values:[0,4]},multi:{terms:-1,operators:null},logical:{operators:{values:["not","and","or","xor"],index:[0]}},row:{}},a());t["default"]={convertToRuleSelection:d,empty:a,EMPTY_SELECTION:v,hasField:p,markModified:h,partition:i,range:s,rule:l,setInitialGenerationNumber:n}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(710),s=r(i);t["default"]=a["default"].createClass({displayName:"SvgIconWidget",propTypes:{className:a["default"].PropTypes.string,height:a["default"].PropTypes.string,icon:a["default"].PropTypes.string,width:a["default"].PropTypes.string,style:a["default"].PropTypes.object,onClick:a["default"].PropTypes.func},getDefaultProps:function(){return{className:"",icon:s["default"],style:{}}},render:function(){var e=Object.assign({},this.props.style,{width:this.props.width,height:this.props.height});return a["default"].createElement("svg",{style:e,className:this.props.className,onClick:this.props.onClick},a["default"].createElement("use",{xlinkHref:this.props.icon}))}})},function(e,t,n){"use strict";var r=n(72),o=r({bubbled:null,captured:null}),a=r({topAbort:null,topAnimationEnd:null,topAnimationIteration:null,topAnimationStart:null,topBlur:null,topCanPlay:null,topCanPlayThrough: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,topDurationChange:null,topEmptied:null,topEncrypted:null,topEnded:null,topError:null,topFocus:null,topInput:null,topInvalid:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topLoadedData:null,topLoadedMetadata:null,topLoadStart:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topPause:null,topPlay:null,topPlaying:null,topProgress:null,topRateChange:null,topReset:null,topScroll:null,topSeeked:null,topSeeking:null,topSelectionChange:null,topStalled:null,topSubmit:null,topSuspend:null,topTextInput:null,topTimeUpdate:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topTransitionEnd:null,topVolumeChange:null,topWaiting:null,topWheel:null}),i={topLevelTypes:a,PropagationPhases:o};e.exports=i},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var l=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return l?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}var o=n(11),a=n(33),i=n(22),s=(n(8),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),l={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;nv?(r.scrollInternal.deltaX=0,r.scrollInternal.deltaY=0,t.isFirst=!0,t.isFinal=!1):t.isFinal=!1,void 0===e.wheelDeltaX?(t.zoom=r.lastScrollZoomFactor,r.scrollInternal.deltaY-=2*e.detail):(t.zoom=r.lastScrollZoomFactor,r.scrollInternal.deltaX+=e.wheelDeltaX,r.scrollInternal.deltaY+=e.wheelDeltaY),t.deltaX=r.scrollInternal.deltaX,t.deltaY=r.scrollInternal.deltaY,t.scale=1+t.deltaY/r.el.getClientRects()[0].height,t.scale=t.scale<.1?.1:t.scale,r.scrollInternal.ts=n,r.finalZoomEvent=t}return r.emit(t.topic,t),!1},this.hammer.get("pan").set(u.pan),this.hammer.get("pinch").set(u.pinch),this.hammer.on("tap",function(e){s(r,"click",e)}),this.hammer.on("doubletap",function(e){s(r,"dblclick",e)}),this.hammer.on("pan",function(e){s(r,"drag",e)}),this.hammer.on("panstart",function(e){e.isFirst=!0,s(r,"drag",e)}),this.hammer.on("panend",function(e){e.isFinal=!0,s(r,"drag",e)}),this.hammer.on("pinch",function(e){s(r,"zoom",e)}),this.hammer.on("pinchstart",function(e){console.log("zoom start"),e.isFirst=!0,s(r,"zoom",e)}),this.hammer.on("pinchend",function(e){e.isFinal=!0,console.log("zoom end"),s(r,"zoom",e)}),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("press",function(e){r.toggleModifierEnable&&(r.toggleModifierIdx=(r.toggleModifierIdx+1)%r.toggleModifiers.length,r.modifier=r.toggleModifiers[r.toggleModifierIdx],e.relative=i(r.el,e),r.emit("modifier.change",{value:r.modifier,list:g,event:e}))}),this.el.addEventListener("contextmenu",this.domEventHandler),this.el.addEventListener("mousewheel",this.domEventHandler),this.el.addEventListener("DOMMouseScroll",this.domEventHandler)}return l(e,[{key:"enablePinch",value:function(e){this.hammer.get("pinch").set({enable:e})}},{key:"setModifier",value:function(e){this.modifier=e}},{key:"toggleModifierOnPress",value:function(e,t){this.toggleModifiers=t,this.toggleModifierEnable=e}},{key:"attach",value:function(e){var t=this,n={};return Object.keys(e).forEach(function(r){n[r]=t.on(r,e[r])}),n}},{key:"destroy",value:function(){this.off(),this.hammer.destroy(),this.el.removeEventListener("contextmenu",this.domEventHandler),this.el.removeEventListener("mousewheel",this.domEventHandler),this.el.removeEventListener("DOMMouseScroll",this.domEventHandler)}}]),e}();t["default"]=b,p["default"].mixInto(b)},function(e,t,n){var r,o;!function(){function a(e){return e&&(e.ownerDocument||e.document||e).documentElement}function i(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}function s(e,t){return et?1:e>=t?0:NaN}function l(e){return null===e?NaN:+e}function u(e){return!isNaN(e)}function c(e){return{left:function(t,n,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=t.length);r>>1;e(t[a],n)<0?r=a+1:o=a}return r},right:function(t,n,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=t.length);r>>1;e(t[a],n)>0?o=a:r=a+1}return r}}}function f(e){return e.length}function d(e){for(var t=1;e*t%1;)t*=10;return t}function h(e,t){for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}function p(){this._=Object.create(null)}function g(e){return(e+="")===Ei||e[0]===Ti?Ti+e:e}function m(e){return(e+="")[0]===Ti?e.slice(1):e}function v(e){return g(e)in this._}function y(e){return(e=g(e))in this._&&delete this._[e]}function b(){var e=[];for(var t in this._)e.push(m(t));return e}function _(){var e=0;for(var t in this._)++e;return e}function x(){for(var e in this._)return!1;return!0}function w(){this._=Object.create(null)}function C(e){return e}function k(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function M(e,t){if(t in e)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var n=0,r=Ai.length;n=t&&(t=o+1);!(i=s[t])&&++t0&&(e=e.slice(0,s));var u=Fi.get(e);return u&&(e=u,l=$),s?t?o:r:t?E:a}function J(e,t){return function(n){var r=hi.event;hi.event=n,t[0]=this.__data__;try{e.apply(this,t)}finally{hi.event=r}}}function $(e,t){var n=J(e,t);return function(e){var t=this,r=e.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||n.call(t,e)}}function ee(e){var t=".dragsuppress-"+ ++zi,n="click"+t,r=hi.select(i(e)).on("touchmove"+t,S).on("dragstart"+t,S).on("selectstart"+t,S);if(null==Bi&&(Bi=!("onselectstart"in e)&&M(e.style,"userSelect")),Bi){var o=a(e).style,s=o[Bi];o[Bi]="none"}return function(e){if(r.on(t,null),Bi&&(o[Bi]=s),e){var a=function(){r.on(n,null)};r.on(n,function(){S(),a()},!0),setTimeout(a,0)}}}function te(e,t){t.changedTouches&&(t=t.changedTouches[0]);var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();if(Ui<0){var o=i(e);if(o.scrollX||o.scrollY){n=hi.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=n[0][0].getScreenCTM();Ui=!(a.f||a.e),n.remove()}}return Ui?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function ne(){return hi.event.changedTouches[0].identifier}function re(e){return e>0?1:e<0?-1:0}function oe(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function ae(e){return e>1?0:e<-1?qi:Math.acos(e)}function ie(e){return e>1?Gi:e<-1?-Gi:Math.asin(e)}function se(e){return((e=Math.exp(e))-1/e)/2}function le(e){return((e=Math.exp(e))+1/e)/2}function ue(e){return((e=Math.exp(2*e))-1)/(e+1)}function ce(e){return(e=Math.sin(e/2))*e}function fe(){}function de(e,t,n){return this instanceof de?(this.h=+e,this.s=+t,void(this.l=+n)):arguments.length<2?e instanceof de?new de(e.h,e.s,e.l):Ee(""+e,Te,de):new de(e,t,n)}function he(e,t,n){function r(e){return e>360?e-=360:e<0&&(e+=360),e<60?a+(i-a)*e/60:e<180?i:e<240?a+(i-a)*(240-e)/60:a}function o(e){return Math.round(255*r(e))}var a,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,a=2*n-i,new we(o(e+120),o(e),o(e-120))}function pe(e,t,n){return this instanceof pe?(this.h=+e,this.c=+t,void(this.l=+n)):arguments.length<2?e instanceof pe?new pe(e.h,e.c,e.l):e instanceof me?ye(e.l,e.a,e.b):ye((e=Ae((e=hi.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new pe(e,t,n)}function ge(e,t,n){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new me(n,Math.cos(e*=Yi)*t,Math.sin(e)*t)}function me(e,t,n){return this instanceof me?(this.l=+e,this.a=+t,void(this.b=+n)):arguments.length<2?e instanceof me?new me(e.l,e.a,e.b):e instanceof pe?ge(e.h,e.c,e.l):Ae((e=we(e)).r,e.g,e.b):new me(e,t,n)}function ve(e,t,n){var r=(e+16)/116,o=r+t/500,a=r-n/200;return o=be(o)*as,r=be(r)*is,a=be(a)*ss,new we(xe(3.2404542*o-1.5371385*r-.4985314*a),xe(-.969266*o+1.8760108*r+.041556*a),xe(.0556434*o-.2040259*r+1.0572252*a))}function ye(e,t,n){return e>0?new pe(Math.atan2(n,t)*Zi,Math.sqrt(t*t+n*n),e):new pe(NaN,NaN,e)}function be(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function _e(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function xe(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function we(e,t,n){return this instanceof we?(this.r=~~e,this.g=~~t,void(this.b=~~n)):arguments.length<2?e instanceof we?new we(e.r,e.g,e.b):Ee(""+e,we,he):new we(e,t,n)}function Ce(e){return new we(e>>16,e>>8&255,255&e)}function ke(e){return Ce(e)+""}function Me(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Ee(e,t,n){var r,o,a,i=0,s=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(o=r[2].split(","),r[1]){case"hsl":return n(parseFloat(o[0]),parseFloat(o[1])/100,parseFloat(o[2])/100);case"rgb":return t(Pe(o[0]),Pe(o[1]),Pe(o[2]))}return(a=cs.get(e))?t(a.r,a.g,a.b):(null==e||"#"!==e.charAt(0)||isNaN(a=parseInt(e.slice(1),16))||(4===e.length?(i=(3840&a)>>4,i=i>>4|i,s=240&a,s=s>>4|s,l=15&a,l=l<<4|l):7===e.length&&(i=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),t(i,s,l))}function Te(e,t,n){var r,o,a=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-a,l=(i+a)/2;return s?(o=l<.5?s/(i+a):s/(2-i-a),r=e==i?(t-n)/s+(t0&&l<1?0:r),new de(r,o,l)}function Ae(e,t,n){e=Se(e),t=Se(t),n=Se(n);var r=_e((.4124564*e+.3575761*t+.1804375*n)/as),o=_e((.2126729*e+.7151522*t+.072175*n)/is),a=_e((.0193339*e+.119192*t+.9503041*n)/ss);return me(116*o-16,500*(r-o),200*(o-a))}function Se(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Pe(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}function Le(e){return"function"==typeof e?e:function(){return e}}function Re(e){return function(t,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),Ie(t,n,e,r)}}function Ie(e,t,n,r){function o(){var e,t=l.status;if(!t&&Oe(l)||t>=200&&t<300||304===t){try{e=n.call(a,l)}catch(r){return void i.error.call(a,r)}i.load.call(a,e)}else i.error.call(a,l)}var a={},i=hi.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(e)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=o:l.onreadystatechange=function(){l.readyState>3&&o()},l.onprogress=function(e){var t=hi.event;hi.event=e;try{i.progress.call(a,l)}finally{hi.event=t}},a.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",a)},a.mimeType=function(e){return arguments.length?(t=null==e?null:e+"",a):t},a.responseType=function(e){return arguments.length?(u=e,a):u},a.response=function(e){return n=e,a},["get","post"].forEach(function(e){a[e]=function(){return a.send.apply(a,[e].concat(gi(arguments)))}}),a.send=function(n,r,o){if(2===arguments.length&&"function"==typeof r&&(o=r,r=null),l.open(n,e,!0),null==t||"accept"in s||(s.accept=t+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=u&&(l.responseType=u),null!=o&&a.on("error",o).on("load",function(e){o(null,e)}),i.beforesend.call(a,l),l.send(null==r?null:r),a},a.abort=function(){return l.abort(),a},hi.rebind(a,i,"on"),null==r?a:a.get(De(r))}function De(e){return 1===e.length?function(t,n){e(null==t?n:null)}:e}function Oe(e){var t=e.responseType;return t&&"text"!==t?e.response:e.responseText}function Ne(e,t,n){var r=arguments.length;r<2&&(t=0),r<3&&(n=Date.now());var o=n+t,a={c:e,t:o,n:null};return ds?ds.n=a:fs=a,ds=a,hs||(ps=clearTimeout(ps),hs=1,gs(je)),a}function je(){var e=Fe(),t=Be()-e;t>24?(isFinite(t)&&(clearTimeout(ps),ps=setTimeout(je,t)),hs=0):(hs=1,gs(je))}function Fe(){for(var e=Date.now(),t=fs;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Be(){for(var e,t=fs,n=1/0;t;)t.c?(t.t8?function(e){return e/n}:function(e){return e*n},symbol:e}}function We(e){var t=e.decimal,n=e.thousands,r=e.grouping,o=e.currency,a=r&&n?function(e,t){for(var o=e.length,a=[],i=0,s=r[0],l=0;o>0&&s>0&&(l+s+1>t&&(s=Math.max(1,t-l)),a.push(e.substring(o-=s,o+s)),!((l+=s+1)>t));)s=r[i=(i+1)%r.length];return a.reverse().join(n)}:C;return function(e){var n=vs.exec(e),r=n[1]||" ",i=n[2]||">",s=n[3]||"-",l=n[4]||"",u=n[5],c=+n[6],f=n[7],d=n[8],h=n[9],p=1,g="",m="",v=!1,y=!0;switch(d&&(d=+d.substring(1)),(u||"0"===r&&"="===i)&&(u=r="0",i="="),h){case"n":f=!0,h="g";break;case"%":p=100,m="%",h="f";break;case"p":p=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+h.toLowerCase());case"c":y=!1;case"d":v=!0,d=0;break;case"s":p=-1,h="r"}"$"===l&&(g=o[0],m=o[1]),"r"!=h||d||(h="g"),null!=d&&("g"==h?d=Math.max(1,Math.min(21,d)):"e"!=h&&"f"!=h||(d=Math.max(0,Math.min(20,d)))),h=ys.get(h)||He;var b=u&&f;return function(e){var n=m;if(v&&e%1)return"";var o=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===s?"":s;if(p<0){var l=hi.formatPrefix(e,d);e=l.scale(e),n=l.symbol+m}else e*=p;e=h(e,d);var _,x,w=e.lastIndexOf(".");if(w<0){var C=y?e.lastIndexOf("e"):-1;C<0?(_=e,x=""):(_=e.substring(0,C),x=e.substring(C))}else _=e.substring(0,w),x=t+e.substring(w+1);!u&&f&&(_=a(_,1/0));var k=g.length+_.length+x.length+(b?0:o.length),M=k"===i?M+o+e:"^"===i?M.substring(0,k>>=1)+o+e+M.substring(k):o+(b?e:M+e))+n}}}function He(e){return e+""}function qe(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ve(e,t,n){function r(t){var n=e(t),r=a(n,1);return t-n1)for(;i=u)return-1;if(o=t.charCodeAt(s++),37===o){if(i=t.charAt(s++),a=S[i in ws?t.charAt(s++):i],!a||(r=a(e,n,r))<0)return-1}else if(o!=n.charCodeAt(r++))return-1}return r}function r(e,t,n){w.lastIndex=0;var r=w.exec(t.slice(n));return r?(e.w=C.get(r[0].toLowerCase()),n+r[0].length):-1}function o(e,t,n){_.lastIndex=0;var r=_.exec(t.slice(n));return r?(e.w=x.get(r[0].toLowerCase()),n+r[0].length):-1}function a(e,t,n){E.lastIndex=0;var r=E.exec(t.slice(n));return r?(e.m=T.get(r[0].toLowerCase()),n+r[0].length):-1}function i(e,t,n){k.lastIndex=0;var r=k.exec(t.slice(n));return r?(e.m=M.get(r[0].toLowerCase()),n+r[0].length):-1}function s(e,t,r){return n(e,A.c.toString(),t,r)}function l(e,t,r){return n(e,A.x.toString(),t,r)}function u(e,t,r){return n(e,A.X.toString(),t,r)}function c(e,t,n){var r=b.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)}var f=e.dateTime,d=e.date,h=e.time,p=e.periods,g=e.days,m=e.shortDays,v=e.months,y=e.shortMonths;t.utc=function(e){function n(e){try{_s=qe;var t=new _s;return t._=e,r(t)}finally{_s=Date}}var r=t(e);return n.parse=function(e){try{_s=qe;var t=r.parse(e);return t&&t._}finally{_s=Date}},n.toString=r.toString,n},t.multi=t.utc.multi=ht;var b=hi.map(),_=Ze(g),x=Qe(g),w=Ze(m),C=Qe(m),k=Ze(v),M=Qe(v),E=Ze(y),T=Qe(y);p.forEach(function(e,t){b.set(e.toLowerCase(),t)});var A={a:function(e){return m[e.getDay()]},A:function(e){return g[e.getDay()]},b:function(e){return y[e.getMonth()]},B:function(e){return v[e.getMonth()]},c:t(f),d:function(e,t){return Ye(e.getDate(),t,2)},e:function(e,t){return Ye(e.getDate(),t,2)},H:function(e,t){return Ye(e.getHours(),t,2)},I:function(e,t){return Ye(e.getHours()%12||12,t,2)},j:function(e,t){return Ye(1+bs.dayOfYear(e),t,3)},L:function(e,t){return Ye(e.getMilliseconds(),t,3)},m:function(e,t){return Ye(e.getMonth()+1,t,2)},M:function(e,t){return Ye(e.getMinutes(),t,2)},p:function(e){return p[+(e.getHours()>=12)]},S:function(e,t){return Ye(e.getSeconds(),t,2)},U:function(e,t){return Ye(bs.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Ye(bs.mondayOfYear(e),t,2)},x:t(d),X:t(h),y:function(e,t){return Ye(e.getFullYear()%100,t,2)},Y:function(e,t){return Ye(e.getFullYear()%1e4,t,4)},Z:ft,"%":function(){return"%"}},S={a:r,A:o,b:a,B:i,c:s,d:at,e:at,H:st,I:st,j:it,L:ct,m:ot,M:lt,p:c,S:ut,U:Je,w:Ke,W:$e,x:l,X:u,y:tt,Y:et,Z:nt,"%":dt};return t}function Ye(e,t,n){var r=e<0?"-":"",o=(r?-e:e)+"",a=o.length;return r+(a68?1900:2e3)}function ot(e,t,n){Cs.lastIndex=0;var r=Cs.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function at(e,t,n){Cs.lastIndex=0;var r=Cs.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function it(e,t,n){Cs.lastIndex=0;var r=Cs.exec(t.slice(n,n+3));return r?(e.j=+r[0],n+r[0].length):-1}function st(e,t,n){Cs.lastIndex=0;var r=Cs.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function lt(e,t,n){Cs.lastIndex=0;var r=Cs.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function ut(e,t,n){Cs.lastIndex=0;var r=Cs.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function ct(e,t,n){Cs.lastIndex=0;var r=Cs.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ft(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=Mi(t)/60|0,o=Mi(t)%60;return n+Ye(r,"0",2)+Ye(o,"0",2)}function dt(e,t,n){ks.lastIndex=0;var r=ks.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function ht(e){for(var t=e.length,n=-1;++n=0?1:-1,s=i*n,l=Math.cos(t),u=Math.sin(t),c=a*u,f=o*l+c*Math.cos(s),d=c*i*Math.sin(s);Ps.add(Math.atan2(d,f)),r=e,o=l,a=u}var t,n,r,o,a;Ls.point=function(i,s){Ls.point=e,r=(t=i)*Yi,o=Math.cos(s=(n=s)*Yi/2+qi/4),a=Math.sin(s)},Ls.lineEnd=function(){e(t,n)}}function _t(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 xt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function wt(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 Ct(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function kt(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Mt(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 Et(e){return[Math.atan2(e[1],e[0]),ie(e[2])]}function Tt(e,t){return Mi(e[0]-t[0])=0;--s)o.point((f=c[s])[0],f[1])}else r(h.x,h.p.x,-1,o);h=h.p}h=h.o,c=h.z,p=!p}while(!h.v);o.lineEnd()}}}function Nt(e){if(t=e.length){for(var t,n,r=0,o=e[0];++r0){for(x||(a.polygonStart(),x=!0),a.lineStart();++i1&&2&t&&n.push(n.pop().concat(n.shift())),h.push(n.filter(Bt))}var h,p,g,m=t(a),v=o.invert(r[0],r[1]),y={point:i,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=f,y.lineEnd=d,h=[],p=[]},polygonEnd:function(){y.point=i,y.lineStart=l,y.lineEnd=u,h=hi.merge(h);var e=Vt(v,p);h.length?(x||(a.polygonStart(),x=!0),Ot(h,Ut,e,n,a)):e&&(x||(a.polygonStart(),x=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),x&&(a.polygonEnd(),x=!1),h=p=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=zt(),_=t(b),x=!1;return y}}function Bt(e){return e.length>1}function zt(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,n){e.push([t,n])},lineEnd:E,buffer:function(){var n=t;return t=[],e=null,n},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ut(e,t){return((e=e.x)[0]<0?e[1]-Gi-Wi:Gi-e[1])-((t=t.x)[0]<0?t[1]-Gi-Wi:Gi-t[1])}function Wt(e){var t,n=NaN,r=NaN,o=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(a,i){var s=a>0?qi:-qi,l=Mi(a-n);Mi(l-qi)0?Gi:-Gi),e.point(o,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(a,r),t=0):o!==s&&l>=qi&&(Mi(n-o)Wi?Math.atan((Math.sin(t)*(a=Math.cos(r))*Math.sin(n)-Math.sin(r)*(o=Math.cos(t))*Math.sin(e))/(o*a*i)):(t+r)/2}function qt(e,t,n,r){var o;if(null==e)o=n*Gi,r.point(-qi,o),r.point(0,o),r.point(qi,o),r.point(qi,0),r.point(qi,-o),r.point(0,-o),r.point(-qi,-o),r.point(-qi,0),r.point(-qi,o);else if(Mi(e[0]-t[0])>Wi){var a=e[0]=0?1:-1,C=w*x,k=C>qi,M=p*b;if(Ps.add(Math.atan2(M*w*Math.sin(C),g*_+M*Math.cos(C))),a+=k?x+w*Vi:x,k^d>=n^v>=n){var E=wt(_t(f),_t(e));Mt(E);var T=wt(o,E);Mt(T);var A=(k^x>=0?-1:1)*ie(T[2]);(r>A||r===A&&(E[0]||E[1]))&&(i+=k^x>=0?1:-1)}if(!m++)break;d=v,p=b,g=_,f=e}}return(a<-Wi||aa}function n(e){var n,a,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,d){var h,p=[f,d],g=t(f,d),m=i?g?0:o(f,d):g?o(f+(f<0?qi:-qi),d):0;if(!n&&(u=l=g)&&e.lineStart(),g!==l&&(h=r(n,p),(Tt(n,h)||Tt(p,h))&&(p[0]+=Wi,p[1]+=Wi,g=t(p[0],p[1]))),g!==l)c=0,g?(e.lineStart(),h=r(p,n),e.point(h[0],h[1])):(h=r(n,p),e.point(h[0],h[1]),e.lineEnd()),n=h;else if(s&&n&&i^g){var v;m&a||!(v=r(p,n,!0))||(c=0,i?(e.lineStart(),e.point(v[0][0],v[0][1]),e.point(v[1][0],v[1][1]),e.lineEnd()):(e.point(v[1][0],v[1][1]),e.lineEnd(),e.lineStart(),e.point(v[0][0],v[0][1])))}!g||n&&Tt(n,p)||e.point(p[0],p[1]),n=p,l=g,a=m},lineEnd:function(){l&&e.lineEnd(),n=null},clean:function(){return c|(u&&l)<<1}}}function r(e,t,n){var r=_t(e),o=_t(t),i=[1,0,0],s=wt(r,o),l=xt(s,s),u=s[0],c=l-u*u;if(!c)return!n&&e;var f=a*l/c,d=-a*u/c,h=wt(i,s),p=kt(i,f),g=kt(s,d);Ct(p,g);var m=h,v=xt(p,m),y=xt(m,m),b=v*v-y*(xt(p,p)-1);if(!(b<0)){var _=Math.sqrt(b),x=kt(m,(-v-_)/y);if(Ct(x,p),x=Et(x),!n)return x;var w,C=e[0],k=t[0],M=e[1],E=t[1];k0^x[1]<(Mi(x[0]-C)qi^(C<=x[0]&&x[0]<=k)){var P=kt(m,(-v+_)/y);return Ct(P,p),[x,Et(P)]}}}function o(t,n){var r=i?e:qi-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}var a=Math.cos(e),i=a>0,s=Mi(a)>Wi,l=_n(e,6*Yi);return Ft(t,n,l,i?[0,-e]:[-qi,e-qi])}function Gt(e,t,n,r){return function(o){var a,i=o.a,s=o.b,l=i.x,u=i.y,c=s.x,f=s.y,d=0,h=1,p=c-l,g=f-u;if(a=e-l,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>h)return;a>d&&(d=a)}if(a=n-l,p||!(a<0)){if(a/=p,p<0){if(a>h)return;a>d&&(d=a)}else if(p>0){if(a0)){if(a/=g,g<0){if(a0){if(a>h)return;a>d&&(d=a)}if(a=r-u,g||!(a<0)){if(a/=g,g<0){if(a>h)return;a>d&&(d=a)}else if(g>0){if(a0&&(o.a={x:l+d*p,y:u+d*g}),h<1&&(o.b={x:l+h*p,y:u+h*g}),o}}}}}}function Yt(e,t,n,r){function o(r,o){return Mi(r[0]-e)0?0:3:Mi(r[0]-n)0?2:1:Mi(r[1]-t)0?1:0:o>0?3:2}function a(e,t){return i(e.x,t.x)}function i(e,t){var n=o(e,1),r=o(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(s){function l(e){for(var t=0,n=m.length,r=e[1],o=0;or&&oe(u,a,e)>0&&++t:a[1]<=r&&oe(u,a,e)<0&&--t,u=a;return 0!==t}function u(a,s,l,u){var c=0,f=0;if(null==a||(c=o(a,l))!==(f=o(s,l))||i(a,s)<0^l>0){do u.point(0===c||3===c?e:n,c>1?r:t);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(o,a){return e<=o&&o<=n&&t<=a&&a<=r}function f(e,t){c(e,t)&&s.point(e,t)}function d(){S.point=p,m&&m.push(v=[]),k=!0,C=!1,x=w=NaN}function h(){g&&(p(y,b),_&&C&&T.rejoin(),g.push(T.buffer())),S.point=f,C&&s.lineEnd()}function p(e,t){e=Math.max(-Vs,Math.min(Vs,e)),t=Math.max(-Vs,Math.min(Vs,t));var n=c(e,t);if(m&&v.push([e,t]),k)y=e,b=t,_=n,k=!1,n&&(s.lineStart(),s.point(e,t));else if(n&&C)s.point(e,t);else{var r={a:{x:x,y:w},b:{x:e,y:t}};A(r)?(C||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),M=!1):n&&(s.lineStart(),s.point(e,t),M=!1)}x=e,w=t,C=n}var g,m,v,y,b,_,x,w,C,k,M,E=s,T=zt(),A=Gt(e,t,n,r),S={point:f,lineStart:d,lineEnd:h,polygonStart:function(){s=T,g=[],m=[],M=!0},polygonEnd:function(){s=E,g=hi.merge(g);var t=l([e,r]),n=M&&t,o=g.length;(n||o)&&(s.polygonStart(),n&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),o&&Ot(g,a,t,u,s),s.polygonEnd()),g=m=v=null}};return S}}function Zt(e){var t=0,n=qi/3,r=dn(e),o=r(t,n);return o.parallels=function(e){return arguments.length?r(t=e[0]*qi/180,n=e[1]*qi/180):[t/qi*180,n/qi*180]},o}function Qt(e,t){function n(e,t){var n=Math.sqrt(a-2*o*Math.sin(t))/o;return[n*Math.sin(e*=o),i-n*Math.cos(e)]}var r=Math.sin(e),o=(r+Math.sin(t))/2,a=1+r*(2*o-r),i=Math.sqrt(a)/o;return n.invert=function(e,t){var n=i-t;return[Math.atan2(e,n)/o,ie((a-(e*e+n*n)*o*o)/(2*o))]},n}function Kt(){function e(e,t){Gs+=o*e-r*t,r=e,o=t}var t,n,r,o;Js.point=function(a,i){Js.point=e,t=r=a,n=o=i},Js.lineEnd=function(){e(t,n)}}function Jt(e,t){eQs&&(Qs=e),tKs&&(Ks=t)}function $t(){function e(e,t){i.push("M",e,",",t,a)}function t(e,t){i.push("M",e,",",t),s.point=n}function n(e,t){i.push("L",e,",",t)}function r(){s.point=e}function o(){i.push("Z")}var a=en(4.5),i=[],s={point:e,lineStart:function(){s.point=t},lineEnd:r,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=r,s.point=e},pointRadius:function(e){return a=en(e),s},result:function(){if(i.length){var e=i.join("");return i=[],e}}};return s}function en(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function tn(e,t){Ds+=e,Os+=t,++Ns}function nn(){function e(e,r){var o=e-t,a=r-n,i=Math.sqrt(o*o+a*a);js+=i*(t+e)/2,Fs+=i*(n+r)/2,Bs+=i,tn(t=e,n=r)}var t,n;el.point=function(r,o){el.point=e,tn(t=r,n=o)}}function rn(){el.point=tn}function on(){function e(e,t){var n=e-r,a=t-o,i=Math.sqrt(n*n+a*a);js+=i*(r+e)/2,Fs+=i*(o+t)/2,Bs+=i,i=o*e-r*t,zs+=i*(r+e),Us+=i*(o+t),Ws+=3*i,tn(r=e,o=t)}var t,n,r,o;el.point=function(a,i){el.point=e,tn(t=r=a,n=o=i)},el.lineEnd=function(){e(t,n)}}function an(e){function t(t,n){e.moveTo(t+i,n),e.arc(t,n,i,0,Vi)}function n(t,n){e.moveTo(t,n),s.point=r}function r(t,n){e.lineTo(t,n)}function o(){s.point=t}function a(){e.closePath()}var i=4.5,s={point:t,lineStart:function(){s.point=n},lineEnd:o,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=o,s.point=t},pointRadius:function(e){return i=e,s},result:E};return s}function sn(e){function t(e){return(s?r:n)(e)}function n(t){return cn(t,function(n,r){n=e(n,r),t.point(n[0],n[1])})}function r(t){function n(n,r){n=e(n,r),t.point(n[0],n[1])}function r(){b=NaN,k.point=a,t.lineStart()}function a(n,r){var a=_t([n,r]),i=e(n,r);o(b,_,y,x,w,C,b=i[0],_=i[1],y=n,x=a[0],w=a[1],C=a[2],s,t),t.point(b,_)}function i(){k.point=n,t.lineEnd()}function l(){r(),k.point=u,k.lineEnd=c}function u(e,t){a(f=e,d=t),h=b,p=_,g=x,m=w,v=C,k.point=a}function c(){o(b,_,y,x,w,C,h,p,f,g,m,v,s,t),k.lineEnd=i,i()}var f,d,h,p,g,m,v,y,b,_,x,w,C,k={point:n,lineStart:r,lineEnd:i,polygonStart:function(){t.polygonStart(),k.lineStart=l},polygonEnd:function(){t.polygonEnd(),k.lineStart=r}};return k}function o(t,n,r,s,l,u,c,f,d,h,p,g,m,v){var y=c-t,b=f-n,_=y*y+b*b;if(_>4*a&&m--){var x=s+h,w=l+p,C=u+g,k=Math.sqrt(x*x+w*w+C*C),M=Math.asin(C/=k),E=Mi(Mi(C)-1)a||Mi((y*P+b*L)/_-.5)>.3||s*h+l*p+u*g0&&16,t):Math.sqrt(a)},t}function ln(e){var t=sn(function(t,n){return e([t*Zi,n*Zi])});return function(e){return hn(t(e))}}function un(e){this.stream=e}function cn(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 fn(e){return dn(function(){return e})()}function dn(e){function t(e){return e=s(e[0]*Yi,e[1]*Yi),[e[0]*d+l,u-e[1]*d]}function n(e){return e=s.invert((e[0]-l)/d,(u-e[1])/d),e&&[e[0]*Zi,e[1]*Zi]}function r(){s=It(i=mn(v,y,b),a);var e=a(g,m);return l=h-e[0]*d,u=p+e[1]*d,o()}function o(){return c&&(c.valid=!1,c=null),t}var a,i,s,l,u,c,f=sn(function(e,t){return e=a(e,t),[e[0]*d+l,u-e[1]*d]}),d=150,h=480,p=250,g=0,m=0,v=0,y=0,b=0,_=qs,x=C,w=null,k=null;return t.stream=function(e){return c&&(c.valid=!1),c=hn(_(i,f(x(e)))),c.valid=!0,c},t.clipAngle=function(e){return arguments.length?(_=null==e?(w=e,qs):Xt((w=+e)*Yi),o()):w},t.clipExtent=function(e){return arguments.length?(k=e,x=e?Yt(e[0][0],e[0][1],e[1][0],e[1][1]):C,o()):k},t.scale=function(e){return arguments.length?(d=+e,r()):d},t.translate=function(e){return arguments.length?(h=+e[0],p=+e[1],r()):[h,p]},t.center=function(e){return arguments.length?(g=e[0]%360*Yi,m=e[1]%360*Yi,r()):[g*Zi,m*Zi]},t.rotate=function(e){return arguments.length?(v=e[0]%360*Yi,y=e[1]%360*Yi,b=e.length>2?e[2]%360*Yi:0,r()):[v*Zi,y*Zi,b*Zi]},hi.rebind(t,f,"precision"),function(){return a=e.apply(this,arguments),t.invert=a.invert&&n,r()}}function hn(e){return cn(e,function(t,n){e.point(t*Yi,n*Yi)})}function pn(e,t){return[e,t]}function gn(e,t){return[e>qi?e-Vi:e<-qi?e+Vi:e,t]}function mn(e,t,n){return e?t||n?It(yn(e),bn(t,n)):yn(e):t||n?bn(t,n):gn}function vn(e){return function(t,n){return t+=e,[t>qi?t-Vi:t<-qi?t+Vi:t,n]}}function yn(e){var t=vn(e);return t.invert=vn(-e),t}function bn(e,t){function n(e,t){var n=Math.cos(t),s=Math.cos(e)*n,l=Math.sin(e)*n,u=Math.sin(t),c=u*r+s*o;return[Math.atan2(l*a-c*i,s*r-u*o),ie(c*a+l*i)]}var r=Math.cos(e),o=Math.sin(e),a=Math.cos(t),i=Math.sin(t);return n.invert=function(e,t){var n=Math.cos(t),s=Math.cos(e)*n,l=Math.sin(e)*n,u=Math.sin(t),c=u*a-l*i;return[Math.atan2(l*a+u*i,s*r+c*o),ie(c*r-s*o)]},n}function _n(e,t){var n=Math.cos(e),r=Math.sin(e);return function(o,a,i,s){var l=i*t;null!=o?(o=xn(n,o),a=xn(n,a),(i>0?oa)&&(o+=i*Vi)):(o=e+i*Vi,a=e-.5*l);for(var u,c=o;i>0?c>a:c0?t<-Gi+Wi&&(t=-Gi+Wi):t>Gi-Wi&&(t=Gi-Wi);var n=i/Math.pow(o(t),a);return[n*Math.sin(a*e),i-n*Math.cos(a*e)]}var r=Math.cos(e),o=function(e){return Math.tan(qi/4+e/2)},a=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(o(t)/o(e)),i=r*Math.pow(o(e),a)/a;return a?(n.invert=function(e,t){var n=i-t,r=re(a)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/a,2*Math.atan(Math.pow(i/r,1/a))-Gi]},n):Ln}function Pn(e,t){function n(e,t){var n=a-t;return[n*Math.sin(o*e),a-n*Math.cos(o*e)]}var r=Math.cos(e),o=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),a=r/o+e;return Mi(o)1&&oe(e[n[r-2]],e[n[r-1]],e[o])<=0;)--r;n[r++]=o}return n.slice(0,r)}function jn(e,t){return e[0]-t[0]||e[1]-t[1]}function Fn(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function Bn(e,t,n,r){var o=e[0],a=n[0],i=t[0]-o,s=r[0]-a,l=e[1],u=n[1],c=t[1]-l,f=r[1]-u,d=(s*(l-u)-f*(o-a))/(f*i-s*c);return[o+d*i,l+d*c]}function zn(e){var t=e[0],n=e[e.length-1];return!(t[0]-n[0]||t[1]-n[1])}function Un(){lr(this),this.edge=this.site=this.circle=null}function Wn(e){var t=pl.pop()||new Un;return t.site=e,t}function Hn(e){$n(e),fl.remove(e),pl.push(e),lr(e)}function qn(e){var t=e.circle,n=t.x,r=t.cy,o={x:n,y:r},a=e.P,i=e.N,s=[e];Hn(e);for(var l=a;l.circle&&Mi(n-l.circle.x)Wi)s=s.L;else{if(o=a-Gn(s,i),!(o>Wi)){r>-Wi?(t=s.P,n=s):o>-Wi?(t=s,n=s.N):t=n=s;break}if(!s.R){t=s;break}s=s.R}var l=Wn(e);if(fl.insert(t,l),t||n){if(t===n)return $n(t),n=Wn(t.site),fl.insert(l,n),l.edge=n.edge=rr(t.site,l.site),Jn(t),void Jn(n);if(!n)return void(l.edge=rr(t.site,l.site));$n(t),$n(n);var u=t.site,c=u.x,f=u.y,d=e.x-c,h=e.y-f,p=n.site,g=p.x-c,m=p.y-f,v=2*(d*m-h*g),y=d*d+h*h,b=g*g+m*m,_={x:(m*y-h*b)/v+c,y:(d*b-g*y)/v+f};ar(n.edge,u,p,_),l.edge=rr(u,e,null,_),n.edge=rr(e,p,null,_),Jn(t),Jn(n)}}function Xn(e,t){var n=e.site,r=n.x,o=n.y,a=o-t;if(!a)return r;var i=e.P;if(!i)return-(1/0);n=i.site;var s=n.x,l=n.y,u=l-t;if(!u)return s;var c=s-r,f=1/a-1/u,d=c/u;return f?(-d+Math.sqrt(d*d-2*f*(c*c/(-2*u)-l+u/2+o-a/2)))/f+r:(r+s)/2}function Gn(e,t){var n=e.N;if(n)return Xn(n,t);var r=e.site;return r.y===t?r.x:1/0}function Yn(e){this.site=e,this.edges=[]}function Zn(e){for(var t,n,r,o,a,i,s,l,u,c,f=e[0][0],d=e[1][0],h=e[0][1],p=e[1][1],g=cl,m=g.length;m--;)if(a=g[m],a&&a.prepare())for(s=a.edges,l=s.length,i=0;iWi||Mi(o-n)>Wi)&&(s.splice(i,0,new ir(or(a.site,c,Mi(r-f)Wi?{x:f,y:Mi(t-f)Wi?{x:Mi(n-p)Wi?{x:d,y:Mi(t-d)Wi?{x:Mi(n-h)=-Hi)){var h=l*l+u*u,p=c*c+f*f,g=(f*h-u*p)/d,m=(l*p-c*h)/d,f=m+s,v=gl.pop()||new Kn;v.arc=e,v.site=o,v.x=g+i,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,e.circle=v;for(var y=null,b=hl._;b;)if(v.y=s)return;if(d>p){if(a){if(a.y>=u)return}else a={x:m,y:l};n={x:m,y:u}}else{if(a){if(a.y1)if(d>p){if(a){if(a.y>=u)return}else a={x:(l-o)/r,y:l};n={x:(u-o)/r,y:u}}else{if(a){if(a.y=s)return}else a={x:i,y:r*i+o};n={x:s,y:r*s+o}}else{if(a){if(a.xa||f>i||d=_,C=n>=x,k=C<<1|w,M=k+4;ka&&(o=t.slice(a,o),s[i]?s[i]+=o:s[++i]=o),(n=n[0])===(r=r[0])?s[i]?s[i]+=r:s[++i]=r:(s[++i]=null,l.push({i:i,x:wr(n,r)})),a=yl.lastIndex;return a=0&&!(n=hi.interpolators[r](e,t)););return n}function Mr(e,t){var n,r=[],o=[],a=e.length,i=t.length,s=Math.min(e.length,t.length);for(n=0;n=1?1:e(t)}}function Tr(e){return function(t){return 1-e(1-t)}}function Ar(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function Sr(e){return e*e}function Pr(e){return e*e*e}function Lr(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 Rr(e){return function(t){return Math.pow(t,e)}}function Ir(e){return 1-Math.cos(e*Gi)}function Dr(e){return Math.pow(2,10*(e-1))}function Or(e){return 1-Math.sqrt(1-e*e)}function Nr(e,t){var n;return arguments.length<2&&(t=.45),arguments.length?n=t/Vi*Math.asin(1/e):(e=1,n=t/4),function(r){return 1+e*Math.pow(2,-10*r)*Math.sin((r-n)*Vi/t)}}function jr(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function Fr(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 Br(e,t){e=hi.hcl(e),t=hi.hcl(t);var n=e.h,r=e.c,o=e.l,a=t.h-n,i=t.c-r,s=t.l-o;return isNaN(i)&&(i=0,r=isNaN(r)?t.c:r),isNaN(a)?(a=0,n=isNaN(n)?t.h:n):a>180?a-=360:a<-180&&(a+=360),function(e){return ge(n+a*e,r+i*e,o+s*e)+""}}function zr(e,t){e=hi.hsl(e),t=hi.hsl(t);var n=e.h,r=e.s,o=e.l,a=t.h-n,i=t.s-r,s=t.l-o;return isNaN(i)&&(i=0,r=isNaN(r)?t.s:r),isNaN(a)?(a=0,n=isNaN(n)?t.h:n):a>180?a-=360:a<-180&&(a+=360),function(e){return he(n+a*e,r+i*e,o+s*e)+""}}function Ur(e,t){e=hi.lab(e),t=hi.lab(t);var n=e.l,r=e.a,o=e.b,a=t.l-n,i=t.a-r,s=t.b-o;return function(e){return ve(n+a*e,r+i*e,o+s*e)+""}}function Wr(e,t){return t-=e,function(n){return Math.round(e+t*n)}}function Hr(e){var t=[e.a,e.b],n=[e.c,e.d],r=Vr(t),o=qr(t,n),a=Vr(Xr(n,t,-o))||0;t[0]*n[1]180?t+=360:t-e>180&&(e+=360),r.push({i:n.push(Gr(n)+"rotate(",null,")")-2,x:wr(e,t)})):t&&n.push(Gr(n)+"rotate("+t+")")}function Qr(e,t,n,r){e!==t?r.push({i:n.push(Gr(n)+"skewX(",null,")")-2,x:wr(e,t)}):t&&n.push(Gr(n)+"skewX("+t+")")}function Kr(e,t,n,r){if(e[0]!==t[0]||e[1]!==t[1]){var o=n.push(Gr(n)+"scale(",null,",",null,")");r.push({i:o-4,x:wr(e[0],t[0])},{i:o-2,x:wr(e[1],t[1])})}else 1===t[0]&&1===t[1]||n.push(Gr(n)+"scale("+t+")")}function Jr(e,t){var n=[],r=[];return e=hi.transform(e),t=hi.transform(t),Yr(e.translate,t.translate,n,r),Zr(e.rotate,t.rotate,n,r),Qr(e.skew,t.skew,n,r),Kr(e.scale,t.scale,n,r),e=t=null,function(e){for(var t,o=-1,a=r.length;++o=0;)n.push(o[r])}function fo(e,t){for(var n=[e],r=[];null!=(e=n.pop());)if(r.push(e),(a=e.children)&&(o=a.length))for(var o,a,i=-1;++io&&(r=n,o=t);return r}function Co(e){return e.reduce(ko,0)}function ko(e,t){return e+t[1]}function Mo(e,t){return Eo(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Eo(e,t){for(var n=-1,r=+e[0],o=(e[1]-r)/t,a=[];++n<=t;)a[n]=o*n+r;return a}function To(e){return[hi.min(e),hi.max(e)]}function Ao(e,t){return e.value-t.value}function So(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function Po(e,t){e._pack_next=t,t._pack_prev=e}function Lo(e,t){var n=t.x-e.x,r=t.y-e.y,o=e.r+t.r;return.999*o*o>n*n+r*r}function Ro(e){function t(e){c=Math.min(e.x-e.r,c),f=Math.max(e.x+e.r,f),d=Math.min(e.y-e.r,d),h=Math.max(e.y+e.r,h)}if((n=e.children)&&(u=n.length)){var n,r,o,a,i,s,l,u,c=1/0,f=-(1/0),d=1/0,h=-(1/0);if(n.forEach(Io),r=n[0],r.x=-r.r,r.y=0,t(r),u>1&&(o=n[1],o.x=o.r,o.y=0,t(o),u>2))for(a=n[2],No(r,o,a),t(a),So(r,a),r._pack_prev=a,So(a,o),o=r._pack_next,i=3;i=0;)t=o[a],t.z+=n,t.m+=n,n+=t.s+(r+=t.c)}function Wo(e,t,n){return e.a.parent===t.parent?e.a:n}function Ho(e){return 1+hi.max(e,function(e){return e.y})}function qo(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function Vo(e){var t=e.children;return t&&t.length?Vo(t[0]):e}function Xo(e){var t,n=e.children;return n&&(t=n.length)?Xo(n[t-1]):e}function Go(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Yo(e,t){var n=e.x+t[3],r=e.y+t[0],o=e.dx-t[1]-t[3],a=e.dy-t[0]-t[2];return o<0&&(n+=o/2,o=0),a<0&&(r+=a/2,a=0),{x:n,y:r,dx:o,dy:a}}function Zo(e){var t=e[0],n=e[e.length-1];return t2?ea:Ko,l=r?eo:$r;return i=o(e,t,l,n),s=o(t,e,l,kr),a}function a(e){return i(e)}var i,s;return a.invert=function(e){return s(e)},a.domain=function(t){return arguments.length?(e=t.map(Number),o()):e},a.range=function(e){return arguments.length?(t=e,o()):t},a.rangeRound=function(e){return a.range(e).interpolate(Wr)},a.clamp=function(e){return arguments.length?(r=e,o()):r},a.interpolate=function(e){return arguments.length?(n=e,o()):n},a.ticks=function(t){return aa(e,t)},a.tickFormat=function(t,n){return ia(e,t,n)},a.nice=function(t){return ra(e,t),o()},a.copy=function(){return ta(e,t,n,r)},o()}function na(e,t){return hi.rebind(e,t,"range","rangeRound","interpolate","clamp"); -}function ra(e,t){return Jo(e,$o(oa(e,t)[2])),Jo(e,$o(oa(e,t)[2])),e}function oa(e,t){null==t&&(t=10);var n=Zo(e),r=n[1]-n[0],o=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),a=t/r*o;return a<=.15?o*=10:a<=.35?o*=5:a<=.75&&(o*=2),n[0]=Math.ceil(n[0]/o)*o,n[1]=Math.floor(n[1]/o)*o+.5*o,n[2]=o,n}function aa(e,t){return hi.range.apply(hi,oa(e,t))}function ia(e,t,n){var r=oa(e,t);if(n){var o=vs.exec(n);if(o.shift(),"s"===o[8]){var a=hi.formatPrefix(Math.max(Mi(r[0]),Mi(r[1])));return o[7]||(o[7]="."+sa(a.scale(r[2]))),o[8]="f",n=hi.format(o.join("")),function(e){return n(a.scale(e))+a.symbol}}o[7]||(o[7]="."+la(o[8],r)),n=o.join("")}else n=",."+sa(r[2])+"f";return hi.format(n)}function sa(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}function la(e,t){var n=sa(t[2]);return e in Pl?Math.abs(n-sa(Math.max(Mi(t[0]),Mi(t[1]))))+ +("e"!==e):n-2*("%"===e)}function ua(e,t,n,r){function o(e){return(n?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(t)}function a(e){return n?Math.pow(t,e):-Math.pow(t,-e)}function i(t){return e(o(t))}return i.invert=function(t){return a(e.invert(t))},i.domain=function(t){return arguments.length?(n=t[0]>=0,e.domain((r=t.map(Number)).map(o)),i):r},i.base=function(n){return arguments.length?(t=+n,e.domain(r.map(o)),i):t},i.nice=function(){var t=Jo(r.map(o),n?Math:Rl);return e.domain(t),r=t.map(a),i},i.ticks=function(){var e=Zo(r),i=[],s=e[0],l=e[1],u=Math.floor(o(s)),c=Math.ceil(o(l)),f=t%1?2:t;if(isFinite(c-u)){if(n){for(;u0;d--)i.push(a(u)*d);for(u=0;i[u]l;c--);i=i.slice(u,c)}return i},i.tickFormat=function(e,n){if(!arguments.length)return Ll;arguments.length<2?n=Ll:"function"!=typeof n&&(n=hi.format(n));var r=Math.max(1,t*e/i.ticks().length);return function(e){var i=e/a(Math.round(o(e)));return i*t0?o[n-1]:e[0],n0?0:1}function ka(e,t,n,r,o){var a=e[0]-t[0],i=e[1]-t[1],s=(o?r:-r)/Math.sqrt(a*a+i*i),l=s*i,u=-s*a,c=e[0]+l,f=e[1]+u,d=t[0]+l,h=t[1]+u,p=(c+d)/2,g=(f+h)/2,m=d-c,v=h-f,y=m*m+v*v,b=n-r,_=c*h-d*f,x=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-_*_)),w=(_*v-m*x)/y,C=(-_*m-v*x)/y,k=(_*v+m*x)/y,M=(-_*m+v*x)/y,E=w-p,T=C-g,A=k-p,S=M-g;return E*E+T*T>A*A+S*S&&(w=k,C=M),[[w-l,C-u],[w*n/b,C*n/b]]}function Ma(e){function t(t){function i(){u.push("M",a(e(c),s))}for(var l,u=[],c=[],f=-1,d=t.length,h=Le(n),p=Le(r);++f1?e.join("L"):e+"Z"}function Ta(e){return e.join("L")+"Z"}function Aa(e){for(var t=0,n=e.length,r=e[0],o=[r[0],",",r[1]];++t1&&o.push("H",r[0]),o.join("")}function Sa(e){for(var t=0,n=e.length,r=e[0],o=[r[0],",",r[1]];++t1){s=t[1],a=e[l],l++,r+="C"+(o[0]+i[0])+","+(o[1]+i[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u9&&(o=3*t/Math.sqrt(o),i[s]=o*n,i[s+1]=o*r));for(s=-1;++s<=l;)o=(e[Math.min(l,s+1)][0]-e[Math.max(0,s-1)][0])/(6*(1+i[s]*i[s])),a.push([o||0,i[s]*o||0]);return a}function Va(e){return e.length<3?Ea(e):e[0]+Da(e,qa(e))}function Xa(e){for(var t,n,r,o=-1,a=e.length;++o0;)d[--s].call(e,i);if(a>=1)return g.event&&g.event.end.call(e,e.__data__,t),--h.count?delete h[r]:delete e[n],1}var l,u,c,f,d,h=e[n]||(e[n]={active:0,count:0}),g=h[r];g||(l=o.time,u=Ne(a,0,l),g=h[r]={tween:new p,time:l,timer:u,delay:o.delay,duration:o.duration,ease:o.ease,index:t},o=null,++h.count)}function ii(e,t,n){e.attr("transform",function(e){var r=t(e);return"translate("+(isFinite(r)?r:n(e))+",0)"})}function si(e,t,n){e.attr("transform",function(e){var r=t(e);return"translate(0,"+(isFinite(r)?r:n(e))+")"})}function li(e){return e.toISOString()}function ui(e,t,n){function r(t){return e(t)}function o(e,n){var r=e[1]-e[0],o=r/n,a=hi.bisect(ru,o);return a==ru.length?[t.year,oa(e.map(function(e){return e/31536e6}),n)[2]]:a?t[o/ru[a-1]1?{floor:function(t){for(;n(t=e.floor(t));)t=ci(t-1);return t},ceil:function(t){for(;n(t=e.ceil(t));)t=ci(+t+1);return t}}:e))},r.ticks=function(e,t){var n=Zo(r.domain()),a=null==e?o(n,10):"number"==typeof e?o(n,e):!e.range&&[{range:e},t];return a&&(e=a[0],t=a[1]),e.range(n[0],ci(+n[1]+1),t<1?1:t)},r.tickFormat=function(){return n},r.copy=function(){return ui(e.copy(),t,n)},na(r,e)}function ci(e){return new Date(e)}function fi(e){return JSON.parse(e.responseText)}function di(e){var t=mi.createRange();return t.selectNode(mi.body),t.createContextualFragment(e.responseText)}var hi={version:"3.5.17"},pi=[].slice,gi=function(e){return pi.call(e)},mi=this.document;if(mi)try{gi(mi.documentElement.childNodes)[0].nodeType}catch(vi){gi=function(e){for(var t=e.length,n=new Array(t);t--;)n[t]=e[t];return n}}if(Date.now||(Date.now=function(){return+new Date}),mi)try{mi.createElement("DIV").style.setProperty("opacity",0,"")}catch(yi){var bi=this.Element.prototype,_i=bi.setAttribute,xi=bi.setAttributeNS,wi=this.CSSStyleDeclaration.prototype,Ci=wi.setProperty;bi.setAttribute=function(e,t){_i.call(this,e,t+"")},bi.setAttributeNS=function(e,t,n){xi.call(this,e,t,n+"")},wi.setProperty=function(e,t,n){Ci.call(this,e,t+"",n)}}hi.ascending=s,hi.descending=function(e,t){return te?1:t>=e?0:NaN},hi.min=function(e,t){var n,r,o=-1,a=e.length;if(1===arguments.length){for(;++o=r){n=r;break}for(;++or&&(n=r)}else{for(;++o=r){n=r;break}for(;++or&&(n=r)}return n},hi.max=function(e,t){var n,r,o=-1,a=e.length;if(1===arguments.length){for(;++o=r){n=r;break}for(;++on&&(n=r)}else{for(;++o=r){n=r;break}for(;++on&&(n=r)}return n},hi.extent=function(e,t){var n,r,o,a=-1,i=e.length;if(1===arguments.length){for(;++a=r){n=o=r;break}for(;++ar&&(n=r),o=r){n=o=r;break}for(;++ar&&(n=r),o1)return i/(c-1)},hi.deviation=function(){var e=hi.variance.apply(this,arguments);return e?Math.sqrt(e):e};var ki=c(s);hi.bisectLeft=ki.left,hi.bisect=hi.bisectRight=ki.right,hi.bisector=function(e){return c(1===e.length?function(t,n){return s(e(t),n)}:e)},hi.shuffle=function(e,t,n){(a=arguments.length)<3&&(n=e.length,a<2&&(t=0));for(var r,o,a=n-t;a;)o=Math.random()*a--|0,r=e[a+t],e[a+t]=e[o+t],e[o+t]=r;return e},hi.permute=function(e,t){for(var n=t.length,r=new Array(n);n--;)r[n]=e[t[n]];return r},hi.pairs=function(e){for(var t,n=0,r=e.length-1,o=e[0],a=new Array(r<0?0:r);n=0;)for(r=e[o],t=r.length;--t>=0;)n[--i]=r[t];return n};var Mi=Math.abs;hi.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n===1/0)throw new Error("infinite range");var r,o=[],a=d(Mi(n)),i=-1;if(e*=a,t*=a,n*=a,n<0)for(;(r=e+n*++i)>t;)o.push(r/a);else for(;(r=e+n*++i)=a.length)return r?r.call(o,i):n?i.sort(n):i;for(var l,u,c,f,d=-1,h=i.length,g=a[s++],m=new p;++d=a.length)return e;var r=[],o=i[n++];return e.forEach(function(e,o){r.push({key:e,values:t(o,n)})}),o?r.sort(function(e,t){return o(e.key,t.key)}):r}var n,r,o={},a=[],i=[];return o.map=function(t,n){return e(n,t,0)},o.entries=function(n){return t(e(hi.map,n,0),0)},o.key=function(e){return a.push(e),o},o.sortKeys=function(e){return i[a.length-1]=e,o},o.sortValues=function(e){return n=e,o},o.rollup=function(e){return r=e,o},o},hi.set=function(e){var t=new w;if(e)for(var n=0,r=e.length;n=0&&(r=e.slice(n+1),e=e.slice(0,n)),e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(r,null);return this}},hi.event=null,hi.requote=function(e){return e.replace(Si,"\\$&")};var Si=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Pi={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]},Li=function(e,t){return t.querySelector(e)},Ri=function(e,t){return t.querySelectorAll(e)},Ii=function(e,t){var n=e.matches||e[M(e,"matchesSelector")];return(Ii=function(e,t){return n.call(e,t)})(e,t)};"function"==typeof Sizzle&&(Li=function(e,t){return Sizzle(e,t)[0]||null},Ri=Sizzle,Ii=Sizzle.matchesSelector),hi.selection=function(){return hi.select(mi.documentElement)};var Di=hi.selection.prototype=[];Di.select=function(e){var t,n,r,o,a=[];e=I(e);for(var i=-1,s=this.length;++i=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),Ni.hasOwnProperty(n)?{space:Ni[n],local:e}:e}},Di.attr=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node();return e=hi.ns.qualify(e),e.local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(O(t,e[t]));return this}return this.each(O(e,t))},Di.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node(),r=(e=F(e)).length,o=-1;if(t=n.classList){for(;++o=0;)(n=r[o])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Di.sort=function(e){e=G.apply(this,arguments);for(var t=-1,n=this.length;++t0&&(t=t.transition().duration(T)),t.call(e.event)}function s(){x&&x.domain(_.range().map(function(e){return(e-k.x)/k.k}).map(_.invert)),C&&C.domain(w.range().map(function(e){return(e-k.y)/k.k}).map(w.invert))}function l(e){A++||e({type:"zoomstart"})}function u(e){s(),e({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(e){--A||(e({type:"zoomend"}),m=null)}function f(){function e(){s=1,o(hi.mouse(r),d),u(a)}function n(){f.on(R,null).on(I,null),h(s),c(a)}var r=this,a=O.of(r,arguments),s=0,f=hi.select(i(r)).on(R,e).on(I,n),d=t(hi.mouse(r)),h=ee(r);Gl.call(r),l(a)}function d(){function e(){var e=hi.touches(p);return h=k.k,e.forEach(function(e){e.identifier in m&&(m[e.identifier]=t(e))}),e}function n(){var t=hi.event.target;hi.select(t).on(_,i).on(x,s),w.push(t);for(var n=hi.event.changedTouches,r=0,o=n.length;r1){var c=l[0],f=l[1],d=c[0]-f[0],h=c[1]-f[1];v=d*d+h*h}}function i(){var e,t,n,a,i=hi.touches(p);Gl.call(p);for(var s=0,l=i.length;s=u)return i;if(o)return o=!1,a;var t=c;if(34===e.charCodeAt(t)){for(var n=t;n++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ys=hi.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(e,t){return(e=hi.round(e,ze(e,t))).toFixed(Math.max(0,Math.min(20,ze(e*(1+1e-15),t))))}}),bs=hi.time={},_s=Date;qe.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(){xs.setUTCDate.apply(this._,arguments)},setDay:function(){xs.setUTCDay.apply(this._,arguments)},setFullYear:function(){xs.setUTCFullYear.apply(this._,arguments)},setHours:function(){xs.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){xs.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){xs.setUTCMinutes.apply(this._,arguments)},setMonth:function(){xs.setUTCMonth.apply(this._,arguments)},setSeconds:function(){xs.setUTCSeconds.apply(this._,arguments)},setTime:function(){xs.setTime.apply(this._,arguments)}};var xs=Date.prototype;bs.year=Ve(function(e){return e=bs.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),bs.years=bs.year.range,bs.years.utc=bs.year.utc.range,bs.day=Ve(function(e){var t=new _s(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}),bs.days=bs.day.range,bs.days.utc=bs.day.utc.range,bs.dayOfYear=function(e){var t=bs.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(e,t){t=7-t;var n=bs[e]=Ve(function(e){return(e=bs.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+7*Math.floor(t))},function(e){var n=bs.year(e).getDay();return Math.floor((bs.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});bs[e+"s"]=n.range,bs[e+"s"].utc=n.utc.range,bs[e+"OfYear"]=function(e){var n=bs.year(e).getDay();return Math.floor((bs.dayOfYear(e)+(n+t)%7)/7)}}),bs.week=bs.sunday,bs.weeks=bs.sunday.range,bs.weeks.utc=bs.sunday.utc.range,bs.weekOfYear=bs.sundayOfYear;var ws={"-":"",_:" ",0:"0"},Cs=/^\s*\d+/,ks=/^%/;hi.locale=function(e){return{numberFormat:We(e),timeFormat:Ge(e)}};var Ms=hi.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"]});hi.format=Ms.numberFormat,hi.geo={},pt.prototype={s:0,t:0,add:function(e){gt(e,this.t,Es),gt(Es.s,this.s,this),this.s?this.t+=Es.t:this.s=Es.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Es=new pt;hi.geo.stream=function(e,t){e&&Ts.hasOwnProperty(e.type)?Ts[e.type](e,t):mt(e,t)};var Ts={Feature:function(e,t){mt(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++rh&&(h=t)}function t(t,n){var r=_t([t*Yi,n*Yi]);if(v){var o=wt(v,r),a=[o[1],-o[0],0],i=wt(a,o);Mt(i),i=Et(i);var l=t-p,u=l>0?1:-1,g=i[0]*Zi*u,m=Mi(l)>180;if(m^(u*ph&&(h=y)}else if(g=(g+360)%360-180,m^(u*ph&&(h=n);m?ts(c,d)&&(d=t):s(t,d)>s(c,d)&&(c=t):d>=c?(td&&(d=t)):t>p?s(c,t)>s(c,d)&&(d=t):s(t,d)>s(c,d)&&(c=t)}else e(t,n);v=r,p=t}function n(){x.point=t}function r(){_[0]=c,_[1]=d,x.point=e,v=null}function o(e,n){if(v){var r=e-p;y+=Mi(r)>180?r+(r>0?360:-360):r}else g=e,m=n;Ls.point(e,n),t(e,n)}function a(){Ls.lineStart()}function i(){o(g,m),Ls.lineEnd(),Mi(y)>Wi&&(c=-(d=180)),_[0]=c,_[1]=d,v=null}function s(e,t){return(t-=e)<0?t+360:t}function l(e,t){return e[0]-t[0]}function u(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:eWi?h=90:y<-Wi&&(f=-90),_[0]=c,_[1]=d}};return function(e){h=d=-(c=f=1/0),b=[],hi.geo.stream(e,x);var t=b.length;if(t){b.sort(l);for(var n,r=1,o=b[0],a=[o];rs(o[0],o[1])&&(o[1]=n[1]),s(n[0],o[1])>s(o[0],o[1])&&(o[0]=n[0])):a.push(o=n);for(var i,n,p=-(1/0),t=a.length-1,r=0,o=a[t];r<=t;o=n,++r)n=a[r],(i=s(o[1],n[0]))>p&&(p=i,c=n[0],d=o[1])}return b=_=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[d,h]]}}(),hi.geo.centroid=function(e){Rs=Is=Ds=Os=Ns=js=Fs=Bs=zs=Us=Ws=0,hi.geo.stream(e,Hs);var t=zs,n=Us,r=Ws,o=t*t+n*n+r*r;return o=.12&&o<.234&&r>=-.425&&r<-.214?i:o>=.166&&o<.234&&r>=-.214&&r<-.115?s:a).invert(e)},e.stream=function(e){var t=a.stream(e),n=i.stream(e),r=s.stream(e);return{point:function(e,o){t.point(e,o),n.point(e,o),r.point(e,o)},sphere:function(){t.sphere(),n.sphere(),r.sphere()},lineStart:function(){t.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},e.precision=function(t){return arguments.length?(a.precision(t),i.precision(t),s.precision(t),e):a.precision()},e.scale=function(t){return arguments.length?(a.scale(t),i.scale(.35*t),s.scale(t),e.translate(a.translate())):a.scale()},e.translate=function(t){if(!arguments.length)return a.translate();var u=a.scale(),c=+t[0],f=+t[1];return n=a.translate(t).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point,r=i.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Wi,f+.12*u+Wi],[c-.214*u-Wi,f+.234*u-Wi]]).stream(l).point,o=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Wi,f+.166*u+Wi],[c-.115*u-Wi,f+.234*u-Wi]]).stream(l).point,e},e.scale(1070)};var Xs,Gs,Ys,Zs,Qs,Ks,Js={point:E,lineStart:E,lineEnd:E,polygonStart:function(){Gs=0,Js.lineStart=Kt},polygonEnd:function(){Js.lineStart=Js.lineEnd=Js.point=E,Xs+=Mi(Gs/2)}},$s={point:Jt,lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E},el={point:tn,lineStart:nn,lineEnd:rn,polygonStart:function(){el.lineStart=on},polygonEnd:function(){el.point=tn,el.lineStart=nn,el.lineEnd=rn}};hi.geo.path=function(){function e(e){return e&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),i&&i.valid||(i=o(a)),hi.geo.stream(e,i)),a.result()}function t(){return i=null,e}var n,r,o,a,i,s=4.5;return e.area=function(e){return Xs=0,hi.geo.stream(e,o(Js)),Xs},e.centroid=function(e){return Ds=Os=Ns=js=Fs=Bs=zs=Us=Ws=0,hi.geo.stream(e,o(el)),Ws?[zs/Ws,Us/Ws]:Bs?[js/Bs,Fs/Bs]:Ns?[Ds/Ns,Os/Ns]:[NaN,NaN]},e.bounds=function(e){return Qs=Ks=-(Ys=Zs=1/0),hi.geo.stream(e,o($s)),[[Ys,Zs],[Qs,Ks]]},e.projection=function(e){return arguments.length?(o=(n=e)?e.stream||ln(e):C,t()):n},e.context=function(e){return arguments.length?(a=null==(r=e)?new $t:new an(e),"function"!=typeof s&&a.pointRadius(s),t()):r},e.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(a.pointRadius(+t),+t),e):s},e.projection(hi.geo.albersUsa()).context(null)},hi.geo.transform=function(e){return{stream:function(t){var n=new un(t);for(var r in e)n[r]=e[r];return n}}},un.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()}},hi.geo.projection=fn,hi.geo.projectionMutator=dn,(hi.geo.equirectangular=function(){return fn(pn)}).raw=pn.invert=pn,hi.geo.rotation=function(e){function t(t){return t=e(t[0]*Yi,t[1]*Yi),t[0]*=Zi,t[1]*=Zi,t}return e=mn(e[0]%360*Yi,e[1]*Yi,e.length>2?e[2]*Yi:0),t.invert=function(t){return t=e.invert(t[0]*Yi,t[1]*Yi),t[0]*=Zi,t[1]*=Zi,t},t},gn.invert=pn,hi.geo.circle=function(){function e(){var e="function"==typeof r?r.apply(this,arguments):r,t=mn(-e[0]*Yi,-e[1]*Yi,0).invert,o=[];return n(null,null,1,{point:function(e,n){o.push(e=t(e,n)),e[0]*=Zi,e[1]*=Zi}}),{type:"Polygon",coordinates:[o]}}var t,n,r=[0,0],o=6;return e.origin=function(t){return arguments.length?(r=t,e):r},e.angle=function(r){return arguments.length?(n=_n((t=+r)*Yi,o*Yi),e):t},e.precision=function(r){return arguments.length?(n=_n(t*Yi,(o=+r)*Yi),e):o},e.angle(90)},hi.geo.distance=function(e,t){var n,r=(t[0]-e[0])*Yi,o=e[1]*Yi,a=t[1]*Yi,i=Math.sin(r),s=Math.cos(r),l=Math.sin(o),u=Math.cos(o),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((n=f*i)*n+(n=u*c-l*f*s)*n),l*c+u*f*s)},hi.geo.graticule=function(){function e(){return{type:"MultiLineString",coordinates:t()}}function t(){return hi.range(Math.ceil(a/m)*m,o,m).map(d).concat(hi.range(Math.ceil(u/v)*v,l,v).map(h)).concat(hi.range(Math.ceil(r/p)*p,n,p).filter(function(e){return Mi(e%m)>Wi}).map(c)).concat(hi.range(Math.ceil(s/g)*g,i,g).filter(function(e){return Mi(e%v)>Wi}).map(f))}var n,r,o,a,i,s,l,u,c,f,d,h,p=10,g=p,m=90,v=360,y=2.5;return e.lines=function(){return t().map(function(e){return{type:"LineString",coordinates:e}})},e.outline=function(){return{type:"Polygon",coordinates:[d(a).concat(h(l).slice(1),d(o).reverse().slice(1),h(u).reverse().slice(1))]}},e.extent=function(t){return arguments.length?e.majorExtent(t).minorExtent(t):e.minorExtent()},e.majorExtent=function(t){return arguments.length?(a=+t[0][0],o=+t[1][0],u=+t[0][1],l=+t[1][1],a>o&&(t=a,a=o,o=t),u>l&&(t=u,u=l,l=t),e.precision(y)):[[a,u],[o,l]]},e.minorExtent=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],i=+t[1][1],r>n&&(t=r,r=n,n=t),s>i&&(t=s,s=i,i=t),e.precision(y)):[[r,s],[n,i]]},e.step=function(t){return arguments.length?e.majorStep(t).minorStep(t):e.minorStep()},e.majorStep=function(t){return arguments.length?(m=+t[0],v=+t[1],e):[m,v]},e.minorStep=function(t){return arguments.length?(p=+t[0],g=+t[1],e):[p,g]},e.precision=function(t){return arguments.length?(y=+t,c=wn(s,i,90),f=Cn(r,n,y),d=wn(u,l,90),h=Cn(a,o,y),e):y},e.majorExtent([[-180,-90+Wi],[180,90-Wi]]).minorExtent([[-180,-80-Wi],[180,80+Wi]])},hi.geo.greatArc=function(){function e(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),n||o.apply(this,arguments)]}}var t,n,r=kn,o=Mn;return e.distance=function(){return hi.geo.distance(t||r.apply(this,arguments),n||o.apply(this,arguments))},e.source=function(n){return arguments.length?(r=n,t="function"==typeof n?null:n,e):r},e.target=function(t){return arguments.length?(o=t,n="function"==typeof t?null:t,e):o},e.precision=function(){return arguments.length?e:0},e},hi.geo.interpolate=function(e,t){return En(e[0]*Yi,e[1]*Yi,t[0]*Yi,t[1]*Yi)},hi.geo.length=function(e){return tl=0,hi.geo.stream(e,nl),tl};var tl,nl={sphere:E,point:E,lineStart:Tn,lineEnd:E,polygonStart:E,polygonEnd:E},rl=An(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(hi.geo.azimuthalEqualArea=function(){return fn(rl)}).raw=rl;var ol=An(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},C);(hi.geo.azimuthalEquidistant=function(){return fn(ol)}).raw=ol,(hi.geo.conicConformal=function(){return Zt(Sn)}).raw=Sn,(hi.geo.conicEquidistant=function(){return Zt(Pn)}).raw=Pn;var al=An(function(e){return 1/e},Math.atan);(hi.geo.gnomonic=function(){return fn(al)}).raw=al,Ln.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-Gi]},(hi.geo.mercator=function(){return Rn(Ln)}).raw=Ln;var il=An(function(){return 1},Math.asin);(hi.geo.orthographic=function(){return fn(il)}).raw=il;var sl=An(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(hi.geo.stereographic=function(){return fn(sl)}).raw=sl,In.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Gi]},(hi.geo.transverseMercator=function(){var e=Rn(In),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=In,hi.geom={},hi.geom.hull=function(e){function t(e){if(e.length<3)return[];var t,o=Le(n),a=Le(r),i=e.length,s=[],l=[];for(t=0;t=0;--t)h.push(e[s[u[t]][2]]);for(t=+f;t=r&&u.x<=a&&u.y>=o&&u.y<=i?[[r,i],[a,i],[a,o],[r,o]]:[];c.point=e[s]}),t}function n(e){return e.map(function(e,t){return{x:Math.round(a(e,t)/Wi)*Wi,y:Math.round(i(e,t)/Wi)*Wi,i:t}})}var r=Dn,o=On,a=r,i=o,s=ml;return e?t(e):(t.links=function(e){return dr(n(e)).edges.filter(function(e){return e.l&&e.r}).map(function(t){return{source:e[t.l.i],target:e[t.r.i]}})},t.triangles=function(e){var t=[];return dr(n(e)).cells.forEach(function(n,r){for(var o,a,i=n.site,s=n.edges.sort(Qn),l=-1,u=s.length,c=s[u-1].edge,f=c.l===i?c.r:c.l;++l=u,d=r>=c,h=d<<1|f;e.leaf=!1,e=e.nodes[h]||(e.nodes[h]=vr()),f?o=u:s=u,d?i=c:l=c,a(e,t,n,r,o,i,s,l)}var c,f,d,h,p,g,m,v,y,b=Le(s),_=Le(l);if(null!=t)g=t,m=n,v=r,y=o;else if(v=y=-(g=m=1/0),f=[],d=[],p=e.length,i)for(h=0;hv&&(v=c.x),c.y>y&&(y=c.y),f.push(c.x),d.push(c.y);else for(h=0;hv&&(v=x),w>y&&(y=w),f.push(x),d.push(w)}var C=v-g,k=y-m;C>k?y=m+C:v=g+k;var M=vr();if(M.add=function(e){a(M,e,+b(e,++h),+_(e,h),g,m,v,y)},M.visit=function(e){yr(e,M,g,m,v,y)},M.find=function(e){return br(M,e[0],e[1],g,m,v,y)},h=-1,null==t){for(;++h=0?e.slice(0,t):e,r=t>=0?e.slice(t+1):"in";return n=_l.get(n)||bl,r=xl.get(r)||C,Er(r(n.apply(null,pi.call(arguments,1))))},hi.interpolateHcl=Br,hi.interpolateHsl=zr,hi.interpolateLab=Ur,hi.interpolateRound=Wr,hi.transform=function(e){var t=mi.createElementNS(hi.ns.prefix.svg,"g");return(hi.transform=function(e){if(null!=e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate()}return new Hr(n?n.matrix:wl)})(e)},Hr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var wl={a:1,b:0,c:0,d:1,e:0,f:0};hi.interpolateTransform=Jr,hi.layout={},hi.layout.bundle=function(){return function(e){for(var t=[],n=-1,r=e.length;++n0?o=e:(n.c=null,n.t=NaN,n=null,u.end({type:"end",alpha:o=0})):e>0&&(u.start({type:"start",alpha:o=e}),n=Ne(l.tick)),l):o},l.start=function(){function e(e,r){if(!n){for(n=new Array(o),l=0;l=0;)i.push(c=u[l]),c.parent=a,c.depth=a.depth+1;r&&(a.value=0),a.children=u}else r&&(a.value=+r.call(e,a,a.depth)||0),delete a.children;return fo(o,function(e){var n,o;t&&(n=e.children)&&n.sort(t),r&&(o=e.parent)&&(o.value+=e.value)}),s}var t=go,n=ho,r=po;return e.sort=function(n){return arguments.length?(t=n,e):t},e.children=function(t){return arguments.length?(n=t,e):n},e.value=function(t){return arguments.length?(r=t,e):r},e.revalue=function(t){return r&&(co(t,function(e){e.children&&(e.value=0)}),fo(t,function(t){var n;t.children||(t.value=+r.call(e,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)})),t},e},hi.layout.partition=function(){function e(t,n,r,o){var a=t.children;if(t.x=n,t.y=t.depth*o,t.dx=r,t.dy=o,a&&(i=a.length)){var i,s,l,u=-1;for(r=t.value?r/t.value:0;++us&&(s=r),i.push(r)}for(n=0;n0)for(a=-1;++a=c[0]&&s<=c[1]&&(i=l[hi.bisect(f,s,1,h)-1],i.y+=p,i.push(e[a]));return l}var t=!0,n=Number,r=To,o=Mo;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=Le(t),e):r},e.bins=function(t){return arguments.length?(o="number"==typeof t?function(e){return Eo(e,t)}:Le(t),e):o},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},hi.layout.pack=function(){function e(e,a){var i=n.call(this,e,a),s=i[0],l=o[0],u=o[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(s.x=s.y=0,fo(s,function(e){e.r=+c(e.value)}),fo(s,Ro),r){var f=r*(t?1:Math.max(2*s.r/l,2*s.r/u))/2;fo(s,function(e){e.r+=f}),fo(s,Ro),fo(s,function(e){e.r-=f})}return Oo(s,l/2,u/2,t?1:1/Math.max(2*s.r/l,2*s.r/u)),i}var t,n=hi.layout.hierarchy().sort(Ao),r=0,o=[1,1];return e.size=function(t){return arguments.length?(o=t,e):o},e.radius=function(n){return arguments.length?(t=null==n||"function"==typeof n?n:+n,e):t},e.padding=function(t){return arguments.length?(r=+t,e):r},uo(e,n)},hi.layout.tree=function(){function e(e,o){var c=i.call(this,e,o),f=c[0],d=t(f);if(fo(d,n),d.parent.m=-d.z,co(d,r),u)co(f,a);else{var h=f,p=f,g=f;co(f,function(e){e.xp.x&&(p=e),e.depth>g.depth&&(g=e)});var m=s(h,p)/2-h.x,v=l[0]/(p.x+s(p,h)/2+m),y=l[1]/(g.depth||1);co(f,function(e){e.x=(e.x+m)*v,e.y=e.depth*y})}return c}function t(e){for(var t,n={A:null,children:[e]},r=[n];null!=(t=r.pop());)for(var o,a=t.children,i=0,s=a.length;i0&&(zo(Wo(i,e,n),e,r),u+=r,c+=r),f+=i.m,u+=o.m,d+=l.m,c+=a.m;i&&!Bo(a)&&(a.t=i,a.m+=f-c),o&&!Fo(l)&&(l.t=o,l.m+=u-d,n=e)}return n}function a(e){e.x*=l[0],e.y=e.depth*l[1]}var i=hi.layout.hierarchy().sort(null).value(null),s=jo,l=[1,1],u=null;return e.separation=function(t){return arguments.length?(s=t,e):s},e.size=function(t){return arguments.length?(u=null==(l=t)?a:null,e):u?null:l},e.nodeSize=function(t){return arguments.length?(u=null==(l=t)?null:a,e):u?l:null},uo(e,i)},hi.layout.cluster=function(){function e(e,a){var i,s=t.call(this,e,a),l=s[0],u=0;fo(l,function(e){var t=e.children;t&&t.length?(e.x=qo(t),e.y=Ho(t)):(e.x=i?u+=n(e,i):0,e.y=0,i=e)});var c=Vo(l),f=Xo(l),d=c.x-n(c,f)/2,h=f.x+n(f,c)/2;return fo(l,o?function(e){e.x=(e.x-l.x)*r[0],e.y=(l.y-e.y)*r[1]}:function(e){e.x=(e.x-d)/(h-d)*r[0],e.y=(1-(l.y?e.y/l.y:1))*r[1]}),s}var t=hi.layout.hierarchy().sort(null).value(null),n=jo,r=[1,1],o=!1;return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(o=null==(r=t),e):o?null:r},e.nodeSize=function(t){return arguments.length?(o=null!=(r=t),e):o?r:null},uo(e,t)},hi.layout.treemap=function(){function e(e,t){for(var n,r,o=-1,a=e.length;++o0;)c.push(i=d[l-1]),c.area+=i.area,"squarify"!==h||(s=r(c,g))<=p?(d.pop(),p=s):(c.area-=c.pop().area,o(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(o(c,g,u,!0),c.length=c.area=0),a.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var a,i=f(t),s=r.slice(),l=[];for(e(s,i.dx*i.dy/t.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(o(l,a.z?i.dx:i.dy,i,!s.length),l.length=l.area=0);r.forEach(n)}}function r(e,t){for(var n,r=e.area,o=0,a=1/0,i=-1,s=e.length;++io&&(o=n));return r*=r,t*=t,r?Math.max(t*o*p/r,r/(t*a*p)):1/0}function o(e,t,n,r){var o,a=-1,i=e.length,s=n.x,u=n.y,c=t?l(e.area/t):0;if(t==n.dx){for((r||c>n.dy)&&(c=n.dy);++an.dx)&&(c=n.dx);++a1);return e+t*n*Math.sqrt(-2*Math.log(o)/o)}},logNormal:function(){var e=hi.random.normal.apply(hi,arguments);return function(){return Math.exp(e())}},bates:function(e){var t=hi.random.irwinHall(e);return function(){return t()/e}},irwinHall:function(e){return function(){for(var t=0,n=0;nf?0:1;if(u=Xi)return t(u,h)+(e?t(e,1-h):"")+"Z";var p,g,m,v,y,b,_,x,w,C,k,M,E=0,T=0,A=[];if((v=(+l.apply(this,arguments)||0)/2)&&(m=a===jl?Math.sqrt(e*e+u*u):+a.apply(this,arguments),h||(T*=-1),u&&(T=ie(m/u*Math.sin(v))),e&&(E=ie(m/e*Math.sin(v)))),u){y=u*Math.cos(c+T),b=u*Math.sin(c+T),_=u*Math.cos(f-T),x=u*Math.sin(f-T);var S=Math.abs(f-c-2*T)<=qi?0:1;if(T&&Ca(y,b,_,x)===h^S){var P=(c+f)/2;y=u*Math.cos(P),b=u*Math.sin(P),_=x=null}}else y=b=0;if(e){w=e*Math.cos(f-E),C=e*Math.sin(f-E),k=e*Math.cos(c+E),M=e*Math.sin(c+E);var L=Math.abs(c-f+2*E)<=qi?0:1;if(E&&Ca(w,C,k,M)===1-h^L){var R=(c+f)/2;w=e*Math.cos(R),C=e*Math.sin(R),k=M=null}}else w=C=0;if(d>Wi&&(p=Math.min(Math.abs(u-e)/2,+o.apply(this,arguments)))>.001){g=eqi)+",1 "+t}function o(e,t,n,r){return"Q 0,0 "+r}var a=kn,i=Mn,s=Ya,l=_a,u=xa;return e.radius=function(t){return arguments.length?(s=Le(t),e):s},e.source=function(t){return arguments.length?(a=Le(t),e):a},e.target=function(t){return arguments.length?(i=Le(t),e):i},e.startAngle=function(t){return arguments.length?(l=Le(t),e):l},e.endAngle=function(t){return arguments.length?(u=Le(t),e):u},e},hi.svg.diagonal=function(){function e(e,o){var a=t.call(this,e,o),i=n.call(this,e,o),s=(a.y+i.y)/2,l=[a,{x:a.x,y:s},{x:i.x,y:s},i];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var t=kn,n=Mn,r=Za;return e.source=function(n){return arguments.length?(t=Le(n),e):t},e.target=function(t){return arguments.length?(n=Le(t),e):n},e.projection=function(t){return arguments.length?(r=t,e):r},e},hi.svg.diagonal.radial=function(){var e=hi.svg.diagonal(),t=Za,n=e.projection;return e.projection=function(e){return arguments.length?n(Qa(t=e)):t},e},hi.svg.symbol=function(){function e(e,r){return(Wl.get(t.call(this,e,r))||$a)(n.call(this,e,r))}var t=Ja,n=Ka;return e.type=function(n){return arguments.length?(t=Le(n),e):t},e.size=function(t){return arguments.length?(n=Le(t),e):n},e};var Wl=hi.map({circle:$a,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*ql)),n=t*ql;return"M0,"+-t+"L"+n+",0 0,"+t+" "+-n+",0Z"},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/Hl),n=t*Hl/2;return"M0,"+n+"L"+t+","+-n+" "+-t+","+-n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Hl),n=t*Hl/2;return"M0,"+-n+"L"+t+","+n+" "+-t+","+n+"Z"}});hi.svg.symbolTypes=Wl.keys();var Hl=Math.sqrt(3),ql=Math.tan(30*Yi);Di.transition=function(e){for(var t,n,r=Vl||++Zl,o=oi(e),a=[],i=Xl||{time:Date.now(),ease:Lr,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function r(e){e.select(".extent").attr("y",d[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",d[1]-d[0])}function o(){function o(){32==hi.event.keyCode&&(A||(b=null,L[0]-=f[1],L[1]-=d[1],A=2),S())}function g(){32==hi.event.keyCode&&2==A&&(L[0]+=f[1],L[1]+=d[1],A=0,S())}function m(){var e=hi.mouse(x),o=!1;_&&(e[0]+=_[0],e[1]+=_[1]),A||(hi.event.altKey?(b||(b=[(f[0]+f[1])/2,(d[0]+d[1])/2]),L[0]=f[+(e[0]1)for(var n=1;n2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return h+=1,{id:(0,c.generateUUID)(),generation:h,selection:e,score:t,weight:n,rationale:r,name:o}}function i(e,t){var n=Object.assign({},e,t),r=!1;return Object.keys(n).forEach(function(t){n[t]!==e[t]&&(r=!0)}),r&&(h+=1,n.generation=h),n}function s(e,t){e&&e.selection&&t&&(e.readOnly=d["default"].hasField(e.selection,t))}function l(e){var t=(0,c.generateUUID)();return h+=1,Object.assign({},e,{generation:h,id:t})}function u(e){return h+=1,Object.assign({},e,{generation:h})}Object.defineProperty(t,"__esModule",{value:!0});var c=n(151),f=n(28),d=r(f),h=0,p=a(d["default"].EMPTY_SELECTION,0);t["default"]={annotation:a,EMPTY_ANNOTATION:p,fork:l,markModified:u,setInitialGenerationNumber:o,update:i,updateReadOnlyFlag:s}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n>>6-i%4*2;r[a>>>2]|=(s|l)<<24-a%4*8,a++}return o.create(r,a)}var n=e,r=n.lib,o=r.WordArray,a=n.enc;a.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var o=[],a=0;a>>2]>>>24-a%4*8&255,s=t[a+1>>>2]>>>24-(a+1)%4*8&255,l=t[a+2>>>2]>>>24-(a+2)%4*8&255,u=i<<16|s<<8|l,c=0;c<4&&a+.75*c>>6*(3-c)&63));var f=r.charAt(64);if(f)for(;o.length%4;)o.push(f);return o.join("")},parse:function(e){var n=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a>>32-a)+t}function r(e,t,n,r,o,a,i){var s=e+(t&r|n&~r)+o+i;return(s<>>32-a)+t}function o(e,t,n,r,o,a,i){var s=e+(t^n^r)+o+i;return(s<>>32-a)+t}function a(e,t,n,r,o,a,i){var s=e+(n^(t|~r))+o+i;return(s<>>32-a)+t}var i=e,s=i.lib,l=s.WordArray,u=s.Hasher,c=i.algo,f=[];!function(){for(var e=0;e<64;e++)f[e]=4294967296*t.abs(t.sin(e+1))|0}();var d=c.MD5=u.extend({_doReset:function(){this._hash=new l.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var s=t+i,l=e[s];e[s]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}var u=this._hash.words,c=e[t+0],d=e[t+1],h=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],v=e[t+6],y=e[t+7],b=e[t+8],_=e[t+9],x=e[t+10],w=e[t+11],C=e[t+12],k=e[t+13],M=e[t+14],E=e[t+15],T=u[0],A=u[1],S=u[2],P=u[3];T=n(T,A,S,P,c,7,f[0]),P=n(P,T,A,S,d,12,f[1]),S=n(S,P,T,A,h,17,f[2]),A=n(A,S,P,T,p,22,f[3]),T=n(T,A,S,P,g,7,f[4]),P=n(P,T,A,S,m,12,f[5]),S=n(S,P,T,A,v,17,f[6]),A=n(A,S,P,T,y,22,f[7]),T=n(T,A,S,P,b,7,f[8]),P=n(P,T,A,S,_,12,f[9]),S=n(S,P,T,A,x,17,f[10]),A=n(A,S,P,T,w,22,f[11]),T=n(T,A,S,P,C,7,f[12]),P=n(P,T,A,S,k,12,f[13]),S=n(S,P,T,A,M,17,f[14]),A=n(A,S,P,T,E,22,f[15]),T=r(T,A,S,P,d,5,f[16]),P=r(P,T,A,S,v,9,f[17]),S=r(S,P,T,A,w,14,f[18]),A=r(A,S,P,T,c,20,f[19]),T=r(T,A,S,P,m,5,f[20]),P=r(P,T,A,S,x,9,f[21]),S=r(S,P,T,A,E,14,f[22]),A=r(A,S,P,T,g,20,f[23]),T=r(T,A,S,P,_,5,f[24]),P=r(P,T,A,S,M,9,f[25]),S=r(S,P,T,A,p,14,f[26]),A=r(A,S,P,T,b,20,f[27]),T=r(T,A,S,P,k,5,f[28]),P=r(P,T,A,S,h,9,f[29]),S=r(S,P,T,A,y,14,f[30]),A=r(A,S,P,T,C,20,f[31]),T=o(T,A,S,P,m,4,f[32]),P=o(P,T,A,S,b,11,f[33]),S=o(S,P,T,A,w,16,f[34]),A=o(A,S,P,T,M,23,f[35]),T=o(T,A,S,P,d,4,f[36]),P=o(P,T,A,S,g,11,f[37]),S=o(S,P,T,A,y,16,f[38]),A=o(A,S,P,T,x,23,f[39]),T=o(T,A,S,P,k,4,f[40]),P=o(P,T,A,S,c,11,f[41]),S=o(S,P,T,A,p,16,f[42]),A=o(A,S,P,T,v,23,f[43]),T=o(T,A,S,P,_,4,f[44]),P=o(P,T,A,S,C,11,f[45]),S=o(S,P,T,A,E,16,f[46]),A=o(A,S,P,T,h,23,f[47]),T=a(T,A,S,P,c,6,f[48]),P=a(P,T,A,S,y,10,f[49]),S=a(S,P,T,A,M,15,f[50]),A=a(A,S,P,T,m,21,f[51]),T=a(T,A,S,P,C,6,f[52]),P=a(P,T,A,S,p,10,f[53]),S=a(S,P,T,A,x,15,f[54]),A=a(A,S,P,T,d,21,f[55]),T=a(T,A,S,P,b,6,f[56]),P=a(P,T,A,S,E,10,f[57]),S=a(S,P,T,A,v,15,f[58]),A=a(A,S,P,T,k,21,f[59]),T=a(T,A,S,P,g,6,f[60]),P=a(P,T,A,S,w,10,f[61]),S=a(S,P,T,A,h,15,f[62]),A=a(A,S,P,T,_,21,f[63]),u[0]=u[0]+T|0,u[1]=u[1]+A|0,u[2]=u[2]+S|0,u[3]=u[3]+P|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;n[o>>>5]|=128<<24-o%32;var a=t.floor(r/4294967296),i=r;n[(o+64>>>9<<4)+15]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),n[(o+64>>>9<<4)+14]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,l=s.words,u=0;u<4;u++){var c=l[u];l[u]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return s},clone:function(){var e=u.clone.call(this);return e._hash=this._hash.clone(),e}});i.MD5=u._createHelper(d),i.HmacMD5=u._createHmacHelper(d)}(Math),e.MD5})},function(e,t,n){"use strict";function r(e){if(m){var t=e.node,n=e.children;if(n.length)for(var r=0;r=1||0==o);var a=Math.sqrt(-2*Math.log(o)/o);return(e||0)+n*a*(t||1)},i=function(t,n){if(!t)throw i.useDebugger||"AUTOBAHN_DEBUG"in e&&AUTOBAHN_DEBUG,new Error(n||"Assertion failed!")},s=function(e,t,n){r.debug("new http_post request",e,t,n);var a=o.defer(),i=new XMLHttpRequest;return i.onreadystatechange=function(){if(4===i.readyState){var e=1223===i.status?204:i.status;if(200===e&&a.resolve(i.responseText),204===e)a.resolve();else{var t=null;try{t=i.statusText}catch(n){}a.reject({code:e,text:t})}}},i.open("POST",e,!0),i.setRequestHeader("Content-type","application/json; charset=utf-8"),n>0&&(i.timeout=n,i.ontimeout=function(){a.reject({code:501,text:"request timeout"})}),t?i.send(t):i.send(),a.promise.then?a.promise:a};t.rand_normal=a,t.assert=i,t.http_post=s}).call(t,function(){return this}())},function(e,t){"use strict";function n(e,t,n){var r=t;if(e)for(;r;)r-=1,n(r);else for(var o=0;o0&&this.setState(e)},componentWillReceiveProps:function(e){var t=e.data;this.state.data!==t&&this.setState({data:t})},helpToggled:function(e){this.setState({helpOpen:e})}}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){function r(e,t){return o(a(e),t)}var o=n(555),a=n(200);e.exports=r},function(e,t,n){var r,o;r=[n(75),n(576),n(109),n(107)],o=function(e,t,n,r){function o(t){return function(n,r){return e(this,r)&&t(n,this[r])}}function a(t,n){return e(this,n)}function i(e,i,s){return s=s||r,n(e)&&n(i)?t(e,o(s),i)&&t(i,a,e):s(e,i)}return i}.apply(t,r),!(void 0!==o&&(e.exports=o))},function(e,t,n){"use strict";var r=n(6),o=n(113),a=n(114),i=n(120),s=n(223),l=n(225),u=(n(5),{}),c=null,f=function(e,t){e&&(a.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},d=function(e){return f(e,!0)},h=function(e){return f(e,!1)},p=function(e){return"."+e._rootNodeID},g={injection:{injectEventPluginOrder:o.injectEventPluginOrder,injectEventPluginsByName:o.injectEventPluginsByName},putListener:function(e,t,n){"function"!=typeof n?r("94",t,typeof n):void 0;var a=p(e),i=u[t]||(u[t]={});i[a]=n;var s=o.registrationNameModules[t];s&&s.didPutListener&&s.didPutListener(e,t,n)},getListener:function(e,t){var n=u[t],r=p(e);return n&&n[r]},deleteListener:function(e,t){var n=o.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var r=u[t];if(r){var a=p(e);delete r[a]}},deleteAllListeners:function(e){var t=p(e);for(var n in u)if(u.hasOwnProperty(n)&&u[n][t]){var r=o.registrationNameModules[n];r&&r.willDeleteListener&&r.willDeleteListener(e,n),delete u[n][t]}},extractEvents:function(e,t,n,r){for(var a,i=o.plugins,l=0;l382.5?0:255;a.data[4*o+0]=this.props.inverse?(a.data[4*o+0]+128)%256:i,a.data[4*o+1]=this.props.inverse?(a.data[4*o+1]+128)%256:i,a.data[4*o+2]=this.props.inverse?(a.data[4*o+2]+128)%256:i,r.putImageData(a,0,0)}}},componentWillUnmount:function(){this.removeListener()},setPreset:function(e){this.props.lookupTable.setPreset(e.target.dataset.name),this.togglePresetMode()},updateScalarRange:function(){var e=this.props.lookupTable.getScalarRange(),t=this.min.getValue()||e[0],n=this.max.getValue()||e[1];this.props.lookupTable.setScalarRange(t,t===n?n+1:n),this.forceUpdate()},addControlPoint:function(){var e=this.props.lookupTable.addControlPoint({x:.5,r:0,g:0,b:0});this.setState({currentControlPointIndex:e})},deleteControlPoint:function(){this.props.lookupTable.removeControlPoint(this.state.currentControlPointIndex)&&this.forceUpdate()},nextControlPoint:function(){var e=this.state.currentControlPointIndex+1;e-1&&this.setState({currentControlPointIndex:e})},updateScalar:function(e){var t=this.props.lookupTable.getScalarRange(),n=(e-t[0])/(t[1]-t[0]),r=this.props.lookupTable.getControlPoint(this.state.currentControlPointIndex),o=this.props.lookupTable.updateControlPoint(this.state.currentControlPointIndex,{x:n,r:r.r,g:r.g,b:r.b});this.setState({currentControlPointIndex:o}),this.forceUpdate()},updateRGB:function(e){var t=this.props.lookupTable.getControlPoint(this.state.currentControlPointIndex),n=this.props.lookupTable.updateControlPoint(this.state.currentControlPointIndex,{x:t.x,r:e[0]/255,g:e[1]/255,b:e[2]/255});this.setState({currentControlPointIndex:n -})},toggleEditMode:function(){"none"===this.state.mode||"edit"!==this.state.mode?this.setState({mode:"edit",internal_lut:!1}):this.setState({mode:"none",internal_lut:!1})},togglePresetMode:function(){"none"===this.state.mode||"preset"!==this.state.mode?(this.deltaPreset(0),this.setState({mode:"preset",internal_lut:!0})):this.setState({mode:"none",internal_lut:!1})},attachListener:function(e){var t=this;this.subscription=e.onChange(function(e,n){t.forceUpdate()})},removeListener:function(){this.subscription&&(this.subscription.unsubscribe(),this.subscription=null)},updateOriginalRange:function(e,t){console.log("Someone asked LookupTableWidget to update original range to ["+e+", "+t+"]"),this.setState({originalRange:[e,t]})},resetRange:function(){var e=this.state.originalRange,t=this.props.lookupTable.getScalarRange();console.log("LookupTableWidget current range: ["+t[0]+", "+t[1]+"], new range: ["+e[0]+", "+e[1]+"]"),this.props.lookupTable.setScalarRange(e[0],e[1])},changePreset:function(e){var t=e.detail||e.deltaY||e.deltaX;e.preventDefault(),this.deltaPreset(t)},nextPreset:function(){this.deltaPreset(1)},previousPreset:function(){this.deltaPreset(-1)},deltaPreset:function(e){var t=this.props.lookupTable.getPresets(),n=t.indexOf(this.state.activePreset),r=null;if(n+=0===e?0:e<0?-1:1,!(n<0||n===t.length)){if(r=t[n],this.props.lookupTableManager){var o=this.props.lookupTableManager.getLookupTable("__internal");o?o.setPreset(r):o=this.props.lookupTableManager.addLookupTable("__internal",[0,1],r),o.drawToCanvas(this.canvas)}this.setState({activePreset:r})}},render:function(){var e=this,t=this.props.lookupTable.getScalarRange(),n=this.props.lookupTable.getControlPoint(this.state.currentControlPointIndex),r=n.x*(t[1]-t[0])+t[0],o=[Math.floor(255*n.r),Math.floor(255*n.g),Math.floor(255*n.b)];return a["default"].createElement("div",{className:s["default"].container},a["default"].createElement("div",{className:s["default"].line},a["default"].createElement("i",{className:s["default"].editButton,onClick:this.toggleEditMode}),a["default"].createElement("canvas",{ref:function(t){e.canvas=t},className:s["default"].canvas,width:this.props.lookupTable.colorTableSize*this.props.lookupTable.scale,height:"1"}),a["default"].createElement("i",{className:s["default"].presetButton,onClick:this.togglePresetMode})),a["default"].createElement("div",{className:s["default"].range,style:d.range[this.state.mode]},a["default"].createElement(f["default"],{ref:function(t){e.min=t},className:s["default"].input,value:this.props.lookupTable.getScalarRange()[0],onChange:this.updateScalarRange}),a["default"].createElement("i",{onClick:this.resetRange,className:s["default"].resetRangeButton}),a["default"].createElement(f["default"],{ref:function(t){e.max=t},className:s["default"].inputRight,value:this.props.lookupTable.getScalarRange()[1],onChange:this.updateScalarRange})),a["default"].createElement("div",{className:s["default"].editContent,style:d.editContent[this.state.mode]},a["default"].createElement("div",{className:s["default"].line},a["default"].createElement("i",{onClick:this.previousControlPoint,className:s["default"].previousButton}),a["default"].createElement("div",{className:s["default"].label},this.state.currentControlPointIndex+1," / ",this.props.lookupTable.getNumberOfControlPoints()),a["default"].createElement("i",{onClick:this.nextControlPoint,className:s["default"].nextButton}),a["default"].createElement("i",{onClick:this.addControlPoint,className:s["default"].addButton}),a["default"].createElement(f["default"],{className:s["default"].inputRight,value:r,onChange:this.updateScalar}),a["default"].createElement("i",{onClick:this.deleteControlPoint,className:s["default"].deleteButton})),a["default"].createElement(u["default"],{color:o,onChange:this.updateRGB})),a["default"].createElement("div",{className:s["default"].presets,style:d.presets[this.state.mode]},a["default"].createElement("i",{onClick:this.previousPreset,className:this.state.activePreset===this.props.lookupTable.getPresets()[0]?s["default"].disablePreviousButton:s["default"].previousButton}),this.props.lookupTable.getPresets().map(function(t){return a["default"].createElement("div",{onClick:e.setPreset,onScroll:e.changePreset,onWheel:e.changePreset,className:e.state.activePreset===t?s["default"].preset:s["default"].hiddenPreset,"data-name":t,key:t},t)}),a["default"].createElement("i",{onClick:this.nextPreset,className:this.state.activePreset===this.props.lookupTable.getPresets()[this.props.lookupTable.getPresets().length-1]?s["default"].disableNextButton:s["default"].nextButton})))}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(686),s=r(i);t["default"]=a["default"].createClass({displayName:"NumberSliderWidget",propTypes:{max:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string]),min:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string]),name:a["default"].PropTypes.string,onChange:a["default"].PropTypes.func,step:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string]),value:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string])},getDefaultProps:function(){return{max:100,min:0,step:1,value:50}},getInitialState:function(){return{max:this.props.max,min:this.props.min,step:this.props.step,value:this.props.value}},valInput:function(e){this.setState({value:e.target.value}),this.props.onChange&&(this.props.name&&(e.target.name=this.props.name),this.props.onChange(e))},value:function l(e){if(null===e||void 0===e)return this.state.value;var l=Math.max(this.state.min,Math.min(e,this.state.max));return this.setState({value:l}),l},render:function(){var e=[this.props.min,this.props.max],t=e[0],n=e[1];return a["default"].createElement("div",{className:s["default"].container},a["default"].createElement("input",{type:"range",className:s["default"].range,value:this.props.value,onChange:this.valInput,max:n,min:t}),a["default"].createElement("input",{type:"number",className:s["default"].text,value:this.props.value,onChange:this.valInput,max:n,min:t}))}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={getDefaultProps:function(){return{listener:!0}},attachListener:function(e){this.dataSubscription=e.onStateChange(this.dataListenerCallback)},detachListener:function(){this.dataSubscription&&(this.dataSubscription.unsubscribe(),this.dataSubscription=null)},componentWillMount:function(){this.detachListener(),this.props.listener&&this.attachListener(this.props.model)},componentWillUnmount:function(){this.detachListener()},componentWillReceiveProps:function(e){var t=this.props.model,n=e.model;t!==n&&(this.detachListener(),this.attachListener(n))}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={dataListenerCallback:function(e,t){this.forceUpdate()}}},function(e,t,n){!function(r,o){e.exports=t=o(n(7))}(this,function(e){return function(t){var n=e,r=n.lib,o=r.Base,a=r.WordArray,i=n.x64={};i.Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),i.WordArray=o.extend({init:function(e,n){e=this.words=e||[],n!=t?this.sigBytes=n:this.sigBytes=8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],r=0;r]/;e.exports=r},function(e,t,n){"use strict";var r,o=n(18),a=n(112),i=/^[ \r\n\t\f]/,s=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,l=n(126),u=l(function(e,t){if(e.namespaceURI!==a.svg||"innerHTML"in e)e.innerHTML=t;else{r=r||document.createElement("div"),r.innerHTML=""+t+"";for(var n=r.firstChild.childNodes,o=0;o0){var t=l["default"].bisectLeft(this.numbers,e);if(this.numbers[t]===e)return t}var n=l["default"].bisectRight(this.numbers,e);return this.numbers=this.numbers.slice(0,n).concat(e).concat(this.numbers.slice(n,this.numbers.length)),n}},{key:"del",value:function(e){if(!isFinite(e)||!this.numbers)return-1;if(this.numbers.length>0){var t=l["default"].bisectLeft(this.numbers,e);if(this.numbers[t]===e)return this.numbers=this.numbers.slice(0,t).concat(this.numbers.slice(t+1,this.numbers.length)),t}return-1}},{key:"eval",value:function(e){if(0===e)return"0";if(e===1/0)return"∞";if(e===-(1/0))return"-∞";if(isNaN(e))return"NaN";var t=Math.log10(Math.abs(e)),n=this.fixedPrecision;if(this.numbers){var r=l["default"].bisectLeft(this.numbers,e)-1,o=l["default"].bisectRight(this.numbers,e);if(r>=0&&rn&&(n=i)}if(o>r&&on&&(n=u)}}if(t<=3&&t>-2)return e.toFixed(n-Math.floor(t));var c=3*-Math.floor(Math.log10(Math.abs(e))/3),f=Math.pow(10,c)*e;return f.toFixed(n-Math.ceil(t+c)).concat("e").concat(-c.toFixed())}},{key:"evaluator",value:function(){var e=this;return function(t){return e.eval(t)}}}]),e}();t["default"]=u;t.sciNotationRegExp="[-+]?[0-9]*[.]?[0-9]*[eE]?[-+]?[0-9]*"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0])||arguments[0];o(this,e),this.state=n,this.toggleState=function(){t.state=!t.state,t.emit(l,t.state)}}return a(e,[{key:"setState",value:function(e){!!e!==this.state&&(this.state=!!e,this.emit(l,this.state))}},{key:"getState",value:function(){return this.state}},{key:"onChange",value:function(e){return this.on(l,e)}},{key:"destroy",value:function(){this.off()}}]),e}();t["default"]=u,s["default"].mixInto(u)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(){return(new Date).getTime()}function i(e){return"json"===e.type?e.size=JSON.stringify(e.data).length:"blob"===e.type?e.size=e.data.size:e.size=e.data.length,e.size}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:1e9;o(this,e),this.pattern=new h["default"],this.keyToTypeMap={},this.cacheSize=t,this.cacheData={cache:{},modified:0,ts:0,size:0}}return s(e,[{key:"destroy",value:function(){this.off(),this.clear()}},{key:"fetch",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=t?this.pattern.getValue(e,t):e,s=this.cacheData.cache[o];return s?s.pending?(s.keysToNotify.push(e),r&&s.keysToNotify.push(r)):(this.cacheData.ts=s.ts=a(),setTimeout(function(){var t=s.keysToNotify||[e],o=t.length;for(delete s.keysToNotify;o;)o-=1,n.emit(t[o],s);r&&n.emit(r,s)},0)):!function(){n.gc(),n.cacheData.cache[o]={pending:!0,keysToNotify:[e]},r&&n.cacheData.cache[o].keysToNotify.push(r);var l=n,u=n.keyToTypeMap[e],c=u[0],f=u[1],d=u[2],h=function(n,r){if(n)return delete l.cacheData.cache[o],void l.emit(e,{error:n,data:{key:e,options:t,url:o,typeFnMime:u}});s={data:r,type:c,requestedURL:o,pending:!1},d&&d.indexOf("image")!==-1&&(s.url=window.URL.createObjectURL(r)),l.cacheData.size+=i(s),l.cacheData.modified=l.cacheData.ts=s.ts=a();var f=l.cacheData.cache[o].keysToNotify,h=f.length;for(l.cacheData.cache[o]=s;h;)h-=1,l.emit(f[h],s)};d?f(o,d,h):f(o,h)}(),o}},{key:"fetchURL",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return this.keyToTypeMap[e]=[t,p[t],n],this.fetch(e,null,r)}},{key:"get",value:function(e,t){var n=this.cacheData.cache[e];return t&&this.free(e),n}},{key:"free",value:function(e){var t=this.cacheData.cache[e];t&&t.url&&(window.URL.revokeObjectURL(t.url),delete t.url),delete this.cacheData.cache[e],this.off(e)}},{key:"registerURL",value:function(e,t,n,r){this.pattern.registerPattern(e,t),this.keyToTypeMap[e]=[n,p[n],r]}},{key:"unregisterURL",value:function(e){this.pattern.unregisterPattern(e),delete this.keyToTypeMap[e],this.off(e)}},{key:"clear",value:function(){var e=[];Object.keys(this.cacheData.cache).forEach(function(t){e.push(t)});for(var t=e.length;t;)t-=1,this.free(e[t]);this.cacheData.size=0}},{key:"gc",value:function(){this.cacheData.size>this.cacheSize&&(console.log("Free cache memory",this.cacheData.size),this.clear())}},{key:"setCacheSize",value:function(e){this.cacheSize=e}},{key:"getCacheSize",value:function(){return this.cacheSize}},{key:"getMemoryUsage",value:function(){return this.cacheData.size}}]),e}();t["default"]=g,u["default"].mixInto(g)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:100,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100;o(this,e),this.client=t,this.ready=!0,this.width=r,this.height=a,this.setInteractionDoneCallback(),this.listeners={drag:function(e){var t={view:-1,buttonLeft:!e.isFinal,buttonMiddle:!1,buttonRight:!1,shiftKey:e.modifier&l.SHIFT,ctrlKey:e.modifier&l.CTRL,altKey:e.modifier&l.ALT,metaKey:e.modifier&l.META,x:e.relative.x/n.width,y:1-e.relative.y/n.height};e.isFirst?t.action="down":e.isFinal?t.action="up":t.action="move",n.emit(u,"up"!==t.action),n.client&&(n.ready||"move"!==t.action)&&(n.ready=!1,n.client.MouseHandler.interaction(t).then(function(e){n.ready=!0,n.doneCallback("up"!==t.action)},function(e){console.log("event err",e),n.doneCallback("up"!==t.action)}))},zoom:function(e){var t={view:-1,buttonLeft:!1,buttonMiddle:!1,buttonRight:!e.isFinal,shiftKey:!1,ctrlKey:!1,altKey:!1,metaKey:!1,x:e.relative.x/n.width,y:1-(e.relative.y+e.deltaY)/n.height};e.isFirst?t.action="down":e.isFinal?t.action="up":t.action="move",n.emit(u,"up"!==t.action),n.client&&n.client.MouseHandler.interaction(t).then(function(e){n.doneCallback("up"!==t.action)},function(e){n.doneCallback("up"!==t.action)})}}}return a(e,[{key:"getListeners",value:function(){return this.listeners}},{key:"setInteractionDoneCallback",value:function(e){this.doneCallback=e||c}},{key:"updateSize",value:function(e,t){this.width=e,this.height=t}},{key:"onInteraction",value:function(e){return this.on(u,e)}},{key:"destroy",value:function(){this.client=null,this.listeners=null}}]),e}();t["default"]=f,s["default"].mixInto(f)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(17),s=r(i),l=n(67),u=r(l),c=n(93),f=r(c);t["default"]=a["default"].createClass({displayName:"lookupTableManagerControl",propTypes:{field:a["default"].PropTypes.string,lookupTableManager:a["default"].PropTypes.object.isRequired},getInitialState:function(){var e=this.props.lookupTableManager.luts,t=Object.keys(e),n=this.props.field||t[0];return{field:n,fields:t}},componentWillMount:function(){var e=this;this.changeSubscription=this.props.lookupTableManager.onFieldsChange(function(t,n){var r=Object.keys(e.props.lookupTableManager.luts);e.setState({fields:r})})},componentWillUnmount:function(){this.changeSubscription&&(this.changeSubscription.unsubscribe(),this.changeSubscription=null)},onFieldsChange:function(e){this.props.lookupTableManager.updateActiveLookupTable(e),this.setState({field:e})},render:function(){var e=this.props.lookupTableManager,t=e.getLookupTable(this.state.field),n=t.getScalarRange();return a["default"].createElement(s["default"],{title:"Lookup Table",activeSubTitle:!0,subtitle:a["default"].createElement(f["default"],{field:this.state.field,fields:this.state.fields,onChange:this.onFieldsChange})},a["default"].createElement(u["default"],{lookupTableManager:e,lookupTable:t,originalRange:n}))}})},function(e,t,n){(function(e){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(68),s=r(i),l=n(17),u=r(l);t["default"]=a["default"].createClass({displayName:"ProbeControl",propTypes:{imageBuilder:a["default"].PropTypes.object.isRequired,imageBuilders:a["default"].PropTypes.object},getDefaultProps:function(){return{imageBuilders:{}}},getInitialState:function(){var e=this.getImageBuilder(this.props);return{probe:[e.getProbe()[0],e.getProbe()[1],e.getProbe()[2]],showFieldValue:!0}},componentWillMount:function(){this.attachImageBuilderListeners(this.getImageBuilder(this.props))},componentDidMount:function(){this.setState({showFieldValue:this.probeInput.isExpanded()})},componentWillReceiveProps:function(e){var t=this.getImageBuilder(this.props),n=this.getImageBuilder(e);t!==n&&this.attachImageBuilderListeners(n)},componentWillUnmount:function(){this.detachImageBuilderListeners()},onProbeVisibilityChange:function(t){var n=this;this.setState({showFieldValue:t}),e(function(){n.props.imageBuilders&&Object.keys(n.props.imageBuilders).forEach(function(e){var r=n.props.imageBuilders[e].builder;r.setCrossHairEnable(t),r.render()}),n.props.imageBuilder&&(n.props.imageBuilder.setCrossHairEnable(t),n.props.imageBuilder.render())})},getImageBuilder:function(e){var t=e.imageBuilder;if(!t){var n=Object.keys(e.imageBuilders)[0];t=e.imageBuilders[n].builder}return t},attachImageBuilderListeners:function(e){var t=this;this.detachImageBuilderListeners(),this.probeListenerSubscription=e.onProbeChange(function(n,r){var o=e.getFieldValueAtProbeLocation();t.isMounted()&&t.setState({probe:n,field:o})}),this.probeDataListenerSubscription=e.onProbeLineReady(function(n,r){var o=e.getFieldValueAtProbeLocation();t.isMounted()&&o!==t.state.field&&t.setState({field:o})})},detachImageBuilderListeners:function(){this.probeListenerSubscription&&(this.probeListenerSubscription.unsubscribe(),this.probeListenerSubscription=null),this.probeDataListenerSubscription&&(this.probeDataListenerSubscription.unsubscribe(),this.probeDataListenerSubscription=null)},updateRenderMethod:function(e){this.props.imageBuilder&&(this.props.imageBuilder.setRenderMethod(e.target.value),this.props.imageBuilder.render(),this.forceUpdate())},probeChange:function(e){var t=Number(e.target.value),n=this.state.probe,r=Number(e.target.name);n[r]=t,this.getImageBuilder(this.props).setProbe(n[0],n[1],n[2])},render:function(){var e=this,t=this.getImageBuilder(this.props),n=this.state.field||t.getFieldValueAtProbeLocation(),r=""+n;return void 0===n?r="":(r&&r.length>6&&(r=n.toFixed(5)),Math.abs(n)<1e-5&&(r="0")),a["default"].createElement("div",null,a["default"].createElement(u["default"],{title:"Render method",visible:t.isRenderMethodMutable()},a["default"].createElement("select",{style:{width:"100%"},value:t.getRenderMethod(),onChange:this.updateRenderMethod},t.getRenderMethods().map(function(e){return a["default"].createElement("option",{key:e,value:e},e)}))),a["default"].createElement(u["default"],{title:"Probe",subtitle:this.state.showFieldValue?r:"",ref:function(t){e.probeInput=t},onChange:this.onProbeVisibilityChange,open:t.isCrossHairEnabled()},a["default"].createElement(s["default"],{name:"0",min:"0",max:t.metadata.dimensions[0]-1,key:"slider-x",value:this.state.probe[0],onChange:this.probeChange}),a["default"].createElement(s["default"],{name:"1",min:"0",max:t.metadata.dimensions[1]-1,key:"slider-Y",value:this.state.probe[1],onChange:this.probeChange}),a["default"].createElement(s["default"],{name:"2",min:"0",max:t.metadata.dimensions[2]-1,key:"slider-Z",value:this.state.probe[2],onChange:this.probeChange})))}})}).call(t,n(24).setImmediate)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return e[0].toUpperCase()+e.substr(1).toLowerCase()}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t,n){var r=v[o(e.ui.propType)];return r?r(e,t,n):null};var a=n(2),i=r(a),s=n(168),l=r(s),u=n(169),c=r(u),f=n(170),d=r(f),h=n(171),p=r(h),g=n(172),m=r(g),v={Cell:function(e,t,n){return i["default"].createElement(l["default"],{key:e.data.id,data:e.data,ui:e.ui,viewData:t,show:e.show,onChange:n})},Slider:function(e,t,n){return i["default"].createElement(m["default"],{key:e.data.id,data:e.data,ui:e.ui,viewData:t,show:e.show,onChange:n})},Enum:function(e,t,n){return i["default"].createElement(d["default"],{key:e.data.id,data:e.data,ui:e.ui,viewData:t,show:e.show,onChange:n})},Checkbox:function(e,t,n){return i["default"].createElement(c["default"],{key:e.data.id,data:e.data,ui:e.ui,viewData:t,show:e.show,onChange:n})},Map:function(e,t,n){return i["default"].createElement(p["default"],{key:e.data.id,data:e.data,ui:e.ui,viewData:t,show:e.show,onChange:n})}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(672),s=r(i);t["default"]=a["default"].createClass({displayName:"ActionListWidget",propTypes:{list:a["default"].PropTypes.array.isRequired,onClick:a["default"].PropTypes.func},processClick:function(e){for(var t=e.target;!t.dataset.name;)t=t.parentNode;this.props.onClick&&this.props.onClick(t.dataset.name,t.dataset.action,t.dataset.user)},render:function(){var e=this,t=[];return this.props.list.forEach(function(n,r){t.push(a["default"].createElement("li",{className:n.active?s["default"].activeItem:s["default"].item,key:r,title:n.name,"data-name":n.name,"data-action":n.action||"default","data-user":n.data||"",onClick:e.processClick},a["default"].createElement("i",{className:n.icon}),n.name))}),a["default"].createElement("ul",{className:s["default"].list},t)}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(680),s=r(i);t["default"]=a["default"].createClass({displayName:"DropDownWidget",propTypes:{field:a["default"].PropTypes.string,fields:a["default"].PropTypes.array,onChange:a["default"].PropTypes.func},getInitialState:function(){return{open:!1,field:this.props.field||this.props.fields[0]}},getField:function(e){return this.state.field},setField:function(e){this.setState({field:e.target.innerHTML}),this.props.onChange(e.target.innerHTML)},toggleDropdown:function(){this.setState({open:!this.state.open})},render:function(){var e=this;return a["default"].createElement("div",{className:s["default"].container,onClick:this.toggleDropdown},this.state.field,a["default"].createElement("ul",{className:this.state.open?s["default"].list:s["default"].hidden},this.props.fields.map(function(t){return"__internal"===t?null:t===e.state.field?a["default"].createElement("li",{className:s["default"].selectedItem,key:t,onClick:e.setField},t):a["default"].createElement("li",{className:s["default"].item,key:t,onClick:e.setField},t)})))}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(73),a=r(o),i=n(2),s=r(i),l=n(681),u=r(l),c=n(39),f=r(c),d=n(20),h=r(d);t["default"]=s["default"].createClass({displayName:"EqualizerWidget",propTypes:{colors:s["default"].PropTypes.array,height:s["default"].PropTypes.number,layers:s["default"].PropTypes.array,onChange:s["default"].PropTypes.func,spacing:s["default"].PropTypes.number,stroke:s["default"].PropTypes.string,width:s["default"].PropTypes.number},getDefaultProps:function(){return{layers:[1,1,1,1,1,1,1],colors:["#0000ff","#ffffff","#ff0000"],stroke:"#000000",height:120,width:300,spacing:2}},getInitialState:function(){return{layers:this.props.layers,width:this.props.width,height:this.props.height}},componentWillMount:function(){this.sizeSubscription=h["default"].onSizeChange(this.updateDimensions),h["default"].startListening()},componentDidMount:function(){this.updateDimensions(),this.draw(),this.mouseHandler=new f["default"](this.canvas),this.mouseHandler.attach({click:this.clicked,drag:this.clicked})},componentWillReceiveProps:function(e){var t=e.layers;(0,a["default"])(this.state.layers,t)||this.setState({layers:t})},componentDidUpdate:function(e,t){this.draw()},componentWillUnmount:function(){this.mouseHandler.destroy(),this.sizeSubscription&&(this.sizeSubscription.unsubscribe(),this.sizeSubscription=null)},updateDimensions:function(){var e=this.rootContainer.parentNode,t=h["default"].getSize(e,!0).clientWidth;return!(!e||!t||this.state.width===t)&&(this.setState({width:t}),!0)},draw:function(){var e=this.canvas.getContext("2d");e.strokeStyle=this.props.stroke,e.lineWidth="1";var t=this.state.layers,n=this.state.width,r=this.state.height,o=t.length,a=this.props.spacing,i=Math.floor((n-5*a)/o-a),s=r-4*a,l=i+(n-i*t.length-2*a)/(t.length+1);e.clearRect(0,0,this.state.width,this.state.height),e.beginPath(),e.rect(a,a,n-2*a,r-2*a),e.stroke();for(var u=0;u1?1:i,i=i<0?0:i,s[a]=i,this.setState({layers:s}),this.props.onChange&&this.props.onChange(s),this.draw()},render:function(){var e=this;return s["default"].createElement("div",{className:u["default"].container,ref:function(t){return e.rootContainer=t}},s["default"].createElement("canvas",{className:u["default"].canvas,ref:function(t){e.canvas=t},width:this.state.width,height:this.state.height}))}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o);t["default"]=a["default"].createClass({displayName:"NumberInputWidget",propTypes:{className:a["default"].PropTypes.string,max:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string]),min:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string]),name:a["default"].PropTypes.string,onChange:a["default"].PropTypes.func,step:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string]),value:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string])},getDefaultProps:function(){return{className:"",step:1,value:0,classes:[]}},getInitialState:function(){return{editing:!1,valueRep:this.props.value}},getValue:function(){var e=parseFloat(this.newVal);if(!isNaN(e))return e},valueChange:function(e){this.newVal=e.target.value,this.setState({editing:!0,valueRep:this.newVal});var t=parseFloat(this.newVal);!isNaN(t)&&this.props.onChange&&(this.props.name?this.props.onChange(t,this.props.name):this.props.onChange(t))},endEditing:function(){this.setState({editing:!1})},render:function(){return a["default"].createElement("input",{className:this.props.className,type:"number",min:this.props.min,max:this.props.max,step:this.props.step,value:this.state.editing?this.state.valueRep:this.props.value,onChange:this.valueChange,onBlur:this.endEditing})}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(574),s=r(i),l=n(687),u=r(l),c=n(159),f=r(c),d=n(29),h=r(d),p=n(20),g=r(p),m=n(707),v=r(m),y=n(709),b=r(y);t["default"]=a["default"].createClass({displayName:"PieceWiseFunctionEditorWidget",propTypes:{points:a["default"].PropTypes.array,rangeMin:a["default"].PropTypes.number,rangeMax:a["default"].PropTypes.number,onChange:a["default"].PropTypes.func,onEditModeChange:a["default"].PropTypes.func,height:a["default"].PropTypes.number,width:a["default"].PropTypes.number,hidePointControl:a["default"].PropTypes.bool},getDefaultProps:function(){return{height:200,width:-1,points:[{x:0,y:0},{x:1,y:1}]}},getInitialState:function(){return{height:this.props.height,width:this.props.width,activePoint:-1}},componentDidMount:function(){var e=this.canvas;this.editor=new f["default"](e),this.editor.setControlPoints(this.props.points),this.editor.render(),this.editor.onChange(this.updatePoints),this.editor.onEditModeChange(this.props.onEditModeChange),this.props.width!==-1&&this.props.height!==-1||(this.sizeSubscription=g["default"].onSizeChange(this.updateDimensions),g["default"].startListening(),this.updateDimensions())},componentWillReceiveProps:function(e){var t={};(0,s["default"])(e.points,this.props.points)||(this.editor.setControlPoints(e.points,this.editor.activeIndex),this.state.activePoint>=e.points.length&&(t.activePoint=-1)),e.width!==this.props.width&&(t.width=e.width),e.height!==this.props.height&&(t.height=e.height),this.props.width!==-1&&this.props.height!==-1||this.updateDimensions(),this.setState(t)},componentDidUpdate:function(e,t){this.state.width===t.width&&this.state.height===t.height||this.editor.render()},componentWillUnmount:function(){this.sizeSubscription&&(this.sizeSubscription.unsubscribe(),this.sizeSubscription=null,this.editor.destroy(),this.editor=null)},updateDimensions:function(){var e=g["default"].getSize(this.rootContainer,!0),t=e.clientWidth,n=e.clientHeight;this.props.width===-1&&this.setState({width:t}),this.props.height===-1&&this.setState({height:n})},updatePoints:function(e,t){var n=this.editor.activeIndex;this.setState({activePoint:n});var r=this.props.points.map(function(e){return{x:e.x,y:e.y,x2:e.x2||.5,y2:e.y2||.5}}),o=e.map(function(e){return{x:e.x,y:e.y,x2:e.x2||.5,y2:e.y2||.5}});this.oldPoints=r,this.props.onChange&&this.props.onChange(o)},updateActivePointDataValue:function(e){if(this.state.activePoint!==-1){var t=parseFloat(e.target.value),n=this.props.points.map(function(e){return{x:e.x,y:e.y,x2:e.x2||.5,y2:e.y2||.5}});n[this.state.activePoint].x=(t-this.props.rangeMin)/(this.props.rangeMax-this.props.rangeMin),this.editor.setControlPoints(n,this.state.activePoint)}},updateActivePointOpacity:function(e){if(this.state.activePoint!==-1){var t=parseFloat(e.target.value),n=this.props.points.map(function(e){return{x:e.x,y:e.y,x2:e.x2||.5,y2:e.y2||.5}});n[this.state.activePoint].y=t,this.editor.setControlPoints(n,this.state.activePoint)}},addPoint:function(e){var t=this.props.points.map(function(e){return{x:e.x,y:e.y,x2:e.x2||.5,y2:e.y2||.5}});t.push({x:.5,y:.5,x2:.5,y2:.5}),this.editor.setControlPoints(t,t.length-1)},removePoint:function(e){if(this.state.activePoint!==-1){var t=this.props.points.map(function(e){return{x:e.x,y:e.y,x2:e.x2||.5,y2:e.y2||.5}});t.splice(this.state.activePoint,1),this.editor.setActivePoint(-1),this.editor.setControlPoints(t)}},render:function(){var e=this,t=(this.state.activePoint!==-1?this.props.points[this.state.activePoint].x:.5)*(this.props.rangeMax-this.props.rangeMin)+this.props.rangeMin,n=this.state.activePoint!==-1?this.props.points[this.state.activePoint].y:.5;return a["default"].createElement("div",{className:u["default"].pieceWiseFunctionEditorWidget,ref:function(t){return e.rootContainer=t}},a["default"].createElement("canvas",{className:u["default"].canvas,width:this.state.width,height:this.state.height,ref:function(t){e.canvas=t}}),this.props.hidePointControl?null:a["default"].createElement("div",{className:u["default"].pointControls},a["default"].createElement("div",{className:u["default"].pointInfo},a["default"].createElement("div",{className:u["default"].line},a["default"].createElement("label",null,"Data"),a["default"].createElement("input",{className:u["default"].input,type:"number",step:"any",min:this.props.rangeMin,max:this.props.rangeMax,value:t,onChange:this.updateActivePointDataValue})),a["default"].createElement("div",{className:u["default"].line},a["default"].createElement("label",null,"Opacity"),a["default"].createElement("input",{className:u["default"].input,type:"number",step:.01,min:0,max:1,value:Math.floor(100*n)/100,onChange:this.updateActivePointOpacity}))),a["default"].createElement(h["default"],{className:u["default"].svgIcon,icon:v["default"],onClick:this.addPoint}),a["default"].createElement(h["default"],{className:u["default"].svgIcon,icon:b["default"],onClick:this.removePoint})))}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(688),s=r(i);t["default"]=a["default"].createClass({displayName:"PresetListWidget",propTypes:{activeName:a["default"].PropTypes.string,height:a["default"].PropTypes.string,onChange:a["default"].PropTypes.func,presets:a["default"].PropTypes.object,visible:a["default"].PropTypes.bool},getDefaultProps:function(){return{activeName:"",height:"1em",presets:{},visible:!0}},getInitialState:function(){return{activeName:this.props.activeName}},updateActive:function(e){var t=e.target.dataset.name;this.setState({activeName:t}),this.props.onChange&&this.props.onChange(t)},render:function(){var e=this;if(!this.props.presets||!this.props.visible)return null;var t=this.state.activeName,n=this.props.height,r=this.props.presets,o=Object.keys(r);return a["default"].createElement("div",{className:s["default"].container},a["default"].createElement("div",{className:s["default"].bottomPadding}),o.map(function(o){return a["default"].createElement("img",{alt:"Preset",src:"data:image/png;base64,"+r[o],key:o,style:{height:n},"data-name":o,onClick:e.updateActive,className:o===t?s["default"].activeLine:s["default"].line})}),a["default"].createElement("div",{className:s["default"].bottomPadding}))}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(137),s=r(i),l=n(408),u=r(l),c=n(407),f=r(c),d=n(69),h=r(d),p=n(70),g=r(p);t["default"]=a["default"].createClass({displayName:"QueryDataModelWidget",propTypes:{model:a["default"].PropTypes.object},mixins:[h["default"],g["default"]],render:function(){var e=this.props.model,t=e.originalData.arguments,n=e.originalData.arguments_order.filter(function(e){return t[e].values.length>1});return a["default"].createElement("div",{className:s["default"].container},n.map(function(t){return"list"===e.getUiType(t)?a["default"].createElement(u["default"],{key:t,model:e,arg:t,listener:!1}):"slider"===e.getUiType(t)?a["default"].createElement(f["default"],{key:t,model:e,arg:t,listener:!1}):null}))}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(!e.getLegend)return i["default"].createElement("span",null,e.name);var t={fill:e.getLegend(e.name).color},n=Object.assign({stroke:"black",strokeWidth:1},t,e.style);return i["default"].createElement(l["default"],{icon:e.getLegend(e.name).shape,width:e.width,height:e.height,style:n,onClick:e.onClick})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(2),i=r(a),s=n(29),l=r(s);o.propTypes={name:i["default"].PropTypes.string,getLegend:i["default"].PropTypes.func,width:i["default"].PropTypes.string,height:i["default"].PropTypes.string,style:i["default"].PropTypes.object,onClick:i["default"].PropTypes.func}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=l["default"][e.selection?e.selection.type:"empty"];return i["default"].createElement(t,e)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(2),i=r(a),s=n(420),l=r(s);o.propTypes={selection:i["default"].PropTypes.object,ranges:i["default"].PropTypes.object,onChange:i["default"].PropTypes.func,getLegend:i["default"].PropTypes.func,className:i["default"].PropTypes.string},o.defaultProps={onChange:function(e,t){}}},function(e,t,n){!function(r,o){e.exports=t=o(n(7))}(this,function(e){!function(){var t=e,n=t.lib,r=n.Base,o=t.enc,a=o.Utf8,i=t.algo;i.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=a.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),s=o.words,l=i.words,u=0;u>>31}var f=(r<<5|r>>>27)+l+i[u];f+=u<20?(o&a|~o&s)+1518500249:u<40?(o^a^s)+1859775393:u<60?(o&a|o&s|a&s)-1894007588:(o^a^s)-899497514,l=s,s=a,a=o<<30|o>>>2,o=r,r=f}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[(r+64>>>9<<4)+14]=Math.floor(n/4294967296),t[(r+64>>>9<<4)+15]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=o._createHelper(s),t.HmacSHA1=o._createHmacHelper(s)}(),e.SHA1})},function(e,t,n){t=e.exports=n(3)(),t.i(n(1),void 0),t.push([e.id,".AbstractViewerMenu_container_UqWNj{overflow:hidden;width:100%;height:100%;font-size:16px}.AbstractViewerMenu_hidden_tW5_E{display:none}.AbstractViewerMenu_button_2irlM{width:1.52em;height:1.25em;padding-top:.25em;text-align:center;margin-left:.5em;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.AbstractViewerMenu_leftButton_2MeNR{float:left}.AbstractViewerMenu_collapsedControl_20cvd .AbstractViewerMenu_leftButton_2MeNR{display:none}.AbstractViewerMenu_magicLensButtonIn_iixWh{border-radius:5px}.AbstractViewerMenu_magicLensButtonOut_1erzW{background:#000}.AbstractViewerMenu_recordButtonOff_2ai1M{color:#000}.AbstractViewerMenu_recordButtonOn_VYrxJ{color:red}.AbstractViewerMenu_animationSpeed_1W9cF{float:left}.AbstractViewerMenu_collapsedControl_20cvd .AbstractViewerMenu_animationSpeed_1W9cF{display:none}.AbstractViewerMenu_menuButton_1d4M0{float:right}.AbstractViewerMenu_collapsedMenuButton_2brM7{border:1px solid;border-radius:50%;border-color:#ccc;background-color:#eee}.AbstractViewerMenu_control_2Mn-b{position:absolute;top:10px;right:10px;width:20%;max-width:400px;min-width:300px;z-index:1;border-radius:5px;background-color:hsla(0,0%,100%,.3);color:rgba(0,0,0,.3)}.AbstractViewerMenu_control_2Mn-b:hover{background-color:#fff;color:#000}.AbstractViewerMenu_collapsedControl_20cvd{min-width:1.5em;width:1.5em;border-radius:50%}.AbstractViewerMenu_collapsedControl_20cvd:hover{background:none}.AbstractViewerMenu_control_2Mn-b input[type=number].AbstractViewerMenu_LookupTableWidget__input_rh3Xg{color:#000}.AbstractViewerMenu_control_2Mn-b input[type=number],.AbstractViewerMenu_control_2Mn-b input[type=text],.AbstractViewerMenu_control_2Mn-b select{background-color:transparent}.AbstractViewerMenu_control_2Mn-b select{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:1px 5px;background-image:url("+n(722)+");background-repeat:no-repeat;background-position:99%;background-size:13px 13px;border:1px solid #d3d3d3;border-radius:3px}.AbstractViewerMenu_controlContent_2eESa{border:1px solid;border-radius:0 0 5px 5px;border-color:#ccc;padding-left:5px;padding-bottom:.5em;max-height:calc(100vh - 55px);overflow-y:auto}.AbstractViewerMenu_collapsedControl_20cvd>.AbstractViewerMenu_controlContent_2eESa{display:none}.AbstractViewerMenu_controlBar_2JSl5{height:25px;line-height:25px;border:1px solid;border-radius:5px 5px 0 0;border-color:#ccc}.AbstractViewerMenu_control_2Mn-b:hover .AbstractViewerMenu_controlBar_2JSl5{background-color:#eee}.AbstractViewerMenu_collapsedControl_20cvd>.AbstractViewerMenu_controlBar_2JSl5{background:none;border:none;display:inline}.AbstractViewerMenu_renderer_2FUfo{position:absolute;top:0;bottom:0;left:0;right:0}.AbstractViewerMenu_item_fNsoc{display:-ms-flexbox;display:flex;-ms-flex:1 0 0%;flex:1 0 0%;-ms-flex-direction:column;flex-direction:column;box-sizing:border-box;margin-left:3px;padding-left:10px;padding-right:10px}.AbstractViewerMenu_row_1qFcK{position:relative;display:-ms-flexbox;display:flex;-ms-flex:1 0 0%;flex:1 0 0%;-ms-flex-direction:row;flex-direction:row}.AbstractViewerMenu_label_13aO1{-ms-flex:1 0 0%;flex:1 0 0%;font-weight:700;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.AbstractViewerMenu_label_13aO1:first-letter{text-transform:uppercase}.AbstractViewerMenu_row_1qFcK>select{width:100%;background-color:rbga(0,0,0,0)}@media screen and (max-width:400px),screen and (orientation:landscape) and (max-device-width:400px){.AbstractViewerMenu_controlBar_2JSl5{height:40px}.AbstractViewerMenu_controlBar_2JSl5>.AbstractViewerMenu_button_2irlM{font-size:1.45em}.AbstractViewerMenu_controlContent_2eESa{max-height:calc(100vh - 70px)}}.is-ios-device .AbstractViewerMenu_controlBar_2JSl5{height:40px}.is-ios-device .AbstractViewerMenu_controlBar_2JSl5 .AbstractViewerMenu_button_2irlM{font-size:1.45em}.is-ios-device .AbstractViewerMenu_controlContent_2eESa{max-height:calc(100vh - 70px)}",""]),t.locals={container:"AbstractViewerMenu_container_UqWNj",hidden:"AbstractViewerMenu_hidden_tW5_E",button:"AbstractViewerMenu_button_2irlM",leftButton:"AbstractViewerMenu_leftButton_2MeNR AbstractViewerMenu_button_2irlM",collapsedControl:"AbstractViewerMenu_collapsedControl_20cvd AbstractViewerMenu_control_2Mn-b",magicLensButtonIn:"AbstractViewerMenu_magicLensButtonIn_iixWh "+n(1).locals.fa+" "+n(1).locals["fa-search"]+" AbstractViewerMenu_leftButton_2MeNR AbstractViewerMenu_button_2irlM",magicLensButtonOut:"AbstractViewerMenu_magicLensButtonOut_1erzW AbstractViewerMenu_magicLensButtonIn_iixWh "+n(1).locals.fa+" "+n(1).locals["fa-search"]+" AbstractViewerMenu_leftButton_2MeNR AbstractViewerMenu_button_2irlM "+n(1).locals["fa-inverse"],recordButtonOff:"AbstractViewerMenu_recordButtonOff_2ai1M "+n(1).locals.fa+" "+n(1).locals["fa-circle-thin"]+" AbstractViewerMenu_leftButton_2MeNR AbstractViewerMenu_button_2irlM",recordButtonOn:"AbstractViewerMenu_recordButtonOn_VYrxJ AbstractViewerMenu_recordButtonOff_2ai1M "+n(1).locals.fa+" "+n(1).locals["fa-circle-thin"]+" AbstractViewerMenu_leftButton_2MeNR AbstractViewerMenu_button_2irlM "+n(1).locals["fa-circle"],resetCameraButton:"AbstractViewerMenu_resetCameraButton_2bsjg "+n(1).locals.fa+" "+n(1).locals["fa-arrows-alt"]+" AbstractViewerMenu_leftButton_2MeNR AbstractViewerMenu_button_2irlM",playButton:"AbstractViewerMenu_playButton_3QF6p "+n(1).locals.fa+" "+n(1).locals["fa-play"]+" AbstractViewerMenu_leftButton_2MeNR AbstractViewerMenu_button_2irlM",stopButton:"AbstractViewerMenu_stopButton_2Sl-k "+n(1).locals.fa+" "+n(1).locals["fa-stop"]+" AbstractViewerMenu_leftButton_2MeNR AbstractViewerMenu_button_2irlM",speedButton:"AbstractViewerMenu_speedButton_1beKS "+n(1).locals.fa+" "+n(1).locals["fa-clock-o"]+" AbstractViewerMenu_leftButton_2MeNR AbstractViewerMenu_button_2irlM",animationSpeed:"AbstractViewerMenu_animationSpeed_1W9cF",menuButton:"AbstractViewerMenu_menuButton_1d4M0 "+n(1).locals.fa+" "+n(1).locals["fa-bars"]+" AbstractViewerMenu_button_2irlM",collapsedMenuButton:"AbstractViewerMenu_collapsedMenuButton_2brM7 AbstractViewerMenu_menuButton_1d4M0 "+n(1).locals.fa+" "+n(1).locals["fa-bars"]+" AbstractViewerMenu_button_2irlM",control:"AbstractViewerMenu_control_2Mn-b",LookupTableWidget__input:"AbstractViewerMenu_LookupTableWidget__input_rh3Xg",controlContent:"AbstractViewerMenu_controlContent_2eESa",controlBar:"AbstractViewerMenu_controlBar_2JSl5",renderer:"AbstractViewerMenu_renderer_2FUfo",item:"AbstractViewerMenu_item_fNsoc",row:"AbstractViewerMenu_row_1qFcK",label:"AbstractViewerMenu_label_13aO1"}},function(e,t){"use strict";function n(e,t){return e===t?0!==e||0!==t||1/e===1/t:e!==e&&t!==t}function r(e,t){if(n(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(var i=0;i-1?void 0:i("96",e),!u.plugins[n]){t.extractEvents?void 0:i("97",e),u.plugins[n]=t;var r=t.eventTypes;for(var a in r)o(r[a],t,a)?void 0:i("98",a,e)}}}function o(e,t,n){u.eventNameDispatchConfigs.hasOwnProperty(n)?i("99",n):void 0,u.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var s=r[o];a(s,t,n)}return!0}return!!e.registrationName&&(a(e.registrationName,t,n),!0)}function a(e,t,n){u.registrationNameModules[e]?i("100",e):void 0,u.registrationNameModules[e]=t,u.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var i=n(6),s=(n(5),null),l={},u={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:null,injectEventPluginOrder:function(e){s?i("101"):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];l.hasOwnProperty(n)&&l[n]===o||(l[n]?i("102",n):void 0,l[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in l)l.hasOwnProperty(e)&&delete l[e];u.plugins.length=0;var t=u.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=u.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};e.exports=u},function(e,t,n){"use strict";function r(e){return e===y.topMouseUp||e===y.topTouchEnd||e===y.topTouchCancel}function o(e){return e===y.topMouseMove||e===y.topTouchMove}function a(e){return e===y.topMouseDown||e===y.topTouchStart}function i(e,t,n,r){var o=e.type||"unknown-event";e.currentTarget=b.getNodeFromInstance(r),t?m.invokeGuardedCallbackWithCatch(o,n,e):m.invokeGuardedCallback(o,n,e),e.currentTarget=null}function s(e,t){var n=e._dispatchListeners,r=e._dispatchInstances;if(Array.isArray(n))for(var o=0;o0&&r.length<20?n+" (keys: "+r.join(", ")+")":n}function a(e,t){var n=s.get(e);if(!n){return null}return n}var i=n(6),s=(n(34),n(61)),l=(n(23),n(27)),u=(n(5),n(8),{isMounted:function(e){var t=s.get(e);return!!t&&!!t._renderedComponent},enqueueCallback:function(e,t,n){u.validateCallback(t,n);var o=a(e);return o?(o._pendingCallbacks?o._pendingCallbacks.push(t):o._pendingCallbacks=[t],void r(o)):null},enqueueCallbackInternal:function(e,t){e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=a(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=a(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=a(e,"setState");if(n){var o=n._pendingStateQueue||(n._pendingStateQueue=[]);o.push(t),r(n)}},enqueueElementInternal:function(e,t,n){e._pendingElement=t,e._context=n,r(e)},validateCallback:function(e,t){e&&"function"!=typeof e?i("122",t,o(e)):void 0}});e.exports=u},function(e,t){"use strict";var n=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e};e.exports=n},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}e.exports=n},function(e,t){"use strict";function n(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=o[e];return!!r&&!!n[r]}function r(e){return n}var o={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};e.exports=r},function(e,t){"use strict";function n(e){var t=e.target||e.srcElement||window;return t.correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}e.exports=n},function(e,t,n){"use strict";/** +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {module.exports = global["ParaViewWeb"] = __webpack_require__(1); + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Rendering = exports.React = exports.NativeUI = exports.IO = exports.Interaction = exports.InfoViz = exports.Component = exports.Common = undefined; + + var _Common = __webpack_require__(2); + + var _Common2 = _interopRequireDefault(_Common); + + var _Component = __webpack_require__(34); + + var _Component2 = _interopRequireDefault(_Component); + + var _InfoViz = __webpack_require__(232); + + var _InfoViz2 = _interopRequireDefault(_InfoViz); + + var _Interaction = __webpack_require__(287); + + var _Interaction2 = _interopRequireDefault(_Interaction); + + var _IO = __webpack_require__(303); + + var _IO2 = _interopRequireDefault(_IO); + + var _NativeUI = __webpack_require__(463); + + var _NativeUI2 = _interopRequireDefault(_NativeUI); + + var _React = __webpack_require__(469); + + var _React2 = _interopRequireDefault(_React); + + var _Rendering = __webpack_require__(701); + + var _Rendering2 = _interopRequireDefault(_Rendering); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.Common = _Common2.default; + exports.Component = _Component2.default; + exports.InfoViz = _InfoViz2.default; + exports.Interaction = _Interaction2.default; + exports.IO = _IO2.default; + exports.NativeUI = _NativeUI2.default; + exports.React = _React2.default; + exports.Rendering = _Rendering2.default; + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _Core = __webpack_require__(3); + + var _Core2 = _interopRequireDefault(_Core); + + var _Misc = __webpack_require__(15); + + var _Misc2 = _interopRequireDefault(_Misc); + + var _State = __webpack_require__(30); + + var _State2 = _interopRequireDefault(_State); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + Core: _Core2.default, + Misc: _Misc2.default, + State: _State2.default + }; + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _CompositeClosureHelper = __webpack_require__(4); + + var _CompositeClosureHelper2 = _interopRequireDefault(_CompositeClosureHelper); + + var _LookupTable = __webpack_require__(7); + + var _LookupTable2 = _interopRequireDefault(_LookupTable); + + var _LookupTableManager = __webpack_require__(14); + + var _LookupTableManager2 = _interopRequireDefault(_LookupTableManager); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + CompositeClosureHelper: _CompositeClosureHelper2.default, + LookupTable: _LookupTable2.default, + LookupTableManager: _LookupTableManager2.default + }; + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(setImmediate) {'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.capitalize = capitalize; + // ---------------------------------------------------------------------------- + // capitilze provided string + // ---------------------------------------------------------------------------- + + function capitalize(str) { + return str.charAt(0).toUpperCase() + str.slice(1); + } + + // ---------------------------------------------------------------------------- + // Add isA function and register your class name + // ---------------------------------------------------------------------------- + + function isA(publicAPI) { + var model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + + if (!model.isA) { + model.isA = []; + } + + if (name) { + model.isA.push(name); + } + + if (!publicAPI.isA) { + publicAPI.isA = function (className) { + return model.isA.indexOf(className) !== -1; + }; + } + } + + // ---------------------------------------------------------------------------- + // Basic setter + // ---------------------------------------------------------------------------- + + function set(publicAPI) { + var model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var names = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + names.forEach(function (name) { + publicAPI['set' + capitalize(name)] = function (value) { + model[name] = value; + }; + }); + } + + // ---------------------------------------------------------------------------- + // Basic getter + // ---------------------------------------------------------------------------- + + function get(publicAPI) { + var model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var names = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + names.forEach(function (name) { + publicAPI['get' + capitalize(name)] = function () { + return model[name]; + }; + }); + } + + // ---------------------------------------------------------------------------- + // Add destroy function + // ---------------------------------------------------------------------------- + + function destroy(publicAPI) { + var model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var previousDestroy = publicAPI.destroy; + + if (!model.subscriptions) { + model.subscriptions = []; + } + + publicAPI.destroy = function () { + if (previousDestroy) { + previousDestroy(); + } + while (model.subscriptions && model.subscriptions.length) { + model.subscriptions.pop().unsubscribe(); + } + Object.keys(model).forEach(function (field) { + delete model[field]; + }); + + // Flag the instance beeing deleted + model.deleted = true; + }; + } + + // ---------------------------------------------------------------------------- + // Event handling: onXXX(callback), fireXXX(args...) + // ---------------------------------------------------------------------------- + + function event(publicAPI, model, eventName) { + var asynchrounous = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + + var callbacks = []; + var previousDestroy = publicAPI.destroy; + + function off(index) { + callbacks[index] = null; + } + + function on(index) { + function unsubscribe() { + off(index); + } + return Object.freeze({ unsubscribe: unsubscribe }); + } + + publicAPI['fire' + capitalize(eventName)] = function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (model.deleted) { + console.log('instance deleted - can not call any method'); + return; + } + + function processCallbacks() { + callbacks.forEach(function (callback) { + if (callback) { + try { + callback.apply(publicAPI, args); + } catch (errObj) { + console.log('Error event:', eventName, errObj); + } + } + }); + } + + if (asynchrounous) { + setImmediate(processCallbacks); + } else { + processCallbacks(); + } + }; + + publicAPI['on' + capitalize(eventName)] = function (callback) { + if (model.deleted) { + console.log('instance deleted - can not call any method'); + return null; + } + + var index = callbacks.length; + callbacks.push(callback); + return on(index); + }; + + publicAPI.destroy = function () { + previousDestroy(); + callbacks.forEach(function (el, index) { + return off(index); + }); + }; + } + + // ---------------------------------------------------------------------------- + // Fetch handling: setXXXFetchCallback / return { addRequest } + // ---------------------------------------------------------------------------- + function fetch(publicAPI, model, name) { + var fetchCallback = null; + var requestQueue = []; + + publicAPI['set' + capitalize(name) + 'FetchCallback'] = function (fetchMethod) { + if (requestQueue.length) { + fetchMethod(requestQueue); + } + fetchCallback = fetchMethod; + }; + + return { + addRequest: function addRequest(request) { + requestQueue.push(request); + if (fetchCallback) { + fetchCallback(requestQueue); + } + }, + resetRequests: function resetRequests(requestList) { + while (requestQueue.length) { + requestQueue.pop(); + } + if (requestList) { + // Rebuild request list + requestList.forEach(function (req) { + requestQueue.push(req); + }); + // Also trigger a request + if (fetchCallback) { + fetchCallback(requestQueue); + } + } + } + }; + } + + // ---------------------------------------------------------------------------- + // Dynamic array handler + // - add${xxx}(item) + // - remove${xxx}(item) + // - get${xxx}() => [items...] + // - removeAll${xxx}() + // ---------------------------------------------------------------------------- + + function dynamicArray(publicAPI, model, name) { + if (!model[name]) { + model[name] = []; + } + + publicAPI['set' + capitalize(name)] = function (items) { + model[name] = [].concat(items); + }; + + publicAPI['add' + capitalize(name)] = function (item) { + model[name].push(item); + }; + + publicAPI['remove' + capitalize(name)] = function (item) { + var index = model[name].indexOf(item); + model[name].splice(index, 1); + }; + + publicAPI['get' + capitalize(name)] = function () { + return model[name]; + }; + + publicAPI['removeAll' + capitalize(name)] = function () { + return model[name] = []; + }; + } + + // ---------------------------------------------------------------------------- + // Chain function calls + // ---------------------------------------------------------------------------- + + function chain() { + for (var _len2 = arguments.length, fn = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + fn[_key2] = arguments[_key2]; + } + + return function () { + for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + return fn.filter(function (i) { + return !!i; + }).forEach(function (i) { + return i.apply(undefined, args); + }); + }; + } + + // ---------------------------------------------------------------------------- + // Data Subscription + // => dataHandler = { + // // Set of default values you would expect in your metadata + // defaultMetadata: { + // numberOfBins: 32, + // }, + // + // // Method used internally to store the data + // set(model, data) { return !!sameAsBefore; }, // Return true if nothing has changed + // + // // Method used internally to extract the data from the cache based on a given subscription + // // This should return null/undefined if the data is not available (yet). + // get(model, request, dataChanged) {}, + // } + // ---------------------------------------------------------------------------- + // Methods generated with dataName = 'mutualInformation' + // => publicAPI + // - onMutualInformationSubscriptionChange(callback) => subscription[unsubscribe() + update(variables = [], metadata = {})] + // - fireMutualInformationSubscriptionChange(request) + // - subscribeToMutualInformation(onDataReady, variables = [], metadata = {}) + // - setMutualInformation(data) + // - destroy() + // ---------------------------------------------------------------------------- + + function dataSubscriber(publicAPI, model, dataName, dataHandler) { + // Private members + var dataSubscriptions = []; + var eventName = dataName + 'SubscriptionChange'; + var fireMethodName = 'fire' + capitalize(eventName); + var dataContainerName = dataName + '_storage'; + + // Add data container to model if not exist + if (!model[dataContainerName]) { + model[dataContainerName] = {}; + } + + // Add event handling methods + event(publicAPI, model, eventName); + + function off() { + var count = dataSubscriptions.length; + while (count) { + count -= 1; + dataSubscriptions[count] = null; + } + } + + // Internal function that will notify any subscriber with its data in a synchronous manner + function flushDataToListener(dataListener, dataChanged) { + try { + if (dataListener) { + var dataToForward = dataHandler.get(model[dataContainerName], dataListener.request, dataChanged); + if (dataToForward && JSON.stringify(dataToForward) !== dataListener.request.lastPush) { + dataListener.request.lastPush = JSON.stringify(dataToForward); + dataListener.onDataReady(dataToForward); + } + } + } catch (err) { + console.log('flush ' + dataName + ' error caught:', err); + } + } + + // onDataReady function will be called each time the setXXX method will be called and + // when the actual subscription correspond to the data that has been set. + // This is performed synchronously. + publicAPI['subscribeTo' + capitalize(dataName)] = function (onDataReady) { + var variables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var metadata = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + var id = dataSubscriptions.length; + var request = { + id: id, + variables: variables, + metadata: Object.assign({}, dataHandler.defaultMetadata, metadata) + }; + var dataListener = { onDataReady: onDataReady, request: request }; + dataSubscriptions.push(dataListener); + publicAPI[fireMethodName](request); + flushDataToListener(dataListener, null); + return { + unsubscribe: function unsubscribe() { + request.action = 'unsubscribe'; + publicAPI[fireMethodName](request); + dataSubscriptions[id] = null; + }, + update: function update(vars, meta) { + request.variables = [].concat(vars); + request.metadata = Object.assign({}, request.metadata, meta); + publicAPI[fireMethodName](request); + flushDataToListener(dataListener, null); + } + }; + }; + + // Method use to store data + publicAPI['set' + capitalize(dataName)] = function (data) { + // Process all subscription to see if we can trigger a notification + if (!dataHandler.set(model[dataContainerName], data)) { + dataSubscriptions.forEach(function (dataListener) { + return flushDataToListener(dataListener, data); + }); + } + }; + + publicAPI.destroy = chain(off, publicAPI.destroy); + } + + // ---------------------------------------------------------------------------- + // newInstance + // ---------------------------------------------------------------------------- + + function newInstance(extend) { + return function () { + var initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var model = {}; + var publicAPI = {}; + extend(publicAPI, model, initialValues); + return Object.freeze(publicAPI); + }; + } + + exports.default = { + chain: chain, + dataSubscriber: dataSubscriber, + destroy: destroy, + dynamicArray: dynamicArray, + event: event, + fetch: fetch, + get: get, + isA: isA, + newInstance: newInstance, + set: set + }; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).setImmediate)) + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(setImmediate, clearImmediate) {var nextTick = __webpack_require__(6).nextTick; + var apply = Function.prototype.apply; + var slice = Array.prototype.slice; + var immediateIds = {}; + var nextImmediateId = 0; + + // DOM APIs, for completeness + + exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); + }; + exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); + }; + exports.clearTimeout = + exports.clearInterval = function(timeout) { timeout.close(); }; + + function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; + } + Timeout.prototype.unref = Timeout.prototype.ref = function() {}; + Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); + }; + + // Does not start the time, just sets up the members needed. + exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; + }; + + exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; + }; + + exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } + }; + + // That's not how node.js implements it but the exposed api is the same. + exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + + immediateIds[id] = true; + + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); + + return id; + }; + + exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; + }; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).setImmediate, __webpack_require__(5).clearImmediate)) + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _monologue = __webpack_require__(8); + + var _monologue2 = _interopRequireDefault(_monologue); + + var _Presets = __webpack_require__(13); + + var _Presets2 = _interopRequireDefault(_Presets); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var CHANGE_TOPIC = 'LookupTable.change'; + + // Global helper methods ------------------------------------------------------ + + function applyRatio(a, b, ratio) { + return (b - a) * ratio + a; + } + + function interpolateColor(pointA, pointB, scalar) { + var ratio = (scalar - pointA[0]) / (pointB[0] - pointA[0]); + return [applyRatio(pointA[1], pointB[1], ratio), applyRatio(pointA[2], pointB[2], ratio), applyRatio(pointA[3], pointB[3], ratio), 255]; + } + + function extractPoint(controlPoints, idx) { + return [controlPoints[idx].x, controlPoints[idx].r, controlPoints[idx].g, controlPoints[idx].b]; + } + + function xrgbCompare(a, b) { + return a.x - b.x; + } + + // ---------------------------------------------------------------------------- + + var LookupTable = function () { + function LookupTable(name) { + var discrete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + _classCallCheck(this, LookupTable); + + this.name = name; + this.scalarRange = [0, 1]; + this.delta = 1; + this.controlPoints = null; + this.colorTableSize = 256; + this.colorTable = null; + this.colorNaN = [0, 0, 0, 0]; + this.setPreset('spectralflip'); + this.discrete = discrete; + this.scale = 1; + + // Auto rebuild + this.build(); + } + + _createClass(LookupTable, [{ + key: 'getName', + value: function getName() { + return this.name; + } + + /* eslint-disable class-methods-use-this */ + + }, { + key: 'getPresets', + value: function getPresets() { + return Object.keys(_Presets2.default.lookuptables); + } + }, { + key: 'setPreset', + value: function setPreset(name) { + this.colorTable = null; + this.controlPoints = []; + + var colors = _Presets2.default.lookuptables[name].controlpoints; + var count = colors.length; + + for (var i = 0; i < count; i++) { + this.controlPoints.push({ + x: colors[i].x, + r: colors[i].r, + g: colors[i].g, + b: colors[i].b + }); + } + + // Auto rebuild + this.build(); + + this.emit(CHANGE_TOPIC, { change: 'preset', lut: this }); + } + }, { + key: 'updateControlPoints', + value: function updateControlPoints(controlPoints) { + this.colorTable = null; + this.controlPoints = []; + + var count = controlPoints.length; + + for (var i = 0; i < count; i++) { + this.controlPoints.push({ + x: controlPoints[i].x, + r: controlPoints[i].r, + g: controlPoints[i].g, + b: controlPoints[i].b + }); + } + + // Auto rebuild + this.build(); + + this.emit(CHANGE_TOPIC, { change: 'controlPoints', lut: this }); + } + }, { + key: 'setColorForNaN', + value: function setColorForNaN() { + var r = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var g = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var b = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + this.colorNaN = [r, g, b, a]; + } + }, { + key: 'getColorForNaN', + value: function getColorForNaN() { + return this.colorNaN; + } + }, { + key: 'getScalarRange', + value: function getScalarRange() { + return [Number(this.scalarRange[0]), Number(this.scalarRange[1])]; + } + }, { + key: 'setScalarRange', + value: function setScalarRange(min, max) { + this.scalarRange = [min, max]; + this.delta = max - min; + + this.emit(CHANGE_TOPIC, { change: 'scalarRange', lut: this }); + } + }, { + key: 'build', + value: function build(trigger) { + var currentControlIdx = 0; + + if (this.colorTable) { + return; + } + + this.colorTable = []; + if (this.discrete) { + this.colorTableSize = this.controlPoints.length; + this.scale = 50; + for (var idx = 0; idx < this.colorTableSize; idx++) { + var color = this.controlPoints[idx]; + this.colorTable.push([color.r, color.g, color.b, 255]); + } + } else { + this.scale = 1; + for (var _idx = 0; _idx < this.colorTableSize; _idx++) { + var value = _idx / (this.colorTableSize - 1); + var pointA = extractPoint(this.controlPoints, currentControlIdx); + var pointB = extractPoint(this.controlPoints, currentControlIdx + 1); + + if (value > pointB[0]) { + currentControlIdx += 1; + pointA = extractPoint(this.controlPoints, currentControlIdx); + pointB = extractPoint(this.controlPoints, currentControlIdx + 1); + } + + this.colorTable.push(interpolateColor(pointA, pointB, value)); + } + } + + if (trigger) { + this.emit(CHANGE_TOPIC, { change: 'controlPoints', lut: this }); + } + } + }, { + key: 'setNumberOfColors', + value: function setNumberOfColors(nbColors) { + this.colorTableSize = nbColors; + this.colorTable = null; + + // Auto rebuild + this.build(); + + this.emit(CHANGE_TOPIC, { change: 'numberOfColors', lut: this }); + } + }, { + key: 'getNumberOfControlPoints', + value: function getNumberOfControlPoints() { + return this.controlPoints ? this.controlPoints.length : 0; + } + }, { + key: 'removeControlPoint', + value: function removeControlPoint(idx) { + if (idx > 0 && idx < this.controlPoints.length - 1) { + this.controlPoints.splice(idx, 1); + + // Auto rebuild and trigger change + this.colorTable = null; + this.build(true); + + return true; + } + return false; + } + }, { + key: 'getControlPoint', + value: function getControlPoint(idx) { + return this.controlPoints[idx]; + } + }, { + key: 'updateControlPoint', + value: function updateControlPoint(idx, xrgb) { + this.controlPoints[idx] = xrgb; + var xValue = xrgb.x; + + // Ensure order + this.controlPoints.sort(xrgbCompare); + + // Auto rebuild and trigger change + this.colorTable = null; + this.build(true); + + // Return the modified index of current control point + for (var i = 0; i < this.controlPoints.length; i++) { + if (this.controlPoints[i].x === xValue) { + return i; + } + } + return 0; + } + }, { + key: 'addControlPoint', + value: function addControlPoint(xrgb) { + this.controlPoints.push(xrgb); + var xValue = xrgb.x; + + // Ensure order + this.controlPoints.sort(xrgbCompare); + + // Auto rebuild and trigger change + this.colorTable = null; + this.build(true); + + // Return the modified index of current control point + for (var i = 0; i < this.controlPoints.length; i++) { + if (this.controlPoints[i].x === xValue) { + return i; + } + } + return -1; + } + }, { + key: 'drawToCanvas', + value: function drawToCanvas(canvas) { + var colors = this.colorTable; + var length = this.scale * colors.length; + var ctx = canvas.getContext('2d'); + var canvasData = ctx.getImageData(0, 0, length, 1); + + for (var i = 0; i < length; i++) { + var colorIdx = Math.floor(i / this.scale); + canvasData.data[i * 4 + 0] = Math.floor(255 * colors[colorIdx][0]); + canvasData.data[i * 4 + 1] = Math.floor(255 * colors[colorIdx][1]); + canvasData.data[i * 4 + 2] = Math.floor(255 * colors[colorIdx][2]); + canvasData.data[i * 4 + 3] = 255; + } + ctx.putImageData(canvasData, 0, 0); + } + }, { + key: 'getColor', + value: function getColor(scalar) { + if (isNaN(scalar)) { + return this.colorNaN; + } + var idxValue = Math.floor(this.colorTableSize * (scalar - this.scalarRange[0]) / this.delta); + if (idxValue < 0) { + return this.colorTable[0]; + } + if (idxValue >= this.colorTableSize) { + return this.colorTable[this.colorTable.length - 1]; + } + return this.colorTable[idxValue]; + } + }, { + key: 'destroy', + value: function destroy() { + this.off(); + } + }, { + key: 'onChange', + value: function onChange(callback) { + return this.on(CHANGE_TOPIC, callback); + } + }]); + + return LookupTable; + }(); + + // Add Observer pattern using Monologue.js + + + exports.default = LookupTable; + _monologue2.default.mixInto(LookupTable); + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** + * monologue.js - EventEmitter replacement with AMQP-style bindings and other advanced features. Compatible with postal.js's API. + * Author: Jim Cowart (http://ifandelse.com) + * Version: v0.3.5 + * Url: https://github.com/postaljs/monologue.js + * License(s): MIT, GPL + */ + + ( function( root, factory ) { + /* istanbul ignore if */ + if ( true ) { + // AMD. Register as an anonymous module. + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(9), __webpack_require__(11) ], __WEBPACK_AMD_DEFINE_RESULT__ = function( _, riveter ) { + return factory( _, riveter, root ); + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + /* istanbul ignore else */ + } else if ( typeof module === "object" && module.exports ) { + // Node, or CommonJS-Like environments + module.exports = factory( require( "lodash" ), require( "riveter" ) ); + } else { + // Browser globals + root.Monologue = factory( root._, root.riveter, root ); + } + }( this, function( _, riveter, global, undefined ) { + + var keyDelimiter = "|"; + var bindingsResolver = { + cache: {}, + regex: {}, + + compare: function compare( binding, topic ) { + var pattern; + var rgx; + var prevSegment; + var result = ( this.cache[ topic + keyDelimiter + binding ] ); + // result is cached? + if ( result === true ) { + return result; + } + // plain string matching? + if ( binding.indexOf( "#" ) === -1 && binding.indexOf( "*" ) === -1 ) { + result = this.cache[ topic + keyDelimiter + binding ] = ( topic === binding ); + return result; + } + // ah, regex matching, then + if ( !( rgx = this.regex[ binding ] ) ) { + pattern = "^" + _.map( binding.split( "." ), function mapTopicBinding( segment ) { + var res = ""; + if ( !!prevSegment ) { + res = prevSegment !== "#" ? "\\.\\b" : "\\b"; + } + if ( segment === "#" ) { + res += "[\\s\\S]*"; + } else if ( segment === "*" ) { + res += "[^.]+"; + } else { + res += segment; + } + prevSegment = segment; + return res; + } ).join( "" ) + "$"; + rgx = this.regex[ binding ] = new RegExp( pattern ); + } + result = this.cache[ topic + keyDelimiter + binding ] = rgx.test( topic ); + return result; + }, + + reset: function reset() { + this.cache = {}; + this.regex = {}; + }, + + purge: function( options ) { + var self = this; + var matchPredicate = function( val, key ) { + var split = key.split( keyDelimiter ); + var topic = split[ 0 ]; + var binding = split[ 1 ]; + if ( ( typeof options.topic === "undefined" || options.topic === topic ) && + ( typeof options.binding === "undefined" || options.binding === binding ) ) { + delete self.cache[ key ]; + } + }; + + if ( typeof options === "undefined" ) { + this.reset(); + } else { + _.each( this.cache, matchPredicate ); + } + } + }; + + var SubscriptionDefinition = function( topic, callback, emitter ) { + this.topic = topic; + this.callback = callback; + this.pipeline = []; + this.cacheKeys = []; + this._context = undefined; + this.emitter = emitter; + }; + + var ConsecutiveDistinctPredicate = function() { + var previous; + return function( data ) { + var eq = false; + if ( _.isString( data ) ) { + eq = data === previous; + previous = data; + } else { + eq = _.isEqual( data, previous ); + previous = _.clone( data ); + } + return !eq; + }; + }; + + var DistinctPredicate = function DistinctPredicateFactory() { + var previous = []; + return function DistinctPredicate( data ) { + var isDistinct = !_.any( previous, function( p ) { + if ( _.isObject( data ) || _.isArray( data ) ) { + return _.isEqual( data, p ); + } + return data === p; + } ); + if ( isDistinct ) { + previous.push( data ); + } + return isDistinct; + }; + }; + + SubscriptionDefinition.prototype = { + + "catch": function( errorHandler ) { + var original = this.callback; + var safeCallback = function() { + try { + original.apply( this, arguments ); + } catch ( err ) { + errorHandler( err, arguments[ 0 ] ); + } + }; + this.callback = safeCallback; + return this; + }, + + defer: function defer() { + return this.delay( 0 ); + }, + + disposeAfter: function disposeAfter( maxCalls ) { + if ( !_.isNumber( maxCalls ) || maxCalls <= 0 ) { + throw new Error( "The value provided to disposeAfter (maxCalls) must be a number greater than zero." ); + } + + var dispose = _.after( maxCalls, this.unsubscribe.bind( this ) ); + this.pipeline.push( function( data, env, next ) { + next( data, env ); + dispose(); + } ); + return this; + }, + + distinct: function distinct() { + return this.constraint( new DistinctPredicate() ); + }, + + distinctUntilChanged: function distinctUntilChanged() { + return this.constraint( new ConsecutiveDistinctPredicate() ); + }, + + invokeSubscriber: function invokeSubscriber( data, env ) { + if ( !this.inactive ) { + var self = this; + var pipeline = self.pipeline; + var len = pipeline.length; + var context = self._context; + var idx = -1; + if ( !len ) { + self.callback.call( context, data, env ); + } else { + pipeline = pipeline.concat( [ self.callback ] ); + var step = function step( d, e ) { + idx += 1; + if ( idx < len ) { + pipeline[ idx ].call( context, d, e, step ); + } else { + self.callback.call( context, d, e ); + } + }; + step( data, env, 0 ); + } + } + }, + + logError: function logError() { + /* istanbul ignore else */ + if ( console ) { + var report; + if ( console.warn ) { + report = console.warn; + } else { + report = console.log; + } + this.catch( report ); + } + return this; + }, + + once: function once() { + return this.disposeAfter( 1 ); + }, + + unsubscribe: function() { + /* istanbul ignore else */ + if ( !this.inactive ) { + this.emitter.off( this ); + } + }, + + constraint: function constraint( predicate ) { + if ( !_.isFunction( predicate ) ) { + throw new Error( "Predicate constraint must be a function" ); + } + this.pipeline.push( function( data, env, next ) { + if ( predicate.call( this, data, env ) ) { + next( data, env ); + } + } ); + return this; + }, + + constraints: function constraints( predicates ) { + var self = this; + /* istanbul ignore else */ + if ( _.isArray( predicates ) ) { + _.each( predicates, function( predicate ) { + self.constraint( predicate ); + } ); + } + return self; + }, + + context: function contextSetter( context ) { + this._context = context; + return this; + }, + + debounce: function debounce( milliseconds, immediate ) { + if ( !_.isNumber( milliseconds ) ) { + throw new Error( "Milliseconds must be a number" ); + } + this.pipeline.push( + _.debounce( function( data, env, next ) { + next( data, env ); + }, + milliseconds, + !!immediate + ) + ); + return this; + }, + + delay: function delay( milliseconds ) { + if ( !_.isNumber( milliseconds ) ) { + throw new Error( "Milliseconds must be a number" ); + } + var self = this; + self.pipeline.push( function( data, env, next ) { + setTimeout( function() { + next( data, env ); + }, milliseconds ); + } ); + return this; + }, + + throttle: function throttle( milliseconds ) { + if ( !_.isNumber( milliseconds ) ) { + throw new Error( "Milliseconds must be a number" ); + } + var fn = function( data, env, next ) { + next( data, env ); + }; + this.pipeline.push( _.throttle( fn, milliseconds ) ); + return this; + } + }; + + SubscriptionDefinition.prototype.off = SubscriptionDefinition.prototype.unsubscribe; + // Backwards Compatibility + // WARNING: these will be removed after the next version + /* istanbul ignore next */ + function warnOnDeprecation( oldMethod, newMethod ) { + return function() { + if ( console.warn || console.log ) { + var msg = "Warning, the " + oldMethod + " method has been deprecated. Please use " + newMethod + " instead."; + if ( console.warn ) { + console.warn( msg ); + } else { + console.log( msg ); + } + } + return SubscriptionDefinition.prototype[ newMethod ].apply( this, arguments ); + }; + } + var oldMethods = [ "withConstraint", "withConstraints", "withContext", "withDebounce", "withDelay", "withThrottle" ]; + var newMethods = [ "constraint", "constraints", "context", "debounce", "delay", "throttle" ]; + for ( var i = 0; i < 6; i++ ) { + var oldMethod = oldMethods[ i ]; + SubscriptionDefinition.prototype[ oldMethod ] = warnOnDeprecation( oldMethod, newMethods[ i ] ); + } + + + var slice = Array.prototype.slice; + var Monologue = function() {}; + + function getCacher( topic, cache, done ) { + return function( subDef ) { + if ( Monologue.resolver.compare( subDef.topic, topic ) ) { + cache.push( subDef ); + subDef.cacheKeys.push( topic ); + if ( done ) { + done( subDef ); + } + } + }; + } + + function getCachePurger( subDef, topic, cache ) { + return function( sub, i, list ) { + if ( sub === subDef ) { + list.splice( i, 1 ); + } + if ( list.length === 0 ) { + delete cache[ topic ]; + } + }; + } + + function removeSubscriber( subDef, emitter, idx, list ) { + subDef.inactive = true; + list.splice( idx, 1 ); + // remove SubscriptionDefinition from cache + if ( subDef.cacheKeys && subDef.cacheKeys.length ) { + var key; + while ( key = subDef.cacheKeys.pop() ) { + _.each( emitter._cache[ key ], getCachePurger( subDef, key, emitter._cache ) ); + } + } + } + + Monologue.prototype = { + on: function( topic, callback ) { + var self = this; + self._subscriptions = self._subscriptions || {}; + self._subscriptions[ topic ] = self._subscriptions[ topic ] || []; + var subDef = new SubscriptionDefinition( topic, callback, self ); + self._subscriptions[ topic ].push( subDef ); + + // Next, add the SubscriptionDefinition to any relevant existing cache(s) + _.each( self._cache, function( list, key ) { + getCacher( key, list )( subDef ); + } ); + + return self._subscriptions[ topic ][ self._subscriptions[ topic ].length - 1 ]; + }, + + once: function( topic, callback ) { + return this.on( topic, callback ).once(); + }, + + off: function( topic, context ) { + var self = this; + self._subscriptions = self._subscriptions || {}; + self._cache = self._cache || {}; + switch ( arguments.length ) { + case 0: + _.each( self._subscriptions, function( tpc ) { + _.each( tpc, function( subDef, idx ) { + removeSubscriber( subDef, self, idx, tpc ); + } ); + } ); + self._subscriptions = {}; + break; + case 1: + var type = Object.prototype.toString.call( topic ) === "[object String]" ? "topic" : topic instanceof SubscriptionDefinition ? "def" : "context"; + switch ( type ) { + case "topic": + if ( self._subscriptions[ topic ] ) { + _.each( self._subscriptions[ topic ], function( subDef, idx ) { + removeSubscriber( subDef, self, idx, self._subscriptions[ topic ] ); + } ); + } + break; + case "context": + _.each( self._subscriptions, function( subs ) { + _.each( _.clone( subs ), function( subDef, idx ) { + if ( subDef._context === topic ) { + removeSubscriber( subDef, self, idx, subs ); + } + } ); + } ); + break; + default: + // topic arg is the subDef in this case.... + _.each( self._subscriptions[ topic.topic ], function( subDef, idx ) { + if ( subDef === topic ) { + removeSubscriber( subDef, self, idx, self._subscriptions[ topic.topic ] ); + } + } ); + break; + } + break; + default: + _.each( _.clone( self._subscriptions[ topic ] ), function( subDef, idx ) { + if ( subDef._context === context ) { + removeSubscriber( subDef, self, idx, self._subscriptions[ topic ] ); + } + } ); + break; + } + }, + + emit: function( topic, data ) { + var envelope = this.getEnvelope( topic, data ); + this._cache = this._cache || {}; + var cache = this._cache[ topic ]; + var invoker = function( subDef ) { + subDef.invokeSubscriber( envelope.data, envelope ); + }; + if ( !cache ) { + cache = this._cache[ topic ] = []; + var cacherFn = getCacher( topic, cache, invoker ); + _.each( this._subscriptions, function( candidates ) { + _.each( slice.call( candidates, 0 ), cacherFn ); + } ); + } else { + _.each( slice.call( cache, 0 ), invoker ); + } + }, + + getEnvelope: function( topic, data ) { + return { + topic: topic, + timeStamp: new Date(), + data: data + }; + } + }; + + Monologue.resolver = bindingsResolver; + Monologue.debug = false; + Monologue.SubscriptionDefinition = SubscriptionDefinition; + riveter( Monologue ); + Monologue.mixInto = function( target ) { + riveter.punch( target, Monologue.prototype ); + }; + + return Monologue; + } ) ); + + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/** + * @license + * lodash 3.10.1 (Custom Build) + * Build: `lodash modern -d -o ./index.js` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + ;(function() { + + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined; + + /** Used as the semantic version number. */ + var VERSION = '3.10.1'; + + /** Used to compose bitmasks for wrapper metadata. */ + var BIND_FLAG = 1, + BIND_KEY_FLAG = 2, + CURRY_BOUND_FLAG = 4, + CURRY_FLAG = 8, + CURRY_RIGHT_FLAG = 16, + PARTIAL_FLAG = 32, + PARTIAL_RIGHT_FLAG = 64, + ARY_FLAG = 128, + REARG_FLAG = 256; + + /** Used as default options for `_.trunc`. */ + var DEFAULT_TRUNC_LENGTH = 30, + DEFAULT_TRUNC_OMISSION = '...'; + + /** Used to detect when a function becomes hot. */ + var HOT_COUNT = 150, + HOT_SPAN = 16; + + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + + /** Used to indicate the type of lazy iteratees. */ + var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2; + + /** Used as the `TypeError` message for "Functions" methods. */ + var FUNC_ERROR_TEXT = 'Expected a function'; + + /** Used as the internal argument placeholder. */ + var PLACEHOLDER = '__lodash_placeholder__'; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + + var arrayBufferTag = '[object ArrayBuffer]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + + /** Used to match empty string literals in compiled template source. */ + var reEmptyStringLeading = /\b__p \+= '';/g, + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + + /** Used to match HTML entities and HTML characters. */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g, + reUnescapedHtml = /[&<>"'`]/g, + reHasEscapedHtml = RegExp(reEscapedHtml.source), + reHasUnescapedHtml = RegExp(reUnescapedHtml.source); + + /** Used to match template delimiters. */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; + + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; + + /** + * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns) + * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern). + */ + var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g, + reHasRegExpChars = RegExp(reRegExpChars.source); + + /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */ + var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ + var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; + + /** Used to detect hexadecimal string values. */ + var reHasHexPrefix = /^0[xX]/; + + /** Used to detect host constructors (Safari > 5). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^\d+$/; + + /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ + var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; + + /** Used to ensure capturing order of template delimiters. */ + var reNoMatch = /($^)/; + + /** Used to match unescaped characters in compiled string literals. */ + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; + + /** Used to match words to create compound words. */ + var reWords = (function() { + var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]', + lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+'; + + return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g'); + }()); + + /** Used to assign default `context` object properties. */ + var contextProps = [ + 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array', + 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number', + 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite', + 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', + 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap' + ]; + + /** Used to make template sourceURLs easier to identify. */ + var templateCounter = -1; + + /** Used to identify `toStringTag` values of typed arrays. */ + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dateTag] = typedArrayTags[errorTag] = + typedArrayTags[funcTag] = typedArrayTags[mapTag] = + typedArrayTags[numberTag] = typedArrayTags[objectTag] = + typedArrayTags[regexpTag] = typedArrayTags[setTag] = + typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + + /** Used to identify `toStringTag` values supported by `_.clone`. */ + var cloneableTags = {}; + cloneableTags[argsTag] = cloneableTags[arrayTag] = + cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = + cloneableTags[dateTag] = cloneableTags[float32Tag] = + cloneableTags[float64Tag] = cloneableTags[int8Tag] = + cloneableTags[int16Tag] = cloneableTags[int32Tag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[stringTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = cloneableTags[funcTag] = + cloneableTags[mapTag] = cloneableTags[setTag] = + cloneableTags[weakMapTag] = false; + + /** Used to map latin-1 supplementary letters to basic latin letters. */ + var deburredLetters = { + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss' + }; + + /** Used to map characters to HTML entities. */ + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`' + }; + + /** Used to map HTML entities to characters. */ + var htmlUnescapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'", + '`': '`' + }; + + /** Used to determine if values are of the language type `Object`. */ + var objectTypes = { + 'function': true, + 'object': true + }; + + /** Used to escape characters for inclusion in compiled regexes. */ + var regexpEscapes = { + '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34', + '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39', + 'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46', + 'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66', + 'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78' + }; + + /** Used to escape characters for inclusion in compiled string literals. */ + var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + /** Detect free variable `exports`. */ + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global; + + /** Detect free variable `self`. */ + var freeSelf = objectTypes[typeof self] && self && self.Object && self; + + /** Detect free variable `window`. */ + var freeWindow = objectTypes[typeof window] && window && window.Object && window; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; + + /** + * Used as a reference to the global object. + * + * The `this` value is used if it's the global object to avoid Greasemonkey's + * restricted `window` object, otherwise the `window` object is used. + */ + var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this; + + /*--------------------------------------------------------------------------*/ + + /** + * The base implementation of `compareAscending` which compares values and + * sorts them in ascending order without guaranteeing a stable sort. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ + function baseCompareAscending(value, other) { + if (value !== other) { + var valIsNull = value === null, + valIsUndef = value === undefined, + valIsReflexive = value === value; + + var othIsNull = other === null, + othIsUndef = other === undefined, + othIsReflexive = other === other; + + if ((value > other && !othIsNull) || !valIsReflexive || + (valIsNull && !othIsUndef && othIsReflexive) || + (valIsUndef && othIsReflexive)) { + return 1; + } + if ((value < other && !valIsNull) || !othIsReflexive || + (othIsNull && !valIsUndef && valIsReflexive) || + (othIsUndef && valIsReflexive)) { + return -1; + } + } + return 0; + } + + /** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseFindIndex(array, predicate, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.indexOf` without support for binary searches. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return indexOfNaN(array, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.isFunction` without support for environments + * with incorrect `typeof` results. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + */ + function baseIsFunction(value) { + // Avoid a Chakra JIT bug in compatibility modes of IE 11. + // See https://github.com/jashkenas/underscore/issues/1621 for more details. + return typeof value == 'function' || false; + } + + /** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + return value == null ? '' : (value + ''); + } + + /** + * Used by `_.trim` and `_.trimLeft` to get the index of the first character + * of `string` that is not found in `chars`. + * + * @private + * @param {string} string The string to inspect. + * @param {string} chars The characters to find. + * @returns {number} Returns the index of the first character not found in `chars`. + */ + function charsLeftIndex(string, chars) { + var index = -1, + length = string.length; + + while (++index < length && chars.indexOf(string.charAt(index)) > -1) {} + return index; + } + + /** + * Used by `_.trim` and `_.trimRight` to get the index of the last character + * of `string` that is not found in `chars`. + * + * @private + * @param {string} string The string to inspect. + * @param {string} chars The characters to find. + * @returns {number} Returns the index of the last character not found in `chars`. + */ + function charsRightIndex(string, chars) { + var index = string.length; + + while (index-- && chars.indexOf(string.charAt(index)) > -1) {} + return index; + } + + /** + * Used by `_.sortBy` to compare transformed elements of a collection and stable + * sort them in ascending order. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareAscending(object, other) { + return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index); + } + + /** + * Used by `_.sortByOrder` to compare multiple properties of a value to another + * and stable sort them. + * + * If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise, + * a value is sorted in ascending order if its corresponding order is "asc", and + * descending if "desc". + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {boolean[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = baseCompareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + var order = orders[index]; + return result * ((order === 'asc' || order === true) ? 1 : -1); + } + } + // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. + // + // This also ensures a stable sort in V8 and other engines. + // See https://code.google.com/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; + } + + /** + * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ + function deburrLetter(letter) { + return deburredLetters[letter]; + } + + /** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + function escapeHtmlChar(chr) { + return htmlEscapes[chr]; + } + + /** + * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes. + * + * @private + * @param {string} chr The matched character to escape. + * @param {string} leadingChar The capture group for a leading character. + * @param {string} whitespaceChar The capture group for a whitespace character. + * @returns {string} Returns the escaped character. + */ + function escapeRegExpChar(chr, leadingChar, whitespaceChar) { + if (leadingChar) { + chr = regexpEscapes[chr]; + } else if (whitespaceChar) { + chr = stringEscapes[chr]; + } + return '\\' + chr; + } + + /** + * Used by `_.template` to escape characters for inclusion in compiled string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; + } + + /** + * Gets the index at which the first occurrence of `NaN` is found in `array`. + * + * @private + * @param {Array} array The array to search. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched `NaN`, else `-1`. + */ + function indexOfNaN(array, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 0 : -1); + + while ((fromRight ? index-- : ++index < length)) { + var other = array[index]; + if (other !== other) { + return index; + } + } + return -1; + } + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + /** + * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a + * character code is whitespace. + * + * @private + * @param {number} charCode The character code to inspect. + * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`. + */ + function isSpace(charCode) { + return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 || + (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279))); + } + + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = -1, + result = []; + + while (++index < length) { + if (array[index] === placeholder) { + array[index] = PLACEHOLDER; + result[++resIndex] = index; + } + } + return result; + } + + /** + * An implementation of `_.uniq` optimized for sorted arrays without support + * for callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The function invoked per iteration. + * @returns {Array} Returns the new duplicate-value-free array. + */ + function sortedUniq(array, iteratee) { + var seen, + index = -1, + length = array.length, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value, index, array) : value; + + if (!index || seen !== computed) { + seen = computed; + result[++resIndex] = value; + } + } + return result; + } + + /** + * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the first non-whitespace character. + */ + function trimmedLeftIndex(string) { + var index = -1, + length = string.length; + + while (++index < length && isSpace(string.charCodeAt(index))) {} + return index; + } + + /** + * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ + function trimmedRightIndex(string) { + var index = string.length; + + while (index-- && isSpace(string.charCodeAt(index))) {} + return index; + } + + /** + * Used by `_.unescape` to convert HTML entities to characters. + * + * @private + * @param {string} chr The matched character to unescape. + * @returns {string} Returns the unescaped character. + */ + function unescapeHtmlChar(chr) { + return htmlUnescapes[chr]; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Create a new pristine `lodash` function using the given `context` object. + * + * @static + * @memberOf _ + * @category Utility + * @param {Object} [context=root] The context object. + * @returns {Function} Returns a new `lodash` function. + * @example + * + * _.mixin({ 'foo': _.constant('foo') }); + * + * var lodash = _.runInContext(); + * lodash.mixin({ 'bar': lodash.constant('bar') }); + * + * _.isFunction(_.foo); + * // => true + * _.isFunction(_.bar); + * // => false + * + * lodash.isFunction(lodash.foo); + * // => false + * lodash.isFunction(lodash.bar); + * // => true + * + * // using `context` to mock `Date#getTime` use in `_.now` + * var mock = _.runInContext({ + * 'Date': function() { + * return { 'getTime': getTimeMock }; + * } + * }); + * + * // or creating a suped-up `defer` in Node.js + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; + */ + function runInContext(context) { + // Avoid issues with some ES3 environments that attempt to use values, named + // after built-in constructors like `Object`, for the creation of literals. + // ES5 clears this up by stating that literals must use built-in constructors. + // See https://es5.github.io/#x11.1.5 for more details. + context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; + + /** Native constructor references. */ + var Array = context.Array, + Date = context.Date, + Error = context.Error, + Function = context.Function, + Math = context.Math, + Number = context.Number, + Object = context.Object, + RegExp = context.RegExp, + String = context.String, + TypeError = context.TypeError; + + /** Used for native method references. */ + var arrayProto = Array.prototype, + objectProto = Object.prototype, + stringProto = String.prototype; + + /** Used to resolve the decompiled source of functions. */ + var fnToString = Function.prototype.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to generate unique IDs. */ + var idCounter = 0; + + /** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** Used to restore the original `_` reference in `_.noConflict`. */ + var oldDash = root._; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** Native method references. */ + var ArrayBuffer = context.ArrayBuffer, + clearTimeout = context.clearTimeout, + parseFloat = context.parseFloat, + pow = Math.pow, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + Set = getNative(context, 'Set'), + setTimeout = context.setTimeout, + splice = arrayProto.splice, + Uint8Array = context.Uint8Array, + WeakMap = getNative(context, 'WeakMap'); + + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeCeil = Math.ceil, + nativeCreate = getNative(Object, 'create'), + nativeFloor = Math.floor, + nativeIsArray = getNative(Array, 'isArray'), + nativeIsFinite = context.isFinite, + nativeKeys = getNative(Object, 'keys'), + nativeMax = Math.max, + nativeMin = Math.min, + nativeNow = getNative(Date, 'now'), + nativeParseInt = context.parseInt, + nativeRandom = Math.random; + + /** Used as references for `-Infinity` and `Infinity`. */ + var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY, + POSITIVE_INFINITY = Number.POSITIVE_INFINITY; + + /** Used as references for the maximum length and index of an array. */ + var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + + /** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** Used to store function metadata. */ + var metaMap = WeakMap && new WeakMap; + + /** Used to lookup unminified function names. */ + var realNames = {}; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object which wraps `value` to enable implicit chaining. + * Methods that operate on and return arrays, collections, and functions can + * be chained together. Methods that retrieve a single value or may return a + * primitive value will automatically end the chain returning the unwrapped + * value. Explicit chaining may be enabled using `_.chain`. The execution of + * chained methods is lazy, that is, execution is deferred until `_#value` + * is implicitly or explicitly called. + * + * Lazy evaluation allows several methods to support shortcut fusion. Shortcut + * fusion is an optimization strategy which merge iteratee calls; this can help + * to avoid the creation of intermediate data structures and greatly reduce the + * number of iteratee executions. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, + * `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, + * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, + * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, + * and `where` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`, + * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`, + * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`, + * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`, + * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, + * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, + * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, + * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, + * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`, + * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, + * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`, + * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, + * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`, + * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, + * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`, + * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`, + * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, + * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, + * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`, + * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, + * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`, + * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, + * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, + * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`, + * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`, + * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, + * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, + * `unescape`, `uniqueId`, `value`, and `words` + * + * The wrapper method `sample` will return a wrapped value when `n` is provided, + * otherwise an unwrapped value is returned. + * + * @name _ + * @constructor + * @category Chain + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var wrapped = _([1, 2, 3]); + * + * // returns an unwrapped value + * wrapped.reduce(function(total, n) { + * return total + n; + * }); + * // => 6 + * + * // returns a wrapped value + * var squares = wrapped.map(function(n) { + * return n * n; + * }); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); + } + + /** + * The function whose prototype all chaining wrappers inherit from. + * + * @private + */ + function baseLodash() { + // No operation performed. + } + + /** + * The base constructor for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable chaining for all wrapper methods. + * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value. + */ + function LodashWrapper(value, chainAll, actions) { + this.__wrapped__ = value; + this.__actions__ = actions || []; + this.__chain__ = !!chainAll; + } + + /** + * An object environment feature flags. + * + * @static + * @memberOf _ + * @type Object + */ + var support = lodash.support = {}; + + /** + * By default, the template delimiters used by lodash are like those in + * embedded Ruby (ERB). Change the following template settings to use + * alternative delimiters. + * + * @static + * @memberOf _ + * @type Object + */ + lodash.templateSettings = { + + /** + * Used to detect `data` property values to be HTML-escaped. + * + * @memberOf _.templateSettings + * @type RegExp + */ + 'escape': reEscape, + + /** + * Used to detect code to be evaluated. + * + * @memberOf _.templateSettings + * @type RegExp + */ + 'evaluate': reEvaluate, + + /** + * Used to detect `data` property values to inject. + * + * @memberOf _.templateSettings + * @type RegExp + */ + 'interpolate': reInterpolate, + + /** + * Used to reference the data object in the template text. + * + * @memberOf _.templateSettings + * @type string + */ + 'variable': '', + + /** + * Used to import variables into the compiled template. + * + * @memberOf _.templateSettings + * @type Object + */ + 'imports': { + + /** + * A reference to the `lodash` function. + * + * @memberOf _.templateSettings.imports + * @type Function + */ + '_': lodash + } + }; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. + * + * @private + * @param {*} value The value to wrap. + */ + function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__dir__ = 1; + this.__filtered__ = false; + this.__iteratees__ = []; + this.__takeCount__ = POSITIVE_INFINITY; + this.__views__ = []; + } + + /** + * Creates a clone of the lazy wrapper object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ + function lazyClone() { + var result = new LazyWrapper(this.__wrapped__); + result.__actions__ = arrayCopy(this.__actions__); + result.__dir__ = this.__dir__; + result.__filtered__ = this.__filtered__; + result.__iteratees__ = arrayCopy(this.__iteratees__); + result.__takeCount__ = this.__takeCount__; + result.__views__ = arrayCopy(this.__views__); + return result; + } + + /** + * Reverses the direction of lazy iteration. + * + * @private + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. + */ + function lazyReverse() { + if (this.__filtered__) { + var result = new LazyWrapper(this); + result.__dir__ = -1; + result.__filtered__ = true; + } else { + result = this.clone(); + result.__dir__ *= -1; + } + return result; + } + + /** + * Extracts the unwrapped value from its lazy wrapper. + * + * @private + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. + */ + function lazyValue() { + var array = this.__wrapped__.value(), + dir = this.__dir__, + isArr = isArray(array), + isRight = dir < 0, + arrLength = isArr ? array.length : 0, + view = getView(0, arrLength, this.__views__), + start = view.start, + end = view.end, + length = end - start, + index = isRight ? end : (start - 1), + iteratees = this.__iteratees__, + iterLength = iteratees.length, + resIndex = 0, + takeCount = nativeMin(length, this.__takeCount__); + + if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) { + return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__); + } + var result = []; + + outer: + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + result[resIndex++] = value; + } + return result; + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates a cache object to store key/value pairs. + * + * @private + * @static + * @name Cache + * @memberOf _.memoize + */ + function MapCache() { + this.__data__ = {}; + } + + /** + * Removes `key` and its value from the cache. + * + * @private + * @name delete + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`. + */ + function mapDelete(key) { + return this.has(key) && delete this.__data__[key]; + } + + /** + * Gets the cached value for `key`. + * + * @private + * @name get + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to get. + * @returns {*} Returns the cached value. + */ + function mapGet(key) { + return key == '__proto__' ? undefined : this.__data__[key]; + } + + /** + * Checks if a cached value for `key` exists. + * + * @private + * @name has + * @memberOf _.memoize.Cache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function mapHas(key) { + return key != '__proto__' && hasOwnProperty.call(this.__data__, key); + } + + /** + * Sets `value` to `key` of the cache. + * + * @private + * @name set + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to cache. + * @param {*} value The value to cache. + * @returns {Object} Returns the cache object. + */ + function mapSet(key, value) { + if (key != '__proto__') { + this.__data__[key] = value; + } + return this; + } + + /*------------------------------------------------------------------------*/ + + /** + * + * Creates a cache object to store unique values. + * + * @private + * @param {Array} [values] The values to cache. + */ + function SetCache(values) { + var length = values ? values.length : 0; + + this.data = { 'hash': nativeCreate(null), 'set': new Set }; + while (length--) { + this.push(values[length]); + } + } + + /** + * Checks if `value` is in `cache` mimicking the return signature of + * `_.indexOf` by returning `0` if the value is found, else `-1`. + * + * @private + * @param {Object} cache The cache to search. + * @param {*} value The value to search for. + * @returns {number} Returns `0` if `value` is found, else `-1`. + */ + function cacheIndexOf(cache, value) { + var data = cache.data, + result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value]; + + return result ? 0 : -1; + } + + /** + * Adds `value` to the cache. + * + * @private + * @name push + * @memberOf SetCache + * @param {*} value The value to cache. + */ + function cachePush(value) { + var data = this.data; + if (typeof value == 'string' || isObject(value)) { + data.set.add(value); + } else { + data.hash[value] = true; + } + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates a new array joining `array` with `other`. + * + * @private + * @param {Array} array The array to join. + * @param {Array} other The other array to join. + * @returns {Array} Returns the new concatenated array. + */ + function arrayConcat(array, other) { + var index = -1, + length = array.length, + othIndex = -1, + othLength = other.length, + result = Array(length + othLength); + + while (++index < length) { + result[index] = array[index]; + } + while (++othIndex < othLength) { + result[index++] = other[othIndex]; + } + return result; + } + + /** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ + function arrayCopy(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; + } + + /** + * A specialized version of `_.forEach` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.forEachRight` for arrays without support for + * callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEachRight(array, iteratee) { + var length = array.length; + + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.every` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + */ + function arrayEvery(array, predicate) { + var index = -1, + length = array.length; + + while (++index < length) { + if (!predicate(array[index], index, array)) { + return false; + } + } + return true; + } + + /** + * A specialized version of `baseExtremum` for arrays which invokes `iteratee` + * with one argument: (value). + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} comparator The function used to compare values. + * @param {*} exValue The initial extremum value. + * @returns {*} Returns the extremum value. + */ + function arrayExtremum(array, iteratee, comparator, exValue) { + var index = -1, + length = array.length, + computed = exValue, + result = computed; + + while (++index < length) { + var value = array[index], + current = +iteratee(value); + + if (comparator(current, computed)) { + computed = current; + result = value; + } + } + return result; + } + + /** + * A specialized version of `_.filter` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function arrayFilter(array, predicate) { + var index = -1, + length = array.length, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[++resIndex] = value; + } + } + return result; + } + + /** + * A specialized version of `_.map` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + /** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ + function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; + } + + /** + * A specialized version of `_.reduce` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initFromArray] Specify using the first element of `array` + * as the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduce(array, iteratee, accumulator, initFromArray) { + var index = -1, + length = array.length; + + if (initFromArray && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; + } + + /** + * A specialized version of `_.reduceRight` for arrays without support for + * callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initFromArray] Specify using the last element of `array` + * as the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduceRight(array, iteratee, accumulator, initFromArray) { + var length = array.length; + if (initFromArray && length) { + accumulator = array[--length]; + } + while (length--) { + accumulator = iteratee(accumulator, array[length], length, array); + } + return accumulator; + } + + /** + * A specialized version of `_.some` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function arraySome(array, predicate) { + var index = -1, + length = array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; + } + + /** + * A specialized version of `_.sum` for arrays without support for callback + * shorthands and `this` binding.. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. + */ + function arraySum(array, iteratee) { + var length = array.length, + result = 0; + + while (length--) { + result += +iteratee(array[length]) || 0; + } + return result; + } + + /** + * Used by `_.defaults` to customize its `_.assign` use. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @returns {*} Returns the value to assign to the destination object. + */ + function assignDefaults(objectValue, sourceValue) { + return objectValue === undefined ? sourceValue : objectValue; + } + + /** + * Used by `_.template` to customize its `_.assign` use. + * + * **Note:** This function is like `assignDefaults` except that it ignores + * inherited property values when checking if a property is `undefined`. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @param {string} key The key associated with the object and source values. + * @param {Object} object The destination object. + * @returns {*} Returns the value to assign to the destination object. + */ + function assignOwnDefaults(objectValue, sourceValue, key, object) { + return (objectValue === undefined || !hasOwnProperty.call(object, key)) + ? sourceValue + : objectValue; + } + + /** + * A specialized version of `_.assign` for customizing assigned values without + * support for argument juggling, multiple sources, and `this` binding `customizer` + * functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + */ + function assignWith(object, source, customizer) { + var index = -1, + props = keys(source), + length = props.length; + + while (++index < length) { + var key = props[index], + value = object[key], + result = customizer(value, source[key], key, object, source); + + if ((result === result ? (result !== value) : (value === value)) || + (value === undefined && !(key in object))) { + object[key] = result; + } + } + return object; + } + + /** + * The base implementation of `_.assign` without support for argument juggling, + * multiple sources, and `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssign(object, source) { + return source == null + ? object + : baseCopy(source, keys(source), object); + } + + /** + * The base implementation of `_.at` without support for string collections + * and individual key arguments. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {number[]|string[]} props The property names or indexes of elements to pick. + * @returns {Array} Returns the new array of picked elements. + */ + function baseAt(collection, props) { + var index = -1, + isNil = collection == null, + isArr = !isNil && isArrayLike(collection), + length = isArr ? collection.length : 0, + propsLength = props.length, + result = Array(propsLength); + + while(++index < propsLength) { + var key = props[index]; + if (isArr) { + result[index] = isIndex(key, length) ? collection[key] : undefined; + } else { + result[index] = isNil ? undefined : collection[key]; + } + } + return result; + } + + /** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property names to copy. + * @param {Object} [object={}] The object to copy properties to. + * @returns {Object} Returns `object`. + */ + function baseCopy(source, props, object) { + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + object[key] = source[key]; + } + return object; + } + + /** + * The base implementation of `_.callback` which supports specifying the + * number of arguments to provide to `func`. + * + * @private + * @param {*} [func=_.identity] The value to convert to a callback. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {number} [argCount] The number of arguments to provide to `func`. + * @returns {Function} Returns the callback. + */ + function baseCallback(func, thisArg, argCount) { + var type = typeof func; + if (type == 'function') { + return thisArg === undefined + ? func + : bindCallback(func, thisArg, argCount); + } + if (func == null) { + return identity; + } + if (type == 'object') { + return baseMatches(func); + } + return thisArg === undefined + ? property(func) + : baseMatchesProperty(func, thisArg); + } + + /** + * The base implementation of `_.clone` without support for argument juggling + * and `this` binding `customizer` functions. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @param {Function} [customizer] The function to customize cloning values. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The object `value` belongs to. + * @param {Array} [stackA=[]] Tracks traversed source objects. + * @param {Array} [stackB=[]] Associates clones with source counterparts. + * @returns {*} Returns the cloned value. + */ + function baseClone(value, isDeep, customizer, key, object, stackA, stackB) { + var result; + if (customizer) { + result = object ? customizer(value, key, object) : customizer(value); + } + if (result !== undefined) { + return result; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result = initCloneArray(value); + if (!isDeep) { + return arrayCopy(value, result); + } + } else { + var tag = objToString.call(value), + isFunc = tag == funcTag; + + if (tag == objectTag || tag == argsTag || (isFunc && !object)) { + result = initCloneObject(isFunc ? {} : value); + if (!isDeep) { + return baseAssign(result, value); + } + } else { + return cloneableTags[tag] + ? initCloneByTag(value, tag, isDeep) + : (object ? value : {}); + } + } + // Check for circular references and return its corresponding clone. + stackA || (stackA = []); + stackB || (stackB = []); + + var length = stackA.length; + while (length--) { + if (stackA[length] == value) { + return stackB[length]; + } + } + // Add the source value to the stack of traversed objects and associate it with its clone. + stackA.push(value); + stackB.push(result); + + // Recursively populate clone (susceptible to call stack limits). + (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { + result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB); + }); + return result; + } + + /** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ + var baseCreate = (function() { + function object() {} + return function(prototype) { + if (isObject(prototype)) { + object.prototype = prototype; + var result = new object; + object.prototype = undefined; + } + return result || {}; + }; + }()); + + /** + * The base implementation of `_.delay` and `_.defer` which accepts an index + * of where to slice the arguments to provide to `func`. + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Object} args The arguments provide to `func`. + * @returns {number} Returns the timer id. + */ + function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined, args); }, wait); + } + + /** + * The base implementation of `_.difference` which accepts a single array + * of values to exclude. + * + * @private + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @returns {Array} Returns the new array of filtered values. + */ + function baseDifference(array, values) { + var length = array ? array.length : 0, + result = []; + + if (!length) { + return result; + } + var index = -1, + indexOf = getIndexOf(), + isCommon = indexOf == baseIndexOf, + cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null, + valuesLength = values.length; + + if (cache) { + indexOf = cacheIndexOf; + isCommon = false; + values = cache; + } + outer: + while (++index < length) { + var value = array[index]; + + if (isCommon && value === value) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === value) { + continue outer; + } + } + result.push(value); + } + else if (indexOf(values, value, 0) < 0) { + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.forEach` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object|string} Returns `collection`. + */ + var baseEach = createBaseEach(baseForOwn); + + /** + * The base implementation of `_.forEachRight` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object|string} Returns `collection`. + */ + var baseEachRight = createBaseEach(baseForOwnRight, true); + + /** + * The base implementation of `_.every` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` + */ + function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function(value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; + } + + /** + * Gets the extremum value of `collection` invoking `iteratee` for each value + * in `collection` to generate the criterion by which the value is ranked. + * The `iteratee` is invoked with three arguments: (value, index|key, collection). + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} comparator The function used to compare values. + * @param {*} exValue The initial extremum value. + * @returns {*} Returns the extremum value. + */ + function baseExtremum(collection, iteratee, comparator, exValue) { + var computed = exValue, + result = computed; + + baseEach(collection, function(value, index, collection) { + var current = +iteratee(value, index, collection); + if (comparator(current, computed) || (current === exValue && current === result)) { + computed = current; + result = value; + } + }); + return result; + } + + /** + * The base implementation of `_.fill` without an iteratee call guard. + * + * @private + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ + function baseFill(array, value, start, end) { + var length = array.length; + + start = start == null ? 0 : (+start || 0); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : (+end || 0); + if (end < 0) { + end += length; + } + length = start > end ? 0 : (end >>> 0); + start >>>= 0; + + while (start < length) { + array[start++] = value; + } + return array; + } + + /** + * The base implementation of `_.filter` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; + } + + /** + * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, + * without support for callback shorthands and `this` binding, which iterates + * over `collection` using the provided `eachFunc`. + * + * @private + * @param {Array|Object|string} collection The collection to search. + * @param {Function} predicate The function invoked per iteration. + * @param {Function} eachFunc The function to iterate over `collection`. + * @param {boolean} [retKey] Specify returning the key of the found element + * instead of the element itself. + * @returns {*} Returns the found element or its key, else `undefined`. + */ + function baseFind(collection, predicate, eachFunc, retKey) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = retKey ? key : value; + return false; + } + }); + return result; + } + + /** + * The base implementation of `_.flatten` with added support for restricting + * flattening and specifying the start index. + * + * @private + * @param {Array} array The array to flatten. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, isDeep, isStrict, result) { + result || (result = []); + + var index = -1, + length = array.length; + + while (++index < length) { + var value = array[index]; + if (isObjectLike(value) && isArrayLike(value) && + (isStrict || isArray(value) || isArguments(value))) { + if (isDeep) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, isDeep, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; + } + + /** + * The base implementation of `baseForIn` and `baseForOwn` which iterates + * over `object` properties returned by `keysFunc` invoking `iteratee` for + * each property. Iteratee functions may exit iteration early by explicitly + * returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseFor = createBaseFor(); + + /** + * This function is like `baseFor` except that it iterates over properties + * in the opposite order. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseForRight = createBaseFor(true); + + /** + * The base implementation of `_.forIn` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForIn(object, iteratee) { + return baseFor(object, iteratee, keysIn); + } + + /** + * The base implementation of `_.forOwn` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwn(object, iteratee) { + return baseFor(object, iteratee, keys); + } + + /** + * The base implementation of `_.forOwnRight` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwnRight(object, iteratee) { + return baseForRight(object, iteratee, keys); + } + + /** + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from those provided. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the new array of filtered property names. + */ + function baseFunctions(object, props) { + var index = -1, + length = props.length, + resIndex = -1, + result = []; + + while (++index < length) { + var key = props[index]; + if (isFunction(object[key])) { + result[++resIndex] = key; + } + } + return result; + } + + /** + * The base implementation of `get` without support for string paths + * and default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path of the property to get. + * @param {string} [pathKey] The key representation of path. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path, pathKey) { + if (object == null) { + return; + } + if (pathKey !== undefined && pathKey in toObject(object)) { + path = [pathKey]; + } + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; + } + + /** + * The base implementation of `_.isEqual` without support for `this` binding + * `customizer` functions. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparing values. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA] Tracks traversed `value` objects. + * @param {Array} [stackB] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ + function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); + } + + /** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparing objects. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA=[]] Tracks traversed `value` objects. + * @param {Array} [stackB=[]] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = arrayTag, + othTag = arrayTag; + + if (!objIsArr) { + objTag = objToString.call(object); + if (objTag == argsTag) { + objTag = objectTag; + } else if (objTag != objectTag) { + objIsArr = isTypedArray(object); + } + } + if (!othIsArr) { + othTag = objToString.call(other); + if (othTag == argsTag) { + othTag = objectTag; + } else if (othTag != objectTag) { + othIsArr = isTypedArray(other); + } + } + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && !(objIsArr || objIsObj)) { + return equalByTag(object, other, objTag); + } + if (!isLoose) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); + } + } + if (!isSameTag) { + return false; + } + // Assume cyclic values are equal. + // For more information on detecting circular references see https://es5.github.io/#JO. + stackA || (stackA = []); + stackB || (stackB = []); + + var length = stackA.length; + while (length--) { + if (stackA[length] == object) { + return stackB[length] == other; + } + } + // Add `object` and `other` to the stack of traversed objects. + stackA.push(object); + stackB.push(other); + + var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); + + stackA.pop(); + stackB.pop(); + + return result; + } + + /** + * The base implementation of `_.isMatch` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} matchData The propery names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparing objects. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ + function baseIsMatch(object, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = toObject(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var result = customizer ? customizer(objValue, srcValue, key) : undefined; + if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { + return false; + } + } + } + return true; + } + + /** + * The base implementation of `_.map` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; + } + + /** + * The base implementation of `_.matches` which does not clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new function. + */ + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + var key = matchData[0][0], + value = matchData[0][1]; + + return function(object) { + if (object == null) { + return false; + } + return object[key] === value && (value !== undefined || (key in toObject(object))); + }; + } + return function(object) { + return baseIsMatch(object, matchData); + }; + } + + /** + * The base implementation of `_.matchesProperty` which does not clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to compare. + * @returns {Function} Returns the new function. + */ + function baseMatchesProperty(path, srcValue) { + var isArr = isArray(path), + isCommon = isKey(path) && isStrictComparable(srcValue), + pathKey = (path + ''); + + path = toPath(path); + return function(object) { + if (object == null) { + return false; + } + var key = pathKey; + object = toObject(object); + if ((isArr || !isCommon) && !(key in object)) { + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + if (object == null) { + return false; + } + key = last(path); + object = toObject(object); + } + return object[key] === srcValue + ? (srcValue !== undefined || (key in object)) + : baseIsEqual(srcValue, object[key], undefined, true); + }; + } + + /** + * The base implementation of `_.merge` without support for argument juggling, + * multiple sources, and `this` binding `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {Function} [customizer] The function to customize merged values. + * @param {Array} [stackA=[]] Tracks traversed source objects. + * @param {Array} [stackB=[]] Associates values with source counterparts. + * @returns {Object} Returns `object`. + */ + function baseMerge(object, source, customizer, stackA, stackB) { + if (!isObject(object)) { + return object; + } + var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)), + props = isSrcArr ? undefined : keys(source); + + arrayEach(props || source, function(srcValue, key) { + if (props) { + key = srcValue; + srcValue = source[key]; + } + if (isObjectLike(srcValue)) { + stackA || (stackA = []); + stackB || (stackB = []); + baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); + } + else { + var value = object[key], + result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = result === undefined; + + if (isCommon) { + result = srcValue; + } + if ((result !== undefined || (isSrcArr && !(key in object))) && + (isCommon || (result === result ? (result !== value) : (value === value)))) { + object[key] = result; + } + } + }); + return object; + } + + /** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize merged values. + * @param {Array} [stackA=[]] Tracks traversed source objects. + * @param {Array} [stackB=[]] Associates values with source counterparts. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) { + var length = stackA.length, + srcValue = source[key]; + + while (length--) { + if (stackA[length] == srcValue) { + object[key] = stackB[length]; + return; + } + } + var value = object[key], + result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = result === undefined; + + if (isCommon) { + result = srcValue; + if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) { + result = isArray(value) + ? value + : (isArrayLike(value) ? arrayCopy(value) : []); + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + result = isArguments(value) + ? toPlainObject(value) + : (isPlainObject(value) ? value : {}); + } + else { + isCommon = false; + } + } + // Add the source value to the stack of traversed objects and associate + // it with its merged value. + stackA.push(srcValue); + stackB.push(result); + + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB); + } else if (result === result ? (result !== value) : (value === value)) { + object[key] = result; + } + } + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + */ + function basePropertyDeep(path) { + var pathKey = (path + ''); + path = toPath(path); + return function(object) { + return baseGet(object, path, pathKey); + }; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * index arguments and capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0; + while (length--) { + var index = indexes[length]; + if (index != previous && isIndex(index)) { + var previous = index; + splice.call(array, index, 1); + } + } + return array; + } + + /** + * The base implementation of `_.random` without support for argument juggling + * and returning floating-point numbers. + * + * @private + * @param {number} min The minimum possible value. + * @param {number} max The maximum possible value. + * @returns {number} Returns the random number. + */ + function baseRandom(min, max) { + return min + nativeFloor(nativeRandom() * (max - min + 1)); + } + + /** + * The base implementation of `_.reduce` and `_.reduceRight` without support + * for callback shorthands and `this` binding, which iterates over `collection` + * using the provided `eachFunc`. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initFromCollection Specify using the first or last element + * of `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. + */ + function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initFromCollection + ? (initFromCollection = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; + } + + /** + * The base implementation of `setData` without support for hot loop detection. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var baseSetData = !metaMap ? identity : function(func, data) { + metaMap.set(func, data); + return func; + }; + + /** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + start = start == null ? 0 : (+start || 0); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : (+end || 0); + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; + } + + /** + * The base implementation of `_.some` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function baseSome(collection, predicate) { + var result; + + baseEach(collection, function(value, index, collection) { + result = predicate(value, index, collection); + return !result; + }); + return !!result; + } + + /** + * The base implementation of `_.sortBy` which uses `comparer` to define + * the sort order of `array` and replaces criteria objects with their + * corresponding values. + * + * @private + * @param {Array} array The array to sort. + * @param {Function} comparer The function to define sort order. + * @returns {Array} Returns `array`. + */ + function baseSortBy(array, comparer) { + var length = array.length; + + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; + } + + /** + * The base implementation of `_.sortByOrder` without param guards. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {boolean[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. + */ + function baseSortByOrder(collection, iteratees, orders) { + var callback = getCallback(), + index = -1; + + iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); }); + + var result = baseMap(collection, function(value) { + var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; + }); + + return baseSortBy(result, function(object, other) { + return compareMultiple(object, other, orders); + }); + } + + /** + * The base implementation of `_.sum` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. + */ + function baseSum(collection, iteratee) { + var result = 0; + baseEach(collection, function(value, index, collection) { + result += +iteratee(value, index, collection) || 0; + }); + return result; + } + + /** + * The base implementation of `_.uniq` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The function invoked per iteration. + * @returns {Array} Returns the new duplicate-value-free array. + */ + function baseUniq(array, iteratee) { + var index = -1, + indexOf = getIndexOf(), + length = array.length, + isCommon = indexOf == baseIndexOf, + isLarge = isCommon && length >= LARGE_ARRAY_SIZE, + seen = isLarge ? createCache() : null, + result = []; + + if (seen) { + indexOf = cacheIndexOf; + isCommon = false; + } else { + isLarge = false; + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value, index, array) : value; + + if (isCommon && value === value) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (indexOf(seen, computed, 0) < 0) { + if (iteratee || isLarge) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ + function baseValues(object, props) { + var index = -1, + length = props.length, + result = Array(length); + + while (++index < length) { + result[index] = object[props[index]]; + } + return result; + } + + /** + * The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`, + * and `_.takeWhile` without support for callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. + */ + function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} + return isDrop + ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) + : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); + } + + /** + * The base implementation of `wrapperValue` which returns the result of + * performing a sequence of actions on the unwrapped `value`, where each + * successive action is supplied the return value of the previous. + * + * @private + * @param {*} value The unwrapped value. + * @param {Array} actions Actions to peform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. + */ + function baseWrapperValue(value, actions) { + var result = value; + if (result instanceof LazyWrapper) { + result = result.value(); + } + var index = -1, + length = actions.length; + + while (++index < length) { + var action = actions[index]; + result = action.func.apply(action.thisArg, arrayPush([result], action.args)); + } + return result; + } + + /** + * Performs a binary search of `array` to determine the index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function binaryIndex(array, value, retHighest) { + var low = 0, + high = array ? array.length : low; + + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; + + if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return binaryIndexBy(array, value, identity, retHighest); + } + + /** + * This function is like `binaryIndex` except that it invokes `iteratee` for + * `value` and each element of `array` to compute their sort ranking. The + * iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The function invoked per iteration. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function binaryIndexBy(array, value, iteratee, retHighest) { + value = iteratee(value); + + var low = 0, + high = array ? array.length : 0, + valIsNaN = value !== value, + valIsNull = value === null, + valIsUndef = value === undefined; + + while (low < high) { + var mid = nativeFloor((low + high) / 2), + computed = iteratee(array[mid]), + isDef = computed !== undefined, + isReflexive = computed === computed; + + if (valIsNaN) { + var setLow = isReflexive || retHighest; + } else if (valIsNull) { + setLow = isReflexive && isDef && (retHighest || computed != null); + } else if (valIsUndef) { + setLow = isReflexive && (retHighest || isDef); + } else if (computed == null) { + setLow = false; + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); + } + + /** + * A specialized version of `baseCallback` which only supports `this` binding + * and specifying the number of arguments to provide to `func`. + * + * @private + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {number} [argCount] The number of arguments to provide to `func`. + * @returns {Function} Returns the callback. + */ + function bindCallback(func, thisArg, argCount) { + if (typeof func != 'function') { + return identity; + } + if (thisArg === undefined) { + return func; + } + switch (argCount) { + case 1: return function(value) { + return func.call(thisArg, value); + }; + case 3: return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; + case 4: return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + case 5: return function(value, other, key, object, source) { + return func.call(thisArg, value, other, key, object, source); + }; + } + return function() { + return func.apply(thisArg, arguments); + }; + } + + /** + * Creates a clone of the given array buffer. + * + * @private + * @param {ArrayBuffer} buffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ + function bufferClone(buffer) { + var result = new ArrayBuffer(buffer.byteLength), + view = new Uint8Array(result); + + view.set(new Uint8Array(buffer)); + return result; + } + + /** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array|Object} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgs(args, partials, holders) { + var holdersLength = holders.length, + argsIndex = -1, + argsLength = nativeMax(args.length - holdersLength, 0), + leftIndex = -1, + leftLength = partials.length, + result = Array(leftLength + argsLength); + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + while (argsLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; + } + + /** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array|Object} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgsRight(args, partials, holders) { + var holdersIndex = -1, + holdersLength = holders.length, + argsIndex = -1, + argsLength = nativeMax(args.length - holdersLength, 0), + rightIndex = -1, + rightLength = partials.length, + result = Array(argsLength + rightLength); + + while (++argsIndex < argsLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + return result; + } + + /** + * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function. + * + * @private + * @param {Function} setter The function to set keys and values of the accumulator object. + * @param {Function} [initializer] The function to initialize the accumulator object. + * @returns {Function} Returns the new aggregator function. + */ + function createAggregator(setter, initializer) { + return function(collection, iteratee, thisArg) { + var result = initializer ? initializer() : {}; + iteratee = getCallback(iteratee, thisArg, 3); + + if (isArray(collection)) { + var index = -1, + length = collection.length; + + while (++index < length) { + var value = collection[index]; + setter(result, value, iteratee(value, index, collection), collection); + } + } else { + baseEach(collection, function(value, key, collection) { + setter(result, value, iteratee(value, key, collection), collection); + }); + } + return result; + }; + } + + /** + * Creates a `_.assign`, `_.defaults`, or `_.merge` function. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return restParam(function(object, sources) { + var index = -1, + length = object == null ? 0 : sources.length, + customizer = length > 2 ? sources[length - 2] : undefined, + guard = length > 2 ? sources[2] : undefined, + thisArg = length > 1 ? sources[length - 1] : undefined; + + if (typeof customizer == 'function') { + customizer = bindCallback(customizer, thisArg, 5); + length -= 2; + } else { + customizer = typeof thisArg == 'function' ? thisArg : undefined; + length -= (customizer ? 1 : 0); + } + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, customizer); + } + } + return object; + }); + } + + /** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { + return eachFunc(collection, iteratee); + } + var index = fromRight ? length : -1, + iterable = toObject(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + + /** + * Creates a base function for `_.forIn` or `_.forInRight`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var iterable = toObject(object), + props = keysFunc(object), + length = props.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length)) { + var key = props[index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** + * Creates a function that wraps `func` and invokes it with the `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to bind. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new bound function. + */ + function createBindWrapper(func, thisArg) { + var Ctor = createCtorWrapper(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(thisArg, arguments); + } + return wrapper; + } + + /** + * Creates a `Set` cache object to optimize linear searches of large arrays. + * + * @private + * @param {Array} [values] The values to cache. + * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. + */ + function createCache(values) { + return (nativeCreate && Set) ? new SetCache(values) : null; + } + + /** + * Creates a function that produces compound words out of the words in a + * given string. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ + function createCompounder(callback) { + return function(string) { + var index = -1, + array = words(deburr(string)), + length = array.length, + result = ''; + + while (++index < length) { + result = callback(result, array[index], index); + } + return result; + }; + } + + /** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ + function createCtorWrapper(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. + // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; + } + + /** + * Creates a `_.curry` or `_.curryRight` function. + * + * @private + * @param {boolean} flag The curry bit flag. + * @returns {Function} Returns the new curry function. + */ + function createCurry(flag) { + function curryFunc(func, arity, guard) { + if (guard && isIterateeCall(func, arity, guard)) { + arity = undefined; + } + var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curryFunc.placeholder; + return result; + } + return curryFunc; + } + + /** + * Creates a `_.defaults` or `_.defaultsDeep` function. + * + * @private + * @param {Function} assigner The function to assign values. + * @param {Function} customizer The function to customize assigned values. + * @returns {Function} Returns the new defaults function. + */ + function createDefaults(assigner, customizer) { + return restParam(function(args) { + var object = args[0]; + if (object == null) { + return object; + } + args.push(customizer); + return assigner.apply(undefined, args); + }); + } + + /** + * Creates a `_.max` or `_.min` function. + * + * @private + * @param {Function} comparator The function used to compare values. + * @param {*} exValue The initial extremum value. + * @returns {Function} Returns the new extremum function. + */ + function createExtremum(comparator, exValue) { + return function(collection, iteratee, thisArg) { + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = undefined; + } + iteratee = getCallback(iteratee, thisArg, 3); + if (iteratee.length == 1) { + collection = isArray(collection) ? collection : toIterable(collection); + var result = arrayExtremum(collection, iteratee, comparator, exValue); + if (!(collection.length && result === exValue)) { + return result; + } + } + return baseExtremum(collection, iteratee, comparator, exValue); + }; + } + + /** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new find function. + */ + function createFind(eachFunc, fromRight) { + return function(collection, predicate, thisArg) { + predicate = getCallback(predicate, thisArg, 3); + if (isArray(collection)) { + var index = baseFindIndex(collection, predicate, fromRight); + return index > -1 ? collection[index] : undefined; + } + return baseFind(collection, predicate, eachFunc); + }; + } + + /** + * Creates a `_.findIndex` or `_.findLastIndex` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new find function. + */ + function createFindIndex(fromRight) { + return function(array, predicate, thisArg) { + if (!(array && array.length)) { + return -1; + } + predicate = getCallback(predicate, thisArg, 3); + return baseFindIndex(array, predicate, fromRight); + }; + } + + /** + * Creates a `_.findKey` or `_.findLastKey` function. + * + * @private + * @param {Function} objectFunc The function to iterate over an object. + * @returns {Function} Returns the new find function. + */ + function createFindKey(objectFunc) { + return function(object, predicate, thisArg) { + predicate = getCallback(predicate, thisArg, 3); + return baseFind(object, predicate, objectFunc, true); + }; + } + + /** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ + function createFlow(fromRight) { + return function() { + var wrapper, + length = arguments.length, + index = fromRight ? length : -1, + leftIndex = 0, + funcs = Array(length); + + while ((fromRight ? index-- : ++index < length)) { + var func = funcs[leftIndex++] = arguments[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') { + wrapper = new LodashWrapper([], true); + } + } + index = wrapper ? -1 : length; + while (++index < length) { + func = funcs[index]; + + var funcName = getFuncName(func), + data = funcName == 'wrapper' ? getData(func) : undefined; + + if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { + wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); + } else { + wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); + } + } + return function() { + var args = arguments, + value = args[0]; + + if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) { + return wrapper.plant(value).value(); + } + var index = 0, + result = length ? funcs[index].apply(this, args) : value; + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }; + } + + /** + * Creates a function for `_.forEach` or `_.forEachRight`. + * + * @private + * @param {Function} arrayFunc The function to iterate over an array. + * @param {Function} eachFunc The function to iterate over a collection. + * @returns {Function} Returns the new each function. + */ + function createForEach(arrayFunc, eachFunc) { + return function(collection, iteratee, thisArg) { + return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) + ? arrayFunc(collection, iteratee) + : eachFunc(collection, bindCallback(iteratee, thisArg, 3)); + }; + } + + /** + * Creates a function for `_.forIn` or `_.forInRight`. + * + * @private + * @param {Function} objectFunc The function to iterate over an object. + * @returns {Function} Returns the new each function. + */ + function createForIn(objectFunc) { + return function(object, iteratee, thisArg) { + if (typeof iteratee != 'function' || thisArg !== undefined) { + iteratee = bindCallback(iteratee, thisArg, 3); + } + return objectFunc(object, iteratee, keysIn); + }; + } + + /** + * Creates a function for `_.forOwn` or `_.forOwnRight`. + * + * @private + * @param {Function} objectFunc The function to iterate over an object. + * @returns {Function} Returns the new each function. + */ + function createForOwn(objectFunc) { + return function(object, iteratee, thisArg) { + if (typeof iteratee != 'function' || thisArg !== undefined) { + iteratee = bindCallback(iteratee, thisArg, 3); + } + return objectFunc(object, iteratee); + }; + } + + /** + * Creates a function for `_.mapKeys` or `_.mapValues`. + * + * @private + * @param {boolean} [isMapKeys] Specify mapping keys instead of values. + * @returns {Function} Returns the new map function. + */ + function createObjectMapper(isMapKeys) { + return function(object, iteratee, thisArg) { + var result = {}; + iteratee = getCallback(iteratee, thisArg, 3); + + baseForOwn(object, function(value, key, object) { + var mapped = iteratee(value, key, object); + key = isMapKeys ? mapped : key; + value = isMapKeys ? value : mapped; + result[key] = value; + }); + return result; + }; + } + + /** + * Creates a function for `_.padLeft` or `_.padRight`. + * + * @private + * @param {boolean} [fromRight] Specify padding from the right. + * @returns {Function} Returns the new pad function. + */ + function createPadDir(fromRight) { + return function(string, length, chars) { + string = baseToString(string); + return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); + }; + } + + /** + * Creates a `_.partial` or `_.partialRight` function. + * + * @private + * @param {boolean} flag The partial bit flag. + * @returns {Function} Returns the new partial function. + */ + function createPartial(flag) { + var partialFunc = restParam(function(func, partials) { + var holders = replaceHolders(partials, partialFunc.placeholder); + return createWrapper(func, flag, undefined, partials, holders); + }); + return partialFunc; + } + + /** + * Creates a function for `_.reduce` or `_.reduceRight`. + * + * @private + * @param {Function} arrayFunc The function to iterate over an array. + * @param {Function} eachFunc The function to iterate over a collection. + * @returns {Function} Returns the new each function. + */ + function createReduce(arrayFunc, eachFunc) { + return function(collection, iteratee, accumulator, thisArg) { + var initFromArray = arguments.length < 3; + return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) + ? arrayFunc(collection, iteratee, accumulator, initFromArray) + : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc); + }; + } + + /** + * Creates a function that wraps `func` and invokes it with optional `this` + * binding of, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to reference. + * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & ARY_FLAG, + isBind = bitmask & BIND_FLAG, + isBindKey = bitmask & BIND_KEY_FLAG, + isCurry = bitmask & CURRY_FLAG, + isCurryBound = bitmask & CURRY_BOUND_FLAG, + isCurryRight = bitmask & CURRY_RIGHT_FLAG, + Ctor = isBindKey ? undefined : createCtorWrapper(func); + + function wrapper() { + // Avoid `arguments` object use disqualifying optimizations by + // converting it to an array before providing it to other functions. + var length = arguments.length, + index = length, + args = Array(length); + + while (index--) { + args[index] = arguments[index]; + } + if (partials) { + args = composeArgs(args, partials, holders); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight); + } + if (isCurry || isCurryRight) { + var placeholder = wrapper.placeholder, + argsHolders = replaceHolders(args, placeholder); + + length -= argsHolders.length; + if (length < arity) { + var newArgPos = argPos ? arrayCopy(argPos) : undefined, + newArity = nativeMax(arity - length, 0), + newsHolders = isCurry ? argsHolders : undefined, + newHoldersRight = isCurry ? undefined : argsHolders, + newPartials = isCurry ? args : undefined, + newPartialsRight = isCurry ? undefined : args; + + bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); + + if (!isCurryBound) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity], + result = createHybridWrapper.apply(undefined, newData); + + if (isLaziable(func)) { + setData(result, newData); + } + result.placeholder = placeholder; + return result; + } + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + if (argPos) { + args = reorder(args, argPos); + } + if (isAry && ary < args.length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtorWrapper(func); + } + return fn.apply(thisBinding, args); + } + return wrapper; + } + + /** + * Creates the padding required for `string` based on the given `length`. + * The `chars` string is truncated if the number of characters exceeds `length`. + * + * @private + * @param {string} string The string to create padding for. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the pad for `string`. + */ + function createPadding(string, length, chars) { + var strLength = string.length; + length = +length; + + if (strLength >= length || !nativeIsFinite(length)) { + return ''; + } + var padLength = length - strLength; + chars = chars == null ? ' ' : (chars + ''); + return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength); + } + + /** + * Creates a function that wraps `func` and invokes it with the optional `this` + * binding of `thisArg` and the `partials` prepended to those provided to + * the wrapper. + * + * @private + * @param {Function} func The function to partially apply arguments to. + * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to the new function. + * @returns {Function} Returns the new bound function. + */ + function createPartialWrapper(func, bitmask, thisArg, partials) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtorWrapper(func); + + function wrapper() { + // Avoid `arguments` object use disqualifying optimizations by + // converting it to an array before providing it `func`. + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength); + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, args); + } + return wrapper; + } + + /** + * Creates a `_.ceil`, `_.floor`, or `_.round` function. + * + * @private + * @param {string} methodName The name of the `Math` method to use when rounding. + * @returns {Function} Returns the new round function. + */ + function createRound(methodName) { + var func = Math[methodName]; + return function(number, precision) { + precision = precision === undefined ? 0 : (+precision || 0); + if (precision) { + precision = pow(10, precision); + return func(number * precision) / precision; + } + return func(number); + }; + } + + /** + * Creates a `_.sortedIndex` or `_.sortedLastIndex` function. + * + * @private + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {Function} Returns the new index function. + */ + function createSortedIndex(retHighest) { + return function(array, value, iteratee, thisArg) { + var callback = getCallback(iteratee); + return (iteratee == null && callback === baseCallback) + ? binaryIndex(array, value, retHighest) + : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest); + }; + } + + /** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to reference. + * @param {number} bitmask The bitmask of flags. + * The bitmask may be composed of the following flags: + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + length -= (holders ? holders.length : 0); + if (bitmask & PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + var data = isBindKey ? undefined : getData(func), + newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; + + if (data) { + mergeData(newData, data); + bitmask = newData[1]; + arity = newData[9]; + } + newData[9] = arity == null + ? (isBindKey ? 0 : func.length) + : (nativeMax(arity - length, 0) || 0); + + if (bitmask == BIND_FLAG) { + var result = createBindWrapper(newData[0], newData[2]); + } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) { + result = createPartialWrapper.apply(undefined, newData); + } else { + result = createHybridWrapper.apply(undefined, newData); + } + var setter = data ? baseSetData : setData; + return setter(result, newData); + } + + /** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparing arrays. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA] Tracks traversed `value` objects. + * @param {Array} [stackB] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ + function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { + var index = -1, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isLoose && othLength > arrLength)) { + return false; + } + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index], + result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; + + if (result !== undefined) { + if (result) { + continue; + } + return false; + } + // Recursively compare arrays (susceptible to call stack limits). + if (isLoose) { + if (!arraySome(other, function(othValue) { + return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); + })) { + return false; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { + return false; + } + } + return true; + } + + /** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalByTag(object, other, tag) { + switch (tag) { + case boolTag: + case dateTag: + // Coerce dates and booleans to numbers, dates to milliseconds and booleans + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + return +object == +other; + + case errorTag: + return object.name == other.name && object.message == other.message; + + case numberTag: + // Treat `NaN` vs. `NaN` as equal. + return (object != +object) + ? other != +other + : object == +other; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings primitives and string + // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + return object == (other + ''); + } + return false; + } + + /** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparing values. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA] Tracks traversed `value` objects. + * @param {Array} [stackB] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { + var objProps = keys(object), + objLength = objProps.length, + othProps = keys(other), + othLength = othProps.length; + + if (objLength != othLength && !isLoose) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + var skipCtor = isLoose; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key], + result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; + + // Recursively compare objects (susceptible to call stack limits). + if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { + return false; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (!skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + return false; + } + } + return true; + } + + /** + * Gets the appropriate "callback" function. If the `_.callback` method is + * customized this function returns the custom method, otherwise it returns + * the `baseCallback` function. If arguments are provided the chosen function + * is invoked with them and its result is returned. + * + * @private + * @returns {Function} Returns the chosen function or its result. + */ + function getCallback(func, thisArg, argCount) { + var result = lodash.callback || callback; + result = result === callback ? baseCallback : result; + return argCount ? result(func, thisArg, argCount) : result; + } + + /** + * Gets metadata for `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {*} Returns the metadata for `func`. + */ + var getData = !metaMap ? noop : function(func) { + return metaMap.get(func); + }; + + /** + * Gets the name of `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {string} Returns the function name. + */ + function getFuncName(func) { + var result = func.name, + array = realNames[result], + length = array ? array.length : 0; + + while (length--) { + var data = array[length], + otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; + } + } + return result; + } + + /** + * Gets the appropriate "indexOf" function. If the `_.indexOf` method is + * customized this function returns the custom method, otherwise it returns + * the `baseIndexOf` function. If arguments are provided the chosen function + * is invoked with them and its result is returned. + * + * @private + * @returns {Function|number} Returns the chosen function or its result. + */ + function getIndexOf(collection, target, fromIndex) { + var result = lodash.indexOf || indexOf; + result = result === indexOf ? baseIndexOf : result; + return collection ? result(collection, target, fromIndex) : result; + } + + /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); + + /** + * Gets the propery names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ + function getMatchData(object) { + var result = pairs(object), + length = result.length; + + while (length--) { + result[length][2] = isStrictComparable(result[length][1]); + } + return result; + } + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; + } + + /** + * Gets the view, applying any `transforms` to the `start` and `end` positions. + * + * @private + * @param {number} start The start of the view. + * @param {number} end The end of the view. + * @param {Array} transforms The transformations to apply to the view. + * @returns {Object} Returns an object containing the `start` and `end` + * positions of the view. + */ + function getView(start, end, transforms) { + var index = -1, + length = transforms.length; + + while (++index < length) { + var data = transforms[index], + size = data.size; + + switch (data.type) { + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; + } + } + return { 'start': start, 'end': end }; + } + + /** + * Initializes an array clone. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the initialized clone. + */ + function initCloneArray(array) { + var length = array.length, + result = new array.constructor(length); + + // Add array properties assigned by `RegExp#exec`. + if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { + result.index = array.index; + result.input = array.input; + } + return result; + } + + /** + * Initializes an object clone. + * + * @private + * @param {Object} object The object to clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneObject(object) { + var Ctor = object.constructor; + if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) { + Ctor = Object; + } + return new Ctor; + } + + /** + * Initializes an object clone based on its `toStringTag`. + * + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to clone. + * @param {string} tag The `toStringTag` of the object to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneByTag(object, tag, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag: + return bufferClone(object); + + case boolTag: + case dateTag: + return new Ctor(+object); + + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: + var buffer = object.buffer; + return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length); + + case numberTag: + case stringTag: + return new Ctor(object); + + case regexpTag: + var result = new Ctor(object.source, reFlags.exec(object)); + result.lastIndex = object.lastIndex; + } + return result; + } + + /** + * Invokes the method at `path` on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + */ + function invokePath(object, path, args) { + if (object != null && !isKey(path, object)) { + path = toPath(path); + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + path = last(path); + } + var func = object == null ? object : object[path]; + return func == null ? undefined : func.apply(object, args); + } + + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; + } + + /** + * Checks if the provided arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object)) { + var other = object[index]; + return value === value ? (value === other) : (other !== other); + } + return false; + } + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + var type = typeof value; + if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { + return true; + } + if (isArray(value)) { + return false; + } + var result = !reIsDeepProp.test(value); + return result || (object != null && value in toObject(object)); + } + + /** + * Checks if `func` has a lazy counterpart. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. + */ + function isLaziable(func) { + var funcName = getFuncName(func); + if (!(funcName in LazyWrapper.prototype)) { + return false; + } + var other = lodash[funcName]; + if (func === other) { + return true; + } + var data = getData(other); + return !!data && func === data[0]; + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ + function isStrictComparable(value) { + return value === value && !isObject(value); + } + + /** + * Merges the function metadata of `source` into `data`. + * + * Merging metadata reduces the number of wrappers required to invoke a function. + * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` + * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` + * augment function arguments, making the order in which they are executed important, + * preventing the merging of metadata. However, we make an exception for a safe + * common case where curried functions have `_.ary` and or `_.rearg` applied. + * + * @private + * @param {Array} data The destination metadata. + * @param {Array} source The source metadata. + * @returns {Array} Returns `data`. + */ + function mergeData(data, source) { + var bitmask = data[1], + srcBitmask = source[1], + newBitmask = bitmask | srcBitmask, + isCommon = newBitmask < ARY_FLAG; + + var isCombo = + (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) || + (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) || + (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG); + + // Exit early if metadata can't be merged. + if (!(isCommon || isCombo)) { + return data; + } + // Use source `thisArg` if available. + if (srcBitmask & BIND_FLAG) { + data[2] = source[2]; + // Set when currying a bound function. + newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG; + } + // Compose partial arguments. + var value = source[3]; + if (value) { + var partials = data[3]; + data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value); + data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]); + } + // Compose partial right arguments. + value = source[5]; + if (value) { + partials = data[5]; + data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value); + data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]); + } + // Use source `argPos` if available. + value = source[7]; + if (value) { + data[7] = arrayCopy(value); + } + // Use source `ary` if it's smaller. + if (srcBitmask & ARY_FLAG) { + data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); + } + // Use source `arity` if one is not provided. + if (data[9] == null) { + data[9] = source[9]; + } + // Use source `func` and merge bitmasks. + data[0] = source[0]; + data[1] = newBitmask; + + return data; + } + + /** + * Used by `_.defaultsDeep` to customize its `_.merge` use. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @returns {*} Returns the value to assign to the destination object. + */ + function mergeDefaults(objectValue, sourceValue) { + return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults); + } + + /** + * A specialized version of `_.pick` which picks `object` properties specified + * by `props`. + * + * @private + * @param {Object} object The source object. + * @param {string[]} props The property names to pick. + * @returns {Object} Returns the new object. + */ + function pickByArray(object, props) { + object = toObject(object); + + var index = -1, + length = props.length, + result = {}; + + while (++index < length) { + var key = props[index]; + if (key in object) { + result[key] = object[key]; + } + } + return result; + } + + /** + * A specialized version of `_.pick` which picks `object` properties `predicate` + * returns truthy for. + * + * @private + * @param {Object} object The source object. + * @param {Function} predicate The function invoked per iteration. + * @returns {Object} Returns the new object. + */ + function pickByCallback(object, predicate) { + var result = {}; + baseForIn(object, function(value, key, object) { + if (predicate(value, key, object)) { + result[key] = value; + } + }); + return result; + } + + /** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ + function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = arrayCopy(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; + } + + /** + * Sets metadata for `func`. + * + * **Note:** If this function becomes hot, i.e. is invoked a lot in a short + * period of time, it will trip its breaker and transition to an identity function + * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) + * for more details. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var setData = (function() { + var count = 0, + lastCalled = 0; + + return function(key, value) { + var stamp = now(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return key; + } + } else { + count = 0; + } + return baseSetData(key, value); + }; + }()); + + /** + * A fallback implementation of `Object.keys` which creates an array of the + * own enumerable property names of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function shimKeys(object) { + var props = keysIn(object), + propsLength = props.length, + length = propsLength && object.length; + + var allowIndexes = !!length && isLength(length) && + (isArray(object) || isArguments(object)); + + var index = -1, + result = []; + + while (++index < propsLength) { + var key = props[index]; + if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { + result.push(key); + } + } + return result; + } + + /** + * Converts `value` to an array-like object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array|Object} Returns the array-like object. + */ + function toIterable(value) { + if (value == null) { + return []; + } + if (!isArrayLike(value)) { + return values(value); + } + return isObject(value) ? value : Object(value); + } + + /** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ + function toObject(value) { + return isObject(value) ? value : Object(value); + } + + /** + * Converts `value` to property path array if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array} Returns the property path array. + */ + function toPath(value) { + if (isArray(value)) { + return value; + } + var result = []; + baseToString(value).replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + } + + /** + * Creates a clone of `wrapper`. + * + * @private + * @param {Object} wrapper The wrapper to clone. + * @returns {Object} Returns the cloned wrapper. + */ + function wrapperClone(wrapper) { + return wrapper instanceof LazyWrapper + ? wrapper.clone() + : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of elements split into groups the length of `size`. + * If `collection` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new array containing chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ + function chunk(array, size, guard) { + if (guard ? isIterateeCall(array, size, guard) : size == null) { + size = 1; + } else { + size = nativeMax(nativeFloor(size) || 1, 1); + } + var index = 0, + length = array ? array.length : 0, + resIndex = -1, + result = Array(nativeCeil(length / size)); + + while (index < length) { + result[++resIndex] = baseSlice(array, index, (index += size)); + } + return result; + } + + /** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ + function compact(array) { + var index = -1, + length = array ? array.length : 0, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[++resIndex] = value; + } + } + return result; + } + + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The arrays of values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.difference([1, 2, 3], [4, 2]); + * // => [1, 3] + */ + var difference = restParam(function(array, values) { + return (isObjectLike(array) && isArrayLike(array)) + ? baseDifference(array, baseFlatten(values, false, true)) + : []; + }); + + /** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function drop(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function dropRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that match the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [1] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active', false), 'user'); + * // => ['barney'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ + function dropRightWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, getCallback(predicate, thisArg, 3), true, true) + : []; + } + + /** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [3] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropWhile(users, 'active', false), 'user'); + * // => ['pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ + function dropWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, getCallback(predicate, thisArg, 3), true) + : []; + } + + /** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8], '*', 1, 2); + * // => [4, '*', 8] + */ + function fill(array, value, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); + } + + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(chr) { + * return chr.user == 'barney'; + * }); + * // => 0 + * + * // using the `_.matches` callback shorthand + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // using the `_.matchesProperty` callback shorthand + * _.findIndex(users, 'active', false); + * // => 0 + * + * // using the `_.property` callback shorthand + * _.findIndex(users, 'active'); + * // => 2 + */ + var findIndex = createFindIndex(); + + /** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(chr) { + * return chr.user == 'pebbles'; + * }); + * // => 2 + * + * // using the `_.matches` callback shorthand + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // using the `_.matchesProperty` callback shorthand + * _.findLastIndex(users, 'active', false); + * // => 2 + * + * // using the `_.property` callback shorthand + * _.findLastIndex(users, 'active'); + * // => 0 + */ + var findLastIndex = createFindIndex(true); + + /** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @alias head + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.first([1, 2, 3]); + * // => 1 + * + * _.first([]); + * // => undefined + */ + function first(array) { + return array ? array[0] : undefined; + } + + /** + * Flattens a nested array. If `isDeep` is `true` the array is recursively + * flattened, otherwise it is only flattened a single level. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to flatten. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, 3, [4]]]); + * // => [1, 2, 3, [4]] + * + * // using `isDeep` + * _.flatten([1, [2, 3, [4]]], true); + * // => [1, 2, 3, 4] + */ + function flatten(array, isDeep, guard) { + var length = array ? array.length : 0; + if (guard && isIterateeCall(array, isDeep, guard)) { + isDeep = false; + } + return length ? baseFlatten(array, isDeep) : []; + } + + /** + * Recursively flattens a nested array. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to recursively flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, 3, [4]]]); + * // => [1, 2, 3, 4] + */ + function flattenDeep(array) { + var length = array ? array.length : 0; + return length ? baseFlatten(array, true) : []; + } + + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` + * performs a faster binary search. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + * + * // performing a binary search + * _.indexOf([1, 1, 2, 2], 2, true); + * // => 2 + */ + function indexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + if (typeof fromIndex == 'number') { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; + } else if (fromIndex) { + var index = binaryIndex(array, value); + if (index < length && + (value === value ? (value === array[index]) : (array[index] !== array[index]))) { + return index; + } + return -1; + } + return baseIndexOf(array, value, fromIndex || 0); + } + + /** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ + function initial(array) { + return dropRight(array, 1); + } + + /** + * Creates an array of unique values that are included in all of the provided + * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of shared values. + * @example + * _.intersection([1, 2], [4, 2], [2, 1]); + * // => [2] + */ + var intersection = restParam(function(arrays) { + var othLength = arrays.length, + othIndex = othLength, + caches = Array(length), + indexOf = getIndexOf(), + isCommon = indexOf == baseIndexOf, + result = []; + + while (othIndex--) { + var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : []; + caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null; + } + var array = arrays[0], + index = -1, + length = array ? array.length : 0, + seen = caches[0]; + + outer: + while (++index < length) { + value = array[index]; + if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { + var othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) { + continue outer; + } + } + if (seen) { + seen.push(value); + } + result.push(value); + } + } + return result; + }); + + /** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ + function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; + } + + /** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=array.length-1] The index to search from + * or `true` to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // using `fromIndex` + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + * + * // performing a binary search + * _.lastIndexOf([1, 1, 2, 2], 2, true); + * // => 3 + */ + function lastIndexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = length; + if (typeof fromIndex == 'number') { + index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; + } else if (fromIndex) { + index = binaryIndex(array, value, true) - 1; + var other = array[index]; + if (value === value ? (value === other) : (other !== other)) { + return index; + } + return -1; + } + if (value !== value) { + return indexOfNaN(array, index, true); + } + while (index--) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * Removes all provided values from `array` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ + function pull() { + var args = arguments, + array = args[0]; + + if (!(array && array.length)) { + return array; + } + var index = 0, + indexOf = getIndexOf(), + length = args.length; + + while (++index < length) { + var fromIndex = 0, + value = args[index]; + + while ((fromIndex = indexOf(array, value, fromIndex)) > -1) { + splice.call(array, fromIndex, 1); + } + } + return array; + } + + /** + * Removes elements from `array` corresponding to the given indexes and returns + * an array of the removed elements. Indexes may be specified as an array of + * indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove, + * specified as individual indexes or arrays of indexes. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [5, 10, 15, 20]; + * var evens = _.pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ + var pullAt = restParam(function(array, indexes) { + indexes = baseFlatten(indexes); + + var result = baseAt(array, indexes); + basePullAt(array, indexes.sort(baseCompareAscending)); + return result; + }); + + /** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is bound to + * `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * **Note:** Unlike `_.filter`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; + * }); + * + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] + */ + function remove(array, predicate, thisArg) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; + + predicate = getCallback(predicate, thisArg, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; + } + + /** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @alias tail + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.rest([1, 2, 3]); + * // => [2, 3] + */ + function rest(array) { + return drop(array, 1); + } + + /** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of `Array#slice` to support node + * lists in IE < 9 and to ensure dense arrays are returned. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function slice(array, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + return baseSlice(array, start, end); + } + + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. If an iteratee + * function is provided it is invoked for `value` and each element of `array` + * to compute their sort ranking. The iteratee is bound to `thisArg` and + * invoked with one argument; (value). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 4, 5, 5], 5); + * // => 2 + * + * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } }; + * + * // using an iteratee function + * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) { + * return this.data[word]; + * }, dict); + * // => 1 + * + * // using the `_.property` callback shorthand + * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); + * // => 1 + */ + var sortedIndex = createSortedIndex(); + + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 4, 5, 5], 5); + * // => 4 + */ + var sortedLastIndex = createSortedIndex(true); + + /** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.take([1, 2, 3]); + * // => [1] + * + * _.take([1, 2, 3], 2); + * // => [1, 2] + * + * _.take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.take([1, 2, 3], 0); + * // => [] + */ + function take(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRight([1, 2, 3]); + * // => [3] + * + * _.takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * _.takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.takeRight([1, 2, 3], 0); + * // => [] + */ + function takeRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is bound to `thisArg` + * and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [2, 3] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active', false), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active'), 'user'); + * // => [] + */ + function takeRightWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, getCallback(predicate, thisArg, 3), false, true) + : []; + } + + /** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is bound to + * `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [1, 2] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false}, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeWhile(users, 'active', false), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeWhile(users, 'active'), 'user'); + * // => [] + */ + function takeWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, getCallback(predicate, thisArg, 3)) + : []; + } + + /** + * Creates an array of unique values, in order, from all of the provided arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([1, 2], [4, 2], [2, 1]); + * // => [1, 2, 4] + */ + var union = restParam(function(arrays) { + return baseUniq(baseFlatten(arrays, false, true)); + }); + + /** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurence of each element + * is kept. Providing `true` for `isSorted` performs a faster search algorithm + * for sorted arrays. If an iteratee function is provided it is invoked for + * each element in the array to generate the criterion by which uniqueness + * is computed. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index, array). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias unique + * @category Array + * @param {Array} array The array to inspect. + * @param {boolean} [isSorted] Specify the array is sorted. + * @param {Function|Object|string} [iteratee] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new duplicate-value-free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + * + * // using `isSorted` + * _.uniq([1, 1, 2], true); + * // => [1, 2] + * + * // using an iteratee function + * _.uniq([1, 2.5, 1.5, 2], function(n) { + * return this.floor(n); + * }, Math); + * // => [1, 2.5] + * + * // using the `_.property` callback shorthand + * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + function uniq(array, isSorted, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (isSorted != null && typeof isSorted != 'boolean') { + thisArg = iteratee; + iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted; + isSorted = false; + } + var callback = getCallback(); + if (!(iteratee == null && callback === baseCallback)) { + iteratee = callback(iteratee, thisArg, 3); + } + return (isSorted && getIndexOf() == baseIndexOf) + ? sortedUniq(array, iteratee) + : baseUniq(array, iteratee); + } + + /** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-zip + * configuration. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + * + * _.unzip(zipped); + * // => [['fred', 'barney'], [30, 40], [true, false]] + */ + function unzip(array) { + if (!(array && array.length)) { + return []; + } + var index = -1, + length = 0; + + array = arrayFilter(array, function(group) { + if (isArrayLike(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + var result = Array(length); + while (++index < length) { + result[index] = arrayMap(array, baseProperty(index)); + } + return result; + } + + /** + * This method is like `_.unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee] The function to combine regrouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + iteratee = bindCallback(iteratee, thisArg, 4); + return arrayMap(result, function(group) { + return arrayReduce(group, iteratee, undefined, true); + }); + } + + /** + * Creates an array excluding all provided values using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to filter. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.without([1, 2, 1, 3], 1, 2); + * // => [3] + */ + var without = restParam(function(array, values) { + return isArrayLike(array) + ? baseDifference(array, values) + : []; + }); + + /** + * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the provided arrays. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of values. + * @example + * + * _.xor([1, 2], [4, 2]); + * // => [1, 4] + */ + function xor() { + var index = -1, + length = arguments.length; + + while (++index < length) { + var array = arguments[index]; + if (isArrayLike(array)) { + var result = result + ? arrayPush(baseDifference(result, array), baseDifference(array, result)) + : array; + } + } + return result ? baseUniq(result) : []; + } + + /** + * Creates an array of grouped elements, the first of which contains the first + * elements of the given arrays, the second of which contains the second elements + * of the given arrays, and so on. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + */ + var zip = restParam(unzip); + + /** + * The inverse of `_.pairs`; this method returns an object composed from arrays + * of property names and values. Provide either a single two dimensional array, + * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names + * and one of corresponding values. + * + * @static + * @memberOf _ + * @alias object + * @category Array + * @param {Array} props The property names. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + * + * _.zipObject(['fred', 'barney'], [30, 40]); + * // => { 'fred': 30, 'barney': 40 } + */ + function zipObject(props, values) { + var index = -1, + length = props ? props.length : 0, + result = {}; + + if (length && !values && !isArray(props[0])) { + values = []; + } + while (++index < length) { + var key = props[index]; + if (values) { + result[key] = values[index]; + } else if (key) { + result[key[0]] = key[1]; + } + } + return result; + } + + /** + * This method is like `_.zip` except that it accepts an iteratee to specify + * how grouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], _.add); + * // => [111, 222] + */ + var zipWith = restParam(function(arrays) { + var length = arrays.length, + iteratee = length > 2 ? arrays[length - 2] : undefined, + thisArg = length > 1 ? arrays[length - 1] : undefined; + + if (length > 2 && typeof iteratee == 'function') { + length -= 2; + } else { + iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined; + thisArg = undefined; + } + arrays.length = length; + return unzipWith(arrays, iteratee, thisArg); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object that wraps `value` with explicit method + * chaining enabled. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _.chain(users) + * .sortBy('age') + * .map(function(chr) { + * return chr.user + ' is ' + chr.age; + * }) + * .first() + * .value(); + * // => 'pebbles is 1' + */ + function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; + } + + /** + * This method invokes `interceptor` and returns `value`. The interceptor is + * bound to `thisArg` and invoked with one argument; (value). The purpose of + * this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ + function tap(value, interceptor, thisArg) { + interceptor.call(thisArg, value); + return value; + } + + /** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ + function thru(value, interceptor, thisArg) { + return interceptor.call(thisArg, value); + } + + /** + * Enables explicit method chaining on the wrapper object. + * + * @name chain + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // without explicit chaining + * _(users).first(); + * // => { 'user': 'barney', 'age': 36 } + * + * // with explicit chaining + * _(users).chain() + * .first() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ + function wrapperChain() { + return chain(this); + } + + /** + * Executes the chained sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapped = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapped = wrapped.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapped.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ + function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); + } + + /** + * Creates a new array joining a wrapped array with any additional arrays + * and/or values. + * + * @name concat + * @memberOf _ + * @category Chain + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var wrapped = _(array).concat(2, [3], [[4]]); + * + * console.log(wrapped.value()); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + var wrapperConcat = restParam(function(values) { + values = baseFlatten(values); + return this.thru(function(array) { + return arrayConcat(isArray(array) ? array : [toObject(array)], values); + }); + }); + + /** + * Creates a clone of the chained sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapped = _(array).map(function(value) { + * return Math.pow(value, 2); + * }); + * + * var other = [3, 4]; + * var otherWrapped = wrapped.plant(other); + * + * otherWrapped.value(); + * // => [9, 16] + * + * wrapped.value(); + * // => [1, 4] + */ + function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; + } + + /** + * Reverses the wrapped array so the first element becomes the last, the + * second element becomes the second to last, and so on. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new reversed `lodash` wrapper instance. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function wrapperReverse() { + var value = this.__wrapped__; + + var interceptor = function(value) { + return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse(); + }; + if (value instanceof LazyWrapper) { + var wrapped = value; + if (this.__actions__.length) { + wrapped = new LazyWrapper(this); + } + wrapped = wrapped.reverse(); + wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); + return new LodashWrapper(wrapped, this.__chain__); + } + return this.thru(interceptor); + } + + /** + * Produces the result of coercing the unwrapped value to a string. + * + * @name toString + * @memberOf _ + * @category Chain + * @returns {string} Returns the coerced string value. + * @example + * + * _([1, 2, 3]).toString(); + * // => '1,2,3' + */ + function wrapperToString() { + return (this.value() + ''); + } + + /** + * Executes the chained sequence to extract the unwrapped value. + * + * @name value + * @memberOf _ + * @alias run, toJSON, valueOf + * @category Chain + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ + function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of elements corresponding to the given keys, or indexes, + * of `collection`. Keys may be specified as individual arguments or as arrays + * of keys. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(number|number[]|string|string[])} [props] The property names + * or indexes of elements to pick, specified individually or in arrays. + * @returns {Array} Returns the new array of picked elements. + * @example + * + * _.at(['a', 'b', 'c'], [0, 2]); + * // => ['a', 'c'] + * + * _.at(['barney', 'fred', 'pebbles'], 0, 2); + * // => ['barney', 'pebbles'] + */ + var at = restParam(function(collection, props) { + return baseAt(collection, baseFlatten(props)); + }); + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the number of times the key was returned by `iteratee`. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': 1, '6': 2 } + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': 1, '6': 2 } + * + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ + var countBy = createAggregator(function(result, value, key) { + hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); + }); + + /** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * The predicate is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias all + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.every(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.every(users, 'active'); + * // => false + */ + function every(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = undefined; + } + if (typeof predicate != 'function' || thisArg !== undefined) { + predicate = getCallback(predicate, thisArg, 3); + } + return func(collection, predicate); + } + + /** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias select + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.filter([4, 5, 6], function(n) { + * return n % 2 == 0; + * }); + * // => [4, 6] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.filter(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.filter(users, 'active'), 'user'); + * // => ['barney'] + */ + function filter(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = getCallback(predicate, thisArg, 3); + return func(collection, predicate); + } + + /** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias detect + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.result(_.find(users, function(chr) { + * return chr.age < 40; + * }), 'user'); + * // => 'barney' + * + * // using the `_.matches` callback shorthand + * _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); + * // => 'pebbles' + * + * // using the `_.matchesProperty` callback shorthand + * _.result(_.find(users, 'active', false), 'user'); + * // => 'fred' + * + * // using the `_.property` callback shorthand + * _.result(_.find(users, 'active'), 'user'); + * // => 'barney' + */ + var find = createFind(baseEach); + + /** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ + var findLast = createFind(baseEachRight, true); + + /** + * Performs a deep comparison between each element in `collection` and the + * source object, returning the first element that has equivalent property + * values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user'); + * // => 'barney' + * + * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user'); + * // => 'fred' + */ + function findWhere(collection, source) { + return find(collection, baseMatches(source)); + } + + /** + * Iterates over elements of `collection` invoking `iteratee` for each element. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early + * by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" property + * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` + * may be used for object iteration. + * + * @static + * @memberOf _ + * @alias each + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEach(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from left to right and returns the array + * + * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { + * console.log(n, key); + * }); + * // => logs each value-key pair and returns the object (iteration order is not guaranteed) + */ + var forEach = createForEach(arrayEach, baseEach); + + /** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias eachRight + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEachRight(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from right to left and returns the array + */ + var forEachRight = createForEach(arrayEachRight, baseEachRight); + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is an array of the elements responsible for generating the key. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * // using the `_.property` callback shorthand + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ + var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + result[key] = [value]; + } + }); + + /** + * Checks if `value` is in `collection` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `collection`. + * + * @static + * @memberOf _ + * @alias contains, include + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {*} target The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {boolean} Returns `true` if a matching element is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); + * // => true + * + * _.includes('pebbles', 'eb'); + * // => true + */ + function includes(collection, target, fromIndex, guard) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { + collection = values(collection); + length = collection.length; + } + if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { + fromIndex = 0; + } else { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); + } + return (typeof collection == 'string' || !isArray(collection) && isString(collection)) + ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) + : (!!length && getIndexOf(collection, target, fromIndex) > -1); + } + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the last element responsible for generating the key. The + * iteratee function is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var keyData = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.indexBy(keyData, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return String.fromCharCode(object.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return this.fromCharCode(object.code); + * }, String); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + */ + var indexBy = createAggregator(function(result, value, key) { + result[key] = value; + }); + + /** + * Invokes the method at `path` of each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `methodName` is a function it is + * invoked for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invoke([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ + var invoke = restParam(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + isProp = isKey(path), + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value) { + var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined); + result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); + }); + return result; + }); + + /** + * Creates an array of values by running each element in `collection` through + * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, + * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, + * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, + * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, + * `sum`, `uniq`, and `words` + * + * @static + * @memberOf _ + * @alias collect + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new mapped array. + * @example + * + * function timesThree(n) { + * return n * 3; + * } + * + * _.map([1, 2], timesThree); + * // => [3, 6] + * + * _.map({ 'a': 1, 'b': 2 }, timesThree); + * // => [3, 6] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // using the `_.property` callback shorthand + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ + function map(collection, iteratee, thisArg) { + var func = isArray(collection) ? arrayMap : baseMap; + iteratee = getCallback(iteratee, thisArg, 3); + return func(collection, iteratee); + } + + /** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, while the second of which + * contains elements `predicate` returns falsey for. The predicate is bound + * to `thisArg` and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * _.partition([1, 2, 3], function(n) { + * return n % 2; + * }); + * // => [[1, 3], [2]] + * + * _.partition([1.2, 2.3, 3.4], function(n) { + * return this.floor(n) % 2; + * }, Math); + * // => [[1.2, 3.4], [2.3]] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * var mapper = function(array) { + * return _.pluck(array, 'user'); + * }; + * + * // using the `_.matches` callback shorthand + * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper); + * // => [['pebbles'], ['barney', 'fred']] + * + * // using the `_.matchesProperty` callback shorthand + * _.map(_.partition(users, 'active', false), mapper); + * // => [['barney', 'pebbles'], ['fred']] + * + * // using the `_.property` callback shorthand + * _.map(_.partition(users, 'active'), mapper); + * // => [['fred'], ['barney', 'pebbles']] + */ + var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); + }, function() { return [[], []]; }); + + /** + * Gets the property value of `path` from all elements in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|string} path The path of the property to pluck. + * @returns {Array} Returns the property values. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * _.pluck(users, 'user'); + * // => ['barney', 'fred'] + * + * var userIndex = _.indexBy(users, 'user'); + * _.pluck(userIndex, 'age'); + * // => [36, 40] (iteration order is not guaranteed) + */ + function pluck(collection, path) { + return map(collection, property(path)); + } + + /** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` through `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not provided the first element of `collection` is used as the initial + * value. The `iteratee` is bound to `thisArg` and invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`, + * and `sortByOrder` + * + * @static + * @memberOf _ + * @alias foldl, inject + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * _.reduce([1, 2], function(total, n) { + * return total + n; + * }); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { + * result[key] = n * 3; + * return result; + * }, {}); + * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed) + */ + var reduce = createReduce(arrayReduce, baseEach); + + /** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias foldr + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ + var reduceRight = createReduce(arrayReduceRight, baseEachRight); + + /** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.reject([1, 2, 3, 4], function(n) { + * return n % 2 == 0; + * }); + * // => [1, 3] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.reject(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.reject(users, 'active'), 'user'); + * // => ['barney'] + */ + function reject(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = getCallback(predicate, thisArg, 3); + return func(collection, function(value, index, collection) { + return !predicate(value, index, collection); + }); + } + + /** + * Gets a random element or `n` random elements from a collection. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to sample. + * @param {number} [n] The number of elements to sample. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {*} Returns the random sample(s). + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + * + * _.sample([1, 2, 3, 4], 2); + * // => [3, 1] + */ + function sample(collection, n, guard) { + if (guard ? isIterateeCall(collection, n, guard) : n == null) { + collection = toIterable(collection); + var length = collection.length; + return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; + } + var index = -1, + result = toArray(collection), + length = result.length, + lastIndex = length - 1; + + n = nativeMin(n < 0 ? 0 : (+n || 0), length); + while (++index < n) { + var rand = baseRandom(index, lastIndex), + value = result[rand]; + + result[rand] = result[index]; + result[index] = value; + } + result.length = n; + return result; + } + + /** + * Creates an array of shuffled values, using a version of the + * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + * @example + * + * _.shuffle([1, 2, 3, 4]); + * // => [4, 1, 3, 2] + */ + function shuffle(collection) { + return sample(collection, POSITIVE_INFINITY); + } + + /** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable properties for objects. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the size of `collection`. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ + function size(collection) { + var length = collection ? getLength(collection) : 0; + return isLength(length) ? length : keys(collection).length; + } + + /** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * The function returns as soon as it finds a passing value and does not iterate + * over the entire collection. The predicate is bound to `thisArg` and invoked + * with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias any + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.some(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.some(users, 'active'); + * // => true + */ + function some(collection, predicate, thisArg) { + var func = isArray(collection) ? arraySome : baseSome; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = undefined; + } + if (typeof predicate != 'function' || thisArg !== undefined) { + predicate = getCallback(predicate, thisArg, 3); + } + return func(collection, predicate); + } + + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through `iteratee`. This method performs + * a stable sort, that is, it preserves the original sort order of equal elements. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new sorted array. + * @example + * + * _.sortBy([1, 2, 3], function(n) { + * return Math.sin(n); + * }); + * // => [3, 1, 2] + * + * _.sortBy([1, 2, 3], function(n) { + * return this.sin(n); + * }, Math); + * // => [3, 1, 2] + * + * var users = [ + * { 'user': 'fred' }, + * { 'user': 'pebbles' }, + * { 'user': 'barney' } + * ]; + * + * // using the `_.property` callback shorthand + * _.pluck(_.sortBy(users, 'user'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ + function sortBy(collection, iteratee, thisArg) { + if (collection == null) { + return []; + } + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = undefined; + } + var index = -1; + iteratee = getCallback(iteratee, thisArg, 3); + + var result = baseMap(collection, function(value, key, collection) { + return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value }; + }); + return baseSortBy(result, compareAscending); + } + + /** + * This method is like `_.sortBy` except that it can sort by multiple iteratees + * or property names. + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees + * The iteratees to sort by, specified as individual values or arrays of values. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.map(_.sortByAll(users, ['user', 'age']), _.values); + * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.map(_.sortByAll(users, 'user', function(chr) { + * return Math.floor(chr.age / 10); + * }), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + var sortByAll = restParam(function(collection, iteratees) { + if (collection == null) { + return []; + } + var guard = iteratees[2]; + if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) { + iteratees.length = 1; + } + return baseSortByOrder(collection, baseFlatten(iteratees), []); + }); + + /** + * This method is like `_.sortByAll` except that it allows specifying the + * sort orders of the iteratees to sort by. If `orders` is unspecified, all + * values are sorted in ascending order. Otherwise, a value is sorted in + * ascending order if its corresponding order is "asc", and descending if "desc". + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {boolean[]} [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + function sortByOrder(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (guard && isIterateeCall(iteratees, orders, guard)) { + orders = undefined; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseSortByOrder(collection, iteratees, orders); + } + + /** + * Performs a deep comparison between each element in `collection` and the + * source object, returning an array of all elements that have equivalent + * property values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {Array} Returns the new filtered array. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] }, + * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] } + * ]; + * + * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user'); + * // => ['barney'] + * + * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); + * // => ['fred'] + */ + function where(collection, source) { + return filter(collection, baseMatches(source)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch + * (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @category Date + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => logs the number of milliseconds it took for the deferred function to be invoked + */ + var now = nativeNow || function() { + return new Date().getTime(); + }; + + /*------------------------------------------------------------------------*/ + + /** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it is called `n` or more times. + * + * @static + * @memberOf _ + * @category Function + * @param {number} n The number of calls before `func` is invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var saves = ['profile', 'settings']; + * + * var done = _.after(saves.length, function() { + * console.log('done saving!'); + * }); + * + * _.forEach(saves, function(type) { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => logs 'done saving!' after the two async saves have completed + */ + function after(n, func) { + if (typeof func != 'function') { + if (typeof n == 'function') { + var temp = n; + n = func; + func = temp; + } else { + throw new TypeError(FUNC_ERROR_TEXT); + } + } + n = nativeIsFinite(n = +n) ? n : 0; + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; + } + + /** + * Creates a function that accepts up to `n` arguments ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to cap arguments for. + * @param {number} [n=func.length] The arity cap. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the new function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ + function ary(func, n, guard) { + if (guard && isIterateeCall(func, n, guard)) { + n = undefined; + } + n = (func && n == null) ? func.length : nativeMax(+n || 0, 0); + return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n); + } + + /** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it is called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery('#add').on('click', _.before(5, addContactToList)); + * // => allows adding up to 4 contacts to the list + */ + function before(n, func) { + var result; + if (typeof func != 'function') { + if (typeof n == 'function') { + var temp = n; + n = func; + func = temp; + } else { + throw new TypeError(FUNC_ERROR_TEXT); + } + } + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined; + } + return result; + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and prepends any additional `_.bind` arguments to those provided to the + * bound function. + * + * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for partially applied arguments. + * + * **Note:** Unlike native `Function#bind` this method does not set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var greet = function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * }; + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // using placeholders + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ + var bind = restParam(function(func, thisArg, partials) { + var bitmask = BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, bind.placeholder); + bitmask |= PARTIAL_FLAG; + } + return createWrapper(func, bitmask, thisArg, partials, holders); + }); + + /** + * Binds methods of an object to the object itself, overwriting the existing + * method. Method names may be specified as individual arguments or as arrays + * of method names. If no method names are provided all enumerable function + * properties, own and inherited, of `object` are bound. + * + * **Note:** This method does not set the "length" property of bound functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Object} object The object to bind and assign the bound methods to. + * @param {...(string|string[])} [methodNames] The object method names to bind, + * specified as individual method names or arrays of method names. + * @returns {Object} Returns `object`. + * @example + * + * var view = { + * 'label': 'docs', + * 'onClick': function() { + * console.log('clicked ' + this.label); + * } + * }; + * + * _.bindAll(view); + * jQuery('#docs').on('click', view.onClick); + * // => logs 'clicked docs' when the element is clicked + */ + var bindAll = restParam(function(object, methodNames) { + methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object); + + var index = -1, + length = methodNames.length; + + while (++index < length) { + var key = methodNames[index]; + object[key] = createWrapper(object[key], BIND_FLAG, object); + } + return object; + }); + + /** + * Creates a function that invokes the method at `object[key]` and prepends + * any additional `_.bindKey` arguments to those provided to the bound function. + * + * This method differs from `_.bind` by allowing bound functions to reference + * methods that may be redefined or don't yet exist. + * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * for more details. + * + * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * @static + * @memberOf _ + * @category Function + * @param {Object} object The object the method belongs to. + * @param {string} key The key of the method. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var object = { + * 'user': 'fred', + * 'greet': function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * }; + * + * var bound = _.bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function(greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // using placeholders + * var bound = _.bindKey(object, 'greet', _, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ + var bindKey = restParam(function(object, key, partials) { + var bitmask = BIND_FLAG | BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, bindKey.placeholder); + bitmask |= PARTIAL_FLAG; + } + return createWrapper(key, bitmask, object, partials, holders); + }); + + /** + * Creates a function that accepts one or more arguments of `func` that when + * called either invokes `func` returning its result, if all `func` arguments + * have been provided, or returns a function that accepts one or more of the + * remaining `func` arguments, and so on. The arity of `func` may be specified + * if `func.length` is not sufficient. + * + * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for provided arguments. + * + * **Note:** This method does not set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curry(abc); + * + * curried(1)(2)(3); + * // => [1, 2, 3] + * + * curried(1, 2)(3); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // using placeholders + * curried(1)(_, 3)(2); + * // => [1, 2, 3] + */ + var curry = createCurry(CURRY_FLAG); + + /** + * This method is like `_.curry` except that arguments are applied to `func` + * in the manner of `_.partialRight` instead of `_.partial`. + * + * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for provided arguments. + * + * **Note:** This method does not set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curryRight(abc); + * + * curried(3)(2)(1); + * // => [1, 2, 3] + * + * curried(2, 3)(1); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // using placeholders + * curried(3)(1, _)(2); + * // => [1, 2, 3] + */ + var curryRight = createCurry(CURRY_RIGHT_FLAG); + + /** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed invocations. Provide an options object to indicate that `func` + * should be invoked on the leading and/or trailing edge of the `wait` timeout. + * Subsequent calls to the debounced function return the result of the last + * `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked + * on the trailing edge of the timeout only if the the debounced function is + * invoked more than once during the `wait` timeout. + * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options] The options object. + * @param {boolean} [options.leading=false] Specify invoking on the leading + * edge of the timeout. + * @param {number} [options.maxWait] The maximum time `func` is allowed to be + * delayed before it is invoked. + * @param {boolean} [options.trailing=true] Specify invoking on the trailing + * edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // avoid costly calculations while the window size is in flux + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // invoke `sendMail` when the click event is fired, debouncing subsequent calls + * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // ensure `batchLog` is invoked once after 1 second of debounced calls + * var source = new EventSource('/stream'); + * jQuery(source).on('message', _.debounce(batchLog, 250, { + * 'maxWait': 1000 + * })); + * + * // cancel a debounced call + * var todoChanges = _.debounce(batchLog, 1000); + * Object.observe(models.todo, todoChanges); + * + * Object.observe(models, function(changes) { + * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) { + * todoChanges.cancel(); + * } + * }, ['delete']); + * + * // ...at some point `models.todo` is changed + * models.todo.completed = true; + * + * // ...before 1 second has passed `models.todo` is deleted + * // which cancels the debounced `todoChanges` call + * delete models.todo; + */ + function debounce(func, wait, options) { + var args, + maxTimeoutId, + result, + stamp, + thisArg, + timeoutId, + trailingCall, + lastCalled = 0, + maxWait = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = wait < 0 ? 0 : (+wait || 0); + if (options === true) { + var leading = true; + trailing = false; + } else if (isObject(options)) { + leading = !!options.leading; + maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait); + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function cancel() { + if (timeoutId) { + clearTimeout(timeoutId); + } + if (maxTimeoutId) { + clearTimeout(maxTimeoutId); + } + lastCalled = 0; + maxTimeoutId = timeoutId = trailingCall = undefined; + } + + function complete(isCalled, id) { + if (id) { + clearTimeout(id); + } + maxTimeoutId = timeoutId = trailingCall = undefined; + if (isCalled) { + lastCalled = now(); + result = func.apply(thisArg, args); + if (!timeoutId && !maxTimeoutId) { + args = thisArg = undefined; + } + } + } + + function delayed() { + var remaining = wait - (now() - stamp); + if (remaining <= 0 || remaining > wait) { + complete(trailingCall, maxTimeoutId); + } else { + timeoutId = setTimeout(delayed, remaining); + } + } + + function maxDelayed() { + complete(trailing, timeoutId); + } + + function debounced() { + args = arguments; + stamp = now(); + thisArg = this; + trailingCall = trailing && (timeoutId || !leading); + + if (maxWait === false) { + var leadingCall = leading && !timeoutId; + } else { + if (!maxTimeoutId && !leading) { + lastCalled = stamp; + } + var remaining = maxWait - (stamp - lastCalled), + isCalled = remaining <= 0 || remaining > maxWait; + + if (isCalled) { + if (maxTimeoutId) { + maxTimeoutId = clearTimeout(maxTimeoutId); + } + lastCalled = stamp; + result = func.apply(thisArg, args); + } + else if (!maxTimeoutId) { + maxTimeoutId = setTimeout(maxDelayed, remaining); + } + } + if (isCalled && timeoutId) { + timeoutId = clearTimeout(timeoutId); + } + else if (!timeoutId && wait !== maxWait) { + timeoutId = setTimeout(delayed, wait); + } + if (leadingCall) { + isCalled = true; + result = func.apply(thisArg, args); + } + if (isCalled && !timeoutId && !maxTimeoutId) { + args = thisArg = undefined; + } + return result; + } + debounced.cancel = cancel; + return debounced; + } + + /** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it is invoked. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke the function with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // logs 'deferred' after one or more milliseconds + */ + var defer = restParam(function(func, args) { + return baseDelay(func, 1, args); + }); + + /** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it is invoked. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {...*} [args] The arguments to invoke the function with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => logs 'later' after one second + */ + var delay = restParam(function(func, wait, args) { + return baseDelay(func, wait, args); + }); + + /** + * Creates a function that returns the result of invoking the provided + * functions with the `this` binding of the created function, where each + * successive invocation is supplied the return value of the previous. + * + * @static + * @memberOf _ + * @category Function + * @param {...Function} [funcs] Functions to invoke. + * @returns {Function} Returns the new function. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flow(_.add, square); + * addSquare(1, 2); + * // => 9 + */ + var flow = createFlow(); + + /** + * This method is like `_.flow` except that it creates a function that + * invokes the provided functions from right to left. + * + * @static + * @memberOf _ + * @alias backflow, compose + * @category Function + * @param {...Function} [funcs] Functions to invoke. + * @returns {Function} Returns the new function. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flowRight(square, _.add); + * addSquare(1, 2); + * // => 9 + */ + var flowRight = createFlow(true); + + /** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the + * cache key. The `func` is invoked with the `this` binding of the memoized + * function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) + * method interface of `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoizing function. + * @example + * + * var upperCase = _.memoize(function(string) { + * return string.toUpperCase(); + * }); + * + * upperCase('fred'); + * // => 'FRED' + * + * // modifying the result cache + * upperCase.cache.set('fred', 'BARNEY'); + * upperCase('fred'); + * // => 'BARNEY' + * + * // replacing `_.memoize.Cache` + * var object = { 'user': 'fred' }; + * var other = { 'user': 'barney' }; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'fred' } + * + * _.memoize.Cache = WeakMap; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'barney' } + */ + function memoize(func, resolver) { + if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result); + return result; + }; + memoized.cache = new memoize.Cache; + return memoized; + } + + /** + * Creates a function that runs each argument through a corresponding + * transform function. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to wrap. + * @param {...(Function|Function[])} [transforms] The functions to transform + * arguments, specified as individual functions or arrays of functions. + * @returns {Function} Returns the new function. + * @example + * + * function doubled(n) { + * return n * 2; + * } + * + * function square(n) { + * return n * n; + * } + * + * var modded = _.modArgs(function(x, y) { + * return [x, y]; + * }, square, doubled); + * + * modded(1, 2); + * // => [1, 4] + * + * modded(5, 10); + * // => [25, 20] + */ + var modArgs = restParam(function(func, transforms) { + transforms = baseFlatten(transforms); + if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = transforms.length; + return restParam(function(args) { + var index = nativeMin(args.length, length); + while (index--) { + args[index] = transforms[index](args[index]); + } + return func.apply(this, args); + }); + }); + + /** + * Creates a function that negates the result of the predicate `func`. The + * `func` predicate is invoked with the `this` binding and arguments of the + * created function. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} predicate The predicate to negate. + * @returns {Function} Returns the new function. + * @example + * + * function isEven(n) { + * return n % 2 == 0; + * } + * + * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); + * // => [1, 3, 5] + */ + function negate(predicate) { + if (typeof predicate != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function() { + return !predicate.apply(this, arguments); + }; + } + + /** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first call. The `func` is invoked + * with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // `initialize` invokes `createApplication` once + */ + function once(func) { + return before(2, func); + } + + /** + * Creates a function that invokes `func` with `partial` arguments prepended + * to those provided to the new function. This method is like `_.bind` except + * it does **not** alter the `this` binding. + * + * The `_.partial.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method does not set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * var greet = function(greeting, name) { + * return greeting + ' ' + name; + * }; + * + * var sayHelloTo = _.partial(greet, 'hello'); + * sayHelloTo('fred'); + * // => 'hello fred' + * + * // using placeholders + * var greetFred = _.partial(greet, _, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + */ + var partial = createPartial(PARTIAL_FLAG); + + /** + * This method is like `_.partial` except that partially applied arguments + * are appended to those provided to the new function. + * + * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method does not set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * var greet = function(greeting, name) { + * return greeting + ' ' + name; + * }; + * + * var greetFred = _.partialRight(greet, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + * + * // using placeholders + * var sayHelloTo = _.partialRight(greet, 'hello', _); + * sayHelloTo('fred'); + * // => 'hello fred' + */ + var partialRight = createPartial(PARTIAL_RIGHT_FLAG); + + /** + * Creates a function that invokes `func` with arguments arranged according + * to the specified indexes where the argument value at the first index is + * provided as the first argument, the argument value at the second index is + * provided as the second argument, and so on. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to rearrange arguments for. + * @param {...(number|number[])} indexes The arranged argument indexes, + * specified as individual indexes or arrays of indexes. + * @returns {Function} Returns the new function. + * @example + * + * var rearged = _.rearg(function(a, b, c) { + * return [a, b, c]; + * }, 2, 0, 1); + * + * rearged('b', 'c', 'a') + * // => ['a', 'b', 'c'] + * + * var map = _.rearg(_.map, [1, 0]); + * map(function(n) { + * return n * 3; + * }, [1, 2, 3]); + * // => [3, 6, 9] + */ + var rearg = restParam(function(func, indexes) { + return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes)); + }); + + /** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as an array. + * + * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.restParam(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ + function restParam(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + rest = Array(length); + + while (++index < length) { + rest[index] = args[start + index]; + } + switch (start) { + case 0: return func.call(this, rest); + case 1: return func.call(this, args[0], rest); + case 2: return func.call(this, args[0], args[1], rest); + } + var otherArgs = Array(start + 1); + index = -1; + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = rest; + return func.apply(this, otherArgs); + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of the created + * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). + * + * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator). + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to spread arguments over. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.spread(function(who, what) { + * return who + ' says ' + what; + * }); + * + * say(['fred', 'hello']); + * // => 'fred says hello' + * + * // with a Promise + * var numbers = Promise.all([ + * Promise.resolve(40), + * Promise.resolve(36) + * ]); + * + * numbers.then(_.spread(function(x, y) { + * return x + y; + * })); + * // => a Promise of 76 + */ + function spread(func) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function(array) { + return func.apply(this, array); + }; + } + + /** + * Creates a throttled function that only invokes `func` at most once per + * every `wait` milliseconds. The throttled function comes with a `cancel` + * method to cancel delayed invocations. Provide an options object to indicate + * that `func` should be invoked on the leading and/or trailing edge of the + * `wait` timeout. Subsequent calls to the throttled function return the + * result of the last `func` call. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked + * on the trailing edge of the timeout only if the the throttled function is + * invoked more than once during the `wait` timeout. + * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] The number of milliseconds to throttle invocations to. + * @param {Object} [options] The options object. + * @param {boolean} [options.leading=true] Specify invoking on the leading + * edge of the timeout. + * @param {boolean} [options.trailing=true] Specify invoking on the trailing + * edge of the timeout. + * @returns {Function} Returns the new throttled function. + * @example + * + * // avoid excessively updating the position while scrolling + * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); + * + * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes + * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { + * 'trailing': false + * })); + * + * // cancel a trailing throttled call + * jQuery(window).on('popstate', throttled.cancel); + */ + function throttle(func, wait, options) { + var leading = true, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (options === false) { + leading = false; + } else if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing }); + } + + /** + * Creates a function that provides `value` to the wrapper function as its + * first argument. Any additional arguments provided to the function are + * appended to those provided to the wrapper function. The wrapper is invoked + * with the `this` binding of the created function. + * + * @static + * @memberOf _ + * @category Function + * @param {*} value The value to wrap. + * @param {Function} wrapper The wrapper function. + * @returns {Function} Returns the new function. + * @example + * + * var p = _.wrap(_.escape, function(func, text) { + * return '

' + func(text) + '

'; + * }); + * + * p('fred, barney, & pebbles'); + * // => '

fred, barney, & pebbles

' + */ + function wrap(value, wrapper) { + wrapper = wrapper == null ? identity : wrapper; + return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, + * otherwise they are assigned by reference. If `customizer` is provided it is + * invoked to produce the cloned values. If `customizer` returns `undefined` + * cloning is handled by the method instead. The `customizer` is bound to + * `thisArg` and invoked with two argument; (value [, index|key, object]). + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). + * The enumerable properties of `arguments` objects and objects created by + * constructors other than `Object` are cloned to plain `Object` objects. An + * empty object is returned for uncloneable values such as functions, DOM nodes, + * Maps, Sets, and WeakMaps. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @param {Function} [customizer] The function to customize cloning values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {*} Returns the cloned value. + * @example + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * var shallow = _.clone(users); + * shallow[0] === users[0]; + * // => true + * + * var deep = _.clone(users, true); + * deep[0] === users[0]; + * // => false + * + * // using a customizer callback + * var el = _.clone(document.body, function(value) { + * if (_.isElement(value)) { + * return value.cloneNode(false); + * } + * }); + * + * el === document.body + * // => false + * el.nodeName + * // => BODY + * el.childNodes.length; + * // => 0 + */ + function clone(value, isDeep, customizer, thisArg) { + if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) { + isDeep = false; + } + else if (typeof isDeep == 'function') { + thisArg = customizer; + customizer = isDeep; + isDeep = false; + } + return typeof customizer == 'function' + ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1)) + : baseClone(value, isDeep); + } + + /** + * Creates a deep clone of `value`. If `customizer` is provided it is invoked + * to produce the cloned values. If `customizer` returns `undefined` cloning + * is handled by the method instead. The `customizer` is bound to `thisArg` + * and invoked with two argument; (value [, index|key, object]). + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). + * The enumerable properties of `arguments` objects and objects created by + * constructors other than `Object` are cloned to plain `Object` objects. An + * empty object is returned for uncloneable values such as functions, DOM nodes, + * Maps, Sets, and WeakMaps. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to deep clone. + * @param {Function} [customizer] The function to customize cloning values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {*} Returns the deep cloned value. + * @example + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * var deep = _.cloneDeep(users); + * deep[0] === users[0]; + * // => false + * + * // using a customizer callback + * var el = _.cloneDeep(document.body, function(value) { + * if (_.isElement(value)) { + * return value.cloneNode(true); + * } + * }); + * + * el === document.body + * // => false + * el.nodeName + * // => BODY + * el.childNodes.length; + * // => 20 + */ + function cloneDeep(value, customizer, thisArg) { + return typeof customizer == 'function' + ? baseClone(value, true, bindCallback(customizer, thisArg, 1)) + : baseClone(value, true); + } + + /** + * Checks if `value` is greater than `other`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. + * @example + * + * _.gt(3, 1); + * // => true + * + * _.gt(3, 3); + * // => false + * + * _.gt(1, 3); + * // => false + */ + function gt(value, other) { + return value > other; + } + + /** + * Checks if `value` is greater than or equal to `other`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`. + * @example + * + * _.gte(3, 1); + * // => true + * + * _.gte(3, 3); + * // => true + * + * _.gte(1, 3); + * // => false + */ + function gte(value, other) { + return value >= other; + } + + /** + * Checks if `value` is classified as an `arguments` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + function isArguments(value) { + return isObjectLike(value) && isArrayLike(value) && + hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); + } + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(function() { return arguments; }()); + * // => false + */ + var isArray = nativeIsArray || function(value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; + }; + + /** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ + function isBoolean(value) { + return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag); + } + + /** + * Checks if `value` is classified as a `Date` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isDate(new Date); + * // => true + * + * _.isDate('Mon April 23 2012'); + * // => false + */ + function isDate(value) { + return isObjectLike(value) && objToString.call(value) == dateTag; + } + + /** + * Checks if `value` is a DOM element. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * @example + * + * _.isElement(document.body); + * // => true + * + * _.isElement(''); + * // => false + */ + function isElement(value) { + return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); + } + + /** + * Checks if `value` is empty. A value is considered empty unless it is an + * `arguments` object, array, string, or jQuery-like collection with a length + * greater than `0` or an object with own enumerable properties. + * + * @static + * @memberOf _ + * @category Lang + * @param {Array|Object|string} value The value to inspect. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */ + function isEmpty(value) { + if (value == null) { + return true; + } + if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || + (isObjectLike(value) && isFunction(value.splice)))) { + return !value.length; + } + return !keys(value).length; + } + + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. If `customizer` is provided it is invoked to compare values. + * If `customizer` returns `undefined` comparisons are handled by the method + * instead. The `customizer` is bound to `thisArg` and invoked with three + * arguments: (value, other [, index|key]). + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. Functions and DOM nodes + * are **not** supported. Provide a customizer function to extend support + * for comparing other values. + * + * @static + * @memberOf _ + * @alias eq + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize value comparisons. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * object == other; + * // => false + * + * _.isEqual(object, other); + * // => true + * + * // using a customizer callback + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqual(array, other, function(value, other) { + * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) { + * return true; + * } + * }); + * // => true + */ + function isEqual(value, other, customizer, thisArg) { + customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; + var result = customizer ? customizer(value, other) : undefined; + return result === undefined ? baseIsEqual(value, other, customizer) : !!result; + } + + /** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ + function isError(value) { + return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag; + } + + /** + * Checks if `value` is a finite primitive number. + * + * **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @example + * + * _.isFinite(10); + * // => true + * + * _.isFinite('10'); + * // => false + * + * _.isFinite(true); + * // => false + * + * _.isFinite(Object(10)); + * // => false + * + * _.isFinite(Infinity); + * // => false + */ + function isFinite(value) { + return typeof value == 'number' && nativeIsFinite(value); + } + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; + } + + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. If `customizer` is provided + * it is invoked to compare values. If `customizer` returns `undefined` + * comparisons are handled by the method instead. The `customizer` is bound + * to `thisArg` and invoked with three arguments: (value, other, index|key). + * + * **Note:** This method supports comparing properties of arrays, booleans, + * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions + * and DOM nodes are **not** supported. Provide a customizer function to extend + * support for comparing other values. + * + * @static + * @memberOf _ + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize value comparisons. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + * + * // using a customizer callback + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatch(object, source, function(value, other) { + * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined; + * }); + * // => true + */ + function isMatch(object, source, customizer, thisArg) { + customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; + return baseIsMatch(object, getMatchData(source), customizer); + } + + /** + * Checks if `value` is `NaN`. + * + * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4) + * which returns `true` for `undefined` and other non-numeric values. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + * @example + * + * _.isNaN(NaN); + * // => true + * + * _.isNaN(new Number(NaN)); + * // => true + * + * isNaN(undefined); + * // => true + * + * _.isNaN(undefined); + * // => false + */ + function isNaN(value) { + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some host objects in IE. + return isNumber(value) && value != +value; + } + + /** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); + } + + /** + * Checks if `value` is `null`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `null`, else `false`. + * @example + * + * _.isNull(null); + * // => true + * + * _.isNull(void 0); + * // => false + */ + function isNull(value) { + return value === null; + } + + /** + * Checks if `value` is classified as a `Number` primitive or object. + * + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified + * as numbers, use the `_.isFinite` method. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isNumber(8.4); + * // => true + * + * _.isNumber(NaN); + * // => true + * + * _.isNumber('8.4'); + * // => false + */ + function isNumber(value) { + return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag); + } + + /** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * **Note:** This method assumes objects created by the `Object` constructor + * have no inherited enumerable properties. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ + function isPlainObject(value) { + var Ctor; + + // Exit early for non `Object` objects. + if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) || + (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { + return false; + } + // IE < 9 iterates inherited properties before own properties. If the first + // iterated property is an object's own property then there are no inherited + // enumerable properties. + var result; + // In most environments an object's own properties are iterated before + // its inherited properties. If the last iterated property is an object's + // own property then there are no inherited enumerable properties. + baseForIn(value, function(subValue, key) { + result = key; + }); + return result === undefined || hasOwnProperty.call(value, result); + } + + /** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ + function isRegExp(value) { + return isObject(value) && objToString.call(value) == regexpTag; + } + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag); + } + + /** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ + function isTypedArray(value) { + return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; + } + + /** + * Checks if `value` is `undefined`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ + function isUndefined(value) { + return value === undefined; + } + + /** + * Checks if `value` is less than `other`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. + * @example + * + * _.lt(1, 3); + * // => true + * + * _.lt(3, 3); + * // => false + * + * _.lt(3, 1); + * // => false + */ + function lt(value, other) { + return value < other; + } + + /** + * Checks if `value` is less than or equal to `other`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`. + * @example + * + * _.lte(1, 3); + * // => true + * + * _.lte(3, 3); + * // => true + * + * _.lte(3, 1); + * // => false + */ + function lte(value, other) { + return value <= other; + } + + /** + * Converts `value` to an array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * (function() { + * return _.toArray(arguments).slice(1); + * }(1, 2, 3)); + * // => [2, 3] + */ + function toArray(value) { + var length = value ? getLength(value) : 0; + if (!isLength(length)) { + return values(value); + } + if (!length) { + return []; + } + return arrayCopy(value); + } + + /** + * Converts `value` to a plain object flattening inherited enumerable + * properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */ + function toPlainObject(value) { + return baseCopy(value, keysIn(value)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Recursively merges own enumerable properties of the source object(s), that + * don't resolve to `undefined` into the destination object. Subsequent sources + * overwrite property assignments of previous sources. If `customizer` is + * provided it is invoked to produce the merged values of the destination and + * source properties. If `customizer` returns `undefined` merging is handled + * by the method instead. The `customizer` is bound to `thisArg` and invoked + * with five arguments: (objectValue, sourceValue, key, object, source). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {Object} Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } + * + * // using a customizer callback + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, function(a, b) { + * if (_.isArray(a)) { + * return a.concat(b); + * } + * }); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + var merge = createAssigner(baseMerge); + + /** + * Assigns own enumerable properties of source object(s) to the destination + * object. Subsequent sources overwrite property assignments of previous sources. + * If `customizer` is provided it is invoked to produce the assigned values. + * The `customizer` is bound to `thisArg` and invoked with five arguments: + * (objectValue, sourceValue, key, object, source). + * + * **Note:** This method mutates `object` and is based on + * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign). + * + * @static + * @memberOf _ + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {Object} Returns `object`. + * @example + * + * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); + * // => { 'user': 'fred', 'age': 40 } + * + * // using a customizer callback + * var defaults = _.partialRight(_.assign, function(value, other) { + * return _.isUndefined(value) ? other : value; + * }); + * + * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); + * // => { 'user': 'barney', 'age': 36 } + */ + var assign = createAssigner(function(object, source, customizer) { + return customizer + ? assignWith(object, source, customizer) + : baseAssign(object, source); + }); + + /** + * Creates an object that inherits from the given `prototype` object. If a + * `properties` object is provided its own enumerable properties are assigned + * to the created object. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Object} Returns the new object. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * function Circle() { + * Shape.call(this); + * } + * + * Circle.prototype = _.create(Shape.prototype, { + * 'constructor': Circle + * }); + * + * var circle = new Circle; + * circle instanceof Circle; + * // => true + * + * circle instanceof Shape; + * // => true + */ + function create(prototype, properties, guard) { + var result = baseCreate(prototype); + if (guard && isIterateeCall(prototype, properties, guard)) { + properties = undefined; + } + return properties ? baseAssign(result, properties) : result; + } + + /** + * Assigns own enumerable properties of source object(s) to the destination + * object for all destination properties that resolve to `undefined`. Once a + * property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); + * // => { 'user': 'barney', 'age': 36 } + */ + var defaults = createDefaults(assign, assignDefaults); + + /** + * This method is like `_.defaults` except that it recursively assigns + * default properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } }); + * // => { 'user': { 'name': 'barney', 'age': 36 } } + * + */ + var defaultsDeep = createDefaults(merge, mergeDefaults); + + /** + * This method is like `_.find` except that it returns the key of the first + * element `predicate` returns truthy for instead of the element itself. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {string|undefined} Returns the key of the matched element, else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findKey(users, function(chr) { + * return chr.age < 40; + * }); + * // => 'barney' (iteration order is not guaranteed) + * + * // using the `_.matches` callback shorthand + * _.findKey(users, { 'age': 1, 'active': true }); + * // => 'pebbles' + * + * // using the `_.matchesProperty` callback shorthand + * _.findKey(users, 'active', false); + * // => 'fred' + * + * // using the `_.property` callback shorthand + * _.findKey(users, 'active'); + * // => 'barney' + */ + var findKey = createFindKey(baseForOwn); + + /** + * This method is like `_.findKey` except that it iterates over elements of + * a collection in the opposite order. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {string|undefined} Returns the key of the matched element, else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findLastKey(users, function(chr) { + * return chr.age < 40; + * }); + * // => returns `pebbles` assuming `_.findKey` returns `barney` + * + * // using the `_.matches` callback shorthand + * _.findLastKey(users, { 'age': 36, 'active': true }); + * // => 'barney' + * + * // using the `_.matchesProperty` callback shorthand + * _.findLastKey(users, 'active', false); + * // => 'fred' + * + * // using the `_.property` callback shorthand + * _.findLastKey(users, 'active'); + * // => 'pebbles' + */ + var findLastKey = createFindKey(baseForOwnRight); + + /** + * Iterates over own and inherited enumerable properties of an object invoking + * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked + * with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forIn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed) + */ + var forIn = createForIn(baseFor); + + /** + * This method is like `_.forIn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forInRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c' + */ + var forInRight = createForIn(baseForRight); + + /** + * Iterates over own enumerable properties of an object invoking `iteratee` + * for each property. The `iteratee` is bound to `thisArg` and invoked with + * three arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => logs 'a' and 'b' (iteration order is not guaranteed) + */ + var forOwn = createForOwn(baseForOwn); + + /** + * This method is like `_.forOwn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwnRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b' + */ + var forOwnRight = createForOwn(baseForOwnRight); + + /** + * Creates an array of function property names from all enumerable properties, + * own and inherited, of `object`. + * + * @static + * @memberOf _ + * @alias methods + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the new array of property names. + * @example + * + * _.functions(_); + * // => ['after', 'ary', 'assign', ...] + */ + function functions(object) { + return baseFunctions(object, keysIn(object)); + } + + /** + * Gets the property value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, toPath(path), path + ''); + return result === undefined ? defaultValue : result; + } + + /** + * Checks if `path` is a direct property. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` is a direct property, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + */ + function has(object, path) { + if (object == null) { + return false; + } + var result = hasOwnProperty.call(object, path); + if (!result && !isKey(path)) { + path = toPath(path); + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + if (object == null) { + return false; + } + path = last(path); + result = hasOwnProperty.call(object, path); + } + return result || (isLength(object.length) && isIndex(path, object.length) && + (isArray(object) || isArguments(object))); + } + + /** + * Creates an object composed of the inverted keys and values of `object`. + * If `object` contains duplicate values, subsequent values overwrite property + * assignments of previous values unless `multiValue` is `true`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to invert. + * @param {boolean} [multiValue] Allow multiple values per key. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invert(object); + * // => { '1': 'c', '2': 'b' } + * + * // with `multiValue` + * _.invert(object, true); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ + function invert(object, multiValue, guard) { + if (guard && isIterateeCall(object, multiValue, guard)) { + multiValue = undefined; + } + var index = -1, + props = keys(object), + length = props.length, + result = {}; + + while (++index < length) { + var key = props[index], + value = object[key]; + + if (multiValue) { + if (hasOwnProperty.call(result, value)) { + result[value].push(key); + } else { + result[value] = [key]; + } + } + else { + result[value] = key; + } + } + return result; + } + + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + var keys = !nativeKeys ? shimKeys : function(object) { + var Ctor = object == null ? undefined : object.constructor; + if ((typeof Ctor == 'function' && Ctor.prototype === object) || + (typeof object != 'function' && isArrayLike(object))) { + return shimKeys(object); + } + return isObject(object) ? nativeKeys(object) : []; + }; + + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ + function keysIn(object) { + if (object == null) { + return []; + } + if (!isObject(object)) { + object = Object(object); + } + var length = object.length; + length = (length && isLength(length) && + (isArray(object) || isArguments(object)) && length) || 0; + + var Ctor = object.constructor, + index = -1, + isProto = typeof Ctor == 'function' && Ctor.prototype === object, + result = Array(length), + skipIndexes = length > 0; + + while (++index < length) { + result[index] = (index + ''); + } + for (var key in object) { + if (!(skipIndexes && isIndex(key, length)) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + /** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * property of `object` through `iteratee`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the new mapped object. + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + var mapKeys = createObjectMapper(true); + + /** + * Creates an object with the same keys as `object` and values generated by + * running each own enumerable property of `object` through `iteratee`. The + * iteratee function is bound to `thisArg` and invoked with three arguments: + * (value, key, object). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the new mapped object. + * @example + * + * _.mapValues({ 'a': 1, 'b': 2 }, function(n) { + * return n * 3; + * }); + * // => { 'a': 3, 'b': 6 } + * + * var users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * + * // using the `_.property` callback shorthand + * _.mapValues(users, 'age'); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + */ + var mapValues = createObjectMapper(); + + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {Function|...(string|string[])} [predicate] The function invoked per + * iteration or property names to omit, specified as individual property + * names or arrays of property names. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.omit(object, 'age'); + * // => { 'user': 'fred' } + * + * _.omit(object, _.isNumber); + * // => { 'user': 'fred' } + */ + var omit = restParam(function(object, props) { + if (object == null) { + return {}; + } + if (typeof props[0] != 'function') { + var props = arrayMap(baseFlatten(props), String); + return pickByArray(object, baseDifference(keysIn(object), props)); + } + var predicate = bindCallback(props[0], props[1], 3); + return pickByCallback(object, function(value, key, object) { + return !predicate(value, key, object); + }); + }); + + /** + * Creates a two dimensional array of the key-value pairs for `object`, + * e.g. `[[key1, value1], [key2, value2]]`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the new array of key-value pairs. + * @example + * + * _.pairs({ 'barney': 36, 'fred': 40 }); + * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) + */ + function pairs(object) { + object = toObject(object); + + var index = -1, + props = keys(object), + length = props.length, + result = Array(length); + + while (++index < length) { + var key = props[index]; + result[index] = [key, object[key]]; + } + return result; + } + + /** + * Creates an object composed of the picked `object` properties. Property + * names may be specified as individual arguments or as arrays of property + * names. If `predicate` is provided it is invoked for each property of `object` + * picking the properties `predicate` returns truthy for. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, key, object). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {Function|...(string|string[])} [predicate] The function invoked per + * iteration or property names to pick, specified as individual property + * names or arrays of property names. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.pick(object, 'user'); + * // => { 'user': 'fred' } + * + * _.pick(object, _.isString); + * // => { 'user': 'fred' } + */ + var pick = restParam(function(object, props) { + if (object == null) { + return {}; + } + return typeof props[0] == 'function' + ? pickByCallback(object, bindCallback(props[0], props[1], 3)) + : pickByArray(object, baseFlatten(props)); + }); + + /** + * This method is like `_.get` except that if the resolved value is a function + * it is invoked with the `this` binding of its parent object and its result + * is returned. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to resolve. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; + * + * _.result(object, 'a[0].b.c1'); + * // => 3 + * + * _.result(object, 'a[0].b.c2'); + * // => 4 + * + * _.result(object, 'a.b.c', 'default'); + * // => 'default' + * + * _.result(object, 'a.b.c', _.constant('default')); + * // => 'default' + */ + function result(object, path, defaultValue) { + var result = object == null ? undefined : object[path]; + if (result === undefined) { + if (object != null && !isKey(path, object)) { + path = toPath(path); + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + result = object == null ? undefined : object[last(path)]; + } + result = result === undefined ? defaultValue : result; + } + return isFunction(result) ? result.call(object) : result; + } + + /** + * Sets the property value of `path` on `object`. If a portion of `path` + * does not exist it is created. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to augment. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, 'x[0].y.z', 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + if (object == null) { + return object; + } + var pathKey = (path + ''); + path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = path[index]; + if (isObject(nested)) { + if (index == lastIndex) { + nested[key] = value; + } else if (nested[key] == null) { + nested[key] = isIndex(path[index + 1]) ? [] : {}; + } + } + nested = nested[key]; + } + return object; + } + + /** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own enumerable + * properties through `iteratee`, with each invocation potentially mutating + * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked + * with four arguments: (accumulator, value, key, object). Iteratee functions + * may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Array|Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) { + * result[key] = n * 3; + * }); + * // => { 'a': 3, 'b': 6 } + */ + function transform(object, iteratee, accumulator, thisArg) { + var isArr = isArray(object) || isTypedArray(object); + iteratee = getCallback(iteratee, thisArg, 4); + + if (accumulator == null) { + if (isArr || isObject(object)) { + var Ctor = object.constructor; + if (isArr) { + accumulator = isArray(object) ? new Ctor : []; + } else { + accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); + } + } else { + accumulator = {}; + } + } + (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) { + return iteratee(accumulator, value, index, object); + }); + return accumulator; + } + + /** + * Creates an array of the own enumerable property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ + function values(object) { + return baseValues(object, keys(object)); + } + + /** + * Creates an array of the own and inherited enumerable property values + * of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.valuesIn(new Foo); + * // => [1, 2, 3] (iteration order is not guaranteed) + */ + function valuesIn(object) { + return baseValues(object, keysIn(object)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Checks if `n` is between `start` and up to but not including, `end`. If + * `end` is not specified it is set to `start` with `start` then set to `0`. + * + * @static + * @memberOf _ + * @category Number + * @param {number} n The number to check. + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `n` is in the range, else `false`. + * @example + * + * _.inRange(3, 2, 4); + * // => true + * + * _.inRange(4, 8); + * // => true + * + * _.inRange(4, 2); + * // => false + * + * _.inRange(2, 2); + * // => false + * + * _.inRange(1.2, 2); + * // => true + * + * _.inRange(5.2, 4); + * // => false + */ + function inRange(value, start, end) { + start = +start || 0; + if (end === undefined) { + end = start; + start = 0; + } else { + end = +end || 0; + } + return value >= nativeMin(start, end) && value < nativeMax(start, end); + } + + /** + * Produces a random number between `min` and `max` (inclusive). If only one + * argument is provided a number between `0` and the given number is returned. + * If `floating` is `true`, or either `min` or `max` are floats, a floating-point + * number is returned instead of an integer. + * + * @static + * @memberOf _ + * @category Number + * @param {number} [min=0] The minimum possible value. + * @param {number} [max=1] The maximum possible value. + * @param {boolean} [floating] Specify returning a floating-point number. + * @returns {number} Returns the random number. + * @example + * + * _.random(0, 5); + * // => an integer between 0 and 5 + * + * _.random(5); + * // => also an integer between 0 and 5 + * + * _.random(5, true); + * // => a floating-point number between 0 and 5 + * + * _.random(1.2, 5.2); + * // => a floating-point number between 1.2 and 5.2 + */ + function random(min, max, floating) { + if (floating && isIterateeCall(min, max, floating)) { + max = floating = undefined; + } + var noMin = min == null, + noMax = max == null; + + if (floating == null) { + if (noMax && typeof min == 'boolean') { + floating = min; + min = 1; + } + else if (typeof max == 'boolean') { + floating = max; + noMax = true; + } + } + if (noMin && noMax) { + max = 1; + noMax = false; + } + min = +min || 0; + if (noMax) { + max = min; + min = 0; + } else { + max = +max || 0; + } + if (floating || min % 1 || max % 1) { + var rand = nativeRandom(); + return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max); + } + return baseRandom(min, max); + } + + /*------------------------------------------------------------------------*/ + + /** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the camel cased string. + * @example + * + * _.camelCase('Foo Bar'); + * // => 'fooBar' + * + * _.camelCase('--foo-bar'); + * // => 'fooBar' + * + * _.camelCase('__foo_bar__'); + * // => 'fooBar' + */ + var camelCase = createCompounder(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word); + }); + + /** + * Capitalizes the first character of `string`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('fred'); + * // => 'Fred' + */ + function capitalize(string) { + string = baseToString(string); + return string && (string.charAt(0).toUpperCase() + string.slice(1)); + } + + /** + * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ + function deburr(string) { + string = baseToString(string); + return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); + } + + /** + * Checks if `string` ends with the given target string. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to search. + * @param {string} [target] The string to search for. + * @param {number} [position=string.length] The position to search from. + * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. + * @example + * + * _.endsWith('abc', 'c'); + * // => true + * + * _.endsWith('abc', 'b'); + * // => false + * + * _.endsWith('abc', 'b', 2); + * // => true + */ + function endsWith(string, target, position) { + string = baseToString(string); + target = (target + ''); + + var length = string.length; + position = position === undefined + ? length + : nativeMin(position < 0 ? 0 : (+position || 0), length); + + position -= target.length; + return position >= 0 && string.indexOf(target, position) == position; + } + + /** + * Converts the characters "&", "<", ">", '"', "'", and "\`", in `string` to + * their corresponding HTML entities. + * + * **Note:** No other characters are escaped. To escape additional characters + * use a third-party library like [_he_](https://mths.be/he). + * + * Though the ">" character is escaped for symmetry, characters like + * ">" and "/" don't need escaping in HTML and have no special meaning + * unless they're part of a tag or unquoted attribute value. + * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * (under "semi-related fun fact") for more details. + * + * Backticks are escaped because in Internet Explorer < 9, they can break out + * of attribute values or HTML comments. See [#59](https://html5sec.org/#59), + * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and + * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) + * for more details. + * + * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) + * to reduce XSS vectors. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escape('fred, barney, & pebbles'); + * // => 'fred, barney, & pebbles' + */ + function escape(string) { + // Reset `lastIndex` because in IE < 9 `String#replace` does not. + string = baseToString(string); + return (string && reHasUnescapedHtml.test(string)) + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; + } + + /** + * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?", + * "*", "+", "(", ")", "[", "]", "{" and "}" in `string`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https:\/\/lodash\.com\/\)' + */ + function escapeRegExp(string) { + string = baseToString(string); + return (string && reHasRegExpChars.test(string)) + ? string.replace(reRegExpChars, escapeRegExpChar) + : (string || '(?:)'); + } + + /** + * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the kebab cased string. + * @example + * + * _.kebabCase('Foo Bar'); + * // => 'foo-bar' + * + * _.kebabCase('fooBar'); + * // => 'foo-bar' + * + * _.kebabCase('__foo_bar__'); + * // => 'foo-bar' + */ + var kebabCase = createCompounder(function(result, word, index) { + return result + (index ? '-' : '') + word.toLowerCase(); + }); + + /** + * Pads `string` on the left and right sides if it's shorter than `length`. + * Padding characters are truncated if they can't be evenly divided by `length`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.pad('abc', 8); + * // => ' abc ' + * + * _.pad('abc', 8, '_-'); + * // => '_-abc_-_' + * + * _.pad('abc', 3); + * // => 'abc' + */ + function pad(string, length, chars) { + string = baseToString(string); + length = +length; + + var strLength = string.length; + if (strLength >= length || !nativeIsFinite(length)) { + return string; + } + var mid = (length - strLength) / 2, + leftLength = nativeFloor(mid), + rightLength = nativeCeil(mid); + + chars = createPadding('', rightLength, chars); + return chars.slice(0, leftLength) + string + chars; + } + + /** + * Pads `string` on the left side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padLeft('abc', 6); + * // => ' abc' + * + * _.padLeft('abc', 6, '_-'); + * // => '_-_abc' + * + * _.padLeft('abc', 3); + * // => 'abc' + */ + var padLeft = createPadDir(); + + /** + * Pads `string` on the right side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padRight('abc', 6); + * // => 'abc ' + * + * _.padRight('abc', 6, '_-'); + * // => 'abc_-_' + * + * _.padRight('abc', 3); + * // => 'abc' + */ + var padRight = createPadDir(true); + + /** + * Converts `string` to an integer of the specified radix. If `radix` is + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, + * in which case a `radix` of `16` is used. + * + * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E) + * of `parseInt`. + * + * @static + * @memberOf _ + * @category String + * @param {string} string The string to convert. + * @param {number} [radix] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {number} Returns the converted integer. + * @example + * + * _.parseInt('08'); + * // => 8 + * + * _.map(['6', '08', '10'], _.parseInt); + * // => [6, 8, 10] + */ + function parseInt(string, radix, guard) { + // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. + // Chrome fails to trim leading whitespace characters. + // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. + if (guard ? isIterateeCall(string, radix, guard) : radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } + string = trim(string); + return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); + } + + /** + * Repeats the given string `n` times. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to repeat. + * @param {number} [n=0] The number of times to repeat the string. + * @returns {string} Returns the repeated string. + * @example + * + * _.repeat('*', 3); + * // => '***' + * + * _.repeat('abc', 2); + * // => 'abcabc' + * + * _.repeat('abc', 0); + * // => '' + */ + function repeat(string, n) { + var result = ''; + string = baseToString(string); + n = +n; + if (n < 1 || !string || !nativeIsFinite(n)) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + string += string; + } while (n); + + return result; + } + + /** + * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the snake cased string. + * @example + * + * _.snakeCase('Foo Bar'); + * // => 'foo_bar' + * + * _.snakeCase('fooBar'); + * // => 'foo_bar' + * + * _.snakeCase('--foo-bar'); + * // => 'foo_bar' + */ + var snakeCase = createCompounder(function(result, word, index) { + return result + (index ? '_' : '') + word.toLowerCase(); + }); + + /** + * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the start cased string. + * @example + * + * _.startCase('--foo-bar'); + * // => 'Foo Bar' + * + * _.startCase('fooBar'); + * // => 'Foo Bar' + * + * _.startCase('__foo_bar__'); + * // => 'Foo Bar' + */ + var startCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1)); + }); + + /** + * Checks if `string` starts with the given target string. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to search. + * @param {string} [target] The string to search for. + * @param {number} [position=0] The position to search from. + * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`. + * @example + * + * _.startsWith('abc', 'a'); + * // => true + * + * _.startsWith('abc', 'b'); + * // => false + * + * _.startsWith('abc', 'b', 1); + * // => true + */ + function startsWith(string, target, position) { + string = baseToString(string); + position = position == null + ? 0 + : nativeMin(position < 0 ? 0 : (+position || 0), string.length); + + return string.lastIndexOf(target, position) == position; + } + + /** + * Creates a compiled template function that can interpolate data properties + * in "interpolate" delimiters, HTML-escape interpolated data properties in + * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data + * properties may be accessed as free variables in the template. If a setting + * object is provided it takes precedence over `_.templateSettings` values. + * + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The template string. + * @param {Object} [options] The options object. + * @param {RegExp} [options.escape] The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate] The "evaluate" delimiter. + * @param {Object} [options.imports] An object to import into the template as free variables. + * @param {RegExp} [options.interpolate] The "interpolate" delimiter. + * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. + * @param {string} [options.variable] The data object variable name. + * @param- {Object} [otherOptions] Enables the legacy `options` param signature. + * @returns {Function} Returns the compiled template function. + * @example + * + * // using the "interpolate" delimiter to create a compiled template + * var compiled = _.template('hello <%= user %>!'); + * compiled({ 'user': 'fred' }); + * // => 'hello fred!' + * + * // using the HTML "escape" delimiter to escape data property values + * var compiled = _.template('<%- value %>'); + * compiled({ 'value': '