{"version":3,"file":"index-BPR51Ye6.js","sources":["../../node_modules/reka-ui/dist/Avatar/AvatarRoot.js","../../node_modules/reka-ui/dist/Avatar/AvatarFallback.js","../../node_modules/reka-ui/dist/Avatar/AvatarImage.js","../../node_modules/reka-ui/dist/Avatar/utils.js","../../src/components/ui/avatar/Avatar.vue","../../src/components/ui/avatar/AvatarFallback.vue","../../src/components/ui/avatar/AvatarImage.vue","../../src/components/ui/avatar/index.ts"],"sourcesContent":["import { defineComponent, ref, openBlock, createBlock, unref, withCtx, renderSlot } from 'vue';\nimport { u as useForwardExpose } from '../shared/useForwardExpose.js';\nimport { P as Primitive } from '../Primitive/Primitive.js';\nimport { c as createContext } from '../shared/createContext.js';\n\nconst [injectAvatarRootContext, provideAvatarRootContext] = createContext(\"AvatarRoot\");\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"AvatarRoot\",\n props: {\n asChild: { type: Boolean },\n as: { default: \"span\" }\n },\n setup(__props) {\n useForwardExpose();\n provideAvatarRootContext({\n imageLoadingStatus: ref(\"loading\")\n });\n return (_ctx, _cache) => {\n return openBlock(), createBlock(unref(Primitive), {\n \"as-child\": _ctx.asChild,\n as: _ctx.as\n }, {\n default: withCtx(() => [\n renderSlot(_ctx.$slots, \"default\")\n ]),\n _: 3\n }, 8, [\"as-child\", \"as\"]);\n };\n }\n});\n\nexport { _sfc_main as _, injectAvatarRootContext as i };\n//# sourceMappingURL=AvatarRoot.js.map\n","import { defineComponent, ref, watch, unref, openBlock, createBlock, withCtx, renderSlot, createCommentVNode } from 'vue';\nimport { i as injectAvatarRootContext } from './AvatarRoot.js';\nimport { u as useForwardExpose } from '../shared/useForwardExpose.js';\nimport { P as Primitive } from '../Primitive/Primitive.js';\n\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"AvatarFallback\",\n props: {\n delayMs: { default: 0 },\n asChild: { type: Boolean },\n as: { default: \"span\" }\n },\n setup(__props) {\n const props = __props;\n const rootContext = injectAvatarRootContext();\n useForwardExpose();\n const canRender = ref(false);\n let timeout;\n watch(rootContext.imageLoadingStatus, (value) => {\n if (value === \"loading\") {\n canRender.value = false;\n if (props.delayMs) {\n timeout = setTimeout(() => {\n canRender.value = true;\n clearTimeout(timeout);\n }, props.delayMs);\n } else {\n canRender.value = true;\n }\n }\n }, { immediate: true });\n return (_ctx, _cache) => {\n return canRender.value && unref(rootContext).imageLoadingStatus.value !== \"loaded\" ? (openBlock(), createBlock(unref(Primitive), {\n key: 0,\n \"as-child\": _ctx.asChild,\n as: _ctx.as\n }, {\n default: withCtx(() => [\n renderSlot(_ctx.$slots, \"default\")\n ]),\n _: 3\n }, 8, [\"as-child\", \"as\"])) : createCommentVNode(\"\", true);\n };\n }\n});\n\nexport { _sfc_main as _ };\n//# sourceMappingURL=AvatarFallback.js.map\n","import { defineComponent, toRefs, watch, withDirectives, openBlock, createBlock, unref, withCtx, renderSlot, vShow } from 'vue';\nimport { u as useImageLoadingStatus } from './utils.js';\nimport { u as useForwardExpose } from '../shared/useForwardExpose.js';\nimport { P as Primitive } from '../Primitive/Primitive.js';\nimport { i as injectAvatarRootContext } from './AvatarRoot.js';\n\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"AvatarImage\",\n props: {\n src: {},\n referrerPolicy: {},\n asChild: { type: Boolean },\n as: { default: \"img\" }\n },\n emits: [\"loadingStatusChange\"],\n setup(__props, { emit: __emit }) {\n const props = __props;\n const emits = __emit;\n const { src, referrerPolicy } = toRefs(props);\n useForwardExpose();\n const rootContext = injectAvatarRootContext();\n const imageLoadingStatus = useImageLoadingStatus(src, referrerPolicy);\n watch(\n imageLoadingStatus,\n (newValue) => {\n emits(\"loadingStatusChange\", newValue);\n if (newValue !== \"idle\")\n rootContext.imageLoadingStatus.value = newValue;\n },\n { immediate: true }\n );\n return (_ctx, _cache) => {\n return withDirectives((openBlock(), createBlock(unref(Primitive), {\n role: \"img\",\n \"as-child\": _ctx.asChild,\n as: _ctx.as,\n src: unref(src),\n \"referrer-policy\": unref(referrerPolicy)\n }, {\n default: withCtx(() => [\n renderSlot(_ctx.$slots, \"default\")\n ]),\n _: 3\n }, 8, [\"as-child\", \"as\", \"src\", \"referrer-policy\"])), [\n [vShow, unref(imageLoadingStatus) === \"loaded\"]\n ]);\n };\n }\n});\n\nexport { _sfc_main as _ };\n//# sourceMappingURL=AvatarImage.js.map\n","import { ref, onMounted, watch, onUnmounted } from 'vue';\n\nfunction useImageLoadingStatus(src, referrerPolicy) {\n const loadingStatus = ref(\"idle\");\n const isMounted = ref(false);\n const updateStatus = (status) => () => {\n if (isMounted.value)\n loadingStatus.value = status;\n };\n onMounted(() => {\n isMounted.value = true;\n watch([() => src.value, () => referrerPolicy?.value], ([src2, referrer]) => {\n if (!src2) {\n loadingStatus.value = \"error\";\n } else {\n const image = new window.Image();\n loadingStatus.value = \"loading\";\n image.onload = updateStatus(\"loaded\");\n image.onerror = updateStatus(\"error\");\n image.src = src2;\n if (referrer) {\n image.referrerPolicy = referrer;\n }\n }\n }, { immediate: true });\n });\n onUnmounted(() => {\n isMounted.value = false;\n });\n return loadingStatus;\n}\n\nexport { useImageLoadingStatus as u };\n//# sourceMappingURL=utils.js.map\n","\n\n\n \n \n \n\n","\n\n\n \n \n \n\n","\n\n\n \n \n \n\n","import { cva, type VariantProps } from 'class-variance-authority'\n\nexport { default as Avatar } from './Avatar.vue'\nexport { default as AvatarFallback } from './AvatarFallback.vue'\nexport { default as AvatarImage } from './AvatarImage.vue'\n\nexport const avatarVariant = cva(\n 'inline-flex items-center justify-center font-normal text-foreground select-none shrink-0 bg-secondary overflow-hidden',\n {\n variants: {\n size: {\n sm: 'h-10 w-10 text-xs',\n base: 'h-16 w-16 text-2xl',\n lg: 'h-32 w-32 text-5xl',\n },\n shape: {\n circle: 'rounded-full',\n square: 'rounded-md',\n },\n },\n },\n)\n\nexport type AvatarVariants = VariantProps\n"],"names":["injectAvatarRootContext","provideAvatarRootContext","createContext","_sfc_main","defineComponent","__name","props","asChild","type","Boolean","as","default","setup","__props","useForwardExpose","imageLoadingStatus","ref","_ctx","_cache","openBlock","createBlock","unref","Primitive","withCtx","renderSlot","$slots","_","delayMs","rootContext","canRender","timeout","watch","value","setTimeout","clearTimeout","immediate","key","createCommentVNode","src","referrerPolicy","emits","emit","__emit","toRefs","loadingStatus","isMounted","updateStatus","status","onMounted","src2","referrer","image","window","Image","onload","onerror","onUnmounted","useImageLoadingStatus","newValue","withDirectives","role","vShow","avatarVariant","cva","variants","size","sm","base","lg","shape","circle","square"],"mappings":"8jBAKA,MAAOA,EAAyBC,GAA4BC,EAAc,cACpEC,EAA4CC,EAAA,CAChDC,OAAQ,aACRC,MAAO,CACLC,QAAS,CAAEC,KAAMC,SACjBC,GAAI,CAAEC,QAAS,SAEjBC,MAAMC,IACcC,IACOb,EAAA,CACvBc,mBAAoBC,EAAI,aAEnB,CAACC,EAAMC,KACLC,IAAaC,EAAYC,EAAMC,GAAY,CAChD,WAAYL,EAAKV,QACjBG,GAAIO,EAAKP,IACR,CACDC,QAASY,GAAQ,IAAM,CACrBC,EAAWP,EAAKQ,OAAQ,cAE1BC,EAAG,GACF,EAAG,CAAC,WAAY,WCrBnBvB,EAA4CC,EAAA,CAChDC,OAAQ,iBACRC,MAAO,CACLqB,QAAS,CAAEhB,QAAS,GACpBJ,QAAS,CAAEC,KAAMC,SACjBC,GAAI,CAAEC,QAAS,SAEjB,KAAAC,CAAMC,GACJ,MAAMP,EAAQO,EACRe,EAAc5B,IACFc,IACZ,MAAAe,EAAYb,GAAI,GAClB,IAAAc,EAcG,OAbDC,EAAAH,EAAYb,oBAAqBiB,IACvB,YAAVA,IACFH,EAAUG,OAAQ,EACd1B,EAAMqB,QACRG,EAAUG,YAAW,KACnBJ,EAAUG,OAAQ,EAClBE,aAAaJ,EAAO,GACnBxB,EAAMqB,SAETE,EAAUG,OAAQ,EAE5B,GACO,CAAEG,WAAW,IACT,CAAClB,EAAMC,IACLW,EAAUG,OAAyD,WAAhDX,EAAMO,GAAab,mBAAmBiB,OA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