1import{j as o,a as i,B as C,R as d,d as I,o as F,F as A,g as L,L as D,u as O,r as P}from"./index.c5103936.js";import{u as T,c as q,R as z,r as U,l as Q,P as p}from"./application.a0f95e67.js";import{I as H,s as R,m as x,a as W,M as S,R as v,e as y}from"./cache-controller.c08af390.js";import{j as Y}from"./index.4d1ebec1.js";import"./not-found.cb7e16d8.js";function b(e){const t=decodeURI(e).split("/").map(u=>u.trim()).filter(u=>u.length>0).slice(1),a={page:1};return t.length<1?a:t.length==2&&!isNaN(parseInt(t[1]))?(a.tag=t[0],a.page=parseInt(t[1]),a):(isNaN(parseInt(t[0]))?a.tag=t[0]:a.page=parseInt(t[0]),a)}function _(e){return o("div",{className:"materials-search-block ui flex row w-100 gap",children:[i(H,{placeholder:"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0442\u0435\u043A\u0443\u0449\u0435\u043C\u0443 \u0440\u0430\u0437\u0434\u0435\u043B\u0443",onInput:e.setQuery,onReturn:e.onSearch}),i(C,{onClick:e.onSearch,icon:"bi bi-search",children:"\u041F\u043E\u0438\u0441\u043A"})]})}function $(e){const[t,a]=d.useState(e.defaultPage?e.defaultPage:1),u=Array(e.total).fill(0).map((l,c)=>String(c+1));e.setPageRef&&(e.setPageRef.current=a);let n=u.slice(0,e.splitBy),s=u.slice(-e.splitBy+1),r=[];if(t>=e.splitBy){let l=t-(e.splitBy-1)+1;if(l=l>3?3:l,n=u.slice(0,l-1),r=u.slice(t-2,t+1),s=u.slice(-e.splitBy+(3-(3-l))),t-1>=e.total-e.splitBy){s=[];let c=t-2;e.total-c<e.splitBy+1&&(c=e.total-(e.splitBy+1)),r=u.slice(c,e.total)}}e.total<e.splitBy&&(s=[]);const h=[...n,...r.length>0?["..."]:[],...r,...s.length>0?["..."]:[],...s],w=i("div",{className:"pagination-switch-buttons ui flex row center-jc w-fit wrap",children:h.map((l,c)=>{if(l=="...")return i("span",{className:"page-switch-placeholder",children:"..."},c*Math.random());const g=parseInt(l);return i("div",{className:I("page-switch",{select:g==t}),onClick:()=>{a(g),e.onPageChange&&e.onPageChange(g)},children:l},g)})});return o("div",{className:"pagination-component w-fit ui flex column center-ai",children:[e.topSwitches&&w,i("div",{className:"pagination-page-content ui flex column w-100",children:e.children}),w]})}function G(e){const t=F();return e.total<=1?i("div",{className:"ui flex row wrap w-100 pagination-page-content",children:e.children}):i($,{total:e.total,splitBy:4,topSwitches:!0,onPageChange:a=>{t("/"+["search",e.tag,a].filter(u=>u&&String(u).length>0).join("/")),e.onPageChange&&e.onPageChange()},setPageRef:e.setPageRef,children:e.children})}function J(e){let t={\u0430:"a",\u0431:"b",\u0432:"v",\u0433:"g",\u0434:"d",\u0435:"e",\u0451:"e",\u0436:"zh",\u0437:"z",\u0438:"i",\u0439:"j",\u043A:"k",\u043B:"l",\u043C:"m",\u043D:"n",\u043E:"o",\u043F:"p",\u0440:"r",\u0441:"s",\u0442:"t",\u0443:"y",\u0444:"f",\u0445:"h",\u0446:"ts",\u0447:"ch",\u0448:"sh",\u0449:"sch",\u044B:"y",\u044D:"e",\u044E:"yu",\u044F:"ya"},a=e.replace(/[ÑÑ]/g,"").replace(/\s/g,"-");return Object.entries(t).forEach(([u,n])=>a=a.replace(RegExp(u.toLocaleUpperCase(),"g"),n.toUpperCase()).replace(RegExp(u,"g"),n)),a}function K(e){const[t,a]=d.useState(!0),u=e.tag||"search",[n,s]=d.useState();return T({setMaterial:s,identifier:J(u).toLowerCase(),setLoading:a}),o(A,{children:[i(L,{display:t}),n&&i(q,{material:n,strict:!0})]})}function V(e){const t=u=>{const n=new Q.exports.StringProcessor(u);return n.clean,n.limitWordsCount(20),n.entry},a=o("div",{className:"search-result-item ui flex column",children:[e.material.preview!=="none"&&i("div",{className:"preview-image ui w-100",style:{backgroundImage:`url("${R.getFile(e.material.preview,!1)}")`,height:300}}),o("div",{className:"material-meta ui padding-20 flex column gap",children:[i("span",{className:"item-title ui fz-20 fw-700",children:e.material.title}),i("span",{className:"material-date ui opacity-65",children:Y(new Date(parseInt(e.material.datetime)*1e3))}),i("div",{className:"material-description",children:i(z,{remarkPlugins:U,children:t(e.material.description)})})]})]});return i(D,{to:x(e.material.identifier,W.material),className:"ui clean search-result-item-holder",children:a})}async function M(e){e.setLoading&&e.setLoading(!0);const t=Date.now(),a=b(e.pathname),u=new S({[v.limitSearchResponse]:e.query?e.materialsPerPage*2:e.materialsPerPage});e.query?u.add({[y.content]:e.query}):u.add({[v.searchOffset]:e.materialsPerPage*(a.page-1)}),a.tag&&u.add({[y.tags]:a.tag}),u.add({[y.excludeEmpty]:!0});const n=await fetch(x(R.searchMaterials),u.fetchObject).then(r=>r.json()).catch(e.setError);if(!e.query){const r=await fetch(x(R.getTotalMaterials),new S({[y.tags]:a.tag?a.tag:"NOT_EMPTY"}).fetchObject).then(h=>h.json()).catch(e.setError);r.success||e.setError&&e.setError("total-fetch-error"),e.setTotalMaterials(r.responseContent)}const s=Date.now()-t;await new Promise(r=>setTimeout(r,s<300?300:300-s)),e.mounted.current&&(e.query&&e.setTotalMaterials(0),e.setMaterials&&e.setMaterials(n.responseContent||[]),e.setLoading&&e.setLoading(!1))}function ue(){const[e,t]=d.useState(!0),[a,u]=d.useState([]),[n,s]=d.use
1State(),[r,h]=d.useState(),[w,l]=d.useState(0),c=O().pathname,g=P.exports.useRef(),E=P.exports.useRef(!1),m=P.exports.useRef(null),f=b(c),N=15;P.exports.useLayoutEffect(()=>(E.current=!0,M({materialsPerPage:N,setTotalMaterials:l,pathname:c,mounted:E,query:r,setLoading:t,setError:s,setMaterials:u}).then(()=>g.current&&g.current(f.page)),()=>{E.current=!1}),[f.tag,f.page]);const j=i(G,{total:Math.ceil(w/N),tag:f.tag,setPageRef:g,onPageChange:()=>{!m.current||m.current.scrollTop>=m.current.scrollHeight/2&&m.current.scrollTo({top:0,behavior:"smooth"})},children:a.map(B=>i(V,{material:B},B.identifier))}),k=()=>{M({materialsPerPage:N,setTotalMaterials:l,pathname:c,mounted:E,query:r,setLoading:t,setError:s,setMaterials:u})};return o(p,{loader:i(L,{display:e,error:n}),ref:m,children:[i(K,{tag:f.tag}),o("div",{className:"search-result ui flex center-ai w-100 gap",children:[i(_,{setQuery:h,onSearch:k,query:r}),Boolean(a.length)?j:o("div",{className:"no-materials ui flex column gap limit-460",children:[o("div",{className:"warning-title ui flex row gap fz-20",children:[i("i",{className:"bi bi-diagram-3"}),i("span",{className:"warning-title-text ui fw-700",children:"\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E"})]}),o("span",{className:"description",children:["\u0412 \u0434\u0430\u043D\u043D\u043E\u043C \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u043D\u0438 \u043E\u0434\u043D\u043E\u0433\u043E \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u0430, \u043F\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043D\u0430 \u0432\u043A\u043B\u0430\u0434\u043A\u0443 ",i("b",{children:"\xAB\u0412\u0441\u0435 \u043D\u043E\u0432\u043E\u0441\u0442\u0438\xBB"})," \u0438\u043B\u0438 \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u043A \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0443, \u0435\u0441\u043B\u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u044D\u0442\u043E \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435 \u043E\u0448\u0438\u0431\u043A\u043E\u0439"]}),o("div",{className:"buttons-holder ui flex row gap wrap center-ai",children:[i(D,{to:"/",className:"ui clean",children:i(C,{children:"\u041D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E"})}),i(D,{to:"/search",className:"ui clean padding-20",children:"\u0412\u0441\u0435 \u043D\u043E\u0432\u043E\u0441\u0442\u0438"})]})]})]})]})}export{ue as default};
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.