PageSourceSearch

https://static.varus.ua/azgwc-blob-static-varus-prod-01/vsf/dist/0923-v6cf1fb81/app-7871766e.js

js varus.ua collected 2026-09-24 20:53:53 UTC 10,648 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkvue_storefront=self.webpackChunkvue_storefront||[]).push([[8088],{9039:function(fe,ae,g){g.d(ae,{t:function(){return Ee}});const l="search-module",w=l+"/SEARCH_SET_RESULT_PRODUCTS",W=l+"/SEARCH_ADD_RESULT_PRODUCTS",B=l+"/SEARCH_SET_RESULT_CATEGORIES",Q=l+"/SEARCH_SET_RESULT_STATS",Y=`${l}/SET_CURRENT_CATEGORY`,V=`${l}/SET_SEARCH_TOTAL_PRODUCTS`,z=`${l}/SET_LAST_SEARCH_QUERY_HASH`,P=`${l}/SET_LAST_SEARCH_AUTOCOMPLETE_HASH`,oe=l+"/SET_FILTER_PRICE",J=l+"/SET_META_TAGS",I=l+"/SET_AUTOCOMPLETE_RESULT",H=l+"/SET_LOADING_AUTOCOMPLETE",v=l+"/SET_LOADING_RESULT_PAGE",K=l+"/SET_LOADED_RESULT_PAGE",F=l+"/SET_AVAILABLE_FILTERS",O=l+"/SET_FILTER_LABELS",$=l+"/SET_ACTIVE_FILTER",X=l+"/SET_AI_SEARCH_RESULT",Z=l+"/SET_AI_SEARCH_SUGGEST",U=l+"/SET_AI_SEARCH_RESULT_LOADING",le=l+"/SET_AI_SEARCH_SUGGEST_LOADING";var D=g(89615),y=g(3312),ne=g(74802),G=g.n(ne),ue=g(60083),b=g(29709),ce=g(57754),ie=g(56422),M=g(30397),C=g(91061),Se=g(47301),de=g(95283);const k={Accept:"application/json, text/plain, */*","Content-Type":"application/json"},j={loadAiSearch:async e=>{try{const t=[];e.q&&t.push(`query=${e.q}`),t.push("multi_search_limit=10","llm_search_limit=10","llm_product_filtering_limit=10","fields=true"),e.location&&t.push(`location=${e.location}`);const s=[(0,M.A)(y.$W.aiSearch,"search_endpoint")];t.length&&s.push(t.join("&"));const o=await(0,b.A)(s.join("?"),{method:"GET",headers:k}),r=await o.json();return{code:o?.status,result:r}}catch(t){return(0,C.TL)(C.TN.Search,"syncHandler:loadAiSearch:error",{error:t}),{code:999,result:null}}},loadAiSuggest:async e=>{try{const t=[];e.q&&t.push(`query=${e.q}`),t.push("multi_search_limit=10","llm_search_limit=10","llm_product_filtering_limit=10","fields=true");const s=[(0,M.A)(y.$W.aiSearch,"suggestions_endpoint")];t.length&&s.push(t.join("&"));const o=await(0,b.A)(s.join("?"),{method:"GET",headers:k}),r=await o.json();return{code:o?.status,result:r}}catch(t){return(0,C.TL)(C.TN.Search,"syncHandler:loadAiSuggest:error",{error:t}),{code:999,result:[]}}},sendAiFeedback:async e=>{try{return Se.P.execute({url:(0,de.GG)((0,M.A)(y.$W.aiSearch,"feedback_endpoint")),payload:{method:"POST",mode:"cors",headers:k,body:JSON.stringify(e)}})}catch(t){return(0,C.TL)(C.TN.Search,"syncHandler:sendAiFeedback:error",{error:t}),{code:999,result:[]}}}};var ee=g(27638),ge={async setCategory({commit:e},t){e(Y,t)},async setSearchMetaTag({commit:e,dispatch:t}){const s=await t("config-varus/get",{path:"search_meta_templates_search_meta_title"},{root:!0}),o=await t("config-varus/get",{path:"search_meta_templates_search_meta_description"},{root:!0}),r=await Promise.all([s,o]).then(a=>a);e(J,r)},async multisearch({rootState:e,rootGetters:t},{searchText:s="",autocomplete:o=!1,limit:r=40,offset:a=0,categories:n=null,category:c=null,fields:i=null,sort:u=null,filters:p=null}){const _=e.user.current?.id,h=t["cart/getCartToken"],S=_||h||"guest",A=(0,ue.m1)().storeCode==="ua"?"uk":"ru",f=t["shipping-module/getCurrentRegion"]?.url_key||"default",L=t["shipping-module/getCurrent"]?.shop?.tms_id||f,d=[`id=${y.$W.multisearch.siteId}`,`query=${encodeURIComponent(s)}`,`uid=${S}`,`lang=${A}`,`tags=${window.innerWidth<=768?2:1}`,`key=${y.$W.multisearch.apiKey}`];L&&d.push(`location=${L}`),r&&d.push(`limit=${r}`),a&&d.push(`offset=${a}`),(n||n===0)&&d.push(`categories=${n}`),c&&d.push(`t=${c}`),i&&d.push(`fields=${i}`),o&&d.push("autocomplete=true"),u&&d.push(`sort=${u}`),p&&d.push(`filters=${encodeURIComponent(JSON.stringify(p))}`);const m=d.join("&"),T=`${y.$W.multisearch.api}?${m}`;return(0,b.A)(T).then(x=>(0,ie.j)(x))},async loadProductsForSearch({dispatch:e},{productIDs:t,onlyInStock:s}){const o={ids:t,manualSort:!0};return s&&(o.onlyInStock=!0),e("product/getProductsByID",o,{root:!0})},async multisearchPrepareItems({dispatch:e},{productIDs:t,categoriesIDs:s,onlyInStock:o}){const[r,a]=await Promise.allSettled([e("loadProductsForSearch",{onlyInStock:o,productIDs:t}),e("category-next/findCategories",{filters:{id:s},size:s.length,includeFields:ee.A.categorySearchSmall.includeFields,excludeFields:ee.A.categorySearchSmall.excludeFields},{root:!0})]).then(i=>i.map(u=>u?.value||null)),n=t.map(i=>r.find(u=>+u.id==+i)).filter(i=>!!i),c=s.map(i=>a.find(u=>+u.id==+i)).filter(i=>!!i);return{products:n,categories:c}},async multisearchAutocompleteClear({commit:e}){e(H,!1),e(P,""),e(I,{query:"",total:0,corrected:null,results:{suggest:[],categories:[],brands:[],items:[]}})},async multisearchCorrectionClear({commit:e,state:t,rootGetters:s}){const o=t.autocomplete?.corrected?.phrase;if(!o)return;
1const r=s["shipping/getShippingDetails"].shopId,a=G()({searchText:o,shopId:r});e(P,a),e(I,{...t.autocomplete,corrected:null})},async multisearchAutocomplete({commit:e,dispatch:t,rootGetters:s,state:o},{searchText:r}={searchText:""}){try{if(r.length===0)return t("multisearchAutocompleteClear");const a=s["shipping/getShippingDetails"].shopId,n=G()({searchText:r,shopId:a});if(n===o.autocompleteHash)return;e(P,n),e(H,!0);const c=await t("multisearch",{searchText:r,autocomplete:!0}),i=(c?.results?.items||[]).map(S=>S.id),u=(c?.results?.categories||[]).map(S=>S.id),{products:p,categories:_}=await t("multisearchPrepareItems",{productIDs:i,categoriesIDs:u,onlyInStock:!0}),h=p.map(D.fk);e(I,{query:c?.query||"",total:c?.total||0,corrected:c?.corrected||null,results:{suggest:c?.results?.suggest||[],categories:_,brands:c?.results?.brands||[],items:h}})}catch{t("multisearchAutocompleteClear")}finally{e(H,!1)}},prepareFilters({commit:e},t){try{const s=(t||[]).reduce((r,a)=>a.name==="price"?(r.price={type:"price",from:a.range.from,to:a.range.to,min:a.range.min,max:a.range.max},r):(r[a.name]=Object.keys(a.values).sort()?.map(n=>({id:n,label:n,type:a.name})),r),{}),o=t.reduce((r,a)=>(r[a.name]=a.title||a.name,r),{});e(F,s),e(O,o)}catch{e(F,{}),e(O,{})}},setSearchFilter({state:e,commit:t},{filter:s,active:o}){if(!s||!s?.type)return;const r=e.activeFilters;r[s?.type]=(r[s?.type]||[]).filter(a=>a.id!==s?.id),o||(r[s?.type]||(r[s?.type]=[]),r[s?.type].push(s)),r[s?.type].length||delete r[s?.type],t($,r)},resetFilterSearch({commit:e}){e($,{})},async loadSearch({commit:e,rootGetters:t,dispatch:s,state:o},r){let a=!0;try{const{sort:n=ce.r[0].id,search:c,page:i=1,size:u=40,isLoadMore:p=!1,category:_=null,filters:h={}}=r,S=((i||1)-1)*u,A=t["shipping-module/getCurrentRegion"]?.url_key||"default",f=t["shipping-module/getCurrent"]?.shop?.tms_id||A,L=Object.keys(h).reduce((E,R)=>R==="price"?(E[R]={from:h[R]?.[0]?.from,to:h[R]?.[0]?.to},E):(E[R]=h[R].map(q=>q.id),E),{}),d=G()({offset:S,size:u,isLoadMore:p,category:_,search:c,location:f,sort:n,fm:L});if(d===o.lastSearchQueryHash)return;a=!1,y.$W.aiSearch?.enabled&&c&&i===1&&s("aiSearchResult",{q:c}),e(z,d),e(v,!0);const m={searchText:c,offset:S,limit:u,categories:0,fields:"id",filters:L};_&&(m.category=_),n&&(m.sort=n);const T=await s("multisearch",m),x=T.results.items.map(E=>E.id),pe=T.results.categories.map(E=>E.id),{products:se,categories:_e}=await s("multisearchPrepareItems",{productIDs:x,categoriesIDs:pe,onlyInStock:!1}),re=T.results.count||T.total;e(Q,{totalPages:Math.ceil(re/u),totalProducts:re});const Ae=_e.map(E=>{const R=T.results.categories.find(q=>+q.id==+E.id);return{...E,countProduct:R.count}});s("prepareFilters",T?.results?.filters||[]),e(V,T.total),p?e(W,{products:se}):e(w,{products:se}),e(B,Ae)}finally{!a&&e(v,!1),!a&&e(K,!0),s("ui/setPagingLoading",!1,{root:!0})}},async aiSearchResult({dispatch:e,commit:t,state:s,rootGetters:o},r){try{if(s.aiSearch?.result?.q===r.q)return s.aiSearch?.result;const a=o["shipping-module/getCurrentRegion"]?.url_key||"default";r.location=o["shipping-module/getCurrent"]?.shop?.tms_id||a,t(U,!0);const{result:n,code:c}=await j.loadAiSearch(r);if(c!==200||!n.results)return null;const i=Object.keys(n.results);let u=[];const p=[];for(const S of i)u.push({key:S,...n.results[S]}),p.push(...n.results[S]?.items?.map(A=>{const[f]=A.id.split("_");return f}));const[_]=await Promise.all([e("loadProductsForSearch",{productIDs:p,onlyInStock:!0}),e("cmsBlock/single",{value:"ai-search-about"},{root:!0})]);u=u.reduce((S,A)=>{const f=[];for(const L of A.items){const[d]=L.id.split("_"),m=_.find(T=>+T.id==+d);m&&f.push(m)}return f.length&&(A.items=f,S.push(A)),S},[]);const h={q:r.q,explanation:n?.explanation||"",list:u||[]};return t(X,h),h||null}catch{return null}finally{t(U,!1)}},async aiSearchSuggest({commit:e},t){try{const{code:s,result:o}=await j.loadAiSuggest(t);return s!==200?[]:(e(Z,o),o||[])}catch{return null}finally{e(U,!1)}},async aiFeedbackSend(e,t){try{const{code:s}=await j.sendAiFeedback(t);return s!==200?null:!0}catch{return!1}}},he={getSearchProducts:e=>e.searchResultProducts,getCategories:e=>e.categories,getSearchResultStats:e=>e.resultStats,getTotalPages:e=>e.resultStats.totalPages,getTotalProducts:e=>e.resultStats.totalProducts,getSearchTotalProducts:e=>e.searchTotalProducts,getCurrentCategory:e=>e.currentCategory,getAvailableFilters:e=>e.availableFilters,getFilterLabels:e=>e.filterLabels,getCurrentFilters:e=>e.activeFilters,getFilterPrice:e=>e.filterPrice,getMetaTags:e=>e.metaTags,getSearchResult:e=>e.autocomplete,getLoadingAutocomplete:e=>e.loading.autocomplete,getLoadingResultPage:e=>e.loading.resultPage,getLoadedResultPage:e=>e.loaded.resultPage},Te={[w](e,{products:t}){e.searchResultProducts=t.map(D.fk)},[W](e,{products:t}){e.searchResultProducts.push(...t.map(D.fk))},[B](e,t){e.categories=[...t]},[Y](e,t){e.currentCategory=t},[Q](e,t){e.resultStats=t},[V](e,t){e.searchTotalProducts=t},[z](e,t){e.lastSearchQueryHash=t},[P](e,t){e.autocompleteHash=t},[oe](e,t){e.filterPrice=t},[J](e,t){e.metaTags=t},[I](e,t){e.autocomplete=t},[H](e,t){e.loading.autocomplete=t},[v](e,t){e.loading.resultPage=t},[K](e,t){e.loaded.resultPage=t},[F](e,t){e.availableFilters=t},[O](e,t){e.filterLabels=t},[O](e,t){e.filterLabels=t},[$](e,t){e.activeFilters={...t||{}}},[X](e,t){e.aiSearch.result={...t||{}}},[Z](e,t){e.aiSearch.suggests={...t||{}}},[U](e,t){e.loading.ai_result=t===!0},[le](e,t){e.loading.ai_suggest=t===!0}};const te={namespaced:!0,state:{searchResultProducts:[],categories:[],availableFilters:{},filterLabels:{},resultStats:{},currentCategory:null,searchTotalProducts:0,lastSearchQueryHash:"",autocompleteHash:"",activeFilters:{},filterPrice:{},metaTags:[],aiSearch:{result:null,suggests:[]},loading:{ai_result:!1,ai_suggest:!1,autocomplete:!1,resultPage:!0},loaded:{resultPage:!1},autocomplete:{corrected:null,query:"",total:0,results:{suggest:[],categories:[],brands:[],items:[]}}},actions:ge,getters:he,mutations:Te},N="search-module",Ee=function({store:e},t){t?.[N]&&(te.state=t[N]),e.registerModule(N,te)}
1}}]);

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.