tungsten 0.1.17 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/tungsten/{_form_helpers.js → _form-helpers.js} +0 -0
  3. data/app/assets/javascripts/tungsten/enhancements/flash-messages.js +14 -0
  4. data/app/assets/javascripts/tungsten/enhancements/notify.js +89 -0
  5. data/app/assets/javascripts/tungsten/tungsten.js +5 -2
  6. data/app/assets/stylesheets/tungsten/components/_index.scss +2 -0
  7. data/app/assets/stylesheets/tungsten/components/_notices.scss +31 -0
  8. data/app/assets/stylesheets/tungsten/components/_notifications.scss +136 -0
  9. data/app/assets/stylesheets/tungsten/components/_tooltip.scss +22 -8
  10. data/app/assets/stylesheets/tungsten/core/_animations.scss +48 -0
  11. data/app/assets/stylesheets/tungsten/core/_globals.scss +15 -14
  12. data/app/assets/stylesheets/tungsten/core/_layout.scss +9 -1
  13. data/app/helpers/tungsten/notice_helper.rb +25 -0
  14. data/app/views/shared/tungsten/_flash-messages.html.slim +3 -3
  15. data/lib/tungsten/version.rb +1 -1
  16. data/public/{code-0.1.17.js → code-0.1.18.js} +1 -1
  17. data/public/{code-0.1.17.js.gz → code-0.1.18.js.gz} +0 -0
  18. data/public/{code-0.1.17.map.json → code-0.1.18.map.json} +0 -0
  19. data/public/{tungsten-0.1.17.css → tungsten-0.1.18.css} +256 -14
  20. data/public/tungsten-0.1.18.css.gz +0 -0
  21. data/public/{tungsten-0.1.17.js → tungsten-0.1.18.js} +43 -39
  22. data/public/tungsten-0.1.18.js.gz +0 -0
  23. data/public/tungsten-0.1.18.map.json +1 -0
  24. metadata +16 -12
  25. data/app/assets/javascripts/tungsten/enhancements/form-flash.js +0 -0
  26. data/public/tungsten-0.1.17.css.gz +0 -0
  27. data/public/tungsten-0.1.17.js.gz +0 -0
  28. data/public/tungsten-0.1.17.map.json +0 -1
