<commit_before>angular.module("MassAutoComplete",[]).directive("massAutocomplete",["$timeout","$window","$document","$q",function(q,f,g,m){return{restrict:"A",scope:{options:"&massAutocomplete"},transclude:!0,template:'<span ng-transclude></span><div class="ac-container" ng-show="show_autocomplete && results.length > 0" style="position:absolute;">  <ul class="ac-menu">    <li ng-repeat="result in results" ng-if="$index > 0"        class="ac-menu-item" ng-class="$index == selected_index ? \'ac-state-focus\': \'\'">      <a href ng-click="apply_selection($index, $event)" ng-bind-html="result.label"></a>    </li>  </ul></div>',
link:function(a,g){a.container=angular.element(g[0].getElementsByClassName("ac-container")[0])},controller:["$scope",function(a){function r(a,c,g){var e;return function(){var f=this,d=arguments,h=g&&!e;clearTimeout(e);e=setTimeout(function(){e=null;g||a.apply(f,d)},c);h&&a.apply(f,d)}}function u(){var b=c[0].getBoundingClientRect(),e=g[0].body.scrollLeft||g[0].documentElement.scrollLeft||f.pageXOffset,d=a.container[0];d.style.top=b.top+b.height+(g[0].body.scrollTop||g[0].documentElement.scrollTop||
f.pageYOffset)+"px";d.style.left=b.left+e+"px";d.style.width=b.width+"px"}function v(){var a=c.val();h.$modelValue!==a&&(h.$setViewValue(a),h.$render());return a}function s(b){c.val(a.results[b].value);a.selected_index=b}function y(){angular.element(f).bind(d.RESIZE,z);c.bind(d.BLUR,function(){a.show_autocomplete||q(function(){c&&c[0]===g[0].activeElement||k.detach()},n.debounce_blur)});c.bind(d.KEYDOWN,function(b){if(!b.shiftKey)switch(b.keyCode){case l.ESC:a.show_autocomplete?(a.show_autocomplete=
!1,a.$apply()):c.val(t);break;case l.ENTER:a.show_autocomplete&&0<a.selected_index&&!a.waiting_for_suggestion&&(a.apply_selection(a.selected_index),b.stopPropagation());a.show_autocomplete=!1;a.$apply();break;case l.TAB:if(!a.show_autocomplete)break;b.preventDefault();case l.DOWN:0<a.results.length&&(a.show_autocomplete?s(a.selected_index+1>a.results.length-1?0:a.selected_index+1):(a.show_autocomplete=!0,a.selected_index=0),a.$apply());break;case l.UP:a.show_autocomplete&&(b.preventDefault(),s(0<=
a.selected_index-1?a.selected_index-1:a.results.length-1),a.$apply())}})}var k=this,l={TAB:9,ESC:27,ENTER:13,UP:38,DOWN:40},d={KEYDOWN:"keydown",RESIZE:"resize",BLUR:"blur"},p=a.options()||{},n={debounce_position:p.debounce_position||150,debounce_attach:p.debounce_attach||300,debounce_suggest:p.debounce_suggest||200,debounce_blur:p.debounce_blur||150},c,h,e,t,w,x;a.show_autocomplete=!1;var z=r(u,n.debounce_position);k.attach=r(function(b,d,f){c!==d&&(c&&k.detach(),d[0]===g[0].activeElement&&(f.on_attach&&
f.on_attach(),c=d,h=b,e=f,t=b.$viewValue,a.results=[],a.selected_index=-1,y(),w=a.$watch(function(){return b.$modelValue},function(b,c){b!==x&&(a.results&&(a.results.length=0),u(),A(b))})))},n.debounce_attach);var A=r(function(b){a.selected_index=0;a.show_autocomplete=!1;a.waiting_for_suggestion=!0;"string"===typeof b&&0<b.length?m.when(e.suggest(b),function(c){c&&0<c.length?(a.results=[{value:b,label:""}].concat(c),a.show_autocomplete=!0):a.results=[]},function(a){e.on_error&&e.on_error(a)})["finally"](function(){a.waiting_for_suggestion=
!1}):(a.waiting_for_suggestion=!1,a.$apply())},n.debounce_suggest);k.detach=function(){c&&(v(),e.on_detach&&e.on_detach(c.val()));a.show_autocomplete=!1;c.unbind(d.KEYDOWN);c.unbind(d.BLUR);angular.element(f).unbind(d.RESIZE);w();h=c=t=a.selected_index=a.results=void 0};a.apply_selection=function(b){c[0].focus();!a.show_autocomplete||b>a.results.length||0>b||(s(b),x=v(),a.show_autocomplete=!1,e.on_select&&e.on_select(a.results[a.selected_index]))};a.$on("$destroy",function(){k.detach();a.container.remove()})}]}}]).directive("massAutocompleteItem",
function(){return{restrict:"A",require:["^massAutocomplete","ngModel"],scope:!1,link:function(q,f,g,m){g.$set("autocomplete","off");f.bind("focus",function(){var a=q[g.massAutocompleteItem];if(!a)throw"Invalid options";m[0].attach(m[1],f,a)})}}});
<commit_msg>update minified version<commit_after>angular.module("MassAutoComplete",[]).directive("massAutocomplete",["$timeout","$window","$document","$q",function(r,e,f,n){return{restrict:"A",scope:{options:"&massAutocomplete"},transclude:!0,template:'<span ng-transclude></span><div class="ac-container" ng-show="show_autocomplete && results.length > 0" style="position:absolute;"><ul class="ac-menu"><li ng-repeat="result in results" ng-if="$index > 0" class="ac-menu-item" ng-class="$index == selected_index ? \'ac-state-focus\': \'\'"><a href ng-click="apply_selection($index, $event)" ng-bind-html="result.label"></a></li></ul></div>',
link:function(a,f){a.container=angular.element(f[0].getElementsByClassName("ac-container")[0])},controller:["$scope",function(a){function s(a,d,f){var c;return function(){var e=this,g=arguments,h=f&&!c;clearTimeout(c);c=setTimeout(function(){c=null;f||a.apply(e,g)},d);h&&a.apply(e,g)}}function v(){var b=d[0].getBoundingClientRect(),k=f[0].body.scrollLeft||f[0].documentElement.scrollLeft||e.pageXOffset,c=a.container[0];c.style.top=b.top+b.height+(f[0].body.scrollTop||f[0].documentElement.scrollTop||
e.pageYOffset)+"px";c.style.left=b.left+k+"px";c.style.width=b.width+"px"}function w(a){h.$modelValue!==a&&(h.$setViewValue(a),h.$render())}function t(b){var c=a.results[b];d.val(c.value);a.selected_index=b;return c}function z(){angular.element(e).bind(g.RESIZE,A);d.bind(g.BLUR,function(){a.show_autocomplete||r(function(){d&&d[0]===f[0].activeElement||l.detach()},p.debounce_blur)});d.bind(g.KEYDOWN,function(b){if(!b.shiftKey)switch(b.keyCode){case m.ESC:a.show_autocomplete?(a.show_autocomplete=!1,
a.$apply()):d.val(u);break;case m.ENTER:a.show_autocomplete&&0<a.selected_index&&!a.waiting_for_suggestion&&(a.apply_selection(a.selected_index),b.stopPropagation());a.show_autocomplete=!1;a.$apply();break;case m.TAB:if(!a.show_autocomplete)break;b.preventDefault();case m.DOWN:0<a.results.length&&(a.show_autocomplete?t(a.selected_index+1>a.results.length-1?0:a.selected_index+1):(a.show_autocomplete=!0,a.selected_index=0),a.$apply());break;case m.UP:a.show_autocomplete&&(b.preventDefault(),t(0<=a.selected_index-
1?a.selected_index-1:a.results.length-1),a.$apply())}})}var l=this,m={TAB:9,ESC:27,ENTER:13,UP:38,DOWN:40},g={KEYDOWN:"keydown",RESIZE:"resize",BLUR:"blur"},q=a.options()||{},p={debounce_position:q.debounce_position||150,debounce_attach:q.debounce_attach||300,debounce_suggest:q.debounce_suggest||200,debounce_blur:q.debounce_blur||150},d,h,c,u,x,y;a.show_autocomplete=!1;var A=s(v,p.debounce_position);l.attach=s(function(b,k,e){d!==k&&(d&&l.detach(),k[0]===f[0].activeElement&&(e.on_attach&&e.on_attach(),
d=k,h=b,c=e,u=b.$viewValue,a.results=[],a.selected_index=-1,z(),x=a.$watch(function(){return b.$modelValue},function(b,c){b!==y&&(a.results&&(a.results.length=0),v(),B(b))})))},p.debounce_attach);var B=s(function(b){a.selected_index=0;a.show_autocomplete=!1;a.waiting_for_suggestion=!0;"string"===typeof b&&0<b.length?n.when(c.suggest(b),function(c){c&&0<c.length?(a.results=[{value:b,label:""}].concat(c),a.show_autocomplete=!0):a.results=[]},function(a){c.on_error&&c.on_error(a)})["finally"](function(){a.waiting_for_suggestion=
!1}):(a.waiting_for_suggestion=!1,a.$apply())},p.debounce_suggest);l.detach=function(){d&&(w(),c.on_detach&&c.on_detach(d.val()),d.unbind(g.KEYDOWN),d.unbind(g.BLUR));a.show_autocomplete=!1;angular.element(e).unbind(g.RESIZE);x();h=d=u=a.selected_index=a.results=void 0};a.apply_selection=function(b){d[0].focus();!a.show_autocomplete||b>a.results.length||0>b||(b=t(b),y=b.value,w(b.value),a.show_autocomplete=!1,c.on_select&&c.on_select(a.results[a.selected_index]))};a.$on("$destroy",function(){l.detach();
a.container.remove()})}]}}]).directive("massAutocompleteItem",function(){return{restrict:"A",require:["^massAutocomplete","ngModel"],scope:!1,link:function(r,e,f,n){f.$set("autocomplete","off");e.bind("focus",function(){var a=r[f.massAutocompleteItem];if(!a)throw"Invalid options";n[0].attach(n[1],e,a)})}}});

{'fraction_non_alphanumeric': 0.2604309378502927, 'fraction_numerical': 0.017187694607049445, 'mean_word_length': 14.412667946257198, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4703702', 'n_tokens_mistral': 3348, 'n_tokens_neox': 3221, 'n_words': 112}