PageSourceSearch

https://www.bswhealth.com/_next/static/chunks/pages/LocationFetchers-2a7f8240c291112c.js

js bswhealth.com collected 2026-09-24 17:37:51 UTC 9,114 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4849],{671:(e,t,r)=>{"use strict";r.d(t,{L:()=>o});var n=r(14232);function o(e,t){(0,n.useEffect)(function(){var r=function(r){e.current&&!e.current.contains(r.target)&&t(r)};return document.addEventListener("mousedown",r),function(){return document.removeEventListener("mousedown",r)}},[e,t])}},11950:(e,t,r)=>{"use strict";r.d(t,{v:()=>a});var n=r(3711),o=r(45383),a=new(function(){function e(){(0,n._)(this,e),this.isDevelopment=!1}var t=e.prototype;return t.error=function(e,t,r){this.log("error",e,t,r)},t.warn=function(e,t){this.log("warn",e,void 0,t)},t.info=function(e,t){this.log("info",e,void 0,t)},t.debug=function(e,t){this.isDevelopment&&this.log("debug",e,void 0,t)},t.log=function(e,t,r,n){var o={timestamp:new Date().toISOString(),level:e,message:t};if(n&&(o.context=n),r&&(o.error=this.formatError(r)),this.isDevelopment&&1)try{var a=JSON.parse(sessionStorage.getItem("app_logs")||"[]");a.push(o),a.length>100&&a.shift(),sessionStorage.setItem("app_logs",JSON.stringify(a))}catch(e){}},t.formatError=function(e){return(0,o._)(e,Error)?{name:e.name,message:e.message,stack:e.stack}:{message:String(e)}},e}())},14733:(e,t,r)=>{"use strict";r.d(t,{$:()=>c});var n=r(16927),o=r(20294),a=r(4902),i=r(14232),s=r(11950);function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.debounceMs,r=void 0===t?300:t,c=e.minQueryLength,u=void 0===c?2:c,l=(0,o._)((0,i.useState)(""),2),d=l[0],f=l[1],h=(0,o._)((0,i.useState)([]),2),m=h[0],v=h[1],g=(0,o._)((0,i.useState)(!1),2),p=g[0],y=g[1],b=(0,i.useRef)(void 0);(0,i.useEffect)(function(){return function(){b.current&&clearTimeout(b.current)}},[]);var w=(0,i.useCallback)(function(e){return(0,n._)(function(){var t,r;return(0,a.YH)(this,function(n){switch(n.label){case 0:if(e.trim().length<u)return[2];y(!0),n.label=1;case 1:return n.trys.push([1,4,5,6]),[4,fetch("/api/locations/search?keyword=".concat(encodeURIComponent(e)))];case 2:if(!(t=n.sent()).ok)throw Error("HTTP error! status: ".concat(t.status));return[4,t.json()];case 3:return v(n.sent().locationResults||[]),[3,6];case 4:return r=n.sent(),s.v.error("Error fetching locations",r,{query:e}),v([]),[3,6];case 5:return y(!1),[7];case 6:return[2]}})})()},[u]),x=(0,i.useCallback)(function(e){var t=e.target.value;f(t),b.current&&clearTimeout(b.current),b.current=setTimeout(function(){w(t)},r)},[r,w]);return{searchQuery:d,locations:m,isLoading:p,setSearchQuery:f,handleSearchChange:x}}},50358:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LocationSearchInput:()=>o});var n=r(37876);function o(e){var t=e.id,r=e.value,o=e.onChange,a=e.onFocus,i=e.placeholder,s=e.label,c=e.isLoading;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{htmlFor:t,className:"block mb-2 font-sharp-sans-bold ",children:void 0===s?"Search Location":s}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("input",{id:t,type:"text",value:r,onChange:o,placeholder:void 0===i?"Search by location name, type, or ID...":i,className:"w-full px-3 py-3 text-base border-2 border-secondary-a4 rounded-lg outline-none transition-colors duration-300 focus:border-primary-a3 focus:ring-2 focus:ring-primary-a3/20",onFocus:a}),void 0!==c&&c&&(0,n.jsx)("div",{className:"absolute right-3 top-3 text-sm text-secondary-a7",children:"Loading..."})]})]})}r(14232)},56860:(e,t,r)=>{"use strict";r.d(t,{K:()=>h});var n=r(16927),o=r(45383),a=r(67684),i=r(62701),s=r(20294),c=r(4902),u=r(38351),l=r(14232),d={retryAttempts:3,retryDelay:1e3,autoInit:!0},f=void 0;function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,l.useMemo)(function(){return(0,a._)({},d,e)},[e]),r=(0,s._)((0,l.useState)({client:null,error:null,isLoading:!1,isInitialized:!1}),2),h=r[0],m=r[1],v=(0,l.useRef)(!1),g=(0,l.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return(0,n._)(function(){var r,s;return(0,c.YH)(this,function(l){switch(l.label){case 0:if(r=!1,m(function(e){return e.isLoading||e.isInitialized||v.current?e:(r=!0,v.current=!0,(0,i._)((0,a._)({},e),{isLoading:!0,error:null}))}),!r)return[2];l.label=1;case 1:return l.trys.push([1,3,6,7]),[4,(0,n._)(function(){var e;return(0,c.YH)(this,function(t){switch(t.label){case 0:if(f)return[2,f];return e={target:window.parent},[4,u.U.init(e)];case 1:return[2,f=t.sent()]}})})()];case 2:return m({client:l.sent(),error:null,isLoading:!1,isInitialized:!0}),[3,7];case 3:if(s=l.sent(),!(e<t.retryAttempts))return[3,5];return[4,new Promise(function(e){return setTimeout(e,t.retryDelay)})];case 4:return l.sent(),[2,g(e+1)];case 5:return m({client:null,error:(0,o._)(s,Error)?s:Error("Failed to initialize MarketplaceClient"),isLoading:!1,isInitialized:!1}),[3,7];case 6:return v.current=!1,[7];case 7:return[2]}})})()},[t.retryAttempts,t.retryDelay]);return(0,l.useEffect)(function(){return t.autoInit&&g(),function(){v.current=!1,m({client:null,error:null,isLoading:!1,isInitialized:!1})}},[t.autoInit,g]),(0,l.useMemo)(function(){return(0,i._)((0,a._)({},h),{initialize:g})},[h,g])}},57572:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LocationDropdownItem:()=>
1o});var n=r(37876);function o(e){var t=e.location,r=e.onSelect;return(0,n.jsxs)("div",{onClick:function(){return r(t)},className:"px-3 py-3 cursor-pointer border-b border-secondary-a5 transition-colors duration-200 hover:bg-secondary-a6 bg-white",children:[(0,n.jsx)("div",{className:"font-sharp-sans-bold mb-1 ",children:t.locationName}),(0,n.jsx)("div",{className:"text-sm text-secondary-a7 mb-0.5",children:t.locationType})]},t.locationID)}r(14232)},58625:(e,t,r)=>{"use strict";r.d(t,{Ps:()=>a.NoResultsMessage,fq:()=>o.LocationDropdown,w8:()=>n.LocationSearchInput});var n=r(50358),o=r(72081);r(57572);var a=r(78573)},72081:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LocationDropdown:()=>a});var n=r(37876);r(14232);var o=r(57572);function a(e){var t=e.locations,r=e.onSelect;return e.isVisible&&0!==t.length?(0,n.jsx)("div",{className:"absolute top-full left-0 right-0 bg-white border border-secondary-a4 rounded-lg mt-1 max-h-72 overflow-y-auto shadow-md z-50",children:t.map(function(e){return(0,n.jsx)(o.LocationDropdownItem,{location:e,onSelect:r},e.locationID)})}):null}},77934:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/LocationFetchers",function(){return r(96704)}
1])},78573:(e,t,r)=>{"use strict";r.r(t),r.d(t,{NoResultsMessage:()=>o});var n=r(37876);function o(e){var t=e.searchQuery,r=e.isLoading,o=e.hasResults;return 0===t.length||r||o?null:(0,n.jsx)("div",{className:"mt-2 px-3 py-3 bg-secondary-a6 rounded-lg text-secondary-a7 text-sm",children:"No locations found. Try a different search term."})}r(14232)},96704:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>h});var n=r(16927),o=r(20294),a=r(4902),i=r(37876),s=r(14232),c=r(56860),u=r(671),l=r(14733),d=r(58625),f=r(11950);function h(){var e=(0,c.K)().client,t=(0,o._)((0,s.useState)(null),2),r=t[0],h=t[1],m=(0,o._)((0,s.useState)([]),2),v=m[0],g=m[1],p=(0,o._)((0,s.useState)(!1),2),y=p[0],b=p[1],w=(0,s.useRef)(null),x=(0,l.$)(),_=x.searchQuery,S=x.locations,L=x.isLoading,N=x.setSearchQuery,I=x.handleSearchChange;(0,u.L)(w,function(){return b(!1)}),(0,s.useEffect)(function(){var e=_.trim();if(""===e){g([]),b(!1);return}var t=e.toLowerCase(),r=S.filter(function(r){return r.locationName.toLowerCase().includes(t)||r.locationType.toLowerCase().includes(t)||r.locationID.includes(e)});g(r),b(r.length>0)},[_,S]);var D=function(t){e&&e.query("pages.context").then(function(r){return(0,n._)(function(){var n,o,i;return(0,a.YH)(this,function(a){switch(a.label){case 0:if(!((i=null==(o=r.data)||null==(n=o.pageInfo)?void 0:n.id)&&t))return[3,2];return[4,fetch("/api/update-sitecore-field",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemId:i,fieldName:"title",fieldValue:t.locationName,locationData:t})})];case 1:a.sent(),e.closeApp(),a.label=2;case 2:return[2]}})})()}).catch(function(e){f.v.error("Error retrieving pages.context",e)})};return(0,s.useEffect)(function(){r&&r.locationName&&D(r)},[r]),(0,i.jsx)("div",{className:"max-w-2xl mx-auto my-5 min-h-screen",children:(0,i.jsxs)("div",{className:"relative",ref:w,children:[(0,i.jsx)(d.w8,{id:"location-search",value:_,onChange:I,onFocus:function(){v.length>0&&b(!0)},placeholder:"Search by location name, type, or ID...",label:"Search Location",isLoading:L,"aria-describedby":"location-search-description","aria-label":"Search for healthcare locations by name, type, or ID"}),(0,i.jsx)(d.fq,{locations:v,onSelect:function(t){return(0,n._)(function(){var r;return(0,a.YH)(this,function(n){switch(n.label){case 0:if(N(t.locationName),h(t),b(!1),!e)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e.setValue(t.locationID,!0)];case 2:return n.sent(),e.closeApp(),[3,4];case 3:return r=n.sent(),f.v.error("Error saving location ID",r,{locationId:t.locationID,locationName:t.locationName}),[3,4];case 4:return[2]}})})()},isVisible:y}),(0,i.jsx)(d.Ps,{searchQuery:_,isLoading:L,hasResults:v.length>0})]})})}}},e=>{e.O(0,[8351,6593,7236,8634,9054,7154,4041,5066,7877,8630,1668,5524,1492,636,8792],()=>e(e.s=77934)),_N_E=e.O()}]);

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.