PageSourceSearch

https://www.confiancaleiloes.leilao.br/_nuxt/useFavoritos.cf-725c9d9f.jKoWzf48.js

js confiancaleiloes.leilao.br collected 2026-10-09 23:58:14 UTC 2,504 bytes, 2 lines download raw bytes

1/* cf-725c9d9f */
2import{u as S}from"./useSession.cf-725c9d9f.BbzqDiJH.js";import{aC as l,s as b,a5 as j}from"#entry";function N(r){return r?Array.isArray(r)?r:Object.values(r):[]}function L(r){return String(r?.data?.message||r?.statusMessage||r?.message||"")}function C(){const{isAuthenticated:r}=S(),o=l("account-favoritos-lotes",()=>[]),i=l("account-favoritos-leiloes",()=>[]),c=l("account-favoritos-pending",()=>!1),f=l("account-favoritos-error",()=>null),s=l("account-favoritos-loaded",()=>!1);async function h(t=!1){if(!c.value&&!(s.value&&!t)){if(!r.value){s.value=!0;return}c.value=!0,f.value=null;try{const e=j(["cookie"]),a=await $fetch("/api/arrematante/favoritos",{headers:e});o.value=N(a?.lotes),i.value=N(a?.leiloes),s.value=!0}catch(e){f.value=e?.statusMessage||e?.message||"Não foi possível carregar seus favoritos"}finally{c.value=!1}}}async function v(){await h(!0)}function d(t){return t==null?!1:o.value.some(e=>Number(e.lote?.id)===Number(t))}function m(t){return t==null?!1:i.value.some(e=>Number(e.leilao?.id)===Number(t))}async function w(t){const e=Number(t?.id);if(!e||d(e))return;const a=o.value;o.value=[...a,{id:e,active:!0,lote:{...t,id:e}}];try{await $fetch(`/api/arrematante/lotes/${e}/favorito`,{method:"POST"}),s.value=!0}catch(u){const n=L(u).toLowerCase();if(n.includes("já está")||n.includes("ja esta")){await v();return}throw o.value=a,u}}async function y(t){const e=o.value;o.value=e.filter(a=>Number(a.lote?.id)!==Number(t));try{await $fetch(`/api/arrematante/lotes/${t}/favorito`,{method:"DELETE"})}catch(a){throw o.value=e,a}}async function $(t){const e=Number(t?.id);if(e){if(d(e)){await y(e);return}await w(t)}}async function g(t){const e=Number(t?.id);if(!e||m(e))return;const a=i.value;i.value=[...a,{id:e,active:!0,leilao:{...t,id:e}}];try{await $fetch(`/api/arrematante/leiloes/${e}/favorito`,{method:"POST"}),s.value=!0}catch(u){const n=L(u).toLowerCase();if(n.includes("já está")||n.includes("ja esta")){await v();return}throw i.value=a,u}}async function p(t){const e=i.value;i.value=e.filter(a=>Number(a.leilao?.id)!==Number(t));try{await $fetch(`/api/arrematante/leiloes/${t}/favorito`,{method:"DELETE"})}catch(a){throw i.value=e,a}}async function E(t){const e=Number(t?.id);if(e){if(m(e)){await p(e);return}await g(t)}}return{pending:c,error:f,loaded:s,lotes:b(()=>o.value),leiloes:b(()=>i.value),load:h,refresh:v,isLoteFavorito:d,isLeilaoFavorito:m,addLote:w,removeLote:y,toggleLote:$,addLeilao:g,removeLeilao:p,toggleLeilao:E}}export{C as u};

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.