PageSourceSearch

https://snapfy.ai/assets/MyModelsPage.DZ_XH0PW.js

js snapfy.ai collected 2026-10-05 12:39:17 UTC 6,745 bytes, 2 lines download raw bytes

1!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"snapfy-frontend@1790655446049"}}catch(e){}}();try{e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},(a=(new e.Error).stack)&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="6dc4563b-c7ec-4b13-baff-5c734a07f793",e._sentryDebugIdIdentifier="sentry-dbid-6dc4563b-c7ec-4b13-baff-5c734a07f793")}catch(e){}var e,a;import{p as s,e as t,j as l,m as r,a2 as n,f as i,a3 as d,E as o,h as c,r as m}from"./index.DuJZvJ7M.js";import{b as f}from"./vendor.B7-ms4FH.js";import{m as p}from"./modelService.brwD9tMh.js";const x=()=>{const{t:e}=s("models"),[a,x]=f.useState([]),[u,y]=f.useState(!0),[b,h]=f.useState(null),[g,j]=f.useState(null),[w,v]=f.useState(null),[N,k]=f.useState(""),[C,M]=f.useState(null),E=f.useRef(!1),I={hidden:t()?{opacity:1,y:0}:{opacity:0,y:16},visible:{opacity:1,y:0,transition:{duration:.5,ease:[.22,1,.36,1]}}},S=f.useCallback(async()=>{try{y(!0);const e=await p.list();x(e)}catch(e){console.error("Failed to fetch models:",e)}finally{y(!1)}},[]);f.useEffect(()=>{S()},[S]);const T=f.useCallback(async a=>{if(window.confirm(e("myModels.deleteConfirm")))try{j(a),await p.delete(a),x(e=>e.filter(e=>e.id!==a))}catch(s){console.error("Failed to delete model:",s)}finally{j(null)}},[e]),D=f.useCallback(e=>{E.current=!1,v(e.id),k(e.name)},[]),z=f.useCallback(()=>{E.current=!0,v(null),k("")},[]),F=f.useCallback(async a=>{if(E.current)return;const s=N.trim();if(s)try{E.current=!0,M(a);const e=await p.rename(a,s);x(s=>s.map(s=>s.id===a?e:s))}catch(t){console.error("Failed to rename model:",t),alert(e("myModels.renameError"))}finally{M(null),v(null)}else v(null)},[N,e]);return l.jsxs(r.div,{className:"p-4 md:p-6 max-w-[1440px] mx-auto",variants:I,initial:"hidden",animate:"visible",children:[l.jsxs("div",{className:"mb-6 md:mb-8",children:[l.jsxs("h1",{className:"text-2xl md:text-3xl font-black tracking-tight flex items-center gap-3 text-snapfy-text-primary",children:[l.jsx(n,{className:"w-6 h-6 md:w-8 md:h-8 text-snapfy-primary"}),e("myModels.title")]}),l.jsx("p",{className:"text-base md:text-lg text-snapfy-text-secondary mt-2",children:e("myModels.subtitle")})]}),u?l.jsx("div",{className:"flex justify-center py-20",children:l.jsx("div",{className:"w-10 h-10 border-4 border-snapfy-primary/20 border-t-snapfy-primary rounded-full animate-spin"})}):0===a.length?l.jsxs(i,{className:"p-8 md:p-12 text-center",children:[l.jsx("div",{className:"w-12 h-12 md:w-16 md:h-16 bg-snapfy-primary/10 text-snapfy-primary rounded-full flex items-center justify-center mx-auto mb-4",children:l.jsx("svg",{className:"w-6 h-6 md:w-8 md:h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"})})}),l.jsx("h3",{className:"text-lg md:text-xl font-bold text-snapfy-text-primary mb-2",children:e("myModels.emptyTitle")}),l.jsx("p",{className:"text-sm md:text-base text-snapfy-text-secondary max-w-md mx-auto",children:e("myModels.emptyDescription")})]}):l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 md:gap-6",children:a.map(a=>{return l.jsxs(i,{interactive:!0,className:"overflow-hidden !p-0 group",children:[l.jsxs("div",{className:"aspect-[3/4] w-full bg-snapfy-bg relative cursor-pointer overflow-hidden",onClick:()=>a.previewImageUrl&&h(a.previewImageUrl),children:[a.previewImageUrl?l.jsx("img",{src:a.previewImageUrl,alt:a.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",loading:"lazy"}):l.jsx("div",{className:"w-full h-full flex items-center justify-center text-snapfy-text-secondary",children:l.jsx(n,{className:"w-12 h-12"})}),l.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:l.jsx("span",{className:"opacity-0 group-hover:opacity-100 text-white font-medium text-sm bg-black/50 px-3 py-1.5 rounded-full backdrop-blur-sm transition-opacity",children:e("myModels.viewCasting")})})]}),l.jsx("div",{className:"p-4",children:l.jsxs("div",{className:"flex justify-between items-start gap-2",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[w===a.id?l.jsx("input",{type:"text",value:N,autoFocus:!0,disabled:C===a.id,onClick:e=>e.stopPropagation(),onChange:e=>k(e.target.value),onBlur:()=>F(a.id),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),e.currentTarget.blur()):"Escape"===e.key&&(e.preventDefault(),z())},"aria-label":e("myModels.renameTitle"),className:"w-full bg-snapfy-bg text-snapfy-text-primary text-sm font-bold rounded-xl px-2 py-1 border border-snapfy-primary/60 focus:border-snapfy-primary focus:outline-none focus:ring-snapfy-focus disabled:opacity-50"}):l.jsx("h3",{className:"font-bold text-snapfy-text-primary truncate",title:a.name,children:a.name}),l.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[l.jsx("span",{className:"text-xs px-2 py-0.5 bg-snapfy-bg text-snapfy-text-secondary rounded-xl capitalize border border-white/10",children:a.ageCategory}),l.jsx("span",{className:"text-xs px-2 py-0.5 bg-snapfy-bg text-snapfy-text-secondary rounded-xl capitalize border border-white/10",children:(s=a.gender,e("male"===s||"masculino"===s?"myModels.male":"female"===s||"feminino"===s?"myModels.female":"myModels.neutral"))})]})]}),l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(d,{"aria-label":e("myModels.renameTitle"),onClick:e=>{e.stopPropagation(),D(a)},disabled:C===a.id||w===a.id,children:l.jsx(o,{className:"w-4 h-4"})}),l.jsx(d,{"aria-label":e("myModels.deleteConfirm"),onClick:e=>{e.stopPropagation(),T(a.id)},disabled:g===a.id,className:"hover:text-snapfy-error hover:bg-snapfy-error/10",children:l.jsx(c,{className:"w-4 h-4"})})]})]})})]},a.id);var s})}),b&&l.jsx("div",{className:"fixed inset-0 bg-black/90 backdrop-blur-md z-[100] flex items-center justify-center p-4",onClick:()=>h(null),children:l.jsxs("div",{className:"relative max-w-5xl w-full h-full flex items-center justify-center",children:[l.jsx(d,{"aria-label":"Fechar",onImagery:!0,onClick:()=>h(null),className:"absolute top-4 right-4 z-10",children:l.jsx(m,{className:"w-6 h-6"})}),l.jsx("img",{src:b,className:"max-w-full max-h-full object-contain rounded-card shadow-2xl",alt:"Model Preview",onClick:e=>e.stopPropagation()})]})})]})};export{x as default};
2//# sourceMappingURL=MyModelsPage.DZ_XH0PW.js.map

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.