PageSourceSearch

https://www.stanstedairport.com/_next/static/chunks/9313.89083575da448604.js

js stanstedairport.com collected 2026-09-24 17:42:16 UTC 14,988 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9313],{10835:(e,t,a)=>{a.d(t,{be:()=>I,Yc:()=>_,Qg:()=>f});var r=a(37876),n=a(14232);let o="SET_LIVE_DATA",i="CLEAR_LIVE_DATA",l="SET_HISTORIC_DATA",s="CLEAR_HISTORIC_DATA",c="SET_ERROR_STATUS",d="CLEAR_ERROR_STATUS",p={INIT:(e,t)=>t.payload,[o]:(e,t)=>({...e,liveData:{data:t.payload}}),[i]:e=>({...e,liveData:{data:[]}}),[l]:(e,t)=>({...e,historicData:{data:t.payload}}),[s]:e=>({...e,historicData:{data:[]}}),SET_PLAYBACK_DATA:(e,t)=>({...e,data:t.payload}),SET_LOADING_STATUS:(e,t)=>({...e,loading:t.payload}),[c]:(e,t)=>({...e,error:t.payload}),[d]:e=>({...e,error:null})},u=(e,t)=>{let a=p[t.type];return a?a(e,t):e};var T=a(24368),y=a(76381),S=a(19645);let D={isLoading:!1,error:null,liveData:{data:null},historicData:{data:null},data:null},A=(0,n.createContext)(null),E=(0,n.createContext)(null),h=async(e,t,a)=>{let r=[["Auth Token",!a],["Airport Code",!t]].filter(([e,t])=>t).map(([e])=>e);if(r.length>0)return e({type:"SET_ERROR_STATUS",payload:`MEASURES API: Missing ${r.join(" & ")}`}),!1;e({type:"SET_LOADING_STATUS",payload:!0});try{let r=await fetch(`${y.AOP.Measures.API}/${t}/v1/measure/${t}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:a}});if(!r.ok){let t=`Failed to fetch live data: ${r.status} ${r.statusText}`;return console.error(t),e({type:"SET_ERROR_STATUS",payload:t}),!1}let n=await r.json();return e({type:"SET_LIVE_DATA",payload:n}),!0}catch(t){e({type:"SET_ERROR_STATUS",payload:t})}finally{e({type:"SET_LOADING_STATUS",payload:!1})}},_=async(e,t,a,r,n)=>{let o=[["Auth Token",!a],["Airport Code",!t]].filter(([e,t])=>t).map(([e])=>e);if(o.length>0)return e({type:"SET_ERROR_STATUS",payload:`MEASURES API: Missing ${o.join(" & ")}`}),!1;e({type:"SET_LOADING_STATUS",payload:!0});try{let o=await fetch(`${y.AOP.Measures.API}/${t}/v1/historicmeasure/${t}${r?`?eventStartDate=${encodeURIComponent(r.toISOString())}`:""}${n?`&eventEndDate=${encodeURIComponent(n.toISOString())}`:""}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:a}});if(!o.ok){let t=`Failed to fetch historic data: ${o.status} ${o.statusText}`;return console.error(t),e({type:"SET_ERROR_STATUS",payload:t}),!1}let i=await o.json();return e({type:"SET_HISTORIC_DATA",payload:i}),!0}catch(t){console.warn(t),e({type:"SET_ERROR_STATUS",payload:t})}finally{e({type:"SET_LOADING_STATUS",payload:!1})}},I=({children:e})=>{let[t,a]=(0,n.useReducer)(u,D),[o,i]=(0,n.useState)(!1),l=(0,n.useRef)(null),s=(0,n.useRef)(null),c=(0,n.useRef)(null),d=(0,T.kv)(),{user:p}=(0,S.uT)();(0,n.useEffect)(()=>{i(!0)},[]);let y=(0,n.useRef)({airportCode:d?.airportCode,isPlayingBack:d?.playback?.isPlayingBack,currentTimestamp:d?.playback?.currentTimestamp,startDate:d?.filters?.date?.start,idToken:p?.id_token});(0,n.useEffect)(()=>{let e,t;if(!o||!p?.id_token||!d?.airportCode)return()=>{};l.current&&(clearInterval(l.current),l.current=null),s.current&&(clearTimeout(s.current),s.current=null),c.current&&(clearInterval(c.current),c.current=null);let r=async()=>{try{if(d?.playback?.isPlayingBack&&d?.playback?.currentTimestamp){let e=new Date(d.playback.currentTimestamp),t=new Date(e);t.setMinutes(t.getMinutes()+1),await _(a,d.airportCode,p?.id_token,e,t)}else await h(a,d.airportCode,p?.id_token)}catch(e){console.warn("Failed to fetch measures data",e)}},n=(t=[],y.current.airportCode!==d.airportCode&&(t.push("airportCode changed"),y.current.airportCode=d.airportCode),y.current.isPlayingBack!==d?.playback?.isPlayingBack&&(t.push("playback state changed"),y.current.isPlayingBack=d?.playback?.isPlayingBack),y.current.currentTimestamp!==d?.playback?.currentTimestamp&&(t.push("currentTimestamp changed"),y.current.currentTimestamp=d?.playback?.currentTimestamp),y.current.startDate!==d?.filters?.date?.start&&(t.push("startDate changed"),y.current.startDate=d?.filters?.date?.start),y.current.idToken!==p?.id_token&&(t.push("auth token changed"),y.current.idToken=p?.id_token),t);if(n.length>=0&&(n.length>1||!n.includes("currentTimestamp changed")||n.includes("playback state changed")))r();else if(1===n.length&&n.includes("currentTimestamp changed")){let e=new Date(d?.playback?.currentTimestamp||Date.now()),t=new Date(y.current.currentTimestamp||Date.now());e.getMinutes()!==t.getMinutes()&&r()}return d?.playback?.isPlayingBack&&d?.playback?.currentTimestamp?s.current=setTimeout(()=>{r(),c.current=setInterval(()=>{r()},6e4),l.current=c.current},(60-(e=new Date(d.playback.currentTimestamp)).getSeconds())*1e3-e.getMilliseconds()):s.current=setTimeout(()=>{r(),c.current=setInterval(()=>{r()},6e4),l.current=c.current},(60-(e=new Date).getSeconds())*1e3-e.getMilliseconds()),()=>{s.current&&clearTimeout(s.current),c.current&&clearInterval(c.current),l.current&&clearInterval(l.current)}},[o,a,d?.airportCode,d?.playback?.isPlayingBack,d?.playback?.currentTimestamp,d?.filters?.date?.start,p?.id_token]);let I=(0,n.useMemo)(()=>d?.playback?.isPlayingBack?t.historicData.data:t.liveData.data,[d?.playback?.isPlayingBack,t.historicData.data,t.liveData.data]),f=(0,n.useMemo)(()=>({...t,data:I}),[I,t.liveData,t.historicData]);return(0,r.jsx)(A.Provider,{value:f,children:(0,r.jsx)(E.Provider,{value:a,children:e})})};function f(){let e=(0,n.useContext)(A);return void 0===e&&console.error("ERROR: useAOPMeasuresState must be used within a AOPMeasuresProvideer"),e}},61283:(e,t,a)=>{a.d(t,{XF:()=>w,uE:()=>L});var r=a(37876),n=a(14232);let o=function(e,t){if(!t||!Array.isArray(t))return[e];if(!e?.flight?.flightIdAODB)return console.warn("Warning: Event missing flightIdAODB",e),[...t,e];let a={};t.forEach((e,t)=>{e.flight?.flightIdAODB&&(a[e.flight.flightIdAODB]=t)});let r=e.flight.flightIdAODB;if(!(r in a))return[...t,e];{let n=[...t];return n[a[r]]=e,n}},i="SET_LIVE_DATA",l="UPDATE_LIVE_DATA",s="CLEAR_LIVE_DATA",c="SET_HISTORIC_DATA",d="UPDATE_HISTORIC_DATA",p="CLEAR_HISTORIC_DATA",u="SET_HISTORIC_EVENT_DATA",T="UPDATE_HISTORIC_EVENT_DATA",y="CLEAR_HISTORIC_EVENT_DATA",S="SET_ERROR_STATUS",D="CLEAR_ERROR_STATUS",A={INIT:(e,t)=>t.payload,[l]:(e,t)=>({...e,liveData:{data:o(t.payload,e.liveData.data),events:[...e.liveData.events||[],t.payload]}}),[i]:(e,t)=>({...e,liveData:{data:t.payload,events:e.liveData.events||[]}}),[s]:e=>({...e,liveData:{data:null,events:null}}),[c]:(e,t)=>({...e,historicData:{data:t.payload.data||null,events:null}}),[d]:(e,t)=>({...e,historicData:{...e.historicData,data:o(t.payload,e.historicData.data)}}),[p]:e=>({...e,historicData:{data:null,events:null}}),[u]:(e,t)=>({...e,historicData:{...e.historicData,events:t.payload||null}}),[T]:(e,t)=>({...e,historicData:{...e.historicData,events:{...e.historicData.events,...t.payload}}}),[y]:e=>({...e,historicData:{...e.historicData,events:null}}),SET_LOADING_STATUS:(e,t)=>({...e,isLoading:t.payload}),SET_EVENTS_LOADING_STATUS:(e,t)=>({...e,isEventsLoading:t.payload}),[S]:(e,t)=>({...e,error:t.payload}),[D]:e=>({...e,error:null})},E=(e,t)=>{let a=A[t.type];return a?a(e,t):e};var h=a(32950),_=a(24368),I=a(76381),f=a(19645),R=a(43635),k=a(81751),m=a(43313);let g={isLoading:!1,isEventsLoading:!1,error:null,liveData:{data:null,events:null},historicData:{data:null,events:null},data:null},v=(0,n.createContext)(null),O=(0,n.createContext)(null),C=async(e,t,a,r=!0)=>{let n=[["Auth Token",!a],["Airport Code",!t]].filter(([e,t])=>t).map(([e])=>e);if(n.length>0)return e({type:"SET_ERROR_STATUS",payload:`PDPI API: Missing ${n.join(" & ")}`}),!1;e({type:"SET_LOADING_STATUS",payload:!0});let o=(0,k.tQ)(new Date,r),i=(0,k.dr)(new Date(o),r);try{let r=await fetch(`${I.AOP.PDPI.API}/${t}/v1/pdpi/${t}?startDate=${encodeURIComponent(i.startOfDay)}&endDate=${encodeURIComponent(i.endOfDay)}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:a}});if(!r.ok){let t=`Failed to fetch live data: ${r.status} ${r.statusText}`;return console.error(t),e({type:"SET_ERROR_STATUS",payload:t}),!1}let n=await r.json();return e({type:"SET_LIVE_DATA",payload:n}),!0}catch(t){e({type:"SET_ERROR_STATUS",payload:t})}finally{e({type:"SET_LOADING_STATUS",payload:!1})}},P=async(e,t,a,r)=>{e({type:"SET_EVENTS_LOADING_STATUS",payload:!0});let n=new Date(r+1e3);try{let r=`${I.AOP.PDPI.API}/${t}/v1/historicpdpi/${t}?eventStartDate=${encodeURIComponent(n.toISOString())}`,o=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",Authorization:a}});if(!o.ok){let t=`Failed to fetch next historic PDPI events: ${o.status} ${o.statusText}`;console.error(t),e({type:"SET_ERROR_STATUS",payload:t}),e({type:"SET_EVENTS_LOADING_STATUS",payload:!1});return}let i=(await o.json()).reduce((e,t)=>
1{if(!t?.event?.eventId)return e;let a=t.event.eventId.split("-"),r=a[0],n=1e3*Math.round(Number(a[1])/1e3);return{...e,[n]:{...e?.[n]??{},[r]:e?.[n]?.[r]?[...e[n][r],t]:[t]}}},{});e({type:T,payload:i}),e({type:"SET_LOADING_STATUS",payload:!1})}catch(a){let t=a instanceof Error?a.message:String(a);console.error("Historic data fetch error:",t),e({type:"SET_ERROR_STATUS",payload:t})}},U=async(e,t,a,r,n=!0)=>{if(e({type:"SET_LOADING_STATUS",payload:!0}),null===r)return e({type:"SET_ERROR_STATUS",payload:"Cannot fetch historic PDPI data: start date is null"}),!1;try{let o=new Date((0,k.dr)(new Date((0,k.tQ)(r,n)),n).startOfDay),i=`${I.AOP.PDPI.API}/${t}/v1/historicpdpi/${t}?startDate=${encodeURIComponent(o.toISOString())}&endDate=${encodeURIComponent(o.toISOString())}&eventStartDate=${encodeURIComponent(r.toISOString())}&eventEndDate=${encodeURIComponent((0,R.z)(r,3).toISOString())}`,l=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json",Authorization:a}});if(!l.ok){let t=`Failed to fetch historic PDPI data: ${l.status} ${l.statusText}`;return console.error(t),e({type:"SET_ERROR_STATUS",payload:t}),!1}let s=(await l.json()).reduce((e,t)=>{if(!t?.event?.eventId)return e;let a=t.event.eventId.split("-"),r=a[0],n=1e3*Math.round(Number(a[1])/1e3);return{...e,[n]:{...e?.[n]??{},[r]:e?.[n]?.[r]?[...e[n][r],t]:[t]}}},{});return e({type:"SET_HISTORIC_EVENT_DATA",payload:s}),!0}catch(a){let t=a instanceof Error?a.message:String(a);return console.error("Historic PDPI data fetch error:",t),e({type:"SET_ERROR_STATUS",payload:t}),!1}finally{e({type:"SET_LOADING_STATUS",payload:!1})}},b=async(e,t,a,r,n,o=!0,i)=>{let l;if(e({type:"SET_LOADING_STATUS",payload:!0}),null===r)return e({type:"SET_ERROR_STATUS",payload:"Cannot fetch historic data: start date is null"}),!1;let s=new Date((0,k.tQ)(r,o)),c=(0,k.dr)(s,o),d=new Date(c.startOfDay),p=new Date(c.endOfDay),u=void 0!==i&&i>new Date().getTime();u?l=`${I.AOP.PDPI.API}/${t}/v1/pdpi/${t}?startDate=${encodeURIComponent(d.toISOString())}&endDate=${encodeURIComponent(p?.toISOString()??"")}`:(l=`${I.AOP.PDPI.API}/${t}/v1/historicpdpi/${t}?eventStartDate=${encodeURIComponent(r.toISOString())}&eventEndDate=${encodeURIComponent(r.toISOString())}&startDate=${encodeURIComponent(d.toISOString())}&endDate=${encodeURIComponent(p.toISOString())}`,n&&(l+=`&eventEndDate=${encodeURIComponent(n.toISOString())}`));try{let n=await fetch(l,{method:"GET",headers:{"Content-Type":"application/json",Authorization:a}});if(!n.ok){let t=`Failed to fetch historic PDPI data: ${n.status} ${n.statusText}`;return console.error(t),e({type:"SET_ERROR_STATUS",payload:t}),!1}let o=await n.json();return e({type:"SET_HISTORIC_DATA",payload:{data:o}}),u||U(e,t,a,r),!0}catch(l){let i=l instanceof Error?l.message:String(l);return console.error("Historic PDPI data fetch error:",i),e({type:"SET_ERROR_STATUS",payload:i}),setTimeout(()=>b(e,t,a,r,n,o),1e4),!1}finally{e({type:"SET_LOADING_STATUS",payload:!1})}},$=async(e,t,a)=>await (0,h.L)(`${I.AOP.PDPI.Websocket.Url}${t}`,a,t=>{e({type:"UPDATE_LIVE_DATA",payload:t})},t=>{e({type:"SET_ERROR_STATUS",payload:t.message})}),w=({children:e})=>{let[t,a]=(0,n.useReducer)(E,g),[o,i]=(0,n.useState)(!1),[l,s]=(0,n.useState)(null),c=(0,_.kv)(),{user:p}=(0,f.uT)(),u=(0,m.kq)(),T=u?.useUTC??!0,[y,S]=(0,n.useState)(()=>(0,k.tQ)(new Date,T));(0,n.useEffect)(()=>{let e=setTimeout(()=>{S((0,k.tQ)(new Date,T))},(0,k.KA)(T));return()=>clearTimeout(e)},[y,T]),(0,n.useEffect)(()=>{i(!0)},[]),(0,n.useEffect)(()=>{o&&c?.airportCode&&(l&&l!==c.airportCode&&a({type:"INIT",payload:g}),s(c.airportCode))},[o,c?.airportCode,l]),(0,n.useEffect)(()=>{let e;if(!o||!p?.accessToken||!c?.airportCode)return()=>{};let t=!0;return(async()=>{try{let r=await C(a,c.airportCode,p?.accessToken,T);!1!==r&&$(a,c.airportCode,p?.accessToken).then(a=>{t?e=a:a&&a()}).catch(e=>{a({type:"SET_ERROR_STATUS",payload:e.message})})}catch(e){console.warn("Failed to fetch initial PDPI data",e)}})(),()=>{t=!1,e&&e()}},[o,a,c?.airportCode,p?.accessToken,y]),(0,n.useEffect)(()=>{if(!c?.playback?.isPlayingBack||!t?.historicData?.events||!c.playback?.currentTimestamp||!c.airportCode||p?.accessToken)return;let e=c.playback.currentTimestamp,r=t.historicData.events[e];
1r&&Object.values(r).forEach(e=>{e.forEach(e=>{a({type:d,payload:e})})})},[t.historicData.events,c?.playback?.currentTimestamp,c?.playback?.isPlayingBack,c?.airportCode,p?.accessToken]),(0,n.useEffect)(()=>{if(!c?.playback?.isPlayingBack||!t.historicData?.events||!c.airportCode||!p?.accessToken||!c.playback?.currentTimestamp||t.isLoading||t.isEventsLoading)return;let e=Object.keys(t.historicData.events);if(0===e.length)return;let r=Math.max(...e.map(Number));!r||c.playback.currentTimestamp>=Number(r)-6e4&&P(a,c.airportCode,p?.accessToken,r)},[t.historicData.events,c?.playback?.currentTimestamp,c?.playback?.isPlayingBack,c?.airportCode,p?.accessToken]);let D=n.useRef(void 0),A=n.useRef(null);(0,n.useEffect)(()=>{if(!c?.playback?.isPlayingBack||!c?.airportCode||!p?.accessToken||!c?.playback?.currentTimestamp)return;let e=(0,k.tQ)(new Date(c.playback.currentTimestamp),T).split("T")[0];if(A.current!==e){A.current=e;let t=new Date(c.playback.currentTimestamp);b(a,c.airportCode,p?.accessToken,t,null,T,c.playback.currentTimestamp)}},[c?.playback?.currentTimestamp,c?.playback?.isPlayingBack,c?.airportCode,p?.accessToken]),(0,n.useEffect)(()=>{if(c?.playback?.isPlayingBack===!0){let e=c?.filters?.date?.start||null,t=c?.filters?.date?.end||null;b(a,c.airportCode,p?.accessToken,e,t,T,c.playback?.currentTimestamp||void 0).then(e=>{e||console.warn("Failed to fetch historic PDPI data for playback")})}D.current=c?.playback?.isPlayingBack},[p?.accessToken,c?.airportCode,c?.filters?.date?.end,c?.filters?.date?.start,c?.playback?.isPlayingBack]),(0,n.useEffect)(()=>{c?.playback?.isPlayingBack?t.historicData?.data?.length&&a({type:"SET_DATA",payload:t.historicData.data}):t.liveData?.data?.length&&a({type:"SET_DATA",payload:t.liveData.data})},[c?.playback?.isPlayingBack,t.historicData,t.liveData]);let h=(0,n.useMemo)(()=>c?.playback?.isPlayingBack?t.historicData?.data||null:t.liveData?.data||null,[c?.playback?.isPlayingBack,t.historicData?.data,t.liveData?.data]),I=(0,n.useMemo)(()=>({...t,data:h}),[t,h]);return(0,r.jsx)(v.Provider,{value:I,children:(0,r.jsx)(O.Provider,{value:a,children:e})})};function L(){return(0,n.useContext)(v)}}}]);

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.