PageSourceSearch

https://rainbowcentresrilanka.com/assets/News-BEE9MwfZ.js

js rainbowcentresrilanka.com collected 2026-10-04 02:08:55 UTC 14,117 bytes, 1 lines download raw bytes

1var gt=s=>{throw TypeError(s)};var X=(s,t,e)=>t.has(s)||gt("Cannot "+e);var i=(s,t,e)=>(X(s,t,"read from private field"),e?e.call(s):t.get(s)),g=(s,t,e)=>t.has(s)?gt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),d=(s,t,e,r)=>(X(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),p=(s,t,e)=>(X(s,t,"access private method"),e);import{S as Qt,p as bt,f as w,g as Z,h as H,n as tt,k as et,l as yt,t as Ut,m as It,o as _t,q as xt,v as Ot,r as R,w as Ft,x as Dt,u as kt,j as b,b as Mt,c as At,y as Bt,z as Pt,A as vt,B as Nt,C as Ht}from"./index-C3MKh5_X.js";import{B as $t}from"./BlueBar-DjayAFp5.js";import{C as zt,a as Wt}from"./CardMedia-mtB_LN1w.js";import{C as Vt}from"./CardContent-D5Rdez0I.js";import{T as st,B as it}from"./Box-CLrCtQR5.js";import{a as $}from"./axios-CCb-kr4I.js";import{C as qt}from"./CircularProgress-Cn57w79E.js";import{G as Rt}from"./Grid-CfAJtRbx.js";import{a as Gt}from"./aos-C2RcRrci.js";import"./Paper-Ds36hDXr.js";var x,n,z,y,U,D,T,j,W,k,M,I,_,L,A,c,N,rt,at,nt,ot,ht,ct,lt,Tt,Et,Kt=(Et=class extends Qt{constructor(t,e){super();g(this,c);g(this,x);g(this,n);g(this,z);g(this,y);g(this,U);g(this,D);g(this,T);g(this,j);g(this,W);g(this,k);g(this,M);g(this,I);g(this,_);g(this,L);g(this,A,new Set);this.options=e,d(this,x,t),d(this,j,null),d(this,T,bt()),this.options.experimental_prefetchInRender||i(this,T).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,n).addObserver(this),Ct(i(this,n),this.options)?p(this,c,N).call(this):this.updateResult(),p(this,c,ot).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ut(i(this,n),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ut(i(this,n),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,p(this,c,ht).call(this),p(this,c,ct).call(this),i(this,n).removeObserver(this)}setOptions(t){const e=this.options,r=i(this,n);if(this.options=i(this,x).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof w(this.options.enabled,i(this,n))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");p(this,c,lt).call(this),i(this,n).setOptions(this.options),e._defaulted&&!Z(this.options,e)&&i(this,x).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,n),observer:this});const l=this.hasListeners();l&&wt(i(this,n),r,this.options,e)&&p(this,c,N).call(this),this.updateResult(),l&&(i(this,n)!==r||w(this.options.enabled,i(this,n))!==w(e.enabled,i(this,n))||H(this.options.staleTime,i(this,n))!==H(e.staleTime,i(this,n)))&&p(this,c,rt).call(this);const o=p(this,c,at).call(this);l&&(i(this,n)!==r||w(this.options.enabled,i(this,n))!==w(e.enabled,i(this,n))||o!==i(this,L))&&p(this,c,nt).call(this,o)}getOptimisticResult(t){const e=i(this,x).getQueryCache().build(i(this,x),t),r=this.createResult(e,t);return Jt(this,r)&&(d(this,y,r),d(this,D,this.options),d(this,U,i(this,n).state)),r}getCurrentResult(){return i(this,y)}trackResult(t,e){return new Proxy(t,{get:(r,l)=>(this.trackProp(l),e==null||e(l),Reflect.get(r,l))})}trackProp(t){i(this,A).add(t)}getCurrentQuery(){return i(this,n)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=i(this,x).defaultQueryOptions(t),r=i(this,x).getQueryCache().build(i(this,x),e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return p(this,c,N).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,y)))}createResult(t,e){var mt;const r=i(this,n),l=this.options,o=i(this,y),h=i(this,U),E=i(this,D),f=t!==r?t.state:i(this,z),{state:O}=t;let u={...O},Q=!1,m;if(e._optimisticResults){const C=this.hasListeners(),q=!C&&Ct(t,e),F=C&&wt(t,r,e,l);(q||F)&&(u={...u,..._t(O.data,t.options)}),e._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:B,errorUpdatedAt:P,status:v}=u;m=u.data;let V=!1;if(e.placeholderData!==void 0&&m===void 0&&v==="pending"){let C;o!=null&&o.isPlaceholderData&&e.placeholderData===(E==null?void 0:E.placeholderData)?(C=o.data,V=!0):C=typeof e.placeholderData=="function"?e.placeholderData((mt=i(this,M))==null?void 0:mt.state.data,i(this,M)):e.placeholderData,C!==void 0&&(v="success",m=xt(o==null?void 0:o.data,C,e),Q=!0)}if(e.select&&m!==void 0&&!V)if(o&&m===(h==null?void 0:h.data)&&e.select===i(this,W))m=i(this,k);else try{d(this,W,e.select),m=e.select(m),m=xt(o==null?void 0:o.data,m,e),d(this,k,m),d(this,j,null)}catch(C){d(this,j,C)}i(this,j)&&(B=i(this,j),m=i(this,k),P=Date.now(),v="error");const K=u.fetchStatus==="fetching",Y=v==="pending",J=v==="error",ft=Y&&K,pt=m!==void 0,S={status:v,fetchStatus:u.fetchStatus,isPending:Y,isSuccess:v==="success",isError:J,isInitialLoading:ft,isLoading:ft,data:m,dataUpdatedAt:u.dataUpdatedAt,error:B,errorUpdatedAt:P,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdate
vendor: 4,150 bytes, line 1
1Count:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>f.dataUpdateCount||u.errorUpdateCount>f.errorUpdateCount,isFetching:K,isRefetching:K&&!Y,isLoadingError:J&&!pt,isPaused:u.fetchStatus==="paused",isPlaceholderData:Q,isRefetchError:J&&pt,isStale:dt(t,e),refetch:this.refetch,promise:i(this,T),isEnabled:w(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const C=G=>{S.status==="error"?G.reject(S.error):S.data!==void 0&&G.resolve(S.data)},q=()=>{const G=d(this,T,S.promise=bt());C(G)},F=i(this,T);switch(F.status){case"pending":t.queryHash===r.queryHash&&C(F);break;case"fulfilled":(S.status==="error"||S.data!==F.value)&&q();break;case"rejected":(S.status!=="error"||S.error!==F.reason)&&q();break}}return S}updateResult(){const t=i(this,y),e=this.createResult(i(this,n),this.options);if(d(this,U,i(this,n).state),d(this,D,this.options),i(this,U).data!==void 0&&d(this,M,i(this,n)),Z(e,t))return;d(this,y,e);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:l}=this.options,o=typeof l=="function"?l():l;if(o==="all"||!o&&!i(this,A).size)return!0;const h=new Set(o??i(this,A));return this.options.throwOnError&&h.add("error"),Object.keys(i(this,y)).some(E=>{const a=E;return i(this,y)[a]!==t[a]&&h.has(a)})};p(this,c,Tt).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&p(this,c,ot).call(this)}},x=new WeakMap,n=new WeakMap,z=new WeakMap,y=new WeakMap,U=new WeakMap,D=new WeakMap,T=new WeakMap,j=new WeakMap,W=new WeakMap,k=new WeakMap,M=new WeakMap,I=new WeakMap,_=new WeakMap,L=new WeakMap,A=new WeakMap,c=new WeakSet,N=function(t){p(this,c,lt).call(this);let e=i(this,n).fetch(this.options,t);return t!=null&&t.throwOnError||(e=e.catch(tt)),e},rt=function(){p(this,c,ht).call(this);const t=H(this.options.staleTime,i(this,n));if(et||i(this,y).isStale||!yt(t))return;const r=Ut(i(this,y).dataUpdatedAt,t)+1;d(this,I,setTimeout(()=>{i(this,y).isStale||this.updateResult()},r))},at=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,n)):this.options.refetchInterval)??!1},nt=function(t){p(this,c,ct).call(this),d(this,L,t),!(et||w(this.options.enabled,i(this,n))===!1||!yt(i(this,L))||i(this,L)===0)&&d(this,_,setInterval(()=>{(this.options.refetchIntervalInBackground||It.isFocused())&&p(this,c,N).call(this)},i(this,L)))},ot=function(){p(this,c,rt).call(this),p(this,c,nt).call(this,p(this,c,at).call(this))},ht=function(){i(this,I)&&(clearTimeout(i(this,I)),d(this,I,void 0))},ct=function(){i(this,_)&&(clearInterval(i(this,_)),d(this,_,void 0))},lt=function(){const t=i(this,x).getQueryCache().build(i(this,x),this.options);if(t===i(this,n))return;const e=i(this,n);d(this,n,t),d(this,z,t.state),this.hasListeners()&&(e==null||e.removeObserver(this),t.addObserver(this))},Tt=function(t){Ot.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(i(this,y))}),i(this,x).getQueryCache().notify({query:i(this,n),type:"observerResultsUpdated"})})},Et);function Yt(s,t){return w(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&t.retryOnMount===!1)}function Ct(s,t){return Yt(s,t)||s.state.data!==void 0&&ut(s,t,t.refetchOnMount)}function ut(s,t,e){if(w(t.enabled,s)!==!1&&H(t.staleTime,s)!=="static"){const r=typeof e=="function"?e(s):e;return r==="always"||r!==!1&&dt(s,t)}return!1}function wt(s,t,e,r){return(s!==t||w(r.enabled,s)===!1)&&(!e.suspense||s.state.status!=="error")&&dt(s,e)}function dt(s,t){return w(t.enabled,s)!==!1&&s.isStaleByTime(H(t.staleTime,s))}function Jt(s,t){return!Z(s.getCurrentResult(),t)}var jt=R.createContext(!1),Xt=()=>R.useContext(jt);jt.Provider;function Zt(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var te=R.createContext(Zt()),ee=()=>R.useContext(te),se=(s,t)=>{(s.suspense||s.throwOnError||s.experimental_prefetchInRender)&&(t.isReset()||(s.retryOnMount=!1))},ie=s=>{R.useEffect(()=>{s.clearReset()},[s])},re=({result:s,errorResetBoundary:t,throwOnError:e,query:r,suspense:l})=>s.isError&&!t.isReset()&&!s.isFetching&&r&&(l&&s.data===void 0||Ft(e,[s.error,r])),ae=s=>{if(s.suspense){const t=r=>
1r==="static"?r:Math.max(r??1e3,1e3),e=s.staleTime;s.staleTime=typeof e=="function"?(...r)=>t(e(...r)):t(e),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},ne=(s,t)=>s.isLoading&&s.isFetching&&!t,oe=(s,t)=>(s==null?void 0:s.suspense)&&t.isPending,St=(s,t,e)=>t.fetchOptimistic(s).catch(()=>{e.clearReset()});function he(s,t,e){var u,Q,m,B,P;const r=Xt(),l=ee(),o=Dt(),h=o.defaultQueryOptions(s);(Q=(u=o.getDefaultOptions().queries)==null?void 0:u._experimental_beforeQuery)==null||Q.call(u,h),h._optimisticResults=r?"isRestoring":"optimistic",ae(h),se(h,l),ie(l);const E=!o.getQueryCache().get(h.queryHash),[a]=R.useState(()=>new t(o,h)),f=a.getOptimisticResult(h),O=!r&&s.subscribed!==!1;if(R.useSyncExternalStore(R.useCallback(v=>{const V=O?a.subscribe(Ot.batchCalls(v)):tt;return a.updateResult(),V},[a,O]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),R.useEffect(()=>{a.setOptions(h)},[h,a]),oe(h,f))throw St(h,a,l);if(re({result:f,errorResetBoundary:l,throwOnError:h.throwOnError,query:o.getQueryCache().get(h.queryHash),suspense:h.suspense}))throw f.error;if((B=(m=o.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||B.call(m,h,f),h.experimental_prefetchInRender&&!et&&ne(f,r)){const v=E?St(h,a,l):(P=o.getQueryCache().get(h.queryHash))==null?void 0:P.promise;v==null||v.catch(tt).finally(()=>{a.updateResult()})}return h.notifyOnChangeProps?f:a.trackResult(f)}function Lt(s,t){return he(s,Kt)}const ce=({image:s,title:t,description:e,id:r})=>{const l=kt(),o=()=>{l(`/view-news?id=${r}`)};return b.jsxs(zt,{sx:{maxWidth:345,boxShadow:"0 4px 8px rgba(0,0,0,0.1)",borderRadius:"8px",overflow:"hidden",height:"100%",display:"flex",flexDirection:"column",transition:"transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out","&:hover":{transform:"translateY(-5px)",boxShadow:"0 10px 20px rgba(0,0,0,0.15)",cursor:"pointer"}},onClick:o,children:[b.jsx(Wt,{component:"img",height:"240",image:Array.isArray(s)?s[0]:s,alt:t,sx:{objectFit:"contain",width:"100%"}}),b.jsxs(Vt,{sx:{flexGrow:1,bgcolor:"white"},children:[b.jsx(st,{variant:"h6",component:"div",color:"error",fontWeight:"bold",textAlign:"center",sx:{fontSize:{xs:"14px",md:"16px"},mb:1},children:t}),b.jsx(st,{variant:"body2",color:"text.secondary",textAlign:"center",sx:{fontSize:{xs:"12px",md:"14px"}},children:e})]})]})},le=({title:s})=>{const t=Mt(),{newsList:e,mainImages:r,titleImages:l,loading:o}=At(a=>a.news),{data:h,isLoading:E}=Lt({queryKey:["newsList"],queryFn:async()=>{t(vt(!0));try{const a=await $.post("https://rainbowcentresrilanka.com/api/news/list",{status:"ACTIVE",page:1,limit:100});return t(Nt(a.data.data.data)),a.data.data.data}catch(a){throw t(Ht(a.message)),a}finally{t(vt(!1))}},staleTime:1e3*60*5});return R.useEffect(()=>{h&&h.forEach(async a=>{if(a.main_image&&!r[a.id])try{const f=await $.get(`https://rainbowcentresrilanka.com/api/media/view/${a.main_image}`,{responseType:"blob"}),O=URL.createObjectURL(f.data);t(Bt({id:a.id,imageUrl:O}))}catch(f){console.error("Error fetching main image:",f)}if(a.title_images&&(!l[a.id]||l[a.id].length===0))try{const f=[...new Set(a.title_images)];for(const O of f){const u=await $.get(`https://rainbowcentresrilanka.com/api/media/view/${O}`,{responseType:"blob"}),Q=URL.createObjectURL(u.data);t(Pt({id:a.id,imageUrl:Q}))}}catch(f){console.error("Error fetching title images:",f)}})},[h,t]),E||o?b.jsx(it,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",children:b.jsx(qt,{})}):b.jsxs(it,{sx:{width:{xs:"auto",md:"1050px"},margin:{xs:2,md:"0 auto"},mt:4,mb:6},children:[s&&b.jsx(st,{variant:"h4",component:"h2",textAlign:"center",color:"primary.main",fontWeight:"600",mb:4,"data-aos":"fade-up","data-aos-once":"true",children:s}),b.jsx(Rt,{container:!0,spacing:3,children:e&&e.map((a,f)=>b.jsx(Rt,{item:!0,xs:12,sm:6,md:4,"data-aos":"fade-up","data-aos-delay":f*100,"data-aos-once":"true",children:b.jsx(ce,{image:r[a.id],title:a.small_title||a.main_title,description:a.short_description,id:a.id})},a.id))})]})};function we(){const[s,t]=R.useState(null),{data:e,isLoading:r}=Lt({queryKey:["news"],queryFn:async()=>(await $.post("https://rainbowcentresrilanka.com/api/news/list",{status:"ACTIVE",page:1,limit:1})).data.data.data[0],staleTime:1e3*60*5});return R.useEffect(()=>{e!=null&&e.main_image&&(async()=>{try{const o=await $.get(`https://rainbowcentresrilanka.com/api/media/view/${e.main_image}`,{responseType:"blob"}),h=URL.createObjectURL(o.data);t(h)}catch(o){console.error("Error fetching image:",o),t(null)}})()},[e]),R.useEffect(()=>{Gt.init({duration:1e3,once:!1,mirror:!0})},[]),b.jsxs(b.Fragment,{children:[b.jsx($t,{title:e?e.main_title:"Loading...",description:e?e.short_description:"Loading...",backgroundColor:"#E2EBF4",image:s}),b.jsx(it,{sx:{mt:3},children:b.jsx(le,{title:"Latest News"})})]})}export{we as default};

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.