!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):t.Mark=e(t.jQuery)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;n(this,t),this.ctx=e,this.iframes=i,this.exclude=r,this.iframesTimeout=o}return i(t,[{key:"getContexts",value:function(){var t=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach(function(e){var n=t.filter(function(t){return t.contains(e)}).length>0;-1!==t.indexOf(e)||n||t.push(e)}),t}},{key:"getIframeContents",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=void 0;try{var r=t.contentWindow;if(i=r.document,!r||!i)throw new Error("iframe inaccessible")}catch(t){n()}i&&e(i)}},{key:"isIframeBlank",value:function(t){var e="about:blank",n=t.getAttribute("src").trim();return t.contentWindow.location.href===e&&n!==e&&n}},{key:"observeIframeLoad",value:function(t,e,n){var i=this,r=!1,o=null,a=function a(){if(!r){r=!0,clearTimeout(o);try{i.isIframeBlank(t)||(t.removeEventListener("load",a),i.getIframeContents(t,e,n))}catch(t){n()}}};t.addEventListener("load",a),o=setTimeout(a,this.iframesTimeout)}},{key:"onIframeReady",value:function(t,e,n){try{"complete"===t.contentWindow.document.readyState?this.isIframeBlank(t)?this.observeIframeLoad(t,e,n):this.getIframeContents(t,e,n):this.observeIframeLoad(t,e,n)}catch(t){n()}}},{key:"waitForIframes",value:function(t,e){var n=this,i=0;this.forEachIframe(t,function(){return!0},function(t){i++,n.waitForIframes(t.querySelector("html"),function(){--i||e()})},function(t){t||e()})}},{key:"forEachIframe",value:function(e,n,i){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},a=e.querySelectorAll("iframe"),s=a.length,l=0;a=Array.prototype.slice.call(a);var u=function(){--s<=0&&o(l)};s||u(),a.forEach(function(e){t.matches(e,r.exclude)?u():r.onIframeReady(e,function(t){n(e)&&(l++,i(t)),u()},u)})}},{key:"createIterator",value:function(t,e,n){return document.createNodeIterator(t,e,n,!1)}},{key:"createInstanceOnIframe",value:function(e){return new t(e.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(t,e,n){if(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING){if(null===e)return!0;if(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(t){var e=t.previousNode();return{prevNode:e,node:null===e?t.nextNode():t.nextNode()&&t.nextNode()}}},{key:"checkIframeFilter",value:function(t,e,n,i){var r=!1,o=!1;return i.forEach(function(t,e){t.val===n&&(r=e,o=t.handled)}),this.compareNodeIframe(t,e,n)?(!1!==r||o?!1===r||o||(i[r].handled=!0):i.push({val:n,handled:!0}),!0):(!1===r&&i.push({val:n,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(t,e,n,i){var r=this;t.forEach(function(t){t.handled||r.getIframeContents(t.val,function(t){r.createInstanceOnIframe(t).forEachNode(e,n,i)})})}},{key:"iterateThroughNodes",value:function(t,e,n,i,r){for(var o,a=this,s=this.createIterator(e,t,i),l=[],u=[],c=void 0,h=void 0;o=void 0,o=a.getIteratorNode(s),h=o.prevNode,c=o.node;)this.iframes&&this.forEachIframe(e,function(t){return a.checkIframeFilter(c,h,t,l)},function(e){a.createInstanceOnIframe(e).forEachNode(t,function(t){return u.push(t)},i)}),u.push(c);u.forEach(function(t){n(t)}),this.iframes&&this.handleOpenIframes(l,t,n,i),r()}},{key:"forEachNode",value:function(t,e,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),a=o.length;a||r(),o.forEach(function(o){var s=function(){i.iterateThroughNodes(t,o,e,n,function(){--a<=0&&r()})};i.iframes?i.waitForIframes(o,s):s()})}}],[{key:"matches",value:function(t,e){var n="string"==typeof e?[e]:e,i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector;if(i){var r=!1;return n.every(function(e){return!i.call(t,e)||(r=!0,!1)}),r}return!1}}]),t}(),a=function(){function t(e){n(this,t),this.ctx=e,this.ie=!1;var i=window.navigator.userAgent;(i.indexOf("MSIE")>-1||i.indexOf("Trident")>-1)&&(this.ie=!0)}return i(t,[{key:"log",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",i=this.opt.log;this.opt.debug&&"object"===(void 0===i?"undefined":e(i))&&"function"==typeof i[n]&&i[n]("mark.js: "+t)}},{key:"escapeStr",value:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(t){return"disabled"!==this.opt.wildcards&&(t=this.setupWildcardsRegExp(t)),t=this.escapeStr(t),Object.keys(this.opt.synonyms).length&&(t=this.createSynonymsRegExp(t)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(t=this.setupIgnoreJoinersRegExp(t)),this.opt.diacritics&&(t=this.createDiacriticsRegExp(t)),t=this.createMergedBlanksRegExp(t),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(t=this.createJoinersRegExp(t)),"disabled"!==this.opt.wildcards&&(t=this.createWildcardsRegExp(t)),t=this.createAccuracyRegExp(t)}},{key:"createSynonymsRegExp",value:function(t){var e=this.opt.synonyms,n=this.opt.caseSensitive?"":"i",i=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var r in e)if(e.hasOwnProperty(r)){var o=e[r],a="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(r):this.escapeStr(r),s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o);""!==a&&""!==s&&(t=t.replace(new RegExp("("+this.escapeStr(a)+"|"+this.escapeStr(s)+")","gm"+n),i+"("+this.processSynomyms(a)+"|"+this.processSynomyms(s)+")"+i))}return t}},{key:"processSynomyms",value:function(t){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(t=this.setupIgnoreJoinersRegExp(t)),t}},{key:"setupWildcardsRegExp",value:function(t){return(t=t.replace(/(?:\\)*\?/g,function(t){return"\\"===t.charAt(0)?"?":""})).replace(/(?:\\)*\*/g,function(t){return"\\"===t.charAt(0)?"*":""})}},{key:"createWildcardsRegExp",value:function(t){var e="withSpaces"===this.opt.wildcards;return t.replace(/\u0001/g,e?"[\\S\\s]?":"\\S?").replace(/\u0002/g,e?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(t){return t.replace(/[^(|)\\]/g,function(t,e,n){var i=n.charAt(e+1);return/[(|)\\]/.test(i)||""===i?t:t+"\0"})}},{key:"createJoinersRegExp",value:function(t){var e=[],n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&e.push(this.escapeStr(n.join(""))),this.opt.ignoreJoiners&&e.push("\\u00ad\\u200b\\u200c\\u200d"),e.length?t.split(/\u0000+/).join("["+e.join("")+"]*"):t}},{key:"createDiacriticsRegExp",value:function(t){var e=this.opt.caseSensitive?"":"i",n=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"],i=[];return t.split("").forEach(function(r){n.every(function(n){if(-1!==n.indexOf(r)){if(i.indexOf(n)>-1)return!1;t=t.replace(new RegExp("["+n+"]","gm"+e),"["+n+"]"),i.push(n)}return!0})}),t}},{key:"createMergedBlanksRegExp",value:function(t){return t.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(t){var e=this,n=this.opt.accuracy,i="string"==typeof n?n:n.value,r="string"==typeof n?[]:n.limiters,o="";switch(r.forEach(function(t){o+="|"+e.escapeStr(t)}),i){case"partially":default:return"()("+t+")";case"complementary":return"()([^"+(o="\\s"+(o||this.escapeStr("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿")))+"]*"+t+"[^"+o+"]*)";case"exactly":return"(^|\\s"+o+")("+t+")(?=$|\\s"+o+")"}}},{key:"getSeparatedKeywords",value:function(t){var e=this,n=[];return t.forEach(function(t){e.opt.separateWordSearch?t.split(" ").forEach(function(t){t.trim()&&-1===n.indexOf(t)&&n.push(t)}):t.trim()&&-1===n.indexOf(t)&&n.push(t)}),{keywords:n.sort(function(t,e){return e.length-t.length}),length:n.length}}},{key:"isNumeric",value:function(t){return Number(parseFloat(t))==t}},{key:"checkRanges",value:function(t){var e=this;if(!Array.isArray(t)||"[object Object]"!==Object.prototype.toString.call(t[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(t),[];var n=[],i=0;return t.sort(function(t,e){return t.start-e.start}).forEach(function(t){var r=e.callNoMatchOnInvalidRanges(t,i),o=r.start,a=r.end;r.valid&&(t.start=o,t.length=a-o,n.push(t),i=a)}),n}},{key:"callNoMatchOnInvalidRanges",value:function(t,e){var n=void 0,i=void 0,r=!1;return t&&void 0!==t.start?(i=(n=parseInt(t.start,10))+parseInt(t.length,10),this.isNumeric(t.start)&&this.isNumeric(t.length)&&i-e>0&&i-n>0?r=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(t)),this.opt.noMatch(t))):(this.log("Ignoring invalid range: "+JSON.stringify(t)),this.opt.noMatch(t)),{start:n,end:i,valid:r}}},{key:"checkWhitespaceRanges",value:function(t,e,n){var i=void 0,r=!0,o=n.length,a=e-o,s=parseInt(t.start,10)-a;return(i=(s=s>o?o:s)+parseInt(t.length,10))>o&&(i=o,this.log("End range automatically set to the max value of "+o)),s<0||i-s<0||s>o||i>o?(r=!1,this.log("Invalid range: "+JSON.stringify(t)),this.opt.noMatch(t)):""===n.substring(s,i).replace(/\s+/g,"")&&(r=!1,this.log("Skipping whitespace only range: "+JSON.stringify(t)),this.opt.noMatch(t)),{start:s,end:i,valid:r}}},{key:"getTextNodes",value:function(t){var e=this,n="",i=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(t){i.push({start:n.length,end:(n+=t.textContent).length,node:t})},function(t){return e.matchesExclude(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){t({value:n,nodes:i})})}},{key:"matchesExclude",value:function(t){return o.matches(t,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(t,e,n){var i=this.opt.element?this.opt.element:"mark",r=t.splitText(e),o=r.splitText(n-e),a=document.createElement(i);return a.setAttribute("data-markjs","true"),this.opt.className&&a.setAttribute("class",this.opt.className),a.textContent=r.textContent,r.parentNode.replaceChild(a,r),o}},{key:"wrapRangeInMappedTextNode",value:function(t,e,n,i,r){var o=this;t.nodes.every(function(a,s){var l=t.nodes[s+1];if(void 0===l||l.start>e){if(!i(a.node))return!1;var u=e-a.start,c=(n>a.end?a.end:n)-a.start,h=t.value.substr(0,a.start),p=t.value.substr(c+a.start);if(a.node=o.wrapRangeInTextNode(a.node,u,c),t.value=h+p,t.nodes.forEach(function(e,n){n>=s&&(t.nodes[n].start>0&&n!==s&&(t.nodes[n].start-=c),t.nodes[n].end-=c)}),n-=c,r(a.node.previousSibling,a.start),!(n>a.end))return!1;e=a.end}return!0})}},{key:"wrapMatches",value:function(t,e,n,i,r){var o=this,a=0===e?0:e+1;this.getTextNodes(function(e){e.nodes.forEach(function(e){e=e.node;for(var r=void 0;null!==(r=t.exec(e.textContent))&&""!==r[a];)if(n(r[a],e)){var s=r.index;if(0!==a)for(var l=1;l=this.maxSize&&(this.list.remove(i),delete this.hash[i.key],this.size--),(n=this.hash[t])?(n.val=e,this.list.moveToFront(n)):(n=new r(t,e),this.list.add(n),this.hash[t]=n,this.size++)},get:function(t){var e=this.hash[t];if(e)return this.list.moveToFront(e),e.val},reset:function(){this.size=0,this.hash={},this.list=new i}}),e.mixin(i.prototype,{add:function(t){this.head&&(t.next=this.head,this.head.prev=t),this.head=t,this.tail=this.tail||t},remove:function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev},moveToFront:function(t){this.remove(t),this.add(t)}}),n}(),o=function(){"use strict";var n;try{(n=window.localStorage).setItem("~~~","!"),n.removeItem("~~~")}catch(t){n=null}function i(t,i){this.prefix=["__",t,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+e.escapeRegExChars(this.prefix)),this.ls=i||n,!this.ls&&this._noop()}return e.mixin(i.prototype,{_prefix:function(t){return this.prefix+t},_ttlKey:function(t){return this._prefix(t)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=e.noop},_safeSet:function(t,e){try{this.ls.setItem(t,e)}catch(t){"QuotaExceededError"===t.name&&(this.clear(),this._noop())}},get:function(t){return this.isExpired(t)&&this.remove(t),a(this.ls.getItem(this._prefix(t)))},set:function(t,n,i){return e.isNumber(i)?this._safeSet(this._ttlKey(t),o(r()+i)):this.ls.removeItem(this._ttlKey(t)),this._safeSet(this._prefix(t),o(n))},remove:function(t){return this.ls.removeItem(this._ttlKey(t)),this.ls.removeItem(this._prefix(t)),this},clear:function(){var t,e=function(t){var e,i,r=[],o=n.length;for(e=0;en)}}),i;function r(){return(new Date).getTime()}function o(t){return JSON.stringify(e.isUndefined(t)?null:t)}function a(e){return t.parseJSON(e)}}(),a=function(){"use strict";var n=0,i={},o=6,a=new r(10);function s(t){t=t||{},this.cancelled=!1,this.lastReq=null,this._send=t.transport,this._get=t.limiter?t.limiter(this._get):this._get,this._cache=!1===t.cache?new r(0):a}return s.setMaxPendingRequests=function(t){o=t},s.resetCache=function(){a.reset()},e.mixin(s.prototype,{_fingerprint:function(e){return(e=e||{}).url+e.type+t.param(e.data||{})},_get:function(t,e){var r,a,s=this;function l(t){e(null,t),s._cache.set(r,t)}function u(){e(!0)}r=this._fingerprint(t),this.cancelled||r!==this.lastReq||((a=i[r])?a.done(l).fail(u):ne[i]?i++:(r.push(t[n]),n++,i++);return r}(a,l):l}),a?e.map(function(t){for(var e={},n=[],i=0,r=t.length;i',menu:'
'}),selectors:n(a)}).css,html:o.html,classes:o.classes,selectors:o.selectors,mixin:function(t){e.mixin(t,o)}};var s};function n(t){var n={};return e.each(t,function(t,e){n[e]="."+t}),n}function i(){var t={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"}};return e.isMsie()&&e.mixin(t.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),t}}(),i=function(){"use strict";var n;function i(e){e&&e.el||t.error("EventBus initialized without el"),this.$el=t(e.el)}return"typeahead:",n={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},e.mixin(i.prototype,{_trigger:function(e,n){var i;return i=t.Event("typeahead:"+e),(n=n||[]).unshift(i),this.$el.trigger.apply(this.$el,n),i},before:function(t){var e;return e=[].slice.call(arguments,1),this._trigger("before"+t,e).isDefaultPrevented()},trigger:function(t){var e;this._trigger(t,[].slice.call(arguments,1)),(e=n[t])&&this._trigger(e,[].slice.call(arguments,1))}}),i}(),r=function(){"use strict";var t=/\s+/,e=function(){var t;t=window.setImmediate?function(t){setImmediate(function(){t()})}:function(t){setTimeout(function(){t()},0)};return t}();return{onSync:function(t,e,i){return n.call(this,"sync",t,e,i)},onAsync:function(t,e,i){return n.call(this,"async",t,e,i)},off:function(e){var n;if(!this._callbacks)return this;e=e.split(t);for(;n=e.shift();)delete this._callbacks[n];return this},trigger:function(n){var r,o,a,s,l;if(!this._callbacks)return this;n=n.split(t),a=[].slice.call(arguments,1);for(;(r=n.shift())&&(o=this._callbacks[r]);)s=i(o.sync,this,[r].concat(a)),l=i(o.async,this,[r].concat(a)),s()&&e(l);return this}};function n(e,n,i,r){var o;if(!i)return this;for(n=n.split(t),i=r?function(t,e){return t.bind?t.bind(e):function(){t.apply(e,[].slice.call(arguments,0))}}(i,r):i,this._callbacks=this._callbacks||{};o=n.shift();)this._callbacks[o]=this._callbacks[o]||{sync:[],async:[]},this._callbacks[o][e].push(i);return this}function i(t,e,n){return function(){for(var i,r=0,o=t.length;!i&&r