"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[404],{1991:function(e,n,t){var a=t(8870),s=t(4467),r=t(9379),c=t(5544),i=t(6540),o=t(758),l=t.n(o),u=t(118),d=t(1212),h=t(467),f=t(374),p=t(5596),m=[{key:"plaza",label:"\u5e7f\u573a",path:"/pages/plaza/index"},{key:"nearby",label:"\u9644\u8fd1",path:"/pages/nearby/index"},{key:"messages",label:"\u6c6a\u53cb",path:"/pages/messages/index",dot:!0},{key:"profile",label:"\u6211\u7684",path:"/pages/profile/index"}],v=t(4848);function _(e){var n=e.active,t=e.onSwitch,a=(0,f.v)(),s=a.safeBottom,r=function(e,a){e!==n&&(t?t(e):l().switchTab({url:a}))},c=function(e){var t=m[e],a=n===t.key?"bottom-tabbar__item--active":"";return(0,v.jsxs)(u.Ss,{className:"bottom-tabbar__item ".concat(a),onClick:function(){return r(t.key,t.path)},children:[(0,v.jsxs)(u.Ss,{className:"bottom-tabbar__icon-wrap",children:[(0,v.jsx)(u.Ss,{className:"bottom-tabbar__icon bottom-tabbar__icon--".concat(t.key)}),t.dot?(0,v.jsx)(u.Ss,{className:"bottom-tabbar__dot"}):null]}),(0,v.jsx)(u.EY,{className:"bottom-tabbar__label ".concat(n===t.key?"bottom-tabbar__label--active":""),children:t.label})]})},i=function(){var e=(0,h.A)((0,d.A)().m(function e(){return(0,d.A)().w(function(e){while(1)switch(e.n){case 0:return e.n=1,(0,p.HQ)();case 1:if(e.v){e.n=2;break}return e.a(2);case 2:l().navigateTo({url:"/pages/publish/index"});case 3:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return(0,v.jsxs)(u.Ss,{className:"bottom-tabbar",style:{paddingBottom:"".concat(Math.max(22,s),"px")},children:[c(0),c(1),(0,v.jsx)(u.Ss,{className:"bottom-tabbar__fab",onClick:i,children:(0,v.jsx)(u.Ss,{className:"bottom-tabbar__fab-inner",children:(0,v.jsx)(u.Ss,{className:"bottom-tabbar__fab-icon"})})}),c(2),c(3)]})}var x=_,b=t(436);function g(e){var n=e.title,t=e.compactTitle,a=void 0!==t&&t,s=e.left,r=e.leading,c=(0,f.v)(),i=c.statusBarHeight,o=c.menuRight,l=r||s;return(0,v.jsx)(u.Ss,{className:"custom-nav",style:{paddingTop:"".concat(i,"px"),paddingRight:"".concat(o,"px")},children:(0,v.jsxs)(u.Ss,{className:"custom-nav__row",children:[l?(0,v.jsx)(u.Ss,{className:"custom-nav__leading",children:l}):(0,v.jsx)(u.Ss,{className:"custom-nav__left"}),n?(0,v.jsx)(u.EY,{className:"custom-nav__title ".concat(a?"custom-nav__title--compact":""),children:n}):null]})})}var j=g;function y(e){var n=e.children,t=e.className,a=void 0===t?"":t,s=e.scroll,r=void 0===s||s,c=e.withTabBar,i=void 0===c||c,o=e.lowerThreshold,l=void 0===o?80:o,d=e.onScrollToLower,h=(0,f.v)(),p=h.safeBottom,m=(0,v.jsx)(u.Ss,{className:"page-shell__inner ".concat(a),style:{paddingBottom:"".concat(i?108+p:24+p,"px")},children:n});return(0,v.jsx)(u.Ss,{className:"page-shell",children:r?(0,v.jsx)(u.BM,{scrollY:!0,className:"page-shell__scroll",enhanced:!0,showScrollbar:!1,lowerThreshold:l,onScrollToLower:d,children:m}):m})}var k=y,S=t(3401);function w(e){var n=e.placeholder,t=e.value,a=void 0===t?"":t,s=e.onInput,r=e.onConfirm;return(0,v.jsxs)(u.Ss,{className:"search-bar",children:[(0,v.jsx)(S.A,{name:"search",size:14}),(0,v.jsx)(u.pd,{className:"search-bar__input",value:a,placeholder:n,placeholderClass:"search-bar__placeholder",confirmType:"search",onInput:function(e){return null===s||void 0===s?void 0:s(String(e.detail.value))},onConfirm:r})]})}var A=w,N=t(326);function T(e){var n=e.active,t=void 0!==n&&n,a=e.prefix,s=e.className,r=void 0===s?"":s,c=e.onClick,i=e.children;return(0,v.jsxs)(u.Ss,{className:"chip ".concat(t?"chip--active":""," ").concat(r),onClick:c,children:[a?(0,v.jsx)(u.EY,{className:"chip__prefix",children:a}):null,(0,v.jsx)(u.EY,{children:i})]})}var E=T,C=t(7896);function Y(){return(0,v.jsxs)(u.Ss,{className:"feed-ad-card",children:[(0,v.jsx)(u.Ss,{className:"feed-ad-card__mark",children:"\u6c6a"}),(0,v.jsxs)(u.Ss,{className:"feed-ad-card__text",children:[(0,v.jsx)(u.EY,{className:"feed-ad-card__title",children:"\u5468\u672b\u5ba0\u7269\u6d3e\u5bf9 \xb7 \u6ee8\u6c5f\u7eff\u5730"}),(0,v.jsx)(u.EY,{className:"feed-ad-card__sub",children:"\u672c\u5468\u516d 14:00 \xb7 \u540d\u989d\u5269 12 \u4e2a"})]}),(0,v.jsx)(u.Ss,{className:"feed-ad-card__cta",children:"\u62a5\u540d"})]})}var M=Y,z=t(3972),B=t(4149),I=t(994),L=t(5313);function R(e,n,t,a){var s=(0,i.useRef)(a);s.current=a;var r=(0,i.useRef)(n),c=(0,i.useRef)(t);(0,i.useEffect)(function(){var a=n&&!r.current,i=n&&t!==c.current;r.current=n,c.current=t,(a||i)&&(0,L.Xl)(e)&&s.current()},[n,t,e])}var U=[{key:"feed",label:"\u63a8\u8350"},{key:"nearby",label:"\u9644\u8fd1"},{key:"follow",label:"\u5173\u6ce8"}],F="\u5168\u90e8",Q=20,H=6,V=[F];function D(){return 1+Math.floor(3*Math.random())}function O(e,n){var t=new Set(e.map(function(e){return e._id}));return[].concat((0,b.A)(e),(0,b.A)(n.filter(function(e){return!t.has(e._id)})))}function Z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F,t=[].concat(V),a=new Set(t);return n!==F&&(t.push(n),a.add(n)),e.forEach(function(e){e&&!a.has(e)&&(t.push(e),a.add(e))}),t}function K(e,n){return e.map(function(e){var t=n.get(e._id);return t?(0,r.A)((0,r.A)({},e),{},{likedByMe:t.likedByMe,counts:(0,r.A)((0,r.A)({},e.counts),{},{likes:t.likes})}):e})}function P(e){var n=e.active,t=void 0!==n&&n,a=e.showTick,s=void 0===a?0:a,o=(0,i.useState)("feed"),f=(0,c.A)(o,2),m=f[0],_=f[1],x=(0,i.useState)(F),b=(0,c.A)(x,2),g=b[0],y=b[1],S=(0,i.useState)(V),w=(0,c.A)(S,2),T=w[0],Y=w[1],P=(0,i.useState)(""),$=(0,c.A)(P,2),q=$[0],X=$[1],J=(0,i.useState)(""),W=(0,c.A)(J,2),G=W[0],ee=W[1],ne=(0,i.useState)([]),te=(0,c.A)(ne,2),ae=te[0],se=te[1],re=(0,i.useState)(""),ce=(0,c.A)(re,2),ie=ce[0],oe=ce[1],le=(0,i.useState)(!0),ue=(0,c.A)(le,2),de=ue[0],he=ue[1],fe=(0,i.useState)(!1),pe=(0,c.A)(fe,2),me=pe[0],ve=pe[1],_e=(0,i.useState)(D),xe=(0,c.A)(_e,2),be=xe[0],ge=xe[1],je=(0,I.d)(480),ye=(0,i.useRef)([]),ke=(0,i.useRef)(0),Se=(0,i.useRef)(new Set),we=(0,i.useRef)(new Map),Ae=function(){ke.current+=1},Ne=(0,i.useCallback)((0,h.A)((0,d.A)().m(function e(){var n,t,a,s,r,c,i,o,u,h=arguments;return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return n=h.length>0&&void 0!==h[0]?h[0]:{},t=n.append,a=void 0!==t&&t,s=n.cursor,r=n.silent,c=void 0!==r&&r,i=ke.current+1,ke.current=i,a?ve(!0):c||(he(!0),oe("")),e.p=1,e.n=2,(0,B.lr)({channel:m,topic:g===F?void 0:g,cursor:s,pageSize:Q,keyword:G||void 0});case 2:if(o=e.v,i===ke.current){e.n=3;break}return e.a(2);case 3:u=K(o.list,we.current),se(function(e){return a?O(e,u):u}),oe(o.nextCursor||""),a||(Y(Z(o.topics,g)),ge(D()),(0,L.aQ)("feed")),e.n=5;break;case 4:e.p=4,e.v,i===ke.current&&l().showToast({title:"\u52a8\u6001\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5",icon:"none"});case 5:return e.p=5,a?ve(!1):he(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])})),[m,G,g]);(0,i.useEffect)(function(){Ne()},[Ne]),(0,i.useEffect)(function(){ye.current=ae},[ae]),(0,i.useEffect)(function(){var e=setTimeout(function(){return ee(q.trim())},300);return function(){return clearTimeout(e)}},[q]);var Te=function(){ee(q.trim())},Ee=function(){X(""),ee("")};R("feed",t,s,function(){return Ne({silent:!0})}),(0,i.useEffect)(function(){return(0,L.Fo)(function(e){var n=e.postId,t=e.liked,a=e.likes;se(function(e){return e.map(function(e){return e._id===n?e.likedByMe===t&&e.counts.likes===a?e:(0,r.A)((0,r.A)({},e),{},{likedByMe:t,counts:(0,r.A)((0,r.A)({},e.counts),{},{likes:a})}):e})})})},[]);var Ce=function(){de||me||!ie||Ne({append:!0,cursor:ie})},Ye=function(){var e=(0,h.A)((0,d.A)().m(function e(n){var t,a,s,c;return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.n=1,(0,p.HQ)();case 1:if(e.v){e.n=2;break}return e.a(2);case 2:if(!Se.current.has(n)){e.n=3;break}return e.a(2);case 3:if(t=ye.current.find(function(e){return e._id===n}),t){e.n=4;break}return e.a(2);case 4:return a=!t.likedByMe,s=Math.max(0,t.counts.likes+(a?1:-1)),Se.current.add(n),we.current.set(n,{likedByMe:a,likes:s}),Ae(),a&&je.show(),se(function(e){return e.map(function(e){return e._id!==n?e:(0,r.A)((0,r.A)({},e),{},{likedByMe:a,counts:(0,r.A)((0,r.A)({},e.counts),{},{likes:s})})})}),e.p=5,e.n=6,(0,B.O$)(n,a);case 6:c=e.v,we.current.delete(n),Ae(),se(function(e){return e.map(function(e){return e._id===n?(0,r.A)((0,r.A)({},e),{},{likedByMe:c.liked,counts:(0,r.A)((0,r.A)({},e.counts),{},{likes:c.likes})}):e})}),e.n=8;break;case 7:e.p=7,e.v,we.current.delete(n),Ae(),se(function(e){return e.map(function(e){return e._id===n?(0,r.A)((0,r.A)({},e),{},{likedByMe:t.likedByMe,counts:(0,r.A)((0,r.A)({},e.counts),{},{likes:t.counts.likes})}):e})}),l().showToast({title:"\u70b9\u8d5e\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5",icon:"none"});case 8:return e.p=8,Se.current.delete(n),e.f(8);case 9:return e.a(2)}},e,null,[[5,7,8,9]])}));return function(n){return e.apply(this,arguments)}}(),Me=function(e){var n=ye.current.find(function(n){return n._id===e});n&&(0,L.bE)(n),l().navigateTo({url:"/pages/post-detail/index?postId=".concat(e)})},ze=function(e){return e>=be&&(e-be)%H===0},Be=ie?"".concat(ae.length,"+"):String(ae.length),Ie=G?"\u6ca1\u6709\u627e\u5230\u76f8\u5173\u52a8\u6001\uff0c\u6362\u4e2a\u5173\u952e\u8bcd\u8bd5\u8bd5\u5427":"follow"===m?"\u5173\u6ce8\u7684\u4eba\u8fd8\u6ca1\u6709\u53d1\u5e03\u52a8\u6001\uff0c\u53bb\u53d1\u73b0\u66f4\u591a\u6c6a\u53cb\u5427":"\u8fd8\u6ca1\u6709\u52a8\u6001\uff0c\u70b9\u51fb + \u53d1\u5e03\u7b2c\u4e00\u6761\u5427";return(0,v.jsxs)(k,{className:"plaza-page",lowerThreshold:160,onScrollToLower:Ce,children:[(0,v.jsx)(j,{title:"\u5e7f\u573a"}),(0,v.jsx)(A,{placeholder:"\u641c\u7d22\u8bdd\u9898\u3001\u5ba0\u7269\u3001\u9644\u8fd1\u6d3b\u52a8",value:q,onInput:X,onConfirm:Te}),(0,v.jsx)(N.A,{items:U,value:m,onChange:_}),(0,v.jsx)(u.BM,{scrollX:!0,className:"plaza-page__chips",showScrollbar:!1,children:(0,v.jsx)(u.Ss,{className:"plaza-page__chips-inner",children:T.map(function(e){return(0,v.jsx)(E,{active:g===e,onClick:function(){return y(e)},children:e},e)})})}),G?(0,v.jsxs)(u.Ss,{className:"plaza-page__search-result",children:[(0,v.jsxs)(u.Ss,{className:"plaza-page__search-copy",children:[(0,v.jsx)(u.EY,{className:"plaza-page__search-title",children:g===F?"\u641c\u7d22\u201c".concat(G,"\u201d"):"\u5728 #".concat(g," \u4e2d\u641c\u7d22\u201c").concat(G,"\u201d")}),(0,v.jsx)(u.EY,{className:"plaza-page__search-count",children:de?"\u6b63\u5728\u641c\u7d22\u2026":"\u5df2\u5c55\u793a ".concat(Be," \u6761\u7ed3\u679c")})]}),(0,v.jsx)(u.EY,{className:"plaza-page__search-clear",onClick:Ee,children:"\u6e05\u9664"})]}):null,(0,v.jsxs)(u.Ss,{className:"plaza-page__feed",children:[ae.map(function(e,n){return(0,v.jsxs)(u.Ss,{children:[(0,v.jsx)(z.A,{post:e,onLike:Ye,onOpen:Me}),ze(n)?(0,v.jsx)(M,{}):null]},e._id)}),de&&0===ae.length?(0,v.jsx)(u.EY,{className:"plaza-page__empty",children:"\u52a0\u8f7d\u4e2d\u2026"}):de||0!==ae.length?me?(0,v.jsx)(u.EY,{className:"plaza-page__empty",children:"\u52a0\u8f7d\u66f4\u591a\u4e2d\u2026"}):ie?(0,v.jsx)(u.EY,{className:"plaza-page__empty",children:"\u4e0a\u6ed1\u52a0\u8f7d\u66f4\u591a"}):(0,v.jsx)(u.EY,{className:"plaza-page__empty",children:"\u6682\u65f6\u6ca1\u6709\u66f4\u591a\u4e86\uff0c\u7a0d\u540e\u518d\u6765\u770b\u770b\u5427"}):(0,v.jsx)(u.EY,{className:"plaza-page__empty",children:Ie})]}),(0,v.jsx)(C.A,{visible:je.visible})]})}var $="",q=1,X="nearbyMap",J="#d8b4ff",W="#2a1d4a",G="rgba(31,23,66,0.92)",ee="#ffffff";function ne(e){var n=e.pets,t=e.center,a=e.scale,s=e.activeId,r=e.onSelect,c=e.onRegionChange,o=n.map(function(e,n){return{pet:e,index:n}}).filter(function(e){var n=e.pet;return"number"===typeof n.latitude&&"number"===typeof n.longitude}).map(function(e){var n=e.pet,t=e.index,a=n._id===s;return{id:t,latitude:n.latitude,longitude:n.longitude,width:a?32:24,height:a?32:24,callout:{content:n.name,color:a?W:ee,bgColor:a?J:G,fontSize:12,padding:6,borderRadius:10,display:"ALWAYS"}}}),l=function(e){var t=n[e.detail.markerId];t&&r(t._id)},d=(0,i.useMemo)(function(){var e=n.filter(function(e){return"number"===typeof e.latitude&&"number"===typeof e.longitude}).map(function(e){return{latitude:e.latitude,longitude:e.longitude}});if(e.length)return[{latitude:t.latitude,longitude:t.longitude}].concat((0,b.A)(e));var a=.02;return[{latitude:t.latitude-a,longitude:t.longitude-a},{latitude:t.latitude+a,longitude:t.longitude+a}]},[n,t.latitude,t.longitude]);return(0,v.jsx)(u.T5,{id:X,className:"nearby-map",latitude:t.latitude,longitude:t.longitude,scale:a,showLocation:!0,enableZoom:!0,enableScroll:!0,enableRotate:!1,subkey:$||void 0,layerStyle:$?q:void 0,markers:o,includePoints:d,onMarkerTap:l,onRegionChange:function(e){"end"===(null===e||void 0===e?void 0:e.type)&&(null===c||void 0===c||c(e.causedBy||""))},onError:function(){}})}var te=ne;function ae(e){var n=e.onRefresh,t=e.onZoomIn,a=e.onZoomOut,s=e.onLocate;return(0,v.jsxs)(u.Ss,{className:"map-controls",children:[(0,v.jsx)(u.Ss,{className:"map-controls__btn",onClick:n,children:(0,v.jsx)(S.A,{name:"refresh",size:18})}),(0,v.jsxs)(u.Ss,{className:"map-controls__stack",children:[(0,v.jsx)(u.Ss,{className:"map-controls__btn",onClick:t,children:(0,v.jsx)(S.A,{name:"plus",size:18})}),(0,v.jsx)(u.Ss,{className:"map-controls__btn",onClick:a,children:(0,v.jsx)(S.A,{name:"minus",size:18})}),(0,v.jsx)(u.Ss,{className:"map-controls__btn",onClick:s,children:(0,v.jsx)(S.A,{name:"target",size:18})})]})]})}var se=ae;function re(e){var n=e.pet,t=e.active,a=e.onSelect,s=e.onFriendAction,r=e.onLike,o=(0,i.useState)(!1),l=(0,c.A)(o,2),d=l[0],h=l[1];(0,i.useEffect)(function(){return h(!1)},[n.photoUrl]);var f=d||!n.photoUrl||n.photoUrl.startsWith("cloud://")?"":n.photoUrl,p=n.isMine?{key:"mine",label:"\u6211\u7684",icon:"user"}:n.isFriend?{key:"friend",label:"\u804a\u5929",icon:"message"}:n.isFollowing?{key:"pending",label:"\u5f85\u56de\u5173",icon:"check"}:{key:"add",label:"\u52a0\u6c6a\u53cb",icon:"plus"};return(0,v.jsxs)(u.Ss,{className:"nearby-pet-card ".concat(t?"nearby-pet-card--active":""),onClick:a,children:[(0,v.jsxs)(u.Ss,{className:"nearby-pet-card__photo ".concat(f?"":n.photoKey||""),children:[f?(0,v.jsx)(u._V,{className:"nearby-pet-card__photo-img",src:f,mode:"aspectFill",onError:function(){return h(!0)}}):null,(0,v.jsx)(u.EY,{className:"nearby-pet-card__distance",children:n.distanceText})]}),(0,v.jsxs)(u.Ss,{className:"nearby-pet-card__info",children:[(0,v.jsxs)(u.Ss,{className:"nearby-pet-card__title",children:[(0,v.jsx)(u.EY,{className:"nearby-pet-card__name",children:n.name}),n.online?(0,v.jsx)(u.Ss,{className:"nearby-pet-card__online"}):null]}),(0,v.jsxs)(u.EY,{className:"nearby-pet-card__meta",children:[n.breed," \xb7 ",n.ageText]}),(0,v.jsx)(u.EY,{className:"nearby-pet-card__mood",children:n.mood}),(0,v.jsx)(u.Ss,{className:"nearby-pet-card__tags",children:n.tags.slice(0,2).map(function(e){return(0,v.jsx)(u.EY,{className:"nearby-pet-card__tag",children:e},e)})})]}),(0,v.jsxs)(u.Ss,{className:"nearby-pet-card__actions",children:[(0,v.jsxs)(u.Ss,{className:"nearby-pet-card__friend nearby-pet-card__friend--".concat(p.key),onClick:function(e){e.stopPropagation(),s()},children:[(0,v.jsx)(S.A,{name:p.icon,size:13}),(0,v.jsx)(u.EY,{className:"nearby-pet-card__friend-text",children:p.label})]}),(0,v.jsx)(u.Ss,{className:"nearby-pet-card__btn nearby-pet-card__btn--like ".concat(n.likedByMe?"nearby-pet-card__btn--liked":""),onClick:function(e){e.stopPropagation(),r()},children:(0,v.jsx)(S.A,{name:n.likedByMe?"heart-fill":"heart",size:16})})]})]})}var ce=re;function ie(e,n,t){return Math.max(n,Math.min(t,e))}var oe=[64,220,400,520];function le(e){return oe.reduce(function(n,t){return Math.abs(t-e)0&&void 0!==arguments[0]?arguments[0]:220,n=(0,i.useState)(e),t=(0,c.A)(n,2),a=t[0],s=t[1],r=(0,i.useState)(!1),o=(0,c.A)(r,2),l=o[0],u=o[1],d=(0,i.useRef)(0),h=(0,i.useRef)(e),f=function(e){var n=e.touches[0];d.current=n.clientY,h.current=a,u(!0)},p=function(e){if(l){var n=e.touches[0],t=h.current+d.current-n.clientY;s(ie(t,oe[0],oe[oe.length-1]))}},m=function(){u(!1),s(le(a))};return{height:a,dragging:l,isMin:a<=oe[0]+8,onTouchStart:f,onTouchMove:p,onTouchEnd:m}}var de=[{key:"all",label:"\u5168\u90e8"},{key:"dog",label:"\u72d7\u72d7"},{key:"cat",label:"\u732b\u54aa"},{key:"online",label:"\u5728\u7ebf"}];function he(e){var n=e.pets,t=e.activeId,a=e.filter,s=e.state,r=void 0===s?"ready":s,c=e.onFilterChange,i=e.onSelect,o=e.onFriendAction,l=e.onLike,d=ue(220),h="loading"===r?"\u6b63\u5728\u8bfb\u53d6\u9644\u8fd1\u8bbe\u7f6e\u2026":"disabled"===r?"\u9644\u8fd1\u53ef\u89c1\u5df2\u5173\u95ed\uff0c\u53ef\u5728\u300c\u6211\u7684\u300d\u91cc\u91cd\u65b0\u5f00\u542f":"\u9644\u8fd1\u6682\u65f6\u6ca1\u6709\u6c6a\u53cb\uff0c\u6362\u4e2a\u65f6\u95f4\u6216\u632a\u4e2a\u4f4d\u7f6e\u518d\u770b\u770b\uff5e";return(0,v.jsxs)(u.Ss,{className:"nearby-sheet ".concat(d.isMin?"nearby-sheet--min":""," ").concat(d.dragging?"nearby-sheet--dragging":""),style:{height:"".concat(d.height,"px")},catchMove:!0,children:[(0,v.jsx)(u.Ss,{className:"nearby-sheet__handle",onTouchStart:d.onTouchStart,onTouchMove:d.onTouchMove,onTouchEnd:d.onTouchEnd,onTouchCancel:d.onTouchEnd,children:(0,v.jsx)(u.Ss,{className:"nearby-sheet__bar"})}),(0,v.jsx)(u.Ss,{className:"nearby-sheet__header",children:(0,v.jsxs)(u.Ss,{children:[(0,v.jsx)(u.EY,{className:"nearby-sheet__title",children:"\u9644\u8fd1\u7684\u6bdb\u5b69\u5b50"}),(0,v.jsxs)(u.EY,{className:"nearby-sheet__count",children:[n.length," \u4f4d\u6b63\u5728\u9644\u8fd1\u6d3b\u52a8"]})]})}),(0,v.jsx)(u.Ss,{className:"nearby-sheet__chips",children:de.map(function(e){return(0,v.jsx)(E,{active:a===e.key,onClick:function(){return c(e.key)},children:e.label},e.key)})}),(0,v.jsx)(u.Ss,{className:"nearby-sheet__list",children:0===n.length?(0,v.jsx)(u.EY,{className:"nearby-sheet__empty",children:h}):n.map(function(e){return(0,v.jsx)(ce,{pet:e,active:e._id===t,onSelect:function(){return i(e._id)},onFriendAction:function(){return o(e)},onLike:function(){return l(e._id)}},e._id)})})]})}var fe=he,pe=t(9251),me=t(4282),ve=t(5366);function _e(e,n){return"dog"===n||"cat"===n?e.filter(function(e){return e.species===n}):"online"===n?e.filter(function(e){return e.online}):e}function xe(e){return be.apply(this,arguments)}function be(){return be=(0,h.A)((0,d.A)().m(function e(n){var t,a;return(0,d.A)().w(function(e){while(1)switch(e.n){case 0:return e.n=1,(0,me.f0)(n.map(function(e){return e.photoUrl||""}));case 1:return t=e.v,a=function(e){return e&&t.has(e)?t.get(e)||"":e},e.a(2,n.map(function(e){return(0,r.A)((0,r.A)({},e),{},{photoUrl:a(e.photoUrl)})}))}},e)})),be.apply(this,arguments)}function ge(e){return je.apply(this,arguments)}function je(){return je=(0,h.A)((0,d.A)().m(function e(n){var t,a,s=arguments;return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t=s.length>1&&void 0!==s[1]?s[1]:"all",(0,pe.n)()){e.n=1;break}return e.a(2,_e(ve.KB,t));case 1:return e.p=1,e.n=2,(0,pe.k)("nearbyPets",{location:n,filters:{type:t}});case 2:return a=e.v,e.a(2,xe(_e(a.list||[],t)));case 3:return e.p=3,e.v,e.a(2,[])}},e,null,[[1,3]])})),je.apply(this,arguments)}function ye(e,n){return ke.apply(this,arguments)}function ke(){return ke=(0,h.A)((0,d.A)().m(function e(n,t){var a;return(0,d.A)().w(function(e){while(1)switch(e.n){case 0:if((0,pe.n)()){e.n=1;break}return e.a(2,!0);case 1:return e.n=2,(0,pe.k)("locationUpdate",{location:n,visible:t});case 2:return a=e.v,e.a(2,a.ok)}},e)})),ke.apply(this,arguments)}function Se(e){return we.apply(this,arguments)}function we(){return we=(0,h.A)((0,d.A)().m(function e(n){return(0,d.A)().w(function(e){while(1)switch(e.n){case 0:if((0,pe.n)()){e.n=1;break}return e.a(2,{matched:n.length%2===0});case 1:return e.a(2,(0,pe.k)("matchLike",{petId:n}))}},e)})),we.apply(this,arguments)}var Ae=t(1926),Ne=t(3810),Te={latitude:31.2304,longitude:121.4737},Ee=4,Ce=20;function Ye(e){var n=(0,f.v)(),t=n.navHeight,a=(0,i.useState)([]),s=(0,c.A)(a,2),o=s[0],m=s[1],_=(0,i.useState)(),x=(0,c.A)(_,2),b=x[0],g=x[1],y=(0,i.useState)("all"),k=(0,c.A)(y,2),w=k[0],A=k[1],N=(0,i.useState)(null),T=(0,c.A)(N,2),E=T[0],Y=T[1],M=(0,i.useState)(15),z=(0,c.A)(M,2),B=z[0],L=z[1],R=(0,i.useState)(""),U=(0,c.A)(R,2),F=U[0],Q=U[1],H=(0,i.useState)(null),V=(0,c.A)(H,2),D=V[0],O=V[1],Z=(0,i.useRef)(new Set),K=(0,I.d)(480),P=function(e){m(e),g(function(n){var t;return n&&e.some(function(e){return e._id===n})?n:null===(t=e[0])||void 0===t?void 0:t._id})};(0,i.useEffect)(function(){var e=!1;return(0,Ae.E$)().then(function(n){var t=n.user;e||O(t.preferences.nearbyVisible)}).catch(function(){e||O(!0)}),function(){e=!0}},[]),(0,i.useEffect)(function(){if(null!==D){var e=!1;return D?(l().getLocation({type:"gcj02"}).then(function(n){if(!e){var t={latitude:n.latitude,longitude:n.longitude};Y(t),ye(t,!0).catch(function(){})}}).catch(function(){e||Y(Te)}),function(){e=!0}):(m([]),g(void 0),Y(Te),void ye(null,!1).catch(function(){}))}},[D]);var $=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w;ge(e,n).then(P)};(0,i.useEffect)(function(){if(E&&!0===D){var e=!1;return ge(E,w).then(function(n){e||P(n)}),function(){e=!0}}},[E,w,D]);var q=function(){null!==D?!1!==D?l().getLocation({type:"gcj02"}).then(function(e){var n={latitude:e.latitude,longitude:e.longitude};Y(n),ye(n,!0).catch(function(){})}).catch(function(){l().showModal({title:"\u9700\u8981\u4f4d\u7f6e\u6743\u9650",content:"\u8bf7\u5728\u53f3\u4e0a\u89d2\u300c\xb7\xb7\xb7\u300d\u2192 \u8bbe\u7f6e\u4e2d\u5141\u8bb8\u83b7\u53d6\u4f4d\u7f6e\u540e\u91cd\u8bd5",showCancel:!1})}):l().showToast({title:"\u9644\u8fd1\u53ef\u89c1\u5df2\u5173\u95ed",icon:"none"}):l().showToast({title:"\u6b63\u5728\u8bfb\u53d6\u8bbe\u7f6e",icon:"none"})},J=function(e){if("scale"===e)try{l().createMapContext(X).getScale({success:function(e){null!==e&&void 0!==e&&e.scale&&L(Math.round(e.scale))}})}catch(e){}},W=function(){return L(function(e){return Math.min(Ce,e+1)})},G=function(){return L(function(e){return Math.max(Ee,e-1)})},ee=function(){null!==D?!1!==D?(E&&$(E),l().showToast({title:"\u5df2\u5237\u65b0\u9644\u8fd1",icon:"none"})):l().showToast({title:"\u9644\u8fd1\u53ef\u89c1\u5df2\u5173\u95ed",icon:"none"}):l().showToast({title:"\u6b63\u5728\u8bfb\u53d6\u8bbe\u7f6e",icon:"none"})},ne=function(){var e=(0,h.A)((0,d.A)().m(function e(n){var t,a,s;return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.n=1,(0,p.HQ)();case 1:if(e.v){e.n=2;break}return e.a(2);case 2:if(t=o.find(function(e){return e._id===n}),null===t||void 0===t||!t.likedByMe){e.n=3;break}return l().showToast({title:"\u5df2\u7ecf\u559c\u6b22\u8fc7\u5566",icon:"none"}),e.a(2);case 3:if(!Z.current.has(n)){e.n=4;break}return e.a(2);case 4:return Z.current.add(n),a=Boolean(null===t||void 0===t?void 0:t.likedByMe),m(function(e){return e.map(function(e){return e._id===n?(0,r.A)((0,r.A)({},e),{},{likedByMe:!0}):e})}),K.show(),e.p=5,e.n=6,Se(n);case 6:s=e.v,s.matched&&l().showToast({title:"\u4e92\u76f8\u559c\u6b22\u5566",icon:"none"}),e.n=8;break;case 7:e.p=7,e.v,m(function(e){return e.map(function(e){return e._id===n?(0,r.A)((0,r.A)({},e),{},{likedByMe:a}):e})}),l().showToast({title:"\u559c\u6b22\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5",icon:"none"});case 8:return e.p=8,Z.current.delete(n),e.f(8);case 9:return e.a(2)}},e,null,[[5,7,8,9]])}));return function(n){return e.apply(this,arguments)}}(),ae=function(e,n){m(function(t){return t.map(function(t){return t.ownerId===e?(0,r.A)((0,r.A)({},t),n):t})})},re=function(e){e.ownerId&&(0,p.HQ)().then(function(n){if(n){var t=e.ownerName||e.name;l().navigateTo({url:"/pages/chat/index?targetUserId=".concat(e.ownerId,"&title=").concat(encodeURIComponent(t))})}})},ce=function(){var e=(0,h.A)((0,d.A)().m(function e(n){var t;return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.n=1,(0,p.HQ)();case 1:if(e.v){e.n=2;break}return e.a(2);case 2:if(!n.isMine){e.n=3;break}return l().showToast({title:"\u8fd9\u662f\u4f60\u81ea\u5df1\u7684\u6bdb\u5b69\u5b50",icon:"none"}),e.a(2);case 3:if(!n.isFriend){e.n=4;break}return re(n),e.a(2);case 4:if(!n.isFollowing){e.n=5;break}return l().showToast({title:"\u5df2\u5173\u6ce8\uff0c\u7b49\u5bf9\u65b9\u56de\u5173",icon:"none"}),e.a(2);case 5:return ae(n.ownerId,{isFollowing:!0,isFriend:!1}),e.p=6,e.n=7,(0,Ne.So)(n.ownerId,!0);case 7:t=e.v,ae(n.ownerId,{isFollowing:!0,isFriend:t.mutual}),l().showToast({title:t.mutual?"\u5df2\u6210\u4e3a\u6c6a\u53cb":"\u5df2\u5173\u6ce8\uff0c\u7b49\u5bf9\u65b9\u56de\u5173",icon:"none"}),e.n=9;break;case 8:e.p=8,e.v,ae(n.ownerId,{isFollowing:!1,isFriend:!1}),l().showToast({title:"\u6dfb\u52a0\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5",icon:"none"});case 9:return e.a(2)}},e,null,[[6,8]])}));return function(n){return e.apply(this,arguments)}}(),ie=F.trim().toLowerCase(),oe=ie?o.filter(function(e){return e.name.toLowerCase().includes(ie)||(e.breed||"").toLowerCase().includes(ie)}):o;return(0,v.jsxs)(u.Ss,{className:"nearby-page",children:[(0,v.jsx)(te,{pets:oe,center:E||Te,scale:B,activeId:b,onSelect:g,onRegionChange:J}),(0,v.jsx)(j,{}),(0,v.jsxs)(u.Ss,{className:"nearby-page__search",style:{top:"".concat(t+6,"px")},children:[(0,v.jsx)(S.A,{name:"search",size:14}),(0,v.jsx)(u.pd,{className:"nearby-page__search-input",value:F,placeholder:"\u641c\u7d22\u540d\u5b57 / \u54c1\u79cd",placeholderClass:"nearby-page__search-ph",confirmType:"search",onInput:function(e){return Q(e.detail.value)}}),F?(0,v.jsx)(u.Ss,{className:"nearby-page__search-clear",onClick:function(){return Q("")},children:(0,v.jsx)(S.A,{name:"close",size:14})}):null]}),(0,v.jsx)(se,{onRefresh:ee,onZoomIn:W,onZoomOut:G,onLocate:q}),(0,v.jsx)(fe,{pets:oe,activeId:b,filter:w,state:null===D?"loading":!1===D?"disabled":"ready",onFilterChange:A,onSelect:g,onFriendAction:ce,onLike:ne}),(0,v.jsx)(C.A,{visible:K.visible})]})}var Me=t(7745);function ze(e){var n=e.users,t=e.onSelect,a=e.onDiscover,s=e.showDiscover,r=void 0===s||s;return r||0!==n.length?(0,v.jsx)(u.BM,{scrollX:!0,className:"active-user-row",showScrollbar:!1,children:(0,v.jsxs)(u.Ss,{className:"active-user-row__inner",children:[r?(0,v.jsxs)(u.Ss,{className:"active-user-row__item",onClick:a,children:[(0,v.jsx)(u.Ss,{className:"active-user-row__avatar-wrap active-user-row__add",children:(0,v.jsx)(S.A,{name:"plus",size:22})}),(0,v.jsx)(u.EY,{className:"active-user-row__name",children:"\u627e\u6c6a\u53cb"})]}):null,n.map(function(e){return(0,v.jsxs)(u.Ss,{className:"active-user-row__item",onClick:function(){return null===t||void 0===t?void 0:t(e)},children:[(0,v.jsxs)(u.Ss,{className:"active-user-row__avatar-wrap",children:[(0,v.jsx)(Me.A,{avatarKey:e.avatarKey,avatarUrl:e.avatarUrl,size:"lg",label:e.name}),e.live?(0,v.jsx)(u.EY,{className:"active-user-row__live",children:"LIVE"}):null]}),(0,v.jsx)(u.EY,{className:"active-user-row__name",children:e.name})]},e.id)})]})}):null}var Be=ze;function Ie(e){var n=e.conversation,t=e.onClick;return(0,v.jsxs)(u.Ss,{className:"conversation-item",onClick:t,children:[(0,v.jsx)(Me.A,{avatarKey:n.avatarKey,avatarUrl:n.avatarUrl,label:n.title,size:"lg",online:n.online,petTag:"single"===n.type?"\ud83d\udc3e":void 0}),(0,v.jsxs)(u.Ss,{className:"conversation-item__main",children:[(0,v.jsxs)(u.Ss,{className:"conversation-item__top",children:[(0,v.jsxs)(u.Ss,{className:"conversation-item__name-row",children:[(0,v.jsx)(u.EY,{className:"conversation-item__name",children:n.title}),n.petName?(0,v.jsx)(u.EY,{className:"conversation-item__pet",children:n.petName}):null]}),(0,v.jsx)(u.EY,{className:"conversation-item__time",children:n.timeText})]}),(0,v.jsxs)(u.Ss,{className:"conversation-item__bottom",children:[(0,v.jsx)(u.EY,{className:"conversation-item__preview",children:n.preview}),n.pinned?(0,v.jsx)(u.Ss,{className:"conversation-item__pin",children:(0,v.jsx)(S.A,{name:"bookmark",size:12})}):n.unreadCount>0?(0,v.jsx)(u.EY,{className:"conversation-item__badge",children:n.unreadCount}):n.muted?(0,v.jsx)(u.Ss,{className:"conversation-item__muted"}):null]})]})]})}var Le=Ie,Re=t(9672),Ue=[{key:"all",label:"\u5168\u90e8"},{key:"unread",label:"\u672a\u8bfb"}];function Fe(e){var n=e.active,t=void 0!==n&&n,a=e.showTick,s=void 0===a?0:a,o=(0,i.useState)("all"),f=(0,c.A)(o,2),m=f[0],_=f[1],x=(0,i.useState)([]),b=(0,c.A)(x,2),g=b[0],y=b[1],S=(0,i.useState)([]),w=(0,c.A)(S,2),T=w[0],E=w[1],C=(0,i.useState)(""),Y=(0,c.A)(C,2),M=Y[0],z=Y[1],B=function(){(0,Re.VL)(m).then(function(e){y(e.activeUsers),E(e.conversations),(0,L.aQ)("messages")})};(0,i.useEffect)(function(){B()},[m]),R("messages",t,s,B);var I=function(e,n){E(function(t){return t.map(function(t){return t._id===e?(0,r.A)((0,r.A)({},t),{},{unreadCount:n}):t})})},U=function(){var e=(0,h.A)((0,d.A)().m(function e(n){var t;return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.n=1,(0,p.HQ)();case 1:if(e.v){e.n=2;break}return e.a(2);case 2:if(t=n.unreadCount,"system"!==n.type){e.n=8;break}if(!(t<=0)){e.n=3;break}return l().showToast({title:"\u7cfb\u7edf\u6d88\u606f\u6682\u4e0d\u652f\u6301\u804a\u5929",icon:"none"}),e.a(2);case 3:return I(n._id,0),e.p=4,e.n=5,(0,Re.vs)(n._id);case 5:l().showToast({title:"\u7cfb\u7edf\u6d88\u606f\u5df2\u8bfb",icon:"success"}),e.n=7;break;case 6:e.p=6,e.v,I(n._id,t),l().showToast({title:"\u64cd\u4f5c\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5",icon:"none"});case 7:return e.a(2);case 8:return t>0&&I(n._id,0),e.p=9,e.n=10,l().navigateTo({url:"/pages/chat/index?conversationId=".concat(n._id,"&title=").concat(encodeURIComponent(n.title))});case 10:e.n=12;break;case 11:return e.p=11,e.v,t>0&&I(n._id,t),l().showToast({title:"\u6253\u5f00\u804a\u5929\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5",icon:"none"}),e.a(2);case 12:if(!(t<=0)){e.n=13;break}return e.a(2);case 13:return e.p=13,e.n=14,(0,Re.vs)(n._id);case 14:e.n=16;break;case 15:e.p=15,e.v,I(n._id,t);case 16:return e.a(2)}},e,null,[[13,15],[9,11],[4,6]])}));return function(n){return e.apply(this,arguments)}}(),F=function(){var e=(0,h.A)((0,d.A)().m(function e(n){return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.n=1,(0,p.HQ)();case 1:if(e.v){e.n=2;break}return e.a(2);case 2:return e.p=2,e.n=3,l().navigateTo({url:"/pages/chat/index?targetUserId=".concat(n.id,"&title=").concat(encodeURIComponent(n.name))});case 3:e.n=5;break;case 4:e.p=4,e.v,l().showToast({title:"\u6253\u5f00\u804a\u5929\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5",icon:"none"});case 5:return e.a(2)}},e,null,[[2,4]])}));return function(n){return e.apply(this,arguments)}}(),Q=function(){return l().navigateTo({url:"/pages/contacts/index?tab=discover"})},H=M.trim().toLowerCase(),V=H?g.filter(function(e){return e.name.toLowerCase().includes(H)}):g,D=H?T.filter(function(e){return e.title.toLowerCase().includes(H)||(e.preview||"").toLowerCase().includes(H)}):T;return(0,v.jsxs)(k,{className:"messages-page",children:[(0,v.jsx)(j,{title:"\u6c6a\u53cb"}),(0,v.jsx)(A,{placeholder:"\u641c\u7d22\u6c6a\u53cb\u6216\u804a\u5929",value:M,onInput:z}),(0,v.jsx)(N.A,{items:Ue,value:m,onChange:_}),H?V.length>0?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u.Ss,{className:"messages-page__divider",children:(0,v.jsx)(u.EY,{children:"\u5728\u7ebf\u6c6a\u53cb"})}),(0,v.jsx)(Be,{users:V,onSelect:F,showDiscover:!1})]}):null:(0,v.jsx)(Be,{users:g,onSelect:F,onDiscover:Q}),(0,v.jsx)(u.Ss,{className:"messages-page__divider",children:(0,v.jsx)(u.EY,{children:H&&V.length>0?"\u5339\u914d\u804a\u5929":H?"\u641c\u7d22\u7ed3\u679c":"\u6700\u8fd1\u804a\u5929"})}),(0,v.jsxs)(u.Ss,{className:"messages-page__list",children:[D.map(function(e){return(0,v.jsx)(Le,{conversation:e,onClick:function(){return U(e)}},e._id)}),0===D.length?(0,v.jsx)(u.EY,{className:"messages-page__empty",children:H?V.length>0?"\u6ca1\u6709\u5339\u914d\u7684\u804a\u5929":"\u6ca1\u6709\u5339\u914d\u7684\u6c6a\u53cb\u6216\u804a\u5929":"unread"===m?"\u6ca1\u6709\u672a\u8bfb\u6d88\u606f":"\u8fd8\u6ca1\u6709\u804a\u5929\uff0c\u53bb\u300c\u9644\u8fd1\u300d\u52a0\u6c6a\u53cb\u5427"}):null]})]})}var Qe=t(2538),He=t(1798),Ve=10;function De(e){var n=e?"?petId=".concat(e):"";l().navigateTo({url:"/pages/pet-edit/index".concat(n)})}function Oe(e){var n=e.pets,t=n.length>=Ve;return(0,v.jsxs)(u.Ss,{className:"pet-shelf",children:[(0,v.jsx)(u.Ss,{className:"pet-shelf__head",children:(0,v.jsxs)(u.EY,{className:"pet-shelf__title",children:["\u6211\u7684\u6bdb\u5b69\u5b50 \xb7 ",n.length,"/",Ve]})}),(0,v.jsxs)(u.Ss,{className:"pet-shelf__list",children:[n.map(function(e){return(0,v.jsxs)(u.Ss,{className:"pet-shelf__card",onClick:function(){return De(e._id)},children:[(0,v.jsxs)(u.Ss,{className:"pet-shelf__photo ".concat(e.photoUrl?"":e.photoKey),children:[e.photoUrl?(0,v.jsx)(u._V,{className:"pet-shelf__photo-img",src:e.photoUrl,mode:"aspectFill"}):null,(0,v.jsx)(u.EY,{className:"pet-shelf__label",children:"cat"===e.species?"CAT":"DOG"})]}),(0,v.jsxs)(u.EY,{className:"pet-shelf__name",children:[e.name," \xb7 ",e.breed]}),(0,v.jsxs)(u.EY,{className:"pet-shelf__meta",children:[e.ageText||"\u5f85\u5b8c\u5584"," \xb7 ",e.tags[0]||"\u5f85\u5b8c\u5584"]})]},e._id)}),t?(0,v.jsx)(u.Ss,{className:"pet-shelf__card pet-shelf__card--add pet-shelf__card--limit",children:(0,v.jsx)(u.EY,{className:"pet-shelf__add-label",children:"\u5df2\u8fbe\u4e0a\u9650"})}):(0,v.jsxs)(u.Ss,{className:"pet-shelf__card pet-shelf__card--add",onClick:function(){return De()},children:[(0,v.jsx)(u.Ss,{className:"pet-shelf__add-icon",children:(0,v.jsx)(S.A,{name:"plus",size:18})}),(0,v.jsx)(u.EY,{className:"pet-shelf__add-label",children:"\u6dfb\u52a0\u5ba0\u7269"})]})]})]})}var Ze=Oe;function Ke(e){var n=e.checked,t=e.onChange;return(0,v.jsx)(u.Ss,{className:"switch ".concat(n?"switch--checked":""),onClick:function(){return null===t||void 0===t?void 0:t(!n)}})}var Pe=Ke,$e=[{key:"nearbyVisible",icon:"heart",label:"\u9644\u8fd1\u53ef\u89c1"},{key:"notifications",icon:"bell",label:"\u6d88\u606f\u901a\u77e5"},{key:"help",icon:"info",label:"\u5e2e\u52a9\u4e0e\u53cd\u9988",value:"\u203a"},{key:"about",icon:"settings",label:"\u8bbe\u7f6e",value:"\u203a"}];function qe(e){return"notifications"===e||"nearbyVisible"===e}function Xe(e){var n=e.preferences,t=e.onChange,a=e.onAction,s=e.onLogout,r=n||{notifications:!0,nearbyVisible:!0};return(0,v.jsxs)(u.Ss,{className:"preference-list",children:[(0,v.jsx)(u.EY,{className:"preference-list__title",children:"\u504f\u597d\u8bbe\u7f6e"}),(0,v.jsx)(u.Ss,{className:"preference-list__panel",children:$e.map(function(e){var n=!qe(e.key);return(0,v.jsxs)(u.Ss,{className:"preference-list__row",onClick:n?function(){return null===a||void 0===a?void 0:a(e.key)}:void 0,children:[(0,v.jsx)(u.Ss,{className:"preference-list__icon preference-list__icon--".concat(e.key),children:(0,v.jsx)(S.A,{name:e.icon,size:16})}),(0,v.jsx)(u.EY,{className:"preference-list__label",children:e.label}),qe(e.key)?(0,v.jsx)(Pe,{checked:r[e.key],onChange:function(n){return t(e.key,n)}}):(0,v.jsx)(u.EY,{className:"preference-list__value",children:e.value})]},e.key)})}),s?(0,v.jsx)(u.Ss,{className:"preference-list__logout",onClick:s,children:"\u9000\u51fa\u767b\u5f55"}):null]})}var Je=Xe;function We(e){var n=e.onSubmit,t=(0,i.useState)(""),a=(0,c.A)(t,2),s=a[0],r=a[1],o=(0,i.useState)(""),l=(0,c.A)(o,2),f=l[0],p=l[1],m=(0,i.useState)(!1),_=(0,c.A)(m,2),x=_[0],b=_[1],g=function(e){var n,t=null===e||void 0===e||null===(n=e.detail)||void 0===n?void 0:n.avatarUrl;t&&r(t)},j=Boolean(s&&f.trim()),y=function(){var e=(0,h.A)((0,d.A)().m(function e(){return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(j&&!x){e.n=1;break}return e.a(2);case 1:return b(!0),e.p=2,e.n=3,n(s,f.trim());case 3:return e.p=3,b(!1),e.f(3);case 4:return e.a(2)}},e,null,[[2,,3,4]])}));return function(){return e.apply(this,arguments)}}();return(0,v.jsxs)(u.Ss,{className:"login-card",children:[(0,v.jsx)(u.EY,{className:"login-card__title",children:"\u767b\u5f55\u6c6a\u5708"}),(0,v.jsx)(u.EY,{className:"login-card__sub",children:"\u6388\u6743\u5934\u50cf\u6635\u79f0\uff0c\u8bb0\u5f55\u4f60\u548c\u6bdb\u5b69\u5b50\u7684\u65e5\u5e38"}),(0,v.jsx)(u.$n,{className:"login-card__avatar-btn",openType:"chooseAvatar",onChooseAvatar:g,children:s?(0,v.jsx)(u._V,{className:"login-card__avatar-img",src:s,mode:"aspectFill"}):(0,v.jsxs)(u.Ss,{className:"login-card__avatar-empty",children:[(0,v.jsx)(u.EY,{className:"login-card__avatar-plus",children:"\uff0b"}),(0,v.jsx)(u.EY,{className:"login-card__avatar-hint",children:"\u9009\u62e9\u5934\u50cf"})]})}),(0,v.jsx)(u.Ss,{className:"login-card__field",children:(0,v.jsx)(u.pd,{className:"login-card__input",type:"nickname",placeholder:"\u70b9\u6b64\u586b\u5199\u6635\u79f0",placeholderClass:"login-card__placeholder",value:f,onInput:function(e){return p(e.detail.value)},onBlur:function(e){return p(e.detail.value)}})}),(0,v.jsx)(u.Ss,{className:"login-card__submit ".concat(j?"":"login-card__submit--disabled"),onClick:y,children:x?"\u767b\u5f55\u4e2d\u2026":"\u5b8c\u6210\u767b\u5f55"}),(0,v.jsx)(u.EY,{className:"login-card__tip",children:"\u4ec5\u7528\u4e8e\u5c55\u793a\u4f60\u7684\u5934\u50cf\u548c\u6635\u79f0\uff0c\u4e0d\u4f1a\u83b7\u53d6\u5176\u4ed6\u4fe1\u606f"})]})}var Ge=We,en=t(3427),nn="xirZ0SkI9s_CCYAioAzz3U-qBg4ZEmR1avQTrM-0DrE";function tn(){return Boolean(nn)}function an(){return sn.apply(this,arguments)}function sn(){return sn=(0,h.A)((0,d.A)().m(function e(){var n,t;return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(nn&&"function"===typeof l().requestSubscribeMessage){e.n=1;break}return e.a(2,!1);case 1:return e.p=1,n=l().requestSubscribeMessage,e.n=2,n({tmplIds:[nn]});case 2:return t=e.v,e.a(2,"accept"===t[nn]);case 3:return e.p=3,e.v,e.a(2,!1)}},e,null,[[1,3]])})),sn.apply(this,arguments)}function rn(e){var n=e.active,t=void 0!==n&&n,a=e.showTick,o=void 0===a?0:a,f=(0,p.wV)(),m=f.user,_=f.setUser,x=(0,i.useState)(ve.LT),b=(0,c.A)(x,2),g=b[0],y=b[1],S=(0,i.useState)(!1),w=(0,c.A)(S,2),A=w[0],N=w[1],T=(0,i.useState)(!0),E=(0,c.A)(T,2),C=E[0],Y=E[1],M=function(){(0,en.nB)()||(0,Ae.E$)().then(function(e){var n=e.user,t=e.pets;_(n),y(t),N((0,en.nB)()||!n.profileCompleted),(0,L.aQ)("profile")})};(0,i.useEffect)(function(){(0,p.oH)().then(function(e){N((0,en.nB)()||!e.profileCompleted),Y(!1),M()})},[]),R("profile",t,o,M);var z=function(){var e=(0,h.A)((0,d.A)().m(function e(n,t){var a;return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.p=0,e.n=1,(0,en.R$)(n,t);case 1:a=e.v,_(a),N(!1),l().showToast({title:"\u767b\u5f55\u6210\u529f",icon:"success"}),e.n=3;break;case 2:e.p=2,e.v,l().showToast({title:"\u767b\u5f55\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5",icon:"none"});case 3:return e.a(2)}},e,null,[[0,2]])}));return function(n,t){return e.apply(this,arguments)}}(),B=function(){l().showModal({title:"\u9000\u51fa\u767b\u5f55",content:"\u786e\u5b9a\u8981\u9000\u51fa\u5f53\u524d\u8d26\u53f7\u5417\uff1f",confirmText:"\u9000\u51fa",confirmColor:"#ff8a9b",success:function(){var e=(0,h.A)((0,d.A)().m(function e(n){return(0,d.A)().w(function(e){while(1)switch(e.n){case 0:if(n.confirm){e.n=1;break}return e.a(2);case 1:return e.n=2,(0,en.ri)();case 2:(0,p.q7)(),y([]),N(!0),l().showToast({title:"\u5df2\u9000\u51fa\u767b\u5f55",icon:"none"});case 3:return e.a(2)}},e)}));function n(n){return e.apply(this,arguments)}return n}()})},I=function(e){"help"===e?l().showModal({title:"\u5e2e\u52a9\u4e0e\u53cd\u9988",content:"\u9047\u5230\u95ee\u9898\u6216\u6709\u5efa\u8bae\uff1f\n\u8bf7\u53d1\u9001\u90ae\u4ef6\u81f3 chenwuzhu975@gmail.com\n\u6211\u4eec\u4f1a\u5c3d\u5feb\u56de\u590d\u4f60 \u2728",confirmText:"\u590d\u5236\u90ae\u7bb1",cancelText:"\u5173\u95ed",success:function(e){e.confirm&&l().setClipboardData({data:"chenwuzhu975@gmail.com"})}}):l().showToast({title:"\u656c\u8bf7\u671f\u5f85\u65b0\u529f\u80fd",icon:"none"})},U=function(){var e=(0,h.A)((0,d.A)().m(function e(n,t){var a,c,i,o;return(0,d.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(a=m,"notifications"!==n||!t||!tn()){e.n=2;break}return e.n=1,an();case 1:c=e.v,c||l().showToast({title:"\u672a\u5f00\u542f\u5fae\u4fe1\u8ba2\u9605\u901a\u77e5",icon:"none"});case 2:return i=(0,r.A)((0,r.A)({},m),{},{preferences:(0,r.A)((0,r.A)({},m.preferences),{},(0,s.A)({},n,t))}),_(i),e.p=3,e.n=4,(0,Ae.r7)({preferences:i.preferences});case 4:o=e.v,_(o),e.n=6;break;case 5:e.p=5,e.v,_(a),l().showToast({title:"\u8bbe\u7f6e\u4fdd\u5b58\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5",icon:"none"});case 6:return e.a(2)}},e,null,[[3,5]])}));return function(n,t){return e.apply(this,arguments)}}();return A&&!C?(0,v.jsxs)(k,{className:"profile-page",children:[(0,v.jsx)(j,{title:"\u6211\u7684"}),(0,v.jsx)(Ge,{onSubmit:z})]}):(0,v.jsxs)(k,{className:"profile-page",children:[(0,v.jsx)(j,{title:"\u6211\u7684"}),(0,v.jsx)(Qe.A,{user:m}),(0,v.jsx)(He.A,{stats:m.stats,onSelect:function(e){"posts"===e?l().navigateTo({url:"/pages/my-posts/index"}):"following"===e?l().navigateTo({url:"/pages/contacts/index?tab=following"}):"followers"===e&&l().navigateTo({url:"/pages/contacts/index?tab=followers"})}}),(0,v.jsx)(u.Ss,{className:"profile-page__actions",children:(0,v.jsx)(u.Ss,{className:"profile-page__primary",onClick:function(){return l().navigateTo({url:"/pages/profile-edit/index"})},children:"\u7f16\u8f91\u8d44\u6599"})}),(0,v.jsx)(Ze,{pets:g}),(0,v.jsx)(Je,{preferences:m.preferences,onChange:U,onAction:I,onLogout:B})]})}var cn=t(9545);function on(){var e=(0,i.useState)("plaza"),n=(0,c.A)(e,2),t=n[0],a=n[1],l=(0,i.useState)({plaza:!0,nearby:!1,messages:!1,profile:!1}),d=(0,c.A)(l,2),h=d[0],f=d[1],p=(0,i.useState)(0),m=(0,c.A)(p,2),_=m[0],b=m[1],g=(0,i.useRef)(!0),j=function(e){f(function(n){return n[e]?n:(0,r.A)((0,r.A)({},n),{},(0,s.A)({},e,!0))}),a(e)};(0,o.useDidShow)(function(){if(g.current)g.current=!1;else{var e=(0,cn.OZ)();e&&j(e),b(function(e){return e+1})}}),(0,i.useEffect)(function(){return(0,cn.X_)(j)},[]);var y=function(e){return{display:t===e?"block":"none"}};return(0,v.jsxs)(u.Ss,{className:"home",children:[h.plaza?(0,v.jsx)(u.Ss,{className:"home__tab",style:y("plaza"),children:(0,v.jsx)(P,{active:"plaza"===t,showTick:_})}):null,h.nearby?(0,v.jsx)(u.Ss,{className:"home__tab",style:y("nearby"),children:(0,v.jsx)(Ye,{active:"nearby"===t,showTick:_})}):null,h.messages?(0,v.jsx)(u.Ss,{className:"home__tab",style:y("messages"),children:(0,v.jsx)(Fe,{active:"messages"===t,showTick:_})}):null,h.profile?(0,v.jsx)(u.Ss,{className:"home__tab",style:y("profile"),children:(0,v.jsx)(rn,{active:"profile"===t,showTick:_})}):null,(0,v.jsx)(x,{active:t,onSwitch:j})]})}var ln={navigationStyle:"custom",disableScroll:!0},un=(0,a.eU)(on,"pages/home/index",{root:{cn:[]}},ln||{});on&&on.behaviors&&(un.behaviors=(un.behaviors||[]).concat(on.behaviors));Page(un)}},function(e){var n=function(n){return e(e.s=n)};e.O(0,[907,96,76],function(){return n(1991)});e.O()}]);