text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@polymer/polymer/polymer-element.js"),require("@polymer/polymer/lib/utils/resolve-url.js"),require("@lrnwebcomponents/es-global-bridge/es-global-bridge.js"),require("@polymer/iron-ajax/iron-ajax.js")):"function"==typeof define&&define.amd?define(["exports","@polymer/polymer/polymer-element.js","@polymer/polymer/lib/utils/resolve-url.js","@lrnwebcomponents/es-global-bridge/es-global-bridge.js","@polymer/iron-ajax/iron-ajax.js"],t):t((e=e||self).LunrSearch={},e.polymerElement_js,e.resolveUrl_js)}(this,function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t,r){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=i(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function s(){var e,t,r=(e=['\n<style>:host {\n  display: block;\n}\n\n:host([hidden]) {\n  display: none;\n}\n</style>\n<iron-ajax\n  auto\n  url="[[dataSource]]"\n  method="[[method]]"\n  handle-as="json"\n  on-response="_dataResponse"\n></iron-ajax>'],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return s=function(){return r},r}var d=function(e){function n(){var e,t,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t=this,e=!(o=i(n).call(this))||"object"!=typeof o&&"function"!=typeof o?a(t):o;var l=r.pathFromUrl("undefined"!=typeof document?document.currentScript&&document.currentScript.src||document.baseURI:new("undefined"!=typeof URL?URL:require("url").URL)("file:"+__filename).href),u="".concat(l,"../../lunr/lunr.js");return window.addEventListener("es-bridge-lunr-loaded",e._lunrLoaded.bind(a(e))),window.ESGlobalBridge.requestAvailability(),window.ESGlobalBridge.instance.load("lunr",u),window.ESGlobalBridge.imports&&window.ESGlobalBridge.imports.lunr&&(e.__lunrLoaded=!0),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(n,t.PolymerElement),o(n,null,[{key:"template",get:function(){return t.html(s())}},{key:"properties",get:function(){return{dataSource:{name:"dataSource",type:"String"},data:{name:"data",type:"Array",notify:!0},method:{name:"method",type:"String",value:"GET"},search:{type:"String",notify:!0},results:{type:"Array",computed:"searched(data, search, index, minScore, limit)",notify:!0},noStopWords:{type:"Boolean",value:!1,notify:!0},fields:{type:"Array",value:[]},indexNoStopWords:{type:"Object"},index:{type:"Object",computed:"_createIndex(data, fields, noStopWords, __lunrLoaded)"},__lunrLoaded:{type:"Boolean"},limit:{type:"Number",value:500},minScore:{type:"Number",value:0},log:{type:"Boolean",value:!1}}}}]),o(n,[{key:"disconnectedCallback",value:function(){window.removeEventListener("es-bridge-lunr-loaded",this._lunrLoaded.bind(this)),u(i(n.prototype),"disconnectedCallback",this).call(this)}},{key:"_lunrLoaded",value:function(e){this.__lunrLoaded=!0}},{key:"_dataResponse",value:function(e){this.set("data",e.detail.response),this.notifyPath("data.*")}},{key:"searched",value:function(e,t,r,n,o){if(e&&r&&t){var i=[];if(""+t!="")for(var l=r.search(t),a=0;a<l.length&&!(a===o||l[a].score<n);a++){var u=e.find(function(e){return e.id==l[a].ref});i.push(u)}if(0===i.length&&!this.noStopWords&&""+t!=""){this.indexNoStopWords||(this.indexNoStopWords=this._createIndex(e,this.fields,!0,r)),l=this.indexNoStopWords.search(t);for(i=[],a=0;a<l.length&&!(a===o||l[a].score<n);a++){var s=e.find(function(e){return e.id==l[a].ref});i.push(s)}}return i}}},{key:"_createIndex",value:function(e,t,r,n){if(n){var o=this;if(Array.isArray(e)&&e.length>0){if(Array.isArray(t)&&t.length>0)return lunr(function(){for(var n=0;n<t.length;n++)t[n].charAt(0)===t[n].charAt(0).toUpperCase()?this.field(t[n],{boost:10}):this.field(t[n]);for(n=0;n<e.length;n++){for(var o={id:n},i=0;i<t.length;i++)e[n].hasOwnProperty(t[i])&&null!==e[n][t[i]]&&"function"==typeof e[n][t[i]].toString&&(e[n][t[i]].toString().split(" ").length>2||e[n][t[i]].toString().length<30)?o[t[i]]=e[n][t[i]].toString():o[t[i]]="";this.add(o)}r&&this.pipeline.remove(lunr.stopWordFilter)});t=[];var i={};return lunr(function(){for(var n=0;n<e.length;n++)for(var l in e[n])"_"!==l.charAt(0)&&!i.hasOwnProperty(l)&&(l.toString().split(" ").length>2||l.toString().length<30)&&(t.push(l),l.charAt(0)===l.charAt(0).toUpperCase()?this.field(l,{boost:10}):this.field(l),i[l]=1);t.length>0&&(o.fields=t);for(var a=0;a<e.length;a++){for(var u={id:a},s=0;s<t.length;s++)e[a].hasOwnProperty(t[s])&&null!==e[a][t[s]]&&"function"==typeof e[a][t[s]].toString&&(e[a][t[s]].toString().split(" ").length>2||e[a][t[s]].toString().length<30)?u[t[s]]=e[a][t[s]].toString():u[t[s]]="";this.add(u)}r&&this.pipeline.remove(lunr.stopWordFilter)})}}}}],[{key:"tag",get:function(){return"lunr-search"}}]),n}();window.customElements.define(d.tag,d),e.LunrSearch=d,Object.defineProperty(e,"__esModule",{value:!0})});
  //# sourceMappingURL=lunr-search.umd.js.map
  