PageSourceSearch

https://www.trafikverket.se/Static/dist/cms-quicksearch.441f211dca1eaef67b45.js

js trafikverket.se collected 2026-10-01 10:32:04 UTC 3,789 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkknowit_seed_project=self.webpackChunkknowit_seed_project||[]).push([[88384],{51879(e,a,t){t.r(a),t.d(a,{default:()=>g});var l=t(41425);const n={class:"oui-date-picker__input-row"},r=["placeholder","aria-expanded","aria-activedescendant"],i=["value"],s=["aria-expanded"],o=["aria-selected","id","onclick","aria-label"],u={class:"axiom-typography--body axiom-checkbox__label",for:"checkbox--1"},c={class:"axiom-dropdown__block-link-text flex flex-justified--between"},d={class:"truncate width--1-1"};var h=t(27716);const p={name:"cms-quicksearch",props:{apiurl:{type:String},placeholdertext:{type:String}},setup(e){const a=(0,l.Kh)({items:[]}),t=(0,l.KR)(!1),n=(0,l.KR)(!1),r=(0,l.KR)(""),i=(0,l.KR)(""),s=(0,l.KR)(-1),o=(0,l.KR)(0),u=(0,l.KR)(null),c=(0,l.EW)(()=>{const e=[];if(r&&r.value.length>0){const t=new RegExp(r.value,"ig");a.items.forEach(a=>{let l={headingMatches:[],heading:a.Heading,value:a.Value},n=0;for(let e of a.Heading.matchAll(t))l.headingMatches.push({text:a.Heading.substring(n,e.index),match:!1}),n=e.index,l.headingMatches.push({text:a.Heading.substr(n,r.value.length),match:!0}),n+=r.value.length;n<a.Heading.length&&l.headingMatches.push({text:a.Heading.substring(n),match:!1}),e.push(l)})}return e}),d=async()=>{try{let a=e.apiurl+r.value,t=await fetch(a,{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error("Url: "+t.url+" Status: "+t.status+" StatusText: "+t.statusText);return await t.json()}catch(e){console.log(e.message)}};return(0,l.wB)([r],(e,l)=>{e.length&&l.length&&e[0]!==l[0]&&(async()=>{try{if(r.value.length<2||n.value)return a.items=[],t.value=!1,void(n.value=!1);let e=await d();a.items=e,a.items.length>0&&(t.value=!0)}catch(e){console.log(e.message)}})()},{deep:!0}),(0,h.X2)(u,()=>t.value=!1),{isExpanded:t,hits:a,searchInput:r,searchValue:i,highlights:c,arrowCounter:s,onArrowDown:()=>{s.value<a.items.length-1&&(s.value=s.value+1,o.value=s.value)},onArrowUp:()=>{s.value>0&&(s.value=s.value-1,o.value=s.value)},onEnter:()=>{r.value=a.items[s.value].Heading,i.value=a.items[s.value].Value,s.value=-1,t.value=!1,n.value=!0},activeDescendant:o,target:u,onClickSearchItem:e=>{let l=e.currentTarget.id.substr(e.currentTarget.id.length-1,e.currentTarget.id.length);r.value=a.items[l].Heading,i.value=a.items[l].Value,s.value=-1,t.value=!1}}}};const g=(0,t(66262).A)(p,[["render",function(e,a,t,h,p,g){return(0,l.uX)(),(0,l.CE)("div",n,[(0,l.Lk)("div",null,[(0,l.bo)((0,l.Lk)("input",{class:"oui-text-input",placeholder:t.placeholdertext,"onUpdate:modelValue":a[0]||(a[0]=e=>h.searchInput=e),"aria-expanded":h.isExpanded,type:"text",autocomplete:"off","aria-autocomplete":"both","aria-controls":"cms-search-listbox","aria-haspopup":"listbox","aria-activedescendant":"search_phrase_"+h.activeDescendant,role:"searchbox",onKeydown:[a[1]||(a[1]=(0,l.jR)((...e)=>h.onArrowDown&&h.onArrowDown(...e),["down"])),a[2]||(a[2]=(0,l.jR)((...e)=>h.onArrowUp&&h.onArrowUp(...e),["up"])),a[3]||(a[3]=(0,l.jR)(e=>h.isExpanded=!1,["esc"])),a[4]||(a[4]=(0,l.jR)((...e)=>h.onEnter&&h.onEnter(...e),["enter"]))]},null,40,r),[[l.Jo,h.searchInput]]),(0,l.Lk)("input",{id:"choosenSearchValue",type:"hidden",value:h.searchValue},null,8,i),(0,l.bo)((0,l.Lk)("ul",{class:"axiom-dropdown__list",role:"listbox",id:"cms-search-listbox","aria-expanded":h.isExpanded,"aria-live":"polite",ref:"target"},[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(h.highlights,(e,a)=>((0,l.uX)(),(0,l.CE)("li",{key:a,role:"option","aria-selected":a===h.arrowCounter||0===a,id:"search_phrase_"+a,onclick:h.onClickSearchItem,"aria-label":e.heading,style:{cursor:"pointer"}},[(0,l.Lk)("label",u,[(0,l.Lk)("span",c,[(0,l.Lk)("span",d,(0,l.v_)(e.heading),1)])])],8,o))),128))],8,s),[[l.aG,h.hits.items.length>0&&h.isExpanded]])])])}]])}}]);

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.