Changeset 3279779
- Timestamp:
- 04/23/2025 09:36:04 AM (11 months ago)
- Location:
- wp-to-hootsuite
- Files:
-
- 38 edited
- 1 copied
-
tags/1.6.2 (copied) (copied from wp-to-hootsuite/trunk)
-
tags/1.6.2/_modules/dashboard/class-wpzincdashboardwidget.php (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/media-library.js (modified) (4 diffs)
-
tags/1.6.2/_modules/dashboard/js/min/admin-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/autocomplete-gutenberg-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/autocomplete-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/autocomplete-tinymce-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/autosize-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/jquery.form-conditionals-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/media-library-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/selectize-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/synchronous-ajax-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/tables-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/tabs-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/tags-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/tinymce-modal-min.js (modified) (1 diff)
-
tags/1.6.2/_modules/dashboard/js/min/tribute-min.js (modified) (1 diff)
-
tags/1.6.2/includes/class-wp-to-hootsuite.php (modified) (3 diffs)
-
tags/1.6.2/readme.txt (modified) (2 diffs)
-
tags/1.6.2/wp-to-hootsuite.php (modified) (2 diffs)
-
trunk/_modules/dashboard/class-wpzincdashboardwidget.php (modified) (1 diff)
-
trunk/_modules/dashboard/js/media-library.js (modified) (4 diffs)
-
trunk/_modules/dashboard/js/min/admin-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/autocomplete-gutenberg-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/autocomplete-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/autocomplete-tinymce-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/autosize-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/jquery.form-conditionals-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/media-library-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/selectize-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/synchronous-ajax-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/tables-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/tabs-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/tags-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/tinymce-modal-min.js (modified) (1 diff)
-
trunk/_modules/dashboard/js/min/tribute-min.js (modified) (1 diff)
-
trunk/includes/class-wp-to-hootsuite.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp-to-hootsuite.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/class-wpzincdashboardwidget.php
r3262556 r3279779 139 139 } 140 140 141 // Export and Support.142 add_action( 'init', array( $this, 'export' ) );143 add_action( ' plugins_loaded', array( $this, 'maybe_redirect' ));141 // Export and Redirects. 142 add_action( 'init', array( $this, 'export' ), 9999 ); 143 add_action( 'init', array( $this, 'maybe_redirect' ), 2 ); 144 144 145 145 // Permit wpzinc.com to be redirected to when using wp_safe_redirect(). -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/media-library.js
r3196055 r3279779 42 42 var container = $( this ).closest( '.wpzinc-media-library-selector' ), 43 43 input_name = $( container ).data( 'input-name' ), 44 input_url = $( container ).data( 'input-url' ), 44 45 output_size = $( container ).data( 'output-size' ), // The size of the image to output. 45 46 file_type = $( container ).data( 'file-type' ), // The file types that can be selected. … … 48 49 49 50 // Define some attributes if they're not defined in the data- attributes. 51 if ( typeof input_url == 'undefined' ) { 52 input_url = false; 53 } 50 54 if ( typeof output_size == 'undefined' ) { 51 55 output_size = 'thumbnail'; … … 172 176 173 177 html += '<img src="' + attachment_url + '" />'; 178 179 // Include URL as hidden field if required. 180 if ( input_url ) { 181 html += '<input type="hidden" name="' + input_url + '" value="' + attachment.attributes.url + '" />'; 182 } 174 183 break; 175 184 … … 186 195 // Inject. 187 196 $( 'ul', $( container ) ).append( html ); 197 198 // Trigger event so other JS can hook into when an attachment is added. 199 $( 'body' ).trigger( 'wpzinc-media-library-attachment-added' ); 188 200 189 201 } -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/admin-min.js
r2688344 r3279779 1 jQuery(document).ready((function($){if("undefined"!=typeof Clipboard&&$(".clipboard-js").length>0){ var e=new Clipboard(".clipboard-js");$(document).on("click",".clipboard-js",(function(e){e.preventDefault()}))}$("body").on("click","a.wpzinc-populate-field-value",(function(e){e.preventDefault(),$($(this).data("field")).val($(this).data("value"))}))}));1 jQuery(document).ready((function($){if("undefined"!=typeof Clipboard&&$(".clipboard-js").length>0){new Clipboard(".clipboard-js");$(document).on("click",".clipboard-js",(function(e){e.preventDefault()}))}$("body").on("click","a.wpzinc-populate-field-value",(function(e){e.preventDefault(),$($(this).data("field")).val($(this).data("value"))}))})); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/autocomplete-gutenberg-min.js
r3196055 r3279779 1 function wp_zinc_auto_complete_gutenberg_register(e,t){return wpzinc_autocomplete_gutenberg.forEach((function(t,o){t.triggers.forEach((function(t,o){"url"in t||e.push({name:t.name,triggerPrefix:t.trigger,options:t.values,getOptionKeywords:function(e){return e.value},getOptionLabel:function(e){return e.value},getOptionCompletion:function(e){return e.key}})}))})),e}var WPZincAutocompleterControl=function(e){const t=window.wp.element.createElement,{TextControl:o}=window.wp.components;var n=[];for(var i in e.options)n.push(t("option",{value:e.options[i],key:e.id+"_"+i},e.options[i]));return delete e.options,[t(o,e),t("datalist",{id:e.list},n)]};"undefined"!=typeof wp&&void 0!==wp.hooks&&"undefined"!=typeof wpzinc_autocomplete_gutenberg&&wpzinc_autocomplete_gutenberg.forEach((function(e,t){e.triggers.forEach((function(e,t){wp.hooks.addFilter("editor.Autocomplete.completers","wp-zinc/autocompleters/"+e.name,wp_zinc_auto_complete_gutenberg_register)}))}));1 var WPZincAutocompleterControl=function(e){const t=window.wp.element.createElement,{TextControl:o}=window.wp.components;var n=[];for(var i in e.options)n.push(t("option",{value:e.options[i],key:e.id+"_"+i},e.options[i]));return delete e.options,[t(o,e),t("datalist",{id:e.list},n)]};function wp_zinc_auto_complete_gutenberg_register(e,t){return wpzinc_autocomplete_gutenberg.forEach((function(t,o){t.triggers.forEach((function(t,o){"url"in t||e.push({name:t.name,triggerPrefix:t.trigger,options:t.values,getOptionKeywords:function(e){return e.value},getOptionLabel:function(e){return e.value},getOptionCompletion:function(e){return e.key}})}))})),e}"undefined"!=typeof wp&&void 0!==wp.hooks&&"undefined"!=typeof wpzinc_autocomplete_gutenberg&&wpzinc_autocomplete_gutenberg.forEach((function(e,t){e.triggers.forEach((function(e,t){wp.hooks.addFilter("editor.Autocomplete.completers","wp-zinc/autocompleters/"+e.name,wp_zinc_auto_complete_gutenberg_register)}))})); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/autocomplete-min.js
r3196055 r3279779 1 function wp_zinc_autocomplete_setup(){wpzinc_autocompleters=[],wpzinc_autocomplete.forEach((function(t,e){var n=[];t.triggers.forEach((function(t,e){t.selectTemplate=function(t){return t.original.value},"url"in t&&(t.values=function(e,n){data=new FormData,data.append("action",t.action),data.append("nonce",t.nonce),data.append("search",e),fetch(t.url,{method:t.method,credentials:"same-origin",body:data}).then((function(t){return t.json()})).then((function(t){n(t.data)})).catch((function(t){console.error(t)}))}),n.push(t)}));var c=new Tribute({collection:n});wpzinc_autocompleters.push({fields:t.fields,instance:c})}))}function wp_zinc_autocomplete_initialize(t){wpzinc_autocompleters.forEach((function(e,n){e.fields.forEach((function(n,c){void 0!==t&&(n=t+" "+n),e.instance.attach(document.querySelectorAll(n))}))}))}function wp_zinc_autocomplete_destroy(){wpzinc_autocompleters.forEach((function(t,e){t.fields.forEach((function(e,n){t.instance.detach(document.querySelectorAll(e))}))})),wpzinc_autocompleters=[]}var wpzinc_autocompleters=[];wp_zinc_autocomplete_setup(),wp_zinc_autocomplete_initialize();1 var wpzinc_autocompleters=[];function wp_zinc_autocomplete_setup(){wpzinc_autocompleters=[],wpzinc_autocomplete.forEach((function(t,e){var n=[];t.triggers.forEach((function(t,e){t.selectTemplate=function(t){return t.original.value},"url"in t&&(t.values=function(e,n){data=new FormData,data.append("action",t.action),data.append("nonce",t.nonce),data.append("search",e),fetch(t.url,{method:t.method,credentials:"same-origin",body:data}).then((function(t){return t.json()})).then((function(t){n(t.data)})).catch((function(t){console.error(t)}))}),n.push(t)}));var c=new Tribute({collection:n});wpzinc_autocompleters.push({fields:t.fields,instance:c})}))}function wp_zinc_autocomplete_initialize(t){wpzinc_autocompleters.forEach((function(e,n){e.fields.forEach((function(n,c){void 0!==t&&(n=t+" "+n),e.instance.attach(document.querySelectorAll(n))}))}))}function wp_zinc_autocomplete_destroy(){wpzinc_autocompleters.forEach((function(t,e){t.fields.forEach((function(e,n){t.instance.detach(document.querySelectorAll(e))}))})),wpzinc_autocompleters=[]}wp_zinc_autocomplete_setup(),wp_zinc_autocomplete_initialize(); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/autocomplete-tinymce-min.js
r3262556 r3279779 1 !function(){ const e=40,t=38,n=27,i=13,o=8;var l=[e,t,n,i],s=["123"];"undefined"!=typeof wpzinc_autocomplete&&wpzinc_autocomplete.forEach((function(o,c){o.triggers.forEach((function(o,c){"url"in o||(tinymce.create("tinymce.plugins."+o.tinyMCEName,{init:function(c){function r(){var e=document.createElement("ul");return e.setAttribute("class","wpzinc-tinymce-autocomplete"),o.values.forEach((function(t,n){var i=document.createElement("li");i.classList.add("displayed"),e.appendChild(i),i.innerHTML=i.innerHTML+t.value})),document.body.appendChild(e),e}function a(e,t){var n=d(e);g(t,n.top,n.left),t.classList.remove("displayed"),t.classList.add("displayed"),E=!0}function d(e){var t=e.getContainer()?e.getContainer():document.getElementById(e.id),n=t.getBoundingClientRect().top+window.scrollY,i=t.getBoundingClientRect().left+window.scrollX,o={top:0,left:0};o=e.selection.getRng().getClientRects().length>0?{top:e.selection.getRng().getClientRects()[0].top+20,left:e.selection.getRng().getClientRects()[0].left}:{top:e.selection.getNode().getClientRects()[0].top+20,left:e.selection.getNode().getClientRects()[0].left};var l=t.getElementsByClassName("mce-toolbar-grp")[0];return l?{top:n+l.getBoundingClientRect().height+o.top,left:i+o.left}:o}function g(e,t,n){e.style.marginTop=t+"px",e.style.marginLeft=n+"px"}function u(e){var t=null==e.selection.getSel().focusNode?"":e.selection.getSel().focusNode.nodeValue,n=e.selection.getSel().focusOffset,i=0,o;if(null==t||0==t.length)return"";for(var l=n;l>=0;l--)if(-1!=s.indexOf(t.charCodeAt(l).toString())){i=l;break}return{search:t.substr(i,n-i),start:i,end:n}}function f(e,t,n){for(var i=n.getElementsByTagName("li"),o=!0,l=i.length,s=0;s<l-1;s++)i.item(s).classList.remove("highlight"),-1==i.item(s).innerText.indexOf(e.search)?i.item(s).classList.remove("displayed"):(i.item(s).classList.add("displayed"),o&&(i.item(s).classList.add("highlight"),o=!1))}function m(e,t,n){for(var i=n.querySelectorAll("li.displayed"),o=i.length,l=0;l<o-1;l++)if(i[l].classList.contains("highlight")){if("previous"==e){if(0==l)break;i[l].classList.remove("highlight"),i[l-1].classList.add("highlight");break}if("next"==e){if(l==i.length-1)break;i[l].classList.remove("highlight"),i[l+1].classList.add("highlight");break}}}function h(e,t){var n;y(t.querySelectorAll("li.highlight")[0].innerText,e,t)}function y(e,t){var n=u(t),i=t.selection.getSel().focusNode,o=t.selection.getRng();o.setStart(i,n.start),o.setEnd(i,n.end),t.selection.setRng(o),t.selection.setContent(e)}function p(e,t){t.classList.remove("displayed"),E=!1}function v(l,s){if(o.triggerKeyCode==s.keyCode&&!E){if(!o.triggerKeyShiftRequired)return void a(l,R);if(s.shiftKey)return void a(l,R)}if(n!=s.keyCode||!E){var c;if(E&&(t==s.keyCode||e==s.keyCode))m(t==s.keyCode?"previous":"next",l,R);return E&&i==s.keyCode?(tinymce.dom.Event.cancel(s),h(l,R),void p(l,R)):void 0}p(l,R)}function C(e,t){var n;-1==l.indexOf(t.keyCode)&&E&&(a(e,R),f(u(e),e,R))}function L(e,t){p(e,R)}function k(e){e.target.matches("li.displayed")?(y(e.target.innerText,c),p(c,R)):p(c,R)}var E=!1,R=r();c.onKeyDown.add(C),c.onKeyDown.add(v),c.onClick.add(L),document.addEventListener("click",k)},getInfo:function(){return{longname:"Autocomplete",author:"WP Zinc",version:tinymce.majorVersion+"."+tinymce.minorVersion}}}),tinymce.PluginManager.add(o.tinyMCEName,tinymce.plugins[o.tinyMCEName]))}))}))}();1 !function(){var e=[40,38,27,13],t=["123"];"undefined"!=typeof wpzinc_autocomplete&&wpzinc_autocomplete.forEach((function(n,i){n.triggers.forEach((function(n,i){"url"in n||(tinymce.create("tinymce.plugins."+n.tinyMCEName,{init:function(i){var o,l=!1,s=((o=document.createElement("ul")).setAttribute("class","wpzinc-tinymce-autocomplete"),n.values.forEach((function(e,t){var n=document.createElement("li");n.classList.add("displayed"),o.appendChild(n),n.innerHTML=n.innerHTML+e.value})),document.body.appendChild(o),o);function c(e,t){var n=function(e){var t=e.getContainer()?e.getContainer():document.getElementById(e.id),n={top:t.getBoundingClientRect().top+window.scrollY,left:t.getBoundingClientRect().left+window.scrollX},i={top:0,left:0};i=e.selection.getRng().getClientRects().length>0?{top:e.selection.getRng().getClientRects()[0].top+20,left:e.selection.getRng().getClientRects()[0].left}:{top:e.selection.getNode().getClientRects()[0].top+20,left:e.selection.getNode().getClientRects()[0].left};var o=t.getElementsByClassName("mce-toolbar-grp")[0];if(o)return{top:n.top+o.getBoundingClientRect().height+i.top,left:n.left+i.left};return i}(e);!function(e,t,n){e.style.marginTop=t+"px",e.style.marginLeft=n+"px"}(t,n.top,n.left),t.classList.remove("displayed"),t.classList.add("displayed"),l=!0}function r(e){var n=null==e.selection.getSel().focusNode?"":e.selection.getSel().focusNode.nodeValue,i=e.selection.getSel().focusOffset,o=0;if(null==n||0==n.length)return"";for(var l=i;l>=0;l--)if(-1!=t.indexOf(n.charCodeAt(l).toString())){o=l;break}return{search:n.substr(o,i-o),start:o,end:i}}function a(e,t){var n=r(t),i=t.selection.getSel().focusNode,o=t.selection.getRng();o.setStart(i,n.start),o.setEnd(i,n.end),t.selection.setRng(o),t.selection.setContent(e)}function d(e,t){t.classList.remove("displayed"),l=!1}i.onKeyDown.add((function(t,n){-1==e.indexOf(n.keyCode)&&l&&(c(t,s),function(e,t,n){for(var i=n.getElementsByTagName("li"),o=!0,l=i.length,s=0;s<l-1;s++)i.item(s).classList.remove("highlight"),-1==i.item(s).innerText.indexOf(e.search)?i.item(s).classList.remove("displayed"):(i.item(s).classList.add("displayed"),o&&(i.item(s).classList.add("highlight"),o=!1))}(r(t),0,s))})),i.onKeyDown.add((function(e,t){if(n.triggerKeyCode==t.keyCode&&!l){if(!n.triggerKeyShiftRequired)return void c(e,s);if(t.shiftKey)return void c(e,s)}if(27!=t.keyCode||!l){if(l&&(38==t.keyCode||40==t.keyCode))!function(e,t,n){for(var i=n.querySelectorAll("li.displayed"),o=i.length,l=0;l<o-1;l++)if(i[l].classList.contains("highlight")){if("previous"==e){if(0==l)break;i[l].classList.remove("highlight"),i[l-1].classList.add("highlight");break}if("next"==e){if(l==i.length-1)break;i[l].classList.remove("highlight"),i[l+1].classList.add("highlight");break}}}(38==t.keyCode?"previous":"next",0,s);return l&&13==t.keyCode?(tinymce.dom.Event.cancel(t),function(e,t){a(t.querySelectorAll("li.highlight")[0].innerText,e)}(e,s),void d(0,s)):void 0}d(0,s)})),i.onClick.add((function(e,t){d(0,s)})),document.addEventListener("click",(function(e){e.target.matches("li.displayed")?(a(e.target.innerText,i),d(0,s)):d(0,s)}))},getInfo:function(){return{longname:"Autocomplete",author:"WP Zinc",version:tinymce.majorVersion+"."+tinymce.minorVersion}}}),tinymce.PluginManager.add(n.tinyMCEName,tinymce.plugins[n.tinyMCEName]))}))}))}(); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/autosize-min.js
r2322366 r3279779 4 4 http://www.jacklmoore.com/autosize 5 5 */ 6 !function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,(function(e, t){"use strict";function n(e){function t(){var t=window.getComputedStyle(e,null);"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),l="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(l)&&(l=0),d()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function o(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function r(){if(0!==e.scrollHeight){var t=o(e),n=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+l+"px",u=e.clientWidth,t.forEach((function(e){e.node.scrollTop=e.scrollTop})),n&&(document.documentElement.scrollTop=n)}}function d(){r();var t=Math.round(parseFloat(e.style.height)),o=window.getComputedStyle(e,null),i="content-box"===o.boxSizing?Math.round(parseFloat(o.height)):e.offsetHeight;if(i<t?"hidden"===o.overflowY&&(n("scroll"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==o.overflowY&&(n("hidden"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),a!==i){a=i;var d=s("autosize:resized");try{e.dispatchEvent(d)}catch(e){}}}if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!i.has(e)){var l=null,u=null,a=null,c=function t(){e.clientWidth!==u&&d()},f=function(t){window.removeEventListener("resize",c,!1),e.removeEventListener("input",d,!1),e.removeEventListener("keyup",d,!1),e.removeEventListener("autosize:destroy",f,!1),e.removeEventListener("autosize:update",d,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),i.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",f,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",d,!1),window.addEventListener("resize",c,!1),e.addEventListener("input",d,!1),e.addEventListener("autosize:update",d,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",i.set(e,{destroy:f,update:d}),t()}}function o(e){var t=i.get(e);t&&t.destroy()}function r(e){var t=i.get(e);t&&t.update()}var i="function"==typeof Map?new Map:(d=[],l=[],{has:function e(t){return d.indexOf(t)>-1},get:function e(t){return l[d.indexOf(t)]},set:function e(t,n){-1===d.indexOf(t)&&(d.push(t),l.push(n))},delete:function e(t){var n=d.indexOf(t);n>-1&&(d.splice(n,1),l.splice(n,1))}}),d,l,s=function e(t){return new Event(t,{bubbles:!0})};try{new Event("test")}catch(e){s=function e(t){var n=document.createEvent("Event");return n.initEvent(t,!0,!1),n}}var u=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((u=function e(t){return t}).destroy=function(e){return e},u.update=function(e){return e}):((u=function e(t,o){return t&&Array.prototype.forEach.call(t.length?t:[t],(function(e){return n(e,o)})),t}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},u.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e}),t.default=u,e.exports=t.default}));6 !function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,(function(e,exports){"use strict";var t,n,o="function"==typeof Map?new Map:(t=[],n=[],{has:function(e){return t.indexOf(e)>-1},get:function(e){return n[t.indexOf(e)]},set:function(e,o){-1===t.indexOf(e)&&(t.push(e),n.push(o))},delete:function(e){var o=t.indexOf(e);o>-1&&(t.splice(o,1),n.splice(o,1))}}),r=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){r=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!o.has(e)){var t,n=null,i=null,d=null,l=function(){e.clientWidth!==i&&p()},s=function(t){window.removeEventListener("resize",l,!1),e.removeEventListener("input",p,!1),e.removeEventListener("keyup",p,!1),e.removeEventListener("autosize:destroy",s,!1),e.removeEventListener("autosize:update",p,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),o.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",s,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",p,!1),window.addEventListener("resize",l,!1),e.addEventListener("input",p,!1),e.addEventListener("autosize:update",p,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",o.set(e,{destroy:s,update:p}),"vertical"===(t=window.getComputedStyle(e,null)).resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),n="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(n)&&(n=0),p()}function u(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function a(){if(0!==e.scrollHeight){var t=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(e),o=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+n+"px",i=e.clientWidth,t.forEach((function(e){e.node.scrollTop=e.scrollTop})),o&&(document.documentElement.scrollTop=o)}}function p(){a();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),o="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(o<t?"hidden"===n.overflowY&&(u("scroll"),a(),o="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(u("hidden"),a(),o="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),d!==o){d=o;var i=r("autosize:resized");try{e.dispatchEvent(i)}catch(e){}}}}function d(e){var t=o.get(e);t&&t.destroy()}function l(e){var t=o.get(e);t&&t.update()}var s=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((s=function(e){return e}).destroy=function(e){return e},s.update=function(e){return e}):((s=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return i(e)})),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],d),e},s.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],l),e}),exports.default=s,e.exports=exports.default})); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/jquery.form-conditionals-min.js
r2688344 r3279779 1 !function($){"use strict";$.fn.conditional=function(t){var i=$.extend({data:"conditional",value:"conditional-value",displayOnEnabled:"conditional-display"},t);return this.each((function(){if(void 0===$(this).data(i.data))return!0;var t,a,n,e;$(this).on("change",(function(){ switch(t=$(this).data(i.data).split(","),void 0===(a=$(this).data(i.displayOnEnabled))&&(a=!0),n=void 0===(n=$(this).data(i.value))?"":String(n).split(","),e=!1,$(this).attr("type")){case"checkbox":e=a?$(this).is(":checked"):!$(this).is(":checked");break;default:e=a?n.length>0?-1!=n.indexOf(String($(this).val())):""!==$(this).val()&&"0"!==$(this).val():n.length>0?-1==n.indexOf(String($(this).val())):""===$(this).val()||"0"===$(this).val();break}for(var d=t.length,s=0;s<d;s++){var h;h=$("#"+t[s]).length>0?$("#"+t[s]):$("."+t[s],$(this).parent()),e?$(h).fadeIn(300):$(h).fadeOut(300)}})),$(this).trigger("change")})),this}}(jQuery),jQuery(document).ready((function($){$("input,select").conditional()}));1 !function($){"use strict";$.fn.conditional=function(t){var i=$.extend({data:"conditional",value:"conditional-value",displayOnEnabled:"conditional-display"},t);return this.each((function(){if(void 0===$(this).data(i.data))return!0;var t,a,n,e;$(this).on("change",(function(){if(t=$(this).data(i.data).split(","),void 0===(a=$(this).data(i.displayOnEnabled))&&(a=!0),n=void 0===(n=$(this).data(i.value))?"":String(n).split(","),e=!1,"checkbox"===$(this).attr("type"))e=a?$(this).is(":checked"):!$(this).is(":checked");else e=a?n.length>0?-1!=n.indexOf(String($(this).val())):""!==$(this).val()&&"0"!==$(this).val():n.length>0?-1==n.indexOf(String($(this).val())):""===$(this).val()||"0"===$(this).val();for(var d=t.length,s=0;s<d;s++){var h;h=$("#"+t[s]).length>0?$("#"+t[s]):$("."+t[s],$(this).parent()),e?$(h).fadeIn(300):$(h).fadeOut(300)}})),$(this).trigger("change")})),this}}(jQuery),jQuery(document).ready((function($){$("input,select").conditional()})); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/media-library-min.js
r3196055 r3279779 1 !function($){$(".wpzinc-media-library-selector").each((function(){var t=$(this).data("multiple");void 0===t&&(t=!1),t&&$("ul",$(this)).sortable()})),$("#wpbody").on("click",".wpzinc-media-library-insert",(function(t){t.preventDefault();var e=$(this).closest(".wpzinc-media-library-selector"),a=$(e).data("input-name"),i=$(e).data(" output-size"),n=$(e).data("file-type"),l=$(e).data("multiple"),r=$(e).data("limit");void 0===i&&(i="thumbnail"),void 0===n&&(n="image"),void 0===l&&(l=!1),void 0===r&&(r=99999);var o=[];if($("input[type=hidden]",$(e)).each((function(){o.push($(this).val())})),c)c.open();else{var c=wp.media({title:"Choose Item",button:{text:"Select"},library:{type:n},multiple:!!l&&"add"});c.on("open",(function(){var t=c.state().get("selection");o.forEach((function(e){attachment=wp.media.attachment(e),attachment.fetch(),t.add(attachment?[attachment]:[])}))})),c.off("select"),c.off("selection:toggle"),c.on("selection:toggle",(function(){var t=c.state().get("selection");t.length>r&&t.remove(t.last())})),c.on("select",(function(){var t=c.state().get("selection").map((function(t){return t.toJSON(),t}));$("ul",$(e)).html("");for(var n=t.length,l=0;l<n;l++){var r=t[l],o=r.get("id"),s=r.get("url"),m='<li class="wpzinc-media-library-attachment">';switch(m+='<a href="#" class="wpzinc-media-library-insert">',m+='<input type="hidden" name="'+a+'" value="'+o+'" />',r.attributes.type){case"image":void 0!==r.attributes.sizes[i]&&(s=r.attributes.sizes[i].url),m+='<img src="'+s+'" />';break;default:m+=r.attributes.filename;break}m+='<a href="#" class="wpzinc-media-library-remove">Remove</a>',m+="</li>",$("ul",$(e)).append(m)}})),c.open()}})),$("#wpbody").on("click",".wpzinc-media-library-remove",(function(t){t.preventDefault(),$(this).closest(".wpzinc-media-library-attachment").remove()}))}(jQuery);1 !function($){$(".wpzinc-media-library-selector").each((function(){var t=$(this).data("multiple");void 0===t&&(t=!1),t&&$("ul",$(this)).sortable()})),$("#wpbody").on("click",".wpzinc-media-library-insert",(function(t){t.preventDefault();var e=$(this).closest(".wpzinc-media-library-selector"),a=$(e).data("input-name"),i=$(e).data("input-url"),n=$(e).data("output-size"),l=$(e).data("file-type"),r=$(e).data("multiple"),o=$(e).data("limit");void 0===i&&(i=!1),void 0===n&&(n="thumbnail"),void 0===l&&(l="image"),void 0===r&&(r=!1),void 0===o&&(o=99999);var c=[];if($("input[type=hidden]",$(e)).each((function(){c.push($(this).val())})),s)s.open();else{var s=wp.media({title:"Choose Item",button:{text:"Select"},library:{type:l},multiple:!!r&&"add"});s.on("open",(function(){var t=s.state().get("selection");c.forEach((function(e){attachment=wp.media.attachment(e),attachment.fetch(),t.add(attachment?[attachment]:[])}))})),s.off("select"),s.off("selection:toggle"),s.on("selection:toggle",(function(){var t=s.state().get("selection");t.length>o&&t.remove(t.last())})),s.on("select",(function(){var t=s.state().get("selection").map((function(t){return t.toJSON(),t}));$("ul",$(e)).html("");for(var l=t.length,r=0;r<l;r++){var o=t[r],c=o.get("id"),d=o.get("url"),u='<li class="wpzinc-media-library-attachment">';if(u+='<a href="#" class="wpzinc-media-library-insert">',u+='<input type="hidden" name="'+a+'" value="'+c+'" />',"image"===o.attributes.type)void 0!==o.attributes.sizes[n]&&(d=o.attributes.sizes[n].url),u+='<img src="'+d+'" />',i&&(u+='<input type="hidden" name="'+i+'" value="'+o.attributes.url+'" />');else u+=o.attributes.filename;u+='<a href="#" class="wpzinc-media-library-remove">Remove</a>',u+="</li>",$("ul",$(e)).append(u),$("body").trigger("wpzinc-media-library-attachment-added")}})),s.open()}})),$("#wpbody").on("click",".wpzinc-media-library-remove",(function(t){t.preventDefault(),$(this).closest(".wpzinc-media-library-attachment").remove()}))}(jQuery); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/selectize-min.js
r2688344 r3279779 1 !function(e,t){"function"==typeof define&&define.amd?define("sifter",t):"object"==typeof exports?module.exports=t():e.Sifter=t()}(this,(function(){var e=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};e.prototype.tokenize=function(e){if(!(e=o(String(e||"").toLowerCase()))||!e.length)return[];var t,n,i,s,l=[],p=e.split(/ +/);for(t=0,n=p.length;t<n;t++){if(i=r(p[t]),this.settings.diacritics)for(s in a)a.hasOwnProperty(s)&&(i=i.replace(new RegExp(s,"g"),a[s]));l.push({string:p[t],regex:new RegExp(i,"i")})}return l},e.prototype.iterator=function(e,t){var n;n=s(e)?Array.prototype.forEach||function(e){for(var t=0,n=this.length;t<n;t++)e(this[t],t,this)}:function(e){for(var t in this)this.hasOwnProperty(t)&&e(this[t],t,this)},n.apply(e,[t])},e.prototype.getScoreFunction=function(e,t){var n,o,r,s ,a;e=(n=this).prepareSearch(e,t),r=e.tokens,o=e.options.fields,s=r.length,a=e.options.nesting;var l=function(e,t){var n,i;return e?-1===(i=(e=String(e||"")).search(t.regex))?0:(n=t.string.length/e.length,0===i&&(n+=.5),n):0},p=(u=o.length)?1===u?function(e,t){return l(i(t,o[0],a),e)}:function(e,t){for(var n=0,r=0;n<u;n++)r+=l(i(t,o[n],a),e);return r/u}:function(){return 0},u;return s?1===s?function(e){return p(r[0],e)}:"and"===e.options.conjunction?function(e){for(var t,n=0,i=0;n<s;n++){if((t=p(r[n],e))<=0)return 0;i+=t}return i/s}:function(e){for(var t=0,n=0;t<s;t++)n+=p(r[t],e);return n/s}:function(){return 0}},e.prototype.getSortFunction=function(e,n){var o,r,s,a,l,p,u,c,d,h,g;if(g=!(e=(s=this).prepareSearch(e,n)).query&&n.sort_empty||n.sort,d=function(e,t){return"$score"===e?t.score:i(s.items[t.id],e,n.nesting)},l=[],g)for(o=0,r=g.length;o<r;o++)(e.query||"$score"!==g[o].field)&&l.push(g[o]);if(e.query){for(h=!0,o=0,r=l.length;o<r;o++)if("$score"===l[o].field){h=!1;break}h&&l.unshift({field:"$score",direction:"desc"})}else for(o=0,r=l.length;o<r;o++)if("$score"===l[o].field){l.splice(o,1);break}for(c=[],o=0,r=l.length;o<r;o++)c.push("desc"===l[o].direction?-1:1);return(p=l.length)?1===p?(a=l[0].field,u=c[0],function(e,n){return u*t(d(a,e),d(a,n))}):function(e,n){var i,o,r,s,a;for(i=0;i<p;i++)if(a=l[i].field,o=c[i]*t(d(a,e),d(a,n)))return o;return 0}:null},e.prototype.prepareSearch=function(e,t){if("object"==typeof e)return e;var i=(t=n({},t)).fields,o=t.sort,r=t.sort_empty;return i&&!s(i)&&(t.fields=[i]),o&&!s(o)&&(t.sort=[o]),r&&!s(r)&&(t.sort_empty=[r]),{options:t,query:String(e||"").toLowerCase(),tokens:this.tokenize(e),total:0,items:[]}},e.prototype.search=function(e,t){var n=this,i,o,r,s,a,l;return r=this.prepareSearch(e,t),t=r.options,e=r.query,l=t.score||n.getScoreFunction(r),e.length?n.iterator(n.items,(function(e,n){o=l(e),(!1===t.filter||o>0)&&r.items.push({score:o,id:n})})):n.iterator(n.items,(function(e,t){r.items.push({score:1,id:t})})),(a=n.getSortFunction(r,t))&&r.items.sort(a),r.total=r.items.length,"number"==typeof t.limit&&(r.items=r.items.slice(0,t.limit)),r};var t=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:e<t?-1:0:(e=l(String(e||"")))>(t=l(String(t||"")))?1:t>e?-1:0},n=function(e,t){var n,i,o,r;for(n=1,i=arguments.length;n<i;n++)if(r=arguments[n])for(o in r)r.hasOwnProperty(o)&&(e[o]=r[o]);return e},i=function(e,t,n){if(e&&t){if(!n)return e[t];for(var i=t.split(".");i.length&&(e=e[i.shift()]););return e}},o=function(e){return(e+"").replace(/^\s+|\s+$|/g,"")},r=function(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},s=Array.isArray||"undefined"!=typeof $&&$.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},l=function(){var e,t,n,i,o="",r={};for(n in a)if(a.hasOwnProperty(n))for(o+=i=a[n].substring(2,a[n].length-1),e=0,t=i.length;e<t;e++)r[i.charAt(e)]=n;var s=new RegExp("["+o+"]","g");return function(e){return e.replace(s,(function(e){return r[e]})).toLowerCase()}}();return e})),function(e,t){"function"==typeof define&&define.amd?define("microplugin",t):"object"==typeof exports?module.exports=t():e.MicroPlugin=t()}(this,(function(){var e={mixin:function(e){e.plugins={},e.prototype.initializePlugins=function(e){var n,i,o,r=this,s=[];if(r.plugins={names:[],settings:{},requested:{},loaded:{}},t.isArray(e))for(n=0,i=e.length;n<i;n++)"string"==typeof e[n]?s.push(e[n]):(r.plugins.settings[e[n].name]=e[n].options,s.push(e[n].name));else if(e)for(o in e)e.hasOwnProperty(o)&&(r.plugins.settings[o]=e[o],s.push(o));for(;s.length;)r.require(s.shift())},e.prototype.loadPlugin=function(t){var n=this,i=n.plugins,o=e.plugins[t];if(!e.plugins.hasOwnProperty(t))throw new Error('Unable to find "'+t+'" plugin');i.requested[t]=!0,i.loaded[t]=o.fn.apply(n,[n.plugins.settings[t]||{}]),i.names.push(t)},e.prototype.require=function(e){var t=this,n=t.plugins;if(!t.plugins.loaded.hasOwnProperty(e)){if(n.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")');t.loadPlugin(e)}return n.loaded[e]},e.define=function(t,n){e.plugins[t]={name:t,fn:n}}}},t={isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}};return e})),function(e,t){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],t):"object"==typeof exports?module.exports=t(require("jquery"),require("sifter"),require("microplugin")):e.Selectize=t(e.jQuery,e.Sifter,e.MicroPlugin)}(this,(function($,e,t){"use strict";var n=function(e,t){if("string"!=typeof t||t.length){var n="string"==typeof t?new RegExp(t,"i"):t,i=function(e){var t=0;if(3===e.nodeType){var o=e.data.search(n);if(o>=0&&e.data.length>0){var r=e.data.match(n),s=document.createElement("span");s.className="highlight";var a=e.splitText(o),l=a.splitText(r[0].length),p=a.cloneNode(!0);s.appendChild(p),a.parentNode.replaceChild(s,a),t=1}}else if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&("highlight"!==e.className||"SPAN"!==e.tagName))for(var u=0;u<e.childNodes.length;++u)u+=i(e.childNodes[u]);return t};return e.each((function(){i(this)}))}};$.fn.removeHighlight=function(){return this.find("span.highlight").each((function(){this.parentNode.firstChild.nodeName;var e=this.parentNode;e.replaceChild(this.firstChild,this),e.normalize()})).end()};var i=function(){};i.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){var n=arguments.length;return 0===n?delete this._events:1===n?delete this._events[e]:(this._events=this._events||{},void(e in this._events!=!1&&this._events[e].splice(this._events[e].indexOf(t),1)))},trigger:function(e){if(this._events=this._events||{},e in this._events!=!1)for(var t=0;t<this._events[e].length;t++)this._events[e][t].apply(this,Array.prototype.slice.call(arguments,1))}},i.mixin=function(e){for(var t=["on","off","trigger"],n=0;n<t.length;n++)e.prototype[t[n]]=i.prototype[t[n]]};var o=/Mac/.test(navigator.userAgent),r=65,s=188,a=13,l=27,p=37,u=38,c=80,d=39,h=40,g=78,f=8,v=46,m=16,y=o?91:17,w=o?18:17,O=9,C=1,b=2,x=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,S=function(e){return void 0!==e},I=function(e){return null==e?null:"boolean"==typeof e?e?"1":"0":e+""},_=function(e){return(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},F=function(e){return(e+"").replace(/\$/g,"$$$$")},D={before:function(e,t,n){var i=e[t];e[t]=function(){return n.apply(e,arguments),i.apply(e,arguments)}},after:function(e,t,n){var i=e[t];e[t]=function(){var t=i.apply(e,arguments);return n.apply(e,arguments),t}}},k=function(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}},P=function(e,t){var n;return function(){var i=this,o=arguments;window.clearTimeout(n),n=window.setTimeout((function(){e.apply(i,o)}),t)}},A=function(e,t,n){var i,o=e.trigger,r={};for(i in e.trigger=function(n){var i=n;if(-1===t.indexOf(i))return o.apply(e,arguments);r[i]=arguments},n.apply(e,[]),e.trigger=o,r)r.hasOwnProperty(i)&&o.apply(e,r[i])},z=function(e,t,n,i){e.on(t,n,(function(t){for(var n=t.target;n&&n.parentNode!==e[0];)n=n.parentNode;return t.currentTarget=n,i.apply(this,[t])}))},T=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var n=document.selection.createRange(),i=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t.start=n.text.length-i,t.length=i}return t},q=function(e,t,n){var i,o,r={};if(n)for(i=0,o=n.length;i<o;i++)r[n[i]]=e.css(n[i]);else r=e.css();t.css(r)},N=function(e,t){return e?(L.$testInput||(L.$testInput=$("<span />").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).appendTo("body")),L.$testInput.text(e),q(t,L.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),L.$testInput.width()):0},j=function(e){var t=null,n=function(n,i){var o,r,s,a,l,p,u,c;i=i||{},(n=n||window.event||{}).metaKey||n.altKey||(i.force||!1!==e.data("grow"))&&(o=e.val(),n.type&&"keydown"===n.type.toLowerCase()&&(s=(r=n.keyCode)>=48&&r<=57||r>=65&&r<=90||r>=96&&r<=111||r>=186&&r<=222||32===r,r===v||8===r?(c=T(e[0])).length?o=o.substring(0,c.start)+o.substring(c.start+c.length):8===r&&c.start?o=o.substring(0,c.start-1)+o.substring(c.start+1):r===v&&void 0!==c.start&&(o=o.substring(0,c.start)+o.substring(c.start+1)):s&&(p=n.shiftKey,u=String.fromCharCode(n.keyCode),o+=u=p?u.toUpperCase():u.toLowerCase())),a=e.attr("placeholder"),!o&&a&&(o=a),(l=N(o,e)+4)!==t&&(t=l,e.width(l),e.triggerHandler("resize")))};e.on("keydown keyup update blur",n),n()},E=function(e){var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},H=function(e,t){t||(t={});var n="Selectize";console.error("Selectize: "+e),t.explanation&&(console.group&&console.group(),console.error(t.explanation),console.group&&console.groupEnd())},L=function(t,n){var i,o,r,s,a,l=this;(a=t[0]).selectize=l;var p=window.getComputedStyle&&window.getComputedStyle(a,null);if(s=(s=p?p.getPropertyValue("direction"):a.currentStyle&&a.currentStyle.direction)||t.parents("[dir]:first").attr("dir")||"",$.extend(l,{order:0,settings:n,$input:t,tabIndex:t.attr("tabindex")||"",tagType:"select"===a.tagName.toLowerCase()?1:2,rtl:/rtl/i.test(s),eventNS:".selectize"+ ++L.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:t.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===n.loadThrottle?l.onSearchChange:P(l.onSearchChange,n.loadThrottle)}),l.sifter=new e(this.options,{diacritics:n.diacritics}),l.settings.options){for(o=0,r=l.settings.options.length;o<r;o++)l.registerOption(l.settings.options[o]);delete l.settings.options}if(l.settings.optgroups){for(o=0,r=l.settings.optgroups.length;o<r;o++)l.registerOptionGroup(l.settings.optgroups[o]);delete l.settings.optgroups}l.settings.mode=l.settings.mode||(1===l.settings.maxItems?"single":"multi"),"boolean"!=typeof l.settings.hideSelected&&(l.settings.hideSelected="multi"===l.settings.mode),l.initializePlugins(l.settings.plugins),l.setupCallbacks(),l.setupTemplates(),l.setup()};return i.mixin(L),void 0!==t?t.mixin(L):H("Dependency MicroPlugin is missing",{explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'}),$.extend(L.prototype,{setup:function(){var e=this,t=e.settings,n=e.eventNS,i=$(window),r=$(document),s=e.$input,a,l,p,u,c,d,h,g,f,v,O,C;if(h=e.settings.mode,v=s.attr("class")||"",a=$("<div>").addClass(t.wrapperClass).addClass(v).addClass(h),l=$("<div>").addClass(t.inputClass).addClass("items").appendTo(a),p=$('<input type="text" autocomplete="off" />').appendTo(l).attr("tabindex",s.is(":disabled")?"-1":e.tabIndex),d=$(t.dropdownParent||a),u=$("<div>").addClass(t.dropdownClass).addClass(h).hide().appendTo(d),c=$("<div>").addClass(t.dropdownContentClass).appendTo(u),(C=s.attr("id"))&&(p.attr("id",C+"-selectized"),$("label[for='"+C+"']").attr("for",C+"-selectized")),e.settings.copyClassesToDropdown&&u.addClass(v),a.css({width:s[0].style.width}),e.plugins.names.length&&(O="plugin-"+e.plugins.names.join(" plugin-"),a.addClass(O),u.addClass(O)),(null===t.maxItems||t.maxItems>1)&&1===e.tagType&&s.attr("multiple","multiple"),e.settings.placeholder&&p.attr("placeholder",t.placeholder),!e.settings.splitOn&&e.settings.delimiter){var b=e.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");e.settings.splitOn=new RegExp("\\s*"+b+"+\\s*")}s.attr("autocorrect")&&p.attr("autocorrect",s.attr("autocorrect")),s.attr("autocapitalize")&&p.attr("autocapitalize",s.attr("autocapitalize")),p[0].type=s[0].type,e.$wrapper=a,e.$control=l,e.$control_input=p,e.$dropdown=u,e.$dropdown_content=c,u.on("mouseenter mousedown click","[data-disabled]>[data-selectable]",(function(e){e.stopImmediatePropagation()})),u.on("mouseenter","[data-selectable]",(function(){return e.onOptionHover.apply(e,arguments)})),u.on("mousedown click","[data-selectable]",(function(){return e.onOptionSelect.apply(e,arguments)})),z(l,"mousedown","*:not(input)",(function(){return e.onItemSelect.apply(e,arguments)})),j(p),l.on({mousedown:function(){return e.onMouseDown.apply(e,arguments)},click:function(){return e.onClick.apply(e,arguments)}}),p.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return e.onKeyDown.apply(e,arguments)},keyup:function(){return e.onKeyUp.apply(e,arguments)},keypress:function(){return e.onKeyPress.apply(e,arguments)},resize:function(){e.positionDropdown.apply(e,[])},blur:function(){return e.onBlur.apply(e,arguments)},focus:function(){return e.ignoreBlur=!1,e.onFocus.apply(e,arguments)},paste:function(){return e.onPaste.apply(e,arguments)}}),r.on("keydown"+n,(function(t){e.isCmdDown=t[o?"metaKey":"ctrlKey"],e.isCtrlDown=t[o?"altKey":"ctrlKey"],e.isShiftDown=t.shiftKey})),r.on("keyup"+n,(function(t){t.keyCode===w&&(e.isCtrlDown=!1),t.keyCode===m&&(e.isShiftDown=!1),t.keyCode===y&&(e.isCmdDown=!1)})),r.on("mousedown"+n,(function(t){if(e.isFocused){if(t.target===e.$dropdown[0]||t.target.parentNode===e.$dropdown[0])return!1;e.$control.has(t.target).length||t.target===e.$control[0]||e.blur(t.target)}})),i.on(["scroll"+n,"resize"+n].join(" "),(function(){e.isOpen&&e.positionDropdown.apply(e,arguments)})),i.on("mousemove"+n,(function(){e.ignoreHover=!1})),this.revertSettings={$children:s.children().detach(),tabindex:s.attr("tabindex")},s.attr("tabindex",-1).hide().after(e.$wrapper),$.isArray(t.items)&&(e.setValue(t.items),delete t.items),x&&s.on("invalid"+n,(function(t){t.preventDefault(),e.isInvalid=!0,e.refreshState()})),e.updateOriginalInput(),e.refreshItems(),e.refreshState(),e.updatePlaceholder(),e.isSetup=!0,s.is(":disabled")&&e.disable(),e.on("change",this.onChange),s.data("selectize",e),s.addClass("selectized"),e.trigger("initialize"),!0===t.preload&&e.onSearchChange("")},setupTemplates:function(){var e=this,t=e.settings.labelField,n=e.settings.optgroupLabelField,i={optgroup:function(e){return'<div class="optgroup">'+e.html+"</div>"},optgroup_header:function(e,t){return'<div class="optgroup-header">'+t(e[n])+"</div>"},option:function(e,n){return'<div class="option">'+n(e[t])+"</div>"},item:function(e,n){return'<div class="item">'+n(e[t])+"</div>"},option_create:function(e,t){return'<div class="create">Add <strong>'+t(e.input)+"</strong>…</div>"}};e.settings.render=$.extend({},i,e.settings.render)},setupCallbacks:function(){var e,t,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in n)n.hasOwnProperty(e)&&(t=this.settings[n[e]])&&this.on(e,t)},onClick:function(e){var t=this;t.isFocused&&t.isOpen||(t.focus(),e.preventDefault())},onMouseDown:function(e){var t=this,n=e.isDefaultPrevented(),i=$(e.target);if(t.isFocused){if(e.target!==t.$control_input[0])return"single"===t.settings.mode?t.isOpen?t.close():t.open():n||t.setActiveItem(null),!1}else n||window.setTimeout((function(){t.focus()}),0)},onChange:function(){this.$input.trigger("change")},onPaste:function(e){var t=this;t.isFull()||t.isInputHidden||t.isLocked?e.preventDefault():t.settings.splitOn&&setTimeout((function(){var e=t.$control_input.val();if(e.match(t.settings.splitOn))for(var n=$.trim(e).split(t.settings.splitOn),i=0,o=n.length;i<o;i++)t.createItem(n[i])}),0)},onKeyPress:function(e){if(this.isLocked)return e&&e.preventDefault();var t=String.fromCharCode(e.keyCode||e.which);return this.settings.create&&"multi"===this.settings.mode&&t===this.settings.delimiter?(this.createItem(),e.preventDefault(),!1):void 0},onKeyDown:function(e){var t=e.target===this.$control_input[0],n=this;if(n.isLocked)9!==e.keyCode&&e.preventDefault();else{switch(e.keyCode){case r:if(n.isCmdDown)return void n.selectAll();break;case l:return void(n.isOpen&&(e.preventDefault(),e.stopPropagation(),n.close()));case g:if(!e.ctrlKey||e.altKey)break;case h:if(!n.isOpen&&n.hasOptions)n.open();else if(n.$activeOption){n.ignoreHover=!0;var i=n.getAdjacentOption(n.$activeOption,1);i.length&&n.setActiveOption(i,!0,!0)}return void e.preventDefault();case c:if(!e.ctrlKey||e.altKey)break;case u:if(n.$activeOption){n.ignoreHover=!0;var s=n.getAdjacentOption(n.$activeOption,-1);s.length&&n.setActiveOption(s,!0,!0)}return void e.preventDefault();case a:return void(n.isOpen&&n.$activeOption&&(n.onOptionSelect({currentTarget:n.$activeOption}),e.preventDefault()));case p:return void n.advanceSelection(-1,e);case d:return void n.advanceSelection(1,e);case 9:return n.settings.selectOnTab&&n.isOpen&&n.$activeOption&&(n.onOptionSelect({currentTarget:n.$activeOption}),n.isFull()||e.preventDefault()),void(n.settings.create&&n.createItem()&&e.preventDefault());case 8:case v:return void n.deleteSelection(e)}!n.isFull()&&!n.isInputHidden||(o?e.metaKey:e.ctrlKey)||e.preventDefault()}},onKeyUp:function(e){var t=this;if(t.isLocked)return e&&e.preventDefault();var n=t.$control_input.val()||"";t.lastValue!==n&&(t.lastValue=n,t.onSearchChange(n),t.refreshOptions(),t.trigger("type",n))},onSearchChange:function(e){var t=this,n=t.settings.load;n&&(t.loadedSearches.hasOwnProperty(e)||(t.loadedSearches[e]=!0,t.load((function(i){n.apply(t,[e,i])}))))},onFocus:function(e){var t=this,n=t.isFocused;if(t.isDisabled)return t.blur(),e&&e.preventDefault(),!1;t.ignoreFocus||(t.isFocused=!0,"focus"===t.settings.preload&&t.onSearchChange(""),n||t.trigger("focus"),t.$activeItems.length||(t.showInput(),t.setActiveItem(null),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())},onBlur:function(e,t){var n=this;if(n.isFocused&&(n.isFocused=!1,!n.ignoreFocus)){if(!n.ignoreBlur&&document.activeElement===n.$dropdown_content[0])return n.ignoreBlur=!0,void n.onFocus(e);var i=function(){n.close(),n.setTextboxValue(""),n.setActiveItem(null),n.setActiveOption(null),n.setCaret(n.items.length),n.refreshState(),t&&t.focus&&t.focus(),n.isBlurring=!1,n.ignoreFocus=!1,n.trigger("blur")};n.isBlurring=!0,n.ignoreFocus=!0,n.settings.create&&n.settings.createOnBlur?n.createItem(null,!1,i):i()}},onOptionHover:function(e){this.ignoreHover||this.setActiveOption(e.currentTarget,!1)},onOptionSelect:function(e){var t,n,i,o=this;e.preventDefault&&(e.preventDefault(),e.stopPropagation()),(n=$(e.currentTarget)).hasClass("create")?o.createItem(null,(function(){o.settings.closeAfterSelect&&o.close()})):void 0!==(t=n.attr("data-value"))&&(o.lastQuery=null,o.setTextboxValue(""),o.addItem(t),o.settings.closeAfterSelect?o.close():!o.settings.hideSelected&&e.type&&/mouse/.test(e.type)&&o.setActiveOption(o.getOption(t)))},onItemSelect:function(e){var t=this;t.isLocked||"multi"===t.settings.mode&&(e.preventDefault(),t.setActiveItem(e.currentTarget,e))},load:function(e){var t=this,n=t.$wrapper.addClass(t.settings.loadingClass);t.loading++,e.apply(t,[function(e){t.loading=Math.max(t.loading-1,0),e&&e.length&&(t.addOption(e),t.refreshOptions(t.isFocused&&!t.isInputHidden)),t.loading||n.removeClass(t.settings.loadingClass),t.trigger("load",e)}])},setTextboxValue:function(e){var t=this.$control_input,n;t.val()!==e&&(t.val(e).triggerHandler("update"),this.lastValue=e)},getValue:function(){return 1===this.tagType&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(e,t){var n;A(this,t?[]:["change"],(function(){this.clear(t),this.addItems(e,t)}))},setActiveItem:function(e,t){var n=this,i,o,r,s,a,l,p,u;if("single"!==n.settings.mode){if(!(e=$(e)).length)return $(n.$activeItems).removeClass("active"),n.$activeItems=[],void(n.isFocused&&n.showInput());if("mousedown"===(i=t&&t.type.toLowerCase())&&n.isShiftDown&&n.$activeItems.length){for(u=n.$control.children(".active:last"),(s=Array.prototype.indexOf.apply(n.$control[0].childNodes,[u[0]]))>(a=Array.prototype.indexOf.apply(n.$control[0].childNodes,[e[0]]))&&(p=s,s=a,a=p),o=s;o<=a;o++)l=n.$control[0].childNodes[o],-1===n.$activeItems.indexOf(l)&&($(l).addClass("active"),n.$activeItems.push(l));t.preventDefault()}else"mousedown"===i&&n.isCtrlDown||"keydown"===i&&this.isShiftDown?e.hasClass("active")?(r=n.$activeItems.indexOf(e[0]),n.$activeItems.splice(r,1),e.removeClass("active")):n.$activeItems.push(e.addClass("active")[0]):($(n.$activeItems).removeClass("active"),n.$activeItems=[e.addClass("active")[0]]);n.hideInput(),this.isFocused||n.focus()}},setActiveOption:function(e,t,n){var i,o,r,s,a,l=this;l.$activeOption&&l.$activeOption.removeClass("active"),l.$activeOption=null,(e=$(e)).length&&(l.$activeOption=e.addClass("active"),!t&&S(t)||(i=l.$dropdown_content.height(),o=l.$activeOption.outerHeight(!0),t=l.$dropdown_content.scrollTop()||0,s=r=l.$activeOption.offset().top-l.$dropdown_content.offset().top+t,a=r-i+o,r+o>i+t?l.$dropdown_content.stop().animate({scrollTop:a},n?l.settings.scrollDuration:0):r<t&&l.$dropdown_content.stop().animate({scrollTop:s},n?l.settings.scrollDuration:0)))},selectAll:function(){var e=this;"single"!==e.settings.mode&&(e.$activeItems=Array.prototype.slice.apply(e.$control.children(":not(input)").addClass("active")),e.$activeItems.length&&(e.hideInput(),e.close()),e.focus())},hideInput:function(){var e=this;e.setTextboxValue(""),e.$control_input.css({opacity:0,position:"absolute",left:e.rtl?1e4:-1e4}),e.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var e=this;e.isDisabled||(e.ignoreFocus=!0,e.$control_input[0].focus(),window.setTimeout((function(){e.ignoreFocus=!1,e.onFocus()}),0))},blur:function(e){this.$control_input[0].blur(),this.onBlur(null,e)},getScoreFunction:function(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())},getSearchOptions:function(){var e=this.settings,t=e.sortField;return"string"==typeof t&&(t=[{field:t}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t,nesting:e.nesting}},search:function(e){var t,n,i,o,r,s=this,a=s.settings,l=this.getSearchOptions();if(a.score&&"function"!=typeof(r=s.settings.score.apply(this,[e])))throw new Error('Selectize "score" setting must be a function that returns a function');if(e!==s.lastQuery?(s.lastQuery=e,o=s.sifter.search(e,$.extend(l,{score:r})),s.currentResults=o):o=$.extend(!0,{},s.currentResults),a.hideSelected)for(t=o.items.length-1;t>=0;t--)-1!==s.items.indexOf(I(o.items[t].id))&&o.items.splice(t,1);return o},refreshOptions:function(e){var t,i,o,r,s,a,l,p,u,c,d,h,g,f,v,m;void 0===e&&(e=!0);var y=this,w=$.trim(y.$control_input.val()),O=y.search(w),C=y.$dropdown_content,b=y.$activeOption&&I(y.$activeOption.attr("data-value"));for(r=O.items.length,"number"==typeof y.settings.maxOptions&&(r=Math.min(r,y.settings.maxOptions)),s={},a=[],t=0;t<r;t++)for(l=y.options[O.items[t].id],p=y.render("option",l),u=l[y.settings.optgroupField]||"",i=0,o=(c=$.isArray(u)?u:[u])&&c.length;i<o;i++)u=c[i],y.optgroups.hasOwnProperty(u)||(u=""),s.hasOwnProperty(u)||(s[u]=document.createDocumentFragment(),a.push(u)),s[u].appendChild(p);for(this.settings.lockOptgroupOrder&&a.sort((function(e,t){var n,i;return(y.optgroups[e].$order||0)-(y.optgroups[t].$order||0)})),d=document.createDocumentFragment(),t=0,r=a.length;t<r;t++)u=a[t],y.optgroups.hasOwnProperty(u)&&s[u].childNodes.length?((h=document.createDocumentFragment()).appendChild(y.render("optgroup_header",y.optgroups[u])),h.appendChild(s[u]),d.appendChild(y.render("optgroup",$.extend({},y.optgroups[u],{html:E(h),dom:h})))):d.appendChild(s[u]);if(C.html(d),y.settings.highlight&&(C.removeHighlight(),O.query.length&&O.tokens.length))for(t=0,r=O.tokens.length;t<r;t++)n(C,O.tokens[t].regex);if(!y.settings.hideSelected)for(t=0,r=y.items.length;t<r;t++)y.getOption(y.items[t]).addClass("selected");(g=y.canCreate(w))&&(C.prepend(y.render("option_create",{input:w})),m=$(C[0].childNodes[0])),y.hasOptions=O.items.length>0||g,y.hasOptions?(O.items.length>0?((v=b&&y.getOption(b))&&v.length?f=v:"single"===y.settings.mode&&y.items.length&&(f=y.getOption(y.items[0])),f&&f.length||(f=m&&!y.settings.addPrecedence?y.getAdjacentOption(m,1):C.find("[data-selectable]:first"))):f=m,y.setActiveOption(f),e&&!y.isOpen&&y.open()):(y.setActiveOption(null),e&&y.isOpen&&y.close())},addOption:function(e){var t,n,i,o=this;if($.isArray(e))for(t=0,n=e.length;t<n;t++)o.addOption(e[t]);else(i=o.registerOption(e))&&(o.userOptions[i]=!0,o.lastQuery=null,o.trigger("option_add",i,e))},registerOption:function(e){var t=I(e[this.settings.valueField]);return null!=t&&!this.options.hasOwnProperty(t)&&(e.$order=e.$order||++this.order,this.options[t]=e,t)},registerOptionGroup:function(e){var t=I(e[this.settings.optgroupValueField]);return!!t&&(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)},addOptionGroup:function(e,t){t[this.settings.optgroupValueField]=e,(e=this.registerOptionGroup(t))&&this.trigger("optgroup_add",e,t)},removeOptionGroup:function(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.renderCache={},this.trigger("optgroup_remove",e))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(e,t){var n=this,i,o,r,s,a,l,p;if(e=I(e),r=I(t[n.settings.valueField]),null!==e&&n.options.hasOwnProperty(e)){if("string"!=typeof r)throw new Error("Value must be set in option data");p=n.options[e].$order,r!==e&&(delete n.options[e],-1!==(s=n.items.indexOf(e))&&n.items.splice(s,1,r)),t.$order=t.$order||p,n.options[r]=t,a=n.renderCache.item,l=n.renderCache.option,a&&(delete a[e],delete a[r]),l&&(delete l[e],delete l[r]),-1!==n.items.indexOf(r)&&(i=n.getItem(e),o=$(n.render("item",t)),i.hasClass("active")&&o.addClass("active"),i.replaceWith(o)),n.lastQuery=null,n.isOpen&&n.refreshOptions(!1)}},removeOption:function(e,t){var n=this;e=I(e);var i=n.renderCache.item,o=n.renderCache.option;i&&delete i[e],o&&delete o[e],delete n.userOptions[e],delete n.options[e],n.lastQuery=null,n.trigger("option_remove",e),n.removeItem(e,t)},clearOptions:function(){var e=this;e.loadedSearches={},e.userOptions={},e.renderCache={};var t=e.options;$.each(e.options,(function(n,i){-1==e.items.indexOf(n)&&delete t[n]})),e.options=e.sifter.items=t,e.lastQuery=null,e.trigger("option_clear")},getOption:function(e){return this.getElementWithValue(e,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(e,t){var n=this.$dropdown.find("[data-selectable]"),i=n.index(e)+t;return i>=0&&i<n.length?n.eq(i):$()},getElementWithValue:function(e,t){if(null!=(e=I(e)))for(var n=0,i=t.length;n<i;n++)if(t[n].getAttribute("data-value")===e)return $(t[n]);return $()},getItem:function(e){return this.getElementWithValue(e,this.$control.children())},addItems:function(e,t){this.buffer=document.createDocumentFragment();for(var n=this.$control[0].childNodes,i=0;i<n.length;i++)this.buffer.appendChild(n[i]);for(var o=$.isArray(e)?e:[e],i=0,r=o.length;i<r;i++)this.isPending=i<r-1,this.addItem(o[i],t);var s=this.$control[0];s.insertBefore(this.buffer,s.firstChild),this.buffer=null},addItem:function(e,t){var n;A(this,t?[]:["change"],(function(){var n,i,o,r=this,s=r.settings.mode,a,l,p,u;e=I(e),-1===r.items.indexOf(e)?r.options.hasOwnProperty(e)&&("single"===s&&r.clear(t),"multi"===s&&r.isFull()||(n=$(r.render("item",r.options[e])),u=r.isFull(),r.items.splice(r.caretPos,0,e),r.insertAtCaret(n),(!r.isPending||!u&&r.isFull())&&r.refreshState(),r.isSetup&&(o=r.$dropdown_content.find("[data-selectable]"),r.isPending||(i=r.getOption(e),p=r.getAdjacentOption(i,1).attr("data-value"),r.refreshOptions(r.isFocused&&"single"!==s),p&&r.setActiveOption(r.getOption(p))),!o.length||r.isFull()?r.close():r.isPending||r.positionDropdown(),r.updatePlaceholder(),r.trigger("item_add",e,n),r.isPending||r.updateOriginalInput({silent:t})))):"single"===s&&r.close()}))},removeItem:function(e,t){var n=this,i,o,r;i=e instanceof $?e:n.getItem(e),e=I(i.attr("data-value")),-1!==(o=n.items.indexOf(e))&&(i.remove(),i.hasClass("active")&&(r=n.$activeItems.indexOf(i[0]),n.$activeItems.splice(r,1)),n.items.splice(o,1),n.lastQuery=null,!n.settings.persist&&n.userOptions.hasOwnProperty(e)&&n.removeOption(e,t),o<n.caretPos&&n.setCaret(n.caretPos-1),n.refreshState(),n.updatePlaceholder(),n.updateOriginalInput({silent:t}),n.positionDropdown(),n.trigger("item_remove",e,i))},createItem:function(e,t){var n=this,i=n.caretPos;e=e||$.trim(n.$control_input.val()||"");var o=arguments[arguments.length-1];if("function"!=typeof o&&(o=function(){}),"boolean"!=typeof t&&(t=!0),!n.canCreate(e))return o(),!1;n.lock();var r="function"==typeof n.settings.create?this.settings.create:function(e){var t={};return t[n.settings.labelField]=e,t[n.settings.valueField]=e,t},s=k((function(e){if(n.unlock(),!e||"object"!=typeof e)return o();var r=I(e[n.settings.valueField]);if("string"!=typeof r)return o();n.setTextboxValue(""),n.addOption(e),n.setCaret(i),n.addItem(r),n.refreshOptions(t&&"single"!==n.settings.mode),o(e)})),a=r.apply(this,[e,s]);return void 0!==a&&s(a),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var e=!this.items.length;this.isInvalid=e,this.$control_input.prop("required",e),this.$input.prop("required",!e)},refreshClasses:function(){var e=this,t=e.isFull(),n=e.isLocked;e.$wrapper.toggleClass("rtl",e.rtl),2 e.$control.toggleClass("focus",e.isFocused).toggleClass("disabled",e.isDisabled).toggleClass("required",e.isRequired).toggleClass("invalid",e.isInvalid).toggleClass("locked",n).toggleClass("full",t).toggleClass("not-full",!t).toggleClass("input-active",e.isFocused&&!e.isInputHidden).toggleClass("dropdown-active",e.isOpen).toggleClass("has-options",!$.isEmptyObject(e.options)).toggleClass("has-items",e.items.length>0),e.$control_input.data("grow",!t&&!n)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,n,i,o,r=this;if(e=e||{},1===r.tagType){for(i=[],t=0,n=r.items.length;t<n;t++)o=r.options[r.items[t]][r.settings.labelField]||"",i.push('<option value="'+_(r.items[t])+'" selected="selected">'+_(o)+"</option>");i.length||this.$input.attr("multiple")||i.push('<option value="" selected="selected"></option>'),r.$input.html(i.join(""))}else r.$input.val(r.getValue()),r.$input.attr("value",r.$input.val());r.isSetup&&(e.silent||r.trigger("change",r.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.isBlurring||e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e[0].getBoundingClientRect().width,top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(e){var t=Math.min(this.caretPos,this.items.length),n=e[0],i=this.buffer||this.$control[0];0===t?i.insertBefore(n,i.firstChild):i.insertBefore(n,i.childNodes[t]),this.setCaret(t+1)},deleteSelection:function(e){var t,n,i,o,r,s,a,l,p,u=this;if(i=e&&8===e.keyCode?-1:1,o=T(u.$control_input[0]),u.$activeOption&&!u.settings.hideSelected&&(a=u.getAdjacentOption(u.$activeOption,-1).attr("data-value")),r=[],u.$activeItems.length){for(p=u.$control.children(".active:"+(i>0?"last":"first")),s=u.$control.children(":not(input)").index(p),i>0&&s++,t=0,n=u.$activeItems.length;t<n;t++)r.push($(u.$activeItems[t]).attr("data-value"));e&&(e.preventDefault(),e.stopPropagation())}else(u.isFocused||"single"===u.settings.mode)&&u.items.length&&(i<0&&0===o.start&&0===o.length?r.push(u.items[u.caretPos-1]):i>0&&o.start===u.$control_input.val().length&&r.push(u.items[u.caretPos]));if(!r.length||"function"==typeof u.settings.onDelete&&!1===u.settings.onDelete.apply(u,[r]))return!1;for(void 0!==s&&u.setCaret(s);r.length;)u.removeItem(r.pop());return u.showInput(),u.positionDropdown(),u.refreshOptions(!0),a&&(l=u.getOption(a)).length&&u.setActiveOption(l),!0},advanceSelection:function(e,t){var n,i,o,r,s,a,l=this;0!==e&&(l.rtl&&(e*=-1),n=e>0?"last":"first",i=T(l.$control_input[0]),l.isFocused&&!l.isInputHidden?(r=l.$control_input.val().length,(s=e<0?0===i.start&&0===i.length:i.start===r)&&!r&&l.advanceCaret(e,t)):(a=l.$control.children(".active:"+n)).length&&(o=l.$control.children(":not(input)").index(a),l.setActiveItem(null),l.setCaret(e>0?o+1:o)))},advanceCaret:function(e,t){var n=this,i,o;0!==e&&(i=e>0?"next":"prev",n.isShiftDown?(o=n.$control_input[i]()).length&&(n.hideInput(),n.setActiveItem(o),t&&t.preventDefault()):n.setCaret(n.caretPos+e))},setCaret:function(e){var t=this,n,i,o,r,s;if(e="single"===t.settings.mode?t.items.length:Math.max(0,Math.min(t.items.length,e)),!t.isPending)for(n=0,i=(r=t.$control.children(":not(input)")).length;n<i;n++)s=$(r[n]).detach(),n<e?t.$control_input.before(s):t.$control.append(s);t.caretPos=e},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var e=this;e.$input.prop("disabled",!0),e.$control_input.prop("disabled",!0).prop("tabindex",-1),e.isDisabled=!0,e.lock()},enable:function(){var e=this;e.$input.prop("disabled",!1),e.$control_input.prop("disabled",!1).prop("tabindex",e.tabIndex),e.isDisabled=!1,e.unlock()},destroy:function(){var e=this,t=e.eventNS,n=e.revertSettings;e.trigger("destroy"),e.off(),e.$wrapper.remove(),e.$dropdown.remove(),e.$input.html("").append(n.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:n.tabindex}).show(),e.$control_input.removeData("grow"),e.$input.removeData("selectize"),0==--L.count&&L.$testInput&&(L.$testInput.remove(),L.$testInput=void 0),$(window).off(t),$(document).off(t),$(document.body).off(t),delete e.$input[0].selectize},render:function(e,t){var n,i,o,r="",s=!1,a=this,l=/^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;return"option"!==e&&"item"!==e||(s=!!(n=I(t[a.settings.valueField]))),s&&(S(a.renderCache[e])||(a.renderCache[e]={}),a.renderCache[e].hasOwnProperty(n))?a.renderCache[e][n]:(r=$(a.settings.render[e].apply(this,[t,_])),"option"===e||"option_create"===e?t[a.settings.disabledField]||r.attr("data-selectable",""):"optgroup"===e&&(i=t[a.settings.optgroupValueField]||"",r.attr("data-group",i),t[a.settings.disabledField]&&r.attr("data-disabled","")),"option"!==e&&"item"!==e||r.attr("data-value",n||""),s&&(a.renderCache[e][n]=r[0]),r[0])},clearCache:function(e){var t=this;void 0===e?t.renderCache={}:delete t.renderCache[e]},canCreate:function(e){var t=this;if(!t.settings.create)return!1;var n=t.settings.createFilter;return e.length&&("function"!=typeof n||n.apply(t,[e]))&&("string"!=typeof n||new RegExp(n).test(e))&&(!(n instanceof RegExp)||n.test(e))}}),L.count=0,L.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},$.fn.selectize=function(e){var t=$.fn.selectize.defaults,n=$.extend({},t,e),i=n.dataAttr,o=n.labelField,r=n.valueField,s=n.disabledField,a=n.optgroupField,l=n.optgroupLabelField,p=n.optgroupValueField,u=function(e,t){var s,a,l,p,u=e.attr(i);if(u)for(t.options=JSON.parse(u),s=0,a=t.options.length;s<a;s++)t.items.push(t.options[s][r]);else{var c=$.trim(e.val()||"");if(!n.allowEmptyOption&&!c.length)return;for(s=0,a=(l=c.split(n.delimiter)).length;s<a;s++)(p={})[o]=l[s],p[r]=l[s],t.options.push(p);t.items=l}},c=function(e,t){var u,c,d,h,g=0,f=t.options,v={},m=function(e){var t=i&&e.attr(i);return"string"==typeof t&&t.length?JSON.parse(t):null},y=function(e,i){e=$(e);var l=I(e.val());if(l||n.allowEmptyOption)if(v.hasOwnProperty(l)){if(i){var p=v[l][a];p?$.isArray(p)?p.push(i):v[l][a]=[p,i]:v[l][a]=i}}else{var u=m(e)||{};u[o]=u[o]||e.text(),u[r]=u[r]||l,u[s]=u[s]||e.prop("disabled"),u[a]=u[a]||i,v[l]=u,f.push(u),e.is(":selected")&&t.items.push(l)}},w=function(e){var n,i,o,r,a;for((o=(e=$(e)).attr("label"))&&((r=m(e)||{})[l]=o,r[p]=o,r[s]=e.prop("disabled"),t.optgroups.push(r)),n=0,i=(a=$("option",e)).length;n<i;n++)y(a[n],o)};for(t.maxItems=e.attr("multiple")?null:1,u=0,c=(h=e.children()).length;u<c;u++)"optgroup"===(d=h[u].tagName.toLowerCase())?w(h[u]):"option"===d&&y(h[u])};return this.each((function(){if(!this.selectize){var i,o=$(this),r=this.tagName.toLowerCase(),s=o.attr("placeholder")||o.attr("data-placeholder");s||n.allowEmptyOption||(s=o.children('option[value=""]').text());var a={placeholder:s,options:[],optgroups:[],items:[]};"select"===r?c(o,a):u(o,a),i=new L(o,$.extend(!0,{},t,a,e))}}))},$.fn.selectize.defaults=L.defaults,$.fn.selectize.support={validity:x},L.define("drag_drop",(function(e){if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var t=this,n;t.lock=(n=t.lock,function(){var e=t.$control.data("sortable");return e&&e.disable(),n.apply(t,arguments)}),t.unlock=function(){var e=t.unlock;return function(){var n=t.$control.data("sortable");return n&&n.enable(),e.apply(t,arguments)}}(),t.setup=function(){var e=t.setup;return function(){e.apply(this,arguments);var n=t.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:t.isLocked,start:function(e,t){t.placeholder.css("width",t.helper.css("width")),n.css({overflow:"visible"})},stop:function(){n.css({overflow:"hidden"});var e=t.$activeItems?t.$activeItems.slice():null,i=[];n.children("[data-value]").each((function(){i.push($(this).attr("data-value"))})),t.setValue(i),t.setActiveItem(e)}})}}()}})),L.define("dropdown_header",(function(e){var t=this,n;e=$.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(e){return'<div class="'+e.headerClass+'"><div class="'+e.titleRowClass+'"><span class="'+e.labelClass+'">'+e.title+'</span><a href="javascript:void(0)" class="'+e.closeClass+'">×</a></div></div>'}},e),t.setup=(n=t.setup,function(){n.apply(t,arguments),t.$dropdown_header=$(e.html(e)),t.$dropdown.prepend(t.$dropdown_header)})})),L.define("optgroup_columns",(function(e){var t=this,n;e=$.extend({equalizeWidth:!0,equalizeHeight:!0},e),this.getAdjacentOption=function(e,t){var n=e.closest("[data-group]").find("[data-selectable]"),i=n.index(e)+t;return i>=0&&i<n.length?n.eq(i):$()},this.onKeyDown=(n=t.onKeyDown,function(e){var i,o,r,s;return!this.isOpen||e.keyCode!==p&&e.keyCode!==d?n.apply(this,arguments):(t.ignoreHover=!0,i=(s=this.$activeOption.closest("[data-group]")).find("[data-selectable]").index(this.$activeOption),void((o=(r=(s=e.keyCode===p?s.prev("[data-group]"):s.next("[data-group]")).find("[data-selectable]")).eq(Math.min(r.length-1,i))).length&&this.setActiveOption(o)))});var i=function(){var e,t=i.width,n=document;return void 0===t&&((e=n.createElement("div")).innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',e=e.firstChild,n.body.appendChild(e),t=i.width=e.offsetWidth-e.clientWidth,n.body.removeChild(e)),t},o=function(){var n,o,r,s,a,l,p;if((o=(p=$("[data-group]",t.$dropdown_content)).length)&&t.$dropdown_content.width()){if(e.equalizeHeight){for(r=0,n=0;n<o;n++)r=Math.max(r,p.eq(n).height());p.css({height:r})}e.equalizeWidth&&(l=t.$dropdown_content.innerWidth()-i(),s=Math.round(l/o),p.css({width:s}),o>1&&(a=l-s*(o-1),p.eq(o-1).css({width:a})))}};(e.equalizeHeight||e.equalizeWidth)&&(D.after(this,"positionDropdown",o),D.after(this,"refreshOptions",o))})),L.define("remove_button",(function(e){e=$.extend({label:"×",title:"Remove",className:"remove",append:!0},e);var t=function(e,t){t.className="remove-single";var n=e,i='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+_(t.title)+'">'+t.label+"</a>",o=function(e,t){return $("<span>").append(e).append(t)},r;e.setup=(r=n.setup,function(){if(t.append){var s=$(n.$input.context).attr("id"),a=$("#"+s),l=n.settings.render.item;n.settings.render.item=function(t){return o(l.apply(e,arguments),i)}}r.apply(e,arguments),e.$control.on("click","."+t.className,(function(e){e.preventDefault(),n.isLocked||n.clear()}))})},n=function(e,t){var n=e,i='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+_(t.title)+'">'+t.label+"</a>",o=function(e,t){var n=e.search(/(<\/[^>]+>\s*)$/);return e.substring(0,n)+t+e.substring(n)},r;e.setup=(r=n.setup,function(){if(t.append){var s=n.settings.render.item;n.settings.render.item=function(t){return o(s.apply(e,arguments),i)}}r.apply(e,arguments),e.$control.on("click","."+t.className,(function(e){if(e.preventDefault(),!n.isLocked){var t=$(e.currentTarget).parent();n.setActiveItem(t),n.deleteSelection()&&n.setCaret(n.items.length)}}))})};"single"!==this.settings.mode?n(this,e):t(this,e)})),L.define("restore_on_backspace",(function(e){var t=this,n;e.text=e.text||function(e){return e[this.settings.labelField]},this.onKeyDown=(n=t.onKeyDown,function(t){var i,o;return 8===t.keyCode&&""===this.$control_input.val()&&!this.$activeItems.length&&(i=this.caretPos-1)>=0&&i<this.items.length?(o=this.options[this.items[i]],this.deleteSelection(t)&&(this.setTextboxValue(e.text.apply(this,[o])),this.refreshOptions(!0)),void t.preventDefault()):n.apply(this,arguments)})})),L}));1 !function(e,t){"function"==typeof define&&define.amd?define("sifter",t):"object"==typeof exports?module.exports=t():e.Sifter=t()}(this,(function(){var e=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};e.prototype.tokenize=function(e){if(!(e=o(String(e||"").toLowerCase()))||!e.length)return[];var t,n,i,s,l=[],p=e.split(/ +/);for(t=0,n=p.length;t<n;t++){if(i=r(p[t]),this.settings.diacritics)for(s in a)a.hasOwnProperty(s)&&(i=i.replace(new RegExp(s,"g"),a[s]));l.push({string:p[t],regex:new RegExp(i,"i")})}return l},e.prototype.iterator=function(e,t){var n;n=s(e)?Array.prototype.forEach||function(e){for(var t=0,n=this.length;t<n;t++)e(this[t],t,this)}:function(e){for(var t in this)this.hasOwnProperty(t)&&e(this[t],t,this)},n.apply(e,[t])},e.prototype.getScoreFunction=function(e,t){var n,o,r,s;e=this.prepareSearch(e,t),o=e.tokens,n=e.options.fields,r=o.length,s=e.options.nesting;var a,l=function(e,t){var n,i;return e?-1===(i=(e=String(e||"")).search(t.regex))?0:(n=t.string.length/e.length,0===i&&(n+=.5),n):0},p=(a=n.length)?1===a?function(e,t){return l(i(t,n[0],s),e)}:function(e,t){for(var o=0,r=0;o<a;o++)r+=l(i(t,n[o],s),e);return r/a}:function(){return 0};return r?1===r?function(e){return p(o[0],e)}:"and"===e.options.conjunction?function(e){for(var t,n=0,i=0;n<r;n++){if((t=p(o[n],e))<=0)return 0;i+=t}return i/r}:function(e){for(var t=0,n=0;t<r;t++)n+=p(o[t],e);return n/r}:function(){return 0}},e.prototype.getSortFunction=function(e,n){var o,r,s,a,l,p,u,c,d,h,g;if(g=!(e=(s=this).prepareSearch(e,n)).query&&n.sort_empty||n.sort,d=function(e,t){return"$score"===e?t.score:i(s.items[t.id],e,n.nesting)},l=[],g)for(o=0,r=g.length;o<r;o++)(e.query||"$score"!==g[o].field)&&l.push(g[o]);if(e.query){for(h=!0,o=0,r=l.length;o<r;o++)if("$score"===l[o].field){h=!1;break}h&&l.unshift({field:"$score",direction:"desc"})}else for(o=0,r=l.length;o<r;o++)if("$score"===l[o].field){l.splice(o,1);break}for(c=[],o=0,r=l.length;o<r;o++)c.push("desc"===l[o].direction?-1:1);return(p=l.length)?1===p?(a=l[0].field,u=c[0],function(e,n){return u*t(d(a,e),d(a,n))}):function(e,n){var i,o,r;for(i=0;i<p;i++)if(r=l[i].field,o=c[i]*t(d(r,e),d(r,n)))return o;return 0}:null},e.prototype.prepareSearch=function(e,t){if("object"==typeof e)return e;var i=(t=n({},t)).fields,o=t.sort,r=t.sort_empty;return i&&!s(i)&&(t.fields=[i]),o&&!s(o)&&(t.sort=[o]),r&&!s(r)&&(t.sort_empty=[r]),{options:t,query:String(e||"").toLowerCase(),tokens:this.tokenize(e),total:0,items:[]}},e.prototype.search=function(e,t){var n,i,o,r,s=this;return i=this.prepareSearch(e,t),t=i.options,e=i.query,r=t.score||s.getScoreFunction(i),e.length?s.iterator(s.items,(function(e,o){n=r(e),(!1===t.filter||n>0)&&i.items.push({score:n,id:o})})):s.iterator(s.items,(function(e,t){i.items.push({score:1,id:t})})),(o=s.getSortFunction(i,t))&&i.items.sort(o),i.total=i.items.length,"number"==typeof t.limit&&(i.items=i.items.slice(0,t.limit)),i};var t=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:e<t?-1:0:(e=l(String(e||"")))>(t=l(String(t||"")))?1:t>e?-1:0},n=function(e,t){var n,i,o,r;for(n=1,i=arguments.length;n<i;n++)if(r=arguments[n])for(o in r)r.hasOwnProperty(o)&&(e[o]=r[o]);return e},i=function(e,t,n){if(e&&t){if(!n)return e[t];for(var i=t.split(".");i.length&&(e=e[i.shift()]););return e}},o=function(e){return(e+"").replace(/^\s+|\s+$|/g,"")},r=function(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},s=Array.isArray||"undefined"!=typeof $&&$.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},l=function(){var e,t,n,i,o="",r={};for(n in a)if(a.hasOwnProperty(n))for(o+=i=a[n].substring(2,a[n].length-1),e=0,t=i.length;e<t;e++)r[i.charAt(e)]=n;var s=new RegExp("["+o+"]","g");return function(e){return e.replace(s,(function(e){return r[e]})).toLowerCase()}}();return e})),function(e,t){"function"==typeof define&&define.amd?define("microplugin",t):"object"==typeof exports?module.exports=t():e.MicroPlugin=t()}(this,(function(){var e={mixin:function(e){e.plugins={},e.prototype.initializePlugins=function(e){var n,i,o,r=this,s=[];if(r.plugins={names:[],settings:{},requested:{},loaded:{}},t.isArray(e))for(n=0,i=e.length;n<i;n++)"string"==typeof e[n]?s.push(e[n]):(r.plugins.settings[e[n].name]=e[n].options,s.push(e[n].name));else if(e)for(o in e)e.hasOwnProperty(o)&&(r.plugins.settings[o]=e[o],s.push(o));for(;s.length;)r.require(s.shift())},e.prototype.loadPlugin=function(t){var n=this,i=n.plugins,o=e.plugins[t];if(!e.plugins.hasOwnProperty(t))throw new Error('Unable to find "'+t+'" plugin');i.requested[t]=!0,i.loaded[t]=o.fn.apply(n,[n.plugins.settings[t]||{}]),i.names.push(t)},e.prototype.require=function(e){var t=this,n=t.plugins;if(!t.plugins.loaded.hasOwnProperty(e)){if(n.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")');t.loadPlugin(e)}return n.loaded[e]},e.define=function(t,n){e.plugins[t]={name:t,fn:n}}}},t={isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}};return e})),function(e,t){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],t):"object"==typeof exports?module.exports=t(require("jquery"),require("sifter"),require("microplugin")):e.Selectize=t(e.jQuery,e.Sifter,e.MicroPlugin)}(this,(function($,e,t){"use strict";var n=function(e,t){if("string"!=typeof t||t.length){var n="string"==typeof t?new RegExp(t,"i"):t,i=function(e){var t=0;if(3===e.nodeType){var o=e.data.search(n);if(o>=0&&e.data.length>0){var r=e.data.match(n),s=document.createElement("span");s.className="highlight";var a=e.splitText(o),l=(a.splitText(r[0].length),a.cloneNode(!0));s.appendChild(l),a.parentNode.replaceChild(s,a),t=1}}else if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&("highlight"!==e.className||"SPAN"!==e.tagName))for(var p=0;p<e.childNodes.length;++p)p+=i(e.childNodes[p]);return t};return e.each((function(){i(this)}))}};$.fn.removeHighlight=function(){return this.find("span.highlight").each((function(){this.parentNode.firstChild.nodeName;var e=this.parentNode;e.replaceChild(this.firstChild,this),e.normalize()})).end()};var i=function(){};i.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){var n=arguments.length;return 0===n?delete this._events:1===n?delete this._events[e]:(this._events=this._events||{},void(e in this._events!=!1&&this._events[e].splice(this._events[e].indexOf(t),1)))},trigger:function(e){if(this._events=this._events||{},e in this._events!=!1)for(var t=0;t<this._events[e].length;t++)this._events[e][t].apply(this,Array.prototype.slice.call(arguments,1))}},i.mixin=function(e){for(var t=["on","off","trigger"],n=0;n<t.length;n++)e.prototype[t[n]]=i.prototype[t[n]]};var o,r,s=/Mac/.test(navigator.userAgent),a=s?91:17,l=s?18:17,p=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,u=function(e){return void 0!==e},c=function(e){return null==e?null:"boolean"==typeof e?e?"1":"0":e+""},d=function(e){return(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},h={before:function(e,t,n){var i=e[t];e[t]=function(){return n.apply(e,arguments),i.apply(e,arguments)}},after:function(e,t,n){var i=e[t];e[t]=function(){var t=i.apply(e,arguments);return n.apply(e,arguments),t}}},g=function(e,t,n){var i,o=e.trigger,r={};for(i in e.trigger=function(){var n=arguments[0];if(-1===t.indexOf(n))return o.apply(e,arguments);r[n]=arguments},n.apply(e,[]),e.trigger=o,r)r.hasOwnProperty(i)&&o.apply(e,r[i])},f=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var n=document.selection.createRange(),i=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t.start=n.text.length-i,t.length=i}return t},v=function(e){var t=null,n=function(n,i){var o,r,s,a,l,p,u,c,d,h;(i=i||{},(n=n||window.event||{}).metaKey||n.altKey)||(i.force||!1!==e.data("grow"))&&(o=e.val(),n.type&&"keydown"===n.type.toLowerCase()&&(s=(r=n.keyCode)>=48&&r<=57||r>=65&&r<=90||r>=96&&r<=111||r>=186&&r<=222||32===r,46===r||8===r?(c=f(e[0])).length?o=o.substring(0,c.start)+o.substring(c.start+c.length):8===r&&c.start?o=o.substring(0,c.start-1)+o.substring(c.start+1):46===r&&void 0!==c.start&&(o=o.substring(0,c.start)+o.substring(c.start+1)):s&&(p=n.shiftKey,u=String.fromCharCode(n.keyCode),o+=u=p?u.toUpperCase():u.toLowerCase())),a=e.attr("placeholder"),!o&&a&&(o=a),h=e,(l=((d=o)?(m.$testInput||(m.$testInput=$("<span />").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).appendTo("body")),m.$testInput.text(d),function(e,t,n){var i,o,r={};if(n)for(i=0,o=n.length;i<o;i++)r[n[i]]=e.css(n[i]);else r=e.css();t.css(r)}(h,m.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),m.$testInput.width()):0)+4)!==t&&(t=l,e.width(l),e.triggerHandler("resize")))};e.on("keydown keyup update blur",n),n()},m=function(t,n){var i,o,r,s,a=this;(s=t[0]).selectize=a;var l,p,u,c=window.getComputedStyle&&window.getComputedStyle(s,null);if(r=(r=c?c.getPropertyValue("direction"):s.currentStyle&&s.currentStyle.direction)||t.parents("[dir]:first").attr("dir")||"",$.extend(a,{order:0,settings:n,$input:t,tabIndex:t.attr("tabindex")||"",tagType:"select"===s.tagName.toLowerCase()?1:2,rtl:/rtl/i.test(r),eventNS:".selectize"+ ++m.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:t.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===n.loadThrottle?a.onSearchChange:(l=a.onSearchChange,p=n.loadThrottle,function(){var e=this,t=arguments;window.clearTimeout(u),u=window.setTimeout((function(){l.apply(e,t)}),p)})}),a.sifter=new e(this.options,{diacritics:n.diacritics}),a.settings.options){for(i=0,o=a.settings.options.length;i<o;i++)a.registerOption(a.settings.options[i]);delete a.settings.options}if(a.settings.optgroups){for(i=0,o=a.settings.optgroups.length;i<o;i++)a.registerOptionGroup(a.settings.optgroups[i]);delete a.settings.optgroups}a.settings.mode=a.settings.mode||(1===a.settings.maxItems?"single":"multi"),"boolean"!=typeof a.settings.hideSelected&&(a.settings.hideSelected="multi"===a.settings.mode),a.initializePlugins(a.settings.plugins),a.setupCallbacks(),a.setupTemplates(),a.setup()};return i.mixin(m),void 0!==t?t.mixin(m):(o="Dependency MicroPlugin is missing",(r={explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'})||(r={}),console.error("Selectize: "+o),r.explanation&&(console.group&&console.group(),console.error(r.explanation),console.group&&console.groupEnd())),$.extend(m.prototype,{setup:function(){var e,t,n,i,o,r,u,c,d,h,g,f,m,y,w=this,O=w.settings,C=w.eventNS,b=$(window),x=$(document),S=w.$input;if(u=w.settings.mode,c=S.attr("class")||"",e=$("<div>").addClass(O.wrapperClass).addClass(c).addClass(u),t=$("<div>").addClass(O.inputClass).addClass("items").appendTo(e),n=$('<input type="text" autocomplete="off" />').appendTo(t).attr("tabindex",S.is(":disabled")?"-1":w.tabIndex),r=$(O.dropdownParent||e),i=$("<div>").addClass(O.dropdownClass).addClass(u).hide().appendTo(r),o=$("<div>").addClass(O.dropdownContentClass).appendTo(i),(h=S.attr("id"))&&(n.attr("id",h+"-selectized"),$("label[for='"+h+"']").attr("for",h+"-selectized")),w.settings.copyClassesToDropdown&&i.addClass(c),e.css({width:S[0].style.width}),w.plugins.names.length&&(d="plugin-"+w.plugins.names.join(" plugin-"),e.addClass(d),i.addClass(d)),(null===O.maxItems||O.maxItems>1)&&1===w.tagType&&S.attr("multiple","multiple"),w.settings.placeholder&&n.attr("placeholder",O.placeholder),!w.settings.splitOn&&w.settings.delimiter){var I=w.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");w.settings.splitOn=new RegExp("\\s*"+I+"+\\s*")}S.attr("autocorrect")&&n.attr("autocorrect",S.attr("autocorrect")),S.attr("autocapitalize")&&n.attr("autocapitalize",S.attr("autocapitalize")),n[0].type=S[0].type,w.$wrapper=e,w.$control=t,w.$control_input=n,w.$dropdown=i,w.$dropdown_content=o,i.on("mouseenter mousedown click","[data-disabled]>[data-selectable]",(function(e){e.stopImmediatePropagation()})),i.on("mouseenter","[data-selectable]",(function(){return w.onOptionHover.apply(w,arguments)})),i.on("mousedown click","[data-selectable]",(function(){return w.onOptionSelect.apply(w,arguments)})),f="mousedown",m="*:not(input)",y=function(){return w.onItemSelect.apply(w,arguments)},(g=t).on(f,m,(function(e){for(var t=e.target;t&&t.parentNode!==g[0];)t=t.parentNode;return e.currentTarget=t,y.apply(this,[e])})),v(n),t.on({mousedown:function(){return w.onMouseDown.apply(w,arguments)},click:function(){return w.onClick.apply(w,arguments)}}),n.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return w.onKeyDown.apply(w,arguments)},keyup:function(){return w.onKeyUp.apply(w,arguments)},keypress:function(){return w.onKeyPress.apply(w,arguments)},resize:function(){w.positionDropdown.apply(w,[])},blur:function(){return w.onBlur.apply(w,arguments)},focus:function(){return w.ignoreBlur=!1,w.onFocus.apply(w,arguments)},paste:function(){return w.onPaste.apply(w,arguments)}}),x.on("keydown"+C,(function(e){w.isCmdDown=e[s?"metaKey":"ctrlKey"],w.isCtrlDown=e[s?"altKey":"ctrlKey"],w.isShiftDown=e.shiftKey})),x.on("keyup"+C,(function(e){e.keyCode===l&&(w.isCtrlDown=!1),16===e.keyCode&&(w.isShiftDown=!1),e.keyCode===a&&(w.isCmdDown=!1)})),x.on("mousedown"+C,(function(e){if(w.isFocused){if(e.target===w.$dropdown[0]||e.target.parentNode===w.$dropdown[0])return!1;w.$control.has(e.target).length||e.target===w.$control[0]||w.blur(e.target)}})),b.on(["scroll"+C,"resize"+C].join(" "),(function(){w.isOpen&&w.positionDropdown.apply(w,arguments)})),b.on("mousemove"+C,(function(){w.ignoreHover=!1})),this.revertSettings={$children:S.children().detach(),tabindex:S.attr("tabindex")},S.attr("tabindex",-1).hide().after(w.$wrapper),$.isArray(O.items)&&(w.setValue(O.items),delete O.items),p&&S.on("invalid"+C,(function(e){e.preventDefault(),w.isInvalid=!0,w.refreshState()})),w.updateOriginalInput(),w.refreshItems(),w.refreshState(),w.updatePlaceholder(),w.isSetup=!0,S.is(":disabled")&&w.disable(),w.on("change",this.onChange),S.data("selectize",w),S.addClass("selectized"),w.trigger("initialize"),!0===O.preload&&w.onSearchChange("")},setupTemplates:function(){var e=this,t=e.settings.labelField,n=e.settings.optgroupLabelField,i={optgroup:function(e){return'<div class="optgroup">'+e.html+"</div>"},optgroup_header:function(e,t){return'<div class="optgroup-header">'+t(e[n])+"</div>"},option:function(e,n){return'<div class="option">'+n(e[t])+"</div>"},item:function(e,n){return'<div class="item">'+n(e[t])+"</div>"},option_create:function(e,t){return'<div class="create">Add <strong>'+t(e.input)+"</strong>…</div>"}};e.settings.render=$.extend({},i,e.settings.render)},setupCallbacks:function(){var e,t,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in n)n.hasOwnProperty(e)&&(t=this.settings[n[e]])&&this.on(e,t)},onClick:function(e){var t=this;t.isFocused&&t.isOpen||(t.focus(),e.preventDefault())},onMouseDown:function(e){var t=this,n=e.isDefaultPrevented();$(e.target);if(t.isFocused){if(e.target!==t.$control_input[0])return"single"===t.settings.mode?t.isOpen?t.close():t.open():n||t.setActiveItem(null),!1}else n||window.setTimeout((function(){t.focus()}),0)},onChange:function(){this.$input.trigger("change")},onPaste:function(e){var t=this;t.isFull()||t.isInputHidden||t.isLocked?e.preventDefault():t.settings.splitOn&&setTimeout((function(){var e=t.$control_input.val();if(e.match(t.settings.splitOn))for(var n=$.trim(e).split(t.settings.splitOn),i=0,o=n.length;i<o;i++)t.createItem(n[i])}),0)},onKeyPress:function(e){if(this.isLocked)return e&&e.preventDefault();var t=String.fromCharCode(e.keyCode||e.which);return this.settings.create&&"multi"===this.settings.mode&&t===this.settings.delimiter?(this.createItem(),e.preventDefault(),!1):void 0},onKeyDown:function(e){e.target,this.$control_input[0];var t=this;if(t.isLocked)9!==e.keyCode&&e.preventDefault();else{switch(e.keyCode){case 65:if(t.isCmdDown)return void t.selectAll();break;case 27:return void(t.isOpen&&(e.preventDefault(),e.stopPropagation(),t.close()));case 78:if(!e.ctrlKey||e.altKey)break;case 40:if(!t.isOpen&&t.hasOptions)t.open();else if(t.$activeOption){t.ignoreHover=!0;var n=t.getAdjacentOption(t.$activeOption,1);n.length&&t.setActiveOption(n,!0,!0)}return void e.preventDefault();case 80:if(!e.ctrlKey||e.altKey)break;case 38:if(t.$activeOption){t.ignoreHover=!0;var i=t.getAdjacentOption(t.$activeOption,-1);i.length&&t.setActiveOption(i,!0,!0)}return void e.preventDefault();case 13:return void(t.isOpen&&t.$activeOption&&(t.onOptionSelect({currentTarget:t.$activeOption}),e.preventDefault()));case 37:return void t.advanceSelection(-1,e);case 39:return void t.advanceSelection(1,e);case 9:return t.settings.selectOnTab&&t.isOpen&&t.$activeOption&&(t.onOptionSelect({currentTarget:t.$activeOption}),t.isFull()||e.preventDefault()),void(t.settings.create&&t.createItem()&&e.preventDefault());case 8:case 46:return void t.deleteSelection(e)}!t.isFull()&&!t.isInputHidden||(s?e.metaKey:e.ctrlKey)||e.preventDefault()}},onKeyUp:function(e){var t=this;if(t.isLocked)return e&&e.preventDefault();var n=t.$control_input.val()||"";t.lastValue!==n&&(t.lastValue=n,t.onSearchChange(n),t.refreshOptions(),t.trigger("type",n))},onSearchChange:function(e){var t=this,n=t.settings.load;n&&(t.loadedSearches.hasOwnProperty(e)||(t.loadedSearches[e]=!0,t.load((function(i){n.apply(t,[e,i])}))))},onFocus:function(e){var t=this,n=t.isFocused;if(t.isDisabled)return t.blur(),e&&e.preventDefault(),!1;t.ignoreFocus||(t.isFocused=!0,"focus"===t.settings.preload&&t.onSearchChange(""),n||t.trigger("focus"),t.$activeItems.length||(t.showInput(),t.setActiveItem(null),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())},onBlur:function(e,t){var n=this;if(n.isFocused&&(n.isFocused=!1,!n.ignoreFocus)){if(!n.ignoreBlur&&document.activeElement===n.$dropdown_content[0])return n.ignoreBlur=!0,void n.onFocus(e);var i=function(){n.close(),n.setTextboxValue(""),n.setActiveItem(null),n.setActiveOption(null),n.setCaret(n.items.length),n.refreshState(),t&&t.focus&&t.focus(),n.isBlurring=!1,n.ignoreFocus=!1,n.trigger("blur")};n.isBlurring=!0,n.ignoreFocus=!0,n.settings.create&&n.settings.createOnBlur?n.createItem(null,!1,i):i()}},onOptionHover:function(e){this.ignoreHover||this.setActiveOption(e.currentTarget,!1)},onOptionSelect:function(e){var t,n,i=this;e.preventDefault&&(e.preventDefault(),e.stopPropagation()),(n=$(e.currentTarget)).hasClass("create")?i.createItem(null,(function(){i.settings.closeAfterSelect&&i.close()})):void 0!==(t=n.attr("data-value"))&&(i.lastQuery=null,i.setTextboxValue(""),i.addItem(t),i.settings.closeAfterSelect?i.close():!i.settings.hideSelected&&e.type&&/mouse/.test(e.type)&&i.setActiveOption(i.getOption(t)))},onItemSelect:function(e){var t=this;t.isLocked||"multi"===t.settings.mode&&(e.preventDefault(),t.setActiveItem(e.currentTarget,e))},load:function(e){var t=this,n=t.$wrapper.addClass(t.settings.loadingClass);t.loading++,e.apply(t,[function(e){t.loading=Math.max(t.loading-1,0),e&&e.length&&(t.addOption(e),t.refreshOptions(t.isFocused&&!t.isInputHidden)),t.loading||n.removeClass(t.settings.loadingClass),t.trigger("load",e)}])},setTextboxValue:function(e){var t=this.$control_input;t.val()!==e&&(t.val(e).triggerHandler("update"),this.lastValue=e)},getValue:function(){return 1===this.tagType&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(e,t){g(this,t?[]:["change"],(function(){this.clear(t),this.addItems(e,t)}))},setActiveItem:function(e,t){var n,i,o,r,s,a,l,p,u=this;if("single"!==u.settings.mode){if(!(e=$(e)).length)return $(u.$activeItems).removeClass("active"),u.$activeItems=[],void(u.isFocused&&u.showInput());if("mousedown"===(n=t&&t.type.toLowerCase())&&u.isShiftDown&&u.$activeItems.length){for(p=u.$control.children(".active:last"),(r=Array.prototype.indexOf.apply(u.$control[0].childNodes,[p[0]]))>(s=Array.prototype.indexOf.apply(u.$control[0].childNodes,[e[0]]))&&(l=r,r=s,s=l),i=r;i<=s;i++)a=u.$control[0].childNodes[i],-1===u.$activeItems.indexOf(a)&&($(a).addClass("active"),u.$activeItems.push(a));t.preventDefault()}else"mousedown"===n&&u.isCtrlDown||"keydown"===n&&this.isShiftDown?e.hasClass("active")?(o=u.$activeItems.indexOf(e[0]),u.$activeItems.splice(o,1),e.removeClass("active")):u.$activeItems.push(e.addClass("active")[0]):($(u.$activeItems).removeClass("active"),u.$activeItems=[e.addClass("active")[0]]);u.hideInput(),this.isFocused||u.focus()}},setActiveOption:function(e,t,n){var i,o,r,s,a,l=this;l.$activeOption&&l.$activeOption.removeClass("active"),l.$activeOption=null,(e=$(e)).length&&(l.$activeOption=e.addClass("active"),!t&&u(t)||(i=l.$dropdown_content.height(),o=l.$activeOption.outerHeight(!0),t=l.$dropdown_content.scrollTop()||0,s=r=l.$activeOption.offset().top-l.$dropdown_content.offset().top+t,a=r-i+o,r+o>i+t?l.$dropdown_content.stop().animate({scrollTop:a},n?l.settings.scrollDuration:0):r<t&&l.$dropdown_content.stop().animate({scrollTop:s},n?l.settings.scrollDuration:0)))},selectAll:function(){var e=this;"single"!==e.settings.mode&&(e.$activeItems=Array.prototype.slice.apply(e.$control.children(":not(input)").addClass("active")),e.$activeItems.length&&(e.hideInput(),e.close()),e.focus())},hideInput:function(){var e=this;e.setTextboxValue(""),e.$control_input.css({opacity:0,position:"absolute",left:e.rtl?1e4:-1e4}),e.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var e=this;e.isDisabled||(e.ignoreFocus=!0,e.$control_input[0].focus(),window.setTimeout((function(){e.ignoreFocus=!1,e.onFocus()}),0))},blur:function(e){this.$control_input[0].blur(),this.onBlur(null,e)},getScoreFunction:function(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())},getSearchOptions:function(){var e=this.settings,t=e.sortField;return"string"==typeof t&&(t=[{field:t}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t,nesting:e.nesting}},search:function(e){var t,n,i,o=this,r=o.settings,s=this.getSearchOptions();if(r.score&&"function"!=typeof(i=o.settings.score.apply(this,[e])))throw new Error('Selectize "score" setting must be a function that returns a function');if(e!==o.lastQuery?(o.lastQuery=e,n=o.sifter.search(e,$.extend(s,{score:i})),o.currentResults=n):n=$.extend(!0,{},o.currentResults),r.hideSelected)for(t=n.items.length-1;t>=0;t--)-1!==o.items.indexOf(c(n.items[t].id))&&n.items.splice(t,1);return n},refreshOptions:function(e){var t,i,o,r,s,a,l,p,u,d,h,g,f,v,m,y;void 0===e&&(e=!0);var w,O,C=this,b=$.trim(C.$control_input.val()),x=C.search(b),S=C.$dropdown_content,I=C.$activeOption&&c(C.$activeOption.attr("data-value"));for(r=x.items.length,"number"==typeof C.settings.maxOptions&&(r=Math.min(r,C.settings.maxOptions)),s={},a=[],t=0;t<r;t++)for(l=C.options[x.items[t].id],p=C.render("option",l),u=l[C.settings.optgroupField]||"",i=0,o=(d=$.isArray(u)?u:[u])&&d.length;i<o;i++)u=d[i],C.optgroups.hasOwnProperty(u)||(u=""),s.hasOwnProperty(u)||(s[u]=document.createDocumentFragment(),a.push(u)),s[u].appendChild(p);for(this.settings.lockOptgroupOrder&&a.sort((function(e,t){return(C.optgroups[e].$order||0)-(C.optgroups[t].$order||0)})),h=document.createDocumentFragment(),t=0,r=a.length;t<r;t++)u=a[t],C.optgroups.hasOwnProperty(u)&&s[u].childNodes.length?((g=document.createDocumentFragment()).appendChild(C.render("optgroup_header",C.optgroups[u])),g.appendChild(s[u]),h.appendChild(C.render("optgroup",$.extend({},C.optgroups[u],{html:(w=g,O=void 0,O=document.createElement("div"),O.appendChild(w.cloneNode(!0)),O.innerHTML),dom:g})))):h.appendChild(s[u]);if(S.html(h),C.settings.highlight&&(S.removeHighlight(),x.query.length&&x.tokens.length))for(t=0,r=x.tokens.length;t<r;t++)n(S,x.tokens[t].regex);if(!C.settings.hideSelected)for(t=0,r=C.items.length;t<r;t++)C.getOption(C.items[t]).addClass("selected");(f=C.canCreate(b))&&(S.prepend(C.render("option_create",{input:b})),y=$(S[0].childNodes[0])),C.hasOptions=x.items.length>0||f,C.hasOptions?(x.items.length>0?((m=I&&C.getOption(I))&&m.length?v=m:"single"===C.settings.mode&&C.items.length&&(v=C.getOption(C.items[0])),v&&v.length||(v=y&&!C.settings.addPrecedence?C.getAdjacentOption(y,1):S.find("[data-selectable]:first"))):v=y,C.setActiveOption(v),e&&!C.isOpen&&C.open()):(C.setActiveOption(null),e&&C.isOpen&&C.close())},addOption:function(e){var t,n,i,o=this;if($.isArray(e))for(t=0,n=e.length;t<n;t++)o.addOption(e[t]);else(i=o.registerOption(e))&&(o.userOptions[i]=!0,o.lastQuery=null,o.trigger("option_add",i,e))},registerOption:function(e){var t=c(e[this.settings.valueField]);return null!=t&&!this.options.hasOwnProperty(t)&&(e.$order=e.$order||++this.order,this.options[t]=e,t)},registerOptionGroup:function(e){var t=c(e[this.settings.optgroupValueField]);return!!t&&(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)},addOptionGroup:function(e,t){t[this.settings.optgroupValueField]=e,(e=this.registerOptionGroup(t))&&this.trigger("optgroup_add",e,t)},removeOptionGroup:function(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.renderCache={},this.trigger("optgroup_remove",e))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(e,t){var n,i,o,r,s,a,l,p=this;if(e=c(e),o=c(t[p.settings.valueField]),null!==e&&p.options.hasOwnProperty(e)){if("string"!=typeof o)throw new Error("Value must be set in option data");l=p.options[e].$order,o!==e&&(delete p.options[e],-1!==(r=p.items.indexOf(e))&&p.items.splice(r,1,o)),t.$order=t.$order||l,p.options[o]=t,s=p.renderCache.item,a=p.renderCache.option,s&&(delete s[e],delete s[o]),a&&(delete a[e],delete a[o]),-1!==p.items.indexOf(o)&&(n=p.getItem(e),i=$(p.render("item",t)),n.hasClass("active")&&i.addClass("active"),n.replaceWith(i)),p.lastQuery=null,p.isOpen&&p.refreshOptions(!1)}},removeOption:function(e,t){var n=this;e=c(e);var i=n.renderCache.item,o=n.renderCache.option;i&&delete i[e],o&&delete o[e],delete n.userOptions[e],delete n.options[e],n.lastQuery=null,n.trigger("option_remove",e),n.removeItem(e,t)},clearOptions:function(){var e=this;e.loadedSearches={},e.userOptions={},e.renderCache={};var t=e.options;$.each(e.options,(function(n,i){-1==e.items.indexOf(n)&&delete t[n]})),e.options=e.sifter.items=t,e.lastQuery=null,e.trigger("option_clear")},getOption:function(e){return this.getElementWithValue(e,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(e,t){var n=this.$dropdown.find("[data-selectable]"),i=n.index(e)+t;return i>=0&&i<n.length?n.eq(i):$()},getElementWithValue:function(e,t){if(null!=(e=c(e)))for(var n=0,i=t.length;n<i;n++)if(t[n].getAttribute("data-value")===e)return $(t[n]);return $()},getItem:function(e){return this.getElementWithValue(e,this.$control.children())},addItems:function(e,t){this.buffer=document.createDocumentFragment();for(var n=this.$control[0].childNodes,i=0;i<n.length;i++)this.buffer.appendChild(n[i]);for(var o=$.isArray(e)?e:[e],r=(i=0,o.length);i<r;i++)this.isPending=i<r-1,this.addItem(o[i],t);var s=this.$control[0];s.insertBefore(this.buffer,s.firstChild),this.buffer=null},addItem:function(e,t){g(this,t?[]:["change"],(function(){var n,i,o,r,s,a=this,l=a.settings.mode;e=c(e),-1===a.items.indexOf(e)?a.options.hasOwnProperty(e)&&("single"===l&&a.clear(t),"multi"===l&&a.isFull()||(n=$(a.render("item",a.options[e])),s=a.isFull(),a.items.splice(a.caretPos,0,e),a.insertAtCaret(n),(!a.isPending||!s&&a.isFull())&&a.refreshState(),a.isSetup&&(o=a.$dropdown_content.find("[data-selectable]"),a.isPending||(i=a.getOption(e),r=a.getAdjacentOption(i,1).attr("data-value"),a.refreshOptions(a.isFocused&&"single"!==l),r&&a.setActiveOption(a.getOption(r))),!o.length||a.isFull()?a.close():a.isPending||a.positionDropdown(),a.updatePlaceholder(),a.trigger("item_add",e,n),a.isPending||a.updateOriginalInput({silent:t})))):"single"===l&&a.close()}))},removeItem:function(e,t){var n,i,o,r=this;n=e instanceof $?e:r.getItem(e),e=c(n.attr("data-value")),-1!==(i=r.items.indexOf(e))&&(n.remove(),n.hasClass("active")&&(o=r.$activeItems.indexOf(n[0]),r.$activeItems.splice(o,1)),r.items.splice(i,1),r.lastQuery=null,!r.settings.persist&&r.userOptions.hasOwnProperty(e)&&r.removeOption(e,t),i<r.caretPos&&r.setCaret(r.caretPos-1),r.refreshState(),r.updatePlaceholder(),r.updateOriginalInput({silent:t}),r.positionDropdown(),r.trigger("item_remove",e,n))},createItem:function(e,t){var n=this,i=n.caretPos;e=e||$.trim(n.$control_input.val()||"");var o=arguments[arguments.length-1];if("function"!=typeof o&&(o=function(){}),"boolean"!=typeof t&&(t=!0),!n.canCreate(e))return o(),!1;n.lock();var r,s,a="function"==typeof n.settings.create?this.settings.create:function(e){var t={};return t[n.settings.labelField]=e,t[n.settings.valueField]=e,t},l=(r=function(e){if(n.unlock(),!e||"object"!=typeof e)return o();var r=c(e[n.settings.valueField]);if("string"!=typeof r)return o();n.setTextboxValue(""),n.addOption(e),n.setCaret(i),n.addItem(r),n.refreshOptions(t&&"single"!==n.settings.mode),o(e)},s=!1,function(){s||(s=!0,r.apply(this,arguments))}),p=a.apply(this,[e,l]);return void 0!==p&&l(p),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var e=!this.items.length;this.isInvalid=e,this.$control_input.prop("required",e),this.$input.prop("required",!e)},refreshClasses:function(){var e=this,t=e.isFull(),n=e.isLocked;e.$wrapper.toggleClass("rtl",e.rtl),e.$control.toggleClass("focus",e.isFocused).toggleClass("disabled",e.isDisabled).toggleClass("required",e.isRequired).toggleClass("invalid",e.isInvalid).toggleClass("locked",n).toggleClass("full",t).toggleClass("not-full",!t).toggleClass("input-active",e.isFocused&&!e.isInputHidden).toggleClass("dropdown-active",e.isOpen).toggleClass("has-options",!$.isEmptyObject(e.options)).toggleClass("has-items",e.items.length>0),e.$control_input.data("grow",!t&&!n)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,n,i,o,r=this;if(e=e||{},1===r.tagType){for(i=[],t=0, 2 n=r.items.length;t<n;t++)o=r.options[r.items[t]][r.settings.labelField]||"",i.push('<option value="'+d(r.items[t])+'" selected="selected">'+d(o)+"</option>");i.length||this.$input.attr("multiple")||i.push('<option value="" selected="selected"></option>'),r.$input.html(i.join(""))}else r.$input.val(r.getValue()),r.$input.attr("value",r.$input.val());r.isSetup&&(e.silent||r.trigger("change",r.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.isBlurring||e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e[0].getBoundingClientRect().width,top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(e){var t=Math.min(this.caretPos,this.items.length),n=e[0],i=this.buffer||this.$control[0];0===t?i.insertBefore(n,i.firstChild):i.insertBefore(n,i.childNodes[t]),this.setCaret(t+1)},deleteSelection:function(e){var t,n,i,o,r,s,a,l,p,u=this;if(i=e&&8===e.keyCode?-1:1,o=f(u.$control_input[0]),u.$activeOption&&!u.settings.hideSelected&&(a=u.getAdjacentOption(u.$activeOption,-1).attr("data-value")),r=[],u.$activeItems.length){for(p=u.$control.children(".active:"+(i>0?"last":"first")),s=u.$control.children(":not(input)").index(p),i>0&&s++,t=0,n=u.$activeItems.length;t<n;t++)r.push($(u.$activeItems[t]).attr("data-value"));e&&(e.preventDefault(),e.stopPropagation())}else(u.isFocused||"single"===u.settings.mode)&&u.items.length&&(i<0&&0===o.start&&0===o.length?r.push(u.items[u.caretPos-1]):i>0&&o.start===u.$control_input.val().length&&r.push(u.items[u.caretPos]));if(!r.length||"function"==typeof u.settings.onDelete&&!1===u.settings.onDelete.apply(u,[r]))return!1;for(void 0!==s&&u.setCaret(s);r.length;)u.removeItem(r.pop());return u.showInput(),u.positionDropdown(),u.refreshOptions(!0),a&&(l=u.getOption(a)).length&&u.setActiveOption(l),!0},advanceSelection:function(e,t){var n,i,o,r,s,a=this;0!==e&&(a.rtl&&(e*=-1),n=e>0?"last":"first",i=f(a.$control_input[0]),a.isFocused&&!a.isInputHidden?(r=a.$control_input.val().length,(e<0?0===i.start&&0===i.length:i.start===r)&&!r&&a.advanceCaret(e,t)):(s=a.$control.children(".active:"+n)).length&&(o=a.$control.children(":not(input)").index(s),a.setActiveItem(null),a.setCaret(e>0?o+1:o)))},advanceCaret:function(e,t){var n,i,o=this;0!==e&&(n=e>0?"next":"prev",o.isShiftDown?(i=o.$control_input[n]()).length&&(o.hideInput(),o.setActiveItem(i),t&&t.preventDefault()):o.setCaret(o.caretPos+e))},setCaret:function(e){var t,n,i,o,r=this;if(e="single"===r.settings.mode?r.items.length:Math.max(0,Math.min(r.items.length,e)),!r.isPending)for(t=0,n=(i=r.$control.children(":not(input)")).length;t<n;t++)o=$(i[t]).detach(),t<e?r.$control_input.before(o):r.$control.append(o);r.caretPos=e},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var e=this;e.$input.prop("disabled",!0),e.$control_input.prop("disabled",!0).prop("tabindex",-1),e.isDisabled=!0,e.lock()},enable:function(){var e=this;e.$input.prop("disabled",!1),e.$control_input.prop("disabled",!1).prop("tabindex",e.tabIndex),e.isDisabled=!1,e.unlock()},destroy:function(){var e=this,t=e.eventNS,n=e.revertSettings;e.trigger("destroy"),e.off(),e.$wrapper.remove(),e.$dropdown.remove(),e.$input.html("").append(n.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:n.tabindex}).show(),e.$control_input.removeData("grow"),e.$input.removeData("selectize"),0==--m.count&&m.$testInput&&(m.$testInput.remove(),m.$testInput=void 0),$(window).off(t),$(document).off(t),$(document.body).off(t),delete e.$input[0].selectize},render:function(e,t){var n,i,o="",r=!1,s=this;return"option"!==e&&"item"!==e||(r=!!(n=c(t[s.settings.valueField]))),r&&(u(s.renderCache[e])||(s.renderCache[e]={}),s.renderCache[e].hasOwnProperty(n))?s.renderCache[e][n]:(o=$(s.settings.render[e].apply(this,[t,d])),"option"===e||"option_create"===e?t[s.settings.disabledField]||o.attr("data-selectable",""):"optgroup"===e&&(i=t[s.settings.optgroupValueField]||"",o.attr("data-group",i),t[s.settings.disabledField]&&o.attr("data-disabled","")),"option"!==e&&"item"!==e||o.attr("data-value",n||""),r&&(s.renderCache[e][n]=o[0]),o[0])},clearCache:function(e){void 0===e?this.renderCache={}:delete this.renderCache[e]},canCreate:function(e){var t=this;if(!t.settings.create)return!1;var n=t.settings.createFilter;return e.length&&("function"!=typeof n||n.apply(t,[e]))&&("string"!=typeof n||new RegExp(n).test(e))&&(!(n instanceof RegExp)||n.test(e))}}),m.count=0,m.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},$.fn.selectize=function(e){var t=$.fn.selectize.defaults,n=$.extend({},t,e),i=n.dataAttr,o=n.labelField,r=n.valueField,s=n.disabledField,a=n.optgroupField,l=n.optgroupLabelField,p=n.optgroupValueField;return this.each((function(){if(!this.selectize){var u=$(this),d=this.tagName.toLowerCase(),h=u.attr("placeholder")||u.attr("data-placeholder");h||n.allowEmptyOption||(h=u.children('option[value=""]').text());var g={placeholder:h,options:[],optgroups:[],items:[]};"select"===d?function(e,t){var u,d,h,g,f=t.options,v={},m=function(e){var t=i&&e.attr(i);return"string"==typeof t&&t.length?JSON.parse(t):null},y=function(e,i){e=$(e);var l=c(e.val());if(l||n.allowEmptyOption)if(v.hasOwnProperty(l)){if(i){var p=v[l][a];p?$.isArray(p)?p.push(i):v[l][a]=[p,i]:v[l][a]=i}}else{var u=m(e)||{};u[o]=u[o]||e.text(),u[r]=u[r]||l,u[s]=u[s]||e.prop("disabled"),u[a]=u[a]||i,v[l]=u,f.push(u),e.is(":selected")&&t.items.push(l)}},w=function(e){var n,i,o,r,a;for((o=(e=$(e)).attr("label"))&&((r=m(e)||{})[l]=o,r[p]=o,r[s]=e.prop("disabled"),t.optgroups.push(r)),n=0,i=(a=$("option",e)).length;n<i;n++)y(a[n],o)};for(t.maxItems=e.attr("multiple")?null:1,u=0,d=(g=e.children()).length;u<d;u++)"optgroup"===(h=g[u].tagName.toLowerCase())?w(g[u]):"option"===h&&y(g[u])}(u,g):function(e,t){var s,a,l,p,u=e.attr(i);if(u)for(t.options=JSON.parse(u),s=0,a=t.options.length;s<a;s++)t.items.push(t.options[s][r]);else{var c=$.trim(e.val()||"");if(!n.allowEmptyOption&&!c.length)return;for(s=0,a=(l=c.split(n.delimiter)).length;s<a;s++)(p={})[o]=l[s],p[r]=l[s],t.options.push(p);t.items=l}}(u,g),new m(u,$.extend(!0,{},t,g,e))}}))},$.fn.selectize.defaults=m.defaults,$.fn.selectize.support={validity:p},m.define("drag_drop",(function(e){if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var t,n=this;n.lock=(t=n.lock,function(){var e=n.$control.data("sortable");return e&&e.disable(),t.apply(n,arguments)}),n.unlock=function(){var e=n.unlock;return function(){var t=n.$control.data("sortable");return t&&t.enable(),e.apply(n,arguments)}}(),n.setup=function(){var e=n.setup;return function(){e.apply(this,arguments);var t=n.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:n.isLocked,start:function(e,n){n.placeholder.css("width",n.helper.css("width")),t.css({overflow:"visible"})},stop:function(){t.css({overflow:"hidden"});var e=n.$activeItems?n.$activeItems.slice():null,i=[];t.children("[data-value]").each((function(){i.push($(this).attr("data-value"))})),n.setValue(i),n.setActiveItem(e)}})}}()}})),m.define("dropdown_header",(function(e){var t,n=this;e=$.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(e){return'<div class="'+e.headerClass+'"><div class="'+e.titleRowClass+'"><span class="'+e.labelClass+'">'+e.title+'</span><a href="javascript:void(0)" class="'+e.closeClass+'">×</a></div></div>'}},e),n.setup=(t=n.setup,function(){t.apply(n,arguments),n.$dropdown_header=$(e.html(e)),n.$dropdown.prepend(n.$dropdown_header)})})),m.define("optgroup_columns",(function(e){var t,n=this;e=$.extend({equalizeWidth:!0,equalizeHeight:!0},e),this.getAdjacentOption=function(e,t){var n=e.closest("[data-group]").find("[data-selectable]"),i=n.index(e)+t;return i>=0&&i<n.length?n.eq(i):$()},this.onKeyDown=(t=n.onKeyDown,function(e){var i,o,r,s;return!this.isOpen||37!==e.keyCode&&39!==e.keyCode?t.apply(this,arguments):(n.ignoreHover=!0,i=(s=this.$activeOption.closest("[data-group]")).find("[data-selectable]").index(this.$activeOption),void((o=(r=(s=37===e.keyCode?s.prev("[data-group]"):s.next("[data-group]")).find("[data-selectable]")).eq(Math.min(r.length-1,i))).length&&this.setActiveOption(o)))});var i=function(){var e,t=i.width,n=document;return void 0===t&&((e=n.createElement("div")).innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',e=e.firstChild,n.body.appendChild(e),t=i.width=e.offsetWidth-e.clientWidth,n.body.removeChild(e)),t},o=function(){var t,o,r,s,a,l,p;if((o=(p=$("[data-group]",n.$dropdown_content)).length)&&n.$dropdown_content.width()){if(e.equalizeHeight){for(r=0,t=0;t<o;t++)r=Math.max(r,p.eq(t).height());p.css({height:r})}e.equalizeWidth&&(l=n.$dropdown_content.innerWidth()-i(),s=Math.round(l/o),p.css({width:s}),o>1&&(a=l-s*(o-1),p.eq(o-1).css({width:a})))}};(e.equalizeHeight||e.equalizeWidth)&&(h.after(this,"positionDropdown",o),h.after(this,"refreshOptions",o))})),m.define("remove_button",(function(e){e=$.extend({label:"×",title:"Remove",className:"remove",append:!0},e);"single"!==this.settings.mode?function(e,t){var n,i=e,o='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+d(t.title)+'">'+t.label+"</a>";e.setup=(n=i.setup,function(){if(t.append){var r=i.settings.render.item;i.settings.render.item=function(t){return n=r.apply(e,arguments),i=o,s=n.search(/(<\/[^>]+>\s*)$/),n.substring(0,s)+i+n.substring(s);var n,i,s}}n.apply(e,arguments),e.$control.on("click","."+t.className,(function(e){if(e.preventDefault(),!i.isLocked){var t=$(e.currentTarget).parent();i.setActiveItem(t),i.deleteSelection()&&i.setCaret(i.items.length)}}))})}(this,e):function(e,t){t.className="remove-single";var n,i=e,o='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+d(t.title)+'">'+t.label+"</a>";e.setup=(n=i.setup,function(){if(t.append){var r=$(i.$input.context).attr("id"),s=($("#"+r),i.settings.render.item);i.settings.render.item=function(t){return n=s.apply(e,arguments),i=o,$("<span>").append(n).append(i);var n,i}}n.apply(e,arguments),e.$control.on("click","."+t.className,(function(e){e.preventDefault(),i.isLocked||i.clear()}))})}(this,e)})),m.define("restore_on_backspace",(function(e){var t,n=this;e.text=e.text||function(e){return e[this.settings.labelField]},this.onKeyDown=(t=n.onKeyDown,function(n){var i,o;return 8===n.keyCode&&""===this.$control_input.val()&&!this.$activeItems.length&&(i=this.caretPos-1)>=0&&i<this.items.length?(o=this.options[this.items[i]],this.deleteSelection(n)&&(this.setTextboxValue(e.text.apply(this,[o])),this.refreshOptions(!0)),void n.preventDefault()):t.apply(this,arguments)})})),m})); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/synchronous-ajax-min.js
r2964113 r3279779 1 !function($){function e(s,t,n,r,o){if(o?t++:t+=Number(s.index_increment),t>Number(s.offset)+Number(s.number_requests)-1)return s.onFinished(),!0;let i ,u={...{action:s.action,nonce:s.nonce,id:s.ids[t],current_index:t,index_increment:s.index_increment,number_requests:s.number_requests,offset:s.offset},...s.data};$.ajax({url:s.url,type:s.type,async:!0,cache:s.cache,dataType:s.dataType,data:u,success:function(o){let i=s.onRequestSuccess(o,t),u=t+Number(s.index_increment);if(u>s.number_requests&&(u=s.number_requests),o.success)n.progressbar("value",Number(u/s.number_requests*100)),$(r).text(u);else{if(1==s.stop_on_error)return void s.onFinished();-1==s.stop_on_error&&(n.progressbar("value",Number(u/s.number_requests*100)),$(r).text(u)),0==s.stop_on_error&&(t-=Number(s.index_increment))}i?o.success||-1===s.stop_on_error?e(s=s.updateSettings(s),t,n,r):setTimeout((function(){e(s,t,n,r)}),s.wait):s.onFinished()},error:function(o,i,u){let c=s.onRequestError(o,i,u,t);1!=s.stop_on_error?(0==s.stop_on_error&&t--,c?setTimeout((function(){e(s,t,n,r)}),s.wait):s.onFinished()):s.onFinished()}})}$.fn.synchronous_request=function(s){let t=$.extend({url:"",number_requests:0,offset:0,index_increment:1,action:"",nonce:"",ids:"",wait:5e3,stop_on_error:0,progress_count:"#progress-number",log:"#log",spinner:"#progress .spinner",cancel_button:".cancel",type:"post",cache:!1,dataType:"json",onRequestSuccess:function(e,s){if(this.maybeResetLog(),e.success)$("ul",$(this.log)).append('<li class="success">'+(s+1)+"/"+this.number_requests+": "+e.data+"</li>");else{let t=s+1+"/"+this.number_requests+": Response Error: "+e.data;switch(this.stop_on_error){case 1:break;case 0:t=t+". Waiting "+this.stop_on_error_pause/1e3+" seconds before reattempting this request.";break;case-1:t=t+". Waiting "+this.stop_on_error_pause/1e3+" seconds before attempting next request.";break}$("ul",$(this.log)).append('<li class="error">'+t+"</li>")}return 1!=this.cancelled},onRequestError:function(e,s,n,r){return this.maybeResetLog(),$("#log ul").append('<li class="error">'+(r+1)+"/"+t.number_requests+": Request Error: "+e.status+" "+e.statusText+"</li>"),1!=this.cancelled},updateSettings:function(e){return e},onFinished:function(){this.cancelled?$("ul",$(this.log)).append('<li class="success">Process cancelled by user.</li>'):($("ul",$(this.log)).append('<li class="success">Finished.</li>'),$(t.cancel_button).attr("disabled","disabled")),$(this.spinner).remove()},maybeResetLog:function(){$("li.spinner",$(this.log)).length>0&&$("li.spinner",$(this.log)).remove(),$("ul li",$(this.log)).length>=100&&$("ul",$(this.log)).html("")}},s);progressbar=$(this).progressbar({value:0}),t.cancel_button&&$(t.cancel_button).on("click",(function(e){e.preventDefault(),t.cancelled=!0,$(t.cancel_button).attr("disabled","disabled")})),e(t,-1+Number(t.offset),progressbar,t.progress_count,!0)}}(jQuery);1 !function($){function e(s,t,n,r,o){if(o?t++:t+=Number(s.index_increment),t>Number(s.offset)+Number(s.number_requests)-1)return s.onFinished(),!0;let i={...{action:s.action,nonce:s.nonce,id:s.ids[t],current_index:t,index_increment:s.index_increment,number_requests:s.number_requests,offset:s.offset},...s.data};$.ajax({url:s.url,type:s.type,async:!0,cache:s.cache,dataType:s.dataType,data:i,success:function(o){let i=s.onRequestSuccess(o,t),u=t+Number(s.index_increment);if(u>s.number_requests&&(u=s.number_requests),o.success)n.progressbar("value",Number(u/s.number_requests*100)),$(r).text(u);else{if(1==s.stop_on_error)return void s.onFinished();-1==s.stop_on_error&&(n.progressbar("value",Number(u/s.number_requests*100)),$(r).text(u)),0==s.stop_on_error&&(t-=Number(s.index_increment))}i?o.success||-1===s.stop_on_error?e(s=s.updateSettings(s),t,n,r):setTimeout((function(){e(s,t,n,r)}),s.wait):s.onFinished()},error:function(o,i,u){let c=s.onRequestError(o,i,u,t);1!=s.stop_on_error?(0==s.stop_on_error&&t--,c?setTimeout((function(){e(s,t,n,r)}),s.wait):s.onFinished()):s.onFinished()}})}$.fn.synchronous_request=function(s){let t=$.extend({url:"",number_requests:0,offset:0,index_increment:1,action:"",nonce:"",ids:"",wait:5e3,stop_on_error:0,progress_count:"#progress-number",log:"#log",spinner:"#progress .spinner",cancel_button:".cancel",type:"post",cache:!1,dataType:"json",onRequestSuccess:function(e,s){if(this.maybeResetLog(),e.success)$("ul",$(this.log)).append('<li class="success">'+(s+1)+"/"+this.number_requests+": "+e.data+"</li>");else{let t=s+1+"/"+this.number_requests+": Response Error: "+e.data;switch(this.stop_on_error){case 1:break;case 0:t=t+". Waiting "+this.stop_on_error_pause/1e3+" seconds before reattempting this request.";break;case-1:t=t+". Waiting "+this.stop_on_error_pause/1e3+" seconds before attempting next request."}$("ul",$(this.log)).append('<li class="error">'+t+"</li>")}return 1!=this.cancelled},onRequestError:function(e,s,n,r){return this.maybeResetLog(),$("#log ul").append('<li class="error">'+(r+1)+"/"+t.number_requests+": Request Error: "+e.status+" "+e.statusText+"</li>"),1!=this.cancelled},updateSettings:function(e){return e},onFinished:function(){this.cancelled?$("ul",$(this.log)).append('<li class="success">Process cancelled by user.</li>'):($("ul",$(this.log)).append('<li class="success">Finished.</li>'),$(t.cancel_button).attr("disabled","disabled")),$(this.spinner).remove()},maybeResetLog:function(){$("li.spinner",$(this.log)).length>0&&$("li.spinner",$(this.log)).remove(),$("ul li",$(this.log)).length>=100&&$("ul",$(this.log)).html("")}},s);progressbar=$(this).progressbar({value:0}),t.cancel_button&&$(t.cancel_button).on("click",(function(e){e.preventDefault(),t.cancelled=!0,$(t.cancel_button).attr("disabled","disabled")})),e(t,-1+Number(t.offset),progressbar,t.progress_count,!0)}}(jQuery); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/tables-min.js
r2688344 r3279779 1 function wpzinc_table_row_add(t,e){var $, r;$=jQuery,r=$("tbody tr."+t,$(e)),$("tbody tr:last-child",$(e)).after('<tr class="'+t+'">'+$(r).html()+"</tr>")}function wpzinc_table_row_delete(t){var $;($=jQuery)(t).closest("tr").remove()}jQuery(document).ready((function($){$("body").on("click",".wpzinc-add-table-row",(function(t){t.preventDefault(),wpzinc_table_row_add($(this).attr("data-table-row-selector"),$(this).closest("table"))})),$("body").on("click",".wpzinc-delete-table-row",(function(t){t.preventDefault(),wpzinc_table_row_delete(this)}))}));1 function wpzinc_table_row_add(t,e){var $,o;$=jQuery,o=$("tbody tr."+t,$(e)),$("tbody tr:last-child",$(e)).after('<tr class="'+t+'">'+$(o).html()+"</tr>")}function wpzinc_table_row_delete(t){jQuery(t).closest("tr").remove()}jQuery(document).ready((function($){$("body").on("click",".wpzinc-add-table-row",(function(t){t.preventDefault(),wpzinc_table_row_add($(this).attr("data-table-row-selector"),$(this).closest("table"))})),$("body").on("click",".wpzinc-delete-table-row",(function(t){t.preventDefault(),wpzinc_table_row_delete(this)}))})); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/tabs-min.js
r2688344 r3279779 1 function wp_zinc_tabs_init(){var $;$=jQuery,wp_zinc_tabs_destroy(),$(".wpzinc-js-tabs").each((function(){var t=$(this),a=$(t).data("panels-container"), i=$(t).data("panel"),n=$(t).data("active"),e=$(t).data("match-height");wp_zinc_tabs_update(t,a,i,n,$("a."+n,$(t)).attr("href")),void 0!==e&&$(a).height($(e).innerHeight()),$(t).on("click.wpzinc_tabs","a",(function(e){if(location.hostname!==this.hostname&&this.hostname.length)return!0;e.preventDefault(),wp_zinc_tabs_update(t,a,i,n,$(this).attr("href"))}))})),$(".wpzinc-tab-indicator").on("change.wpzinc_tab_indicator",(function(t){var a=$(this).data("tab");if($(this).is("input"))var i=$(this).prop("checked");else if($(this).is("select"))var i=$(this).val();1==i?$("a[href=#"+a+"]").addClass("enabled"):$("a[href=#"+a+"]").removeClass("enabled")}))}function wp_zinc_tabs_update(t,a,i,n,e){!function($){if(void 0!==e&&0!=e.length){var c=$('a[href="'+e+'"]',$(t));$("a",$(t)).removeClass(n),$(i,$(a)).hide(),$('a[href="'+e+'"]',$(t)).addClass(n),$(e).show(),void 0!==$(c).data("documentation")&&$("a.nav-tab.documentation").attr("href",$(c).data("documentation")),setTimeout((function(){$(t).trigger("change",c)}),500)}}(jQuery)}function wp_zinc_tabs_destroy(){var $;($=jQuery)(".wpzinc-js-tabs").each((function(){$(this).off("click.wpzinc_tabs","a"),$(this).off("change.wpzinc_tab_indicator")}))}jQuery(document).ready((function($){$(".wpzinc-js-tabs").length>0&&wp_zinc_tabs_init()}));1 function wp_zinc_tabs_init(){var $;$=jQuery,wp_zinc_tabs_destroy(),$(".wpzinc-js-tabs").each((function(){var t=$(this),a=$(t).data("panels-container"),n=$(t).data("panel"),i=$(t).data("active"),e=$(t).data("match-height");wp_zinc_tabs_update(t,a,n,i,$("a."+i,$(t)).attr("href")),void 0!==e&&$(a).height($(e).innerHeight()),$(t).on("click.wpzinc_tabs","a",(function(e){if(location.hostname!==this.hostname&&this.hostname.length)return!0;e.preventDefault(),wp_zinc_tabs_update(t,a,n,i,$(this).attr("href"))}))})),$(".wpzinc-tab-indicator").on("change.wpzinc_tab_indicator",(function(t){var a=$(this).data("tab");if($(this).is("input"))var n=$(this).prop("checked");else $(this).is("select")&&(n=$(this).val());1==n?$("a[href=#"+a+"]").addClass("enabled"):$("a[href=#"+a+"]").removeClass("enabled")}))}function wp_zinc_tabs_update(t,a,n,i,e){!function($){if(void 0!==e&&0!=e.length){var c=$('a[href="'+e+'"]',$(t));$("a",$(t)).removeClass(i),$(n,$(a)).hide(),$('a[href="'+e+'"]',$(t)).addClass(i),$(e).show(),void 0!==$(c).data("documentation")&&$("a.nav-tab.documentation").attr("href",$(c).data("documentation")),setTimeout((function(){$(t).trigger("change",c)}),500)}}(jQuery)}function wp_zinc_tabs_destroy(){var $;($=jQuery)(".wpzinc-js-tabs").each((function(){$(this).off("click.wpzinc_tabs","a"),$(this).off("change.wpzinc_tab_indicator")}))}jQuery(document).ready((function($){$(".wpzinc-js-tabs").length>0&&wp_zinc_tabs_init()})); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/tags-min.js
r2688344 r3279779 1 jQuery(document).ready((function($){ var t;(function(){$("body").unbind("change.wpzinc-tags").on("change.wpzinc-tags","select.wpzinc-tags",(function(t){var n=$(this).val(),a=$(this).data("element"),e=$(a);e.length>1&&(e=$(a,$(this).parent().parent()));var s=$(e).val();if($(e).hasClass("tmce-active"));else{var i=$(e)[0].selectionStart;i>0&&(n=" "+n),$(e).val(s.substring(0,i)+n+s.substring(i))}}))})()}));1 jQuery(document).ready((function($){$("body").unbind("change.wpzinc-tags").on("change.wpzinc-tags","select.wpzinc-tags",(function(t){var a=$(this).val(),n=$(this).data("element"),e=$(n);e.length>1&&(e=$(n,$(this).parent().parent()));var s=$(e).val();if($(e).hasClass("tmce-active"));else{var i=$(e)[0].selectionStart;i>0&&(a=" "+a),$(e).val(s.substring(0,i)+a+s.substring(i))}}))})); -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/tinymce-modal-min.js
r3123476 r3279779 1 if(jQuery(document).ready((function($){$("body").on("click","#wpzinc-tinymce-modal div.mce-cancel button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.cancel",(function( e){"undefined"==typeof tinyMCE||!tinyMCE.activeEditor||tinyMCE.activeEditor.isHidden()?(wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent)):tinymce.activeEditor.windowManager.close()})),$("body").on("click","#wpzinc-tinymce-modal div.mce-insert button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.insert",(function(e){e.preventDefault();var t=$("form.wpzinc-tinymce-popup"),n="["+$('input[name="shortcode"]',$(t)).val(),i="1"==$('input[name="close_shortcode"]',$(t)).val();$("input, select, textarea",$(t)).each((function(e){if(void 0===$(this).data("shortcode"))return!0;if(!$(this).val())return!0;if(0==$(this).val().length)return!0;var t=$(this).data("shortcode"),i="0"!=$(this).data("trim"),o=$(this).val();if(!t.length)return!0;t.search("}")>-1&&t.search("{")>-1&&(t=t.replace(/{|}/gi,(function(e){return""})),t=$(t,$(this).parent().parent()).val()),void 0!==$(this).data("shortcode-prepend")&&(t=$(this).data("shortcode-prepend")+t),Array.isArray(o)&&(o=o.join(",")),i&&(o=o.trim()),n+=" "+t.trim()+'="'+o+'"'})),n+="]",i&&(n+="[/"+$('input[name="shortcode"]',$(t)).val()+"]");let o=$('input[name="editor_type"]',$(t)).val();switch(o){case"tinymce":"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&(tinyMCE.activeEditor.execCommand("mceReplaceContent",!1,n),tinyMCE.activeEditor.windowManager.close());break;case"quicktags":QTags.insertContent(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent);break;default:$(o).val(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent);break}}))})),"undefined"!=typeof wp&&void 0!==wp.media){var wpZincModal=new wp.media.view.Modal({controller:{trigger:function(){}},className:"wpzinc-backbone-modal"}),wpZincModalContent=wp.Backbone.View.extend({template:wp.template("wpzinc-modal")});wpZincModal.content(new wpZincModalContent)}1 if(jQuery(document).ready((function($){$("body").on("click","#wpzinc-tinymce-modal div.mce-cancel button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.cancel",(function(t){"undefined"==typeof tinyMCE||!tinyMCE.activeEditor||tinyMCE.activeEditor.isHidden()?(wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent)):tinymce.activeEditor.windowManager.close()})),$("body").on("click","#wpzinc-tinymce-modal div.mce-insert button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.insert",(function(t){t.preventDefault();var e=$("form.wpzinc-tinymce-popup"),n="["+$('input[name="shortcode"]',$(e)).val(),i="1"==$('input[name="close_shortcode"]',$(e)).val();$("input, select, textarea",$(e)).each((function(t){if(void 0===$(this).data("shortcode"))return!0;if(!$(this).val())return!0;if(0==$(this).val().length)return!0;var e=$(this).data("shortcode"),i="0"!=$(this).data("trim"),o=$(this).val();if(!e.length)return!0;e.search("}")>-1&&e.search("{")>-1&&(e=e.replace(/{|}/gi,(function(t){return""})),e=$(e,$(this).parent().parent()).val()),void 0!==$(this).data("shortcode-prepend")&&(e=$(this).data("shortcode-prepend")+e),Array.isArray(o)&&(o=o.join(",")),i&&(o=o.trim()),n+=" "+e.trim()+'="'+o+'"'})),n+="]",i&&(n+="[/"+$('input[name="shortcode"]',$(e)).val()+"]");let o=$('input[name="editor_type"]',$(e)).val();switch(o){case"tinymce":"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&(tinyMCE.activeEditor.execCommand("mceReplaceContent",!1,n),tinyMCE.activeEditor.windowManager.close());break;case"quicktags":QTags.insertContent(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent);break;default:$(o).val(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent)}}))})),"undefined"!=typeof wp&&void 0!==wp.media){var wpZincModal=new wp.media.view.Modal({controller:{trigger:function(){}},className:"wpzinc-backbone-modal"}),wpZincModalContent=wp.Backbone.View.extend({template:wp.template("wpzinc-modal")});wpZincModal.content(new wpZincModalContent)} -
wp-to-hootsuite/tags/1.6.2/_modules/dashboard/js/min/tribute-min.js
r2739897 r3279779 1 !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Tribute=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function i(e,t){return r(e)||o(e,t)||u(e,t)||l()}function r(e){if(Array.isArray(e))return e}function o(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,r=!1,o=void 0;try{for(var u=e[Symbol.iterator](),a;!(i=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==u.return||u.return()}finally{if(r)throw o}}return n}}function u(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function l(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}if(Array.prototype.find||(Array.prototype.find=function(e,t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=Object(this),i=n.length>>>0,r=t,o,u=0;u<i;u++)if(o=n[u],e.call(r,o,u,n))return o}),window&&"function"!=typeof window.CustomEvent){var s=function e(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),i};void 0!==window.Event&&(s.prototype=window.Event.prototype),window.CustomEvent=s}var c=function(){function t(n){e(this,t),this.tribute=n,this.tribute.events=this}return n(t,[{key:"bind",value:function e(t){t.boundKeydown=this.keydown.bind(t,this),t.boundKeyup=this.keyup.bind(t,this),t.boundInput=this.input.bind(t,this),t.addEventListener("keydown",t.boundKeydown,!1),t.addEventListener("keyup",t.boundKeyup,!1),t.addEventListener("input",t.boundInput,!1)}},{key:"unbind",value:function e(t){t.removeEventListener("keydown",t.boundKeydown,!1),t.removeEventListener("keyup",t.boundKeyup,!1),t.removeEventListener("input",t.boundInput,!1),delete t.boundKeydown,delete t.boundKeyup,delete t.boundInput}},{key:"keydown",value:function e(n,i){n.shouldDeactivate(i)&&(n.tribute.isActive=!1,n.tribute.hideMenu());var r=this;n.commandEvent=!1,t.keys().forEach((function(e){e.key===i.keyCode&&(n.commandEvent=!0,n.callbacks()[e.value.toLowerCase()](i,r))}))}},{key:"input",value:function e(t,n){t.inputEvent=!0,t.keyup.call(this,t,n)}},{key:"click",value:function e(t,n){var i=t.tribute;if(i.menu&&i.menu.contains(n.target)){var r=n.target;for(n.preventDefault(),n.stopPropagation();"li"!==r.nodeName.toLowerCase();)if(!(r=r.parentNode)||r===i.menu)throw new Error("cannot find the <li> container for the click");i.selectItemAtIndex(r.getAttribute("data-index"),n),i.hideMenu()}else i.current.element&&!i.current.externalTrigger&&(i.current.externalTrigger=!1,setTimeout((function(){return i.hideMenu()})))}},{key:"keyup",value:function e(t,n){if(t.inputEvent&&(t.inputEvent=!1),t.updateSelection(this),27!==n.keyCode){if(!t.tribute.allowSpaces&&t.tribute.hasTrailingSpace)return t.tribute.hasTrailingSpace=!1,t.commandEvent=!0,void t.callbacks().space(n,this);if(!t.tribute.isActive)if(t.tribute.autocompleteMode)t.callbacks().triggerChar(n,this,"");else{var i=t.getKeyCode(t,this,n);if(isNaN(i)||!i)return;var r=t.tribute.triggers().find((function(e){return e.charCodeAt(0)===i}));void 0!==r&&t.callbacks().triggerChar(n,this,r)}t.tribute.current.mentionText.length<t.tribute.current.collection.menuShowMinLength||((t.tribute.current.trigger||t.tribute.autocompleteMode)&&!1===t.commandEvent||t.tribute.isActive&&8===n.keyCode)&&t.tribute.showMenuFor(this,!0)}}},{key:"shouldDeactivate",value:function e(n){if(!this.tribute.isActive)return!1;if(0===this.tribute.current.mentionText.length){var i=!1;return t.keys().forEach((function(e){n.keyCode===e.key&&(i=!0)})),!i}return!1}},{key:"getKeyCode",value:function e(t,n,i){var r=t.tribute,o=r.range.getTriggerInfo(!1,r.hasTrailingSpace,!0,r.allowSpaces,r.autocompleteMode);return!!o&&o.mentionTriggerChar.charCodeAt(0)}},{key:"updateSelection",value:function e(t){this.tribute.current.element=t;var n=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);n&&(this.tribute.current.selectedPath=n.mentionSelectedPath,this.tribute.current.mentionText=n.mentionText,this.tribute.current.selectedOffset=n.mentionSelectedOffset)}},{key:"callbacks",value:function e(){var t=this;return{triggerChar:function e(n,i,r){var o=t.tribute;o.current.trigger=r;var u=o.collection.find((function(e){return e.trigger===r}));o.current.collection=u,o.current.mentionText.length>=o.current.collection.menuShowMinLength&&o.inputEvent&&o.showMenuFor(i,!0)},enter:function e(n,i){t.tribute.isActive&&t.tribute.current.filteredItems&&(n.preventDefault(),n.stopPropagation(),setTimeout((function(){t.tribute.selectItemAtIndex(t.tribute.menuSelected,n),t.tribute.hideMenu()}),0))},escape:function e(n,i){t.tribute.isActive&&(n.preventDefault(),n.stopPropagation(),t.tribute.isActive=!1,t.tribute.hideMenu())},tab:function e(n,i){t.callbacks().enter(n,i)},space:function e(n,i){t.tribute.isActive&&(t.tribute.spaceSelectsMatch?t.callbacks().enter(n,i):t.tribute.allowSpaces||(n.stopPropagation(),setTimeout((function(){t.tribute.hideMenu(),t.tribute.isActive=!1}),0)))},up:function e(n,i){if(t.tribute.isActive&&t.tribute.current.filteredItems){n.preventDefault(),n.stopPropagation();var r=t.tribute.current.filteredItems.length,o=t.tribute.menuSelected;r>o&&o>0?(t.tribute.menuSelected--,t.setActiveLi()):0===o&&(t.tribute.menuSelected=r-1,t.setActiveLi(),t.tribute.menu.scrollTop=t.tribute.menu.scrollHeight)}},down:function e(n,i){if(t.tribute.isActive&&t.tribute.current.filteredItems){n.preventDefault(),n.stopPropagation();var r=t.tribute.current.filteredItems.length-1,o=t.tribute.menuSelected;r>o?(t.tribute.menuSelected++,t.setActiveLi()):r===o&&(t.tribute.menuSelected=0,t.setActiveLi(),t.tribute.menu.scrollTop=0)}},delete:function e(n,i){t.tribute.isActive&&t.tribute.current.mentionText.length<1?t.tribute.hideMenu():t.tribute.isActive&&t.tribute.showMenuFor(i)}}}},{key:"setActiveLi",value:function e(t){var n=this.tribute.menu.querySelectorAll("li"),i=n.length>>>0;t&&(this.tribute.menuSelected=parseInt(t));for(var r=0;r<i;r++){var o=n[r];if(r===this.tribute.menuSelected){o.classList.add(this.tribute.current.collection.selectClass);var u=o.getBoundingClientRect(),a=this.tribute.menu.getBoundingClientRect();if(u.bottom>a.bottom){var l=u.bottom-a.bottom;this.tribute.menu.scrollTop+=l}else if(u.top<a.top){var s=a.top-u.top;this.tribute.menu.scrollTop-=s}}else o.classList.remove(this.tribute.current.collection.selectClass)}}},{key:"getFullHeight",value:function e(t,n){var i=t.getBoundingClientRect().height;if(n){var r=t.currentStyle||window.getComputedStyle(t);return i+parseFloat(r.marginTop)+parseFloat(r.marginBottom)}return i}}],[{key:"keys",value:function e(){return[{key:9,value:"TAB"},{key:8,value:"DELETE"},{key:13,value:"ENTER"},{key:27,value:"ESCAPE"},{key:32,value:"SPACE"},{key:38,value:"UP"},{key:40,value:"DOWN"}]}}]),t}(),h=function(){function t(n){e(this,t),this.tribute=n,this.tribute.menuEvents=this,this.menu=this.tribute.menu}return n(t,[{key:"bind",value:function e(t){var n=this;this.menuClickEvent=this.tribute.events.click.bind(null,this),this.menuContainerScrollEvent=this.debounce((function(){n.tribute.isActive&&n.tribute.hideMenu()}),10,!1),this.windowResizeEvent=this.debounce((function(){n.tribute.isActive&&n.tribute.hideMenu()}),10,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}},{key:"unbind",value:function e(t){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}},{key:"debounce",value:function e(t,n,i){var r=arguments,o=this,u;return function(){var e=o,a=r,l=function n(){u=null,i||t.apply(e,a)},s=i&&!u;clearTimeout(u),u=setTimeout(l,n),s&&t.apply(e,a)}}}]),t}(),d=function(){function t(n){e(this,t),this.tribute=n,this.tribute.range=this}return n(t,[{key:"getDocument",value:function e(){var t;return this.tribute.current.collection&&(t=this.tribute.current.collection.iframe),t?t.contentWindow.document:document}},{key:"positionMenuAtCaret",value:function e(t){var n=this.tribute.current,i,r=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==r){if(!this.tribute.positionMenu)return void(this.tribute.menu.style.cssText="display: block;");i=this.isContentEditable(n.element)?this.getContentEditableCaretPosition(r.mentionPosition):this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,r.mentionPosition),this.tribute.menu.style.cssText="top: ".concat(i.top,"px;\n left: ").concat(i.left,"px;\n right: ").concat(i.right,"px;\n bottom: ").concat(i.bottom,"px;\n max-height: ").concat(i.maxHeight||500,"px;\n max-width: ").concat(i.maxWidth||300,"px;\n position: ").concat(i.position||"absolute",";\n display: block;"),"auto"===i.left&&(this.tribute.menu.style.left="auto"),"auto"===i.top&&(this.tribute.menu.style.top="auto"),t&&this.scrollIntoView()}else this.tribute.menu.style.cssText="display: none"}},{key:"selectElement",value:function e(t,n,i){var r,o=t;if(n)for(var u=0;u<n.length;u++){if(void 0===(o=o.childNodes[n[u]]))return;for(;o.length<i;)i-=o.length,o=o.nextSibling;0!==o.childNodes.length||o.length||(o=o.previousSibling)}var a=this.getWindowSelection();(r=this.getDocument().createRange()).setStart(o,i),r.setEnd(o,i),r.collapse(!0);try{a.removeAllRanges()}catch(e){}a.addRange(r),t.focus()}},{key:"replaceTriggerText",value:function e(t,n,i,r,o){var u=this.getTriggerInfo(!0,i,n,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==u){var a=this.tribute.current,l=new CustomEvent("tribute-replaced",{detail:{item:o,instance:a,context:u,event:r}});if(this.isContentEditable(a.element)){var s;t+="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";var c=u.mentionPosition+u.mentionText.length;this.tribute.autocompleteMode||(c+=u.mentionTriggerChar.length),this.pasteHtml(t,u.mentionPosition,c)}else{var h=this.tribute.current.element,d="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";t+=d;var f=u.mentionPosition,m=u.mentionPosition+u.mentionText.length+d.length;this.tribute.autocompleteMode||(m+=u.mentionTriggerChar.length-1),h.value=h.value.substring(0,f)+t+h.value.substring(m,h.value.length),h.selectionStart=f+t.length,h.selectionEnd=f+t.length}a.element.dispatchEvent(new CustomEvent("input",{bubbles:!0})),a.element.dispatchEvent(l)}}},{key:"pasteHtml",value:function e(t,n,i){var r,o;o=this.getWindowSelection(),(r=this.getDocument().createRange()).setStart(o.anchorNode,n),r.setEnd(o.anchorNode,i),r.deleteContents();var u=this.getDocument().createElement("div");u.innerHTML=t;for(var a=this.getDocument().createDocumentFragment(),l,s;l=u.firstChild;)s=a.appendChild(l);r.insertNode(a),s&&((r=r.cloneRange()).setStartAfter(s),r.collapse(!0),o.removeAllRanges(),o.addRange(r))}},{key:"getWindowSelection",value:function e(){return this.tribute.collection.iframe?this.tribute.collection.iframe.contentWindow.getSelection():window.getSelection()}},{key:"getNodePositionInParent",value:function e(t){if(null===t.parentNode)return 0;for(var n=0;n<t.parentNode.childNodes.length;n++){var i;if(t.parentNode.childNodes[n]===t)return n}}},{key:"getContentEditableSelectedPath",value:function e(t){var n=this.getWindowSelection(),i=n.anchorNode,r=[],o;if(null!=i){for(var u,a=i.contentEditable;null!==i&&"true"!==a;)u=this.getNodePositionInParent(i),r.push(u),null!==(i=i.parentNode)&&(a=i.contentEditable);return r.reverse(),{selected:i,path:r,offset:o=n.getRangeAt(0).startOffset}}}},{key:"getTextPrecedingCurrentSelection",value:function e(){var t=this.tribute.current,n="";if(this.isContentEditable(t.element)){var i=this.getWindowSelection().anchorNode;if(null!=i){var r=i.textContent,o=this.getWindowSelection().getRangeAt(0).startOffset;r&&o>=0&&(n=r.substring(0,o))}}else{var u=this.tribute.current.element;if(u){var a=u.selectionStart;u.value&&a>=0&&(n=u.value.substring(0,a))}}return n}},{key:"getLastWordInText",value:function e(t){var n,i;return t=t.replace(/\u00A0/g," "),(n=this.tribute.autocompleteSeparator?t.split(this.tribute.autocompleteSeparator):t.split(/\s+/))[n.length-1].trim()}},{key:"getTriggerInfo",value:function e(t,n,i,r,o){var u=this,a=this.tribute.current,l,s,c;if(this.isContentEditable(a.element)){var h=this.getContentEditableSelectedPath(a);h&&(l=h.selected,s=h.path,c=h.offset)}else l=this.tribute.current.element;var d=this.getTextPrecedingCurrentSelection(),f=this.getLastWordInText(d);if(o)return{mentionPosition:d.length-f.length,mentionText:f,mentionSelectedElement:l,mentionSelectedPath:s,mentionSelectedOffset:c};if(null!=d){var m=-1,p;if(this.tribute.collection.forEach((function(e){var t=e.trigger,n=e.requireLeadingSpace?u.lastIndexWithLeadingSpace(d,t):d.lastIndexOf(t);n>m&&(m=n,p=t,i=e.requireLeadingSpace)})),m>=0&&(0===m||!i||/[\xA0\s]/g.test(d.substring(m-1,m)))){var v=d.substring(m+p.length,d.length);p=d.substring(m,m+p.length);var g=v.substring(0,1),b=v.length>0&&(" "===g||" "===g);n&&(v=v.trim());var y=r?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=y.test(v),!b&&(t||!y.test(v)))return{mentionPosition:m,mentionText:v,mentionSelectedElement:l,mentionSelectedPath:s,mentionSelectedOffset:c,mentionTriggerChar:p}}}}},{key:"lastIndexWithLeadingSpace",value:function e(t,n){for(var i=t.split("").reverse().join(""),r=-1,o=0,u=t.length;o<u;o++){for(var a=o===t.length-1,l=/\s/.test(i[o+1]),s=!0,c=n.length-1;c>=0;c--)if(n[c]!==i[o-c]){s=!1;break}if(s&&(a||l)){r=t.length-1-o;break}}return r}},{key:"isContentEditable",value:function e(t){return"INPUT"!==t.nodeName&&"TEXTAREA"!==t.nodeName}},{key:"isMenuOffScreen",value:function e(t,n){var i=window.innerWidth,r=window.innerHeight,o=document.documentElement,u=(window.pageXOffset||o.scrollLeft)-(o.clientLeft||0),a=(window.pageYOffset||o.scrollTop)-(o.clientTop||0),l="number"==typeof t.top?t.top:a+r-t.bottom-n.height,s="number"==typeof t.right?t.right:t.left+n.width,c="number"==typeof t.bottom?t.bottom:t.top+n.height,h="number"==typeof t.left?t.left:u+i-t.right-n.width;return{top:l<Math.floor(a),right:s>Math.ceil(u+i),bottom:c>Math.ceil(a+r),left:h<Math.floor(u)}}},{key:"getMenuDimensions",value:function e(){var t={width:null,height:null};return this.tribute.menu.style.cssText="top: 0px;\n left: 0px;\n position: fixed;\n display: block;\n visibility; hidden;\n max-height:500px;",t.width=this.tribute.menu.offsetWidth,t.height=this.tribute.menu.offsetHeight,this.tribute.menu.style.cssText="display: none;",t}},{key:"getTextAreaOrInputUnderlinePosition",value:function e(t,n,i){var r=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"],o=this.getDocument().createElement("div");o.id="input-textarea-caret-position-mirror-div",this.getDocument().body.appendChild(o);var u=o.style,a=window.getComputedStyle?getComputedStyle(t):t.currentStyle;u.whiteSpace="pre-wrap","INPUT"!==t.nodeName&&(u.wordWrap="break-word"),u.position="absolute",u.visibility="hidden",r.forEach((function(e){u[e]=a[e]}));var l=document.createElement("span");l.textContent=t.value.substring(0,n),o.appendChild(l),"INPUT"===t.nodeName&&(o.textContent=o.textContent.replace(/\s/g," "));var s=this.getDocument().createElement("span");s.textContent="​",o.appendChild(s);var c=this.getDocument().createElement("span");c.textContent=t.value.substring(n),o.appendChild(c);var h=t.getBoundingClientRect();o.style.position="fixed",o.style.left=h.left+"px",o.style.top=h.top+"px",o.style.width=h.width+"px",o.style.height=h.height+"px",o.scrollTop=t.scrollTop;var d=s.getBoundingClientRect();return this.getDocument().body.removeChild(o),this.getFixedCoordinatesRelativeToRect(d)}},{key:"getContentEditableCaretPosition",value:function e(t){var n,i=this.getWindowSelection();(n=this.getDocument().createRange()).setStart(i.anchorNode,t),n.setEnd(i.anchorNode,t),n.collapse(!1);var r=n.getBoundingClientRect();return this.getFixedCoordinatesRelativeToRect(r)}},{key:"getFixedCoordinatesRelativeToRect",value:function e(t){var n={position:"fixed",left:t.left,top:t.top+t.height},i=this.getMenuDimensions(),r=t.top,o=window.innerHeight-(t.top+t.height);o<i.height&&(r>=i.height||r>o?(n.top="auto",n.bottom=window.innerHeight-t.top,o<i.height&&(n.maxHeight=r)):r<i.height&&(n.maxHeight=o));var u=t.left,a=window.innerWidth-t.left;return a<i.width&&(u>=i.width||u>a?(n.left="auto",n.right=window.innerWidth-t.left,a<i.width&&(n.maxWidth=u)):u<i.width&&(n.maxWidth=a)),n}},{key:"scrollIntoView",value:function e(t){var n=20,i,r=100,o=this.menu;if(void 0!==o){for(;void 0===i||0===i.height;)if(0===(i=o.getBoundingClientRect()).height&&(void 0===(o=o.childNodes[0])||!o.getBoundingClientRect))return;var u=i.top,a=u+i.height;if(u<0)window.scrollTo(0,window.pageYOffset+i.top-n);else if(a>window.innerHeight){var l=window.pageYOffset+i.top-n;l-window.pageYOffset>r&&(l=window.pageYOffset+r);var s=window.pageYOffset-(window.innerHeight-a);s>l&&(s=l),window.scrollTo(0,s)}}}},{key:"menuContainerIsBody",get:function e(){return this.tribute.menuContainer===document.body||!this.tribute.menuContainer}}]),t}(),f=function(){function t(n){e(this,t),this.tribute=n,this.tribute.search=this}return n(t,[{key:"simpleFilter",value:function e(t,n){var i=this;return n.filter((function(e){return i.test(t,e)}))}},{key:"test",value:function e(t,n){return null!==this.match(t,n)}},{key:"match",value:function e(t,n,i){i=i||{};var r=n.length,o=i.pre||"",u=i.post||"",a=i.caseSensitive&&n||n.toLowerCase();if(i.skip)return{rendered:n,score:0};t=i.caseSensitive&&t||t.toLowerCase();var l=this.traverse(a,t,0,0,[]);return l?{rendered:this.render(n,l.cache,o,u),score:l.score}:null}},{key:"traverse",value:function e(t,n,i,r,o){if(this.tribute.autocompleteSeparator&&(n=n.split(this.tribute.autocompleteSeparator).splice(-1)[0]),n.length===r)return{score:this.calculateScore(o),cache:o.slice()};if(!(t.length===i||n.length-r>t.length-i)){for(var u=n[r],a=t.indexOf(u,i),l,s;a>-1;){if(o.push(a),s=this.traverse(t,n,a+1,r+1,o),o.pop(),!s)return l;(!l||l.score<s.score)&&(l=s),a=t.indexOf(u,a+1)}return l}}},{key:"calculateScore",value:function e(t){var n=0,i=1;return t.forEach((function(e,r){r>0&&(t[r-1]+1===e?i+=i+1:i=1),n+=i})),n}},{key:"render",value:function e(t,n,i,r){var o=t.substring(0,n[0]);return n.forEach((function(e,u){o+=i+t[e]+r+t.substring(e+1,n[u+1]?n[u+1]:t.length)})),o}},{key:"filter",value:function e(t,n,i){var r=this;return i=i||{},n.reduce((function(e,n,o,u){var a=n;i.extract&&((a=i.extract(n))||(a=""));var l=r.match(t,a,i);return null!=l&&(e[e.length]={string:l.rendered,score:l.score,index:o,original:n}),e}),[]).sort((function(e,t){var n=t.score-e.score;return n||e.index-t.index}))}}]),t}(),m;return function(){function t(n){var i=this,r=n.values,o=void 0===r?null:r,u=n.loadingItemTemplate,a=void 0===u?null:u,l=n.iframe,s=void 0===l?null:l,m=n.selectClass,p=void 0===m?"highlight":m,v=n.containerClass,g=void 0===v?"tribute-container":v,b=n.itemClass,y=void 0===b?"":b,w=n.trigger,T=void 0===w?"@":w,S=n.autocompleteMode,C=void 0!==S&&S,k=n.autocompleteSeparator,E=void 0===k?null:k,x=n.selectTemplate,A=void 0===x?null:x,M=n.menuItemTemplate,L=void 0===M?null:M,I=n.lookup,N=void 0===I?"key":I,P=n.fillAttr,R=void 0===P?"value":P,D=n.collection,O=void 0===D?null:D,W=n.menuContainer,H=void 0===W?null:W,F=n.noMatchTemplate,_=void 0===F?null:F,B=n.requireLeadingSpace,j=void 0===B||B,K=n.allowSpaces,q=void 0!==K&&K,U=n.replaceTextSuffix,z=void 0===U?null:U,Y=n.positionMenu,Q=void 0===Y||Y,X=n.spaceSelectsMatch,V=void 0!==X&&X,G=n.searchOpts,J=void 0===G?{}:G,Z=n.menuItemLimit,ee=void 0===Z?null:Z,te=n.menuShowMinLength,ne=void 0===te?0:te,ie;if(e(this,t),this.autocompleteMode=C,this.autocompleteSeparator=E,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=H,this.allowSpaces=q,this.replaceTextSuffix=z,this.positionMenu=Q,this.hasTrailingSpace=!1,this.spaceSelectsMatch=V,this.autocompleteMode&&(T="",q=!1),o)this.collection=[{trigger:T,iframe:s,selectClass:p,containerClass:g,itemClass:y,selectTemplate:(A||t.defaultSelectTemplate).bind(this),menuItemTemplate:(L||t.defaultMenuItemTemplate).bind(this),noMatchTemplate:(ie=_,"string"==typeof ie?""===ie.trim()?null:ie:"function"==typeof ie?ie.bind(i):_||function(){return"<li>No Match Found!</li>"}.bind(i)),lookup:N,fillAttr:R,values:o,loadingItemTemplate:a,requireLeadingSpace:j,searchOpts:J,menuItemLimit:ee,menuShowMinLength:ne}];else{if(!O)throw new Error("[Tribute] No collection specified.");this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=O.map((function(e){return{trigger:e.trigger||T,iframe:e.iframe||s,selectClass:e.selectClass||p,containerClass:e.containerClass||g,itemClass:e.itemClass||y,selectTemplate:(e.selectTemplate||t.defaultSelectTemplate).bind(i),menuItemTemplate:(e.menuItemTemplate||t.defaultMenuItemTemplate).bind(i),noMatchTemplate:function(e){return"string"==typeof e?""===e.trim()?null:e:"function"==typeof e?e.bind(i):_||function(){return"<li>No Match Found!</li>"}.bind(i)}(_),lookup:e.lookup||N,fillAttr:e.fillAttr||R,values:e.values,loadingItemTemplate:e.loadingItemTemplate,requireLeadingSpace:e.requireLeadingSpace,searchOpts:e.searchOpts||J,menuItemLimit:e.menuItemLimit||ee,menuShowMinLength:e.menuShowMinLength||ne}}))}new d(this),new c(this),new h(this),new f(this)}return n(t,[{key:"triggers",value:function e(){return this.collection.map((function(e){return e.trigger}))}},{key:"attach",value:function e(t){if(!t)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&t instanceof jQuery&&(t=t.get()),t.constructor===NodeList||t.constructor===HTMLCollection||t.constructor===Array)for(var n=t.length,i=0;i<n;++i)this._attach(t[i]);else this._attach(t)}},{key:"_attach",value:function e(t){t.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+t.nodeName),this.ensureEditable(t),this.events.bind(t),t.setAttribute("data-tribute",!0)}},{key:"ensureEditable",value:function e(n){if(-1===t.inputTypes().indexOf(n.nodeName)){if(!n.contentEditable)throw new Error("[Tribute] Cannot bind to "+n.nodeName);n.contentEditable=!0}}},{key:"createMenu",value:function e(t){var n=this.range.getDocument().createElement("div"),i=this.range.getDocument().createElement("ul");return n.className=t,n.appendChild(i),this.menuContainer?this.menuContainer.appendChild(n):this.range.getDocument().body.appendChild(n)}},{key:"showMenuFor",value:function e(t,n){var r=this;if(!this.isActive||this.current.element!==t||this.current.mentionText!==this.currentMentionTextSnapshot){this.currentMentionTextSnapshot=this.current.mentionText,this.menu||(this.menu=this.createMenu(this.current.collection.containerClass),t.tributeMenu=this.menu,this.menuEvents.bind(this.menu)),this.isActive=!0,this.menuSelected=0,this.current.mentionText||(this.current.mentionText="");var o=function e(t){if(r.isActive){var o=r.search.filter(r.current.mentionText,t,{pre:r.current.collection.searchOpts.pre||"<span>",post:r.current.collection.searchOpts.post||"</span>",skip:r.current.collection.searchOpts.skip,extract:function e(t){if("string"==typeof r.current.collection.lookup)return t[r.current.collection.lookup];if("function"==typeof r.current.collection.lookup)return r.current.collection.lookup(t,r.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});r.current.collection.menuItemLimit&&(o=o.slice(0,r.current.collection.menuItemLimit)),r.current.filteredItems=o;var u=r.menu.querySelector("ul");if(!o.length){var a=new CustomEvent("tribute-no-match",{detail:r.menu});return r.current.element.dispatchEvent(a),void("function"==typeof r.current.collection.noMatchTemplate&&!r.current.collection.noMatchTemplate()||!r.current.collection.noMatchTemplate?r.hideMenu():("function"==typeof r.current.collection.noMatchTemplate?u.innerHTML=r.current.collection.noMatchTemplate():u.innerHTML=r.current.collection.noMatchTemplate,r.range.positionMenuAtCaret(n)))}u.innerHTML="";var l=r.range.getDocument().createDocumentFragment();o.forEach((function(e,t){var n=r.range.getDocument().createElement("li");n.setAttribute("data-index",t),n.className=r.current.collection.itemClass,n.addEventListener("mousemove",(function(e){var t,n=i(r._findLiTarget(e.target),2),o=n[0],u=n[1];0!==e.movementY&&r.events.setActiveLi(u)})),r.menuSelected===t&&n.classList.add(r.current.collection.selectClass),n.innerHTML=r.current.collection.menuItemTemplate(e),l.appendChild(n)})),u.appendChild(l),r.range.positionMenuAtCaret(n)}};"function"==typeof this.current.collection.values?(this.current.collection.loadingItemTemplate&&(this.menu.querySelector("ul").innerHTML=this.current.collection.loadingItemTemplate,this.range.positionMenuAtCaret(n)),this.current.collection.values(this.current.mentionText,o)):o(this.current.collection.values)}}},{key:"_findLiTarget",value:function e(t){if(!t)return[];var n=t.getAttribute("data-index");return n?[t,n]:this._findLiTarget(t.parentNode)}},{key:"showMenuForCollection",value:function e(t,n){t!==document.activeElement&&this.placeCaretAtEnd(t),this.current.collection=this.collection[n||0],this.current.externalTrigger=!0,this.current.element=t,t.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(t,this.current.collection.trigger),this.showMenuFor(t)}},{key:"placeCaretAtEnd",value:function e(t){if(t.focus(),void 0!==window.getSelection&&void 0!==document.createRange){var n=document.createRange();n.selectNodeContents(t),n.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(n)}else if(void 0!==document.body.createTextRange){var r=document.body.createTextRange();r.moveToElementText(t),r.collapse(!1),r.select()}}},{key:"insertTextAtCursor",value:function e(t){var n,i;(i=(n=window.getSelection()).getRangeAt(0)).deleteContents();var r=document.createTextNode(t);i.insertNode(r),i.selectNodeContents(r),i.collapse(!1),n.removeAllRanges(),n.addRange(i)}},{key:"insertAtCaret",value:function e(t,n){var i=t.scrollTop,r=t.selectionStart,o=t.value.substring(0,r),u=t.value.substring(t.selectionEnd,t.value.length);t.value=o+n+u,r+=n.length,t.selectionStart=r,t.selectionEnd=r,t.focus(),t.scrollTop=i}},{key:"hideMenu",value:function e(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}},{key:"selectItemAtIndex",value:function e(t,n){if("number"==typeof(t=parseInt(t))&&!isNaN(t)){var i=this.current.filteredItems[t],r=this.current.collection.selectTemplate(i);null!==r&&this.replaceText(r,n,i)}}},{key:"replaceText",value:function e(t,n,i){this.range.replaceTriggerText(t,!0,!0,n,i)}},{key:"_append",value:function e(t,n,i){if("function"==typeof t.values)throw new Error("Unable to append to values, as it is a function.");t.values=i?n:t.values.concat(n)}},{key:"append",value:function e(t,n,i){var r=parseInt(t);if("number"!=typeof r)throw new Error("please provide an index for the collection to update.");var o=this.collection[r];this._append(o,n,i)}},{key:"appendCurrent",value:function e(t,n){if(!this.isActive)throw new Error("No active state. Please use append instead and pass an index.");this._append(this.current.collection,t,n)}},{key:"detach",value:function e(t){if(!t)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&t instanceof jQuery&&(t=t.get()),t.constructor===NodeList||t.constructor===HTMLCollection||t.constructor===Array)for(var n=t.length,i=0;i<n;++i)this._detach(t[i]);else this._detach(t)}},{key:"_detach",value:function e(t){var n=this;this.events.unbind(t),t.tributeMenu&&this.menuEvents.unbind(t.tributeMenu),setTimeout((function(){t.removeAttribute("data-tribute"),n.isActive=!1,t.tributeMenu&&t.tributeMenu.remove()}))}},{key:"isActive",get:function e(){return this._isActive},set:function e(t){if(this._isActive!=t&&(this._isActive=t,this.current.element)){var n=new CustomEvent("tribute-active-".concat(t));this.current.element.dispatchEvent(n)}}}],[{key:"defaultSelectTemplate",value:function e(t){return void 0===t?"".concat(this.current.collection.trigger).concat(this.current.mentionText):this.range.isContentEditable(this.current.element)?'<span class="tribute-mention">'+(this.current.collection.trigger+t.original[this.current.collection.fillAttr])+"</span>":this.current.collection.trigger+t.original[this.current.collection.fillAttr]}},{key:"defaultMenuItemTemplate",value:function e(t){return t.string}},{key:"inputTypes",value:function e(){return["TEXTAREA","INPUT"]}}]),t}()}));1 !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Tribute=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,r=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(i=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw o}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}if(Array.prototype.find||(Array.prototype.find=function(e){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,n=Object(this),i=n.length>>>0,r=arguments[1],o=0;o<i;o++)if(t=n[o],e.call(r,t,o,n))return t}),window&&"function"!=typeof window.CustomEvent){var o=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};void 0!==window.Event&&(o.prototype=window.Event.prototype),window.CustomEvent=o}var u=function(){function t(n){e(this,t),this.tribute=n,this.tribute.events=this}return n(t,[{key:"bind",value:function(e){e.boundKeydown=this.keydown.bind(e,this),e.boundKeyup=this.keyup.bind(e,this),e.boundInput=this.input.bind(e,this),e.addEventListener("keydown",e.boundKeydown,!1),e.addEventListener("keyup",e.boundKeyup,!1),e.addEventListener("input",e.boundInput,!1)}},{key:"unbind",value:function(e){e.removeEventListener("keydown",e.boundKeydown,!1),e.removeEventListener("keyup",e.boundKeyup,!1),e.removeEventListener("input",e.boundInput,!1),delete e.boundKeydown,delete e.boundKeyup,delete e.boundInput}},{key:"keydown",value:function(e,n){e.shouldDeactivate(n)&&(e.tribute.isActive=!1,e.tribute.hideMenu());var i=this;e.commandEvent=!1,t.keys().forEach((function(t){t.key===n.keyCode&&(e.commandEvent=!0,e.callbacks()[t.value.toLowerCase()](n,i))}))}},{key:"input",value:function(e,t){e.inputEvent=!0,e.keyup.call(this,e,t)}},{key:"click",value:function(e,t){var n=e.tribute;if(n.menu&&n.menu.contains(t.target)){var i=t.target;for(t.preventDefault(),t.stopPropagation();"li"!==i.nodeName.toLowerCase();)if(!(i=i.parentNode)||i===n.menu)throw new Error("cannot find the <li> container for the click");n.selectItemAtIndex(i.getAttribute("data-index"),t),n.hideMenu()}else n.current.element&&!n.current.externalTrigger&&(n.current.externalTrigger=!1,setTimeout((function(){return n.hideMenu()})))}},{key:"keyup",value:function(e,t){if(e.inputEvent&&(e.inputEvent=!1),e.updateSelection(this),27!==t.keyCode){if(!e.tribute.allowSpaces&&e.tribute.hasTrailingSpace)return e.tribute.hasTrailingSpace=!1,e.commandEvent=!0,void e.callbacks().space(t,this);if(!e.tribute.isActive)if(e.tribute.autocompleteMode)e.callbacks().triggerChar(t,this,"");else{var n=e.getKeyCode(e,this,t);if(isNaN(n)||!n)return;var i=e.tribute.triggers().find((function(e){return e.charCodeAt(0)===n}));void 0!==i&&e.callbacks().triggerChar(t,this,i)}e.tribute.current.mentionText.length<e.tribute.current.collection.menuShowMinLength||((e.tribute.current.trigger||e.tribute.autocompleteMode)&&!1===e.commandEvent||e.tribute.isActive&&8===t.keyCode)&&e.tribute.showMenuFor(this,!0)}}},{key:"shouldDeactivate",value:function(e){if(!this.tribute.isActive)return!1;if(0===this.tribute.current.mentionText.length){var n=!1;return t.keys().forEach((function(t){e.keyCode===t.key&&(n=!0)})),!n}return!1}},{key:"getKeyCode",value:function(e,t,n){var i=e.tribute,r=i.range.getTriggerInfo(!1,i.hasTrailingSpace,!0,i.allowSpaces,i.autocompleteMode);return!!r&&r.mentionTriggerChar.charCodeAt(0)}},{key:"updateSelection",value:function(e){this.tribute.current.element=e;var t=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);t&&(this.tribute.current.selectedPath=t.mentionSelectedPath,this.tribute.current.mentionText=t.mentionText,this.tribute.current.selectedOffset=t.mentionSelectedOffset)}},{key:"callbacks",value:function(){var e=this;return{triggerChar:function(t,n,i){var r=e.tribute;r.current.trigger=i;var o=r.collection.find((function(e){return e.trigger===i}));r.current.collection=o,r.current.mentionText.length>=r.current.collection.menuShowMinLength&&r.inputEvent&&r.showMenuFor(n,!0)},enter:function(t,n){e.tribute.isActive&&e.tribute.current.filteredItems&&(t.preventDefault(),t.stopPropagation(),setTimeout((function(){e.tribute.selectItemAtIndex(e.tribute.menuSelected,t),e.tribute.hideMenu()}),0))},escape:function(t,n){e.tribute.isActive&&(t.preventDefault(),t.stopPropagation(),e.tribute.isActive=!1,e.tribute.hideMenu())},tab:function(t,n){e.callbacks().enter(t,n)},space:function(t,n){e.tribute.isActive&&(e.tribute.spaceSelectsMatch?e.callbacks().enter(t,n):e.tribute.allowSpaces||(t.stopPropagation(),setTimeout((function(){e.tribute.hideMenu(),e.tribute.isActive=!1}),0)))},up:function(t,n){if(e.tribute.isActive&&e.tribute.current.filteredItems){t.preventDefault(),t.stopPropagation();var i=e.tribute.current.filteredItems.length,r=e.tribute.menuSelected;i>r&&r>0?(e.tribute.menuSelected--,e.setActiveLi()):0===r&&(e.tribute.menuSelected=i-1,e.setActiveLi(),e.tribute.menu.scrollTop=e.tribute.menu.scrollHeight)}},down:function(t,n){if(e.tribute.isActive&&e.tribute.current.filteredItems){t.preventDefault(),t.stopPropagation();var i=e.tribute.current.filteredItems.length-1,r=e.tribute.menuSelected;i>r?(e.tribute.menuSelected++,e.setActiveLi()):i===r&&(e.tribute.menuSelected=0,e.setActiveLi(),e.tribute.menu.scrollTop=0)}},delete:function(t,n){e.tribute.isActive&&e.tribute.current.mentionText.length<1?e.tribute.hideMenu():e.tribute.isActive&&e.tribute.showMenuFor(n)}}}},{key:"setActiveLi",value:function(e){var t=this.tribute.menu.querySelectorAll("li"),n=t.length>>>0;e&&(this.tribute.menuSelected=parseInt(e));for(var i=0;i<n;i++){var r=t[i];if(i===this.tribute.menuSelected){r.classList.add(this.tribute.current.collection.selectClass);var o=r.getBoundingClientRect(),u=this.tribute.menu.getBoundingClientRect();if(o.bottom>u.bottom){var a=o.bottom-u.bottom;this.tribute.menu.scrollTop+=a}else if(o.top<u.top){var l=u.top-o.top;this.tribute.menu.scrollTop-=l}}else r.classList.remove(this.tribute.current.collection.selectClass)}}},{key:"getFullHeight",value:function(e,t){var n=e.getBoundingClientRect().height;if(t){var i=e.currentStyle||window.getComputedStyle(e);return n+parseFloat(i.marginTop)+parseFloat(i.marginBottom)}return n}}],[{key:"keys",value:function(){return[{key:9,value:"TAB"},{key:8,value:"DELETE"},{key:13,value:"ENTER"},{key:27,value:"ESCAPE"},{key:32,value:"SPACE"},{key:38,value:"UP"},{key:40,value:"DOWN"}]}}]),t}(),a=function(){function t(n){e(this,t),this.tribute=n,this.tribute.menuEvents=this,this.menu=this.tribute.menu}return n(t,[{key:"bind",value:function(e){var t=this;this.menuClickEvent=this.tribute.events.click.bind(null,this),this.menuContainerScrollEvent=this.debounce((function(){t.tribute.isActive&&t.tribute.hideMenu()}),10,!1),this.windowResizeEvent=this.debounce((function(){t.tribute.isActive&&t.tribute.hideMenu()}),10,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}},{key:"unbind",value:function(e){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}},{key:"debounce",value:function(e,t,n){var i,r=arguments,o=this;return function(){var u=o,a=r,l=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||e.apply(u,a)}),t),l&&e.apply(u,a)}}}]),t}(),l=function(){function t(n){e(this,t),this.tribute=n,this.tribute.range=this}return n(t,[{key:"getDocument",value:function(){var e;return this.tribute.current.collection&&(e=this.tribute.current.collection.iframe),e?e.contentWindow.document:document}},{key:"positionMenuAtCaret",value:function(e){var t,n=this.tribute.current,i=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==i){if(!this.tribute.positionMenu)return void(this.tribute.menu.style.cssText="display: block;");t=this.isContentEditable(n.element)?this.getContentEditableCaretPosition(i.mentionPosition):this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,i.mentionPosition),this.tribute.menu.style.cssText="top: ".concat(t.top,"px;\n left: ").concat(t.left,"px;\n right: ").concat(t.right,"px;\n bottom: ").concat(t.bottom,"px;\n max-height: ").concat(t.maxHeight||500,"px;\n max-width: ").concat(t.maxWidth||300,"px;\n position: ").concat(t.position||"absolute",";\n display: block;"),"auto"===t.left&&(this.tribute.menu.style.left="auto"),"auto"===t.top&&(this.tribute.menu.style.top="auto"),e&&this.scrollIntoView()}else this.tribute.menu.style.cssText="display: none"}},{key:"selectElement",value:function(e,t,n){var i,r=e;if(t)for(var o=0;o<t.length;o++){if(void 0===(r=r.childNodes[t[o]]))return;for(;r.length<n;)n-=r.length,r=r.nextSibling;0!==r.childNodes.length||r.length||(r=r.previousSibling)}var u=this.getWindowSelection();(i=this.getDocument().createRange()).setStart(r,n),i.setEnd(r,n),i.collapse(!0);try{u.removeAllRanges()}catch(e){}u.addRange(i),e.focus()}},{key:"replaceTriggerText",value:function(e,t,n,i,r){var o=this.getTriggerInfo(!0,n,t,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==o){var u=this.tribute.current,a=new CustomEvent("tribute-replaced",{detail:{item:r,instance:u,context:o,event:i}});if(this.isContentEditable(u.element)){e+="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";var l=o.mentionPosition+o.mentionText.length;this.tribute.autocompleteMode||(l+=o.mentionTriggerChar.length),this.pasteHtml(e,o.mentionPosition,l)}else{var s=this.tribute.current.element,c="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";e+=c;var h=o.mentionPosition,d=o.mentionPosition+o.mentionText.length+c.length;this.tribute.autocompleteMode||(d+=o.mentionTriggerChar.length-1),s.value=s.value.substring(0,h)+e+s.value.substring(d,s.value.length),s.selectionStart=h+e.length,s.selectionEnd=h+e.length}u.element.dispatchEvent(new CustomEvent("input",{bubbles:!0})),u.element.dispatchEvent(a)}}},{key:"pasteHtml",value:function(e,t,n){var i,r;r=this.getWindowSelection(),(i=this.getDocument().createRange()).setStart(r.anchorNode,t),i.setEnd(r.anchorNode,n),i.deleteContents();var o=this.getDocument().createElement("div");o.innerHTML=e;for(var u,a,l=this.getDocument().createDocumentFragment();u=o.firstChild;)a=l.appendChild(u);i.insertNode(l),a&&((i=i.cloneRange()).setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i))}},{key:"getWindowSelection",value:function(){return this.tribute.collection.iframe?this.tribute.collection.iframe.contentWindow.getSelection():window.getSelection()}},{key:"getNodePositionInParent",value:function(e){if(null===e.parentNode)return 0;for(var t=0;t<e.parentNode.childNodes.length;t++){if(e.parentNode.childNodes[t]===e)return t}}},{key:"getContentEditableSelectedPath",value:function(e){var t=this.getWindowSelection(),n=t.anchorNode,i=[];if(null!=n){for(var r,o=n.contentEditable;null!==n&&"true"!==o;)r=this.getNodePositionInParent(n),i.push(r),null!==(n=n.parentNode)&&(o=n.contentEditable);return i.reverse(),{selected:n,path:i,offset:t.getRangeAt(0).startOffset}}}},{key:"getTextPrecedingCurrentSelection",value:function(){var e=this.tribute.current,t="";if(this.isContentEditable(e.element)){var n=this.getWindowSelection().anchorNode;if(null!=n){var i=n.textContent,r=this.getWindowSelection().getRangeAt(0).startOffset;i&&r>=0&&(t=i.substring(0,r))}}else{var o=this.tribute.current.element;if(o){var u=o.selectionStart;o.value&&u>=0&&(t=o.value.substring(0,u))}}return t}},{key:"getLastWordInText",value:function(e){var t;return e=e.replace(/\u00A0/g," "),(t=this.tribute.autocompleteSeparator?e.split(this.tribute.autocompleteSeparator):e.split(/\s+/))[t.length-1].trim()}},{key:"getTriggerInfo",value:function(e,t,n,i,r){var o,u,a,l=this,s=this.tribute.current;if(this.isContentEditable(s.element)){var c=this.getContentEditableSelectedPath(s);c&&(o=c.selected,u=c.path,a=c.offset)}else o=this.tribute.current.element;var h=this.getTextPrecedingCurrentSelection(),d=this.getLastWordInText(h);if(r)return{mentionPosition:h.length-d.length,mentionText:d,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:a};if(null!=h){var f,m=-1;if(this.tribute.collection.forEach((function(e){var t=e.trigger,i=e.requireLeadingSpace?l.lastIndexWithLeadingSpace(h,t):h.lastIndexOf(t);i>m&&(m=i,f=t,n=e.requireLeadingSpace)})),m>=0&&(0===m||!n||/[\xA0\s]/g.test(h.substring(m-1,m)))){var p=h.substring(m+f.length,h.length);f=h.substring(m,m+f.length);var v=p.substring(0,1),g=p.length>0&&(" "===v||" "===v);t&&(p=p.trim());var b=i?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=b.test(p),!g&&(e||!b.test(p)))return{mentionPosition:m,mentionText:p,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:a,mentionTriggerChar:f}}}}},{key:"lastIndexWithLeadingSpace",value:function(e,t){for(var n=e.split("").reverse().join(""),i=-1,r=0,o=e.length;r<o;r++){for(var u=r===e.length-1,a=/\s/.test(n[r+1]),l=!0,s=t.length-1;s>=0;s--)if(t[s]!==n[r-s]){l=!1;break}if(l&&(u||a)){i=e.length-1-r;break}}return i}},{key:"isContentEditable",value:function(e){return"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName}},{key:"isMenuOffScreen",value:function(e,t){var n=window.innerWidth,i=window.innerHeight,r=document.documentElement,o=(window.pageXOffset||r.scrollLeft)-(r.clientLeft||0),u=(window.pageYOffset||r.scrollTop)-(r.clientTop||0),a="number"==typeof e.top?e.top:u+i-e.bottom-t.height,l="number"==typeof e.right?e.right:e.left+t.width,s="number"==typeof e.bottom?e.bottom:e.top+t.height,c="number"==typeof e.left?e.left:o+n-e.right-t.width;return{top:a<Math.floor(u),right:l>Math.ceil(o+n),bottom:s>Math.ceil(u+i),left:c<Math.floor(o)}}},{key:"getMenuDimensions",value:function(){var e={width:null,height:null};return this.tribute.menu.style.cssText="top: 0px;\n left: 0px;\n position: fixed;\n display: block;\n visibility; hidden;\n max-height:500px;",e.width=this.tribute.menu.offsetWidth,e.height=this.tribute.menu.offsetHeight,this.tribute.menu.style.cssText="display: none;",e}},{key:"getTextAreaOrInputUnderlinePosition",value:function(e,t,n){var i=this.getDocument().createElement("div");i.id="input-textarea-caret-position-mirror-div",this.getDocument().body.appendChild(i);var r=i.style,o=window.getComputedStyle?getComputedStyle(e):e.currentStyle;r.whiteSpace="pre-wrap","INPUT"!==e.nodeName&&(r.wordWrap="break-word"),r.position="absolute",r.visibility="hidden",["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"].forEach((function(e){r[e]=o[e]}));var u=document.createElement("span");u.textContent=e.value.substring(0,t),i.appendChild(u),"INPUT"===e.nodeName&&(i.textContent=i.textContent.replace(/\s/g," "));var a=this.getDocument().createElement("span");a.textContent="​",i.appendChild(a);var l=this.getDocument().createElement("span");l.textContent=e.value.substring(t),i.appendChild(l);var s=e.getBoundingClientRect();i.style.position="fixed",i.style.left=s.left+"px",i.style.top=s.top+"px",i.style.width=s.width+"px",i.style.height=s.height+"px",i.scrollTop=e.scrollTop;var c=a.getBoundingClientRect();return this.getDocument().body.removeChild(i),this.getFixedCoordinatesRelativeToRect(c)}},{key:"getContentEditableCaretPosition",value:function(e){var t,n=this.getWindowSelection();(t=this.getDocument().createRange()).setStart(n.anchorNode,e),t.setEnd(n.anchorNode,e),t.collapse(!1);var i=t.getBoundingClientRect();return this.getFixedCoordinatesRelativeToRect(i)}},{key:"getFixedCoordinatesRelativeToRect",value:function(e){var t={position:"fixed",left:e.left,top:e.top+e.height},n=this.getMenuDimensions(),i=e.top,r=window.innerHeight-(e.top+e.height);r<n.height&&(i>=n.height||i>r?(t.top="auto",t.bottom=window.innerHeight-e.top,r<n.height&&(t.maxHeight=i)):i<n.height&&(t.maxHeight=r));var o=e.left,u=window.innerWidth-e.left;return u<n.width&&(o>=n.width||o>u?(t.left="auto",t.right=window.innerWidth-e.left,u<n.width&&(t.maxWidth=o)):o<n.width&&(t.maxWidth=u)),t}},{key:"scrollIntoView",value:function(e){var t,n=this.menu;if(void 0!==n){for(;void 0===t||0===t.height;)if(0===(t=n.getBoundingClientRect()).height&&(void 0===(n=n.childNodes[0])||!n.getBoundingClientRect))return;var i=t.top,r=i+t.height;if(i<0)window.scrollTo(0,window.pageYOffset+t.top-20);else if(r>window.innerHeight){var o=window.pageYOffset+t.top-20;o-window.pageYOffset>100&&(o=window.pageYOffset+100);var u=window.pageYOffset-(window.innerHeight-r);u>o&&(u=o),window.scrollTo(0,u)}}}},{key:"menuContainerIsBody",get:function(){return this.tribute.menuContainer===document.body||!this.tribute.menuContainer}}]),t}(),s=function(){function t(n){e(this,t),this.tribute=n,this.tribute.search=this}return n(t,[{key:"simpleFilter",value:function(e,t){var n=this;return t.filter((function(t){return n.test(e,t)}))}},{key:"test",value:function(e,t){return null!==this.match(e,t)}},{key:"match",value:function(e,t,n){n=n||{};t.length;var i=n.pre||"",r=n.post||"",o=n.caseSensitive&&t||t.toLowerCase();if(n.skip)return{rendered:t,score:0};e=n.caseSensitive&&e||e.toLowerCase();var u=this.traverse(o,e,0,0,[]);return u?{rendered:this.render(t,u.cache,i,r),score:u.score}:null}},{key:"traverse",value:function(e,t,n,i,r){if(this.tribute.autocompleteSeparator&&(t=t.split(this.tribute.autocompleteSeparator).splice(-1)[0]),t.length===i)return{score:this.calculateScore(r),cache:r.slice()};if(!(e.length===n||t.length-i>e.length-n)){for(var o,u,a=t[i],l=e.indexOf(a,n);l>-1;){if(r.push(l),u=this.traverse(e,t,l+1,i+1,r),r.pop(),!u)return o;(!o||o.score<u.score)&&(o=u),l=e.indexOf(a,l+1)}return o}}},{key:"calculateScore",value:function(e){var t=0,n=1;return e.forEach((function(i,r){r>0&&(e[r-1]+1===i?n+=n+1:n=1),t+=n})),t}},{key:"render",value:function(e,t,n,i){var r=e.substring(0,t[0]);return t.forEach((function(o,u){r+=n+e[o]+i+e.substring(o+1,t[u+1]?t[u+1]:e.length)})),r}},{key:"filter",value:function(e,t,n){var i=this;return n=n||{},t.reduce((function(t,r,o,u){var a=r;n.extract&&((a=n.extract(r))||(a=""));var l=i.match(e,a,n);return null!=l&&(t[t.length]={string:l.rendered,score:l.score,index:o,original:r}),t}),[]).sort((function(e,t){var n=t.score-e.score;return n||e.index-t.index}))}}]),t}();return function(){function t(n){var i,r=this,o=n.values,c=void 0===o?null:o,h=n.loadingItemTemplate,d=void 0===h?null:h,f=n.iframe,m=void 0===f?null:f,p=n.selectClass,v=void 0===p?"highlight":p,g=n.containerClass,b=void 0===g?"tribute-container":g,y=n.itemClass,w=void 0===y?"":y,T=n.trigger,S=void 0===T?"@":T,C=n.autocompleteMode,k=void 0!==C&&C,E=n.autocompleteSeparator,x=void 0===E?null:E,A=n.selectTemplate,M=void 0===A?null:A,L=n.menuItemTemplate,I=void 0===L?null:L,N=n.lookup,P=void 0===N?"key":N,R=n.fillAttr,D=void 0===R?"value":R,O=n.collection,W=void 0===O?null:O,H=n.menuContainer,F=void 0===H?null:H,_=n.noMatchTemplate,B=void 0===_?null:_,j=n.requireLeadingSpace,K=void 0===j||j,q=n.allowSpaces,U=void 0!==q&&q,z=n.replaceTextSuffix,Y=void 0===z?null:z,Q=n.positionMenu,X=void 0===Q||Q,V=n.spaceSelectsMatch,G=void 0!==V&&V,J=n.searchOpts,Z=void 0===J?{}:J,ee=n.menuItemLimit,te=void 0===ee?null:ee,ne=n.menuShowMinLength,ie=void 0===ne?0:ne;if(e(this,t),this.autocompleteMode=k,this.autocompleteSeparator=x,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=F,this.allowSpaces=U,this.replaceTextSuffix=Y,this.positionMenu=X,this.hasTrailingSpace=!1,this.spaceSelectsMatch=G,this.autocompleteMode&&(S="",U=!1),c)this.collection=[{trigger:S,iframe:m,selectClass:v,containerClass:b,itemClass:w,selectTemplate:(M||t.defaultSelectTemplate).bind(this),menuItemTemplate:(I||t.defaultMenuItemTemplate).bind(this),noMatchTemplate:(i=B,"string"==typeof i?""===i.trim()?null:i:"function"==typeof i?i.bind(r):B||function(){return"<li>No Match Found!</li>"}.bind(r)),lookup:P,fillAttr:D,values:c,loadingItemTemplate:d,requireLeadingSpace:K,searchOpts:Z,menuItemLimit:te,menuShowMinLength:ie}];else{if(!W)throw new Error("[Tribute] No collection specified.");this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=W.map((function(e){return{trigger:e.trigger||S,iframe:e.iframe||m,selectClass:e.selectClass||v,containerClass:e.containerClass||b,itemClass:e.itemClass||w,selectTemplate:(e.selectTemplate||t.defaultSelectTemplate).bind(r),menuItemTemplate:(e.menuItemTemplate||t.defaultMenuItemTemplate).bind(r),noMatchTemplate:function(e){return"string"==typeof e?""===e.trim()?null:e:"function"==typeof e?e.bind(r):B||function(){return"<li>No Match Found!</li>"}.bind(r)}(B),lookup:e.lookup||P,fillAttr:e.fillAttr||D,values:e.values,loadingItemTemplate:e.loadingItemTemplate,requireLeadingSpace:e.requireLeadingSpace,searchOpts:e.searchOpts||Z,menuItemLimit:e.menuItemLimit||te,menuShowMinLength:e.menuShowMinLength||ie}}))}new l(this),new u(this),new a(this),new s(this)}return n(t,[{key:"triggers",value:function(){return this.collection.map((function(e){return e.trigger}))}},{key:"attach",value:function(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array)for(var t=e.length,n=0;n<t;++n)this._attach(e[n]);else this._attach(e)}},{key:"_attach",value:function(e){e.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+e.nodeName),this.ensureEditable(e),this.events.bind(e),e.setAttribute("data-tribute",!0)}},{key:"ensureEditable",value:function(e){if(-1===t.inputTypes().indexOf(e.nodeName)){if(!e.contentEditable)throw new Error("[Tribute] Cannot bind to "+e.nodeName);e.contentEditable=!0}}},{key:"createMenu",value:function(e){var t=this.range.getDocument().createElement("div"),n=this.range.getDocument().createElement("ul");return t.className=e,t.appendChild(n),this.menuContainer?this.menuContainer.appendChild(t):this.range.getDocument().body.appendChild(t)}},{key:"showMenuFor",value:function(e,t){var n=this;if(!this.isActive||this.current.element!==e||this.current.mentionText!==this.currentMentionTextSnapshot){this.currentMentionTextSnapshot=this.current.mentionText,this.menu||(this.menu=this.createMenu(this.current.collection.containerClass),e.tributeMenu=this.menu,this.menuEvents.bind(this.menu)),this.isActive=!0,this.menuSelected=0,this.current.mentionText||(this.current.mentionText="");var r=function(e){if(n.isActive){var r=n.search.filter(n.current.mentionText,e,{pre:n.current.collection.searchOpts.pre||"<span>",post:n.current.collection.searchOpts.post||"</span>",skip:n.current.collection.searchOpts.skip,extract:function(e){if("string"==typeof n.current.collection.lookup)return e[n.current.collection.lookup];if("function"==typeof n.current.collection.lookup)return n.current.collection.lookup(e,n.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});n.current.collection.menuItemLimit&&(r=r.slice(0,n.current.collection.menuItemLimit)),n.current.filteredItems=r;var o=n.menu.querySelector("ul");if(!r.length){var u=new CustomEvent("tribute-no-match",{detail:n.menu});return n.current.element.dispatchEvent(u),void("function"==typeof n.current.collection.noMatchTemplate&&!n.current.collection.noMatchTemplate()||!n.current.collection.noMatchTemplate?n.hideMenu():("function"==typeof n.current.collection.noMatchTemplate?o.innerHTML=n.current.collection.noMatchTemplate():o.innerHTML=n.current.collection.noMatchTemplate,n.range.positionMenuAtCaret(t)))}o.innerHTML="";var a=n.range.getDocument().createDocumentFragment();r.forEach((function(e,t){var r=n.range.getDocument().createElement("li");r.setAttribute("data-index",t),r.className=n.current.collection.itemClass,r.addEventListener("mousemove",(function(e){var t=i(n._findLiTarget(e.target),2),r=(t[0],t[1]);0!==e.movementY&&n.events.setActiveLi(r)})),n.menuSelected===t&&r.classList.add(n.current.collection.selectClass),r.innerHTML=n.current.collection.menuItemTemplate(e),a.appendChild(r)})),o.appendChild(a),n.range.positionMenuAtCaret(t)}};"function"==typeof this.current.collection.values?(this.current.collection.loadingItemTemplate&&(this.menu.querySelector("ul").innerHTML=this.current.collection.loadingItemTemplate,this.range.positionMenuAtCaret(t)),this.current.collection.values(this.current.mentionText,r)):r(this.current.collection.values)}}},{key:"_findLiTarget",value:function(e){if(!e)return[];var t=e.getAttribute("data-index");return t?[e,t]:this._findLiTarget(e.parentNode)}},{key:"showMenuForCollection",value:function(e,t){e!==document.activeElement&&this.placeCaretAtEnd(e),this.current.collection=this.collection[t||0],this.current.externalTrigger=!0,this.current.element=e,e.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(e,this.current.collection.trigger),this.showMenuFor(e)}},{key:"placeCaretAtEnd",value:function(e){if(e.focus(),void 0!==window.getSelection&&void 0!==document.createRange){var t=document.createRange();t.selectNodeContents(e),t.collapse(!1);var n=window.getSelection();n.removeAllRanges(),n.addRange(t)}else if(void 0!==document.body.createTextRange){var i=document.body.createTextRange();i.moveToElementText(e),i.collapse(!1),i.select()}}},{key:"insertTextAtCursor",value:function(e){var t,n;(n=(t=window.getSelection()).getRangeAt(0)).deleteContents();var i=document.createTextNode(e);n.insertNode(i),n.selectNodeContents(i),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}},{key:"insertAtCaret",value:function(e,t){var n=e.scrollTop,i=e.selectionStart,r=e.value.substring(0,i),o=e.value.substring(e.selectionEnd,e.value.length);e.value=r+t+o,i+=t.length,e.selectionStart=i,e.selectionEnd=i,e.focus(),e.scrollTop=n}},{key:"hideMenu",value:function(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}},{key:"selectItemAtIndex",value:function(e,t){if("number"==typeof(e=parseInt(e))&&!isNaN(e)){var n=this.current.filteredItems[e],i=this.current.collection.selectTemplate(n);null!==i&&this.replaceText(i,t,n)}}},{key:"replaceText",value:function(e,t,n){this.range.replaceTriggerText(e,!0,!0,t,n)}},{key:"_append",value:function(e,t,n){if("function"==typeof e.values)throw new Error("Unable to append to values, as it is a function.");e.values=n?t:e.values.concat(t)}},{key:"append",value:function(e,t,n){var i=parseInt(e);if("number"!=typeof i)throw new Error("please provide an index for the collection to update.");var r=this.collection[i];this._append(r,t,n)}},{key:"appendCurrent",value:function(e,t){if(!this.isActive)throw new Error("No active state. Please use append instead and pass an index.");this._append(this.current.collection,e,t)}},{key:"detach",value:function(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array)for(var t=e.length,n=0;n<t;++n)this._detach(e[n]);else this._detach(e)}},{key:"_detach",value:function(e){var t=this;this.events.unbind(e),e.tributeMenu&&this.menuEvents.unbind(e.tributeMenu),setTimeout((function(){e.removeAttribute("data-tribute"),t.isActive=!1,e.tributeMenu&&e.tributeMenu.remove()}))}},{key:"isActive",get:function(){return this._isActive},set:function(e){if(this._isActive!=e&&(this._isActive=e,this.current.element)){var t=new CustomEvent("tribute-active-".concat(e));this.current.element.dispatchEvent(t)}}}],[{key:"defaultSelectTemplate",value:function(e){return void 0===e?"".concat(this.current.collection.trigger).concat(this.current.mentionText):this.range.isContentEditable(this.current.element)?'<span class="tribute-mention">'+(this.current.collection.trigger+e.original[this.current.collection.fillAttr])+"</span>":this.current.collection.trigger+e.original[this.current.collection.fillAttr]}},{key:"defaultMenuItemTemplate",value:function(e){return e.string}},{key:"inputTypes",value:function(){return["TEXTAREA","INPUT"]}}]),t}()})); -
wp-to-hootsuite/tags/1.6.2/includes/class-wp-to-hootsuite.php
r3243135 r3279779 76 76 $this->plugin->logo = WP_TO_HOOTSUITE_PLUGIN_URL . 'lib/assets/images/icons/hootsuite-dark.svg'; 77 77 $this->plugin->review_name = 'wp-to-hootsuite'; 78 $this->plugin->review_notice = sprintf( 78 79 // Defer loading of Plugin Classes. 80 add_action( 'init', array( $this, 'initialize' ), 1 ); 81 add_action( 'init', array( $this, 'upgrade' ), 2 ); 82 83 // Admin Menus. 84 add_action( $this->plugin->filter_name . '_admin_admin_menu', array( $this, 'admin_menus' ) ); 85 86 } 87 88 /** 89 * Register menus and submenus. 90 * 91 * @since 1.5.8 92 * 93 * @param string $minimum_capability Minimum required capability. 94 */ 95 public function admin_menus( $minimum_capability ) { 96 97 // Menus. 98 add_menu_page( $this->plugin->displayName, $this->plugin->displayName, $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ), $this->plugin->url . 'lib/assets/images/icons/' . strtolower( $this->plugin->account ) . '-light.svg' ); 99 100 // Register Submenu Pages. 101 $settings_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Settings', 'wp-to-hootsuite' ), __( 'Settings', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ) ); 102 103 // Logs. 104 if ( $this->get_class( 'log' )->is_enabled() ) { 105 $log_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Logs', 'wp-to-hootsuite' ), __( 'Logs', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-log', array( $this->get_class( 'admin' ), 'log_screen' ) ); 106 add_action( "load-$log_page", array( $this->get_class( 'log' ), 'add_screen_options' ) ); 107 } 108 109 $upgrade_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Upgrade', 'wp-to-hootsuite' ), __( 'Upgrade', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-upgrade', array( $this->get_class( 'admin' ), 'upgrade_screen' ) ); 110 111 } 112 113 /** 114 * Initializes required classes 115 * 116 * @since 3.4.9 117 */ 118 public function initialize() { 119 120 $this->plugin->review_notice = sprintf( 79 121 /* translators: Plugin Name */ 80 122 __( 'Thanks for using %s to schedule your social media statuses on Hootsuite!', 'wp-to-hootsuite' ), … … 162 204 $this->dashboard = new WPZincDashboardWidget( $this->plugin, 'https://www.wpzinc.com/wp-content/plugins/lum-deactivation' ); 163 205 164 // Defer loading of Plugin Classes. 165 add_action( 'init', array( $this, 'initialize' ), 1 ); 166 add_action( 'init', array( $this, 'upgrade' ), 2 ); 167 168 // Admin Menus. 169 add_action( $this->plugin->filter_name . '_admin_admin_menu', array( $this, 'admin_menus' ) ); 170 171 // Localization. 172 add_action( 'init', array( $this, 'load_language_files' ) ); 173 174 } 175 176 /** 177 * Register menus and submenus. 178 * 179 * @since 1.5.8 180 * 181 * @param string $minimum_capability Minimum required capability. 182 */ 183 public function admin_menus( $minimum_capability ) { 184 185 // Menus. 186 add_menu_page( $this->plugin->displayName, $this->plugin->displayName, $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ), $this->plugin->url . 'lib/assets/images/icons/' . strtolower( $this->plugin->account ) . '-light.svg' ); 187 188 // Register Submenu Pages. 189 $settings_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Settings', 'wp-to-hootsuite' ), __( 'Settings', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ) ); 190 191 // Logs. 192 if ( $this->get_class( 'log' )->is_enabled() ) { 193 $log_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Logs', 'wp-to-hootsuite' ), __( 'Logs', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-log', array( $this->get_class( 'admin' ), 'log_screen' ) ); 194 add_action( "load-$log_page", array( $this->get_class( 'log' ), 'add_screen_options' ) ); 195 } 196 197 $upgrade_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Upgrade', 'wp-to-hootsuite' ), __( 'Upgrade', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-upgrade', array( $this->get_class( 'admin' ), 'upgrade_screen' ) ); 198 199 } 200 201 /** 202 * Initializes required classes 203 * 204 * @since 3.4.9 205 */ 206 public function initialize() { 207 206 // Initialize Plugin classes. 208 207 $this->classes = new stdClass(); 209 208 … … 248 247 249 248 /** 250 * Loads plugin textdomain251 *252 * @since 3.8.4253 */254 public function load_language_files() {255 256 load_plugin_textdomain( 'wp-to-hootsuite', false, $this->plugin->name . '/languages/' );257 258 }259 260 /**261 249 * Returns the given class 262 250 * -
wp-to-hootsuite/tags/1.6.2/readme.txt
r3262556 r3279779 4 4 Tags: auto post, auto publish, social media scheduling, social media automation, hootsuite 5 5 Requires at least: 5.0 6 Tested up to: 6. 7.26 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1.6. 18 Stable tag: 1.6.2 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 89 89 == Changelog == 90 90 91 = 1.6.2 (2025-04-23) = 92 * Fix: Notice: Function `_load_textdomain_just_in_time` was called incorrectly in WordPress 6.8 and higher 93 91 94 = 1.6.1 (2025-03-27) = 92 95 * Updated: Coding standards -
wp-to-hootsuite/tags/1.6.2/wp-to-hootsuite.php
r3262556 r3279779 9 9 * Plugin Name: WP to Hootsuite 10 10 * Plugin URI: http://www.wpzinc.com/plugins/wordpress-to-hootsuite-pro 11 * Version: 1.6. 111 * Version: 1.6.2 12 12 * Author: WP Zinc 13 13 * Author URI: http://www.wpzinc.com … … 22 22 23 23 // Define Plugin version and build date. 24 define( 'WP_TO_HOOTSUITE_PLUGIN_VERSION', '1.6. 1' );25 define( 'WP_TO_HOOTSUITE_PLUGIN_BUILD_DATE', '2025-0 3-2718:00:00' );24 define( 'WP_TO_HOOTSUITE_PLUGIN_VERSION', '1.6.2' ); 25 define( 'WP_TO_HOOTSUITE_PLUGIN_BUILD_DATE', '2025-04-23 18:00:00' ); 26 26 27 27 // Define Plugin paths. -
wp-to-hootsuite/trunk/_modules/dashboard/class-wpzincdashboardwidget.php
r3262556 r3279779 139 139 } 140 140 141 // Export and Support.142 add_action( 'init', array( $this, 'export' ) );143 add_action( ' plugins_loaded', array( $this, 'maybe_redirect' ));141 // Export and Redirects. 142 add_action( 'init', array( $this, 'export' ), 9999 ); 143 add_action( 'init', array( $this, 'maybe_redirect' ), 2 ); 144 144 145 145 // Permit wpzinc.com to be redirected to when using wp_safe_redirect(). -
wp-to-hootsuite/trunk/_modules/dashboard/js/media-library.js
r3196055 r3279779 42 42 var container = $( this ).closest( '.wpzinc-media-library-selector' ), 43 43 input_name = $( container ).data( 'input-name' ), 44 input_url = $( container ).data( 'input-url' ), 44 45 output_size = $( container ).data( 'output-size' ), // The size of the image to output. 45 46 file_type = $( container ).data( 'file-type' ), // The file types that can be selected. … … 48 49 49 50 // Define some attributes if they're not defined in the data- attributes. 51 if ( typeof input_url == 'undefined' ) { 52 input_url = false; 53 } 50 54 if ( typeof output_size == 'undefined' ) { 51 55 output_size = 'thumbnail'; … … 172 176 173 177 html += '<img src="' + attachment_url + '" />'; 178 179 // Include URL as hidden field if required. 180 if ( input_url ) { 181 html += '<input type="hidden" name="' + input_url + '" value="' + attachment.attributes.url + '" />'; 182 } 174 183 break; 175 184 … … 186 195 // Inject. 187 196 $( 'ul', $( container ) ).append( html ); 197 198 // Trigger event so other JS can hook into when an attachment is added. 199 $( 'body' ).trigger( 'wpzinc-media-library-attachment-added' ); 188 200 189 201 } -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/admin-min.js
r2688344 r3279779 1 jQuery(document).ready((function($){if("undefined"!=typeof Clipboard&&$(".clipboard-js").length>0){ var e=new Clipboard(".clipboard-js");$(document).on("click",".clipboard-js",(function(e){e.preventDefault()}))}$("body").on("click","a.wpzinc-populate-field-value",(function(e){e.preventDefault(),$($(this).data("field")).val($(this).data("value"))}))}));1 jQuery(document).ready((function($){if("undefined"!=typeof Clipboard&&$(".clipboard-js").length>0){new Clipboard(".clipboard-js");$(document).on("click",".clipboard-js",(function(e){e.preventDefault()}))}$("body").on("click","a.wpzinc-populate-field-value",(function(e){e.preventDefault(),$($(this).data("field")).val($(this).data("value"))}))})); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/autocomplete-gutenberg-min.js
r3196055 r3279779 1 function wp_zinc_auto_complete_gutenberg_register(e,t){return wpzinc_autocomplete_gutenberg.forEach((function(t,o){t.triggers.forEach((function(t,o){"url"in t||e.push({name:t.name,triggerPrefix:t.trigger,options:t.values,getOptionKeywords:function(e){return e.value},getOptionLabel:function(e){return e.value},getOptionCompletion:function(e){return e.key}})}))})),e}var WPZincAutocompleterControl=function(e){const t=window.wp.element.createElement,{TextControl:o}=window.wp.components;var n=[];for(var i in e.options)n.push(t("option",{value:e.options[i],key:e.id+"_"+i},e.options[i]));return delete e.options,[t(o,e),t("datalist",{id:e.list},n)]};"undefined"!=typeof wp&&void 0!==wp.hooks&&"undefined"!=typeof wpzinc_autocomplete_gutenberg&&wpzinc_autocomplete_gutenberg.forEach((function(e,t){e.triggers.forEach((function(e,t){wp.hooks.addFilter("editor.Autocomplete.completers","wp-zinc/autocompleters/"+e.name,wp_zinc_auto_complete_gutenberg_register)}))}));1 var WPZincAutocompleterControl=function(e){const t=window.wp.element.createElement,{TextControl:o}=window.wp.components;var n=[];for(var i in e.options)n.push(t("option",{value:e.options[i],key:e.id+"_"+i},e.options[i]));return delete e.options,[t(o,e),t("datalist",{id:e.list},n)]};function wp_zinc_auto_complete_gutenberg_register(e,t){return wpzinc_autocomplete_gutenberg.forEach((function(t,o){t.triggers.forEach((function(t,o){"url"in t||e.push({name:t.name,triggerPrefix:t.trigger,options:t.values,getOptionKeywords:function(e){return e.value},getOptionLabel:function(e){return e.value},getOptionCompletion:function(e){return e.key}})}))})),e}"undefined"!=typeof wp&&void 0!==wp.hooks&&"undefined"!=typeof wpzinc_autocomplete_gutenberg&&wpzinc_autocomplete_gutenberg.forEach((function(e,t){e.triggers.forEach((function(e,t){wp.hooks.addFilter("editor.Autocomplete.completers","wp-zinc/autocompleters/"+e.name,wp_zinc_auto_complete_gutenberg_register)}))})); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/autocomplete-min.js
r3196055 r3279779 1 function wp_zinc_autocomplete_setup(){wpzinc_autocompleters=[],wpzinc_autocomplete.forEach((function(t,e){var n=[];t.triggers.forEach((function(t,e){t.selectTemplate=function(t){return t.original.value},"url"in t&&(t.values=function(e,n){data=new FormData,data.append("action",t.action),data.append("nonce",t.nonce),data.append("search",e),fetch(t.url,{method:t.method,credentials:"same-origin",body:data}).then((function(t){return t.json()})).then((function(t){n(t.data)})).catch((function(t){console.error(t)}))}),n.push(t)}));var c=new Tribute({collection:n});wpzinc_autocompleters.push({fields:t.fields,instance:c})}))}function wp_zinc_autocomplete_initialize(t){wpzinc_autocompleters.forEach((function(e,n){e.fields.forEach((function(n,c){void 0!==t&&(n=t+" "+n),e.instance.attach(document.querySelectorAll(n))}))}))}function wp_zinc_autocomplete_destroy(){wpzinc_autocompleters.forEach((function(t,e){t.fields.forEach((function(e,n){t.instance.detach(document.querySelectorAll(e))}))})),wpzinc_autocompleters=[]}var wpzinc_autocompleters=[];wp_zinc_autocomplete_setup(),wp_zinc_autocomplete_initialize();1 var wpzinc_autocompleters=[];function wp_zinc_autocomplete_setup(){wpzinc_autocompleters=[],wpzinc_autocomplete.forEach((function(t,e){var n=[];t.triggers.forEach((function(t,e){t.selectTemplate=function(t){return t.original.value},"url"in t&&(t.values=function(e,n){data=new FormData,data.append("action",t.action),data.append("nonce",t.nonce),data.append("search",e),fetch(t.url,{method:t.method,credentials:"same-origin",body:data}).then((function(t){return t.json()})).then((function(t){n(t.data)})).catch((function(t){console.error(t)}))}),n.push(t)}));var c=new Tribute({collection:n});wpzinc_autocompleters.push({fields:t.fields,instance:c})}))}function wp_zinc_autocomplete_initialize(t){wpzinc_autocompleters.forEach((function(e,n){e.fields.forEach((function(n,c){void 0!==t&&(n=t+" "+n),e.instance.attach(document.querySelectorAll(n))}))}))}function wp_zinc_autocomplete_destroy(){wpzinc_autocompleters.forEach((function(t,e){t.fields.forEach((function(e,n){t.instance.detach(document.querySelectorAll(e))}))})),wpzinc_autocompleters=[]}wp_zinc_autocomplete_setup(),wp_zinc_autocomplete_initialize(); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/autocomplete-tinymce-min.js
r3262556 r3279779 1 !function(){ const e=40,t=38,n=27,i=13,o=8;var l=[e,t,n,i],s=["123"];"undefined"!=typeof wpzinc_autocomplete&&wpzinc_autocomplete.forEach((function(o,c){o.triggers.forEach((function(o,c){"url"in o||(tinymce.create("tinymce.plugins."+o.tinyMCEName,{init:function(c){function r(){var e=document.createElement("ul");return e.setAttribute("class","wpzinc-tinymce-autocomplete"),o.values.forEach((function(t,n){var i=document.createElement("li");i.classList.add("displayed"),e.appendChild(i),i.innerHTML=i.innerHTML+t.value})),document.body.appendChild(e),e}function a(e,t){var n=d(e);g(t,n.top,n.left),t.classList.remove("displayed"),t.classList.add("displayed"),E=!0}function d(e){var t=e.getContainer()?e.getContainer():document.getElementById(e.id),n=t.getBoundingClientRect().top+window.scrollY,i=t.getBoundingClientRect().left+window.scrollX,o={top:0,left:0};o=e.selection.getRng().getClientRects().length>0?{top:e.selection.getRng().getClientRects()[0].top+20,left:e.selection.getRng().getClientRects()[0].left}:{top:e.selection.getNode().getClientRects()[0].top+20,left:e.selection.getNode().getClientRects()[0].left};var l=t.getElementsByClassName("mce-toolbar-grp")[0];return l?{top:n+l.getBoundingClientRect().height+o.top,left:i+o.left}:o}function g(e,t,n){e.style.marginTop=t+"px",e.style.marginLeft=n+"px"}function u(e){var t=null==e.selection.getSel().focusNode?"":e.selection.getSel().focusNode.nodeValue,n=e.selection.getSel().focusOffset,i=0,o;if(null==t||0==t.length)return"";for(var l=n;l>=0;l--)if(-1!=s.indexOf(t.charCodeAt(l).toString())){i=l;break}return{search:t.substr(i,n-i),start:i,end:n}}function f(e,t,n){for(var i=n.getElementsByTagName("li"),o=!0,l=i.length,s=0;s<l-1;s++)i.item(s).classList.remove("highlight"),-1==i.item(s).innerText.indexOf(e.search)?i.item(s).classList.remove("displayed"):(i.item(s).classList.add("displayed"),o&&(i.item(s).classList.add("highlight"),o=!1))}function m(e,t,n){for(var i=n.querySelectorAll("li.displayed"),o=i.length,l=0;l<o-1;l++)if(i[l].classList.contains("highlight")){if("previous"==e){if(0==l)break;i[l].classList.remove("highlight"),i[l-1].classList.add("highlight");break}if("next"==e){if(l==i.length-1)break;i[l].classList.remove("highlight"),i[l+1].classList.add("highlight");break}}}function h(e,t){var n;y(t.querySelectorAll("li.highlight")[0].innerText,e,t)}function y(e,t){var n=u(t),i=t.selection.getSel().focusNode,o=t.selection.getRng();o.setStart(i,n.start),o.setEnd(i,n.end),t.selection.setRng(o),t.selection.setContent(e)}function p(e,t){t.classList.remove("displayed"),E=!1}function v(l,s){if(o.triggerKeyCode==s.keyCode&&!E){if(!o.triggerKeyShiftRequired)return void a(l,R);if(s.shiftKey)return void a(l,R)}if(n!=s.keyCode||!E){var c;if(E&&(t==s.keyCode||e==s.keyCode))m(t==s.keyCode?"previous":"next",l,R);return E&&i==s.keyCode?(tinymce.dom.Event.cancel(s),h(l,R),void p(l,R)):void 0}p(l,R)}function C(e,t){var n;-1==l.indexOf(t.keyCode)&&E&&(a(e,R),f(u(e),e,R))}function L(e,t){p(e,R)}function k(e){e.target.matches("li.displayed")?(y(e.target.innerText,c),p(c,R)):p(c,R)}var E=!1,R=r();c.onKeyDown.add(C),c.onKeyDown.add(v),c.onClick.add(L),document.addEventListener("click",k)},getInfo:function(){return{longname:"Autocomplete",author:"WP Zinc",version:tinymce.majorVersion+"."+tinymce.minorVersion}}}),tinymce.PluginManager.add(o.tinyMCEName,tinymce.plugins[o.tinyMCEName]))}))}))}();1 !function(){var e=[40,38,27,13],t=["123"];"undefined"!=typeof wpzinc_autocomplete&&wpzinc_autocomplete.forEach((function(n,i){n.triggers.forEach((function(n,i){"url"in n||(tinymce.create("tinymce.plugins."+n.tinyMCEName,{init:function(i){var o,l=!1,s=((o=document.createElement("ul")).setAttribute("class","wpzinc-tinymce-autocomplete"),n.values.forEach((function(e,t){var n=document.createElement("li");n.classList.add("displayed"),o.appendChild(n),n.innerHTML=n.innerHTML+e.value})),document.body.appendChild(o),o);function c(e,t){var n=function(e){var t=e.getContainer()?e.getContainer():document.getElementById(e.id),n={top:t.getBoundingClientRect().top+window.scrollY,left:t.getBoundingClientRect().left+window.scrollX},i={top:0,left:0};i=e.selection.getRng().getClientRects().length>0?{top:e.selection.getRng().getClientRects()[0].top+20,left:e.selection.getRng().getClientRects()[0].left}:{top:e.selection.getNode().getClientRects()[0].top+20,left:e.selection.getNode().getClientRects()[0].left};var o=t.getElementsByClassName("mce-toolbar-grp")[0];if(o)return{top:n.top+o.getBoundingClientRect().height+i.top,left:n.left+i.left};return i}(e);!function(e,t,n){e.style.marginTop=t+"px",e.style.marginLeft=n+"px"}(t,n.top,n.left),t.classList.remove("displayed"),t.classList.add("displayed"),l=!0}function r(e){var n=null==e.selection.getSel().focusNode?"":e.selection.getSel().focusNode.nodeValue,i=e.selection.getSel().focusOffset,o=0;if(null==n||0==n.length)return"";for(var l=i;l>=0;l--)if(-1!=t.indexOf(n.charCodeAt(l).toString())){o=l;break}return{search:n.substr(o,i-o),start:o,end:i}}function a(e,t){var n=r(t),i=t.selection.getSel().focusNode,o=t.selection.getRng();o.setStart(i,n.start),o.setEnd(i,n.end),t.selection.setRng(o),t.selection.setContent(e)}function d(e,t){t.classList.remove("displayed"),l=!1}i.onKeyDown.add((function(t,n){-1==e.indexOf(n.keyCode)&&l&&(c(t,s),function(e,t,n){for(var i=n.getElementsByTagName("li"),o=!0,l=i.length,s=0;s<l-1;s++)i.item(s).classList.remove("highlight"),-1==i.item(s).innerText.indexOf(e.search)?i.item(s).classList.remove("displayed"):(i.item(s).classList.add("displayed"),o&&(i.item(s).classList.add("highlight"),o=!1))}(r(t),0,s))})),i.onKeyDown.add((function(e,t){if(n.triggerKeyCode==t.keyCode&&!l){if(!n.triggerKeyShiftRequired)return void c(e,s);if(t.shiftKey)return void c(e,s)}if(27!=t.keyCode||!l){if(l&&(38==t.keyCode||40==t.keyCode))!function(e,t,n){for(var i=n.querySelectorAll("li.displayed"),o=i.length,l=0;l<o-1;l++)if(i[l].classList.contains("highlight")){if("previous"==e){if(0==l)break;i[l].classList.remove("highlight"),i[l-1].classList.add("highlight");break}if("next"==e){if(l==i.length-1)break;i[l].classList.remove("highlight"),i[l+1].classList.add("highlight");break}}}(38==t.keyCode?"previous":"next",0,s);return l&&13==t.keyCode?(tinymce.dom.Event.cancel(t),function(e,t){a(t.querySelectorAll("li.highlight")[0].innerText,e)}(e,s),void d(0,s)):void 0}d(0,s)})),i.onClick.add((function(e,t){d(0,s)})),document.addEventListener("click",(function(e){e.target.matches("li.displayed")?(a(e.target.innerText,i),d(0,s)):d(0,s)}))},getInfo:function(){return{longname:"Autocomplete",author:"WP Zinc",version:tinymce.majorVersion+"."+tinymce.minorVersion}}}),tinymce.PluginManager.add(n.tinyMCEName,tinymce.plugins[n.tinyMCEName]))}))}))}(); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/autosize-min.js
r2322366 r3279779 4 4 http://www.jacklmoore.com/autosize 5 5 */ 6 !function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,(function(e, t){"use strict";function n(e){function t(){var t=window.getComputedStyle(e,null);"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),l="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(l)&&(l=0),d()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function o(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function r(){if(0!==e.scrollHeight){var t=o(e),n=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+l+"px",u=e.clientWidth,t.forEach((function(e){e.node.scrollTop=e.scrollTop})),n&&(document.documentElement.scrollTop=n)}}function d(){r();var t=Math.round(parseFloat(e.style.height)),o=window.getComputedStyle(e,null),i="content-box"===o.boxSizing?Math.round(parseFloat(o.height)):e.offsetHeight;if(i<t?"hidden"===o.overflowY&&(n("scroll"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==o.overflowY&&(n("hidden"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),a!==i){a=i;var d=s("autosize:resized");try{e.dispatchEvent(d)}catch(e){}}}if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!i.has(e)){var l=null,u=null,a=null,c=function t(){e.clientWidth!==u&&d()},f=function(t){window.removeEventListener("resize",c,!1),e.removeEventListener("input",d,!1),e.removeEventListener("keyup",d,!1),e.removeEventListener("autosize:destroy",f,!1),e.removeEventListener("autosize:update",d,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),i.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",f,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",d,!1),window.addEventListener("resize",c,!1),e.addEventListener("input",d,!1),e.addEventListener("autosize:update",d,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",i.set(e,{destroy:f,update:d}),t()}}function o(e){var t=i.get(e);t&&t.destroy()}function r(e){var t=i.get(e);t&&t.update()}var i="function"==typeof Map?new Map:(d=[],l=[],{has:function e(t){return d.indexOf(t)>-1},get:function e(t){return l[d.indexOf(t)]},set:function e(t,n){-1===d.indexOf(t)&&(d.push(t),l.push(n))},delete:function e(t){var n=d.indexOf(t);n>-1&&(d.splice(n,1),l.splice(n,1))}}),d,l,s=function e(t){return new Event(t,{bubbles:!0})};try{new Event("test")}catch(e){s=function e(t){var n=document.createEvent("Event");return n.initEvent(t,!0,!1),n}}var u=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((u=function e(t){return t}).destroy=function(e){return e},u.update=function(e){return e}):((u=function e(t,o){return t&&Array.prototype.forEach.call(t.length?t:[t],(function(e){return n(e,o)})),t}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},u.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e}),t.default=u,e.exports=t.default}));6 !function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,(function(e,exports){"use strict";var t,n,o="function"==typeof Map?new Map:(t=[],n=[],{has:function(e){return t.indexOf(e)>-1},get:function(e){return n[t.indexOf(e)]},set:function(e,o){-1===t.indexOf(e)&&(t.push(e),n.push(o))},delete:function(e){var o=t.indexOf(e);o>-1&&(t.splice(o,1),n.splice(o,1))}}),r=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){r=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!o.has(e)){var t,n=null,i=null,d=null,l=function(){e.clientWidth!==i&&p()},s=function(t){window.removeEventListener("resize",l,!1),e.removeEventListener("input",p,!1),e.removeEventListener("keyup",p,!1),e.removeEventListener("autosize:destroy",s,!1),e.removeEventListener("autosize:update",p,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),o.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",s,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",p,!1),window.addEventListener("resize",l,!1),e.addEventListener("input",p,!1),e.addEventListener("autosize:update",p,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",o.set(e,{destroy:s,update:p}),"vertical"===(t=window.getComputedStyle(e,null)).resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),n="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(n)&&(n=0),p()}function u(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function a(){if(0!==e.scrollHeight){var t=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(e),o=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+n+"px",i=e.clientWidth,t.forEach((function(e){e.node.scrollTop=e.scrollTop})),o&&(document.documentElement.scrollTop=o)}}function p(){a();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),o="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(o<t?"hidden"===n.overflowY&&(u("scroll"),a(),o="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(u("hidden"),a(),o="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),d!==o){d=o;var i=r("autosize:resized");try{e.dispatchEvent(i)}catch(e){}}}}function d(e){var t=o.get(e);t&&t.destroy()}function l(e){var t=o.get(e);t&&t.update()}var s=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((s=function(e){return e}).destroy=function(e){return e},s.update=function(e){return e}):((s=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return i(e)})),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],d),e},s.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],l),e}),exports.default=s,e.exports=exports.default})); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/jquery.form-conditionals-min.js
r2688344 r3279779 1 !function($){"use strict";$.fn.conditional=function(t){var i=$.extend({data:"conditional",value:"conditional-value",displayOnEnabled:"conditional-display"},t);return this.each((function(){if(void 0===$(this).data(i.data))return!0;var t,a,n,e;$(this).on("change",(function(){ switch(t=$(this).data(i.data).split(","),void 0===(a=$(this).data(i.displayOnEnabled))&&(a=!0),n=void 0===(n=$(this).data(i.value))?"":String(n).split(","),e=!1,$(this).attr("type")){case"checkbox":e=a?$(this).is(":checked"):!$(this).is(":checked");break;default:e=a?n.length>0?-1!=n.indexOf(String($(this).val())):""!==$(this).val()&&"0"!==$(this).val():n.length>0?-1==n.indexOf(String($(this).val())):""===$(this).val()||"0"===$(this).val();break}for(var d=t.length,s=0;s<d;s++){var h;h=$("#"+t[s]).length>0?$("#"+t[s]):$("."+t[s],$(this).parent()),e?$(h).fadeIn(300):$(h).fadeOut(300)}})),$(this).trigger("change")})),this}}(jQuery),jQuery(document).ready((function($){$("input,select").conditional()}));1 !function($){"use strict";$.fn.conditional=function(t){var i=$.extend({data:"conditional",value:"conditional-value",displayOnEnabled:"conditional-display"},t);return this.each((function(){if(void 0===$(this).data(i.data))return!0;var t,a,n,e;$(this).on("change",(function(){if(t=$(this).data(i.data).split(","),void 0===(a=$(this).data(i.displayOnEnabled))&&(a=!0),n=void 0===(n=$(this).data(i.value))?"":String(n).split(","),e=!1,"checkbox"===$(this).attr("type"))e=a?$(this).is(":checked"):!$(this).is(":checked");else e=a?n.length>0?-1!=n.indexOf(String($(this).val())):""!==$(this).val()&&"0"!==$(this).val():n.length>0?-1==n.indexOf(String($(this).val())):""===$(this).val()||"0"===$(this).val();for(var d=t.length,s=0;s<d;s++){var h;h=$("#"+t[s]).length>0?$("#"+t[s]):$("."+t[s],$(this).parent()),e?$(h).fadeIn(300):$(h).fadeOut(300)}})),$(this).trigger("change")})),this}}(jQuery),jQuery(document).ready((function($){$("input,select").conditional()})); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/media-library-min.js
r3196055 r3279779 1 !function($){$(".wpzinc-media-library-selector").each((function(){var t=$(this).data("multiple");void 0===t&&(t=!1),t&&$("ul",$(this)).sortable()})),$("#wpbody").on("click",".wpzinc-media-library-insert",(function(t){t.preventDefault();var e=$(this).closest(".wpzinc-media-library-selector"),a=$(e).data("input-name"),i=$(e).data(" output-size"),n=$(e).data("file-type"),l=$(e).data("multiple"),r=$(e).data("limit");void 0===i&&(i="thumbnail"),void 0===n&&(n="image"),void 0===l&&(l=!1),void 0===r&&(r=99999);var o=[];if($("input[type=hidden]",$(e)).each((function(){o.push($(this).val())})),c)c.open();else{var c=wp.media({title:"Choose Item",button:{text:"Select"},library:{type:n},multiple:!!l&&"add"});c.on("open",(function(){var t=c.state().get("selection");o.forEach((function(e){attachment=wp.media.attachment(e),attachment.fetch(),t.add(attachment?[attachment]:[])}))})),c.off("select"),c.off("selection:toggle"),c.on("selection:toggle",(function(){var t=c.state().get("selection");t.length>r&&t.remove(t.last())})),c.on("select",(function(){var t=c.state().get("selection").map((function(t){return t.toJSON(),t}));$("ul",$(e)).html("");for(var n=t.length,l=0;l<n;l++){var r=t[l],o=r.get("id"),s=r.get("url"),m='<li class="wpzinc-media-library-attachment">';switch(m+='<a href="#" class="wpzinc-media-library-insert">',m+='<input type="hidden" name="'+a+'" value="'+o+'" />',r.attributes.type){case"image":void 0!==r.attributes.sizes[i]&&(s=r.attributes.sizes[i].url),m+='<img src="'+s+'" />';break;default:m+=r.attributes.filename;break}m+='<a href="#" class="wpzinc-media-library-remove">Remove</a>',m+="</li>",$("ul",$(e)).append(m)}})),c.open()}})),$("#wpbody").on("click",".wpzinc-media-library-remove",(function(t){t.preventDefault(),$(this).closest(".wpzinc-media-library-attachment").remove()}))}(jQuery);1 !function($){$(".wpzinc-media-library-selector").each((function(){var t=$(this).data("multiple");void 0===t&&(t=!1),t&&$("ul",$(this)).sortable()})),$("#wpbody").on("click",".wpzinc-media-library-insert",(function(t){t.preventDefault();var e=$(this).closest(".wpzinc-media-library-selector"),a=$(e).data("input-name"),i=$(e).data("input-url"),n=$(e).data("output-size"),l=$(e).data("file-type"),r=$(e).data("multiple"),o=$(e).data("limit");void 0===i&&(i=!1),void 0===n&&(n="thumbnail"),void 0===l&&(l="image"),void 0===r&&(r=!1),void 0===o&&(o=99999);var c=[];if($("input[type=hidden]",$(e)).each((function(){c.push($(this).val())})),s)s.open();else{var s=wp.media({title:"Choose Item",button:{text:"Select"},library:{type:l},multiple:!!r&&"add"});s.on("open",(function(){var t=s.state().get("selection");c.forEach((function(e){attachment=wp.media.attachment(e),attachment.fetch(),t.add(attachment?[attachment]:[])}))})),s.off("select"),s.off("selection:toggle"),s.on("selection:toggle",(function(){var t=s.state().get("selection");t.length>o&&t.remove(t.last())})),s.on("select",(function(){var t=s.state().get("selection").map((function(t){return t.toJSON(),t}));$("ul",$(e)).html("");for(var l=t.length,r=0;r<l;r++){var o=t[r],c=o.get("id"),d=o.get("url"),u='<li class="wpzinc-media-library-attachment">';if(u+='<a href="#" class="wpzinc-media-library-insert">',u+='<input type="hidden" name="'+a+'" value="'+c+'" />',"image"===o.attributes.type)void 0!==o.attributes.sizes[n]&&(d=o.attributes.sizes[n].url),u+='<img src="'+d+'" />',i&&(u+='<input type="hidden" name="'+i+'" value="'+o.attributes.url+'" />');else u+=o.attributes.filename;u+='<a href="#" class="wpzinc-media-library-remove">Remove</a>',u+="</li>",$("ul",$(e)).append(u),$("body").trigger("wpzinc-media-library-attachment-added")}})),s.open()}})),$("#wpbody").on("click",".wpzinc-media-library-remove",(function(t){t.preventDefault(),$(this).closest(".wpzinc-media-library-attachment").remove()}))}(jQuery); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/selectize-min.js
r2688344 r3279779 1 !function(e,t){"function"==typeof define&&define.amd?define("sifter",t):"object"==typeof exports?module.exports=t():e.Sifter=t()}(this,(function(){var e=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};e.prototype.tokenize=function(e){if(!(e=o(String(e||"").toLowerCase()))||!e.length)return[];var t,n,i,s,l=[],p=e.split(/ +/);for(t=0,n=p.length;t<n;t++){if(i=r(p[t]),this.settings.diacritics)for(s in a)a.hasOwnProperty(s)&&(i=i.replace(new RegExp(s,"g"),a[s]));l.push({string:p[t],regex:new RegExp(i,"i")})}return l},e.prototype.iterator=function(e,t){var n;n=s(e)?Array.prototype.forEach||function(e){for(var t=0,n=this.length;t<n;t++)e(this[t],t,this)}:function(e){for(var t in this)this.hasOwnProperty(t)&&e(this[t],t,this)},n.apply(e,[t])},e.prototype.getScoreFunction=function(e,t){var n,o,r,s ,a;e=(n=this).prepareSearch(e,t),r=e.tokens,o=e.options.fields,s=r.length,a=e.options.nesting;var l=function(e,t){var n,i;return e?-1===(i=(e=String(e||"")).search(t.regex))?0:(n=t.string.length/e.length,0===i&&(n+=.5),n):0},p=(u=o.length)?1===u?function(e,t){return l(i(t,o[0],a),e)}:function(e,t){for(var n=0,r=0;n<u;n++)r+=l(i(t,o[n],a),e);return r/u}:function(){return 0},u;return s?1===s?function(e){return p(r[0],e)}:"and"===e.options.conjunction?function(e){for(var t,n=0,i=0;n<s;n++){if((t=p(r[n],e))<=0)return 0;i+=t}return i/s}:function(e){for(var t=0,n=0;t<s;t++)n+=p(r[t],e);return n/s}:function(){return 0}},e.prototype.getSortFunction=function(e,n){var o,r,s,a,l,p,u,c,d,h,g;if(g=!(e=(s=this).prepareSearch(e,n)).query&&n.sort_empty||n.sort,d=function(e,t){return"$score"===e?t.score:i(s.items[t.id],e,n.nesting)},l=[],g)for(o=0,r=g.length;o<r;o++)(e.query||"$score"!==g[o].field)&&l.push(g[o]);if(e.query){for(h=!0,o=0,r=l.length;o<r;o++)if("$score"===l[o].field){h=!1;break}h&&l.unshift({field:"$score",direction:"desc"})}else for(o=0,r=l.length;o<r;o++)if("$score"===l[o].field){l.splice(o,1);break}for(c=[],o=0,r=l.length;o<r;o++)c.push("desc"===l[o].direction?-1:1);return(p=l.length)?1===p?(a=l[0].field,u=c[0],function(e,n){return u*t(d(a,e),d(a,n))}):function(e,n){var i,o,r,s,a;for(i=0;i<p;i++)if(a=l[i].field,o=c[i]*t(d(a,e),d(a,n)))return o;return 0}:null},e.prototype.prepareSearch=function(e,t){if("object"==typeof e)return e;var i=(t=n({},t)).fields,o=t.sort,r=t.sort_empty;return i&&!s(i)&&(t.fields=[i]),o&&!s(o)&&(t.sort=[o]),r&&!s(r)&&(t.sort_empty=[r]),{options:t,query:String(e||"").toLowerCase(),tokens:this.tokenize(e),total:0,items:[]}},e.prototype.search=function(e,t){var n=this,i,o,r,s,a,l;return r=this.prepareSearch(e,t),t=r.options,e=r.query,l=t.score||n.getScoreFunction(r),e.length?n.iterator(n.items,(function(e,n){o=l(e),(!1===t.filter||o>0)&&r.items.push({score:o,id:n})})):n.iterator(n.items,(function(e,t){r.items.push({score:1,id:t})})),(a=n.getSortFunction(r,t))&&r.items.sort(a),r.total=r.items.length,"number"==typeof t.limit&&(r.items=r.items.slice(0,t.limit)),r};var t=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:e<t?-1:0:(e=l(String(e||"")))>(t=l(String(t||"")))?1:t>e?-1:0},n=function(e,t){var n,i,o,r;for(n=1,i=arguments.length;n<i;n++)if(r=arguments[n])for(o in r)r.hasOwnProperty(o)&&(e[o]=r[o]);return e},i=function(e,t,n){if(e&&t){if(!n)return e[t];for(var i=t.split(".");i.length&&(e=e[i.shift()]););return e}},o=function(e){return(e+"").replace(/^\s+|\s+$|/g,"")},r=function(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},s=Array.isArray||"undefined"!=typeof $&&$.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},l=function(){var e,t,n,i,o="",r={};for(n in a)if(a.hasOwnProperty(n))for(o+=i=a[n].substring(2,a[n].length-1),e=0,t=i.length;e<t;e++)r[i.charAt(e)]=n;var s=new RegExp("["+o+"]","g");return function(e){return e.replace(s,(function(e){return r[e]})).toLowerCase()}}();return e})),function(e,t){"function"==typeof define&&define.amd?define("microplugin",t):"object"==typeof exports?module.exports=t():e.MicroPlugin=t()}(this,(function(){var e={mixin:function(e){e.plugins={},e.prototype.initializePlugins=function(e){var n,i,o,r=this,s=[];if(r.plugins={names:[],settings:{},requested:{},loaded:{}},t.isArray(e))for(n=0,i=e.length;n<i;n++)"string"==typeof e[n]?s.push(e[n]):(r.plugins.settings[e[n].name]=e[n].options,s.push(e[n].name));else if(e)for(o in e)e.hasOwnProperty(o)&&(r.plugins.settings[o]=e[o],s.push(o));for(;s.length;)r.require(s.shift())},e.prototype.loadPlugin=function(t){var n=this,i=n.plugins,o=e.plugins[t];if(!e.plugins.hasOwnProperty(t))throw new Error('Unable to find "'+t+'" plugin');i.requested[t]=!0,i.loaded[t]=o.fn.apply(n,[n.plugins.settings[t]||{}]),i.names.push(t)},e.prototype.require=function(e){var t=this,n=t.plugins;if(!t.plugins.loaded.hasOwnProperty(e)){if(n.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")');t.loadPlugin(e)}return n.loaded[e]},e.define=function(t,n){e.plugins[t]={name:t,fn:n}}}},t={isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}};return e})),function(e,t){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],t):"object"==typeof exports?module.exports=t(require("jquery"),require("sifter"),require("microplugin")):e.Selectize=t(e.jQuery,e.Sifter,e.MicroPlugin)}(this,(function($,e,t){"use strict";var n=function(e,t){if("string"!=typeof t||t.length){var n="string"==typeof t?new RegExp(t,"i"):t,i=function(e){var t=0;if(3===e.nodeType){var o=e.data.search(n);if(o>=0&&e.data.length>0){var r=e.data.match(n),s=document.createElement("span");s.className="highlight";var a=e.splitText(o),l=a.splitText(r[0].length),p=a.cloneNode(!0);s.appendChild(p),a.parentNode.replaceChild(s,a),t=1}}else if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&("highlight"!==e.className||"SPAN"!==e.tagName))for(var u=0;u<e.childNodes.length;++u)u+=i(e.childNodes[u]);return t};return e.each((function(){i(this)}))}};$.fn.removeHighlight=function(){return this.find("span.highlight").each((function(){this.parentNode.firstChild.nodeName;var e=this.parentNode;e.replaceChild(this.firstChild,this),e.normalize()})).end()};var i=function(){};i.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){var n=arguments.length;return 0===n?delete this._events:1===n?delete this._events[e]:(this._events=this._events||{},void(e in this._events!=!1&&this._events[e].splice(this._events[e].indexOf(t),1)))},trigger:function(e){if(this._events=this._events||{},e in this._events!=!1)for(var t=0;t<this._events[e].length;t++)this._events[e][t].apply(this,Array.prototype.slice.call(arguments,1))}},i.mixin=function(e){for(var t=["on","off","trigger"],n=0;n<t.length;n++)e.prototype[t[n]]=i.prototype[t[n]]};var o=/Mac/.test(navigator.userAgent),r=65,s=188,a=13,l=27,p=37,u=38,c=80,d=39,h=40,g=78,f=8,v=46,m=16,y=o?91:17,w=o?18:17,O=9,C=1,b=2,x=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,S=function(e){return void 0!==e},I=function(e){return null==e?null:"boolean"==typeof e?e?"1":"0":e+""},_=function(e){return(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},F=function(e){return(e+"").replace(/\$/g,"$$$$")},D={before:function(e,t,n){var i=e[t];e[t]=function(){return n.apply(e,arguments),i.apply(e,arguments)}},after:function(e,t,n){var i=e[t];e[t]=function(){var t=i.apply(e,arguments);return n.apply(e,arguments),t}}},k=function(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}},P=function(e,t){var n;return function(){var i=this,o=arguments;window.clearTimeout(n),n=window.setTimeout((function(){e.apply(i,o)}),t)}},A=function(e,t,n){var i,o=e.trigger,r={};for(i in e.trigger=function(n){var i=n;if(-1===t.indexOf(i))return o.apply(e,arguments);r[i]=arguments},n.apply(e,[]),e.trigger=o,r)r.hasOwnProperty(i)&&o.apply(e,r[i])},z=function(e,t,n,i){e.on(t,n,(function(t){for(var n=t.target;n&&n.parentNode!==e[0];)n=n.parentNode;return t.currentTarget=n,i.apply(this,[t])}))},T=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var n=document.selection.createRange(),i=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t.start=n.text.length-i,t.length=i}return t},q=function(e,t,n){var i,o,r={};if(n)for(i=0,o=n.length;i<o;i++)r[n[i]]=e.css(n[i]);else r=e.css();t.css(r)},N=function(e,t){return e?(L.$testInput||(L.$testInput=$("<span />").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).appendTo("body")),L.$testInput.text(e),q(t,L.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),L.$testInput.width()):0},j=function(e){var t=null,n=function(n,i){var o,r,s,a,l,p,u,c;i=i||{},(n=n||window.event||{}).metaKey||n.altKey||(i.force||!1!==e.data("grow"))&&(o=e.val(),n.type&&"keydown"===n.type.toLowerCase()&&(s=(r=n.keyCode)>=48&&r<=57||r>=65&&r<=90||r>=96&&r<=111||r>=186&&r<=222||32===r,r===v||8===r?(c=T(e[0])).length?o=o.substring(0,c.start)+o.substring(c.start+c.length):8===r&&c.start?o=o.substring(0,c.start-1)+o.substring(c.start+1):r===v&&void 0!==c.start&&(o=o.substring(0,c.start)+o.substring(c.start+1)):s&&(p=n.shiftKey,u=String.fromCharCode(n.keyCode),o+=u=p?u.toUpperCase():u.toLowerCase())),a=e.attr("placeholder"),!o&&a&&(o=a),(l=N(o,e)+4)!==t&&(t=l,e.width(l),e.triggerHandler("resize")))};e.on("keydown keyup update blur",n),n()},E=function(e){var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},H=function(e,t){t||(t={});var n="Selectize";console.error("Selectize: "+e),t.explanation&&(console.group&&console.group(),console.error(t.explanation),console.group&&console.groupEnd())},L=function(t,n){var i,o,r,s,a,l=this;(a=t[0]).selectize=l;var p=window.getComputedStyle&&window.getComputedStyle(a,null);if(s=(s=p?p.getPropertyValue("direction"):a.currentStyle&&a.currentStyle.direction)||t.parents("[dir]:first").attr("dir")||"",$.extend(l,{order:0,settings:n,$input:t,tabIndex:t.attr("tabindex")||"",tagType:"select"===a.tagName.toLowerCase()?1:2,rtl:/rtl/i.test(s),eventNS:".selectize"+ ++L.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:t.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===n.loadThrottle?l.onSearchChange:P(l.onSearchChange,n.loadThrottle)}),l.sifter=new e(this.options,{diacritics:n.diacritics}),l.settings.options){for(o=0,r=l.settings.options.length;o<r;o++)l.registerOption(l.settings.options[o]);delete l.settings.options}if(l.settings.optgroups){for(o=0,r=l.settings.optgroups.length;o<r;o++)l.registerOptionGroup(l.settings.optgroups[o]);delete l.settings.optgroups}l.settings.mode=l.settings.mode||(1===l.settings.maxItems?"single":"multi"),"boolean"!=typeof l.settings.hideSelected&&(l.settings.hideSelected="multi"===l.settings.mode),l.initializePlugins(l.settings.plugins),l.setupCallbacks(),l.setupTemplates(),l.setup()};return i.mixin(L),void 0!==t?t.mixin(L):H("Dependency MicroPlugin is missing",{explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'}),$.extend(L.prototype,{setup:function(){var e=this,t=e.settings,n=e.eventNS,i=$(window),r=$(document),s=e.$input,a,l,p,u,c,d,h,g,f,v,O,C;if(h=e.settings.mode,v=s.attr("class")||"",a=$("<div>").addClass(t.wrapperClass).addClass(v).addClass(h),l=$("<div>").addClass(t.inputClass).addClass("items").appendTo(a),p=$('<input type="text" autocomplete="off" />').appendTo(l).attr("tabindex",s.is(":disabled")?"-1":e.tabIndex),d=$(t.dropdownParent||a),u=$("<div>").addClass(t.dropdownClass).addClass(h).hide().appendTo(d),c=$("<div>").addClass(t.dropdownContentClass).appendTo(u),(C=s.attr("id"))&&(p.attr("id",C+"-selectized"),$("label[for='"+C+"']").attr("for",C+"-selectized")),e.settings.copyClassesToDropdown&&u.addClass(v),a.css({width:s[0].style.width}),e.plugins.names.length&&(O="plugin-"+e.plugins.names.join(" plugin-"),a.addClass(O),u.addClass(O)),(null===t.maxItems||t.maxItems>1)&&1===e.tagType&&s.attr("multiple","multiple"),e.settings.placeholder&&p.attr("placeholder",t.placeholder),!e.settings.splitOn&&e.settings.delimiter){var b=e.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");e.settings.splitOn=new RegExp("\\s*"+b+"+\\s*")}s.attr("autocorrect")&&p.attr("autocorrect",s.attr("autocorrect")),s.attr("autocapitalize")&&p.attr("autocapitalize",s.attr("autocapitalize")),p[0].type=s[0].type,e.$wrapper=a,e.$control=l,e.$control_input=p,e.$dropdown=u,e.$dropdown_content=c,u.on("mouseenter mousedown click","[data-disabled]>[data-selectable]",(function(e){e.stopImmediatePropagation()})),u.on("mouseenter","[data-selectable]",(function(){return e.onOptionHover.apply(e,arguments)})),u.on("mousedown click","[data-selectable]",(function(){return e.onOptionSelect.apply(e,arguments)})),z(l,"mousedown","*:not(input)",(function(){return e.onItemSelect.apply(e,arguments)})),j(p),l.on({mousedown:function(){return e.onMouseDown.apply(e,arguments)},click:function(){return e.onClick.apply(e,arguments)}}),p.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return e.onKeyDown.apply(e,arguments)},keyup:function(){return e.onKeyUp.apply(e,arguments)},keypress:function(){return e.onKeyPress.apply(e,arguments)},resize:function(){e.positionDropdown.apply(e,[])},blur:function(){return e.onBlur.apply(e,arguments)},focus:function(){return e.ignoreBlur=!1,e.onFocus.apply(e,arguments)},paste:function(){return e.onPaste.apply(e,arguments)}}),r.on("keydown"+n,(function(t){e.isCmdDown=t[o?"metaKey":"ctrlKey"],e.isCtrlDown=t[o?"altKey":"ctrlKey"],e.isShiftDown=t.shiftKey})),r.on("keyup"+n,(function(t){t.keyCode===w&&(e.isCtrlDown=!1),t.keyCode===m&&(e.isShiftDown=!1),t.keyCode===y&&(e.isCmdDown=!1)})),r.on("mousedown"+n,(function(t){if(e.isFocused){if(t.target===e.$dropdown[0]||t.target.parentNode===e.$dropdown[0])return!1;e.$control.has(t.target).length||t.target===e.$control[0]||e.blur(t.target)}})),i.on(["scroll"+n,"resize"+n].join(" "),(function(){e.isOpen&&e.positionDropdown.apply(e,arguments)})),i.on("mousemove"+n,(function(){e.ignoreHover=!1})),this.revertSettings={$children:s.children().detach(),tabindex:s.attr("tabindex")},s.attr("tabindex",-1).hide().after(e.$wrapper),$.isArray(t.items)&&(e.setValue(t.items),delete t.items),x&&s.on("invalid"+n,(function(t){t.preventDefault(),e.isInvalid=!0,e.refreshState()})),e.updateOriginalInput(),e.refreshItems(),e.refreshState(),e.updatePlaceholder(),e.isSetup=!0,s.is(":disabled")&&e.disable(),e.on("change",this.onChange),s.data("selectize",e),s.addClass("selectized"),e.trigger("initialize"),!0===t.preload&&e.onSearchChange("")},setupTemplates:function(){var e=this,t=e.settings.labelField,n=e.settings.optgroupLabelField,i={optgroup:function(e){return'<div class="optgroup">'+e.html+"</div>"},optgroup_header:function(e,t){return'<div class="optgroup-header">'+t(e[n])+"</div>"},option:function(e,n){return'<div class="option">'+n(e[t])+"</div>"},item:function(e,n){return'<div class="item">'+n(e[t])+"</div>"},option_create:function(e,t){return'<div class="create">Add <strong>'+t(e.input)+"</strong>…</div>"}};e.settings.render=$.extend({},i,e.settings.render)},setupCallbacks:function(){var e,t,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in n)n.hasOwnProperty(e)&&(t=this.settings[n[e]])&&this.on(e,t)},onClick:function(e){var t=this;t.isFocused&&t.isOpen||(t.focus(),e.preventDefault())},onMouseDown:function(e){var t=this,n=e.isDefaultPrevented(),i=$(e.target);if(t.isFocused){if(e.target!==t.$control_input[0])return"single"===t.settings.mode?t.isOpen?t.close():t.open():n||t.setActiveItem(null),!1}else n||window.setTimeout((function(){t.focus()}),0)},onChange:function(){this.$input.trigger("change")},onPaste:function(e){var t=this;t.isFull()||t.isInputHidden||t.isLocked?e.preventDefault():t.settings.splitOn&&setTimeout((function(){var e=t.$control_input.val();if(e.match(t.settings.splitOn))for(var n=$.trim(e).split(t.settings.splitOn),i=0,o=n.length;i<o;i++)t.createItem(n[i])}),0)},onKeyPress:function(e){if(this.isLocked)return e&&e.preventDefault();var t=String.fromCharCode(e.keyCode||e.which);return this.settings.create&&"multi"===this.settings.mode&&t===this.settings.delimiter?(this.createItem(),e.preventDefault(),!1):void 0},onKeyDown:function(e){var t=e.target===this.$control_input[0],n=this;if(n.isLocked)9!==e.keyCode&&e.preventDefault();else{switch(e.keyCode){case r:if(n.isCmdDown)return void n.selectAll();break;case l:return void(n.isOpen&&(e.preventDefault(),e.stopPropagation(),n.close()));case g:if(!e.ctrlKey||e.altKey)break;case h:if(!n.isOpen&&n.hasOptions)n.open();else if(n.$activeOption){n.ignoreHover=!0;var i=n.getAdjacentOption(n.$activeOption,1);i.length&&n.setActiveOption(i,!0,!0)}return void e.preventDefault();case c:if(!e.ctrlKey||e.altKey)break;case u:if(n.$activeOption){n.ignoreHover=!0;var s=n.getAdjacentOption(n.$activeOption,-1);s.length&&n.setActiveOption(s,!0,!0)}return void e.preventDefault();case a:return void(n.isOpen&&n.$activeOption&&(n.onOptionSelect({currentTarget:n.$activeOption}),e.preventDefault()));case p:return void n.advanceSelection(-1,e);case d:return void n.advanceSelection(1,e);case 9:return n.settings.selectOnTab&&n.isOpen&&n.$activeOption&&(n.onOptionSelect({currentTarget:n.$activeOption}),n.isFull()||e.preventDefault()),void(n.settings.create&&n.createItem()&&e.preventDefault());case 8:case v:return void n.deleteSelection(e)}!n.isFull()&&!n.isInputHidden||(o?e.metaKey:e.ctrlKey)||e.preventDefault()}},onKeyUp:function(e){var t=this;if(t.isLocked)return e&&e.preventDefault();var n=t.$control_input.val()||"";t.lastValue!==n&&(t.lastValue=n,t.onSearchChange(n),t.refreshOptions(),t.trigger("type",n))},onSearchChange:function(e){var t=this,n=t.settings.load;n&&(t.loadedSearches.hasOwnProperty(e)||(t.loadedSearches[e]=!0,t.load((function(i){n.apply(t,[e,i])}))))},onFocus:function(e){var t=this,n=t.isFocused;if(t.isDisabled)return t.blur(),e&&e.preventDefault(),!1;t.ignoreFocus||(t.isFocused=!0,"focus"===t.settings.preload&&t.onSearchChange(""),n||t.trigger("focus"),t.$activeItems.length||(t.showInput(),t.setActiveItem(null),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())},onBlur:function(e,t){var n=this;if(n.isFocused&&(n.isFocused=!1,!n.ignoreFocus)){if(!n.ignoreBlur&&document.activeElement===n.$dropdown_content[0])return n.ignoreBlur=!0,void n.onFocus(e);var i=function(){n.close(),n.setTextboxValue(""),n.setActiveItem(null),n.setActiveOption(null),n.setCaret(n.items.length),n.refreshState(),t&&t.focus&&t.focus(),n.isBlurring=!1,n.ignoreFocus=!1,n.trigger("blur")};n.isBlurring=!0,n.ignoreFocus=!0,n.settings.create&&n.settings.createOnBlur?n.createItem(null,!1,i):i()}},onOptionHover:function(e){this.ignoreHover||this.setActiveOption(e.currentTarget,!1)},onOptionSelect:function(e){var t,n,i,o=this;e.preventDefault&&(e.preventDefault(),e.stopPropagation()),(n=$(e.currentTarget)).hasClass("create")?o.createItem(null,(function(){o.settings.closeAfterSelect&&o.close()})):void 0!==(t=n.attr("data-value"))&&(o.lastQuery=null,o.setTextboxValue(""),o.addItem(t),o.settings.closeAfterSelect?o.close():!o.settings.hideSelected&&e.type&&/mouse/.test(e.type)&&o.setActiveOption(o.getOption(t)))},onItemSelect:function(e){var t=this;t.isLocked||"multi"===t.settings.mode&&(e.preventDefault(),t.setActiveItem(e.currentTarget,e))},load:function(e){var t=this,n=t.$wrapper.addClass(t.settings.loadingClass);t.loading++,e.apply(t,[function(e){t.loading=Math.max(t.loading-1,0),e&&e.length&&(t.addOption(e),t.refreshOptions(t.isFocused&&!t.isInputHidden)),t.loading||n.removeClass(t.settings.loadingClass),t.trigger("load",e)}])},setTextboxValue:function(e){var t=this.$control_input,n;t.val()!==e&&(t.val(e).triggerHandler("update"),this.lastValue=e)},getValue:function(){return 1===this.tagType&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(e,t){var n;A(this,t?[]:["change"],(function(){this.clear(t),this.addItems(e,t)}))},setActiveItem:function(e,t){var n=this,i,o,r,s,a,l,p,u;if("single"!==n.settings.mode){if(!(e=$(e)).length)return $(n.$activeItems).removeClass("active"),n.$activeItems=[],void(n.isFocused&&n.showInput());if("mousedown"===(i=t&&t.type.toLowerCase())&&n.isShiftDown&&n.$activeItems.length){for(u=n.$control.children(".active:last"),(s=Array.prototype.indexOf.apply(n.$control[0].childNodes,[u[0]]))>(a=Array.prototype.indexOf.apply(n.$control[0].childNodes,[e[0]]))&&(p=s,s=a,a=p),o=s;o<=a;o++)l=n.$control[0].childNodes[o],-1===n.$activeItems.indexOf(l)&&($(l).addClass("active"),n.$activeItems.push(l));t.preventDefault()}else"mousedown"===i&&n.isCtrlDown||"keydown"===i&&this.isShiftDown?e.hasClass("active")?(r=n.$activeItems.indexOf(e[0]),n.$activeItems.splice(r,1),e.removeClass("active")):n.$activeItems.push(e.addClass("active")[0]):($(n.$activeItems).removeClass("active"),n.$activeItems=[e.addClass("active")[0]]);n.hideInput(),this.isFocused||n.focus()}},setActiveOption:function(e,t,n){var i,o,r,s,a,l=this;l.$activeOption&&l.$activeOption.removeClass("active"),l.$activeOption=null,(e=$(e)).length&&(l.$activeOption=e.addClass("active"),!t&&S(t)||(i=l.$dropdown_content.height(),o=l.$activeOption.outerHeight(!0),t=l.$dropdown_content.scrollTop()||0,s=r=l.$activeOption.offset().top-l.$dropdown_content.offset().top+t,a=r-i+o,r+o>i+t?l.$dropdown_content.stop().animate({scrollTop:a},n?l.settings.scrollDuration:0):r<t&&l.$dropdown_content.stop().animate({scrollTop:s},n?l.settings.scrollDuration:0)))},selectAll:function(){var e=this;"single"!==e.settings.mode&&(e.$activeItems=Array.prototype.slice.apply(e.$control.children(":not(input)").addClass("active")),e.$activeItems.length&&(e.hideInput(),e.close()),e.focus())},hideInput:function(){var e=this;e.setTextboxValue(""),e.$control_input.css({opacity:0,position:"absolute",left:e.rtl?1e4:-1e4}),e.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var e=this;e.isDisabled||(e.ignoreFocus=!0,e.$control_input[0].focus(),window.setTimeout((function(){e.ignoreFocus=!1,e.onFocus()}),0))},blur:function(e){this.$control_input[0].blur(),this.onBlur(null,e)},getScoreFunction:function(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())},getSearchOptions:function(){var e=this.settings,t=e.sortField;return"string"==typeof t&&(t=[{field:t}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t,nesting:e.nesting}},search:function(e){var t,n,i,o,r,s=this,a=s.settings,l=this.getSearchOptions();if(a.score&&"function"!=typeof(r=s.settings.score.apply(this,[e])))throw new Error('Selectize "score" setting must be a function that returns a function');if(e!==s.lastQuery?(s.lastQuery=e,o=s.sifter.search(e,$.extend(l,{score:r})),s.currentResults=o):o=$.extend(!0,{},s.currentResults),a.hideSelected)for(t=o.items.length-1;t>=0;t--)-1!==s.items.indexOf(I(o.items[t].id))&&o.items.splice(t,1);return o},refreshOptions:function(e){var t,i,o,r,s,a,l,p,u,c,d,h,g,f,v,m;void 0===e&&(e=!0);var y=this,w=$.trim(y.$control_input.val()),O=y.search(w),C=y.$dropdown_content,b=y.$activeOption&&I(y.$activeOption.attr("data-value"));for(r=O.items.length,"number"==typeof y.settings.maxOptions&&(r=Math.min(r,y.settings.maxOptions)),s={},a=[],t=0;t<r;t++)for(l=y.options[O.items[t].id],p=y.render("option",l),u=l[y.settings.optgroupField]||"",i=0,o=(c=$.isArray(u)?u:[u])&&c.length;i<o;i++)u=c[i],y.optgroups.hasOwnProperty(u)||(u=""),s.hasOwnProperty(u)||(s[u]=document.createDocumentFragment(),a.push(u)),s[u].appendChild(p);for(this.settings.lockOptgroupOrder&&a.sort((function(e,t){var n,i;return(y.optgroups[e].$order||0)-(y.optgroups[t].$order||0)})),d=document.createDocumentFragment(),t=0,r=a.length;t<r;t++)u=a[t],y.optgroups.hasOwnProperty(u)&&s[u].childNodes.length?((h=document.createDocumentFragment()).appendChild(y.render("optgroup_header",y.optgroups[u])),h.appendChild(s[u]),d.appendChild(y.render("optgroup",$.extend({},y.optgroups[u],{html:E(h),dom:h})))):d.appendChild(s[u]);if(C.html(d),y.settings.highlight&&(C.removeHighlight(),O.query.length&&O.tokens.length))for(t=0,r=O.tokens.length;t<r;t++)n(C,O.tokens[t].regex);if(!y.settings.hideSelected)for(t=0,r=y.items.length;t<r;t++)y.getOption(y.items[t]).addClass("selected");(g=y.canCreate(w))&&(C.prepend(y.render("option_create",{input:w})),m=$(C[0].childNodes[0])),y.hasOptions=O.items.length>0||g,y.hasOptions?(O.items.length>0?((v=b&&y.getOption(b))&&v.length?f=v:"single"===y.settings.mode&&y.items.length&&(f=y.getOption(y.items[0])),f&&f.length||(f=m&&!y.settings.addPrecedence?y.getAdjacentOption(m,1):C.find("[data-selectable]:first"))):f=m,y.setActiveOption(f),e&&!y.isOpen&&y.open()):(y.setActiveOption(null),e&&y.isOpen&&y.close())},addOption:function(e){var t,n,i,o=this;if($.isArray(e))for(t=0,n=e.length;t<n;t++)o.addOption(e[t]);else(i=o.registerOption(e))&&(o.userOptions[i]=!0,o.lastQuery=null,o.trigger("option_add",i,e))},registerOption:function(e){var t=I(e[this.settings.valueField]);return null!=t&&!this.options.hasOwnProperty(t)&&(e.$order=e.$order||++this.order,this.options[t]=e,t)},registerOptionGroup:function(e){var t=I(e[this.settings.optgroupValueField]);return!!t&&(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)},addOptionGroup:function(e,t){t[this.settings.optgroupValueField]=e,(e=this.registerOptionGroup(t))&&this.trigger("optgroup_add",e,t)},removeOptionGroup:function(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.renderCache={},this.trigger("optgroup_remove",e))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(e,t){var n=this,i,o,r,s,a,l,p;if(e=I(e),r=I(t[n.settings.valueField]),null!==e&&n.options.hasOwnProperty(e)){if("string"!=typeof r)throw new Error("Value must be set in option data");p=n.options[e].$order,r!==e&&(delete n.options[e],-1!==(s=n.items.indexOf(e))&&n.items.splice(s,1,r)),t.$order=t.$order||p,n.options[r]=t,a=n.renderCache.item,l=n.renderCache.option,a&&(delete a[e],delete a[r]),l&&(delete l[e],delete l[r]),-1!==n.items.indexOf(r)&&(i=n.getItem(e),o=$(n.render("item",t)),i.hasClass("active")&&o.addClass("active"),i.replaceWith(o)),n.lastQuery=null,n.isOpen&&n.refreshOptions(!1)}},removeOption:function(e,t){var n=this;e=I(e);var i=n.renderCache.item,o=n.renderCache.option;i&&delete i[e],o&&delete o[e],delete n.userOptions[e],delete n.options[e],n.lastQuery=null,n.trigger("option_remove",e),n.removeItem(e,t)},clearOptions:function(){var e=this;e.loadedSearches={},e.userOptions={},e.renderCache={};var t=e.options;$.each(e.options,(function(n,i){-1==e.items.indexOf(n)&&delete t[n]})),e.options=e.sifter.items=t,e.lastQuery=null,e.trigger("option_clear")},getOption:function(e){return this.getElementWithValue(e,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(e,t){var n=this.$dropdown.find("[data-selectable]"),i=n.index(e)+t;return i>=0&&i<n.length?n.eq(i):$()},getElementWithValue:function(e,t){if(null!=(e=I(e)))for(var n=0,i=t.length;n<i;n++)if(t[n].getAttribute("data-value")===e)return $(t[n]);return $()},getItem:function(e){return this.getElementWithValue(e,this.$control.children())},addItems:function(e,t){this.buffer=document.createDocumentFragment();for(var n=this.$control[0].childNodes,i=0;i<n.length;i++)this.buffer.appendChild(n[i]);for(var o=$.isArray(e)?e:[e],i=0,r=o.length;i<r;i++)this.isPending=i<r-1,this.addItem(o[i],t);var s=this.$control[0];s.insertBefore(this.buffer,s.firstChild),this.buffer=null},addItem:function(e,t){var n;A(this,t?[]:["change"],(function(){var n,i,o,r=this,s=r.settings.mode,a,l,p,u;e=I(e),-1===r.items.indexOf(e)?r.options.hasOwnProperty(e)&&("single"===s&&r.clear(t),"multi"===s&&r.isFull()||(n=$(r.render("item",r.options[e])),u=r.isFull(),r.items.splice(r.caretPos,0,e),r.insertAtCaret(n),(!r.isPending||!u&&r.isFull())&&r.refreshState(),r.isSetup&&(o=r.$dropdown_content.find("[data-selectable]"),r.isPending||(i=r.getOption(e),p=r.getAdjacentOption(i,1).attr("data-value"),r.refreshOptions(r.isFocused&&"single"!==s),p&&r.setActiveOption(r.getOption(p))),!o.length||r.isFull()?r.close():r.isPending||r.positionDropdown(),r.updatePlaceholder(),r.trigger("item_add",e,n),r.isPending||r.updateOriginalInput({silent:t})))):"single"===s&&r.close()}))},removeItem:function(e,t){var n=this,i,o,r;i=e instanceof $?e:n.getItem(e),e=I(i.attr("data-value")),-1!==(o=n.items.indexOf(e))&&(i.remove(),i.hasClass("active")&&(r=n.$activeItems.indexOf(i[0]),n.$activeItems.splice(r,1)),n.items.splice(o,1),n.lastQuery=null,!n.settings.persist&&n.userOptions.hasOwnProperty(e)&&n.removeOption(e,t),o<n.caretPos&&n.setCaret(n.caretPos-1),n.refreshState(),n.updatePlaceholder(),n.updateOriginalInput({silent:t}),n.positionDropdown(),n.trigger("item_remove",e,i))},createItem:function(e,t){var n=this,i=n.caretPos;e=e||$.trim(n.$control_input.val()||"");var o=arguments[arguments.length-1];if("function"!=typeof o&&(o=function(){}),"boolean"!=typeof t&&(t=!0),!n.canCreate(e))return o(),!1;n.lock();var r="function"==typeof n.settings.create?this.settings.create:function(e){var t={};return t[n.settings.labelField]=e,t[n.settings.valueField]=e,t},s=k((function(e){if(n.unlock(),!e||"object"!=typeof e)return o();var r=I(e[n.settings.valueField]);if("string"!=typeof r)return o();n.setTextboxValue(""),n.addOption(e),n.setCaret(i),n.addItem(r),n.refreshOptions(t&&"single"!==n.settings.mode),o(e)})),a=r.apply(this,[e,s]);return void 0!==a&&s(a),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var e=!this.items.length;this.isInvalid=e,this.$control_input.prop("required",e),this.$input.prop("required",!e)},refreshClasses:function(){var e=this,t=e.isFull(),n=e.isLocked;e.$wrapper.toggleClass("rtl",e.rtl),2 e.$control.toggleClass("focus",e.isFocused).toggleClass("disabled",e.isDisabled).toggleClass("required",e.isRequired).toggleClass("invalid",e.isInvalid).toggleClass("locked",n).toggleClass("full",t).toggleClass("not-full",!t).toggleClass("input-active",e.isFocused&&!e.isInputHidden).toggleClass("dropdown-active",e.isOpen).toggleClass("has-options",!$.isEmptyObject(e.options)).toggleClass("has-items",e.items.length>0),e.$control_input.data("grow",!t&&!n)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,n,i,o,r=this;if(e=e||{},1===r.tagType){for(i=[],t=0,n=r.items.length;t<n;t++)o=r.options[r.items[t]][r.settings.labelField]||"",i.push('<option value="'+_(r.items[t])+'" selected="selected">'+_(o)+"</option>");i.length||this.$input.attr("multiple")||i.push('<option value="" selected="selected"></option>'),r.$input.html(i.join(""))}else r.$input.val(r.getValue()),r.$input.attr("value",r.$input.val());r.isSetup&&(e.silent||r.trigger("change",r.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.isBlurring||e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e[0].getBoundingClientRect().width,top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(e){var t=Math.min(this.caretPos,this.items.length),n=e[0],i=this.buffer||this.$control[0];0===t?i.insertBefore(n,i.firstChild):i.insertBefore(n,i.childNodes[t]),this.setCaret(t+1)},deleteSelection:function(e){var t,n,i,o,r,s,a,l,p,u=this;if(i=e&&8===e.keyCode?-1:1,o=T(u.$control_input[0]),u.$activeOption&&!u.settings.hideSelected&&(a=u.getAdjacentOption(u.$activeOption,-1).attr("data-value")),r=[],u.$activeItems.length){for(p=u.$control.children(".active:"+(i>0?"last":"first")),s=u.$control.children(":not(input)").index(p),i>0&&s++,t=0,n=u.$activeItems.length;t<n;t++)r.push($(u.$activeItems[t]).attr("data-value"));e&&(e.preventDefault(),e.stopPropagation())}else(u.isFocused||"single"===u.settings.mode)&&u.items.length&&(i<0&&0===o.start&&0===o.length?r.push(u.items[u.caretPos-1]):i>0&&o.start===u.$control_input.val().length&&r.push(u.items[u.caretPos]));if(!r.length||"function"==typeof u.settings.onDelete&&!1===u.settings.onDelete.apply(u,[r]))return!1;for(void 0!==s&&u.setCaret(s);r.length;)u.removeItem(r.pop());return u.showInput(),u.positionDropdown(),u.refreshOptions(!0),a&&(l=u.getOption(a)).length&&u.setActiveOption(l),!0},advanceSelection:function(e,t){var n,i,o,r,s,a,l=this;0!==e&&(l.rtl&&(e*=-1),n=e>0?"last":"first",i=T(l.$control_input[0]),l.isFocused&&!l.isInputHidden?(r=l.$control_input.val().length,(s=e<0?0===i.start&&0===i.length:i.start===r)&&!r&&l.advanceCaret(e,t)):(a=l.$control.children(".active:"+n)).length&&(o=l.$control.children(":not(input)").index(a),l.setActiveItem(null),l.setCaret(e>0?o+1:o)))},advanceCaret:function(e,t){var n=this,i,o;0!==e&&(i=e>0?"next":"prev",n.isShiftDown?(o=n.$control_input[i]()).length&&(n.hideInput(),n.setActiveItem(o),t&&t.preventDefault()):n.setCaret(n.caretPos+e))},setCaret:function(e){var t=this,n,i,o,r,s;if(e="single"===t.settings.mode?t.items.length:Math.max(0,Math.min(t.items.length,e)),!t.isPending)for(n=0,i=(r=t.$control.children(":not(input)")).length;n<i;n++)s=$(r[n]).detach(),n<e?t.$control_input.before(s):t.$control.append(s);t.caretPos=e},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var e=this;e.$input.prop("disabled",!0),e.$control_input.prop("disabled",!0).prop("tabindex",-1),e.isDisabled=!0,e.lock()},enable:function(){var e=this;e.$input.prop("disabled",!1),e.$control_input.prop("disabled",!1).prop("tabindex",e.tabIndex),e.isDisabled=!1,e.unlock()},destroy:function(){var e=this,t=e.eventNS,n=e.revertSettings;e.trigger("destroy"),e.off(),e.$wrapper.remove(),e.$dropdown.remove(),e.$input.html("").append(n.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:n.tabindex}).show(),e.$control_input.removeData("grow"),e.$input.removeData("selectize"),0==--L.count&&L.$testInput&&(L.$testInput.remove(),L.$testInput=void 0),$(window).off(t),$(document).off(t),$(document.body).off(t),delete e.$input[0].selectize},render:function(e,t){var n,i,o,r="",s=!1,a=this,l=/^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;return"option"!==e&&"item"!==e||(s=!!(n=I(t[a.settings.valueField]))),s&&(S(a.renderCache[e])||(a.renderCache[e]={}),a.renderCache[e].hasOwnProperty(n))?a.renderCache[e][n]:(r=$(a.settings.render[e].apply(this,[t,_])),"option"===e||"option_create"===e?t[a.settings.disabledField]||r.attr("data-selectable",""):"optgroup"===e&&(i=t[a.settings.optgroupValueField]||"",r.attr("data-group",i),t[a.settings.disabledField]&&r.attr("data-disabled","")),"option"!==e&&"item"!==e||r.attr("data-value",n||""),s&&(a.renderCache[e][n]=r[0]),r[0])},clearCache:function(e){var t=this;void 0===e?t.renderCache={}:delete t.renderCache[e]},canCreate:function(e){var t=this;if(!t.settings.create)return!1;var n=t.settings.createFilter;return e.length&&("function"!=typeof n||n.apply(t,[e]))&&("string"!=typeof n||new RegExp(n).test(e))&&(!(n instanceof RegExp)||n.test(e))}}),L.count=0,L.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},$.fn.selectize=function(e){var t=$.fn.selectize.defaults,n=$.extend({},t,e),i=n.dataAttr,o=n.labelField,r=n.valueField,s=n.disabledField,a=n.optgroupField,l=n.optgroupLabelField,p=n.optgroupValueField,u=function(e,t){var s,a,l,p,u=e.attr(i);if(u)for(t.options=JSON.parse(u),s=0,a=t.options.length;s<a;s++)t.items.push(t.options[s][r]);else{var c=$.trim(e.val()||"");if(!n.allowEmptyOption&&!c.length)return;for(s=0,a=(l=c.split(n.delimiter)).length;s<a;s++)(p={})[o]=l[s],p[r]=l[s],t.options.push(p);t.items=l}},c=function(e,t){var u,c,d,h,g=0,f=t.options,v={},m=function(e){var t=i&&e.attr(i);return"string"==typeof t&&t.length?JSON.parse(t):null},y=function(e,i){e=$(e);var l=I(e.val());if(l||n.allowEmptyOption)if(v.hasOwnProperty(l)){if(i){var p=v[l][a];p?$.isArray(p)?p.push(i):v[l][a]=[p,i]:v[l][a]=i}}else{var u=m(e)||{};u[o]=u[o]||e.text(),u[r]=u[r]||l,u[s]=u[s]||e.prop("disabled"),u[a]=u[a]||i,v[l]=u,f.push(u),e.is(":selected")&&t.items.push(l)}},w=function(e){var n,i,o,r,a;for((o=(e=$(e)).attr("label"))&&((r=m(e)||{})[l]=o,r[p]=o,r[s]=e.prop("disabled"),t.optgroups.push(r)),n=0,i=(a=$("option",e)).length;n<i;n++)y(a[n],o)};for(t.maxItems=e.attr("multiple")?null:1,u=0,c=(h=e.children()).length;u<c;u++)"optgroup"===(d=h[u].tagName.toLowerCase())?w(h[u]):"option"===d&&y(h[u])};return this.each((function(){if(!this.selectize){var i,o=$(this),r=this.tagName.toLowerCase(),s=o.attr("placeholder")||o.attr("data-placeholder");s||n.allowEmptyOption||(s=o.children('option[value=""]').text());var a={placeholder:s,options:[],optgroups:[],items:[]};"select"===r?c(o,a):u(o,a),i=new L(o,$.extend(!0,{},t,a,e))}}))},$.fn.selectize.defaults=L.defaults,$.fn.selectize.support={validity:x},L.define("drag_drop",(function(e){if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var t=this,n;t.lock=(n=t.lock,function(){var e=t.$control.data("sortable");return e&&e.disable(),n.apply(t,arguments)}),t.unlock=function(){var e=t.unlock;return function(){var n=t.$control.data("sortable");return n&&n.enable(),e.apply(t,arguments)}}(),t.setup=function(){var e=t.setup;return function(){e.apply(this,arguments);var n=t.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:t.isLocked,start:function(e,t){t.placeholder.css("width",t.helper.css("width")),n.css({overflow:"visible"})},stop:function(){n.css({overflow:"hidden"});var e=t.$activeItems?t.$activeItems.slice():null,i=[];n.children("[data-value]").each((function(){i.push($(this).attr("data-value"))})),t.setValue(i),t.setActiveItem(e)}})}}()}})),L.define("dropdown_header",(function(e){var t=this,n;e=$.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(e){return'<div class="'+e.headerClass+'"><div class="'+e.titleRowClass+'"><span class="'+e.labelClass+'">'+e.title+'</span><a href="javascript:void(0)" class="'+e.closeClass+'">×</a></div></div>'}},e),t.setup=(n=t.setup,function(){n.apply(t,arguments),t.$dropdown_header=$(e.html(e)),t.$dropdown.prepend(t.$dropdown_header)})})),L.define("optgroup_columns",(function(e){var t=this,n;e=$.extend({equalizeWidth:!0,equalizeHeight:!0},e),this.getAdjacentOption=function(e,t){var n=e.closest("[data-group]").find("[data-selectable]"),i=n.index(e)+t;return i>=0&&i<n.length?n.eq(i):$()},this.onKeyDown=(n=t.onKeyDown,function(e){var i,o,r,s;return!this.isOpen||e.keyCode!==p&&e.keyCode!==d?n.apply(this,arguments):(t.ignoreHover=!0,i=(s=this.$activeOption.closest("[data-group]")).find("[data-selectable]").index(this.$activeOption),void((o=(r=(s=e.keyCode===p?s.prev("[data-group]"):s.next("[data-group]")).find("[data-selectable]")).eq(Math.min(r.length-1,i))).length&&this.setActiveOption(o)))});var i=function(){var e,t=i.width,n=document;return void 0===t&&((e=n.createElement("div")).innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',e=e.firstChild,n.body.appendChild(e),t=i.width=e.offsetWidth-e.clientWidth,n.body.removeChild(e)),t},o=function(){var n,o,r,s,a,l,p;if((o=(p=$("[data-group]",t.$dropdown_content)).length)&&t.$dropdown_content.width()){if(e.equalizeHeight){for(r=0,n=0;n<o;n++)r=Math.max(r,p.eq(n).height());p.css({height:r})}e.equalizeWidth&&(l=t.$dropdown_content.innerWidth()-i(),s=Math.round(l/o),p.css({width:s}),o>1&&(a=l-s*(o-1),p.eq(o-1).css({width:a})))}};(e.equalizeHeight||e.equalizeWidth)&&(D.after(this,"positionDropdown",o),D.after(this,"refreshOptions",o))})),L.define("remove_button",(function(e){e=$.extend({label:"×",title:"Remove",className:"remove",append:!0},e);var t=function(e,t){t.className="remove-single";var n=e,i='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+_(t.title)+'">'+t.label+"</a>",o=function(e,t){return $("<span>").append(e).append(t)},r;e.setup=(r=n.setup,function(){if(t.append){var s=$(n.$input.context).attr("id"),a=$("#"+s),l=n.settings.render.item;n.settings.render.item=function(t){return o(l.apply(e,arguments),i)}}r.apply(e,arguments),e.$control.on("click","."+t.className,(function(e){e.preventDefault(),n.isLocked||n.clear()}))})},n=function(e,t){var n=e,i='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+_(t.title)+'">'+t.label+"</a>",o=function(e,t){var n=e.search(/(<\/[^>]+>\s*)$/);return e.substring(0,n)+t+e.substring(n)},r;e.setup=(r=n.setup,function(){if(t.append){var s=n.settings.render.item;n.settings.render.item=function(t){return o(s.apply(e,arguments),i)}}r.apply(e,arguments),e.$control.on("click","."+t.className,(function(e){if(e.preventDefault(),!n.isLocked){var t=$(e.currentTarget).parent();n.setActiveItem(t),n.deleteSelection()&&n.setCaret(n.items.length)}}))})};"single"!==this.settings.mode?n(this,e):t(this,e)})),L.define("restore_on_backspace",(function(e){var t=this,n;e.text=e.text||function(e){return e[this.settings.labelField]},this.onKeyDown=(n=t.onKeyDown,function(t){var i,o;return 8===t.keyCode&&""===this.$control_input.val()&&!this.$activeItems.length&&(i=this.caretPos-1)>=0&&i<this.items.length?(o=this.options[this.items[i]],this.deleteSelection(t)&&(this.setTextboxValue(e.text.apply(this,[o])),this.refreshOptions(!0)),void t.preventDefault()):n.apply(this,arguments)})})),L}));1 !function(e,t){"function"==typeof define&&define.amd?define("sifter",t):"object"==typeof exports?module.exports=t():e.Sifter=t()}(this,(function(){var e=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};e.prototype.tokenize=function(e){if(!(e=o(String(e||"").toLowerCase()))||!e.length)return[];var t,n,i,s,l=[],p=e.split(/ +/);for(t=0,n=p.length;t<n;t++){if(i=r(p[t]),this.settings.diacritics)for(s in a)a.hasOwnProperty(s)&&(i=i.replace(new RegExp(s,"g"),a[s]));l.push({string:p[t],regex:new RegExp(i,"i")})}return l},e.prototype.iterator=function(e,t){var n;n=s(e)?Array.prototype.forEach||function(e){for(var t=0,n=this.length;t<n;t++)e(this[t],t,this)}:function(e){for(var t in this)this.hasOwnProperty(t)&&e(this[t],t,this)},n.apply(e,[t])},e.prototype.getScoreFunction=function(e,t){var n,o,r,s;e=this.prepareSearch(e,t),o=e.tokens,n=e.options.fields,r=o.length,s=e.options.nesting;var a,l=function(e,t){var n,i;return e?-1===(i=(e=String(e||"")).search(t.regex))?0:(n=t.string.length/e.length,0===i&&(n+=.5),n):0},p=(a=n.length)?1===a?function(e,t){return l(i(t,n[0],s),e)}:function(e,t){for(var o=0,r=0;o<a;o++)r+=l(i(t,n[o],s),e);return r/a}:function(){return 0};return r?1===r?function(e){return p(o[0],e)}:"and"===e.options.conjunction?function(e){for(var t,n=0,i=0;n<r;n++){if((t=p(o[n],e))<=0)return 0;i+=t}return i/r}:function(e){for(var t=0,n=0;t<r;t++)n+=p(o[t],e);return n/r}:function(){return 0}},e.prototype.getSortFunction=function(e,n){var o,r,s,a,l,p,u,c,d,h,g;if(g=!(e=(s=this).prepareSearch(e,n)).query&&n.sort_empty||n.sort,d=function(e,t){return"$score"===e?t.score:i(s.items[t.id],e,n.nesting)},l=[],g)for(o=0,r=g.length;o<r;o++)(e.query||"$score"!==g[o].field)&&l.push(g[o]);if(e.query){for(h=!0,o=0,r=l.length;o<r;o++)if("$score"===l[o].field){h=!1;break}h&&l.unshift({field:"$score",direction:"desc"})}else for(o=0,r=l.length;o<r;o++)if("$score"===l[o].field){l.splice(o,1);break}for(c=[],o=0,r=l.length;o<r;o++)c.push("desc"===l[o].direction?-1:1);return(p=l.length)?1===p?(a=l[0].field,u=c[0],function(e,n){return u*t(d(a,e),d(a,n))}):function(e,n){var i,o,r;for(i=0;i<p;i++)if(r=l[i].field,o=c[i]*t(d(r,e),d(r,n)))return o;return 0}:null},e.prototype.prepareSearch=function(e,t){if("object"==typeof e)return e;var i=(t=n({},t)).fields,o=t.sort,r=t.sort_empty;return i&&!s(i)&&(t.fields=[i]),o&&!s(o)&&(t.sort=[o]),r&&!s(r)&&(t.sort_empty=[r]),{options:t,query:String(e||"").toLowerCase(),tokens:this.tokenize(e),total:0,items:[]}},e.prototype.search=function(e,t){var n,i,o,r,s=this;return i=this.prepareSearch(e,t),t=i.options,e=i.query,r=t.score||s.getScoreFunction(i),e.length?s.iterator(s.items,(function(e,o){n=r(e),(!1===t.filter||n>0)&&i.items.push({score:n,id:o})})):s.iterator(s.items,(function(e,t){i.items.push({score:1,id:t})})),(o=s.getSortFunction(i,t))&&i.items.sort(o),i.total=i.items.length,"number"==typeof t.limit&&(i.items=i.items.slice(0,t.limit)),i};var t=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:e<t?-1:0:(e=l(String(e||"")))>(t=l(String(t||"")))?1:t>e?-1:0},n=function(e,t){var n,i,o,r;for(n=1,i=arguments.length;n<i;n++)if(r=arguments[n])for(o in r)r.hasOwnProperty(o)&&(e[o]=r[o]);return e},i=function(e,t,n){if(e&&t){if(!n)return e[t];for(var i=t.split(".");i.length&&(e=e[i.shift()]););return e}},o=function(e){return(e+"").replace(/^\s+|\s+$|/g,"")},r=function(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},s=Array.isArray||"undefined"!=typeof $&&$.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},l=function(){var e,t,n,i,o="",r={};for(n in a)if(a.hasOwnProperty(n))for(o+=i=a[n].substring(2,a[n].length-1),e=0,t=i.length;e<t;e++)r[i.charAt(e)]=n;var s=new RegExp("["+o+"]","g");return function(e){return e.replace(s,(function(e){return r[e]})).toLowerCase()}}();return e})),function(e,t){"function"==typeof define&&define.amd?define("microplugin",t):"object"==typeof exports?module.exports=t():e.MicroPlugin=t()}(this,(function(){var e={mixin:function(e){e.plugins={},e.prototype.initializePlugins=function(e){var n,i,o,r=this,s=[];if(r.plugins={names:[],settings:{},requested:{},loaded:{}},t.isArray(e))for(n=0,i=e.length;n<i;n++)"string"==typeof e[n]?s.push(e[n]):(r.plugins.settings[e[n].name]=e[n].options,s.push(e[n].name));else if(e)for(o in e)e.hasOwnProperty(o)&&(r.plugins.settings[o]=e[o],s.push(o));for(;s.length;)r.require(s.shift())},e.prototype.loadPlugin=function(t){var n=this,i=n.plugins,o=e.plugins[t];if(!e.plugins.hasOwnProperty(t))throw new Error('Unable to find "'+t+'" plugin');i.requested[t]=!0,i.loaded[t]=o.fn.apply(n,[n.plugins.settings[t]||{}]),i.names.push(t)},e.prototype.require=function(e){var t=this,n=t.plugins;if(!t.plugins.loaded.hasOwnProperty(e)){if(n.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")');t.loadPlugin(e)}return n.loaded[e]},e.define=function(t,n){e.plugins[t]={name:t,fn:n}}}},t={isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}};return e})),function(e,t){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],t):"object"==typeof exports?module.exports=t(require("jquery"),require("sifter"),require("microplugin")):e.Selectize=t(e.jQuery,e.Sifter,e.MicroPlugin)}(this,(function($,e,t){"use strict";var n=function(e,t){if("string"!=typeof t||t.length){var n="string"==typeof t?new RegExp(t,"i"):t,i=function(e){var t=0;if(3===e.nodeType){var o=e.data.search(n);if(o>=0&&e.data.length>0){var r=e.data.match(n),s=document.createElement("span");s.className="highlight";var a=e.splitText(o),l=(a.splitText(r[0].length),a.cloneNode(!0));s.appendChild(l),a.parentNode.replaceChild(s,a),t=1}}else if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&("highlight"!==e.className||"SPAN"!==e.tagName))for(var p=0;p<e.childNodes.length;++p)p+=i(e.childNodes[p]);return t};return e.each((function(){i(this)}))}};$.fn.removeHighlight=function(){return this.find("span.highlight").each((function(){this.parentNode.firstChild.nodeName;var e=this.parentNode;e.replaceChild(this.firstChild,this),e.normalize()})).end()};var i=function(){};i.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){var n=arguments.length;return 0===n?delete this._events:1===n?delete this._events[e]:(this._events=this._events||{},void(e in this._events!=!1&&this._events[e].splice(this._events[e].indexOf(t),1)))},trigger:function(e){if(this._events=this._events||{},e in this._events!=!1)for(var t=0;t<this._events[e].length;t++)this._events[e][t].apply(this,Array.prototype.slice.call(arguments,1))}},i.mixin=function(e){for(var t=["on","off","trigger"],n=0;n<t.length;n++)e.prototype[t[n]]=i.prototype[t[n]]};var o,r,s=/Mac/.test(navigator.userAgent),a=s?91:17,l=s?18:17,p=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,u=function(e){return void 0!==e},c=function(e){return null==e?null:"boolean"==typeof e?e?"1":"0":e+""},d=function(e){return(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},h={before:function(e,t,n){var i=e[t];e[t]=function(){return n.apply(e,arguments),i.apply(e,arguments)}},after:function(e,t,n){var i=e[t];e[t]=function(){var t=i.apply(e,arguments);return n.apply(e,arguments),t}}},g=function(e,t,n){var i,o=e.trigger,r={};for(i in e.trigger=function(){var n=arguments[0];if(-1===t.indexOf(n))return o.apply(e,arguments);r[n]=arguments},n.apply(e,[]),e.trigger=o,r)r.hasOwnProperty(i)&&o.apply(e,r[i])},f=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var n=document.selection.createRange(),i=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t.start=n.text.length-i,t.length=i}return t},v=function(e){var t=null,n=function(n,i){var o,r,s,a,l,p,u,c,d,h;(i=i||{},(n=n||window.event||{}).metaKey||n.altKey)||(i.force||!1!==e.data("grow"))&&(o=e.val(),n.type&&"keydown"===n.type.toLowerCase()&&(s=(r=n.keyCode)>=48&&r<=57||r>=65&&r<=90||r>=96&&r<=111||r>=186&&r<=222||32===r,46===r||8===r?(c=f(e[0])).length?o=o.substring(0,c.start)+o.substring(c.start+c.length):8===r&&c.start?o=o.substring(0,c.start-1)+o.substring(c.start+1):46===r&&void 0!==c.start&&(o=o.substring(0,c.start)+o.substring(c.start+1)):s&&(p=n.shiftKey,u=String.fromCharCode(n.keyCode),o+=u=p?u.toUpperCase():u.toLowerCase())),a=e.attr("placeholder"),!o&&a&&(o=a),h=e,(l=((d=o)?(m.$testInput||(m.$testInput=$("<span />").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).appendTo("body")),m.$testInput.text(d),function(e,t,n){var i,o,r={};if(n)for(i=0,o=n.length;i<o;i++)r[n[i]]=e.css(n[i]);else r=e.css();t.css(r)}(h,m.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),m.$testInput.width()):0)+4)!==t&&(t=l,e.width(l),e.triggerHandler("resize")))};e.on("keydown keyup update blur",n),n()},m=function(t,n){var i,o,r,s,a=this;(s=t[0]).selectize=a;var l,p,u,c=window.getComputedStyle&&window.getComputedStyle(s,null);if(r=(r=c?c.getPropertyValue("direction"):s.currentStyle&&s.currentStyle.direction)||t.parents("[dir]:first").attr("dir")||"",$.extend(a,{order:0,settings:n,$input:t,tabIndex:t.attr("tabindex")||"",tagType:"select"===s.tagName.toLowerCase()?1:2,rtl:/rtl/i.test(r),eventNS:".selectize"+ ++m.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:t.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===n.loadThrottle?a.onSearchChange:(l=a.onSearchChange,p=n.loadThrottle,function(){var e=this,t=arguments;window.clearTimeout(u),u=window.setTimeout((function(){l.apply(e,t)}),p)})}),a.sifter=new e(this.options,{diacritics:n.diacritics}),a.settings.options){for(i=0,o=a.settings.options.length;i<o;i++)a.registerOption(a.settings.options[i]);delete a.settings.options}if(a.settings.optgroups){for(i=0,o=a.settings.optgroups.length;i<o;i++)a.registerOptionGroup(a.settings.optgroups[i]);delete a.settings.optgroups}a.settings.mode=a.settings.mode||(1===a.settings.maxItems?"single":"multi"),"boolean"!=typeof a.settings.hideSelected&&(a.settings.hideSelected="multi"===a.settings.mode),a.initializePlugins(a.settings.plugins),a.setupCallbacks(),a.setupTemplates(),a.setup()};return i.mixin(m),void 0!==t?t.mixin(m):(o="Dependency MicroPlugin is missing",(r={explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'})||(r={}),console.error("Selectize: "+o),r.explanation&&(console.group&&console.group(),console.error(r.explanation),console.group&&console.groupEnd())),$.extend(m.prototype,{setup:function(){var e,t,n,i,o,r,u,c,d,h,g,f,m,y,w=this,O=w.settings,C=w.eventNS,b=$(window),x=$(document),S=w.$input;if(u=w.settings.mode,c=S.attr("class")||"",e=$("<div>").addClass(O.wrapperClass).addClass(c).addClass(u),t=$("<div>").addClass(O.inputClass).addClass("items").appendTo(e),n=$('<input type="text" autocomplete="off" />').appendTo(t).attr("tabindex",S.is(":disabled")?"-1":w.tabIndex),r=$(O.dropdownParent||e),i=$("<div>").addClass(O.dropdownClass).addClass(u).hide().appendTo(r),o=$("<div>").addClass(O.dropdownContentClass).appendTo(i),(h=S.attr("id"))&&(n.attr("id",h+"-selectized"),$("label[for='"+h+"']").attr("for",h+"-selectized")),w.settings.copyClassesToDropdown&&i.addClass(c),e.css({width:S[0].style.width}),w.plugins.names.length&&(d="plugin-"+w.plugins.names.join(" plugin-"),e.addClass(d),i.addClass(d)),(null===O.maxItems||O.maxItems>1)&&1===w.tagType&&S.attr("multiple","multiple"),w.settings.placeholder&&n.attr("placeholder",O.placeholder),!w.settings.splitOn&&w.settings.delimiter){var I=w.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");w.settings.splitOn=new RegExp("\\s*"+I+"+\\s*")}S.attr("autocorrect")&&n.attr("autocorrect",S.attr("autocorrect")),S.attr("autocapitalize")&&n.attr("autocapitalize",S.attr("autocapitalize")),n[0].type=S[0].type,w.$wrapper=e,w.$control=t,w.$control_input=n,w.$dropdown=i,w.$dropdown_content=o,i.on("mouseenter mousedown click","[data-disabled]>[data-selectable]",(function(e){e.stopImmediatePropagation()})),i.on("mouseenter","[data-selectable]",(function(){return w.onOptionHover.apply(w,arguments)})),i.on("mousedown click","[data-selectable]",(function(){return w.onOptionSelect.apply(w,arguments)})),f="mousedown",m="*:not(input)",y=function(){return w.onItemSelect.apply(w,arguments)},(g=t).on(f,m,(function(e){for(var t=e.target;t&&t.parentNode!==g[0];)t=t.parentNode;return e.currentTarget=t,y.apply(this,[e])})),v(n),t.on({mousedown:function(){return w.onMouseDown.apply(w,arguments)},click:function(){return w.onClick.apply(w,arguments)}}),n.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return w.onKeyDown.apply(w,arguments)},keyup:function(){return w.onKeyUp.apply(w,arguments)},keypress:function(){return w.onKeyPress.apply(w,arguments)},resize:function(){w.positionDropdown.apply(w,[])},blur:function(){return w.onBlur.apply(w,arguments)},focus:function(){return w.ignoreBlur=!1,w.onFocus.apply(w,arguments)},paste:function(){return w.onPaste.apply(w,arguments)}}),x.on("keydown"+C,(function(e){w.isCmdDown=e[s?"metaKey":"ctrlKey"],w.isCtrlDown=e[s?"altKey":"ctrlKey"],w.isShiftDown=e.shiftKey})),x.on("keyup"+C,(function(e){e.keyCode===l&&(w.isCtrlDown=!1),16===e.keyCode&&(w.isShiftDown=!1),e.keyCode===a&&(w.isCmdDown=!1)})),x.on("mousedown"+C,(function(e){if(w.isFocused){if(e.target===w.$dropdown[0]||e.target.parentNode===w.$dropdown[0])return!1;w.$control.has(e.target).length||e.target===w.$control[0]||w.blur(e.target)}})),b.on(["scroll"+C,"resize"+C].join(" "),(function(){w.isOpen&&w.positionDropdown.apply(w,arguments)})),b.on("mousemove"+C,(function(){w.ignoreHover=!1})),this.revertSettings={$children:S.children().detach(),tabindex:S.attr("tabindex")},S.attr("tabindex",-1).hide().after(w.$wrapper),$.isArray(O.items)&&(w.setValue(O.items),delete O.items),p&&S.on("invalid"+C,(function(e){e.preventDefault(),w.isInvalid=!0,w.refreshState()})),w.updateOriginalInput(),w.refreshItems(),w.refreshState(),w.updatePlaceholder(),w.isSetup=!0,S.is(":disabled")&&w.disable(),w.on("change",this.onChange),S.data("selectize",w),S.addClass("selectized"),w.trigger("initialize"),!0===O.preload&&w.onSearchChange("")},setupTemplates:function(){var e=this,t=e.settings.labelField,n=e.settings.optgroupLabelField,i={optgroup:function(e){return'<div class="optgroup">'+e.html+"</div>"},optgroup_header:function(e,t){return'<div class="optgroup-header">'+t(e[n])+"</div>"},option:function(e,n){return'<div class="option">'+n(e[t])+"</div>"},item:function(e,n){return'<div class="item">'+n(e[t])+"</div>"},option_create:function(e,t){return'<div class="create">Add <strong>'+t(e.input)+"</strong>…</div>"}};e.settings.render=$.extend({},i,e.settings.render)},setupCallbacks:function(){var e,t,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in n)n.hasOwnProperty(e)&&(t=this.settings[n[e]])&&this.on(e,t)},onClick:function(e){var t=this;t.isFocused&&t.isOpen||(t.focus(),e.preventDefault())},onMouseDown:function(e){var t=this,n=e.isDefaultPrevented();$(e.target);if(t.isFocused){if(e.target!==t.$control_input[0])return"single"===t.settings.mode?t.isOpen?t.close():t.open():n||t.setActiveItem(null),!1}else n||window.setTimeout((function(){t.focus()}),0)},onChange:function(){this.$input.trigger("change")},onPaste:function(e){var t=this;t.isFull()||t.isInputHidden||t.isLocked?e.preventDefault():t.settings.splitOn&&setTimeout((function(){var e=t.$control_input.val();if(e.match(t.settings.splitOn))for(var n=$.trim(e).split(t.settings.splitOn),i=0,o=n.length;i<o;i++)t.createItem(n[i])}),0)},onKeyPress:function(e){if(this.isLocked)return e&&e.preventDefault();var t=String.fromCharCode(e.keyCode||e.which);return this.settings.create&&"multi"===this.settings.mode&&t===this.settings.delimiter?(this.createItem(),e.preventDefault(),!1):void 0},onKeyDown:function(e){e.target,this.$control_input[0];var t=this;if(t.isLocked)9!==e.keyCode&&e.preventDefault();else{switch(e.keyCode){case 65:if(t.isCmdDown)return void t.selectAll();break;case 27:return void(t.isOpen&&(e.preventDefault(),e.stopPropagation(),t.close()));case 78:if(!e.ctrlKey||e.altKey)break;case 40:if(!t.isOpen&&t.hasOptions)t.open();else if(t.$activeOption){t.ignoreHover=!0;var n=t.getAdjacentOption(t.$activeOption,1);n.length&&t.setActiveOption(n,!0,!0)}return void e.preventDefault();case 80:if(!e.ctrlKey||e.altKey)break;case 38:if(t.$activeOption){t.ignoreHover=!0;var i=t.getAdjacentOption(t.$activeOption,-1);i.length&&t.setActiveOption(i,!0,!0)}return void e.preventDefault();case 13:return void(t.isOpen&&t.$activeOption&&(t.onOptionSelect({currentTarget:t.$activeOption}),e.preventDefault()));case 37:return void t.advanceSelection(-1,e);case 39:return void t.advanceSelection(1,e);case 9:return t.settings.selectOnTab&&t.isOpen&&t.$activeOption&&(t.onOptionSelect({currentTarget:t.$activeOption}),t.isFull()||e.preventDefault()),void(t.settings.create&&t.createItem()&&e.preventDefault());case 8:case 46:return void t.deleteSelection(e)}!t.isFull()&&!t.isInputHidden||(s?e.metaKey:e.ctrlKey)||e.preventDefault()}},onKeyUp:function(e){var t=this;if(t.isLocked)return e&&e.preventDefault();var n=t.$control_input.val()||"";t.lastValue!==n&&(t.lastValue=n,t.onSearchChange(n),t.refreshOptions(),t.trigger("type",n))},onSearchChange:function(e){var t=this,n=t.settings.load;n&&(t.loadedSearches.hasOwnProperty(e)||(t.loadedSearches[e]=!0,t.load((function(i){n.apply(t,[e,i])}))))},onFocus:function(e){var t=this,n=t.isFocused;if(t.isDisabled)return t.blur(),e&&e.preventDefault(),!1;t.ignoreFocus||(t.isFocused=!0,"focus"===t.settings.preload&&t.onSearchChange(""),n||t.trigger("focus"),t.$activeItems.length||(t.showInput(),t.setActiveItem(null),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())},onBlur:function(e,t){var n=this;if(n.isFocused&&(n.isFocused=!1,!n.ignoreFocus)){if(!n.ignoreBlur&&document.activeElement===n.$dropdown_content[0])return n.ignoreBlur=!0,void n.onFocus(e);var i=function(){n.close(),n.setTextboxValue(""),n.setActiveItem(null),n.setActiveOption(null),n.setCaret(n.items.length),n.refreshState(),t&&t.focus&&t.focus(),n.isBlurring=!1,n.ignoreFocus=!1,n.trigger("blur")};n.isBlurring=!0,n.ignoreFocus=!0,n.settings.create&&n.settings.createOnBlur?n.createItem(null,!1,i):i()}},onOptionHover:function(e){this.ignoreHover||this.setActiveOption(e.currentTarget,!1)},onOptionSelect:function(e){var t,n,i=this;e.preventDefault&&(e.preventDefault(),e.stopPropagation()),(n=$(e.currentTarget)).hasClass("create")?i.createItem(null,(function(){i.settings.closeAfterSelect&&i.close()})):void 0!==(t=n.attr("data-value"))&&(i.lastQuery=null,i.setTextboxValue(""),i.addItem(t),i.settings.closeAfterSelect?i.close():!i.settings.hideSelected&&e.type&&/mouse/.test(e.type)&&i.setActiveOption(i.getOption(t)))},onItemSelect:function(e){var t=this;t.isLocked||"multi"===t.settings.mode&&(e.preventDefault(),t.setActiveItem(e.currentTarget,e))},load:function(e){var t=this,n=t.$wrapper.addClass(t.settings.loadingClass);t.loading++,e.apply(t,[function(e){t.loading=Math.max(t.loading-1,0),e&&e.length&&(t.addOption(e),t.refreshOptions(t.isFocused&&!t.isInputHidden)),t.loading||n.removeClass(t.settings.loadingClass),t.trigger("load",e)}])},setTextboxValue:function(e){var t=this.$control_input;t.val()!==e&&(t.val(e).triggerHandler("update"),this.lastValue=e)},getValue:function(){return 1===this.tagType&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(e,t){g(this,t?[]:["change"],(function(){this.clear(t),this.addItems(e,t)}))},setActiveItem:function(e,t){var n,i,o,r,s,a,l,p,u=this;if("single"!==u.settings.mode){if(!(e=$(e)).length)return $(u.$activeItems).removeClass("active"),u.$activeItems=[],void(u.isFocused&&u.showInput());if("mousedown"===(n=t&&t.type.toLowerCase())&&u.isShiftDown&&u.$activeItems.length){for(p=u.$control.children(".active:last"),(r=Array.prototype.indexOf.apply(u.$control[0].childNodes,[p[0]]))>(s=Array.prototype.indexOf.apply(u.$control[0].childNodes,[e[0]]))&&(l=r,r=s,s=l),i=r;i<=s;i++)a=u.$control[0].childNodes[i],-1===u.$activeItems.indexOf(a)&&($(a).addClass("active"),u.$activeItems.push(a));t.preventDefault()}else"mousedown"===n&&u.isCtrlDown||"keydown"===n&&this.isShiftDown?e.hasClass("active")?(o=u.$activeItems.indexOf(e[0]),u.$activeItems.splice(o,1),e.removeClass("active")):u.$activeItems.push(e.addClass("active")[0]):($(u.$activeItems).removeClass("active"),u.$activeItems=[e.addClass("active")[0]]);u.hideInput(),this.isFocused||u.focus()}},setActiveOption:function(e,t,n){var i,o,r,s,a,l=this;l.$activeOption&&l.$activeOption.removeClass("active"),l.$activeOption=null,(e=$(e)).length&&(l.$activeOption=e.addClass("active"),!t&&u(t)||(i=l.$dropdown_content.height(),o=l.$activeOption.outerHeight(!0),t=l.$dropdown_content.scrollTop()||0,s=r=l.$activeOption.offset().top-l.$dropdown_content.offset().top+t,a=r-i+o,r+o>i+t?l.$dropdown_content.stop().animate({scrollTop:a},n?l.settings.scrollDuration:0):r<t&&l.$dropdown_content.stop().animate({scrollTop:s},n?l.settings.scrollDuration:0)))},selectAll:function(){var e=this;"single"!==e.settings.mode&&(e.$activeItems=Array.prototype.slice.apply(e.$control.children(":not(input)").addClass("active")),e.$activeItems.length&&(e.hideInput(),e.close()),e.focus())},hideInput:function(){var e=this;e.setTextboxValue(""),e.$control_input.css({opacity:0,position:"absolute",left:e.rtl?1e4:-1e4}),e.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var e=this;e.isDisabled||(e.ignoreFocus=!0,e.$control_input[0].focus(),window.setTimeout((function(){e.ignoreFocus=!1,e.onFocus()}),0))},blur:function(e){this.$control_input[0].blur(),this.onBlur(null,e)},getScoreFunction:function(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())},getSearchOptions:function(){var e=this.settings,t=e.sortField;return"string"==typeof t&&(t=[{field:t}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t,nesting:e.nesting}},search:function(e){var t,n,i,o=this,r=o.settings,s=this.getSearchOptions();if(r.score&&"function"!=typeof(i=o.settings.score.apply(this,[e])))throw new Error('Selectize "score" setting must be a function that returns a function');if(e!==o.lastQuery?(o.lastQuery=e,n=o.sifter.search(e,$.extend(s,{score:i})),o.currentResults=n):n=$.extend(!0,{},o.currentResults),r.hideSelected)for(t=n.items.length-1;t>=0;t--)-1!==o.items.indexOf(c(n.items[t].id))&&n.items.splice(t,1);return n},refreshOptions:function(e){var t,i,o,r,s,a,l,p,u,d,h,g,f,v,m,y;void 0===e&&(e=!0);var w,O,C=this,b=$.trim(C.$control_input.val()),x=C.search(b),S=C.$dropdown_content,I=C.$activeOption&&c(C.$activeOption.attr("data-value"));for(r=x.items.length,"number"==typeof C.settings.maxOptions&&(r=Math.min(r,C.settings.maxOptions)),s={},a=[],t=0;t<r;t++)for(l=C.options[x.items[t].id],p=C.render("option",l),u=l[C.settings.optgroupField]||"",i=0,o=(d=$.isArray(u)?u:[u])&&d.length;i<o;i++)u=d[i],C.optgroups.hasOwnProperty(u)||(u=""),s.hasOwnProperty(u)||(s[u]=document.createDocumentFragment(),a.push(u)),s[u].appendChild(p);for(this.settings.lockOptgroupOrder&&a.sort((function(e,t){return(C.optgroups[e].$order||0)-(C.optgroups[t].$order||0)})),h=document.createDocumentFragment(),t=0,r=a.length;t<r;t++)u=a[t],C.optgroups.hasOwnProperty(u)&&s[u].childNodes.length?((g=document.createDocumentFragment()).appendChild(C.render("optgroup_header",C.optgroups[u])),g.appendChild(s[u]),h.appendChild(C.render("optgroup",$.extend({},C.optgroups[u],{html:(w=g,O=void 0,O=document.createElement("div"),O.appendChild(w.cloneNode(!0)),O.innerHTML),dom:g})))):h.appendChild(s[u]);if(S.html(h),C.settings.highlight&&(S.removeHighlight(),x.query.length&&x.tokens.length))for(t=0,r=x.tokens.length;t<r;t++)n(S,x.tokens[t].regex);if(!C.settings.hideSelected)for(t=0,r=C.items.length;t<r;t++)C.getOption(C.items[t]).addClass("selected");(f=C.canCreate(b))&&(S.prepend(C.render("option_create",{input:b})),y=$(S[0].childNodes[0])),C.hasOptions=x.items.length>0||f,C.hasOptions?(x.items.length>0?((m=I&&C.getOption(I))&&m.length?v=m:"single"===C.settings.mode&&C.items.length&&(v=C.getOption(C.items[0])),v&&v.length||(v=y&&!C.settings.addPrecedence?C.getAdjacentOption(y,1):S.find("[data-selectable]:first"))):v=y,C.setActiveOption(v),e&&!C.isOpen&&C.open()):(C.setActiveOption(null),e&&C.isOpen&&C.close())},addOption:function(e){var t,n,i,o=this;if($.isArray(e))for(t=0,n=e.length;t<n;t++)o.addOption(e[t]);else(i=o.registerOption(e))&&(o.userOptions[i]=!0,o.lastQuery=null,o.trigger("option_add",i,e))},registerOption:function(e){var t=c(e[this.settings.valueField]);return null!=t&&!this.options.hasOwnProperty(t)&&(e.$order=e.$order||++this.order,this.options[t]=e,t)},registerOptionGroup:function(e){var t=c(e[this.settings.optgroupValueField]);return!!t&&(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)},addOptionGroup:function(e,t){t[this.settings.optgroupValueField]=e,(e=this.registerOptionGroup(t))&&this.trigger("optgroup_add",e,t)},removeOptionGroup:function(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.renderCache={},this.trigger("optgroup_remove",e))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(e,t){var n,i,o,r,s,a,l,p=this;if(e=c(e),o=c(t[p.settings.valueField]),null!==e&&p.options.hasOwnProperty(e)){if("string"!=typeof o)throw new Error("Value must be set in option data");l=p.options[e].$order,o!==e&&(delete p.options[e],-1!==(r=p.items.indexOf(e))&&p.items.splice(r,1,o)),t.$order=t.$order||l,p.options[o]=t,s=p.renderCache.item,a=p.renderCache.option,s&&(delete s[e],delete s[o]),a&&(delete a[e],delete a[o]),-1!==p.items.indexOf(o)&&(n=p.getItem(e),i=$(p.render("item",t)),n.hasClass("active")&&i.addClass("active"),n.replaceWith(i)),p.lastQuery=null,p.isOpen&&p.refreshOptions(!1)}},removeOption:function(e,t){var n=this;e=c(e);var i=n.renderCache.item,o=n.renderCache.option;i&&delete i[e],o&&delete o[e],delete n.userOptions[e],delete n.options[e],n.lastQuery=null,n.trigger("option_remove",e),n.removeItem(e,t)},clearOptions:function(){var e=this;e.loadedSearches={},e.userOptions={},e.renderCache={};var t=e.options;$.each(e.options,(function(n,i){-1==e.items.indexOf(n)&&delete t[n]})),e.options=e.sifter.items=t,e.lastQuery=null,e.trigger("option_clear")},getOption:function(e){return this.getElementWithValue(e,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(e,t){var n=this.$dropdown.find("[data-selectable]"),i=n.index(e)+t;return i>=0&&i<n.length?n.eq(i):$()},getElementWithValue:function(e,t){if(null!=(e=c(e)))for(var n=0,i=t.length;n<i;n++)if(t[n].getAttribute("data-value")===e)return $(t[n]);return $()},getItem:function(e){return this.getElementWithValue(e,this.$control.children())},addItems:function(e,t){this.buffer=document.createDocumentFragment();for(var n=this.$control[0].childNodes,i=0;i<n.length;i++)this.buffer.appendChild(n[i]);for(var o=$.isArray(e)?e:[e],r=(i=0,o.length);i<r;i++)this.isPending=i<r-1,this.addItem(o[i],t);var s=this.$control[0];s.insertBefore(this.buffer,s.firstChild),this.buffer=null},addItem:function(e,t){g(this,t?[]:["change"],(function(){var n,i,o,r,s,a=this,l=a.settings.mode;e=c(e),-1===a.items.indexOf(e)?a.options.hasOwnProperty(e)&&("single"===l&&a.clear(t),"multi"===l&&a.isFull()||(n=$(a.render("item",a.options[e])),s=a.isFull(),a.items.splice(a.caretPos,0,e),a.insertAtCaret(n),(!a.isPending||!s&&a.isFull())&&a.refreshState(),a.isSetup&&(o=a.$dropdown_content.find("[data-selectable]"),a.isPending||(i=a.getOption(e),r=a.getAdjacentOption(i,1).attr("data-value"),a.refreshOptions(a.isFocused&&"single"!==l),r&&a.setActiveOption(a.getOption(r))),!o.length||a.isFull()?a.close():a.isPending||a.positionDropdown(),a.updatePlaceholder(),a.trigger("item_add",e,n),a.isPending||a.updateOriginalInput({silent:t})))):"single"===l&&a.close()}))},removeItem:function(e,t){var n,i,o,r=this;n=e instanceof $?e:r.getItem(e),e=c(n.attr("data-value")),-1!==(i=r.items.indexOf(e))&&(n.remove(),n.hasClass("active")&&(o=r.$activeItems.indexOf(n[0]),r.$activeItems.splice(o,1)),r.items.splice(i,1),r.lastQuery=null,!r.settings.persist&&r.userOptions.hasOwnProperty(e)&&r.removeOption(e,t),i<r.caretPos&&r.setCaret(r.caretPos-1),r.refreshState(),r.updatePlaceholder(),r.updateOriginalInput({silent:t}),r.positionDropdown(),r.trigger("item_remove",e,n))},createItem:function(e,t){var n=this,i=n.caretPos;e=e||$.trim(n.$control_input.val()||"");var o=arguments[arguments.length-1];if("function"!=typeof o&&(o=function(){}),"boolean"!=typeof t&&(t=!0),!n.canCreate(e))return o(),!1;n.lock();var r,s,a="function"==typeof n.settings.create?this.settings.create:function(e){var t={};return t[n.settings.labelField]=e,t[n.settings.valueField]=e,t},l=(r=function(e){if(n.unlock(),!e||"object"!=typeof e)return o();var r=c(e[n.settings.valueField]);if("string"!=typeof r)return o();n.setTextboxValue(""),n.addOption(e),n.setCaret(i),n.addItem(r),n.refreshOptions(t&&"single"!==n.settings.mode),o(e)},s=!1,function(){s||(s=!0,r.apply(this,arguments))}),p=a.apply(this,[e,l]);return void 0!==p&&l(p),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var e=!this.items.length;this.isInvalid=e,this.$control_input.prop("required",e),this.$input.prop("required",!e)},refreshClasses:function(){var e=this,t=e.isFull(),n=e.isLocked;e.$wrapper.toggleClass("rtl",e.rtl),e.$control.toggleClass("focus",e.isFocused).toggleClass("disabled",e.isDisabled).toggleClass("required",e.isRequired).toggleClass("invalid",e.isInvalid).toggleClass("locked",n).toggleClass("full",t).toggleClass("not-full",!t).toggleClass("input-active",e.isFocused&&!e.isInputHidden).toggleClass("dropdown-active",e.isOpen).toggleClass("has-options",!$.isEmptyObject(e.options)).toggleClass("has-items",e.items.length>0),e.$control_input.data("grow",!t&&!n)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,n,i,o,r=this;if(e=e||{},1===r.tagType){for(i=[],t=0, 2 n=r.items.length;t<n;t++)o=r.options[r.items[t]][r.settings.labelField]||"",i.push('<option value="'+d(r.items[t])+'" selected="selected">'+d(o)+"</option>");i.length||this.$input.attr("multiple")||i.push('<option value="" selected="selected"></option>'),r.$input.html(i.join(""))}else r.$input.val(r.getValue()),r.$input.attr("value",r.$input.val());r.isSetup&&(e.silent||r.trigger("change",r.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.isBlurring||e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e[0].getBoundingClientRect().width,top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(e){var t=Math.min(this.caretPos,this.items.length),n=e[0],i=this.buffer||this.$control[0];0===t?i.insertBefore(n,i.firstChild):i.insertBefore(n,i.childNodes[t]),this.setCaret(t+1)},deleteSelection:function(e){var t,n,i,o,r,s,a,l,p,u=this;if(i=e&&8===e.keyCode?-1:1,o=f(u.$control_input[0]),u.$activeOption&&!u.settings.hideSelected&&(a=u.getAdjacentOption(u.$activeOption,-1).attr("data-value")),r=[],u.$activeItems.length){for(p=u.$control.children(".active:"+(i>0?"last":"first")),s=u.$control.children(":not(input)").index(p),i>0&&s++,t=0,n=u.$activeItems.length;t<n;t++)r.push($(u.$activeItems[t]).attr("data-value"));e&&(e.preventDefault(),e.stopPropagation())}else(u.isFocused||"single"===u.settings.mode)&&u.items.length&&(i<0&&0===o.start&&0===o.length?r.push(u.items[u.caretPos-1]):i>0&&o.start===u.$control_input.val().length&&r.push(u.items[u.caretPos]));if(!r.length||"function"==typeof u.settings.onDelete&&!1===u.settings.onDelete.apply(u,[r]))return!1;for(void 0!==s&&u.setCaret(s);r.length;)u.removeItem(r.pop());return u.showInput(),u.positionDropdown(),u.refreshOptions(!0),a&&(l=u.getOption(a)).length&&u.setActiveOption(l),!0},advanceSelection:function(e,t){var n,i,o,r,s,a=this;0!==e&&(a.rtl&&(e*=-1),n=e>0?"last":"first",i=f(a.$control_input[0]),a.isFocused&&!a.isInputHidden?(r=a.$control_input.val().length,(e<0?0===i.start&&0===i.length:i.start===r)&&!r&&a.advanceCaret(e,t)):(s=a.$control.children(".active:"+n)).length&&(o=a.$control.children(":not(input)").index(s),a.setActiveItem(null),a.setCaret(e>0?o+1:o)))},advanceCaret:function(e,t){var n,i,o=this;0!==e&&(n=e>0?"next":"prev",o.isShiftDown?(i=o.$control_input[n]()).length&&(o.hideInput(),o.setActiveItem(i),t&&t.preventDefault()):o.setCaret(o.caretPos+e))},setCaret:function(e){var t,n,i,o,r=this;if(e="single"===r.settings.mode?r.items.length:Math.max(0,Math.min(r.items.length,e)),!r.isPending)for(t=0,n=(i=r.$control.children(":not(input)")).length;t<n;t++)o=$(i[t]).detach(),t<e?r.$control_input.before(o):r.$control.append(o);r.caretPos=e},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var e=this;e.$input.prop("disabled",!0),e.$control_input.prop("disabled",!0).prop("tabindex",-1),e.isDisabled=!0,e.lock()},enable:function(){var e=this;e.$input.prop("disabled",!1),e.$control_input.prop("disabled",!1).prop("tabindex",e.tabIndex),e.isDisabled=!1,e.unlock()},destroy:function(){var e=this,t=e.eventNS,n=e.revertSettings;e.trigger("destroy"),e.off(),e.$wrapper.remove(),e.$dropdown.remove(),e.$input.html("").append(n.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:n.tabindex}).show(),e.$control_input.removeData("grow"),e.$input.removeData("selectize"),0==--m.count&&m.$testInput&&(m.$testInput.remove(),m.$testInput=void 0),$(window).off(t),$(document).off(t),$(document.body).off(t),delete e.$input[0].selectize},render:function(e,t){var n,i,o="",r=!1,s=this;return"option"!==e&&"item"!==e||(r=!!(n=c(t[s.settings.valueField]))),r&&(u(s.renderCache[e])||(s.renderCache[e]={}),s.renderCache[e].hasOwnProperty(n))?s.renderCache[e][n]:(o=$(s.settings.render[e].apply(this,[t,d])),"option"===e||"option_create"===e?t[s.settings.disabledField]||o.attr("data-selectable",""):"optgroup"===e&&(i=t[s.settings.optgroupValueField]||"",o.attr("data-group",i),t[s.settings.disabledField]&&o.attr("data-disabled","")),"option"!==e&&"item"!==e||o.attr("data-value",n||""),r&&(s.renderCache[e][n]=o[0]),o[0])},clearCache:function(e){void 0===e?this.renderCache={}:delete this.renderCache[e]},canCreate:function(e){var t=this;if(!t.settings.create)return!1;var n=t.settings.createFilter;return e.length&&("function"!=typeof n||n.apply(t,[e]))&&("string"!=typeof n||new RegExp(n).test(e))&&(!(n instanceof RegExp)||n.test(e))}}),m.count=0,m.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},$.fn.selectize=function(e){var t=$.fn.selectize.defaults,n=$.extend({},t,e),i=n.dataAttr,o=n.labelField,r=n.valueField,s=n.disabledField,a=n.optgroupField,l=n.optgroupLabelField,p=n.optgroupValueField;return this.each((function(){if(!this.selectize){var u=$(this),d=this.tagName.toLowerCase(),h=u.attr("placeholder")||u.attr("data-placeholder");h||n.allowEmptyOption||(h=u.children('option[value=""]').text());var g={placeholder:h,options:[],optgroups:[],items:[]};"select"===d?function(e,t){var u,d,h,g,f=t.options,v={},m=function(e){var t=i&&e.attr(i);return"string"==typeof t&&t.length?JSON.parse(t):null},y=function(e,i){e=$(e);var l=c(e.val());if(l||n.allowEmptyOption)if(v.hasOwnProperty(l)){if(i){var p=v[l][a];p?$.isArray(p)?p.push(i):v[l][a]=[p,i]:v[l][a]=i}}else{var u=m(e)||{};u[o]=u[o]||e.text(),u[r]=u[r]||l,u[s]=u[s]||e.prop("disabled"),u[a]=u[a]||i,v[l]=u,f.push(u),e.is(":selected")&&t.items.push(l)}},w=function(e){var n,i,o,r,a;for((o=(e=$(e)).attr("label"))&&((r=m(e)||{})[l]=o,r[p]=o,r[s]=e.prop("disabled"),t.optgroups.push(r)),n=0,i=(a=$("option",e)).length;n<i;n++)y(a[n],o)};for(t.maxItems=e.attr("multiple")?null:1,u=0,d=(g=e.children()).length;u<d;u++)"optgroup"===(h=g[u].tagName.toLowerCase())?w(g[u]):"option"===h&&y(g[u])}(u,g):function(e,t){var s,a,l,p,u=e.attr(i);if(u)for(t.options=JSON.parse(u),s=0,a=t.options.length;s<a;s++)t.items.push(t.options[s][r]);else{var c=$.trim(e.val()||"");if(!n.allowEmptyOption&&!c.length)return;for(s=0,a=(l=c.split(n.delimiter)).length;s<a;s++)(p={})[o]=l[s],p[r]=l[s],t.options.push(p);t.items=l}}(u,g),new m(u,$.extend(!0,{},t,g,e))}}))},$.fn.selectize.defaults=m.defaults,$.fn.selectize.support={validity:p},m.define("drag_drop",(function(e){if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var t,n=this;n.lock=(t=n.lock,function(){var e=n.$control.data("sortable");return e&&e.disable(),t.apply(n,arguments)}),n.unlock=function(){var e=n.unlock;return function(){var t=n.$control.data("sortable");return t&&t.enable(),e.apply(n,arguments)}}(),n.setup=function(){var e=n.setup;return function(){e.apply(this,arguments);var t=n.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:n.isLocked,start:function(e,n){n.placeholder.css("width",n.helper.css("width")),t.css({overflow:"visible"})},stop:function(){t.css({overflow:"hidden"});var e=n.$activeItems?n.$activeItems.slice():null,i=[];t.children("[data-value]").each((function(){i.push($(this).attr("data-value"))})),n.setValue(i),n.setActiveItem(e)}})}}()}})),m.define("dropdown_header",(function(e){var t,n=this;e=$.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(e){return'<div class="'+e.headerClass+'"><div class="'+e.titleRowClass+'"><span class="'+e.labelClass+'">'+e.title+'</span><a href="javascript:void(0)" class="'+e.closeClass+'">×</a></div></div>'}},e),n.setup=(t=n.setup,function(){t.apply(n,arguments),n.$dropdown_header=$(e.html(e)),n.$dropdown.prepend(n.$dropdown_header)})})),m.define("optgroup_columns",(function(e){var t,n=this;e=$.extend({equalizeWidth:!0,equalizeHeight:!0},e),this.getAdjacentOption=function(e,t){var n=e.closest("[data-group]").find("[data-selectable]"),i=n.index(e)+t;return i>=0&&i<n.length?n.eq(i):$()},this.onKeyDown=(t=n.onKeyDown,function(e){var i,o,r,s;return!this.isOpen||37!==e.keyCode&&39!==e.keyCode?t.apply(this,arguments):(n.ignoreHover=!0,i=(s=this.$activeOption.closest("[data-group]")).find("[data-selectable]").index(this.$activeOption),void((o=(r=(s=37===e.keyCode?s.prev("[data-group]"):s.next("[data-group]")).find("[data-selectable]")).eq(Math.min(r.length-1,i))).length&&this.setActiveOption(o)))});var i=function(){var e,t=i.width,n=document;return void 0===t&&((e=n.createElement("div")).innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',e=e.firstChild,n.body.appendChild(e),t=i.width=e.offsetWidth-e.clientWidth,n.body.removeChild(e)),t},o=function(){var t,o,r,s,a,l,p;if((o=(p=$("[data-group]",n.$dropdown_content)).length)&&n.$dropdown_content.width()){if(e.equalizeHeight){for(r=0,t=0;t<o;t++)r=Math.max(r,p.eq(t).height());p.css({height:r})}e.equalizeWidth&&(l=n.$dropdown_content.innerWidth()-i(),s=Math.round(l/o),p.css({width:s}),o>1&&(a=l-s*(o-1),p.eq(o-1).css({width:a})))}};(e.equalizeHeight||e.equalizeWidth)&&(h.after(this,"positionDropdown",o),h.after(this,"refreshOptions",o))})),m.define("remove_button",(function(e){e=$.extend({label:"×",title:"Remove",className:"remove",append:!0},e);"single"!==this.settings.mode?function(e,t){var n,i=e,o='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+d(t.title)+'">'+t.label+"</a>";e.setup=(n=i.setup,function(){if(t.append){var r=i.settings.render.item;i.settings.render.item=function(t){return n=r.apply(e,arguments),i=o,s=n.search(/(<\/[^>]+>\s*)$/),n.substring(0,s)+i+n.substring(s);var n,i,s}}n.apply(e,arguments),e.$control.on("click","."+t.className,(function(e){if(e.preventDefault(),!i.isLocked){var t=$(e.currentTarget).parent();i.setActiveItem(t),i.deleteSelection()&&i.setCaret(i.items.length)}}))})}(this,e):function(e,t){t.className="remove-single";var n,i=e,o='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+d(t.title)+'">'+t.label+"</a>";e.setup=(n=i.setup,function(){if(t.append){var r=$(i.$input.context).attr("id"),s=($("#"+r),i.settings.render.item);i.settings.render.item=function(t){return n=s.apply(e,arguments),i=o,$("<span>").append(n).append(i);var n,i}}n.apply(e,arguments),e.$control.on("click","."+t.className,(function(e){e.preventDefault(),i.isLocked||i.clear()}))})}(this,e)})),m.define("restore_on_backspace",(function(e){var t,n=this;e.text=e.text||function(e){return e[this.settings.labelField]},this.onKeyDown=(t=n.onKeyDown,function(n){var i,o;return 8===n.keyCode&&""===this.$control_input.val()&&!this.$activeItems.length&&(i=this.caretPos-1)>=0&&i<this.items.length?(o=this.options[this.items[i]],this.deleteSelection(n)&&(this.setTextboxValue(e.text.apply(this,[o])),this.refreshOptions(!0)),void n.preventDefault()):t.apply(this,arguments)})})),m})); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/synchronous-ajax-min.js
r2964113 r3279779 1 !function($){function e(s,t,n,r,o){if(o?t++:t+=Number(s.index_increment),t>Number(s.offset)+Number(s.number_requests)-1)return s.onFinished(),!0;let i ,u={...{action:s.action,nonce:s.nonce,id:s.ids[t],current_index:t,index_increment:s.index_increment,number_requests:s.number_requests,offset:s.offset},...s.data};$.ajax({url:s.url,type:s.type,async:!0,cache:s.cache,dataType:s.dataType,data:u,success:function(o){let i=s.onRequestSuccess(o,t),u=t+Number(s.index_increment);if(u>s.number_requests&&(u=s.number_requests),o.success)n.progressbar("value",Number(u/s.number_requests*100)),$(r).text(u);else{if(1==s.stop_on_error)return void s.onFinished();-1==s.stop_on_error&&(n.progressbar("value",Number(u/s.number_requests*100)),$(r).text(u)),0==s.stop_on_error&&(t-=Number(s.index_increment))}i?o.success||-1===s.stop_on_error?e(s=s.updateSettings(s),t,n,r):setTimeout((function(){e(s,t,n,r)}),s.wait):s.onFinished()},error:function(o,i,u){let c=s.onRequestError(o,i,u,t);1!=s.stop_on_error?(0==s.stop_on_error&&t--,c?setTimeout((function(){e(s,t,n,r)}),s.wait):s.onFinished()):s.onFinished()}})}$.fn.synchronous_request=function(s){let t=$.extend({url:"",number_requests:0,offset:0,index_increment:1,action:"",nonce:"",ids:"",wait:5e3,stop_on_error:0,progress_count:"#progress-number",log:"#log",spinner:"#progress .spinner",cancel_button:".cancel",type:"post",cache:!1,dataType:"json",onRequestSuccess:function(e,s){if(this.maybeResetLog(),e.success)$("ul",$(this.log)).append('<li class="success">'+(s+1)+"/"+this.number_requests+": "+e.data+"</li>");else{let t=s+1+"/"+this.number_requests+": Response Error: "+e.data;switch(this.stop_on_error){case 1:break;case 0:t=t+". Waiting "+this.stop_on_error_pause/1e3+" seconds before reattempting this request.";break;case-1:t=t+". Waiting "+this.stop_on_error_pause/1e3+" seconds before attempting next request.";break}$("ul",$(this.log)).append('<li class="error">'+t+"</li>")}return 1!=this.cancelled},onRequestError:function(e,s,n,r){return this.maybeResetLog(),$("#log ul").append('<li class="error">'+(r+1)+"/"+t.number_requests+": Request Error: "+e.status+" "+e.statusText+"</li>"),1!=this.cancelled},updateSettings:function(e){return e},onFinished:function(){this.cancelled?$("ul",$(this.log)).append('<li class="success">Process cancelled by user.</li>'):($("ul",$(this.log)).append('<li class="success">Finished.</li>'),$(t.cancel_button).attr("disabled","disabled")),$(this.spinner).remove()},maybeResetLog:function(){$("li.spinner",$(this.log)).length>0&&$("li.spinner",$(this.log)).remove(),$("ul li",$(this.log)).length>=100&&$("ul",$(this.log)).html("")}},s);progressbar=$(this).progressbar({value:0}),t.cancel_button&&$(t.cancel_button).on("click",(function(e){e.preventDefault(),t.cancelled=!0,$(t.cancel_button).attr("disabled","disabled")})),e(t,-1+Number(t.offset),progressbar,t.progress_count,!0)}}(jQuery);1 !function($){function e(s,t,n,r,o){if(o?t++:t+=Number(s.index_increment),t>Number(s.offset)+Number(s.number_requests)-1)return s.onFinished(),!0;let i={...{action:s.action,nonce:s.nonce,id:s.ids[t],current_index:t,index_increment:s.index_increment,number_requests:s.number_requests,offset:s.offset},...s.data};$.ajax({url:s.url,type:s.type,async:!0,cache:s.cache,dataType:s.dataType,data:i,success:function(o){let i=s.onRequestSuccess(o,t),u=t+Number(s.index_increment);if(u>s.number_requests&&(u=s.number_requests),o.success)n.progressbar("value",Number(u/s.number_requests*100)),$(r).text(u);else{if(1==s.stop_on_error)return void s.onFinished();-1==s.stop_on_error&&(n.progressbar("value",Number(u/s.number_requests*100)),$(r).text(u)),0==s.stop_on_error&&(t-=Number(s.index_increment))}i?o.success||-1===s.stop_on_error?e(s=s.updateSettings(s),t,n,r):setTimeout((function(){e(s,t,n,r)}),s.wait):s.onFinished()},error:function(o,i,u){let c=s.onRequestError(o,i,u,t);1!=s.stop_on_error?(0==s.stop_on_error&&t--,c?setTimeout((function(){e(s,t,n,r)}),s.wait):s.onFinished()):s.onFinished()}})}$.fn.synchronous_request=function(s){let t=$.extend({url:"",number_requests:0,offset:0,index_increment:1,action:"",nonce:"",ids:"",wait:5e3,stop_on_error:0,progress_count:"#progress-number",log:"#log",spinner:"#progress .spinner",cancel_button:".cancel",type:"post",cache:!1,dataType:"json",onRequestSuccess:function(e,s){if(this.maybeResetLog(),e.success)$("ul",$(this.log)).append('<li class="success">'+(s+1)+"/"+this.number_requests+": "+e.data+"</li>");else{let t=s+1+"/"+this.number_requests+": Response Error: "+e.data;switch(this.stop_on_error){case 1:break;case 0:t=t+". Waiting "+this.stop_on_error_pause/1e3+" seconds before reattempting this request.";break;case-1:t=t+". Waiting "+this.stop_on_error_pause/1e3+" seconds before attempting next request."}$("ul",$(this.log)).append('<li class="error">'+t+"</li>")}return 1!=this.cancelled},onRequestError:function(e,s,n,r){return this.maybeResetLog(),$("#log ul").append('<li class="error">'+(r+1)+"/"+t.number_requests+": Request Error: "+e.status+" "+e.statusText+"</li>"),1!=this.cancelled},updateSettings:function(e){return e},onFinished:function(){this.cancelled?$("ul",$(this.log)).append('<li class="success">Process cancelled by user.</li>'):($("ul",$(this.log)).append('<li class="success">Finished.</li>'),$(t.cancel_button).attr("disabled","disabled")),$(this.spinner).remove()},maybeResetLog:function(){$("li.spinner",$(this.log)).length>0&&$("li.spinner",$(this.log)).remove(),$("ul li",$(this.log)).length>=100&&$("ul",$(this.log)).html("")}},s);progressbar=$(this).progressbar({value:0}),t.cancel_button&&$(t.cancel_button).on("click",(function(e){e.preventDefault(),t.cancelled=!0,$(t.cancel_button).attr("disabled","disabled")})),e(t,-1+Number(t.offset),progressbar,t.progress_count,!0)}}(jQuery); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/tables-min.js
r2688344 r3279779 1 function wpzinc_table_row_add(t,e){var $, r;$=jQuery,r=$("tbody tr."+t,$(e)),$("tbody tr:last-child",$(e)).after('<tr class="'+t+'">'+$(r).html()+"</tr>")}function wpzinc_table_row_delete(t){var $;($=jQuery)(t).closest("tr").remove()}jQuery(document).ready((function($){$("body").on("click",".wpzinc-add-table-row",(function(t){t.preventDefault(),wpzinc_table_row_add($(this).attr("data-table-row-selector"),$(this).closest("table"))})),$("body").on("click",".wpzinc-delete-table-row",(function(t){t.preventDefault(),wpzinc_table_row_delete(this)}))}));1 function wpzinc_table_row_add(t,e){var $,o;$=jQuery,o=$("tbody tr."+t,$(e)),$("tbody tr:last-child",$(e)).after('<tr class="'+t+'">'+$(o).html()+"</tr>")}function wpzinc_table_row_delete(t){jQuery(t).closest("tr").remove()}jQuery(document).ready((function($){$("body").on("click",".wpzinc-add-table-row",(function(t){t.preventDefault(),wpzinc_table_row_add($(this).attr("data-table-row-selector"),$(this).closest("table"))})),$("body").on("click",".wpzinc-delete-table-row",(function(t){t.preventDefault(),wpzinc_table_row_delete(this)}))})); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/tabs-min.js
r2688344 r3279779 1 function wp_zinc_tabs_init(){var $;$=jQuery,wp_zinc_tabs_destroy(),$(".wpzinc-js-tabs").each((function(){var t=$(this),a=$(t).data("panels-container"), i=$(t).data("panel"),n=$(t).data("active"),e=$(t).data("match-height");wp_zinc_tabs_update(t,a,i,n,$("a."+n,$(t)).attr("href")),void 0!==e&&$(a).height($(e).innerHeight()),$(t).on("click.wpzinc_tabs","a",(function(e){if(location.hostname!==this.hostname&&this.hostname.length)return!0;e.preventDefault(),wp_zinc_tabs_update(t,a,i,n,$(this).attr("href"))}))})),$(".wpzinc-tab-indicator").on("change.wpzinc_tab_indicator",(function(t){var a=$(this).data("tab");if($(this).is("input"))var i=$(this).prop("checked");else if($(this).is("select"))var i=$(this).val();1==i?$("a[href=#"+a+"]").addClass("enabled"):$("a[href=#"+a+"]").removeClass("enabled")}))}function wp_zinc_tabs_update(t,a,i,n,e){!function($){if(void 0!==e&&0!=e.length){var c=$('a[href="'+e+'"]',$(t));$("a",$(t)).removeClass(n),$(i,$(a)).hide(),$('a[href="'+e+'"]',$(t)).addClass(n),$(e).show(),void 0!==$(c).data("documentation")&&$("a.nav-tab.documentation").attr("href",$(c).data("documentation")),setTimeout((function(){$(t).trigger("change",c)}),500)}}(jQuery)}function wp_zinc_tabs_destroy(){var $;($=jQuery)(".wpzinc-js-tabs").each((function(){$(this).off("click.wpzinc_tabs","a"),$(this).off("change.wpzinc_tab_indicator")}))}jQuery(document).ready((function($){$(".wpzinc-js-tabs").length>0&&wp_zinc_tabs_init()}));1 function wp_zinc_tabs_init(){var $;$=jQuery,wp_zinc_tabs_destroy(),$(".wpzinc-js-tabs").each((function(){var t=$(this),a=$(t).data("panels-container"),n=$(t).data("panel"),i=$(t).data("active"),e=$(t).data("match-height");wp_zinc_tabs_update(t,a,n,i,$("a."+i,$(t)).attr("href")),void 0!==e&&$(a).height($(e).innerHeight()),$(t).on("click.wpzinc_tabs","a",(function(e){if(location.hostname!==this.hostname&&this.hostname.length)return!0;e.preventDefault(),wp_zinc_tabs_update(t,a,n,i,$(this).attr("href"))}))})),$(".wpzinc-tab-indicator").on("change.wpzinc_tab_indicator",(function(t){var a=$(this).data("tab");if($(this).is("input"))var n=$(this).prop("checked");else $(this).is("select")&&(n=$(this).val());1==n?$("a[href=#"+a+"]").addClass("enabled"):$("a[href=#"+a+"]").removeClass("enabled")}))}function wp_zinc_tabs_update(t,a,n,i,e){!function($){if(void 0!==e&&0!=e.length){var c=$('a[href="'+e+'"]',$(t));$("a",$(t)).removeClass(i),$(n,$(a)).hide(),$('a[href="'+e+'"]',$(t)).addClass(i),$(e).show(),void 0!==$(c).data("documentation")&&$("a.nav-tab.documentation").attr("href",$(c).data("documentation")),setTimeout((function(){$(t).trigger("change",c)}),500)}}(jQuery)}function wp_zinc_tabs_destroy(){var $;($=jQuery)(".wpzinc-js-tabs").each((function(){$(this).off("click.wpzinc_tabs","a"),$(this).off("change.wpzinc_tab_indicator")}))}jQuery(document).ready((function($){$(".wpzinc-js-tabs").length>0&&wp_zinc_tabs_init()})); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/tags-min.js
r2688344 r3279779 1 jQuery(document).ready((function($){ var t;(function(){$("body").unbind("change.wpzinc-tags").on("change.wpzinc-tags","select.wpzinc-tags",(function(t){var n=$(this).val(),a=$(this).data("element"),e=$(a);e.length>1&&(e=$(a,$(this).parent().parent()));var s=$(e).val();if($(e).hasClass("tmce-active"));else{var i=$(e)[0].selectionStart;i>0&&(n=" "+n),$(e).val(s.substring(0,i)+n+s.substring(i))}}))})()}));1 jQuery(document).ready((function($){$("body").unbind("change.wpzinc-tags").on("change.wpzinc-tags","select.wpzinc-tags",(function(t){var a=$(this).val(),n=$(this).data("element"),e=$(n);e.length>1&&(e=$(n,$(this).parent().parent()));var s=$(e).val();if($(e).hasClass("tmce-active"));else{var i=$(e)[0].selectionStart;i>0&&(a=" "+a),$(e).val(s.substring(0,i)+a+s.substring(i))}}))})); -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/tinymce-modal-min.js
r3123476 r3279779 1 if(jQuery(document).ready((function($){$("body").on("click","#wpzinc-tinymce-modal div.mce-cancel button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.cancel",(function( e){"undefined"==typeof tinyMCE||!tinyMCE.activeEditor||tinyMCE.activeEditor.isHidden()?(wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent)):tinymce.activeEditor.windowManager.close()})),$("body").on("click","#wpzinc-tinymce-modal div.mce-insert button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.insert",(function(e){e.preventDefault();var t=$("form.wpzinc-tinymce-popup"),n="["+$('input[name="shortcode"]',$(t)).val(),i="1"==$('input[name="close_shortcode"]',$(t)).val();$("input, select, textarea",$(t)).each((function(e){if(void 0===$(this).data("shortcode"))return!0;if(!$(this).val())return!0;if(0==$(this).val().length)return!0;var t=$(this).data("shortcode"),i="0"!=$(this).data("trim"),o=$(this).val();if(!t.length)return!0;t.search("}")>-1&&t.search("{")>-1&&(t=t.replace(/{|}/gi,(function(e){return""})),t=$(t,$(this).parent().parent()).val()),void 0!==$(this).data("shortcode-prepend")&&(t=$(this).data("shortcode-prepend")+t),Array.isArray(o)&&(o=o.join(",")),i&&(o=o.trim()),n+=" "+t.trim()+'="'+o+'"'})),n+="]",i&&(n+="[/"+$('input[name="shortcode"]',$(t)).val()+"]");let o=$('input[name="editor_type"]',$(t)).val();switch(o){case"tinymce":"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&(tinyMCE.activeEditor.execCommand("mceReplaceContent",!1,n),tinyMCE.activeEditor.windowManager.close());break;case"quicktags":QTags.insertContent(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent);break;default:$(o).val(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent);break}}))})),"undefined"!=typeof wp&&void 0!==wp.media){var wpZincModal=new wp.media.view.Modal({controller:{trigger:function(){}},className:"wpzinc-backbone-modal"}),wpZincModalContent=wp.Backbone.View.extend({template:wp.template("wpzinc-modal")});wpZincModal.content(new wpZincModalContent)}1 if(jQuery(document).ready((function($){$("body").on("click","#wpzinc-tinymce-modal div.mce-cancel button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.cancel",(function(t){"undefined"==typeof tinyMCE||!tinyMCE.activeEditor||tinyMCE.activeEditor.isHidden()?(wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent)):tinymce.activeEditor.windowManager.close()})),$("body").on("click","#wpzinc-tinymce-modal div.mce-insert button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.insert",(function(t){t.preventDefault();var e=$("form.wpzinc-tinymce-popup"),n="["+$('input[name="shortcode"]',$(e)).val(),i="1"==$('input[name="close_shortcode"]',$(e)).val();$("input, select, textarea",$(e)).each((function(t){if(void 0===$(this).data("shortcode"))return!0;if(!$(this).val())return!0;if(0==$(this).val().length)return!0;var e=$(this).data("shortcode"),i="0"!=$(this).data("trim"),o=$(this).val();if(!e.length)return!0;e.search("}")>-1&&e.search("{")>-1&&(e=e.replace(/{|}/gi,(function(t){return""})),e=$(e,$(this).parent().parent()).val()),void 0!==$(this).data("shortcode-prepend")&&(e=$(this).data("shortcode-prepend")+e),Array.isArray(o)&&(o=o.join(",")),i&&(o=o.trim()),n+=" "+e.trim()+'="'+o+'"'})),n+="]",i&&(n+="[/"+$('input[name="shortcode"]',$(e)).val()+"]");let o=$('input[name="editor_type"]',$(e)).val();switch(o){case"tinymce":"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&(tinyMCE.activeEditor.execCommand("mceReplaceContent",!1,n),tinyMCE.activeEditor.windowManager.close());break;case"quicktags":QTags.insertContent(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent);break;default:$(o).val(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent)}}))})),"undefined"!=typeof wp&&void 0!==wp.media){var wpZincModal=new wp.media.view.Modal({controller:{trigger:function(){}},className:"wpzinc-backbone-modal"}),wpZincModalContent=wp.Backbone.View.extend({template:wp.template("wpzinc-modal")});wpZincModal.content(new wpZincModalContent)} -
wp-to-hootsuite/trunk/_modules/dashboard/js/min/tribute-min.js
r2739897 r3279779 1 !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Tribute=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function i(e,t){return r(e)||o(e,t)||u(e,t)||l()}function r(e){if(Array.isArray(e))return e}function o(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,r=!1,o=void 0;try{for(var u=e[Symbol.iterator](),a;!(i=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==u.return||u.return()}finally{if(r)throw o}}return n}}function u(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function l(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}if(Array.prototype.find||(Array.prototype.find=function(e,t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=Object(this),i=n.length>>>0,r=t,o,u=0;u<i;u++)if(o=n[u],e.call(r,o,u,n))return o}),window&&"function"!=typeof window.CustomEvent){var s=function e(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),i};void 0!==window.Event&&(s.prototype=window.Event.prototype),window.CustomEvent=s}var c=function(){function t(n){e(this,t),this.tribute=n,this.tribute.events=this}return n(t,[{key:"bind",value:function e(t){t.boundKeydown=this.keydown.bind(t,this),t.boundKeyup=this.keyup.bind(t,this),t.boundInput=this.input.bind(t,this),t.addEventListener("keydown",t.boundKeydown,!1),t.addEventListener("keyup",t.boundKeyup,!1),t.addEventListener("input",t.boundInput,!1)}},{key:"unbind",value:function e(t){t.removeEventListener("keydown",t.boundKeydown,!1),t.removeEventListener("keyup",t.boundKeyup,!1),t.removeEventListener("input",t.boundInput,!1),delete t.boundKeydown,delete t.boundKeyup,delete t.boundInput}},{key:"keydown",value:function e(n,i){n.shouldDeactivate(i)&&(n.tribute.isActive=!1,n.tribute.hideMenu());var r=this;n.commandEvent=!1,t.keys().forEach((function(e){e.key===i.keyCode&&(n.commandEvent=!0,n.callbacks()[e.value.toLowerCase()](i,r))}))}},{key:"input",value:function e(t,n){t.inputEvent=!0,t.keyup.call(this,t,n)}},{key:"click",value:function e(t,n){var i=t.tribute;if(i.menu&&i.menu.contains(n.target)){var r=n.target;for(n.preventDefault(),n.stopPropagation();"li"!==r.nodeName.toLowerCase();)if(!(r=r.parentNode)||r===i.menu)throw new Error("cannot find the <li> container for the click");i.selectItemAtIndex(r.getAttribute("data-index"),n),i.hideMenu()}else i.current.element&&!i.current.externalTrigger&&(i.current.externalTrigger=!1,setTimeout((function(){return i.hideMenu()})))}},{key:"keyup",value:function e(t,n){if(t.inputEvent&&(t.inputEvent=!1),t.updateSelection(this),27!==n.keyCode){if(!t.tribute.allowSpaces&&t.tribute.hasTrailingSpace)return t.tribute.hasTrailingSpace=!1,t.commandEvent=!0,void t.callbacks().space(n,this);if(!t.tribute.isActive)if(t.tribute.autocompleteMode)t.callbacks().triggerChar(n,this,"");else{var i=t.getKeyCode(t,this,n);if(isNaN(i)||!i)return;var r=t.tribute.triggers().find((function(e){return e.charCodeAt(0)===i}));void 0!==r&&t.callbacks().triggerChar(n,this,r)}t.tribute.current.mentionText.length<t.tribute.current.collection.menuShowMinLength||((t.tribute.current.trigger||t.tribute.autocompleteMode)&&!1===t.commandEvent||t.tribute.isActive&&8===n.keyCode)&&t.tribute.showMenuFor(this,!0)}}},{key:"shouldDeactivate",value:function e(n){if(!this.tribute.isActive)return!1;if(0===this.tribute.current.mentionText.length){var i=!1;return t.keys().forEach((function(e){n.keyCode===e.key&&(i=!0)})),!i}return!1}},{key:"getKeyCode",value:function e(t,n,i){var r=t.tribute,o=r.range.getTriggerInfo(!1,r.hasTrailingSpace,!0,r.allowSpaces,r.autocompleteMode);return!!o&&o.mentionTriggerChar.charCodeAt(0)}},{key:"updateSelection",value:function e(t){this.tribute.current.element=t;var n=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);n&&(this.tribute.current.selectedPath=n.mentionSelectedPath,this.tribute.current.mentionText=n.mentionText,this.tribute.current.selectedOffset=n.mentionSelectedOffset)}},{key:"callbacks",value:function e(){var t=this;return{triggerChar:function e(n,i,r){var o=t.tribute;o.current.trigger=r;var u=o.collection.find((function(e){return e.trigger===r}));o.current.collection=u,o.current.mentionText.length>=o.current.collection.menuShowMinLength&&o.inputEvent&&o.showMenuFor(i,!0)},enter:function e(n,i){t.tribute.isActive&&t.tribute.current.filteredItems&&(n.preventDefault(),n.stopPropagation(),setTimeout((function(){t.tribute.selectItemAtIndex(t.tribute.menuSelected,n),t.tribute.hideMenu()}),0))},escape:function e(n,i){t.tribute.isActive&&(n.preventDefault(),n.stopPropagation(),t.tribute.isActive=!1,t.tribute.hideMenu())},tab:function e(n,i){t.callbacks().enter(n,i)},space:function e(n,i){t.tribute.isActive&&(t.tribute.spaceSelectsMatch?t.callbacks().enter(n,i):t.tribute.allowSpaces||(n.stopPropagation(),setTimeout((function(){t.tribute.hideMenu(),t.tribute.isActive=!1}),0)))},up:function e(n,i){if(t.tribute.isActive&&t.tribute.current.filteredItems){n.preventDefault(),n.stopPropagation();var r=t.tribute.current.filteredItems.length,o=t.tribute.menuSelected;r>o&&o>0?(t.tribute.menuSelected--,t.setActiveLi()):0===o&&(t.tribute.menuSelected=r-1,t.setActiveLi(),t.tribute.menu.scrollTop=t.tribute.menu.scrollHeight)}},down:function e(n,i){if(t.tribute.isActive&&t.tribute.current.filteredItems){n.preventDefault(),n.stopPropagation();var r=t.tribute.current.filteredItems.length-1,o=t.tribute.menuSelected;r>o?(t.tribute.menuSelected++,t.setActiveLi()):r===o&&(t.tribute.menuSelected=0,t.setActiveLi(),t.tribute.menu.scrollTop=0)}},delete:function e(n,i){t.tribute.isActive&&t.tribute.current.mentionText.length<1?t.tribute.hideMenu():t.tribute.isActive&&t.tribute.showMenuFor(i)}}}},{key:"setActiveLi",value:function e(t){var n=this.tribute.menu.querySelectorAll("li"),i=n.length>>>0;t&&(this.tribute.menuSelected=parseInt(t));for(var r=0;r<i;r++){var o=n[r];if(r===this.tribute.menuSelected){o.classList.add(this.tribute.current.collection.selectClass);var u=o.getBoundingClientRect(),a=this.tribute.menu.getBoundingClientRect();if(u.bottom>a.bottom){var l=u.bottom-a.bottom;this.tribute.menu.scrollTop+=l}else if(u.top<a.top){var s=a.top-u.top;this.tribute.menu.scrollTop-=s}}else o.classList.remove(this.tribute.current.collection.selectClass)}}},{key:"getFullHeight",value:function e(t,n){var i=t.getBoundingClientRect().height;if(n){var r=t.currentStyle||window.getComputedStyle(t);return i+parseFloat(r.marginTop)+parseFloat(r.marginBottom)}return i}}],[{key:"keys",value:function e(){return[{key:9,value:"TAB"},{key:8,value:"DELETE"},{key:13,value:"ENTER"},{key:27,value:"ESCAPE"},{key:32,value:"SPACE"},{key:38,value:"UP"},{key:40,value:"DOWN"}]}}]),t}(),h=function(){function t(n){e(this,t),this.tribute=n,this.tribute.menuEvents=this,this.menu=this.tribute.menu}return n(t,[{key:"bind",value:function e(t){var n=this;this.menuClickEvent=this.tribute.events.click.bind(null,this),this.menuContainerScrollEvent=this.debounce((function(){n.tribute.isActive&&n.tribute.hideMenu()}),10,!1),this.windowResizeEvent=this.debounce((function(){n.tribute.isActive&&n.tribute.hideMenu()}),10,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}},{key:"unbind",value:function e(t){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}},{key:"debounce",value:function e(t,n,i){var r=arguments,o=this,u;return function(){var e=o,a=r,l=function n(){u=null,i||t.apply(e,a)},s=i&&!u;clearTimeout(u),u=setTimeout(l,n),s&&t.apply(e,a)}}}]),t}(),d=function(){function t(n){e(this,t),this.tribute=n,this.tribute.range=this}return n(t,[{key:"getDocument",value:function e(){var t;return this.tribute.current.collection&&(t=this.tribute.current.collection.iframe),t?t.contentWindow.document:document}},{key:"positionMenuAtCaret",value:function e(t){var n=this.tribute.current,i,r=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==r){if(!this.tribute.positionMenu)return void(this.tribute.menu.style.cssText="display: block;");i=this.isContentEditable(n.element)?this.getContentEditableCaretPosition(r.mentionPosition):this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,r.mentionPosition),this.tribute.menu.style.cssText="top: ".concat(i.top,"px;\n left: ").concat(i.left,"px;\n right: ").concat(i.right,"px;\n bottom: ").concat(i.bottom,"px;\n max-height: ").concat(i.maxHeight||500,"px;\n max-width: ").concat(i.maxWidth||300,"px;\n position: ").concat(i.position||"absolute",";\n display: block;"),"auto"===i.left&&(this.tribute.menu.style.left="auto"),"auto"===i.top&&(this.tribute.menu.style.top="auto"),t&&this.scrollIntoView()}else this.tribute.menu.style.cssText="display: none"}},{key:"selectElement",value:function e(t,n,i){var r,o=t;if(n)for(var u=0;u<n.length;u++){if(void 0===(o=o.childNodes[n[u]]))return;for(;o.length<i;)i-=o.length,o=o.nextSibling;0!==o.childNodes.length||o.length||(o=o.previousSibling)}var a=this.getWindowSelection();(r=this.getDocument().createRange()).setStart(o,i),r.setEnd(o,i),r.collapse(!0);try{a.removeAllRanges()}catch(e){}a.addRange(r),t.focus()}},{key:"replaceTriggerText",value:function e(t,n,i,r,o){var u=this.getTriggerInfo(!0,i,n,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==u){var a=this.tribute.current,l=new CustomEvent("tribute-replaced",{detail:{item:o,instance:a,context:u,event:r}});if(this.isContentEditable(a.element)){var s;t+="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";var c=u.mentionPosition+u.mentionText.length;this.tribute.autocompleteMode||(c+=u.mentionTriggerChar.length),this.pasteHtml(t,u.mentionPosition,c)}else{var h=this.tribute.current.element,d="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";t+=d;var f=u.mentionPosition,m=u.mentionPosition+u.mentionText.length+d.length;this.tribute.autocompleteMode||(m+=u.mentionTriggerChar.length-1),h.value=h.value.substring(0,f)+t+h.value.substring(m,h.value.length),h.selectionStart=f+t.length,h.selectionEnd=f+t.length}a.element.dispatchEvent(new CustomEvent("input",{bubbles:!0})),a.element.dispatchEvent(l)}}},{key:"pasteHtml",value:function e(t,n,i){var r,o;o=this.getWindowSelection(),(r=this.getDocument().createRange()).setStart(o.anchorNode,n),r.setEnd(o.anchorNode,i),r.deleteContents();var u=this.getDocument().createElement("div");u.innerHTML=t;for(var a=this.getDocument().createDocumentFragment(),l,s;l=u.firstChild;)s=a.appendChild(l);r.insertNode(a),s&&((r=r.cloneRange()).setStartAfter(s),r.collapse(!0),o.removeAllRanges(),o.addRange(r))}},{key:"getWindowSelection",value:function e(){return this.tribute.collection.iframe?this.tribute.collection.iframe.contentWindow.getSelection():window.getSelection()}},{key:"getNodePositionInParent",value:function e(t){if(null===t.parentNode)return 0;for(var n=0;n<t.parentNode.childNodes.length;n++){var i;if(t.parentNode.childNodes[n]===t)return n}}},{key:"getContentEditableSelectedPath",value:function e(t){var n=this.getWindowSelection(),i=n.anchorNode,r=[],o;if(null!=i){for(var u,a=i.contentEditable;null!==i&&"true"!==a;)u=this.getNodePositionInParent(i),r.push(u),null!==(i=i.parentNode)&&(a=i.contentEditable);return r.reverse(),{selected:i,path:r,offset:o=n.getRangeAt(0).startOffset}}}},{key:"getTextPrecedingCurrentSelection",value:function e(){var t=this.tribute.current,n="";if(this.isContentEditable(t.element)){var i=this.getWindowSelection().anchorNode;if(null!=i){var r=i.textContent,o=this.getWindowSelection().getRangeAt(0).startOffset;r&&o>=0&&(n=r.substring(0,o))}}else{var u=this.tribute.current.element;if(u){var a=u.selectionStart;u.value&&a>=0&&(n=u.value.substring(0,a))}}return n}},{key:"getLastWordInText",value:function e(t){var n,i;return t=t.replace(/\u00A0/g," "),(n=this.tribute.autocompleteSeparator?t.split(this.tribute.autocompleteSeparator):t.split(/\s+/))[n.length-1].trim()}},{key:"getTriggerInfo",value:function e(t,n,i,r,o){var u=this,a=this.tribute.current,l,s,c;if(this.isContentEditable(a.element)){var h=this.getContentEditableSelectedPath(a);h&&(l=h.selected,s=h.path,c=h.offset)}else l=this.tribute.current.element;var d=this.getTextPrecedingCurrentSelection(),f=this.getLastWordInText(d);if(o)return{mentionPosition:d.length-f.length,mentionText:f,mentionSelectedElement:l,mentionSelectedPath:s,mentionSelectedOffset:c};if(null!=d){var m=-1,p;if(this.tribute.collection.forEach((function(e){var t=e.trigger,n=e.requireLeadingSpace?u.lastIndexWithLeadingSpace(d,t):d.lastIndexOf(t);n>m&&(m=n,p=t,i=e.requireLeadingSpace)})),m>=0&&(0===m||!i||/[\xA0\s]/g.test(d.substring(m-1,m)))){var v=d.substring(m+p.length,d.length);p=d.substring(m,m+p.length);var g=v.substring(0,1),b=v.length>0&&(" "===g||" "===g);n&&(v=v.trim());var y=r?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=y.test(v),!b&&(t||!y.test(v)))return{mentionPosition:m,mentionText:v,mentionSelectedElement:l,mentionSelectedPath:s,mentionSelectedOffset:c,mentionTriggerChar:p}}}}},{key:"lastIndexWithLeadingSpace",value:function e(t,n){for(var i=t.split("").reverse().join(""),r=-1,o=0,u=t.length;o<u;o++){for(var a=o===t.length-1,l=/\s/.test(i[o+1]),s=!0,c=n.length-1;c>=0;c--)if(n[c]!==i[o-c]){s=!1;break}if(s&&(a||l)){r=t.length-1-o;break}}return r}},{key:"isContentEditable",value:function e(t){return"INPUT"!==t.nodeName&&"TEXTAREA"!==t.nodeName}},{key:"isMenuOffScreen",value:function e(t,n){var i=window.innerWidth,r=window.innerHeight,o=document.documentElement,u=(window.pageXOffset||o.scrollLeft)-(o.clientLeft||0),a=(window.pageYOffset||o.scrollTop)-(o.clientTop||0),l="number"==typeof t.top?t.top:a+r-t.bottom-n.height,s="number"==typeof t.right?t.right:t.left+n.width,c="number"==typeof t.bottom?t.bottom:t.top+n.height,h="number"==typeof t.left?t.left:u+i-t.right-n.width;return{top:l<Math.floor(a),right:s>Math.ceil(u+i),bottom:c>Math.ceil(a+r),left:h<Math.floor(u)}}},{key:"getMenuDimensions",value:function e(){var t={width:null,height:null};return this.tribute.menu.style.cssText="top: 0px;\n left: 0px;\n position: fixed;\n display: block;\n visibility; hidden;\n max-height:500px;",t.width=this.tribute.menu.offsetWidth,t.height=this.tribute.menu.offsetHeight,this.tribute.menu.style.cssText="display: none;",t}},{key:"getTextAreaOrInputUnderlinePosition",value:function e(t,n,i){var r=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"],o=this.getDocument().createElement("div");o.id="input-textarea-caret-position-mirror-div",this.getDocument().body.appendChild(o);var u=o.style,a=window.getComputedStyle?getComputedStyle(t):t.currentStyle;u.whiteSpace="pre-wrap","INPUT"!==t.nodeName&&(u.wordWrap="break-word"),u.position="absolute",u.visibility="hidden",r.forEach((function(e){u[e]=a[e]}));var l=document.createElement("span");l.textContent=t.value.substring(0,n),o.appendChild(l),"INPUT"===t.nodeName&&(o.textContent=o.textContent.replace(/\s/g," "));var s=this.getDocument().createElement("span");s.textContent="​",o.appendChild(s);var c=this.getDocument().createElement("span");c.textContent=t.value.substring(n),o.appendChild(c);var h=t.getBoundingClientRect();o.style.position="fixed",o.style.left=h.left+"px",o.style.top=h.top+"px",o.style.width=h.width+"px",o.style.height=h.height+"px",o.scrollTop=t.scrollTop;var d=s.getBoundingClientRect();return this.getDocument().body.removeChild(o),this.getFixedCoordinatesRelativeToRect(d)}},{key:"getContentEditableCaretPosition",value:function e(t){var n,i=this.getWindowSelection();(n=this.getDocument().createRange()).setStart(i.anchorNode,t),n.setEnd(i.anchorNode,t),n.collapse(!1);var r=n.getBoundingClientRect();return this.getFixedCoordinatesRelativeToRect(r)}},{key:"getFixedCoordinatesRelativeToRect",value:function e(t){var n={position:"fixed",left:t.left,top:t.top+t.height},i=this.getMenuDimensions(),r=t.top,o=window.innerHeight-(t.top+t.height);o<i.height&&(r>=i.height||r>o?(n.top="auto",n.bottom=window.innerHeight-t.top,o<i.height&&(n.maxHeight=r)):r<i.height&&(n.maxHeight=o));var u=t.left,a=window.innerWidth-t.left;return a<i.width&&(u>=i.width||u>a?(n.left="auto",n.right=window.innerWidth-t.left,a<i.width&&(n.maxWidth=u)):u<i.width&&(n.maxWidth=a)),n}},{key:"scrollIntoView",value:function e(t){var n=20,i,r=100,o=this.menu;if(void 0!==o){for(;void 0===i||0===i.height;)if(0===(i=o.getBoundingClientRect()).height&&(void 0===(o=o.childNodes[0])||!o.getBoundingClientRect))return;var u=i.top,a=u+i.height;if(u<0)window.scrollTo(0,window.pageYOffset+i.top-n);else if(a>window.innerHeight){var l=window.pageYOffset+i.top-n;l-window.pageYOffset>r&&(l=window.pageYOffset+r);var s=window.pageYOffset-(window.innerHeight-a);s>l&&(s=l),window.scrollTo(0,s)}}}},{key:"menuContainerIsBody",get:function e(){return this.tribute.menuContainer===document.body||!this.tribute.menuContainer}}]),t}(),f=function(){function t(n){e(this,t),this.tribute=n,this.tribute.search=this}return n(t,[{key:"simpleFilter",value:function e(t,n){var i=this;return n.filter((function(e){return i.test(t,e)}))}},{key:"test",value:function e(t,n){return null!==this.match(t,n)}},{key:"match",value:function e(t,n,i){i=i||{};var r=n.length,o=i.pre||"",u=i.post||"",a=i.caseSensitive&&n||n.toLowerCase();if(i.skip)return{rendered:n,score:0};t=i.caseSensitive&&t||t.toLowerCase();var l=this.traverse(a,t,0,0,[]);return l?{rendered:this.render(n,l.cache,o,u),score:l.score}:null}},{key:"traverse",value:function e(t,n,i,r,o){if(this.tribute.autocompleteSeparator&&(n=n.split(this.tribute.autocompleteSeparator).splice(-1)[0]),n.length===r)return{score:this.calculateScore(o),cache:o.slice()};if(!(t.length===i||n.length-r>t.length-i)){for(var u=n[r],a=t.indexOf(u,i),l,s;a>-1;){if(o.push(a),s=this.traverse(t,n,a+1,r+1,o),o.pop(),!s)return l;(!l||l.score<s.score)&&(l=s),a=t.indexOf(u,a+1)}return l}}},{key:"calculateScore",value:function e(t){var n=0,i=1;return t.forEach((function(e,r){r>0&&(t[r-1]+1===e?i+=i+1:i=1),n+=i})),n}},{key:"render",value:function e(t,n,i,r){var o=t.substring(0,n[0]);return n.forEach((function(e,u){o+=i+t[e]+r+t.substring(e+1,n[u+1]?n[u+1]:t.length)})),o}},{key:"filter",value:function e(t,n,i){var r=this;return i=i||{},n.reduce((function(e,n,o,u){var a=n;i.extract&&((a=i.extract(n))||(a=""));var l=r.match(t,a,i);return null!=l&&(e[e.length]={string:l.rendered,score:l.score,index:o,original:n}),e}),[]).sort((function(e,t){var n=t.score-e.score;return n||e.index-t.index}))}}]),t}(),m;return function(){function t(n){var i=this,r=n.values,o=void 0===r?null:r,u=n.loadingItemTemplate,a=void 0===u?null:u,l=n.iframe,s=void 0===l?null:l,m=n.selectClass,p=void 0===m?"highlight":m,v=n.containerClass,g=void 0===v?"tribute-container":v,b=n.itemClass,y=void 0===b?"":b,w=n.trigger,T=void 0===w?"@":w,S=n.autocompleteMode,C=void 0!==S&&S,k=n.autocompleteSeparator,E=void 0===k?null:k,x=n.selectTemplate,A=void 0===x?null:x,M=n.menuItemTemplate,L=void 0===M?null:M,I=n.lookup,N=void 0===I?"key":I,P=n.fillAttr,R=void 0===P?"value":P,D=n.collection,O=void 0===D?null:D,W=n.menuContainer,H=void 0===W?null:W,F=n.noMatchTemplate,_=void 0===F?null:F,B=n.requireLeadingSpace,j=void 0===B||B,K=n.allowSpaces,q=void 0!==K&&K,U=n.replaceTextSuffix,z=void 0===U?null:U,Y=n.positionMenu,Q=void 0===Y||Y,X=n.spaceSelectsMatch,V=void 0!==X&&X,G=n.searchOpts,J=void 0===G?{}:G,Z=n.menuItemLimit,ee=void 0===Z?null:Z,te=n.menuShowMinLength,ne=void 0===te?0:te,ie;if(e(this,t),this.autocompleteMode=C,this.autocompleteSeparator=E,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=H,this.allowSpaces=q,this.replaceTextSuffix=z,this.positionMenu=Q,this.hasTrailingSpace=!1,this.spaceSelectsMatch=V,this.autocompleteMode&&(T="",q=!1),o)this.collection=[{trigger:T,iframe:s,selectClass:p,containerClass:g,itemClass:y,selectTemplate:(A||t.defaultSelectTemplate).bind(this),menuItemTemplate:(L||t.defaultMenuItemTemplate).bind(this),noMatchTemplate:(ie=_,"string"==typeof ie?""===ie.trim()?null:ie:"function"==typeof ie?ie.bind(i):_||function(){return"<li>No Match Found!</li>"}.bind(i)),lookup:N,fillAttr:R,values:o,loadingItemTemplate:a,requireLeadingSpace:j,searchOpts:J,menuItemLimit:ee,menuShowMinLength:ne}];else{if(!O)throw new Error("[Tribute] No collection specified.");this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=O.map((function(e){return{trigger:e.trigger||T,iframe:e.iframe||s,selectClass:e.selectClass||p,containerClass:e.containerClass||g,itemClass:e.itemClass||y,selectTemplate:(e.selectTemplate||t.defaultSelectTemplate).bind(i),menuItemTemplate:(e.menuItemTemplate||t.defaultMenuItemTemplate).bind(i),noMatchTemplate:function(e){return"string"==typeof e?""===e.trim()?null:e:"function"==typeof e?e.bind(i):_||function(){return"<li>No Match Found!</li>"}.bind(i)}(_),lookup:e.lookup||N,fillAttr:e.fillAttr||R,values:e.values,loadingItemTemplate:e.loadingItemTemplate,requireLeadingSpace:e.requireLeadingSpace,searchOpts:e.searchOpts||J,menuItemLimit:e.menuItemLimit||ee,menuShowMinLength:e.menuShowMinLength||ne}}))}new d(this),new c(this),new h(this),new f(this)}return n(t,[{key:"triggers",value:function e(){return this.collection.map((function(e){return e.trigger}))}},{key:"attach",value:function e(t){if(!t)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&t instanceof jQuery&&(t=t.get()),t.constructor===NodeList||t.constructor===HTMLCollection||t.constructor===Array)for(var n=t.length,i=0;i<n;++i)this._attach(t[i]);else this._attach(t)}},{key:"_attach",value:function e(t){t.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+t.nodeName),this.ensureEditable(t),this.events.bind(t),t.setAttribute("data-tribute",!0)}},{key:"ensureEditable",value:function e(n){if(-1===t.inputTypes().indexOf(n.nodeName)){if(!n.contentEditable)throw new Error("[Tribute] Cannot bind to "+n.nodeName);n.contentEditable=!0}}},{key:"createMenu",value:function e(t){var n=this.range.getDocument().createElement("div"),i=this.range.getDocument().createElement("ul");return n.className=t,n.appendChild(i),this.menuContainer?this.menuContainer.appendChild(n):this.range.getDocument().body.appendChild(n)}},{key:"showMenuFor",value:function e(t,n){var r=this;if(!this.isActive||this.current.element!==t||this.current.mentionText!==this.currentMentionTextSnapshot){this.currentMentionTextSnapshot=this.current.mentionText,this.menu||(this.menu=this.createMenu(this.current.collection.containerClass),t.tributeMenu=this.menu,this.menuEvents.bind(this.menu)),this.isActive=!0,this.menuSelected=0,this.current.mentionText||(this.current.mentionText="");var o=function e(t){if(r.isActive){var o=r.search.filter(r.current.mentionText,t,{pre:r.current.collection.searchOpts.pre||"<span>",post:r.current.collection.searchOpts.post||"</span>",skip:r.current.collection.searchOpts.skip,extract:function e(t){if("string"==typeof r.current.collection.lookup)return t[r.current.collection.lookup];if("function"==typeof r.current.collection.lookup)return r.current.collection.lookup(t,r.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});r.current.collection.menuItemLimit&&(o=o.slice(0,r.current.collection.menuItemLimit)),r.current.filteredItems=o;var u=r.menu.querySelector("ul");if(!o.length){var a=new CustomEvent("tribute-no-match",{detail:r.menu});return r.current.element.dispatchEvent(a),void("function"==typeof r.current.collection.noMatchTemplate&&!r.current.collection.noMatchTemplate()||!r.current.collection.noMatchTemplate?r.hideMenu():("function"==typeof r.current.collection.noMatchTemplate?u.innerHTML=r.current.collection.noMatchTemplate():u.innerHTML=r.current.collection.noMatchTemplate,r.range.positionMenuAtCaret(n)))}u.innerHTML="";var l=r.range.getDocument().createDocumentFragment();o.forEach((function(e,t){var n=r.range.getDocument().createElement("li");n.setAttribute("data-index",t),n.className=r.current.collection.itemClass,n.addEventListener("mousemove",(function(e){var t,n=i(r._findLiTarget(e.target),2),o=n[0],u=n[1];0!==e.movementY&&r.events.setActiveLi(u)})),r.menuSelected===t&&n.classList.add(r.current.collection.selectClass),n.innerHTML=r.current.collection.menuItemTemplate(e),l.appendChild(n)})),u.appendChild(l),r.range.positionMenuAtCaret(n)}};"function"==typeof this.current.collection.values?(this.current.collection.loadingItemTemplate&&(this.menu.querySelector("ul").innerHTML=this.current.collection.loadingItemTemplate,this.range.positionMenuAtCaret(n)),this.current.collection.values(this.current.mentionText,o)):o(this.current.collection.values)}}},{key:"_findLiTarget",value:function e(t){if(!t)return[];var n=t.getAttribute("data-index");return n?[t,n]:this._findLiTarget(t.parentNode)}},{key:"showMenuForCollection",value:function e(t,n){t!==document.activeElement&&this.placeCaretAtEnd(t),this.current.collection=this.collection[n||0],this.current.externalTrigger=!0,this.current.element=t,t.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(t,this.current.collection.trigger),this.showMenuFor(t)}},{key:"placeCaretAtEnd",value:function e(t){if(t.focus(),void 0!==window.getSelection&&void 0!==document.createRange){var n=document.createRange();n.selectNodeContents(t),n.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(n)}else if(void 0!==document.body.createTextRange){var r=document.body.createTextRange();r.moveToElementText(t),r.collapse(!1),r.select()}}},{key:"insertTextAtCursor",value:function e(t){var n,i;(i=(n=window.getSelection()).getRangeAt(0)).deleteContents();var r=document.createTextNode(t);i.insertNode(r),i.selectNodeContents(r),i.collapse(!1),n.removeAllRanges(),n.addRange(i)}},{key:"insertAtCaret",value:function e(t,n){var i=t.scrollTop,r=t.selectionStart,o=t.value.substring(0,r),u=t.value.substring(t.selectionEnd,t.value.length);t.value=o+n+u,r+=n.length,t.selectionStart=r,t.selectionEnd=r,t.focus(),t.scrollTop=i}},{key:"hideMenu",value:function e(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}},{key:"selectItemAtIndex",value:function e(t,n){if("number"==typeof(t=parseInt(t))&&!isNaN(t)){var i=this.current.filteredItems[t],r=this.current.collection.selectTemplate(i);null!==r&&this.replaceText(r,n,i)}}},{key:"replaceText",value:function e(t,n,i){this.range.replaceTriggerText(t,!0,!0,n,i)}},{key:"_append",value:function e(t,n,i){if("function"==typeof t.values)throw new Error("Unable to append to values, as it is a function.");t.values=i?n:t.values.concat(n)}},{key:"append",value:function e(t,n,i){var r=parseInt(t);if("number"!=typeof r)throw new Error("please provide an index for the collection to update.");var o=this.collection[r];this._append(o,n,i)}},{key:"appendCurrent",value:function e(t,n){if(!this.isActive)throw new Error("No active state. Please use append instead and pass an index.");this._append(this.current.collection,t,n)}},{key:"detach",value:function e(t){if(!t)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&t instanceof jQuery&&(t=t.get()),t.constructor===NodeList||t.constructor===HTMLCollection||t.constructor===Array)for(var n=t.length,i=0;i<n;++i)this._detach(t[i]);else this._detach(t)}},{key:"_detach",value:function e(t){var n=this;this.events.unbind(t),t.tributeMenu&&this.menuEvents.unbind(t.tributeMenu),setTimeout((function(){t.removeAttribute("data-tribute"),n.isActive=!1,t.tributeMenu&&t.tributeMenu.remove()}))}},{key:"isActive",get:function e(){return this._isActive},set:function e(t){if(this._isActive!=t&&(this._isActive=t,this.current.element)){var n=new CustomEvent("tribute-active-".concat(t));this.current.element.dispatchEvent(n)}}}],[{key:"defaultSelectTemplate",value:function e(t){return void 0===t?"".concat(this.current.collection.trigger).concat(this.current.mentionText):this.range.isContentEditable(this.current.element)?'<span class="tribute-mention">'+(this.current.collection.trigger+t.original[this.current.collection.fillAttr])+"</span>":this.current.collection.trigger+t.original[this.current.collection.fillAttr]}},{key:"defaultMenuItemTemplate",value:function e(t){return t.string}},{key:"inputTypes",value:function e(){return["TEXTAREA","INPUT"]}}]),t}()}));1 !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Tribute=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,r=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(i=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw o}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}if(Array.prototype.find||(Array.prototype.find=function(e){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,n=Object(this),i=n.length>>>0,r=arguments[1],o=0;o<i;o++)if(t=n[o],e.call(r,t,o,n))return t}),window&&"function"!=typeof window.CustomEvent){var o=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};void 0!==window.Event&&(o.prototype=window.Event.prototype),window.CustomEvent=o}var u=function(){function t(n){e(this,t),this.tribute=n,this.tribute.events=this}return n(t,[{key:"bind",value:function(e){e.boundKeydown=this.keydown.bind(e,this),e.boundKeyup=this.keyup.bind(e,this),e.boundInput=this.input.bind(e,this),e.addEventListener("keydown",e.boundKeydown,!1),e.addEventListener("keyup",e.boundKeyup,!1),e.addEventListener("input",e.boundInput,!1)}},{key:"unbind",value:function(e){e.removeEventListener("keydown",e.boundKeydown,!1),e.removeEventListener("keyup",e.boundKeyup,!1),e.removeEventListener("input",e.boundInput,!1),delete e.boundKeydown,delete e.boundKeyup,delete e.boundInput}},{key:"keydown",value:function(e,n){e.shouldDeactivate(n)&&(e.tribute.isActive=!1,e.tribute.hideMenu());var i=this;e.commandEvent=!1,t.keys().forEach((function(t){t.key===n.keyCode&&(e.commandEvent=!0,e.callbacks()[t.value.toLowerCase()](n,i))}))}},{key:"input",value:function(e,t){e.inputEvent=!0,e.keyup.call(this,e,t)}},{key:"click",value:function(e,t){var n=e.tribute;if(n.menu&&n.menu.contains(t.target)){var i=t.target;for(t.preventDefault(),t.stopPropagation();"li"!==i.nodeName.toLowerCase();)if(!(i=i.parentNode)||i===n.menu)throw new Error("cannot find the <li> container for the click");n.selectItemAtIndex(i.getAttribute("data-index"),t),n.hideMenu()}else n.current.element&&!n.current.externalTrigger&&(n.current.externalTrigger=!1,setTimeout((function(){return n.hideMenu()})))}},{key:"keyup",value:function(e,t){if(e.inputEvent&&(e.inputEvent=!1),e.updateSelection(this),27!==t.keyCode){if(!e.tribute.allowSpaces&&e.tribute.hasTrailingSpace)return e.tribute.hasTrailingSpace=!1,e.commandEvent=!0,void e.callbacks().space(t,this);if(!e.tribute.isActive)if(e.tribute.autocompleteMode)e.callbacks().triggerChar(t,this,"");else{var n=e.getKeyCode(e,this,t);if(isNaN(n)||!n)return;var i=e.tribute.triggers().find((function(e){return e.charCodeAt(0)===n}));void 0!==i&&e.callbacks().triggerChar(t,this,i)}e.tribute.current.mentionText.length<e.tribute.current.collection.menuShowMinLength||((e.tribute.current.trigger||e.tribute.autocompleteMode)&&!1===e.commandEvent||e.tribute.isActive&&8===t.keyCode)&&e.tribute.showMenuFor(this,!0)}}},{key:"shouldDeactivate",value:function(e){if(!this.tribute.isActive)return!1;if(0===this.tribute.current.mentionText.length){var n=!1;return t.keys().forEach((function(t){e.keyCode===t.key&&(n=!0)})),!n}return!1}},{key:"getKeyCode",value:function(e,t,n){var i=e.tribute,r=i.range.getTriggerInfo(!1,i.hasTrailingSpace,!0,i.allowSpaces,i.autocompleteMode);return!!r&&r.mentionTriggerChar.charCodeAt(0)}},{key:"updateSelection",value:function(e){this.tribute.current.element=e;var t=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);t&&(this.tribute.current.selectedPath=t.mentionSelectedPath,this.tribute.current.mentionText=t.mentionText,this.tribute.current.selectedOffset=t.mentionSelectedOffset)}},{key:"callbacks",value:function(){var e=this;return{triggerChar:function(t,n,i){var r=e.tribute;r.current.trigger=i;var o=r.collection.find((function(e){return e.trigger===i}));r.current.collection=o,r.current.mentionText.length>=r.current.collection.menuShowMinLength&&r.inputEvent&&r.showMenuFor(n,!0)},enter:function(t,n){e.tribute.isActive&&e.tribute.current.filteredItems&&(t.preventDefault(),t.stopPropagation(),setTimeout((function(){e.tribute.selectItemAtIndex(e.tribute.menuSelected,t),e.tribute.hideMenu()}),0))},escape:function(t,n){e.tribute.isActive&&(t.preventDefault(),t.stopPropagation(),e.tribute.isActive=!1,e.tribute.hideMenu())},tab:function(t,n){e.callbacks().enter(t,n)},space:function(t,n){e.tribute.isActive&&(e.tribute.spaceSelectsMatch?e.callbacks().enter(t,n):e.tribute.allowSpaces||(t.stopPropagation(),setTimeout((function(){e.tribute.hideMenu(),e.tribute.isActive=!1}),0)))},up:function(t,n){if(e.tribute.isActive&&e.tribute.current.filteredItems){t.preventDefault(),t.stopPropagation();var i=e.tribute.current.filteredItems.length,r=e.tribute.menuSelected;i>r&&r>0?(e.tribute.menuSelected--,e.setActiveLi()):0===r&&(e.tribute.menuSelected=i-1,e.setActiveLi(),e.tribute.menu.scrollTop=e.tribute.menu.scrollHeight)}},down:function(t,n){if(e.tribute.isActive&&e.tribute.current.filteredItems){t.preventDefault(),t.stopPropagation();var i=e.tribute.current.filteredItems.length-1,r=e.tribute.menuSelected;i>r?(e.tribute.menuSelected++,e.setActiveLi()):i===r&&(e.tribute.menuSelected=0,e.setActiveLi(),e.tribute.menu.scrollTop=0)}},delete:function(t,n){e.tribute.isActive&&e.tribute.current.mentionText.length<1?e.tribute.hideMenu():e.tribute.isActive&&e.tribute.showMenuFor(n)}}}},{key:"setActiveLi",value:function(e){var t=this.tribute.menu.querySelectorAll("li"),n=t.length>>>0;e&&(this.tribute.menuSelected=parseInt(e));for(var i=0;i<n;i++){var r=t[i];if(i===this.tribute.menuSelected){r.classList.add(this.tribute.current.collection.selectClass);var o=r.getBoundingClientRect(),u=this.tribute.menu.getBoundingClientRect();if(o.bottom>u.bottom){var a=o.bottom-u.bottom;this.tribute.menu.scrollTop+=a}else if(o.top<u.top){var l=u.top-o.top;this.tribute.menu.scrollTop-=l}}else r.classList.remove(this.tribute.current.collection.selectClass)}}},{key:"getFullHeight",value:function(e,t){var n=e.getBoundingClientRect().height;if(t){var i=e.currentStyle||window.getComputedStyle(e);return n+parseFloat(i.marginTop)+parseFloat(i.marginBottom)}return n}}],[{key:"keys",value:function(){return[{key:9,value:"TAB"},{key:8,value:"DELETE"},{key:13,value:"ENTER"},{key:27,value:"ESCAPE"},{key:32,value:"SPACE"},{key:38,value:"UP"},{key:40,value:"DOWN"}]}}]),t}(),a=function(){function t(n){e(this,t),this.tribute=n,this.tribute.menuEvents=this,this.menu=this.tribute.menu}return n(t,[{key:"bind",value:function(e){var t=this;this.menuClickEvent=this.tribute.events.click.bind(null,this),this.menuContainerScrollEvent=this.debounce((function(){t.tribute.isActive&&t.tribute.hideMenu()}),10,!1),this.windowResizeEvent=this.debounce((function(){t.tribute.isActive&&t.tribute.hideMenu()}),10,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}},{key:"unbind",value:function(e){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}},{key:"debounce",value:function(e,t,n){var i,r=arguments,o=this;return function(){var u=o,a=r,l=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||e.apply(u,a)}),t),l&&e.apply(u,a)}}}]),t}(),l=function(){function t(n){e(this,t),this.tribute=n,this.tribute.range=this}return n(t,[{key:"getDocument",value:function(){var e;return this.tribute.current.collection&&(e=this.tribute.current.collection.iframe),e?e.contentWindow.document:document}},{key:"positionMenuAtCaret",value:function(e){var t,n=this.tribute.current,i=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==i){if(!this.tribute.positionMenu)return void(this.tribute.menu.style.cssText="display: block;");t=this.isContentEditable(n.element)?this.getContentEditableCaretPosition(i.mentionPosition):this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,i.mentionPosition),this.tribute.menu.style.cssText="top: ".concat(t.top,"px;\n left: ").concat(t.left,"px;\n right: ").concat(t.right,"px;\n bottom: ").concat(t.bottom,"px;\n max-height: ").concat(t.maxHeight||500,"px;\n max-width: ").concat(t.maxWidth||300,"px;\n position: ").concat(t.position||"absolute",";\n display: block;"),"auto"===t.left&&(this.tribute.menu.style.left="auto"),"auto"===t.top&&(this.tribute.menu.style.top="auto"),e&&this.scrollIntoView()}else this.tribute.menu.style.cssText="display: none"}},{key:"selectElement",value:function(e,t,n){var i,r=e;if(t)for(var o=0;o<t.length;o++){if(void 0===(r=r.childNodes[t[o]]))return;for(;r.length<n;)n-=r.length,r=r.nextSibling;0!==r.childNodes.length||r.length||(r=r.previousSibling)}var u=this.getWindowSelection();(i=this.getDocument().createRange()).setStart(r,n),i.setEnd(r,n),i.collapse(!0);try{u.removeAllRanges()}catch(e){}u.addRange(i),e.focus()}},{key:"replaceTriggerText",value:function(e,t,n,i,r){var o=this.getTriggerInfo(!0,n,t,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==o){var u=this.tribute.current,a=new CustomEvent("tribute-replaced",{detail:{item:r,instance:u,context:o,event:i}});if(this.isContentEditable(u.element)){e+="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";var l=o.mentionPosition+o.mentionText.length;this.tribute.autocompleteMode||(l+=o.mentionTriggerChar.length),this.pasteHtml(e,o.mentionPosition,l)}else{var s=this.tribute.current.element,c="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";e+=c;var h=o.mentionPosition,d=o.mentionPosition+o.mentionText.length+c.length;this.tribute.autocompleteMode||(d+=o.mentionTriggerChar.length-1),s.value=s.value.substring(0,h)+e+s.value.substring(d,s.value.length),s.selectionStart=h+e.length,s.selectionEnd=h+e.length}u.element.dispatchEvent(new CustomEvent("input",{bubbles:!0})),u.element.dispatchEvent(a)}}},{key:"pasteHtml",value:function(e,t,n){var i,r;r=this.getWindowSelection(),(i=this.getDocument().createRange()).setStart(r.anchorNode,t),i.setEnd(r.anchorNode,n),i.deleteContents();var o=this.getDocument().createElement("div");o.innerHTML=e;for(var u,a,l=this.getDocument().createDocumentFragment();u=o.firstChild;)a=l.appendChild(u);i.insertNode(l),a&&((i=i.cloneRange()).setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i))}},{key:"getWindowSelection",value:function(){return this.tribute.collection.iframe?this.tribute.collection.iframe.contentWindow.getSelection():window.getSelection()}},{key:"getNodePositionInParent",value:function(e){if(null===e.parentNode)return 0;for(var t=0;t<e.parentNode.childNodes.length;t++){if(e.parentNode.childNodes[t]===e)return t}}},{key:"getContentEditableSelectedPath",value:function(e){var t=this.getWindowSelection(),n=t.anchorNode,i=[];if(null!=n){for(var r,o=n.contentEditable;null!==n&&"true"!==o;)r=this.getNodePositionInParent(n),i.push(r),null!==(n=n.parentNode)&&(o=n.contentEditable);return i.reverse(),{selected:n,path:i,offset:t.getRangeAt(0).startOffset}}}},{key:"getTextPrecedingCurrentSelection",value:function(){var e=this.tribute.current,t="";if(this.isContentEditable(e.element)){var n=this.getWindowSelection().anchorNode;if(null!=n){var i=n.textContent,r=this.getWindowSelection().getRangeAt(0).startOffset;i&&r>=0&&(t=i.substring(0,r))}}else{var o=this.tribute.current.element;if(o){var u=o.selectionStart;o.value&&u>=0&&(t=o.value.substring(0,u))}}return t}},{key:"getLastWordInText",value:function(e){var t;return e=e.replace(/\u00A0/g," "),(t=this.tribute.autocompleteSeparator?e.split(this.tribute.autocompleteSeparator):e.split(/\s+/))[t.length-1].trim()}},{key:"getTriggerInfo",value:function(e,t,n,i,r){var o,u,a,l=this,s=this.tribute.current;if(this.isContentEditable(s.element)){var c=this.getContentEditableSelectedPath(s);c&&(o=c.selected,u=c.path,a=c.offset)}else o=this.tribute.current.element;var h=this.getTextPrecedingCurrentSelection(),d=this.getLastWordInText(h);if(r)return{mentionPosition:h.length-d.length,mentionText:d,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:a};if(null!=h){var f,m=-1;if(this.tribute.collection.forEach((function(e){var t=e.trigger,i=e.requireLeadingSpace?l.lastIndexWithLeadingSpace(h,t):h.lastIndexOf(t);i>m&&(m=i,f=t,n=e.requireLeadingSpace)})),m>=0&&(0===m||!n||/[\xA0\s]/g.test(h.substring(m-1,m)))){var p=h.substring(m+f.length,h.length);f=h.substring(m,m+f.length);var v=p.substring(0,1),g=p.length>0&&(" "===v||" "===v);t&&(p=p.trim());var b=i?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=b.test(p),!g&&(e||!b.test(p)))return{mentionPosition:m,mentionText:p,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:a,mentionTriggerChar:f}}}}},{key:"lastIndexWithLeadingSpace",value:function(e,t){for(var n=e.split("").reverse().join(""),i=-1,r=0,o=e.length;r<o;r++){for(var u=r===e.length-1,a=/\s/.test(n[r+1]),l=!0,s=t.length-1;s>=0;s--)if(t[s]!==n[r-s]){l=!1;break}if(l&&(u||a)){i=e.length-1-r;break}}return i}},{key:"isContentEditable",value:function(e){return"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName}},{key:"isMenuOffScreen",value:function(e,t){var n=window.innerWidth,i=window.innerHeight,r=document.documentElement,o=(window.pageXOffset||r.scrollLeft)-(r.clientLeft||0),u=(window.pageYOffset||r.scrollTop)-(r.clientTop||0),a="number"==typeof e.top?e.top:u+i-e.bottom-t.height,l="number"==typeof e.right?e.right:e.left+t.width,s="number"==typeof e.bottom?e.bottom:e.top+t.height,c="number"==typeof e.left?e.left:o+n-e.right-t.width;return{top:a<Math.floor(u),right:l>Math.ceil(o+n),bottom:s>Math.ceil(u+i),left:c<Math.floor(o)}}},{key:"getMenuDimensions",value:function(){var e={width:null,height:null};return this.tribute.menu.style.cssText="top: 0px;\n left: 0px;\n position: fixed;\n display: block;\n visibility; hidden;\n max-height:500px;",e.width=this.tribute.menu.offsetWidth,e.height=this.tribute.menu.offsetHeight,this.tribute.menu.style.cssText="display: none;",e}},{key:"getTextAreaOrInputUnderlinePosition",value:function(e,t,n){var i=this.getDocument().createElement("div");i.id="input-textarea-caret-position-mirror-div",this.getDocument().body.appendChild(i);var r=i.style,o=window.getComputedStyle?getComputedStyle(e):e.currentStyle;r.whiteSpace="pre-wrap","INPUT"!==e.nodeName&&(r.wordWrap="break-word"),r.position="absolute",r.visibility="hidden",["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"].forEach((function(e){r[e]=o[e]}));var u=document.createElement("span");u.textContent=e.value.substring(0,t),i.appendChild(u),"INPUT"===e.nodeName&&(i.textContent=i.textContent.replace(/\s/g," "));var a=this.getDocument().createElement("span");a.textContent="​",i.appendChild(a);var l=this.getDocument().createElement("span");l.textContent=e.value.substring(t),i.appendChild(l);var s=e.getBoundingClientRect();i.style.position="fixed",i.style.left=s.left+"px",i.style.top=s.top+"px",i.style.width=s.width+"px",i.style.height=s.height+"px",i.scrollTop=e.scrollTop;var c=a.getBoundingClientRect();return this.getDocument().body.removeChild(i),this.getFixedCoordinatesRelativeToRect(c)}},{key:"getContentEditableCaretPosition",value:function(e){var t,n=this.getWindowSelection();(t=this.getDocument().createRange()).setStart(n.anchorNode,e),t.setEnd(n.anchorNode,e),t.collapse(!1);var i=t.getBoundingClientRect();return this.getFixedCoordinatesRelativeToRect(i)}},{key:"getFixedCoordinatesRelativeToRect",value:function(e){var t={position:"fixed",left:e.left,top:e.top+e.height},n=this.getMenuDimensions(),i=e.top,r=window.innerHeight-(e.top+e.height);r<n.height&&(i>=n.height||i>r?(t.top="auto",t.bottom=window.innerHeight-e.top,r<n.height&&(t.maxHeight=i)):i<n.height&&(t.maxHeight=r));var o=e.left,u=window.innerWidth-e.left;return u<n.width&&(o>=n.width||o>u?(t.left="auto",t.right=window.innerWidth-e.left,u<n.width&&(t.maxWidth=o)):o<n.width&&(t.maxWidth=u)),t}},{key:"scrollIntoView",value:function(e){var t,n=this.menu;if(void 0!==n){for(;void 0===t||0===t.height;)if(0===(t=n.getBoundingClientRect()).height&&(void 0===(n=n.childNodes[0])||!n.getBoundingClientRect))return;var i=t.top,r=i+t.height;if(i<0)window.scrollTo(0,window.pageYOffset+t.top-20);else if(r>window.innerHeight){var o=window.pageYOffset+t.top-20;o-window.pageYOffset>100&&(o=window.pageYOffset+100);var u=window.pageYOffset-(window.innerHeight-r);u>o&&(u=o),window.scrollTo(0,u)}}}},{key:"menuContainerIsBody",get:function(){return this.tribute.menuContainer===document.body||!this.tribute.menuContainer}}]),t}(),s=function(){function t(n){e(this,t),this.tribute=n,this.tribute.search=this}return n(t,[{key:"simpleFilter",value:function(e,t){var n=this;return t.filter((function(t){return n.test(e,t)}))}},{key:"test",value:function(e,t){return null!==this.match(e,t)}},{key:"match",value:function(e,t,n){n=n||{};t.length;var i=n.pre||"",r=n.post||"",o=n.caseSensitive&&t||t.toLowerCase();if(n.skip)return{rendered:t,score:0};e=n.caseSensitive&&e||e.toLowerCase();var u=this.traverse(o,e,0,0,[]);return u?{rendered:this.render(t,u.cache,i,r),score:u.score}:null}},{key:"traverse",value:function(e,t,n,i,r){if(this.tribute.autocompleteSeparator&&(t=t.split(this.tribute.autocompleteSeparator).splice(-1)[0]),t.length===i)return{score:this.calculateScore(r),cache:r.slice()};if(!(e.length===n||t.length-i>e.length-n)){for(var o,u,a=t[i],l=e.indexOf(a,n);l>-1;){if(r.push(l),u=this.traverse(e,t,l+1,i+1,r),r.pop(),!u)return o;(!o||o.score<u.score)&&(o=u),l=e.indexOf(a,l+1)}return o}}},{key:"calculateScore",value:function(e){var t=0,n=1;return e.forEach((function(i,r){r>0&&(e[r-1]+1===i?n+=n+1:n=1),t+=n})),t}},{key:"render",value:function(e,t,n,i){var r=e.substring(0,t[0]);return t.forEach((function(o,u){r+=n+e[o]+i+e.substring(o+1,t[u+1]?t[u+1]:e.length)})),r}},{key:"filter",value:function(e,t,n){var i=this;return n=n||{},t.reduce((function(t,r,o,u){var a=r;n.extract&&((a=n.extract(r))||(a=""));var l=i.match(e,a,n);return null!=l&&(t[t.length]={string:l.rendered,score:l.score,index:o,original:r}),t}),[]).sort((function(e,t){var n=t.score-e.score;return n||e.index-t.index}))}}]),t}();return function(){function t(n){var i,r=this,o=n.values,c=void 0===o?null:o,h=n.loadingItemTemplate,d=void 0===h?null:h,f=n.iframe,m=void 0===f?null:f,p=n.selectClass,v=void 0===p?"highlight":p,g=n.containerClass,b=void 0===g?"tribute-container":g,y=n.itemClass,w=void 0===y?"":y,T=n.trigger,S=void 0===T?"@":T,C=n.autocompleteMode,k=void 0!==C&&C,E=n.autocompleteSeparator,x=void 0===E?null:E,A=n.selectTemplate,M=void 0===A?null:A,L=n.menuItemTemplate,I=void 0===L?null:L,N=n.lookup,P=void 0===N?"key":N,R=n.fillAttr,D=void 0===R?"value":R,O=n.collection,W=void 0===O?null:O,H=n.menuContainer,F=void 0===H?null:H,_=n.noMatchTemplate,B=void 0===_?null:_,j=n.requireLeadingSpace,K=void 0===j||j,q=n.allowSpaces,U=void 0!==q&&q,z=n.replaceTextSuffix,Y=void 0===z?null:z,Q=n.positionMenu,X=void 0===Q||Q,V=n.spaceSelectsMatch,G=void 0!==V&&V,J=n.searchOpts,Z=void 0===J?{}:J,ee=n.menuItemLimit,te=void 0===ee?null:ee,ne=n.menuShowMinLength,ie=void 0===ne?0:ne;if(e(this,t),this.autocompleteMode=k,this.autocompleteSeparator=x,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=F,this.allowSpaces=U,this.replaceTextSuffix=Y,this.positionMenu=X,this.hasTrailingSpace=!1,this.spaceSelectsMatch=G,this.autocompleteMode&&(S="",U=!1),c)this.collection=[{trigger:S,iframe:m,selectClass:v,containerClass:b,itemClass:w,selectTemplate:(M||t.defaultSelectTemplate).bind(this),menuItemTemplate:(I||t.defaultMenuItemTemplate).bind(this),noMatchTemplate:(i=B,"string"==typeof i?""===i.trim()?null:i:"function"==typeof i?i.bind(r):B||function(){return"<li>No Match Found!</li>"}.bind(r)),lookup:P,fillAttr:D,values:c,loadingItemTemplate:d,requireLeadingSpace:K,searchOpts:Z,menuItemLimit:te,menuShowMinLength:ie}];else{if(!W)throw new Error("[Tribute] No collection specified.");this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=W.map((function(e){return{trigger:e.trigger||S,iframe:e.iframe||m,selectClass:e.selectClass||v,containerClass:e.containerClass||b,itemClass:e.itemClass||w,selectTemplate:(e.selectTemplate||t.defaultSelectTemplate).bind(r),menuItemTemplate:(e.menuItemTemplate||t.defaultMenuItemTemplate).bind(r),noMatchTemplate:function(e){return"string"==typeof e?""===e.trim()?null:e:"function"==typeof e?e.bind(r):B||function(){return"<li>No Match Found!</li>"}.bind(r)}(B),lookup:e.lookup||P,fillAttr:e.fillAttr||D,values:e.values,loadingItemTemplate:e.loadingItemTemplate,requireLeadingSpace:e.requireLeadingSpace,searchOpts:e.searchOpts||Z,menuItemLimit:e.menuItemLimit||te,menuShowMinLength:e.menuShowMinLength||ie}}))}new l(this),new u(this),new a(this),new s(this)}return n(t,[{key:"triggers",value:function(){return this.collection.map((function(e){return e.trigger}))}},{key:"attach",value:function(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array)for(var t=e.length,n=0;n<t;++n)this._attach(e[n]);else this._attach(e)}},{key:"_attach",value:function(e){e.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+e.nodeName),this.ensureEditable(e),this.events.bind(e),e.setAttribute("data-tribute",!0)}},{key:"ensureEditable",value:function(e){if(-1===t.inputTypes().indexOf(e.nodeName)){if(!e.contentEditable)throw new Error("[Tribute] Cannot bind to "+e.nodeName);e.contentEditable=!0}}},{key:"createMenu",value:function(e){var t=this.range.getDocument().createElement("div"),n=this.range.getDocument().createElement("ul");return t.className=e,t.appendChild(n),this.menuContainer?this.menuContainer.appendChild(t):this.range.getDocument().body.appendChild(t)}},{key:"showMenuFor",value:function(e,t){var n=this;if(!this.isActive||this.current.element!==e||this.current.mentionText!==this.currentMentionTextSnapshot){this.currentMentionTextSnapshot=this.current.mentionText,this.menu||(this.menu=this.createMenu(this.current.collection.containerClass),e.tributeMenu=this.menu,this.menuEvents.bind(this.menu)),this.isActive=!0,this.menuSelected=0,this.current.mentionText||(this.current.mentionText="");var r=function(e){if(n.isActive){var r=n.search.filter(n.current.mentionText,e,{pre:n.current.collection.searchOpts.pre||"<span>",post:n.current.collection.searchOpts.post||"</span>",skip:n.current.collection.searchOpts.skip,extract:function(e){if("string"==typeof n.current.collection.lookup)return e[n.current.collection.lookup];if("function"==typeof n.current.collection.lookup)return n.current.collection.lookup(e,n.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});n.current.collection.menuItemLimit&&(r=r.slice(0,n.current.collection.menuItemLimit)),n.current.filteredItems=r;var o=n.menu.querySelector("ul");if(!r.length){var u=new CustomEvent("tribute-no-match",{detail:n.menu});return n.current.element.dispatchEvent(u),void("function"==typeof n.current.collection.noMatchTemplate&&!n.current.collection.noMatchTemplate()||!n.current.collection.noMatchTemplate?n.hideMenu():("function"==typeof n.current.collection.noMatchTemplate?o.innerHTML=n.current.collection.noMatchTemplate():o.innerHTML=n.current.collection.noMatchTemplate,n.range.positionMenuAtCaret(t)))}o.innerHTML="";var a=n.range.getDocument().createDocumentFragment();r.forEach((function(e,t){var r=n.range.getDocument().createElement("li");r.setAttribute("data-index",t),r.className=n.current.collection.itemClass,r.addEventListener("mousemove",(function(e){var t=i(n._findLiTarget(e.target),2),r=(t[0],t[1]);0!==e.movementY&&n.events.setActiveLi(r)})),n.menuSelected===t&&r.classList.add(n.current.collection.selectClass),r.innerHTML=n.current.collection.menuItemTemplate(e),a.appendChild(r)})),o.appendChild(a),n.range.positionMenuAtCaret(t)}};"function"==typeof this.current.collection.values?(this.current.collection.loadingItemTemplate&&(this.menu.querySelector("ul").innerHTML=this.current.collection.loadingItemTemplate,this.range.positionMenuAtCaret(t)),this.current.collection.values(this.current.mentionText,r)):r(this.current.collection.values)}}},{key:"_findLiTarget",value:function(e){if(!e)return[];var t=e.getAttribute("data-index");return t?[e,t]:this._findLiTarget(e.parentNode)}},{key:"showMenuForCollection",value:function(e,t){e!==document.activeElement&&this.placeCaretAtEnd(e),this.current.collection=this.collection[t||0],this.current.externalTrigger=!0,this.current.element=e,e.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(e,this.current.collection.trigger),this.showMenuFor(e)}},{key:"placeCaretAtEnd",value:function(e){if(e.focus(),void 0!==window.getSelection&&void 0!==document.createRange){var t=document.createRange();t.selectNodeContents(e),t.collapse(!1);var n=window.getSelection();n.removeAllRanges(),n.addRange(t)}else if(void 0!==document.body.createTextRange){var i=document.body.createTextRange();i.moveToElementText(e),i.collapse(!1),i.select()}}},{key:"insertTextAtCursor",value:function(e){var t,n;(n=(t=window.getSelection()).getRangeAt(0)).deleteContents();var i=document.createTextNode(e);n.insertNode(i),n.selectNodeContents(i),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}},{key:"insertAtCaret",value:function(e,t){var n=e.scrollTop,i=e.selectionStart,r=e.value.substring(0,i),o=e.value.substring(e.selectionEnd,e.value.length);e.value=r+t+o,i+=t.length,e.selectionStart=i,e.selectionEnd=i,e.focus(),e.scrollTop=n}},{key:"hideMenu",value:function(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}},{key:"selectItemAtIndex",value:function(e,t){if("number"==typeof(e=parseInt(e))&&!isNaN(e)){var n=this.current.filteredItems[e],i=this.current.collection.selectTemplate(n);null!==i&&this.replaceText(i,t,n)}}},{key:"replaceText",value:function(e,t,n){this.range.replaceTriggerText(e,!0,!0,t,n)}},{key:"_append",value:function(e,t,n){if("function"==typeof e.values)throw new Error("Unable to append to values, as it is a function.");e.values=n?t:e.values.concat(t)}},{key:"append",value:function(e,t,n){var i=parseInt(e);if("number"!=typeof i)throw new Error("please provide an index for the collection to update.");var r=this.collection[i];this._append(r,t,n)}},{key:"appendCurrent",value:function(e,t){if(!this.isActive)throw new Error("No active state. Please use append instead and pass an index.");this._append(this.current.collection,e,t)}},{key:"detach",value:function(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array)for(var t=e.length,n=0;n<t;++n)this._detach(e[n]);else this._detach(e)}},{key:"_detach",value:function(e){var t=this;this.events.unbind(e),e.tributeMenu&&this.menuEvents.unbind(e.tributeMenu),setTimeout((function(){e.removeAttribute("data-tribute"),t.isActive=!1,e.tributeMenu&&e.tributeMenu.remove()}))}},{key:"isActive",get:function(){return this._isActive},set:function(e){if(this._isActive!=e&&(this._isActive=e,this.current.element)){var t=new CustomEvent("tribute-active-".concat(e));this.current.element.dispatchEvent(t)}}}],[{key:"defaultSelectTemplate",value:function(e){return void 0===e?"".concat(this.current.collection.trigger).concat(this.current.mentionText):this.range.isContentEditable(this.current.element)?'<span class="tribute-mention">'+(this.current.collection.trigger+e.original[this.current.collection.fillAttr])+"</span>":this.current.collection.trigger+e.original[this.current.collection.fillAttr]}},{key:"defaultMenuItemTemplate",value:function(e){return e.string}},{key:"inputTypes",value:function(){return["TEXTAREA","INPUT"]}}]),t}()})); -
wp-to-hootsuite/trunk/includes/class-wp-to-hootsuite.php
r3243135 r3279779 76 76 $this->plugin->logo = WP_TO_HOOTSUITE_PLUGIN_URL . 'lib/assets/images/icons/hootsuite-dark.svg'; 77 77 $this->plugin->review_name = 'wp-to-hootsuite'; 78 $this->plugin->review_notice = sprintf( 78 79 // Defer loading of Plugin Classes. 80 add_action( 'init', array( $this, 'initialize' ), 1 ); 81 add_action( 'init', array( $this, 'upgrade' ), 2 ); 82 83 // Admin Menus. 84 add_action( $this->plugin->filter_name . '_admin_admin_menu', array( $this, 'admin_menus' ) ); 85 86 } 87 88 /** 89 * Register menus and submenus. 90 * 91 * @since 1.5.8 92 * 93 * @param string $minimum_capability Minimum required capability. 94 */ 95 public function admin_menus( $minimum_capability ) { 96 97 // Menus. 98 add_menu_page( $this->plugin->displayName, $this->plugin->displayName, $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ), $this->plugin->url . 'lib/assets/images/icons/' . strtolower( $this->plugin->account ) . '-light.svg' ); 99 100 // Register Submenu Pages. 101 $settings_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Settings', 'wp-to-hootsuite' ), __( 'Settings', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ) ); 102 103 // Logs. 104 if ( $this->get_class( 'log' )->is_enabled() ) { 105 $log_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Logs', 'wp-to-hootsuite' ), __( 'Logs', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-log', array( $this->get_class( 'admin' ), 'log_screen' ) ); 106 add_action( "load-$log_page", array( $this->get_class( 'log' ), 'add_screen_options' ) ); 107 } 108 109 $upgrade_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Upgrade', 'wp-to-hootsuite' ), __( 'Upgrade', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-upgrade', array( $this->get_class( 'admin' ), 'upgrade_screen' ) ); 110 111 } 112 113 /** 114 * Initializes required classes 115 * 116 * @since 3.4.9 117 */ 118 public function initialize() { 119 120 $this->plugin->review_notice = sprintf( 79 121 /* translators: Plugin Name */ 80 122 __( 'Thanks for using %s to schedule your social media statuses on Hootsuite!', 'wp-to-hootsuite' ), … … 162 204 $this->dashboard = new WPZincDashboardWidget( $this->plugin, 'https://www.wpzinc.com/wp-content/plugins/lum-deactivation' ); 163 205 164 // Defer loading of Plugin Classes. 165 add_action( 'init', array( $this, 'initialize' ), 1 ); 166 add_action( 'init', array( $this, 'upgrade' ), 2 ); 167 168 // Admin Menus. 169 add_action( $this->plugin->filter_name . '_admin_admin_menu', array( $this, 'admin_menus' ) ); 170 171 // Localization. 172 add_action( 'init', array( $this, 'load_language_files' ) ); 173 174 } 175 176 /** 177 * Register menus and submenus. 178 * 179 * @since 1.5.8 180 * 181 * @param string $minimum_capability Minimum required capability. 182 */ 183 public function admin_menus( $minimum_capability ) { 184 185 // Menus. 186 add_menu_page( $this->plugin->displayName, $this->plugin->displayName, $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ), $this->plugin->url . 'lib/assets/images/icons/' . strtolower( $this->plugin->account ) . '-light.svg' ); 187 188 // Register Submenu Pages. 189 $settings_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Settings', 'wp-to-hootsuite' ), __( 'Settings', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ) ); 190 191 // Logs. 192 if ( $this->get_class( 'log' )->is_enabled() ) { 193 $log_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Logs', 'wp-to-hootsuite' ), __( 'Logs', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-log', array( $this->get_class( 'admin' ), 'log_screen' ) ); 194 add_action( "load-$log_page", array( $this->get_class( 'log' ), 'add_screen_options' ) ); 195 } 196 197 $upgrade_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Upgrade', 'wp-to-hootsuite' ), __( 'Upgrade', 'wp-to-hootsuite' ), $minimum_capability, $this->plugin->name . '-upgrade', array( $this->get_class( 'admin' ), 'upgrade_screen' ) ); 198 199 } 200 201 /** 202 * Initializes required classes 203 * 204 * @since 3.4.9 205 */ 206 public function initialize() { 207 206 // Initialize Plugin classes. 208 207 $this->classes = new stdClass(); 209 208 … … 248 247 249 248 /** 250 * Loads plugin textdomain251 *252 * @since 3.8.4253 */254 public function load_language_files() {255 256 load_plugin_textdomain( 'wp-to-hootsuite', false, $this->plugin->name . '/languages/' );257 258 }259 260 /**261 249 * Returns the given class 262 250 * -
wp-to-hootsuite/trunk/readme.txt
r3262556 r3279779 4 4 Tags: auto post, auto publish, social media scheduling, social media automation, hootsuite 5 5 Requires at least: 5.0 6 Tested up to: 6. 7.26 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1.6. 18 Stable tag: 1.6.2 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 89 89 == Changelog == 90 90 91 = 1.6.2 (2025-04-23) = 92 * Fix: Notice: Function `_load_textdomain_just_in_time` was called incorrectly in WordPress 6.8 and higher 93 91 94 = 1.6.1 (2025-03-27) = 92 95 * Updated: Coding standards -
wp-to-hootsuite/trunk/wp-to-hootsuite.php
r3262556 r3279779 9 9 * Plugin Name: WP to Hootsuite 10 10 * Plugin URI: http://www.wpzinc.com/plugins/wordpress-to-hootsuite-pro 11 * Version: 1.6. 111 * Version: 1.6.2 12 12 * Author: WP Zinc 13 13 * Author URI: http://www.wpzinc.com … … 22 22 23 23 // Define Plugin version and build date. 24 define( 'WP_TO_HOOTSUITE_PLUGIN_VERSION', '1.6. 1' );25 define( 'WP_TO_HOOTSUITE_PLUGIN_BUILD_DATE', '2025-0 3-2718:00:00' );24 define( 'WP_TO_HOOTSUITE_PLUGIN_VERSION', '1.6.2' ); 25 define( 'WP_TO_HOOTSUITE_PLUGIN_BUILD_DATE', '2025-04-23 18:00:00' ); 26 26 27 27 // Define Plugin paths.
Note: See TracChangeset
for help on using the changeset viewer.