!function(){var moduleFactory=function($){var module=this,exports=function(){var defaultOptions={using:[],inside:{},within:[],exclude:[],match:function(){},depth:1},$match=function(value,keyword){return"string"==typeof value||"number"==typeof value?value.toUpperCase().indexOf(keyword.toUpperCase())>=0:!1};$.lookup=function(options){if("string"==typeof options&&(options={using:arguments[0],dataset:arguments[1]||{}}),options=$.extend({},defaultOptions,options),$.isEmptyObject(options.inside))return{};if("string"==typeof options.using&&(options.using=$.trim(options.using).split(" ")),options.using.length<1)return options.inside;
"string"==typeof options.within&&(options.within=$.trim(options.within).split(" "));var dataset=$.makeArray($.extend(!0,{length:options.inside.length},options.inside)),result=[];return $.each(options.using,function(i,keyword){result=result.concat($.grep(dataset,function(data){var match=!1;if(!data[".added"]){if($.each(options.exclude,function(i,pattern){for(key in pattern)return match=$match(data[key],pattern[key]),!match}),match)return!1;if(options.within.length>0)$.each(options.within,function(i,key){return match=$match(data[key],keyword),!match
});else for(key in data)if(match=$match(data[key],keyword))break;return match&&(data[".added"]=!0),match}}))}),result}};exports(),module.resolveWith(exports)};dispatch("lookup").containing(moduleFactory).to("Foundry/2.1 Modules")}();