(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==='object'&&typeof module==='object')
module.exports=factory();else if(typeof define==='function'&&define.amd)
define([],factory);else if(typeof exports==='object')
exports["Handlebars"]=factory();else
root["Handlebars"]=factory();})(this,function(){return(function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])
return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:false};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=true;return module.exports;}
__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0);})
([(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;var _handlebarsRuntime=__webpack_require__(2);var _handlebarsRuntime2=_interopRequireDefault(_handlebarsRuntime);var _handlebarsCompilerAst=__webpack_require__(35);var _handlebarsCompilerAst2=_interopRequireDefault(_handlebarsCompilerAst);var _handlebarsCompilerBase=__webpack_require__(36);var _handlebarsCompilerCompiler=__webpack_require__(41);var _handlebarsCompilerJavascriptCompiler=__webpack_require__(42);var _handlebarsCompilerJavascriptCompiler2=_interopRequireDefault(_handlebarsCompilerJavascriptCompiler);var _handlebarsCompilerVisitor=__webpack_require__(39);var _handlebarsCompilerVisitor2=_interopRequireDefault(_handlebarsCompilerVisitor);var _handlebarsNoConflict=__webpack_require__(34);var _handlebarsNoConflict2=_interopRequireDefault(_handlebarsNoConflict);var _create=_handlebarsRuntime2['default'].create;function create(){var hb=_create();hb.compile=function(input,options){return _handlebarsCompilerCompiler.compile(input,options,hb);};hb.precompile=function(input,options){return _handlebarsCompilerCompiler.precompile(input,options,hb);};hb.AST=_handlebarsCompilerAst2['default'];hb.Compiler=_handlebarsCompilerCompiler.Compiler;hb.JavaScriptCompiler=_handlebarsCompilerJavascriptCompiler2['default'];hb.Parser=_handlebarsCompilerBase.parser;hb.parse=_handlebarsCompilerBase.parse;return hb;}
var inst=create();inst.create=create;_handlebarsNoConflict2['default'](inst);inst.Visitor=_handlebarsCompilerVisitor2['default'];inst['default']=inst;exports['default']=inst;module.exports=exports['default'];}),(function(module,exports){"use strict";exports["default"]=function(obj){return obj&&obj.__esModule?obj:{"default":obj};};exports.__esModule=true;}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireWildcard=__webpack_require__(3)['default'];var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;var _handlebarsBase=__webpack_require__(4);var base=_interopRequireWildcard(_handlebarsBase);var _handlebarsSafeString=__webpack_require__(21);var _handlebarsSafeString2=_interopRequireDefault(_handlebarsSafeString);var _handlebarsException=__webpack_require__(6);var _handlebarsException2=_interopRequireDefault(_handlebarsException);var _handlebarsUtils=__webpack_require__(5);var Utils=_interopRequireWildcard(_handlebarsUtils);var _handlebarsRuntime=__webpack_require__(22);var runtime=_interopRequireWildcard(_handlebarsRuntime);var _handlebarsNoConflict=__webpack_require__(34);var _handlebarsNoConflict2=_interopRequireDefault(_handlebarsNoConflict);function create(){var hb=new base.HandlebarsEnvironment();Utils.extend(hb,base);hb.SafeString=_handlebarsSafeString2['default'];hb.Exception=_handlebarsException2['default'];hb.Utils=Utils;hb.escapeExpression=Utils.escapeExpression;hb.VM=runtime;hb.template=function(spec){return runtime.template(spec,hb);};return hb;}
var inst=create();inst.create=create;_handlebarsNoConflict2['default'](inst);inst['default']=inst;exports['default']=inst;module.exports=exports['default'];}),(function(module,exports){"use strict";exports["default"]=function(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}
newObj["default"]=obj;return newObj;}};exports.__esModule=true;}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;exports.HandlebarsEnvironment=HandlebarsEnvironment;var _utils=__webpack_require__(5);var _exception=__webpack_require__(6);var _exception2=_interopRequireDefault(_exception);var _helpers=__webpack_require__(10);var _decorators=__webpack_require__(18);var _logger=__webpack_require__(20);var _logger2=_interopRequireDefault(_logger);var VERSION='4.2.0';exports.VERSION=VERSION;var COMPILER_REVISION=7;exports.COMPILER_REVISION=COMPILER_REVISION;var REVISION_CHANGES={1:'<= 1.0.rc.2',2:'== 1.0.0-rc.3',3:'== 1.0.0-rc.4',4:'== 1.x.x',5:'== 2.0.0-alpha.x',6:'>= 2.0.0-beta.1',7:'>= 4.0.0'};exports.REVISION_CHANGES=REVISION_CHANGES;var objectType='[object Object]';function HandlebarsEnvironment(helpers,partials,decorators){this.helpers=helpers||{};this.partials=partials||{};this.decorators=decorators||{};_helpers.registerDefaultHelpers(this);_decorators.registerDefaultDecorators(this);}
HandlebarsEnvironment.prototype={constructor:HandlebarsEnvironment,logger:_logger2['default'],log:_logger2['default'].log,registerHelper:function registerHelper(name,fn){if(_utils.toString.call(name)===objectType){if(fn){throw new _exception2['default']('Arg not supported with multiple helpers');}
_utils.extend(this.helpers,name);}else{this.helpers[name]=fn;}},unregisterHelper:function unregisterHelper(name){delete this.helpers[name];},registerPartial:function registerPartial(name,partial){if(_utils.toString.call(name)===objectType){_utils.extend(this.partials,name);}else{if(typeof partial==='undefined'){throw new _exception2['default']('Attempting to register a partial called "'+name+'" as undefined');}
this.partials[name]=partial;}},unregisterPartial:function unregisterPartial(name){delete this.partials[name];},registerDecorator:function registerDecorator(name,fn){if(_utils.toString.call(name)===objectType){if(fn){throw new _exception2['default']('Arg not supported with multiple decorators');}
_utils.extend(this.decorators,name);}else{this.decorators[name]=fn;}},unregisterDecorator:function unregisterDecorator(name){delete this.decorators[name];}};var log=_logger2['default'].log;exports.log=log;exports.createFrame=_utils.createFrame;exports.logger=_logger2['default'];}),(function(module,exports){'use strict';exports.__esModule=true;exports.extend=extend;exports.indexOf=indexOf;exports.escapeExpression=escapeExpression;exports.isEmpty=isEmpty;exports.createFrame=createFrame;exports.blockParams=blockParams;exports.appendContextPath=appendContextPath;var escape={'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#x27;','`':'&#x60;','=':'&#x3D;'};var badChars=/[&<>"'`=]/g,possible=/[&<>"'`=]/;function escapeChar(chr){return escape[chr];}
function extend(obj){for(var i=1;i<arguments.length;i++){for(var key in arguments[i]){if(Object.prototype.hasOwnProperty.call(arguments[i],key)){obj[key]=arguments[i][key];}}}
return obj;}
var toString=Object.prototype.toString;exports.toString=toString;var isFunction=function isFunction(value){return typeof value==='function';};if(isFunction(/x/)){exports.isFunction=isFunction=function(value){return typeof value==='function'&&toString.call(value)==='[object Function]';};}
exports.isFunction=isFunction;var isArray=Array.isArray||function(value){return value&&typeof value==='object'?toString.call(value)==='[object Array]':false;};exports.isArray=isArray;function indexOf(array,value){for(var i=0,len=array.length;i<len;i++){if(array[i]===value){return i;}}
return-1;}
function escapeExpression(string){if(typeof string!=='string'){if(string&&string.toHTML){return string.toHTML();}else if(string==null){return'';}else if(!string){return string+'';}
string=''+string;}
if(!possible.test(string)){return string;}
return string.replace(badChars,escapeChar);}
function isEmpty(value){if(!value&&value!==0){return true;}else if(isArray(value)&&value.length===0){return true;}else{return false;}}
function createFrame(object){var frame=extend({},object);frame._parent=object;return frame;}
function blockParams(params,ids){params.path=ids;return params;}
function appendContextPath(contextPath,id){return(contextPath?contextPath+'.':'')+id;}}),(function(module,exports,__webpack_require__){'use strict';var _Object$defineProperty=__webpack_require__(7)['default'];exports.__esModule=true;var errorProps=['description','fileName','lineNumber','message','name','number','stack'];function Exception(message,node){var loc=node&&node.loc,line=undefined,column=undefined;if(loc){line=loc.start.line;column=loc.start.column;message+=' - '+line+':'+column;}
var tmp=Error.prototype.constructor.call(this,message);for(var idx=0;idx<errorProps.length;idx++){this[errorProps[idx]]=tmp[errorProps[idx]];}
if(Error.captureStackTrace){Error.captureStackTrace(this,Exception);}
try{if(loc){this.lineNumber=line;if(_Object$defineProperty){Object.defineProperty(this,'column',{value:column,enumerable:true});}else{this.column=column;}}}catch(nop){}}
Exception.prototype=new Error();exports['default']=Exception;module.exports=exports['default'];}),(function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(8),__esModule:true};}),(function(module,exports,__webpack_require__){var $=__webpack_require__(9);module.exports=function defineProperty(it,key,desc){return $.setDesc(it,key,desc);};}),(function(module,exports){var $Object=Object;module.exports={create:$Object.create,getProto:$Object.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:$Object.getOwnPropertyDescriptor,setDesc:$Object.defineProperty,setDescs:$Object.defineProperties,getKeys:$Object.keys,getNames:$Object.getOwnPropertyNames,getSymbols:$Object.getOwnPropertySymbols,each:[].forEach};}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;exports.registerDefaultHelpers=registerDefaultHelpers;var _helpersBlockHelperMissing=__webpack_require__(11);var _helpersBlockHelperMissing2=_interopRequireDefault(_helpersBlockHelperMissing);var _helpersEach=__webpack_require__(12);var _helpersEach2=_interopRequireDefault(_helpersEach);var _helpersHelperMissing=__webpack_require__(13);var _helpersHelperMissing2=_interopRequireDefault(_helpersHelperMissing);var _helpersIf=__webpack_require__(14);var _helpersIf2=_interopRequireDefault(_helpersIf);var _helpersLog=__webpack_require__(15);var _helpersLog2=_interopRequireDefault(_helpersLog);var _helpersLookup=__webpack_require__(16);var _helpersLookup2=_interopRequireDefault(_helpersLookup);var _helpersWith=__webpack_require__(17);var _helpersWith2=_interopRequireDefault(_helpersWith);function registerDefaultHelpers(instance){_helpersBlockHelperMissing2['default'](instance);_helpersEach2['default'](instance);_helpersHelperMissing2['default'](instance);_helpersIf2['default'](instance);_helpersLog2['default'](instance);_helpersLookup2['default'](instance);_helpersWith2['default'](instance);}}),(function(module,exports,__webpack_require__){'use strict';exports.__esModule=true;var _utils=__webpack_require__(5);exports['default']=function(instance){instance.registerHelper('blockHelperMissing',function(context,options){var inverse=options.inverse,fn=options.fn;if(context===true){return fn(this);}else if(context===false||context==null){return inverse(this);}else if(_utils.isArray(context)){if(context.length>0){if(options.ids){options.ids=[options.name];}
return instance.helpers.each(context,options);}else{return inverse(this);}}else{if(options.data&&options.ids){var data=_utils.createFrame(options.data);data.contextPath=_utils.appendContextPath(options.data.contextPath,options.name);options={data:data};}
return fn(context,options);}});};module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;var _utils=__webpack_require__(5);var _exception=__webpack_require__(6);var _exception2=_interopRequireDefault(_exception);exports['default']=function(instance){instance.registerHelper('each',function(context,options){if(!options){throw new _exception2['default']('Must pass iterator to #each');}
var fn=options.fn,inverse=options.inverse,i=0,ret='',data=undefined,contextPath=undefined;if(options.data&&options.ids){contextPath=_utils.appendContextPath(options.data.contextPath,options.ids[0])+'.';}
if(_utils.isFunction(context)){context=context.call(this);}
if(options.data){data=_utils.createFrame(options.data);}
function execIteration(field,index,last){if(data){data.key=field;data.index=index;data.first=index===0;data.last=!!last;if(contextPath){data.contextPath=contextPath+field;}}
ret=ret+fn(context[field],{data:data,blockParams:_utils.blockParams([context[field],field],[contextPath+field,null])});}
if(context&&typeof context==='object'){if(_utils.isArray(context)){for(var j=context.length;i<j;i++){if(i in context){execIteration(i,i,i===context.length-1);}}}else{var priorKey=undefined;for(var key in context){if(context.hasOwnProperty(key)){if(priorKey!==undefined){execIteration(priorKey,i-1);}
priorKey=key;i++;}}
if(priorKey!==undefined){execIteration(priorKey,i-1,true);}}}
if(i===0){ret=inverse(this);}
return ret;});};module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;var _exception=__webpack_require__(6);var _exception2=_interopRequireDefault(_exception);exports['default']=function(instance){instance.registerHelper('helperMissing',function(){if(arguments.length===1){return undefined;}else{throw new _exception2['default']('Missing helper: "'+arguments[arguments.length-1].name+'"');}});};module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';exports.__esModule=true;var _utils=__webpack_require__(5);exports['default']=function(instance){instance.registerHelper('if',function(conditional,options){if(_utils.isFunction(conditional)){conditional=conditional.call(this);}
if(!options.hash.includeZero&&!conditional||_utils.isEmpty(conditional)){return options.inverse(this);}else{return options.fn(this);}});instance.registerHelper('unless',function(conditional,options){return instance.helpers['if'].call(this,conditional,{fn:options.inverse,inverse:options.fn,hash:options.hash});});};module.exports=exports['default'];}),(function(module,exports){'use strict';exports.__esModule=true;exports['default']=function(instance){instance.registerHelper('log',function(){var args=[undefined],options=arguments[arguments.length-1];for(var i=0;i<arguments.length-1;i++){args.push(arguments[i]);}
var level=1;if(options.hash.level!=null){level=options.hash.level;}else if(options.data&&options.data.level!=null){level=options.data.level;}
args[0]=level;instance.log.apply(instance,args);});};module.exports=exports['default'];}),(function(module,exports){'use strict';exports.__esModule=true;exports['default']=function(instance){instance.registerHelper('lookup',function(obj,field){if(!obj){return obj;}
if(field==='constructor'&&!obj.propertyIsEnumerable(field)){return undefined;}
return obj[field];});};module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';exports.__esModule=true;var _utils=__webpack_require__(5);exports['default']=function(instance){instance.registerHelper('with',function(context,options){if(_utils.isFunction(context)){context=context.call(this);}
var fn=options.fn;if(!_utils.isEmpty(context)){var data=options.data;if(options.data&&options.ids){data=_utils.createFrame(options.data);data.contextPath=_utils.appendContextPath(options.data.contextPath,options.ids[0]);}
return fn(context,{data:data,blockParams:_utils.blockParams([context],[data&&data.contextPath])});}else{return options.inverse(this);}});};module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;exports.registerDefaultDecorators=registerDefaultDecorators;var _decoratorsInline=__webpack_require__(19);var _decoratorsInline2=_interopRequireDefault(_decoratorsInline);function registerDefaultDecorators(instance){_decoratorsInline2['default'](instance);}}),(function(module,exports,__webpack_require__){'use strict';exports.__esModule=true;var _utils=__webpack_require__(5);exports['default']=function(instance){instance.registerDecorator('inline',function(fn,props,container,options){var ret=fn;if(!props.partials){props.partials={};ret=function(context,options){var original=container.partials;container.partials=_utils.extend({},original,props.partials);var ret=fn(context,options);container.partials=original;return ret;};}
props.partials[options.args[0]]=options.fn;return ret;});};module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';exports.__esModule=true;var _utils=__webpack_require__(5);var logger={methodMap:['debug','info','warn','error'],level:'info',lookupLevel:function lookupLevel(level){if(typeof level==='string'){var levelMap=_utils.indexOf(logger.methodMap,level.toLowerCase());if(levelMap>=0){level=levelMap;}else{level=parseInt(level,10);}}
return level;},log:function log(level){level=logger.lookupLevel(level);if(typeof console!=='undefined'&&logger.lookupLevel(logger.level)<=level){var method=logger.methodMap[level];if(!console[method]){method='log';}
for(var _len=arguments.length,message=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){message[_key-1]=arguments[_key];}
console[method].apply(console,message);}}};exports['default']=logger;module.exports=exports['default'];}),(function(module,exports){'use strict';exports.__esModule=true;function SafeString(string){this.string=string;}
SafeString.prototype.toString=SafeString.prototype.toHTML=function(){return''+this.string;};exports['default']=SafeString;module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';var _Object$seal=__webpack_require__(23)['default'];var _interopRequireWildcard=__webpack_require__(3)['default'];var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;exports.checkRevision=checkRevision;exports.template=template;exports.wrapProgram=wrapProgram;exports.resolvePartial=resolvePartial;exports.invokePartial=invokePartial;exports.noop=noop;var _utils=__webpack_require__(5);var Utils=_interopRequireWildcard(_utils);var _exception=__webpack_require__(6);var _exception2=_interopRequireDefault(_exception);var _base=__webpack_require__(4);function checkRevision(compilerInfo){var compilerRevision=compilerInfo&&compilerInfo[0]||1,currentRevision=_base.COMPILER_REVISION;if(compilerRevision!==currentRevision){if(compilerRevision<currentRevision){var runtimeVersions=_base.REVISION_CHANGES[currentRevision],compilerVersions=_base.REVISION_CHANGES[compilerRevision];throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. '+'Please update your precompiler to a newer version ('+runtimeVersions+') or downgrade your runtime to an older version ('+compilerVersions+').');}else{throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. '+'Please update your runtime to a newer version ('+compilerInfo[1]+').');}}}
function template(templateSpec,env){if(!env){throw new _exception2['default']('No environment passed to template');}
if(!templateSpec||!templateSpec.main){throw new _exception2['default']('Unknown template object: '+typeof templateSpec);}
templateSpec.main.decorator=templateSpec.main_d;env.VM.checkRevision(templateSpec.compiler);function invokePartialWrapper(partial,context,options){if(options.hash){context=Utils.extend({},context,options.hash);if(options.ids){options.ids[0]=true;}}
partial=env.VM.resolvePartial.call(this,partial,context,options);var result=env.VM.invokePartial.call(this,partial,context,options);if(result==null&&env.compile){options.partials[options.name]=env.compile(partial,templateSpec.compilerOptions,env);result=options.partials[options.name](context,options);}
if(result!=null){if(options.indent){var lines=result.split('\n');for(var i=0,l=lines.length;i<l;i++){if(!lines[i]&&i+1===l){break;}
lines[i]=options.indent+lines[i];}
result=lines.join('\n');}
return result;}else{throw new _exception2['default']('The partial '+options.name+' could not be compiled when running in runtime-only mode');}}
var container={strict:function strict(obj,name){if(!(name in obj)){throw new _exception2['default']('"'+name+'" not defined in '+obj);}
return obj[name];},lookup:function lookup(depths,name){var len=depths.length;for(var i=0;i<len;i++){if(depths[i]&&depths[i][name]!=null){return depths[i][name];}}},lambda:function lambda(current,context){return typeof current==='function'?current.call(context):current;},escapeExpression:Utils.escapeExpression,invokePartial:invokePartialWrapper,fn:function fn(i){var ret=templateSpec[i];ret.decorator=templateSpec[i+'_d'];return ret;},programs:[],program:function program(i,data,declaredBlockParams,blockParams,depths){var programWrapper=this.programs[i],fn=this.fn(i);if(data||depths||blockParams||declaredBlockParams){programWrapper=wrapProgram(this,i,fn,data,declaredBlockParams,blockParams,depths);}else if(!programWrapper){programWrapper=this.programs[i]=wrapProgram(this,i,fn);}
return programWrapper;},data:function data(value,depth){while(value&&depth--){value=value._parent;}
return value;},merge:function merge(param,common){var obj=param||common;if(param&&common&&param!==common){obj=Utils.extend({},common,param);}
return obj;},nullContext:_Object$seal({}),noop:env.VM.noop,compilerInfo:templateSpec.compiler};function ret(context){var options=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var data=options.data;ret._setup(options);if(!options.partial&&templateSpec.useData){data=initData(context,data);}
var depths=undefined,blockParams=templateSpec.useBlockParams?[]:undefined;if(templateSpec.useDepths){if(options.depths){depths=context!=options.depths[0]?[context].concat(options.depths):options.depths;}else{depths=[context];}}
function main(context){return''+templateSpec.main(container,context,container.helpers,container.partials,data,blockParams,depths);}
main=executeDecorators(templateSpec.main,main,container,options.depths||[],data,blockParams);return main(context,options);}
ret.isTop=true;ret._setup=function(options){if(!options.partial){container.helpers=container.merge(options.helpers,env.helpers);if(templateSpec.usePartial){container.partials=container.merge(options.partials,env.partials);}
if(templateSpec.usePartial||templateSpec.useDecorators){container.decorators=container.merge(options.decorators,env.decorators);}}else{container.helpers=options.helpers;container.partials=options.partials;container.decorators=options.decorators;}};ret._child=function(i,data,blockParams,depths){if(templateSpec.useBlockParams&&!blockParams){throw new _exception2['default']('must pass block params');}
if(templateSpec.useDepths&&!depths){throw new _exception2['default']('must pass parent depths');}
return wrapProgram(container,i,templateSpec[i],data,0,blockParams,depths);};return ret;}
function wrapProgram(container,i,fn,data,declaredBlockParams,blockParams,depths){function prog(context){var options=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var currentDepths=depths;if(depths&&context!=depths[0]&&!(context===container.nullContext&&depths[0]===null)){currentDepths=[context].concat(depths);}
return fn(container,context,container.helpers,container.partials,options.data||data,blockParams&&[options.blockParams].concat(blockParams),currentDepths);}
prog=executeDecorators(fn,prog,container,depths,data,blockParams);prog.program=i;prog.depth=depths?depths.length:0;prog.blockParams=declaredBlockParams||0;return prog;}
function resolvePartial(partial,context,options){if(!partial){if(options.name==='@partial-block'){partial=options.data['partial-block'];}else{partial=options.partials[options.name];}}else if(!partial.call&&!options.name){options.name=partial;partial=options.partials[partial];}
return partial;}
function invokePartial(partial,context,options){var currentPartialBlock=options.data&&options.data['partial-block'];options.partial=true;if(options.ids){options.data.contextPath=options.ids[0]||options.data.contextPath;}
var partialBlock=undefined;if(options.fn&&options.fn!==noop){(function(){options.data=_base.createFrame(options.data);var fn=options.fn;partialBlock=options.data['partial-block']=function partialBlockWrapper(context){var options=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];options.data=_base.createFrame(options.data);options.data['partial-block']=currentPartialBlock;return fn(context,options);};if(fn.partials){options.partials=Utils.extend({},options.partials,fn.partials);}})();}
if(partial===undefined&&partialBlock){partial=partialBlock;}
if(partial===undefined){throw new _exception2['default']('The partial '+options.name+' could not be found');}else if(partial instanceof Function){return partial(context,options);}}
function noop(){return'';}
function initData(context,data){if(!data||!('root'in data)){data=data?_base.createFrame(data):{};data.root=context;}
return data;}
function executeDecorators(fn,prog,container,depths,data,blockParams){if(fn.decorator){var props={};prog=fn.decorator(prog,props,container,depths&&depths[0],data,blockParams,depths);Utils.extend(prog,props);}
return prog;}}),(function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(24),__esModule:true};}),(function(module,exports,__webpack_require__){__webpack_require__(25);module.exports=__webpack_require__(30).Object.seal;}),(function(module,exports,__webpack_require__){var isObject=__webpack_require__(26);__webpack_require__(27)('seal',function($seal){return function seal(it){return $seal&&isObject(it)?$seal(it):it;};});}),(function(module,exports){module.exports=function(it){return typeof it==='object'?it!==null:typeof it==='function';};}),(function(module,exports,__webpack_require__){var $export=__webpack_require__(28),core=__webpack_require__(30),fails=__webpack_require__(33);module.exports=function(KEY,exec){var fn=(core.Object||{})[KEY]||Object[KEY],exp={};exp[KEY]=exec(fn);$export($export.S+$export.F*fails(function(){fn(1);}),'Object',exp);};}),(function(module,exports,__webpack_require__){var global=__webpack_require__(29),core=__webpack_require__(30),ctx=__webpack_require__(31),PROTOTYPE='prototype';var $export=function(type,name,source){var IS_FORCED=type&$export.F,IS_GLOBAL=type&$export.G,IS_STATIC=type&$export.S,IS_PROTO=type&$export.P,IS_BIND=type&$export.B,IS_WRAP=type&$export.W,exports=IS_GLOBAL?core:core[name]||(core[name]={}),target=IS_GLOBAL?global:IS_STATIC?global[name]:(global[name]||{})[PROTOTYPE],key,own,out;if(IS_GLOBAL)source=name;for(key in source){own=!IS_FORCED&&target&&key in target;if(own&&key in exports)continue;out=own?target[key]:source[key];exports[key]=IS_GLOBAL&&typeof target[key]!='function'?source[key]:IS_BIND&&own?ctx(out,global):IS_WRAP&&target[key]==out?(function(C){var F=function(param){return this instanceof C?new C(param):C(param);};F[PROTOTYPE]=C[PROTOTYPE];return F;})(out):IS_PROTO&&typeof out=='function'?ctx(Function.call,out):out;if(IS_PROTO)(exports[PROTOTYPE]||(exports[PROTOTYPE]={}))[key]=out;}};$export.F=1;$export.G=2;$export.S=4;$export.P=8;$export.B=16;$export.W=32;module.exports=$export;}),(function(module,exports){var global=module.exports=typeof window!='undefined'&&window.Math==Math?window:typeof self!='undefined'&&self.Math==Math?self:Function('return this')();if(typeof __g=='number')__g=global;}),(function(module,exports){var core=module.exports={version:'1.2.6'};if(typeof __e=='number')__e=core;}),(function(module,exports,__webpack_require__){var aFunction=__webpack_require__(32);module.exports=function(fn,that,length){aFunction(fn);if(that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a);};case 2:return function(a,b){return fn.call(that,a,b);};case 3:return function(a,b,c){return fn.call(that,a,b,c);};}
return function(){return fn.apply(that,arguments);};};}),(function(module,exports){module.exports=function(it){if(typeof it!='function')throw TypeError(it+' is not a function!');return it;};}),(function(module,exports){module.exports=function(exec){try{return!!exec();}catch(e){return true;}};}),(function(module,exports){(function(global){'use strict';exports.__esModule=true;exports['default']=function(Handlebars){var root=typeof global!=='undefined'?global:window,$Handlebars=root.Handlebars;Handlebars.noConflict=function(){if(root.Handlebars===Handlebars){root.Handlebars=$Handlebars;}
return Handlebars;};};module.exports=exports['default'];}.call(exports,(function(){return this;}())))}),(function(module,exports){'use strict';exports.__esModule=true;var AST={helpers:{helperExpression:function helperExpression(node){return node.type==='SubExpression'||(node.type==='MustacheStatement'||node.type==='BlockStatement')&&!!(node.params&&node.params.length||node.hash);},scopedId:function scopedId(path){return(/^\.|this\b/.test(path.original));},simpleId:function simpleId(path){return path.parts.length===1&&!AST.helpers.scopedId(path)&&!path.depth;}}};exports['default']=AST;module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];var _interopRequireWildcard=__webpack_require__(3)['default'];exports.__esModule=true;exports.parse=parse;var _parser=__webpack_require__(37);var _parser2=_interopRequireDefault(_parser);var _whitespaceControl=__webpack_require__(38);var _whitespaceControl2=_interopRequireDefault(_whitespaceControl);var _helpers=__webpack_require__(40);var Helpers=_interopRequireWildcard(_helpers);var _utils=__webpack_require__(5);exports.parser=_parser2['default'];var yy={};_utils.extend(yy,Helpers);function parse(input,options){if(input.type==='Program'){return input;}
_parser2['default'].yy=yy;yy.locInfo=function(locInfo){return new yy.SourceLocation(options&&options.srcName,locInfo);};var strip=new _whitespaceControl2['default'](options);return strip.accept(_parser2['default'].parse(input));}}),(function(module,exports){"use strict";exports.__esModule=true;var handlebars=(function(){var parser={trace:function trace(){},yy:{},symbols_:{"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"partialBlock":12,"content":13,"COMMENT":14,"CONTENT":15,"openRawBlock":16,"rawBlock_repetition_plus0":17,"END_RAW_BLOCK":18,"OPEN_RAW_BLOCK":19,"helperName":20,"openRawBlock_repetition0":21,"openRawBlock_option0":22,"CLOSE_RAW_BLOCK":23,"openBlock":24,"block_option0":25,"closeBlock":26,"openInverse":27,"block_option1":28,"OPEN_BLOCK":29,"openBlock_repetition0":30,"openBlock_option0":31,"openBlock_option1":32,"CLOSE":33,"OPEN_INVERSE":34,"openInverse_repetition0":35,"openInverse_option0":36,"openInverse_option1":37,"openInverseChain":38,"OPEN_INVERSE_CHAIN":39,"openInverseChain_repetition0":40,"openInverseChain_option0":41,"openInverseChain_option1":42,"inverseAndProgram":43,"INVERSE":44,"inverseChain":45,"inverseChain_option0":46,"OPEN_ENDBLOCK":47,"OPEN":48,"mustache_repetition0":49,"mustache_option0":50,"OPEN_UNESCAPED":51,"mustache_repetition1":52,"mustache_option1":53,"CLOSE_UNESCAPED":54,"OPEN_PARTIAL":55,"partialName":56,"partial_repetition0":57,"partial_option0":58,"openPartialBlock":59,"OPEN_PARTIAL_BLOCK":60,"openPartialBlock_repetition0":61,"openPartialBlock_option0":62,"param":63,"sexpr":64,"OPEN_SEXPR":65,"sexpr_repetition0":66,"sexpr_option0":67,"CLOSE_SEXPR":68,"hash":69,"hash_repetition_plus0":70,"hashSegment":71,"ID":72,"EQUALS":73,"blockParams":74,"OPEN_BLOCK_PARAMS":75,"blockParams_repetition_plus0":76,"CLOSE_BLOCK_PARAMS":77,"path":78,"dataName":79,"STRING":80,"NUMBER":81,"BOOLEAN":82,"UNDEFINED":83,"NULL":84,"DATA":85,"pathSegments":86,"SEP":87,"$accept":0,"$end":1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,1],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];break;case 2:this.$=yy.prepareProgram($$[$0]);break;case 3:this.$=$$[$0];break;case 4:this.$=$$[$0];break;case 5:this.$=$$[$0];break;case 6:this.$=$$[$0];break;case 7:this.$=$$[$0];break;case 8:this.$=$$[$0];break;case 9:this.$={type:'CommentStatement',value:yy.stripComment($$[$0]),strip:yy.stripFlags($$[$0],$$[$0]),loc:yy.locInfo(this._$)};break;case 10:this.$={type:'ContentStatement',original:$$[$0],value:$$[$0],loc:yy.locInfo(this._$)};break;case 11:this.$=yy.prepareRawBlock($$[$0-2],$$[$0-1],$$[$0],this._$);break;case 12:this.$={path:$$[$0-3],params:$$[$0-2],hash:$$[$0-1]};break;case 13:this.$=yy.prepareBlock($$[$0-3],$$[$0-2],$$[$0-1],$$[$0],false,this._$);break;case 14:this.$=yy.prepareBlock($$[$0-3],$$[$0-2],$$[$0-1],$$[$0],true,this._$);break;case 15:this.$={open:$$[$0-5],path:$$[$0-4],params:$$[$0-3],hash:$$[$0-2],blockParams:$$[$0-1],strip:yy.stripFlags($$[$0-5],$$[$0])};break;case 16:this.$={path:$$[$0-4],params:$$[$0-3],hash:$$[$0-2],blockParams:$$[$0-1],strip:yy.stripFlags($$[$0-5],$$[$0])};break;case 17:this.$={path:$$[$0-4],params:$$[$0-3],hash:$$[$0-2],blockParams:$$[$0-1],strip:yy.stripFlags($$[$0-5],$$[$0])};break;case 18:this.$={strip:yy.stripFlags($$[$0-1],$$[$0-1]),program:$$[$0]};break;case 19:var inverse=yy.prepareBlock($$[$0-2],$$[$0-1],$$[$0],$$[$0],false,this._$),program=yy.prepareProgram([inverse],$$[$0-1].loc);program.chained=true;this.$={strip:$$[$0-2].strip,program:program,chain:true};break;case 20:this.$=$$[$0];break;case 21:this.$={path:$$[$0-1],strip:yy.stripFlags($$[$0-2],$$[$0])};break;case 22:this.$=yy.prepareMustache($$[$0-3],$$[$0-2],$$[$0-1],$$[$0-4],yy.stripFlags($$[$0-4],$$[$0]),this._$);break;case 23:this.$=yy.prepareMustache($$[$0-3],$$[$0-2],$$[$0-1],$$[$0-4],yy.stripFlags($$[$0-4],$$[$0]),this._$);break;case 24:this.$={type:'PartialStatement',name:$$[$0-3],params:$$[$0-2],hash:$$[$0-1],indent:'',strip:yy.stripFlags($$[$0-4],$$[$0]),loc:yy.locInfo(this._$)};break;case 25:this.$=yy.preparePartialBlock($$[$0-2],$$[$0-1],$$[$0],this._$);break;case 26:this.$={path:$$[$0-3],params:$$[$0-2],hash:$$[$0-1],strip:yy.stripFlags($$[$0-4],$$[$0])};break;case 27:this.$=$$[$0];break;case 28:this.$=$$[$0];break;case 29:this.$={type:'SubExpression',path:$$[$0-3],params:$$[$0-2],hash:$$[$0-1],loc:yy.locInfo(this._$)};break;case 30:this.$={type:'Hash',pairs:$$[$0],loc:yy.locInfo(this._$)};break;case 31:this.$={type:'HashPair',key:yy.id($$[$0-2]),value:$$[$0],loc:yy.locInfo(this._$)};break;case 32:this.$=yy.id($$[$0-1]);break;case 33:this.$=$$[$0];break;case 34:this.$=$$[$0];break;case 35:this.$={type:'StringLiteral',value:$$[$0],original:$$[$0],loc:yy.locInfo(this._$)};break;case 36:this.$={type:'NumberLiteral',value:Number($$[$0]),original:Number($$[$0]),loc:yy.locInfo(this._$)};break;case 37:this.$={type:'BooleanLiteral',value:$$[$0]==='true',original:$$[$0]==='true',loc:yy.locInfo(this._$)};break;case 38:this.$={type:'UndefinedLiteral',original:undefined,value:undefined,loc:yy.locInfo(this._$)};break;case 39:this.$={type:'NullLiteral',original:null,value:null,loc:yy.locInfo(this._$)};break;case 40:this.$=$$[$0];break;case 41:this.$=$$[$0];break;case 42:this.$=yy.preparePath(true,$$[$0],this._$);break;case 43:this.$=yy.preparePath(false,$$[$0],this._$);break;case 44:$$[$0-2].push({part:yy.id($$[$0]),original:$$[$0],separator:$$[$0-1]});this.$=$$[$0-2];break;case 45:this.$=[{part:yy.id($$[$0]),original:$$[$0]}];break;case 46:this.$=[];break;case 47:$$[$0-1].push($$[$0]);break;case 48:this.$=[$$[$0]];break;case 49:$$[$0-1].push($$[$0]);break;case 50:this.$=[];break;case 51:$$[$0-1].push($$[$0]);break;case 58:this.$=[];break;case 59:$$[$0-1].push($$[$0]);break;case 64:this.$=[];break;case 65:$$[$0-1].push($$[$0]);break;case 70:this.$=[];break;case 71:$$[$0-1].push($$[$0]);break;case 78:this.$=[];break;case 79:$$[$0-1].push($$[$0]);break;case 82:this.$=[];break;case 83:$$[$0-1].push($$[$0]);break;case 86:this.$=[];break;case 87:$$[$0-1].push($$[$0]);break;case 90:this.$=[];break;case 91:$$[$0-1].push($$[$0]);break;case 94:this.$=[];break;case 95:$$[$0-1].push($$[$0]);break;case 98:this.$=[$$[$0]];break;case 99:$$[$0-1].push($$[$0]);break;case 100:this.$=[$$[$0]];break;case 101:$$[$0-1].push($$[$0]);break;}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{13:40,15:[1,20],17:39},{20:42,56:41,64:43,65:[1,44],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:45,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:48,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:42,56:49,64:43,65:[1,44],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:50,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,51]},{72:[1,35],86:52},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:53,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:54,38:56,39:[1,58],43:57,44:[1,59],45:55,47:[2,54]},{28:60,43:61,44:[1,59],47:[2,56]},{13:63,15:[1,20],18:[1,62]},{15:[2,48],18:[2,48]},{33:[2,86],57:64,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:65,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:66,47:[1,67]},{30:68,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:69,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:70,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:71,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:75,33:[2,80],50:72,63:73,64:76,65:[1,44],69:74,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,80]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,51]},{20:75,53:81,54:[2,84],63:82,64:76,65:[1,44],69:83,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:84,47:[1,67]},{47:[2,55]},{4:85,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:86,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:87,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:88,47:[1,67]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:75,33:[2,88],58:89,63:90,64:76,65:[1,44],69:91,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:92,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:93,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:75,31:94,33:[2,60],63:95,64:76,65:[1,44],69:96,70:77,71:78,72:[1,79],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:75,33:[2,66],36:97,63:98,64:76,65:[1,44],69:99,70:77,71:78,72:[1,79],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:75,22:100,23:[2,52],63:101,64:76,65:[1,44],69:102,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:75,33:[2,92],62:103,63:104,64:76,65:[1,44],69:105,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,106]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:107,72:[1,108],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,109],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,110]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:56,39:[1,58],43:57,44:[1,59],45:112,46:111,47:[2,76]},{33:[2,70],40:113,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,114]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:75,63:116,64:76,65:[1,44],67:115,68:[2,96],69:117,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,118]},{32:119,33:[2,62],74:120,75:[1,121]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:122,74:123,75:[1,121]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,124]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,125]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,109]},{20:75,63:126,64:76,65:[1,44],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:75,33:[2,72],41:127,63:128,64:76,65:[1,44],69:129,70:77,71:78,72:[1,79],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,130]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,131]},{33:[2,63]},{72:[1,133],76:132},{33:[1,134]},{33:[2,69]},{15:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:135,74:136,75:[1,121]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,138],77:[1,137]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,139]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],55:[2,55],57:[2,20],61:[2,57],74:[2,81],83:[2,85],87:[2,18],91:[2,89],102:[2,53],105:[2,93],111:[2,19],112:[2,77],117:[2,97],120:[2,63],123:[2,69],124:[2,12],136:[2,75],137:[2,32]},parseError:function parseError(str,hash){throw new Error(str);},parse:function parse(input){var self=this,stack=[0],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;this.lexer.setInput(input);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;this.yy.parser=this;if(typeof this.lexer.yylloc=="undefined")this.lexer.yylloc={};var yyloc=this.lexer.yylloc;lstack.push(yyloc);var ranges=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function")this.parseError=this.yy.parseError;function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n;}
function lex(){var token;token=self.lexer.lex()||1;if(typeof token!=="number"){token=self.symbols_[token]||token;}
return token;}
var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state];}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex();}
action=table[state]&&table[state][symbol];}
if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";if(!recovering){expected=[];for(p in table[state])if(this.terminals_[p]&&p>2){expected.push("'"+this.terminals_[p]+"'");}
if(this.lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'";}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==1?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'");}
this.parseError(errStr,{text:this.lexer.match,token:this.terminals_[symbol]||symbol,line:this.lexer.yylineno,loc:yyloc,expected:expected});}}
if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);}
switch(action[0]){case 1:stack.push(symbol);vstack.push(this.lexer.yytext);lstack.push(this.lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=this.lexer.yyleng;yytext=this.lexer.yytext;yylineno=this.lexer.yylineno;yyloc=this.lexer.yylloc;if(recovering>0)recovering--;}else{symbol=preErrorSymbol;preErrorSymbol=null;}
break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]];}
r=this.performAction.call(yyval,yytext,yyleng,yylineno,this.yy,action[1],vstack,lstack);if(typeof r!=="undefined"){return r;}
if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len);}
stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true;}}
return true;}};var lexer=(function(){var lexer={EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash);}else{throw new Error(str);}},setInput:function setInput(input){this._input=input;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match='';this.conditionStack=['INITIAL'];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges)this.yylloc.range=[0,0];this.offset=0;return this;},input:function input(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++;}else{this.yylloc.last_column++;}
if(this.options.ranges)this.yylloc.range[1]++;this._input=this._input.slice(1);return ch;},unput:function unput(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len-1);this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(lines.length-1)this.yylineno-=lines.length-1;var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len];}
return this;},more:function more(){this._more=true;return this;},less:function less(n){this.unput(this.match.slice(n));},pastInput:function pastInput(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?'...':'')+past.substr(-20).replace(/\n/g,"");},upcomingInput:function upcomingInput(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length);}
return(next.substr(0,20)+(next.length>20?'...':'')).replace(/\n/g,"");},showPosition:function showPosition(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^";},next:function next(){if(this.done){return this.EOF;}
if(!this._input)this.done=true;var token,match,tempMatch,index,col,lines;if(!this._more){this.yytext='';this.match='';}
var rules=this._currentRules();for(var i=0;i<rules.length;i++){tempMatch=this._input.match(this.rules[rules[i]]);if(tempMatch&&(!match||tempMatch[0].length>match[0].length)){match=tempMatch;index=i;if(!this.options.flex)break;}}
if(match){lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines)this.yylineno+=lines.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng];}
this._more=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,rules[index],this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input)this.done=false;if(token)return token;else return;}
if(this._input===""){return this.EOF;}else{return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),{text:"",token:null,line:this.yylineno});}},lex:function lex(){var r=this.next();if(typeof r!=='undefined'){return r;}else{return this.lex();}},begin:function begin(condition){this.conditionStack.push(condition);},popState:function popState(){return this.conditionStack.pop();},_currentRules:function _currentRules(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;},topState:function topState(){return this.conditionStack[this.conditionStack.length-2];},pushState:function begin(condition){this.begin(condition);}};lexer.options={};lexer.performAction=function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){function strip(start,end){return yy_.yytext=yy_.yytext.substring(start,yy_.yyleng-end+start);}
var YYSTATE=YY_START;switch($avoiding_name_collisions){case 0:if(yy_.yytext.slice(-2)==="\\\\"){strip(0,1);this.begin("mu");}else if(yy_.yytext.slice(-1)==="\\"){strip(0,1);this.begin("emu");}else{this.begin("mu");}
if(yy_.yytext)return 15;break;case 1:return 15;break;case 2:this.popState();return 15;break;case 3:this.begin('raw');return 15;break;case 4:this.popState();if(this.conditionStack[this.conditionStack.length-1]==='raw'){return 15;}else{strip(5,9);return'END_RAW_BLOCK';}
break;case 5:return 15;break;case 6:this.popState();return 14;break;case 7:return 65;break;case 8:return 68;break;case 9:return 19;break;case 10:this.popState();this.begin('raw');return 23;break;case 11:return 55;break;case 12:return 60;break;case 13:return 29;break;case 14:return 47;break;case 15:this.popState();return 44;break;case 16:this.popState();return 44;break;case 17:return 34;break;case 18:return 39;break;case 19:return 51;break;case 20:return 48;break;case 21:this.unput(yy_.yytext);this.popState();this.begin('com');break;case 22:this.popState();return 14;break;case 23:return 48;break;case 24:return 73;break;case 25:return 72;break;case 26:return 72;break;case 27:return 87;break;case 28:break;case 29:this.popState();return 54;break;case 30:this.popState();return 33;break;case 31:yy_.yytext=strip(1,2).replace(/\\"/g,'"');return 80;break;case 32:yy_.yytext=strip(1,2).replace(/\\'/g,"'");return 80;break;case 33:return 85;break;case 34:return 82;break;case 35:return 82;break;case 36:return 83;break;case 37:return 84;break;case 38:return 81;break;case 39:return 75;break;case 40:return 77;break;case 41:return 72;break;case 42:yy_.yytext=yy_.yytext.replace(/\\([\\\]])/g,'$1');return 72;break;case 43:return'INVALID';break;case 44:return 5;break;}};lexer.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/];lexer.conditions={"mu":{"rules":[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[6],"inclusive":false},"raw":{"rules":[3,4,5],"inclusive":false},"INITIAL":{"rules":[0,1,44],"inclusive":true}};return lexer;})();parser.lexer=lexer;function Parser(){this.yy={};}Parser.prototype=parser;parser.Parser=Parser;return new Parser();})();exports["default"]=handlebars;module.exports=exports["default"];}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;var _visitor=__webpack_require__(39);var _visitor2=_interopRequireDefault(_visitor);function WhitespaceControl(){var options=arguments.length<=0||arguments[0]===undefined?{}:arguments[0];this.options=options;}
WhitespaceControl.prototype=new _visitor2['default']();WhitespaceControl.prototype.Program=function(program){var doStandalone=!this.options.ignoreStandalone;var isRoot=!this.isRootSeen;this.isRootSeen=true;var body=program.body;for(var i=0,l=body.length;i<l;i++){var current=body[i],strip=this.accept(current);if(!strip){continue;}
var _isPrevWhitespace=isPrevWhitespace(body,i,isRoot),_isNextWhitespace=isNextWhitespace(body,i,isRoot),openStandalone=strip.openStandalone&&_isPrevWhitespace,closeStandalone=strip.closeStandalone&&_isNextWhitespace,inlineStandalone=strip.inlineStandalone&&_isPrevWhitespace&&_isNextWhitespace;if(strip.close){omitRight(body,i,true);}
if(strip.open){omitLeft(body,i,true);}
if(doStandalone&&inlineStandalone){omitRight(body,i);if(omitLeft(body,i)){if(current.type==='PartialStatement'){current.indent=/([ \t]+$)/.exec(body[i-1].original)[1];}}}
if(doStandalone&&openStandalone){omitRight((current.program||current.inverse).body);omitLeft(body,i);}
if(doStandalone&&closeStandalone){omitRight(body,i);omitLeft((current.inverse||current.program).body);}}
return program;};WhitespaceControl.prototype.BlockStatement=WhitespaceControl.prototype.DecoratorBlock=WhitespaceControl.prototype.PartialBlockStatement=function(block){this.accept(block.program);this.accept(block.inverse);var program=block.program||block.inverse,inverse=block.program&&block.inverse,firstInverse=inverse,lastInverse=inverse;if(inverse&&inverse.chained){firstInverse=inverse.body[0].program;while(lastInverse.chained){lastInverse=lastInverse.body[lastInverse.body.length-1].program;}}
var strip={open:block.openStrip.open,close:block.closeStrip.close,openStandalone:isNextWhitespace(program.body),closeStandalone:isPrevWhitespace((firstInverse||program).body)};if(block.openStrip.close){omitRight(program.body,null,true);}
if(inverse){var inverseStrip=block.inverseStrip;if(inverseStrip.open){omitLeft(program.body,null,true);}
if(inverseStrip.close){omitRight(firstInverse.body,null,true);}
if(block.closeStrip.open){omitLeft(lastInverse.body,null,true);}
if(!this.options.ignoreStandalone&&isPrevWhitespace(program.body)&&isNextWhitespace(firstInverse.body)){omitLeft(program.body);omitRight(firstInverse.body);}}else if(block.closeStrip.open){omitLeft(program.body,null,true);}
return strip;};WhitespaceControl.prototype.Decorator=WhitespaceControl.prototype.MustacheStatement=function(mustache){return mustache.strip;};WhitespaceControl.prototype.PartialStatement=WhitespaceControl.prototype.CommentStatement=function(node){var strip=node.strip||{};return{inlineStandalone:true,open:strip.open,close:strip.close};};function isPrevWhitespace(body,i,isRoot){if(i===undefined){i=body.length;}
var prev=body[i-1],sibling=body[i-2];if(!prev){return isRoot;}
if(prev.type==='ContentStatement'){return(sibling||!isRoot?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(prev.original);}}
function isNextWhitespace(body,i,isRoot){if(i===undefined){i=-1;}
var next=body[i+1],sibling=body[i+2];if(!next){return isRoot;}
if(next.type==='ContentStatement'){return(sibling||!isRoot?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(next.original);}}
function omitRight(body,i,multiple){var current=body[i==null?0:i+1];if(!current||current.type!=='ContentStatement'||!multiple&&current.rightStripped){return;}
var original=current.value;current.value=current.value.replace(multiple?/^\s+/:/^[ \t]*\r?\n?/,'');current.rightStripped=current.value!==original;}
function omitLeft(body,i,multiple){var current=body[i==null?body.length-1:i-1];if(!current||current.type!=='ContentStatement'||!multiple&&current.leftStripped){return;}
var original=current.value;current.value=current.value.replace(multiple?/\s+$/:/[ \t]+$/,'');current.leftStripped=current.value!==original;return current.leftStripped;}
exports['default']=WhitespaceControl;module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;var _exception=__webpack_require__(6);var _exception2=_interopRequireDefault(_exception);function Visitor(){this.parents=[];}
Visitor.prototype={constructor:Visitor,mutating:false,acceptKey:function acceptKey(node,name){var value=this.accept(node[name]);if(this.mutating){if(value&&!Visitor.prototype[value.type]){throw new _exception2['default']('Unexpected node type "'+value.type+'" found when accepting '+name+' on '+node.type);}
node[name]=value;}},acceptRequired:function acceptRequired(node,name){this.acceptKey(node,name);if(!node[name]){throw new _exception2['default'](node.type+' requires '+name);}},acceptArray:function acceptArray(array){for(var i=0,l=array.length;i<l;i++){this.acceptKey(array,i);if(!array[i]){array.splice(i,1);i--;l--;}}},accept:function accept(object){if(!object){return;}
if(!this[object.type]){throw new _exception2['default']('Unknown type: '+object.type,object);}
if(this.current){this.parents.unshift(this.current);}
this.current=object;var ret=this[object.type](object);this.current=this.parents.shift();if(!this.mutating||ret){return ret;}else if(ret!==false){return object;}},Program:function Program(program){this.acceptArray(program.body);},MustacheStatement:visitSubExpression,Decorator:visitSubExpression,BlockStatement:visitBlock,DecoratorBlock:visitBlock,PartialStatement:visitPartial,PartialBlockStatement:function PartialBlockStatement(partial){visitPartial.call(this,partial);this.acceptKey(partial,'program');},ContentStatement:function ContentStatement(){},CommentStatement:function CommentStatement(){},SubExpression:visitSubExpression,PathExpression:function PathExpression(){},StringLiteral:function StringLiteral(){},NumberLiteral:function NumberLiteral(){},BooleanLiteral:function BooleanLiteral(){},UndefinedLiteral:function UndefinedLiteral(){},NullLiteral:function NullLiteral(){},Hash:function Hash(hash){this.acceptArray(hash.pairs);},HashPair:function HashPair(pair){this.acceptRequired(pair,'value');}};function visitSubExpression(mustache){this.acceptRequired(mustache,'path');this.acceptArray(mustache.params);this.acceptKey(mustache,'hash');}
function visitBlock(block){visitSubExpression.call(this,block);this.acceptKey(block,'program');this.acceptKey(block,'inverse');}
function visitPartial(partial){this.acceptRequired(partial,'name');this.acceptArray(partial.params);this.acceptKey(partial,'hash');}
exports['default']=Visitor;module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;exports.SourceLocation=SourceLocation;exports.id=id;exports.stripFlags=stripFlags;exports.stripComment=stripComment;exports.preparePath=preparePath;exports.prepareMustache=prepareMustache;exports.prepareRawBlock=prepareRawBlock;exports.prepareBlock=prepareBlock;exports.prepareProgram=prepareProgram;exports.preparePartialBlock=preparePartialBlock;var _exception=__webpack_require__(6);var _exception2=_interopRequireDefault(_exception);function validateClose(open,close){close=close.path?close.path.original:close;if(open.path.original!==close){var errorNode={loc:open.path.loc};throw new _exception2['default'](open.path.original+" doesn't match "+close,errorNode);}}
function SourceLocation(source,locInfo){this.source=source;this.start={line:locInfo.first_line,column:locInfo.first_column};this.end={line:locInfo.last_line,column:locInfo.last_column};}
function id(token){if(/^\[.*\]$/.test(token)){return token.substring(1,token.length-1);}else{return token;}}
function stripFlags(open,close){return{open:open.charAt(2)==='~',close:close.charAt(close.length-3)==='~'};}
function stripComment(comment){return comment.replace(/^\{\{~?!-?-?/,'').replace(/-?-?~?\}\}$/,'');}
function preparePath(data,parts,loc){loc=this.locInfo(loc);var original=data?'@':'',dig=[],depth=0;for(var i=0,l=parts.length;i<l;i++){var part=parts[i].part,isLiteral=parts[i].original!==part;original+=(parts[i].separator||'')+part;if(!isLiteral&&(part==='..'||part==='.'||part==='this')){if(dig.length>0){throw new _exception2['default']('Invalid path: '+original,{loc:loc});}else if(part==='..'){depth++;}}else{dig.push(part);}}
return{type:'PathExpression',data:data,depth:depth,parts:dig,original:original,loc:loc};}
function prepareMustache(path,params,hash,open,strip,locInfo){var escapeFlag=open.charAt(3)||open.charAt(2),escaped=escapeFlag!=='{'&&escapeFlag!=='&';var decorator=/\*/.test(open);return{type:decorator?'Decorator':'MustacheStatement',path:path,params:params,hash:hash,escaped:escaped,strip:strip,loc:this.locInfo(locInfo)};}
function prepareRawBlock(openRawBlock,contents,close,locInfo){validateClose(openRawBlock,close);locInfo=this.locInfo(locInfo);var program={type:'Program',body:contents,strip:{},loc:locInfo};return{type:'BlockStatement',path:openRawBlock.path,params:openRawBlock.params,hash:openRawBlock.hash,program:program,openStrip:{},inverseStrip:{},closeStrip:{},loc:locInfo};}
function prepareBlock(openBlock,program,inverseAndProgram,close,inverted,locInfo){if(close&&close.path){validateClose(openBlock,close);}
var decorator=/\*/.test(openBlock.open);program.blockParams=openBlock.blockParams;var inverse=undefined,inverseStrip=undefined;if(inverseAndProgram){if(decorator){throw new _exception2['default']('Unexpected inverse block on decorator',inverseAndProgram);}
if(inverseAndProgram.chain){inverseAndProgram.program.body[0].closeStrip=close.strip;}
inverseStrip=inverseAndProgram.strip;inverse=inverseAndProgram.program;}
if(inverted){inverted=inverse;inverse=program;program=inverted;}
return{type:decorator?'DecoratorBlock':'BlockStatement',path:openBlock.path,params:openBlock.params,hash:openBlock.hash,program:program,inverse:inverse,openStrip:openBlock.strip,inverseStrip:inverseStrip,closeStrip:close&&close.strip,loc:this.locInfo(locInfo)};}
function prepareProgram(statements,loc){if(!loc&&statements.length){var firstLoc=statements[0].loc,lastLoc=statements[statements.length-1].loc;if(firstLoc&&lastLoc){loc={source:firstLoc.source,start:{line:firstLoc.start.line,column:firstLoc.start.column},end:{line:lastLoc.end.line,column:lastLoc.end.column}};}}
return{type:'Program',body:statements,strip:{},loc:loc};}
function preparePartialBlock(open,program,close,locInfo){validateClose(open,close);return{type:'PartialBlockStatement',name:open.path,params:open.params,hash:open.hash,program:program,openStrip:open.strip,closeStrip:close&&close.strip,loc:this.locInfo(locInfo)};}}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;exports.Compiler=Compiler;exports.precompile=precompile;exports.compile=compile;var _exception=__webpack_require__(6);var _exception2=_interopRequireDefault(_exception);var _utils=__webpack_require__(5);var _ast=__webpack_require__(35);var _ast2=_interopRequireDefault(_ast);var slice=[].slice;function Compiler(){}
Compiler.prototype={compiler:Compiler,equals:function equals(other){var len=this.opcodes.length;if(other.opcodes.length!==len){return false;}
for(var i=0;i<len;i++){var opcode=this.opcodes[i],otherOpcode=other.opcodes[i];if(opcode.opcode!==otherOpcode.opcode||!argEquals(opcode.args,otherOpcode.args)){return false;}}
len=this.children.length;for(var i=0;i<len;i++){if(!this.children[i].equals(other.children[i])){return false;}}
return true;},guid:0,compile:function compile(program,options){this.sourceNode=[];this.opcodes=[];this.children=[];this.options=options;this.stringParams=options.stringParams;this.trackIds=options.trackIds;options.blockParams=options.blockParams||[];var knownHelpers=options.knownHelpers;options.knownHelpers={'helperMissing':true,'blockHelperMissing':true,'each':true,'if':true,'unless':true,'with':true,'log':true,'lookup':true};if(knownHelpers){for(var _name in knownHelpers){this.options.knownHelpers[_name]=knownHelpers[_name];}}
return this.accept(program);},compileProgram:function compileProgram(program){var childCompiler=new this.compiler(),result=childCompiler.compile(program,this.options),guid=this.guid++;this.usePartial=this.usePartial||result.usePartial;this.children[guid]=result;this.useDepths=this.useDepths||result.useDepths;return guid;},accept:function accept(node){if(!this[node.type]){throw new _exception2['default']('Unknown type: '+node.type,node);}
this.sourceNode.unshift(node);var ret=this[node.type](node);this.sourceNode.shift();return ret;},Program:function Program(program){this.options.blockParams.unshift(program.blockParams);var body=program.body,bodyLength=body.length;for(var i=0;i<bodyLength;i++){this.accept(body[i]);}
this.options.blockParams.shift();this.isSimple=bodyLength===1;this.blockParams=program.blockParams?program.blockParams.length:0;return this;},BlockStatement:function BlockStatement(block){transformLiteralToPath(block);var program=block.program,inverse=block.inverse;program=program&&this.compileProgram(program);inverse=inverse&&this.compileProgram(inverse);var type=this.classifySexpr(block);if(type==='helper'){this.helperSexpr(block,program,inverse);}else if(type==='simple'){this.simpleSexpr(block);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);this.opcode('emptyHash');this.opcode('blockValue',block.path.original);}else{this.ambiguousSexpr(block,program,inverse);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);this.opcode('emptyHash');this.opcode('ambiguousBlockValue');}
this.opcode('append');},DecoratorBlock:function DecoratorBlock(decorator){var program=decorator.program&&this.compileProgram(decorator.program);var params=this.setupFullMustacheParams(decorator,program,undefined),path=decorator.path;this.useDecorators=true;this.opcode('registerDecorator',params.length,path.original);},PartialStatement:function PartialStatement(partial){this.usePartial=true;var program=partial.program;if(program){program=this.compileProgram(partial.program);}
var params=partial.params;if(params.length>1){throw new _exception2['default']('Unsupported number of partial arguments: '+params.length,partial);}else if(!params.length){if(this.options.explicitPartialContext){this.opcode('pushLiteral','undefined');}else{params.push({type:'PathExpression',parts:[],depth:0});}}
var partialName=partial.name.original,isDynamic=partial.name.type==='SubExpression';if(isDynamic){this.accept(partial.name);}
this.setupFullMustacheParams(partial,program,undefined,true);var indent=partial.indent||'';if(this.options.preventIndent&&indent){this.opcode('appendContent',indent);indent='';}
this.opcode('invokePartial',isDynamic,partialName,indent);this.opcode('append');},PartialBlockStatement:function PartialBlockStatement(partialBlock){this.PartialStatement(partialBlock);},MustacheStatement:function MustacheStatement(mustache){this.SubExpression(mustache);if(mustache.escaped&&!this.options.noEscape){this.opcode('appendEscaped');}else{this.opcode('append');}},Decorator:function Decorator(decorator){this.DecoratorBlock(decorator);},ContentStatement:function ContentStatement(content){if(content.value){this.opcode('appendContent',content.value);}},CommentStatement:function CommentStatement(){},SubExpression:function SubExpression(sexpr){transformLiteralToPath(sexpr);var type=this.classifySexpr(sexpr);if(type==='simple'){this.simpleSexpr(sexpr);}else if(type==='helper'){this.helperSexpr(sexpr);}else{this.ambiguousSexpr(sexpr);}},ambiguousSexpr:function ambiguousSexpr(sexpr,program,inverse){var path=sexpr.path,name=path.parts[0],isBlock=program!=null||inverse!=null;this.opcode('getContext',path.depth);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);path.strict=true;this.accept(path);this.opcode('invokeAmbiguous',name,isBlock);},simpleSexpr:function simpleSexpr(sexpr){var path=sexpr.path;path.strict=true;this.accept(path);this.opcode('resolvePossibleLambda');},helperSexpr:function helperSexpr(sexpr,program,inverse){var params=this.setupFullMustacheParams(sexpr,program,inverse),path=sexpr.path,name=path.parts[0];if(this.options.knownHelpers[name]){this.opcode('invokeKnownHelper',params.length,name);}else if(this.options.knownHelpersOnly){throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper '+name,sexpr);}else{path.strict=true;path.falsy=true;this.accept(path);this.opcode('invokeHelper',params.length,path.original,_ast2['default'].helpers.simpleId(path));}},PathExpression:function PathExpression(path){this.addDepth(path.depth);this.opcode('getContext',path.depth);var name=path.parts[0],scoped=_ast2['default'].helpers.scopedId(path),blockParamId=!path.depth&&!scoped&&this.blockParamIndex(name);if(blockParamId){this.opcode('lookupBlockParam',blockParamId,path.parts);}else if(!name){this.opcode('pushContext');}else if(path.data){this.options.data=true;this.opcode('lookupData',path.depth,path.parts,path.strict);}else{this.opcode('lookupOnContext',path.parts,path.falsy,path.strict,scoped);}},StringLiteral:function StringLiteral(string){this.opcode('pushString',string.value);},NumberLiteral:function NumberLiteral(number){this.opcode('pushLiteral',number.value);},BooleanLiteral:function BooleanLiteral(bool){this.opcode('pushLiteral',bool.value);},UndefinedLiteral:function UndefinedLiteral(){this.opcode('pushLiteral','undefined');},NullLiteral:function NullLiteral(){this.opcode('pushLiteral','null');},Hash:function Hash(hash){var pairs=hash.pairs,i=0,l=pairs.length;this.opcode('pushHash');for(;i<l;i++){this.pushParam(pairs[i].value);}
while(i--){this.opcode('assignToHash',pairs[i].key);}
this.opcode('popHash');},opcode:function opcode(name){this.opcodes.push({opcode:name,args:slice.call(arguments,1),loc:this.sourceNode[0].loc});},addDepth:function addDepth(depth){if(!depth){return;}
this.useDepths=true;},classifySexpr:function classifySexpr(sexpr){var isSimple=_ast2['default'].helpers.simpleId(sexpr.path);var isBlockParam=isSimple&&!!this.blockParamIndex(sexpr.path.parts[0]);var isHelper=!isBlockParam&&_ast2['default'].helpers.helperExpression(sexpr);var isEligible=!isBlockParam&&(isHelper||isSimple);if(isEligible&&!isHelper){var _name2=sexpr.path.parts[0],options=this.options;if(options.knownHelpers[_name2]){isHelper=true;}else if(options.knownHelpersOnly){isEligible=false;}}
if(isHelper){return'helper';}else if(isEligible){return'ambiguous';}else{return'simple';}},pushParams:function pushParams(params){for(var i=0,l=params.length;i<l;i++){this.pushParam(params[i]);}},pushParam:function pushParam(val){var value=val.value!=null?val.value:val.original||'';if(this.stringParams){if(value.replace){value=value.replace(/^(\.?\.\/)*/g,'').replace(/\//g,'.');}
if(val.depth){this.addDepth(val.depth);}
this.opcode('getContext',val.depth||0);this.opcode('pushStringParam',value,val.type);if(val.type==='SubExpression'){this.accept(val);}}else{if(this.trackIds){var blockParamIndex=undefined;if(val.parts&&!_ast2['default'].helpers.scopedId(val)&&!val.depth){blockParamIndex=this.blockParamIndex(val.parts[0]);}
if(blockParamIndex){var blockParamChild=val.parts.slice(1).join('.');this.opcode('pushId','BlockParam',blockParamIndex,blockParamChild);}else{value=val.original||value;if(value.replace){value=value.replace(/^this(?:\.|$)/,'').replace(/^\.\//,'').replace(/^\.$/,'');}
this.opcode('pushId',val.type,value);}}
this.accept(val);}},setupFullMustacheParams:function setupFullMustacheParams(sexpr,program,inverse,omitEmpty){var params=sexpr.params;this.pushParams(params);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);if(sexpr.hash){this.accept(sexpr.hash);}else{this.opcode('emptyHash',omitEmpty);}
return params;},blockParamIndex:function blockParamIndex(name){for(var depth=0,len=this.options.blockParams.length;depth<len;depth++){var blockParams=this.options.blockParams[depth],param=blockParams&&_utils.indexOf(blockParams,name);if(blockParams&&param>=0){return[depth,param];}}}};function precompile(input,options,env){if(input==null||typeof input!=='string'&&input.type!=='Program'){throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed '+input);}
options=options||{};if(!('data'in options)){options.data=true;}
if(options.compat){options.useDepths=true;}
var ast=env.parse(input,options),environment=new env.Compiler().compile(ast,options);return new env.JavaScriptCompiler().compile(environment,options);}
function compile(input,options,env){if(options===undefined)options={};if(input==null||typeof input!=='string'&&input.type!=='Program'){throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed '+input);}
options=_utils.extend({},options);if(!('data'in options)){options.data=true;}
if(options.compat){options.useDepths=true;}
var compiled=undefined;function compileInput(){var ast=env.parse(input,options),environment=new env.Compiler().compile(ast,options),templateSpec=new env.JavaScriptCompiler().compile(environment,options,undefined,true);return env.template(templateSpec);}
function ret(context,execOptions){if(!compiled){compiled=compileInput();}
return compiled.call(this,context,execOptions);}
ret._setup=function(setupOptions){if(!compiled){compiled=compileInput();}
return compiled._setup(setupOptions);};ret._child=function(i,data,blockParams,depths){if(!compiled){compiled=compileInput();}
return compiled._child(i,data,blockParams,depths);};return ret;}
function argEquals(a,b){if(a===b){return true;}
if(_utils.isArray(a)&&_utils.isArray(b)&&a.length===b.length){for(var i=0;i<a.length;i++){if(!argEquals(a[i],b[i])){return false;}}
return true;}}
function transformLiteralToPath(sexpr){if(!sexpr.path.parts){var literal=sexpr.path;sexpr.path={type:'PathExpression',data:false,depth:0,parts:[literal.original+''],original:literal.original+'',loc:literal.loc};}}}),(function(module,exports,__webpack_require__){'use strict';var _interopRequireDefault=__webpack_require__(1)['default'];exports.__esModule=true;var _base=__webpack_require__(4);var _exception=__webpack_require__(6);var _exception2=_interopRequireDefault(_exception);var _utils=__webpack_require__(5);var _codeGen=__webpack_require__(43);var _codeGen2=_interopRequireDefault(_codeGen);function Literal(value){this.value=value;}
function JavaScriptCompiler(){}
JavaScriptCompiler.prototype={nameLookup:function nameLookup(parent,name){if(name==='constructor'){return['(',parent,'.propertyIsEnumerable(\'constructor\') ? ',parent,'.constructor : undefined',')'];}
if(JavaScriptCompiler.isValidJavaScriptVariableName(name)){return[parent,'.',name];}else{return[parent,'[',JSON.stringify(name),']'];}},depthedLookup:function depthedLookup(name){return[this.aliasable('container.lookup'),'(depths, "',name,'")'];},compilerInfo:function compilerInfo(){var revision=_base.COMPILER_REVISION,versions=_base.REVISION_CHANGES[revision];return[revision,versions];},appendToBuffer:function appendToBuffer(source,location,explicit){if(!_utils.isArray(source)){source=[source];}
source=this.source.wrap(source,location);if(this.environment.isSimple){return['return ',source,';'];}else if(explicit){return['buffer += ',source,';'];}else{source.appendToBuffer=true;return source;}},initializeBuffer:function initializeBuffer(){return this.quotedString('');},compile:function compile(environment,options,context,asObject){this.environment=environment;this.options=options;this.stringParams=this.options.stringParams;this.trackIds=this.options.trackIds;this.precompile=!asObject;this.name=this.environment.name;this.isChild=!!context;this.context=context||{decorators:[],programs:[],environments:[]};this.preamble();this.stackSlot=0;this.stackVars=[];this.aliases={};this.registers={list:[]};this.hashes=[];this.compileStack=[];this.inlineStack=[];this.blockParams=[];this.compileChildren(environment,options);this.useDepths=this.useDepths||environment.useDepths||environment.useDecorators||this.options.compat;this.useBlockParams=this.useBlockParams||environment.useBlockParams;var opcodes=environment.opcodes,opcode=undefined,firstLoc=undefined,i=undefined,l=undefined;for(i=0,l=opcodes.length;i<l;i++){opcode=opcodes[i];this.source.currentLocation=opcode.loc;firstLoc=firstLoc||opcode.loc;this[opcode.opcode].apply(this,opcode.args);}
this.source.currentLocation=firstLoc;this.pushSource('');if(this.stackSlot||this.inlineStack.length||this.compileStack.length){throw new _exception2['default']('Compile completed with content left on stack');}
if(!this.decorators.isEmpty()){this.useDecorators=true;this.decorators.prepend('var decorators = container.decorators;\n');this.decorators.push('return fn;');if(asObject){this.decorators=Function.apply(this,['fn','props','container','depth0','data','blockParams','depths',this.decorators.merge()]);}else{this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n');this.decorators.push('}\n');this.decorators=this.decorators.merge();}}else{this.decorators=undefined;}
var fn=this.createFunctionContext(asObject);if(!this.isChild){var ret={compiler:this.compilerInfo(),main:fn};if(this.decorators){ret.main_d=this.decorators;ret.useDecorators=true;}
var _context=this.context;var programs=_context.programs;var decorators=_context.decorators;for(i=0,l=programs.length;i<l;i++){if(programs[i]){ret[i]=programs[i];if(decorators[i]){ret[i+'_d']=decorators[i];ret.useDecorators=true;}}}
if(this.environment.usePartial){ret.usePartial=true;}
if(this.options.data){ret.useData=true;}
if(this.useDepths){ret.useDepths=true;}
if(this.useBlockParams){ret.useBlockParams=true;}
if(this.options.compat){ret.compat=true;}
if(!asObject){ret.compiler=JSON.stringify(ret.compiler);this.source.currentLocation={start:{line:1,column:0}};ret=this.objectLiteral(ret);if(options.srcName){ret=ret.toStringWithSourceMap({file:options.destName});ret.map=ret.map&&ret.map.toString();}else{ret=ret.toString();}}else{ret.compilerOptions=this.options;}
return ret;}else{return fn;}},preamble:function preamble(){this.lastContext=0;this.source=new _codeGen2['default'](this.options.srcName);this.decorators=new _codeGen2['default'](this.options.srcName);},createFunctionContext:function createFunctionContext(asObject){var varDeclarations='';var locals=this.stackVars.concat(this.registers.list);if(locals.length>0){varDeclarations+=', '+locals.join(', ');}
var aliasCount=0;for(var alias in this.aliases){var node=this.aliases[alias];if(this.aliases.hasOwnProperty(alias)&&node.children&&node.referenceCount>1){varDeclarations+=', alias'+ ++aliasCount+'='+alias;node.children[0]='alias'+aliasCount;}}
var params=['container','depth0','helpers','partials','data'];if(this.useBlockParams||this.useDepths){params.push('blockParams');}
if(this.useDepths){params.push('depths');}
var source=this.mergeSource(varDeclarations);if(asObject){params.push(source);return Function.apply(this,params);}else{return this.source.wrap(['function(',params.join(','),') {\n  ',source,'}']);}},mergeSource:function mergeSource(varDeclarations){var isSimple=this.environment.isSimple,appendOnly=!this.forceBuffer,appendFirst=undefined,sourceSeen=undefined,bufferStart=undefined,bufferEnd=undefined;this.source.each(function(line){if(line.appendToBuffer){if(bufferStart){line.prepend('  + ');}else{bufferStart=line;}
bufferEnd=line;}else{if(bufferStart){if(!sourceSeen){appendFirst=true;}else{bufferStart.prepend('buffer += ');}
bufferEnd.add(';');bufferStart=bufferEnd=undefined;}
sourceSeen=true;if(!isSimple){appendOnly=false;}}});if(appendOnly){if(bufferStart){bufferStart.prepend('return ');bufferEnd.add(';');}else if(!sourceSeen){this.source.push('return "";');}}else{varDeclarations+=', buffer = '+(appendFirst?'':this.initializeBuffer());if(bufferStart){bufferStart.prepend('return buffer + ');bufferEnd.add(';');}else{this.source.push('return buffer;');}}
if(varDeclarations){this.source.prepend('var '+varDeclarations.substring(2)+(appendFirst?'':';\n'));}
return this.source.merge();},blockValue:function blockValue(name){var blockHelperMissing=this.aliasable('helpers.blockHelperMissing'),params=[this.contextName(0)];this.setupHelperArgs(name,0,params);var blockName=this.popStack();params.splice(1,0,blockName);this.push(this.source.functionCall(blockHelperMissing,'call',params));},ambiguousBlockValue:function ambiguousBlockValue(){var blockHelperMissing=this.aliasable('helpers.blockHelperMissing'),params=[this.contextName(0)];this.setupHelperArgs('',0,params,true);this.flushInline();var current=this.topStack();params.splice(1,0,current);this.pushSource(['if (!',this.lastHelper,') { ',current,' = ',this.source.functionCall(blockHelperMissing,'call',params),'}']);},appendContent:function appendContent(content){if(this.pendingContent){content=this.pendingContent+content;}else{this.pendingLocation=this.source.currentLocation;}
this.pendingContent=content;},append:function append(){if(this.isInline()){this.replaceStack(function(current){return[' != null ? ',current,' : ""'];});this.pushSource(this.appendToBuffer(this.popStack()));}else{var local=this.popStack();this.pushSource(['if (',local,' != null) { ',this.appendToBuffer(local,undefined,true),' }']);if(this.environment.isSimple){this.pushSource(['else { ',this.appendToBuffer("''",undefined,true),' }']);}}},appendEscaped:function appendEscaped(){this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'),'(',this.popStack(),')']));},getContext:function getContext(depth){this.lastContext=depth;},pushContext:function pushContext(){this.pushStackLiteral(this.contextName(this.lastContext));},lookupOnContext:function lookupOnContext(parts,falsy,strict,scoped){var i=0;if(!scoped&&this.options.compat&&!this.lastContext){this.push(this.depthedLookup(parts[i++]));}else{this.pushContext();}
this.resolvePath('context',parts,i,falsy,strict);},lookupBlockParam:function lookupBlockParam(blockParamId,parts){this.useBlockParams=true;this.push(['blockParams[',blockParamId[0],'][',blockParamId[1],']']);this.resolvePath('context',parts,1);},lookupData:function lookupData(depth,parts,strict){if(!depth){this.pushStackLiteral('data');}else{this.pushStackLiteral('container.data(data, '+depth+')');}
this.resolvePath('data',parts,0,true,strict);},resolvePath:function resolvePath(type,parts,i,falsy,strict){var _this=this;if(this.options.strict||this.options.assumeObjects){this.push(strictLookup(this.options.strict&&strict,this,parts,type));return;}
var len=parts.length;for(;i<len;i++){this.replaceStack(function(current){var lookup=_this.nameLookup(current,parts[i],type);if(!falsy){return[' != null ? ',lookup,' : ',current];}else{return[' && ',lookup];}});}},resolvePossibleLambda:function resolvePossibleLambda(){this.push([this.aliasable('container.lambda'),'(',this.popStack(),', ',this.contextName(0),')']);},pushStringParam:function pushStringParam(string,type){this.pushContext();this.pushString(type);if(type!=='SubExpression'){if(typeof string==='string'){this.pushString(string);}else{this.pushStackLiteral(string);}}},emptyHash:function emptyHash(omitEmpty){if(this.trackIds){this.push('{}');}
if(this.stringParams){this.push('{}');this.push('{}');}
this.pushStackLiteral(omitEmpty?'undefined':'{}');},pushHash:function pushHash(){if(this.hash){this.hashes.push(this.hash);}
this.hash={values:[],types:[],contexts:[],ids:[]};},popHash:function popHash(){var hash=this.hash;this.hash=this.hashes.pop();if(this.trackIds){this.push(this.objectLiteral(hash.ids));}
if(this.stringParams){this.push(this.objectLiteral(hash.contexts));this.push(this.objectLiteral(hash.types));}
this.push(this.objectLiteral(hash.values));},pushString:function pushString(string){this.pushStackLiteral(this.quotedString(string));},pushLiteral:function pushLiteral(value){this.pushStackLiteral(value);},pushProgram:function pushProgram(guid){if(guid!=null){this.pushStackLiteral(this.programExpression(guid));}else{this.pushStackLiteral(null);}},registerDecorator:function registerDecorator(paramSize,name){var foundDecorator=this.nameLookup('decorators',name,'decorator'),options=this.setupHelperArgs(name,paramSize);this.decorators.push(['fn = ',this.decorators.functionCall(foundDecorator,'',['fn','props','container',options]),' || fn;']);},invokeHelper:function invokeHelper(paramSize,name,isSimple){var nonHelper=this.popStack(),helper=this.setupHelper(paramSize,name),simple=isSimple?[helper.name,' || ']:'';var lookup=['('].concat(simple,nonHelper);if(!this.options.strict){lookup.push(' || ',this.aliasable('helpers.helperMissing'));}
lookup.push(')');this.push(this.source.functionCall(lookup,'call',helper.callParams));},invokeKnownHelper:function invokeKnownHelper(paramSize,name){var helper=this.setupHelper(paramSize,name);this.push(this.source.functionCall(helper.name,'call',helper.callParams));},invokeAmbiguous:function invokeAmbiguous(name,helperCall){this.useRegister('helper');var nonHelper=this.popStack();this.emptyHash();var helper=this.setupHelper(0,name,helperCall);var helperName=this.lastHelper=this.nameLookup('helpers',name,'helper');var lookup=['(','(helper = ',helperName,' || ',nonHelper,')'];if(!this.options.strict){lookup[0]='(helper = ';lookup.push(' != null ? helper : ',this.aliasable('helpers.helperMissing'));}
this.push(['(',lookup,helper.paramsInit?['),(',helper.paramsInit]:[],'),','(typeof helper === ',this.aliasable('"function"'),' ? ',this.source.functionCall('helper','call',helper.callParams),' : helper))']);},invokePartial:function invokePartial(isDynamic,name,indent){var params=[],options=this.setupParams(name,1,params);if(isDynamic){name=this.popStack();delete options.name;}
if(indent){options.indent=JSON.stringify(indent);}
options.helpers='helpers';options.partials='partials';options.decorators='container.decorators';if(!isDynamic){params.unshift(this.nameLookup('partials',name,'partial'));}else{params.unshift(name);}
if(this.options.compat){options.depths='depths';}
options=this.objectLiteral(options);params.push(options);this.push(this.source.functionCall('container.invokePartial','',params));},assignToHash:function assignToHash(key){var value=this.popStack(),context=undefined,type=undefined,id=undefined;if(this.trackIds){id=this.popStack();}
if(this.stringParams){type=this.popStack();context=this.popStack();}
var hash=this.hash;if(context){hash.contexts[key]=context;}
if(type){hash.types[key]=type;}
if(id){hash.ids[key]=id;}
hash.values[key]=value;},pushId:function pushId(type,name,child){if(type==='BlockParam'){this.pushStackLiteral('blockParams['+name[0]+'].path['+name[1]+']'+(child?' + '+JSON.stringify('.'+child):''));}else if(type==='PathExpression'){this.pushString(name);}else if(type==='SubExpression'){this.pushStackLiteral('true');}else{this.pushStackLiteral('null');}},compiler:JavaScriptCompiler,compileChildren:function compileChildren(environment,options){var children=environment.children,child=undefined,compiler=undefined;for(var i=0,l=children.length;i<l;i++){child=children[i];compiler=new this.compiler();var existing=this.matchExistingProgram(child);if(existing==null){this.context.programs.push('');var index=this.context.programs.length;child.index=index;child.name='program'+index;this.context.programs[index]=compiler.compile(child,options,this.context,!this.precompile);this.context.decorators[index]=compiler.decorators;this.context.environments[index]=child;this.useDepths=this.useDepths||compiler.useDepths;this.useBlockParams=this.useBlockParams||compiler.useBlockParams;child.useDepths=this.useDepths;child.useBlockParams=this.useBlockParams;}else{child.index=existing.index;child.name='program'+existing.index;this.useDepths=this.useDepths||existing.useDepths;this.useBlockParams=this.useBlockParams||existing.useBlockParams;}}},matchExistingProgram:function matchExistingProgram(child){for(var i=0,len=this.context.environments.length;i<len;i++){var environment=this.context.environments[i];if(environment&&environment.equals(child)){return environment;}}},programExpression:function programExpression(guid){var child=this.environment.children[guid],programParams=[child.index,'data',child.blockParams];if(this.useBlockParams||this.useDepths){programParams.push('blockParams');}
if(this.useDepths){programParams.push('depths');}
return'container.program('+programParams.join(', ')+')';},useRegister:function useRegister(name){if(!this.registers[name]){this.registers[name]=true;this.registers.list.push(name);}},push:function push(expr){if(!(expr instanceof Literal)){expr=this.source.wrap(expr);}
this.inlineStack.push(expr);return expr;},pushStackLiteral:function pushStackLiteral(item){this.push(new Literal(item));},pushSource:function pushSource(source){if(this.pendingContent){this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation));this.pendingContent=undefined;}
if(source){this.source.push(source);}},replaceStack:function replaceStack(callback){var prefix=['('],stack=undefined,createdStack=undefined,usedLiteral=undefined;if(!this.isInline()){throw new _exception2['default']('replaceStack on non-inline');}
var top=this.popStack(true);if(top instanceof Literal){stack=[top.value];prefix=['(',stack];usedLiteral=true;}else{createdStack=true;var _name=this.incrStack();prefix=['((',this.push(_name),' = ',top,')'];stack=this.topStack();}
var item=callback.call(this,stack);if(!usedLiteral){this.popStack();}
if(createdStack){this.stackSlot--;}
this.push(prefix.concat(item,')'));},incrStack:function incrStack(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push('stack'+this.stackSlot);}
return this.topStackName();},topStackName:function topStackName(){return'stack'+this.stackSlot;},flushInline:function flushInline(){var inlineStack=this.inlineStack;this.inlineStack=[];for(var i=0,len=inlineStack.length;i<len;i++){var entry=inlineStack[i];if(entry instanceof Literal){this.compileStack.push(entry);}else{var stack=this.incrStack();this.pushSource([stack,' = ',entry,';']);this.compileStack.push(stack);}}},isInline:function isInline(){return this.inlineStack.length;},popStack:function popStack(wrapped){var inline=this.isInline(),item=(inline?this.inlineStack:this.compileStack).pop();if(!wrapped&&item instanceof Literal){return item.value;}else{if(!inline){if(!this.stackSlot){throw new _exception2['default']('Invalid stack pop');}
this.stackSlot--;}
return item;}},topStack:function topStack(){var stack=this.isInline()?this.inlineStack:this.compileStack,item=stack[stack.length-1];if(item instanceof Literal){return item.value;}else{return item;}},contextName:function contextName(context){if(this.useDepths&&context){return'depths['+context+']';}else{return'depth'+context;}},quotedString:function quotedString(str){return this.source.quotedString(str);},objectLiteral:function objectLiteral(obj){return this.source.objectLiteral(obj);},aliasable:function aliasable(name){var ret=this.aliases[name];if(ret){ret.referenceCount++;return ret;}
ret=this.aliases[name]=this.source.wrap(name);ret.aliasable=true;ret.referenceCount=1;return ret;},setupHelper:function setupHelper(paramSize,name,blockHelper){var params=[],paramsInit=this.setupHelperArgs(name,paramSize,params,blockHelper);var foundHelper=this.nameLookup('helpers',name,'helper'),callContext=this.aliasable(this.contextName(0)+' != null ? '+this.contextName(0)+' : (container.nullContext || {})');return{params:params,paramsInit:paramsInit,name:foundHelper,callParams:[callContext].concat(params)};},setupParams:function setupParams(helper,paramSize,params){var options={},contexts=[],types=[],ids=[],objectArgs=!params,param=undefined;if(objectArgs){params=[];}
options.name=this.quotedString(helper);options.hash=this.popStack();if(this.trackIds){options.hashIds=this.popStack();}
if(this.stringParams){options.hashTypes=this.popStack();options.hashContexts=this.popStack();}
var inverse=this.popStack(),program=this.popStack();if(program||inverse){options.fn=program||'container.noop';options.inverse=inverse||'container.noop';}
var i=paramSize;while(i--){param=this.popStack();params[i]=param;if(this.trackIds){ids[i]=this.popStack();}
if(this.stringParams){types[i]=this.popStack();contexts[i]=this.popStack();}}
if(objectArgs){options.args=this.source.generateArray(params);}
if(this.trackIds){options.ids=this.source.generateArray(ids);}
if(this.stringParams){options.types=this.source.generateArray(types);options.contexts=this.source.generateArray(contexts);}
if(this.options.data){options.data='data';}
if(this.useBlockParams){options.blockParams='blockParams';}
return options;},setupHelperArgs:function setupHelperArgs(helper,paramSize,params,useRegister){var options=this.setupParams(helper,paramSize,params);options=this.objectLiteral(options);if(useRegister){this.useRegister('options');params.push('options');return['options=',options];}else if(params){params.push(options);return'';}else{return options;}}};(function(){var reservedWords=('break else new var'+' case finally return void'+' catch for switch while'+' continue function this with'+' default if throw'+' delete in try'+' do instanceof typeof'+' abstract enum int short'+' boolean export interface static'+' byte extends long super'+' char final native synchronized'+' class float package throws'+' const goto private transient'+' debugger implements protected volatile'+' double import public let yield await'+' null true false').split(' ');var compilerWords=JavaScriptCompiler.RESERVED_WORDS={};for(var i=0,l=reservedWords.length;i<l;i++){compilerWords[reservedWords[i]]=true;}})();JavaScriptCompiler.isValidJavaScriptVariableName=function(name){return!JavaScriptCompiler.RESERVED_WORDS[name]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);};function strictLookup(requireTerminal,compiler,parts,type){var stack=compiler.popStack(),i=0,len=parts.length;if(requireTerminal){len--;}
for(;i<len;i++){stack=compiler.nameLookup(stack,parts[i],type);}
if(requireTerminal){return[compiler.aliasable('container.strict'),'(',stack,', ',compiler.quotedString(parts[i]),')'];}else{return stack;}}
exports['default']=JavaScriptCompiler;module.exports=exports['default'];}),(function(module,exports,__webpack_require__){'use strict';exports.__esModule=true;var _utils=__webpack_require__(5);var SourceNode=undefined;try{if(false){var SourceMap=require('source-map');SourceNode=SourceMap.SourceNode;}}catch(err){}
if(!SourceNode){SourceNode=function(line,column,srcFile,chunks){this.src='';if(chunks){this.add(chunks);}};SourceNode.prototype={add:function add(chunks){if(_utils.isArray(chunks)){chunks=chunks.join('');}
this.src+=chunks;},prepend:function prepend(chunks){if(_utils.isArray(chunks)){chunks=chunks.join('');}
this.src=chunks+this.src;},toStringWithSourceMap:function toStringWithSourceMap(){return{code:this.toString()};},toString:function toString(){return this.src;}};}
function castChunk(chunk,codeGen,loc){if(_utils.isArray(chunk)){var ret=[];for(var i=0,len=chunk.length;i<len;i++){ret.push(codeGen.wrap(chunk[i],loc));}
return ret;}else if(typeof chunk==='boolean'||typeof chunk==='number'){return chunk+'';}
return chunk;}
function CodeGen(srcFile){this.srcFile=srcFile;this.source=[];}
CodeGen.prototype={isEmpty:function isEmpty(){return!this.source.length;},prepend:function prepend(source,loc){this.source.unshift(this.wrap(source,loc));},push:function push(source,loc){this.source.push(this.wrap(source,loc));},merge:function merge(){var source=this.empty();this.each(function(line){source.add(['  ',line,'\n']);});return source;},each:function each(iter){for(var i=0,len=this.source.length;i<len;i++){iter(this.source[i]);}},empty:function empty(){var loc=this.currentLocation||{start:{}};return new SourceNode(loc.start.line,loc.start.column,this.srcFile);},wrap:function wrap(chunk){var loc=arguments.length<=1||arguments[1]===undefined?this.currentLocation||{start:{}}:arguments[1];if(chunk instanceof SourceNode){return chunk;}
chunk=castChunk(chunk,this,loc);return new SourceNode(loc.start.line,loc.start.column,this.srcFile,chunk);},functionCall:function functionCall(fn,type,params){params=this.generateList(params);return this.wrap([fn,type?'.'+type+'(':'(',params,')']);},quotedString:function quotedString(str){return'"'+(str+'').replace(/\\/g,'\\\\').replace(/"/g,'\\"').replace(/\n/g,'\\n').replace(/\r/g,'\\r').replace(/\u2028/g,'\\u2028').replace(/\u2029/g,'\\u2029')+'"';},objectLiteral:function objectLiteral(obj){var pairs=[];for(var key in obj){if(obj.hasOwnProperty(key)){var value=castChunk(obj[key],this);if(value!=='undefined'){pairs.push([this.quotedString(key),':',value]);}}}
var ret=this.generateList(pairs);ret.prepend('{');ret.add('}');return ret;},generateList:function generateList(entries){var ret=this.empty();for(var i=0,len=entries.length;i<len;i++){if(i){ret.add(',');}
ret.add(castChunk(entries[i],this));}
return ret;},generateArray:function generateArray(entries){var ret=this.generateList(entries);ret.prepend('[');ret.add(']');return ret;}};exports['default']=CodeGen;module.exports=exports['default'];})])});;;
(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory(require('jquery')):typeof define==='function'&&define.amd?define(['jquery'],factory):(global.parsley=factory(global.jQuery));}(this,(function($){'use strict';function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj;};}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}
return _typeof(obj);}
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}
return target;};return _extends.apply(this,arguments);}
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}
function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_nonIterableSpread();}
function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2;}}
function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}
function _iterableToArray(iter){if(Symbol.iterator in Object(iter)||Object.prototype.toString.call(iter)==="[object Arguments]")return Array.from(iter);}
function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}
return _arr;}
function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance");}
function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}
var globalID=1;var pastWarnings={};var Utils={attr:function attr(element,namespace,obj){var i;var attribute;var attributes;var regex=new RegExp('^'+namespace,'i');if('undefined'===typeof obj)obj={};else{for(i in obj){if(obj.hasOwnProperty(i))delete obj[i];}}
if(!element)return obj;attributes=element.attributes;for(i=attributes.length;i--;){attribute=attributes[i];if(attribute&&attribute.specified&&regex.test(attribute.name)){obj[this.camelize(attribute.name.slice(namespace.length))]=this.deserializeValue(attribute.value);}}
return obj;},checkAttr:function checkAttr(element,namespace,_checkAttr){return element.hasAttribute(namespace+_checkAttr);},setAttr:function setAttr(element,namespace,attr,value){element.setAttribute(this.dasherize(namespace+attr),String(value));},getType:function getType(element){return element.getAttribute('type')||'text';},generateID:function generateID(){return''+globalID++;},deserializeValue:function deserializeValue(value){var num;try{return value?value=="true"||(value=="false"?false:value=="null"?null:!isNaN(num=Number(value))?num:/^[\[\{]/.test(value)?JSON.parse(value):value):value;}catch(e){return value;}},camelize:function camelize(str){return str.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():'';});},dasherize:function dasherize(str){return str.replace(/::/g,'/').replace(/([A-Z]+)([A-Z][a-z])/g,'$1_$2').replace(/([a-z\d])([A-Z])/g,'$1_$2').replace(/_/g,'-').toLowerCase();},warn:function warn(){var _window$console;if(window.console&&'function'===typeof window.console.warn)(_window$console=window.console).warn.apply(_window$console,arguments);},warnOnce:function warnOnce(msg){if(!pastWarnings[msg]){pastWarnings[msg]=true;this.warn.apply(this,arguments);}},_resetWarnings:function _resetWarnings(){pastWarnings={};},trimString:function trimString(string){return string.replace(/^\s+|\s+$/g,'');},parse:{date:function date(string){var parsed=string.match(/^(\d{4,})-(\d\d)-(\d\d)$/);if(!parsed)return null;var _parsed$map=parsed.map(function(x){return parseInt(x,10);}),_parsed$map2=_slicedToArray(_parsed$map,4),_=_parsed$map2[0],year=_parsed$map2[1],month=_parsed$map2[2],day=_parsed$map2[3];var date=new Date(year,month-1,day);if(date.getFullYear()!==year||date.getMonth()+1!==month||date.getDate()!==day)return null;return date;},string:function string(_string){return _string;},integer:function integer(string){if(isNaN(string))return null;return parseInt(string,10);},number:function number(string){if(isNaN(string))throw null;return parseFloat(string);},'boolean':function _boolean(string){return!/^\s*false\s*$/i.test(string);},object:function object(string){return Utils.deserializeValue(string);},regexp:function regexp(_regexp){var flags='';if(/^\/.*\/(?:[gimy]*)$/.test(_regexp)){flags=_regexp.replace(/.*\/([gimy]*)$/,'$1');_regexp=_regexp.replace(new RegExp('^/(.*?)/'+flags+'$'),'$1');}else{_regexp='^'+_regexp+'$';}
return new RegExp(_regexp,flags);}},parseRequirement:function parseRequirement(requirementType,string){var converter=this.parse[requirementType||'string'];if(!converter)throw'Unknown requirement specification: "'+requirementType+'"';var converted=converter(string);if(converted===null)throw"Requirement is not a ".concat(requirementType,": \"").concat(string,"\"");return converted;},namespaceEvents:function namespaceEvents(events,namespace){events=this.trimString(events||'').split(/\s+/);if(!events[0])return'';return $.map(events,function(evt){return"".concat(evt,".").concat(namespace);}).join(' ');},difference:function difference(array,remove){var result=[];$.each(array,function(_,elem){if(remove.indexOf(elem)==-1)result.push(elem);});return result;},all:function all(promises){return $.when.apply($,_toConsumableArray(promises).concat([42,42]));},objectCreate:Object.create||function(){var Object=function Object(){};return function(prototype){if(arguments.length>1){throw Error('Second argument not supported');}
if(_typeof(prototype)!='object'){throw TypeError('Argument must be an object');}
Object.prototype=prototype;var result=new Object();Object.prototype=null;return result;};}(),_SubmitSelector:'input[type="submit"], button:submit'};var Defaults={namespace:'data-parsley-',inputs:'input, textarea, select',excluded:'input[type=button], input[type=submit], input[type=reset], input[type=hidden]',priorityEnabled:true,multiple:null,group:null,uiEnabled:true,validationThreshold:3,focus:'first',trigger:false,triggerAfterFailure:'input',errorClass:'parsley-error',successClass:'parsley-success',classHandler:function classHandler(Field){},errorsContainer:function errorsContainer(Field){},errorsWrapper:'<ul class="parsley-errors-list"></ul>',errorTemplate:'<li></li>'};var Base=function Base(){this.__id__=Utils.generateID();};Base.prototype={asyncSupport:true,_pipeAccordingToValidationResult:function _pipeAccordingToValidationResult(){var _this=this;var pipe=function pipe(){var r=$.Deferred();if(true!==_this.validationResult)r.reject();return r.resolve().promise();};return[pipe,pipe];},actualizeOptions:function actualizeOptions(){Utils.attr(this.element,this.options.namespace,this.domOptions);if(this.parent&&this.parent.actualizeOptions)this.parent.actualizeOptions();return this;},_resetOptions:function _resetOptions(initOptions){this.domOptions=Utils.objectCreate(this.parent.options);this.options=Utils.objectCreate(this.domOptions);for(var i in initOptions){if(initOptions.hasOwnProperty(i))this.options[i]=initOptions[i];}
this.actualizeOptions();},_listeners:null,on:function on(name,fn){this._listeners=this._listeners||{};var queue=this._listeners[name]=this._listeners[name]||[];queue.push(fn);return this;},subscribe:function subscribe(name,fn){$.listenTo(this,name.toLowerCase(),fn);},off:function off(name,fn){var queue=this._listeners&&this._listeners[name];if(queue){if(!fn){delete this._listeners[name];}else{for(var i=queue.length;i--;){if(queue[i]===fn)queue.splice(i,1);}}}
return this;},unsubscribe:function unsubscribe(name,fn){$.unsubscribeTo(this,name.toLowerCase());},trigger:function trigger(name,target,extraArg){target=target||this;var queue=this._listeners&&this._listeners[name];var result;if(queue){for(var i=queue.length;i--;){result=queue[i].call(target,target,extraArg);if(result===false)return result;}}
if(this.parent){return this.parent.trigger(name,target,extraArg);}
return true;},asyncIsValid:function asyncIsValid(group,force){Utils.warnOnce("asyncIsValid is deprecated; please use whenValid instead");return this.whenValid({group:group,force:force});},_findRelated:function _findRelated(){return this.options.multiple?$(this.parent.element.querySelectorAll("[".concat(this.options.namespace,"multiple=\"").concat(this.options.multiple,"\"]"))):this.$element;}};var convertArrayRequirement=function convertArrayRequirement(string,length){var m=string.match(/^\s*\[(.*)\]\s*$/);if(!m)throw'Requirement is not an array: "'+string+'"';var values=m[1].split(',').map(Utils.trimString);if(values.length!==length)throw'Requirement has '+values.length+' values when '+length+' are needed';return values;};var convertExtraOptionRequirement=function convertExtraOptionRequirement(requirementSpec,string,extraOptionReader){var main=null;var extra={};for(var key in requirementSpec){if(key){var value=extraOptionReader(key);if('string'===typeof value)value=Utils.parseRequirement(requirementSpec[key],value);extra[key]=value;}else{main=Utils.parseRequirement(requirementSpec[key],string);}}
return[main,extra];};var Validator=function Validator(spec){$.extend(true,this,spec);};Validator.prototype={validate:function validate(value,requirementFirstArg){if(this.fn){if(arguments.length>3)
requirementFirstArg=[].slice.call(arguments,1,-1);return this.fn(value,requirementFirstArg);}
if(Array.isArray(value)){if(!this.validateMultiple)throw'Validator `'+this.name+'` does not handle multiple values';return this.validateMultiple.apply(this,arguments);}else{var instance=arguments[arguments.length-1];if(this.validateDate&&instance._isDateInput()){arguments[0]=Utils.parse.date(arguments[0]);if(arguments[0]===null)return false;return this.validateDate.apply(this,arguments);}
if(this.validateNumber){if(!value)
return true;if(isNaN(value))return false;arguments[0]=parseFloat(arguments[0]);return this.validateNumber.apply(this,arguments);}
if(this.validateString){return this.validateString.apply(this,arguments);}
throw'Validator `'+this.name+'` only handles multiple values';}},parseRequirements:function parseRequirements(requirements,extraOptionReader){if('string'!==typeof requirements){return Array.isArray(requirements)?requirements:[requirements];}
var type=this.requirementType;if(Array.isArray(type)){var values=convertArrayRequirement(requirements,type.length);for(var i=0;i<values.length;i++){values[i]=Utils.parseRequirement(type[i],values[i]);}
return values;}else if($.isPlainObject(type)){return convertExtraOptionRequirement(type,requirements,extraOptionReader);}else{return[Utils.parseRequirement(type,requirements)];}},requirementType:'string',priority:2};var ValidatorRegistry=function ValidatorRegistry(validators,catalog){this.__class__='ValidatorRegistry';this.locale='en';this.init(validators||{},catalog||{});};var typeTesters={email:/^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/,number:/^-?(\d*\.)?\d+(e[-+]?\d+)?$/i,integer:/^-?\d+$/,digits:/^\d+$/,alphanum:/^\w+$/i,date:{test:function test(value){return Utils.parse.date(value)!==null;}},url:new RegExp("^"+"(?:(?:https?|ftp)://)?"+"(?:\\S+(?::\\S*)?@)?"+"(?:"+"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])"+"(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}"+"(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))"+"|"+"(?:(?:[a-zA-Z\\u00a1-\\uffff0-9]-*)*[a-zA-Z\\u00a1-\\uffff0-9]+)"+"(?:\\.(?:[a-zA-Z\\u00a1-\\uffff0-9]-*)*[a-zA-Z\\u00a1-\\uffff0-9]+)*"+"(?:\\.(?:[a-zA-Z\\u00a1-\\uffff]{2,}))"+")"+"(?::\\d{2,5})?"+"(?:/\\S*)?"+"$")};typeTesters.range=typeTesters.number;var decimalPlaces=function decimalPlaces(num){var match=(''+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);if(!match){return 0;}
return Math.max(0,(match[1]?match[1].length:0)-(match[2]?+match[2]:0));};var parseArguments=function parseArguments(type,args){return args.map(Utils.parse[type]);};var operatorToValidator=function operatorToValidator(type,operator){return function(value){for(var _len=arguments.length,requirementsAndInput=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){requirementsAndInput[_key-1]=arguments[_key];}
requirementsAndInput.pop();return operator.apply(void 0,[value].concat(_toConsumableArray(parseArguments(type,requirementsAndInput))));};};var comparisonOperator=function comparisonOperator(operator){return{validateDate:operatorToValidator('date',operator),validateNumber:operatorToValidator('number',operator),requirementType:operator.length<=2?'string':['string','string'],priority:30};};ValidatorRegistry.prototype={init:function init(validators,catalog){this.catalog=catalog;this.validators=_extends({},this.validators);for(var name in validators){this.addValidator(name,validators[name].fn,validators[name].priority);}
window.Parsley.trigger('parsley:validator:init');},setLocale:function setLocale(locale){if('undefined'===typeof this.catalog[locale])throw new Error(locale+' is not available in the catalog');this.locale=locale;return this;},addCatalog:function addCatalog(locale,messages,set){if('object'===_typeof(messages))this.catalog[locale]=messages;if(true===set)return this.setLocale(locale);return this;},addMessage:function addMessage(locale,name,message){if('undefined'===typeof this.catalog[locale])this.catalog[locale]={};this.catalog[locale][name]=message;return this;},addMessages:function addMessages(locale,nameMessageObject){for(var name in nameMessageObject){this.addMessage(locale,name,nameMessageObject[name]);}
return this;},addValidator:function addValidator(name,arg1,arg2){if(this.validators[name])Utils.warn('Validator "'+name+'" is already defined.');else if(Defaults.hasOwnProperty(name)){Utils.warn('"'+name+'" is a restricted keyword and is not a valid validator name.');return;}
return this._setValidator.apply(this,arguments);},hasValidator:function hasValidator(name){return!!this.validators[name];},updateValidator:function updateValidator(name,arg1,arg2){if(!this.validators[name]){Utils.warn('Validator "'+name+'" is not already defined.');return this.addValidator.apply(this,arguments);}
return this._setValidator.apply(this,arguments);},removeValidator:function removeValidator(name){if(!this.validators[name])Utils.warn('Validator "'+name+'" is not defined.');delete this.validators[name];return this;},_setValidator:function _setValidator(name,validator,priority){if('object'!==_typeof(validator)){validator={fn:validator,priority:priority};}
if(!validator.validate){validator=new Validator(validator);}
this.validators[name]=validator;for(var locale in validator.messages||{}){this.addMessage(locale,name,validator.messages[locale]);}
return this;},getErrorMessage:function getErrorMessage(constraint){var message;if('type'===constraint.name){var typeMessages=this.catalog[this.locale][constraint.name]||{};message=typeMessages[constraint.requirements];}else message=this.formatMessage(this.catalog[this.locale][constraint.name],constraint.requirements);return message||this.catalog[this.locale].defaultMessage||this.catalog.en.defaultMessage;},formatMessage:function formatMessage(string,parameters){if('object'===_typeof(parameters)){for(var i in parameters){string=this.formatMessage(string,parameters[i]);}
return string;}
return'string'===typeof string?string.replace(/%s/i,parameters):'';},validators:{notblank:{validateString:function validateString(value){return /\S/.test(value);},priority:2},required:{validateMultiple:function validateMultiple(values){return values.length>0;},validateString:function validateString(value){return /\S/.test(value);},priority:512},type:{validateString:function validateString(value,type){var _ref=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},_ref$step=_ref.step,step=_ref$step===void 0?'any':_ref$step,_ref$base=_ref.base,base=_ref$base===void 0?0:_ref$base;var tester=typeTesters[type];if(!tester){throw new Error('validator type `'+type+'` is not supported');}
if(!value)return true;if(!tester.test(value))return false;if('number'===type){if(!/^any$/i.test(step||'')){var nb=Number(value);var decimals=Math.max(decimalPlaces(step),decimalPlaces(base));if(decimalPlaces(nb)>decimals)
return false;var toInt=function toInt(f){return Math.round(f*Math.pow(10,decimals));};if((toInt(nb)-toInt(base))%toInt(step)!=0)return false;}}
return true;},requirementType:{'':'string',step:'string',base:'number'},priority:256},pattern:{validateString:function validateString(value,regexp){if(!value)return true;return regexp.test(value);},requirementType:'regexp',priority:64},minlength:{validateString:function validateString(value,requirement){if(!value)return true;return value.length>=requirement;},requirementType:'integer',priority:30},maxlength:{validateString:function validateString(value,requirement){return value.length<=requirement;},requirementType:'integer',priority:30},length:{validateString:function validateString(value,min,max){if(!value)return true;return value.length>=min&&value.length<=max;},requirementType:['integer','integer'],priority:30},mincheck:{validateMultiple:function validateMultiple(values,requirement){return values.length>=requirement;},requirementType:'integer',priority:30},maxcheck:{validateMultiple:function validateMultiple(values,requirement){return values.length<=requirement;},requirementType:'integer',priority:30},check:{validateMultiple:function validateMultiple(values,min,max){return values.length>=min&&values.length<=max;},requirementType:['integer','integer'],priority:30},min:comparisonOperator(function(value,requirement){return value>=requirement;}),max:comparisonOperator(function(value,requirement){return value<=requirement;}),range:comparisonOperator(function(value,min,max){return value>=min&&value<=max;}),equalto:{validateString:function validateString(value,refOrValue){if(!value)return true;var $reference=$(refOrValue);if($reference.length)return value===$reference.val();else return value===refOrValue;},priority:256},euvatin:{validateString:function validateString(value,refOrValue){if(!value){return true;}
var re=/^[A-Z][A-Z][A-Za-z0-9 -]{2,}$/;return re.test(value);},priority:30}}};var UI={};var diffResults=function diffResults(newResult,oldResult,deep){var added=[];var kept=[];for(var i=0;i<newResult.length;i++){var found=false;for(var j=0;j<oldResult.length;j++){if(newResult[i].assert.name===oldResult[j].assert.name){found=true;break;}}
if(found)kept.push(newResult[i]);else added.push(newResult[i]);}
return{kept:kept,added:added,removed:!deep?diffResults(oldResult,newResult,true).added:[]};};UI.Form={_actualizeTriggers:function _actualizeTriggers(){var _this=this;this.$element.on('submit.Parsley',function(evt){_this.onSubmitValidate(evt);});this.$element.on('click.Parsley',Utils._SubmitSelector,function(evt){_this.onSubmitButton(evt);});if(false===this.options.uiEnabled)return;this.element.setAttribute('novalidate','');},focus:function focus(){this._focusedField=null;if(true===this.validationResult||'none'===this.options.focus)return null;for(var i=0;i<this.fields.length;i++){var field=this.fields[i];if(true!==field.validationResult&&field.validationResult.length>0&&'undefined'===typeof field.options.noFocus){this._focusedField=field.$element;if('first'===this.options.focus)break;}}
if(null===this._focusedField)return null;return this._focusedField.focus();},_destroyUI:function _destroyUI(){this.$element.off('.Parsley');}};UI.Field={_reflowUI:function _reflowUI(){this._buildUI();if(!this._ui)return;var diff=diffResults(this.validationResult,this._ui.lastValidationResult);this._ui.lastValidationResult=this.validationResult;this._manageStatusClass();this._manageErrorsMessages(diff);this._actualizeTriggers();if((diff.kept.length||diff.added.length)&&!this._failedOnce){this._failedOnce=true;this._actualizeTriggers();}},getErrorsMessages:function getErrorsMessages(){if(true===this.validationResult)return[];var messages=[];for(var i=0;i<this.validationResult.length;i++){messages.push(this.validationResult[i].errorMessage||this._getErrorMessage(this.validationResult[i].assert));}
return messages;},addError:function addError(name){var _ref=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},message=_ref.message,assert=_ref.assert,_ref$updateClass=_ref.updateClass,updateClass=_ref$updateClass===void 0?true:_ref$updateClass;this._buildUI();this._addError(name,{message:message,assert:assert});if(updateClass)this._errorClass();},updateError:function updateError(name){var _ref2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},message=_ref2.message,assert=_ref2.assert,_ref2$updateClass=_ref2.updateClass,updateClass=_ref2$updateClass===void 0?true:_ref2$updateClass;this._buildUI();this._updateError(name,{message:message,assert:assert});if(updateClass)this._errorClass();},removeError:function removeError(name){var _ref3=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref3$updateClass=_ref3.updateClass,updateClass=_ref3$updateClass===void 0?true:_ref3$updateClass;this._buildUI();this._removeError(name);if(updateClass)this._manageStatusClass();},_manageStatusClass:function _manageStatusClass(){if(this.hasConstraints()&&this.needsValidation()&&true===this.validationResult)this._successClass();else if(this.validationResult.length>0)this._errorClass();else this._resetClass();},_manageErrorsMessages:function _manageErrorsMessages(diff){if('undefined'!==typeof this.options.errorsMessagesDisabled)return;if('undefined'!==typeof this.options.errorMessage){if(diff.added.length||diff.kept.length){this._insertErrorWrapper();if(0===this._ui.$errorsWrapper.find('.parsley-custom-error-message').length)this._ui.$errorsWrapper.append($(this.options.errorTemplate).addClass('parsley-custom-error-message'));return this._ui.$errorsWrapper.addClass('filled').find('.parsley-custom-error-message').html(this.options.errorMessage);}
return this._ui.$errorsWrapper.removeClass('filled').find('.parsley-custom-error-message').remove();}
for(var i=0;i<diff.removed.length;i++){this._removeError(diff.removed[i].assert.name);}
for(i=0;i<diff.added.length;i++){this._addError(diff.added[i].assert.name,{message:diff.added[i].errorMessage,assert:diff.added[i].assert});}
for(i=0;i<diff.kept.length;i++){this._updateError(diff.kept[i].assert.name,{message:diff.kept[i].errorMessage,assert:diff.kept[i].assert});}},_addError:function _addError(name,_ref4){var message=_ref4.message,assert=_ref4.assert;this._insertErrorWrapper();this._ui.$errorClassHandler.attr('aria-describedby',this._ui.errorsWrapperId);this._ui.$errorsWrapper.addClass('filled').append($(this.options.errorTemplate).addClass('parsley-'+name).html(message||this._getErrorMessage(assert)));},_updateError:function _updateError(name,_ref5){var message=_ref5.message,assert=_ref5.assert;this._ui.$errorsWrapper.addClass('filled').find('.parsley-'+name).html(message||this._getErrorMessage(assert));},_removeError:function _removeError(name){this._ui.$errorClassHandler.removeAttr('aria-describedby');this._ui.$errorsWrapper.removeClass('filled').find('.parsley-'+name).remove();},_getErrorMessage:function _getErrorMessage(constraint){var customConstraintErrorMessage=constraint.name+'Message';if('undefined'!==typeof this.options[customConstraintErrorMessage])return window.Parsley.formatMessage(this.options[customConstraintErrorMessage],constraint.requirements);return window.Parsley.getErrorMessage(constraint);},_buildUI:function _buildUI(){if(this._ui||false===this.options.uiEnabled)return;var _ui={};this.element.setAttribute(this.options.namespace+'id',this.__id__);_ui.$errorClassHandler=this._manageClassHandler();_ui.errorsWrapperId='parsley-id-'+(this.options.multiple?'multiple-'+this.options.multiple:this.__id__);_ui.$errorsWrapper=$(this.options.errorsWrapper).attr('id',_ui.errorsWrapperId);_ui.lastValidationResult=[];_ui.validationInformationVisible=false;this._ui=_ui;},_manageClassHandler:function _manageClassHandler(){if('string'===typeof this.options.classHandler&&$(this.options.classHandler).length)return $(this.options.classHandler);var $handlerFunction=this.options.classHandler;if('string'===typeof this.options.classHandler&&'function'===typeof window[this.options.classHandler])$handlerFunction=window[this.options.classHandler];if('function'===typeof $handlerFunction){var $handler=$handlerFunction.call(this,this);if('undefined'!==typeof $handler&&$handler.length)return $handler;}else if('object'===_typeof($handlerFunction)&&$handlerFunction instanceof jQuery&&$handlerFunction.length){return $handlerFunction;}else if($handlerFunction){Utils.warn('The class handler `'+$handlerFunction+'` does not exist in DOM nor as a global JS function');}
return this._inputHolder();},_inputHolder:function _inputHolder(){if(!this.options.multiple||this.element.nodeName==='SELECT')return this.$element;return this.$element.parent();},_insertErrorWrapper:function _insertErrorWrapper(){var $errorsContainer=this.options.errorsContainer;if(0!==this._ui.$errorsWrapper.parent().length)return this._ui.$errorsWrapper.parent();if('string'===typeof $errorsContainer){if($($errorsContainer).length)return $($errorsContainer).append(this._ui.$errorsWrapper);else if('function'===typeof window[$errorsContainer])$errorsContainer=window[$errorsContainer];else Utils.warn('The errors container `'+$errorsContainer+'` does not exist in DOM nor as a global JS function');}
if('function'===typeof $errorsContainer)$errorsContainer=$errorsContainer.call(this,this);if('object'===_typeof($errorsContainer)&&$errorsContainer.length)return $errorsContainer.append(this._ui.$errorsWrapper);return this._inputHolder().after(this._ui.$errorsWrapper);},_actualizeTriggers:function _actualizeTriggers(){var _this2=this;var $toBind=this._findRelated();var trigger;$toBind.off('.Parsley');if(this._failedOnce)$toBind.on(Utils.namespaceEvents(this.options.triggerAfterFailure,'Parsley'),function(){_this2._validateIfNeeded();});else if(trigger=Utils.namespaceEvents(this.options.trigger,'Parsley')){$toBind.on(trigger,function(event){_this2._validateIfNeeded(event);});}},_validateIfNeeded:function _validateIfNeeded(event){var _this3=this;if(event&&/key|input/.test(event.type))if(!(this._ui&&this._ui.validationInformationVisible)&&this.getValue().length<=this.options.validationThreshold)return;if(this.options.debounce){window.clearTimeout(this._debounced);this._debounced=window.setTimeout(function(){return _this3.validate();},this.options.debounce);}else this.validate();},_resetUI:function _resetUI(){this._failedOnce=false;this._actualizeTriggers();if('undefined'===typeof this._ui)return;this._ui.$errorsWrapper.removeClass('filled').children().remove();this._resetClass();this._ui.lastValidationResult=[];this._ui.validationInformationVisible=false;},_destroyUI:function _destroyUI(){this._resetUI();if('undefined'!==typeof this._ui)this._ui.$errorsWrapper.remove();delete this._ui;},_successClass:function _successClass(){this._ui.validationInformationVisible=true;this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass);},_errorClass:function _errorClass(){this._ui.validationInformationVisible=true;this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass);},_resetClass:function _resetClass(){this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass);}};var Form=function Form(element,domOptions,options){this.__class__='Form';this.element=element;this.$element=$(element);this.domOptions=domOptions;this.options=options;this.parent=window.Parsley;this.fields=[];this.validationResult=null;};var statusMapping={pending:null,resolved:true,rejected:false};Form.prototype={onSubmitValidate:function onSubmitValidate(event){var _this=this;if(true===event.parsley)return;var submitSource=this._submitSource||this.$element.find(Utils._SubmitSelector)[0];this._submitSource=null;this.$element.find('.parsley-synthetic-submit-button').prop('disabled',true);if(submitSource&&null!==submitSource.getAttribute('formnovalidate'))return;window.Parsley._remoteCache={};var promise=this.whenValidate({event:event});if('resolved'===promise.state()&&false!==this._trigger('submit'));else{event.stopImmediatePropagation();event.preventDefault();if('pending'===promise.state())promise.done(function(){_this._submit(submitSource);});}},onSubmitButton:function onSubmitButton(event){this._submitSource=event.currentTarget;},_submit:function _submit(submitSource){if(false===this._trigger('submit'))return;if(submitSource){var $synthetic=this.$element.find('.parsley-synthetic-submit-button').prop('disabled',false);if(0===$synthetic.length)$synthetic=$('<input class="parsley-synthetic-submit-button" type="hidden">').appendTo(this.$element);$synthetic.attr({name:submitSource.getAttribute('name'),value:submitSource.getAttribute('value')});}
this.$element.trigger(_extends($.Event('submit'),{parsley:true}));},validate:function validate(options){if(arguments.length>=1&&!$.isPlainObject(options)){Utils.warnOnce('Calling validate on a parsley form without passing arguments as an object is deprecated.');var _arguments=Array.prototype.slice.call(arguments),group=_arguments[0],force=_arguments[1],event=_arguments[2];options={group:group,force:force,event:event};}
return statusMapping[this.whenValidate(options).state()];},whenValidate:function whenValidate(){var _this2=this,_Utils$all$done$fail$;var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},group=_ref.group,force=_ref.force,event=_ref.event;this.submitEvent=event;if(event){this.submitEvent=_extends({},event,{preventDefault:function preventDefault(){Utils.warnOnce("Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`");_this2.validationResult=false;}});}
this.validationResult=true;this._trigger('validate');this._refreshFields();var promises=this._withoutReactualizingFormOptions(function(){return $.map(_this2.fields,function(field){return field.whenValidate({force:force,group:group});});});return(_Utils$all$done$fail$=Utils.all(promises).done(function(){_this2._trigger('success');}).fail(function(){_this2.validationResult=false;_this2.focus();_this2._trigger('error');}).always(function(){_this2._trigger('validated');})).pipe.apply(_Utils$all$done$fail$,_toConsumableArray(this._pipeAccordingToValidationResult()));},isValid:function isValid(options){if(arguments.length>=1&&!$.isPlainObject(options)){Utils.warnOnce('Calling isValid on a parsley form without passing arguments as an object is deprecated.');var _arguments2=Array.prototype.slice.call(arguments),group=_arguments2[0],force=_arguments2[1];options={group:group,force:force};}
return statusMapping[this.whenValid(options).state()];},whenValid:function whenValid(){var _this3=this;var _ref2=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},group=_ref2.group,force=_ref2.force;this._refreshFields();var promises=this._withoutReactualizingFormOptions(function(){return $.map(_this3.fields,function(field){return field.whenValid({group:group,force:force});});});return Utils.all(promises);},refresh:function refresh(){this._refreshFields();return this;},reset:function reset(){for(var i=0;i<this.fields.length;i++){this.fields[i].reset();}
this._trigger('reset');},destroy:function destroy(){this._destroyUI();for(var i=0;i<this.fields.length;i++){this.fields[i].destroy();}
this.$element.removeData('Parsley');this._trigger('destroy');},_refreshFields:function _refreshFields(){return this.actualizeOptions()._bindFields();},_bindFields:function _bindFields(){var _this4=this;var oldFields=this.fields;this.fields=[];this.fieldsMappedById={};this._withoutReactualizingFormOptions(function(){_this4.$element.find(_this4.options.inputs).not(_this4.options.excluded).not("[".concat(_this4.options.namespace,"excluded=true]")).each(function(_,element){var fieldInstance=new window.Parsley.Factory(element,{},_this4);if('Field'===fieldInstance.__class__||'FieldMultiple'===fieldInstance.__class__){var uniqueId=fieldInstance.__class__+'-'+fieldInstance.__id__;if('undefined'===typeof _this4.fieldsMappedById[uniqueId]){_this4.fieldsMappedById[uniqueId]=fieldInstance;_this4.fields.push(fieldInstance);}}});$.each(Utils.difference(oldFields,_this4.fields),function(_,field){field.reset();});});return this;},_withoutReactualizingFormOptions:function _withoutReactualizingFormOptions(fn){var oldActualizeOptions=this.actualizeOptions;this.actualizeOptions=function(){return this;};var result=fn();this.actualizeOptions=oldActualizeOptions;return result;},_trigger:function _trigger(eventName){return this.trigger('form:'+eventName);}};var Constraint=function Constraint(parsleyField,name,requirements,priority,isDomConstraint){var validatorSpec=window.Parsley._validatorRegistry.validators[name];var validator=new Validator(validatorSpec);priority=priority||parsleyField.options[name+'Priority']||validator.priority;isDomConstraint=true===isDomConstraint;_extends(this,{validator:validator,name:name,requirements:requirements,priority:priority,isDomConstraint:isDomConstraint});this._parseRequirements(parsleyField.options);};var capitalize=function capitalize(str){var cap=str[0].toUpperCase();return cap+str.slice(1);};Constraint.prototype={validate:function validate(value,instance){var _this$validator;return(_this$validator=this.validator).validate.apply(_this$validator,[value].concat(_toConsumableArray(this.requirementList),[instance]));},_parseRequirements:function _parseRequirements(options){var _this=this;this.requirementList=this.validator.parseRequirements(this.requirements,function(key){return options[_this.name+capitalize(key)];});}};var Field=function Field(field,domOptions,options,parsleyFormInstance){this.__class__='Field';this.element=field;this.$element=$(field);if('undefined'!==typeof parsleyFormInstance){this.parent=parsleyFormInstance;}
this.options=options;this.domOptions=domOptions;this.constraints=[];this.constraintsByName={};this.validationResult=true;this._bindConstraints();};var statusMapping$1={pending:null,resolved:true,rejected:false};Field.prototype={validate:function validate(options){if(arguments.length>=1&&!$.isPlainObject(options)){Utils.warnOnce('Calling validate on a parsley field without passing arguments as an object is deprecated.');options={options:options};}
var promise=this.whenValidate(options);if(!promise)
return true;switch(promise.state()){case'pending':return null;case'resolved':return true;case'rejected':return this.validationResult;}},whenValidate:function whenValidate(){var _this$whenValid$alway,_this=this;var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},force=_ref.force,group=_ref.group;this.refresh();if(group&&!this._isInGroup(group))return;this.value=this.getValue();this._trigger('validate');return(_this$whenValid$alway=this.whenValid({force:force,value:this.value,_refreshed:true}).always(function(){_this._reflowUI();}).done(function(){_this._trigger('success');}).fail(function(){_this._trigger('error');}).always(function(){_this._trigger('validated');})).pipe.apply(_this$whenValid$alway,_toConsumableArray(this._pipeAccordingToValidationResult()));},hasConstraints:function hasConstraints(){return 0!==this.constraints.length;},needsValidation:function needsValidation(value){if('undefined'===typeof value)value=this.getValue();if(!value.length&&!this._isRequired()&&'undefined'===typeof this.options.validateIfEmpty)return false;return true;},_isInGroup:function _isInGroup(group){if(Array.isArray(this.options.group))return-1!==$.inArray(group,this.options.group);return this.options.group===group;},isValid:function isValid(options){if(arguments.length>=1&&!$.isPlainObject(options)){Utils.warnOnce('Calling isValid on a parsley field without passing arguments as an object is deprecated.');var _arguments=Array.prototype.slice.call(arguments),force=_arguments[0],value=_arguments[1];options={force:force,value:value};}
var promise=this.whenValid(options);if(!promise)
return true;return statusMapping$1[promise.state()];},whenValid:function whenValid(){var _this2=this;var _ref2=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref2$force=_ref2.force,force=_ref2$force===void 0?false:_ref2$force,value=_ref2.value,group=_ref2.group,_refreshed=_ref2._refreshed;if(!_refreshed)this.refresh();if(group&&!this._isInGroup(group))return;this.validationResult=true;if(!this.hasConstraints())return $.when();if('undefined'===typeof value||null===value)value=this.getValue();if(!this.needsValidation(value)&&true!==force)return $.when();var groupedConstraints=this._getGroupedConstraints();var promises=[];$.each(groupedConstraints,function(_,constraints){var promise=Utils.all($.map(constraints,function(constraint){return _this2._validateConstraint(value,constraint);}));promises.push(promise);if(promise.state()==='rejected')return false;});return Utils.all(promises);},_validateConstraint:function _validateConstraint(value,constraint){var _this3=this;var result=constraint.validate(value,this);if(false===result)result=$.Deferred().reject();return Utils.all([result]).fail(function(errorMessage){if(!(_this3.validationResult instanceof Array))_this3.validationResult=[];_this3.validationResult.push({assert:constraint,errorMessage:'string'===typeof errorMessage&&errorMessage});});},getValue:function getValue(){var value;if('function'===typeof this.options.value)value=this.options.value(this);else if('undefined'!==typeof this.options.value)value=this.options.value;else value=this.$element.val();if('undefined'===typeof value||null===value)return'';return this._handleWhitespace(value);},reset:function reset(){this._resetUI();return this._trigger('reset');},destroy:function destroy(){this._destroyUI();this.$element.removeData('Parsley');this.$element.removeData('FieldMultiple');this._trigger('destroy');},refresh:function refresh(){this._refreshConstraints();return this;},_refreshConstraints:function _refreshConstraints(){return this.actualizeOptions()._bindConstraints();},refreshConstraints:function refreshConstraints(){Utils.warnOnce("Parsley's refreshConstraints is deprecated. Please use refresh");return this.refresh();},addConstraint:function addConstraint(name,requirements,priority,isDomConstraint){if(window.Parsley._validatorRegistry.validators[name]){var constraint=new Constraint(this,name,requirements,priority,isDomConstraint);if('undefined'!==this.constraintsByName[constraint.name])this.removeConstraint(constraint.name);this.constraints.push(constraint);this.constraintsByName[constraint.name]=constraint;}
return this;},removeConstraint:function removeConstraint(name){for(var i=0;i<this.constraints.length;i++){if(name===this.constraints[i].name){this.constraints.splice(i,1);break;}}
delete this.constraintsByName[name];return this;},updateConstraint:function updateConstraint(name,parameters,priority){return this.removeConstraint(name).addConstraint(name,parameters,priority);},_bindConstraints:function _bindConstraints(){var constraints=[];var constraintsByName={};for(var i=0;i<this.constraints.length;i++){if(false===this.constraints[i].isDomConstraint){constraints.push(this.constraints[i]);constraintsByName[this.constraints[i].name]=this.constraints[i];}}
this.constraints=constraints;this.constraintsByName=constraintsByName;for(var name in this.options){this.addConstraint(name,this.options[name],undefined,true);}
return this._bindHtml5Constraints();},_bindHtml5Constraints:function _bindHtml5Constraints(){if(null!==this.element.getAttribute('required'))this.addConstraint('required',true,undefined,true);if(null!==this.element.getAttribute('pattern'))this.addConstraint('pattern',this.element.getAttribute('pattern'),undefined,true);var min=this.element.getAttribute('min');var max=this.element.getAttribute('max');if(null!==min&&null!==max)this.addConstraint('range',[min,max],undefined,true);else if(null!==min)this.addConstraint('min',min,undefined,true);else if(null!==max)this.addConstraint('max',max,undefined,true);if(null!==this.element.getAttribute('minlength')&&null!==this.element.getAttribute('maxlength'))this.addConstraint('length',[this.element.getAttribute('minlength'),this.element.getAttribute('maxlength')],undefined,true);else if(null!==this.element.getAttribute('minlength'))this.addConstraint('minlength',this.element.getAttribute('minlength'),undefined,true);else if(null!==this.element.getAttribute('maxlength'))this.addConstraint('maxlength',this.element.getAttribute('maxlength'),undefined,true);var type=Utils.getType(this.element);if('number'===type){return this.addConstraint('type',['number',{step:this.element.getAttribute('step')||'1',base:min||this.element.getAttribute('value')}],undefined,true);}else if(/^(email|url|range|date)$/i.test(type)){return this.addConstraint('type',type,undefined,true);}
return this;},_isRequired:function _isRequired(){if('undefined'===typeof this.constraintsByName.required)return false;return false!==this.constraintsByName.required.requirements;},_trigger:function _trigger(eventName){return this.trigger('field:'+eventName);},_handleWhitespace:function _handleWhitespace(value){if(true===this.options.trimValue)Utils.warnOnce('data-parsley-trim-value="true" is deprecated, please use data-parsley-whitespace="trim"');if('squish'===this.options.whitespace)value=value.replace(/\s{2,}/g,' ');if('trim'===this.options.whitespace||'squish'===this.options.whitespace||true===this.options.trimValue)value=Utils.trimString(value);return value;},_isDateInput:function _isDateInput(){var c=this.constraintsByName.type;return c&&c.requirements==='date';},_getGroupedConstraints:function _getGroupedConstraints(){if(false===this.options.priorityEnabled)return[this.constraints];var groupedConstraints=[];var index={};for(var i=0;i<this.constraints.length;i++){var p=this.constraints[i].priority;if(!index[p])groupedConstraints.push(index[p]=[]);index[p].push(this.constraints[i]);}
groupedConstraints.sort(function(a,b){return b[0].priority-a[0].priority;});return groupedConstraints;}};var Multiple=function Multiple(){this.__class__='FieldMultiple';};Multiple.prototype={addElement:function addElement($element){this.$elements.push($element);return this;},_refreshConstraints:function _refreshConstraints(){var fieldConstraints;this.constraints=[];if(this.element.nodeName==='SELECT'){this.actualizeOptions()._bindConstraints();return this;}
for(var i=0;i<this.$elements.length;i++){if(!$('html').has(this.$elements[i]).length){this.$elements.splice(i,1);continue;}
fieldConstraints=this.$elements[i].data('FieldMultiple')._refreshConstraints().constraints;for(var j=0;j<fieldConstraints.length;j++){this.addConstraint(fieldConstraints[j].name,fieldConstraints[j].requirements,fieldConstraints[j].priority,fieldConstraints[j].isDomConstraint);}}
return this;},getValue:function getValue(){if('function'===typeof this.options.value)return this.options.value(this);else if('undefined'!==typeof this.options.value)return this.options.value;if(this.element.nodeName==='INPUT'){var type=Utils.getType(this.element);if(type==='radio')return this._findRelated().filter(':checked').val()||'';if(type==='checkbox'){var values=[];this._findRelated().filter(':checked').each(function(){values.push($(this).val());});return values;}}
if(this.element.nodeName==='SELECT'&&null===this.$element.val())return[];return this.$element.val();},_init:function _init(){this.$elements=[this.$element];return this;}};var Factory=function Factory(element,options,parsleyFormInstance){this.element=element;this.$element=$(element);var savedparsleyFormInstance=this.$element.data('Parsley');if(savedparsleyFormInstance){if('undefined'!==typeof parsleyFormInstance&&savedparsleyFormInstance.parent===window.Parsley){savedparsleyFormInstance.parent=parsleyFormInstance;savedparsleyFormInstance._resetOptions(savedparsleyFormInstance.options);}
if('object'===_typeof(options)){_extends(savedparsleyFormInstance.options,options);}
return savedparsleyFormInstance;}
if(!this.$element.length)throw new Error('You must bind Parsley on an existing element.');if('undefined'!==typeof parsleyFormInstance&&'Form'!==parsleyFormInstance.__class__)throw new Error('Parent instance must be a Form instance');this.parent=parsleyFormInstance||window.Parsley;return this.init(options);};Factory.prototype={init:function init(options){this.__class__='Parsley';this.__version__='2.9.1';this.__id__=Utils.generateID();this._resetOptions(options);if(this.element.nodeName==='FORM'||Utils.checkAttr(this.element,this.options.namespace,'validate')&&!this.$element.is(this.options.inputs))return this.bind('parsleyForm');return this.isMultiple()?this.handleMultiple():this.bind('parsleyField');},isMultiple:function isMultiple(){var type=Utils.getType(this.element);return type==='radio'||type==='checkbox'||this.element.nodeName==='SELECT'&&null!==this.element.getAttribute('multiple');},handleMultiple:function handleMultiple(){var _this=this;var name;var parsleyMultipleInstance;this.options.multiple=this.options.multiple||(name=this.element.getAttribute('name'))||this.element.getAttribute('id');if(this.element.nodeName==='SELECT'&&null!==this.element.getAttribute('multiple')){this.options.multiple=this.options.multiple||this.__id__;return this.bind('parsleyFieldMultiple');}else if(!this.options.multiple){Utils.warn('To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.',this.$element);return this;}
this.options.multiple=this.options.multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g,'');if(name){$('input[name="'+name+'"]').each(function(i,input){var type=Utils.getType(input);if(type==='radio'||type==='checkbox')input.setAttribute(_this.options.namespace+'multiple',_this.options.multiple);});}
var $previouslyRelated=this._findRelated();for(var i=0;i<$previouslyRelated.length;i++){parsleyMultipleInstance=$($previouslyRelated.get(i)).data('Parsley');if('undefined'!==typeof parsleyMultipleInstance){if(!this.$element.data('FieldMultiple')){parsleyMultipleInstance.addElement(this.$element);}
break;}}
this.bind('parsleyField',true);return parsleyMultipleInstance||this.bind('parsleyFieldMultiple');},bind:function bind(type,doNotStore){var parsleyInstance;switch(type){case'parsleyForm':parsleyInstance=$.extend(new Form(this.element,this.domOptions,this.options),new Base(),window.ParsleyExtend)._bindFields();break;case'parsleyField':parsleyInstance=$.extend(new Field(this.element,this.domOptions,this.options,this.parent),new Base(),window.ParsleyExtend);break;case'parsleyFieldMultiple':parsleyInstance=$.extend(new Field(this.element,this.domOptions,this.options,this.parent),new Multiple(),new Base(),window.ParsleyExtend)._init();break;default:throw new Error(type+'is not a supported Parsley type');}
if(this.options.multiple)Utils.setAttr(this.element,this.options.namespace,'multiple',this.options.multiple);if('undefined'!==typeof doNotStore){this.$element.data('FieldMultiple',parsleyInstance);return parsleyInstance;}
this.$element.data('Parsley',parsleyInstance);parsleyInstance._actualizeTriggers();parsleyInstance._trigger('init');return parsleyInstance;}};var vernums=$.fn.jquery.split('.');if(parseInt(vernums[0])<=1&&parseInt(vernums[1])<8){throw"The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.";}
if(!vernums.forEach){Utils.warn('Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim');}
var Parsley=_extends(new Base(),{element:document,$element:$(document),actualizeOptions:null,_resetOptions:null,Factory:Factory,version:'2.9.1'});_extends(Field.prototype,UI.Field,Base.prototype);_extends(Form.prototype,UI.Form,Base.prototype);_extends(Factory.prototype,Base.prototype);$.fn.parsley=$.fn.psly=function(options){if(this.length>1){var instances=[];this.each(function(){instances.push($(this).parsley(options));});return instances;}
if(this.length==0){return;}
return new Factory(this[0],options);};if('undefined'===typeof window.ParsleyExtend)window.ParsleyExtend={};Parsley.options=_extends(Utils.objectCreate(Defaults),window.ParsleyConfig);window.ParsleyConfig=Parsley.options;window.Parsley=window.psly=Parsley;Parsley.Utils=Utils;window.ParsleyUtils={};$.each(Utils,function(key,value){if('function'===typeof value){window.ParsleyUtils[key]=function(){Utils.warnOnce('Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead.');return Utils[key].apply(Utils,arguments);};}});var registry=window.Parsley._validatorRegistry=new ValidatorRegistry(window.ParsleyConfig.validators,window.ParsleyConfig.i18n);window.ParsleyValidator={};$.each('setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator hasValidator'.split(' '),function(i,method){window.Parsley[method]=function(){return registry[method].apply(registry,arguments);};window.ParsleyValidator[method]=function(){var _window$Parsley;Utils.warnOnce("Accessing the method '".concat(method,"' through Validator is deprecated. Simply call 'window.Parsley.").concat(method,"(...)'"));return(_window$Parsley=window.Parsley)[method].apply(_window$Parsley,arguments);};});window.Parsley.UI=UI;window.ParsleyUI={removeError:function removeError(instance,name,doNotUpdateClass){var updateClass=true!==doNotUpdateClass;Utils.warnOnce("Accessing UI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method.");return instance.removeError(name,{updateClass:updateClass});},getErrorsMessages:function getErrorsMessages(instance){Utils.warnOnce("Accessing UI is deprecated. Call 'getErrorsMessages' on the instance directly.");return instance.getErrorsMessages();}};$.each('addError updateError'.split(' '),function(i,method){window.ParsleyUI[method]=function(instance,name,message,assert,doNotUpdateClass){var updateClass=true!==doNotUpdateClass;Utils.warnOnce("Accessing UI is deprecated. Call '".concat(method,"' on the instance directly. Please comment in issue 1073 as to your need to call this method."));return instance[method](name,{message:message,assert:assert,updateClass:updateClass});};});if(false!==window.ParsleyConfig.autoBind){$(function(){if($('[data-parsley-validate]').length)$('[data-parsley-validate]').parsley();});}
var o=$({});var deprecated=function deprecated(){Utils.warnOnce("Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley");};function adapt(fn,context){if(!fn.parsleyAdaptedCallback){fn.parsleyAdaptedCallback=function(){var args=Array.prototype.slice.call(arguments,0);args.unshift(this);fn.apply(context||o,args);};}
return fn.parsleyAdaptedCallback;}
var eventPrefix='parsley:';function eventName(name){if(name.lastIndexOf(eventPrefix,0)===0)return name.substr(eventPrefix.length);return name;}
$.listen=function(name,callback){var context;deprecated();if('object'===_typeof(arguments[1])&&'function'===typeof arguments[2]){context=arguments[1];callback=arguments[2];}
if('function'!==typeof callback)throw new Error('Wrong parameters');window.Parsley.on(eventName(name),adapt(callback,context));};$.listenTo=function(instance,name,fn){deprecated();if(!(instance instanceof Field)&&!(instance instanceof Form))throw new Error('Must give Parsley instance');if('string'!==typeof name||'function'!==typeof fn)throw new Error('Wrong parameters');instance.on(eventName(name),adapt(fn));};$.unsubscribe=function(name,fn){deprecated();if('string'!==typeof name||'function'!==typeof fn)throw new Error('Wrong arguments');window.Parsley.off(eventName(name),fn.parsleyAdaptedCallback);};$.unsubscribeTo=function(instance,name){deprecated();if(!(instance instanceof Field)&&!(instance instanceof Form))throw new Error('Must give Parsley instance');instance.off(eventName(name));};$.unsubscribeAll=function(name){deprecated();window.Parsley.off(eventName(name));$('form,input,textarea,select').each(function(){var instance=$(this).data('Parsley');if(instance){instance.off(eventName(name));}});};$.emit=function(name,instance){var _instance;deprecated();var instanceGiven=instance instanceof Field||instance instanceof Form;var args=Array.prototype.slice.call(arguments,instanceGiven?2:1);args.unshift(eventName(name));if(!instanceGiven){instance=window.Parsley;}
(_instance=instance).trigger.apply(_instance,_toConsumableArray(args));};$.extend(true,Parsley,{asyncValidators:{'default':{fn:function fn(xhr){return xhr.status>=200&&xhr.status<300;},url:false},reverse:{fn:function fn(xhr){return xhr.status<200||xhr.status>=300;},url:false}},addAsyncValidator:function addAsyncValidator(name,fn,url,options){Parsley.asyncValidators[name]={fn:fn,url:url||false,options:options||{}};return this;}});Parsley.addValidator('remote',{requirementType:{'':'string','validator':'string','reverse':'boolean','options':'object'},validateString:function validateString(value,url,options,instance){var data={};var ajaxOptions;var csr;var validator=options.validator||(true===options.reverse?'reverse':'default');if('undefined'===typeof Parsley.asyncValidators[validator])throw new Error('Calling an undefined async validator: `'+validator+'`');url=Parsley.asyncValidators[validator].url||url;if(url.indexOf('{value}')>-1){url=url.replace('{value}',encodeURIComponent(value));}else{data[instance.element.getAttribute('name')||instance.element.getAttribute('id')]=value;}
var remoteOptions=$.extend(true,options.options||{},Parsley.asyncValidators[validator].options);ajaxOptions=$.extend(true,{},{url:url,data:data,type:'GET'},remoteOptions);instance.trigger('field:ajaxoptions',instance,ajaxOptions);csr=$.param(ajaxOptions);if('undefined'===typeof Parsley._remoteCache)Parsley._remoteCache={};var xhr=Parsley._remoteCache[csr]=Parsley._remoteCache[csr]||$.ajax(ajaxOptions);var handleXhr=function handleXhr(){var result=Parsley.asyncValidators[validator].fn.call(instance,xhr,url,options);if(!result)
result=$.Deferred().reject();return $.when(result);};return xhr.then(handleXhr,handleXhr);},priority:-1});Parsley.on('form:submit',function(){Parsley._remoteCache={};});Base.prototype.addAsyncValidator=function(){Utils.warnOnce('Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`');return Parsley.addAsyncValidator.apply(Parsley,arguments);};Parsley.addMessages('en',{defaultMessage:"This value seems to be invalid.",type:{email:"This value should be a valid email.",url:"This value should be a valid url.",number:"This value should be a valid number.",integer:"This value should be a valid integer.",digits:"This value should be digits.",alphanum:"This value should be alphanumeric."},notblank:"This value should not be blank.",required:"This value is required.",pattern:"This value seems to be invalid.",min:"This value should be greater than or equal to %s.",max:"This value should be lower than or equal to %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or fewer.",length:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or fewer.",check:"You must select between %s and %s choices.",equalto:"This value should be the same.",euvatin:"It's not a valid VAT Identification Number."});Parsley.setLocale('en');function InputEvent(){var _this=this;var globals=window||global;_extends(this,{isNativeEvent:function isNativeEvent(evt){return evt.originalEvent&&evt.originalEvent.isTrusted!==false;},fakeInputEvent:function fakeInputEvent(evt){if(_this.isNativeEvent(evt)){$(evt.target).trigger('input');}},misbehaves:function misbehaves(evt){if(_this.isNativeEvent(evt)){_this.behavesOk(evt);$(document).on('change.inputevent',evt.data.selector,_this.fakeInputEvent);_this.fakeInputEvent(evt);}},behavesOk:function behavesOk(evt){if(_this.isNativeEvent(evt)){$(document).off('input.inputevent',evt.data.selector,_this.behavesOk).off('change.inputevent',evt.data.selector,_this.misbehaves);}},install:function install(){if(globals.inputEventPatched){return;}
globals.inputEventPatched='0.0.3';var _arr=['select','input[type="checkbox"]','input[type="radio"]','input[type="file"]'];for(var _i=0;_i<_arr.length;_i++){var selector=_arr[_i];$(document).on('input.inputevent',selector,{selector:selector},_this.behavesOk).on('change.inputevent',selector,{selector:selector},_this.misbehaves);}},uninstall:function uninstall(){delete globals.inputEventPatched;$(document).off('.inputevent');}});}
var inputevent=new InputEvent();inputevent.install();return Parsley;})));;
!function(t,e){"use strict";t=t||"docReady",e=e||window;var n=[],o=!1,d=!1;function a(){if(!o){o=!0;for(var t=0;t<n.length;t++)n[t].fn.call(window,n[t].ctx);n=[]}}
function c(){"complete"===document.readyState&&a()}
e[t]=function(t,e){if("function"!=typeof t)throw new TypeError("callback for docReady(fn) must be a function");o?setTimeout(function(){t(e)},1):(n.push({fn:t,ctx:e}),"complete"===document.readyState||!document.attachEvent&&"interactive"===document.readyState?setTimeout(a,1):d||(document.addEventListener?(document.addEventListener("DOMContentLoaded",a,!1),window.addEventListener("load",a,!1)):(document.attachEvent("onreadystatechange",c),window.attachEvent("onload",a)),d=!0))}}("docReady",window);Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null});window.requestAnimFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(callback){window.setTimeout(callback,1000 / 60);};})();function scrollToY(o,n){function a(){t+=1 / 60;var n=t / c,l=i(n);1>n?(requestAnimFrame(a),window.scrollTo(0,r+(o-r)*l)):window.scrollTo(0,o)}
var r=window.scrollY,o=o||0,n=n||2e3,t=0,c=Math.max(.1,Math.min(Math.abs(r-o)/ n,.8)),i=function(o){return-.5*(Math.cos(Math.PI*o)-1)};a()}
var hasClass=function(elem,classname){return elem.classList.contains(classname);};var addClass=function(elem,classname){elem.classList.add(classname);};var removeClass=function(elem,classname){elem.classList.remove(classname);};removeClass(document.querySelector('div.o-wrapper.no_js'),'no_js');var show=function(elem){if(elem){removeClass(elem,'is-hidden');}};var hide=function(elem){if(elem){addClass(elem,'is-hidden');}};var setInputFieldValue=function(field,value){var inputField=document.getElementsByClassName('js_'+field)[0];inputField.value=value;};var getInputFieldValue=function(field){return document.getElementsByClassName('js_'+field)[0].value;};var showInvisionDropdown=function(){var dropdown=document.querySelector('.ipsSelectTree');dropdown.setAttribute('style','display: flex !important;');};var getCustomFieldHolder=function(key){var field=document.querySelectorAll('div[data-field-key="'+key+'"]');return(field.length)?field[0]:null;};var showCustomFields=function(fields){for(var i=0;i<fields.length;i++){var holder=getCustomFieldHolder(fields[i]);if(holder!==null){show(holder);}}};var hideAndResetCustomFields=function(fields){for(var i=0;i<fields.length;i++){var holder=getCustomFieldHolder(fields[i]);if(holder!==null){var fieldID=holder.getElementsByTagName('label')[0].getAttribute('for');switch(holder.getAttribute('data-field-type')){case'Text':case'Url':case'Date':case'Upload':document.getElementById(fieldID).value='';break;case'Select':var options=document.getElementById(fieldID).getElementsByTagName('option');for(var j=0;j<options.length;j++){options[j].selected=options[j].defaultSelected;}
break;case'Editor':document.getElementById(fieldID).value='';holder.getElementsByClassName('ql-editor')[0].innerHTML='';break;case'YesNo':document.getElementById(fieldID+'_yes').checked=false;document.getElementById(fieldID+'_no').checked=true;break;}
hide(holder);}}};var configureCustomFields=function(){var articleType=getInputFieldValue('article-type');var contentType=getInputFieldValue('content-type');if(contentType==='pre_existing'){if(articleType==='safety_alerts'){showCustomFields(['link','copyright-status','paywalled']);hideAndResetCustomFields(['original-publication-date','original-author','contentfield_1','summary','attachment','about-the-author','setting-and-context','challenge','actions','implementation','key-outcomes-lessons-learnt','impact','next-steps','questions-answers']);showCustomFields(['alert-type','alert-reference-number','originator','issue-date','to-be-completed-by','date-alert-will-be-reviewed']);}else{showCustomFields(['original-publication-date','original-author','contentfield_1','summary','link','attachment','copyright-status','paywalled']);hideAndResetCustomFields(['about-the-author','setting-and-context','challenge','actions','implementation','key-outcomes-lessons-learnt','impact','next-steps','questions-answers','alert-type','alert-reference-number','originator','issue-date','to-be-completed-by','date-alert-will-be-reviewed']);}}else{showCustomFields(['summary','attachment']);hideAndResetCustomFields(['original-publication-date','original-author','link','copyright-status','paywalled','alert-type','alert-reference-number','originator','issue-date','to-be-completed-by','date-alert-will-be-reviewed']);switch(articleType){case'accounts_narratives':case'blogs':showCustomFields(['contentfield_1','about-the-author']);hideAndResetCustomFields(['setting-and-context','challenge','actions','implementation','key-outcomes-lessons-learnt','impact','next-steps','questions-answers']);break;case'case_studies':hideAndResetCustomFields(['contentfield_1']);showCustomFields(['about-the-author','setting-and-context','challenge','actions']);hideAndResetCustomFields(['implementation']);showCustomFields(['key-outcomes-lessons-learnt','impact','next-steps']);hideAndResetCustomFields(['questions-answers']);break;case'data_research_analysis':case'guides_guidelines':case'infographics':showCustomFields(['contentfield_1']);hideAndResetCustomFields(['about-the-author','setting-and-context','challenge','actions','implementation','key-outcomes-lessons-learnt','impact','next-steps','questions-answers']);break;case'interviews_reflections':hideAndResetCustomFields(['contentfield_1']);showCustomFields(['about-the-author']);hideAndResetCustomFields(['setting-and-context','challenge','actions','implementation','key-outcomes-lessons-learnt','impact','next-steps']);showCustomFields(['questions-answers']);break;case'investigations':case'podcast_audio':case'policies_procedures':case'processes_systems':showCustomFields(['contentfield_1']);hideAndResetCustomFields(['about-the-author','setting-and-context','challenge','actions','implementation','key-outcomes-lessons-learnt','impact','next-steps','questions-answers']);break;case'recommendations':hideAndResetCustomFields(['contentfield_1','about-the-author']);showCustomFields(['setting-and-context']);hideAndResetCustomFields(['challenge','actions']);showCustomFields(['implementation']);hideAndResetCustomFields(['key-outcomes-lessons-learnt']);showCustomFields(['impact','next-steps']);hideAndResetCustomFields(['questions-answers']);break;case'reports_articles':case'safety_improvement_strategies_interventions':case'seminars_presentations':case'simulation_reenactment':case'standards_regulations':case'tips_tricks':case'toolkits_collections':case'tools_templates':case'videos_animations':showCustomFields(['contentfield_1']);hideAndResetCustomFields(['about-the-author','setting-and-context','challenge','actions','implementation','key-outcomes-lessons-learnt','impact','next-steps','questions-answers']);break;}}};var removeCustomisation=function(customisedElement){var original=customisedElement.parentElement.getElementsByClassName('default')[0];customisedElement.parentElement.removeChild(customisedElement);removeClass(original,'is-hidden');};var resetCustomFieldCustomisations=function(){var customLabels=document.querySelectorAll('div.c-share-form--row label span.custom-label');var customDescriptions=document.querySelectorAll('div.c-share-form--input-description span.custom-desc');for(var i=0;i<customLabels.length;i++){removeCustomisation(customLabels[i]);}
for(i=0;i<customDescriptions.length;i++){removeCustomisation(customDescriptions[i]);}
var optionalFields=document.querySelectorAll('div.c-share-form--row[data-field-required="0"]');for(i=0;i<optionalFields.length;i++){switchFieldRequirement(optionalFields[i].getAttribute('data-field-key'),false);}};var switchFieldLabel=function(field,newLabel){var labelHolder=document.querySelector('div.c-share-form--row[data-field-key="'+field+'"] label');if(labelHolder!==null){var origLabel=labelHolder.getElementsByClassName('default')[0];addClass(origLabel,'is-hidden');var customLabel=document.createElement('span');addClass(customLabel,'custom-label');customLabel.innerText=newLabel;labelHolder.appendChild(customLabel);}};var switchFieldDescription=function(field,newDescription){var descHolder=document.querySelector('div.c-share-form--row[data-field-key="'+field+'"] .c-share-form--input-description');if(descHolder!==null){var origDesc=descHolder.getElementsByClassName('default')[0];addClass(origDesc,'is-hidden');var customDesc=document.createElement('span');addClass(customDesc,'custom-desc');customDesc.innerText=newDescription;descHolder.appendChild(customDesc);}};var switchFieldRequirement=function(fieldKey,required){var fieldHolder=document.querySelector('div.c-share-form--row[data-field-key="'+fieldKey+'"]');if(fieldHolder!==null){var fieldType=fieldHolder.getAttribute('data-field-type');var field=null;switch(fieldType){case'Text':case'Url':case'Editor':case'Date':case'Upload':field=fieldHolder.getElementsByTagName('input')[0];break;case'Select':field=fieldHolder.getElementsByTagName('select')[0];break;}
if(field!==null){if(required){addClass(fieldHolder.getElementsByTagName('label')[0],'c-share-form--label-required');field.setAttribute('required','required');}else{removeClass(fieldHolder.getElementsByTagName('label')[0],'c-share-form--label-required');field.removeAttribute('required');}}}};var customiseCustomFields=function(){resetCustomFieldCustomisations();var articleType=getInputFieldValue('article-type');var contentType=getInputFieldValue('content-type');if(contentType==='new'){switch(articleType){case'accounts_narratives':switchFieldDescription('about-the-author','Provide a few sentences about yourself, your organisation and any additional information which sets the account or narrative in context');break;case'blogs':switchFieldDescription('about-the-author','Provide a few sentences about yourself, your organisation and any additional information which sets the blog in context');break;case'case_studies':switchFieldRequirement('setting-and-context',true);switchFieldRequirement('challenge',true);switchFieldRequirement('actions',true);switchFieldRequirement('key-outcomes-lessons-learnt',true);switchFieldRequirement('impact',true);switchFieldRequirement('next-steps',true);switchFieldDescription('setting-and-context','Unit/hospital/healthcare organisation details: location, size, number of admissions, staff, statistics relevant to the case study. Some background to the case study - how the idea or challenge arose, what was happening at the time.');switchFieldDescription('impact','What has been the impact on patients, staff, systems, the organisation? How did people react to the changes implemented? What long term changes were made in the organisation, to systems? Include any statistics or evidence to back this up.')
switchFieldDescription('next-steps','What still needs to be done and what are you going to do next? Further areas of improvement.');break;case'interviews_reflections':switchFieldRequirement('about-the-author',true);switchFieldRequirement('summary',true);switchFieldDescription('summary','Who they are, current organisation and position, brief summary of what the interview, viewpoint or reflection is on or topics discussed.');switchFieldLabel('about-the-author','About');switchFieldDescription('about-the-author','Few sentences about the interviewee, their organisation and any relevant additional information');break;case'recommendations':switchFieldRequirement('summary',true);switchFieldRequirement('setting-and-context',true);switchFieldRequirement('implementation',true);switchFieldRequirement('impact',true);switchFieldRequirement('next-steps',true);switchFieldDescription('setting-and-context','Hospital/trust/organisation details. Details of the original safety alert or recommendation if applicable, background on topic');switchFieldDescription('impact','What has been the impact on patients, staff, systems, organisation? How did people react to the changes implemented? What long term changes were made in the organisation, to systems? How have you measured the benefits?');switchFieldDescription('next-steps','What still needs to be done and what are you going to do next? Further areas of improvement. Any external evaluation or audit to measure success?');break;}}else{switch(articleType){case'safety_alerts':switchFieldRequirement('alert-type',true);switchFieldRequirement('alert-reference-number',true);switchFieldRequirement('originator',true);switchFieldRequirement('issue-date',true);switchFieldRequirement('to-be-completed-by',true);switchFieldRequirement('date-alert-will-be-reviewed',true);switchFieldRequirement('link',true);switchFieldDescription('titlefield_1','Title of the safety alert');break;}}};var formValidation=null;var initFormValidation=function(){if(formValidation===null){formValidation=jQuery('form.c-share-form').parsley({excluded:'input[type=button], input[type=submit], input[type=reset], input[name="tags"], .is-hidden input',focus:'none'});}else{formValidation.refresh();formValidation.validate();}};var autoAdvance=function(){var panel2btns=document.querySelectorAll('div[data-stage="2"] .c-share-option--link');for(var i=0;i<panel2btns.length;i++){var btn=panel2btns[i];if(btn.getAttribute('data-value')==='pre_existing'){btn.click();break;}}};var navigateToStage=function(stage){if(stage===3){showInvisionDropdown();}else if(stage===5){configureCustomFields();customiseCustomFields();initFormValidation();}
var panels=document.getElementsByClassName('js_panel'),completedSection=document.querySelector('.c-share-section--highlight');if(completedSection!==null){removeClass(completedSection,'c-share-section--highlight');}
for(var i=0;i<panels.length;i++){var panel=panels[i];if((i+1)==stage){show(panel);addClass(panel,'js_current');panel.setAttribute('tabindex',0);var navQuestion=document.querySelector('li[data-question="'+stage+'"]');if(navQuestion!==null){addClass(navQuestion.getElementsByClassName('c-share-section')[0],'c-share-section--highlight');}
continue;}
panel.setAttribute('tabindex',-1);removeClass(panel,'js_current');hide(panel);}
if(stage===2&&getInputFieldValue('article-type')==='safety_alerts'){autoAdvance();}};var getCurrentStage=function(){var panel=document.getElementsByClassName('js_current')[0];return parseInt(panel.getAttribute('data-stage'));};var getStageQuestion=function(stage){var panel=document.querySelectorAll('[data-stage="'+stage+'"]')[0];var question=panel.querySelectorAll('h2.js_question')[0];return question.getAttribute('data-summary');};var updateProgressBar=function(reset){var progressFill=document.querySelector('.c-share-progress-bar--fill'),progressLabel=document.querySelector('.js-progress-label');if(reset){progressFill.setAttribute('style','width: 0%');progressLabel.textContent="0% complete";var allBtns=document.querySelectorAll('.c-share-option--link-active');for(var i=0;i<allBtns.length;i++){removeClass(allBtns[i],'c-share-option--link-active');}}else{var numberOfStages=document.querySelectorAll('.js_panel').length,stagesCompleted=getCurrentStage();stagesCompleted--;var numberOfStagesPercentage=Math.floor((stagesCompleted / numberOfStages)*100);progressFill.setAttribute('style','width: '+numberOfStagesPercentage+'%');progressLabel.textContent=numberOfStagesPercentage+"% complete";}};var clickEditButton=function(event){event.preventDefault();var btn=event.currentTarget;var stage=parseInt(btn.getAttribute('data-edit'));var allPanels=document.querySelectorAll('.js_panel');var shareSections=document.querySelectorAll(".c-share-section");for(var i=0;i<shareSections.length;i++){var shareSection=shareSections[i];removeClass(shareSection,'c-share-section--highlight');}
addClass(btn.closest('.c-share-section'),'c-share-section--highlight');for(var i=0;i<allPanels.length;i++){var panel=allPanels[i];panel.setAttribute('tabindex',-1);}
resetValidation();document.querySelector('[data-stage="'+stage+'"]').setAttribute('tabindex',0);navigateToStage(stage);updateProgressBar(false);};var clearUserSelectionsHighlight=function(){var shareSections=document.querySelectorAll('.c-share-section');if(shareSections.length>0){for(var i=0;i<shareSections.length;i++){removeClass(shareSections[i],'c-share-section--highlight');}}};var updateSelection=function(stage,value){clearUserSelectionsHighlight();var nav=document.getElementsByClassName('js_nav')[0].getElementsByTagName('ul')[0];var selection=nav.querySelectorAll('[data-question="'+stage+'"]')[0];if(typeof selection!=='undefined'){selection.getElementsByClassName('js_user_selection')[0].textContent=value;}else{selection=document.createElement('li');var answerText=document.createTextNode(value),questionText=document.createTextNode(stage+'. '+getStageQuestion(stage)),editToolTipText=document.createTextNode('Edit '+getStageQuestion(stage)),editBtnHolder=document.createElement('div'),editBtnIcon=document.createElement('i'),editBtn=document.createElement('button'),editBtnToolTip=document.createElement('div'),answerRow=document.createElement('div'),answerStage=document.createElement('h2'),answerSelection=document.createElement('div');editBtnIcon.setAttribute('class','fa fa-pencil');editBtn.setAttribute('class','js_edit c-button');editBtn.setAttribute('data-edit',stage);editBtnToolTip.setAttribute('class','c-tooltip--message c-tooltip--message-left');editBtn.setAttribute('aria-label','Edit '+getStageQuestion(stage));editBtnHolder.setAttribute('class','c-share-section--completed-button');editBtn.appendChild(editBtnIcon);editBtnToolTip.appendChild(editToolTipText);editBtn.addEventListener('click',clickEditButton);editBtnHolder.appendChild(editBtn);editBtnHolder.appendChild(editBtnToolTip);answerRow.setAttribute('class','c-share-section c-share-section--completed ipsBox');answerStage.setAttribute('class','ips_reset u-margin-bottom-small u-margin-top-none js_question');answerSelection.setAttribute('class','c-share-section--completed-options js_user_selection');answerStage.appendChild(questionText);answerSelection.appendChild(answerText);answerRow.appendChild(answerStage);answerRow.appendChild(answerSelection);answerRow.appendChild(editBtnHolder);selection.appendChild(answerRow);selection.setAttribute('data-question',stage);nav.appendChild(selection);}
if(stage===2){var editBtn=nav.querySelector('[data-question="'+stage+'"] button.js_edit');if(getInputFieldValue('article-type')==='safety_alerts'&&value==='Pre-existing'){hide(editBtn);}else{show(editBtn);}}};var hideAllTooltipMessages=function(){var activeTooltipMessages=document.querySelectorAll('.c-share-option--tooltip-message-show');for(var i=0;i<activeTooltipMessages.length;i++){removeClass(activeTooltipMessages[i],'c-share-option--tooltip-message-show');}};var clickOption=function(event){event.preventDefault();var btn=event.currentTarget;var selectedValue=btn.getAttribute('data-value');var selectedValueText=btn.firstChild.nodeValue;var stage=getCurrentStage();var allBtns=document.querySelectorAll('div[data-stage="'+stage+'"] .c-share-option--link');for(var i=0;i<allBtns.length;i++){removeClass(allBtns[i],'c-share-option--link-active');}
addClass(btn,'c-share-option--link-active');updateSelection(stage,selectedValueText);if(stage===1){setInputFieldValue('article-type',selectedValue);}else if(stage===2){setInputFieldValue('content-type',selectedValue);}
navigateToStage(stage+1);updateProgressBar(false);hideAllTooltipMessages();};var initOptions=function(){var buttons=document.getElementsByClassName('js_btn');for(var i=0;i<buttons.length;i++){buttons[i].addEventListener('click',clickOption);}};var clearExistingSelections=function(){var nav=document.getElementsByClassName('js_nav')[0].getElementsByTagName('ul')[0];while(nav.hasChildNodes()){nav.removeChild(nav.lastChild);}};var updateCategorySelectionProgress=function(){var selectedCatDropdown=document.getElementsByClassName('js_current')[0].querySelector('.ipsSelectTree_selected span'),selectedCatSearch=document.querySelector('.tt-input'),selectedCat=null;if(selectedCatDropdown!==null){selectedCat=selectedCatDropdown.innerHTML;}else if(selectedCatSearch!==''){selectedCat=selectedCatSearch.value;}
if(selectedCat!==null){var stage=getCurrentStage();updateSelection(stage,selectedCat);navigateToStage(parseInt(stage)+1);}};var clickContinue=function(event){event.preventDefault();var btn=event.currentTarget;var catSelectionField=btn.closest('.c-share-section').querySelectorAll('.js_category-selector input[type="hidden"]')[0];if(catSelectionField.value!==''){updateCategorySelectionProgress();updateProgressBar(false);}else{var tooltip=btn.parentElement.getElementsByClassName('c-tooltip--message')[0];addClass(tooltip,'c-tooltip--message-show');setTimeout(function(){removeClass(tooltip,'c-tooltip--message-show');},2000);}};var initContinueButton=function(){var continueBtns=document.querySelectorAll('.c-share-dropdown-continue');for(var i=0;i<continueBtns.length;i++){continueBtns[i].addEventListener('click',clickContinue);}};var resetCategorySelection=function(){var invisionDropdowns=document.querySelectorAll('.ipsSelectTree_value'),invisionSelectedValue=document.querySelector('.ipsSelectTree_selected');for(var i=0;i<invisionDropdowns.length;i++){var dropdown=invisionDropdowns[i];dropdown.innerHTML='Select';addClass(dropdown,'ipsSelectTree_placeholder');}
if(invisionSelectedValue!==null){removeClass(invisionSelectedValue,'ipsSelectTree_selected');}};var clearFormValues=function(){var formInputs=document.querySelectorAll('.c-share-form input'),formWYSIWYGeditors=document.querySelectorAll('.c-share-form .ql-editor');for(var i=0;i<formInputs.length;i++){if(formInputs[i].getAttribute('type')==='radio'||formInputs[i].getAttribute('type')==='checkbox'){continue;}
formInputs[i].value='';}
for(var i=0;i<formWYSIWYGeditors.length;i++){formWYSIWYGeditors[i].innerHTML='';}
resetCategorySelection();resetCategoryID();};var clickCancel=function(event){event.preventDefault();clearExistingSelections();navigateToStage(1);updateProgressBar(true);clearFormValues();resetValidation();};var resetValidation=function(){if(formValidation!==null){formValidation.destroy();formValidation=null;}};var initCancelButton=function(){var cancelBtns=document.querySelectorAll('.js_cancel');for(var i=0;i<cancelBtns.length;i++){cancelBtns[i].addEventListener('click',clickCancel);}};var resetCategoryID=function(){return document.querySelector('.ipsSelectTree').getElementsByTagName('input')[0].value='';};var getSelectedCategoryID=function(){return document.querySelector('.ipsSelectTree').getElementsByTagName('input')[0].value;};var getTagSelections=function(tagsPretty){var tagsList=document.querySelector('input[name="tags"]').value;if(tagsList.slice(-1)===','){tagsList=tagsList.slice(0,-1);}
if(tagsPretty){return tagsList.replace(/,/g,', ');}
return tagsList.replace(/\s*,\s*/g,",");};var collateCustomFieldValues=function(){var customFields=document.getElementsByClassName('c-share-form--row');var customValues=[];for(var i=0;i<customFields.length;i++){if(!hasClass(customFields[i],'is-hidden')){var fieldID=customFields[i].getElementsByTagName('label')[0].getAttribute('for');if(fieldID!==null){switch(customFields[i].getAttribute('data-field-type')){case'Text':case'Url':case'Date':case'Editor':customValues[fieldID]=document.getElementById(fieldID).value;break;case'Select':var values=Array.prototype.slice.call(document.getElementById(fieldID).querySelectorAll('option:checked'),0).map(function(v){return v.value;});if(values.length>1){customValues[fieldID]=values;}else if(values.length===1){customValues[fieldID]=values[0];}else{customValues[fieldID]='';}
break;case'YesNo':customValues[fieldID]=(document.getElementById(fieldID+'_yes').checked)?1:0;break;}}}}
return customValues;};var collateFileUploads=function(){var customFields=document.getElementsByClassName('c-share-form--row');var uploads=[];for(var i=0;i<customFields.length;i++){var fieldID=customFields[i].getElementsByTagName('label')[0].getAttribute('for');if(fieldID!==null){if(customFields[i].getAttribute('data-field-type')==='Upload'){var fileCount=document.getElementById(fieldID).files.length;if(fileCount>1){uploads[fieldID]=[];for(var j=0;j<fileCount;j++){uploads[fieldID].push(document.getElementById(fieldID).files[j]);}}else{uploads[fieldID]=document.getElementById(fieldID).files[0];}}}}
return uploads;};var showErrorMessage=function(){var errorMsg=document.getElementsByClassName(' js_error_msg')[0];show(errorMsg);scrollToY(0,1500);};var hideErrorMessage=function(){var errorMsg=document.getElementsByClassName(' js_error_msg')[0];hide(errorMsg);};var disableSubmitButton=function(btn){addClass(btn,'c-share-button--submit-loading');btn.setAttribute('disabled','disabled');btn.innerText='';var spinner=document.createElement('span');addClass(spinner,'c-share-button--submit-loading-spinner');btn.appendChild(spinner);};var enableSubmitButton=function(btn){removeClass(btn,'c-share-button--submit-loading');btn.removeAttribute('disabled');btn.removeChild(btn.childNodes[0]);btn.innerText='Submit';};var submitForm=function(submitBtn){disableSubmitButton(submitBtn);var articleType=getInputFieldValue('article-type'),contentType=getInputFieldValue('content-type'),categoryID=getSelectedCategoryID(),tags=getTagSelections(false),customValues=collateCustomFieldValues(),fileUploads=collateFileUploads(),authorVisibility=document.querySelector('input[name="author-visibility"]:checked').value;var request=superagent.post('/share/submit/post').auth('brew','fancyabrew').field('article-type',articleType).field('content-type',contentType).field('category',categoryID).field('tags',tags).field('author-visibility',authorVisibility);for(var key in customValues){if(customValues.hasOwnProperty(key)){if(Array.isArray(customValues[key])){request.field(key+'[]',customValues[key]);}else{request.field(key,customValues[key]);}}}
for(var file in fileUploads){if(fileUploads.hasOwnProperty(file)){if(Array.isArray(fileUploads[file])){for(var i=0;i<fileUploads[file].length;i++){request.attach(file+'[]',fileUploads[file][i]);}}else{request.attach(file,fileUploads[file]);}}}
var success=function(response){if(response.status===201){document.body.innerHTML+='<form id="dynForm" action="/share/thanks" method="post">'+'<input type="hidden" name="ref" value="'+response.body.data.ref+'"></form>';document.getElementById('dynForm').submit();}else{showErrorMessage();enableSubmitButton(submitBtn);}};var failure=function(){showErrorMessage();enableSubmitButton(submitBtn);};request.then(success,failure);};var setWYSIWYGhiddenInput=function(editor){var editorID=editor.closest('.js_editor').getAttribute('id');editorID=editorID.substr(0,editorID.lastIndexOf('_'));var editorHTML=editor.innerHTML;if(editorHTML==='<p><br></p>'){editorHTML='';}
document.getElementById(editorID).value=editorHTML;};var setWYSIWYGvalues=function(){var editors=document.getElementsByClassName('ql-editor');for(var i=0;i<editors.length;i++){setWYSIWYGhiddenInput(editors[i]);}};var clickSubmit=function(event){event.preventDefault();hideErrorMessage();setWYSIWYGvalues();if(formValidation.validate()){submitForm(event.currentTarget);}};var initSubmitButton=function(){var submitButton=document.querySelector('.js_submit');submitButton.addEventListener('click',clickSubmit);};var editorOnFocusOut=function(event){setWYSIWYGhiddenInput(event.target);formValidation.validate();};var initEditors=function(){var editors=document.querySelectorAll('.js_editor');for(var i=0;i<editors.length;i++){var quillEditor=new Quill('#'+editors[i].getAttribute('id'),{theme:'snow'});quillEditor.root.addEventListener('focusout',editorOnFocusOut);}};var initDatepickers=function(){var pickers=document.querySelectorAll('.js_datepicker');for(var i=0;i<pickers.length;i++){new Pikaday({field:pickers[i],format:'YYYY/M/D',toString(date,format){var day=date.getDate(),month=(date.getMonth()+1),year=date.getFullYear();return`${year}/${month}/${day}`;},parse(dateString,format){var parts=dateString.split('/'),year=parseInt(parts[0],10),month=(parseInt(parts[1],10)-1),day=parseInt(parts[2],10);return new Date(year,month,day);}});}};var removeTooltipMessage=function(tooltipMsg,btn,optionText,standalone){if(standalone){removeClass(tooltipMsg,'c-share-section--tooltip-message-show');}else{removeClass(tooltipMsg,'c-share-option--tooltip-message-show');}
tooltipMsg.setAttribute('tabindex',-1);tooltipMsg.setAttribute('aria-hidden',true);if(standalone){btn.setAttribute('aria-label',optionText);}else{btn.setAttribute('aria-label','Open '+optionText+' information');}};var showTooltipMessage=function(tooltipMsg,btn,optionText,standalone){if(standalone){addClass(tooltipMsg,'c-share-section--tooltip-message-show');}else{addClass(tooltipMsg,'c-share-option--tooltip-message-show');}
tooltipMsg.setAttribute('tabindex',0);tooltipMsg.setAttribute('aria-hidden',false);if(standalone){btn.setAttribute('aria-label',optionText);}else{btn.setAttribute('aria-label','Close '+optionText+' information');}};var clickOptionToolTip=function(event){var btn=event.currentTarget,btnID=btn.getAttribute('id'),tooltipMsg=btn.parentElement.getElementsByClassName('c-share-option--tooltip-message')[0],optionText=btn.closest('.c-share-option--link-holder').getElementsByTagName('button')[0].textContent,currentlyOpen=document.querySelector('.c-share-option--tooltip-message-show');if(currentlyOpen!==null){var currentID=currentlyOpen.parentElement.getElementsByTagName('button')[0].getAttribute('id');if(currentID!==btnID){removeClass(currentlyOpen,'c-share-option--tooltip-message-show')}}
if(hasClass(tooltipMsg,'c-share-option--tooltip-message-show')){removeTooltipMessage(tooltipMsg,btn,optionText,false);}else{showTooltipMessage(tooltipMsg,btn,optionText,false);}};var clickStandaloneOptionToolTip=function(event){var btn=event.currentTarget,btnID=btn.getAttribute('id'),tooltipMsg=btn.parentElement.getElementsByClassName('c-share-section--tooltip-message')[0],optionText=btn.getAttribute('aria-label'),currentlyOpen=document.querySelector('.c-share-section--tooltip-message-show');if(optionText.indexOf('Show')===0){optionText=optionText.replace('Show','Hide');}else{optionText=optionText.replace('Hide','Show');}
if(currentlyOpen!==null){var currentID=currentlyOpen.parentElement.getElementsByTagName('button')[0].getAttribute('id');if(currentID!==btnID){removeClass(currentlyOpen,'c-share-section--tooltip-message-show')}}
if(hasClass(tooltipMsg,'c-share-section--tooltip-message-show')){removeTooltipMessage(tooltipMsg,btn,optionText,true);}else{showTooltipMessage(tooltipMsg,btn,optionText,true);}};var initOptionToolTips=function(){var tooltipBtns=document.querySelectorAll('.c-share-option--tooltip');for(var i=0;i<tooltipBtns.length;i++){tooltipBtns[i].addEventListener('click',clickOptionToolTip);}};var initStandaloneToolTips=function(){var tooltipBtns=document.querySelectorAll('.c-share-section--tooltip');for(var i=0;i<tooltipBtns.length;i++){tooltipBtns[i].addEventListener('click',clickStandaloneOptionToolTip);}};var activateDisableCategoryContinueButton=function(){var btn=document.querySelector('#Category_Continue'),hiddenInput=document.querySelector('.ipsSelectTree input[type="hidden"]').value;if(hiddenInput!==''){addClass(btn,'c-share-button--submit');btn.removeAttribute('disabled')}else{removeClass(btn,'c-share-button--submit');btn.setAttribute('disabled','disabled');}};var getTypeaheadInputValue=function(hiddenInput){selectedCategory=document.querySelector('.tt-cursor');selectedCategoryID=selectedCategory.getAttribute('data-category-id');(selectedCategory!==null)?hiddenInput.value=selectedCategoryID:'';};var initCategoryDropdown=function(){jQuery(".ipsSelectTree").on("click",".ipsSelectTree_item",function(){setTimeout(function(){activateDisableCategoryContinueButton();},250);document.querySelector('.tt-input').value='';});};var initTypeahead=function(){var mySource=new Bloodhound({datumTokenizer:function(d){return Bloodhound.tokenizers.whitespace(d.name);},queryTokenizer:Bloodhound.tokenizers.whitespace,prefetch:{url:'/applications/pslshare/data/categories.json',ttl:60*60*6}});mySource.initialize();jQuery('.typeahead').typeahead({highlight:true},{displayKey:'name',source:mySource.ttAdapter(),templates:{suggestion:Handlebars.compile('<div data-category-id="{{ catID }}">{{ name }}</div>')}});var typeaheadInput=document.querySelector('.tt-input'),hiddenInput=document.querySelector('.ipsSelectTree input[type="hidden"]');typeaheadInput.addEventListener('keyup',function(event){var suggestions=document.querySelectorAll('.tt-suggestion');resetCategorySelection();if(this.value===''){hiddenInput.value='';}
for(var i=0;i<suggestions.length;i++){var suggestion=suggestions[i];suggestion.addEventListener('click',function(){hiddenInput.value=this.getAttribute('data-category-id');activateDisableCategoryContinueButton();});}
switch(event.keyCode){case 40:getTypeaheadInputValue(hiddenInput);break;case 38:getTypeaheadInputValue(hiddenInput);break;case 39:var suggestion=document.querySelector('.tt-dataset').firstChild;if(suggestion!==null){hiddenInput.value=suggestion.getAttribute('data-category-id');}
break;}
activateDisableCategoryContinueButton();});};var addActiveStateToSelectedVisibilityOption=function(authorSelection){var selection=authorSelection;removeClass(selection.parentNode.parentNode,'c-share-form--author-row-active');if(selection.checked){addClass(selection.parentNode.parentNode,'c-share-form--author-row-active');}};var initAuthorSelection=function(){var authorSelections=document.querySelectorAll('.c-share-form--author-row input');for(var i=0;i<authorSelections.length;i++){var selection=authorSelections[i];addActiveStateToSelectedVisibilityOption(selection);selection.addEventListener('change',function(){for(var i=0;i<authorSelections.length;i++){var selection=authorSelections[i];addActiveStateToSelectedVisibilityOption(selection);}});}};var removeTagValueFromHiddenInput=function(tagValue){var hiddenTagsInput=document.querySelector('input[name="tags"]');hiddenTagsInput.value=hiddenTagsInput.value.replace(tagValue+',','');};var initDeleteTagButtons=function(){var deleteTagButtons=document.querySelectorAll('.cToken_close');for(var i=0;i<deleteTagButtons.length;i++){var btn=deleteTagButtons[i];btn.addEventListener('click',function(){this.parentNode.remove();removeTagValueFromHiddenInput(this.parentNode.getAttribute('data-value'));});}};var clearTagsSearchInput=function(){var tagsSearch=document.querySelector('input[name="tagsSearch"]');tagsSearch.value="";};var addTagToHiddenField=function(value){var tagsHiddenField=document.querySelector('input[name="tags"]');if(value.slice(-2)===', '){tagsHiddenField.value+=value.slice(0,-1);}else{tagsHiddenField.value+=value+',';}};var createVisualTag=function(tagTextValue){var tagText;if(tagTextValue.slice(-2)===', '){tagText=tagTextValue.slice(0,-2);}else{tagText=tagTextValue;}
const tagList=document.querySelector(".js-tag-list");tagList.innerHTML+="<li class='cToken' data-value='"+tagText+"'>"+tagText+"<span class='cToken_close' data-action='delete'>×</span></li>";initDeleteTagButtons();};var CheckIfTagExists=function(value){var allTags=document.querySelectorAll('option[data-tag-value]');var arr=[];for(var i=0;i<allTags.length;i++){var option=allTags[i];arr.push(option.getAttribute('data-tag-value'));}
var tagValue;if(value.slice(-2)===', '){tagValue=value.slice(0,-2);}else{tagValue=value;}
if(arr.indexOf(tagValue)>-1){addTagToHiddenField(value);createVisualTag(value);}
setTimeout(function(){clearTagsSearchInput();},250);};var initTagResultsDropdown=function(){var results=document.querySelectorAll('.js-tag-result');for(var i=0;i<results.length;i++){var result=results[i];result.addEventListener('click',function(){var resultValue=this.getAttribute('data-tag');addTagToHiddenField(resultValue);createVisualTag(resultValue);setTimeout(function(){clearTagsSearchInput();},250);});}};var initTags=function(){window.addEventListener("DOMContentLoaded",()=>{let autoCompleteTagInput=document.querySelector(".js-tag-input");const tagSearch=new Awesomplete(autoCompleteTagInput,{list:"#tagsets",filter:function(text,input){return Awesomplete.FILTER_CONTAINS(text,input.match(/[^,]*$/)[0]);},item:function(text,input){return Awesomplete.ITEM(text,input.match(/[^,]*$/)[0]);},replace:function(text){var before=this.input.value.match(/^.+,\s*|/)[0];this.input.value=before+text+", ";}});autoCompleteTagInput.addEventListener("keyup",(e)=>{if(e.keyCode===13||e.which===13){e.preventDefault();CheckIfTagExists(autoCompleteTagInput.value);}});autoCompleteTagInput.addEventListener("input",()=>{initTagResultsDropdown();});});const tags=document.querySelectorAll('.js-tag');tags.forEach(function(tag){tag.addEventListener("click",(event)=>{let tagText=event.srcElement.innerHTML;let tagValue=tag.getAttribute('data-tag-value');addTagToHiddenField(tagValue);createVisualTag(tagValue);});});var tagListToggleButtons=document.querySelectorAll('.js-tags-list-toggle');for(var i=0;i<tagListToggleButtons.length;i++){var btn=tagListToggleButtons[i];btn.addEventListener('click',function(){var holder=this.parentNode.nextElementSibling;holder.classList.toggle('c-share--tags-list-show');(holder.classList.contains('c-share--tags-list-show'))?this.innerHTML="[Hide]":this.innerHTML="[Show]";});}
var tagsContinueBtn=document.querySelector('.c-share-tags-continue');tagsContinueBtn.addEventListener('click',function(){var tagsSelection=(getTagSelections(true).length>0)?tagsSelection=getTagSelections(true):tagsSelection='No tags selected';updateSelection(4,tagsSelection);navigateToStage(5);updateProgressBar();});};var initPanels=function(){navigateToStage(1);initOptions();initContinueButton();initCancelButton();initSubmitButton();initEditors();initDatepickers();initTags();initOptionToolTips();initStandaloneToolTips();initTypeahead();initAuthorSelection();initCategoryDropdown();};docReady(function(){initPanels();});;
(function(root,factory){if(typeof define==="function"&&define.amd){define("bloodhound",["jquery"],function(a0){return root["Bloodhound"]=factory(a0);});}else if(typeof exports==="object"){module.exports=factory(require("jquery"));}else{root["Bloodhound"]=factory(jQuery);}})(this,function($){var _=function(){"use strict";return{isMsie:function(){return /(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:false;},isBlankString:function(str){return!str||/^\s*$/.test(str);},escapeRegExChars:function(str){return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");},isString:function(obj){return typeof obj==="string";},isNumber:function(obj){return typeof obj==="number";},isArray:$.isArray,isFunction:$.isFunction,isObject:$.isPlainObject,isUndefined:function(obj){return typeof obj==="undefined";},isElement:function(obj){return!!(obj&&obj.nodeType===1);},isJQuery:function(obj){return obj instanceof $;},toStr:function toStr(s){return _.isUndefined(s)||s===null?"":s+"";},bind:$.proxy,each:function(collection,cb){$.each(collection,reverseArgs);function reverseArgs(index,value){return cb(value,index);}},map:$.map,filter:$.grep,every:function(obj,test){var result=true;if(!obj){return result;}
$.each(obj,function(key,val){if(!(result=test.call(null,val,key,obj))){return false;}});return!!result;},some:function(obj,test){var result=false;if(!obj){return result;}
$.each(obj,function(key,val){if(result=test.call(null,val,key,obj)){return false;}});return!!result;},mixin:$.extend,identity:function(x){return x;},clone:function(obj){return $.extend(true,{},obj);},getIdGenerator:function(){var counter=0;return function(){return counter++;};},templatify:function templatify(obj){return $.isFunction(obj)?obj:template;function template(){return String(obj);}},defer:function(fn){setTimeout(fn,0);},debounce:function(func,wait,immediate){var timeout,result;return function(){var context=this,args=arguments,later,callNow;later=function(){timeout=null;if(!immediate){result=func.apply(context,args);}};callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow){result=func.apply(context,args);}
return result;};},throttle:function(func,wait){var context,args,timeout,result,previous,later;previous=0;later=function(){previous=new Date();timeout=null;result=func.apply(context,args);};return function(){var now=new Date(),remaining=wait-(now-previous);context=this;args=arguments;if(remaining<=0){clearTimeout(timeout);timeout=null;previous=now;result=func.apply(context,args);}else if(!timeout){timeout=setTimeout(later,remaining);}
return result;};},stringify:function(val){return _.isString(val)?val:JSON.stringify(val);},noop:function(){}};}();var VERSION="0.11.1";var tokenizers=function(){"use strict";return{nonword:nonword,whitespace:whitespace,obj:{nonword:getObjTokenizer(nonword),whitespace:getObjTokenizer(whitespace)}};function whitespace(str){str=_.toStr(str);return str?str.split(/\s+/):[];}
function nonword(str){str=_.toStr(str);return str?str.split(/\W+/):[];}
function getObjTokenizer(tokenizer){return function setKey(keys){keys=_.isArray(keys)?keys:[].slice.call(arguments,0);return function tokenize(o){var tokens=[];_.each(keys,function(k){tokens=tokens.concat(tokenizer(_.toStr(o[k])));});return tokens;};};}}();var LruCache=function(){"use strict";function LruCache(maxSize){this.maxSize=_.isNumber(maxSize)?maxSize:100;this.reset();if(this.maxSize<=0){this.set=this.get=$.noop;}}
_.mixin(LruCache.prototype,{set:function set(key,val){var tailItem=this.list.tail,node;if(this.size>=this.maxSize){this.list.remove(tailItem);delete this.hash[tailItem.key];this.size--;}
if(node=this.hash[key]){node.val=val;this.list.moveToFront(node);}else{node=new Node(key,val);this.list.add(node);this.hash[key]=node;this.size++;}},get:function get(key){var node=this.hash[key];if(node){this.list.moveToFront(node);return node.val;}},reset:function reset(){this.size=0;this.hash={};this.list=new List();}});function List(){this.head=this.tail=null;}
_.mixin(List.prototype,{add:function add(node){if(this.head){node.next=this.head;this.head.prev=node;}
this.head=node;this.tail=this.tail||node;},remove:function remove(node){node.prev?node.prev.next=node.next:this.head=node.next;node.next?node.next.prev=node.prev:this.tail=node.prev;},moveToFront:function(node){this.remove(node);this.add(node);}});function Node(key,val){this.key=key;this.val=val;this.prev=this.next=null;}
return LruCache;}();var PersistentStorage=function(){"use strict";var LOCAL_STORAGE;try{LOCAL_STORAGE=window.localStorage;LOCAL_STORAGE.setItem("~~~","!");LOCAL_STORAGE.removeItem("~~~");}catch(err){LOCAL_STORAGE=null;}
function PersistentStorage(namespace,override){this.prefix=["__",namespace,"__"].join("");this.ttlKey="__ttl__";this.keyMatcher=new RegExp("^"+_.escapeRegExChars(this.prefix));this.ls=override||LOCAL_STORAGE;!this.ls&&this._noop();}
_.mixin(PersistentStorage.prototype,{_prefix:function(key){return this.prefix+key;},_ttlKey:function(key){return this._prefix(key)+this.ttlKey;},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=_.noop;},_safeSet:function(key,val){try{this.ls.setItem(key,val);}catch(err){if(err.name==="QuotaExceededError"){this.clear();this._noop();}}},get:function(key){if(this.isExpired(key)){this.remove(key);}
return decode(this.ls.getItem(this._prefix(key)));},set:function(key,val,ttl){if(_.isNumber(ttl)){this._safeSet(this._ttlKey(key),encode(now()+ttl));}else{this.ls.removeItem(this._ttlKey(key));}
return this._safeSet(this._prefix(key),encode(val));},remove:function(key){this.ls.removeItem(this._ttlKey(key));this.ls.removeItem(this._prefix(key));return this;},clear:function(){var i,keys=gatherMatchingKeys(this.keyMatcher);for(i=keys.length;i--;){this.remove(keys[i]);}
return this;},isExpired:function(key){var ttl=decode(this.ls.getItem(this._ttlKey(key)));return _.isNumber(ttl)&&now()>ttl?true:false;}});return PersistentStorage;function now(){return new Date().getTime();}
function encode(val){return JSON.stringify(_.isUndefined(val)?null:val);}
function decode(val){return $.parseJSON(val);}
function gatherMatchingKeys(keyMatcher){var i,key,keys=[],len=LOCAL_STORAGE.length;for(i=0;i<len;i++){if((key=LOCAL_STORAGE.key(i)).match(keyMatcher)){keys.push(key.replace(keyMatcher,""));}}
return keys;}}();var Transport=function(){"use strict";var pendingRequestsCount=0,pendingRequests={},maxPendingRequests=6,sharedCache=new LruCache(10);function Transport(o){o=o||{};this.cancelled=false;this.lastReq=null;this._send=o.transport;this._get=o.limiter?o.limiter(this._get):this._get;this._cache=o.cache===false?new LruCache(0):sharedCache;}
Transport.setMaxPendingRequests=function setMaxPendingRequests(num){maxPendingRequests=num;};Transport.resetCache=function resetCache(){sharedCache.reset();};_.mixin(Transport.prototype,{_fingerprint:function fingerprint(o){o=o||{};return o.url+o.type+$.param(o.data||{});},_get:function(o,cb){var that=this,fingerprint,jqXhr;fingerprint=this._fingerprint(o);if(this.cancelled||fingerprint!==this.lastReq){return;}
if(jqXhr=pendingRequests[fingerprint]){jqXhr.done(done).fail(fail);}else if(pendingRequestsCount<maxPendingRequests){pendingRequestsCount++;pendingRequests[fingerprint]=this._send(o).done(done).fail(fail).always(always);}else{this.onDeckRequestArgs=[].slice.call(arguments,0);}
function done(resp){cb(null,resp);that._cache.set(fingerprint,resp);}
function fail(){cb(true);}
function always(){pendingRequestsCount--;delete pendingRequests[fingerprint];if(that.onDeckRequestArgs){that._get.apply(that,that.onDeckRequestArgs);that.onDeckRequestArgs=null;}}},get:function(o,cb){var resp,fingerprint;cb=cb||$.noop;o=_.isString(o)?{url:o}:o||{};fingerprint=this._fingerprint(o);this.cancelled=false;this.lastReq=fingerprint;if(resp=this._cache.get(fingerprint)){cb(null,resp);}else{this._get(o,cb);}},cancel:function(){this.cancelled=true;}});return Transport;}();var SearchIndex=window.SearchIndex=function(){"use strict";var CHILDREN="c",IDS="i";function SearchIndex(o){o=o||{};if(!o.datumTokenizer||!o.queryTokenizer){$.error("datumTokenizer and queryTokenizer are both required");}
this.identify=o.identify||_.stringify;this.datumTokenizer=o.datumTokenizer;this.queryTokenizer=o.queryTokenizer;this.reset();}
_.mixin(SearchIndex.prototype,{bootstrap:function bootstrap(o){this.datums=o.datums;this.trie=o.trie;},add:function(data){var that=this;data=_.isArray(data)?data:[data];_.each(data,function(datum){var id,tokens;that.datums[id=that.identify(datum)]=datum;tokens=normalizeTokens(that.datumTokenizer(datum));_.each(tokens,function(token){var node,chars,ch;node=that.trie;chars=token.split("");while(ch=chars.shift()){node=node[CHILDREN][ch]||(node[CHILDREN][ch]=newNode());node[IDS].push(id);}});});},get:function get(ids){var that=this;return _.map(ids,function(id){return that.datums[id];});},search:function search(query){var that=this,tokens,matches;tokens=normalizeTokens(this.queryTokenizer(query));_.each(tokens,function(token){var node,chars,ch,ids;if(matches&&matches.length===0){return false;}
node=that.trie;chars=token.split("");while(node&&(ch=chars.shift())){node=node[CHILDREN][ch];}
if(node&&chars.length===0){ids=node[IDS].slice(0);matches=matches?getIntersection(matches,ids):ids;}else{matches=[];return false;}});return matches?_.map(unique(matches),function(id){return that.datums[id];}):[];},all:function all(){var values=[];for(var key in this.datums){values.push(this.datums[key]);}
return values;},reset:function reset(){this.datums={};this.trie=newNode();},serialize:function serialize(){return{datums:this.datums,trie:this.trie};}});return SearchIndex;function normalizeTokens(tokens){tokens=_.filter(tokens,function(token){return!!token;});tokens=_.map(tokens,function(token){return token.toLowerCase();});return tokens;}
function newNode(){var node={};node[IDS]=[];node[CHILDREN]={};return node;}
function unique(array){var seen={},uniques=[];for(var i=0,len=array.length;i<len;i++){if(!seen[array[i]]){seen[array[i]]=true;uniques.push(array[i]);}}
return uniques;}
function getIntersection(arrayA,arrayB){var ai=0,bi=0,intersection=[];arrayA=arrayA.sort();arrayB=arrayB.sort();var lenArrayA=arrayA.length,lenArrayB=arrayB.length;while(ai<lenArrayA&&bi<lenArrayB){if(arrayA[ai]<arrayB[bi]){ai++;}else if(arrayA[ai]>arrayB[bi]){bi++;}else{intersection.push(arrayA[ai]);ai++;bi++;}}
return intersection;}}();var Prefetch=function(){"use strict";var keys;keys={data:"data",protocol:"protocol",thumbprint:"thumbprint"};function Prefetch(o){this.url=o.url;this.ttl=o.ttl;this.cache=o.cache;this.prepare=o.prepare;this.transform=o.transform;this.transport=o.transport;this.thumbprint=o.thumbprint;this.storage=new PersistentStorage(o.cacheKey);}
_.mixin(Prefetch.prototype,{_settings:function settings(){return{url:this.url,type:"GET",dataType:"json"};},store:function store(data){if(!this.cache){return;}
this.storage.set(keys.data,data,this.ttl);this.storage.set(keys.protocol,location.protocol,this.ttl);this.storage.set(keys.thumbprint,this.thumbprint,this.ttl);},fromCache:function fromCache(){var stored={},isExpired;if(!this.cache){return null;}
stored.data=this.storage.get(keys.data);stored.protocol=this.storage.get(keys.protocol);stored.thumbprint=this.storage.get(keys.thumbprint);isExpired=stored.thumbprint!==this.thumbprint||stored.protocol!==location.protocol;return stored.data&&!isExpired?stored.data:null;},fromNetwork:function(cb){var that=this,settings;if(!cb){return;}
settings=this.prepare(this._settings());this.transport(settings).fail(onError).done(onResponse);function onError(){cb(true);}
function onResponse(resp){cb(null,that.transform(resp));}},clear:function clear(){this.storage.clear();return this;}});return Prefetch;}();var Remote=function(){"use strict";function Remote(o){this.url=o.url;this.prepare=o.prepare;this.transform=o.transform;this.transport=new Transport({cache:o.cache,limiter:o.limiter,transport:o.transport});}
_.mixin(Remote.prototype,{_settings:function settings(){return{url:this.url,type:"GET",dataType:"json"};},get:function get(query,cb){var that=this,settings;if(!cb){return;}
query=query||"";settings=this.prepare(query,this._settings());return this.transport.get(settings,onResponse);function onResponse(err,resp){err?cb([]):cb(that.transform(resp));}},cancelLastRequest:function cancelLastRequest(){this.transport.cancel();}});return Remote;}();var oParser=function(){"use strict";return function parse(o){var defaults,sorter;defaults={initialize:true,identify:_.stringify,datumTokenizer:null,queryTokenizer:null,sufficient:5,sorter:null,local:[],prefetch:null,remote:null};o=_.mixin(defaults,o||{});!o.datumTokenizer&&$.error("datumTokenizer is required");!o.queryTokenizer&&$.error("queryTokenizer is required");sorter=o.sorter;o.sorter=sorter?function(x){return x.sort(sorter);}:_.identity;o.local=_.isFunction(o.local)?o.local():o.local;o.prefetch=parsePrefetch(o.prefetch);o.remote=parseRemote(o.remote);return o;};function parsePrefetch(o){var defaults;if(!o){return null;}
defaults={url:null,ttl:24*60*60*1e3,cache:true,cacheKey:null,thumbprint:"",prepare:_.identity,transform:_.identity,transport:null};o=_.isString(o)?{url:o}:o;o=_.mixin(defaults,o);!o.url&&$.error("prefetch requires url to be set");o.transform=o.filter||o.transform;o.cacheKey=o.cacheKey||o.url;o.thumbprint=VERSION+o.thumbprint;o.transport=o.transport?callbackToDeferred(o.transport):$.ajax;return o;}
function parseRemote(o){var defaults;if(!o){return;}
defaults={url:null,cache:true,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:"debounce",rateLimitWait:300,transform:_.identity,transport:null};o=_.isString(o)?{url:o}:o;o=_.mixin(defaults,o);!o.url&&$.error("remote requires url to be set");o.transform=o.filter||o.transform;o.prepare=toRemotePrepare(o);o.limiter=toLimiter(o);o.transport=o.transport?callbackToDeferred(o.transport):$.ajax;delete o.replace;delete o.wildcard;delete o.rateLimitBy;delete o.rateLimitWait;return o;}
function toRemotePrepare(o){var prepare,replace,wildcard;prepare=o.prepare;replace=o.replace;wildcard=o.wildcard;if(prepare){return prepare;}
if(replace){prepare=prepareByReplace;}else if(o.wildcard){prepare=prepareByWildcard;}else{prepare=idenityPrepare;}
return prepare;function prepareByReplace(query,settings){settings.url=replace(settings.url,query);return settings;}
function prepareByWildcard(query,settings){settings.url=settings.url.replace(wildcard,encodeURIComponent(query));return settings;}
function idenityPrepare(query,settings){return settings;}}
function toLimiter(o){var limiter,method,wait;limiter=o.limiter;method=o.rateLimitBy;wait=o.rateLimitWait;if(!limiter){limiter=/^throttle$/i.test(method)?throttle(wait):debounce(wait);}
return limiter;function debounce(wait){return function debounce(fn){return _.debounce(fn,wait);};}
function throttle(wait){return function throttle(fn){return _.throttle(fn,wait);};}}
function callbackToDeferred(fn){return function wrapper(o){var deferred=$.Deferred();fn(o,onSuccess,onError);return deferred;function onSuccess(resp){_.defer(function(){deferred.resolve(resp);});}
function onError(err){_.defer(function(){deferred.reject(err);});}};}}();var Bloodhound=function(){"use strict";var old;old=window&&window.Bloodhound;function Bloodhound(o){o=oParser(o);this.sorter=o.sorter;this.identify=o.identify;this.sufficient=o.sufficient;this.local=o.local;this.remote=o.remote?new Remote(o.remote):null;this.prefetch=o.prefetch?new Prefetch(o.prefetch):null;this.index=new SearchIndex({identify:this.identify,datumTokenizer:o.datumTokenizer,queryTokenizer:o.queryTokenizer});o.initialize!==false&&this.initialize();}
Bloodhound.noConflict=function noConflict(){window&&(window.Bloodhound=old);return Bloodhound;};Bloodhound.tokenizers=tokenizers;_.mixin(Bloodhound.prototype,{__ttAdapter:function ttAdapter(){var that=this;return this.remote?withAsync:withoutAsync;function withAsync(query,sync,async){return that.search(query,sync,async);}
function withoutAsync(query,sync){return that.search(query,sync);}},_loadPrefetch:function loadPrefetch(){var that=this,deferred,serialized;deferred=$.Deferred();if(!this.prefetch){deferred.resolve();}else if(serialized=this.prefetch.fromCache()){this.index.bootstrap(serialized);deferred.resolve();}else{this.prefetch.fromNetwork(done);}
return deferred.promise();function done(err,data){if(err){return deferred.reject();}
that.add(data);that.prefetch.store(that.index.serialize());deferred.resolve();}},_initialize:function initialize(){var that=this,deferred;this.clear();(this.initPromise=this._loadPrefetch()).done(addLocalToIndex);return this.initPromise;function addLocalToIndex(){that.add(that.local);}},initialize:function initialize(force){return!this.initPromise||force?this._initialize():this.initPromise;},add:function add(data){this.index.add(data);return this;},get:function get(ids){ids=_.isArray(ids)?ids:[].slice.call(arguments);return this.index.get(ids);},search:function search(query,sync,async){var that=this,local;local=this.sorter(this.index.search(query));sync(this.remote?local.slice():local);if(this.remote&&local.length<this.sufficient){this.remote.get(query,processRemote);}else if(this.remote){this.remote.cancelLastRequest();}
return this;function processRemote(remote){var nonDuplicates=[];_.each(remote,function(r){!_.some(local,function(l){return that.identify(r)===that.identify(l);})&&nonDuplicates.push(r);});async&&async(nonDuplicates);}},all:function all(){return this.index.all();},clear:function clear(){this.index.reset();return this;},clearPrefetchCache:function clearPrefetchCache(){this.prefetch&&this.prefetch.clear();return this;},clearRemoteCache:function clearRemoteCache(){Transport.resetCache();return this;},ttAdapter:function ttAdapter(){return this.__ttAdapter();}});return Bloodhound;}();return Bloodhound;});(function(root,factory){if(typeof define==="function"&&define.amd){define("typeahead.js",["jquery"],function(a0){return factory(a0);});}else if(typeof exports==="object"){module.exports=factory(require("jquery"));}else{factory(jQuery);}})(this,function($){var _=function(){"use strict";return{isMsie:function(){return /(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:false;},isBlankString:function(str){return!str||/^\s*$/.test(str);},escapeRegExChars:function(str){return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");},isString:function(obj){return typeof obj==="string";},isNumber:function(obj){return typeof obj==="number";},isArray:$.isArray,isFunction:$.isFunction,isObject:$.isPlainObject,isUndefined:function(obj){return typeof obj==="undefined";},isElement:function(obj){return!!(obj&&obj.nodeType===1);},isJQuery:function(obj){return obj instanceof $;},toStr:function toStr(s){return _.isUndefined(s)||s===null?"":s+"";},bind:$.proxy,each:function(collection,cb){$.each(collection,reverseArgs);function reverseArgs(index,value){return cb(value,index);}},map:$.map,filter:$.grep,every:function(obj,test){var result=true;if(!obj){return result;}
$.each(obj,function(key,val){if(!(result=test.call(null,val,key,obj))){return false;}});return!!result;},some:function(obj,test){var result=false;if(!obj){return result;}
$.each(obj,function(key,val){if(result=test.call(null,val,key,obj)){return false;}});return!!result;},mixin:$.extend,identity:function(x){return x;},clone:function(obj){return $.extend(true,{},obj);},getIdGenerator:function(){var counter=0;return function(){return counter++;};},templatify:function templatify(obj){return $.isFunction(obj)?obj:template;function template(){return String(obj);}},defer:function(fn){setTimeout(fn,0);},debounce:function(func,wait,immediate){var timeout,result;return function(){var context=this,args=arguments,later,callNow;later=function(){timeout=null;if(!immediate){result=func.apply(context,args);}};callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow){result=func.apply(context,args);}
return result;};},throttle:function(func,wait){var context,args,timeout,result,previous,later;previous=0;later=function(){previous=new Date();timeout=null;result=func.apply(context,args);};return function(){var now=new Date(),remaining=wait-(now-previous);context=this;args=arguments;if(remaining<=0){clearTimeout(timeout);timeout=null;previous=now;result=func.apply(context,args);}else if(!timeout){timeout=setTimeout(later,remaining);}
return result;};},stringify:function(val){return _.isString(val)?val:JSON.stringify(val);},noop:function(){}};}();var WWW=function(){"use strict";var defaultClassNames={wrapper:"twitter-typeahead",input:"tt-input",hint:"tt-hint",menu:"tt-menu",dataset:"tt-dataset",suggestion:"tt-suggestion",selectable:"tt-selectable",empty:"tt-empty",open:"tt-open",cursor:"tt-cursor",highlight:"tt-highlight"};return build;function build(o){var www,classes;classes=_.mixin({},defaultClassNames,o);www={css:buildCss(),classes:classes,html:buildHtml(classes),selectors:buildSelectors(classes)};return{css:www.css,html:www.html,classes:www.classes,selectors:www.selectors,mixin:function(o){_.mixin(o,www);}};}
function buildHtml(c){return{wrapper:'<span class="'+c.wrapper+'"></span>',menu:'<div class="'+c.menu+'"></div>'};}
function buildSelectors(classes){var selectors={};_.each(classes,function(v,k){selectors[k]="."+v;});return selectors;}
function buildCss(){var css={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},menu:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};if(_.isMsie()){_.mixin(css.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"});}
return css;}}();var EventBus=function(){"use strict";var namespace,deprecationMap;namespace="typeahead:";deprecationMap={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"};function EventBus(o){if(!o||!o.el){$.error("EventBus initialized without el");}
this.$el=$(o.el);}
_.mixin(EventBus.prototype,{_trigger:function(type,args){var $e;$e=$.Event(namespace+type);(args=args||[]).unshift($e);this.$el.trigger.apply(this.$el,args);return $e;},before:function(type){var args,$e;args=[].slice.call(arguments,1);$e=this._trigger("before"+type,args);return $e.isDefaultPrevented();},trigger:function(type){var deprecatedType;this._trigger(type,[].slice.call(arguments,1));if(deprecatedType=deprecationMap[type]){this._trigger(deprecatedType,[].slice.call(arguments,1));}}});return EventBus;}();var EventEmitter=function(){"use strict";var splitter=/\s+/,nextTick=getNextTick();return{onSync:onSync,onAsync:onAsync,off:off,trigger:trigger};function on(method,types,cb,context){var type;if(!cb){return this;}
types=types.split(splitter);cb=context?bindContext(cb,context):cb;this._callbacks=this._callbacks||{};while(type=types.shift()){this._callbacks[type]=this._callbacks[type]||{sync:[],async:[]};this._callbacks[type][method].push(cb);}
return this;}
function onAsync(types,cb,context){return on.call(this,"async",types,cb,context);}
function onSync(types,cb,context){return on.call(this,"sync",types,cb,context);}
function off(types){var type;if(!this._callbacks){return this;}
types=types.split(splitter);while(type=types.shift()){delete this._callbacks[type];}
return this;}
function trigger(types){var type,callbacks,args,syncFlush,asyncFlush;if(!this._callbacks){return this;}
types=types.split(splitter);args=[].slice.call(arguments,1);while((type=types.shift())&&(callbacks=this._callbacks[type])){syncFlush=getFlush(callbacks.sync,this,[type].concat(args));asyncFlush=getFlush(callbacks.async,this,[type].concat(args));syncFlush()&&nextTick(asyncFlush);}
return this;}
function getFlush(callbacks,context,args){return flush;function flush(){var cancelled;for(var i=0,len=callbacks.length;!cancelled&&i<len;i+=1){cancelled=callbacks[i].apply(context,args)===false;}
return!cancelled;}}
function getNextTick(){var nextTickFn;if(window.setImmediate){nextTickFn=function nextTickSetImmediate(fn){setImmediate(function(){fn();});};}else{nextTickFn=function nextTickSetTimeout(fn){setTimeout(function(){fn();},0);};}
return nextTickFn;}
function bindContext(fn,context){return fn.bind?fn.bind(context):function(){fn.apply(context,[].slice.call(arguments,0));};}}();var highlight=function(doc){"use strict";var defaults={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:false,caseSensitive:false};return function hightlight(o){var regex;o=_.mixin({},defaults,o);if(!o.node||!o.pattern){return;}
o.pattern=_.isArray(o.pattern)?o.pattern:[o.pattern];regex=getRegex(o.pattern,o.caseSensitive,o.wordsOnly);traverse(o.node,hightlightTextNode);function hightlightTextNode(textNode){var match,patternNode,wrapperNode;if(match=regex.exec(textNode.data)){wrapperNode=doc.createElement(o.tagName);o.className&&(wrapperNode.className=o.className);patternNode=textNode.splitText(match.index);patternNode.splitText(match[0].length);wrapperNode.appendChild(patternNode.cloneNode(true));textNode.parentNode.replaceChild(wrapperNode,patternNode);}
return!!match;}
function traverse(el,hightlightTextNode){var childNode,TEXT_NODE_TYPE=3;for(var i=0;i<el.childNodes.length;i++){childNode=el.childNodes[i];if(childNode.nodeType===TEXT_NODE_TYPE){i+=hightlightTextNode(childNode)?1:0;}else{traverse(childNode,hightlightTextNode);}}}};function getRegex(patterns,caseSensitive,wordsOnly){var escapedPatterns=[],regexStr;for(var i=0,len=patterns.length;i<len;i++){escapedPatterns.push(_.escapeRegExChars(patterns[i]));}
regexStr=wordsOnly?"\\b("+escapedPatterns.join("|")+")\\b":"("+escapedPatterns.join("|")+")";return caseSensitive?new RegExp(regexStr):new RegExp(regexStr,"i");}}(window.document);var Input=function(){"use strict";var specialKeyCodeMap;specialKeyCodeMap={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"};function Input(o,www){o=o||{};if(!o.input){$.error("input is missing");}
www.mixin(this);this.$hint=$(o.hint);this.$input=$(o.input);this.query=this.$input.val();this.queryWhenFocused=this.hasFocus()?this.query:null;this.$overflowHelper=buildOverflowHelper(this.$input);this._checkLanguageDirection();if(this.$hint.length===0){this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=_.noop;}}
Input.normalizeQuery=function(str){return _.toStr(str).replace(/^\s*/g,"").replace(/\s{2,}/g," ");};_.mixin(Input.prototype,EventEmitter,{_onBlur:function onBlur(){this.resetInputValue();this.trigger("blurred");},_onFocus:function onFocus(){this.queryWhenFocused=this.query;this.trigger("focused");},_onKeydown:function onKeydown($e){var keyName=specialKeyCodeMap[$e.which||$e.keyCode];this._managePreventDefault(keyName,$e);if(keyName&&this._shouldTrigger(keyName,$e)){this.trigger(keyName+"Keyed",$e);}},_onInput:function onInput(){this._setQuery(this.getInputValue());this.clearHintIfInvalid();this._checkLanguageDirection();},_managePreventDefault:function managePreventDefault(keyName,$e){var preventDefault;switch(keyName){case"up":case"down":preventDefault=!withModifier($e);break;default:preventDefault=false;}
preventDefault&&$e.preventDefault();},_shouldTrigger:function shouldTrigger(keyName,$e){var trigger;switch(keyName){case"tab":trigger=!withModifier($e);break;default:trigger=true;}
return trigger;},_checkLanguageDirection:function checkLanguageDirection(){var dir=(this.$input.css("direction")||"ltr").toLowerCase();if(this.dir!==dir){this.dir=dir;this.$hint.attr("dir",dir);this.trigger("langDirChanged",dir);}},_setQuery:function setQuery(val,silent){var areEquivalent,hasDifferentWhitespace;areEquivalent=areQueriesEquivalent(val,this.query);hasDifferentWhitespace=areEquivalent?this.query.length!==val.length:false;this.query=val;if(!silent&&!areEquivalent){this.trigger("queryChanged",this.query);}else if(!silent&&hasDifferentWhitespace){this.trigger("whitespaceChanged",this.query);}},bind:function(){var that=this,onBlur,onFocus,onKeydown,onInput;onBlur=_.bind(this._onBlur,this);onFocus=_.bind(this._onFocus,this);onKeydown=_.bind(this._onKeydown,this);onInput=_.bind(this._onInput,this);this.$input.on("blur.tt",onBlur).on("focus.tt",onFocus).on("keydown.tt",onKeydown);if(!_.isMsie()||_.isMsie()>9){this.$input.on("input.tt",onInput);}else{this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function($e){if(specialKeyCodeMap[$e.which||$e.keyCode]){return;}
_.defer(_.bind(that._onInput,that,$e));});}
return this;},focus:function focus(){this.$input.focus();},blur:function blur(){this.$input.blur();},getLangDir:function getLangDir(){return this.dir;},getQuery:function getQuery(){return this.query||"";},setQuery:function setQuery(val,silent){this.setInputValue(val);this._setQuery(val,silent);},hasQueryChangedSinceLastFocus:function hasQueryChangedSinceLastFocus(){return this.query!==this.queryWhenFocused;},getInputValue:function getInputValue(){return this.$input.val();},setInputValue:function setInputValue(value){this.$input.val(value);this.clearHintIfInvalid();this._checkLanguageDirection();},resetInputValue:function resetInputValue(){this.setInputValue(this.query);},getHint:function getHint(){return this.$hint.val();},setHint:function setHint(value){this.$hint.val(value);},clearHint:function clearHint(){this.setHint("");},clearHintIfInvalid:function clearHintIfInvalid(){var val,hint,valIsPrefixOfHint,isValid;val=this.getInputValue();hint=this.getHint();valIsPrefixOfHint=val!==hint&&hint.indexOf(val)===0;isValid=val!==""&&valIsPrefixOfHint&&!this.hasOverflow();!isValid&&this.clearHint();},hasFocus:function hasFocus(){return this.$input.is(":focus");},hasOverflow:function hasOverflow(){var constraint=this.$input.width()-2;this.$overflowHelper.text(this.getInputValue());return this.$overflowHelper.width()>=constraint;},isCursorAtEnd:function(){var valueLength,selectionStart,range;valueLength=this.$input.val().length;selectionStart=this.$input[0].selectionStart;if(_.isNumber(selectionStart)){return selectionStart===valueLength;}else if(document.selection){range=document.selection.createRange();range.moveStart("character",-valueLength);return valueLength===range.text.length;}
return true;},destroy:function destroy(){this.$hint.off(".tt");this.$input.off(".tt");this.$overflowHelper.remove();this.$hint=this.$input=this.$overflowHelper=$("<div>");}});return Input;function buildOverflowHelper($input){return $('<pre aria-hidden="true"></pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:$input.css("font-family"),fontSize:$input.css("font-size"),fontStyle:$input.css("font-style"),fontVariant:$input.css("font-variant"),fontWeight:$input.css("font-weight"),wordSpacing:$input.css("word-spacing"),letterSpacing:$input.css("letter-spacing"),textIndent:$input.css("text-indent"),textRendering:$input.css("text-rendering"),textTransform:$input.css("text-transform")}).insertAfter($input);}
function areQueriesEquivalent(a,b){return Input.normalizeQuery(a)===Input.normalizeQuery(b);}
function withModifier($e){return $e.altKey||$e.ctrlKey||$e.metaKey||$e.shiftKey;}}();var Dataset=function(){"use strict";var keys,nameGenerator;keys={val:"tt-selectable-display",obj:"tt-selectable-object"};nameGenerator=_.getIdGenerator();function Dataset(o,www){o=o||{};o.templates=o.templates||{};o.templates.notFound=o.templates.notFound||o.templates.empty;if(!o.source){$.error("missing source");}
if(!o.node){$.error("missing node");}
if(o.name&&!isValidName(o.name)){$.error("invalid dataset name: "+o.name);}
www.mixin(this);this.highlight=!!o.highlight;this.name=o.name||nameGenerator();this.limit=o.limit||5;this.displayFn=getDisplayFn(o.display||o.displayKey);this.templates=getTemplates(o.templates,this.displayFn);this.source=o.source.__ttAdapter?o.source.__ttAdapter():o.source;this.async=_.isUndefined(o.async)?this.source.length>2:!!o.async;this._resetLastSuggestion();this.$el=$(o.node).addClass(this.classes.dataset).addClass(this.classes.dataset+"-"+this.name);}
Dataset.extractData=function extractData(el){var $el=$(el);if($el.data(keys.obj)){return{val:$el.data(keys.val)||"",obj:$el.data(keys.obj)||null};}
return null;};_.mixin(Dataset.prototype,EventEmitter,{_overwrite:function overwrite(query,suggestions){suggestions=suggestions||[];if(suggestions.length){this._renderSuggestions(query,suggestions);}else if(this.async&&this.templates.pending){this._renderPending(query);}else if(!this.async&&this.templates.notFound){this._renderNotFound(query);}else{this._empty();}
this.trigger("rendered",this.name,suggestions,false);},_append:function append(query,suggestions){suggestions=suggestions||[];if(suggestions.length&&this.$lastSuggestion.length){this._appendSuggestions(query,suggestions);}else if(suggestions.length){this._renderSuggestions(query,suggestions);}else if(!this.$lastSuggestion.length&&this.templates.notFound){this._renderNotFound(query);}
this.trigger("rendered",this.name,suggestions,true);},_renderSuggestions:function renderSuggestions(query,suggestions){var $fragment;$fragment=this._getSuggestionsFragment(query,suggestions);this.$lastSuggestion=$fragment.children().last();this.$el.html($fragment).prepend(this._getHeader(query,suggestions)).append(this._getFooter(query,suggestions));},_appendSuggestions:function appendSuggestions(query,suggestions){var $fragment,$lastSuggestion;$fragment=this._getSuggestionsFragment(query,suggestions);$lastSuggestion=$fragment.children().last();this.$lastSuggestion.after($fragment);this.$lastSuggestion=$lastSuggestion;},_renderPending:function renderPending(query){var template=this.templates.pending;this._resetLastSuggestion();template&&this.$el.html(template({query:query,dataset:this.name}));},_renderNotFound:function renderNotFound(query){var template=this.templates.notFound;this._resetLastSuggestion();template&&this.$el.html(template({query:query,dataset:this.name}));},_empty:function empty(){this.$el.empty();this._resetLastSuggestion();},_getSuggestionsFragment:function getSuggestionsFragment(query,suggestions){var that=this,fragment;fragment=document.createDocumentFragment();_.each(suggestions,function getSuggestionNode(suggestion){var $el,context;context=that._injectQuery(query,suggestion);$el=$(that.templates.suggestion(context)).data(keys.obj,suggestion).data(keys.val,that.displayFn(suggestion)).addClass(that.classes.suggestion+" "+that.classes.selectable);fragment.appendChild($el[0]);});this.highlight&&highlight({className:this.classes.highlight,node:fragment,pattern:query});return $(fragment);},_getFooter:function getFooter(query,suggestions){return this.templates.footer?this.templates.footer({query:query,suggestions:suggestions,dataset:this.name}):null;},_getHeader:function getHeader(query,suggestions){return this.templates.header?this.templates.header({query:query,suggestions:suggestions,dataset:this.name}):null;},_resetLastSuggestion:function resetLastSuggestion(){this.$lastSuggestion=$();},_injectQuery:function injectQuery(query,obj){return _.isObject(obj)?_.mixin({_query:query},obj):obj;},update:function update(query){var that=this,canceled=false,syncCalled=false,rendered=0;this.cancel();this.cancel=function cancel(){canceled=true;that.cancel=$.noop;that.async&&that.trigger("asyncCanceled",query);};this.source(query,sync,async);!syncCalled&&sync([]);function sync(suggestions){if(syncCalled){return;}
syncCalled=true;suggestions=(suggestions||[]).slice(0,that.limit);rendered=suggestions.length;that._overwrite(query,suggestions);if(rendered<that.limit&&that.async){that.trigger("asyncRequested",query);}}
function async(suggestions){suggestions=suggestions||[];if(!canceled&&rendered<that.limit){that.cancel=$.noop;rendered+=suggestions.length;that._append(query,suggestions.slice(0,that.limit-rendered));that.async&&that.trigger("asyncReceived",query);}}},cancel:$.noop,clear:function clear(){this._empty();this.cancel();this.trigger("cleared");},isEmpty:function isEmpty(){return this.$el.is(":empty");},destroy:function destroy(){this.$el=$("<div>");}});return Dataset;function getDisplayFn(display){display=display||_.stringify;return _.isFunction(display)?display:displayFn;function displayFn(obj){return obj[display];}}
function getTemplates(templates,displayFn){return{notFound:templates.notFound&&_.templatify(templates.notFound),pending:templates.pending&&_.templatify(templates.pending),header:templates.header&&_.templatify(templates.header),footer:templates.footer&&_.templatify(templates.footer),suggestion:templates.suggestion||suggestionTemplate};function suggestionTemplate(context){return $("<div>").text(displayFn(context));}}
function isValidName(str){return /^[_a-zA-Z0-9-]+$/.test(str);}}();var Menu=function(){"use strict";function Menu(o,www){var that=this;o=o||{};if(!o.node){$.error("node is required");}
www.mixin(this);this.$node=$(o.node);this.query=null;this.datasets=_.map(o.datasets,initializeDataset);function initializeDataset(oDataset){var node=that.$node.find(oDataset.node).first();oDataset.node=node.length?node:$("<div>").appendTo(that.$node);return new Dataset(oDataset,www);}}
_.mixin(Menu.prototype,EventEmitter,{_onSelectableClick:function onSelectableClick($e){this.trigger("selectableClicked",$($e.currentTarget));},_onRendered:function onRendered(type,dataset,suggestions,async){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty());this.trigger("datasetRendered",dataset,suggestions,async);},_onCleared:function onCleared(){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty());this.trigger("datasetCleared");},_propagate:function propagate(){this.trigger.apply(this,arguments);},_allDatasetsEmpty:function allDatasetsEmpty(){return _.every(this.datasets,isDatasetEmpty);function isDatasetEmpty(dataset){return dataset.isEmpty();}},_getSelectables:function getSelectables(){return this.$node.find(this.selectors.selectable);},_removeCursor:function _removeCursor(){var $selectable=this.getActiveSelectable();$selectable&&$selectable.removeClass(this.classes.cursor);},_ensureVisible:function ensureVisible($el){var elTop,elBottom,nodeScrollTop,nodeHeight;elTop=$el.position().top;elBottom=elTop+$el.outerHeight(true);nodeScrollTop=this.$node.scrollTop();nodeHeight=this.$node.height()+parseInt(this.$node.css("paddingTop"),10)+parseInt(this.$node.css("paddingBottom"),10);if(elTop<0){this.$node.scrollTop(nodeScrollTop+elTop);}else if(nodeHeight<elBottom){this.$node.scrollTop(nodeScrollTop+(elBottom-nodeHeight));}},bind:function(){var that=this,onSelectableClick;onSelectableClick=_.bind(this._onSelectableClick,this);this.$node.on("click.tt",this.selectors.selectable,onSelectableClick);_.each(this.datasets,function(dataset){dataset.onSync("asyncRequested",that._propagate,that).onSync("asyncCanceled",that._propagate,that).onSync("asyncReceived",that._propagate,that).onSync("rendered",that._onRendered,that).onSync("cleared",that._onCleared,that);});return this;},isOpen:function isOpen(){return this.$node.hasClass(this.classes.open);},open:function open(){this.$node.addClass(this.classes.open);},close:function close(){this.$node.removeClass(this.classes.open);this._removeCursor();},setLanguageDirection:function setLanguageDirection(dir){this.$node.attr("dir",dir);},selectableRelativeToCursor:function selectableRelativeToCursor(delta){var $selectables,$oldCursor,oldIndex,newIndex;$oldCursor=this.getActiveSelectable();$selectables=this._getSelectables();oldIndex=$oldCursor?$selectables.index($oldCursor):-1;newIndex=oldIndex+delta;newIndex=(newIndex+1)%($selectables.length+1)-1;newIndex=newIndex<-1?$selectables.length-1:newIndex;return newIndex===-1?null:$selectables.eq(newIndex);},setCursor:function setCursor($selectable){this._removeCursor();if($selectable=$selectable&&$selectable.first()){$selectable.addClass(this.classes.cursor);this._ensureVisible($selectable);}},getSelectableData:function getSelectableData($el){return $el&&$el.length?Dataset.extractData($el):null;},getActiveSelectable:function getActiveSelectable(){var $selectable=this._getSelectables().filter(this.selectors.cursor).first();return $selectable.length?$selectable:null;},getTopSelectable:function getTopSelectable(){var $selectable=this._getSelectables().first();return $selectable.length?$selectable:null;},update:function update(query){var isValidUpdate=query!==this.query;if(isValidUpdate){this.query=query;_.each(this.datasets,updateDataset);}
return isValidUpdate;function updateDataset(dataset){dataset.update(query);}},empty:function empty(){_.each(this.datasets,clearDataset);this.query=null;this.$node.addClass(this.classes.empty);function clearDataset(dataset){dataset.clear();}},destroy:function destroy(){this.$node.off(".tt");this.$node=$("<div>");_.each(this.datasets,destroyDataset);function destroyDataset(dataset){dataset.destroy();}}});return Menu;}();var DefaultMenu=function(){"use strict";var s=Menu.prototype;function DefaultMenu(){Menu.apply(this,[].slice.call(arguments,0));}
_.mixin(DefaultMenu.prototype,Menu.prototype,{open:function open(){!this._allDatasetsEmpty()&&this._show();return s.open.apply(this,[].slice.call(arguments,0));},close:function close(){this._hide();return s.close.apply(this,[].slice.call(arguments,0));},_onRendered:function onRendered(){if(this._allDatasetsEmpty()){this._hide();}else{this.isOpen()&&this._show();}
return s._onRendered.apply(this,[].slice.call(arguments,0));},_onCleared:function onCleared(){if(this._allDatasetsEmpty()){this._hide();}else{this.isOpen()&&this._show();}
return s._onCleared.apply(this,[].slice.call(arguments,0));},setLanguageDirection:function setLanguageDirection(dir){this.$node.css(dir==="ltr"?this.css.ltr:this.css.rtl);return s.setLanguageDirection.apply(this,[].slice.call(arguments,0));},_hide:function hide(){this.$node.hide();},_show:function show(){this.$node.css("display","block");}});return DefaultMenu;}();var Typeahead=function(){"use strict";function Typeahead(o,www){var onFocused,onBlurred,onEnterKeyed,onTabKeyed,onEscKeyed,onUpKeyed,onDownKeyed,onLeftKeyed,onRightKeyed,onQueryChanged,onWhitespaceChanged;o=o||{};if(!o.input){$.error("missing input");}
if(!o.menu){$.error("missing menu");}
if(!o.eventBus){$.error("missing event bus");}
www.mixin(this);this.eventBus=o.eventBus;this.minLength=_.isNumber(o.minLength)?o.minLength:1;this.input=o.input;this.menu=o.menu;this.enabled=true;this.active=false;this.input.hasFocus()&&this.activate();this.dir=this.input.getLangDir();this._hacks();this.menu.bind().onSync("selectableClicked",this._onSelectableClicked,this).onSync("asyncRequested",this._onAsyncRequested,this).onSync("asyncCanceled",this._onAsyncCanceled,this).onSync("asyncReceived",this._onAsyncReceived,this).onSync("datasetRendered",this._onDatasetRendered,this).onSync("datasetCleared",this._onDatasetCleared,this);onFocused=c(this,"activate","open","_onFocused");onBlurred=c(this,"deactivate","_onBlurred");onEnterKeyed=c(this,"isActive","isOpen","_onEnterKeyed");onTabKeyed=c(this,"isActive","isOpen","_onTabKeyed");onEscKeyed=c(this,"isActive","_onEscKeyed");onUpKeyed=c(this,"isActive","open","_onUpKeyed");onDownKeyed=c(this,"isActive","open","_onDownKeyed");onLeftKeyed=c(this,"isActive","isOpen","_onLeftKeyed");onRightKeyed=c(this,"isActive","isOpen","_onRightKeyed");onQueryChanged=c(this,"_openIfActive","_onQueryChanged");onWhitespaceChanged=c(this,"_openIfActive","_onWhitespaceChanged");this.input.bind().onSync("focused",onFocused,this).onSync("blurred",onBlurred,this).onSync("enterKeyed",onEnterKeyed,this).onSync("tabKeyed",onTabKeyed,this).onSync("escKeyed",onEscKeyed,this).onSync("upKeyed",onUpKeyed,this).onSync("downKeyed",onDownKeyed,this).onSync("leftKeyed",onLeftKeyed,this).onSync("rightKeyed",onRightKeyed,this).onSync("queryChanged",onQueryChanged,this).onSync("whitespaceChanged",onWhitespaceChanged,this).onSync("langDirChanged",this._onLangDirChanged,this);}
_.mixin(Typeahead.prototype,{_hacks:function hacks(){var $input,$menu;$input=this.input.$input||$("<div>");$menu=this.menu.$node||$("<div>");$input.on("blur.tt",function($e){var active,isActive,hasActive;active=document.activeElement;isActive=$menu.is(active);hasActive=$menu.has(active).length>0;if(_.isMsie()&&(isActive||hasActive)){$e.preventDefault();$e.stopImmediatePropagation();_.defer(function(){$input.focus();});}});$menu.on("mousedown.tt",function($e){$e.preventDefault();});},_onSelectableClicked:function onSelectableClicked(type,$el){this.select($el);},_onDatasetCleared:function onDatasetCleared(){this._updateHint();},_onDatasetRendered:function onDatasetRendered(type,dataset,suggestions,async){this._updateHint();this.eventBus.trigger("render",suggestions,async,dataset);},_onAsyncRequested:function onAsyncRequested(type,dataset,query){this.eventBus.trigger("asyncrequest",query,dataset);},_onAsyncCanceled:function onAsyncCanceled(type,dataset,query){this.eventBus.trigger("asynccancel",query,dataset);},_onAsyncReceived:function onAsyncReceived(type,dataset,query){this.eventBus.trigger("asyncreceive",query,dataset);},_onFocused:function onFocused(){this._minLengthMet()&&this.menu.update(this.input.getQuery());},_onBlurred:function onBlurred(){if(this.input.hasQueryChangedSinceLastFocus()){this.eventBus.trigger("change",this.input.getQuery());}},_onEnterKeyed:function onEnterKeyed(type,$e){var $selectable;if($selectable=this.menu.getActiveSelectable()){this.select($selectable)&&$e.preventDefault();}},_onTabKeyed:function onTabKeyed(type,$e){var $selectable;if($selectable=this.menu.getActiveSelectable()){this.select($selectable)&&$e.preventDefault();}else if($selectable=this.menu.getTopSelectable()){this.autocomplete($selectable)&&$e.preventDefault();}},_onEscKeyed:function onEscKeyed(){this.close();},_onUpKeyed:function onUpKeyed(){this.moveCursor(-1);},_onDownKeyed:function onDownKeyed(){this.moveCursor(+1);},_onLeftKeyed:function onLeftKeyed(){if(this.dir==="rtl"&&this.input.isCursorAtEnd()){this.autocomplete(this.menu.getTopSelectable());}},_onRightKeyed:function onRightKeyed(){if(this.dir==="ltr"&&this.input.isCursorAtEnd()){this.autocomplete(this.menu.getTopSelectable());}},_onQueryChanged:function onQueryChanged(e,query){this._minLengthMet(query)?this.menu.update(query):this.menu.empty();},_onWhitespaceChanged:function onWhitespaceChanged(){this._updateHint();},_onLangDirChanged:function onLangDirChanged(e,dir){if(this.dir!==dir){this.dir=dir;this.menu.setLanguageDirection(dir);}},_openIfActive:function openIfActive(){this.isActive()&&this.open();},_minLengthMet:function minLengthMet(query){query=_.isString(query)?query:this.input.getQuery()||"";return query.length>=this.minLength;},_updateHint:function updateHint(){var $selectable,data,val,query,escapedQuery,frontMatchRegEx,match;$selectable=this.menu.getTopSelectable();data=this.menu.getSelectableData($selectable);val=this.input.getInputValue();if(data&&!_.isBlankString(val)&&!this.input.hasOverflow()){query=Input.normalizeQuery(val);escapedQuery=_.escapeRegExChars(query);frontMatchRegEx=new RegExp("^(?:"+escapedQuery+")(.+$)","i");match=frontMatchRegEx.exec(data.val);match&&this.input.setHint(val+match[1]);}else{this.input.clearHint();}},isEnabled:function isEnabled(){return this.enabled;},enable:function enable(){this.enabled=true;},disable:function disable(){this.enabled=false;},isActive:function isActive(){return this.active;},activate:function activate(){if(this.isActive()){return true;}else if(!this.isEnabled()||this.eventBus.before("active")){return false;}else{this.active=true;this.eventBus.trigger("active");return true;}},deactivate:function deactivate(){if(!this.isActive()){return true;}else if(this.eventBus.before("idle")){return false;}else{this.active=false;this.close();this.eventBus.trigger("idle");return true;}},isOpen:function isOpen(){return this.menu.isOpen();},open:function open(){if(!this.isOpen()&&!this.eventBus.before("open")){this.menu.open();this._updateHint();this.eventBus.trigger("open");}
return this.isOpen();},close:function close(){if(this.isOpen()&&!this.eventBus.before("close")){this.menu.close();this.input.clearHint();this.input.resetInputValue();this.eventBus.trigger("close");}
return!this.isOpen();},setVal:function setVal(val){this.input.setQuery(_.toStr(val));},getVal:function getVal(){return this.input.getQuery();},select:function select($selectable){var data=this.menu.getSelectableData($selectable);if(data&&!this.eventBus.before("select",data.obj)){this.input.setQuery(data.val,true);this.eventBus.trigger("select",data.obj);this.close();return true;}
return false;},autocomplete:function autocomplete($selectable){var query,data,isValid;query=this.input.getQuery();data=this.menu.getSelectableData($selectable);isValid=data&&query!==data.val;if(isValid&&!this.eventBus.before("autocomplete",data.obj)){this.input.setQuery(data.val);this.eventBus.trigger("autocomplete",data.obj);return true;}
return false;},moveCursor:function moveCursor(delta){var query,$candidate,data,payload,cancelMove;query=this.input.getQuery();$candidate=this.menu.selectableRelativeToCursor(delta);data=this.menu.getSelectableData($candidate);payload=data?data.obj:null;cancelMove=this._minLengthMet()&&this.menu.update(query);if(!cancelMove&&!this.eventBus.before("cursorchange",payload)){this.menu.setCursor($candidate);if(data){this.input.setInputValue(data.val);}else{this.input.resetInputValue();this._updateHint();}
this.eventBus.trigger("cursorchange",payload);return true;}
return false;},destroy:function destroy(){this.input.destroy();this.menu.destroy();}});return Typeahead;function c(ctx){var methods=[].slice.call(arguments,1);return function(){var args=[].slice.call(arguments);_.each(methods,function(method){return ctx[method].apply(ctx,args);});};}}();(function(){"use strict";var old,keys,methods;old=$.fn.typeahead;keys={www:"tt-www",attrs:"tt-attrs",typeahead:"tt-typeahead"};methods={initialize:function initialize(o,datasets){var www;datasets=_.isArray(datasets)?datasets:[].slice.call(arguments,1);o=o||{};www=WWW(o.classNames);return this.each(attach);function attach(){var $input,$wrapper,$hint,$menu,defaultHint,defaultMenu,eventBus,input,menu,typeahead,MenuConstructor;_.each(datasets,function(d){d.highlight=!!o.highlight;});$input=$(this);$wrapper=$(www.html.wrapper);$hint=$elOrNull(o.hint);$menu=$elOrNull(o.menu);defaultHint=o.hint!==false&&!$hint;defaultMenu=o.menu!==false&&!$menu;defaultHint&&($hint=buildHintFromInput($input,www));defaultMenu&&($menu=$(www.html.menu).css(www.css.menu));$hint&&$hint.val("");$input=prepInput($input,www);if(defaultHint||defaultMenu){$wrapper.css(www.css.wrapper);$input.css(defaultHint?www.css.input:www.css.inputWithNoHint);$input.wrap($wrapper).parent().prepend(defaultHint?$hint:null).append(defaultMenu?$menu:null);}
MenuConstructor=defaultMenu?DefaultMenu:Menu;eventBus=new EventBus({el:$input});input=new Input({hint:$hint,input:$input},www);menu=new MenuConstructor({node:$menu,datasets:datasets},www);typeahead=new Typeahead({input:input,menu:menu,eventBus:eventBus,minLength:o.minLength},www);$input.data(keys.www,www);$input.data(keys.typeahead,typeahead);}},isEnabled:function isEnabled(){var enabled;ttEach(this.first(),function(t){enabled=t.isEnabled();});return enabled;},enable:function enable(){ttEach(this,function(t){t.enable();});return this;},disable:function disable(){ttEach(this,function(t){t.disable();});return this;},isActive:function isActive(){var active;ttEach(this.first(),function(t){active=t.isActive();});return active;},activate:function activate(){ttEach(this,function(t){t.activate();});return this;},deactivate:function deactivate(){ttEach(this,function(t){t.deactivate();});return this;},isOpen:function isOpen(){var open;ttEach(this.first(),function(t){open=t.isOpen();});return open;},open:function open(){ttEach(this,function(t){t.open();});return this;},close:function close(){ttEach(this,function(t){t.close();});return this;},select:function select(el){var success=false,$el=$(el);ttEach(this.first(),function(t){success=t.select($el);});return success;},autocomplete:function autocomplete(el){var success=false,$el=$(el);ttEach(this.first(),function(t){success=t.autocomplete($el);});return success;},moveCursor:function moveCursoe(delta){var success=false;ttEach(this.first(),function(t){success=t.moveCursor(delta);});return success;},val:function val(newVal){var query;if(!arguments.length){ttEach(this.first(),function(t){query=t.getVal();});return query;}else{ttEach(this,function(t){t.setVal(newVal);});return this;}},destroy:function destroy(){ttEach(this,function(typeahead,$input){revert($input);typeahead.destroy();});return this;}};$.fn.typeahead=function(method){if(methods[method]){return methods[method].apply(this,[].slice.call(arguments,1));}else{return methods.initialize.apply(this,arguments);}};$.fn.typeahead.noConflict=function noConflict(){$.fn.typeahead=old;return this;};function ttEach($els,fn){$els.each(function(){var $input=$(this),typeahead;(typeahead=$input.data(keys.typeahead))&&fn(typeahead,$input);});}
function buildHintFromInput($input,www){return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop("readonly",true).removeAttr("id name placeholder required").attr({autocomplete:"off",spellcheck:"false",tabindex:-1});}
function prepInput($input,www){$input.data(keys.attrs,{dir:$input.attr("dir"),autocomplete:$input.attr("autocomplete"),spellcheck:$input.attr("spellcheck"),style:$input.attr("style")});$input.addClass(www.classes.input).attr({autocomplete:"off",spellcheck:false});try{!$input.attr("dir")&&$input.attr("dir","auto");}catch(e){}
return $input;}
function getBackgroundStyles($el){return{backgroundAttachment:$el.css("background-attachment"),backgroundClip:$el.css("background-clip"),backgroundColor:$el.css("background-color"),backgroundImage:$el.css("background-image"),backgroundOrigin:$el.css("background-origin"),backgroundPosition:$el.css("background-position"),backgroundRepeat:$el.css("background-repeat"),backgroundSize:$el.css("background-size")};}
function revert($input){var www,$wrapper;www=$input.data(keys.www);$wrapper=$input.parent().filter(www.selectors.wrapper);_.each($input.data(keys.attrs),function(val,key){_.isUndefined(val)?$input.removeAttr(key):$input.attr(key,val);});$input.removeData(keys.typeahead).removeData(keys.www).removeData(keys.attr).removeClass(www.classes.input);if($wrapper.length){$input.detach().insertAfter($wrapper);$wrapper.remove();}}
function $elOrNull(obj){var isValid,$el;isValid=_.isJQuery(obj)||_.isElement(obj);$el=isValid?$(obj).first():[];return $el.length?$el:null;}})();});;