Binary file
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["node_modules/browser-pack/_prelude.js","app/assets/javascripts/tungsten/_form-helpers.js","app/assets/javascripts/tungsten/_icons.js","app/assets/javascripts/tungsten/enhancements/clipboard.js","app/assets/javascripts/tungsten/enhancements/flash-messages.js","app/assets/javascripts/tungsten/enhancements/notify.js","app/assets/javascripts/tungsten/tungsten.js","node_modules/bean/bean.js","node_modules/component-emitter/index.js","node_modules/compose-event/index.js","node_modules/compose-event/lib/animation-events.js","node_modules/compose-event/lib/bubble-form-events.js","node_modules/compose-event/lib/callback-manager.js","node_modules/compose-event/lib/debounce.js","node_modules/compose-event/lib/delay.js","node_modules/compose-event/lib/media.js","node_modules/compose-event/lib/optimized-event-manager.js","node_modules/compose-event/lib/page.js","node_modules/compose-event/lib/repeat.js","node_modules/compose-event/lib/resize.js","node_modules/compose-event/lib/scroll.js","node_modules/compose-event/lib/shims/custom-event.js","node_modules/compose-event/lib/tap-events.js","node_modules/compose-event/lib/throttle.js","node_modules/compose-form-up/index.js","node_modules/compose-form-up/lib/progressive.js","node_modules/compose-form-up/lib/validation.js","node_modules/compose-slider/index.js","node_modules/compose-slider/lib/object.assign.js","node_modules/compose-toggler/index.js","node_modules/compose-toolbox/index.js","node_modules/compose-toolbox/lib/ease.js","node_modules/compose-toolbox/lib/fromtop.js","node_modules/compose-toolbox/lib/scrollto.js","node_modules/compose-toolbox/lib/shims/_classlist.js","node_modules/compose-toolbox/lib/shims/_object.assign.js","node_modules/keymaster/keymaster.js","node_modules/superagent/lib/client.js","node_modules/superagent/lib/is-object.js","node_modules/superagent/lib/request-base.js","node_modules/superagent/lib/request.js"],"names":["syncValue","input","target","classList","toggle","value","trim","length","toolbox","require","Event","event","textSelectors","change","each","document","querySelectorAll","on","embed","querySelector","insertAdjacentHTML","readyState","window","Turbolinks","addEventListener","clipboard","copy","console","log","copyTrigger","currentTarget","copyElement","dataset","copyTarget","preventDefault","select","execCommand","blur","add","setTimeout","remove","err","alert","module","exports","Notify","flash","type","textContent","notify","message","show","messageEl","dismiss","body","template","lastChild","innerHTML","defaults","defaultsByType","dismissAfter","timeout","delay","keyOne","one","callback","cb","clearTimeout","afterAnimation","parentNode","removeChild","normal","success","toggler","formUp","ajax","scroll","disablePointer","Tungsten","merge","form","name","context","definition","define","amd","this","selectorEngine","win","old","namespaceRegex","nameRegex","addEvent","doc","root","documentElement","W3C_MODEL","eventSupport","ONE","slice","Array","prototype","str2arr","s","d","split","isString","o","isFunction","isObject","buildOptions","originalDefaults","maybeOptions","key","hasOwnProperty","nativeEvents","hash","events","i","customEvents","isAncestor","element","container","compareDocumentPosition","nodeType","contains","check","related","relatedTarget","prefix","test","toString","mouseenter","base","condition","mouseleave","mousewheel","navigator","userAgent","commonProps","mouseProps","concat","mouseWheelProps","keyProps","textProps","touchProps","messageProps","stateProps","overOutRegex","typeFixers","reg","fix","newEvent","keyCode","which","rightClick","button","pos","x","y","pageX","pageY","clientX","clientY","scrollLeft","scrollTop","typeFixerMap","isNative","arguments","ownerDocument","parentWindow","originalEvent","isBean","l","p","props","fixer","srcElement","returnValue","stopPropagation","cancelBubble","stop","stopped","stopImmediatePropagation","isImmediatePropagationStopped","clone","ne","targetElement","RegEntry","wrappedHandler","fn","args","call","eargs","apply","findTarget","eventElement","__beanDel","ft","handler","original","namespaces","customType","once","removeListener","eventType","inNamespaces","checkNamespaces","j","c","matches","checkElement","checkOriginal","checkHandler","registry","map","forAll","pfx","list","all","t","charAt","substr","has","get","entries","entry","push","put","del","splice","removed","setSelectorEngine","e","r","Error","rootListener","propertyName","listeners","listener","custom","useCapture","attachEvent","detachEvent","rm","originalFn","orgType","replace","handlers","delegate","selector","array","match","fireListener","evt","createEvent","dispatchEvent","fireEvent","createEventObject","off","typeSpec","k","isTypeStr","defaultOpts","opts","indexOf","types","first","undefined","delfn","options","fire","names","from","beanDel","bean","noConflict","cleanup","CollectGarbage","Emitter","obj","mixin","_callbacks","removeAllListeners","removeEventListener","callbacks","emit","len","hasListeners","setEvent","forEach","animationEvent","transform","isEmpty","join","registerType","transformArgs","arg","keys","scope","unbind","el","getComputedStyle","getPropertyValue","transformedArgs","newEvents","shift","objEvents","touchstart","tap","a","Object","page","debounce","throttle","repeat","bubbleFormEvents","resize","callbackManager","media","formBubbling","ready","keyOn","keyOff","camelCaseEventTypes","animationstart","animationend","animationiteration","lowerCaseEventTypes","getAnimationEventTypes","prefixes","style","animationName","toLowerCase","transformAnimationEvents","cssAnimEventTypes","env","error","supported","formEls","fireBubble","detail","triggered","ev","CustomEvent","bubbles","cancelable","defaultPrevented","tagName","bubbleOn","bubbleOff","Manager","new","manager","start","bool","enabled","now","Date","pickFunction","found","candidate","wait","max","leading","trailing","leadingFn","trailingFn","queued","handle","lastCalled","lastInvoked","leadingBlocked","invoke","callType","addToQueue","requestAnimationFrame","loop","removeFromQueue","cancelAnimationFrame","maxPassed","waitReached","debounced","argsStart","queueDelay","complete","parseQuery","query","dimension","result","min","size","num","limit","toPx","width","listen","minWidth","maxWidth","height","minHeight","maxHeight","matchMedia","addListener","optimizedEventManager","run","running","started","toUpperCase","substring","readyAlready","changed","cancel","disableAnimation","head","pointerEvents","params","initCustomEvent","Tap","e1","done","e2","timeout_id","endEvents","touches","validation","progressive","validate","invalidateField","next","reset","formCallbacks","registeredForms","newForm","currentStep","steps","stepIndex","nextStep","active","disabled","forward","showStep","index","Number","step","direction","disable","revisit","disableOtherFieldsets","firstInput","focus","setNav","nav","enableFieldsets","fieldset","trigger","formEl","getClosest","fireCallbacks","getCallbacks","formData","filter","Callback","formSelector","watching","nextSelector","backSelector","createElement","checkValidity","validateForm","invalidInput","inputs","some","checkInput","showMessage","statusEl","valid","isValid","activeElement","setAttribute","checkValue","checkLength","setCustomValidity","invalidValue","regexp","escapedRegex","cachedMessage","invalidValueMessage","str","RegExp","checkCount","goal","lessThanGoal","wordCount","phrasing","display","nextSibling","submit","checkValidation","hideMessage","msg","label","validationMessage","existingMessage","invalidHandler","sliders","listening","Slider","self","refresh","slider","setLabels","setInput","setFill","setup","ranges","data","id","getAttribute","labels","externalLabels","assign","extractData","extractValues","getLabels","values","segments","camelCase","removeAttribute","inputClass","inputExists","getLineLabels","mark","getData","val","delimiter","external","default","labelCount","objectSize","lineLabels","containerHTML","templateHTML","classes","previousSibling","outerHTML","html","fills","labelTemplate","labelHTML","positionLabel","labelMeta","position","altKey","meta","attributes","nodeName","nodeValue","labelElements","internalSelector","externalSelector","sliderIndex","fill","offsetParent","labelEls","labelAtIndex","set","object","group","TypeError","output","source","nextKey","Toggler","checkboxSelector","radioSelector","selectSelector","hashChange","location","anchor","checked","getSelectFromOption","selectedIndex","ratchet","triggerToggling","toggleCheckboxes","setupSelects","setupRadios","actions","selectedOptions","action","dispatch","setClass","setState","selectors","sel","settings","classnames","classname","method","triggerTogglerEventsOnChildren","state","toggleAction","focusEl","hide","getLeafNodes","parent","hasChildNodes","getElementsByTagName","elem","children","eventName","leafChildNodes","node","checkboxes","radio","togglerActive","radioName","siblings","parentForm","showSelectors","dataAttributes","addClassSelectors","addClass","removeClass","option","parentElement","elements","attr","scrollTo","fromTop","ease","getNext","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","count","collection","rootEl","FormData","fields","field","append","inOutQuad","b","inOutCubic","inOutQuint","ts","tc","inOutCirc","Math","sqrt","round","getBoundingClientRect","top","pageYOffset","move","amount","to","duration","currentTime","animateScroll","testElement","createMethod","DOMTokenList","token","_toggle","force","view","elemCtrProto","Element","objCtr","strTrim","String","arrIndexOf","item","DOMEx","code","DOMException","checkTokenAndGetIndex","ClassList","trimmedClasses","_updateClassName","classListProto","classListGetter","tokens","iter","updated","defineProperty","classListPropDesc","enumerable","configurable","ex","number","__defineGetter__","global","compareArray","a1","a2","updateModifierKey","_mods","modifierMap","modifiersMatch","_downKeys","_MODIFIERS","assignKey","_handlers","getScope","mods","clearModifier","resetModifiers","getKeys","getMods","shortcut","unbindKey","multipleKeys","isPressed","getPressedKeyCodes","setScope","_scope","deleteScope","mi","previousKey","16","18","17","91","⇧","⌥","alt","⌃","ctrl","control","⌘","command","_MAP","backspace","tab","clear","enter","return","esc","escape","space","left","up","right","down","delete","home","end","pageup","pagedown",",",".","/","`","-","=",";","'","[","]","\\","charCodeAt","noop","serialize","pairs","pushEncodedKeyValuePair","isArray","v","subkey","encodeURIComponent","parseString","pair","decodeURIComponent","parseHeader","line","lines","pop","isJSON","mime","reduce","parts","Response","req","xhr","text","responseType","responseText","statusText","_setStatusProperties","status","header","headers","getAllResponseHeaders","getResponseHeader","_setHeaderProperties","_parseBody","response","Request","url","_query","_header","res","parse","rawResponse","statusCode","new_err","request","warn","requestBase","bind","getXHR","XMLHttpRequest","protocol","ActiveXObject","serializeObject","json","xml","urlencoded","form-data","application/x-www-form-urlencoded","application/json","JSON","stringify","ct","statusType","info","ok","clientError","serverError","toError","accepted","noContent","badRequest","unauthorized","notAcceptable","notFound","forbidden","_responseType","accept","auth","user","pass","btoa","username","password","attach","file","filename","_getFormData","_formData","_callback","crossDomainError","crossDomain","_timeoutError","_timeout","_appendQueryString","_data","onreadystatechange","timedout","_aborted","handleProgress","total","percent","loaded","onprogress","upload","_timer","abort","open","_withCredentials","withCredentials","_isHost","contentType","_serializer","setRequestHeader","send","patch","post","_parser","ms","then","resolve","reject","_fullfilledPromise","Promise","innerResolve","innerReject","catch","use","getHeader","unset","redirects","n","_maxRedirects","toJSON","RequestConstructor"],"mappings":"AAAA;YCIA,SAASA,WAAWC,GAGlBA,EAAUA,EAAMC,QAAUD,EAI1BA,EAAME,UAAUC,OAAQ,SAAUH,EAAMI,MAAMC,OAAOC,QAXvD,GAAIC,SAAUC,QAAS,mBACnBC,MAAQF,QAAQG,MAChBC,cAAgB,oJAapBF,OAAMG,OAAQ,WACZL,QAAQM,KAAMC,SAASC,iBAAkBJ,eAAiBZ,aAI5DU,MAAMO,GAAIF,SAAU,QAASH,cAAeZ;;cCpB5C,WAEE,QAASkB,KACFH,SAASI,cAAc,oBAC1BJ,SAASI,cAAc,QAAQC,mBAAmB,aAAc,oZAKzC,eAAvBL,SAASM,YAA+BH,IAGvCI,OAAOC,YACVR,S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duC;;ACjWT,QAASqtB,SAAQyF,EAAoB7S,EAAQ4M,GAE3C,MAAI,kBAAqBA,GAChB,GAAIiG,GAAmB,MAAO7S,GAAQyJ,IAAImD,GAI/C,GAAK3nB,UAAUjK,OACV,GAAI63B,GAAmB,MAAO7S,GAGhC,GAAI6S,GAAmB7S,EAAQ4M,GAGxCxvB,OAAOC,QAAU+vB","file":"bundle.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","var toolbox = require( 'compose-toolbox' )\nvar Event = toolbox.event\nvar textSelectors = 'textarea, input:not([type=radio]):not([type=checkbox]):not([type=range]):not([type=hidden]):not([type=submit]):not([type=image]):not([type=reset])'\n\nfunction syncValue( input ) {\n\n // Allow calling from event handler\n input = ( input.target || input )\n\n // If element is empty (or contains only whitespace)\n // Add empty class\n input.classList.toggle( 'empty', !input.value.trim().length )\n}\n\n// Initialize input state\nEvent.change( function() {\n toolbox.each( document.querySelectorAll( textSelectors ), syncValue )\n})\n\n// Set input state on keyup (debounced)\nEvent.on( document, 'input', textSelectors, syncValue )\n","(function(){\n\n function embed() {\n if (!document.querySelector('#esvg-svg-icons')) {\n document.querySelector('body').insertAdjacentHTML('afterbegin', '<svg id=\"esvg-svg-icons\" data-symbol-class=\"svg-symbol\" data-prefix=\"svg\" version=\"1.1\" style=\"height:0;position:absolute\"><symbol id=\"svg-deployment\" data-name=\"deployment\" viewBox=\"0 0 176 201\" width=\"176\" height=\"201\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" stroke-linejoin=\"round\" stroke-miterlimit=\"1.414\"><path d=\"M88 5.985l82.272 47.5v95L88 195.985l-82.272-47.5v-95L88 5.985z\"/></symbol></svg>')\n }\n }\n\n // If DOM is already ready, embed SVGs\n if (document.readyState == 'interactive') { embed() }\n\n // Handle Turbolinks page change events\n if ( window.Turbolinks ) {\n document.addEventListener(\"turbolinks:load\", function(event) { embed() })\n }\n\n // Handle standard DOM ready events\n document.addEventListener(\"DOMContentLoaded\", function(event) { embed() })\n})()","var event = require( 'compose-toolbox' ).event\n\n// Public API function\nvar clipboard = function() {\n\n // Listen for click events\n event.on( document, 'click', '[data-copy-target]', copy )\n\n // Copy to clipboard handler\n function copy( event ) {\n\n console.log( event )\n\n // Assignment\n var copyTrigger = event.currentTarget,\n copyElement = document.querySelector( copyTrigger.dataset.copyTarget )\n\n // Prevent default behavior\n event.preventDefault()\n\n // Is the element selectable?\n if ( copyElement && copyElement.select ) {\n\n // Select text\n copyElement.select();\n\n // Give it a try\n try {\n\n // Copy text\n document.execCommand( 'copy' )\n\n // Blur the element\n copyElement.blur()\n\n // Trigger copied state\n copyTrigger.classList.add( 'copied' )\n\n // Remove copied state after a couple seconds\n setTimeout( function() {\n copyTrigger.classList.remove( 'copied' )\n }, 2000 )\n\n // If it borks\n } catch ( err ) {\n\n // Go nuclear\n alert( 'please press Ctrl/Cmd+C to copy' )\n\n }\n\n }\n\n }\n}\n\nmodule.exports = clipboard\n","var Event = require('compose-event')\nvar Notify = require('./notify')\n\n// If a page has an element .form-flash, trigger a notification\n//\nEvent.change(function(){\n var flash = document.querySelector('.flash-message')\n if (flash) {\n flash.classList.add('hidden')\n var type = flash.dataset.type || 'error'\n Notify(type, flash.textContent.trim())\n }\n})\n\n","var Event = require( 'compose-event' )\n\nvar defaultsByType = {\n normal: { dismissAfter: 2500 },\n success: { dismissAfter: 2500 },\n}\n\n\nvar timeout, \n messageEl,\n template = '\\\n<div class=\"notification\">\\\n <div class=\"notification-content\">\\\n <div class=\"notification-message\" role=\"alert\"></div>\\\n <button class=\"notification-close\" href=\"#\" role=\"button\" aria-label=\"close message\">\\\n <span class=\"close-icon\" aria-hidden=\"true\"></span>\\\n </button>\\\n </div>\\\n</div>\\\n'\n\nfunction notify (type, message) {\n if ( !message ) {\n message = type\n type = null\n }\n\n return show( type, message )\n}\n\nfunction show ( type, message ) {\n if ( messageEl ) return dismiss( function(){ show( type, message ) })\n\n document.body.insertAdjacentHTML( 'beforeend', template )\n messageEl = document.body.lastChild\n\n messageEl.querySelector( '.notification-message' ).innerHTML = message\n\n if ( type ) {\n\n messageEl.classList.add( type )\n var defaults = defaultsByType[ type ]\n\n if ( defaults && defaults.dismissAfter ){\n timeout = Event.delay( dismiss, defaults.dismissAfter )\n }\n }\n\n messageEl = document.body.lastChild\n\n Event.keyOne( 'esc', dismiss )\n Event.one( messageEl, 'click', '.notification-close', dismiss )\n\n return {\n dismiss: dismiss\n }\n}\n\nfunction dismiss ( callback ) {\n\n var cb\n\n if ( typeof callback == 'function' ) {\n cb = function() { remove(); callback() }\n } else {\n cb = remove;\n }\n\n var timeout = Event.delay( cb, 500 )\n\n Event.one( messageEl, 'animationstart', function() {\n clearTimeout( timeout )\n\n Event.afterAnimation( messageEl, cb )\n })\n\n messageEl.classList.add( 'dismiss' )\n}\n\nfunction remove () {\n messageEl = document.querySelector('body > .notification')\n\n if (messageEl) {\n messageEl.parentNode.removeChild( messageEl )\n }\n messageEl = null\n}\n\nmodule.exports = notify\n","var toggler = require( 'compose-toggler' )\nvar formUp = require( 'compose-form-up' )\nvar toolbox = require( 'compose-toolbox' )\nvar ajax = require( 'superagent' )\nvar event = toolbox.event\nvar clipboard = require( './enhancements/clipboard' )\nvar notify = require( './enhancements/notify' )\n\nevent.scroll.disablePointer() // disable pointer events on scroll for performance (to avoid extra repaints)\nclipboard();\n\nrequire( 'compose-slider' ) // Our slider (range input) component\nrequire( './_icons' ) // Import svg icons (from Esvg)\nrequire( './_form-helpers' )\nrequire( './enhancements/flash-messages' )\n\n// Public API object\nwindow.Tungsten = module.exports = toolbox.merge( {\n ajax : ajax,\n form : formUp,\n toggler : toggler,\n clipboard : clipboard,\n notify : notify\n}, toolbox )\n","/*!\n * Bean - copyright (c) Jacob Thornton 2011-2012\n * https://github.com/fat/bean\n * MIT license\n */\n(function (name, context, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports = definition()\n else if (typeof define == 'function' && define.amd) define(definition)\n else context[name] = definition()\n})('bean', this, function (name, context) {\n name = name || 'bean'\n context = context || this\n\n var win = window\n , old = context[name]\n , namespaceRegex = /[^\\.]*(?=\\..*)\\.|.*/\n , nameRegex = /\\..*/\n , addEvent = 'addEventListener'\n , removeEvent = 'removeEventListener'\n , doc = document || {}\n , root = doc.documentElement || {}\n , W3C_MODEL = root[addEvent]\n , eventSupport = W3C_MODEL ? addEvent : 'attachEvent'\n , ONE = {} // singleton for quick matching making add() do one()\n\n , slice = Array.prototype.slice\n , str2arr = function (s, d) { return s.split(d || ' ') }\n , isString = function (o) { return typeof o == 'string' }\n , isFunction = function (o) { return typeof o == 'function' }\n , isObject = function (o) { return typeof o == 'object' }\n\n // Try to build an options object. If any key in `maybeOptions`\n // matches a key in `defaults`, it will be copied into a clone\n // of `defaults`, thus overriding the default.\n , buildOptions = function (originalDefaults, maybeOptions) {\n var defaults = {}\n\n for (var key in originalDefaults) {\n if (originalDefaults.hasOwnProperty(key)) {\n defaults[key] = originalDefaults[key];\n }\n }\n\n if (!isObject(maybeOptions)) {\n return defaults;\n }\n\n for (key in defaults) {\n if (defaults.hasOwnProperty(key) && maybeOptions.hasOwnProperty(key)) {\n defaults[key] = maybeOptions[key]\n }\n }\n\n return defaults\n }\n\n // events that we consider to be 'native', anything not in this list will\n // be treated as a custom event\n , standardNativeEvents =\n 'click dblclick mouseup mousedown contextmenu ' + // mouse buttons\n 'mousewheel mousemultiwheel DOMMouseScroll ' + // mouse wheel\n 'mouseover mouseout mousemove selectstart selectend ' + // mouse movement\n 'keydown keypress keyup ' + // keyboard\n 'orientationchange ' + // mobile\n 'focus blur change reset select submit ' + // form elements\n 'load unload beforeunload resize move DOMContentLoaded ' + // window\n 'readystatechange message ' + // window\n 'error abort scroll ' // misc\n // element.fireEvent('onXYZ'... is not forgiving if we try to fire an event\n // that doesn't actually exist, so make sure we only do these on newer browsers\n , w3cNativeEvents =\n 'show ' + // mouse buttons\n 'input invalid ' + // form elements\n 'touchstart touchmove touchend touchcancel ' + // touch\n 'gesturestart gesturechange gestureend ' + // gesture\n 'textinput ' + // TextEvent\n 'readystatechange pageshow pagehide popstate ' + // window\n 'hashchange offline online ' + // window\n 'afterprint beforeprint ' + // printing\n 'dragstart dragenter dragover dragleave drag drop dragend ' + // dnd\n 'loadstart progress suspend emptied stalled loadmetadata ' + // media\n 'loadeddata canplay canplaythrough playing waiting seeking ' + // media\n 'seeked ended durationchange timeupdate play pause ratechange ' + // media\n 'volumechange cuechange ' + // media\n 'checking noupdate downloading cached updateready obsolete ' // appcache\n\n // convert to a hash for quick lookups\n , nativeEvents = (function (hash, events, i) {\n for (i = 0; i < events.length; i++) events[i] && (hash[events[i]] = 1)\n return hash\n }({}, str2arr(standardNativeEvents + (W3C_MODEL ? w3cNativeEvents : ''))))\n\n // custom events are events that we *fake*, they are not provided natively but\n // we can use native events to generate them\n , customEvents = (function () {\n var isAncestor = 'compareDocumentPosition' in root\n ? function (element, container) {\n return container.compareDocumentPosition && (container.compareDocumentPosition(element) & 16) === 16\n }\n : 'contains' in root\n ? function (element, container) {\n container = container.nodeType === 9 || container === window ? root : container\n return container !== element && container.contains(element)\n }\n : function (element, container) {\n while (element = element.parentNode) if (element === container) return 1\n return 0\n }\n , check = function (event) {\n var related = event.relatedTarget\n return !related\n ? related == null\n : (related !== this && related.prefix !== 'xul' && !/document/.test(this.toString())\n && !isAncestor(related, this))\n }\n\n return {\n mouseenter: { base: 'mouseover', condition: check }\n , mouseleave: { base: 'mouseout', condition: check }\n , mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' }\n }\n }())\n\n // we provide a consistent Event object across browsers by taking the actual DOM\n // event object and generating a new one from its properties.\n , Event = (function () {\n // a whitelist of properties (for different event types) tells us what to check for and copy\n var commonProps = str2arr('altKey attrChange attrName bubbles cancelable ctrlKey currentTarget ' +\n 'detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey ' +\n 'srcElement target timeStamp type view which propertyName path')\n , mouseProps = commonProps.concat(str2arr('button buttons clientX clientY dataTransfer ' +\n 'fromElement offsetX offsetY pageX pageY screenX screenY toElement movementX movementY region'))\n , mouseWheelProps = mouseProps.concat(str2arr('wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ ' +\n 'axis')) // 'axis' is FF specific\n , keyProps = commonProps.concat(str2arr('char charCode key keyCode keyIdentifier ' +\n 'keyLocation location isComposing code'))\n , textProps = commonProps.concat(str2arr('data'))\n , touchProps = commonProps.concat(str2arr('touches targetTouches changedTouches scale rotation'))\n , messageProps = commonProps.concat(str2arr('data origin source'))\n , stateProps = commonProps.concat(str2arr('state'))\n , overOutRegex = /over|out/\n // some event types need special handling and some need special properties, do that all here\n , typeFixers = [\n { // key events\n reg: /key/i\n , fix: function (event, newEvent) {\n newEvent.keyCode = event.keyCode || event.which\n return keyProps\n }\n }\n , { // mouse events\n reg: /click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i\n , fix: function (event, newEvent, type) {\n newEvent.rightClick = event.which === 3 || event.button === 2\n newEvent.pos = { x: 0, y: 0 }\n if (event.pageX || event.pageY) {\n newEvent.clientX = event.pageX\n newEvent.clientY = event.pageY\n } else if (event.clientX || event.clientY) {\n newEvent.clientX = event.clientX + doc.body.scrollLeft + root.scrollLeft\n newEvent.clientY = event.clientY + doc.body.scrollTop + root.scrollTop\n }\n if (overOutRegex.test(type)) {\n newEvent.relatedTarget = event.relatedTarget\n || event[(type == 'mouseover' ? 'from' : 'to') + 'Element']\n }\n return mouseProps\n }\n }\n , { // mouse wheel events\n reg: /mouse.*(wheel|scroll)/i\n , fix: function () { return mouseWheelProps }\n }\n , { // TextEvent\n reg: /^text/i\n , fix: function () { return textProps }\n }\n , { // touch and gesture events\n reg: /^touch|^gesture/i\n , fix: function () { return touchProps }\n }\n , { // message events\n reg: /^message$/i\n , fix: function () { return messageProps }\n }\n , { // popstate events\n reg: /^popstate$/i\n , fix: function () { return stateProps }\n }\n , { // everything else\n reg: /.*/\n , fix: function () { return commonProps }\n }\n ]\n , typeFixerMap = {} // used to map event types to fixer functions (above), a basic cache mechanism\n\n , Event = function (event, element, isNative) {\n if (!arguments.length) return\n event = event || ((element.ownerDocument || element.document || element).parentWindow || win).event\n this.originalEvent = event\n this.isNative = isNative\n this.isBean = true\n\n if (!event) return\n\n var type = event.type\n , target = event.target || event.srcElement\n , i, l, p, props, fixer\n\n this.target = target && target.nodeType === 3 ? target.parentNode : target\n\n if (isNative) { // we only need basic augmentation on custom events, the rest expensive & pointless\n fixer = typeFixerMap[type]\n if (!fixer) { // haven't encountered this event type before, map a fixer function for it\n for (i = 0, l = typeFixers.length; i < l; i++) {\n if (typeFixers[i].reg.test(type)) { // guaranteed to match at least one, last is .*\n typeFixerMap[type] = fixer = typeFixers[i].fix\n break\n }\n }\n }\n\n props = fixer(event, this, type)\n for (i = props.length; i--;) {\n if (!((p = props[i]) in this) && p in event) this[p] = event[p]\n }\n }\n }\n\n // preventDefault() and stopPropagation() are a consistent interface to those functions\n // on the DOM, stop() is an alias for both of them together\n Event.prototype.preventDefault = function () {\n if (this.originalEvent.preventDefault) this.originalEvent.preventDefault()\n else this.originalEvent.returnValue = false\n }\n Event.prototype.stopPropagation = function () {\n if (this.originalEvent.stopPropagation) this.originalEvent.stopPropagation()\n else this.originalEvent.cancelBubble = true\n }\n Event.prototype.stop = function () {\n this.preventDefault()\n this.stopPropagation()\n this.stopped = true\n }\n // stopImmediatePropagation() has to be handled internally because we manage the event list for\n // each element\n // note that originalElement may be a Bean#Event object in some situations\n Event.prototype.stopImmediatePropagation = function () {\n if (this.originalEvent.stopImmediatePropagation) this.originalEvent.stopImmediatePropagation()\n this.isImmediatePropagationStopped = function () { return true }\n }\n Event.prototype.isImmediatePropagationStopped = function () {\n return this.originalEvent.isImmediatePropagationStopped && this.originalEvent.isImmediatePropagationStopped()\n }\n Event.prototype.clone = function (currentTarget) {\n //TODO: this is ripe for optimisation, new events are *expensive*\n // improving this will speed up delegated events\n var ne = new Event(this, this.element, this.isNative)\n ne.currentTarget = currentTarget\n return ne\n }\n\n return Event\n }())\n\n // if we're in old IE we can't do onpropertychange on doc or win so we use doc.documentElement for both\n , targetElement = function (element, isNative) {\n return !W3C_MODEL && !isNative && (element === doc || element === win) ? root : element\n }\n\n /**\n * Bean maintains an internal registry for event listeners. We don't touch elements, objects\n * or functions to identify them, instead we store everything in the registry.\n * Each event listener has a RegEntry object, we have one 'registry' for the whole instance.\n */\n , RegEntry = (function () {\n // each handler is wrapped so we can handle delegation and custom events\n var wrappedHandler = function (element, fn, condition, args) {\n var call = function (event, eargs) {\n return fn.apply(element, args ? slice.call(eargs, event ? 0 : 1).concat(args) : eargs)\n }\n , findTarget = function (event, eventElement) {\n return fn.__beanDel ? fn.__beanDel.ft(event.target, element) : eventElement\n }\n , handler = condition\n ? function (event) {\n var target = findTarget(event, this) // deleated event\n if (condition.apply(target, arguments)) {\n if (event) event.currentTarget = target\n return call(event, arguments)\n }\n }\n : function (event) {\n if (fn.__beanDel) event = event.clone(findTarget(event)) // delegated event, fix the fix\n return call(event, arguments)\n }\n handler.__beanDel = fn.__beanDel\n return handler\n }\n\n , RegEntry = function (element, type, handler, original, namespaces, args, root) {\n var customType = customEvents[type]\n , isNative\n\n if (type == 'unload') {\n // self clean-up\n handler = once(removeListener, element, type, handler, original)\n }\n\n if (customType) {\n if (customType.condition) {\n handler = wrappedHandler(element, handler, customType.condition, args)\n }\n type = customType.base || type\n }\n\n this.isNative = isNative = nativeEvents[type] && !!element[eventSupport]\n this.customType = !W3C_MODEL && !isNative && type\n this.element = element\n this.type = type\n this.original = original\n this.namespaces = namespaces\n this.eventType = W3C_MODEL || isNative ? type : 'propertychange'\n this.target = targetElement(element, isNative)\n this[eventSupport] = !!this.target[eventSupport]\n this.root = root\n this.handler = wrappedHandler(element, handler, null, args)\n }\n\n // given a list of namespaces, is our entry in any of them?\n RegEntry.prototype.inNamespaces = function (checkNamespaces) {\n var i, j, c = 0\n if (!checkNamespaces) return true\n if (!this.namespaces) return false\n for (i = checkNamespaces.length; i--;) {\n for (j = this.namespaces.length; j--;) {\n if (checkNamespaces[i] == this.namespaces[j]) c++\n }\n }\n return checkNamespaces.length === c\n }\n\n // match by element, original fn (opt), handler fn (opt)\n RegEntry.prototype.matches = function (checkElement, checkOriginal, checkHandler) {\n return this.element === checkElement &&\n (!checkOriginal || this.original === checkOriginal) &&\n (!checkHandler || this.handler === checkHandler)\n }\n\n return RegEntry\n }())\n\n , registry = (function () {\n // our map stores arrays by event type, just because it's better than storing\n // everything in a single array.\n // uses '$' as a prefix for the keys for safety and 'r' as a special prefix for\n // rootListeners so we can look them up fast\n var map = {}\n\n // generic functional search of our registry for matching listeners,\n // `fn` returns false to break out of the loop\n , forAll = function (element, type, original, handler, root, fn) {\n var pfx = root ? 'r' : '$'\n if (!type || type == '*') {\n // search the whole registry\n for (var t in map) {\n if (t.charAt(0) == pfx) {\n forAll(element, t.substr(1), original, handler, root, fn)\n }\n }\n } else {\n var i = 0, l, list = map[pfx + type], all = element == '*'\n if (!list) return\n for (l = list.length; i < l; i++) {\n if ((all || list[i].matches(element, original, handler)) && !fn(list[i], list, i, type)) return\n }\n }\n }\n\n , has = function (element, type, original, root) {\n // we're not using forAll here simply because it's a bit slower and this\n // needs to be fast\n var i, list = map[(root ? 'r' : '$') + type]\n if (list) {\n for (i = list.length; i--;) {\n if (!list[i].root && list[i].matches(element, original, null)) return true\n }\n }\n return false\n }\n\n , get = function (element, type, original, root) {\n var entries = []\n forAll(element, type, original, null, root, function (entry) {\n return entries.push(entry)\n })\n return entries\n }\n\n , put = function (entry) {\n var has = !entry.root && !this.has(entry.element, entry.type, null, false)\n , key = (entry.root ? 'r' : '$') + entry.type\n ;(map[key] || (map[key] = [])).push(entry)\n return has\n }\n\n , del = function (entry) {\n forAll(entry.element, entry.type, null, entry.handler, entry.root, function (entry, list, i) {\n list.splice(i, 1)\n entry.removed = true\n if (list.length === 0) delete map[(entry.root ? 'r' : '$') + entry.type]\n return false\n })\n }\n\n // dump all entries, used for onunload\n , entries = function () {\n var t, entries = []\n for (t in map) {\n if (t.charAt(0) == '$') entries = entries.concat(map[t])\n }\n return entries\n }\n\n return { has: has, get: get, put: put, del: del, entries: entries }\n }())\n\n // we need a selector engine for delegated events, use querySelectorAll if it exists\n // but for older browsers we need Qwery, Sizzle or similar\n , selectorEngine\n , setSelectorEngine = function (e) {\n if (!arguments.length) {\n selectorEngine = doc.querySelectorAll\n ? function (s, r) {\n return r.querySelectorAll(s)\n }\n : function () {\n throw new Error('Bean: No selector engine installed') // eeek\n }\n } else {\n selectorEngine = e\n }\n }\n\n // we attach this listener to each DOM event that we need to listen to, only once\n // per event type per DOM element\n , rootListener = function (event, type) {\n if (!W3C_MODEL && type && event && event.propertyName != '_on' + type) return\n\n var listeners = registry.get(this, type || event.type, null, false)\n , l = listeners.length\n , i = 0\n\n event = new Event(event, this, true)\n if (type) event.type = type\n\n // iterate through all handlers registered for this type, calling them unless they have\n // been removed by a previous handler or stopImmediatePropagation() has been called\n for (; i < l && !event.isImmediatePropagationStopped(); i++) {\n if (!listeners[i].removed) listeners[i].handler.call(this, event)\n }\n }\n\n // add and remove listeners to DOM elements\n , listener = W3C_MODEL\n ? function (element, type, add, custom, useCapture) {\n // new browsers\n element[add ? addEvent : removeEvent](type, rootListener, useCapture)\n }\n : function (element, type, add, custom /*, useCapture */) {\n // IE8 and below, use attachEvent/detachEvent and we have to piggy-back propertychange events\n // to simulate event bubbling etc.\n var entry\n if (add) {\n registry.put(entry = new RegEntry(\n element\n , custom || type\n , function (event) { // handler\n rootListener.call(element, event, custom)\n }\n , rootListener\n , null\n , null\n , true // is root\n ))\n if (custom && element['_on' + custom] == null) element['_on' + custom] = 0\n entry.target.attachEvent('on' + entry.eventType, entry.handler)\n } else {\n entry = registry.get(element, custom || type, rootListener, true)[0]\n if (entry) {\n entry.target.detachEvent('on' + entry.eventType, entry.handler)\n registry.del(entry)\n }\n }\n }\n\n , once = function (rm, element, type, fn, originalFn) {\n // wrap the handler in a handler that does a remove as well\n return function () {\n fn.apply(this, arguments)\n rm(element, type, originalFn)\n }\n }\n\n , removeListener = function (element, orgType, handler, namespaces, useCapture) {\n var type = orgType && orgType.replace(nameRegex, '')\n , handlers = registry.get(element, type, null, false)\n , removed = {}\n , i, l\n\n for (i = 0, l = handlers.length; i < l; i++) {\n if ((!handler || handlers[i].original === handler) && handlers[i].inNamespaces(namespaces)) {\n // TODO: this is problematic, we have a registry.get() and registry.del() that\n // both do registry searches so we waste cycles doing this. Needs to be rolled into\n // a single registry.forAll(fn) that removes while finding, but the catch is that\n // we'll be splicing the arrays that we're iterating over. Needs extra tests to\n // make sure we don't screw it up. @rvagg\n registry.del(handlers[i])\n if (!removed[handlers[i].eventType] && handlers[i][eventSupport])\n removed[handlers[i].eventType] = { t: handlers[i].eventType, c: handlers[i].type }\n }\n }\n // check each type/element for removed listeners and remove the rootListener where it's no longer needed\n for (i in removed) {\n if (!registry.has(element, removed[i].t, null, false)) {\n // last listener of this type, remove the rootListener\n listener(element, removed[i].t, false, removed[i].c, useCapture)\n }\n }\n }\n\n // set up a delegate helper using the given selector, wrap the handler function\n , delegate = function (selector, fn) {\n //TODO: findTarget (therefore $) is called twice, once for match and once for\n // setting e.currentTarget, fix this so it's only needed once\n var findTarget = function (target, root) {\n var i, array = isString(selector) ? selectorEngine(selector, root) : selector\n for (; target && target !== root; target = target.parentNode) {\n for (i = array.length; i--;) {\n if (array[i] === target) return target\n }\n }\n }\n , handler = function (e) {\n var match = findTarget(e.target, this)\n if (match) fn.apply(match, arguments)\n }\n\n // __beanDel isn't pleasant but it's a private function, not exposed outside of Bean\n handler.__beanDel = {\n ft : findTarget // attach it here for customEvents to use too\n , selector : selector\n }\n return handler\n }\n\n , fireListener = W3C_MODEL ? function (isNative, type, element) {\n // modern browsers, do a proper dispatchEvent()\n var evt = doc.createEvent(isNative ? 'HTMLEvents' : 'UIEvents')\n evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, win, 1)\n element.dispatchEvent(evt)\n } : function (isNative, type, element) {\n // old browser use onpropertychange, just increment a custom property to trigger the event\n element = targetElement(element, isNative)\n isNative ? element.fireEvent('on' + type, doc.createEventObject()) : element['_on' + type]++\n }\n\n /**\n * Public API: off(), on(), add(), (remove()), one(), fire(), clone()\n */\n\n /**\n * off(element[, eventType(s)[, handler ], options])\n */\n , off = function (element, typeSpec, fn) {\n var isTypeStr = isString(typeSpec),\n defaultOpts = {\n useCapture: false\n }\n , opts = buildOptions(defaultOpts, arguments[arguments.length - 1])\n , k, type, namespaces, i\n\n if (isTypeStr && typeSpec.indexOf(' ') > 0) {\n // off(el, 't1 t2 t3', fn) or off(el, 't1 t2 t3')\n typeSpec = str2arr(typeSpec)\n for (i = typeSpec.length; i--;)\n off(element, typeSpec[i], fn)\n return element\n }\n\n type = isTypeStr && typeSpec.replace(nameRegex, '')\n if (type && customEvents[type]) type = customEvents[type].base\n\n if (!typeSpec || isTypeStr) {\n // off(el) or off(el, t1.ns) or off(el, .ns) or off(el, .ns1.ns2.ns3)\n if (namespaces = isTypeStr && typeSpec.replace(namespaceRegex, '')) namespaces = str2arr(namespaces, '.')\n removeListener(element, type, fn, namespaces, opts.useCapture)\n } else if (isFunction(typeSpec)) {\n // off(el, fn)\n removeListener(element, null, typeSpec, null, opts.useCapture)\n } else {\n // off(el, { t1: fn1, t2, fn2 })\n for (k in typeSpec) {\n if (typeSpec.hasOwnProperty(k)) off(element, k, typeSpec[k])\n }\n }\n\n return element\n }\n\n /**\n * on(element, eventType(s)[, selector], handler[, args ], [options])\n */\n , on = function(element, events, selector, fn) {\n var defaultOpts = {\n useCapture: false\n },\n originalFn, type, types, i, args, entry, first, opts\n\n //TODO: the undefined check means you can't pass an 'args' argument, fix this perhaps?\n if (selector === undefined && typeof events == 'object') {\n //TODO: this can't handle delegated events\n for (type in events) {\n if (events.hasOwnProperty(type)) {\n on.call(this, element, type, events[type])\n }\n }\n return\n }\n\n if (!isFunction(selector)) {\n // delegated event\n originalFn = fn\n args = slice.call(arguments, 4)\n fn = delegate(selector, originalFn, selectorEngine)\n } else {\n args = slice.call(arguments, 3)\n fn = originalFn = selector\n }\n\n opts = buildOptions(defaultOpts, args[args.length - 1])\n types = str2arr(events)\n\n // special case for one(), wrap in a self-removing handler\n if (this === ONE) {\n fn = once(off, element, events, fn, originalFn)\n }\n\n for (i = types.length; i--;) {\n // add new handler to the registry and check if it's the first for this element/type\n first = registry.put(entry = new RegEntry(\n element\n , types[i].replace(nameRegex, '') // event type\n , fn\n , originalFn\n , str2arr(types[i].replace(namespaceRegex, ''), '.') // namespaces\n , args\n , false // not root\n ))\n if (entry[eventSupport] && first) {\n // first event of this type on this element, add root listener\n listener(element, entry.eventType, true, entry.customType, opts.useCapture)\n }\n }\n\n return element\n }\n\n /**\n * add(element[, selector], eventType(s), handler[, args ])\n *\n * Deprecated: kept (for now) for backward-compatibility\n */\n , add = function (element, events, fn, delfn, options) {\n return on.apply(\n null\n , !isString(fn)\n ? slice.call(arguments)\n : [ element, fn, events, delfn ].concat(arguments.length > 3 ? slice.call(arguments, 4) : [])\n )\n }\n\n /**\n * one(element, eventType(s)[, selector], handler[, args ])\n */\n , one = function () {\n return on.apply(ONE, arguments)\n }\n\n /**\n * fire(element, eventType(s)[, args ])\n *\n * The optional 'args' argument must be an array, if no 'args' argument is provided\n * then we can use the browser's DOM event system, otherwise we trigger handlers manually\n */\n , fire = function (element, type, args) {\n var types = str2arr(type)\n , i, j, l, names, handlers\n\n for (i = types.length; i--;) {\n type = types[i].replace(nameRegex, '')\n if (names = types[i].replace(namespaceRegex, '')) names = str2arr(names, '.')\n if (!names && !args && element[eventSupport]) {\n fireListener(nativeEvents[type], type, element)\n } else {\n // non-native event, either because of a namespace, arguments or a non DOM element\n // iterate over all listeners and manually 'fire'\n handlers = registry.get(element, type, null, false)\n args = [false].concat(args)\n for (j = 0, l = handlers.length; j < l; j++) {\n if (handlers[j].inNamespaces(names)) {\n handlers[j].handler.apply(element, args)\n }\n }\n }\n }\n return element\n }\n\n /**\n * clone(dstElement, srcElement[, eventType ])\n *\n * TODO: perhaps for consistency we should allow the same flexibility in type specifiers?\n */\n , clone = function (element, from, type) {\n var handlers = registry.get(from, type, null, false)\n , l = handlers.length\n , i = 0\n , args, beanDel\n\n for (; i < l; i++) {\n if (handlers[i].original) {\n args = [ element, handlers[i].type ]\n if (beanDel = handlers[i].handler.__beanDel) args.push(beanDel.selector)\n args.push(handlers[i].original)\n on.apply(null, args)\n }\n }\n return element\n }\n\n , bean = {\n 'on' : on\n , 'add' : add\n , 'one' : one\n , 'off' : off\n , 'remove' : off\n , 'clone' : clone\n , 'fire' : fire\n , 'Event' : Event\n , 'setSelectorEngine' : setSelectorEngine\n , 'noConflict' : function () {\n context[name] = old\n return this\n }\n }\n\n // for IE, clean up on unload to avoid leaks\n if (win.attachEvent) {\n var cleanup = function () {\n var i, entries = registry.entries()\n for (i in entries) {\n if (entries[i].type && entries[i].type !== 'unload') off(entries[i].element, entries[i].type)\n }\n win.detachEvent('onunload', cleanup)\n win.CollectGarbage && win.CollectGarbage()\n }\n win.attachEvent('onunload', cleanup)\n }\n\n // initialize selector engine to internal default (qSA or throw Error)\n setSelectorEngine()\n\n return bean\n});\n","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n","require( './lib/shims/custom-event' )\n\nvar bean = require( 'bean' )\nvar key = require( 'keymaster' ) \nvar animationEvent = require( './lib/animation-events' )\nvar page = require( './lib/page' )\nvar tap = require( './lib/tap-events' )\nvar debounce = require( './lib/debounce' )\nvar throttle = require( './lib/throttle' )\nvar delay = require( './lib/delay' )\nvar repeat = require( './lib/repeat' )\nvar bubbleFormEvents = require( './lib/bubble-form-events' )\nvar scroll = require( './lib/scroll' )\nvar resize = require( './lib/resize' )\nvar callbackManager = require( './lib/callback-manager' )\nvar media = require( './lib/media' )\n\nvar slice = Array.prototype.slice\nvar formBubbling = false\n\nmodule.exports = {\n\n // DOM events\n on: on,\n off: off,\n one: one,\n fire: fire,\n clone: bean.clone,\n ready: page.ready,\n change: page.change,\n afterAnimation: afterAnimation,\n\n // Media query events\n media: media,\n\n // Keyboard events\n key: key,\n keyOn: key,\n keyOff: key.unbind,\n keyOne: keyOne,\n\n // Timing utilities\n debounce: debounce,\n throttle: throttle,\n delay: delay,\n repeat: repeat,\n\n // Optimized Event Managers\n scroll: scroll,\n resize: resize,\n\n callbackManager: callbackManager,\n callback: callbackManager.callback,\n\n // Bubbling fix\n bubbleFormEvents: bubbleFormEvents\n}\n\n// Bean doesn't account for cross-browser support on animation events\n// So rather than pass through events to bean, we process them to add\n// vendor prefixes or remove events if browsers do not suppor them\n//\nfunction on () {\n setEvent( 'on', slice.call( arguments ) )\n}\n\nfunction off () {\n setEvent( 'off', slice.call( arguments ) )\n}\n\nfunction one () {\n setEvent( 'one', slice.call( arguments ) )\n}\n\nfunction fire () {\n\n args = slice.call( arguments )\n var el = args[0]\n var events = []\n\n args[1].split(' ').forEach( function( event ) {\n\n var event = animationEvent.transform( event )\n if ( !isEmpty( event ) ) events.push( event )\n\n })\n\n if ( !isEmpty( events ) ) {\n\n args[1] = events.join( ' ' )\n bean.fire.apply( this, args )\n\n }\n}\n\nfunction setEvent( registerType, args ) {\n\n transformArgs( args ).forEach( function( arg ) {\n bean[ registerType ].apply( null, arg )\n })\n\n}\n\n// Add support for unbinding a key event after it is called\n//\nfunction keyOne ( keys, scope, fn ) {\n\n if ( typeof scope == 'function' ) {\n fn = scope\n scope = 'all'\n }\n\n key( keys, scope, function( event ) {\n key.unbind( keys, scope )\n fn( event )\n })\n}\n\nfunction afterAnimation( el, callback ) {\n var hasAnimation = !!window.getComputedStyle( el ).getPropertyValue( 'animation-duration' )\n if ( hasAnimation ) {\n one( el, 'animationend', callback )\n } else {\n callback()\n }\n}\n\n// Transform event arguments to handle tap event and cross-browser animation events\n// Returns an array of events to be registered individually\n//\nfunction transformArgs( args ) {\n\n var transformedArgs = []\n var newEvents = {}\n var element = args.shift() // retrieve element\n var events = args.shift()\n\n // detect event delegate selector\n if ( typeof args[0] != 'function' ) {\n var delegate = args.shift()\n }\n\n // convert event strings to object based events for code simplification\n // example: arguments ('hover focus', function) would become ({ 'hover focus': function })\n if ( typeof events == 'string' ) {\n var objEvents = {}\n objEvents[events] = args.shift()\n events = objEvents\n }\n\n // Walk through each key in the events object and add vendor prefixes to 'animation' events\n // and wrap callback in the tap function for all 'tap' events.\n //\n for ( event in events ) {\n\n if ( events.hasOwnProperty( event ) ) {\n var callback = events[event]\n\n // Events can be registered as space separated groups like \"hover focus\"\n // This handles each event independantly\n //\n event.split(' ').forEach( function( e ){\n\n // If it is an animation event, vendor prefix it, or fire the callback according to browser support\n e = animationEvent.transform( e )\n\n if ( isEmpty( e ) ) {\n // If it's empty, it has been removed since animation events are not supported.\n // In that case, trigger the event immediately\n callback()\n\n } else if ( e.match( /tap/ ) ) {\n\n // If it's a tap event, wrap the callback and set the event to 'touchstart'\n // Tap isn't a real native event, but this wrapper lets us simulate what a\n // native tap event would be.\n //\n newEvents.touchstart = tap( callback )\n } else {\n newEvents[ e ] = callback\n }\n })\n }\n }\n\n for ( event in newEvents ) {\n var a = []\n a.push( element, event )\n\n if ( delegate ) a.push( delegate )\n\n a.push( newEvents[ event ] )\n transformedArgs.push( a.concat( args ) )\n }\n\n return transformedArgs\n}\n\n\nfunction isEmpty( obj ) {\n\n var hasOwnProperty = Object.prototype.hasOwnProperty\n\n if ( obj == null || obj.length === 0 ) return true\n\n if ( 0 < obj.length ) return false\n\n for (var key in obj) {\n if ( hasOwnProperty.call( obj, key ) ) return false\n }\n\n return true;\n}\n","var cssAnimEventTypes = getAnimationEventTypes()\nvar supported = cssAnimEventTypes.animationstart !== undefined\n\nmodule.exports = {\n transform: transformAnimationEvents\n}\n\nfunction camelCaseEventTypes(prefix) {\n prefix = prefix || '';\n\n return {\n animationstart: prefix + 'AnimationStart',\n animationend: prefix + 'AnimationEnd',\n animationiteration: prefix + 'AnimationIteration'\n };\n}\n\nfunction lowerCaseEventTypes(prefix) {\n prefix = prefix || '';\n\n return {\n animationstart: prefix + 'animationstart',\n animationend: prefix + 'animationend',\n animationiteration: prefix + 'animationiteration'\n };\n}\n\n/**\n * @return {Object} Animation event types {animationstart, animationend, animationiteration}\n */\n\nfunction getAnimationEventTypes() {\n var prefixes = ['webkit', 'Moz', 'O', ''];\n var style = document.documentElement.style;\n\n // browser compliant\n if (undefined !== style.animationName) {\n return lowerCaseEventTypes();\n }\n\n for (var i = 0, len = prefixes.length, prefix; i < len; i++) {\n prefix = prefixes[i];\n\n if (undefined !== style[prefix + 'AnimationName']) {\n // Webkit\n if (0 === i) {\n return camelCaseEventTypes(prefix.toLowerCase());\n }\n // Mozilla\n else if (1 === i) {\n return lowerCaseEventTypes();\n }\n // Opera\n else if (2 === i) {\n return lowerCaseEventTypes(prefix.toLowerCase());\n }\n }\n }\n\n return {};\n}\n\n\n// Adds necessary add vendor prefixes or camelCased event names\n//\nfunction transformAnimationEvents (event) {\n if (!event.match(/animation/i)) {\n return event\n } else {\n if (cssAnimEventTypes[event]) {\n return cssAnimEventTypes[event]\n } else {\n if(window.env != 'test') {\n console.error('\"' + event + '\" is not a supported animation event')\n }\n return ''\n }\n }\n}\n","var Event = require( 'bean' ),\n page = require( './page' ),\n formEls;\n\nvar formBubbling = false\n\nvar fireBubble = function ( event ) {\n if ( event.detail && event.detail.triggered ) { return false }\n\n var ev = new CustomEvent( event.type, { bubbles: true, cancelable: true, detail: { triggered: true } } )\n\n event.stopPropagation()\n event.target.dispatchEvent( ev ) \n\n // Prevent default on original event if custom event is prevented\n if ( ev.defaultPrevented ) event.preventDefault() \n}\n\n// Simplify setting the event type based on the element\nvar eventType = function ( el ) {\n return ( el.tagName == 'FORM' ) ? 'submit' : 'focus blur'\n}\n\n// Add event listeners\nvar bubbleOn = function ( el ) {\n Event.on( el, eventType( el ), fireBubble )\n}\n\n// Remove event listeners\nvar bubbleOff = function ( el ) {\n Event.off( el, eventType( el ), fireBubble )\n}\n\n// Add/Remove event listeners\nvar bubbleFormEvents = function () {\n if ( formBubbling ) { return } \n page.change( function() {\n\n // Remove listeners from previous page\n if ( formEls ) Array.prototype.forEach.call( formEls, bubbleOff )\n\n // Add new listeners to this page\n formEls = document.querySelectorAll( 'form, input' )\n\n Array.prototype.forEach.call( formEls, bubbleOn )\n })\n\n var formBubbling = true\n}\n\nmodule.exports = bubbleFormEvents\n","var Manager = {\n new: function() {\n var manager = {\n\n callbacks: [],\n\n add: function( fn ) {\n\n var cb = Manager.callback.new( fn )\n manager.callbacks.push( cb )\n \n return cb\n\n },\n\n stop: function() {\n manager.callbacks.forEach( function( cb ) { cb.stop() } )\n },\n\n start: function() {\n manager.callbacks.forEach( function( cb ) { cb.start() } )\n },\n\n toggle: function( bool ) {\n manager.callbacks.forEach( function( cb ) { cb.toggle( bool ) } )\n },\n\n remove: function() {\n manager.callbacks = []\n },\n\n fire: function() {\n var args = Array.prototype.slice.call( arguments )\n manager.callbacks.forEach( function( fn ) { fn.apply( this, args ) } )\n }\n }\n\n return manager\n },\n\n callback: {\n new: function( fn ) {\n var cb = function() {\n if ( cb.enabled ) { fn.apply( fn, arguments ) }\n }\n\n cb.stop = function() { cb.enabled = false }\n cb.start = function() { cb.enabled = true }\n cb.toggle = function( bool ) {\n cb.enabled = ( 0 in arguments ) ? bool : !cb.enabled\n }\n cb.enabled = true\n\n return cb\n }\n }\n}\n\nmodule.exports = Manager\n","var now = function() {\n return Date.now()\n}\n\nvar pickFunction = function() {\n var found\n Array.prototype.forEach.call( arguments, function( candidate ) {\n if ( typeof( candidate ) == 'function' && !found ) { found = candidate }\n })\n\n return found\n}\n\nvar debounce = function( fn, wait, options ) {\n\n // Allow options passed as the first argument\n if ( typeof( fn ) == 'object' ) { options = fn } \n\n // Options won't be null\n else { options = options || {} }\n\n wait = options.wait || wait || 0\n\n var max = options.max || false,\n leading = ( ( 'leading' in options ) ? options.leading : false ),\n trailing = ( ( 'trailing' in options ) ? options.trailing : true ),\n \n // Grab functions from options or default to first argument\n leadingFn = pickFunction( options.leading, options.trailing, options.callback, fn ),\n trailingFn = pickFunction( options.trailing, options.leading, options.callback, fn ),\n\n // State tracking vars\n args, // Track arguments passed to debounced callback\n queued = false, // Has a callback been added to the animation loop?\n handle = {}, // Object for tracking functions and callbacks\n lastCalled = 0, // Keep a timer for debouncing\n lastInvoked = 0, // Keep a timer for max\n leadingBlocked = false; // Track leading, throttling subsequent leading calls\n\n // Queue the function with requestAnimationFrame\n var invoke = function( callType ) {\n\n lastCalled = now()\n lastInvoked = now()\n queued = false\n leadingBlocked = true\n\n if ( callType === 'leading' ) {\n leadingFn.apply( leadingFn, args ) }\n else {\n trailingFn.apply( trailingFn, args ) }\n\n }\n\n // Load the loop into the animation queue\n var addToQueue = function () {\n\n if ( !queued ) {\n queued = true\n handle.value = requestAnimationFrame( loop ) // Add to browser's animation queue\n }\n\n }\n\n // Remove from animation queue and reset debounce \n var removeFromQueue = function() {\n\n if ( \"value\" in handle ) {\n cancelAnimationFrame( handle.value )\n queued = false\n lastCalled = 0\n lastInvoked = 0\n leadingBlocked = false\n }\n \n }\n\n // prevent infinite debouncing ( if options.max is set )\n var maxPassed = function() {\n return ( max && now() - lastInvoked >= max )\n }\n\n var waitReached = function() {\n return ( now() - lastCalled ) >= wait\n }\n\n // This gets loaded into the animation queue and determines whether to ivoke the debounced function\n var loop = function () {\n \n // Loop was executed so it's no longer in the animation queue\n queued = false\n \n if ( leading && !leadingBlocked ) {\n invoke( 'leading' )\n }\n\n // If function has been called to frequently to execute\n else if ( maxPassed() ) {\n\n if ( leading ) { invoke( 'leading' ) }\n else { invoke( 'trailing' ) }\n\n } \n \n // If function hasn't been called since last wait\n else if ( waitReached() ) {\n\n // If trailing it's safe to invoke\n if ( trailing ) { invoke( 'trailing' ) }\n\n // If leading, it's safe to remove block\n if ( leading ) { leadingBlocked = false }\n \n } else {\n addToQueue()\n }\n\n }\n\n // A wrapper function for queueing up function calls\n //\n var debounced = function() {\n lastCalled = now()\n args = arguments\n addToQueue()\n }\n\n debounced.stop = removeFromQueue\n\n return debounced\n}\n\nmodule.exports = debounce\n","var now = function() {\n return Date.now()\n}\n\nvar delay = function ( fn, wait ) {\n\n var argsStart = ( wait != null ) ? 2 : 1;\n var handle = {}\n\n handle.args = Array.prototype.slice.call( arguments, argsStart )\n handle.wait = wait || 0\n handle.start = now()\n\n handle.stop = function () {\n if ( \"value\" in handle ) {\n cancelAnimationFrame( handle.value );\n }\n }\n\n handle.loop = function () {\n\n // If wait limit has been reached\n if ( now() - handle.start >= handle.wait ) {\n fn.apply( fn, handle.args )\n\n // If repeat is set and is not 0\n if ( !!handle.repeat ) {\n handle.repeat = handle.repeat - 1\n handle.start = now()\n queueDelay( handle )\n } else if ( handle.repeat === 0 && handle.complete ) {\n handle.complete()\n }\n\n } else {\n queueDelay( handle )\n }\n\n }\n\n\n return queueDelay( handle )\n}\n\nvar queueDelay = function ( handle ) {\n handle.value = requestAnimationFrame( handle.loop )\n return handle\n}\n\nmodule.exports = delay\n","// This simplifies common uses for window.matchMedia \n// namely, adding listeners for width and height queries\n\nfunction parseQuery( query, dimension ) {\n var result = {}\n\n if ( typeof( query ) === 'string' ) { return query }\n\n result.min = size( query.min, 'min-' + dimension )\n result.max = size( query.max, 'max-' + dimension )\n\n if ( result.min && result.max )\n result.query = result.min + ' and ' + result.max\n\n return result.query || result.min || result.max\n}\n\nfunction size( num, limit ) {\n return ( num ) ? '('+limit+': ' + toPx( num ) + ')' : null\n}\n\nfunction toPx( width ) {\n if ( typeof( width ) === 'number' ) { return width + 'px'}\n return width\n}\n\nvar media = {\n\n width: function( query, fn ) {\n return media.listen( parseQuery( query, 'width' ), fn )\n },\n\n minWidth: function( size, fn ) { return media.width( { min: size }, fn ) },\n maxWidth: function( size, fn ) { return media.width( { max: size }, fn ) },\n\n height: function( query, fn ) {\n return media.listen( parseQuery( query, 'height' ), fn )\n },\n\n minHeight: function( size, fn ) { return media.height( { min: size }, fn ) },\n maxHeight: function( size, fn ) { return media.height( { max: size }, fn ) },\n\n listen: function( query, fn ) {\n var match = window.matchMedia( query )\n\n if ( fn ) {\n fn( match )\n match.addListener( fn )\n }\n\n return match\n }\n\n}\n\n\nmodule.exports = media\n","var Event = require( 'bean' )\nvar callbackManager = require( './callback-manager' )\nvar throttle = require( './throttle' )\nvar debounce = require( './debounce' )\n\nvar optimizedEventManager = {\n new: function( name ) {\n\n // Create a new callback manager\n var manager = {\n run: callbackManager.new(),\n start: callbackManager.new(),\n stop: callbackManager.new()\n }\n\n // run callbacks when event happens (at paint-ready frames)\n var running = throttle( manager.run.fire )\n\n // fire callbacks when event starts (at paint-ready frames)\n var started = debounce({\n leading: manager.start.fire,\n trailing: false,\n wait: 150\n })\n\n // fire callbacks when event starts (at paint-ready frames)\n var stopped = debounce( manager.stop.fire, 150 )\n\n Event.on( window, name, function() {\n running()\n started()\n stopped()\n })\n\n // Public API\n var run = function ( fn ) { return manager.run.add( fn ) }\n run.start = function ( fn ) { return manager.start.add( fn ) }\n run.stop = function ( fn ) { return manager.stop.add( fn ) }\n\n // Add custom events for to run optimized listeners. ( name -> Name )\n run( function() { Event.fire( window, 'optimized' + name[0].toUpperCase() + name.substring(1) ) } )\n run.start( function() { Event.fire( window, name + 'Start' ) } )\n run.stop( function() { Event.fire( window, name + 'Stop' ) } )\n\n return run\n }\n}\n\nmodule.exports = optimizedEventManager\n","var Event = require( 'bean' )\nvar callbackManager = require( './callback-manager' )\n\n// Create a new page event manager\nvar manager = {\n ready: callbackManager.new(),\n change: callbackManager.new(),\n readyAlready: false,\n changed: false,\n}\n\nmanager.ready.add( function(){\n manager.readyAlready = true \n})\n\nmanager.ready.add( function(){ \n if ( !window.Turbolinks && !manager.changed ) { \n manager.changed = true \n manager.change.fire()\n }\n})\n\nvar ready = function ( fn ) {\n if ( manager.readyAlready ) { fn() }\n return manager.ready.add( fn ) }\n\nvar change = function( fn ) {\n if ( manager.changed ) { fn() }\n return manager.change.add( fn ) }\n\n// Make it easy to trigger ready callbacks\nready.fire = function () {\n manager.ready.fire()\n // Be sure ready can only be fired once\n manager.ready.stop() }\n\n// Make it easy to trigger change callbacks\nchange.fire = function () {\n manager.change.fire() }\n\nEvent.on( document, 'DOMContentLoaded', ready.fire )\nEvent.on( document, 'page:change', change.fire ) // Support rails turbolinks page load event\n\nmodule.exports = {\n ready: ready,\n change: change\n}\n","var delay = require( './delay' )\n\nvar repeat = function( fn, wait, limit ) {\n\n var argsStart = 1,\n handle = delay ( fn, wait );\n\n if ( limit != null ) { argsStart = 3 }\n else if ( wait != null ) { argsStart = 2 }\n\n // Enable repeat ( -1 will repeat forever )\n handle.repeat = limit || -1\n handle.args = Array.prototype.slice.call( arguments, argsStart )\n handle.stop = handle.cancel\n\n return handle\n}\n\nmodule.exports = repeat\n","var manager = require( './optimized-event-manager' )\nvar resize = manager.new( 'resize' )\n\n// Pause animations during resizing for better performance\nresize.disableAnimation = function() {\n var style = '<style id=\"fullstop\">.no-animation *, .no-animation *:after, .no-animation *:before {\\\n transition: none !important; animation: none !important\\\n }</style>'\n\n // Inject style for easy classname manipulation\n if ( !document.querySelector('style#fullstop') ) { \n document.head.insertAdjacentHTML('beforeend', style)\n }\n\n resize.start( function() { document.body.classList.add( 'no-animation' ) } )\n resize.stop( function() { document.body.classList.remove( 'no-animation' ) } )\n}\n\nmodule.exports = resize\n","var manager = require( './optimized-event-manager' )\nvar scroll = manager.new( 'scroll' )\n\nscroll.disablePointer = function() {\n\n // Disable pointer interaction\n scroll.start( function() {\n document.documentElement.style.pointerEvents = 'none'\n })\n\n // Enable pointer interaction\n scroll.stop( function() {\n document.documentElement.style.pointerEvents = ''\n })\n}\n\nmodule.exports = scroll\n","// Custom Event Polyfill\n(function () {\n\n if ( typeof window.CustomEvent === \"function\" ) return false;\n\n function CustomEvent ( event, params ) {\n params = params || { bubbles: false, cancelable: false, detail: undefined };\n var evt = document.createEvent( 'CustomEvent' );\n evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );\n return evt;\n }\n\n CustomEvent.prototype = window.Event.prototype;\n\n window.CustomEvent = CustomEvent;\n})()\n","var endEvents = [\n 'touchend'\n]\n\nmodule.exports = Tap\n\n// default tap timeout in ms\nTap.timeout = 200\n\nfunction Tap(callback, options) {\n options = options || {}\n // if the user holds his/her finger down for more than 200ms,\n // then it's not really considered a tap.\n // however, you can make this configurable.\n var timeout = options.timeout || Tap.timeout\n\n // to keep track of the original listener\n listener.handler = callback\n\n return listener\n\n // el.addEventListener('touchstart', listener)\n function listener(e1) {\n // tap should only happen with a single finger\n if (!e1.touches || e1.touches.length > 1) return\n\n var el = e1.target\n var context = this\n var args = arguments;\n\n var timeout_id = setTimeout(cleanup, timeout)\n\n el.addEventListener('touchmove', cleanup)\n\n endEvents.forEach(function (event) {\n el.addEventListener(event, done)\n })\n\n function done(e2) {\n // since touchstart is added on the same tick\n // and because of bubbling,\n // it'll execute this on the same touchstart.\n // this filters out the same touchstart event.\n if (e1 === e2) return\n\n cleanup()\n\n // already handled\n if (e2.defaultPrevented) return\n\n // overwrite these functions so that they all to both start and events.\n var preventDefault = e1.preventDefault\n var stopPropagation = e1.stopPropagation\n\n e1.stopPropagation = function () {\n stopPropagation.call(e1)\n stopPropagation.call(e2)\n }\n\n e1.preventDefault = function () {\n preventDefault.call(e1)\n preventDefault.call(e2)\n }\n\n // calls the handler with the `end` event,\n // but i don't think it matters.\n callback.apply(context, args)\n }\n\n // cleanup end events\n // to cancel the tap, just run this early\n function cleanup(e2) {\n // if it's the same event as the origin,\n // then don't actually cleanup.\n // hit issues with this - don't remember\n if (e1 === e2) return\n\n clearTimeout(timeout_id)\n\n el.removeEventListener('touchmove', cleanup)\n\n endEvents.forEach(function (event) {\n el.removeEventListener(event, done)\n })\n }\n }\n}\n","var debounce = require( './debounce' )\n\nvar throttle = function( fn, wait, options ) {\n\n if ( typeof( fn ) == 'object' ) { options = fn; fn = undefined } \n else { options = options || {} }\n\n options.wait = options.wait || wait || 0\n options.max = options.max || options.wait\n options.callback = options.callback || fn\n options.leading = true\n options.trailing = true\n\n return debounce(options)\n}\n\n\nmodule.exports = throttle\n","var validation = require( './lib/validation' )\nvar progressive = require( './lib/progressive' )\n\nmodule.exports = {\n\n validate: validation.validate,\n invalidateField: validation.invalidateField,\n next: progressive.next,\n\n}\n","var toolbox = require( 'compose-toolbox' ),\n Event = toolbox.event,\n Callback = toolbox.event.callback,\n formSelector = 'form.progressive',\n watching = false,\n formCallbacks,\n registeredForms\n\n// Remove any existing callbacks and registered forms\nfunction reset () {\n\n formCallbacks = { next: [] }\n registeredForms = []\n\n}\n\nfunction newForm( form ) {\n\n if ( !form ) return\n\n var steps = toolbox.slice( form.querySelectorAll( '.form-step' ) ),\n stepIndex = 0,\n navItems = ''\n\n if ( steps.length == 0 ) return\n\n\n steps.forEach( function( step, index ) { \n\n // disable all steps but the current step\n step.disabled = step != currentStep()\n step.dataset.step = index\n\n })\n\n if ( form.dataset.nav ) {\n var nav = '<nav class=\"progressive-form-nav\">'\n\n steps.forEach( function( step, index ) {\n nav += '<a href=\"#\" class=\"progressive-form-nav-item\" data-step=\"'+( index + 1 )+'\">'\n nav += step.dataset.nav || \"Step \" + ( index + 1 )\n nav += '</a> '\n })\n\n nav += '</nav>'\n\n form.insertAdjacentHTML( 'afterbegin', nav )\n }\n\n show()\n\n function previousStep () { return steps[ stepIndex - 1] }\n function currentStep () { return steps[ stepIndex ] }\n function nextStep () { return steps[ stepIndex + 1] }\n function active () { return currentStep() && !currentStep().disabled }\n \n // Move to next fieldset\n function forward () {\n showStep( stepIndex + 1 )\n }\n\n // Move to next fieldset\n function back () {\n showStep( stepIndex - 1 )\n }\n\n // Accepts a step index\n function showStep ( index ) {\n\n index = Number( index )\n\n // Get the step from the index\n var step = steps[ index ]\n\n // Don't go to a non-existant step, or the current step\n if ( step && step != currentStep() ) {\n\n var direction = ( stepIndex < index ) ? 'forward' : 'reverse'\n\n // If a step is currently active\n // dismiss it before going to the specified step\n if ( active() ) {\n return dismiss( function() { showStep( index ) }, direction )\n }\n\n stepIndex = index\n\n show( direction )\n\n }\n }\n \n // Hide a completed step and move to the next\n function dismiss ( callback, direction ) {\n direction = direction || 'forward'\n\n currentStep().classList.remove( 'active', 'enter' )\n currentStep().classList.add( 'exit' )\n currentStep().dataset.direction = direction\n\n Event.afterAnimation( currentStep(), function() {\n disable()\n\n if ( typeof callback === 'function' ) callback()\n\n })\n\n }\n\n function revisit ( callback, direction ) {\n\n if ( !active() ) {\n direction = direction || 'reverse'\n\n currentStep().classList.remove( 'exit', 'completed' )\n currentStep().classList.add( 'active', 'enter' )\n currentStep().dataset.direction = direction\n\n disableOtherFieldsets()\n\n Event.afterAnimation( currentStep(), function() {\n if ( typeof callback === 'function' ) callback()\n })\n }\n }\n\n // Show the form-step\n function show ( direction ) {\n\n disableOtherFieldsets()\n currentStep().classList.remove( 'completed' )\n currentStep().dataset.direction = direction\n currentStep().classList.add( 'active', 'enter' )\n\n // focus on the first input\n var firstInput = currentStep().querySelector( 'input:not([hidden]), textarea, select' )\n if ( firstInput ) firstInput.focus()\n\n setNav()\n\n }\n\n // Disable a form step after it has been hidden\n function disable () {\n\n currentStep().disabled = true\n currentStep().classList.add( 'completed' )\n currentStep().classList.remove( 'enter', 'exit' )\n\n }\n\n function setNav () {\n toolbox.each( form.querySelectorAll( 'nav [data-step]' ), function ( nav ) {\n\n if ( nav.dataset.step < stepIndex + 1 ) {\n nav.classList.remove( 'here', 'next' )\n nav.classList.add( 'previous', 'completed' )\n }\n\n if ( nav.dataset.step == stepIndex + 1 ) {\n nav.classList.remove( 'previous', 'next' )\n nav.classList.add( 'here' )\n }\n\n if ( nav.dataset.step > stepIndex + 1 ) {\n nav.classList.remove( 'previous', 'here' )\n nav.classList.add( 'next' )\n }\n\n })\n }\n\n function enableFieldsets ( form ) {\n toolbox.each( form.querySelectorAll( 'fieldset.form-step[disabled]' ), function( fieldset ) {\n fieldset.disabled = false \n })\n }\n\n function disableOtherFieldsets ( ) {\n steps.forEach( function( fieldset ) {\n fieldset.disabled = fieldset != currentStep() \n })\n }\n\n registeredForms.push( function( event, trigger ) {\n var target = event.currentTarget\n\n if ( trigger === 'show-step' ) {\n event.preventDefault()\n\n if ( toolbox.matches( target, '.previous, .completed, .completed + a' ) )\n showStep( target.dataset.step - 1 )\n\n } else if ( trigger === 'next' ) {\n\n // Continue if submit was triggered on this form\n // and no invalid fields are found\n\n var formEl = ( target.tagName == \"FORM\" ) ? target : toolbox.getClosest( target, 'form')\n\n if ( form == formEl && !currentStep().querySelector( ':invalid' ) ) {\n\n // Get the function which triggers callbacks\n var fireCallbacks = getCallbacks( form )\n\n // This is the last stop, be sure all fieldsets are enabled!\n if ( !nextStep() ) enableFieldsets( form )\n else disableOtherFieldsets( form )\n\n // If there are callbacks, let them handle this!\n if ( fireCallbacks ) {\n\n // Since there are callbacks, stop the submission event\n event.preventDefault()\n\n fireCallbacks( event, {\n fieldset: currentStep(), // Valid fieldset element\n form: form, // Parent form element\n forward: forward, // Call forward() to move to the next fieldset\n dismiss: dismiss, // Hide and disable current step\n revisit: revisit, // Revisit current disabled step\n showStep: showStep, // Show a specific step by index (0 based)\n complete: !nextStep(), // is this is the final form step?\n formData: toolbox.formData( currentStep() ) // pass FormData for current fieldset\n })\n }\n\n // No callbacks? If there's a next step, stop submission and proceed\n else if ( nextStep() ) {\n event.preventDefault() \n forward()\n }\n }\n }\n })\n}\n\nfunction fire ( event, type ) {\n registeredForms.forEach( function( fn ) { fn( event, type ) })\n}\n\n\n// Returns a function which triggers callbacks\nfunction getCallbacks ( form, type ) {\n\n type = type || 'next'\n var callbacks = [], cb;\n\n formCallbacks[ type ].forEach( function( test ) {\n if ( cb = test( form ) ) {\n callbacks.push( cb )\n }\n })\n\n // Return a function which can trigger all callbacks\n // or returns fallse if none are called\n\n if ( callbacks.length )\n return function() {\n var args = toolbox.slice( arguments )\n\n callbacks.forEach( function( callback ) {\n callback.apply( callback, args ) }) }\n\n else return false\n}\n\nfunction next ( el, callback ) {\n on( el, 'next', callback )\n}\n\nfunction on ( el, event, callback ) {\n\n // Accept events list as an object e.g. { next: callback }\n if ( typeof event === 'object' ) {\n for ( type in event ) {\n on( el, type, event[ type ] )\n }\n }\n\n else if ( formCallbacks[ event ] ) {\n\n // Only allow access to a callback if the form matches\n var filter = function( form ) {\n if ( form == el ) return callback\n }\n\n // Add the test wrapper function to the callback list\n formCallbacks[ event ].push( filter )\n }\n}\n\nEvent.ready( function(){\n reset()\n\n // Add bubbling so we can listen for submission\n Event.bubbleFormEvents()\n\n var nextSelector = formSelector + ' [type=submit], ' + formSelector + ' .next-step'\n var backSelector = formSelector + ' .back-step'\n var navSelector = '.progressive-form-nav-item[data-step]'\n\n Event.on( document, 'click', nextSelector , fire, 'next' )\n Event.on( document, 'click', backSelector , fire, 'back' )\n Event.on( document, 'click', navSelector , fire, 'show-step' )\n// insert core styling for hiding disabled and completed form-steps\n document.head.insertAdjacentHTML( 'beforeend', \"<style>\\\n.form-step[disabled], .form-step.completed {\\\n position: absolute !important;\\\n top: -9999px !important;\\\n left: -9999px !important;\\\n left: 0 !important;\\\n right: 0 !important; }\\\n</style>\" )\n\n Event.change( function() {\n reset()\n\n toolbox.each( document.querySelectorAll( formSelector ), function( el ) {\n newForm( el )\n })\n })\n})\n\nmodule.exports = {\n next: next,\n new: newForm\n}\n","// Dependencies\nvar toolbox = require( 'compose-toolbox' ),\n Event = toolbox.event,\n getClosest = toolbox.getClosest,\n wordCount = toolbox.wordCount,\n textSelectors = '[required]';\n\n// Does this browser support HTML5 validation?\nfunction supported () {\n\n return typeof document.createElement( 'input' ).checkValidity === 'function'\n\n}\n\nvar invalidHandler = Event.callback.new( function( event ) { \n event.preventDefault() \n event.stopPropagation() \n})\n\n// Watch for events ( if validation is suported )\nEvent.ready( function(){\n\n if ( supported() ) { \n\n Event.bubbleFormEvents()\n\n document.addEventListener( 'invalid', invalidHandler, true )\n\n Event.on( document.body, 'click', '[type=submit]', submit )\n\n Event.on( document, 'validate', 'form', function( event ) { \n validateForm( event.target )\n })\n\n // Ensure all required inputs have aria-requrired attributes\n toolbox.slice( document.querySelectorAll( '[required]' ) ).forEach( function( element ) { \n element.setAttribute( 'aria-required', true )\n })\n\n // Watch input events\n Event.on( document, 'blur', '[required]', checkValidation )\n Event.on( document, 'keydown', '[required]', Event.debounce( checkValidation, 200 ) )\n Event.on( document, 'input', 'select[required]', Event.debounce( checkValidation, 200 ) )\n\n }\n})\n\nfunction validateForm ( form ) {\n\n // Scoped variables\n var inputs = form.querySelectorAll( '[required]' ),\n invalidInput;\n\n toolbox.slice( inputs ).some( function( input ) {\n\n // if invalid\n if ( !getClosest( input, '[disabled]' ) && !checkInput( input ) ) {\n invalidInput = input\n return true\n }\n })\n\n if ( invalidInput ) { \n\n // Show validation message\n focus( invalidInput )\n showMessage( invalidInput )\n\n return false\n }\n\n // The form is valid, skip it\n else { \n return true \n }\n\n}\n\n// Handler for validation events\nvar checkValidation = Event.callback.new( function( event ) {\n\n if ( checkInput( event.target, event.type ) ) {\n\n // Remove any pre-existing validation message\n hideMessage( event.target )\n }\n\n})\n\n\nfunction checkInput ( input, event ) {\n\n var el = statusEl( input ),\n valid = isValid( input ),\n neutral = event == 'keydown' && !valid;\n\n // Don't trigger invalid style while typing\n if ( neutral && input == document.activeElement ) {\n\n el.classList.remove( 'invalid', 'valid' )\n input.setAttribute( 'aria-invalid', false )\n\n } else {\n\n el.classList.toggle( 'invalid', !valid )\n el.classList.toggle( 'valid', valid )\n input.setAttribute( 'aria-invalid', valid )\n\n }\n\n return valid\n\n}\n\n// Is an input valid?\nfunction isValid ( input ) {\n\n // If element only contains whitespace, strip value\n if ( !input.value.replace( /\\s/g, '' ).length )\n input.value = ''\n\n // Set a custom validation message for word count\n var message = checkValue( input ) || checkLength( input ) || ''\n input.setCustomValidity( message )\n\n var valid = input.checkValidity()\n\n return valid\n\n}\n\n\nfunction checkValue( input ) {\n if ( input.dataset.invalidValue ) {\n\n // Does input value == invalid value? (case insensitive)\n var regexp = escapedRegex( input.dataset.invalidValue, 'i' )\n\n if ( input.value.match( regexp ) ) {\n\n // Remove any standard custom message\n input.dataset.cachedMessage = input.dataset.message\n input.dataset.message = ''\n\n return input.dataset.invalidValueMessage || \"Value '\"+input.value+\"' is not permitted\"\n\n // If not invalid value reset standard validation message\n } else if ( input.dataset.cachedMessage ) {\n\n input.dataset.message = input.dataset.cachedMessage\n input.dataset.cachedMessage = ''\n\n }\n }\n}\n\nfunction escapedRegex( input, options ) {\n var str = input.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n return new RegExp( \"^\" + str + '$', options )\n}\n\nfunction checkLength ( input ) {\n return checkCount( input, 'min' )\n || checkCount( input, 'max' )\n}\n\n// Test custom validation for maximum or minimum words present\nfunction checkCount ( input, limit ) {\n\n var goal = input.dataset[ limit + 'Words' ]\n\n if ( goal ) {\n\n var lessThanGoal = wordCount( input.value ) < goal\n phrasing = ( limit == 'min' ) ? 'at least ' : 'no more than ',\n valid = ( limit == 'min' ) ? !lessThanGoal : lessThanGoal\n\n // Return a custom error message\n if ( input.value && !valid )\n return 'Please write ' + phrasing + goal + ' words.'\n }\n\n\n}\n\n// If input is nested in a label, treat the label as the\n// target for assigning status (class names and messages).\nfunction statusEl ( input ) {\n\n return getClosest( input, 'label' ) || input\n\n}\n\n// Focus() if invalid element is not hidden\n// or Focus its immediate sibling (mostly used for upload buttons)\nfunction focus ( el ) {\n\n el = ( el.style.display !== 'none' ) ? el : el.nextSibling\n el.focus()\n\n}\n\n// Submission validation handler function\nfunction submit ( event ) {\n\n var form = ( event.target.tagName == \"FORM\" ) ? event.target : getClosest( event.target, 'form')\n\n // Skip validation if no invalid inputs found\n if ( !validateForm( form ) ) {\n\n // Pause keydown/blur triggers for the next second to avoid neutral empty style\n checkValidation.stop()\n Event.delay( checkValidation.start, 500 )\n\n // Stop the submission event\n event.preventDefault()\n event.stopImmediatePropagation()\n\n }\n\n}\n\nfunction invalidateField ( el, message ) {\n if ( el && el.value ) {\n el.dataset.invalidValue = el.value\n if ( message )\n el.dataset.invalidValueMessage = message\n }\n}\n\nfunction hideMessage ( el ) {\n\n var form = getClosest( el, 'form' ),\n msg = form.querySelector( '.validation-message' )\n\n if ( msg ) msg.parentNode.removeChild( msg )\n\n}\n\n\n// Validation message handler function\nfunction showMessage ( el ) {\n\n //hideMessage( el )\n\n var label = getClosest( el, 'label' ),\n message = el.dataset.message || el.validationMessage\n\n if ( label ) {\n var existingMessage = label.querySelector( '.validation-message-text' )\n\n if ( !existingMessage ) {\n label.insertAdjacentHTML( 'beforeend', '<span class=\"validation-message\"><span class=\"validation-message-text\" role=\"alert\">' + message + '</span></span>' )\n\n } else if ( existingMessage.textContent != message ) {\n existingMessage.innerHTML = message\n }\n }\n\n}\n\n// Public API\nmodule.exports = {\n validate: validateForm,\n invalidateField: invalidateField\n}\n","require ('./lib/object.assign')\n\nvar Event = require('compose-event')\n// Improves the utility and user interface for range inputs\n\nvar sliders = []\nvar listening\n\nvar Slider = {\n // When a slider is changed, update the associated label and input.\n change: function(event) {\n self.refresh(event.currentTarget)\n },\n\n // Update labels and inputs\n refresh: function (slider) {\n self.setLabels(slider)\n self.setInput(slider)\n self.setFill(slider)\n },\n \n // Some browsers don't focus when a slider input is changed, this lets us force focus.\n focus: function(event){\n event.currentTarget.focus()\n },\n \n // Inject slider templates into the DOM\n setup: function(){\n\n if (!listening) {\n Event.on(document, \"input toggler:show\", \"[type=range]\", self.change, { useCapture: true })\n Event.on(document, \"click change input\", \"[type=range]\", self.focus, { useCapture: true })\n listening = true\n }\n\n var ranges = document.querySelectorAll('[type=range]:not(.slider-input)')\n\n Array.prototype.forEach.call(ranges, function(slider){\n\n var data = self.data(slider)\n sliders.push(data)\n\n slider.dataset.id = data.id\n\n // Inject template and set inputs\n slider = self.template(slider)\n self.refresh(slider)\n\n })\n },\n\n data: function(el) {\n var data = {\n // Assign an incremental ID to track this slider with its data\n id: sliders.length,\n min: el.getAttribute('min') || 0,\n max: el.getAttribute('max') || 100,\n labels: {},\n externalLabels: {}\n }\n\n // Gets dataset as a hash\n Object.assign(data, self.extractData(el))\n\n data = self.extractValues(data)\n data = self.getLabels(data)\n\n if (data.values)\n data.max = (data.min + data.values.length - 1)\n\n data.segments = Number(data.max) - Number(data.min) + 1\n\n for (var key in data) {\n if(key.match(/-/)){\n data[this.camelCase(key)] = data[key]\n delete data[key]\n }\n }\n\n // Allow data-input or name attribute to set value for hidden input.\n //\n if (!data.input && el.getAttribute('name')) {\n data.input = el.getAttribute('name')\n el.removeAttribute('name')\n }\n\n if (data.input) {\n // Generate a class name for querying later (because some name attributes contain illegal characters for queries)\n data.inputClass = data.input.replace(/\\W/g,'-')\n data.inputExists = self.inputExists(el, data)\n }\n\n data = self.getLineLabels(data)\n\n if (data.mark) { \n data.mark = data.mark.split(',').map(Number) \n }\n\n return data\n },\n\n getData: function(slider) {\n if (typeof slider != 'string' && slider.dataset) {\n slider = slider.dataset.id\n }\n return sliders[slider]\n },\n\n extractValues: function(data) {\n if (data.values) { \n data.values = data.values.split(',').map(self.trim)\n } else {\n data.values = []\n for (var i = data.min; i <= data.max; i++ ) {\n data.values.push(i)\n }\n }\n\n return data\n },\n\n // Convert dataset strings into hashes of arrays\n // examples:\n // - data-label='one,two,three' => data.labels.default = ['one','two','three']\n // - data.external-label-awesome='one;two;three' => data.externalLabels.awesome = ['one','two','three']\n //\n // If labels have not been disabled (data-label='false') and there are no data labels,\n // an array of values is set to data.labels.default\n //\n getLabels: function(data) {\n if (data.label && data.label.match(/false|none/))\n data.label = false\n\n // Unless labels have been disabed with data-label='false'\n for (var val in data) {\n // Ignore non-native methods injected by some wayward lib\n if (!data.hasOwnProperty(val)) { continue }\n // Don't bother processing disabled labels\n if (data[val] === false) { continue }\n\n // Match properties: label, label-id, external-label-id\n var match = val.match(/^(external-)?label-(.+)|^label$/)\n\n if(match) {\n // Some labels may include commas, allow semicolons as an alternate separator\n //\n var delimiter = data[val].match(/;/) ? ';' : ','\n var labels = data[val].split(delimiter).map(self.trim)\n var external = match[1]\n var name = match[2]\n\n if(external){\n data.externalLabels[name] = labels\n } else if (val == 'label') {\n data.labels.default = labels\n delete data.label\n } else {\n data.labels[name] = labels\n }\n\n delete data[val]\n }\n\n var labelCount = self.objectSize(data.labels)\n\n // If there are no labels, use values for a label\n if (labelCount == 0)\n data.labels.default = data.values\n\n if (labelCount > 1)\n delete data.labels.default\n }\n\n return data\n },\n\n getLineLabels: function(data){\n var lineLabels = {}\n\n // Line labels may be in the following formats:\n // - 1:start,11:end - index specified, comma separated\n // - first,second,third,11:last - default to index for some labels\n // - 10,000;20,000;30,000 - semicolon separated\n //\n if(data.lineLabels) {\n var delimiter = data.lineLabels.match(/;/) ? ';' : ','\n data.lineLabels.split(delimiter).map(function(labels, index){\n var l = labels.split(':')\n label = (!l[1] ? l[0] : l[1])\n index = (!l[1] ? index + 1 : l[0])\n lineLabels[index] = label\n })\n data.lineLabels = lineLabels\n }\n\n return data\n },\n\n // \n template: function(slider){\n var data = self.getData(slider)\n\n slider.setAttribute('min', data.min)\n slider.setAttribute('max', data.max)\n\n slider.classList.add('slider-input')\n\n if(slider.classList.contains('left-label'))\n slider.classList.remove('left-label')\n\n var containerHTML = self.templateHTML(data)\n\n var classes = ['slider-container']\n\n if (containerHTML.match('slider-line-label'))\n classes.push('line-labels')\n\n if (containerHTML.match('slider-label'))\n classes.push(\"with-label\")\n else\n classes.push(\"without-label\")\n\n containerHTML = '<div class=\"'+classes.join(' ')+'\" id=\"slider'+data.id+'\">'\n + containerHTML\n +'</div>'\n\n slider.insertAdjacentHTML('beforebegin', containerHTML)\n var container = slider.previousSibling\n container.querySelector('.slider-input-container').insertAdjacentHTML('afterbegin', slider.outerHTML)\n slider.parentNode.removeChild(slider)\n\n slider = container.querySelector('.slider-input')\n \n // Update attributes from processed data\n //\n if(!slider.getAttribute('value'))\n slider.value = data.value || data.min\n return slider\n },\n \n templateHTML: function(data){\n var html = \"\"\n var fills = \"\"\n \n if (data.mark || data.lineLabels) {\n for(var i = 1; i <= data.segments; i++) {\n \n html += \"<div class='slider-segment'><span class='slider-segment-content'>\"\n\n if (data.mark && data.mark.indexOf(i) != -1)\n html += \"<span class='slider-segment-mark' data-index='\"+i+\"'></span>\"\n\n if (data.lineLabels && data.lineLabels[i]) \n html += \"<span class='slider-line-label'>\"+data.lineLabels[i]+\"</span>\"\n\n html += \"</span></div>\"\n }\n }\n\n // one less\n for(var i = 1; i < data.segments; i++) {\n fills += \"<span class='slider-fill' data-index='\"+i+\"'></span>\"\n }\n\n html = \"<div class='slider-input-container'>\"\n + \"<div class='slider-track'>\" + html + \"</div>\"\n + \"<div class='slider-fills'>\" + fills + \"</div>\"\n + \"</div>\"\n + self.labelTemplate(data)\n\n if (!data.inputExists && data.inputClass) {\n html += \"<input class='\"+data.inputClass+\"' type='hidden' name='\"+data.input+\"' value=''>\"\n }\n\n return html\n \n },\n\n labelTemplate: function(data){\n var html = \"\"\n\n if (data.label == false) { return html }\n\n for(var key in data.labels){\n html += '<span class=\"slider-label-'+key+' internal-label\" data-slider-label=\"'+key+'\">'\n html += self.labelHTML(data, key, '')\n html += '</span></span> '\n }\n\n if (html.length > 0) {\n html = \"<div class='slider-label align-\"+(data.positionLabel || 'right')+\"'>\" + html + \"</div>\"\n }\n\n return html\n },\n\n labelHTML: function(data, key, label) {\n return self.labelMeta(data, key, 'before')\n + \"<span class='label-content'>\" + label + \"</span>\"\n + self.labelMeta(data, key, 'after')\n },\n\n // Grab all prefixes or suffixes, for example:\n // - data-before-label='$'\n // - data-after-label='/mo'\n // - data-after-label-size='GB'\n //\n labelMeta: function(data, key, position) {\n var altKey = self.camelCase('-label-'+key)\n var meta = data[position+altKey] || data[position+'Label']\n if (meta)\n return \"<span class='\"+position+\"-label'>\"+meta+\"</span>\"\n else\n return ''\n },\n\n // Is there already an input matching this name?\n inputExists: function(slider, data) {\n if (data.inputClass) {\n var input = self.scope(slider).querySelector('input[name=\"'+data.input+'\"]')\n\n if(input) {\n input.classList.add(data.inputClass)\n return true\n }\n }\n },\n\n extractData: function(el) {\n var pattern = 'data-'\n var data = {}\n\n for (var i = 0; i < el.attributes.length; i++){\n var name = el.attributes[i].nodeName\n\n if(new RegExp(\"^\"+pattern).test(name)) {\n name = name.replace(pattern, '')\n data[name] = el.attributes[i].nodeValue\n }\n }\n return data\n },\n\n labelElements: function(id, key, external) {\n var selector = '[data-slider-label='+key+']'\n var internalSelector = \"#slider\"+id + ' ' + selector\n var externalSelector = selector += ':not(.internal-label)' \n if (external) { \n selector = externalSelector\n } else {\n selector = internalSelector + ', ' + externalSelector\n }\n\n return document.querySelectorAll(selector)\n },\n\n setFill: function(slider) {\n var data = self.getData(slider)\n var segments = document.querySelectorAll('#slider'+data.id+' .slider-segment')\n var fills = document.querySelectorAll('#slider'+data.id+' .slider-fill')\n var sliderIndex = self.sliderIndex(slider)\n \n Array.prototype.forEach.call(fills, function(fill, index){\n if (fill.dataset.index <= sliderIndex) {\n fill.classList.add('filled')\n if(segments[index]) {\n segments[index].classList.add('filled')\n }\n } else {\n fill.classList.remove('filled')\n if(segments[index]) {\n segments[index].classList.remove('filled')\n }\n }\n })\n \n },\n\n setInput: function(slider) {\n var data = self.getData(slider)\n\n // Don't update hidden sliders\n if (slider.offsetParent === null) { return }\n\n if (data.input && data.values) {\n var value = data.values[self.sliderIndex(slider)]\n var selector = \".\"+data.input.replace(/\\W/g,'-')\n var inputs = self.scope(slider).querySelectorAll(selector)\n\n Array.prototype.forEach.call(inputs, function(input){\n input.value = value\n })\n }\n },\n\n setLabels: function(slider) {\n var data = self.getData(slider)\n var index = self.sliderIndex(slider)\n\n if (slider.offsetParent === null) { return }\n\n Array.prototype.forEach.call(['labels', 'externalLabels'], function(type) {\n var external = (type == 'externalLabels')\n\n for (var key in data[type]) {\n var labelEls = self.labelElements(data.id, key, external)\n var labels = self.labelAtIndex(data[type], index)\n\n Array.prototype.forEach.call(labelEls, function(el) {\n var container = el.querySelector('.label-content')\n\n if ( container ) { container.innerHTML = labels[key] }\n else { el.innerHTML = self.labelHTML(data, key, labels[key]) }\n\n el.classList.toggle('empty-label', labels[key] === '')\n })\n }\n })\n },\n\n // Get all labels for the current slider position\n labelAtIndex: function(labels, index){\n var set = {}\n for (var key in labels) {\n set[key] = labels[key][index]\n }\n return set\n }, \n\n // Normalize the slider value by the minimum value\n sliderIndex: function(slider){\n return Number(slider.value) - Number(slider.getAttribute('min'))\n },\n\n // If slider is in a form, return that form.\n // This alows us to be sure that sliders in one\n // form do not update labels with the same name\n // in another form.\n //\n scope: function(slider) {\n var el = slider\n\n while (el && el.tagName != \"FORM\") {\n el = el.parentNode\n }\n\n return el || document\n },\n\n // Function for easy maping, as in: someArray.map(self.trim)\n trim: function(name){ \n return name.trim()\n },\n\n objectSize: function(object) {\n var length = 0; for(var i in object) { length++ }\n return length\n },\n\n camelCase: function(input) {\n return input.toLowerCase().replace(/-(.)/g, function(match, group) {\n return group.toUpperCase();\n });\n }\n}\n\nvar self = Slider\n\nEvent.change(Slider.setup)\n\nmodule.exports = Slider\n","if (typeof Object.assign != 'function') {\n (function () {\n Object.assign = function (target) {\n 'use strict';\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (Object.prototype.hasOwnProperty.call(source, nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n })();\n}\n","var Event = require('compose-event')\n\nvar Toggler = {\n checkboxSelector: \"[type=checkbox][data-toggle], [type=checkbox][data-show], [type=checkbox][data-hide]\",\n radioSelector: \"input[type=radio][data-show], input[type=radio][data-hide], input[type=radio][data-add-class], input[type=radio][data-remove-class]\",\n selectSelector: \"option[data-hide], option[data-show]\",\n\n listen: function(){\n Event.on(document, \"click change\", \"[data-toggle], [data-show], [data-hide], [data-toggle-class], [data-add-class], [data-remove-class]\", Toggler.trigger)\n Event.on(document, \"change\", \".select-toggler\", Toggler.trigger)\n Event.on(window, 'hashchange', Toggler.hashChange)\n },\n\n hashChange: function() {\n if ( window.location.hash ) {\n\n var anchor = '[data-anchor=\"'+window.location.hash+'\"]'\n var target = document.querySelector( 'input'+anchor+ ', option'+anchor )\n\n if ( target ) {\n if ( target.type == 'radio' ) {\n target.checked = true\n } else {\n var select = Toggler.getSelectFromOption(target)\n select.selectedIndex = target.index\n target = select\n }\n ratchet.toggler.triggerToggling( target )\n }\n }\n },\n\n refresh: function(){\n Toggler.toggleCheckboxes()\n Toggler.setupSelects()\n Toggler.setupRadios()\n },\n\n trigger: function(event) {\n // Stop event and bubbling if link is only being used as a toggler\n if (event.currentTarget.getAttribute('href') == \"#\") {\n event.preventDefault()\n event.stop()\n } \n\n Toggler.triggerToggling(event.currentTarget, event)\n },\n\n triggerToggling: function(target, event) {\n var actions = ['hide', 'toggle', 'show', 'removeClass', 'toggleClass', 'addClass']\n var select\n\n // Store the select, and set the target to the current option\n // Events fire on the select, but the options have toggling attributes\n if (target.tagName.match(/select/i)) {\n select = target\n target = select.selectedOptions[0]\n }\n\n // Radio inputs and selects do not support toggling, so remove them\n if (select || target.type == 'radio') {\n actions = actions.filter(function(action) {\n return !action.match(/toggle/)\n })\n }\n\n // Dispatch all actions\n actions.forEach(function(action) {\n Toggler.dispatch(target, action)\n })\n },\n\n dispatch: function(el, type) {\n var action = type\n var data = el.dataset[type]\n\n // Abort if element doesn't have data for the action\n if (!data || typeof data == 'undefined' || data == '') return\n\n // Toggle and show are treated the same for checkboxes\n if (el.type == 'checkbox')\n action = (type.match(/hide|remove/i) ? !el.checked : el.checked)\n\n if (data){\n if (type.match(/class/i)){\n Toggler.setClass(data, action, el)\n } else {\n Toggler.setState(data, action)\n }\n }\n },\n\n // Add, remove, or toggle classnames, triggered by elements with:\n // data-hide-class, data-show-class, and data-toggle-class values\n //\n // Data value examples:\n // - \"classname\" - add/remove/toggle classname on current element\n // - \"foo bar\" - multiple classnames, separated by spaces (like html class property)\n // - \"foo bar; selector\" - change classnames on elements matched by selector\n // - \"foo bar; selector, selector\" - match multiple selectors\n //\n // You can perform multiple add/remove classes by joining values with an `&`\n // For example: \"classname & foo bar; selector\"\n // This would toggle classname on current element and toggle `foo bar` classnames\n // on an element matching the selector\n //\n\n setClass: function (selectors, action, el){\n if(typeof selectors == 'undefined' || selectors == '') return\n\n if (typeof(action) == 'boolean') {\n action = (action ? 'add' : 'remove')\n }\n\n if (selectors.match(/&/)) {\n selectors.split('&').forEach(function(sel){\n Toggler.setClass(sel.trim(), action, el) \n })\n return\n }\n\n // Get selector and classnames, format: \"classname classname; selector,selector\"\n var settings = selectors.split(';')\n var classnames = settings[0].trim()\n var matches = []\n selectors = settings[1]\n\n if (selectors) {\n matches = document.querySelectorAll(selectors)\n\n // If no slectors are present, and el is an OPTION, use its SELECT as the matched element\n } else if (el && el.tagName.match(/option/i)) {\n matches = [Toggler.getSelectFromOption(el)]\n \n // If no slectors are present, use the current el for classnames\n } else if (el) {\n matches = [el]\n }\n\n Array.prototype.forEach.call(matches, function(match){\n Array.prototype.forEach.call(classnames.split(' '), function(classname) {\n var method = action.replace(/Class/,'')\n match.classList[method](classname)\n })\n\n Toggler.triggerTogglerEventsOnChildren(match, 'class')\n })\n },\n\n setState: function(selectors, state) {\n var matches = document.querySelectorAll(selectors)\n\n Array.prototype.forEach.call(matches, function(match){\n var action = Toggler.toggleAction(match, state)\n\n Toggler[action](match)\n Toggler.triggerTogglerEventsOnChildren(match, action)\n })\n },\n\n toggleAction: function(el, action) {\n\n if (typeof(action) == 'boolean') {\n action = (action ? 'show' : 'hide')\n }\n\n if (action == 'toggle') {\n if (el.classList.contains('hidden')) {\n action = 'show'\n } else {\n action = 'hide'\n }\n }\n\n return action\n },\n\n show: function(el) {\n el.classList.remove('hidden')\n el.classList.add('visible')\n\n // Enable inputs, fieldsets or forms when shown\n if ( typeof el.disabled != 'undefined' ){\n el.disabled = false\n }\n\n // Focus on key element if an element expects focus\n var focusEl = el.querySelector('[data-focus]')\n if (focusEl) { focusEl.focus() }\n\n // Trigger input event on ranges that have been hidden\n var ranges = el.querySelectorAll('[type=range]')\n },\n\n hide: function(el) {\n el.classList.remove('visible')\n el.classList.add('hidden')\n\n // Disable inputs, fieldsets or forms when hidden\n if ( typeof el.disabled != 'undefined' ){\n el.disabled = true\n }\n },\n\n getLeafNodes: function (parent) {\n // is the parent itself a leaf node?\n if (!parent.hasChildNodes()) return [parent]\n\n var nodes = Array.prototype.slice.call(parent.getElementsByTagName(\"*\"), 0)\n\n return nodes.filter(function(elem) {\n return elem.children && elem.children.length === 0\n })\n },\n\n triggerTogglerEventsOnChildren: function(el, eventName){\n // we care about leaf nodes since the event will bubble to\n // non-leaf nodes from the leaf nodes\n var leafChildNodes = Toggler.getLeafNodes(el)\n\n Array.prototype.forEach.call(leafChildNodes, function(node) {\n // 'toggler:show', 'toggler:hide', etc\n Event.fire(node, \"toggler:\" + eventName)\n })\n },\n\n toggleCheckboxes: function(checkboxes) {\n checkboxes = checkboxes || document.querySelectorAll(Toggler.checkboxSelector)\n\n Array.prototype.forEach.call(checkboxes, Toggler.triggerToggling)\n },\n\n setupRadios: function() {\n Array.prototype.forEach.call(document.querySelectorAll(Toggler.radioSelector), function(radio, index){\n if (!radio.dataset.togglerActive) {\n\n var radioName = radio.getAttribute('name'),\n siblings = Toggler.parentForm(radio).querySelectorAll('[type=radio][name=\"'+radioName+'\"]'),\n showSelectors = Toggler.dataAttributes(siblings, 'show'),\n addClassSelectors = Toggler.dataAttributes(siblings, 'addClass'),\n checked\n\n Array.prototype.forEach.call(siblings, function(r){\n\n if (r.dataset.anchor && window.location.hash == ('#'+r.dataset.anchor.replace('#',''))) {\n r.checked = true\n }\n\n // Ensure that all radio buttons in a group have a default data-show value of ''\n // This means that unset data-show values will toggle off everything\n //\n r.dataset.show = r.dataset.show || ''\n r.dataset.addClass = r.dataset.addClass || ''\n\n // Append element's data-hide to showSelectors\n if ( r.dataset.hide && r.dataset.hide.length > 0 )\n showSelectors = showSelectors.concat( r.dataset.hide.split( ',' ) )\n\n r.dataset.hide = showSelectors.filter(function(selector){\n return r.dataset.show.indexOf( selector )\n }).join(',')\n\n // Ensure that all radio buttons in a group have a default data-add-class value of ''\n // This means that unset data-add-class values are toggle off all classes\n //\n r.dataset.addClass = r.dataset.addClass || ''\n\n // Ensure that selected radio buttons remove classes according\n // to the deselected radio buttons\n r.dataset.removeClass = addClassSelectors.filter(function(selector){\n return r.dataset.addClass.indexOf( selector )\n }).join('&')\n\n\n r.dataset.togglerActive = true\n\n\n if( r.checked ) checked = r\n\n })\n\n if ( checked ) {\n Toggler.triggerToggling( checked )\n } else {\n Toggler.setState( showSelectors.join(','), 'hide' )\n Toggler.setClass( addClassSelectors.join(' & '), 'removeClass' )\n }\n }\n\n })\n },\n\n // Add data-hide to each <option> containing the selectors from other\n // option's data-show. This makes the toggling of elements exclusive.\n //\n setupSelects: function(){\n Array.prototype.forEach.call(document.querySelectorAll(Toggler.selectSelector), function(option){\n // Prevent an option from being considered twice\n if (!option.dataset.togglerActive) {\n\n option.dataset.show = option.dataset.show || ''\n\n var select = Toggler.getSelectFromOption(option)\n select.classList.add('select-toggler')\n var options = select.querySelectorAll('option')\n\n var showSelectors = Toggler.dataAttributes(options, 'show')\n var addClassSelectors = Toggler.dataAttributes(options, 'addClass')\n\n Array.prototype.forEach.call(options, function(o, index) {\n\n if (o.dataset.anchor && window.location.hash == ('#'+o.dataset.anchor.replace('#',''))) {\n select.selectedIndex = index\n }\n\n o.dataset.show = o.dataset.show || ''\n o.dataset.addClass = o.dataset.addClass || ''\n\n // Append element's data-hide to showSelectors\n if ( o.dataset.hide && o.dataset.hide.length > 0 )\n showSelectors = showSelectors.concat( o.dataset.hide.split( ',' ) )\n\n // If show selectors are not present in element's data-show\n // Add them to the list of selectors to be hidden\n o.dataset.hide = showSelectors.filter(function(selector){\n return o.dataset.show.indexOf( selector )\n }).join(',')\n\n o.dataset.removeClass = addClassSelectors.filter(function(selector){\n return o.dataset.addClass.indexOf( selector )\n }).join(' & ')\n\n o.dataset.togglerActive = true\n })\n\n // Ensure that currently selected option is toggled properly\n //\n Toggler.triggerToggling(select)\n }\n })\n },\n\n // Find parent <select> for an option (accounts for option groups)\n //\n getSelectFromOption: function(el) {\n var p = el.parentElement\n\n if (p.tagName == 'SELECT') {\n return p\n } else {\n return Toggler.getSelectFromOption(p)\n }\n },\n\n\n // Find parent <form> or document if there is no form\n //\n parentForm: function(element) {\n var el = element\n\n while (el && el.tagName != \"FORM\") {\n el = el.parentNode\n }\n\n return el || document\n },\n\n // Return a unique array of all data attribute values from elements\n //\n dataAttributes: function(elements, attr) {\n return Array.prototype.map.call(elements, function(el) { \n return el.dataset[attr]\n }).filter(function(selectors, index, self) {\n return selectors != \"\" && typeof selectors != 'undefined' && self.indexOf(selectors) === index\n })\n }\n}\n\nEvent.ready(Toggler.listen)\nEvent.change(Toggler.refresh)\n\nmodule.exports = Toggler\n","// Shims\nrequire( './lib/shims/_classlist' )\nvar merge = require( './lib/shims/_object.assign' )\n\nvar event = require( 'compose-event' )\nvar scrollTo = require( './lib/scrollto' )\nvar fromTop = require( './lib/fromtop' )\nvar ease = require( './lib/ease' )\n\nvar toolbox = {\n\n event: event,\n scrollTo: scrollTo,\n fromTop: fromTop,\n merge: merge,\n ease: ease,\n\n // Get closest DOM element up the tree that matches a given selector\n getClosest: function ( el, selector ) {\n for ( ; el && el !== document; el = el.parentNode ) {\n if ( toolbox.matches( el, selector ) ) return el;\n }\n return false;\n },\n\n // Get next DOM element that matches a given selector\n getNext: function( el, selector ) {\n for ( ; el && el !== document; el = el.parentNode ) {\n if ( el.querySelector( selector ) ) return el.querySelector( selector );\n }\n return false;\n },\n\n // Matches selector function\n // @reference https://developer.mozilla.org/en-US/docs/Web/API/Element/matches\n matches: function ( el, selector ) {\n return ( el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector ).call( el, selector );\n },\n\n wordCount: function( str ) {\n var matches = str.match( /\\S+/g );\n return matches ? matches.length : 0;\n },\n\n // Easy access to slice for converting objects into arrays of values.\n slice: function( obj, count ) {\n return Array.prototype.slice.call( obj, count )\n },\n\n each: function( collection, callback ) {\n return Array.prototype.forEach.call( collection, callback )\n },\n\n formData: function( rootEl ) {\n var formData = new FormData(),\n fields = rootEl.querySelectorAll( 'input[name]' )\n\n // Loop over fields\n toolbox.each( fields, function( field ) {\n // Append current field’s name/value to new formData object\n formData.append( field.name, field.value );\n })\n\n // Then return said formData object\n return formData;\n }\n\n}\n\n\nmodule.exports = toolbox\n","// easing functions http://gizma.com/easing/\nvar ease = {\n\n inOutQuad: function (t, b, c, d) {\n t /= d/2\n if (t < 1) { return c/2*t*t + b }\n t--\n return -c/2 * (t*(t-2) - 1) + b\n },\n\n inOutCubic: function (t, b, c, d) {\n\tt /= d/2;\n\tif (t < 1) return c/2*t*t*t + b;\n\tt -= 2;\n\treturn c/2*(t*t*t + 2) + b;\n },\n\n inOutQuint: function(t, b, c, d) {\n var ts = (t/=d)*t,\n tc = ts*t;\n return b+c*(6*tc*ts + -15*ts*ts + 10*tc);\n },\n\n inOutCirc: function (t, b, c, d) {\n t /= d/2;\n if (t < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;\n t -= 2;\n return c/2 * (Math.sqrt(1 - t*t) + 1) + b;\n }\n\n}\n\nease.default = ease.inOutQuad\n\nmodule.exports = ease\n","module.exports = function( el ) {\n return Math.round( el.getBoundingClientRect().top + window.pageYOffset );\n}\n","var ease = require( './ease' )\nvar fromTop = require( './fromtop' )\n\nfunction move(amount) {\n\n // Scroll all because document.scrollingElement is still expiremental\n document.documentElement.scrollTop = amount;\n document.body.parentNode.scrollTop = amount;\n document.body.scrollTop = amount;\n\n}\n\nfunction position() {\n return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop;\n}\n\nfunction scrollTo(to, callback, duration) {\n\n // Making args flexible\n //\n // Allow for element or y-coordinates\n if( typeof( to ) === 'object' ) { to = fromTop( to ) }\n\n // Accept duration as the second argument\n if( typeof( callback ) === 'number' ) { duration = callback; callback = null }\n\n // Default duration = 500\n duration = ( typeof( duration ) === 'undefined' ) ? 500 : duration\n\n var start = position(),\n change = to - start,\n currentTime = 0,\n increment = 20;\n\n\n var animateScroll = function() {\n\n // increment the time\n currentTime += increment\n\n // find the value with the quadratic in-out easing function\n var val = ease.default(currentTime, start, change, duration)\n\n // move the document.body\n move(val);\n\n // do the animation unless its over\n if ( currentTime < duration ) {\n requestAnimationFrame( animateScroll )\n } else {\n if ( callback && typeof( callback ) === 'function') {\n callback()\n }\n }\n }\n\n animateScroll()\n}\n\nmodule.exports = scrollTo\n","/**\n * ClassList polyfill\n * Cross-browser full element.classList implementation\n * @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js\n * @author Eli Grey - http://eligrey.com\n * @license MIT\n **/\n\nif ( 'document' in self ) {\n\n // Full polyfill for browsers with no classList support\n if ( !( 'classList' in document.createElement( '_' ) ) ) {\n\n ( function( view ) {\n\n 'use strict';\n\n if ( !( 'Element' in view ) ) return;\n\n var\n classListProp = 'classList',\n protoProp = 'prototype',\n elemCtrProto = view.Element[ protoProp ],\n objCtr = Object,\n\n strTrim = String[ protoProp ].trim || function() {\n return this.replace( /^\\s+|\\s+$/g, '' );\n },\n\n arrIndexOf = Array[ protoProp ].indexOf || function( item ) {\n for ( var i = 0; i < this.length; i++ ) {\n if ( i in this && this[ i ] === item ) {\n return i;\n }\n }\n return -1;\n },\n\n DOMEx = function( type, message ) {\n this.name = type;\n this.code = DOMException[ type ];\n this.message = message;\n },\n\n checkTokenAndGetIndex = function( classList, token ) {\n if ( token === '' ) {\n throw new DOMEx(\n 'SYNTAX_ERR',\n 'An invalid or illegal string was specified'\n );\n }\n if ( /\\s/.test( token ) ) {\n throw new DOMEx(\n 'INVALID_CHARACTER_ERR',\n 'String contains an invalid character'\n );\n }\n return arrIndexOf.call( classList, token );\n },\n\n ClassList = function( elem ) {\n var trimmedClasses = strTrim.call( elem.getAttribute( 'class' ) || '' ),\n classes = trimmedClasses ? trimmedClasses.split( /\\s+/ ) : [];\n\n for ( var i = 0; i < classes.length; i++ ) {\n this.push( classes[ i ] );\n }\n\n this._updateClassName = function() {\n elem.setAttribute( 'class', this.toString() );\n };\n },\n\n classListProto = ClassList[ protoProp ] = [],\n\n classListGetter = function() {\n return new ClassList( this );\n };\n\n DOMEx[ protoProp ] = Error[ protoProp ];\n\n classListProto.item = function( i ) {\n return this[ i ] || null;\n };\n\n classListProto.contains = function( token ) {\n token += '';\n return checkTokenAndGetIndex( this, token ) !== -1;\n };\n\n classListProto.add = function() {\n var\n tokens = arguments,\n iter = 0,\n len = tokens.length,\n updated = false,\n token;\n\n do {\n token = tokens[ iter ] + '';\n if ( checkTokenAndGetIndex( this, token ) === -1 ) {\n this.push( token );\n updated = true;\n }\n }\n\n while ( ++iter < len );\n\n if ( updated ) {\n this._updateClassName();\n }\n };\n\n classListProto.remove = function() {\n var\n tokens = arguments,\n iter = 0,\n len = tokens.length,\n updated = false,\n token,\n index;\n\n do {\n token = tokens[ iter ] + '';\n index = checkTokenAndGetIndex( this, token );\n\n while ( index !== -1 ) {\n this.splice( index, 1 );\n updated = true;\n index = checkTokenAndGetIndex( this, token );\n }\n }\n\n while ( ++iter < len );\n\n if ( updated ) {\n this._updateClassName();\n }\n };\n\n classListProto.toggle = function( token, force ) {\n token += '';\n\n var\n result = this.contains( token ),\n method = result ? force !== true && 'remove' : force !== false && 'add';\n\n if ( method ) {\n this[ method ]( token );\n }\n\n if ( force === true || force === false ) {\n return force;\n } else {\n return !result;\n }\n };\n\n classListProto.toString = function() {\n return this.join( ' ' );\n };\n\n if ( objCtr.defineProperty ) {\n var classListPropDesc = {\n get : classListGetter,\n enumerable : true,\n configurable : true\n };\n\n try {\n objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );\n }\n\n catch ( ex ) {\n if ( ex.number === -0x7FF5EC54 ) {\n classListPropDesc.enumerable = false;\n objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );\n }\n }\n\n } else if ( objCtr[ protoProp ].__defineGetter__ ) {\n elemCtrProto.__defineGetter__( classListProp, classListGetter );\n }\n\n }( self ));\n\n } else {\n\n ( function() {\n\n 'use strict';\n\n var testElement = document.createElement( '_' );\n\n testElement.classList.add( 'c1', 'c2' );\n\n if ( !testElement.classList.contains( 'c2' ) ) {\n var createMethod = function( method ) {\n var original = DOMTokenList.prototype[ method ];\n\n DOMTokenList.prototype[ method ] = function( token ) {\n var i, len = arguments.length;\n\n for ( i = 0; i < len; i++ ) {\n token = arguments[ i ];\n original.call( this, token );\n }\n };\n };\n createMethod( 'add' );\n createMethod( 'remove' );\n }\n\n testElement.classList.toggle( 'c3', false );\n\n if ( testElement.classList.contains( 'c3' ) ) {\n var _toggle = DOMTokenList.prototype.toggle;\n\n DOMTokenList.prototype.toggle = function( token, force ) {\n if ( 1 in arguments && !this.contains( token ) === !force ) {\n return force;\n } else {\n return _toggle.call( this, token );\n }\n };\n\n }\n\n testElement = null;\n\n }());\n\n }\n}\n","/**\n * Object.assign polyfill\n * Cross-browser full Object.assign implementation\n * @source https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill\n * @license MIT\n **/\n\nif ( typeof Object.assign != 'function' ) {\n ( function() {\n Object.assign = function( target ) {\n 'use strict';\n if ( target === undefined || target === null ) {\n throw new TypeError( 'Cannot convert undefined or null to object' );\n }\n\n var output = Object( target );\n for ( var index = 1; index < arguments.length; index++ ) {\n var source = arguments[ index ];\n if ( source !== undefined && source !== null ) {\n for ( var nextKey in source ) {\n if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {\n output[ nextKey ] = source[ nextKey ];\n }\n }\n }\n }\n return output;\n };\n })();\n}\n\n// Make it easy to merge objects without overwriting the original objects\nvar merge = function() {\n var args = [{}].concat( Array.prototype.slice.call( arguments ) )\n return Object.assign.apply( this, args )\n}\n\nmodule.exports = merge\n","// keymaster.js\n// (c) 2011-2013 Thomas Fuchs\n// keymaster.js may be freely distributed under the MIT license.\n\n;(function(global){\n var k,\n _handlers = {},\n _mods = { 16: false, 18: false, 17: false, 91: false },\n _scope = 'all',\n // modifier keys\n _MODIFIERS = {\n '⇧': 16, shift: 16,\n '⌥': 18, alt: 18, option: 18,\n '⌃': 17, ctrl: 17, control: 17,\n '⌘': 91, command: 91\n },\n // special keys\n _MAP = {\n backspace: 8, tab: 9, clear: 12,\n enter: 13, 'return': 13,\n esc: 27, escape: 27, space: 32,\n left: 37, up: 38,\n right: 39, down: 40,\n del: 46, 'delete': 46,\n home: 36, end: 35,\n pageup: 33, pagedown: 34,\n ',': 188, '.': 190, '/': 191,\n '`': 192, '-': 189, '=': 187,\n ';': 186, '\\'': 222,\n '[': 219, ']': 221, '\\\\': 220\n },\n code = function(x){\n return _MAP[x] || x.toUpperCase().charCodeAt(0);\n },\n _downKeys = [];\n\n for(k=1;k<20;k++) _MAP['f'+k] = 111+k;\n\n // IE doesn't support Array#indexOf, so have a simple replacement\n function index(array, item){\n var i = array.length;\n while(i--) if(array[i]===item) return i;\n return -1;\n }\n\n // for comparing mods before unassignment\n function compareArray(a1, a2) {\n if (a1.length != a2.length) return false;\n for (var i = 0; i < a1.length; i++) {\n if (a1[i] !== a2[i]) return false;\n }\n return true;\n }\n\n var modifierMap = {\n 16:'shiftKey',\n 18:'altKey',\n 17:'ctrlKey',\n 91:'metaKey'\n };\n function updateModifierKey(event) {\n for(k in _mods) _mods[k] = event[modifierMap[k]];\n };\n\n // handle keydown event\n function dispatch(event) {\n var key, handler, k, i, modifiersMatch, scope;\n key = event.keyCode;\n\n if (index(_downKeys, key) == -1) {\n _downKeys.push(key);\n }\n\n // if a modifier key, set the key.<modifierkeyname> property to true and return\n if(key == 93 || key == 224) key = 91; // right command on webkit, command on Gecko\n if(key in _mods) {\n _mods[key] = true;\n // 'assignKey' from inside this closure is exported to window.key\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = true;\n return;\n }\n updateModifierKey(event);\n\n // see if we need to ignore the keypress (filter() can can be overridden)\n // by default ignore key presses if a select, textarea, or input is focused\n if(!assignKey.filter.call(this, event)) return;\n\n // abort if no potentially matching shortcuts found\n if (!(key in _handlers)) return;\n\n scope = getScope();\n\n // for each potential shortcut\n for (i = 0; i < _handlers[key].length; i++) {\n handler = _handlers[key][i];\n\n // see if it's in the current scope\n if(handler.scope == scope || handler.scope == 'all'){\n // check if modifiers match if any\n modifiersMatch = handler.mods.length > 0;\n for(k in _mods)\n if((!_mods[k] && index(handler.mods, +k) > -1) ||\n (_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;\n // call the handler and stop the event if neccessary\n if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){\n if(handler.method(event, handler)===false){\n if(event.preventDefault) event.preventDefault();\n else event.returnValue = false;\n if(event.stopPropagation) event.stopPropagation();\n if(event.cancelBubble) event.cancelBubble = true;\n }\n }\n }\n }\n };\n\n // unset modifier keys on keyup\n function clearModifier(event){\n var key = event.keyCode, k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n }\n };\n\n function resetModifiers() {\n for(k in _mods) _mods[k] = false;\n for(k in _MODIFIERS) assignKey[k] = false;\n };\n\n // parse and assign shortcut\n function assignKey(key, scope, method){\n var keys, mods;\n keys = getKeys(key);\n if (method === undefined) {\n method = scope;\n scope = 'all';\n }\n\n // for each shortcut\n for (var i = 0; i < keys.length; i++) {\n // set modifier keys if any\n mods = [];\n key = keys[i].split('+');\n if (key.length > 1){\n mods = getMods(key);\n key = [key[key.length-1]];\n }\n // convert to keycode and...\n key = key[0]\n key = code(key);\n // ...store handler\n if (!(key in _handlers)) _handlers[key] = [];\n _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n }\n };\n\n // unbind all handlers for given key in current scope\n function unbindKey(key, scope) {\n var multipleKeys, keys,\n mods = [],\n i, j, obj;\n\n multipleKeys = getKeys(key);\n\n for (j = 0; j < multipleKeys.length; j++) {\n keys = multipleKeys[j].split('+');\n\n if (keys.length > 1) {\n mods = getMods(keys);\n key = keys[keys.length - 1];\n }\n\n key = code(key);\n\n if (scope === undefined) {\n scope = getScope();\n }\n if (!_handlers[key]) {\n return;\n }\n for (i = 0; i < _handlers[key].length; i++) {\n obj = _handlers[key][i];\n // only clear handlers if correct scope and mods match\n if (obj.scope === scope && compareArray(obj.mods, mods)) {\n _handlers[key][i] = {};\n }\n }\n }\n };\n\n // Returns true if the key with code 'keyCode' is currently down\n // Converts strings into key codes.\n function isPressed(keyCode) {\n if (typeof(keyCode)=='string') {\n keyCode = code(keyCode);\n }\n return index(_downKeys, keyCode) != -1;\n }\n\n function getPressedKeyCodes() {\n return _downKeys.slice(0);\n }\n\n function filter(event){\n var tagName = (event.target || event.srcElement).tagName;\n // ignore keypressed in any elements that support keyboard data input\n return !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');\n }\n\n // initialize key.<modifier> to false\n for(k in _MODIFIERS) assignKey[k] = false;\n\n // set current scope (default 'all')\n function setScope(scope){ _scope = scope || 'all' };\n function getScope(){ return _scope || 'all' };\n\n // delete all handlers for a given scope\n function deleteScope(scope){\n var key, handlers, i;\n\n for (key in _handlers) {\n handlers = _handlers[key];\n for (i = 0; i < handlers.length; ) {\n if (handlers[i].scope === scope) handlers.splice(i, 1);\n else i++;\n }\n }\n };\n\n // abstract key logic for assign and unassign\n function getKeys(key) {\n var keys;\n key = key.replace(/\\s/g, '');\n keys = key.split(',');\n if ((keys[keys.length - 1]) == '') {\n keys[keys.length - 2] += ',';\n }\n return keys;\n }\n\n // abstract mods logic for assign and unassign\n function getMods(key) {\n var mods = key.slice(0, key.length - 1);\n for (var mi = 0; mi < mods.length; mi++)\n mods[mi] = _MODIFIERS[mods[mi]];\n return mods;\n }\n\n // cross-browser events\n function addEvent(object, event, method) {\n if (object.addEventListener)\n object.addEventListener(event, method, false);\n else if(object.attachEvent)\n object.attachEvent('on'+event, function(){ method(window.event) });\n };\n\n // set the handlers globally on document\n addEvent(document, 'keydown', function(event) { dispatch(event) }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48\n addEvent(document, 'keyup', clearModifier);\n\n // reset modifiers to false whenever the window is (re)focused.\n addEvent(window, 'focus', resetModifiers);\n\n // store previously defined key\n var previousKey = global.key;\n\n // restore previously defined key and return reference to our key object\n function noConflict() {\n var k = global.key;\n global.key = previousKey;\n return k;\n }\n\n // set window.key and window.key.set/get/deleteScope, and the default filter\n global.key = assignKey;\n global.key.setScope = setScope;\n global.key.getScope = getScope;\n global.key.deleteScope = deleteScope;\n global.key.filter = filter;\n global.key.isPressed = isPressed;\n global.key.getPressedKeyCodes = getPressedKeyCodes;\n global.key.noConflict = noConflict;\n global.key.unbind = unbindKey;\n\n if(typeof module !== 'undefined') module.exports = assignKey;\n\n})(this);\n","/**\n * Root reference for iframes.\n */\n\nvar root;\nif (typeof window !== 'undefined') { // Browser window\n root = window;\n} else if (typeof self !== 'undefined') { // Web Worker\n root = self;\n} else { // Other environments\n console.warn(\"Using browser-only version of superagent in non-browser environment\");\n root = this;\n}\n\nvar Emitter = require('emitter');\nvar requestBase = require('./request-base');\nvar isObject = require('./is-object');\n\n/**\n * Noop.\n */\n\nfunction noop(){};\n\n/**\n * Expose `request`.\n */\n\nvar request = module.exports = require('./request').bind(null, Request);\n\n/**\n * Determine XHR.\n */\n\nrequest.getXHR = function () {\n if (root.XMLHttpRequest\n && (!root.location || 'file:' != root.location.protocol\n || !root.ActiveXObject)) {\n return new XMLHttpRequest;\n } else {\n try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}\n }\n throw Error(\"Browser-only verison of superagent could not find XHR\");\n};\n\n/**\n * Removes leading and trailing whitespace, added to support IE.\n *\n * @param {String} s\n * @return {String}\n * @api private\n */\n\nvar trim = ''.trim\n ? function(s) { return s.trim(); }\n : function(s) { return s.replace(/(^\\s*|\\s*$)/g, ''); };\n\n/**\n * Serialize the given `obj`.\n *\n * @param {Object} obj\n * @return {String}\n * @api private\n */\n\nfunction serialize(obj) {\n if (!isObject(obj)) return obj;\n var pairs = [];\n for (var key in obj) {\n pushEncodedKeyValuePair(pairs, key, obj[key]);\n }\n return pairs.join('&');\n}\n\n/**\n * Helps 'serialize' with serializing arrays.\n * Mutates the pairs array.\n *\n * @param {Array} pairs\n * @param {String} key\n * @param {Mixed} val\n */\n\nfunction pushEncodedKeyValuePair(pairs, key, val) {\n if (val != null) {\n if (Array.isArray(val)) {\n val.forEach(function(v) {\n pushEncodedKeyValuePair(pairs, key, v);\n });\n } else if (isObject(val)) {\n for(var subkey in val) {\n pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);\n }\n } else {\n pairs.push(encodeURIComponent(key)\n + '=' + encodeURIComponent(val));\n }\n } else if (val === null) {\n pairs.push(encodeURIComponent(key));\n }\n}\n\n/**\n * Expose serialization method.\n */\n\n request.serializeObject = serialize;\n\n /**\n * Parse the given x-www-form-urlencoded `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseString(str) {\n var obj = {};\n var pairs = str.split('&');\n var pair;\n var pos;\n\n for (var i = 0, len = pairs.length; i < len; ++i) {\n pair = pairs[i];\n pos = pair.indexOf('=');\n if (pos == -1) {\n obj[decodeURIComponent(pair)] = '';\n } else {\n obj[decodeURIComponent(pair.slice(0, pos))] =\n decodeURIComponent(pair.slice(pos + 1));\n }\n }\n\n return obj;\n}\n\n/**\n * Expose parser.\n */\n\nrequest.parseString = parseString;\n\n/**\n * Default MIME type map.\n *\n * superagent.types.xml = 'application/xml';\n *\n */\n\nrequest.types = {\n html: 'text/html',\n json: 'application/json',\n xml: 'application/xml',\n urlencoded: 'application/x-www-form-urlencoded',\n 'form': 'application/x-www-form-urlencoded',\n 'form-data': 'application/x-www-form-urlencoded'\n};\n\n/**\n * Default serialization map.\n *\n * superagent.serialize['application/xml'] = function(obj){\n * return 'generated xml here';\n * };\n *\n */\n\n request.serialize = {\n 'application/x-www-form-urlencoded': serialize,\n 'application/json': JSON.stringify\n };\n\n /**\n * Default parsers.\n *\n * superagent.parse['application/xml'] = function(str){\n * return { object parsed from str };\n * };\n *\n */\n\nrequest.parse = {\n 'application/x-www-form-urlencoded': parseString,\n 'application/json': JSON.parse\n};\n\n/**\n * Parse the given header `str` into\n * an object containing the mapped fields.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseHeader(str) {\n var lines = str.split(/\\r?\\n/);\n var fields = {};\n var index;\n var line;\n var field;\n var val;\n\n lines.pop(); // trailing CRLF\n\n for (var i = 0, len = lines.length; i < len; ++i) {\n line = lines[i];\n index = line.indexOf(':');\n field = line.slice(0, index).toLowerCase();\n val = trim(line.slice(index + 1));\n fields[field] = val;\n }\n\n return fields;\n}\n\n/**\n * Check if `mime` is json or has +json structured syntax suffix.\n *\n * @param {String} mime\n * @return {Boolean}\n * @api private\n */\n\nfunction isJSON(mime) {\n return /[\\/+]json\\b/.test(mime);\n}\n\n/**\n * Return the mime type for the given `str`.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nfunction type(str){\n return str.split(/ *; */).shift();\n};\n\n/**\n * Return header field parameters.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction params(str){\n return str.split(/ *; */).reduce(function(obj, str){\n var parts = str.split(/ *= */),\n key = parts.shift(),\n val = parts.shift();\n\n if (key && val) obj[key] = val;\n return obj;\n }, {});\n};\n\n/**\n * Initialize a new `Response` with the given `xhr`.\n *\n * - set flags (.ok, .error, etc)\n * - parse header\n *\n * Examples:\n *\n * Aliasing `superagent` as `request` is nice:\n *\n * request = superagent;\n *\n * We can use the promise-like API, or pass callbacks:\n *\n * request.get('/').end(function(res){});\n * request.get('/', function(res){});\n *\n * Sending data can be chained:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' })\n * .end(function(res){});\n *\n * Or passed to `.send()`:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' }, function(res){});\n *\n * Or passed to `.post()`:\n *\n * request\n * .post('/user', { name: 'tj' })\n * .end(function(res){});\n *\n * Or further reduced to a single call for simple cases:\n *\n * request\n * .post('/user', { name: 'tj' }, function(res){});\n *\n * @param {XMLHTTPRequest} xhr\n * @param {Object} options\n * @api private\n */\n\nfunction Response(req, options) {\n options = options || {};\n this.req = req;\n this.xhr = this.req.xhr;\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')\n ? this.xhr.responseText\n : null;\n this.statusText = this.req.xhr.statusText;\n this._setStatusProperties(this.xhr.status);\n this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());\n // getAllResponseHeaders sometimes falsely returns \"\" for CORS requests, but\n // getResponseHeader still works. so we get content-type even if getting\n // other headers fails.\n this.header['content-type'] = this.xhr.getResponseHeader('content-type');\n this._setHeaderProperties(this.header);\n this.body = this.req.method != 'HEAD'\n ? this._parseBody(this.text ? this.text : this.xhr.response)\n : null;\n}\n\n/**\n * Get case-insensitive `field` value.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nResponse.prototype.get = function(field){\n return this.header[field.toLowerCase()];\n};\n\n/**\n * Set header related properties:\n *\n * - `.type` the content type without params\n *\n * A response of \"Content-Type: text/plain; charset=utf-8\"\n * will provide you with a `.type` of \"text/plain\".\n *\n * @param {Object} header\n * @api private\n */\n\nResponse.prototype._setHeaderProperties = function(header){\n // content-type\n var ct = this.header['content-type'] || '';\n this.type = type(ct);\n\n // params\n var obj = params(ct);\n for (var key in obj) this[key] = obj[key];\n};\n\n/**\n * Parse the given body `str`.\n *\n * Used for auto-parsing of bodies. Parsers\n * are defined on the `superagent.parse` object.\n *\n * @param {String} str\n * @return {Mixed}\n * @api private\n */\n\nResponse.prototype._parseBody = function(str){\n var parse = request.parse[this.type];\n if (!parse && isJSON(this.type)) {\n parse = request.parse['application/json'];\n }\n return parse && str && (str.length || str instanceof Object)\n ? parse(str)\n : null;\n};\n\n/**\n * Set flags such as `.ok` based on `status`.\n *\n * For example a 2xx response will give you a `.ok` of __true__\n * whereas 5xx will be __false__ and `.error` will be __true__. The\n * `.clientError` and `.serverError` are also available to be more\n * specific, and `.statusType` is the class of error ranging from 1..5\n * sometimes useful for mapping respond colors etc.\n *\n * \"sugar\" properties are also defined for common cases. Currently providing:\n *\n * - .noContent\n * - .badRequest\n * - .unauthorized\n * - .notAcceptable\n * - .notFound\n *\n * @param {Number} status\n * @api private\n */\n\nResponse.prototype._setStatusProperties = function(status){\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n if (status === 1223) {\n status = 204;\n }\n\n var type = status / 100 | 0;\n\n // status / class\n this.status = this.statusCode = status;\n this.statusType = type;\n\n // basics\n this.info = 1 == type;\n this.ok = 2 == type;\n this.clientError = 4 == type;\n this.serverError = 5 == type;\n this.error = (4 == type || 5 == type)\n ? this.toError()\n : false;\n\n // sugar\n this.accepted = 202 == status;\n this.noContent = 204 == status;\n this.badRequest = 400 == status;\n this.unauthorized = 401 == status;\n this.notAcceptable = 406 == status;\n this.notFound = 404 == status;\n this.forbidden = 403 == status;\n};\n\n/**\n * Return an `Error` representative of this response.\n *\n * @return {Error}\n * @api public\n */\n\nResponse.prototype.toError = function(){\n var req = this.req;\n var method = req.method;\n var url = req.url;\n\n var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';\n var err = new Error(msg);\n err.status = this.status;\n err.method = method;\n err.url = url;\n\n return err;\n};\n\n/**\n * Expose `Response`.\n */\n\nrequest.Response = Response;\n\n/**\n * Initialize a new `Request` with the given `method` and `url`.\n *\n * @param {String} method\n * @param {String} url\n * @api public\n */\n\nfunction Request(method, url) {\n var self = this;\n this._query = this._query || [];\n this.method = method;\n this.url = url;\n this.header = {}; // preserves header name case\n this._header = {}; // coerces header names to lowercase\n this.on('end', function(){\n var err = null;\n var res = null;\n\n try {\n res = new Response(self);\n } catch(e) {\n err = new Error('Parser is unable to parse the response');\n err.parse = true;\n err.original = e;\n // issue #675: return the raw response if the response parsing fails\n err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null;\n // issue #876: return the http status code if the response parsing fails\n err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : null;\n return self.callback(err);\n }\n\n self.emit('response', res);\n\n var new_err;\n try {\n if (res.status < 200 || res.status >= 300) {\n new_err = new Error(res.statusText || 'Unsuccessful HTTP response');\n new_err.original = err;\n new_err.response = res;\n new_err.status = res.status;\n }\n } catch(e) {\n new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android\n }\n\n // #1000 don't catch errors from the callback to avoid double calling it\n if (new_err) {\n self.callback(new_err, res);\n } else {\n self.callback(null, res);\n }\n });\n}\n\n/**\n * Mixin `Emitter` and `requestBase`.\n */\n\nEmitter(Request.prototype);\nfor (var key in requestBase) {\n Request.prototype[key] = requestBase[key];\n}\n\n/**\n * Set Content-Type to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.xml = 'application/xml';\n *\n * request.post('/')\n * .type('xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * request.post('/')\n * .type('application/xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * @param {String} type\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.type = function(type){\n this.set('Content-Type', request.types[type] || type);\n return this;\n};\n\n/**\n * Set responseType to `val`. Presently valid responseTypes are 'blob' and\n * 'arraybuffer'.\n *\n * Examples:\n *\n * req.get('/')\n * .responseType('blob')\n * .end(callback);\n *\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.responseType = function(val){\n this._responseType = val;\n return this;\n};\n\n/**\n * Set Accept to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.json = 'application/json';\n *\n * request.get('/agent')\n * .accept('json')\n * .end(callback);\n *\n * request.get('/agent')\n * .accept('application/json')\n * .end(callback);\n *\n * @param {String} accept\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.accept = function(type){\n this.set('Accept', request.types[type] || type);\n return this;\n};\n\n/**\n * Set Authorization field value with `user` and `pass`.\n *\n * @param {String} user\n * @param {String} pass\n * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.auth = function(user, pass, options){\n if (!options) {\n options = {\n type: 'basic'\n }\n }\n\n switch (options.type) {\n case 'basic':\n var str = btoa(user + ':' + pass);\n this.set('Authorization', 'Basic ' + str);\n break;\n\n case 'auto':\n this.username = user;\n this.password = pass;\n break;\n }\n return this;\n};\n\n/**\n* Add query-string `val`.\n*\n* Examples:\n*\n* request.get('/shoes')\n* .query('size=10')\n* .query({ color: 'blue' })\n*\n* @param {Object|String} val\n* @return {Request} for chaining\n* @api public\n*/\n\nRequest.prototype.query = function(val){\n if ('string' != typeof val) val = serialize(val);\n if (val) this._query.push(val);\n return this;\n};\n\n/**\n * Queue the given `file` as an attachment to the specified `field`,\n * with optional `filename`.\n *\n * ``` js\n * request.post('/upload')\n * .attach('content', new Blob(['<a id=\"a\"><b id=\"b\">hey!</b></a>'], { type: \"text/html\"}))\n * .end(callback);\n * ```\n *\n * @param {String} field\n * @param {Blob|File} file\n * @param {String} filename\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.attach = function(field, file, filename){\n this._getFormData().append(field, file, filename || file.name);\n return this;\n};\n\nRequest.prototype._getFormData = function(){\n if (!this._formData) {\n this._formData = new root.FormData();\n }\n return this._formData;\n};\n\n/**\n * Invoke the callback with `err` and `res`\n * and handle arity check.\n *\n * @param {Error} err\n * @param {Response} res\n * @api private\n */\n\nRequest.prototype.callback = function(err, res){\n var fn = this._callback;\n this.clearTimeout();\n fn(err, res);\n};\n\n/**\n * Invoke callback with x-domain error.\n *\n * @api private\n */\n\nRequest.prototype.crossDomainError = function(){\n var err = new Error('Request has been terminated\\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');\n err.crossDomain = true;\n\n err.status = this.status;\n err.method = this.method;\n err.url = this.url;\n\n this.callback(err);\n};\n\n/**\n * Invoke callback with timeout error.\n *\n * @api private\n */\n\nRequest.prototype._timeoutError = function(){\n var timeout = this._timeout;\n var err = new Error('timeout of ' + timeout + 'ms exceeded');\n err.timeout = timeout;\n this.callback(err);\n};\n\n/**\n * Compose querystring to append to req.url\n *\n * @api private\n */\n\nRequest.prototype._appendQueryString = function(){\n var query = this._query.join('&');\n if (query) {\n this.url += ~this.url.indexOf('?')\n ? '&' + query\n : '?' + query;\n }\n};\n\n/**\n * Initiate request, invoking callback `fn(res)`\n * with an instanceof `Response`.\n *\n * @param {Function} fn\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.end = function(fn){\n var self = this;\n var xhr = this.xhr = request.getXHR();\n var timeout = this._timeout;\n var data = this._formData || this._data;\n\n // store callback\n this._callback = fn || noop;\n\n // state change\n xhr.onreadystatechange = function(){\n if (4 != xhr.readyState) return;\n\n // In IE9, reads to any property (e.g. status) off of an aborted XHR will\n // result in the error \"Could not complete the operation due to error c00c023f\"\n var status;\n try { status = xhr.status } catch(e) { status = 0; }\n\n if (0 == status) {\n if (self.timedout) return self._timeoutError();\n if (self._aborted) return;\n return self.crossDomainError();\n }\n self.emit('end');\n };\n\n // progress\n var handleProgress = function(direction, e) {\n if (e.total > 0) {\n e.percent = e.loaded / e.total * 100;\n }\n e.direction = direction;\n self.emit('progress', e);\n }\n if (this.hasListeners('progress')) {\n try {\n xhr.onprogress = handleProgress.bind(null, 'download');\n if (xhr.upload) {\n xhr.upload.onprogress = handleProgress.bind(null, 'upload');\n }\n } catch(e) {\n // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.\n // Reported here:\n // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context\n }\n }\n\n // timeout\n if (timeout && !this._timer) {\n this._timer = setTimeout(function(){\n self.timedout = true;\n self.abort();\n }, timeout);\n }\n\n // querystring\n this._appendQueryString();\n\n // initiate request\n if (this.username && this.password) {\n xhr.open(this.method, this.url, true, this.username, this.password);\n } else {\n xhr.open(this.method, this.url, true);\n }\n\n // CORS\n if (this._withCredentials) xhr.withCredentials = true;\n\n // body\n if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) {\n // serialize stuff\n var contentType = this._header['content-type'];\n var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];\n if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];\n if (serialize) data = serialize(data);\n }\n\n // set header fields\n for (var field in this.header) {\n if (null == this.header[field]) continue;\n xhr.setRequestHeader(field, this.header[field]);\n }\n\n if (this._responseType) {\n xhr.responseType = this._responseType;\n }\n\n // send stuff\n this.emit('request', this);\n\n // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)\n // We need null here if data is undefined\n xhr.send(typeof data !== 'undefined' ? data : null);\n return this;\n};\n\n\n/**\n * Expose `Request`.\n */\n\nrequest.Request = Request;\n\n/**\n * GET `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.get = function(url, data, fn){\n var req = request('GET', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.query(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * HEAD `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.head = function(url, data, fn){\n var req = request('HEAD', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * OPTIONS query to `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.options = function(url, data, fn){\n var req = request('OPTIONS', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * DELETE `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nfunction del(url, fn){\n var req = request('DELETE', url);\n if (fn) req.end(fn);\n return req;\n};\n\nrequest['del'] = del;\nrequest['delete'] = del;\n\n/**\n * PATCH `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.patch = function(url, data, fn){\n var req = request('PATCH', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * POST `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.post = function(url, data, fn){\n var req = request('POST', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * PUT `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.put = function(url, data, fn){\n var req = request('PUT', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n","/**\n * Check if `obj` is an object.\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nfunction isObject(obj) {\n return null !== obj && 'object' === typeof obj;\n}\n\nmodule.exports = isObject;\n","/**\n * Module of mixed-in functions shared between node and client code\n */\nvar isObject = require('./is-object');\n\n/**\n * Clear previous timeout.\n *\n * @return {Request} for chaining\n * @api public\n */\n\nexports.clearTimeout = function _clearTimeout(){\n this._timeout = 0;\n clearTimeout(this._timer);\n return this;\n};\n\n/**\n * Override default response body parser\n *\n * This function will be called to convert incoming data into request.body\n *\n * @param {Function}\n * @api public\n */\n\nexports.parse = function parse(fn){\n this._parser = fn;\n return this;\n};\n\n/**\n * Override default request body serializer\n *\n * This function will be called to convert data set via .send or .attach into payload to send\n *\n * @param {Function}\n * @api public\n */\n\nexports.serialize = function serialize(fn){\n this._serializer = fn;\n return this;\n};\n\n/**\n * Set timeout to `ms`.\n *\n * @param {Number} ms\n * @return {Request} for chaining\n * @api public\n */\n\nexports.timeout = function timeout(ms){\n this._timeout = ms;\n return this;\n};\n\n/**\n * Promise support\n *\n * @param {Function} resolve\n * @param {Function} reject\n * @return {Request}\n */\n\nexports.then = function then(resolve, reject) {\n if (!this._fullfilledPromise) {\n var self = this;\n this._fullfilledPromise = new Promise(function(innerResolve, innerReject){\n self.end(function(err, res){\n if (err) innerReject(err); else innerResolve(res);\n });\n });\n }\n return this._fullfilledPromise.then(resolve, reject);\n}\n\nexports.catch = function(cb) {\n return this.then(undefined, cb);\n};\n\n/**\n * Allow for extension\n */\n\nexports.use = function use(fn) {\n fn(this);\n return this;\n}\n\n\n/**\n * Get request header `field`.\n * Case-insensitive.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nexports.get = function(field){\n return this._header[field.toLowerCase()];\n};\n\n/**\n * Get case-insensitive header `field` value.\n * This is a deprecated internal API. Use `.get(field)` instead.\n *\n * (getHeader is no longer used internally by the superagent code base)\n *\n * @param {String} field\n * @return {String}\n * @api private\n * @deprecated\n */\n\nexports.getHeader = exports.get;\n\n/**\n * Set header `field` to `val`, or multiple fields with one object.\n * Case-insensitive.\n *\n * Examples:\n *\n * req.get('/')\n * .set('Accept', 'application/json')\n * .set('X-API-Key', 'foobar')\n * .end(callback);\n *\n * req.get('/')\n * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })\n * .end(callback);\n *\n * @param {String|Object} field\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nexports.set = function(field, val){\n if (isObject(field)) {\n for (var key in field) {\n this.set(key, field[key]);\n }\n return this;\n }\n this._header[field.toLowerCase()] = val;\n this.header[field] = val;\n return this;\n};\n\n/**\n * Remove header `field`.\n * Case-insensitive.\n *\n * Example:\n *\n * req.get('/')\n * .unset('User-Agent')\n * .end(callback);\n *\n * @param {String} field\n */\nexports.unset = function(field){\n delete this._header[field.toLowerCase()];\n delete this.header[field];\n return this;\n};\n\n/**\n * Write the field `name` and `val`, or multiple fields with one object\n * for \"multipart/form-data\" request bodies.\n *\n * ``` js\n * request.post('/upload')\n * .field('foo', 'bar')\n * .end(callback);\n *\n * request.post('/upload')\n * .field({ foo: 'bar', baz: 'qux' })\n * .end(callback);\n * ```\n *\n * @param {String|Object} name\n * @param {String|Blob|File|Buffer|fs.ReadStream} val\n * @return {Request} for chaining\n * @api public\n */\nexports.field = function(name, val) {\n\n // name should be either a string or an object.\n if (null === name || undefined === name) {\n throw new Error('.field(name, val) name can not be empty');\n }\n\n if (isObject(name)) {\n for (var key in name) {\n this.field(key, name[key]);\n }\n return this;\n }\n\n // val should be defined now\n if (null === val || undefined === val) {\n throw new Error('.field(name, val) val can not be empty');\n }\n this._getFormData().append(name, val);\n return this;\n};\n\n/**\n * Abort the request, and clear potential timeout.\n *\n * @return {Request}\n * @api public\n */\nexports.abort = function(){\n if (this._aborted) {\n return this;\n }\n this._aborted = true;\n this.xhr && this.xhr.abort(); // browser\n this.req && this.req.abort(); // node\n this.clearTimeout();\n this.emit('abort');\n return this;\n};\n\n/**\n * Enable transmission of cookies with x-domain requests.\n *\n * Note that for this to work the origin must not be\n * using \"Access-Control-Allow-Origin\" with a wildcard,\n * and also must set \"Access-Control-Allow-Credentials\"\n * to \"true\".\n *\n * @api public\n */\n\nexports.withCredentials = function(){\n // This is browser-only functionality. Node side is no-op.\n this._withCredentials = true;\n return this;\n};\n\n/**\n * Set the max redirects to `n`. Does noting in browser XHR implementation.\n *\n * @param {Number} n\n * @return {Request} for chaining\n * @api public\n */\n\nexports.redirects = function(n){\n this._maxRedirects = n;\n return this;\n};\n\n/**\n * Convert to a plain javascript object (not JSON string) of scalar properties.\n * Note as this method is designed to return a useful non-this value,\n * it cannot be chained.\n *\n * @return {Object} describing method, url, and data of this request\n * @api public\n */\n\nexports.toJSON = function(){\n return {\n method: this.method,\n url: this.url,\n data: this._data,\n headers: this._header\n };\n};\n\n/**\n * Check if `obj` is a host object,\n * we don't want to serialize these :)\n *\n * TODO: future proof, move to compoent land\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nexports._isHost = function _isHost(obj) {\n var str = {}.toString.call(obj);\n\n switch (str) {\n case '[object File]':\n case '[object Blob]':\n case '[object FormData]':\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Send `data` as the request body, defaulting the `.type()` to \"json\" when\n * an object is given.\n *\n * Examples:\n *\n * // manual json\n * request.post('/user')\n * .type('json')\n * .send('{\"name\":\"tj\"}')\n * .end(callback)\n *\n * // auto json\n * request.post('/user')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // manual x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send('name=tj')\n * .end(callback)\n *\n * // auto x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // defaults to x-www-form-urlencoded\n * request.post('/user')\n * .send('name=tobi')\n * .send('species=ferret')\n * .end(callback)\n *\n * @param {String|Object} data\n * @return {Request} for chaining\n * @api public\n */\n\nexports.send = function(data){\n var obj = isObject(data);\n var type = this._header['content-type'];\n\n // merge\n if (obj && isObject(this._data)) {\n for (var key in data) {\n this._data[key] = data[key];\n }\n } else if ('string' == typeof data) {\n // default to x-www-form-urlencoded\n if (!type) this.type('form');\n type = this._header['content-type'];\n if ('application/x-www-form-urlencoded' == type) {\n this._data = this._data\n ? this._data + '&' + data\n : data;\n } else {\n this._data = (this._data || '') + data;\n }\n } else {\n this._data = data;\n }\n\n if (!obj || this._isHost(data)) return this;\n\n // default to json\n if (!type) this.type('json');\n return this;\n};\n","// The node and browser modules expose versions of this with the\n// appropriate constructor function bound as first argument\n/**\n * Issue a request:\n *\n * Examples:\n *\n * request('GET', '/users').end(callback)\n * request('/users').end(callback)\n * request('/users', callback)\n *\n * @param {String} method\n * @param {String|Function} url or callback\n * @return {Request}\n * @api public\n */\n\nfunction request(RequestConstructor, method, url) {\n // callback\n if ('function' == typeof url) {\n return new RequestConstructor('GET', method).end(url);\n }\n\n // url first\n if (2 == arguments.length) {\n return new RequestConstructor('GET', method);\n }\n\n return new RequestConstructor(method, url);\n}\n\nmodule.exports = request;\n"]}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tungsten
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-28 00:00:00.000000000 Z
12
+ date: 2017-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -165,11 +165,12 @@ files:
165
165
  - app/assets/images/tungsten/logo.svg
