PageSourceSearch

https://assets.tori.fi/pkg/frontpage-layout-v2/0.0.151/marketplace-navigation-bar-island.js

js tori.fi collected 2026-09-24 18:33:12 UTC 5,695 bytes, 1 lines download raw bytes

1import{n as e,t}from"./hydrate.js";import{t as n}from"./defineProperty.js";import{t as r}from"./dist.js";import{i}from"./tracking.js";import{n as a}from"./ConfigContext.js";import{t as o}from"./useSkipLinkFocus.js";import{useEffect as s,useRef as c,useState as l}from"https://assets.finn.no/npm/react/v19/react.production.min.js";var u=class extends Error{constructor(e,t){super(`Failed to fetch SVG from ${e}${t?`: ${t}`:``}`),this.name=`SvgFetchError`}},d=class extends Error{constructor(e){super(`SVG sanitization failed: ${e}`),this.name=`SvgSanitizationError`}},f=new class{constructor(){n(this,`cache`,new Map),n(this,`successTtl`,36e5),n(this,`errorTtl`,6e5)}get(e){let t=this.cache.get(e);if(!t)return null;let n=t.isError?this.errorTtl:this.successTtl;if(Date.now()-t.timestamp>n)return this.cache.delete(e),null;if(t.isError){let n=new u(e);throw n.message=t.content,n}return t.content}set(e,t,n=!1){this.cache.set(e,{content:t,timestamp:Date.now(),isError:n})}clear(){this.cache.clear()}size(){return this.cache.size}};function p(e){let t=e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,``).replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi,``).replace(/\s*on\w+\s*=\s*[^"'\s>]+/gi,``).replace(/javascript:/gi,``);return t=t.replace(/xlink:href\s*=\s*["'](?!#)[^"']*["']/gi,`xlink:href=""`),t=t.replace(/href\s*=\s*["'](?!#)[^"']*["']/gi,`href=""`),t}function m(e){try{let t=p(e);if(!t.includes(`<svg`))throw new d(`No SVG element found in content`);return t}catch(e){throw e instanceof d?e:new d(`Unexpected error: ${e instanceof Error?e.message:String(e)}`)}}async function h(e){let t=f.get(e);if(t)return t;try{let t=await fetch(e);if(!t.ok){let n=new u(e,t.status);throw f.set(e,n.message,!0),n}let n=await t.text();return f.set(e,n,!1),n}catch(t){if(t instanceof u)throw t;let n=new u(e);throw f.set(e,n.message,!0),n}}async function g(e){return m(await h(e))}var _=e(),v=({icon:e,locale:t,className:n})=>{let r=e.variants.find(e=>e.img_format===`embedded`)?.id;return r?(0,_.jsx)(`w-icon`,{name:r,size:`large`,locale:t,className:n}):null},y=({icon:e,className:t,imageError:n,setImageError:r})=>{let i=e.variants.find(e=>e.img_format===`svg`)?.locations?.light;return!i||n?null:(0,_.jsx)(`img`,{src:i,alt:e.description,role:`img`,className:t,onError:()=>r(!0),loading:`lazy`})},b=({className:e,svgContent:t,svgError:n})=>n||!t?null:(0,_.jsx)(`div`,{className:e,dangerouslySetInnerHTML:{__html:t}}),x=({icon:e,locale:t,className:n})=>{let[r,i]=l(!1),[a,o]=l(null),[c,f]=l(!1),p=e.icon_type===`icon`?e.variants.find(e=>e.img_format===`svg`)?.locations?.icon:null;s(()=>{p&&g(p).then(e=>{o(e),f(!1)}).catch(e=>{e instanceof u||e instanceof d?console.warn(`SVG processing failed for ${p}:`,e.message):console.warn(`Unexpected error processing SVG:`,e),f(!0)})},[p]);let m=!p||c;return{embedded:()=>v({icon:e,locale:t,className:n}),logo:()=>y({icon:e,className:n,imageError:r,setImageError:i}),icon:()=>b({className:n,svgContent:a,svgError:m})}[e.icon_type]?.()||(0,_.jsx)(`w-icon`,{name:`Image`,size:`large`,locale:t,className:n})},S=e=>e||``,C=e=>S(e).replace(/\s+/g,`-`),w=({market:e,index:t})=>{let{locale:n}=a(),{icon:o,label:s,destinations:c,tracking:l}=e,u=o.icon_type===`logo`;return(0,_.jsx)(`div`,{className:`text-center relative w-auto ${t>15?`lg:hidden`:``}`,children:(0,_.jsxs)(`a`,{className:`group px-4 py-8 sm:py-16 overflow-hidden text-ellipsis text-s flex flex-col items-center no-underline hover:no-underline active:no-underline focus:no-underline focus:focusable focus:[--w-outline-offset:-2px]`,href:S(c.url)||S(c.path),"data-icon-name":C(s),onClick:()=>i(l),"data-logo":u||null,target:c.force_external?`_blank`:null,id:t===0?`first-market-link`:null,children:[(0,_.jsx)(`span`,{className:`order-last s-text mt-8 md:text-14 overflow-hidden line-clamp-2 hyphens-auto hover:s-text-subtle`,children:S(s)}),(0,_.jsx)(`span`,{className:`sr-only`,children:`,\xA0`}),(0,_.jsx)(`span`,{className:`sr-only`,children:e.is_external?r.t({id:`frontpage.market-icon.internal.description.primary`,message:`Primary icon of`}):r.t({id:`frontpage.market-icon.internal.description`,message:`Icon of`})}),(0,_.jsx)(x,{icon:o,locale:n,className:`s-icon-secondary group-hover:s-icon-subtle-hover w-32 h-32`}),e.is_external&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`span`,{className:`sr-only`,children:[`,\xA0`,r.t({id:`frontpage.market-icon.internal.description.secondary`,message:`Secondary icon of`})]}),(0,_.jsx)(`w-icon`,{name:`LinkExternal`,size:`small`,locale:n,className:`absolute right-8 top-8 pointer-events-none s-icon-subtle w-16 h-16`})]})]})})},T=({exploreMore:e})=>{let{locale:t}=a(),{url:n,label:r,tracking:o}=e;return(0,_.jsx)(`div`,{className:`flex justify-end pt-8 px-16`,children:(0,_.jsxs)(`a`,{className:`flex justify-end hover:s-text-subtle`,href:n,"data-explore-more-button":!0,onClick:()=>i(o),children:[r,(0,_.jsx)(`span`,{className:`sr-only`,children:`,\xA0`}),(0,_.jsx)(`w-icon`,{name:`ChevronRight`,size:`small`,locale:t,className:`ml-6 self-center w-16 h-16`})]})})};function E({markets:e=[],exploreMore:t}){let n=c(null);return o(n,`#first-market-link`),e.length?(0,_.jsxs)(`nav`,{ref:n,"aria-labelledby":`market-grid-title`,"data-markets-pulse-wrapper":!0,className:`py-20`,children:[(0,_.jsx)(`h2`,{className:`sr-only`,id:`market-grid-title`,children:r.t({id:`title.frontpage.markets`,message:`Markets`})}),(0,_.jsx)(`div`,{className:`overflow-x-auto lg:overflow-hidden`,children:(0,_.jsx)(`div`,{className:`grid grid-flow-col grid-rows-2 auto-cols-[minmax(10.8rem,_2fr)] px-8`,children:e.map((e,t)=>(0,_.jsx)(w,{market:e,index:t},t))})}),t&&(0,_.jsx)(T,{exploreMore:t})]}):null}t(`marketplace-navigation-bar-island`,e=>(0,_.jsx)(E,{...e}));

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.