PageSourceSearch

https://asiaparts.com.ua/assets/vendor/@orchidjs/sifter/sifter.index-zEuztG7.js

js asiaparts.com.ua collected 2026-10-07 23:13:32 UTC 3,406 bytes, 1 lines download raw bytes

1import{asciifold as m,escape_regex as y,getPattern as F}from"@orchidjs/unicode-variants";export{getPattern}from"@orchidjs/unicode-variants";const v=(i,e)=>{if(i)return i[e]},S=(i,e)=>{if(i){for(var r,n=e.split(".");(r=n.shift())&&(i=i[r]););return i}},p=(i,e,r)=>{var n,t;return i?(i+="",e.regex==null||(t=i.search(e.regex))===-1?0:(n=e.string.length/i.length,t===0&&(n+=.5),n*r)):0},d=(i,e)=>{var r=i[e];if(typeof r=="function")return r;r&&!Array.isArray(r)&&(i[e]=[r])},h=(i,e)=>{if(Array.isArray(i))i.forEach(e);else for(var r in i)i.hasOwnProperty(r)&&e(i[r],r)},w=(i,e)=>typeof i=="number"&&typeof e=="number"?i>e?1:i<e?-1:0:(i=m(i+"").toLowerCase())>(e=m(e+"").toLowerCase())?1:e>i?-1:0;class x{items;settings;constructor(e,r){this.items=e,this.settings=r||{diacritics:!0}}tokenize(e,r,n){if(!e||!e.length)return[];const t=[],f=e.split(/\s+/);var o;return n&&(o=new RegExp("^("+Object.keys(n).map(y).join("|")+"):(.*)$")),f.forEach((a=>{let c,s=null,u=null;o&&(c=a.match(o))&&(s=c[1],a=c[2]),a.length>0&&(u=this.settings.diacritics?F(a)||null:y(a),u&&r&&(u="\\b"+u)),t.push({string:a,regex:u?new RegExp(u,"iu"):null,field:s})})),t}getScoreFunction(e,r){var n=this.prepareSearch(e,r);return this._getScoreFunction(n)}_getScoreFunction(e){const r=e.tokens,n=r.length;if(!n)return function(){return 0};const t=e.options.fields,f=e.weights,o=t.length,a=e.getAttrFn;if(!o)return function(){return 1};const c=o===1?function(s,u){const l=t[0].field;return p(a(u,l),s,f[l]||1)}:function(s,u){var l=0;if(s.field){const g=a(u,s.field);!s.regex&&g?l+=1/o:l+=p(g,s,1)}else h(f,((g,_)=>{l+=p(a(u,_),s,g)}));return l/o};return n===1?function(s){return c(r[0],s)}:e.options.conjunction==="and"?function(s){var u,l=0;for(let g of r){if((u=c(g,s))<=0)return 0;l+=u}return l/n}:function(s){var u=0;return h(r,(l=>{u+=c(l,s)})),u/n}}getSortFunction(e,r){var n=this.prepareSearch(e,r);return this._getSortFunction(n)}_getSortFunction(e){var r,n=[];const t=this,f=e.options,o=!e.query&&f.sort_empty?f.sort_empty:f.sort;if(typeof o=="function")return o.bind(this);const a=function(c,s){return c==="$score"?s.score:e.getAttrFn(t.items[s.id],c)};if(o)for(let c of o)(e.query||c.field!=="$score")&&n.push(c);if(e.query){r=!0;for(let c of n)if(c.field==="$score"){r=!1;break}r&&n.unshift({field:"$score",direction:"desc"})}else n=n.filter((c=>c.field!=="$score"));return n.length?function(c,s){var u,l;for(let g of n)if(l=g.field,u=(g.direction==="desc"?-1:1)*w(a(l,c),a(l,s)))return u;return 0}:null}prepareSearch(e,r){const n={};var t=Object.assign({},r);if(d(t,"sort"),d(t,"sort_empty"),t.fields){d(t,"fields");const f=[];t.fields.forEach((o=>{typeof o=="string"&&(o={field:o,weight:1}),f.push(o),n[o.field]="weight"in o?o.weight:1})),t.fields=f}return{options:t,query:e.toLowerCase().trim(),tokens:this.tokenize(e,t.respect_word_boundaries,n),total:0,items:[],weights:n,getAttrFn:t.nesting?S:v}}search(e,r){var n,t,f=this;t=this.prepareSearch(e,r),r=t.options,e=t.query;const o=r.score||f._getScoreFunction(t);e.length?h(f.items,((c,s)=>{n=o(c),(r.filter===!1||n>0)&&t.items.push({score:n,id:s})})):h(f.items,((c,s)=>{t.items.push({score:1,id:s})}));const a=f._getSortFunction(t);return a&&t.items.sort(a),t.total=t.items.length,typeof r.limit=="number"&&(t.items=t.items.slice(0,r.limit)),t}}export{x as Sifter,w as cmp,v as getAttr,S as getAttrNesting,h as iterate,d as propToArray,p as scoreValue};export default null;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.