PageSourceSearch

https://portal.urbis.primaria-calimanesti.ro/assets/Search-2ff4fd9c.js

js primaria-calimanesti.ro collected 2026-09-25 02:08:07 UTC 4,869 bytes, 2 lines download raw bytes

1import{c as w,r as x,L as A}from"./primevue-ca313794.js";import{_ as L,A as C,aS as y,av as v}from"./index-cc1a661b.js";import{h as J,d as n,e as l,f as T,H as O,s as _,l as D,x as V,A as b,t as k,g as N,F as h,p as S}from"./vendor-ea0043bb.js";import"./mapbox-v3-eadefc84.js";import"./geo-1391ac6a.js";import"./mapbox-addons-be198bf9.js";import"./editor-b65e0429.js";import"./pdf-7415fc80.js";const B={name:"Search",props:{elements:{type:Array}},components:{TextInput:C},data(){return{searchTerm:null,commitedSearchTerm:null,nodes:null}},methods:{goTo(e){this.$emit("goTo",e)},getNodePath(e){return(e?.path||[]).map((r,t,c)=>({...r,command:r.navigateResult?()=>this.goTo(r.navigateResult):t===c.length-1?()=>this.goTo(e):void 0}))},getFlowNodePath(e){if(!e)return[];const r=[{label:e.data.title,icon:`mr-1 fa ${y[e.data.taskTypeId]}`,navigateResult:{node:{id:e.id},focus:{type:"node"}}}];return e.data.taskTypeId!==v.Stage&&e.data.parentDocumentTaskId&&r.unshift(...this.getFlowNodePath(this.elements.find(t=>t.id==e.data.parentDocumentTaskId))),r},buildSearchResult(e,r,t=[],c="node",a=null){return{key:`${e.id}-${c}`,node:e,target:r,focus:a,path:[...this.getFlowNodePath(e),...t.map(s=>({label:s.label,icon:s.icon?`mr-1 fa ${s.icon}`:void 0,navigateResult:s.navigateResult}))]}},getNodeSearchTarget(e){if(!e?.data)return e;const r=JSON.parse(JSON.stringify(e.data));return r.taskTypeId===v.Actions&&delete r.children,r},getActionSearchTarget(e){if(!e)return e;const r=JSON.parse(JSON.stringify(e));return delete r.children,r},getNestedSearchResults(e){const r=[];return e.data.taskTypeId!==v.Actions||!e.data.children?.length||e.data.children.forEach((t,c)=>{const a={node:{id:e.id},focus:{type:"action",actionDocumentTaskId:t.documentTaskId}};r.push(this.buildSearchResult(e,this.getActionSearchTarget(t),[{label:t.title,icon:y[t.taskTypeId],navigateResult:a}],`action-${t.documentTaskId??c}`,a.focus)),t.children?.[0]?.children?.forEach((s,d)=>{const i={node:{id:e.id},focus:{type:"process",actionDocumentTaskId:t.documentTaskId,processDocumentTaskId:s.documentTaskId}};r.push(this.buildSearchResult(e,s,[{label:t.title,icon:y[t.taskTypeId],navigateResult:a},{label:s.title,icon:y[s.taskTypeId],navigateResult:i}],`process-${t.documentTaskId??c}-${s.documentTaskId??d}`,i.focus))})}),r},isLineArray(e){return Array.isArray(e)},search(){if(this.searchTerm.length<3)return;const e=this.searchTerm.toLowerCase(),r=this.elements.filter(t=>t.type==="custom").flatMap(t=>[this.buildSearchResult(t,this.getNodeSearchTarget(t),[],"self",{type:"node"}),...this.getNestedSearchResults(t)]);this.nodes=r.filter(t=>JSON.stringify(t.target).toLowerCase().includes(e)),this.commitedSearchTerm=this.searchTerm},getRelevantSections(e){const t=JSON.stringify(e.target,null,2).split(`
2`),c=[];t.forEach((s,d)=>{s.toLowerCase().includes(this.commitedSearchTerm.toLowerCase())&&c.push(d)});const a=[];return c.forEach(s=>{const d=[];for(let i=Math.max(0,s-3);i<=Math.min(t.length-1,s+3);i++)if(i===s){const m=t[i].toLowerCase().split(this.commitedSearchTerm.toLowerCase()),f=[];for(let o=0;o<m.length;o++){let u=0;if(o>0){for(let p=0;p<o;p++)u+=m[p].length;u+=this.commitedSearchTerm.length*o}f.push(t[i].substring(u,u+m[o].length))}d.push(f)}else d.push(t[i]);a.push(d)}),a}}},E={style:{position:"sticky",top:"0",background:"var(--surface-0)"}},F={class:"p-1",style:{"background-color":"var(--surface-0)","border-radius":"var(--border-radius)",color:"var(--text-color)"}},$={style:{display:"flex","flex-direction":"column",gap:".25rem"}},M={key:0},P={key:0,style:{color:"var(--green-500)"}},j={key:1};function H(e,r,t,c,a,s){const d=J("TextInput"),i=w,m=x,f=A;return n(),l(h,null,[T("div",E,[T("form",{onSubmit:r[1]||(r[1]=O((...o)=>s.search&&s.search(...o),["prevent"])),style:{display:"flex"}},[_(d,{autofocus:"",modelValue:a.searchTerm,"onUpdate:modelValue":r[0]||(r[0]=o=>a.searchTerm=o),placeholder:e.$t("Find...")},null,8,["modelValue","placeholder"]),_(i,{style:{flex:"none"},type:"submit",icon:"fa fa-search"})],32)]),a.nodes&&!a.nodes.length&&a.commitedSearchTerm?(n(),D(m,{key:0,severity:"warn",closable:!1},{default:V(()=>[b(k(e.$t("No results found.")),1)]),_:1})):N("",!0),(n(!0),l(h,null,S(a.nodes,o=>(n(),l("div",{key:o.key},[T("div",F,[_(f,{class:"wrap-breadcrumb",model:s.getNodePath(o),pt:{root:{style:"flex-wrap: wrap;"}}},null,8,["model"]),T("div",$,[(n(!0),l(h,null,S(s.getRelevantSections(o),(u,p)=>(n(),l("div",{key:`${o.key}-${p}`,style:{border:"1px solid var(--surface-100)","border-radius":"var(--border-radius)",padding:"1rem"}},[(n(!0),l(h,null,S(u,g=>(n(),l("div",null,[s.isLineArray(g)?(n(),l("span",M,[(n(!0),l(h,null,S(g,(I,R)=>(n(),l(h,null,[b(k(I),1),R<g.length-1?(n(),l("strong",P,k(a.commitedSearchTerm),1)):N("",!0)],64))),256))])):(n(),l("span",j,k(g),1))]))),256))]))),128))])])]))),128))],64)}const Y=L(B,[["render",H]]);
2export{Y 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.