Files
004_comission/_utils/_comment_backup/louis coding's Reviews on Carousell Hong Kong_files/55dd9e2b663d98c9.min.js.download
louiscklaw 6c60a73f30 update,
2025-01-31 19:15:17 +08:00

6 lines
10 KiB
Plaintext

"use strict";
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9e1429a9-0d68-5958-a445-d47ce3004772")}catch(e){}}();
(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[258],{1631:(e,s,t)=>{t.d(s,{Z:()=>ee});var n=t(9),a=t.n(n),l=t(0),o=t(10),c=t(68),i=t(40),r=t(72),u=t(172),d=t(67),m=t(758),h=t(1488),p=t(24),_=t(15),v=t(1190),x=t(100),g=t(990),f="D_bGJ",S="D_bGG",D=t(1);const b=[{text:"0.5km",value:"0.5"},{text:"1km",value:"1"},{text:"2.5km",value:"2.5"},{text:"5km",value:"5"},{text:"10km",value:"10"},{text:"25km",value:"25"},{text:"50km",value:"50"},{text:"100km",value:"100"},{text:"200km",value:"200"},{text:"500km",value:"500"}],I=(0,d.P1)(h.mV,(e=>e?{text:e.name,value:e.placeId}:null)),N=(0,d.P1)(h.OI,(e=>e&&b.find((s=>s.value===e))||null)),j=function(e){const s=(0,o.I0)(),t=(0,o.v9)(v.Nr),n=(0,o.v9)(p.S$),c=(0,o.v9)(I),i=(0,o.v9)(N),r=(0,o.v9)(_.o2),u=(0,x.y1)((e=>{s((0,v.R3)({query:e,sessionToken:void 0}))}),500),[d,j]=(0,l.useState)("");return(0,l.useEffect)((()=>{const{location_name:e,place_id:t,range:n}=r;!c&&e&&t&&s((0,h.l7)({name:e,placeId:t})),!i&&n&&b.some((e=>e.value===n))&&s((0,h.rg)({range:n}))}),[s,c,r,i]),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m.Z,{allowNoOptions:!0,className:a()("D_bGH",e.isInNewHeader?f:null),classNameSelector:S,iconLeftURL:g,onOptionSelect:({text:e,value:t})=>{s((0,h.l7)({name:e,placeId:t}))},onQueryChange:e=>{j(e),u(e)},options:t.map((e=>({text:e.structured_formatting.main_text,value:e.place_id}))),placeholder:n.country_name,query:d,searchable:!0,value:c}),(0,D.jsx)("div",{className:"D_bGL"}),(0,D.jsx)(m.Z,{className:a()("D_bGI",e.isInNewHeader?f:null),classNameSelector:S,onOptionSelect:({value:e})=>{s((0,h.rg)({range:e}))},options:b,placeholder:"+km",value:i})]})};var y=t(74),L=t(398),w=t(731),C=t(845),O=t(746),Z=t(99),k=t(397),G=t(21),M=t(33),$=t(18),A=t(1429),P=t(1632),R=t(1633),E=t(724),T=t(797),B=t(2424),H=t(957),q="D_bGt";const U=e=>{const{ccID:s,onMouseLeave:t,onMouseOver:n,onSearchOptionClick:a,pageInfo:l,popoverRef:o,searchText:c,selectedLocations:i,setIsDeletingSelection:r,setSelectedLocations:u}=e,d=l?.search_bar?.search_params||[];return(0,D.jsxs)("div",{ref:o,children:[(0,D.jsx)(F,{onCloseClick:a,selectedLocations:i,setIsDeletingSelection:r,setSelectedLocations:u}),c?(0,D.jsx)(R.Z,{ccID:s,onSelect:a,searchParams:d,searchText:c,selectedLocations:i}):l?.search_option_groups.length?l.search_option_groups.map((({label:e,search_options:l},o)=>(0,D.jsx)(P.Z,{ccID:s,label:e,onClick:a,onMouseLeave:t,onMouseOver:n,options:l,selectedLocations:i},o))):null]})},F=({onCloseClick:e,selectedLocations:s,setIsDeletingSelection:t,setSelectedLocations:n})=>{const a=(0,Z._x)(),l=Array.from(s&&s.values()||[]),o=l.reduce(((e,{display_name:s})=>({...e,[s]:s in e?e[s]+1:1})),{});return l.length?(0,D.jsx)("div",{className:"D_bGv",children:(0,D.jsxs)("div",{children:[l.map(((s,n)=>{const{id:l,display_ancestor_name:c,display_name:i}=s;return(0,D.jsx)(C.Z,{className:"D_bGw",color:a.urbanGrey20,onClose:()=>{t(!0),e(null,s)},text:`${i}${o[i]>1?`, ${c}`:""}`},`${l}${n}`)})),l.length>1&&(0,D.jsx)(L.Z,{className:"D_bGx",onClick:()=>{t(!0),n(new Map)},size:"s",type:"linkTeal",children:(0,D.jsx)(k.Z,{id:(0,$.ZP)("Clear all")})})]})}):null},K=e=>{const{className:s,ccID:t=null,getContainerRef:n=null,design:c,selectedLocations:r,setSelectedLocations:u,setShowMainPopover:d,setShowSubPopover:m,showMainPopover:h,showSubPopover:_}=e,v=(0,o.I0)(),[f,S]=(0,l.useState)(!1),[b,I]=(0,l.useState)(""),[N,j]=(0,l.useState)(null),[L,C]=(0,l.useState)(null),[Z,k]=(0,l.useState)(!1),[$,P]=(0,l.useState)(!1),R=(0,o.v9)(G.l$),F=(0,o.v9)(T.UP),{country_code:K}=(0,o.v9)(p.S$),[z,V]=(0,l.useState)(!1),W=(0,l.useRef)(null),Y=(0,l.useRef)(null),J=(0,l.useRef)(null),Q=(0,l.useRef)(),X=(0,l.useCallback)((e=>{Q.current=e||void 0;const s=window.innerWidth;if(!J.current)return;if(!Q.current)return;const t=J.current.getBoundingClientRect(),n=t.width,a=t.left,l=Q.current.getBoundingClientRect().width;V(a+n+l>s)}),[]);(0,l.useEffect)((()=>{v((0,T.Lc)({ccID:t}))}),[t,v]);const ee=(0,x.y1)((function(){P(_)}),300),se=()=>{m(!0),ee()},te=()=>{L&&(clearTimeout(L),C(null))},ne=()=>{te(),m(!1),ee()},ae=(e,s)=>{e&&e.preventDefault();const t=new Map(r),n=t.delete(`${s.id}`);u(n?t:t.set(`${s.id}`,s))},le=J?.current?.offsetParent?.clientHeight,oe=Array.from(r&&r.values()||[]),ce=(0,H.I0)(oe);let ie=F?.search_bar?.label,re=!0;if(!h)if(oe.length)ie=ce,re=!1;else{const e=(0,B.BK)(K);e&&(ie=R(e))}const ue=a()({inlineInSearchBar:"D_bGp",input:"D_bGo",searchBar:"D_bGq"}[c],s);return(0,D.jsxs)("div",{className:a()("D_bGl",{D_bGn:"searchBar"===c&&f}),"data-testid":E.ZT.NAVBAR_SEARCH_INPUT_LOCATION_DESKTOP_DIV_SEARCH_LOCATION_PICKER,ref:W,children:[(0,D.jsx)(w.Z,{className:"D_bGm",classNameInputContainer:ue,classNameInput:a()("D_bGr",re?"D_bGs":null),iconLeftURL:g,onChange:e=>{I(e.target.value),d(!0)},onFocus:()=>{v((0,M.Vh)({name:"location_filter_search_bar_tapped",type:"action"})),S(!0),d(!0)},onBlur:()=>{S(!1)},placeholder:ie||"",ref:Y,spellCheck:!1,type:"text",value:b}),(0,D.jsx)(O.Z,{className:q,container:n?n():null,horizontalAlign:"left",onHide:e=>{const s=y.findDOMNode(Q.current);Q&&s?.contains(e.target)||(Z?k(!1):f||(I(""),d(!1)))},show:h,target:Y.current?.container,children:(0,D.jsx)(U,{ccID:t,onMouseLeave:ne,onMouseOver:e=>{te(),C(setTimeout((()=>{j(e)}),300)),se()},onSearchOptionClick:ae,pageInfo:F,popoverRef:J,searchText:b,selectedLocations:r,setIsDeletingSelection:k,setSelectedLocations:u,setShowMainPopover:d})}),(0,D.jsx)(O.Z,{className:`${q} D_bGu`,container:n?n():null,customStyles:{left:z?`-${i.spacing300}`:i.spacing300,minHeight:`${le||360}px`},horizontalAlign:"left",onMouseLeave:ne,onMouseOver:se,ref:X,show:$,target:Y.current?.container,children:(0,D.jsx)(A.Z,{ccID:t,onSelect:ae,searchOption:N,selectedLocations:r})})]})};var z=t(8),V=t(39),W=t(403),Y=t(404),J=t(104),Q=t(723),X=t(1327);const ee=({className:e,deriveSearchPath:s,field:t,isInFilterBar:n})=>{const d=(0,u.Z)(),m=(0,o.I0)(),{countryCollectionId:h}=(0,c.UO)(),{setField:v}=(0,l.useContext)(J.P_),g=(0,o.v9)(z.Y6),f=(0,o.v9)(G.l$),{country_code:S}=(0,o.v9)(p.S$),b=(0,o.v9)(T.ak),I=(0,o.v9)(T.D7),N=(0,o.v9)(T.uQ),y=(0,x.D9)(N),L=(0,Q.c)("web-enable-adm-location-picker"),[w,C]=(0,l.useState)(!1),[O,Z]=(0,l.useState)(!1),[k,M]=(0,l.useState)(new Map),$=(0,l.useRef)(null);(0,l.useEffect)((()=>{M((I||[]).reduce(((e,s)=>e.set(`${s.id}`,s)),new Map))}),[I]),(0,l.useEffect)((()=>{g||m((0,T.Lc)({ccID:Number(h)||null}))}),[h,m,g]);const A=(0,l.useCallback)((e=>{let n=null,a=[];e&&M(e);const l=Array.from(e&&e.values()||[]);N&&Array.isArray(N)?(a=[...N],M(N.reduce(((e,s)=>e.set(`${s.id}`,s)),new Map))):l?.length&&(a=[...l]),a.length&&(n=(0,B.Yo)(a)),v(t.id,n&&"location_ids"in n?n.location_ids:""),s&&N&&y!==N&&n&&m((0,_.J5)(s(n.location_ids)))}),[s,m,t.id,N,y,v]);(0,l.useEffect)((()=>{N&&y!==N&&(C(!1),Z(!1),A(),m((0,T.G8)({options:null})))}),[s,m,N,y,A]);const P=t.ui_rules.label,R=Array.from(k&&k.values()||[]),E=(0,H.I0)(R);let q=t.ui_rules.label||"";if(R.length)q=E;else{const e=(0,B.BK)(S);q=e?f(e):""}return g?(0,D.jsx)("div",{className:"D_bql",ref:$,style:{maxWidth:n?i.spacing320:void 0},children:L?(0,D.jsx)(K,{className:e,ccID:Number(h),design:n?"inlineInSearchBar":"input",getContainerRef:()=>$.current,selectedLocations:k,setSelectedLocations:A,setShowMainPopover:C,setShowSubPopover:Z,showMainPopover:w,showSubPopover:O}):(0,D.jsx)(j,{isInNewHeader:n})}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)("button",{className:a()("D_bqm",e),onClick:()=>{m((0,V.Gu)("SEARCH_LOCATION_PICKER_MODAL_MOBILE"))},type:"button",children:[(0,D.jsxs)("div",{className:"D_bqn",children:[P?(0,D.jsx)(r.Z,{className:"D_bqp",color:d.urbanGrey60,singleline:!0,size:"s",children:P}):null,(0,D.jsx)(r.Z,{singleline:!0,size:"l",children:q})]}),(0,D.jsx)("div",{className:"D_bqo",children:(0,D.jsx)(W.Z,{name:Y.T.location_pin,size:16})})]}),(0,D.jsx)(X.Z,{ccID:h,onFiltersSubmit:({locationIds:e=[]})=>{A(e.reduce(((e,s)=>(e.set(`${s}`,b[s]),e)),new Map))}})]})}},1429:(e,s,t)=>{t.d(s,{Z:()=>_});var n=t(0),a=t(2428),l=t(10),o=t(730),c=t(72),i=t(8),r=t(33),u=t(802),d=t(797),m=t(2424),h=t(1);const p=t(1430),_=({ccID:e,onSelect:s,searchOption:t,selectedLocations:_})=>{const v=(0,l.I0)(),x=(0,l.v9)(i.Y6),g=(0,n.useMemo)((()=>{if(!t||!t.search_params)return[];const{search_params:e}=t;return e.filter((e=>"adm_ids"===e.key)).map((e=>e.value.split(",").map(Number))).reduce(((e,s)=>[...e,...s]))}),[t]),f=(0,l.v9)((s=>(0,d.hC)(s,{admIDs:g,ccID:e})));if((0,n.useEffect)((()=>{f||v((0,d.G$)({admIDs:g,ccID:e}))}),[g,e,v,f]),!t)return null;const S=(s,t)=>{v((0,d.G$)({admIDs:g,ccID:e}))},D=x?p:void 0;return(0,h.jsx)("div",{onMouseEnter:x?()=>{v((0,r.Vh)({name:"location_filter_option_tapped",properties:{context:(0,m.Rv)(t.type)},type:"action"}))}:void 0,children:f?f?f.map(((e,t)=>{const{id:n,display_name:l}=e;return(0,h.jsxs)("div",{className:`D_bTU ${D.searchOption}`,children:[(0,h.jsx)(u.Z,{variant:"checkbox",selected:!!_?.get(`${n}`),name:l,onChange:t=>{if(s&&e){const n={...e,source:"option"};v((0,d.nb)({options:[n]})),s(t,n)}},children:(0,h.jsx)(c.Z,{singleline:!0,children:l})}),t===f.length-10&&(0,h.jsx)(a.df,{onChange:S,triggerOnce:!0,children:(0,h.jsx)("span",{})})]},`${t}_${n}`)})):null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Z,{className:D.loadingShimmer,style:{width:"60%"}}),(0,h.jsx)(o.Z,{className:D.loadingShimmer,style:{width:"80%"}}),(0,h.jsx)(o.Z,{className:D.loadingShimmer,style:{width:"20%"}}),(0,h.jsx)(o.Z,{className:D.loadingShimmer,style:{width:"40%"}}),(0,h.jsx)(o.Z,{className:D.loadingShimmer,style:{width:"50%"}}),(0,h.jsx)(o.Z,{className:D.loadingShimmer,style:{width:"30%"}}),(0,h.jsx)(o.Z,{className:D.loadingShimmer,style:{width:"70%"}}),(0,h.jsx)(o.Z,{className:D.loadingShimmer,style:{width:"90%"}})]})})}},1430:(e,s,t)=>{t.r(s),t.d(s,{loadingShimmer:()=>n,searchOption:()=>a});var n="D_bTW",a="D_bTV"},770:e=>{e.exports="https://mweb-cdn.karousell.com/build/image-placeholder-5931f6f59c.svg"}}]);
//# sourceMappingURL=https://mdev.llesuorac.com/01857052a1fbff6c7926249973b6164fd2b19d8b/55dd9e2b663d98c9.min.js.map
//# debugId=9e1429a9-0d68-5958-a445-d47ce3004772