-
Notifications
You must be signed in to change notification settings - Fork 0
/
glance-selector.js
2 lines (2 loc) · 49.4 KB
/
glance-selector.js
1
2
!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _glanceSelector=__webpack_require__(1),_glanceSelector2=_interopRequireDefault(_glanceSelector);window.glanceSelector=_glanceSelector2["default"]},function(module,exports,__webpack_require__){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function GlanceSelector(options){var _selector={};_selector.defaultExtensions=options.defaultExtensions||_default2["default"],_selector.extensions=options.extensions?_selector.defaultExtensions.concat(options.extensions):_selector.defaultExtensions,_selector.properties=options.properties||{},_selector.hooks=options.hooks||{},_selector.guideFactory=options.guideFactory;var selector=function selector(reference){for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];if(!reference)throw new Error("Selector required");var resultHandler=function(err,result){return result},config={};args.length>0&&("object"==_typeof(args[0])?(config=args[0],args[1]&&(resultHandler=args[1])):"function"==typeof args[0]&&(resultHandler=args[0])),config.defaultExtensions=config.defaultExtensions||_default2["default"],config.extensions=config.extensions?config.defaultExtensions.concat(config.extensions):config.defaultExtensions,config.defaultProperties=_defaultProperties2["default"],_log2["default"].setLogLevel(config.logLevel||"info"),config.rootElement=config.rootElement||document.body,config.glance=config.glance||selector,config.glanceSelector=config.glanceSelector||selector;var globalScope=global||window;return globalScope.browserExecute=config.browserExecute||function(func){for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];return func.apply(void 0,args)},selector.find=function(reference,resultHandler){var scopes=_parser2["default"].parse(reference);return _log2["default"].debug("Selector:",reference),_selector.extensions.filter(function(e){return e.beforeAll}).forEach(function(e){return e.beforeAll({selector:reference})}),_selector.guideFactory().search({glance:config.glance,glanceSelector:config.glanceSelector,scopeElement:config.rootElement,scopes:scopes,config:config,extensions:config.extensions},function(err,elements){return _selector.extensions.filter(function(e){return e.afterAll}).forEach(function(e){return e.afterAll({elements:elements})}),1===elements.length?resultHandler(err,elements[0]):resultHandler(err,elements)})},selector.find(reference,resultHandler)};return selector.addExtension=function(extension){_selector.extensions.push(extension)},selector.setLogLevel=function(level){_log2["default"].setLogLevel(level)},selector}Object.defineProperty(exports,"__esModule",{value:!0}),exports.DefaultProperties=exports.DefaultExtensions=exports.Parser=void 0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_searchLineage=__webpack_require__(2),_searchLineage2=_interopRequireDefault(_searchLineage),_parser=__webpack_require__(9),_parser2=_interopRequireDefault(_parser),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log),_default=__webpack_require__(10),_default2=_interopRequireDefault(_default),_defaultProperties=__webpack_require__(25),_defaultProperties2=_interopRequireDefault(_defaultProperties);exports.Parser=_parser2["default"],exports.DefaultExtensions=_default2["default"],exports.DefaultProperties=_defaultProperties2["default"],exports["default"]=GlanceSelector({guideFactory:function(){return new _searchLineage2["default"]}})}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_extensions=__webpack_require__(3),_extensions2=_interopRequireDefault(_extensions),_locator=__webpack_require__(4),_locator2=_interopRequireDefault(_locator),_filter=__webpack_require__(8),_filter2=_interopRequireDefault(_filter),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log),_arrayUtils=__webpack_require__(6),SearchLineage=function(){function SearchLineage(){_classCallCheck(this,SearchLineage)}return _createClass(SearchLineage,[{key:"search",value:function(data){var callback=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(err,result){return result},_data=data,scopes=_data.scopes,scopeElement=_data.scopeElement,_data$config=_data.config,config=void 0===_data$config?{}:_data$config;return config.extensions=config.extensions||[],data=_extends({},data,{extensions:config.extensions}),SearchLineage.traverseScopes(_extends({},data,{elements:[scopeElement],target:scopes[0],scopeElements:[]}),callback)}}],[{key:"traverseScopes",value:function(data,resultHandler){var elements=data.elements,scopes=data.scopes,target=data.target,processLevel=function(result,scopeElement,reduceeCallback){function resultHandler(err,located){return err?reduceeCallback(err,[]):(result.push({scopeElement:scopeElement,elements:located}),reduceeCallback(err,result))}var tempData=_extends({},data,{scopeElement:scopeElement});return _extensions2["default"].beforeScopeEvent(tempData),_locator2["default"].locate(tempData,function(err,located){return tempData.intersectElements?(_log2["default"].debug("Finding intersections"),browserExecute(function(located,previous,handler){return handler(null,located.filter(function(e){return previous.indexOf(e)!=-1}))},located,tempData.intersectElements,function(err,result){return _log2["default"].debug("Intersection count:",result.length),resultHandler(err,result)})):resultHandler(null,located)})};return(0,_arrayUtils.reduce)(elements,[],processLevel,function(err,locatedTargets){if(err)return resultHandler(err,[]);var targetInfo=locatedTargets.reduce(function(result,info){return result.elements=result.elements.concat(info.elements),result.scopeElements.push(info.scopeElement),result},{elements:[],scopeElements:[]});return(0,_arrayUtils.unique)(targetInfo.elements,function(err,uniqueTargets){return targetInfo.elements=uniqueTargets,_filter2["default"].filter(_extends({},data,targetInfo),function(err,filteredElements){return err?resultHandler(err,[]):(_extensions2["default"].afterScopeEvent(_extends({},data,{elements:filteredElements})),"target"==target.type?resultHandler(err,filteredElements):"intersect"==target.type?SearchLineage.traverseScopes(_extends({},data,{intersectElements:filteredElements,elements:filteredElements,target:scopes[target.scopeIndex+1]}),resultHandler):SearchLineage.traverseScopes(_extends({},data,{intersectElements:null,scopeElements:filteredElements,elements:filteredElements,target:scopes[target.scopeIndex+1]}),resultHandler))})})})}}]),SearchLineage}();exports["default"]=SearchLineage},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),Extensions=function(){function Extensions(){_classCallCheck(this,Extensions)}return _createClass(Extensions,null,[{key:"beforeScopeEvent",value:function(data){var extensions=data.extensions;return extensions.filter(function(e){return e.beforeScope}).forEach(function(e){return e.beforeScope(data)})}},{key:"afterScopeEvent",value:function(data){var extensions=data.extensions;return extensions.filter(function(e){return e.afterScope}).forEach(function(e){return e.afterScope(data)})}},{key:"labels",value:function(extensions){return extensions.filter(function(e){return e.labels}).reduce(function(l,e){return Object.assign(l,e.labels)},{})}},{key:"properties",value:function(extensions){return extensions.filter(function(e){return e.properties}).reduce(function(l,e){return Object.assign(l,e.properties)},{})}}]),Extensions}();exports["default"]=Extensions},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log),_extensions=__webpack_require__(3),_extensions2=_interopRequireDefault(_extensions),_arrayUtils=__webpack_require__(6),_isDescendant=__webpack_require__(7),_isDescendant2=_interopRequireDefault(_isDescendant),Locator=function(){function Locator(){_classCallCheck(this,Locator)}return _createClass(Locator,null,[{key:"locate",value:function locate(data,resultHandler){var target=data.target,scopeElement=data.scopeElement,scopeElements=data.scopeElements,config=data.config,extensions=data.extensions,parent=scopeElement,locators=Locator.getLocators(target,extensions)||Locator.getDefaultLocators(extensions,config.defaultProperties),locate=function(target,resultHandler){return(0,_arrayUtils.reduce)(locators,[],function(elements,locator,handler){return locator(target,function(err,e){return err?handler(err,[]):(e.length>0&&_log2["default"].debug("Matched "+e.length),elements=elements.concat(e),handler(err,elements))})},resultHandler)},beforeLocate=Locator.locateBeforeFromLabel(target.label,extensions),afterLocate=Locator.locateAfterFromLabel(target.label,extensions);return Locator.beforeLocate(extensions).forEach(function(before){return before(data)}),beforeLocate.forEach(function(before){return before({label:target.label})}),Locator.locateInParent(locate,[],parent,null,scopeElements,target,data,function(err,elements){return err?resultHandler(err,[]):(afterLocate.forEach(function(after){return after({label:target.label})}),Locator.afterLocate(extensions).forEach(function(after){return after(data)}),resultHandler(err,elements))})}},{key:"locateInParent",value:function(locate,elements,parent,previousParent,scopeElements,target,data,resultHandler){return parent&&0==elements.length?locate(_extends({},data,{label:target.label,scopeElement:parent}),function(err,foundElements){return err?resultHandler(err,[]):browserExecute(function(node,handler){return handler(null,{node:node,parentNode:node.parentNode,"continue":null!=node.parentNode&&null!=node.parentNode.outerHTML})},parent,function(err,result){if(err)return resultHandler(err,[]);var flattenedElements=[].concat(foundElements);return flattenedElements=flattenedElements.filter(function(e){return scopeElements.indexOf(e)==-1||scopeElements.filter(function(s){return(0,_isDescendant2["default"])(s,e)}).length>0}),result["continue"]&&0==flattenedElements.length?(_log2["default"].debug("Elements not found, trying parent"),Locator.locateInParent(locate,[].concat(foundElements),result.parentNode,result.node,scopeElements,target,data,resultHandler)):resultHandler(null,flattenedElements)})}):(elements=elements.filter(function(e){return scopeElements.indexOf(e)==-1||scopeElements.filter(function(s){return(0,_isDescendant2["default"])(s,e)}).length>0}),resultHandler(null,elements))}},{key:"getLocator",value:function(locator){return"[object Array]"===Object.prototype.toString.call(locator)?locator.map(function(label){return function(_ref,handler){var glanceSelector=_ref.glanceSelector;return glanceSelector(label,handler)}}):"string"==typeof locator?[function(_ref2,handler){var glanceSelector=_ref2.glanceSelector;return glanceSelector(locator,handler)}]:"function"==typeof locator?[locator]:[]}},{key:"getLocators",value:function(target,extensions){var locators=[],labels=_extensions2["default"].labels(extensions),properties=_extensions2["default"].properties(extensions);return labels[target.label]&&(locators=labels[target.label].locate?Locator.getLocator(labels[target.label].locate):Locator.getLocator(labels[target.label])),target.properties.forEach(function(name){if(properties[name]&&properties[name].locate)locators=locators.concat(Locator.getLocator(properties[name].locate));else{var catchAlls=extensions.filter(function(e){return!!e.locator&&e.locator.check({label:target.label,target:target})});catchAlls.length>0&&(locators=locators.concat(catchAlls.map(function(e){return e.locator.locate})))}}),locators.length>0?locators:null}},{key:"getDefaultLocators",value:function(extensions,defaultProperties){var properties=_extensions2["default"].properties(extensions);if(defaultProperties.length>0){var locators=extensions.filter(function(e){return e.locator}).map(function(e){return function(data,callback){var target=data.target;return e.locator.locate(_extends({},data,{target:_extends({},target,{properties:defaultProperties})}),callback)}}),propertiesWithlocators=defaultProperties.filter(function(name){return properties[name]&&properties[name].locate});return 0!=propertiesWithlocators.length&&(locators=locators.concat(propertiesWithlocators.map(function(name){return properties[name].locate}))),locators}return[]}},{key:"locatorForLabel",value:function(key,extensions){return extensions.filter(function(e){return e.labels&&e.labels[key]}).map(function(e){return e.labels[key]})}},{key:"locateBeforeFromLabel",value:function(label,extensions){return Locator.locatorForLabel(label,extensions).filter(function(e){return e.beforeLocate}).map(function(e){return e.beforeLocate})}},{key:"locateAfterFromLabel",value:function(label,extensions){return Locator.locatorForLabel(label,extensions).filter(function(e){return e.afterLocate}).map(function(e){return e.afterLocate})}},{key:"beforeLocate",value:function(extensions){return extensions.filter(function(e){return e.beforeLocate}).map(function(e){return e.beforeLocate})}},{key:"afterLocate",value:function(extensions){return extensions.filter(function(e){return e.afterLocate}).map(function(e){return e.afterLocate})}}]),Locator}();exports["default"]=Locator},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var LogLevels={error:0,warn:1,info:2,debug:3,trace:4};exports["default"]={level:LogLevels.error,setLogLevel:function(level){this.level=LogLevels[level]},error:function(){for(var _len=arguments.length,messages=Array(_len),_key=0;_key<_len;_key++)messages[_key]=arguments[_key];this._log("error",messages)},warn:function(){for(var _len2=arguments.length,messages=Array(_len2),_key2=0;_key2<_len2;_key2++)messages[_key2]=arguments[_key2];this._log("warn",messages)},info:function(){for(var _len3=arguments.length,messages=Array(_len3),_key3=0;_key3<_len3;_key3++)messages[_key3]=arguments[_key3];this._log("info",messages)},debug:function(){for(var _len4=arguments.length,messages=Array(_len4),_key4=0;_key4<_len4;_key4++)messages[_key4]=arguments[_key4];this._log("debug",messages)},trace:function(){for(var _len5=arguments.length,messages=Array(_len5),_key5=0;_key5<_len5;_key5++)messages[_key5]=arguments[_key5];this._log("trace",messages)},_log:function(level,messages){var l=LogLevels[level];l<=this.level&&console.log(messages.join(" "))}}},function(module,exports){"use strict";function reduce(collection,memo,iteratee,resultHandler){function process(i,collection,memo,iteratee,handler){return i<collection.length?iteratee(memo,collection[i],function(err,result){return err?handler(err,memo):process(++i,collection,result,iteratee,handler)}):handler(null,memo)}return process(0,collection,memo,iteratee,resultHandler)}function unique(array,resultHandler){return browserExecute(function(array,handler){try{return handler(null,array.filter(function(x,i){return array.indexOf(x)===i}))}catch(err){return handler(err,[])}},array,resultHandler)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.reduce=reduce,exports.unique=unique},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=function(parent,child){for(var node=child.parentNode;null!=node;){if(node==parent)return!0;node=node.parentNode}return!1}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_extensions=__webpack_require__(3),_extensions2=_interopRequireDefault(_extensions),_arrayUtils=__webpack_require__(6),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log),Filter=function(){function Filter(){_classCallCheck(this,Filter)}return _createClass(Filter,null,[{key:"filter",value:function(data,callback){var target=data.target,unfilteredElements=data.elements,extensions=data.extensions,config=data.config,filters=Filter.getFilters(target,extensions,config.defaultProperties)||Filter.getDefaultFilters(extensions,config.defaultProperties),beforeFilterElements=Filter.beforeFilters(unfilteredElements,extensions,data),afterFilters=Filter.afterFilters(callback,extensions,data);return(0,_arrayUtils.reduce)(filters,beforeFilterElements,function(filteredElements,filter,executeCallback){return filter(_extends({},data,{elements:filteredElements}),function(err,results){return _log2["default"].debug("Filtered count:",results.length),executeCallback(err,results)})},afterFilters)}},{key:"beforeFilters",value:function(elements,extensions,data){return extensions.filter(function(e){return e.beforeFilters}).reduce(function(elements,e){return e.beforeFilters(Object.assign(data,{elements:elements}))},elements)}},{key:"afterFilters",value:function(callback,extensions,data){return function(err,filteredElements){return callback(err,extensions.filter(function(e){return e.afterFilters}).reduce(function(elements,e){return e.afterFilters(Object.assign(data,{elements:elements}))},filteredElements))}}},{key:"getFilters",value:function(target,extensions,defaultProperties){var filters=[],labels=_extensions2["default"].labels(extensions),properties=_extensions2["default"].properties(extensions);return labels[target.label]&&"[object Array]"!==Object.prototype.toString.call(labels[target.label])&&labels[target.label].filter&&(filters=filters.concat(labels[target.label].filter)),target.properties.forEach(function(name){if(properties[name]&&(properties[name].filter||"function"==typeof properties[name]))filters=filters.concat("function"==typeof properties[name]?properties[name]:properties[name].filter);else{var catchAlls=extensions.filter(function(e){return e.filter});catchAlls.length>0&&(0==filters.length&&catchAlls[0].filter.useDefaultFiltersIfFirst&&(filters=filters.concat(Filter.getDefaultFilters(extensions,defaultProperties))),filters=filters.concat(catchAlls.map(function(e){return e.filter.apply})))}}),filters.length>0?filters:null}},{key:"getDefaultFilters",value:function(extensions,defaultProperties){var properties=_extensions2["default"].properties(extensions);if(defaultProperties.length>0){var filters=extensions.filter(function(e){return e.filter}).map(function(e){return function(data,callback){var target=data.target;return e.filter.apply(_extends({},data,{target:_extends({},target,{properties:defaultProperties})}),callback)}}),propertiesWithFilters=defaultProperties.filter(function(name){return properties[name]&&(properties[name].filter||"function"==typeof properties[name])});return 0!=propertiesWithFilters.length&&(filters=filters.concat(propertiesWithFilters.map(function(name){return"function"==typeof properties[name]?properties[name]:properties[name].filter}))),filters}return[]}}]),Filter}();exports["default"]=Filter},function(module,exports){"use strict";function peg$subclass(child,parent){function ctor(){this.constructor=child}ctor.prototype=parent.prototype,child.prototype=new ctor}function peg$SyntaxError(message,expected,found,location){this.message=message,this.expected=expected,this.found=found,this.location=location,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,peg$SyntaxError)}function peg$parse(input,options){function text(){return input.substring(peg$savedPos,peg$currPos)}function peg$literalExpectation(text,ignoreCase){return{type:"literal",text:text,ignoreCase:ignoreCase}}function peg$classExpectation(parts,inverted,ignoreCase){return{type:"class",parts:parts,inverted:inverted,ignoreCase:ignoreCase}}function peg$anyExpectation(){return{type:"any"}}function peg$endExpectation(){return{type:"end"}}function peg$otherExpectation(description){return{type:"other",description:description}}function peg$computePosDetails(pos){var p,details=peg$posDetailsCache[pos];if(details)return details;for(p=pos-1;!peg$posDetailsCache[p];)p--;for(details=peg$posDetailsCache[p],details={line:details.line,column:details.column};p<pos;)10===input.charCodeAt(p)?(details.line++,details.column=1):details.column++,p++;return peg$posDetailsCache[pos]=details,details}function peg$computeLocation(startPos,endPos){var startPosDetails=peg$computePosDetails(startPos),endPosDetails=peg$computePosDetails(endPos);return{start:{offset:startPos,line:startPosDetails.line,column:startPosDetails.column},end:{offset:endPos,line:endPosDetails.line,column:endPosDetails.column}}}function peg$fail(expected){peg$currPos<peg$maxFailPos||(peg$currPos>peg$maxFailPos&&(peg$maxFailPos=peg$currPos,peg$maxFailExpected=[]),peg$maxFailExpected.push(expected))}function peg$buildStructuredError(expected,found,location){return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected,found),expected,found,location)}function peg$parseStart(){var s0,s1,s2;for(s0=peg$currPos,s1=[],s2=peg$parseReference();s2!==peg$FAILED;)s1.push(s2),s2=peg$parseReference();return s1!==peg$FAILED&&(peg$savedPos=s0,s1=peg$c0(s1)),s0=s1}function peg$parseScopeChar(){var s0;return 62===input.charCodeAt(peg$currPos)?(s0=peg$c1,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c2)),s0}function peg$parseIntersectChar(){var s0;return 94===input.charCodeAt(peg$currPos)?(s0=peg$c3,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c4)),s0}function peg$parsePropertyChar(){var s0;return 35===input.charCodeAt(peg$currPos)?(s0=peg$c5,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c6)),s0}function peg$parseSeparatorChar(){var s0;return 44===input.charCodeAt(peg$currPos)?(s0=peg$c7,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c8)),s0}function peg$parseTransformChar(){var s0;return 58===input.charCodeAt(peg$currPos)?(s0=peg$c9,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c10)),s0}function peg$parseEscapeChar(){var s0;return 92===input.charCodeAt(peg$currPos)?(s0=peg$c11,peg$currPos++):(s0=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c12)),s0}function peg$parseEscapableChars(){var s0;return s0=peg$parseEscapeChar(),s0===peg$FAILED&&(s0=peg$parseScopeChar(),s0===peg$FAILED&&(s0=peg$parseTransformChar(),s0===peg$FAILED&&(s0=peg$parsePropertyChar(),s0===peg$FAILED&&(s0=peg$parseIntersectChar())))),s0}function peg$parseEscapedSequence(){var s0,s1,s2;return s0=peg$currPos,s1=peg$parseEscapeChar(),s1!==peg$FAILED?(s2=peg$parseEscapableChars(),s2!==peg$FAILED?(peg$savedPos=s0,s1=peg$c13(s2),s0=s1):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseReference(){var s0,s1,s2;return s0=peg$currPos,s1=peg$parseTarget(),s1!==peg$FAILED?(s2=peg$parseScopeChar(),s2!==peg$FAILED?(peg$savedPos=s0,s1=peg$c14(s1),s0=s1):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0===peg$FAILED&&(s0=peg$currPos,s1=peg$parseTarget(),s1!==peg$FAILED?(s2=peg$parseIntersectChar(),s2!==peg$FAILED?(peg$savedPos=s0,s1=peg$c15(s1),s0=s1):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0===peg$FAILED&&(s0=peg$currPos,s1=peg$parseTarget(),s1!==peg$FAILED&&(peg$savedPos=s0,s1=peg$c16(s1)),s0=s1)),s0}function peg$parseTarget(){var s0,s1;return s0=peg$currPos,s1=peg$parseLabel(),s1!==peg$FAILED&&(peg$savedPos=s0,s1=peg$c17(s1)),s0=s1}function peg$parseLabel(){var s0,s1,s2,s3,s4;if(s0=peg$currPos,s1=[],s2=peg$parseLabelCharacter(),s2!==peg$FAILED)for(;s2!==peg$FAILED;)s1.push(s2),s2=peg$parseLabelCharacter();else s1=peg$FAILED;return s1!==peg$FAILED?(s2=peg$parseProperties(),s2===peg$FAILED&&(s2=null),s2!==peg$FAILED?(s3=peg$parseTransforms(),s3===peg$FAILED&&(s3=null),s3!==peg$FAILED?(s4=peg$parseWhitespace(),s4===peg$FAILED&&(s4=null),s4!==peg$FAILED?(peg$savedPos=s0,s1=peg$c18(s1,s2,s3),s0=s1):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseLabelCharacter(){var s0,s1,s2;return s0=peg$currPos,s1=peg$currPos,peg$silentFails++,s2=peg$parseEscapableChars(),peg$silentFails--,s2===peg$FAILED?s1=void 0:(peg$currPos=s1,s1=peg$FAILED),s1!==peg$FAILED?(input.length>peg$currPos?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c19)),s2!==peg$FAILED?(peg$savedPos=s0,s1=peg$c20(s2),s0=s1):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0===peg$FAILED&&(s0=peg$parseEscapedSequence()),s0}function peg$parseProperties(){var s0,s1,s2,s3;if(s0=peg$currPos,s1=peg$parsePropertyChar(),s1!==peg$FAILED){for(s2=[],s3=peg$parseProperty();s3!==peg$FAILED;)s2.push(s3),s3=peg$parseProperty();s2!==peg$FAILED?(peg$savedPos=s0,s1=peg$c21(s2),s0=s1):(peg$currPos=s0,s0=peg$FAILED)}else peg$currPos=s0,s0=peg$FAILED;return s0}function peg$parseProperty(){var s0,s1,s2;if(s0=peg$currPos,s1=[],s2=peg$parseCharacter(),s2!==peg$FAILED)for(;s2!==peg$FAILED;)s1.push(s2),s2=peg$parseCharacter();else s1=peg$FAILED;return s1!==peg$FAILED?(s2=peg$parseSeparatorChar(),s2===peg$FAILED&&(s2=null),s2!==peg$FAILED?(peg$savedPos=s0,s1=peg$c22(s1),s0=s1):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseTransforms(){var s0,s1,s2,s3;if(s0=peg$currPos,s1=peg$parseTransformChar(),s1!==peg$FAILED){for(s2=[],s3=peg$parseTransform();s3!==peg$FAILED;)s2.push(s3),s3=peg$parseTransform();s2!==peg$FAILED?(peg$savedPos=s0,s1=peg$c23(s2),s0=s1):(peg$currPos=s0,s0=peg$FAILED)}else peg$currPos=s0,s0=peg$FAILED;return s0}function peg$parseTransform(){var s0,s1,s2;if(s0=peg$currPos,s1=[],s2=peg$parseCharacter(),s2!==peg$FAILED)for(;s2!==peg$FAILED;)s1.push(s2),s2=peg$parseCharacter();else s1=peg$FAILED;return s1!==peg$FAILED?(s2=peg$parseSeparatorChar(),s2===peg$FAILED&&(s2=null),s2!==peg$FAILED?(peg$savedPos=s0,s1=peg$c24(s1),s0=s1):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseCharacter(){var s0,s1,s2;return s0=peg$currPos,s1=peg$currPos,peg$silentFails++,s2=peg$parseEscapableChars(),s2===peg$FAILED&&(s2=peg$parseSeparatorChar()),peg$silentFails--,s2===peg$FAILED?s1=void 0:(peg$currPos=s1,s1=peg$FAILED),s1!==peg$FAILED?(input.length>peg$currPos?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c19)),s2!==peg$FAILED?(peg$savedPos=s0,s1=peg$c20(s2),s0=s1):(peg$currPos=s0,s0=peg$FAILED)):(peg$currPos=s0,s0=peg$FAILED),s0}function peg$parseWhitespace(){var s0,s1;if(s0=[],peg$c25.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c26)),s1!==peg$FAILED)for(;s1!==peg$FAILED;)s0.push(s1),peg$c25.test(input.charAt(peg$currPos))?(s1=input.charAt(peg$currPos),peg$currPos++):(s1=peg$FAILED,0===peg$silentFails&&peg$fail(peg$c26));else s0=peg$FAILED;return s0}function tryParseInt(str){return isNaN(str)?str:parseInt(str)}options=void 0!==options?options:{};var peg$result,peg$FAILED={},peg$startRuleFunctions={Start:peg$parseStart},peg$startRuleFunction=peg$parseStart,peg$c0=function(references){return references},peg$c1=">",peg$c2=peg$literalExpectation(">",!1),peg$c3="^",peg$c4=peg$literalExpectation("^",!1),peg$c5="#",peg$c6=peg$literalExpectation("#",!1),peg$c7=",",peg$c8=peg$literalExpectation(",",!1),peg$c9=":",peg$c10=peg$literalExpectation(":",!1),peg$c11="\\",peg$c12=peg$literalExpectation("\\",!1),peg$c13=function(c){return c},peg$c14=function(target){return scopeIndex++,scope+=text(),target.type="scope",target},peg$c15=function(target){return scopeIndex++,scope+=text(),target.type="intersect",target},peg$c16=function(target){return scopeIndex++,scope+=text(),target.type="target",target},peg$c17=function(label){return label},peg$c18=function(label,properties,transforms){return{label:label.join("").trim(),properties:properties||[],transforms:transforms||[],scope:scope.slice(0,-1).trim(),scopeIndex:scopeIndex,path:(scope+text()).trim()}},peg$c19=peg$anyExpectation(),peg$c20=function(c){return c},peg$c21=function(properties){
return properties},peg$c22=function(name){return tryParseInt(name.join("").trim())},peg$c23=function(transforms){return transforms},peg$c24=function(name){return name.join("").trim()},peg$c25=/^[ \t\r\n]/,peg$c26=peg$classExpectation([" ","\t","\r","\n"],!1,!1),peg$currPos=0,peg$savedPos=0,peg$posDetailsCache=[{line:1,column:1}],peg$maxFailPos=0,peg$maxFailExpected=[],peg$silentFails=0;if("startRule"in options){if(!(options.startRule in peg$startRuleFunctions))throw new Error("Can't start parsing from rule \""+options.startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options.startRule]}var scope="",scopeIndex=0;if(peg$result=peg$startRuleFunction(),peg$result!==peg$FAILED&&peg$currPos===input.length)return peg$result;throw peg$result!==peg$FAILED&&peg$currPos<input.length&&peg$fail(peg$endExpectation()),peg$buildStructuredError(peg$maxFailExpected,peg$maxFailPos<input.length?input.charAt(peg$maxFailPos):null,peg$maxFailPos<input.length?peg$computeLocation(peg$maxFailPos,peg$maxFailPos+1):peg$computeLocation(peg$maxFailPos,peg$maxFailPos))}peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.buildMessage=function(expected,found){function hex(ch){return ch.charCodeAt(0).toString(16).toUpperCase()}function literalEscape(s){return s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch){return"\\x0"+hex(ch)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch){return"\\x"+hex(ch)})}function classEscape(s){return s.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch){return"\\x0"+hex(ch)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch){return"\\x"+hex(ch)})}function describeExpectation(expectation){return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation)}function describeExpected(expected){var i,j,descriptions=new Array(expected.length);for(i=0;i<expected.length;i++)descriptions[i]=describeExpectation(expected[i]);if(descriptions.sort(),descriptions.length>0){for(i=1,j=1;i<descriptions.length;i++)descriptions[i-1]!==descriptions[i]&&(descriptions[j]=descriptions[i],j++);descriptions.length=j}switch(descriptions.length){case 1:return descriptions[0];case 2:return descriptions[0]+" or "+descriptions[1];default:return descriptions.slice(0,-1).join(", ")+", or "+descriptions[descriptions.length-1]}}function describeFound(found){return found?'"'+literalEscape(found)+'"':"end of input"}var DESCRIBE_EXPECTATION_FNS={literal:function(expectation){return'"'+literalEscape(expectation.text)+'"'},"class":function(expectation){var i,escapedParts="";for(i=0;i<expectation.parts.length;i++)escapedParts+=expectation.parts[i]instanceof Array?classEscape(expectation.parts[i][0])+"-"+classEscape(expectation.parts[i][1]):classEscape(expectation.parts[i]);return"["+(expectation.inverted?"^":"")+escapedParts+"]"},any:function(expectation){return"any character"},end:function(expectation){return"end of input"},other:function(expectation){return expectation.description}};return"Expected "+describeExpected(expected)+" but "+describeFound(found)+" found."},module.exports={SyntaxError:peg$SyntaxError,parse:peg$parse}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _contains=__webpack_require__(11),_contains2=_interopRequireDefault(_contains),_exactText=__webpack_require__(13),_exactText2=_interopRequireDefault(_exactText),_value=__webpack_require__(14),_value2=_interopRequireDefault(_value),_class=__webpack_require__(15),_class2=_interopRequireDefault(_class),_nodeType=__webpack_require__(17),_nodeType2=_interopRequireDefault(_nodeType),_css=__webpack_require__(18),_css2=_interopRequireDefault(_css),_attribute=__webpack_require__(19),_attribute2=_interopRequireDefault(_attribute),_visible=__webpack_require__(20),_visible2=_interopRequireDefault(_visible),_targetIsLeafNode=__webpack_require__(21),_targetIsLeafNode2=_interopRequireDefault(_targetIsLeafNode),_inputafter=__webpack_require__(22),_inputafter2=_interopRequireDefault(_inputafter),_shortestScopeAndContainerPath=__webpack_require__(23),_shortestScopeAndContainerPath2=_interopRequireDefault(_shortestScopeAndContainerPath),_index=__webpack_require__(24),_index2=_interopRequireDefault(_index);exports["default"]=[_contains2["default"],_exactText2["default"],_value2["default"],_class2["default"],_attribute2["default"],_nodeType2["default"],_css2["default"],_visible2["default"],_targetIsLeafNode2["default"],_inputafter2["default"],_shortestScopeAndContainerPath2["default"],_index2["default"]]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _xpath=__webpack_require__(12),_xpath2=_interopRequireDefault(_xpath),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{contains:{locate:function(_ref){var label=_ref.label,scopeElement=_ref.scopeElement,resultHandler=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(err,result){return result};return _log2["default"].debug("Searching for text that contains:",label),(0,_xpath2["default"])(".//*[not(self::script) and not(self::noscript) and not(self::style) and text()[contains(translate(., 'ABCDEFGHJIKLMNOPQRSTUVWXYZ', 'abcdefghjiklmnopqrstuvwxyz'),translate('"+label+"', 'ABCDEFGHJIKLMNOPQRSTUVWXYZ', 'abcdefghjiklmnopqrstuvwxyz'))]]",scopeElement,resultHandler)}}}}},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=function(label,scopeElement,resultHandler){return browserExecute(function(label,scopeElement,handler){try{for(var results=[],xpathResult=document.evaluate(label,scopeElement,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),i=0;i<xpathResult.snapshotLength;i++)results.push(xpathResult.snapshotItem(i));return handler(null,results)}catch(err){return handler(err,[])}},label,scopeElement,function(err,result){return err?resultHandler(err,[]):resultHandler(null,result)})}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _xpath=__webpack_require__(12),_xpath2=_interopRequireDefault(_xpath),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{"exact-text":{locate:function(_ref){var label=_ref.label,scopeElement=_ref.scopeElement,resultHandler=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(err,result){return result};return _log2["default"].debug("Searching for text that exact matches:",label),(0,_xpath2["default"])(".//*[not(self::script) and text()='"+label+"']",scopeElement,resultHandler)}}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{value:{locate:function(_ref){var label=_ref.label,scopeElement=_ref.scopeElement,resultHandler=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(err,result){return result};try{return _log2["default"].debug("Searching in value:",label),browserExecute(function(scope,l,handler){var results=scope.querySelectorAll("button,input,option,param"),elements=Array.prototype.slice.apply(results);return handler(null,elements.filter(function(input){return input.value&&input.value.toLowerCase().indexOf(l.toLowerCase())!=-1}))},scopeElement,label,resultHandler)}catch(error){return resultHandler(error,[])}}}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _css=__webpack_require__(16),_css2=_interopRequireDefault(_css),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{"class":{locate:function(_ref){var label=_ref.label,scopeElement=_ref.scopeElement,resultHandler=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(err,result){return result};try{return _log2["default"].debug("Searching as class name:",label),(0,_css2["default"])("."+label,scopeElement,resultHandler)}catch(e){return resultHandler(null,[])}}}}}},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=function(label,scopeElement){var resultHandler=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(err,result){return result};return browserExecute(function(label,scopeElement,handler){try{var results=[],matches=scopeElement.matches||scopeElement.matchesSelector||scopeElement.msMatchesSelector||scopeElement.mozMatchesSelector||scopeElement.webkitMatchesSelector||scopeElement.oMatchesSelector;return matches&&matches.call(scopeElement,label)&&results.push(scopeElement),results=results.concat(Array.prototype.slice.apply(scopeElement.querySelectorAll(label))),handler(null,results)}catch(e){return e instanceof DOMException?handler(null,[]):handler(e,[])}},label,scopeElement,resultHandler)}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _css=__webpack_require__(16),_css2=_interopRequireDefault(_css),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{"node-type":{locate:function(_ref){var label=_ref.label,scopeElement=_ref.scopeElement,resultHandler=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(err,result){return result};try{return _log2["default"].debug("Searching by node type:",label),(0,_css2["default"])(""+label,scopeElement,resultHandler)}catch(err){return resultHandler(err,[])}}}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _css=__webpack_require__(16),_css2=_interopRequireDefault(_css),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{css:{locate:function(_ref){var label=_ref.label,scopeElement=_ref.scopeElement,resultHandler=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(err,result){return result};try{return _log2["default"].debug("Searching as css:",label),(0,_css2["default"])(""+label,scopeElement,resultHandler)}catch(err){return resultHandler(err,[])}}}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _xpath=__webpack_require__(12),_xpath2=_interopRequireDefault(_xpath),_arrayUtils=__webpack_require__(6),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={locator:{check:function(_ref){var target=(_ref.label,_ref.target),attributes=target.properties.filter(function(p){return isNaN(p)&&p.indexOf("attribute-")>-1});return attributes.length>0},locate:function(_ref2){var label=_ref2.label,target=_ref2.target,scopeElement=_ref2.scopeElement,resultHandler=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(err,result){return result},attributes=target.properties.filter(function(p){return isNaN(p)&&p.indexOf("attribute-")>-1});return attributes.length>0?(0,_arrayUtils.reduce)(attributes,[],function(result,attribute,callback){var key=attribute.slice("attribute-".length);return _log2["default"].debug("Searching "+key+" attribute:",label),(0,_xpath2["default"])(".//*[contains(translate(@"+key+", 'ABCDEFGHJIKLMNOPQRSTUVWXYZ', 'abcdefghjiklmnopqrstuvwxyz'), translate('"+label+"', 'ABCDEFGHJIKLMNOPQRSTUVWXYZ', 'abcdefghjiklmnopqrstuvwxyz'))]",scopeElement,function(err,r){return callback(err,result.concat(r))})},resultHandler):resultHandler(null,[])}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{visible:{filter:function(_ref,resultHandler){var elements=_ref.elements;return _log2["default"].debug("Filtering for visible elements"),browserExecute(function(elements,handler){try{return handler(null,elements.filter(function(e){if("option"==e.tagName.toLowerCase()||e.offsetParent)return!0;var style=window.getComputedStyle(e);return"fixed"==style.position&&"none"!=style.display&&"hidden"!=style.visibility}))}catch(err){return handler(err,[])}},elements,resultHandler)}}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{"target-is-leaf-node":{filter:function(_ref,resultHandler){var target=_ref.target,elements=_ref.elements;return _log2["default"].debug("Filtering for leaf node targets"),"target"!=target.type?resultHandler(null,elements):browserExecute(function(elements,handler){try{var filteredElements=elements.filter(function(e){return!e.childNodes||0==e.childNodes.length||[].slice.call(e.childNodes).every(function(c){return c.nodeType==Node.TEXT_NODE})});return 0==filteredElements.length?handler(null,elements):handler(null,filteredElements)}catch(err){return handler(err,[])}},elements,resultHandler)}}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{inputafter:{filter:function(_ref,resultHandler){var elements=_ref.elements,scopeElements=_ref.scopeElements;return _log2["default"].debug("Filtering for sibling input next to scope"),browserExecute(function(elements,scopeElements,handler){var siblings=elements.filter(function(e){return"input"==e.nodeName.toLowerCase()&&(e.previousElementSibling&&"input"!=e.previousElementSibling.nodeName.toLowerCase()&&scopeElements.indexOf(e.previousElementSibling)!=-1)});return handler(null,0==siblings.length?elements:siblings)},elements,scopeElements,resultHandler)}}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={properties:{shortestscopeandcontainerpath:{filter:function(_ref,resultHandler){var elements=_ref.elements,scopeElements=_ref.scopeElements,target=_ref.target;return _log2["default"].debug("Filtering for shortest scope and target"),browserExecute(function(elements,scopeElements,scopeIndex,handler){try{var elementsForDistance,distanceToScopeLookup,closestLevel,closestElements,_ret=function(){var addToLookup=function(element,distance){elementsForDistance.push(element);var i=elementsForDistance.indexOf(element);distanceToScopeLookup[i]=distance},lookup=function(element){var i=elementsForDistance.indexOf(element);return i==-1?null:distanceToScopeLookup[i]};return elementsForDistance=[],distanceToScopeLookup={},0==scopeIndex?{v:handler(null,elements)}:(scopeElements.forEach(function(v){for(var p=v,i=0;null!=p&&null!=p.outerHTML;){var distanceToScope=lookup(p);(!distanceToScope||i<distanceToScope)&&addToLookup(p,i),++i,p=p.parentNode}}),closestLevel=-1,closestElements=[],elements.forEach(function(element){for(var parent=element,distanceToScope=lookup(parent);(closestLevel==-1||!distanceToScope||distanceToScope<=closestLevel)&&null!=parent&&null!=parent.outerHTML;){if(distanceToScope||0===distanceToScope){distanceToScope<closestLevel&&(closestElements=[]),closestLevel=distanceToScope,closestElements.push(element);break}parent=parent.parentNode,distanceToScope=lookup(parent)}}),{v:handler(null,closestElements)})}();if("object"===("undefined"==typeof _ret?"undefined":_typeof(_ret)))return _ret.v}catch(err){return handler(err,[])}},elements,scopeElements,target.scopeIndex,resultHandler)}}}}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _arrayUtils=__webpack_require__(6),_log=__webpack_require__(5),_log2=_interopRequireDefault(_log);exports["default"]={filter:{useDefaultFiltersIfFirst:!0,apply:function(_ref){var elements=_ref.elements,target=_ref.target,resultHandler=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(err,result){return result};_log2["default"].debug("Filtering by index");var attributes=target.properties.filter(function(p){return!isNaN(p)});return attributes.length>0?(0,_arrayUtils.reduce)(attributes,[],function(result,attribute,callback){var position=attribute;if(_log2["default"].debug("Selecting the",position,"element out of",elements.length),null==position)return callback(null,result.concat(elements));if(position<=0)return console.log("Positions start at 1"),callback("Positions start at 1",result.concat([]));if(elements.length<position)return console.log("Position "+position+" out of range"),callback("Position "+position+" out of range",result.concat([]));var i=position-1;return callback(null,result.concat(elements[i]))},resultHandler):resultHandler(null,elements)}}}},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=["contains","value","attribute-placeholder","attribute-name","attribute-id","class","attribute-alt","attribute-type","node-type","visible","target-is-leaf-node","inputafter","shortestscopeandcontainerpath","index"]}]);