1import{U as E,j as n,D as C,c as v,dp as g,dq as T,q as m,aK as p,aL as c,s as w}from"./index-n6y8eD4C.js";import{u as F,a as _,b as R}from"./favorite-api-JvLVzExa.js";const A=({size:e=24,color:t="currentColor"})=>n.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 21C11.734 21 11.48 20.895 11.292 20.706L3.52505 12.926C1.48905 10.886 1.48905 7.567 3.52505 5.527C4.50805 4.543 5.82105 4 7.22005 4C8.61905 4 9.93205 4.543 10.915 5.527L12 6.614L13.084 5.528C14.068 4.543 15.381 4 16.78 4C18.179 4 19.492 4.543 20.475 5.527C22.511 7.567 22.511 10.886 20.476 12.926L12.708 20.707C12.52 20.895 12.266 21 12 21Z",fill:t})}),M=({size:e=24,color:t="currentColor"})=>n.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.2198 6C6.3558 6 5.5458 6.334 4.9398 6.941C3.6818 8.201 3.6818 10.252 4.9408 11.514L11.9998 18.585L19.0598 11.514C20.3188 10.252 20.3188 8.201 19.0598 6.941C17.8478 5.726 15.7118 5.728 14.4998 6.941L12.7078 8.736C12.3318 9.113 11.6678 9.113 11.2918 8.736L9.4998 6.94C8.8938 6.334 8.0848 6 7.2198 6ZM11.9998 21C11.7348 21 11.4798 20.895 11.2928 20.706L3.5248 12.926C1.4888 10.886 1.4888 7.567 3.5248 5.527C4.5088 4.543 5.8208 4 7.2198 4C8.6188 4 9.9318 4.543 10.9148 5.527L11.9998 6.614L13.0848 5.528C14.0688 4.543 15.3808 4 16.7808 4C18.1788 4 19.4918 4.543 20.4748 5.527C22.5118 7.567 22.5118 10.886 20.4758 12.926L12.7078 20.707C12.5198 20.895 12.2658 21 11.9998 21Z",fill:t})}),L=E.forwardRef(({isFavorited:e=!1,iconOnly:t=!1,iconSize:i,className:o,children:s,...a},r)=>{const u=e?A:M;if(t){const d=i??20;return n.jsx(C,{ref:r,shape:"circle",icon:n.jsx(u,{size:d}),className:v(g,o),...a})}const l=i??14;return n.jsx(C,{ref:r,size:"small",icon:n.jsx(u,{size:l}),className:v(T,o),...a,children:s??(e?"å·²æ¶è":"å å
¥æ¶è")})});L.displayName="FavoriteButton";function I(e,t){const{isAuthenticated:i}=m(),{data:o}=F({types:p},{skip:!i});if(!o)return!1;switch(t){case c.UserFavoriteDtoTypeEnum.COMMODITY:return o.commodities.some(s=>s._id===e);case c.UserFavoriteDtoTypeEnum.DENTAL_MATERIAL:return o.dentalMaterials.some(s=>s._id===e);case c.UserFavoriteDtoTypeEnum.ENTITY_COURSE:return o.entityCourses.records.some(s=>s._id===e);case c.UserFavoriteDtoTypeEnum.ONLINE_COURSE:return o.onlineCourses.records.some(s=>s._id===e);default:return!1}}function y({id:e,type:t,className:i}){const{isAuthenticated:o,redirectToLogin:s}=m(),a=I(e,t),[r,{isLoading:u}]=_(),[l,{isLoading:d}]=R(),h=w(),f=async()=>{if(!o){s();return}const x=a?l({_id:e,type:t}):r({_id:e,type:t});await h(x.unwrap(),{successMessage:a?"已忶æ¶è":"å·²æ¶è",errorMessage:"æä½å¤±æ"})};return n.jsx(L,{iconOnly:!0,isFavorited:a,className:i,"aria-label":a?"åæ¶æ¶è":"æ¶è",loading:u||d,onClick:()=>void f()})}export{y as C};
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.