PageSourceSearch

https://trains.fyi/_next/static/chunks/5225-e213019352c2c536.js

js trains.fyi collected 2026-10-01 12:17:52 UTC 11,949 bytes, 43 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5225],{49915:(e,t,a)=>{a.d(t,{A:()=>n});var r=a(37876),s=a(60570),i=a(48230),l=a.n(i);function n({pages:e}){return(0,r.jsx)("nav",{"aria-label":"Breadcrumb",className:"flex",children:(0,r.jsxs)("ol",{role:"list",className:"flex items-center space-x-4 pt-6",children:[(0,r.jsx)("li",{children:(0,r.jsx)("div",{children:(0,r.jsxs)(l(),{href:"/",className:"text-gray-400 hover:text-gray-500",children:[(0,r.jsx)(s.A,{"aria-hidden":"true",className:"h-5 w-5 flex-shrink-0"}),(0,r.jsx)("span",{className:"sr-only",children:"Home"})]})})}),e.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("svg",{fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",className:"h-5 w-5 flex-shrink-0 text-gray-300",children:(0,r.jsx)("path",{d:"M5.555 17.776l8-16 .894.448-8 16-.894-.448z"})}),(0,r.jsx)(l(),{href:e.href,"aria-current":e.current?"page":void 0,className:"ml-4 text-sm font-medium text-gray-500 hover:text-gray-700",children:e.name})]})},e.name))]})})}},60570:(e,t,a)=>{a.d(t,{A:()=>s});var r=a(14232);let s=r.forwardRef(function({title:e,titleId:t,...a},s){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M9.293 2.293a1 1 0 0 1 1.414 0l7 7A1 1 0 0 1 17 11h-1v6a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-6H3a1 1 0 0 1-.707-1.707l7-7Z",clipRule:"evenodd"}))})},75458:(e,t,a)=>{a.d(t,{Iz:()=>b,MO:()=>g,x7:()=>p});var r=a(60371),s=a(75656),i=a(65364);let l="radical-sloth.myshopify.com",n=i.env.NEXT_PUBLIC_SHOPIFY_API_VERSION||"2026-07",c="trainsfyi-apparel",d=l?`https://${l}/api/${n}/graphql.json`:null,o=async(e,t={})=>{let a=await r.A.post(d,{query:e,variables:t},{headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":"8786e5c42f87518810953409bdd3721b"}});if(a.data.errors?.length)throw Error(a.data.errors.map(e=>e.message).join(", "));return a.data.data},m=`
2  id
3  title
4  handle
5  descriptionHtml
6  featuredImage { url altText }
7  images(first: 8) { edges { node { url altText } } }
8  options { name values }
9  variants(first: 20) {
10    edges {
11      node {
12        id
13        title
14        availableForSale
15        price { amount currencyCode }
16        selectedOptions { name value }
17        image { url altText }
18      }
19    }
20  }
21`,u=e=>({id:e.id,title:e.title,handle:e.handle,descriptionHtml:e.descriptionHtml,image:e.featuredImage,images:(e.images?.edges??[]).map(({node:e})=>e),options:e.options,variants:e.variants.edges.map(({node:e})=>({id:e.id,title:e.title,availableForSale:e.availableForSale,price:e.price,selectedOptions:e.selectedOptions,image:e.image}))}),h=`
22  query MerchProducts($handle: String!) {
23    collection(handle: $handle) {
24      products(first: 50) {
25        edges { node { ${m} } }
26      }
27    }
28  }
29`,x=async()=>{if(!d)return[];let e=await o(h,{handle:c});return(e?.collection?.products?.edges??[]).map(({node:e})=>u(e))},p=({fallbackData:e}={})=>{let{data:t,error:a,isLoading:r}=(0,s.Ay)(d?["merch-products",c]:null,x,{fallbackData:e,revalidateOnFocus:!1,dedupingInterval:3e5});return{products:t??[],isLoading:r&&!e,isError:a}},f=`
30  query MerchProduct($handle: String!) {
31    product(handle: $handle) {
32      ${m}
33      collections(first: 10) { edges { node { handle } } }
34    }
35  }
36`,v=async e=>{if(!d||!e)return null;let t=await o(f,{handle:e}),a=t?.product;return a&&a.collections.edges.some(({node:e})=>e.handle===c)?u(a):null},g=(e,{fallbackData:t}={})=>{let{data:a,error:r,isLoading:i}=(0,s.Ay)(d&&e?["merch-product",e]:null,()=>v(e),{fallbackData:t,revalidateOnFocus:!1,dedupingInterval:3e5});return{product:a??t??null,isLoading:i&&!t,isError:r}},y=`
37  mutation CartCreate($lines: [CartLineInput!]!) {
38    cartCreate(input: { lines: $lines }) {
39      cart { id checkoutUrl }
40      userErrors { field message }
41    }
42  }
43`,b=async e=>{let{cart:t,userErrors:a}=(await o(y,{lines:e.map(e=>({merchandiseId:e.variantId,quantity:e.quantity}))})).cartCreate;if(a?.length)throw Error(a.map(e=>e.message).join(", "));return t.checkoutUrl}},77808:(e,t,a)=>{a.d(t,{A:()=>s});var r=a(14232);let s=r.forwardRef(function({title:e,titleId:t,...a},s){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?r.createElement("title",{id:t},e):null,r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"}))})},81946:(e,t,a)=>{a.d(t,{$:()=>n,v:()=>c});var r=a(37876),s=a(14232);let i=(0,s.createContext)(),l="trainsfyi_merch_cart",n=({children:e})=>
43{let[t,a]=(0,s.useState)([]),[n,c]=(0,s.useState)(!1),[d,o]=(0,s.useState)(!1);(0,s.useEffect)(()=>{try{let e=window.localStorage.getItem(l);e&&a(JSON.parse(e))}catch{}c(!0)},[]),(0,s.useEffect)(()=>{n&&window.localStorage.setItem(l,JSON.stringify(t))},[t,n]);let m=(0,s.useCallback)((e,t,r)=>{a(a=>a.find(t=>t.variantId===e)?a.map(a=>a.variantId===e?{...a,quantity:a.quantity+t}:a):[...a,{variantId:e,quantity:t,...r}]),o(!0)},[]),u=(0,s.useCallback)((e,t)=>{a(a=>t<=0?a.filter(t=>t.variantId!==e):a.map(a=>a.variantId===e?{...a,quantity:t}:a))},[]),h=(0,s.useCallback)(e=>{a(t=>t.filter(t=>t.variantId!==e))},[]),x=(0,s.useCallback)(()=>a([]),[]),p=(0,s.useCallback)(()=>o(!0),[]),f=(0,s.useCallback)(()=>o(!1),[]),v=(0,s.useMemo)(()=>t.reduce((e,t)=>e+t.quantity,0),[t]),g=(0,s.useMemo)(()=>t.reduce((e,t)=>e+Number(t.price?.amount??0)*t.quantity,0),[t]),y=t[0]?.price?.currencyCode??"USD";return(0,r.jsx)(i.Provider,{value:{items:t,addItem:m,updateQuantity:u,removeItem:h,clear:x,totalQuantity:v,totalPrice:g,currencyCode:y,isCartOpen:d,openCart:p,closeCart:f},children:e})},c=()=>{let e=(0,s.useContext)(i);if(!e)throw Error("useMerchCart must be used within a MerchCartProvider");return e}},96972:(e,t,a)=>{a.d(t,{A:()=>g});var r=a(37876),s=a(85392),i=a(74),l=a(93408),n=a(65685),c=a(14232),d=a(81946),o=a(73865),m=a(75458);let u=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD"}).format(Number(e));function h(){let{t:e}=(0,o.B)(),t=(0,d.v)(),[a,s]=(0,c.useState)(!1),[i,l]=(0,c.useState)(!1),{isCartOpen:h,closeCart:x}=t;(0,c.useEffect)(()=>{if(!h)return;document.body.style.overflow="hidden";let e=e=>"Escape"===e.key&&x();return window.addEventListener("keydown",e),()=>{document.body.style.overflow="unset",window.removeEventListener("keydown",e)}},[h,x]);let p=async()=>{l(!1),s(!0);try{let e=await (0,m.Iz)(t.items);window.location.href=e}catch{l(!0),s(!1)}};return(0,r.jsxs)("div",{className:`fixed inset-0 z-50 ${t.isCartOpen?"":"pointer-events-none"}`,"aria-hidden":!t.isCartOpen,children:[(0,r.jsx)("div",{onClick:t.closeCart,className:`absolute inset-0 bg-gray-500/75 transition-opacity duration-300 ${t.isCartOpen?"opacity-100":"opacity-0"}`}),(0,r.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":e("merchCartTitle"),className:`absolute inset-y-0 right-0 flex w-full max-w-md flex-col bg-white shadow-xl transition-transform duration-300 ${t.isCartOpen?"translate-x-0":"translate-x-full"}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-4 border-b border-gray-200",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-gray-900",children:e("merchCartTitle")}),(0,r.jsx)("button",{onClick:t.closeCart,className:"rounded-md p-1 text-gray-400 hover:text-gray-600","aria-label":e("merchCartClose"),children:(0,r.jsx)(n.A,{className:"h-5 w-5","aria-hidden":"true"})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-4",children:0===t.items.length?(0,r.jsx)("p",{className:"text-sm text-gray-500",children:e("merchCartEmpty")}):(0,r.jsx)("ul",{className:"divide-y divide-gray-100",children:t.items.map(a=>(0,r.jsxs)("li",{className:"flex items-center gap-3 py-3",children:[a.image?.url&&(0,r.jsx)("img",{src:a.image.url,alt:a.title,className:"h-16 w-16 rounded-md object-cover"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900 truncate",children:a.title}),a.variantTitle&&"Default Title"!==a.variantTitle&&(0,r.jsx)("p",{className:"text-xs text-gray-500",children:a.variantTitle}),(0,r.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,r.jsx)("label",{className:"text-xs text-gray-500",children:e("merchQuantity")}),(0,r.jsx)("input",{type:"number",min:"1",value:a.quantity,onChange:e=>t.updateQuantity(a.variantId,Number(e.target.value)),className:"w-14 rounded-md border-gray-300 text-sm"})]})]}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:u(Number(a.price.amount)*a.quantity,a.price.currencyCode)}),(0,r.jsx)("button",{onClick:()=>t.removeItem(a.variantId),className:"mt-1 text-xs text-gray-400 hover:text-red-600",children:e("merchCartRemove")})]})]},a.variantId))})}),(0,r.jsxs)("div",{className:"border-t border-gray-200 px-4 py-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900",children:e("merchCartTotal")}),(0,r.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:u(t.totalPrice,t.currencyCode)})]}),i&&(0,r.jsx)("p",{className:"mb-2 text-sm text-red-600",children:e("merchCheckoutError")}),(0,r.jsx)("button",{onClick:p,disabled:a||0===t.items.length,className:"w-full rounded-md bg-blue-800 px-4 py-2.5 text-sm font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",children:a?e("merchCheckoutStarting"):e("merchCheckout")})]})]})]})}let x=c.forwardRef(function({title:e,titleId:t,...a},r){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},a),e?c.createElement("title",{id:t},e):null,c.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 10.5V6a3.75 3.75 0 1 0-7.5 0v4.5m11.356-1.993 1.263 12c.07.665-.45 1.243-1.119 1.243H4.25a1.125 1.125 0 0 1-1.12-1.243l1.264-12A1.125 1.125 0 0 1 5.513 7.5
43h12.974c.576 0 1.059.435 1.119 1.007ZM8.625 10.5a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm7.5 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))});var p=a(48230),f=a.n(p);function v(){let{t:e}=(0,o.B)(),{totalQuantity:t,openCart:a}=(0,d.v)();return(0,r.jsx)("div",{className:"bg-gray-900",children:(0,r.jsx)("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:(0,r.jsxs)("div",{className:"flex h-14 items-center justify-between",children:[(0,r.jsx)(f(),{href:"/merch",className:"text-white text-sm font-semibold hover:text-gray-200",children:e("merchPageTitle")}),(0,r.jsxs)("button",{onClick:a,className:"relative inline-flex items-center gap-1.5 rounded-md p-2 text-white hover:bg-white/10","aria-label":e("merchCartOpen"),children:[(0,r.jsx)(x,{className:"h-5 w-5","aria-hidden":"true"}),t>0&&(0,r.jsx)("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-blue-600 px-1 text-[10px] font-semibold text-white",children:t})]})]})})})}function g({head:e,children:t}){return(0,r.jsx)(d.$,{children:(0,r.jsxs)("div",{className:"bg-white",children:[(0,r.jsx)(l.A,{title:"Merch",description:"Official trains.fyi merch — for people who check the train tracker before they check the weather.",canonical:"/merch/",type:"website",keywords:"trains.fyi merch, train shirt, train hat, transit apparel",...e}),(0,r.jsx)(i.A,{}),(0,r.jsx)(v,{}),(0,r.jsx)("main",{className:"isolate",children:t}),(0,r.jsx)(s.A,{}),(0,r.jsx)(h,{})]})})}}}]);

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.