import Resolver from"../resolver.js";import{get_max_len}from"../common.js";import{intersect}from"../intersect.js";import{SearchResults,EnrichedSearchResults,IntermediateSearchResults,HighlightOptions}from"../type.js";Resolver.prototype.and=function(){return this.handler("and",return_result,arguments)};function return_result(a,b,c,d,e,f,g){if(!f&&!this.result.length)return e?this.result:this;let h;if(!a.length)f||(this.result=a);else if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{let d=0;for(let b,c,e=0;e<a.length;e++)if((b=a[e])&&(c=b.length))d<c&&(d=c);else if(!f){d=0;break}d?(this.result=intersect(a,d,b,c,f,this.boostval,e),h=!0):this.result=[]}return e&&(this.await=null),e?this.resolve(b,c,d,g,h):this}