PageSourceSearch

http://prochoicesafetygear.com/assets/vendor/@orchidjs/sifter/sifter.index-dBmLgbU.js

js prochoicesafetygear.com collected 2026-10-09 17:53:32 UTC 3,689 bytes, 7 lines download raw bytes

vendor: 3,689 bytes, lines 1-7
1/**
2 * Bundled by jsDelivr using Rollup v4.62.2 and esbuild v0.28.1.
3 * Original file: /npm/@orchidjs/[email protected]/dist/esm/sifter.js
4 *
5 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6 */
7import{asciifold as _,escape_regex as y,getPattern as x}from"@orchidjs/unicode-variants";import{getPattern as C}from"@orchidjs/unicode-variants";const S=(n,t)=>{if(n)return n[t]},v=(n,t)=>{if(n){for(var e,r=t.split(".");(e=r.shift())&&(n=n[e]););return n}},m=(n,t,e)=>{var r,s;return!n||(n=n+"",t.regex==null)||(s=n.search(t.regex),s===-1)?0:(r=t.string.length/n.length,s===0&&(r+=.5),r*e)},d=(n,t)=>{var e=n[t];if(typeof e=="function")return e;e&&!Array.isArray(e)&&(n[t]=[e])},h=(n,t)=>{if(Array.isArray(n))n.forEach(t);else for(var e in n)n.hasOwnProperty(e)&&t(n[e],e)},F=(n,t)=>typeof n=="number"&&typeof t=="number"?n>t?1:n<t?-1:0:(n=_(n+"").toLowerCase(),t=_(t+"").toLowerCase(),n>t?1:t>n?-1:0);class A{items;settings;constructor(t,e){this.items=t,this.settings=e||{diacritics:!0}}tokenize(t,e,r){if(!t||!t.length)return[];const s=[],o=t.split(/\s+/);var u;return r&&(u=new RegExp("^("+Object.keys(r).map(y).join("|")+"):(.*)$")),o.forEach(c=>{let g,i=null,f=null;u&&(g=c.match(u))&&(i=g[1],c=g[2]),c.length>0&&(this.settings.diacritics?f=x(c)||null:f=y(c),f&&e&&(f="\\b"+f)),s.push({string:c,regex:f?new RegExp(f,"iu"):null,field:i})}),s}getScoreFunction(t,e){var r=this.prepareSearch(t,e);return this._getScoreFunction(r)}_getScoreFunction(t){const e=t.tokens,r=e.length;if(!r)return function(){return 0};const s=t.options.fields,o=t.weights,u=s.length,c=t.getAttrFn;if(!u)return function(){return 1};const g=(function(){return u===1?function(i,f){const l=s[0].field;return m(c(f,l),i,o[l]||1)}:function(i,f){var l=0;if(i.field){const p=c(f,i.field);!i.regex&&p?l+=1/u:l+=m(p,i,1)}else h(o,(p,a)=>{l+=m(c(f,a),i,p)});return l/u}})();return r===1?function(i){return g(e[0],i)}:t.options.conjunction==="and"?function(i){var f,l=0;for(let p of e){if(f=g(p,i),f<=0)return 0;l+=f}return l/r}:function(i){var f=0;return h(e,l=>{f+=g(l,i)}),f/r}}getSortFunction(t,e){var r=this.prepareSearch(t,e);return this._getSortFunction(r)}_getSortFunction(t){var e,r=[];const s=this,o=t.options,u=!t.query&&o.sort_empty?o.sort_empty:o.sort;if(typeof u=="function")return u.bind(this);const c=function(i,f){return i==="$score"?f.score:t.getAttrFn(s.items[f.id],i)};if(u)for(let i of u)(t.query||i.field!=="$score")&&r.push(i);if(t.query){e=!0;for(let i of r)if(i.field==="$score"){e=!1;break}e&&r.unshift({field:"$score",direction:"desc"})}else r=r.filter(i=>i.field!=="$score");return r.length?function(i,f){var l,p;for(let a of r)if(p=a.field,l=(a.direction==="desc"?-1:1)*F(c(p,i),c(p,f)),l)return l;return 0}:null}prepareSearch(t,e){const r={};var s=Object.assign({},e);if(d(s,"sort"),d(s,"sort_empty"),s.fields){d(s,"fields");const o=[];s.fields.forEach(u=>{typeof u=="string"&&(u={field:u,weight:1}),o.push(u),r[u.field]="weight"in u?u.weight:1}),s.fields=o}return{options:s,query:t.toLowerCase().trim(),tokens:this.tokenize(t,s.respect_word_boundaries,r),total:0,items:[],weights:r,getAttrFn:s.nesting?v:S}}search(t,e){var r=this,s,o;o=this.prepareSearch(t,e),e=o.options,t=o.query;const u=e.score||r._getScoreFunction(o);t.length?h(r.items,(g,i)=>{s=u(g),(e.filter===!1||s>0)&&o.items.push({score:s,id:i})}):h(r.items,(g,i)=>{o.items.push({score:1,id:i})});const c=r._getSortFunction(o);return c&&o.items.sort(c),o.total=o.items.length,typeof e.limit=="number"&&(o.items=o.items.slice(0,e.limit)),o}}export{A as Sifter,F as cmp,S as getAttr,v as getAttrNesting,C as getPattern,h as iterate,d as propToArray,m as scoreValue};

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.