166
166
  - app/assets/images/tungsten/num.svg
167
167
  - app/assets/images/tungsten/safari-pinned-tab.svg
168
- - app/assets/javascripts/tungsten/_form_helpers.js
168
+ - app/assets/javascripts/tungsten/_form-helpers.js
169
169
  - app/assets/javascripts/tungsten/_icons.js
170
170
  - app/assets/javascripts/tungsten/code.js
171
171
  - app/assets/javascripts/tungsten/enhancements/clipboard.js
172
- - app/assets/javascripts/tungsten/enhancements/form-flash.js
172
+ - app/assets/javascripts/tungsten/enhancements/flash-messages.js
173
+ - app/assets/javascripts/tungsten/enhancements/notify.js
173
174
  - app/assets/javascripts/tungsten/tungsten.js
174
175
  - app/assets/stylesheets/tungsten/_colors.yml
175
176
  - app/assets/stylesheets/tungsten/_index.scss
@@ -181,6 +182,8 @@ files:
181
182
  - app/assets/stylesheets/tungsten/components/_buttons.scss
182
183
  - app/assets/stylesheets/tungsten/components/_cards.scss
183
184
  - app/assets/stylesheets/tungsten/components/_index.scss
185
+ - app/assets/stylesheets/tungsten/components/_notices.scss
186
+ - app/assets/stylesheets/tungsten/components/_notifications.scss
184
187
  - app/assets/stylesheets/tungsten/components/_tables.scss
