PageSourceSearch

https://hw.ac.uk/_Z8mtzw_41e2125b-1bc2-4628-94fc-1293eb7301fb/stat…/js/search.page.64f485a2793e322194a9.mjs

js hw.ac.uk collected 2026-09-24 08:27:31 UTC 17,530 bytes, 234 lines download raw bytes

1"use strict";(()=>{(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[7170],{49134(re,A,d){d.r(A),d.d(A,{default:()=>ne});var l=d(63589),u=d(29633),C=d(67780),U=d(91601),O=d(43348);/*! *****************************************************************************
2Copyright (c) Microsoft Corporation.
3
4Permission to use, copy, modify, and/or distribute this software for any
5purpose with or without fee is hereby granted.
6
7THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13PERFORMANCE OF THIS SOFTWARE.
14***************************************************************************** */var N=function(t,r){return(N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,e){o.__proto__=e}||function(o,e){for(var n in e)e.hasOwnProperty(n)&&(o[n]=e[n])})(t,r)},X,k,Y=(function(t){/*!
15  Copyright (c) 2017 Jed Watson.
16  Licensed under the MIT License (MIT), see
17  http://jedwatson.github.io/classnames
18*/(function(){var r={}.hasOwnProperty;function o(){for(var e=[],n=0;n<arguments.length;n++){var s=arguments[n];if(s){var a=typeof s;if(a==="string"||a==="number")e.push(s);else if(Array.isArray(s)&&s.length){var h=o.apply(null,s);h&&e.push(h)}else if(a==="object")for(var i in s)r.call(s,i)&&s[i]&&e.push(i)}}return e.join(" ")}t.exports?(o.default=o,t.exports=o):window.classNames=o})()}(k={path:X,exports:{},require:function(t,r){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(r==null&&k.path)}},k.exports),k.exports);function F(t,r,o){var e,n,s,a,h;function i(){var c=Date.now()-a;c<r&&c>=0?e=setTimeout(i,r-c):(e=null,o||(h=t.apply(s,n),s=n=null))}r==null&&(r=100);var m=function(){s=this,n=arguments,a=Date.now();var c=o&&!e;return e||(e=setTimeout(i,r)),c&&(h=t.apply(s,n),s=n=null),h};return m.clear=function(){e&&(clearTimeout(e),e=null)},m.flush=function(){e&&(h=t.apply(s,n),s=n=null,clearTimeout(e),e=null)},m}F.debounce=F;var B=F;(function(t,r){r===void 0&&(r={});var o=r.insertAt;if(t&&typeof document<"u"){var e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",o==="top"&&e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}})(`.indiana-scroll-container {
19  overflow: auto;
20}
21.indiana-scroll-container--dragging {
22  scroll-behavior: auto !important;
23}
24.indiana-scroll-container--dragging > * {
25  pointer-events: none;
26  cursor: -webkit-grab;
27  cursor: grab;
28}
29.indiana-scroll-container--hide-scrollbars {
30  overflow: hidden;
31  overflow: -moz-scrollbars-none;
32  -ms-overflow-style: none;
33  scrollbar-width: none;
34}
35.indiana-scroll-container--hide-scrollbars::-webkit-scrollbar {
36  display: none !important;
37  height: 0 !important;
38  width: 0 !important;
39  background: transparent !important;
40  -webkit-appearance: none !important;
41}
42.indiana-scroll-container--native-scroll {
43  overflow: auto;
44}
45
46.indiana-dragging {
47  cursor: -webkit-grab;
48  cursor: grab;
49}`);var j,H=(j="indiana-scroll-container",function(t,r){if(!t)return j;var o;typeof t=="string"?o=t:r=t;var e=j;return o&&(e+="__"+o),e+(r?Object.keys(r).reduce(function(n,s){var a=r[s];return a&&(n+=" "+(typeof a=="boolean"?e+"--"+s:e+"--"+s+"_"+a)),n},""):"")}),z=function(t){function r(o){var e=t.call(this,o)||this;return e.onEndScroll=function(){e.scrolling=!1,!e.pressed&&e.started&&e.processEnd()},e.onScroll=function(n){var s=e.container.current;s.scrollLeft===e.scrollLeft&&s.scrollTop===e.scrollTop||(e.scrolling=!0,e.processScroll(n),e.onEndScroll())},e.onTouchStart=function(n){var s=e.props.nativeMobileScroll;if(e.isDraggable(n.target))if(e.internal=!0,s&&e.scrolling)e.pressed=!0;else{var a=n.touches[0];e.processClick(n,a.clientX,a.clientY),!s&&e.props.stopPropagation&&n.stopPropagation()}},e.onTouchEnd=function(n){var s=e.props.nativeMobileScroll;e.pressed&&(!e.started||e.scrolling&&s?e.pressed=!1:e.processEnd(),e.forceUpdate())},e.onTouchMove=function(n){var s=e.props.nativeMobileScroll;if(e.pressed&&(!s||!e.isMobile)){var a=n.touches[0];a&&e.processMove(n,a.clientX,a.clientY),n.preventDefault(),e.props.stopPropagation&&n.stopPropagation()}},e.onMouseDown=function(n){e.isDraggable(n.target)&&e.isScrollable()&&(e.internal=!0,e.props.buttons.indexOf(n.button)!==-1&&(e.processClick(n,n.clientX,n.clientY),n.preventDefault(),e.props.stopPropagation&&n.stopPropagation()))},e.onMouseMove=function(n){e.pressed&&(e.processMove(n,n.clientX,n.clientY),n.preventDefault(),e.props.stopPropagation&&n.stopPropagation())},e.onMouseUp=function(n){e.pressed&&(e.started?e.processEnd():(e.internal=!1,e.pressed=!1,e.forceUpdate(),e.props.onClick&&e.props.onClick(n)),n.preventDefault(),e.props.stopPropagation&&n.stopPropagation())},e.container=u.createRef(),e.onEndScroll=B(e.onEndScroll,300),e.scrolling=!1,e.started=!1,e.pressed=!1,e.internal=!1,e.getRef=e.getRef.bind(e),e}return function(o,e){function n(){this.constructor=o}N(o,e),o.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}(r,t),r.prototype.componentDidMount=function(){var o=this.props.nativeMobileScroll,e=this.container.current;window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd),e.addEventListener("touchstart",this.onTouchStart,{passive:!1}),e.addEventListener("mousedown",this.onMouseDown,{passive:!1}),o&&(this.isMobile=this.isMobileDevice(),this.isMobile&&this.forceUpdate())},r.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},r.prototype.getElement=function(){return this.container.current},r.prototype.isMobileDevice=function(){return window.orientation!==void 0||navigator.userAgent.indexOf("IEMobile")!==-1},r.prototype.isDraggable=function(o){var e=this.props.ignoreElements;if(e){var n=o.closest(e);return n===null||n.contains(this.getElement())}return!0},r.prototype.isScrollable=function(){var o=this.container.current;return o&&(o.scrollWidth>o.clientWidth||o.scrollHeight>o.clientHeight)},r.prototype.processClick=function(o,e,n){var s=this.container.current;this.scrollLeft=s.scrollLeft,this.scrollTop=s.scrollTop,this.clientX=e,this.clientY=n,this.pressed=!0},r.prototype.processStart=function(o){o===void 0&&(o=!0);var e=this.props.onStartScroll;this.started=!0,o&&document.body.classList.add("indiana-dragging"),e&&e({external:!this.internal}),this.forceUpdate()},r.prototype.processScroll=function(o){if(this.started){var e=this.props.onScroll;e&&e({external:!this.internal})}else this.processStart(!1)},r.prototype.processMove=function(o,e,n){var s=this.props,a=s.horizontal,h=s.vertical,i=s.activationDistance,m=s.onScroll,c=this.container.current;this.started?(a&&(c.scrollLeft-=e-this.clientX),h&&(c.scrollTop-=n-this.clientY),m&&m({external:!this.internal}),this.clientX=e,this.clientY=n,this.scrollLeft=c.scrollLeft,this.scrollTop=c.scrollTop):(a&&Math.abs(e-this.clientX)>i||h&&Math.abs(n-this.clientY)>i)&&(this.clientX=e,this.clientY=n,this.processStart())},r.prototype.processEnd=function(){var o=this.props.onEndScroll;this.container.current&&o&&o({external:!this.internal}),this.pressed=!1,this.started=!1,this.scrolling=!1,this.internal=!1,document.body.classList.remove("indiana-dragging"),this.forceUpdate()},r.prototype.getRef=function(o){[this.container,this.props.innerRef].forEach(function(e){e&&(typeof e=="function"?e(o):e.current=o)})},r.prototype.render=function(){var o=this.props,e=o.children,n=o.draggingClassName,s=o.className,a=o.style,h=o.hideScrollbars,i=o.component;return u.createElement(i,{className:Y(s,this.pressed&&n,H({dragging:this.pressed,"hide-scrollbars":h,"native-scroll":this.isMobile})),style:a,ref:this.getRef,onScroll:this.onScroll},e)},r.defaultProps={nativeMobileScroll:!0,hideScrollbars:!0,activationDistance:10,vertical:!0,horizontal:!0,stopPropagation:!1,style:{},component:"div",buttons:[0]},r}(u.PureComponent);const G=z,W=({currentFacet:t,facets:r,onFacetChange:o,className:e})=>(0,l.jsx)(I,{className:`facets ${e||""}`,children:(0,l.jsx)(G,{className:"facet-scroll-container",children:(0,l.jsx)("ul",{className:"facet-list",children:r.map(n=>{const s=n.key===t;return(0,l.jsx)("li",{className:"facets-item",children:(0,l.jsx)("button",{onClick:()=>o(n.key),className:`facet-btn ${s?"active":""}`,children:n.label})},n.key)})})})}),I=C.styled.div`
50  .facet-scroll-container {
51    height: 100%;
52    width: 100%;
53
54    /* Hide scrollbars */
55    &::-webkit-scrollbar {
56      display: none;
57    }
58
59    -ms-overflow-style: none;
60    scrollbar-width: none;
61  }
62
63  .facet-list {
64    display: flex;
65    padding: 0;
66    margin: 0;
67    height: 100%;
68    list-style-type: none;
69    background: ${t=>t.theme.colors.blue.primary};
70    flex-wrap: nowrap;
71    width: max-content;
72  }
73
74  .facets-item {
75    flex-shrink: 0;
76  }
77
78  .facet-btn {
79    color: ${t=>t.theme.colors.neutral.white};
80    background: ${t=>t.theme.colors.blue.primary};
81    padding: ${t=>t.theme.spacing.s} ${t=>t.theme.spacing.m};
82    width: max-content;
83    cursor: pointer;
84    border: none;
85    font-family: inherit;
86    font-size: inherit;
87    white-space: nowrap;
88
89    &:hover {
90      background: ${t=>t.theme.colors.blue.dark};
91    }
92
93    &.active {
94      color: ${t=>t.theme.colors.neutral.white};
95      background: ${t=>t.theme.colors.blue.dark};
96    }
97  }
98`;var Q=d(76795),V=d(82227),Z=d(98853),D=d(3338),x=d(96193),J=d(86294),q=d(52136),K=d(51358),_=d(69337),ee=d(6543);const te=({label:t,uri:r,searchTerm:o,pageIndex:e,onPageChange:n,scrollToResults:s,onFacetsChange:a,selectedFilters:h,facetKey:i,profileParam:m,brandEbs:c,onReset:L,onCorrectedSearch:T})=>{const M=(0,u.useMemo)(()=>{if(i==="events")return r;const b=new URL(r);return b.searchParams.set("profile",m),b.toString()},[r,m,i]),w=i!=="allResults"&&i!=="scholarships"&&i!=="events"&&i!=="people"&&i!=="clearing"&&i!=="studentProfiles",f=(0,u.useMemo)(()=>{if(typeof window>"u"||!w)return!0;const b=new URLSearchParams(window.location.search);let g;return i==="programmes"&&c?g="f.Tabs|heriot-watt~ds-programmes-dubai,heriot-watt~ds-programmes-malaysia,heriot-watt~ds-programmes-online,heriot-watt~ds-programmes-uk-pg,heriot-watt~ds-programmes-uk-research,heriot-watt~ds-programmes-uk-ug":i==="people"?c?g="f.Tabs|heriot-watt~ds-profiles-uk-ebs,heriot-watt~ds-profiles-dubai,heriot-watt~ds-profiles-malaysia":g=`f.Tabs|heriot-watt~ds-profiles-${m}`:i==="news"?g="f.Tabs|heriot-watt~ds-news":i==="blogs"?g="f.Tabs|heriot-watt~ds-blogs":i==="events"?g="f.Tabs|heriot-watt~ds-events":i==="scholarships"?g="f.Tabs|heriot-watt~ds-scholarships":i==="studentProfiles"?g="f.Tabs|heriot-watt~ds-profiles-students":i==="clearing"?g="f.Tabs|heriot-watt~ds-programmes-uk-clearing":g=`f.Tabs|heriot-watt~ds-${i}`,Array.from(b.keys()).some(S=>S.startsWith(g))},[w,i,m,c]),E=!w||f,P=(0,D.WB)({uri:E?M:"",searchTerm:o,pageIndex:e,selectedFilters:h,onFacetsChange:b=>{a(b)},currentFacet:i});return(0,l.jsx)(Z.A,{...P,onPageChange:n,scrollToResults:s,showSectionHeader:!0,sectionLabel:t,contentType:i,onReset:L,onCorrectedSearch:T})},ne=()=>{const t=(0,u.useRef)(null),[r,o]=(0,u.useState)([]),{region:e,brandEbs:n,urlProfile:s}=(0,K.T)(),{searchTerm:a,pageIndex:h,selectedFilters:i,facetKey:m,handleSearch:c,handlePageChange:L,handleFilterChange:T,handleClearFilters:M,setFacetKey:w}=(0,D.Z_)({facetKey:"allResults",resetFiltersOnFacetChange:!0}),f=m||"allResults",E=(0,u.useMemo)(()=>s||e,[s,e]),P=(0,u.useCallback)(()=>{setTimeout(()=>{t.current?.scrollIntoView({behavior:"smooth"})},100)},[]),b=(0,u.useCallback)(p=>{if(w){const v=new _.Q,y=(0,x.to)(p);if(!y){console.warn(`No config found for facet: ${p}`);return}v.removeTabFilters(),y.usesGscope?y.gscopeOnlyForNonUK&&e==="uk"?v.removeGscope():v.setGscope(e):v.removeGscope();const se=y.profile==="region"?e:y.profile;v.setProfile(se),v.setRegion(e),y.usesTabFilter&&v.setTabFilter(p,e,n),v.updateBrowserUrl(),w(p),o([])}},[w,e,n]),g=(0,u.useCallback)(p=>{p&&Array.isArray(p)&&o(p)},[]),$=(0,u.useMemo)(()=>(0,x.oV)(r,f),[r,f]),S=(0,u.useMemo)(()=>{const p=x.kv.find(y=>y.key===f);if(!p)return p;const v=(0,x.t1)(f,e);return{...p,uri:v}},[f,e]);return(0,l.jsxs)(U.A,{children:[(0,l.jsx)(ee.A,{pageTitle:"Global Search",robotsHide:!0}),(0,l.jsxs)(oe,{ref:t,children:[(0,l.jsx)("div",{className:"search__header-container",children:(0,l.jsxs)("div",{className:"search__header-content",children:[(0,l.jsx)(O.Ay,{as:"h1",$size:"2",$color:"bluePrimary",children:"Global Search"}),(0,l.jsx)(V.A,{value:a,onSubmit:c,placeholder:"Search all content or browse by category...",enableAutocomplete:!0,autocompleteCollection:"heriot-watt~sp-global",autocompleteProfile:E,minQueryLength:2})]})}),(0,l.jsx)("div",{className:"search__facets-container",children:(0,l.jsx)(W,{currentFacet:f,facets:x.kv.filter(p=>(0,x.s4)(p.key,e)).map(p=>({key:p.key,label:p.label})),onFacetChange:b})}),(0,l.jsxs)("div",{className:"search-container",children:[(0,l.jsx)("article",{className:"search__results-list",children:S&&(0,l.jsx)(te,{label:S.label,uri:S.uri,searchTerm:a,pageIndex:h,onPageChange:L,scrollToResults:P,onFacetsChange:g,selectedFilters:i,facetKey:f,profileParam:f==="scholarships"&&e==="uk"?"scholarships":E,brandEbs:n,onReset:()=>c(""),onCorrectedSearch:c},S.key)}),(0,l.jsx)("aside",{className:"search__filters-container",children:f!=="allResults"&&(0,l.jsxs)(l.Fragment,{children:[$.length>0&&(0,l.jsx)(J.A,{facets:$,selectedFilters:i,onFilterChange:T,clearFilters:M,className:"search__mobile-filters"}),$.length>0?(0,l.jsx)(Q.A,{facets:$,selectedFilters:i,onFilterChange:T,clearFilters:M,className:"search__desktop-filters"}):(0,l.jsx)(q.R,{})]})})]})]})]})},R=(0,C.css)`
99  padding: ${t=>t.theme.spacing.m};
100  text-align: center;
101  border-radius: ${t=>t.theme.spacing.xxxs};
102`,oe=C.styled.div`
103  --section-padding: ${t=>t.theme.spacing.xs};
104  @media ${t=>t.theme.mq.min.desktop} {
105    --section-padding: ${t=>t.theme.spacing.m};
106  }
107
108  .search__header-container {
109    padding: ${t=>t.theme.spacing.l} 0;
110    background-color: ${t=>t.theme.colors.blue.shade};
111
112    .search__header-content {
113      display: flex;
114      flex-direction: column;
115      align-items: flex-start;
116      gap: ${t=>t.theme.spacing.m};
117      max-width: calc(
118        ${({theme:t})=>t.grid.default.width} + var(--section-padding) +
119          var(--section-padding)
120      );
121      margin: 0 auto;
122      padding: 0 var(--section-padding);
123    }
124  }
125
126  .search__facets-container {
127    background-color: ${t=>t.theme.colors.blue.primary};
128    padding: 0;
129
130    .facets {
131      max-width: calc(
132        ${({theme:t})=>t.grid.default.width} + var(--section-padding) +
133          var(--section-padding)
134      );
135      margin: 0 auto;
136      padding: 0 var(--section-padding);
137    }
138  }
139
140  .search-container {
141    max-width: calc(
142      ${({theme:t})=>t.grid.default.width} + var(--section-padding) +
143        var(--section-padding)
144    );
145    margin: 0 auto;
146    padding: ${t=>t.theme.spacing.l} var(--section-padding);
147    display: flex;
148    flex-direction: column-reverse;
149    gap: ${t=>t.theme.spacing.s};
150
151    @media ${t=>t.theme.mq.min.tablet} {
152      display: grid;
153      grid-template-columns: repeat(12, 1fr);
154      gap: ${t=>t.theme.spacing.m};
155    }
156  }
157
158  .search__mobile-filters {
159    margin-bottom: ${t=>t.theme.spacing.s};
160    width: 100%;
161    max-width: 100%;
162
163    @media ${t=>t.theme.mq.min.tablet} {
164      display: none;
165    }
166  }
167
168  .search__desktop-filters {
169    display: none;
170
171    @media ${t=>t.theme.mq.min.tablet} {
172      display: block;
173      grid-column: 9 / span 4;
174      align-self: start;
175    }
176  }
177
178  .search__results-list {
179    display: flex;
180    flex-direction: column;
181    gap: ${t=>t.theme.spacing.s};
182
183    @media ${t=>t.theme.mq.min.tablet} {
184      gap: ${t=>t.theme.spacing.m};
185      grid-column: 1 / span 7;
186    }
187
188    .no-results,
189    .no-search {
190      padding: ${t=>t.theme.spacing.l};
191      text-align: center;
192      color: ${t=>t.theme.colors.neutral.black};
193      background-color: ${t=>t.theme.colors.grey.light};
194      border-radius: 4px;
195    }
196
197    .loading {
198      ${R}
199      color: ${t=>t.theme.colors.blue.primary};
200      background-color: ${t=>t.theme.colors.blue.shade};
201    }
202
203    .error {
204      ${R}
205      color: ${t=>t.theme.colors.orchil.dark};
206      background-color: ${t=>t.theme.colors.pink.light};
207    }
208  }
209
210  .search__filters-container {
211    @media ${t=>t.theme.mq.min.tablet} {
212      grid-column: 9 / span 4;
213      align-self: start;
214    }
215
216    .filters-placeholder {
217      padding: ${t=>t.theme.spacing.m};
218      border: 2px dashed ${t=>t.theme.colors.grey.light};
219      border-radius: 4px;
220      text-align: center;
221
222      h3 {
223        margin: 0 0 ${t=>t.theme.spacing.s} 0;
224        color: ${t=>t.theme.colors.neutral.black};
225      }
226
227      p {
228        margin: 0;
229        color: ${t=>t.theme.colors.neutral.black};
230        font-size: 0.9rem;
231      }
232    }
233  }
234`}}]);})();

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.