PageSourceSearch

https://loothing.xyz/assets/index-BDuKtLIV.js

js loothing.xyz collected 2026-09-24 15:16:08 UTC 65,409 bytes, 1 lines download raw bytes

1import{r as e,R as s,j as t}from"./react-vendor-BR2bEzcq.js";import{l as i,d as a,m as r,A as n,al as l,H as o,W as c,B as d,ak as m,a0 as h,R as u,U as x,G as p,P as g,X as b,D as f,bi as y,n as j,a4 as w,a9 as v,z as N,af as k}from"./index-We6CJOzg.js";import{a as C,z as I}from"./axios-DY9rj2-D.js";import{l as S}from"./socket-BtQC6gv9.js";import{W as E,a as W,b as $,E as A}from"./WowThemedComponents-Ceq00Isr.js";import{g as T,a as F}from"./animations-DylOLEjR.js";import{F as D}from"./CheckIcon-911ghGV7.js";import{F as P}from"./TrashIcon-DpBbAWEC.js";import{M as R}from"./Modal-DPq-sBAL.js";import{F as O,N as L,T as M}from"./FormInput-CRpcn1_o.js";import{S as H}from"./StandardDropdown-BTdJSuUI.js";import{P as q}from"./plus-CdGD-8Iq.js";import{T as U}from"./trash-2-3KaU3fke.js";import{F as z}from"./folder-open-BZilz-DU.js";import{L as G}from"./loader-circle-DAI1GXMj.js";import{L as _}from"./lock-CBrxUhMm.js";import{Q as B}from"./index-CKZTLR_2.js";import{C as Q}from"./circle-check-hSBb0kHo.js";import{C as V}from"./copy-DrhQdk7A.js";import{E as J}from"./eye-BcoJl0Iv.js";import{Q as K}from"./qr-code-DVMGp_2K.js";import{S as X}from"./send-DflEmAU2.js";import{S as Y}from"./share-2-DEVRy_sG.js";import{f as Z}from"./format-zHKzbOb2.js";import{F as ee}from"./Cog6ToothIcon-Bc9jvqQZ.js";import{F as se}from"./ShareIcon-CHA_VtPe.js";import{F as te}from"./PlusIcon-Ca5ILnR9.js";import"./ExclamationCircleIcon-CunFTGPY.js";import"./CheckCircleIcon-Cby2gbWo.js";import"./EyeSlashIcon-5yKjBYTw.js";import"./EyeIcon-D3kwsJLA.js";import"./en-US-D_rcZ7uO.js";const ie=i("link-2-off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]),ae=s.memo(function({item:s,itemId:i,layoutId:a,sourceTypes:o,isChecked:c,isEnriched:d=!1,onCheck:m,onDelete:h,animationDelay:u,isAdmin:x}){const[p,g]=e.useState(!1),[b,f]=e.useState(!1),[y,j]=e.useState(!1),w=e.useRef(null),v=o[s.source]||o.unknown;e.useEffect(()=>{if(d&&!y){j(!0);const e=setTimeout(()=>j(!1),1200);return()=>clearTimeout(e)}},[d,y]),e.useEffect(()=>()=>{w.current&&clearTimeout(w.current)},[]);const N=async()=>{if(!p)return g(!0),void(w.current=setTimeout(()=>g(!1),3e3));f(!0);try{await h(i)}catch(e){console.error("Delete failed:",e),f(!1),g(!1)}};let k;k=s.itemId?t.jsx("a",{href:`https://www.wowhead.com/item=${s.itemId}`,target:"_blank",rel:"noopener noreferrer",className:"text-wow-epic hover:text-purple-300 transition-colors hover:underline","data-wowhead":`item=${s.itemId}`,children:s.name}):s.wowdbId?t.jsx("a",{href:`https://housing.wowdb.com/decor/${s.wowdbId}/`,target:"_blank",rel:"noopener noreferrer",className:"text-wow-epic hover:text-purple-300 transition-colors hover:underline",children:s.name}):t.jsx("span",{className:"text-white",children:s.name});let C=null;s.profession?C=t.jsxs("span",{className:"text-sm",children:[t.jsx("span",{className:"text-gray-300",children:s.profession}),s.professionLevel&&t.jsxs("span",{className:"text-gray-500 ml-1",children:["(",s.professionLevel,")"]})]}):s.vendor&&(C=t.jsxs("span",{className:"text-sm",children:[t.jsx("a",{href:`https://www.wowhead.com/search?q=${encodeURIComponent(s.vendor)}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 hover:underline",children:s.vendor}),s.location&&t.jsxs("span",{className:"text-gray-500 ml-1",children:["(",s.location,")"]})]}));let I=null;s.materials&&s.materials.length>0?I=t.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-sm",children:s.materials.map((e,s)=>t.jsxs("span",{className:"inline-flex items-center whitespace-nowrap",children:[e.itemId?t.jsx("a",{href:`https://www.wowhead.com/item=${e.itemId}`,target:"_blank",rel:"noopener noreferrer",className:"text-green-400 hover:text-green-300 hover:underline","data-wowhead":`item=${e.itemId}`,children:e.name}):t.jsx("span",{className:"text-gray-300",children:e.name}),t.jsxs("span",{className:"text-gray-500 ml-1",children:["×",e.qty]})]},s))}):s.cost?I=s.currencyId?t.jsx("a",{href:`https://www.wowhead.com/currency=${s.currencyId}`,target:"_blank",rel:"noopener noreferrer",className:"text-yellow-400 hover:text-yellow-300 hover:underline text-sm",children:s.cost}):t.jsx("span",{className:"text-yellow-400 text-sm",children:s.cost}):s.notes&&(I=t.jsx("span",{className:"text-gray-400 text-sm italic",children:s.notes}));const S=T(),E=y?F():{};return t.jsx(r.div,{layout:!0,layoutId:a,initial:"initial",animate:"animate",exit:"exit",variants:S,transition:{layout:{duration:.35}},...E,className:`\n        relative px-4 py-3 sm:px-6 sm:py-4\n        transition-all duration-200\n        ${c?"bg-green-900/10":"hover:bg-gray-800/50"}\n        ${y?"bg-cyan-500/20":""}\n        group\n      `,style:{borderLeftWidth:"3px",borderLeftColor:v.color},children:t.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[m&&t.jsx(r.button,{whileHover:{scale:1.1},whileTap:{scale:.9},onClick:e=>{e.stopPropagation(),m&&m(i,!c)},className:`\n              shrink-0 w-6 h-6 rounded-md border-2 transition-all duration-200\n              flex items-center justify-center mt-0.5\n              ${c?"bg-green-500 border-green-500 text-white":"border-gray-600 hover:border-wow-epic"}\n            `,children:c&&t.jsx(r.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:500,damping:25},children:t.jsx(D,{className:"w-4 h-4"})})}),t.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsx("div",{className:"font-medium "+(c?"line-through opacity-60":""),children:k}),t.jsx("span",{className:"hidden sm:inline-flex px-2 py-0.5 text-xs font-medium rounded-full shrink-0",style:{backgroundColor:`${v.color}22`,color:v.color,border:`1px solid ${v.color}44`},children:v.label})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm",children:[t.jsx("span",{className:"sm:hidden inline-flex px-2 py-0.5 text-xs font-medium rounded-full",style:{backgroundColor:`${v.color}22`,color:v.color,border:`1px solid ${v.color}44`},children:v.label}),C,s.craftingCost>0&&t.jsxs("span",{className:"text-sm font-medium "+(s.craftingCost>=1e4?"text-yellow-400":"text-green-400"),title:"Estimated cost based on Duskwood AH prices",children:["~",s.craftingCost>=1e3?`${(s.craftingCost/1e3).toFixed(1)}k`:`${s.craftingCost}g`]}),"crafted"===s.source&&!s.craftingCost&&t.jsx("span",{className:"text-xs text-gray-500",children:"FREE"})]}),I&&t.jsx("div",{className:"mt-1.5 "+(c?"opacity-50":""),children:I})]}),x&&h&&t.jsx("div",{className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(n,{mode:"wait",children:p?t.jsxs(r.div,{initial:{opacity:0,scale:.8}
1,animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},className:"flex items-center gap-1",children:[t.jsx("button",{onClick:N,disabled:b,className:"p-1.5 rounded-lg bg-green-600 hover:bg-green-500 text-white transition-colors disabled:opacity-50",title:"Confirm delete",children:b?t.jsx("span",{className:"w-4 h-4 block animate-spin rounded-full border-2 border-white border-t-transparent"}):t.jsx(D,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>g(!1),className:"p-1.5 rounded-lg bg-red-600 hover:bg-red-500 text-white transition-colors",title:"Cancel",children:t.jsx(l,{className:"w-4 h-4"})})]},"confirm"):t.jsx(r.button,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:N,className:"p-1.5 rounded-lg bg-gray-800 hover:bg-red-600/20 text-gray-500 hover:text-red-400 transition-colors",title:"Remove from wishlist",children:t.jsx(P,{className:"w-4 h-4"})},"delete")})})]})})},(e,s)=>e.isChecked===s.isChecked&&e.isEnriched===s.isEnriched&&e.item.id===s.item.id&&e.item.name===s.item.name&&e.item.enrichmentStatus===s.item.enrichmentStatus&&e.isAdmin===s.isAdmin),re=s.memo(function({expansion:s,items:i,sourceTypes:a,checkedItemIds:l,enrichedItems:c,onCheckItem:d,onDeleteItem:m,isCollapsed:h,onToggle:u,isAdmin:x}){const p=s.lumber?` — ${s.lumber}`:"",g=i.filter(e=>l.has(e.id)).length,b=i.length,f=b>0?Math.round(g/b*100):0,y=e.useMemo(()=>i.reduce((e,s)=>e+(s.craftingCost||0),0),[i]);return t.jsx(r.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3},layout:!0,children:t.jsxs(E,{className:"overflow-hidden transition-all duration-300 "+(h?"opacity-80":""),glow:100===f,children:[t.jsxs("button",{onClick:u,className:"w-full flex items-center justify-between px-4 py-3 sm:px-6 sm:py-4 bg-linear-to-r from-gray-800/50 to-transparent hover:from-gray-700/50 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[t.jsx("span",{className:"text-2xl sm:text-3xl",children:s.emoji}),t.jsxs("div",{className:"text-left",children:[t.jsx("h2",{className:"text-base sm:text-lg font-bold text-white uppercase tracking-wide",children:s.name}),p&&t.jsx("span",{className:"text-xs sm:text-sm text-gray-400 normal-case",children:p})]})]}),t.jsxs("div",{className:"flex items-center gap-3 sm:gap-6",children:[t.jsxs("div",{className:"text-right hidden sm:block",children:[t.jsxs("div",{className:"text-sm text-gray-400",children:[t.jsx("span",{className:"text-white font-semibold",children:g}),t.jsx("span",{className:"mx-1",children:"/"}),t.jsx("span",{children:b})]}),t.jsx("div",{className:"w-24 h-1.5 bg-gray-700 rounded-full mt-1 overflow-hidden",children:t.jsx(r.div,{className:"h-full rounded-full "+(100===f?"bg-green-500":f>=75?"bg-yellow-500":"bg-orange-500"),initial:{width:0},animate:{width:`${f}%`},transition:{duration:.5}})})]}),t.jsxs("div",{className:"sm:hidden text-sm text-gray-400",children:[t.jsx("span",{className:"text-white font-semibold",children:g}),"/",b]}),y>0&&t.jsxs("div",{className:"text-sm font-bold hidden md:block "+(y>=5e4?"text-yellow-400":"text-green-400"),children:["~",y>=1e3?`${(y/1e3).toFixed(1)}k`:`${y}g`]}),t.jsx(r.div,{animate:{rotate:h?-180:0},transition:{duration:.3},children:t.jsx(o,{className:"w-5 h-5 text-gray-400"})})]})]}),t.jsx(n,{initial:!1,children:!h&&t.jsxs(r.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3,ease:"easeInOut"},className:"overflow-hidden",children:[t.jsx("div",{className:"divide-y divide-gray-800/50",children:t.jsx(n,{mode:"popLayout",children:i.map((e,i)=>t.jsx(ae,{item:e,itemId:e.id,layoutId:e.id.toString(),sourceTypes:a,isChecked:l.has(e.id),isEnriched:c?.has(e.id),onCheck:d,onDelete:m,animationDelay:Math.min(.03*i,3),isAdmin:x},`${s.id}-${e.id}`))})}),t.jsx("div",{className:"px-4 py-3 sm:px-6 bg-gray-800/30 border-t border-gray-700/50",children:t.jsxs("div",{className:"flex items-center justify-between text-sm",children:[t.jsx("span",{className:"text-gray-500",children:100===f?t.jsx("span",{className:"text-green-400",children:"✓ Complete!"}):t.jsxs("span",{children:[b-g," remaining"]})}),y>0&&t.jsxs("span",{className:"text-gray-500 md:hidden",children:["Est. cost:"," ",t.jsx("span",{className:y>=5e4?"text-yellow-400":"text-green-400",children:y>=1e3?`${(y/1e3).toFixed(1)}k`:`${y}g`})]})]})})]})})]})})},(e,s)=>e.expansion.id===s.expansion.id&&e.items===s.items&&e.isCollapsed===s.isCollapsed&&e.checkedItemIds===s.checkedItemIds&&e.enrichedItems===s.enrichedItems&&e.isAdmin===s.isAdmin);function ne({open:s,onClose:i,onAdd:a,expansions:r,sourceTypes:n}){const[l,o]=e.useState({name:"",itemId:"",expansion:"",source:"unknown",profession:"",professionLevel:"",vendor:"",cost:"",currencyId:"",notes:""}),[m,h]=e.useState([]),[u,x]=e.useState(!1),[p,g]=e.useState(null),b=e.useCallback(e=>s=>{const t=s?.target?s.target.value:s;o(s=>({...s,[e]:t})),g(null)},[]),f=e.useCallback(e=>s=>{o(t=>({...t,[e]:s})),g(null)},[]),y=e.useCallback(()=>{h(e=>[...e,{name:"",qty:1,itemId:""}])},[]),j=e.useCallback(e=>{h(s=>s.filter((s,t)=>t!==e))},[]),w=e.useCallback((e,s,t)=>{h(i=>{const a=[...i];return a[e]={...a[e],[s]:t},a})},[]),v=e.useCallback(async()=>
1{if(l.name.trim())if(l.expansion){x(!0),g(null);try{const e={...l,itemId:l.itemId?parseInt(l.itemId):void 0,currencyId:l.currencyId?parseInt(l.currencyId):void 0,materials:m.length>0?m.filter(e=>e.name.trim()).map(e=>({name:e.name,qty:parseInt(e.qty)||1,itemId:e.itemId?parseInt(e.itemId):void 0})):void 0};Object.keys(e).forEach(s=>{""!==e[s]&&void 0!==e[s]||delete e[s]}),await a(e),o({name:"",itemId:"",expansion:"",source:"unknown",profession:"",professionLevel:"",vendor:"",cost:"",currencyId:"",notes:""}),h([])}catch(e){g(e.message||"Failed to add item")}finally{x(!1)}}else g("Please select an expansion");else g("Item name is required")},[l,m,a]),N=e.useCallback(()=>{u||(i(),g(null))},[u,i]),k=r.map(e=>({value:e.id,label:`${e.emoji} ${e.name}`})),C=Object.entries(n).map(([e,{label:s}])=>({value:e,label:s}));return t.jsx(R,{isOpen:s,onClose:N,title:"Add New Item",size:"xl",closeOnBackdrop:!u,closeOnEscape:!u,footer:t.jsxs(t.Fragment,{children:[t.jsx(d,{variant:"ghost",onClick:N,disabled:u,children:"Cancel"}),t.jsx(d,{variant:"primary",onClick:v,disabled:u,loading:u,className:"bg-linear-to-r from-[#bb86fc] to-[#03dac6] hover:from-[#9a67ea] hover:to-[#02c4b0]",children:u?"Adding...":"Add Item"})]}),children:t.jsxs("div",{className:"flex flex-col gap-4",children:[p&&t.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-red-700/50 bg-red-900/30 px-3 py-2 text-sm text-red-100",children:[t.jsx(c,{className:"h-4 w-4 shrink-0 mt-0.5"}),t.jsx("span",{children:p})]}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(O,{label:"Item Name",value:l.name,onChange:b("name"),required:!0,disabled:u})}),t.jsx("div",{className:"sm:w-44",children:t.jsx(O,{label:"Wowhead Item ID",type:"number",value:l.itemId,onChange:b("itemId"),disabled:u,helperText:"Optional"})})]}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-300 mb-1",children:["Expansion ",t.jsx("span",{className:"text-red-400",children:"*"})]}),t.jsx(H,{options:k,value:l.expansion,onChange:f("expansion"),placeholder:"Select an expansion...",disabled:u})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-300 mb-1",children:"Source"}),t.jsx(H,{options:C,value:l.source,onChange:f("source"),placeholder:"Select a source...",disabled:u})]})]}),"crafted"===l.source&&t.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(O,{label:"Profession",value:l.profession,onChange:b("profession"),disabled:u,placeholder:"e.g., Inscription"})}),t.jsx("div",{className:"sm:w-52",children:t.jsx(O,{label:"Profession Level",value:l.professionLevel,onChange:b("professionLevel"),disabled:u,placeholder:"e.g., Dragon Isles 80"})})]}),("vendor"===l.source||"reputation"===l.source)&&t.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(O,{label:"Vendor Name",value:l.vendor,onChange:b("vendor"),disabled:u})}),t.jsx("div",{className:"sm:w-52",children:t.jsx(O,{label:"Cost",value:l.cost,onChange:b("cost"),disabled:u,placeholder:"e.g., 250g or 500 Rep"})}),t.jsx("div",{className:"sm:w-36",children:t.jsx(L,{label:"Currency ID",value:l.currencyId,onChange:b("currencyId"),disabled:u,helperText:"Optional"})})]}),"crafted"===l.source&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 mb-2",children:[t.jsx("h3",{className:"text-sm font-semibold text-gray-200",children:"Materials"}),t.jsx(d,{size:"sm",variant:"ghost",onClick:y,disabled:u,leftIcon:t.jsx(q,{className:"h-4 w-4"}),children:"Add Material"})]}),t.jsx("div",{className:"flex flex-col gap-2",children:m.map((e,s)=>t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 sm:items-end",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(O,{size:"sm",label:"Material Name",value:e.name,onChange:e=>w(s,"name",e.target.value),disabled:u})}),t.jsx("div",{className:"sm:w-20",children:t.jsx(O,{size:"sm",type:"number",label:"Qty",value:e.qty,onChange:e=>w(s,"qty",e.target.value),disabled:u})}),t.jsx("div",{className:"sm:w-32",children:t.jsx(O,{size:"sm",type:"number",label:"Item ID",value:e.itemId,onChange:e=>w(s,"itemId",e.target.value),disabled:u})}),t.jsx("button",{type:"button",onClick:()=>j(s),disabled:u,className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-900/20 rounded-lg transition-colors shrink-0 self-end sm:self-ce
1nter disabled:opacity-50","aria-label":"Remove material",children:t.jsx(U,{className:"h-4 w-4"})})]},s))})]}),t.jsx(M,{label:"Notes",value:l.notes,onChange:b("notes"),rows:2,disabled:u,placeholder:"Additional notes about obtaining this item..."})]})})}const le=e=>{switch(e){case"public":return t.jsx(p,{className:"h-4 w-4 text-green-400"});case"guild":return t.jsx(x,{className:"h-4 w-4 text-blue-400"});default:return t.jsx(_,{className:"h-4 w-4 text-gray-400"})}};function oe({currentWishlistId:s=null,onWishlistChange:i,onCreateNew:a,onManageWishlists:l=null}){const[o,c]=e.useState(!1),[d,x]=e.useState([]),[p,g]=e.useState(!1),[b,f]=e.useState(null),y=e.useRef(null),j=e.useCallback(async()=>{g(!0),f(null);try{const e=await C.get("/api/housing/wishlists");x(e.data.wishlists||[])}catch(e){console.error("[WishlistSelector] Error fetching wishlists:",e),f(m(e,"Failed to load wishlists"))}finally{g(!1)}},[]);e.useEffect(()=>{j()},[j]),e.useEffect(()=>{if(!o)return;const e=e=>{y.current&&!y.current.contains(e.target)&&c(!1)},s=e=>{"Escape"===e.key&&c(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",s)}},[o]);const w=Array.isArray(d)?d.find(e=>e.id===s):null;return t.jsxs("div",{ref:y,className:"relative inline-block",children:[t.jsxs("button",{type:"button",id:"wishlist-selector-button","aria-haspopup":"true","aria-expanded":o,onClick:()=>c(e=>!e),className:"\n          flex items-center gap-2 min-w-[12.5rem] px-3 py-2 rounded-lg\n          border border-gray-700 bg-gray-800/50 hover:bg-gray-700/50\n          text-left transition-colors\n          focus:outline-hidden focus:ring-2 focus:ring-(--theme-primary-color,#bb86fc)\n        ",children:[t.jsx(z,{className:"h-4 w-4 shrink-0 text-gray-400"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-gray-100 truncate",children:w?.name||"Select Wishlist"}),w&&t.jsxs("div",{className:"text-xs text-gray-400",children:[w.itemCount||0," items",null!=w.progressPercent&&t.jsxs("span",{children:[" | ",w.progressPercent,"%"]})]})]}),t.jsx(h,{className:"h-4 w-4 shrink-0 text-gray-400 transition-transform "+(o?"rotate-180":"")})]}),t.jsx(n,{children:o&&t.jsxs(r.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},role:"menu","aria-labelledby":"wishlist-selector-button",className:"\n              absolute left-0 z-40 mt-1 w-[20rem] max-w-[90vw]\n              rounded-lg border border-gray-700/50 bg-gray-800/95 backdrop-blur-xs\n              supports-backdrop-filter:bg-gray-800/85 shadow-2xl\n              max-h-[25rem] overflow-y-auto\n            ",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-700/50",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-gray-300",children:"Your Wishlists"}),t.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),j()},disabled:p,className:"p-1 text-gray-400 hover:text-gray-200 hover:bg-gray-700/50 rounded transition-colors disabled:opacity-50","aria-label":"Refresh",title:"Refresh",children:p?t.jsx(G,{className:"h-4 w-4 animate-spin"}):t.jsx(u,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"py-1",children:[b&&t.jsx("div",{className:"px-3 py-2 text-sm text-red-300",children:b}),p&&0===d.length&&t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-sm text-gray-400",children:[t.jsx(G,{className:"h-4 w-4 animate-spin"}),t.jsx("span",{children:"Loading wishlists..."})]}),!p&&0===d.length&&!b&&t.jsx("div",{className:"px-3 py-2 text-sm text-gray-400",children:"No wishlists found"}),Array.isArray(d)&&d.map(e=>{const a=e.id===s;return t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{return s=e.id,i(s),void c(!1);var s},className:`\n                      w-full text-left px-3 py-2 transition-colors\n                      hover:bg-gray-700/50\n                      ${a?"bg-(--theme-primary-color,#bb86fc)/15":""}\n                    `,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[le(e.visibility),t.jsx("span",{className:"flex-1 min-w-0 truncate text-sm font-medium text-gray-100",children:e.name}),t.jsx("span",{className:"shrink-0 inline-flex items-center justify-center min-w-[2.5rem] h-5 px-2 text-xs rounded-full border border-gray-600 text-gray-300",children:e.itemCount||0})]}),e.itemCount>0&&t.jsxs("div",{className:"mt-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[t.jsx("span",{className:"text-[11px] text-gray-400",children:"Progress"}),t.jsxs("span",{className:"text-[11px] text-gray-400",children:[e.progressPercent||0,"%"]})]}),t.jsx("div",{className:"h-1 rounded-full bg-[rgba(187,134,252,0.2)
1] overflow-hidden",children:t.jsx("div",{className:"h-full rounded-full bg-linear-to-r from-[#bb86fc] to-[#03dac6]",style:{width:`${e.progressPercent||0}%`}})})]})]},e.id)})]}),t.jsxs("div",{className:"border-t border-gray-700/50 py-1",children:[t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{c(!1),a()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-(--theme-primary-color,#bb86fc) hover:bg-gray-700/50 transition-colors",children:[t.jsx(q,{className:"h-4 w-4"}),"Create New Wishlist"]}),l&&t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{c(!1),l&&l()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-400 hover:bg-gray-700/50 hover:text-gray-200 transition-colors",children:[t.jsx(z,{className:"h-4 w-4"}),"Manage Wishlists"]})]})]})})]})}oe.propTypes={currentWishlistId:g.oneOfType([g.string,g.number]),onWishlistChange:g.func.isRequired,onCreateNew:g.func.isRequired,onManageWishlists:g.func};const ce=[{value:"private",icon:_,title:"Private",description:"Only you can view this wishlist"},{value:"guild",icon:x,title:"Guild Members",description:"Authenticated guild members can view"},{value:"public",icon:p,title:"Public",description:"Anyone with the link can view (no login required)"}];function de({isOpen:s,onClose:i,onWishlistCreated:a=null}){const[r,n]=e.useState({name:"",description:"",visibility:"private"}),[l,o]=e.useState(!1),[h,u]=e.useState(null),[x,p]=e.useState({}),g=e.useCallback(e=>s=>{const t=s.target.value;n(s=>({...s,[e]:t})),x[e]&&p(s=>{const t={...s};return delete t[e],t}),u(null)},[x]),f=e.useCallback(async()=>{if((()=>{const e={};return r.name.trim()?(r.name.length<1||r.name.length>255)&&(e.name="Name must be between 1 and 255 characters"):e.name="Name is required",r.description&&r.description.length>1e4&&(e.description="Description cannot exceed 10,000 characters"),p(e),0===Object.keys(e).length})()){o(!0),u(null);try{const e=(await C.post("/api/housing/wishlists",{name:r.name.trim(),description:r.description.trim()||void 0,visibility:r.visibility})).data;I.success(`Wishlist "${e.name}" created!`),n({name:"",description:"",visibility:"private"}),p({}),a&&a(e),i()}catch(e){console.error("[CreateWishlistModal] Error creating wishlist:",e);const s=m(e,"Failed to create wishlist");u(s)}finally{o(!1)}}},[r,a,i]),y=e.useCallback(()=>{l||(n({name:"",description:"",visibility:"private"}),p({}),u(null),i())},[l,i]);return t.jsx(R,{isOpen:s,onClose:y,title:"Create New Wishlist",size:"lg",closeOnBackdrop:!l,closeOnEscape:!l,footer:t.jsxs(t.Fragment,{children:[t.jsx(d,{variant:"ghost",onClick:y,disabled:l,children:"Cancel"}),t.jsx(d,{variant:"primary",onClick:f,disabled:l||!r.name.trim(),loading:l,className:"bg-linear-to-r from-[#bb86fc] to-[#03dac6] hover:from-[#9a67ea] hover:to-[#02c4b0] disabled:opacity-50",children:l?"Creating...":"Create Wishlist"})]}),children:t.jsxs("div",{className:"flex flex-col gap-5",children:[h&&t.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-red-700/50 bg-red-900/30 px-3 py-2 text-sm text-red-100",children:[t.jsx(c,{className:"h-4 w-4 shrink-0 mt-0.5"}),t.jsx("span",{className:"flex-1",children:h}),t.jsx("button",{type:"button",onClick:()=>u(null),className:"text-red-200 hover:text-white shrink-0","aria-label":"Dismiss error",children:t.jsx(b,{className:"h-4 w-4"})})]}),t.jsx(O,{label:"Wishlist Name",value:r.name,onChange:g("name"),onKeyPress:e=>{"Enter"===e.key&&!e.shiftKey&&r.name.trim()&&(e.preventDefault(),f())},required:!0,disabled:l,error:Boolean(x.name),errorMessage:x.name,helperText:x.name?"":"Give your wishlist a name (1-255 characters)",placeholder:"e.g., My Housing Wishlist",autoFocus:!0}),t.jsx(M,{label:"Description (optional)",value:r.description,onChange:g("description"),rows:3,disabled:l,error:Boolean(x.description),errorMessage:x.description,helperText:x.description?"":`${r.description.length}/10,000 characters`,placeholder:"Describe your wishlist..."}),t.jsxs("fieldset",{className:"space-y-2",children:[t.jsx("legend",{className:"block text-sm font-medium text-gray-300 mb-2",children:"Who can see this wishlist?"}),t.jsx("div",{className:"flex flex-col gap-2",children:ce.map(({value:e,icon:s,title:i,description:a})=>{const n=r.visibility===e;return t.jsxs("label",{className:`flex items-start gap-3 rounded-lg border px-3 py-2.5 cursor-pointer transition-colors ${n?"border-(--theme-primary-color,#bb86fc) bg-(--theme-primary-color,#bb86fc)/10":"border-gray-700 hover:border-gray-600 hover:bg-gray-800/40"} ${l?"opacity-60 cursor-not-allowed":""}`,children:[t.jsx("input",{type:"radio",name:"visibility",value:e,checked:n,onChange:g("visibility"),disabled:l,className:"mt-1 h-4 w-4 shrink-0 border-gray-600 bg-gray-800 text-(--theme-primary-color,#bb86fc) focus:ring-2 focus:ring-(--theme-primary-color,#bb86fc)/40"}),t.jsx(s,{className:"h-5 w-5 shrink-0 text-gray-400 mt-0.5"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm font-medium text-gray-100",children:i}),t.jsx("div",{className:"text-xs text-gray-400",children:a})]})]},e)})})]})]})})}
1de.propTypes={isOpen:g.bool.isRequired,onClose:g.func.isRequired,onWishlistCreated:g.func};const me=[{value:"private",icon:_,title:"Private",description:"Only you can view this wishlist"},{value:"guild",icon:x,title:"Guild Members",description:"All authenticated guild members can view"},{value:"public",icon:p,title:"Public",description:"Anyone with the link (no login required)"}],he=me.reduce((e,s)=>(e[s.value]=s,e),{});function ue({children:e,className:s=""}){return t.jsx("div",{className:`rounded-lg border border-gray-700/50 bg-gray-800/40 p-4 ${s}`,children:e})}function xe({wishlist:s=null,isOpen:i,onClose:r,onVisibilityChange:n=null}){const{selectedGuild:l}=a(),o=l?.id,[h,u]=e.useState(s?.visibility||"private"),[x,p]=e.useState(s?.shareToken||null),[g,y]=e.useState(s?.viewCount||0),[j,w]=e.useState(!1),[v,N]=e.useState(!1),[k,S]=e.useState(!1),[E,W]=e.useState(!1),[$,A]=e.useState(null),[T,F]=e.useState(!1),[D,P]=e.useState([]),[O,L]=e.useState(""),[M,q]=e.useState(!1),[U,z]=e.useState(!1),[Y,Z]=e.useState(!1),ee=x?`${window.location.origin}/housing/shared/${x}`:null;e.useEffect(()=>{s&&(u(s.visibility||"private"),p(s.shareToken||null),y(s.viewCount||0))},[s]);const se=e.useCallback(async()=>{if(q(!0),A(null),!o)return A("No guild selected. Please select a guild first."),void q(!1);try{const e=await C.get(`/api/discord/channels/${o}`),s=e.data.success?e.data.channels:e.data;if(!Array.isArray(s))throw new Error("Invalid response format from server");const t=s.filter(e=>0===e.type||"GUILD_TEXT"===e.type);P(t)}catch(e){console.error("[ShareWishlistModal] Error loading Discord channels:",e),A(e.response?.data?.error||"Failed to load Discord channels. Make sure Discord integration is configured.")}finally{q(!1)}},[o]);e.useEffect(()=>{i&&o&&se()},[i,o,se]);const te=e.useCallback(async e=>{if(s?.id)if("guild"!==e||o){w(!0),A(null);try{const t={visibility:e};"guild"===e?t.guildId=o:"private"===e&&(t.guildId=null);const i=await C.patch(`/api/housing/wishlists/${s.id}`,t);u(e),n&&n(e,i.data),I.success(`Visibility updated to ${e}`)}catch(t){console.error("[ShareWishlistModal] Error updating visibility:",t),A(m(t,"Failed to update visibility"))}finally{w(!1)}}else A("Please select a guild first to use guild visibility")},[s?.id,o,n]),ae=e.useCallback(async()=>{if(s?.id){N(!0),A(null);try{const e=await C.post(`/api/housing/wishlists/${s.id}/share`);p(e.data.shareToken),I.success("Share link generated!")}catch(e){console.error("[ShareWishlistModal] Error generating token:",e),A(m(e,"Failed to generate share link"))}finally{N(!1)}}},[s?.id]),re=e.useCallback(async()=>{if(s?.id){S(!0),A(null);try{await C.delete(`/api/housing/wishlists/${s.id}/share`),p(null),I.success("Share link revoked")}catch(e){console.error("[ShareWishlistModal] Error revoking token:",e),A(m(e,"Failed to revoke share link"))}finally{S(!1)}}},[s?.id]),ne=e.useCallback(async()=>{if(ee)try{await navigator.clipboard.writeText(ee),W(!0),I.success("Share link copied to clipboard!"),setTimeout(()=>W(!1),3e3)}catch(e){console.error("[ShareWishlistModal] Failed to copy URL:",e),A("Failed to copy URL to clipboard")}},[ee]),le=e.useCallback(()=>{const e=document.getElementById("wishlist-qr-code-svg");if(!e)return;const t=(new XMLSerializer).serializeToString(e),i=document.createElement("canvas"),a=i.getContext("2d"),r=new Image;r.onload=()=>{i.width=r.width,i.height=r.height,a.drawImage(r,0,0),i.toBlob(e=>{const t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=`wishlist-qr-${s?.id||"share"}.png`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)})},r.src="data:image/svg+xml;base64,"+btoa(t)},[s?.id]),oe=e.useCallback(async()=>{if(o)if(O&&s?.id){z(!0),A(null);try{await C.post(`/api/housing/wishlists/${s.id}/post-to-discord`,{channelId:O,guildId:o}),Z(!0),I.success("Wishlist posted to Discord!"),setTimeout(()=>Z(!1),3e3)}catch(e){console.error("[ShareWishlistModal] Error posting to Discord:",e),A(m(e,"Failed to post to Discord"))}finally{z(!1)}}else A("Please select a Discord channel");else A("No guild selected. Please select a guild first.")},[O,s?.id,o]),ce=e.useCallback(()=>{W(!1),Z(!1),F(!1),L(""),A(null),r()},[r]),de=me.map(({value:e,title:s})=>({value:e,label:s})),xe=D.map(e=>({value:e.id,label:`# ${e.name}`})),pe=he[h]?.icon||_;return t.jsx(R,{isOpen:i,onClose:ce,title:"Share Wishlist",size:"xl",footer:t.jsx(d,{variant:"outline",onClick:ce,children:"Close"}),children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx("p",{className:"text-sm text-gray-400",children:s?.name||"Untitled Wishlist"}),$&&t.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-red-700/50 bg-red-900/30 px-3 py-2 text-sm text-red-100",children:[t.jsx(c,{className:"h-4 w-4 shrink-0 mt-0.5"}),t.jsx("span",{className:"flex-1",children:$}),t.jsx("button",{type:"button",onClick:()=>A(null),className:"text-red-200 hover:text-white shrink-0","aria-label":"Dismiss error",children:t.jsx(b,{className:"h-4 w-4"})})]}),t.jsxs(ue,{children:[t.jsx("h3",{className:"text-sm font-semibold text-gray-100 mb-3",children:"Who can access this wishlist?"}),t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(pe,{className:"h-4 w-4 text-gray-400 shrink-0"}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(H,{options:de,value:h,onChange:te,disabled:j})})]}),t.jsx("p",{className:"text-xs text-gray-400",children:he[h]?.description}),j&&t.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs text-gray-400",children:[t.jsx(G,{className:"h-3.5 w-3.5 animate-spin"}),t.jsx("span",{children:"Updating visibility..."})]})]}),"public"===h&&t.jsxs(ue,{children:[t.jsx("h3",{className:"text-sm font-semibold text-gray-100 mb-3",children:"Public Share Link"}),x?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx("input",{type:"text",value:ee,readOnly:!0,className:"\n                      flex-1 min-w-0 rounded-lg border border-gray-700 bg-gray-900/50\n                      px-3 py-2 text-sm text-gray-200 font-mono\n                      focus:outline-hidden focu
1s:ring-2 focus:ring-(--theme-primary-color,#bb86fc)\n                    ",onFocus:e=>e.target.select()}),t.jsx(d,{variant:E?"success":"primary",onClick:ne,leftIcon:E?t.jsx(Q,{className:"h-4 w-4"}):t.jsx(V,{className:"h-4 w-4"}),className:"sm:min-w-[7.5rem]",children:E?"Copied!":"Copy"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-3 text-sm text-gray-400",children:[t.jsx(J,{className:"h-4 w-4"}),t.jsxs("span",{children:[g," view",1!==g?"s":""]})]}),t.jsx(d,{size:"sm",variant:"outline",onClick:re,disabled:k,loading:k,leftIcon:!k&&t.jsx(ie,{className:"h-4 w-4"}),className:"mt-3 border-red-500/50 text-red-300 hover:bg-red-900/20 hover:text-red-200",children:k?"Revoking...":"Revoke Link"}),t.jsx("p",{className:"mt-2 text-xs text-gray-500",children:"Revoking the link will invalidate any previously shared URLs."})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-gray-400 mb-3",children:"Generate a share link to allow anyone to view this wishlist without logging in."}),t.jsx(d,{variant:"primary",onClick:ae,disabled:v,loading:v,leftIcon:!v&&t.jsx(V,{className:"h-4 w-4"}),className:"bg-linear-to-r from-[#bb86fc] to-[#03dac6] hover:from-[#9a67ea] hover:to-[#02c4b0]",children:v?"Generating...":"Generate Share Link"})]})]}),"public"===h&&x&&t.jsxs(ue,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3",children:[t.jsx("h3",{className:"text-sm font-semibold text-gray-100",children:"QR Code"}),t.jsxs(d,{size:"sm",variant:"ghost",onClick:()=>F(!T),leftIcon:t.jsx(K,{className:"h-4 w-4"}),children:[T?"Hide":"Show"," QR Code"]})]}),T&&t.jsxs("div",{className:"flex flex-col items-center py-2",children:[t.jsx("div",{className:"rounded-lg bg-white p-2",children:t.jsx(B,{id:"wishlist-qr-code-svg",value:ee,size:200,level:"H",includeMargin:!0})}),t.jsx(d,{size:"sm",variant:"ghost",onClick:le,leftIcon:t.jsx(f,{className:"h-4 w-4"}),className:"mt-3",children:"Download QR Code"}),t.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Scan with a mobile device to open the wishlist"})]})]}),"public"===h&&x&&t.jsxs(ue,{children:[t.jsx("h3",{className:"text-sm font-semibold text-gray-100 mb-3",children:"Post to Discord"}),M?t.jsx("div",{className:"flex items-center justify-center py-4",children:t.jsx(G,{className:"h-5 w-5 animate-spin text-gray-400"})}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-300 mb-1",children:"Select Channel"}),t.jsx(H,{options:xe,value:O,onChange:L,placeholder:0===D.length?"No channels available":"Choose a channel...",disabled:0===D.length})]}),t.jsx(d,{variant:Y?"success":"primary",onClick:oe,disabled:!O||U||0===D.length,loading:U,leftIcon:!U&&(Y?t.jsx(Q,{className:"h-4 w-4"}):t.jsx(X,{className:"h-4 w-4"})),className:"w-full",children:U?"Posting...":Y?"Posted!":"Post to Channel"}),0===D.length&&t.jsx("p",{className:"mt-2 text-xs text-gray-500",children:"No Discord channels found. Make sure Discord integration is configured."})]})]}),"guild"===h&&t.jsxs(ue,{children:[t.jsx("h3",{className:"text-sm font-semibold text-gray-100 mb-1",children:"Guild Access"}),t.jsx("p",{className:"text-sm text-gray-400",children:"All authenticated members of your guild can view this wishlist. They can find it in the shared wishlists section."})]}),"private"===h&&t.jsxs(ue,{children:[t.jsx("h3",{className:"text-sm font-semibold text-gray-100 mb-1",children:"Private Access"}),t.jsx("p",{className:"text-sm text-gray-400",children:"Only you can view this wishlist. Change visibility to Guild or Public to share with others."})]})]})})}xe.propTypes={wishlist:g.shape({id:g.oneOfType([g.string,g.number]),name:g.string,visibility:g.oneOf(["private","guild","public"]),shareToken:g.string,viewCount:g.number}),isOpen:g.bool.isRequired,onClose:g.func.isRequired,onVisibilityChange:g.func};const pe={public:{Icon:p,classes:"border-green-700/50 bg-green-900/30 text-green-200"},guild:{Icon:x,classes:"border-blue-700/50 bg-blue-900/30 text-blue-200"},private:{Icon:_,classes:"border-gray-700 bg-gray-800/60 text-gray-200"}},ge=[{value:"all",label:"All",Icon:null},{value:"private",label:"Private",Icon:_},{value:"guild",label:"Guild",Icon:x},{value:"public",label:"Public",Icon:p}],be=e=>{if(!e)return null;const s=e instanceof Date?e:new Date(e);return Number.isNaN(s.getTime())?null:Z(s,"MMM d, yyyy")};function fe({visibility:e}){const s=pe[e]||pe.private,{Icon:i}=s,a=e?e.charAt(0).toUpperCase()+e.slice(1):"Private";return t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs ${s.classes}`,children:[t.jsx(i,{className:"h-3 w-3"}),a]})}function ye({wishlist:e,accent:s="primary",onOpen:i,onShare:a,onDelete:r}){const n="info"===s?"border-blue-700/40 hover:border-blue-500":"border-gray-700/50 hover:border-(--theme-primary-color,#bb86fc)";return t.jsxs("div",{role:"button",tabIndex:0,"aria-label":`Open wishlist: ${e.name}`,onClick:()=>i(e),onKeyDown:s=>{"Enter"!==s.key&&" "!==s.key||(s.preventDefault(),i(e))},className:`\n        glass-card flex flex-col h-full p-4 cursor-pointer\n        transition-all duration-200\n        border ${n}\n        hover:-translate-y-1 hover:shadow-xl\n        focus:outline-hidden focu
1s:ring-2 focus:ring-(--theme-primary-color,#bb86fc) focus:ring-offset-2 focus:ring-offset-gray-900\n      `,children:[t.jsxs("div",{className:"flex-1",children:["info"===s?t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-blue-700/50 bg-blue-900/30 px-2 py-0.5 text-xs text-blue-200 mb-3",children:[t.jsx(x,{className:"h-3 w-3"}),"Guild"]}):t.jsx("div",{className:"mb-3",children:t.jsx(fe,{visibility:e.visibility})}),t.jsx("h3",{className:"text-base font-semibold text-gray-100 line-clamp-2 mb-1",children:e.name}),e.description&&t.jsx("p",{className:"text-sm text-gray-400 line-clamp-2 mb-3",children:e.description}),t.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-400 mb-3",children:[t.jsxs("span",{children:[e.itemCount||0," items"]}),e.viewCount>0&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-gray-600",children:"|"}),t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(J,{className:"h-3.5 w-3.5"}),e.viewCount]})]})]}),e.itemCount>0&&"info"!==s&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex justify-between mb-1",children:[t.jsx("span",{className:"text-xs text-gray-400",children:"Progress"}),t.jsxs("span",{className:"text-xs text-gray-400",children:[e.checkedCount||0," / ",e.itemCount," (",e.progressPercent||0,"%)"]})]}),t.jsx("div",{className:"h-1.5 rounded-full bg-[rgba(187,134,252,0.2)] overflow-hidden",children:t.jsx("div",{className:"h-full rounded-full bg-linear-to-r from-[#bb86fc] to-[#03dac6]",style:{width:`${e.progressPercent||0}%`}})})]}),t.jsxs("p",{className:"text-[11px] text-gray-500 mt-3",children:["info"===s?"Updated":"Created"," ",be("info"===s?e.updatedAt:e.createdAt)||"—"]})]}),t.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-700/40 flex items-center gap-1",children:[t.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),i(e)},className:"p-1.5 text-(--theme-primary-color,#bb86fc) hover:bg-gray-700/50 rounded transition-colors","aria-label":"View wishlist",title:"View",children:t.jsx(J,{className:"h-4 w-4"})}),"info"!==s&&a&&t.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),a(e)},className:"p-1.5 text-(--theme-primary-color,#bb86fc) hover:bg-gray-700/50 rounded transition-colors","aria-label":"Share wishlist",title:"Share",children:t.jsx(Y,{className:"h-4 w-4"})}),"info"!==s&&r&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex-1"}),t.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),r(e)},className:"p-1.5 text-red-400 hover:bg-red-900/20 hover:text-red-300 rounded transition-colors","aria-label":"Delete wishlist",title:"Delete",children:t.jsx(U,{className:"h-4 w-4"})})]})]})]})}function je({onWishlistSelect:s=null,onCreateNew:i=null,onShare:r=null,onClose:n=null}){const{selectedGuild:l}=a(),o=l?.id,[h,x]=e.useState([]),[p,g]=e.useState([]),[f,j]=e.useState(!0),[w,v]=e.useState(!1),[N,k]=e.useState(null),[S,E]=e.useState("all"),[W,$]=e.useState({isOpen:!1,wishlist:null}),[A,T]=e.useState(!1),F=e.useCallback(async()=>{j(!0),k(null);try{const e="all"!==S?{visibility:S}:{},s=await C.get("/api/housing/wishlists",{params:e});x(s.data.wishlists||[])}catch(e){console.error("[WishlistList] Error fetching wishlists:",e),k(m(e,"Failed to load wishlists"))}finally{j(!1)}},[S]);e.useEffect(()=>{F()},[F]);const D=e.useCallback(async()=>{if(o){v(!0);try{const e=await C.get(`/api/housing/guild/${o}/wishlists`);g(e.data.wishlists||[])}catch(e){403!==e.response?.status&&console.error("[WishlistList] Error fetching guild wishlists:",e),g([])}finally{v(!1)}}else g([])},[o]);e.useEffect(()=>{D()},[D]);const P=e=>{s&&s(e.id),n&&n()};return t.jsxs("div",{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5",children:[t.jsx("h2",{className:"text-xl sm:text-2xl font-semibold text-gray-100",children:"Your Wishlists"}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[t.jsx("button",{type:"button",onClick:F,disabled:f,className:"p-2 text-gray-400 hover:text-gray-200 hover:bg-gray-700/50 rounded-lg transition-colors disabled:opacity-50","aria-label":"Refresh",title:"Refresh",children:f?t.jsx(G,{className:"h-5 w-5 animate-spin"}):t.jsx(u,{className:"h-5 w-5"})}),i&&t.jsx(d,{variant:"primary",onClick:i,leftIcon:t.jsx(q,{className:"h-4 w-4"}),className:"bg-linear-to-r from-[#bb86fc] to-[#03dac6] hover:from-[#9a67ea] hover:to-[#02c4b0]",children:"New Wishlist"})]})]}),t.jsx("div",{className:"mb-5 rounded-lg border border-gray-700/50 bg-gray-800/40 overflow-x-auto",children:t.jsx("div",{className:"flex gap-1 p-1",role:"tablist",children:ge.map(({value:e,label:s,Icon:i})=>{const a=S===e;return t.jsxs("button",{role:"tab","aria-selected":a,type:"button",onClick:()=>E(e),className:`\n                  inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium whitespace-nowrap transition-colors\n                  ${a?"bg-(--theme-primary-color,#bb86fc)/15 text-(--theme-primary-color,#bb86fc)":"text-gray-400 hover:text-gray-200 hover:bg-gray-700/50"}\n                `,children:[i&&t.jsx(i,{className:"h-3.5 w-3.5"}),s]},e)})})}),N&&t.jsxs("div",{className:"mb-5 flex items-start gap-2 rounded-lg border border-red-700/50 bg-red-900/30 px-3 py-2 text-sm text-red-100",children:[t.jsx(c,{className:"h-4 w-4 shrink-0 mt-0.5"}),t.jsx("span",{className:"flex-1",children:N}),t.jsx("button",{type:"button",onClick:()=>k(null),className:"text-red-200 hover:text-white shrink-0","aria-label":"Dismiss error",children:t.jsx(b,{className:"h-4 w-4"})})]}),f&&0===h.length?t.jsx("div",{className:"flex items-center justify-center py-16",children:t.jsx(G,{className:"h-8 w-8 animate-spin text-gray-400"})}):t.jsx(t.Fragment,{children:0===h.length?t.jsxs("div",{className:"rounded-lg border border-dashed border-gray-700 px-8 py-16 text-center",children:[t.jsx(z,{className:"mx-auto h-16 w-16 text-gray-600 mb-4"}),t.jsx("h3",{className:"text-lg font-semibold text-gray-200 mb-1",children:"No wishlists yet"}),t.jsx("p",{className:"text-gray-400 mb-5",children:"all"===S?"Create your first wishlist to get started":`No ${S} wishlists found`}),i&&t.jsx(d,{variant:"primary",size:"lg",onClick:i,leftIcon:t.jsx(q,{className:"h-4 w-4"}),className:"bg-linear-to-r from-[#bb86fc] to-[#03dac6] hover:from-[#9a67ea] hover:to-[#02c4b0]",children:"Create Wishlist"})]}):t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4",children:Array.isArray(h)&&h.map(e=>t.jsx(ye,{wishlist:e,onOpen:P,onShare:r,onDelete:e=>$({isOpen:!0,wishlist:e})},e.id))})}),o&&p.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-8 h-px bg-gray-700/50"}),t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx(y,{className:"h-5 w-5 text-(--theme-primary-color,#bb86fc)"}),t.jsx("h2",{className:"text-lg font-semibold text-gray-100",children:"Guild Wishlists"}),t.jsx("span",{className:"inline-flex items-center justify-center min-w-[1.5rem] h-5 px-2 rounded-full bg-(--theme-primary-color,#bb86fc)/20 text-xs font-medium text-(--theme-primary-color,#bb86fc)",children:p.length}),w&&t.jsx(G,{className:"h-4 w-4 animate-spin text-gray-400"})]}),t.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Wishlists shared by other members of your guild"}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4",children:p.map(e=>t.jsx(ye,{wishlist:e,accent:"info",onOpen:P},e.id))})]}),t.jsx(R,{isOpen:W.isOpen,onClose:()=>!A&&$({isOpen:!1,wishlist:null}),title:"Delete Wishlist?",size:"sm",footer:t.jsxs(t.Fragment,{children:[t.jsx(d,{variant:"ghost",onClick:()=>$({isOpen:!1,wishlist:null}),disabled:A,children:"Cancel"}),t.jsx(d,{variant:"error",onClick:async()=>{const{wishlist:e}=W;if(e){T(!0);try{await C.delete(`/api/housing/wishlists/${e.id}`),I.success(`"${e.name}" deleted`),x(s=>s.filter(s=>s.id!==e.id))}catch(s){console.error("[WishlistList] Error deleting wishlist:",s),I.error(m(s,"Failed to delete wishlist"))}finally{T(!1),$({isOpen:!1,wishlist:null})}}},disabled:A,loading:A,children:A?"Deleting...":"Delete"})]}),children:t.jsxs("p",{className:"text-gray-300 leading-relaxed",children:["Are you sure you want to delete “",t.jsx("strong",{className:"text-gray-100",children:W.wishlist?.name}),"”? This action cannot be undone."]})})]})}ye.propTypes={wishlist:g.object.isRequired,accent:g.oneOf(["primary","info"]),onOpen:g.func.isRequired,onShare:g.func,onDelete:g.func}
1,je.propTypes={onWishlistSelect:g.func,onCreateNew:g.func,onShare:g.func,onClose:g.func};const we={crafted:{label:"Crafted",color:"#4CAF50"},vendor:{label:"Vendor",color:"#2196F3"},reputation:{label:"Reputation",color:"#9C27B0"},drop:{label:"Drop",color:"#FF9800"},quest:{label:"Quest",color:"#FFEB3B"},event:{label:"Event",color:"#E91E63"},unknown:{label:"Unknown",color:"#9E9E9E"}};function ve(){const{isAuthenticated:s,user:i}=a(),[o,c]=j(),{shareToken:d}=w(),[h,u]=e.useState(null),[x,p]=e.useState(null),[g,b]=e.useState(!1),[f,y]=e.useState(null),[T,F]=e.useState(new Set),[D,P]=e.useState(!1),[R,O]=e.useState(we),[L,M]=e.useState(new Set),H=e.useRef(new Map),q=e.useRef(h),U=e.useRef(i?.discordId);e.useEffect(()=>{q.current=h},[h]),e.useEffect(()=>{U.current=i?.discordId},[i?.discordId]);const[z,G]=e.useState(!0),[_,B]=e.useState(null),[Q,V]=e.useState(""),[J,K]=e.useState("all"),[X,Y]=e.useState("source"),[Z,ie]=e.useState({}),[ae,le]=e.useState(!1),[ce,me]=e.useState(!1),[he,ue]=e.useState(!1),[pe,ge]=e.useState(!1),{isConnected:be,onItemAdded:fe,onItemUpdated:ye,onItemRemoved:ve,onProgressUpdated:Ne,onEnrichmentComplete:ke,onWishlistUpdated:Ce,onItemAddedToWishlist:Ie,onItemRemovedFromWishlist:Se,joinWishlist:Ee}=function(s=!0,t=null){const{user:i,selectedGuild:r}=a(),[n,l]=e.useState(!1),[o,c]=e.useState(null),d=e.useRef(null),m=e.useRef({}),h=e.useRef(null),u=e.useRef(null),x=e.useCallback(e=>{m.current["housing:item-added"]=e},[]),p=e.useCallback(e=>{m.current["housing:item-updated"]=e},[]),g=e.useCallback(e=>{m.current["housing:item-removed"]=e},[]),b=e.useCallback(e=>{m.current["housing:progress-updated"]=e},[]),f=e.useCallback(e=>{m.current["housing:enrichment-complete"]=e},[]),y=e.useCallback(e=>{m.current["housing:wishlist-updated"]=e},[]),j=e.useCallback(e=>{m.current["housing:item-added-to-wishlist"]=e},[]),w=e.useCallback(e=>{m.current["housing:item-removed-from-wishlist"]=e},[]),v=e.useCallback(e=>{m.current.error=e},[]),N=e.useCallback(e=>{if(!d.current||!d.current.connected)return void console.warn("[HousingSocket] Cannot join wishlist - not connected");const s=i?.discordId,t=r?.id||"housing-main";s?(u.current&&u.current!==e&&d.current.emit("leave_wishlist",{userId:s,wishlistId:u.current}),d.current.emit("join_wishlist",{userId:s,username:i?.displayName||i?.username,guildId:t,wishlistId:e}),u.current=e,console.log(`[HousingSocket] Joining wishlist room: ${e}`)):console.warn("[HousingSocket] Cannot join wishlist - no user ID")},[i,r]),k=e.useCallback(()=>{if(!d.current||!d.current.connected)return;const e=i?.discordId;e&&u.current&&(d.current.emit("leave_wishlist",{userId:e,wishlistId:u.current}),u.current=null)},[i]);return e.useEffect(()=>{if(!s||!i?.discordId)return;const{discordId:e,displayName:a,username:n}=i;h.current=e;const o=r?.id||"housing-main",x=S("/housing",{path:"/housing/socket.io",transports:["websocket","polling"],withCredentials:!0,reconnection:!0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:5});return d.current=x,x.on("connect",()=>{console.log("[HousingSocket] Connected"),x.emit("join_housing",{userId:e,username:a||n,guildId:o}),t&&(x.emit("join_wishlist",{userId:e,username:a||n,guildId:o,wishlistId:t}),u.current=t),l(!0),c(null)}),x.on("disconnect",e=>{console.log("[HousingSocket] Disconnected:",e),l(!1)}),x.on("connect_error",e=>{console.error("[HousingSocket] Connection error:",e),l(!1),c(e.message)}),x.on("joined",e=>{console.log("[HousingSocket] Joined room:",e.room)}),x.on("joined_wishlist",e=>{console.log("[HousingSocket] Joined wishlist room:",e.wishlistId)}),x.on("left_wishlist",e=>{console.log("[HousingSocket] Left wishlist room:",e.wishlistId)}),x.on("error",e=>{console.error("[HousingSocket] Server error:",e),m.current.error?.(e)}),x.on("housing:item-added",e=>{console.log("[HousingSocket] Item added:",e),m.current["housing:item-added"]?.(e)}),x.on("housing:item-updated",e=>{console.log("[HousingSocket] Item updated:",e),m.current["housing:item-updated"]?.(e)}),x.on("housing:item-removed",e=>{console.log("[HousingSocket] Item removed:",e),m.current["housing:item-removed"]?.(e)}),x.on("housing:progress-updated",e=>{console.log("[HousingSocket] Progress updated:",e),m.current["housing:progress-updated"]?.(e)}),x.on("housing:enrichment-complete",e=>{console.log("[HousingSocket] Enrichment complete:",e),m.current["housing:enrichment-complete"]?.(e)}),x.on("housing:wishlist-updated",e=>{console.log("[HousingSocket] Wishlist updated:",e),m.current["housing:wishlist-updated"]?.(e)}),x.on("housing:item-added-to-wishlist",e=>{console.log("[HousingSocket] Item added to wishlist:",e),m.current["housing:item-added-to-wishlist"]?.(e)}),x.on("housing:item-removed-from-wishlist",e=>{console.log("[HousingSocket] Item removed from wishlist:",e),m.current["housing:item-removed-from-wishlist"]?.(e)}),x.on("heartbeat",()=>{}),()=>{d.current&&(u.current&&d.current.emit("leave_wishlist",{userId:h.current,wishlistId:u.current}),d.current.emit("leave_housing",{userId:h.current}),d.current.disconnect(),d.current=null),u.current=null}},[s,i?.discordId,i?.displayName,i?.username,r?.id,t]),e.useEffect(()=>{t&&n&&N(t)},[t,n,N]),{isConnected:n,connectionError:o,onItemAdded:x,onItemUpdated:p,onItemRemoved:g,onProgressUpdated:b,onEnrichmentComplete:f,onWishlistUpdated:y,onItemAddedToWishlist:j,onItemRemovedFromWishlist:w,onError:v,joinWishlist:N,leaveWishlist:k}}(s,h);e.useEffect(()=>{const e=d||o.get("shared");e&&We(e)},[d,o]);const We=e.useCallback(async e=>{try{G(!0),B(null),b(!0);const s=(await C.get(`/api/housing/shared/${e}`)).data;p(s),u(s.id),y({items:s.items||[],expansions:s.expansions||[],meta:{title:s.name,description:s.description,ownerName:s.ownerName},total:s.itemCount||0}),F(new Set),P(!1),s.sourceTypes&&O({...we,...s.sourceTypes})}catch(s){console.error("Failed to load shared wishlist:",s),B(m(s,"Invalid or expired share link"))}finally{G(!1)}},[]),$e=e.useCallback(async(e=null)=>{try{let s;if(G(!0),B(null),b(!1),e){const[t,i]=await Promise.all([C.get(`/api/housing/wishlists/${e}`),C.get("/api/housing/expansions").catch(()=>({data:[]}))]);s=t.data,p(s),u(e),y({items:s.items||[],expansions:s.expansions?.length>0?s.expansions:i.data||[],meta:{title:s.name,description:s.description},total:s.itemCount||0}),s.checkedItemIds?F(new Set(s.checkedItemIds)):F(new Set),P(s.isOwner||!1)}else{const e=await C.get("/api/housing/wishlist");if(s=e.data,p(null),u(null),y(s),s.checkedItemIds)F(new Set(s.checkedItemIds));else if(s.checkedItems){const e=s.checkedItems.map(e=>s.items[e]?.id).filter(e=>null!=e);F(new Set(e))}P(s.isAdmin||!1)}s.sourceTypes&&O({...we,...s.sourceTypes})}catch(s){console.error("Failed to load wishlist:",s),B(m(s,"Failed to load wishlist"))}finally{G(!1)}},[]);e.useEffect(()=>{s&&!o.get("shared")&&(async()=>{try{const e=(await C.get("/api/housing/wishlists")).data.wishlists||[];e.length>0?$e(e[0].id):$e()}catch(e){console.error("Failed to load wishlists:",e),$e()}})()},[s,$e,o]),e.useEffect(()=>{if(!be)return;const e=fe(e=>{y(s=>s?{...s,items:[...s.items,e.item],total:s.total+1}:s),I.success(`New item added: ${e.item.name}`)}),s=ye(e=>{y(s=>s&&Array.isArray(s.items)?{...s,items:s.items.map(s=>s.id===e.itemId?{...s,...e.updates}:s)}:s)}),t=ve(e=>{y(s=>s&&Array.isArray(s.items)?{...s,items:s.items.filter(s=>s.id!==e.itemId),total:s.total-1}:s),I.info(`Item removed: ${e.itemName}`)}),i=Ne(e=>
1{e.userId!==U.current&&console.log("[Housing] Progress updated by another user:",e)}),a=ke(e=>{y(s=>s&&Array.isArray(s.items)?{...s,items:s.items.map(s=>s.id===e.itemId?{...s,...e.enrichedData,enrichmentStatus:"success"}:s)}:s),M(s=>new Set(s).add(e.itemId)),H.current.has(e.itemId)&&clearTimeout(H.current.get(e.itemId));const s=setTimeout(()=>{M(s=>{const t=new Set(s);return t.delete(e.itemId),t}),H.current.delete(e.itemId)},1200);H.current.set(e.itemId,s),I.success(`Item enriched: ${e.enrichedData.profession||"Updated"}`)}),r=Ce(e=>{e.wishlistId===q.current&&(p(s=>({...s,...e.updates})),e.updates.name&&y(s=>({...s,meta:{...s?.meta,title:e.updates.name}})))}),n=Ie(e=>{const s=q.current;e.wishlistId===s&&$e(s)}),l=Se(e=>{e.wishlistId===q.current&&y(s=>s&&Array.isArray(s.items)?{...s,items:s.items.filter(s=>!e.itemIds.includes(s.id)),total:s.total-e.itemIds.length}:s)});return()=>{"function"==typeof e&&e(),"function"==typeof s&&s(),"function"==typeof t&&t(),"function"==typeof i&&i(),"function"==typeof a&&a(),"function"==typeof r&&r(),"function"==typeof n&&n(),"function"==typeof l&&l()}},[be,fe,ye,ve,Ne,ke,Ce,Ie,Se,$e]),e.useEffect(()=>()=>{H.current.forEach(e=>clearTimeout(e)),H.current.clear()},[]),e.useEffect(()=>{if(f&&window.$WowheadPower){const e=setTimeout(()=>{window.$WowheadPower.refreshLinks()},100);return()=>clearTimeout(e)}},[f,Q,J,Z]);const Ae=e.useCallback(e=>{o.get("shared")&&c({}),e?($e(e),Ee(e)):$e()},[$e,Ee,o,c]),Te=e.useCallback(e=>{Ae(e.id)},[Ae]),Fe=e.useCallback(async(e,s)=>{F(t=>{const i=new Set(t);return s?i.add(e):i.delete(e),i});try{h?await C.post(`/api/housing/wishlists/${h}/progress/${e}/toggle`,{checked:s}):await C.put(`/api/housing/wishlist/item/${e}/checked`,{checked:s})}catch(t){F(t=>{const i=new Set(t);return s?i.delete(e):i.add(e),i}),I.error("Failed to save progress")}},[h]),De=e.useCallback(async e=>{try{const s=await C.post("/api/housing/items",e);return I.success("Item added!"),le(!1),s.data}catch(s){throw console.error("Failed to add item:",s),409===s.response?.status?I.error("Item already exists"):I.error(m(s,"Failed to add item")),s}},[]),Pe=e.useCallback(async e=>{try{await C.delete(`/api/housing/items/id/${e}`),I.success("Item removed")}catch(s){throw console.error("Failed to delete item:",s),I.error(m(s,"Failed to delete item")),s}},[]),Re=e.useCallback(e=>{ie(s=>({...s,[e]:!s[e]}))},[]),Oe=e.useCallback(e=>{if(!f?.items)return[];const s={crafted:1,vendor:2,currency:3,reputation:4,quest:5,drop:6,treasure:7,event:8,endeavor:9,unknown:10};return f.items.map((e,s)=>({...e,originalIndex:s})).filter(s=>{if(s.expansion!==e)return!1;if("all"!==J&&s.source!==J)return!1;if(Q){const e=Q.toLowerCase();if(![s.name,s.profession,s.vendor,s.notes,s.cost,...(s.materials||[]).map(e=>e.name)].filter(Boolean).join(" ").toLowerCase().includes(e))return!1}return!0}).sort((e,t)=>{switch(X){case"source":const i=s[e.source]||99,a=s[t.source]||99;return i!==a?i-a:e.name.localeCompare(t.name);case"name":return e.name.localeCompare(t.name);case"unchecked":const r=T.has(e.id);if(r!==T.has(t.id))return r?1:-1;const n=s[e.source]||99,l=s[t.source]||99;return n!==l?n-l:e.name.localeCompare(t.name);default:return 0}})},[f,J,Q,X,T]),Le=e.useMemo(()=>{if(!f?.items)return{checked:0,total:0,percent:0};const e=f.items.length,s=T.size;return{checked:s,total:e,percent:e>0?Math.round(s/e*100):0}},[f,T]);if(e.useEffect(()=>{const e=e=>{"/"!==e.key||e.target.matches("input, textarea")||(e.preventDefault(),document.getElementById("housing-search-input")?.focus()),"Escape"===e.key&&(V(""),le(!1),me(!1),ue(!1),ge(!1))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),z)return t.jsxs("div",{className:"min-h-[80vh] flex flex-col items-center justify-center",children:[t.jsx(W,{size:"xl",color:"legendary"}),t.jsx("p",{className:"mt-4 text-gray-400 animate-pulse",children:"Loading wishlist..."})]});if(_)return t.jsx("div",{className:"max-w-4xl mx-auto py-8 px-4",children:t.jsxs(E,{className:"p-6",children:[t.jsxs("div",{className:"flex items-center gap-3 text-red-400 mb-4",children:[t.jsx(l,{className:"w-6 h-6"}),t.jsx("span",{className:"font-semibold",children:"Error Loading Wishlist"})]}),t.jsx("p",{className:"text-gray-300 mb-4",children:_}),t.jsx($,{onClick:()=>$e(),variant:"primary",children:"Retry"})]})});if(!s&&!g)return t.jsx("div",{className:"max-w-4xl mx-auto py-8 px-4",children:t.jsxs(E,{className:"p-6 text-center",children:[t.jsx(v,{className:"w-12 h-12 mx-auto text-wow-epic mb-4"}),t.jsx("h2",{className:"text-xl font-bold mb-2",children:"Housing Wishlist"}),t.jsx("p",{className:"text-gray-400",children:"Please log in to view the housing wishlist."})]})});const{meta:Me,expansions:He}=f||{};return t.jsxs("div",{className:"max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8 space-y-6",children:[t.jsxs(E,{className:"p-6 legendary-glow",children:[t.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[t.jsxs("div",{className:"flex items-start gap-4",children:[t.jsx("div",{className:"p-3 rounded-lg bg-linear-to-br from-orange-500/20 to-yellow-500/20 border border-orange-500/30",children:t.jsx(v,{className:"w-8 h-8 text-wow-legendary"})}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[t.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-white",children:Me?.title||"Housing Wishlist"}),D&&t.jsxs("span",{className:"px-2 py-1 text-xs font-semibold rounded-full bg-primary-20 text-primary-60 border border-primary-30",children:[t.jsx(ee,{className:"w-3 h-3 inline mr-1"}),"Admin"]})]}),g&&Me?.ownerName&&t.jsxs("div",{className:"flex items-center gap-1 mt-1 text-sm text-gray-400",children:[t.jsx(N,{className:"w-4 h-4"}),t.jsxs("span",{children:["Created by ",Me.ownerName]})]}),t.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[Me?.description||"Track your collection progress"," • Hover items for Wowhead tooltips"]})]})]}),s&&!g&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(oe,{currentWishlistId:h,onWishlistChange:Ae,onCreateNew:()=>me(!0),onManageWishlists:()=>ge(!0)}),x&&t.jsx("button",{onClick:()=>ue(!0),className:"p-2 rounded-lg bg-gray-800 hover:bg-gray-700 text-gray-300 hover:text-white transition-colors",title:"Share",children:t.jsx(se,{className:"w-5 h-5"})})]})]}),t.jsxs("div",{className:"mt-6",children:[t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("span",{className:"text-sm text-gray-400",children:"Overall Progress"}),t.jsxs("span",{className:"text-sm font-bold text-white",children:[Le.checked," / ",Le.total,t.jsxs("span",{className:"text-wow-legendary ml-2",children:["(",Le.percent,"%)"]})]})]}),t.jsxs("div",{className:"relative h-4 bg-gray-800 rounded-full overflow-hidden border border-gray-700",children:[t.jsx(r.div,{className:"absolute inset-y-0 left-0 bg-linear-to-r from-orange-500 via-yellow-500 to-orange-400",initial:{width:0},animate:{width:`${Le.percent}%`},transition:{duration:.8,ease:"easeOut"}}),t.jsx("div",{className:"absolute inset-0 bg-linear-to-r from-transparent via-white/10 to-transparent animate-shimmer"})]})]})]}),t.jsx(E,{className:"p-4",children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(k,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx("input",{id:"housing-search-input",type:"text",placeholder:"Search items... (Press / to focus)",value:Q,onChange:e=>V(e.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-gray-800 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-hidden focu
1s:border-wow-epic focus:ring-1 focus:ring-wow-epic transition-colors"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-gray-500 uppercase tracking-wide",children:"Sort:"}),t.jsx("div",{className:"flex gap-1",children:[{value:"source",label:"Source → Name"},{value:"name",label:"Name (A-Z)"},{value:"unchecked",label:"Unchecked First"}].map(e=>t.jsx("button",{onClick:()=>Y(e.value),className:"px-3 py-1.5 text-sm rounded-lg transition-all "+(X===e.value?"bg-wow-epic text-white":"bg-gray-800 text-gray-400 hover:text-white hover:bg-gray-700"),children:e.label},e.value))})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx("button",{onClick:()=>K("all"),className:"px-3 py-1.5 text-sm rounded-full border transition-all "+("all"===J?"bg-wow-epic border-wow-epic text-white":"bg-gray-800/50 border-gray-700 text-gray-400 hover:text-white hover:border-gray-600"),children:"All"}),Object.entries(R).map(([e,{label:s,color:i}])=>t.jsxs("button",{onClick:()=>K(e),className:"px-3 py-1.5 text-sm rounded-full border transition-all "+(J===e?"text-white":"bg-gray-800/50 text-gray-400 hover:text-white"),style:{borderColor:J===e?i:"transparent",backgroundColor:J===e?`${i}33`:void 0},children:[t.jsx("span",{className:"inline-block w-2 h-2 rounded-full mr-1.5",style:{backgroundColor:i}}),s]},e))]})]})}),D&&!h&&t.jsx(r.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},children:t.jsxs($,{onClick:()=>le(!0),variant:"legendary",className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-5 h-5"}),"Add Item"]})}),t.jsx("div",{className:"space-y-4",children:t.jsx(n,{mode:"wait",children:He?.map(e=>{const s=Oe(e.id);return 0===s.length?null:t.jsx(re,{expansion:e,items:s,sourceTypes:R,checkedItemIds:T,enrichedItems:L,onCheckItem:g?null:Fe,onDeleteItem:D&&!h?Pe:null,isCollapsed:Z[e.id],onToggle:()=>Re(e.id),isAdmin:D&&!h},e.id)})})}),He?.every(e=>0===Oe(e.id).length)&&t.jsx(A,{title:"No items found",description:Q?`No items match "${Q}"`:"No items in this wishlist yet"}),t.jsxs("div",{className:"text-center pt-8 border-t border-gray-800",children:[t.jsxs("p",{className:"text-sm text-gray-500",children:["Press ",t.jsx("kbd",{className:"px-2 py-0.5 bg-gray-800 rounded-sm text-gray-400 text-xs",children:"/"})," to search"," • ",t.jsx("kbd",{className:"px-2 py-0.5 bg-gray-800 rounded-sm text-gray-400 text-xs",children:"Esc"})," to clear"]}),Me?.lastUpdated&&t.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["Last updated: ",Me.lastUpdated.split("T")[0]]})]}),t.jsx(ne,{open:ae,onClose:()=>le(!1),onAdd:De,expansions:He||[],sourceTypes:R}),t.jsx(de,{isOpen:ce,onClose:()=>me(!1),onWishlistCreated:Te}),t.jsx(xe,{wishlist:x,isOpen:he,onClose:()=>ue(!1),onVisibilityChange:(e,s)=>{p(t=>({...t,visibility:e,...s}))}}),t.jsx(n,{children:pe&&t.jsxs(t.Fragment,{children:[t.jsx(r.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},onClick:()=>ge(!1),className:"fixed inset-0 bg-black/50 z-40"}),t.jsx(r.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:200},className:"fixed right-0 top-0 h-full w-full sm:w-[500px] md:w-[600px] bg-gray-900 border-l border-gray-800 z-50 overflow-y-auto",children:t.jsxs("div",{className:"p-6",children:[t.jsxs("div",{className:"flex items-center justify-between mb-6",children:[t.jsx("h2",{className:"text-xl font-bold text-white",children:"Manage Wishlists"}),t.jsx("button",{onClick:()=>ge(!1),className:"p-2 rounded-lg hover:bg-gray-800 text-gray-400 hover:text-white transition-colors",children:t.jsx(l,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"border-t border-gray-800 pt-6",children:t.jsx(je,{onWishlistSelect:e=>{Ae(e),ge(!1)},onCreateNew:()=>{ge(!1),me(!0)},onShare:e=>{p(e),ge(!1),ue(!0)},onClose:()=>ge(!1)})})]})})]})})]})}export{ve as default};

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.