185
188
  - app/assets/stylesheets/tungsten/components/_tooltip.scss
186
189
  - app/assets/stylesheets/tungsten/core/_animations.scss
@@ -211,6 +214,7 @@ files:
211
214
  - app/helpers/tungsten/error_helper.rb
212
215
  - app/helpers/tungsten/form_helper.rb
213
216
  - app/helpers/tungsten/layout_helper.rb
217
+ - app/helpers/tungsten/notice_helper.rb
214
218
  - app/helpers/tungsten/section_helper.rb
215
219
  - app/helpers/tungsten/toggle_nav_helper.rb
216
220
  - app/views/layouts/tungsten/default.html.slim
@@ -234,14 +238,14 @@ files:
234
238
  - lib/tungsten.rb
235
239
  - lib/tungsten/helper.rb
236
240
  - lib/tungsten/version.rb
237
- - public/code-0.1.17.js
238
- - public/code-0.1.17.js.gz
239
- - public/code-0.1.17.map.json
240
- - public/tungsten-0.1.17.css
241
- - public/tungsten-0.1.17.css.gz
242
- - public/tungsten-0.1.17.js
243
- - public/tungsten-0.1.17.js.gz
244
- - public/tungsten-0.1.17.map.json
241
+ - public/code-0.1.18.js
242
+ - public/code-0.1.18.js.gz
243
+ - public/code-0.1.18.map.json
244
+ - public/tungsten-0.1.18.css
245
+ - public/tungsten-0.1.18.css.gz
246
+ - public/tungsten-0.1.18.js
247
+ - public/tungsten-0.1.18.js.gz
248
+ - public/tungsten-0.1.18.map.json
245
249
  homepage:
