1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="333c1b72-95af-48f6-8c40-9119229cffe4",e._sentryDebugIdIdentifier="sentry-dbid-333c1b72-95af-48f6-8c40-9119229cffe4")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6898],{6898:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ChatGlobalPendingMessages:()=>b,ChatPendingMessages:()=>g,ChatPendingMessagesProvider:()=>f});var s=n(50979),i=n(25963),r=n(17850),o=n.n(r),l=n(25183),a=n(10392),u=n(13924);let c=i.createContext({});class h extends i.Component{componentDidUpdate(e){null!=e.cursor&&e.cursor!==this.props.cursor&&this.props.reload()}render(){return null}}class d extends i.Component{componentWillUnmount(){this.props.setCount&&this.props.setCount({count:null})}render(){let{session:e,bookingId:t,setCount:n}=this.props;return(0,s.jsx)(a.e,{urlToFetch:"/api/v2/bookings/".concat(t,"/chat"),session:e,sendErrorToSentry:e=>{let{res:t}=e;return 404!==(t||{}).status},children:t=>{let{result:{chat_channel_uid:i,chat_channel_firebase_ref:r,chat_channel_is_archived:o,firebaseConfig:u}={}}=t;return(i||null)&&(0,s.jsx)(l.g,{chatChannelId:i,session:e,config:u,children:t=>{let{result:u}=t;return(0,s.jsx)(l.w,{firebase:u,refPath:r,children:t=>{let{val:{latest_cursor:r}={}}=t;return(0,s.jsx)(a.e,{disabled:null==i||o,urlToFetch:"/api/v2/chat/channels/".concat(i,"/pending-messages-count"),session:e,onFulfilled:e=>{let{result:{count:t}}=e;n({count:t})},children:e=>{let{reload:t}=e;return(0,s.jsx)(h,{cursor:r,reload:t})}})}})}})}})}}function p(e){let{throttleOptions:{delay:t=3e4}={},children:n,...r}=e,[l]=(0,i.useState)(()=>o()(e=>{let{reload:t}=e;return t()},t,{leading:!0,trailing:!0}));return(0,s.jsx)(a.e,{...r,children:e=>{let{reload:t,...s}=e;return n({...s,reload:()=>l({reload:t})})}})}class f extends i.Component{render(){let{session:e}=this.props;return(0,s.jsx)(p,{urlToFetch:"/api/v2/chat/channels/global-pending-messages-count",session:e,children:t=>{let{result:{results:n}={},reload:r,isPending:o}=t;return(0,s.jsxs)(i.Fragment,{children:[(0,s.jsx)(c.Provider,{value:{session:e,register:this.register,counts:this.state.counts,globalPendingCounts:n,visibleChats:this.state.visibleChats},children:this.props.children}),[...new Set(this.state.registered)].filter(e=>!this.state.visibleChats.includes(e)).map(t=>(0,s.jsx)(d,{session:e,bookingId:t,setCount:e=>{let{count:n}=e;r(),this.setState(e=>({counts:{...e.counts,[t]:n}}))}},t)),(0,s.jsx)(u.I,{delay:5e3,onInterval:()=>!o&&r()})]})}})}constructor(...e){super(...e),this.state={registered:[],visibleChats:[],fetchPromise:null,counts:{}},this.register=e=>{let{bookingId:t,chatIsVisible:n}=e;return this.setState(e=>({registered:[...e.registered,t],visibleChats:n?[...e.visibleChats,t]:e.visibleChats}),this.fetchCounts),()=>this.setState(e=>{let s=[...e.registered],i=s.indexOf(t);i>-1&&s.splice(i,1);let r=e.visibleChats;if(n){let n=(r=[...e.visibleChats]).indexOf(t);n>-1&&r.splice(n,1)}return{registered:s,visibleChats:r}})}}}class m extends i.Component{componentDidMount(){let{register:e,bookingId:t,chatIsVisible:n}=this.props;this.unregister=e({bookingId:t,chatIsVisible:n})}componentWillUnmount(){this.unregister&&this.unregister()}render(){let{bookingId:e,counts:t}=this.props;return this.props.children({count:t[e]})}}let g=e=>{let{bookingId:t,children:n,chatIsVisible:i}=e;return(0,s.jsx)(c.Consumer,{children:e=>{let{register:r,counts:o}=e;return(0,s.jsx)(m,{bookingId:t,register:r,counts:o,chatIsVisible:i,children:n})}})};function b(e){let{children:t}=e,{globalPendingCounts:n,visibleChats:s}=(0,i.useContext)(c),r=(n||[]).filter(e=>!s.includes(e.booking_uid));return t({count:r.length,pendingBookingId:((r||[])[0]||{}).booking_uid})}},13924:(e,t,n)=>{"use strict";n.d(t,{I:()=>i});var s=n(25963);class i extends s.Component{componentDidMount(){this.interval=setInterval(()=>this.props.onInterval&&this.props.onInterval(),this.props.delay)}componentWillUnmount(){this.interval&&clearInterval(this.interval)}render(){return null}}},17850:(e,t,n)=>{var s="Expected a function",i=0/0,r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,a=/^0o[0-7]+$/i,u=parseInt,c="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,h="object"==typeof self&&self&&self.Object===Object&&self,d=c||h||Function("return this")(),p=Object.prototype.toString,f=Math.max,m=Math.min,g=function(){return d.Date.now()};function b(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==p.call(t))return i;if(b(e)){var t,n="function"==typeof e.valueOf?e.valueOf():e;e=b(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var s=l.test(e);return s||a.test(e)?u(e.slice(2),s?2:8):o.test(e)?i:+e}e.exports=function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw TypeError(s);return b(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),function(e,t,n){var i,r,o,l,a,u,c=0,h=!1,d=!1,p=!0;if("function"!=typeof e)throw TypeError(s);function y(t){var n=i,s=r;return i=r=void 0,c=t,l=e.apply(s,n)}function x(e){var n=e-u,s=e-c;return void 0===u||n>=t||n<0||d&&s>=o}function j(){var e,n,s,i=g();if(x(i))return C(i);a=setTimeout(j,(e=i-u,n=i-c,s=t-e,d?m(s,o-n):s))}function C(e){return(a=void 0,p&&i)?y(e):(i=r=void 0,l)}function w(){var e,n=g(),s=x(n);
1if(i=arguments,r=this,u=n,s){if(void 0===a)return c=e=u,a=setTimeout(j,t),h?y(e):l;if(d)return a=setTimeout(j,t),y(u)}return void 0===a&&(a=setTimeout(j,t)),l}return t=v(t)||0,b(n)&&(h=!!n.leading,o=(d="maxWait"in n)?f(v(n.maxWait)||0,t):o,p="trailing"in n?!!n.trailing:p),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=u=r=a=void 0},w.flush=function(){return void 0===a?l:C(g())},w}(e,t,{leading:i,maxWait:t,trailing:r})}},25183:(e,t,n)=>{"use strict";n.d(t,{g:()=>o,w:()=>l});var s=n(50979),i=n(25963),r=n(73349);class o extends i.Component{componentDidMount(){this.setup(this.props)}componentDidUpdate(){this.setup(this.props)}componentWillUnmount(){this.key=null,this.onUnmount&&this.onUnmount()}render(){return(0,s.jsx)(r.A,{promise:this.state.loadPromise,children:e=>{let{isPending:t,...n}=e;return this.props.children({...n,isPending:null===this.state.loadPromise||t})}})}constructor(...e){super(...e),this.state={loadPromise:null},this.setup=e=>{let{session:{token:t}={},config:n}=e,s=this.getFirebasePromise(),i=[t,n].map(JSON.stringify).join(":");if(this.key===i||null==n||null==t)return;this.key=i,this.onUnmount&&this.onUnmount();let r=s.then(e=>{if(i!==this.key)return;let t=n.databaseURL;if(null==o.cache[t]){let s=e.initializeApp(n,n.databaseURL);o.cache[t]=s}return o.cache[t]});this.setState({loadPromise:r})},this.getFirebasePromise=()=>(o.loadPromise||(o.loadPromise=new Promise((e,t)=>{let n=document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript",s.src="https://www.gstatic.com/firebasejs/5.7.0/firebase-app.js",s.onreadystatechange=()=>e(),s.onload=()=>e(),s.onerror=()=>{o.loadPromise=null,t(Error("Error loading firebase base"))},n.appendChild(s)}).then(()=>new Promise((e,t)=>{let n=document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript",s.src="https://www.gstatic.com/firebasejs/5.7.0/firebase-database.js",s.onreadystatechange=()=>e(window.firebase),s.onload=()=>e(window.firebase),s.onerror=()=>{o.loadPromise=null,t(Error("Error loading firebase database"))},n.appendChild(s)}))),o.loadPromise)}}o.cache={};class l extends i.Component{componentDidMount(){this.setup(this.props)}componentDidUpdate(){this.setup(this.props)}componentWillUnmount(){this.key=null,this.onUnmount&&this.onUnmount()}render(){return this.props.children({val:null==this.state.val?void 0:this.state.val})}constructor(...e){super(...e),this.state={val:null},this.setup=e=>{let{refPath:t,firebase:n}=e,s=[t,!!n].map(JSON.stringify).join(":");s!==this.key&&(this.key=s,null!=t&&null!=n&&(this.onUnmount&&this.onUnmount(),this.ref=n.database().ref(t),this.ref.on("value",this.listener),this.onUnmount=()=>this.ref.off("value",this.listener)))},this.listener=e=>{this.setState(()=>({val:e.val()}))}}}}}]);
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.