246
250
  licenses:
247
251
  - MIT
Binary file
Binary file
@@ -1 +0,0 @@
1
- {"version":3,"sources":["node_modules/browser-pack/_prelude.js","app/assets/javascripts/tungsten/_form_helpers.js","app/assets/javascripts/tungsten/_icons.js","app/assets/javascripts/tungsten/enhancements/clipboard.js","app/assets/javascripts/tungsten/tungsten.js","node_modules/bean/bean.js","node_modules/component-emitter/index.js","node_modules/compose-event/index.js","node_modules/compose-event/lib/animation-events.js","node_modules/compose-event/lib/bubble-form-events.js","node_modules/compose-event/lib/callback-manager.js","node_modules/compose-event/lib/debounce.js","node_modules/compose-event/lib/delay.js","node_modules/compose-event/lib/media.js","node_modules/compose-event/lib/optimized-event-manager.js","node_modules/compose-event/lib/page.js","node_modules/compose-event/lib/repeat.js","node_modules/compose-event/lib/resize.js","node_modules/compose-event/lib/scroll.js","node_modules/compose-event/lib/shims/custom-event.js","node_modules/compose-event/lib/tap-events.js","node_modules/compose-event/lib/throttle.js","node_modules/compose-form-up/index.js","node_modules/compose-form-up/lib/progressive.js","node_modules/compose-form-up/lib/validation.js","node_modules/compose-slider/index.js","node_modules/compose-slider/lib/object.assign.js","node_modules/compose-toggler/index.js","node_modules/compose-toolbox/index.js","node_modules/compose-toolbox/lib/ease.js","node_modules/compose-toolbox/lib/fromtop.js","node_modules/compose-toolbox/lib/scrollto.js","node_modules/compose-toolbox/lib/shims/_classlist.js","node_modules/compose-toolbox/lib/shims/_object.assign.js","node_modules/keymaster/keymaster.js","node_modules/superagent/lib/client.js","node_modules/superagent/lib/is-object.js","node_modules/superagent/lib/request-base.js","node_modules/superagent/lib/request.js"],"names":["syncValue","input","target","classList","toggle","value","trim","length","toolbox","require","Event","event","textSelectors","change","each","document","querySelectorAll","on","embed","querySelector","insertAdjacentHTML","readyState","window","Turbolinks","addEventListener","clipboard","copy","console","log","copyTrigger","currentTarget","copyElement","dataset","copyTarget","preventDefault","select","execCommand","blur","add","setTimeout","remove","err","alert","module","exports","toggler","formUp","ajax","scroll","disablePointer","Tungsten","merge","form","name","context","definition","define","amd","this","selectorEngine","win","old","namespaceRegex","nameRegex","addEvent","doc","root","documentElement","W3C_MODEL","eventSupport","ONE","slice","Array","prototype","str2arr","s","d","split","isString","o","isFunction","isObject","buildOptions","originalDefaults","maybeOptions","defaults","key","hasOwnProperty","nativeEvents","hash","events","i","customEvents","isAncestor","element","container","compareDocumentPosition","nodeType","contains","parentNode","check","related","relatedTarget","prefix","test","toString","mouseenter","base","condition","mouseleave","mousewheel","navigator","userAgent","commonProps","mouseProps","concat","mouseWheelProps","keyProps","textProps","touchProps","messageProps","stateProps","overOutRegex","typeFixers","reg","fix","newEvent","keyCode","which","type","rightClick","button","pos","x","y","pageX","pageY","clientX","clientY","body","scrollLeft","scrollTop","typeFixerMap","isNative","arguments","ownerDocument","parentWindow","originalEvent","isBean","l","p","props","fixer","srcElement","returnValue","stopPropagation","cancelBubble","stop","stopped","stopImmediatePropagation","isImmediatePropagationStopped","clone","ne","targetElement","RegEntry","wrappedHandler","fn","args","call","eargs","apply","findTarget","eventElement","__beanDel","ft","handler","original","namespaces","customType","once","removeListener","eventType","inNamespaces","checkNamespaces","j","c","matches","checkElement","checkOriginal","checkHandler","registry","map","forAll","pfx","list","all","t","charAt","substr","has","get","entries","entry","push","put","del","splice","removed","setSelectorEngine","e","r","Error","rootListener","propertyName","listeners","listener","custom","useCapture","attachEvent","detachEvent","rm","originalFn","orgType","replace","handlers","delegate","selector","array","match","fireListener","evt","createEvent","dispatchEvent","fireEvent","createEventObject","off","typeSpec","k","isTypeStr","defaultOpts","opts","indexOf","types","first","undefined","delfn","options","one","fire","names","from","beanDel","bean","noConflict","cleanup","CollectGarbage","Emitter","obj","mixin","_callbacks","removeAllListeners","removeEventListener","callbacks","cb","emit","len","hasListeners","setEvent","forEach","animationEvent","transform","isEmpty","join","registerType","transformArgs","arg","keyOne","keys","scope","unbind","afterAnimation","el","callback","getComputedStyle","getPropertyValue","transformedArgs","newEvents","shift","objEvents","touchstart","tap","a","Object","page","debounce","throttle","delay","repeat","bubbleFormEvents","resize","callbackManager","media","formBubbling","ready","keyOn","keyOff","camelCaseEventTypes","animationstart","animationend","animationiteration","lowerCaseEventTypes","getAnimationEventTypes","prefixes","style","animationName","toLowerCase","transformAnimationEvents","cssAnimEventTypes","env","error","supported","formEls","fireBubble","detail","triggered","ev","CustomEvent","bubbles","cancelable","defaultPrevented","tagName","bubbleOn","bubbleOff","Manager","new","manager","start","bool","enabled","now","Date","pickFunction","found","candidate","wait","max","leading","trailing","leadingFn","trailingFn","queued","handle","lastCalled","lastInvoked","leadingBlocked","invoke","callType","addToQueue","requestAnimationFrame","loop","removeFromQueue","cancelAnimationFrame","maxPassed","waitReached","debounced","argsStart","queueDelay","complete","parseQuery","query","dimension","result","min","size","num","limit","toPx","width","listen","minWidth","maxWidth","height","minHeight","maxHeight","matchMedia","addListener","optimizedEventManager","run","running","started","toUpperCase","substring","readyAlready","changed","cancel","disableAnimation","head","pointerEvents","params","initCustomEvent","Tap","e1","done","e2","clearTimeout","timeout_id","endEvents","touches","timeout","validation","progressive","validate","invalidateField","next","reset","formCallbacks","registeredForms","newForm","currentStep","steps","stepIndex","nextStep","active","disabled","forward","showStep","index","Number","step","direction","dismiss","show","disable","revisit","disableOtherFieldsets","firstInput","focus","setNav","nav","enableFieldsets","fieldset","trigger","formEl","getClosest","fireCallbacks","getCallbacks","formData","filter","Callback","formSelector","watching","nextSelector","backSelector","createElement","checkValidity","validateForm","invalidInput","inputs","some","checkInput","showMessage","statusEl","valid","isValid","activeElement","setAttribute","message","checkValue","checkLength","setCustomValidity","invalidValue","regexp","escapedRegex","cachedMessage","invalidValueMessage","str","RegExp","checkCount","goal","lessThanGoal","wordCount","phrasing","display","nextSibling","submit","checkValidation","hideMessage","msg","removeChild","label","validationMessage","existingMessage","textContent","innerHTML","invalidHandler","sliders","listening","Slider","self","refresh","slider","setLabels","setInput","setFill","setup","ranges","data","id","template","getAttribute","labels","externalLabels","assign","extractData","extractValues","getLabels","values","segments","camelCase","removeAttribute","inputClass","inputExists","getLineLabels","mark","getData","val","delimiter","external","default","labelCount","objectSize","lineLabels","containerHTML","templateHTML","classes","previousSibling","outerHTML","html","fills","labelTemplate","labelHTML","positionLabel","labelMeta","position","altKey","meta","attributes","nodeName","nodeValue","labelElements","internalSelector","externalSelector","sliderIndex","fill","offsetParent","labelEls","labelAtIndex","set","object","group","TypeError","output","source","nextKey","Toggler","checkboxSelector","radioSelector","selectSelector","hashChange","location","anchor","checked","getSelectFromOption","selectedIndex","ratchet","triggerToggling","toggleCheckboxes","setupSelects","setupRadios","actions","selectedOptions","action","dispatch","setClass","setState","selectors","sel","settings","classnames","classname","method","triggerTogglerEventsOnChildren","state","toggleAction","focusEl","hide","getLeafNodes","parent","hasChildNodes","getElementsByTagName","elem","children","eventName","leafChildNodes","node","checkboxes","radio","togglerActive","radioName","siblings","parentForm","showSelectors","dataAttributes","addClassSelectors","addClass","removeClass","option","parentElement","elements","attr","scrollTo","fromTop","ease","getNext","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","count","collection","rootEl","FormData","fields","field","append","inOutQuad","b","inOutCubic","inOutQuint","ts","tc","inOutCirc","Math","sqrt","round","getBoundingClientRect","top","pageYOffset","move","amount","to","duration","currentTime","animateScroll","testElement","createMethod","DOMTokenList","token","_toggle","force","view","elemCtrProto","Element","objCtr","strTrim","String","arrIndexOf","item","DOMEx","code","DOMException","checkTokenAndGetIndex","ClassList","trimmedClasses","_updateClassName","classListProto","classListGetter","tokens","iter","updated","defineProperty","classListPropDesc","enumerable","configurable","ex","number","__defineGetter__","global","compareArray","a1","a2","updateModifierKey","_mods","modifierMap","modifiersMatch","_downKeys","_MODIFIERS","assignKey","_handlers","getScope","mods","clearModifier","resetModifiers","getKeys","getMods","shortcut","unbindKey","multipleKeys","isPressed","getPressedKeyCodes","setScope","_scope","deleteScope","mi","previousKey","16","18","17","91","⇧","⌥","alt","⌃","ctrl","control","⌘","command","_MAP","backspace","tab","clear","enter","return","esc","escape","space","left","up","right","down","delete","home","end","pageup","pagedown",",",".","/","`","-","=",";","'","[","]","\\","charCodeAt","noop","serialize","pairs","pushEncodedKeyValuePair","isArray","v","subkey","encodeURIComponent","parseString","pair","decodeURIComponent","parseHeader","line","lines","pop","isJSON","mime","reduce","parts","Response","req","xhr","text","responseType","responseText","statusText","_setStatusProperties","status","header","headers","getAllResponseHeaders","getResponseHeader","_setHeaderProperties","_parseBody","response","Request","url","_query","_header","res","parse","rawResponse","statusCode","new_err","request","warn","requestBase","bind","getXHR","XMLHttpRequest","protocol","ActiveXObject","serializeObject","json","xml","urlencoded","form-data","application/x-www-form-urlencoded","application/json","JSON","stringify","ct","statusType","info","ok","clientError","serverError","toError","accepted","noContent","badRequest","unauthorized","notAcceptable","notFound","forbidden","_responseType","accept","auth","user","pass","btoa","username","password","attach","file","filename","_getFormData","_formData","_callback","crossDomainError","crossDomain","_timeoutError","_timeout","_appendQueryString","_data","onreadystatechange","timedout","_aborted","handleProgress","total","percent","loaded","onprogress","upload","_timer","abort","open","_withCredentials","withCredentials","_isHost","contentType","_serializer","setRequestHeader","send","patch","post","_parser","ms","then","resolve","reject","_fullfilledPromise","Promise","innerResolve","innerReject","catch","use","getHeader","unset","redirects","n","_maxRedirects","toJSON","RequestConstructor"],"mappings":"AAAA;YCIA,SAASA,WAAWC,GAGlBA,EAAUA,EAAMC,QAAUD,EAI1BA,EAAME,UAAUC,OAAQ,SAAUH,EAAMI,MAAMC,OAAOC,QAXvD,GAAIC,SAAUC,QAAS,mBACnBC,MAAQF,QAAQG,MAChBC,cAAgB,oJAapBF,OAAMG,OAAQ,WACZL,QAAQM,KAAMC,SAASC,iBAAkBJ,eAAiBZ,aAI5DU,MAAMO,GAAIF,SAAU,QAASH,cAAeZ;;cCpB5C,WAEE,QAASkB,KACFH,SAASI,cAAc,oBAC1BJ,SAASI,cAAc,QAAQC,mBAAmB,aAAc,oZAKzC,eAAvBL,SAASM,YAA+BH,IAGvCI,OAAOC,YACVR,SAASS,iBAAiB,kBAAmB,SAASb,GAASO,MAIjEH,SAASS,iBAAiB,mBAAoB,SAASb,GAASO;;YCjBlE,IAAIP,OAAQF,QAAS,mBAAoBE,MAGrCc,UAAY,WAMd,QAASC,GAAMf,GAEbgB,QAAQC,IAAKjB,EAGb,IAAIkB,GAAclB,EAAMmB,cACpBC,EAAchB,SAASI,cAAeU,EAAYG,QAAQC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4M,IAAKhuB,KAAKguB,IACVhS,KAAMhc,KAAK0xB,MACXjE,QAASztB,KAAKkuB,UAelBhvB,QAAQuzB,QAAU,SAAiBlmB,GAGjC,UAFaxJ,SAAS+D,KAAKyF,IAGzB,IAAK,gBACL,IAAK,gBACL,IAAK,oBACH,OAAO,CACT,SACE,OAAO,IA4CbrN,QAAQ2zB,KAAO,SAAS7W,GACtB,GAAIzP,GAAMhL,SAASya,GACfzX,EAAOvE,KAAKkuB,QAAQ,eAGxB,IAAI3hB,GAAOhL,SAASvB,KAAK0xB,OACvB,IAAK,GAAI9vB,KAAOoa,GACdhc,KAAK0xB,MAAM9vB,GAAOoa,EAAKpa,OAEhB,gBAAmBoa,IAEvBzX,GAAMvE,KAAKuE,KAAK,QACrBA,EAAOvE,KAAKkuB,QAAQ,gBAElBluB,KAAK0xB,MADH,qCAAuCntB,EAC5BvE,KAAK0xB,MACd1xB,KAAK0xB,MAAQ,IAAM1V,EACnBA,GAEUhc,KAAK0xB,OAAS,IAAM1V,GAGpChc,KAAK0xB,MAAQ1V,CAGf,QAAKzP,GAAOvM,KAAKyyB,QAAQzW,GAAchc,MAGlCuE,GAAMvE,KAAKuE,KAAK,QACdvE;;ACjWT,QAASwuB,SAAQyF,EAAoB7S,EAAQ4M,GAE3C,MAAI,kBAAqBA,GAChB,GAAIiG,GAAmB,MAAO7S,GAAQyJ,IAAImD,GAI/C,GAAK1oB,UAAUzI,OACV,GAAIo3B,GAAmB,MAAO7S,GAGhC,GAAI6S,GAAmB7S,EAAQ4M,GAGxC/uB,OAAOC,QAAUsvB","file":"bundle.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","var toolbox = require( 'compose-toolbox' )\nvar Event = toolbox.event\nvar textSelectors = 'textarea, input:not([type=radio]):not([type=checkbox]):not([type=range]):not([type=hidden]):not([type=submit]):not([type=image]):not([type=reset])'\n\nfunction syncValue( input ) {\n\n // Allow calling from event handler\n input = ( input.target || input )\n\n // If element is empty (or contains only whitespace)\n // Add empty class\n input.classList.toggle( 'empty', !input.value.trim().length )\n}\n\n// Initialize input state\nEvent.change( function() {\n toolbox.each( document.querySelectorAll( textSelectors ), syncValue )\n})\n\n// Set input state on keyup (debounced)\nEvent.on( document, 'input', textSelectors, syncValue )\n","(function(){\n\n function embed() {\n if (!document.querySelector('#esvg-svg-icons')) {\n document.querySelector('body').insertAdjacentHTML('afterbegin', '<svg id=\"esvg-svg-icons\" data-symbol-class=\"svg-symbol\" data-prefix=\"svg\" version=\"1.1\" style=\"height:0;position:absolute\"><symbol id=\"svg-deployment\" data-name=\"deployment\" viewBox=\"0 0 176 201\" width=\"176\" height=\"201\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" stroke-linejoin=\"round\" stroke-miterlimit=\"1.414\"><path d=\"M88 5.985l82.272 47.5v95L88 195.985l-82.272-47.5v-95L88 5.985z\"/></symbol></svg>')\n }\n }\n\n // If DOM is already ready, embed SVGs\n if (document.readyState == 'interactive') { embed() }\n\n // Handle Turbolinks page change events\n if ( window.Turbolinks ) {\n document.addEventListener(\"turbolinks:load\", function(event) { embed() })\n }\n\n // Handle standard DOM ready events\n document.addEventListener(\"DOMContentLoaded\", function(event) { embed() })\n})()","var event = require( 'compose-toolbox' ).event\n\n// Public API function\nvar clipboard = function() {\n\n // Listen for click events\n event.on( document, 'click', '[data-copy-target]', copy )\n\n // Copy to clipboard handler\n function copy( event ) {\n\n console.log( event )\n\n // Assignment\n var copyTrigger = event.currentTarget,\n copyElement = document.querySelector( copyTrigger.dataset.copyTarget )\n\n // Prevent default behavior\n event.preventDefault()\n\n // Is the element selectable?\n if ( copyElement && copyElement.select ) {\n\n // Select text\n copyElement.select();\n\n // Give it a try\n try {\n\n // Copy text\n document.execCommand( 'copy' )\n\n // Blur the element\n copyElement.blur()\n\n // Trigger copied state\n copyTrigger.classList.add( 'copied' )\n\n // Remove copied state after a couple seconds\n setTimeout( function() {\n copyTrigger.classList.remove( 'copied' )\n }, 2000 )\n\n // If it borks\n } catch ( err ) {\n\n // Go nuclear\n alert( 'please press Ctrl/Cmd+C to copy' )\n\n }\n\n }\n\n }\n}\n\nmodule.exports = clipboard\n","var toggler = require( 'compose-toggler' )\nvar formUp = require( 'compose-form-up' )\nvar toolbox = require( 'compose-toolbox' )\nvar ajax = require( 'superagent' )\nvar event = toolbox.event\nvar clipboard = require( './enhancements/clipboard' )\n\nevent.scroll.disablePointer() // disable pointer events on scroll for performance (to avoid extra repaints)\nclipboard();\n\nrequire( 'compose-slider' ) // Our slider (range input) component\nrequire( './_icons' ) // Import svg icons (from Esvg)\nrequire( './_form_helpers' )\n\n// Public API object\nwindow.Tungsten = module.exports = toolbox.merge( {\n ajax : ajax,\n form : formUp,\n toggler : toggler,\n clipboard : clipboard\n}, toolbox )\n","/*!\n * Bean - copyright (c) Jacob Thornton 2011-2012\n * https://github.com/fat/bean\n * MIT license\n */\n(function (name, context, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports = definition()\n else if (typeof define == 'function' && define.amd) define(definition)\n else context[name] = definition()\n})('bean', this, function (name, context) {\n name = name || 'bean'\n context = context || this\n\n var win = window\n , old = context[name]\n , namespaceRegex = /[^\\.]*(?=\\..*)\\.|.*/\n , nameRegex = /\\..*/\n , addEvent = 'addEventListener'\n , removeEvent = 'removeEventListener'\n , doc = document || {}\n , root = doc.documentElement || {}\n , W3C_MODEL = root[addEvent]\n , eventSupport = W3C_MODEL ? addEvent : 'attachEvent'\n , ONE = {} // singleton for quick matching making add() do one()\n\n , slice = Array.prototype.slice\n , str2arr = function (s, d) { return s.split(d || ' ') }\n , isString = function (o) { return typeof o == 'string' }\n , isFunction = function (o) { return typeof o == 'function' }\n , isObject = function (o) { return typeof o == 'object' }\n\n // Try to build an options object. If any key in `maybeOptions`\n // matches a key in `defaults`, it will be copied into a clone\n // of `defaults`, thus overriding the default.\n , buildOptions = function (originalDefaults, maybeOptions) {\n var defaults = {}\n\n for (var key in originalDefaults) {\n if (originalDefaults.hasOwnProperty(key)) {\n defaults[key] = originalDefaults[key];\n }\n }\n\n if (!isObject(maybeOptions)) {\n return defaults;\n }\n\n for (key in defaults) {\n if (defaults.hasOwnProperty(key) && maybeOptions.hasOwnProperty(key)) {\n defaults[key] = maybeOptions[key]\n }\n }\n\n return defaults\n }\n\n // events that we consider to be 'native', anything not in this list will\n // be treated as a custom event\n , standardNativeEvents =\n 'click dblclick mouseup mousedown contextmenu ' + // mouse buttons\n 'mousewheel mousemultiwheel DOMMouseScroll ' + // mouse wheel\n 'mouseover mouseout mousemove selectstart selectend ' + // mouse movement\n 'keydown keypress keyup ' + // keyboard\n 'orientationchange ' + // mobile\n 'focus blur change reset select submit ' + // form elements\n 'load unload beforeunload resize move DOMContentLoaded ' + // window\n 'readystatechange message ' + // window\n 'error abort scroll ' // misc\n // element.fireEvent('onXYZ'... is not forgiving if we try to fire an event\n // that doesn't actually exist, so make sure we only do these on newer browsers\n , w3cNativeEvents =\n 'show ' + // mouse buttons\n 'input invalid ' + // form elements\n 'touchstart touchmove touchend touchcancel ' + // touch\n 'gesturestart gesturechange gestureend ' + // gesture\n 'textinput ' + // TextEvent\n 'readystatechange pageshow pagehide popstate ' + // window\n 'hashchange offline online ' + // window\n 'afterprint beforeprint ' + // printing\n 'dragstart dragenter dragover dragleave drag drop dragend ' + // dnd\n 'loadstart progress suspend emptied stalled loadmetadata ' + // media\n 'loadeddata canplay canplaythrough playing waiting seeking ' + // media\n 'seeked ended durationchange timeupdate play pause ratechange ' + // media\n 'volumechange cuechange ' + // media\n 'checking noupdate downloading cached updateready obsolete ' // appcache\n\n // convert to a hash for quick lookups\n , nativeEvents = (function (hash, events, i) {\n for (i = 0; i < events.length; i++) events[i] && (hash[events[i]] = 1)\n return hash\n }({}, str2arr(standardNativeEvents + (W3C_MODEL ? w3cNativeEvents : ''))))\n\n // custom events are events that we *fake*, they are not provided natively but\n // we can use native events to generate them\n , customEvents = (function () {\n var isAncestor = 'compareDocumentPosition' in root\n ? function (element, container) {\n return container.compareDocumentPosition && (container.compareDocumentPosition(element) & 16) === 16\n }\n : 'contains' in root\n ? function (element, container) {\n container = container.nodeType === 9 || container === window ? root : container\n return container !== element && container.contains(element)\n }\n : function (element, container) {\n while (element = element.parentNode) if (element === container) return 1\n return 0\n }\n , check = function (event) {\n var related = event.relatedTarget\n return !related\n ? related == null\n : (related !== this && related.prefix !== 'xul' && !/document/.test(this.toString())\n && !isAncestor(related, this))\n }\n\n return {\n mouseenter: { base: 'mouseover', condition: check }\n , mouseleave: { base: 'mouseout', condition: check }\n , mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' }\n }\n }())\n\n // we provide a consistent Event object across browsers by taking the actual DOM\n // event object and generating a new one from its properties.\n , Event = (function () {\n // a whitelist of properties (for different event types) tells us what to check for and copy\n var commonProps = str2arr('altKey attrChange attrName bubbles cancelable ctrlKey currentTarget ' +\n 'detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey ' +\n 'srcElement target timeStamp type view which propertyName path')\n , mouseProps = commonProps.concat(str2arr('button buttons clientX clientY dataTransfer ' +\n 'fromElement offsetX offsetY pageX pageY screenX screenY toElement movementX movementY region'))\n , mouseWheelProps = mouseProps.concat(str2arr('wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ ' +\n 'axis')) // 'axis' is FF specific\n , keyProps = commonProps.concat(str2arr('char charCode key keyCode keyIdentifier ' +\n 'keyLocation location isComposing code'))\n , textProps = commonProps.concat(str2arr('data'))\n , touchProps = commonProps.concat(str2arr('touches targetTouches changedTouches scale rotation'))\n , messageProps = commonProps.concat(str2arr('data origin source'))\n , stateProps = commonProps.concat(str2arr('state'))\n , overOutRegex = /over|out/\n // some event types need special handling and some need special properties, do that all here\n , typeFixers = [\n { // key events\n reg: /key/i\n , fix: function (event, newEvent) {\n newEvent.keyCode = event.keyCode || event.which\n return keyProps\n }\n }\n , { // mouse events\n reg: /click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i\n , fix: function (event, newEvent, type) {\n newEvent.rightClick = event.which === 3 || event.button === 2\n newEvent.pos = { x: 0, y: 0 }\n if (event.pageX || event.pageY) {\n newEvent.clientX = event.pageX\n newEvent.clientY = event.pageY\n } else if (event.clientX || event.clientY) {\n newEvent.clientX = event.clientX + doc.body.scrollLeft + root.scrollLeft\n newEvent.clientY = event.clientY + doc.body.scrollTop + root.scrollTop\n }\n if (overOutRegex.test(type)) {\n newEvent.relatedTarget = event.relatedTarget\n || event[(type == 'mouseover' ? 'from' : 'to') + 'Element']\n }\n return mouseProps\n }\n }\n , { // mouse wheel events\n reg: /mouse.*(wheel|scroll)/i\n , fix: function () { return mouseWheelProps }\n }\n , { // TextEvent\n reg: /^text/i\n , fix: function () { return textProps }\n }\n , { // touch and gesture events\n reg: /^touch|^gesture/i\n , fix: function () { return touchProps }\n }\n , { // message events\n reg: /^message$/i\n , fix: function () { return messageProps }\n }\n , { // popstate events\n reg: /^popstate$/i\n , fix: function () { return stateProps }\n }\n , { // everything else\n reg: /.*/\n , fix: function () { return commonProps }\n }\n ]\n , typeFixerMap = {} // used to map event types to fixer functions (above), a basic cache mechanism\n\n , Event = function (event, element, isNative) {\n if (!arguments.length) return\n event = event || ((element.ownerDocument || element.document || element).parentWindow || win).event\n this.originalEvent = event\n this.isNative = isNative\n this.isBean = true\n\n if (!event) return\n\n var type = event.type\n , target = event.target || event.srcElement\n , i, l, p, props, fixer\n\n this.target = target && target.nodeType === 3 ? target.parentNode : target\n\n if (isNative) { // we only need basic augmentation on custom events, the rest expensive & pointless\n fixer = typeFixerMap[type]\n if (!fixer) { // haven't encountered this event type before, map a fixer function for it\n for (i = 0, l = typeFixers.length; i < l; i++) {\n if (typeFixers[i].reg.test(type)) { // guaranteed to match at least one, last is .*\n typeFixerMap[type] = fixer = typeFixers[i].fix\n break\n }\n }\n }\n\n props = fixer(event, this, type)\n for (i = props.length; i--;) {\n if (!((p = props[i]) in this) && p in event) this[p] = event[p]\n }\n }\n }\n\n // preventDefault() and stopPropagation() are a consistent interface to those functions\n // on the DOM, stop() is an alias for both of them together\n Event.prototype.preventDefault = function () {\n if (this.originalEvent.preventDefault) this.originalEvent.preventDefault()\n else this.originalEvent.returnValue = false\n }\n Event.prototype.stopPropagation = function () {\n if (this.originalEvent.stopPropagation) this.originalEvent.stopPropagation()\n else this.originalEvent.cancelBubble = true\n }\n Event.prototype.stop = function () {\n this.preventDefault()\n this.stopPropagation()\n this.stopped = true\n }\n // stopImmediatePropagation() has to be handled internally because we manage the event list for\n // each element\n // note that originalElement may be a Bean#Event object in some situations\n Event.prototype.stopImmediatePropagation = function () {\n if (this.originalEvent.stopImmediatePropagation) this.originalEvent.stopImmediatePropagation()\n this.isImmediatePropagationStopped = function () { return true }\n }\n Event.prototype.isImmediatePropagationStopped = function () {\n return this.originalEvent.isImmediatePropagationStopped && this.originalEvent.isImmediatePropagationStopped()\n }\n Event.prototype.clone = function (currentTarget) {\n //TODO: this is ripe for optimisation, new events are *expensive*\n // improving this will speed up delegated events\n var ne = new Event(this, this.element, this.isNative)\n ne.currentTarget = currentTarget\n return ne\n }\n\n return Event\n }())\n\n // if we're in old IE we can't do onpropertychange on doc or win so we use doc.documentElement for both\n , targetElement = function (element, isNative) {\n return !W3C_MODEL && !isNative && (element === doc || element === win) ? root : element\n }\n\n /**\n * Bean maintains an internal registry for event listeners. We don't touch elements, objects\n * or functions to identify them, instead we store everything in the registry.\n * Each event listener has a RegEntry object, we have one 'registry' for the whole instance.\n */\n , RegEntry = (function () {\n // each handler is wrapped so we can handle delegation and custom events\n var wrappedHandler = function (element, fn, condition, args) {\n var call = function (event, eargs) {\n return fn.apply(element, args ? slice.call(eargs, event ? 0 : 1).concat(args) : eargs)\n }\n , findTarget = function (event, eventElement) {\n return fn.__beanDel ? fn.__beanDel.ft(event.target, element) : eventElement\n }\n , handler = condition\n ? function (event) {\n var target = findTarget(event, this) // deleated event\n if (condition.apply(target, arguments)) {\n if (event) event.currentTarget = target\n return call(event, arguments)\n }\n }\n : function (event) {\n if (fn.__beanDel) event = event.clone(findTarget(event)) // delegated event, fix the fix\n return call(event, arguments)\n }\n handler.__beanDel = fn.__beanDel\n return handler\n }\n\n , RegEntry = function (element, type, handler, original, namespaces, args, root) {\n var customType = customEvents[type]\n , isNative\n\n if (type == 'unload') {\n // self clean-up\n handler = once(removeListener, element, type, handler, original)\n }\n\n if (customType) {\n if (customType.condition) {\n handler = wrappedHandler(element, handler, customType.condition, args)\n }\n type = customType.base || type\n }\n\n this.isNative = isNative = nativeEvents[type] && !!element[eventSupport]\n this.customType = !W3C_MODEL && !isNative && type\n this.element = element\n this.type = type\n this.original = original\n this.namespaces = namespaces\n this.eventType = W3C_MODEL || isNative ? type : 'propertychange'\n this.target = targetElement(element, isNative)\n this[eventSupport] = !!this.target[eventSupport]\n this.root = root\n this.handler = wrappedHandler(element, handler, null, args)\n }\n\n // given a list of namespaces, is our entry in any of them?\n RegEntry.prototype.inNamespaces = function (checkNamespaces) {\n var i, j, c = 0\n if (!checkNamespaces) return true\n if (!this.namespaces) return false\n for (i = checkNamespaces.length; i--;) {\n for (j = this.namespaces.length; j--;) {\n if (checkNamespaces[i] == this.namespaces[j]) c++\n }\n }\n return checkNamespaces.length === c\n }\n\n // match by element, original fn (opt), handler fn (opt)\n RegEntry.prototype.matches = function (checkElement, checkOriginal, checkHandler) {\n return this.element === checkElement &&\n (!checkOriginal || this.original === checkOriginal) &&\n (!checkHandler || this.handler === checkHandler)\n }\n\n return RegEntry\n }())\n\n , registry = (function () {\n // our map stores arrays by event type, just because it's better than storing\n // everything in a single array.\n // uses '$' as a prefix for the keys for safety and 'r' as a special prefix for\n // rootListeners so we can look them up fast\n var map = {}\n\n // generic functional search of our registry for matching listeners,\n // `fn` returns false to break out of the loop\n , forAll = function (element, type, original, handler, root, fn) {\n var pfx = root ? 'r' : '$'\n if (!type || type == '*') {\n // search the whole registry\n for (var t in map) {\n if (t.charAt(0) == pfx) {\n forAll(element, t.substr(1), original, handler, root, fn)\n }\n }\n } else {\n var i = 0, l, list = map[pfx + type], all = element == '*'\n if (!list) return\n for (l = list.length; i < l; i++) {\n if ((all || list[i].matches(element, original, handler)) && !fn(list[i], list, i, type)) return\n }\n }\n }\n\n , has = function (element, type, original, root) {\n // we're not using forAll here simply because it's a bit slower and this\n // needs to be fast\n var i, list = map[(root ? 'r' : '$') + type]\n if (list) {\n for (i = list.length; i--;) {\n if (!list[i].root && list[i].matches(element, original, null)) return true\n }\n }\n return false\n }\n\n , get = function (element, type, original, root) {\n var entries = []\n forAll(element, type, original, null, root, function (entry) {\n return entries.push(entry)\n })\n return entries\n }\n\n , put = function (entry) {\n var has = !entry.root && !this.has(entry.element, entry.type, null, false)\n , key = (entry.root ? 'r' : '$') + entry.type\n ;(map[key] || (map[key] = [])).push(entry)\n return has\n }\n\n , del = function (entry) {\n forAll(entry.element, entry.type, null, entry.handler, entry.root, function (entry, list, i) {\n list.splice(i, 1)\n entry.removed = true\n if (list.length === 0) delete map[(entry.root ? 'r' : '$') + entry.type]\n return false\n })\n }\n\n // dump all entries, used for onunload\n , entries = function () {\n var t, entries = []\n for (t in map) {\n if (t.charAt(0) == '$') entries = entries.concat(map[t])\n }\n return entries\n }\n\n return { has: has, get: get, put: put, del: del, entries: entries }\n }())\n\n // we need a selector engine for delegated events, use querySelectorAll if it exists\n // but for older browsers we need Qwery, Sizzle or similar\n , selectorEngine\n , setSelectorEngine = function (e) {\n if (!arguments.length) {\n selectorEngine = doc.querySelectorAll\n ? function (s, r) {\n return r.querySelectorAll(s)\n }\n : function () {\n throw new Error('Bean: No selector engine installed') // eeek\n }\n } else {\n selectorEngine = e\n }\n }\n\n // we attach this listener to each DOM event that we need to listen to, only once\n // per event type per DOM element\n , rootListener = function (event, type) {\n if (!W3C_MODEL && type && event && event.propertyName != '_on' + type) return\n\n var listeners = registry.get(this, type || event.type, null, false)\n , l = listeners.length\n , i = 0\n\n event = new Event(event, this, true)\n if (type) event.type = type\n\n // iterate through all handlers registered for this type, calling them unless they have\n // been removed by a previous handler or stopImmediatePropagation() has been called\n for (; i < l && !event.isImmediatePropagationStopped(); i++) {\n if (!listeners[i].removed) listeners[i].handler.call(this, event)\n }\n }\n\n // add and remove listeners to DOM elements\n , listener = W3C_MODEL\n ? function (element, type, add, custom, useCapture) {\n // new browsers\n element[add ? addEvent : removeEvent](type, rootListener, useCapture)\n }\n : function (element, type, add, custom /*, useCapture */) {\n // IE8 and below, use attachEvent/detachEvent and we have to piggy-back propertychange events\n // to simulate event bubbling etc.\n var entry\n if (add) {\n registry.put(entry = new RegEntry(\n element\n , custom || type\n , function (event) { // handler\n rootListener.call(element, event, custom)\n }\n , rootListener\n , null\n , null\n , true // is root\n ))\n if (custom && element['_on' + custom] == null) element['_on' + custom] = 0\n entry.target.attachEvent('on' + entry.eventType, entry.handler)\n } else {\n entry = registry.get(element, custom || type, rootListener, true)[0]\n if (entry) {\n entry.target.detachEvent('on' + entry.eventType, entry.handler)\n registry.del(entry)\n }\n }\n }\n\n , once = function (rm, element, type, fn, originalFn) {\n // wrap the handler in a handler that does a remove as well\n return function () {\n fn.apply(this, arguments)\n rm(element, type, originalFn)\n }\n }\n\n , removeListener = function (element, orgType, handler, namespaces, useCapture) {\n var type = orgType && orgType.replace(nameRegex, '')\n , handlers = registry.get(element, type, null, false)\n , removed = {}\n , i, l\n\n for (i = 0, l = handlers.length; i < l; i++) {\n if ((!handler || handlers[i].original === handler) && handlers[i].inNamespaces(namespaces)) {\n // TODO: this is problematic, we have a registry.get() and registry.del() that\n // both do registry searches so we waste cycles doing this. Needs to be rolled into\n // a single registry.forAll(fn) that removes while finding, but the catch is that\n // we'll be splicing the arrays that we're iterating over. Needs extra tests to\n // make sure we don't screw it up. @rvagg\n registry.del(handlers[i])\n if (!removed[handlers[i].eventType] && handlers[i][eventSupport])\n removed[handlers[i].eventType] = { t: handlers[i].eventType, c: handlers[i].type }\n }\n }\n // check each type/element for removed listeners and remove the rootListener where it's no longer needed\n for (i in removed) {\n if (!registry.has(element, removed[i].t, null, false)) {\n // last listener of this type, remove the rootListener\n listener(element, removed[i].t, false, removed[i].c, useCapture)\n }\n }\n }\n\n // set up a delegate helper using the given selector, wrap the handler function\n , delegate = function (selector, fn) {\n //TODO: findTarget (therefore $) is called twice, once for match and once for\n // setting e.currentTarget, fix this so it's only needed once\n var findTarget = function (target, root) {\n var i, array = isString(selector) ? selectorEngine(selector, root) : selector\n for (; target && target !== root; target = target.parentNode) {\n for (i = array.length; i--;) {\n if (array[i] === target) return target\n }\n }\n }\n , handler = function (e) {\n var match = findTarget(e.target, this)\n if (match) fn.apply(match, arguments)\n }\n\n // __beanDel isn't pleasant but it's a private function, not exposed outside of Bean\n handler.__beanDel = {\n ft : findTarget // attach it here for customEvents to use too\n , selector : selector\n }\n return handler\n }\n\n , fireListener = W3C_MODEL ? function (isNative, type, element) {\n // modern browsers, do a proper dispatchEvent()\n var evt = doc.createEvent(isNative ? 'HTMLEvents' : 'UIEvents')\n evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, win, 1)\n element.dispatchEvent(evt)\n } : function (isNative, type, element) {\n // old browser use onpropertychange, just increment a custom property to trigger the event\n element = targetElement(element, isNative)\n isNative ? element.fireEvent('on' + type, doc.createEventObject()) : element['_on' + type]++\n }\n\n /**\n * Public API: off(), on(), add(), (remove()), one(), fire(), clone()\n */\n\n /**\n * off(element[, eventType(s)[, handler ], options])\n */\n , off = function (element, typeSpec, fn) {\n var isTypeStr = isString(typeSpec),\n defaultOpts = {\n useCapture: false\n }\n , opts = buildOptions(defaultOpts, arguments[arguments.length - 1])\n , k, type, namespaces, i\n\n if (isTypeStr && typeSpec.indexOf(' ') > 0) {\n // off(el, 't1 t2 t3', fn) or off(el, 't1 t2 t3')\n typeSpec = str2arr(typeSpec)\n for (i = typeSpec.length; i--;)\n off(element, typeSpec[i], fn)\n return element\n }\n\n type = isTypeStr && typeSpec.replace(nameRegex, '')\n if (type && customEvents[type]) type = customEvents[type].base\n\n if (!typeSpec || isTypeStr) {\n // off(el) or off(el, t1.ns) or off(el, .ns) or off(el, .ns1.ns2.ns3)\n if (namespaces = isTypeStr && typeSpec.replace(namespaceRegex, '')) namespaces = str2arr(namespaces, '.')\n removeListener(element, type, fn, namespaces, opts.useCapture)\n } else if (isFunction(typeSpec)) {\n // off(el, fn)\n removeListener(element, null, typeSpec, null, opts.useCapture)\n } else {\n // off(el, { t1: fn1, t2, fn2 })\n for (k in typeSpec) {\n if (typeSpec.hasOwnProperty(k)) off(element, k, typeSpec[k])\n }\n }\n\n return element\n }\n\n /**\n * on(element, eventType(s)[, selector], handler[, args ], [options])\n */\n , on = function(element, events, selector, fn) {\n var defaultOpts = {\n useCapture: false\n },\n originalFn, type, types, i, args, entry, first, opts\n\n //TODO: the undefined check means you can't pass an 'args' argument, fix this perhaps?\n if (selector === undefined && typeof events == 'object') {\n //TODO: this can't handle delegated events\n for (type in events) {\n if (events.hasOwnProperty(type)) {\n on.call(this, element, type, events[type])\n }\n }\n return\n }\n\n if (!isFunction(selector)) {\n // delegated event\n originalFn = fn\n args = slice.call(arguments, 4)\n fn = delegate(selector, originalFn, selectorEngine)\n } else {\n args = slice.call(arguments, 3)\n fn = originalFn = selector\n }\n\n opts = buildOptions(defaultOpts, args[args.length - 1])\n types = str2arr(events)\n\n // special case for one(), wrap in a self-removing handler\n if (this === ONE) {\n fn = once(off, element, events, fn, originalFn)\n }\n\n for (i = types.length; i--;) {\n // add new handler to the registry and check if it's the first for this element/type\n first = registry.put(entry = new RegEntry(\n element\n , types[i].replace(nameRegex, '') // event type\n , fn\n , originalFn\n , str2arr(types[i].replace(namespaceRegex, ''), '.') // namespaces\n , args\n , false // not root\n ))\n if (entry[eventSupport] && first) {\n // first event of this type on this element, add root listener\n listener(element, entry.eventType, true, entry.customType, opts.useCapture)\n }\n }\n\n return element\n }\n\n /**\n * add(element[, selector], eventType(s), handler[, args ])\n *\n * Deprecated: kept (for now) for backward-compatibility\n */\n , add = function (element, events, fn, delfn, options) {\n return on.apply(\n null\n , !isString(fn)\n ? slice.call(arguments)\n : [ element, fn, events, delfn ].concat(arguments.length > 3 ? slice.call(arguments, 4) : [])\n )\n }\n\n /**\n * one(element, eventType(s)[, selector], handler[, args ])\n */\n , one = function () {\n return on.apply(ONE, arguments)\n }\n\n /**\n * fire(element, eventType(s)[, args ])\n *\n * The optional 'args' argument must be an array, if no 'args' argument is provided\n * then we can use the browser's DOM event system, otherwise we trigger handlers manually\n */\n , fire = function (element, type, args) {\n var types = str2arr(type)\n , i, j, l, names, handlers\n\n for (i = types.length; i--;) {\n type = types[i].replace(nameRegex, '')\n if (names = types[i].replace(namespaceRegex, '')) names = str2arr(names, '.')\n if (!names && !args && element[eventSupport]) {\n fireListener(nativeEvents[type], type, element)\n } else {\n // non-native event, either because of a namespace, arguments or a non DOM element\n // iterate over all listeners and manually 'fire'\n handlers = registry.get(element, type, null, false)\n args = [false].concat(args)\n for (j = 0, l = handlers.length; j < l; j++) {\n if (handlers[j].inNamespaces(names)) {\n handlers[j].handler.apply(element, args)\n }\n }\n }\n }\n return element\n }\n\n /**\n * clone(dstElement, srcElement[, eventType ])\n *\n * TODO: perhaps for consistency we should allow the same flexibility in type specifiers?\n */\n , clone = function (element, from, type) {\n var handlers = registry.get(from, type, null, false)\n , l = handlers.length\n , i = 0\n , args, beanDel\n\n for (; i < l; i++) {\n if (handlers[i].original) {\n args = [ element, handlers[i].type ]\n if (beanDel = handlers[i].handler.__beanDel) args.push(beanDel.selector)\n args.push(handlers[i].original)\n on.apply(null, args)\n }\n }\n return element\n }\n\n , bean = {\n 'on' : on\n , 'add' : add\n , 'one' : one\n , 'off' : off\n , 'remove' : off\n , 'clone' : clone\n , 'fire' : fire\n , 'Event' : Event\n , 'setSelectorEngine' : setSelectorEngine\n , 'noConflict' : function () {\n context[name] = old\n return this\n }\n }\n\n // for IE, clean up on unload to avoid leaks\n if (win.attachEvent) {\n var cleanup = function () {\n var i, entries = registry.entries()\n for (i in entries) {\n if (entries[i].type && entries[i].type !== 'unload') off(entries[i].element, entries[i].type)\n }\n win.detachEvent('onunload', cleanup)\n win.CollectGarbage && win.CollectGarbage()\n }\n win.attachEvent('onunload', cleanup)\n }\n\n // initialize selector engine to internal default (qSA or throw Error)\n setSelectorEngine()\n\n return bean\n});\n","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n","require( './lib/shims/custom-event' )\n\nvar bean = require( 'bean' )\nvar key = require( 'keymaster' ) \nvar animationEvent = require( './lib/animation-events' )\nvar page = require( './lib/page' )\nvar tap = require( './lib/tap-events' )\nvar debounce = require( './lib/debounce' )\nvar throttle = require( './lib/throttle' )\nvar delay = require( './lib/delay' )\nvar repeat = require( './lib/repeat' )\nvar bubbleFormEvents = require( './lib/bubble-form-events' )\nvar scroll = require( './lib/scroll' )\nvar resize = require( './lib/resize' )\nvar callbackManager = require( './lib/callback-manager' )\nvar media = require( './lib/media' )\n\nvar slice = Array.prototype.slice\nvar formBubbling = false\n\nmodule.exports = {\n\n // DOM events\n on: on,\n off: off,\n one: one,\n fire: fire,\n clone: bean.clone,\n ready: page.ready,\n change: page.change,\n afterAnimation: afterAnimation,\n\n // Media query events\n media: media,\n\n // Keyboard events\n key: key,\n keyOn: key,\n keyOff: key.unbind,\n keyOne: keyOne,\n\n // Timing utilities\n debounce: debounce,\n throttle: throttle,\n delay: delay,\n repeat: repeat,\n\n // Optimized Event Managers\n scroll: scroll,\n resize: resize,\n\n callbackManager: callbackManager,\n callback: callbackManager.callback,\n\n // Bubbling fix\n bubbleFormEvents: bubbleFormEvents\n}\n\n// Bean doesn't account for cross-browser support on animation events\n// So rather than pass through events to bean, we process them to add\n// vendor prefixes or remove events if browsers do not suppor them\n//\nfunction on () {\n setEvent( 'on', slice.call( arguments ) )\n}\n\nfunction off () {\n setEvent( 'off', slice.call( arguments ) )\n}\n\nfunction one () {\n setEvent( 'one', slice.call( arguments ) )\n}\n\nfunction fire () {\n\n args = slice.call( arguments )\n var el = args[0]\n var events = []\n\n args[1].split(' ').forEach( function( event ) {\n\n var event = animationEvent.transform( event )\n if ( !isEmpty( event ) ) events.push( event )\n\n })\n\n if ( !isEmpty( events ) ) {\n\n args[1] = events.join( ' ' )\n bean.fire.apply( this, args )\n\n }\n}\n\nfunction setEvent( registerType, args ) {\n\n transformArgs( args ).forEach( function( arg ) {\n bean[ registerType ].apply( null, arg )\n })\n\n}\n\n// Add support for unbinding a key event after it is called\n//\nfunction keyOne ( keys, scope, fn ) {\n\n if ( typeof scope == 'function' ) {\n fn = scope\n scope = 'all'\n }\n\n key( keys, scope, function( event ) {\n key.unbind( keys, scope )\n fn( event )\n })\n}\n\nfunction afterAnimation( el, callback ) {\n var hasAnimation = !!window.getComputedStyle( el ).getPropertyValue( 'animation-duration' )\n if ( hasAnimation ) {\n one( el, 'animationend', callback )\n } else {\n callback()\n }\n}\n\n// Transform event arguments to handle tap event and cross-browser animation events\n// Returns an array of events to be registered individually\n//\nfunction transformArgs( args ) {\n\n var transformedArgs = []\n var newEvents = {}\n var element = args.shift() // retrieve element\n var events = args.shift()\n\n // detect event delegate selector\n if ( typeof args[0] != 'function' ) {\n var delegate = args.shift()\n }\n\n // convert event strings to object based events for code simplification\n // example: arguments ('hover focus', function) would become ({ 'hover focus': function })\n if ( typeof events == 'string' ) {\n var objEvents = {}\n objEvents[events] = args.shift()\n events = objEvents\n }\n\n // Walk through each key in the events object and add vendor prefixes to 'animation' events\n // and wrap callback in the tap function for all 'tap' events.\n //\n for ( event in events ) {\n\n if ( events.hasOwnProperty( event ) ) {\n var callback = events[event]\n\n // Events can be registered as space separated groups like \"hover focus\"\n // This handles each event independantly\n //\n event.split(' ').forEach( function( e ){\n\n // If it is an animation event, vendor prefix it, or fire the callback according to browser support\n e = animationEvent.transform( e )\n\n if ( isEmpty( e ) ) {\n // If it's empty, it has been removed since animation events are not supported.\n // In that case, trigger the event immediately\n callback()\n\n } else if ( e.match( /tap/ ) ) {\n\n // If it's a tap event, wrap the callback and set the event to 'touchstart'\n // Tap isn't a real native event, but this wrapper lets us simulate what a\n // native tap event would be.\n //\n newEvents.touchstart = tap( callback )\n } else {\n newEvents[ e ] = callback\n }\n })\n }\n }\n\n for ( event in newEvents ) {\n var a = []\n a.push( element, event )\n\n if ( delegate ) a.push( delegate )\n\n a.push( newEvents[ event ] )\n transformedArgs.push( a.concat( args ) )\n }\n\n return transformedArgs\n}\n\n\nfunction isEmpty( obj ) {\n\n var hasOwnProperty = Object.prototype.hasOwnProperty\n\n if ( obj == null || obj.length === 0 ) return true\n\n if ( 0 < obj.length ) return false\n\n for (var key in obj) {\n if ( hasOwnProperty.call( obj, key ) ) return false\n }\n\n return true;\n}\n","var cssAnimEventTypes = getAnimationEventTypes()\nvar supported = cssAnimEventTypes.animationstart !== undefined\n\nmodule.exports = {\n transform: transformAnimationEvents\n}\n\nfunction camelCaseEventTypes(prefix) {\n prefix = prefix || '';\n\n return {\n animationstart: prefix + 'AnimationStart',\n animationend: prefix + 'AnimationEnd',\n animationiteration: prefix + 'AnimationIteration'\n };\n}\n\nfunction lowerCaseEventTypes(prefix) {\n prefix = prefix || '';\n\n return {\n animationstart: prefix + 'animationstart',\n animationend: prefix + 'animationend',\n animationiteration: prefix + 'animationiteration'\n };\n}\n\n/**\n * @return {Object} Animation event types {animationstart, animationend, animationiteration}\n */\n\nfunction getAnimationEventTypes() {\n var prefixes = ['webkit', 'Moz', 'O', ''];\n var style = document.documentElement.style;\n\n // browser compliant\n if (undefined !== style.animationName) {\n return lowerCaseEventTypes();\n }\n\n for (var i = 0, len = prefixes.length, prefix; i < len; i++) {\n prefix = prefixes[i];\n\n if (undefined !== style[prefix + 'AnimationName']) {\n // Webkit\n if (0 === i) {\n return camelCaseEventTypes(prefix.toLowerCase());\n }\n // Mozilla\n else if (1 === i) {\n return lowerCaseEventTypes();\n }\n // Opera\n else if (2 === i) {\n return lowerCaseEventTypes(prefix.toLowerCase());\n }\n }\n }\n\n return {};\n}\n\n\n// Adds necessary add vendor prefixes or camelCased event names\n//\nfunction transformAnimationEvents (event) {\n if (!event.match(/animation/i)) {\n return event\n } else {\n if (cssAnimEventTypes[event]) {\n return cssAnimEventTypes[event]\n } else {\n if(window.env != 'test') {\n console.error('\"' + event + '\" is not a supported animation event')\n }\n return ''\n }\n }\n}\n","var Event = require( 'bean' ),\n page = require( './page' ),\n formEls;\n\nvar formBubbling = false\n\nvar fireBubble = function ( event ) {\n if ( event.detail && event.detail.triggered ) { return false }\n\n var ev = new CustomEvent( event.type, { bubbles: true, cancelable: true, detail: { triggered: true } } )\n\n event.stopPropagation()\n event.target.dispatchEvent( ev ) \n\n // Prevent default on original event if custom event is prevented\n if ( ev.defaultPrevented ) event.preventDefault() \n}\n\n// Simplify setting the event type based on the element\nvar eventType = function ( el ) {\n return ( el.tagName == 'FORM' ) ? 'submit' : 'focus blur'\n}\n\n// Add event listeners\nvar bubbleOn = function ( el ) {\n Event.on( el, eventType( el ), fireBubble )\n}\n\n// Remove event listeners\nvar bubbleOff = function ( el ) {\n Event.off( el, eventType( el ), fireBubble )\n}\n\n// Add/Remove event listeners\nvar bubbleFormEvents = function () {\n if ( formBubbling ) { return } \n page.change( function() {\n\n // Remove listeners from previous page\n if ( formEls ) Array.prototype.forEach.call( formEls, bubbleOff )\n\n // Add new listeners to this page\n formEls = document.querySelectorAll( 'form, input' )\n\n Array.prototype.forEach.call( formEls, bubbleOn )\n })\n\n var formBubbling = true\n}\n\nmodule.exports = bubbleFormEvents\n","var Manager = {\n new: function() {\n var manager = {\n\n callbacks: [],\n\n add: function( fn ) {\n\n var cb = Manager.callback.new( fn )\n manager.callbacks.push( cb )\n \n return cb\n\n },\n\n stop: function() {\n manager.callbacks.forEach( function( cb ) { cb.stop() } )\n },\n\n start: function() {\n manager.callbacks.forEach( function( cb ) { cb.start() } )\n },\n\n toggle: function( bool ) {\n manager.callbacks.forEach( function( cb ) { cb.toggle( bool ) } )\n },\n\n remove: function() {\n manager.callbacks = []\n },\n\n fire: function() {\n var args = Array.prototype.slice.call( arguments )\n manager.callbacks.forEach( function( fn ) { fn.apply( this, args ) } )\n }\n }\n\n return manager\n },\n\n callback: {\n new: function( fn ) {\n var cb = function() {\n if ( cb.enabled ) { fn.apply( fn, arguments ) }\n }\n\n cb.stop = function() { cb.enabled = false }\n cb.start = function() { cb.enabled = true }\n cb.toggle = function( bool ) {\n cb.enabled = ( 0 in arguments ) ? bool : !cb.enabled\n }\n cb.enabled = true\n\n return cb\n }\n }\n}\n\nmodule.exports = Manager\n","var now = function() {\n return Date.now()\n}\n\nvar pickFunction = function() {\n var found\n Array.prototype.forEach.call( arguments, function( candidate ) {\n if ( typeof( candidate ) == 'function' && !found ) { found = candidate }\n })\n\n return found\n}\n\nvar debounce = function( fn, wait, options ) {\n\n // Allow options passed as the first argument\n if ( typeof( fn ) == 'object' ) { options = fn } \n\n // Options won't be null\n else { options = options || {} }\n\n wait = options.wait || wait || 0\n\n var max = options.max || false,\n leading = ( ( 'leading' in options ) ? options.leading : false ),\n trailing = ( ( 'trailing' in options ) ? options.trailing : true ),\n \n // Grab functions from options or default to first argument\n leadingFn = pickFunction( options.leading, options.trailing, options.callback, fn ),\n trailingFn = pickFunction( options.trailing, options.leading, options.callback, fn ),\n\n // State tracking vars\n args, // Track arguments passed to debounced callback\n queued = false, // Has a callback been added to the animation loop?\n handle = {}, // Object for tracking functions and callbacks\n lastCalled = 0, // Keep a timer for debouncing\n lastInvoked = 0, // Keep a timer for max\n leadingBlocked = false; // Track leading, throttling subsequent leading calls\n\n // Queue the function with requestAnimationFrame\n var invoke = function( callType ) {\n\n lastCalled = now()\n lastInvoked = now()\n queued = false\n leadingBlocked = true\n\n if ( callType === 'leading' ) {\n leadingFn.apply( leadingFn, args ) }\n else {\n trailingFn.apply( trailingFn, args ) }\n\n }\n\n // Load the loop into the animation queue\n var addToQueue = function () {\n\n if ( !queued ) {\n queued = true\n handle.value = requestAnimationFrame( loop ) // Add to browser's animation queue\n }\n\n }\n\n // Remove from animation queue and reset debounce \n var removeFromQueue = function() {\n\n if ( \"value\" in handle ) {\n cancelAnimationFrame( handle.value )\n queued = false\n lastCalled = 0\n lastInvoked = 0\n leadingBlocked = false\n }\n \n }\n\n // prevent infinite debouncing ( if options.max is set )\n var maxPassed = function() {\n return ( max && now() - lastInvoked >= max )\n }\n\n var waitReached = function() {\n return ( now() - lastCalled ) >= wait\n }\n\n // This gets loaded into the animation queue and determines whether to ivoke the debounced function\n var loop = function () {\n \n // Loop was executed so it's no longer in the animation queue\n queued = false\n \n if ( leading && !leadingBlocked ) {\n invoke( 'leading' )\n }\n\n // If function has been called to frequently to execute\n else if ( maxPassed() ) {\n\n if ( leading ) { invoke( 'leading' ) }\n else { invoke( 'trailing' ) }\n\n } \n \n // If function hasn't been called since last wait\n else if ( waitReached() ) {\n\n // If trailing it's safe to invoke\n if ( trailing ) { invoke( 'trailing' ) }\n\n // If leading, it's safe to remove block\n if ( leading ) { leadingBlocked = false }\n \n } else {\n addToQueue()\n }\n\n }\n\n // A wrapper function for queueing up function calls\n //\n var debounced = function() {\n lastCalled = now()\n args = arguments\n addToQueue()\n }\n\n debounced.stop = removeFromQueue\n\n return debounced\n}\n\nmodule.exports = debounce\n","var now = function() {\n return Date.now()\n}\n\nvar delay = function ( fn, wait ) {\n\n var argsStart = ( wait != null ) ? 2 : 1;\n var handle = {}\n\n handle.args = Array.prototype.slice.call( arguments, argsStart )\n handle.wait = wait || 0\n handle.start = now()\n\n handle.stop = function () {\n if ( \"value\" in handle ) {\n cancelAnimationFrame( handle.value );\n }\n }\n\n handle.loop = function () {\n\n // If wait limit has been reached\n if ( now() - handle.start >= handle.wait ) {\n fn.apply( fn, handle.args )\n\n // If repeat is set and is not 0\n if ( !!handle.repeat ) {\n handle.repeat = handle.repeat - 1\n handle.start = now()\n queueDelay( handle )\n } else if ( handle.repeat === 0 && handle.complete ) {\n handle.complete()\n }\n\n } else {\n queueDelay( handle )\n }\n\n }\n\n\n return queueDelay( handle )\n}\n\nvar queueDelay = function ( handle ) {\n handle.value = requestAnimationFrame( handle.loop )\n return handle\n}\n\nmodule.exports = delay\n","// This simplifies common uses for window.matchMedia \n// namely, adding listeners for width and height queries\n\nfunction parseQuery( query, dimension ) {\n var result = {}\n\n if ( typeof( query ) === 'string' ) { return query }\n\n result.min = size( query.min, 'min-' + dimension )\n result.max = size( query.max, 'max-' + dimension )\n\n if ( result.min && result.max )\n result.query = result.min + ' and ' + result.max\n\n return result.query || result.min || result.max\n}\n\nfunction size( num, limit ) {\n return ( num ) ? '('+limit+': ' + toPx( num ) + ')' : null\n}\n\nfunction toPx( width ) {\n if ( typeof( width ) === 'number' ) { return width + 'px'}\n return width\n}\n\nvar media = {\n\n width: function( query, fn ) {\n return media.listen( parseQuery( query, 'width' ), fn )\n },\n\n minWidth: function( size, fn ) { return media.width( { min: size }, fn ) },\n maxWidth: function( size, fn ) { return media.width( { max: size }, fn ) },\n\n height: function( query, fn ) {\n return media.listen( parseQuery( query, 'height' ), fn )\n },\n\n minHeight: function( size, fn ) { return media.height( { min: size }, fn ) },\n maxHeight: function( size, fn ) { return media.height( { max: size }, fn ) },\n\n listen: function( query, fn ) {\n var match = window.matchMedia( query )\n\n if ( fn ) {\n fn( match )\n match.addListener( fn )\n }\n\n return match\n }\n\n}\n\n\nmodule.exports = media\n","var Event = require( 'bean' )\nvar callbackManager = require( './callback-manager' )\nvar throttle = require( './throttle' )\nvar debounce = require( './debounce' )\n\nvar optimizedEventManager = {\n new: function( name ) {\n\n // Create a new callback manager\n var manager = {\n run: callbackManager.new(),\n start: callbackManager.new(),\n stop: callbackManager.new()\n }\n\n // run callbacks when event happens (at paint-ready frames)\n var running = throttle( manager.run.fire )\n\n // fire callbacks when event starts (at paint-ready frames)\n var started = debounce({\n leading: manager.start.fire,\n trailing: false,\n wait: 150\n })\n\n // fire callbacks when event starts (at paint-ready frames)\n var stopped = debounce( manager.stop.fire, 150 )\n\n Event.on( window, name, function() {\n running()\n started()\n stopped()\n })\n\n // Public API\n var run = function ( fn ) { return manager.run.add( fn ) }\n run.start = function ( fn ) { return manager.start.add( fn ) }\n run.stop = function ( fn ) { return manager.stop.add( fn ) }\n\n // Add custom events for to run optimized listeners. ( name -> Name )\n run( function() { Event.fire( window, 'optimized' + name[0].toUpperCase() + name.substring(1) ) } )\n run.start( function() { Event.fire( window, name + 'Start' ) } )\n run.stop( function() { Event.fire( window, name + 'Stop' ) } )\n\n return run\n }\n}\n\nmodule.exports = optimizedEventManager\n","var Event = require( 'bean' )\nvar callbackManager = require( './callback-manager' )\n\n// Create a new page event manager\nvar manager = {\n ready: callbackManager.new(),\n change: callbackManager.new(),\n readyAlready: false,\n changed: false,\n}\n\nmanager.ready.add( function(){\n manager.readyAlready = true \n})\n\nmanager.ready.add( function(){ \n if ( !window.Turbolinks && !manager.changed ) { \n manager.changed = true \n manager.change.fire()\n }\n})\n\nvar ready = function ( fn ) {\n if ( manager.readyAlready ) { fn() }\n return manager.ready.add( fn ) }\n\nvar change = function( fn ) {\n if ( manager.changed ) { fn() }\n return manager.change.add( fn ) }\n\n// Make it easy to trigger ready callbacks\nready.fire = function () {\n manager.ready.fire()\n // Be sure ready can only be fired once\n manager.ready.stop() }\n\n// Make it easy to trigger change callbacks\nchange.fire = function () {\n manager.change.fire() }\n\nEvent.on( document, 'DOMContentLoaded', ready.fire )\nEvent.on( document, 'page:change', change.fire ) // Support rails turbolinks page load event\n\nmodule.exports = {\n ready: ready,\n change: change\n}\n","var delay = require( './delay' )\n\nvar repeat = function( fn, wait, limit ) {\n\n var argsStart = 1,\n handle = delay ( fn, wait );\n\n if ( limit != null ) { argsStart = 3 }\n else if ( wait != null ) { argsStart = 2 }\n\n // Enable repeat ( -1 will repeat forever )\n handle.repeat = limit || -1\n handle.args = Array.prototype.slice.call( arguments, argsStart )\n handle.stop = handle.cancel\n\n return handle\n}\n\nmodule.exports = repeat\n","var manager = require( './optimized-event-manager' )\nvar resize = manager.new( 'resize' )\n\n// Pause animations during resizing for better performance\nresize.disableAnimation = function() {\n var style = '<style id=\"fullstop\">.no-animation *, .no-animation *:after, .no-animation *:before {\\\n transition: none !important; animation: none !important\\\n }</style>'\n\n // Inject style for easy classname manipulation\n if ( !document.querySelector('style#fullstop') ) { \n document.head.insertAdjacentHTML('beforeend', style)\n }\n\n resize.start( function() { document.body.classList.add( 'no-animation' ) } )\n resize.stop( function() { document.body.classList.remove( 'no-animation' ) } )\n}\n\nmodule.exports = resize\n","var manager = require( './optimized-event-manager' )\nvar scroll = manager.new( 'scroll' )\n\nscroll.disablePointer = function() {\n\n // Disable pointer interaction\n scroll.start( function() {\n document.documentElement.style.pointerEvents = 'none'\n })\n\n // Enable pointer interaction\n scroll.stop( function() {\n document.documentElement.style.pointerEvents = ''\n })\n}\n\nmodule.exports = scroll\n","// Custom Event Polyfill\n(function () {\n\n if ( typeof window.CustomEvent === \"function\" ) return false;\n\n function CustomEvent ( event, params ) {\n params = params || { bubbles: false, cancelable: false, detail: undefined };\n var evt = document.createEvent( 'CustomEvent' );\n evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );\n return evt;\n }\n\n CustomEvent.prototype = window.Event.prototype;\n\n window.CustomEvent = CustomEvent;\n})()\n","var endEvents = [\n 'touchend'\n]\n\nmodule.exports = Tap\n\n// default tap timeout in ms\nTap.timeout = 200\n\nfunction Tap(callback, options) {\n options = options || {}\n // if the user holds his/her finger down for more than 200ms,\n // then it's not really considered a tap.\n // however, you can make this configurable.\n var timeout = options.timeout || Tap.timeout\n\n // to keep track of the original listener\n listener.handler = callback\n\n return listener\n\n // el.addEventListener('touchstart', listener)\n function listener(e1) {\n // tap should only happen with a single finger\n if (!e1.touches || e1.touches.length > 1) return\n\n var el = e1.target\n var context = this\n var args = arguments;\n\n var timeout_id = setTimeout(cleanup, timeout)\n\n el.addEventListener('touchmove', cleanup)\n\n endEvents.forEach(function (event) {\n el.addEventListener(event, done)\n })\n\n function done(e2) {\n // since touchstart is added on the same tick\n // and because of bubbling,\n // it'll execute this on the same touchstart.\n // this filters out the same touchstart event.\n if (e1 === e2) return\n\n cleanup()\n\n // already handled\n if (e2.defaultPrevented) return\n\n // overwrite these functions so that they all to both start and events.\n var preventDefault = e1.preventDefault\n var stopPropagation = e1.stopPropagation\n\n e1.stopPropagation = function () {\n stopPropagation.call(e1)\n stopPropagation.call(e2)\n }\n\n e1.preventDefault = function () {\n preventDefault.call(e1)\n preventDefault.call(e2)\n }\n\n // calls the handler with the `end` event,\n // but i don't think it matters.\n callback.apply(context, args)\n }\n\n // cleanup end events\n // to cancel the tap, just run this early\n function cleanup(e2) {\n // if it's the same event as the origin,\n // then don't actually cleanup.\n // hit issues with this - don't remember\n if (e1 === e2) return\n\n clearTimeout(timeout_id)\n\n el.removeEventListener('touchmove', cleanup)\n\n endEvents.forEach(function (event) {\n el.removeEventListener(event, done)\n })\n }\n }\n}\n","var debounce = require( './debounce' )\n\nvar throttle = function( fn, wait, options ) {\n\n if ( typeof( fn ) == 'object' ) { options = fn; fn = undefined } \n else { options = options || {} }\n\n options.wait = options.wait || wait || 0\n options.max = options.max || options.wait\n options.callback = options.callback || fn\n options.leading = true\n options.trailing = true\n\n return debounce(options)\n}\n\n\nmodule.exports = throttle\n","var validation = require( './lib/validation' )\nvar progressive = require( './lib/progressive' )\n\nmodule.exports = {\n\n validate: validation.validate,\n invalidateField: validation.invalidateField,\n next: progressive.next,\n\n}\n","var toolbox = require( 'compose-toolbox' ),\n Event = toolbox.event,\n Callback = toolbox.event.callback,\n formSelector = 'form.progressive',\n watching = false,\n formCallbacks,\n registeredForms\n\n// Remove any existing callbacks and registered forms\nfunction reset () {\n\n formCallbacks = { next: [] }\n registeredForms = []\n\n}\n\nfunction newForm( form ) {\n\n if ( !form ) return\n\n var steps = toolbox.slice( form.querySelectorAll( '.form-step' ) ),\n stepIndex = 0,\n navItems = ''\n\n if ( steps.length == 0 ) return\n\n\n steps.forEach( function( step, index ) { \n\n // disable all steps but the current step\n step.disabled = step != currentStep()\n step.dataset.step = index\n\n })\n\n if ( form.dataset.nav ) {\n var nav = '<nav class=\"progressive-form-nav\">'\n\n steps.forEach( function( step, index ) {\n nav += '<a href=\"#\" class=\"progressive-form-nav-item\" data-step=\"'+( index + 1 )+'\">'\n nav += step.dataset.nav || \"Step \" + ( index + 1 )\n nav += '</a> '\n })\n\n nav += '</nav>'\n\n form.insertAdjacentHTML( 'afterbegin', nav )\n }\n\n show()\n\n function previousStep () { return steps[ stepIndex - 1] }\n function currentStep () { return steps[ stepIndex ] }\n function nextStep () { return steps[ stepIndex + 1] }\n function active () { return currentStep() && !currentStep().disabled }\n \n // Move to next fieldset\n function forward () {\n showStep( stepIndex + 1 )\n }\n\n // Move to next fieldset\n function back () {\n showStep( stepIndex - 1 )\n }\n\n // Accepts a step index\n function showStep ( index ) {\n\n index = Number( index )\n\n // Get the step from the index\n var step = steps[ index ]\n\n // Don't go to a non-existant step, or the current step\n if ( step && step != currentStep() ) {\n\n var direction = ( stepIndex < index ) ? 'forward' : 'reverse'\n\n // If a step is currently active\n // dismiss it before going to the specified step\n if ( active() ) {\n return dismiss( function() { showStep( index ) }, direction )\n }\n\n stepIndex = index\n\n show( direction )\n\n }\n }\n \n // Hide a completed step and move to the next\n function dismiss ( callback, direction ) {\n direction = direction || 'forward'\n\n currentStep().classList.remove( 'active', 'enter' )\n currentStep().classList.add( 'exit' )\n currentStep().dataset.direction = direction\n\n Event.afterAnimation( currentStep(), function() {\n disable()\n\n if ( typeof callback === 'function' ) callback()\n\n })\n\n }\n\n function revisit ( callback, direction ) {\n\n if ( !active() ) {\n direction = direction || 'reverse'\n\n currentStep().classList.remove( 'exit', 'completed' )\n currentStep().classList.add( 'active', 'enter' )\n currentStep().dataset.direction = direction\n\n disableOtherFieldsets()\n\n Event.afterAnimation( currentStep(), function() {\n if ( typeof callback === 'function' ) callback()\n })\n }\n }\n\n // Show the form-step\n function show ( direction ) {\n\n disableOtherFieldsets()\n currentStep().classList.remove( 'completed' )\n currentStep().dataset.direction = direction\n currentStep().classList.add( 'active', 'enter' )\n\n // focus on the first input\n var firstInput = currentStep().querySelector( 'input:not([hidden]), textarea, select' )\n if ( firstInput ) firstInput.focus()\n\n setNav()\n\n }\n\n // Disable a form step after it has been hidden\n function disable () {\n\n currentStep().disabled = true\n currentStep().classList.add( 'completed' )\n currentStep().classList.remove( 'enter', 'exit' )\n\n }\n\n function setNav () {\n toolbox.each( form.querySelectorAll( 'nav [data-step]' ), function ( nav ) {\n\n if ( nav.dataset.step < stepIndex + 1 ) {\n nav.classList.remove( 'here', 'next' )\n nav.classList.add( 'previous', 'completed' )\n }\n\n if ( nav.dataset.step == stepIndex + 1 ) {\n nav.classList.remove( 'previous', 'next' )\n nav.classList.add( 'here' )\n }\n\n if ( nav.dataset.step > stepIndex + 1 ) {\n nav.classList.remove( 'previous', 'here' )\n nav.classList.add( 'next' )\n }\n\n })\n }\n\n function enableFieldsets ( form ) {\n toolbox.each( form.querySelectorAll( 'fieldset.form-step[disabled]' ), function( fieldset ) {\n fieldset.disabled = false \n })\n }\n\n function disableOtherFieldsets ( ) {\n steps.forEach( function( fieldset ) {\n fieldset.disabled = fieldset != currentStep() \n })\n }\n\n registeredForms.push( function( event, trigger ) {\n var target = event.currentTarget\n\n if ( trigger === 'show-step' ) {\n event.preventDefault()\n\n if ( toolbox.matches( target, '.previous, .completed, .completed + a' ) )\n showStep( target.dataset.step - 1 )\n\n } else if ( trigger === 'next' ) {\n\n // Continue if submit was triggered on this form\n // and no invalid fields are found\n\n var formEl = ( target.tagName == \"FORM\" ) ? target : toolbox.getClosest( target, 'form')\n\n if ( form == formEl && !currentStep().querySelector( ':invalid' ) ) {\n\n // Get the function which triggers callbacks\n var fireCallbacks = getCallbacks( form )\n\n // This is the last stop, be sure all fieldsets are enabled!\n if ( !nextStep() ) enableFieldsets( form )\n else disableOtherFieldsets( form )\n\n // If there are callbacks, let them handle this!\n if ( fireCallbacks ) {\n\n // Since there are callbacks, stop the submission event\n event.preventDefault()\n\n fireCallbacks( event, {\n fieldset: currentStep(), // Valid fieldset element\n form: form, // Parent form element\n forward: forward, // Call forward() to move to the next fieldset\n dismiss: dismiss, // Hide and disable current step\n revisit: revisit, // Revisit current disabled step\n showStep: showStep, // Show a specific step by index (0 based)\n complete: !nextStep(), // is this is the final form step?\n formData: toolbox.formData( currentStep() ) // pass FormData for current fieldset\n })\n }\n\n // No callbacks? If there's a next step, stop submission and proceed\n else if ( nextStep() ) {\n event.preventDefault() \n forward()\n }\n }\n }\n })\n}\n\nfunction fire ( event, type ) {\n registeredForms.forEach( function( fn ) { fn( event, type ) })\n}\n\n\n// Returns a function which triggers callbacks\nfunction getCallbacks ( form, type ) {\n\n type = type || 'next'\n var callbacks = [], cb;\n\n formCallbacks[ type ].forEach( function( test ) {\n if ( cb = test( form ) ) {\n callbacks.push( cb )\n }\n })\n\n // Return a function which can trigger all callbacks\n // or returns fallse if none are called\n\n if ( callbacks.length )\n return function() {\n var args = toolbox.slice( arguments )\n\n callbacks.forEach( function( callback ) {\n callback.apply( callback, args ) }) }\n\n else return false\n}\n\nfunction next ( el, callback ) {\n on( el, 'next', callback )\n}\n\nfunction on ( el, event, callback ) {\n\n // Accept events list as an object e.g. { next: callback }\n if ( typeof event === 'object' ) {\n for ( type in event ) {\n on( el, type, event[ type ] )\n }\n }\n\n else if ( formCallbacks[ event ] ) {\n\n // Only allow access to a callback if the form matches\n var filter = function( form ) {\n if ( form == el ) return callback\n }\n\n // Add the test wrapper function to the callback list\n formCallbacks[ event ].push( filter )\n }\n}\n\nEvent.ready( function(){\n reset()\n\n // Add bubbling so we can listen for submission\n Event.bubbleFormEvents()\n\n var nextSelector = formSelector + ' [type=submit], ' + formSelector + ' .next-step'\n var backSelector = formSelector + ' .back-step'\n var navSelector = '.progressive-form-nav-item[data-step]'\n\n Event.on( document, 'click', nextSelector , fire, 'next' )\n Event.on( document, 'click', backSelector , fire, 'back' )\n Event.on( document, 'click', navSelector , fire, 'show-step' )\n// insert core styling for hiding disabled and completed form-steps\n document.head.insertAdjacentHTML( 'beforeend', \"<style>\\\n.form-step[disabled], .form-step.completed {\\\n position: absolute !important;\\\n top: -9999px !important;\\\n left: -9999px !important;\\\n left: 0 !important;\\\n right: 0 !important; }\\\n</style>\" )\n\n Event.change( function() {\n reset()\n\n toolbox.each( document.querySelectorAll( formSelector ), function( el ) {\n newForm( el )\n })\n })\n})\n\nmodule.exports = {\n next: next,\n new: newForm\n}\n","// Dependencies\nvar toolbox = require( 'compose-toolbox' ),\n Event = toolbox.event,\n getClosest = toolbox.getClosest,\n wordCount = toolbox.wordCount,\n textSelectors = '[required]';\n\n// Does this browser support HTML5 validation?\nfunction supported () {\n\n return typeof document.createElement( 'input' ).checkValidity === 'function'\n\n}\n\nvar invalidHandler = Event.callback.new( function( event ) { \n event.preventDefault() \n event.stopPropagation() \n})\n\n// Watch for events ( if validation is suported )\nEvent.ready( function(){\n\n if ( supported() ) { \n\n Event.bubbleFormEvents()\n\n document.addEventListener( 'invalid', invalidHandler, true )\n\n Event.on( document.body, 'click', '[type=submit]', submit )\n\n Event.on( document, 'validate', 'form', function( event ) { \n validateForm( event.target )\n })\n\n // Ensure all required inputs have aria-requrired attributes\n toolbox.slice( document.querySelectorAll( '[required]' ) ).forEach( function( element ) { \n element.setAttribute( 'aria-required', true )\n })\n\n // Watch input events\n Event.on( document, 'blur', '[required]', checkValidation )\n Event.on( document, 'keydown', '[required]', Event.debounce( checkValidation, 200 ) )\n Event.on( document, 'input', 'select[required]', Event.debounce( checkValidation, 200 ) )\n\n }\n})\n\nfunction validateForm ( form ) {\n\n // Scoped variables\n var inputs = form.querySelectorAll( '[required]' ),\n invalidInput;\n\n toolbox.slice( inputs ).some( function( input ) {\n\n // if invalid\n if ( !getClosest( input, '[disabled]' ) && !checkInput( input ) ) {\n invalidInput = input\n return true\n }\n })\n\n if ( invalidInput ) { \n\n // Show validation message\n focus( invalidInput )\n showMessage( invalidInput )\n\n return false\n }\n\n // The form is valid, skip it\n else { \n return true \n }\n\n}\n\n// Handler for validation events\nvar checkValidation = Event.callback.new( function( event ) {\n\n if ( checkInput( event.target, event.type ) ) {\n\n // Remove any pre-existing validation message\n hideMessage( event.target )\n }\n\n})\n\n\nfunction checkInput ( input, event ) {\n\n var el = statusEl( input ),\n valid = isValid( input ),\n neutral = event == 'keydown' && !valid;\n\n // Don't trigger invalid style while typing\n if ( neutral && input == document.activeElement ) {\n\n el.classList.remove( 'invalid', 'valid' )\n input.setAttribute( 'aria-invalid', false )\n\n } else {\n\n el.classList.toggle( 'invalid', !valid )\n el.classList.toggle( 'valid', valid )\n input.setAttribute( 'aria-invalid', valid )\n\n }\n\n return valid\n\n}\n\n// Is an input valid?\nfunction isValid ( input ) {\n\n // If element only contains whitespace, strip value\n if ( !input.value.replace( /\\s/g, '' ).length )\n input.value = ''\n\n // Set a custom validation message for word count\n var message = checkValue( input ) || checkLength( input ) || ''\n input.setCustomValidity( message )\n\n var valid = input.checkValidity()\n\n return valid\n\n}\n\n\nfunction checkValue( input ) {\n if ( input.dataset.invalidValue ) {\n\n // Does input value == invalid value? (case insensitive)\n var regexp = escapedRegex( input.dataset.invalidValue, 'i' )\n\n if ( input.value.match( regexp ) ) {\n\n // Remove any standard custom message\n input.dataset.cachedMessage = input.dataset.message\n input.dataset.message = ''\n\n return input.dataset.invalidValueMessage || \"Value '\"+input.value+\"' is not permitted\"\n\n // If not invalid value reset standard validation message\n } else if ( input.dataset.cachedMessage ) {\n\n input.dataset.message = input.dataset.cachedMessage\n input.dataset.cachedMessage = ''\n\n }\n }\n}\n\nfunction escapedRegex( input, options ) {\n var str = input.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n return new RegExp( \"^\" + str + '$', options )\n}\n\nfunction checkLength ( input ) {\n return checkCount( input, 'min' )\n || checkCount( input, 'max' )\n}\n\n// Test custom validation for maximum or minimum words present\nfunction checkCount ( input, limit ) {\n\n var goal = input.dataset[ limit + 'Words' ]\n\n if ( goal ) {\n\n var lessThanGoal = wordCount( input.value ) < goal\n phrasing = ( limit == 'min' ) ? 'at least ' : 'no more than ',\n valid = ( limit == 'min' ) ? !lessThanGoal : lessThanGoal\n\n // Return a custom error message\n if ( input.value && !valid )\n return 'Please write ' + phrasing + goal + ' words.'\n }\n\n\n}\n\n// If input is nested in a label, treat the label as the\n// target for assigning status (class names and messages).\nfunction statusEl ( input ) {\n\n return getClosest( input, 'label' ) || input\n\n}\n\n// Focus() if invalid element is not hidden\n// or Focus its immediate sibling (mostly used for upload buttons)\nfunction focus ( el ) {\n\n el = ( el.style.display !== 'none' ) ? el : el.nextSibling\n el.focus()\n\n}\n\n// Submission validation handler function\nfunction submit ( event ) {\n\n var form = ( event.target.tagName == \"FORM\" ) ? event.target : getClosest( event.target, 'form')\n\n // Skip validation if no invalid inputs found\n if ( !validateForm( form ) ) {\n\n // Pause keydown/blur triggers for the next second to avoid neutral empty style\n checkValidation.stop()\n Event.delay( checkValidation.start, 500 )\n\n // Stop the submission event\n event.preventDefault()\n event.stopImmediatePropagation()\n\n }\n\n}\n\nfunction invalidateField ( el, message ) {\n if ( el && el.value ) {\n el.dataset.invalidValue = el.value\n if ( message )\n el.dataset.invalidValueMessage = message\n }\n}\n\nfunction hideMessage ( el ) {\n\n var form = getClosest( el, 'form' ),\n msg = form.querySelector( '.validation-message' )\n\n if ( msg ) msg.parentNode.removeChild( msg )\n\n}\n\n\n// Validation message handler function\nfunction showMessage ( el ) {\n\n //hideMessage( el )\n\n var label = getClosest( el, 'label' ),\n message = el.dataset.message || el.validationMessage\n\n if ( label ) {\n var existingMessage = label.querySelector( '.validation-message-text' )\n\n if ( !existingMessage ) {\n label.insertAdjacentHTML( 'beforeend', '<span class=\"validation-message\"><span class=\"validation-message-text\" role=\"alert\">' + message + '</span></span>' )\n\n } else if ( existingMessage.textContent != message ) {\n existingMessage.innerHTML = message\n }\n }\n\n}\n\n// Public API\nmodule.exports = {\n validate: validateForm,\n invalidateField: invalidateField\n}\n","require ('./lib/object.assign')\n\nvar Event = require('compose-event')\n// Improves the utility and user interface for range inputs\n\nvar sliders = []\nvar listening\n\nvar Slider = {\n // When a slider is changed, update the associated label and input.\n change: function(event) {\n self.refresh(event.currentTarget)\n },\n\n // Update labels and inputs\n refresh: function (slider) {\n self.setLabels(slider)\n self.setInput(slider)\n self.setFill(slider)\n },\n \n // Some browsers don't focus when a slider input is changed, this lets us force focus.\n focus: function(event){\n event.currentTarget.focus()\n },\n \n // Inject slider templates into the DOM\n setup: function(){\n\n if (!listening) {\n Event.on(document, \"input toggler:show\", \"[type=range]\", self.change, { useCapture: true })\n Event.on(document, \"click change input\", \"[type=range]\", self.focus, { useCapture: true })\n listening = true\n }\n\n var ranges = document.querySelectorAll('[type=range]:not(.slider-input)')\n\n Array.prototype.forEach.call(ranges, function(slider){\n\n var data = self.data(slider)\n sliders.push(data)\n\n slider.dataset.id = data.id\n\n // Inject template and set inputs\n slider = self.template(slider)\n self.refresh(slider)\n\n })\n },\n\n data: function(el) {\n var data = {\n // Assign an incremental ID to track this slider with its data\n id: sliders.length,\n min: el.getAttribute('min') || 0,\n max: el.getAttribute('max') || 100,\n labels: {},\n externalLabels: {}\n }\n\n // Gets dataset as a hash\n Object.assign(data, self.extractData(el))\n\n data = self.extractValues(data)\n data = self.getLabels(data)\n\n if (data.values)\n data.max = (data.min + data.values.length - 1)\n\n data.segments = Number(data.max) - Number(data.min) + 1\n\n for (var key in data) {\n if(key.match(/-/)){\n data[this.camelCase(key)] = data[key]\n delete data[key]\n }\n }\n\n // Allow data-input or name attribute to set value for hidden input.\n //\n if (!data.input && el.getAttribute('name')) {\n data.input = el.getAttribute('name')\n el.removeAttribute('name')\n }\n\n if (data.input) {\n // Generate a class name for querying later (because some name attributes contain illegal characters for queries)\n data.inputClass = data.input.replace(/\\W/g,'-')\n data.inputExists = self.inputExists(el, data)\n }\n\n data = self.getLineLabels(data)\n\n if (data.mark) { \n data.mark = data.mark.split(',').map(Number) \n }\n\n return data\n },\n\n getData: function(slider) {\n if (typeof slider != 'string' && slider.dataset) {\n slider = slider.dataset.id\n }\n return sliders[slider]\n },\n\n extractValues: function(data) {\n if (data.values) { \n data.values = data.values.split(',').map(self.trim)\n } else {\n data.values = []\n for (var i = data.min; i <= data.max; i++ ) {\n data.values.push(i)\n }\n }\n\n return data\n },\n\n // Convert dataset strings into hashes of arrays\n // examples:\n // - data-label='one,two,three' => data.labels.default = ['one','two','three']\n // - data.external-label-awesome='one;two;three' => data.externalLabels.awesome = ['one','two','three']\n //\n // If labels have not been disabled (data-label='false') and there are no data labels,\n // an array of values is set to data.labels.default\n //\n getLabels: function(data) {\n if (data.label && data.label.match(/false|none/))\n data.label = false\n\n // Unless labels have been disabed with data-label='false'\n for (var val in data) {\n // Ignore non-native methods injected by some wayward lib\n if (!data.hasOwnProperty(val)) { continue }\n // Don't bother processing disabled labels\n if (data[val] === false) { continue }\n\n // Match properties: label, label-id, external-label-id\n var match = val.match(/^(external-)?label-(.+)|^label$/)\n\n if(match) {\n // Some labels may include commas, allow semicolons as an alternate separator\n //\n var delimiter = data[val].match(/;/) ? ';' : ','\n var labels = data[val].split(delimiter).map(self.trim)\n var external = match[1]\n var name = match[2]\n\n if(external){\n data.externalLabels[name] = labels\n } else if (val == 'label') {\n data.labels.default = labels\n delete data.label\n } else {\n data.labels[name] = labels\n }\n\n delete data[val]\n }\n\n var labelCount = self.objectSize(data.labels)\n\n // If there are no labels, use values for a label\n if (labelCount == 0)\n data.labels.default = data.values\n\n if (labelCount > 1)\n delete data.labels.default\n }\n\n return data\n },\n\n getLineLabels: function(data){\n var lineLabels = {}\n\n // Line labels may be in the following formats:\n // - 1:start,11:end - index specified, comma separated\n // - first,second,third,11:last - default to index for some labels\n // - 10,000;20,000;30,000 - semicolon separated\n //\n if(data.lineLabels) {\n var delimiter = data.lineLabels.match(/;/) ? ';' : ','\n data.lineLabels.split(delimiter).map(function(labels, index){\n var l = labels.split(':')\n label = (!l[1] ? l[0] : l[1])\n index = (!l[1] ? index + 1 : l[0])\n lineLabels[index] = label\n })\n data.lineLabels = lineLabels\n }\n\n return data\n },\n\n // \n template: function(slider){\n var data = self.getData(slider)\n\n slider.setAttribute('min', data.min)\n slider.setAttribute('max', data.max)\n\n slider.classList.add('slider-input')\n\n if(slider.classList.contains('left-label'))\n slider.classList.remove('left-label')\n\n var containerHTML = self.templateHTML(data)\n\n var classes = ['slider-container']\n\n if (containerHTML.match('slider-line-label'))\n classes.push('line-labels')\n\n if (containerHTML.match('slider-label'))\n classes.push(\"with-label\")\n else\n classes.push(\"without-label\")\n\n containerHTML = '<div class=\"'+classes.join(' ')+'\" id=\"slider'+data.id+'\">'\n + containerHTML\n +'</div>'\n\n slider.insertAdjacentHTML('beforebegin', containerHTML)\n var container = slider.previousSibling\n container.querySelector('.slider-input-container').insertAdjacentHTML('afterbegin', slider.outerHTML)\n slider.parentNode.removeChild(slider)\n\n slider = container.querySelector('.slider-input')\n \n // Update attributes from processed data\n //\n if(!slider.getAttribute('value'))\n slider.value = data.value || data.min\n return slider\n },\n \n templateHTML: function(data){\n var html = \"\"\n var fills = \"\"\n \n if (data.mark || data.lineLabels) {\n for(var i = 1; i <= data.segments; i++) {\n \n html += \"<div class='slider-segment'><span class='slider-segment-content'>\"\n\n if (data.mark && data.mark.indexOf(i) != -1)\n html += \"<span class='slider-segment-mark' data-index='\"+i+\"'></span>\"\n\n if (data.lineLabels && data.lineLabels[i]) \n html += \"<span class='slider-line-label'>\"+data.lineLabels[i]+\"</span>\"\n\n html += \"</span></div>\"\n }\n }\n\n // one less\n for(var i = 1; i < data.segments; i++) {\n fills += \"<span class='slider-fill' data-index='\"+i+\"'></span>\"\n }\n\n html = \"<div class='slider-input-container'>\"\n + \"<div class='slider-track'>\" + html + \"</div>\"\n + \"<div class='slider-fills'>\" + fills + \"</div>\"\n + \"</div>\"\n + self.labelTemplate(data)\n\n if (!data.inputExists && data.inputClass) {\n html += \"<input class='\"+data.inputClass+\"' type='hidden' name='\"+data.input+\"' value=''>\"\n }\n\n return html\n \n },\n\n labelTemplate: function(data){\n var html = \"\"\n\n if (data.label == false) { return html }\n\n for(var key in data.labels){\n html += '<span class=\"slider-label-'+key+' internal-label\" data-slider-label=\"'+key+'\">'\n html += self.labelHTML(data, key, '')\n html += '</span></span> '\n }\n\n if (html.length > 0) {\n html = \"<div class='slider-label align-\"+(data.positionLabel || 'right')+\"'>\" + html + \"</div>\"\n }\n\n return html\n },\n\n labelHTML: function(data, key, label) {\n return self.labelMeta(data, key, 'before')\n + \"<span class='label-content'>\" + label + \"</span>\"\n + self.labelMeta(data, key, 'after')\n },\n\n // Grab all prefixes or suffixes, for example:\n // - data-before-label='$'\n // - data-after-label='/mo'\n // - data-after-label-size='GB'\n //\n labelMeta: function(data, key, position) {\n var altKey = self.camelCase('-label-'+key)\n var meta = data[position+altKey] || data[position+'Label']\n if (meta)\n return \"<span class='\"+position+\"-label'>\"+meta+\"</span>\"\n else\n return ''\n },\n\n // Is there already an input matching this name?\n inputExists: function(slider, data) {\n if (data.inputClass) {\n var input = self.scope(slider).querySelector('input[name=\"'+data.input+'\"]')\n\n if(input) {\n input.classList.add(data.inputClass)\n return true\n }\n }\n },\n\n extractData: function(el) {\n var pattern = 'data-'\n var data = {}\n\n for (var i = 0; i < el.attributes.length; i++){\n var name = el.attributes[i].nodeName\n\n if(new RegExp(\"^\"+pattern).test(name)) {\n name = name.replace(pattern, '')\n data[name] = el.attributes[i].nodeValue\n }\n }\n return data\n },\n\n labelElements: function(id, key, external) {\n var selector = '[data-slider-label='+key+']'\n var internalSelector = \"#slider\"+id + ' ' + selector\n var externalSelector = selector += ':not(.internal-label)' \n if (external) { \n selector = externalSelector\n } else {\n selector = internalSelector + ', ' + externalSelector\n }\n\n return document.querySelectorAll(selector)\n },\n\n setFill: function(slider) {\n var data = self.getData(slider)\n var segments = document.querySelectorAll('#slider'+data.id+' .slider-segment')\n var fills = document.querySelectorAll('#slider'+data.id+' .slider-fill')\n var sliderIndex = self.sliderIndex(slider)\n \n Array.prototype.forEach.call(fills, function(fill, index){\n if (fill.dataset.index <= sliderIndex) {\n fill.classList.add('filled')\n if(segments[index]) {\n segments[index].classList.add('filled')\n }\n } else {\n fill.classList.remove('filled')\n if(segments[index]) {\n segments[index].classList.remove('filled')\n }\n }\n })\n \n },\n\n setInput: function(slider) {\n var data = self.getData(slider)\n\n // Don't update hidden sliders\n if (slider.offsetParent === null) { return }\n\n if (data.input && data.values) {\n var value = data.values[self.sliderIndex(slider)]\n var selector = \".\"+data.input.replace(/\\W/g,'-')\n var inputs = self.scope(slider).querySelectorAll(selector)\n\n Array.prototype.forEach.call(inputs, function(input){\n input.value = value\n })\n }\n },\n\n setLabels: function(slider) {\n var data = self.getData(slider)\n var index = self.sliderIndex(slider)\n\n if (slider.offsetParent === null) { return }\n\n Array.prototype.forEach.call(['labels', 'externalLabels'], function(type) {\n var external = (type == 'externalLabels')\n\n for (var key in data[type]) {\n var labelEls = self.labelElements(data.id, key, external)\n var labels = self.labelAtIndex(data[type], index)\n\n Array.prototype.forEach.call(labelEls, function(el) {\n var container = el.querySelector('.label-content')\n\n if ( container ) { container.innerHTML = labels[key] }\n else { el.innerHTML = self.labelHTML(data, key, labels[key]) }\n\n el.classList.toggle('empty-label', labels[key] === '')\n })\n }\n })\n },\n\n // Get all labels for the current slider position\n labelAtIndex: function(labels, index){\n var set = {}\n for (var key in labels) {\n set[key] = labels[key][index]\n }\n return set\n }, \n\n // Normalize the slider value by the minimum value\n sliderIndex: function(slider){\n return Number(slider.value) - Number(slider.getAttribute('min'))\n },\n\n // If slider is in a form, return that form.\n // This alows us to be sure that sliders in one\n // form do not update labels with the same name\n // in another form.\n //\n scope: function(slider) {\n var el = slider\n\n while (el && el.tagName != \"FORM\") {\n el = el.parentNode\n }\n\n return el || document\n },\n\n // Function for easy maping, as in: someArray.map(self.trim)\n trim: function(name){ \n return name.trim()\n },\n\n objectSize: function(object) {\n var length = 0; for(var i in object) { length++ }\n return length\n },\n\n camelCase: function(input) {\n return input.toLowerCase().replace(/-(.)/g, function(match, group) {\n return group.toUpperCase();\n });\n }\n}\n\nvar self = Slider\n\nEvent.change(Slider.setup)\n\nmodule.exports = Slider\n","if (typeof Object.assign != 'function') {\n (function () {\n Object.assign = function (target) {\n 'use strict';\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (Object.prototype.hasOwnProperty.call(source, nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n })();\n}\n","var Event = require('compose-event')\n\nvar Toggler = {\n checkboxSelector: \"[type=checkbox][data-toggle], [type=checkbox][data-show], [type=checkbox][data-hide]\",\n radioSelector: \"input[type=radio][data-show], input[type=radio][data-hide], input[type=radio][data-add-class], input[type=radio][data-remove-class]\",\n selectSelector: \"option[data-hide], option[data-show]\",\n\n listen: function(){\n Event.on(document, \"click change\", \"[data-toggle], [data-show], [data-hide], [data-toggle-class], [data-add-class], [data-remove-class]\", Toggler.trigger)\n Event.on(document, \"change\", \".select-toggler\", Toggler.trigger)\n Event.on(window, 'hashchange', Toggler.hashChange)\n },\n\n hashChange: function() {\n if ( window.location.hash ) {\n\n var anchor = '[data-anchor=\"'+window.location.hash+'\"]'\n var target = document.querySelector( 'input'+anchor+ ', option'+anchor )\n\n if ( target ) {\n if ( target.type == 'radio' ) {\n target.checked = true\n } else {\n var select = Toggler.getSelectFromOption(target)\n select.selectedIndex = target.index\n target = select\n }\n ratchet.toggler.triggerToggling( target )\n }\n }\n },\n\n refresh: function(){\n Toggler.toggleCheckboxes()\n Toggler.setupSelects()\n Toggler.setupRadios()\n },\n\n trigger: function(event) {\n // Stop event and bubbling if link is only being used as a toggler\n if (event.currentTarget.getAttribute('href') == \"#\") {\n event.preventDefault()\n event.stop()\n } \n\n Toggler.triggerToggling(event.currentTarget, event)\n },\n\n triggerToggling: function(target, event) {\n var actions = ['hide', 'toggle', 'show', 'removeClass', 'toggleClass', 'addClass']\n var select\n\n // Store the select, and set the target to the current option\n // Events fire on the select, but the options have toggling attributes\n if (target.tagName.match(/select/i)) {\n select = target\n target = select.selectedOptions[0]\n }\n\n // Radio inputs and selects do not support toggling, so remove them\n if (select || target.type == 'radio') {\n actions = actions.filter(function(action) {\n return !action.match(/toggle/)\n })\n }\n\n // Dispatch all actions\n actions.forEach(function(action) {\n Toggler.dispatch(target, action)\n })\n },\n\n dispatch: function(el, type) {\n var action = type\n var data = el.dataset[type]\n\n // Abort if element doesn't have data for the action\n if (!data || typeof data == 'undefined' || data == '') return\n\n // Toggle and show are treated the same for checkboxes\n if (el.type == 'checkbox')\n action = (type.match(/hide|remove/i) ? !el.checked : el.checked)\n\n if (data){\n if (type.match(/class/i)){\n Toggler.setClass(data, action, el)\n } else {\n Toggler.setState(data, action)\n }\n }\n },\n\n // Add, remove, or toggle classnames, triggered by elements with:\n // data-hide-class, data-show-class, and data-toggle-class values\n //\n // Data value examples:\n // - \"classname\" - add/remove/toggle classname on current element\n // - \"foo bar\" - multiple classnames, separated by spaces (like html class property)\n // - \"foo bar; selector\" - change classnames on elements matched by selector\n // - \"foo bar; selector, selector\" - match multiple selectors\n //\n // You can perform multiple add/remove classes by joining values with an `&`\n // For example: \"classname & foo bar; selector\"\n // This would toggle classname on current element and toggle `foo bar` classnames\n // on an element matching the selector\n //\n\n setClass: function (selectors, action, el){\n if(typeof selectors == 'undefined' || selectors == '') return\n\n if (typeof(action) == 'boolean') {\n action = (action ? 'add' : 'remove')\n }\n\n if (selectors.match(/&/)) {\n selectors.split('&').forEach(function(sel){\n Toggler.setClass(sel.trim(), action, el) \n })\n return\n }\n\n // Get selector and classnames, format: \"classname classname; selector,selector\"\n var settings = selectors.split(';')\n var classnames = settings[0].trim()\n var matches = []\n selectors = settings[1]\n\n if (selectors) {\n matches = document.querySelectorAll(selectors)\n\n // If no slectors are present, and el is an OPTION, use its SELECT as the matched element\n } else if (el && el.tagName.match(/option/i)) {\n matches = [Toggler.getSelectFromOption(el)]\n \n // If no slectors are present, use the current el for classnames\n } else if (el) {\n matches = [el]\n }\n\n Array.prototype.forEach.call(matches, function(match){\n Array.prototype.forEach.call(classnames.split(' '), function(classname) {\n var method = action.replace(/Class/,'')\n match.classList[method](classname)\n })\n\n Toggler.triggerTogglerEventsOnChildren(match, 'class')\n })\n },\n\n setState: function(selectors, state) {\n var matches = document.querySelectorAll(selectors)\n\n Array.prototype.forEach.call(matches, function(match){\n var action = Toggler.toggleAction(match, state)\n\n Toggler[action](match)\n Toggler.triggerTogglerEventsOnChildren(match, action)\n })\n },\n\n toggleAction: function(el, action) {\n\n if (typeof(action) == 'boolean') {\n action = (action ? 'show' : 'hide')\n }\n\n if (action == 'toggle') {\n if (el.classList.contains('hidden')) {\n action = 'show'\n } else {\n action = 'hide'\n }\n }\n\n return action\n },\n\n show: function(el) {\n el.classList.remove('hidden')\n el.classList.add('visible')\n\n // Enable inputs, fieldsets or forms when shown\n if ( typeof el.disabled != 'undefined' ){\n el.disabled = false\n }\n\n // Focus on key element if an element expects focus\n var focusEl = el.querySelector('[data-focus]')\n if (focusEl) { focusEl.focus() }\n\n // Trigger input event on ranges that have been hidden\n var ranges = el.querySelectorAll('[type=range]')\n },\n\n hide: function(el) {\n el.classList.remove('visible')\n el.classList.add('hidden')\n\n // Disable inputs, fieldsets or forms when hidden\n if ( typeof el.disabled != 'undefined' ){\n el.disabled = true\n }\n },\n\n getLeafNodes: function (parent) {\n // is the parent itself a leaf node?\n if (!parent.hasChildNodes()) return [parent]\n\n var nodes = Array.prototype.slice.call(parent.getElementsByTagName(\"*\"), 0)\n\n return nodes.filter(function(elem) {\n return elem.children && elem.children.length === 0\n })\n },\n\n triggerTogglerEventsOnChildren: function(el, eventName){\n // we care about leaf nodes since the event will bubble to\n // non-leaf nodes from the leaf nodes\n var leafChildNodes = Toggler.getLeafNodes(el)\n\n Array.prototype.forEach.call(leafChildNodes, function(node) {\n // 'toggler:show', 'toggler:hide', etc\n Event.fire(node, \"toggler:\" + eventName)\n })\n },\n\n toggleCheckboxes: function(checkboxes) {\n checkboxes = checkboxes || document.querySelectorAll(Toggler.checkboxSelector)\n\n Array.prototype.forEach.call(checkboxes, Toggler.triggerToggling)\n },\n\n setupRadios: function() {\n Array.prototype.forEach.call(document.querySelectorAll(Toggler.radioSelector), function(radio, index){\n if (!radio.dataset.togglerActive) {\n\n var radioName = radio.getAttribute('name'),\n siblings = Toggler.parentForm(radio).querySelectorAll('[type=radio][name=\"'+radioName+'\"]'),\n showSelectors = Toggler.dataAttributes(siblings, 'show'),\n addClassSelectors = Toggler.dataAttributes(siblings, 'addClass'),\n checked\n\n Array.prototype.forEach.call(siblings, function(r){\n\n if (r.dataset.anchor && window.location.hash == ('#'+r.dataset.anchor.replace('#',''))) {\n r.checked = true\n }\n\n // Ensure that all radio buttons in a group have a default data-show value of ''\n // This means that unset data-show values will toggle off everything\n //\n r.dataset.show = r.dataset.show || ''\n r.dataset.addClass = r.dataset.addClass || ''\n\n // Append element's data-hide to showSelectors\n if ( r.dataset.hide && r.dataset.hide.length > 0 )\n showSelectors = showSelectors.concat( r.dataset.hide.split( ',' ) )\n\n r.dataset.hide = showSelectors.filter(function(selector){\n return r.dataset.show.indexOf( selector )\n }).join(',')\n\n // Ensure that all radio buttons in a group have a default data-add-class value of ''\n // This means that unset data-add-class values are toggle off all classes\n //\n r.dataset.addClass = r.dataset.addClass || ''\n\n // Ensure that selected radio buttons remove classes according\n // to the deselected radio buttons\n r.dataset.removeClass = addClassSelectors.filter(function(selector){\n return r.dataset.addClass.indexOf( selector )\n }).join('&')\n\n\n r.dataset.togglerActive = true\n\n\n if( r.checked ) checked = r\n\n })\n\n if ( checked ) {\n Toggler.triggerToggling( checked )\n } else {\n Toggler.setState( showSelectors.join(','), 'hide' )\n Toggler.setClass( addClassSelectors.join(' & '), 'removeClass' )\n }\n }\n\n })\n },\n\n // Add data-hide to each <option> containing the selectors from other\n // option's data-show. This makes the toggling of elements exclusive.\n //\n setupSelects: function(){\n Array.prototype.forEach.call(document.querySelectorAll(Toggler.selectSelector), function(option){\n // Prevent an option from being considered twice\n if (!option.dataset.togglerActive) {\n\n option.dataset.show = option.dataset.show || ''\n\n var select = Toggler.getSelectFromOption(option)\n select.classList.add('select-toggler')\n var options = select.querySelectorAll('option')\n\n var showSelectors = Toggler.dataAttributes(options, 'show')\n var addClassSelectors = Toggler.dataAttributes(options, 'addClass')\n\n Array.prototype.forEach.call(options, function(o, index) {\n\n if (o.dataset.anchor && window.location.hash == ('#'+o.dataset.anchor.replace('#',''))) {\n select.selectedIndex = index\n }\n\n o.dataset.show = o.dataset.show || ''\n o.dataset.addClass = o.dataset.addClass || ''\n\n // Append element's data-hide to showSelectors\n if ( o.dataset.hide && o.dataset.hide.length > 0 )\n showSelectors = showSelectors.concat( o.dataset.hide.split( ',' ) )\n\n // If show selectors are not present in element's data-show\n // Add them to the list of selectors to be hidden\n o.dataset.hide = showSelectors.filter(function(selector){\n return o.dataset.show.indexOf( selector )\n }).join(',')\n\n o.dataset.removeClass = addClassSelectors.filter(function(selector){\n return o.dataset.addClass.indexOf( selector )\n }).join(' & ')\n\n o.dataset.togglerActive = true\n })\n\n // Ensure that currently selected option is toggled properly\n //\n Toggler.triggerToggling(select)\n }\n })\n },\n\n // Find parent <select> for an option (accounts for option groups)\n //\n getSelectFromOption: function(el) {\n var p = el.parentElement\n\n if (p.tagName == 'SELECT') {\n return p\n } else {\n return Toggler.getSelectFromOption(p)\n }\n },\n\n\n // Find parent <form> or document if there is no form\n //\n parentForm: function(element) {\n var el = element\n\n while (el && el.tagName != \"FORM\") {\n el = el.parentNode\n }\n\n return el || document\n },\n\n // Return a unique array of all data attribute values from elements\n //\n dataAttributes: function(elements, attr) {\n return Array.prototype.map.call(elements, function(el) { \n return el.dataset[attr]\n }).filter(function(selectors, index, self) {\n return selectors != \"\" && typeof selectors != 'undefined' && self.indexOf(selectors) === index\n })\n }\n}\n\nEvent.ready(Toggler.listen)\nEvent.change(Toggler.refresh)\n\nmodule.exports = Toggler\n","// Shims\nrequire( './lib/shims/_classlist' )\nvar merge = require( './lib/shims/_object.assign' )\n\nvar event = require( 'compose-event' )\nvar scrollTo = require( './lib/scrollto' )\nvar fromTop = require( './lib/fromtop' )\nvar ease = require( './lib/ease' )\n\nvar toolbox = {\n\n event: event,\n scrollTo: scrollTo,\n fromTop: fromTop,\n merge: merge,\n ease: ease,\n\n // Get closest DOM element up the tree that matches a given selector\n getClosest: function ( el, selector ) {\n for ( ; el && el !== document; el = el.parentNode ) {\n if ( toolbox.matches( el, selector ) ) return el;\n }\n return false;\n },\n\n // Get next DOM element that matches a given selector\n getNext: function( el, selector ) {\n for ( ; el && el !== document; el = el.parentNode ) {\n if ( el.querySelector( selector ) ) return el.querySelector( selector );\n }\n return false;\n },\n\n // Matches selector function\n // @reference https://developer.mozilla.org/en-US/docs/Web/API/Element/matches\n matches: function ( el, selector ) {\n return ( el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector ).call( el, selector );\n },\n\n wordCount: function( str ) {\n var matches = str.match( /\\S+/g );\n return matches ? matches.length : 0;\n },\n\n // Easy access to slice for converting objects into arrays of values.\n slice: function( obj, count ) {\n return Array.prototype.slice.call( obj, count )\n },\n\n each: function( collection, callback ) {\n return Array.prototype.forEach.call( collection, callback )\n },\n\n formData: function( rootEl ) {\n var formData = new FormData(),\n fields = rootEl.querySelectorAll( 'input[name]' )\n\n // Loop over fields\n toolbox.each( fields, function( field ) {\n // Append current field’s name/value to new formData object\n formData.append( field.name, field.value );\n })\n\n // Then return said formData object\n return formData;\n }\n\n}\n\n\nmodule.exports = toolbox\n","// easing functions http://gizma.com/easing/\nvar ease = {\n\n inOutQuad: function (t, b, c, d) {\n t /= d/2\n if (t < 1) { return c/2*t*t + b }\n t--\n return -c/2 * (t*(t-2) - 1) + b\n },\n\n inOutCubic: function (t, b, c, d) {\n\tt /= d/2;\n\tif (t < 1) return c/2*t*t*t + b;\n\tt -= 2;\n\treturn c/2*(t*t*t + 2) + b;\n },\n\n inOutQuint: function(t, b, c, d) {\n var ts = (t/=d)*t,\n tc = ts*t;\n return b+c*(6*tc*ts + -15*ts*ts + 10*tc);\n },\n\n inOutCirc: function (t, b, c, d) {\n t /= d/2;\n if (t < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;\n t -= 2;\n return c/2 * (Math.sqrt(1 - t*t) + 1) + b;\n }\n\n}\n\nease.default = ease.inOutQuad\n\nmodule.exports = ease\n","module.exports = function( el ) {\n return Math.round( el.getBoundingClientRect().top + window.pageYOffset );\n}\n","var ease = require( './ease' )\nvar fromTop = require( './fromtop' )\n\nfunction move(amount) {\n\n // Scroll all because document.scrollingElement is still expiremental\n document.documentElement.scrollTop = amount;\n document.body.parentNode.scrollTop = amount;\n document.body.scrollTop = amount;\n\n}\n\nfunction position() {\n return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop;\n}\n\nfunction scrollTo(to, callback, duration) {\n\n // Making args flexible\n //\n // Allow for element or y-coordinates\n if( typeof( to ) === 'object' ) { to = fromTop( to ) }\n\n // Accept duration as the second argument\n if( typeof( callback ) === 'number' ) { duration = callback; callback = null }\n\n // Default duration = 500\n duration = ( typeof( duration ) === 'undefined' ) ? 500 : duration\n\n var start = position(),\n change = to - start,\n currentTime = 0,\n increment = 20;\n\n\n var animateScroll = function() {\n\n // increment the time\n currentTime += increment\n\n // find the value with the quadratic in-out easing function\n var val = ease.default(currentTime, start, change, duration)\n\n // move the document.body\n move(val);\n\n // do the animation unless its over\n if ( currentTime < duration ) {\n requestAnimationFrame( animateScroll )\n } else {\n if ( callback && typeof( callback ) === 'function') {\n callback()\n }\n }\n }\n\n animateScroll()\n}\n\nmodule.exports = scrollTo\n","/**\n * ClassList polyfill\n * Cross-browser full element.classList implementation\n * @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js\n * @author Eli Grey - http://eligrey.com\n * @license MIT\n **/\n\nif ( 'document' in self ) {\n\n // Full polyfill for browsers with no classList support\n if ( !( 'classList' in document.createElement( '_' ) ) ) {\n\n ( function( view ) {\n\n 'use strict';\n\n if ( !( 'Element' in view ) ) return;\n\n var\n classListProp = 'classList',\n protoProp = 'prototype',\n elemCtrProto = view.Element[ protoProp ],\n objCtr = Object,\n\n strTrim = String[ protoProp ].trim || function() {\n return this.replace( /^\\s+|\\s+$/g, '' );\n },\n\n arrIndexOf = Array[ protoProp ].indexOf || function( item ) {\n for ( var i = 0; i < this.length; i++ ) {\n if ( i in this && this[ i ] === item ) {\n return i;\n }\n }\n return -1;\n },\n\n DOMEx = function( type, message ) {\n this.name = type;\n this.code = DOMException[ type ];\n this.message = message;\n },\n\n checkTokenAndGetIndex = function( classList, token ) {\n if ( token === '' ) {\n throw new DOMEx(\n 'SYNTAX_ERR',\n 'An invalid or illegal string was specified'\n );\n }\n if ( /\\s/.test( token ) ) {\n throw new DOMEx(\n 'INVALID_CHARACTER_ERR',\n 'String contains an invalid character'\n );\n }\n return arrIndexOf.call( classList, token );\n },\n\n ClassList = function( elem ) {\n var trimmedClasses = strTrim.call( elem.getAttribute( 'class' ) || '' ),\n classes = trimmedClasses ? trimmedClasses.split( /\\s+/ ) : [];\n\n for ( var i = 0; i < classes.length; i++ ) {\n this.push( classes[ i ] );\n }\n\n this._updateClassName = function() {\n elem.setAttribute( 'class', this.toString() );\n };\n },\n\n classListProto = ClassList[ protoProp ] = [],\n\n classListGetter = function() {\n return new ClassList( this );\n };\n\n DOMEx[ protoProp ] = Error[ protoProp ];\n\n classListProto.item = function( i ) {\n return this[ i ] || null;\n };\n\n classListProto.contains = function( token ) {\n token += '';\n return checkTokenAndGetIndex( this, token ) !== -1;\n };\n\n classListProto.add = function() {\n var\n tokens = arguments,\n iter = 0,\n len = tokens.length,\n updated = false,\n token;\n\n do {\n token = tokens[ iter ] + '';\n if ( checkTokenAndGetIndex( this, token ) === -1 ) {\n this.push( token );\n updated = true;\n }\n }\n\n while ( ++iter < len );\n\n if ( updated ) {\n this._updateClassName();\n }\n };\n\n classListProto.remove = function() {\n var\n tokens = arguments,\n iter = 0,\n len = tokens.length,\n updated = false,\n token,\n index;\n\n do {\n token = tokens[ iter ] + '';\n index = checkTokenAndGetIndex( this, token );\n\n while ( index !== -1 ) {\n this.splice( index, 1 );\n updated = true;\n index = checkTokenAndGetIndex( this, token );\n }\n }\n\n while ( ++iter < len );\n\n if ( updated ) {\n this._updateClassName();\n }\n };\n\n classListProto.toggle = function( token, force ) {\n token += '';\n\n var\n result = this.contains( token ),\n method = result ? force !== true && 'remove' : force !== false && 'add';\n\n if ( method ) {\n this[ method ]( token );\n }\n\n if ( force === true || force === false ) {\n return force;\n } else {\n return !result;\n }\n };\n\n classListProto.toString = function() {\n return this.join( ' ' );\n };\n\n if ( objCtr.defineProperty ) {\n var classListPropDesc = {\n get : classListGetter,\n enumerable : true,\n configurable : true\n };\n\n try {\n objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );\n }\n\n catch ( ex ) {\n if ( ex.number === -0x7FF5EC54 ) {\n classListPropDesc.enumerable = false;\n objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );\n }\n }\n\n } else if ( objCtr[ protoProp ].__defineGetter__ ) {\n elemCtrProto.__defineGetter__( classListProp, classListGetter );\n }\n\n }( self ));\n\n } else {\n\n ( function() {\n\n 'use strict';\n\n var testElement = document.createElement( '_' );\n\n testElement.classList.add( 'c1', 'c2' );\n\n if ( !testElement.classList.contains( 'c2' ) ) {\n var createMethod = function( method ) {\n var original = DOMTokenList.prototype[ method ];\n\n DOMTokenList.prototype[ method ] = function( token ) {\n var i, len = arguments.length;\n\n for ( i = 0; i < len; i++ ) {\n token = arguments[ i ];\n original.call( this, token );\n }\n };\n };\n createMethod( 'add' );\n createMethod( 'remove' );\n }\n\n testElement.classList.toggle( 'c3', false );\n\n if ( testElement.classList.contains( 'c3' ) ) {\n var _toggle = DOMTokenList.prototype.toggle;\n\n DOMTokenList.prototype.toggle = function( token, force ) {\n if ( 1 in arguments && !this.contains( token ) === !force ) {\n return force;\n } else {\n return _toggle.call( this, token );\n }\n };\n\n }\n\n testElement = null;\n\n }());\n\n }\n}\n","/**\n * Object.assign polyfill\n * Cross-browser full Object.assign implementation\n * @source https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill\n * @license MIT\n **/\n\nif ( typeof Object.assign != 'function' ) {\n ( function() {\n Object.assign = function( target ) {\n 'use strict';\n if ( target === undefined || target === null ) {\n throw new TypeError( 'Cannot convert undefined or null to object' );\n }\n\n var output = Object( target );\n for ( var index = 1; index < arguments.length; index++ ) {\n var source = arguments[ index ];\n if ( source !== undefined && source !== null ) {\n for ( var nextKey in source ) {\n if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {\n output[ nextKey ] = source[ nextKey ];\n }\n }\n }\n }\n return output;\n };\n })();\n}\n\n// Make it easy to merge objects without overwriting the original objects\nvar merge = function() {\n var args = [{}].concat( Array.prototype.slice.call( arguments ) )\n return Object.assign.apply( this, args )\n}\n\nmodule.exports = merge\n","// keymaster.js\n// (c) 2011-2013 Thomas Fuchs\n// keymaster.js may be freely distributed under the MIT license.\n\n;(function(global){\n var k,\n _handlers = {},\n _mods = { 16: false, 18: false, 17: false, 91: false },\n _scope = 'all',\n // modifier keys\n _MODIFIERS = {\n '⇧': 16, shift: 16,\n '⌥': 18, alt: 18, option: 18,\n '⌃': 17, ctrl: 17, control: 17,\n '⌘': 91, command: 91\n },\n // special keys\n _MAP = {\n backspace: 8, tab: 9, clear: 12,\n enter: 13, 'return': 13,\n esc: 27, escape: 27, space: 32,\n left: 37, up: 38,\n right: 39, down: 40,\n del: 46, 'delete': 46,\n home: 36, end: 35,\n pageup: 33, pagedown: 34,\n ',': 188, '.': 190, '/': 191,\n '`': 192, '-': 189, '=': 187,\n ';': 186, '\\'': 222,\n '[': 219, ']': 221, '\\\\': 220\n },\n code = function(x){\n return _MAP[x] || x.toUpperCase().charCodeAt(0);\n },\n _downKeys = [];\n\n for(k=1;k<20;k++) _MAP['f'+k] = 111+k;\n\n // IE doesn't support Array#indexOf, so have a simple replacement\n function index(array, item){\n var i = array.length;\n while(i--) if(array[i]===item) return i;\n return -1;\n }\n\n // for comparing mods before unassignment\n function compareArray(a1, a2) {\n if (a1.length != a2.length) return false;\n for (var i = 0; i < a1.length; i++) {\n if (a1[i] !== a2[i]) return false;\n }\n return true;\n }\n\n var modifierMap = {\n 16:'shiftKey',\n 18:'altKey',\n 17:'ctrlKey',\n 91:'metaKey'\n };\n function updateModifierKey(event) {\n for(k in _mods) _mods[k] = event[modifierMap[k]];\n };\n\n // handle keydown event\n function dispatch(event) {\n var key, handler, k, i, modifiersMatch, scope;\n key = event.keyCode;\n\n if (index(_downKeys, key) == -1) {\n _downKeys.push(key);\n }\n\n // if a modifier key, set the key.<modifierkeyname> property to true and return\n if(key == 93 || key == 224) key = 91; // right command on webkit, command on Gecko\n if(key in _mods) {\n _mods[key] = true;\n // 'assignKey' from inside this closure is exported to window.key\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = true;\n return;\n }\n updateModifierKey(event);\n\n // see if we need to ignore the keypress (filter() can can be overridden)\n // by default ignore key presses if a select, textarea, or input is focused\n if(!assignKey.filter.call(this, event)) return;\n\n // abort if no potentially matching shortcuts found\n if (!(key in _handlers)) return;\n\n scope = getScope();\n\n // for each potential shortcut\n for (i = 0; i < _handlers[key].length; i++) {\n handler = _handlers[key][i];\n\n // see if it's in the current scope\n if(handler.scope == scope || handler.scope == 'all'){\n // check if modifiers match if any\n modifiersMatch = handler.mods.length > 0;\n for(k in _mods)\n if((!_mods[k] && index(handler.mods, +k) > -1) ||\n (_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;\n // call the handler and stop the event if neccessary\n if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){\n if(handler.method(event, handler)===false){\n if(event.preventDefault) event.preventDefault();\n else event.returnValue = false;\n if(event.stopPropagation) event.stopPropagation();\n if(event.cancelBubble) event.cancelBubble = true;\n }\n }\n }\n }\n };\n\n // unset modifier keys on keyup\n function clearModifier(event){\n var key = event.keyCode, k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n }\n };\n\n function resetModifiers() {\n for(k in _mods) _mods[k] = false;\n for(k in _MODIFIERS) assignKey[k] = false;\n };\n\n // parse and assign shortcut\n function assignKey(key, scope, method){\n var keys, mods;\n keys = getKeys(key);\n if (method === undefined) {\n method = scope;\n scope = 'all';\n }\n\n // for each shortcut\n for (var i = 0; i < keys.length; i++) {\n // set modifier keys if any\n mods = [];\n key = keys[i].split('+');\n if (key.length > 1){\n mods = getMods(key);\n key = [key[key.length-1]];\n }\n // convert to keycode and...\n key = key[0]\n key = code(key);\n // ...store handler\n if (!(key in _handlers)) _handlers[key] = [];\n _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n }\n };\n\n // unbind all handlers for given key in current scope\n function unbindKey(key, scope) {\n var multipleKeys, keys,\n mods = [],\n i, j, obj;\n\n multipleKeys = getKeys(key);\n\n for (j = 0; j < multipleKeys.length; j++) {\n keys = multipleKeys[j].split('+');\n\n if (keys.length > 1) {\n mods = getMods(keys);\n key = keys[keys.length - 1];\n }\n\n key = code(key);\n\n if (scope === undefined) {\n scope = getScope();\n }\n if (!_handlers[key]) {\n return;\n }\n for (i = 0; i < _handlers[key].length; i++) {\n obj = _handlers[key][i];\n // only clear handlers if correct scope and mods match\n if (obj.scope === scope && compareArray(obj.mods, mods)) {\n _handlers[key][i] = {};\n }\n }\n }\n };\n\n // Returns true if the key with code 'keyCode' is currently down\n // Converts strings into key codes.\n function isPressed(keyCode) {\n if (typeof(keyCode)=='string') {\n keyCode = code(keyCode);\n }\n return index(_downKeys, keyCode) != -1;\n }\n\n function getPressedKeyCodes() {\n return _downKeys.slice(0);\n }\n\n function filter(event){\n var tagName = (event.target || event.srcElement).tagName;\n // ignore keypressed in any elements that support keyboard data input\n return !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');\n }\n\n // initialize key.<modifier> to false\n for(k in _MODIFIERS) assignKey[k] = false;\n\n // set current scope (default 'all')\n function setScope(scope){ _scope = scope || 'all' };\n function getScope(){ return _scope || 'all' };\n\n // delete all handlers for a given scope\n function deleteScope(scope){\n var key, handlers, i;\n\n for (key in _handlers) {\n handlers = _handlers[key];\n for (i = 0; i < handlers.length; ) {\n if (handlers[i].scope === scope) handlers.splice(i, 1);\n else i++;\n }\n }\n };\n\n // abstract key logic for assign and unassign\n function getKeys(key) {\n var keys;\n key = key.replace(/\\s/g, '');\n keys = key.split(',');\n if ((keys[keys.length - 1]) == '') {\n keys[keys.length - 2] += ',';\n }\n return keys;\n }\n\n // abstract mods logic for assign and unassign\n function getMods(key) {\n var mods = key.slice(0, key.length - 1);\n for (var mi = 0; mi < mods.length; mi++)\n mods[mi] = _MODIFIERS[mods[mi]];\n return mods;\n }\n\n // cross-browser events\n function addEvent(object, event, method) {\n if (object.addEventListener)\n object.addEventListener(event, method, false);\n else if(object.attachEvent)\n object.attachEvent('on'+event, function(){ method(window.event) });\n };\n\n // set the handlers globally on document\n addEvent(document, 'keydown', function(event) { dispatch(event) }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48\n addEvent(document, 'keyup', clearModifier);\n\n // reset modifiers to false whenever the window is (re)focused.\n addEvent(window, 'focus', resetModifiers);\n\n // store previously defined key\n var previousKey = global.key;\n\n // restore previously defined key and return reference to our key object\n function noConflict() {\n var k = global.key;\n global.key = previousKey;\n return k;\n }\n\n // set window.key and window.key.set/get/deleteScope, and the default filter\n global.key = assignKey;\n global.key.setScope = setScope;\n global.key.getScope = getScope;\n global.key.deleteScope = deleteScope;\n global.key.filter = filter;\n global.key.isPressed = isPressed;\n global.key.getPressedKeyCodes = getPressedKeyCodes;\n global.key.noConflict = noConflict;\n global.key.unbind = unbindKey;\n\n if(typeof module !== 'undefined') module.exports = assignKey;\n\n})(this);\n","/**\n * Root reference for iframes.\n */\n\nvar root;\nif (typeof window !== 'undefined') { // Browser window\n root = window;\n} else if (typeof self !== 'undefined') { // Web Worker\n root = self;\n} else { // Other environments\n console.warn(\"Using browser-only version of superagent in non-browser environment\");\n root = this;\n}\n\nvar Emitter = require('emitter');\nvar requestBase = require('./request-base');\nvar isObject = require('./is-object');\n\n/**\n * Noop.\n */\n\nfunction noop(){};\n\n/**\n * Expose `request`.\n */\n\nvar request = module.exports = require('./request').bind(null, Request);\n\n/**\n * Determine XHR.\n */\n\nrequest.getXHR = function () {\n if (root.XMLHttpRequest\n && (!root.location || 'file:' != root.location.protocol\n || !root.ActiveXObject)) {\n return new XMLHttpRequest;\n } else {\n try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}\n }\n throw Error(\"Browser-only verison of superagent could not find XHR\");\n};\n\n/**\n * Removes leading and trailing whitespace, added to support IE.\n *\n * @param {String} s\n * @return {String}\n * @api private\n */\n\nvar trim = ''.trim\n ? function(s) { return s.trim(); }\n : function(s) { return s.replace(/(^\\s*|\\s*$)/g, ''); };\n\n/**\n * Serialize the given `obj`.\n *\n * @param {Object} obj\n * @return {String}\n * @api private\n */\n\nfunction serialize(obj) {\n if (!isObject(obj)) return obj;\n var pairs = [];\n for (var key in obj) {\n pushEncodedKeyValuePair(pairs, key, obj[key]);\n }\n return pairs.join('&');\n}\n\n/**\n * Helps 'serialize' with serializing arrays.\n * Mutates the pairs array.\n *\n * @param {Array} pairs\n * @param {String} key\n * @param {Mixed} val\n */\n\nfunction pushEncodedKeyValuePair(pairs, key, val) {\n if (val != null) {\n if (Array.isArray(val)) {\n val.forEach(function(v) {\n pushEncodedKeyValuePair(pairs, key, v);\n });\n } else if (isObject(val)) {\n for(var subkey in val) {\n pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);\n }\n } else {\n pairs.push(encodeURIComponent(key)\n + '=' + encodeURIComponent(val));\n }\n } else if (val === null) {\n pairs.push(encodeURIComponent(key));\n }\n}\n\n/**\n * Expose serialization method.\n */\n\n request.serializeObject = serialize;\n\n /**\n * Parse the given x-www-form-urlencoded `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseString(str) {\n var obj = {};\n var pairs = str.split('&');\n var pair;\n var pos;\n\n for (var i = 0, len = pairs.length; i < len; ++i) {\n pair = pairs[i];\n pos = pair.indexOf('=');\n if (pos == -1) {\n obj[decodeURIComponent(pair)] = '';\n } else {\n obj[decodeURIComponent(pair.slice(0, pos))] =\n decodeURIComponent(pair.slice(pos + 1));\n }\n }\n\n return obj;\n}\n\n/**\n * Expose parser.\n */\n\nrequest.parseString = parseString;\n\n/**\n * Default MIME type map.\n *\n * superagent.types.xml = 'application/xml';\n *\n */\n\nrequest.types = {\n html: 'text/html',\n json: 'application/json',\n xml: 'application/xml',\n urlencoded: 'application/x-www-form-urlencoded',\n 'form': 'application/x-www-form-urlencoded',\n 'form-data': 'application/x-www-form-urlencoded'\n};\n\n/**\n * Default serialization map.\n *\n * superagent.serialize['application/xml'] = function(obj){\n * return 'generated xml here';\n * };\n *\n */\n\n request.serialize = {\n 'application/x-www-form-urlencoded': serialize,\n 'application/json': JSON.stringify\n };\n\n /**\n * Default parsers.\n *\n * superagent.parse['application/xml'] = function(str){\n * return { object parsed from str };\n * };\n *\n */\n\nrequest.parse = {\n 'application/x-www-form-urlencoded': parseString,\n 'application/json': JSON.parse\n};\n\n/**\n * Parse the given header `str` into\n * an object containing the mapped fields.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseHeader(str) {\n var lines = str.split(/\\r?\\n/);\n var fields = {};\n var index;\n var line;\n var field;\n var val;\n\n lines.pop(); // trailing CRLF\n\n for (var i = 0, len = lines.length; i < len; ++i) {\n line = lines[i];\n index = line.indexOf(':');\n field = line.slice(0, index).toLowerCase();\n val = trim(line.slice(index + 1));\n fields[field] = val;\n }\n\n return fields;\n}\n\n/**\n * Check if `mime` is json or has +json structured syntax suffix.\n *\n * @param {String} mime\n * @return {Boolean}\n * @api private\n */\n\nfunction isJSON(mime) {\n return /[\\/+]json\\b/.test(mime);\n}\n\n/**\n * Return the mime type for the given `str`.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nfunction type(str){\n return str.split(/ *; */).shift();\n};\n\n/**\n * Return header field parameters.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction params(str){\n return str.split(/ *; */).reduce(function(obj, str){\n var parts = str.split(/ *= */),\n key = parts.shift(),\n val = parts.shift();\n\n if (key && val) obj[key] = val;\n return obj;\n }, {});\n};\n\n/**\n * Initialize a new `Response` with the given `xhr`.\n *\n * - set flags (.ok, .error, etc)\n * - parse header\n *\n * Examples:\n *\n * Aliasing `superagent` as `request` is nice:\n *\n * request = superagent;\n *\n * We can use the promise-like API, or pass callbacks:\n *\n * request.get('/').end(function(res){});\n * request.get('/', function(res){});\n *\n * Sending data can be chained:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' })\n * .end(function(res){});\n *\n * Or passed to `.send()`:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' }, function(res){});\n *\n * Or passed to `.post()`:\n *\n * request\n * .post('/user', { name: 'tj' })\n * .end(function(res){});\n *\n * Or further reduced to a single call for simple cases:\n *\n * request\n * .post('/user', { name: 'tj' }, function(res){});\n *\n * @param {XMLHTTPRequest} xhr\n * @param {Object} options\n * @api private\n */\n\nfunction Response(req, options) {\n options = options || {};\n this.req = req;\n this.xhr = this.req.xhr;\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')\n ? this.xhr.responseText\n : null;\n this.statusText = this.req.xhr.statusText;\n this._setStatusProperties(this.xhr.status);\n this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());\n // getAllResponseHeaders sometimes falsely returns \"\" for CORS requests, but\n // getResponseHeader still works. so we get content-type even if getting\n // other headers fails.\n this.header['content-type'] = this.xhr.getResponseHeader('content-type');\n this._setHeaderProperties(this.header);\n this.body = this.req.method != 'HEAD'\n ? this._parseBody(this.text ? this.text : this.xhr.response)\n : null;\n}\n\n/**\n * Get case-insensitive `field` value.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nResponse.prototype.get = function(field){\n return this.header[field.toLowerCase()];\n};\n\n/**\n * Set header related properties:\n *\n * - `.type` the content type without params\n *\n * A response of \"Content-Type: text/plain; charset=utf-8\"\n * will provide you with a `.type` of \"text/plain\".\n *\n * @param {Object} header\n * @api private\n */\n\nResponse.prototype._setHeaderProperties = function(header){\n // content-type\n var ct = this.header['content-type'] || '';\n this.type = type(ct);\n\n // params\n var obj = params(ct);\n for (var key in obj) this[key] = obj[key];\n};\n\n/**\n * Parse the given body `str`.\n *\n * Used for auto-parsing of bodies. Parsers\n * are defined on the `superagent.parse` object.\n *\n * @param {String} str\n * @return {Mixed}\n * @api private\n */\n\nResponse.prototype._parseBody = function(str){\n var parse = request.parse[this.type];\n if (!parse && isJSON(this.type)) {\n parse = request.parse['application/json'];\n }\n return parse && str && (str.length || str instanceof Object)\n ? parse(str)\n : null;\n};\n\n/**\n * Set flags such as `.ok` based on `status`.\n *\n * For example a 2xx response will give you a `.ok` of __true__\n * whereas 5xx will be __false__ and `.error` will be __true__. The\n * `.clientError` and `.serverError` are also available to be more\n * specific, and `.statusType` is the class of error ranging from 1..5\n * sometimes useful for mapping respond colors etc.\n *\n * \"sugar\" properties are also defined for common cases. Currently providing:\n *\n * - .noContent\n * - .badRequest\n * - .unauthorized\n * - .notAcceptable\n * - .notFound\n *\n * @param {Number} status\n * @api private\n */\n\nResponse.prototype._setStatusProperties = function(status){\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n if (status === 1223) {\n status = 204;\n }\n\n var type = status / 100 | 0;\n\n // status / class\n this.status = this.statusCode = status;\n this.statusType = type;\n\n // basics\n this.info = 1 == type;\n this.ok = 2 == type;\n this.clientError = 4 == type;\n this.serverError = 5 == type;\n this.error = (4 == type || 5 == type)\n ? this.toError()\n : false;\n\n // sugar\n this.accepted = 202 == status;\n this.noContent = 204 == status;\n this.badRequest = 400 == status;\n this.unauthorized = 401 == status;\n this.notAcceptable = 406 == status;\n this.notFound = 404 == status;\n this.forbidden = 403 == status;\n};\n\n/**\n * Return an `Error` representative of this response.\n *\n * @return {Error}\n * @api public\n */\n\nResponse.prototype.toError = function(){\n var req = this.req;\n var method = req.method;\n var url = req.url;\n\n var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';\n var err = new Error(msg);\n err.status = this.status;\n err.method = method;\n err.url = url;\n\n return err;\n};\n\n/**\n * Expose `Response`.\n */\n\nrequest.Response = Response;\n\n/**\n * Initialize a new `Request` with the given `method` and `url`.\n *\n * @param {String} method\n * @param {String} url\n * @api public\n */\n\nfunction Request(method, url) {\n var self = this;\n this._query = this._query || [];\n this.method = method;\n this.url = url;\n this.header = {}; // preserves header name case\n this._header = {}; // coerces header names to lowercase\n this.on('end', function(){\n var err = null;\n var res = null;\n\n try {\n res = new Response(self);\n } catch(e) {\n err = new Error('Parser is unable to parse the response');\n err.parse = true;\n err.original = e;\n // issue #675: return the raw response if the response parsing fails\n err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null;\n // issue #876: return the http status code if the response parsing fails\n err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : null;\n return self.callback(err);\n }\n\n self.emit('response', res);\n\n var new_err;\n try {\n if (res.status < 200 || res.status >= 300) {\n new_err = new Error(res.statusText || 'Unsuccessful HTTP response');\n new_err.original = err;\n new_err.response = res;\n new_err.status = res.status;\n }\n } catch(e) {\n new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android\n }\n\n // #1000 don't catch errors from the callback to avoid double calling it\n if (new_err) {\n self.callback(new_err, res);\n } else {\n self.callback(null, res);\n }\n });\n}\n\n/**\n * Mixin `Emitter` and `requestBase`.\n */\n\nEmitter(Request.prototype);\nfor (var key in requestBase) {\n Request.prototype[key] = requestBase[key];\n}\n\n/**\n * Set Content-Type to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.xml = 'application/xml';\n *\n * request.post('/')\n * .type('xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * request.post('/')\n * .type('application/xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * @param {String} type\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.type = function(type){\n this.set('Content-Type', request.types[type] || type);\n return this;\n};\n\n/**\n * Set responseType to `val`. Presently valid responseTypes are 'blob' and\n * 'arraybuffer'.\n *\n * Examples:\n *\n * req.get('/')\n * .responseType('blob')\n * .end(callback);\n *\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.responseType = function(val){\n this._responseType = val;\n return this;\n};\n\n/**\n * Set Accept to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.json = 'application/json';\n *\n * request.get('/agent')\n * .accept('json')\n * .end(callback);\n *\n * request.get('/agent')\n * .accept('application/json')\n * .end(callback);\n *\n * @param {String} accept\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.accept = function(type){\n this.set('Accept', request.types[type] || type);\n return this;\n};\n\n/**\n * Set Authorization field value with `user` and `pass`.\n *\n * @param {String} user\n * @param {String} pass\n * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.auth = function(user, pass, options){\n if (!options) {\n options = {\n type: 'basic'\n }\n }\n\n switch (options.type) {\n case 'basic':\n var str = btoa(user + ':' + pass);\n this.set('Authorization', 'Basic ' + str);\n break;\n\n case 'auto':\n this.username = user;\n this.password = pass;\n break;\n }\n return this;\n};\n\n/**\n* Add query-string `val`.\n*\n* Examples:\n*\n* request.get('/shoes')\n* .query('size=10')\n* .query({ color: 'blue' })\n*\n* @param {Object|String} val\n* @return {Request} for chaining\n* @api public\n*/\n\nRequest.prototype.query = function(val){\n if ('string' != typeof val) val = serialize(val);\n if (val) this._query.push(val);\n return this;\n};\n\n/**\n * Queue the given `file` as an attachment to the specified `field`,\n * with optional `filename`.\n *\n * ``` js\n * request.post('/upload')\n * .attach('content', new Blob(['<a id=\"a\"><b id=\"b\">hey!</b></a>'], { type: \"text/html\"}))\n * .end(callback);\n * ```\n *\n * @param {String} field\n * @param {Blob|File} file\n * @param {String} filename\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.attach = function(field, file, filename){\n this._getFormData().append(field, file, filename || file.name);\n return this;\n};\n\nRequest.prototype._getFormData = function(){\n if (!this._formData) {\n this._formData = new root.FormData();\n }\n return this._formData;\n};\n\n/**\n * Invoke the callback with `err` and `res`\n * and handle arity check.\n *\n * @param {Error} err\n * @param {Response} res\n * @api private\n */\n\nRequest.prototype.callback = function(err, res){\n var fn = this._callback;\n this.clearTimeout();\n fn(err, res);\n};\n\n/**\n * Invoke callback with x-domain error.\n *\n * @api private\n */\n\nRequest.prototype.crossDomainError = function(){\n var err = new Error('Request has been terminated\\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');\n err.crossDomain = true;\n\n err.status = this.status;\n err.method = this.method;\n err.url = this.url;\n\n this.callback(err);\n};\n\n/**\n * Invoke callback with timeout error.\n *\n * @api private\n */\n\nRequest.prototype._timeoutError = function(){\n var timeout = this._timeout;\n var err = new Error('timeout of ' + timeout + 'ms exceeded');\n err.timeout = timeout;\n this.callback(err);\n};\n\n/**\n * Compose querystring to append to req.url\n *\n * @api private\n */\n\nRequest.prototype._appendQueryString = function(){\n var query = this._query.join('&');\n if (query) {\n this.url += ~this.url.indexOf('?')\n ? '&' + query\n : '?' + query;\n }\n};\n\n/**\n * Initiate request, invoking callback `fn(res)`\n * with an instanceof `Response`.\n *\n * @param {Function} fn\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.end = function(fn){\n var self = this;\n var xhr = this.xhr = request.getXHR();\n var timeout = this._timeout;\n var data = this._formData || this._data;\n\n // store callback\n this._callback = fn || noop;\n\n // state change\n xhr.onreadystatechange = function(){\n if (4 != xhr.readyState) return;\n\n // In IE9, reads to any property (e.g. status) off of an aborted XHR will\n // result in the error \"Could not complete the operation due to error c00c023f\"\n var status;\n try { status = xhr.status } catch(e) { status = 0; }\n\n if (0 == status) {\n if (self.timedout) return self._timeoutError();\n if (self._aborted) return;\n return self.crossDomainError();\n }\n self.emit('end');\n };\n\n // progress\n var handleProgress = function(direction, e) {\n if (e.total > 0) {\n e.percent = e.loaded / e.total * 100;\n }\n e.direction = direction;\n self.emit('progress', e);\n }\n if (this.hasListeners('progress')) {\n try {\n xhr.onprogress = handleProgress.bind(null, 'download');\n if (xhr.upload) {\n xhr.upload.onprogress = handleProgress.bind(null, 'upload');\n }\n } catch(e) {\n // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.\n // Reported here:\n // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context\n }\n }\n\n // timeout\n if (timeout && !this._timer) {\n this._timer = setTimeout(function(){\n self.timedout = true;\n self.abort();\n }, timeout);\n }\n\n // querystring\n this._appendQueryString();\n\n // initiate request\n if (this.username && this.password) {\n xhr.open(this.method, this.url, true, this.username, this.password);\n } else {\n xhr.open(this.method, this.url, true);\n }\n\n // CORS\n if (this._withCredentials) xhr.withCredentials = true;\n\n // body\n if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) {\n // serialize stuff\n var contentType = this._header['content-type'];\n var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];\n if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];\n if (serialize) data = serialize(data);\n }\n\n // set header fields\n for (var field in this.header) {\n if (null == this.header[field]) continue;\n xhr.setRequestHeader(field, this.header[field]);\n }\n\n if (this._responseType) {\n xhr.responseType = this._responseType;\n }\n\n // send stuff\n this.emit('request', this);\n\n // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)\n // We need null here if data is undefined\n xhr.send(typeof data !== 'undefined' ? data : null);\n return this;\n};\n\n\n/**\n * Expose `Request`.\n */\n\nrequest.Request = Request;\n\n/**\n * GET `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.get = function(url, data, fn){\n var req = request('GET', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.query(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * HEAD `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.head = function(url, data, fn){\n var req = request('HEAD', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * OPTIONS query to `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.options = function(url, data, fn){\n var req = request('OPTIONS', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * DELETE `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nfunction del(url, fn){\n var req = request('DELETE', url);\n if (fn) req.end(fn);\n return req;\n};\n\nrequest['del'] = del;\nrequest['delete'] = del;\n\n/**\n * PATCH `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.patch = function(url, data, fn){\n var req = request('PATCH', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * POST `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.post = function(url, data, fn){\n var req = request('POST', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * PUT `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.put = function(url, data, fn){\n var req = request('PUT', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n","/**\n * Check if `obj` is an object.\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nfunction isObject(obj) {\n return null !== obj && 'object' === typeof obj;\n}\n\nmodule.exports = isObject;\n","/**\n * Module of mixed-in functions shared between node and client code\n */\nvar isObject = require('./is-object');\n\n/**\n * Clear previous timeout.\n *\n * @return {Request} for chaining\n * @api public\n */\n\nexports.clearTimeout = function _clearTimeout(){\n this._timeout = 0;\n clearTimeout(this._timer);\n return this;\n};\n\n/**\n * Override default response body parser\n *\n * This function will be called to convert incoming data into request.body\n *\n * @param {Function}\n * @api public\n */\n\nexports.parse = function parse(fn){\n this._parser = fn;\n return this;\n};\n\n/**\n * Override default request body serializer\n *\n * This function will be called to convert data set via .send or .attach into payload to send\n *\n * @param {Function}\n * @api public\n */\n\nexports.serialize = function serialize(fn){\n this._serializer = fn;\n return this;\n};\n\n/**\n * Set timeout to `ms`.\n *\n * @param {Number} ms\n * @return {Request} for chaining\n * @api public\n */\n\nexports.timeout = function timeout(ms){\n this._timeout = ms;\n return this;\n};\n\n/**\n * Promise support\n *\n * @param {Function} resolve\n * @param {Function} reject\n * @return {Request}\n */\n\nexports.then = function then(resolve, reject) {\n if (!this._fullfilledPromise) {\n var self = this;\n this._fullfilledPromise = new Promise(function(innerResolve, innerReject){\n self.end(function(err, res){\n if (err) innerReject(err); else innerResolve(res);\n });\n });\n }\n return this._fullfilledPromise.then(resolve, reject);\n}\n\nexports.catch = function(cb) {\n return this.then(undefined, cb);\n};\n\n/**\n * Allow for extension\n */\n\nexports.use = function use(fn) {\n fn(this);\n return this;\n}\n\n\n/**\n * Get request header `field`.\n * Case-insensitive.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nexports.get = function(field){\n return this._header[field.toLowerCase()];\n};\n\n/**\n * Get case-insensitive header `field` value.\n * This is a deprecated internal API. Use `.get(field)` instead.\n *\n * (getHeader is no longer used internally by the superagent code base)\n *\n * @param {String} field\n * @return {String}\n * @api private\n * @deprecated\n */\n\nexports.getHeader = exports.get;\n\n/**\n * Set header `field` to `val`, or multiple fields with one object.\n * Case-insensitive.\n *\n * Examples:\n *\n * req.get('/')\n * .set('Accept', 'application/json')\n * .set('X-API-Key', 'foobar')\n * .end(callback);\n *\n * req.get('/')\n * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })\n * .end(callback);\n *\n * @param {String|Object} field\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nexports.set = function(field, val){\n if (isObject(field)) {\n for (var key in field) {\n this.set(key, field[key]);\n }\n return this;\n }\n this._header[field.toLowerCase()] = val;\n this.header[field] = val;\n return this;\n};\n\n/**\n * Remove header `field`.\n * Case-insensitive.\n *\n * Example:\n *\n * req.get('/')\n * .unset('User-Agent')\n * .end(callback);\n *\n * @param {String} field\n */\nexports.unset = function(field){\n delete this._header[field.toLowerCase()];\n delete this.header[field];\n return this;\n};\n\n/**\n * Write the field `name` and `val`, or multiple fields with one object\n * for \"multipart/form-data\" request bodies.\n *\n * ``` js\n * request.post('/upload')\n * .field('foo', 'bar')\n * .end(callback);\n *\n * request.post('/upload')\n * .field({ foo: 'bar', baz: 'qux' })\n * .end(callback);\n * ```\n *\n * @param {String|Object} name\n * @param {String|Blob|File|Buffer|fs.ReadStream} val\n * @return {Request} for chaining\n * @api public\n */\nexports.field = function(name, val) {\n\n // name should be either a string or an object.\n if (null === name || undefined === name) {\n throw new Error('.field(name, val) name can not be empty');\n }\n\n if (isObject(name)) {\n for (var key in name) {\n this.field(key, name[key]);\n }\n return this;\n }\n\n // val should be defined now\n if (null === val || undefined === val) {\n throw new Error('.field(name, val) val can not be empty');\n }\n this._getFormData().append(name, val);\n return this;\n};\n\n/**\n * Abort the request, and clear potential timeout.\n *\n * @return {Request}\n * @api public\n */\nexports.abort = function(){\n if (this._aborted) {\n return this;\n }\n this._aborted = true;\n this.xhr && this.xhr.abort(); // browser\n this.req && this.req.abort(); // node\n this.clearTimeout();\n this.emit('abort');\n return this;\n};\n\n/**\n * Enable transmission of cookies with x-domain requests.\n *\n * Note that for this to work the origin must not be\n * using \"Access-Control-Allow-Origin\" with a wildcard,\n * and also must set \"Access-Control-Allow-Credentials\"\n * to \"true\".\n *\n * @api public\n */\n\nexports.withCredentials = function(){\n // This is browser-only functionality. Node side is no-op.\n this._withCredentials = true;\n return this;\n};\n\n/**\n * Set the max redirects to `n`. Does noting in browser XHR implementation.\n *\n * @param {Number} n\n * @return {Request} for chaining\n * @api public\n */\n\nexports.redirects = function(n){\n this._maxRedirects = n;\n return this;\n};\n\n/**\n * Convert to a plain javascript object (not JSON string) of scalar properties.\n * Note as this method is designed to return a useful non-this value,\n * it cannot be chained.\n *\n * @return {Object} describing method, url, and data of this request\n * @api public\n */\n\nexports.toJSON = function(){\n return {\n method: this.method,\n url: this.url,\n data: this._data,\n headers: this._header\n };\n};\n\n/**\n * Check if `obj` is a host object,\n * we don't want to serialize these :)\n *\n * TODO: future proof, move to compoent land\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nexports._isHost = function _isHost(obj) {\n var str = {}.toString.call(obj);\n\n switch (str) {\n case '[object File]':\n case '[object Blob]':\n case '[object FormData]':\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Send `data` as the request body, defaulting the `.type()` to \"json\" when\n * an object is given.\n *\n * Examples:\n *\n * // manual json\n * request.post('/user')\n * .type('json')\n * .send('{\"name\":\"tj\"}')\n * .end(callback)\n *\n * // auto json\n * request.post('/user')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // manual x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send('name=tj')\n * .end(callback)\n *\n * // auto x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // defaults to x-www-form-urlencoded\n * request.post('/user')\n * .send('name=tobi')\n * .send('species=ferret')\n * .end(callback)\n *\n * @param {String|Object} data\n * @return {Request} for chaining\n * @api public\n */\n\nexports.send = function(data){\n var obj = isObject(data);\n var type = this._header['content-type'];\n\n // merge\n if (obj && isObject(this._data)) {\n for (var key in data) {\n this._data[key] = data[key];\n }\n } else if ('string' == typeof data) {\n // default to x-www-form-urlencoded\n if (!type) this.type('form');\n type = this._header['content-type'];\n if ('application/x-www-form-urlencoded' == type) {\n this._data = this._data\n ? this._data + '&' + data\n : data;\n } else {\n this._data = (this._data || '') + data;\n }\n } else {\n this._data = data;\n }\n\n if (!obj || this._isHost(data)) return this;\n\n // default to json\n if (!type) this.type('json');\n return this;\n};\n","// The node and browser modules expose versions of this with the\n// appropriate constructor function bound as first argument\n/**\n * Issue a request:\n *\n * Examples:\n *\n * request('GET', '/users').end(callback)\n * request('/users').end(callback)\n * request('/users', callback)\n *\n * @param {String} method\n * @param {String|Function} url or callback\n * @return {Request}\n * @api public\n */\n\nfunction request(RequestConstructor, method, url) {\n // callback\n if ('function' == typeof url) {\n return new RequestConstructor('GET', method).end(url);\n }\n\n // url first\n if (2 == arguments.length) {\n return new RequestConstructor('GET', method);\n }\n\n return new RequestConstructor(method, url);\n}\n\nmodule.exports = request;\n"]}