1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5682],{17158:function(e,t,r){r.d(t,{Z:function(){return a}});/** 2 * @license lucide-react v0.294.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */let a=(0,r(62898).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},38438:function(e,t,r){r.d(t,{Z:function(){return a}});/** 7 * @license lucide-react v0.294.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */let a=(0,r(62898).Z)("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])},41827:function(e,t,r){r.d(t,{Z:function(){return a}});/** 12 * @license lucide-react v0.294.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */let a=(0,r(62898).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},45367:function(e,t,r){r.d(t,{Z:function(){return a}});/** 17 * @license lucide-react v0.294.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */let a=(0,r(62898).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},31541:function(e,t,r){r.d(t,{Z:function(){return a}});/** 22 * @license lucide-react v0.294.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */let a=(0,r(62898).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},38339:function(e,t,r){r.d(t,{Z:function(){return a}});/** 27 * @license lucide-react v0.294.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */let a=(0,r(62898).Z)("Video",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]])},91959:function(e,t,r){r.d(t,{W:function(){return c}});var a=r(57437),l=r(1312),n=r(2265),i=r(96142),s=r(41827),o=r(45922);function c(e){let{value:t,onChange:r,onLocationSelect:c,placeholder:d="Search for a location..."}=e,[u,h]=(0,n.useState)(!1),[m,g]=(0,n.useState)([]),[f,x]=(0,n.useState)(!1),[p,y]=(0,n.useState)(null),b=(0,n.useRef)(null);(0,n.useEffect)(()=>{function e(e){b.current&&!b.current.contains(e.target)&&h(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,n.useEffect)(()=>{let e=setTimeout(async()=>{if(!t||t.length<2){g([]);return}x(!0);try{let e=(0,o.getBrowserSupabase)(),{data:r,error:a}=await e.from("locations").select("id, name, slug, country, city, latitude, longitude").or("name.ilike.%".concat(t,"%,city.ilike.%").concat(t,"%,country.ilike.%").concat(t,"%")).limit(10);if(a)throw a;g(r||[]),h(!0)}catch(e){console.error("Error searching locations:",e),g([])}finally{x(!1)}},300);return()=>clearTimeout(e)},[t]);let v=e=>{y(e),r(e.name),null==c||c(e),h(!1)};return(0,a.jsxs)("div",{ref:b,className:"relative",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"text",value:t,onChange:e=>{r(e.target.value),y(null)},onFocus:()=>t.length>=2&&h(!0),placeholder:d,className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-rausch-500 focus:border-transparent"}),(0,a.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 flex items-center justify-center",children:f?(0,a.jsx)(l.ModernLoader,{size:20,className:"text-gray-400"}):p?(0,a.jsx)(i.Z,{className:"h-4 w-4 text-green-600"}):(0,a.jsx)(s.Z,{className:"h-4 w-4 text-gray-400"})})]}),u&&m.length>0&&(0,a.jsx)("div",{className:"absolute z-10 w-full mt-1 bg-white border border-gray-200 rounded-lg shadow-lg max-h-60 overflow-y-auto",children:m.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>v(e),className:"w-full px-4 py-3 text-left hover:bg-gray-50 transition-colors border-b border-gray-100 last:border-b-0",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 text-rausch-500 flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-gray-900 truncate",children:e.name}),(0,a.jsxs)("p",{className:"text-xs text-gray-500 truncate",children:[e.city?"".concat(e.city,", "):"",e.country]})]})]})},e.id))}),u&&!f&&t.length>=2&&0===m.length&&(0,a.jsxs)("div",{className:"absolute z-10 w-full mt-1 bg-white border border-gray-200 rounded-lg shadow-lg p-4 text-center",children:[(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"No locations foun
31d"}),(0,a.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Try a different search term"})]}),p&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-xs text-green-600",children:[(0,a.jsx)(i.Z,{className:"h-3 w-3"}),(0,a.jsxs)("span",{children:["Linked to ",(0,a.jsx)("a",{href:"/locations/".concat(p.slug),target:"_blank",className:"underline hover:text-green-700",children:p.name})]})]})]})}},45682:function(e,t,r){r.r(t),r.d(t,{UploadModal:function(){return k}});var a=r(57437),l=r(1312),n=r(2265),i=r(38438),s=r(38339),o=r(96142),c=r(31541),d=r(82549),u=r(45367),h=r(79313),m=r(5925),g=r(91959),f=r(81291),x=r(17158),p=r(9883);async function y(e){return new Promise((t,r)=>{let a=new Image,l=new FileReader;l.onload=e=>{var t;a.src=null===(t=e.target)||void 0===t?void 0:t.result},a.onload=async()=>{try{let r=a.width,l=a.height;if(r>1920||l>1080){let e=Math.min(1920/r,1080/l);r=Math.floor(r*e),l=Math.floor(l*e)}let n=document.createElement("canvas"),i=n.getContext("2d");n.width=20,n.height=20,i.drawImage(a,0,0,20,20);let s=await b(n,.3);n.width=Math.floor(.25*r),n.height=Math.floor(.25*l),i.drawImage(a,0,0,n.width,n.height);let o=await b(n,.5);n.width=Math.floor(.5*r),n.height=Math.floor(.5*l),i.drawImage(a,0,0,n.width,n.height);let c=await b(n,.7);n.width=r,n.height=l,i.drawImage(a,0,0,r,l);let d=await b(n,.85);t({thumbnail:s,low:o,medium:c,high:d,original:e})}catch(e){r(e)}},a.onerror=r,l.readAsDataURL(e)})}function b(e,t){return new Promise((r,a)=>{e.toBlob(e=>{e?r(e):a(Error("Failed to create blob"))},"image/jpeg",t)})}function v(e){let{maxImages:t=10,onImagesChange:r}
31=e,[i,s]=(0,n.useState)([]),[o,u]=(0,n.useState)(0),h=(0,n.useRef)(null),g=async e=>{let a=Array.from(e.target.files||[]);if(i.length+a.length>t){m.default.error("Maximum ".concat(t," images allowed"));return}let l=a.filter(e=>e.type.startsWith("image/")?!(e.size>52428800)||(m.default.error("".concat(e.name," is too large (max 50MB)")),!1):(m.default.error("".concat(e.name," is not an image")),!1)),n=await Promise.all(l.map(async e=>{let t=Math.random().toString(36).substring(7),r=URL.createObjectURL(e);return{id:t,file:e,preview:r,isProcessing:!0}}));for(let e of(s(e=>[...e,...n]),r([...i.map(e=>e.file),...l]),n))try{let t=await y(e.file),r=await function(e){return new Promise((t,r)=>{let a=new FileReader;a.onloadend=()=>t(a.result),a.onerror=r,a.readAsDataURL(e)})}(t.thumbnail);s(t=>t.map(t=>t.id===e.id?{...t,blurDataURL:r,isProcessing:!1}:t))}catch(t){console.error("Error processing image:",t),s(t=>t.map(t=>t.id===e.id?{...t,isProcessing:!1}:t))}h.current&&(h.current.value="")},b=e=>{s(t=>{let a=t.find(t=>t.id===e);if(a)try{URL.revokeObjectURL(a.preview)}catch(e){}let l=t.filter(t=>t.id!==e);return r(l.map(e=>e.file)),o>=l.length&&l.length>0&&u(l.length-1),l})};return(0,n.useEffect)(()=>()=>{i.forEach(e=>{try{URL.revokeObjectURL(e.preview)}catch(e){}})},[]),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("input",{ref:h,type:"file",accept:"image/*",multiple:!0,onChange:g,className:"hidden"}),0===i.length?(0,a.jsxs)("button",{onClick:()=>{var e;return null===(e=h.current)||void 0===e?void 0:e.click()},className:"w-full h-64 border-2 border-dashed border-gray-300 rounded-lg hover:border-rausch-500 hover:bg-rausch-50/50 transition-colors flex flex-col items-center justify-center gap-3",children:[(0,a.jsx)(c.Z,{className:"h-12 w-12 text-gray-400"}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Click to upload images"}),(0,a.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:["PNG, JPG up to 10MB ⢠Max ",t," images"]})]})]}):(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("div",{className:"relative h-64 rounded-lg overflow-hidden bg-gray-100",children:[(0,a.jsx)("img",{src:i[o].preview,alt:"Upload ".concat(o+1),className:"w-full h-full object-cover",style:{filter:i[o].isProcessing?"blur(10px)":"none",transition:"filter 0.3s ease"}}),i[o].isProcessing&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20",children:(0,a.jsx)("div",{className:"bg-white rounded-full px-4 py-2 text-sm font-medium",children:"Processing..."})}),(0,a.jsx)("button",{onClick:()=>b(i[o].id),className:"absolute top-2 right-2 p-2 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:(0,a.jsx)(d.Z,{className:"h-4 w-4 text-white"})}),i.length>1&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{onClick:()=>{u(e=>(e-1+i.length)%i.length)},className:"absolute left-2 top-1/2 -translate-y-1/2 p-2 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:(0,a.jsx)(f.Z,{className:"h-5 w-5 text-white"})}),(0,a.jsx)("button",{onClick:()=>{u(e=>(e+1)%i.length)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-2 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:(0,a.jsx)(x.Z,{className:"h-5 w-5 text-white"})})]}),(0,a.jsxs)("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 bg-black/50 text-white px-3 py-1 rounded-full text-xs font-medium",children:[o+1," / ",i.length]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-3 overflow-x-auto pb-2",children:[i.map((e,t)=>(0,a.jsxs)("button",{onClick:()=>u(t),className:"relative flex-shrink-0 w-16 h-16 rounded-lg overflow-hidden border-2 transition-all ".concat(t===o?"border-rausch-500 ring-2 ring-rausch-200":"border-gray-300 hover:border-gray-400"),children:[(0,a.jsx)("img",{src:e.preview,alt:"Thumbnail ".concat(t+1),className:"w-full h-full object-cover"}),e.isProcessing&&(0,a.jsx)("div",{className:"absolute inset-0 bg-black/20 flex items-center justify-center",children:(0,a.jsx)(l.ModernLoader,{size:20,tone:"light"})})]},e.id)),i.length<t&&(0,a.jsx)("button",{onClick:()=>{var e;return null===(e=h.current)||void 0===e?void 0:e.click()},className:"flex-shrink-0 w-16 h-16 rounded-lg border-2 border-dashed border-gray-300 hover:border-rausch-500 hover:bg-rausch-50 transition-colors flex items-center justify-center",children:(0,a.jsx)(p.Z,{className:"h-6 w-6 text-gray-400"})})]})]}),i.length>0&&(0,a.jsxs)("p",{className:"text-xs text-gray-500 text-center",children:[i.length," ",1===i.length?"image":"images"," selected",i.length<t&&" ⢠".concat(t-i.length," more allowed")]})]})}r(51328).lW,document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp");var w=r(45922),j=r(84171),N=r(26488);function k(e){let{isOpen:t,onClose:r,uploadType:f,onUploadSuccess:x,activityId:p}
31=e,[y,b]=(0,n.useState)(""),[k,M]=(0,n.useState)(""),[z,L]=(0,n.useState)(null),[E,S]=(0,n.useState)(null),[U,C]=(0,n.useState)([]),[Z,P]=(0,n.useState)(null),[R,B]=(0,n.useState)(null),[F,O]=(0,n.useState)(!1),[_,I]=(0,n.useState)(0),[T,D]=(0,n.useState)(!1),W=(0,n.useRef)(null);if(!t)return null;let H=async()=>{if("post"!==f&&"location"!==f&&0===U.length&&!Z){m.default.error("Please select a file to upload");return}if(!y.trim()){m.default.error("Please add a caption");return}O(!0);try{let e=(0,w.getBrowserSupabase)(),{data:{user:t},error:a}=await e.auth.getUser();if(a||!t){m.default.error("You must be signed in to upload");return}let l=[],n=U.length>0?U:Z?[Z]:[];if(n.length>0&&("photo"===f||"video"===f)){let e=n.length;if("photo"===f){if(l=(await (0,j.OM)(n,{bucket:"trip-images",userId:t.id,folder:"feed/photos",maxSizeMB:50,optimize:!0,optimizeOptions:{maxWidth:2560,maxHeight:1440,quality:.85}},t=>I(Math.round(t/e*100)))).filter(e=>e.success&&e.url).map(e=>e.url),0===l.length)throw Error("All uploads failed")}else"video"===f&&(l=(await (0,N.N1)(n,{namespace:"trip-images",folder:"feed/videos"},t=>I(Math.round(t/e*100)))).map(e=>e.url))}let{error:i}=await e.from("activity_feed").insert({user_id:t.id,type:"photo"===f?"photo_upload":"video"===f?"video_upload":"post",data:{caption:y.trim(),image_url:l[0]||null,images:l,location:k.trim()||null,location_id:z,location_coordinates:E?{lat:E.lat,lng:E.lng}:null}});if(i)throw i;m.default.success("Upload successful!"),null==x||x(),r(),b(""),M(""),L(null),P(null),C([]),B(null),I(0)}catch(t){console.error("Upload error:",t);let e=t instanceof Error?t.message:"";e.includes("exceeded the maximum allowed size")||e.includes("too large")?m.default.error("File too large. Maximum file size is 50MB."):m.default.error("Upload failed. Please try again.")}finally{O(!1),I(0)}},q=async()=>{if(p)try{D(!0);let e=await fetch("/api/activities/".concat(p),{method:"DELETE",credentials:"include"});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"Delete failed")}m.default.success("Post deleted successfully!"),null==x||x(),r()}catch(e){console.error("Delete error:",e),m.default.error("Failed to delete post")}finally{D(!1)}},A=(()=>{switch(f){case"photo":return i.Z;case"video":return s.Z;case"location":return o.Z;case"post":return c.Z}})();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50 z-50 animate-in fade-in duration-200",onClick:r}),(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:(0,a.jsxs)("div",{className:"w-full max-w-lg pointer-events-auto animate-in zoom-in-95 duration-200 bg-white rounded-xl shadow-2xl border border-gray-200 transform origin-top scale-[0.85]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-full bg-rausch-50",children:(0,a.jsx)(A,{className:"h-5 w-5 text-rausch-600"})}),(0,a.jsx)("h2",{className:"text-xl font-bold text-gray-900",children:(()=>{switch(f){case"photo":return"Upload Photo";case"video":return"Upload Video";case"location":return"Share Location";case"post":return"Create Post"}})()})]}),(0,a.jsx)("button",{onClick:r,className:"p-2 hover:bg-gray-100 rounded-full transition-colors",children:(0,a.jsx)(d.Z,{className:"h-5 w-5 text-gray-500"})})]}),(0,a.jsxs)("div",{className:"p-6 space-y-4",children:["photo"===f&&(0,a.jsx)(v,{maxImages:10,onImagesChange:C}),"video"===f&&(0,a.jsxs)("div",{children:[(0,a.jsx)("input",{ref:W,type:"file",accept:"video/*",onChange:e=>{var t;let r=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!r)return;if("photo"===f&&!r.type.startsWith("image/")){m.default.error("Please select an image file");return}if("video"===f&&!r.type.startsWith("video/")){m.default.error("Please select a video file");return}if(r.size>52428800){m.default.error("File size must be less than 50MB");return}P(r);let a=new FileReader;a.onloadend=()=>{B(a.result)},a.readAsDataURL(r)},className:"hidden"}),R?(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("video",{src:R,controls:!0,playsInl
31ine:!0,preload:"metadata",className:"w-full h-64 rounded-lg bg-black"}),(0,a.jsx)("button",{onClick:()=>{P(null),B(null)},className:"absolute top-2 right-2 p-2 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:(0,a.jsx)(d.Z,{className:"h-4 w-4 text-white"})})]}):(0,a.jsxs)("button",{onClick:()=>{var e;return null===(e=W.current)||void 0===e?void 0:e.click()},className:"w-full h-64 border-2 border-dashed border-gray-300 rounded-lg hover:border-rausch-500 hover:bg-rausch-50/50 transition-colors flex flex-col items-center justify-center gap-3",children:[(0,a.jsx)(c.Z,{className:"h-12 w-12 text-gray-400"}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Click to upload video"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"MP4, MOV up to 50MB"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Caption"}),(0,a.jsx)("textarea",{value:y,onChange:e=>b(e.target.value),placeholder:"Write a caption...",rows:3,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-rausch-500 focus:border-transparent resize-none"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Location (optional)"}),(0,a.jsx)(g.W,{value:k,onChange:e=>{M(e),e||(L(null),S(null))},onLocationSelect:e=>{L(e.id),null!=e.latitude&&null!=e.longitude&&S({lat:Number(e.latitude),lng:Number(e.longitude)})},placeholder:"Search for a location..."})]})]}),F&&_>0&&(0,a.jsxs)("div",{className:"px-6 pb-4",children:[(0,a.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2 overflow-hidden",children:(0,a.jsx)("div",{className:"bg-rausch-500 h-full transition-all duration-300 ease-out",style:{width:"".concat(_,"%")}})}),(0,a.jsxs)("p",{className:"text-xs text-gray-500 mt-1 text-center",children:["Uploading... ",_,"%"]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 p-6 border-t border-gray-200",children:[(0,a.jsx)("div",{children:p&&(0,a.jsx)(h.z,{variant:"outline",onClick:q,disabled:T||F,className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:T?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.ModernLoader,{size:20,className:"mr-2"}),"Deleting..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Z,{className:"h-4 w-4 mr-2"}),"Delete"]})})}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(h.z,{variant:"outline",onClick:r,disabled:F||T,children:"Cancel"}),(0,a.jsx)(h.z,{onClick:H,disabled:F||T||0===U.length&&!Z&&"post"!==f&&"location"!==f,className:"bg-rausch-500 hover:bg-rausch-600",children:F?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.ModernLoader,{size:20,className:"mr-2"}),"Uploading..."]}):p?"Update":"Upload"})]})]})]})})]})}},1312:function(e,t,r){r.r(t),r.d(t,{ModernLoader:function(){return o},ModernPageLoading:function(){return c},ModernSkeleton:function(){return s}});var a=r(57437),l=r(2265),n=r(52818),i=r(1657);function s(e){let{className:t,dark:r=!1}=e;return(0,a.jsx)("div",{"aria-hidden":"true",className:(0,i.cn)(r?"tb-skeleton-dark":"tb-skeleton","rounded-2xl",t)})}function o(e){let{label:t,className:r,tone:s="ink",size:o=64,state:c="working",paused:d=!1,variant:u="orb"}=e,[h,m]=(0,l.useState)(!0);(0,l.useEffect)(()=>{if("route"!==u)return;let e=window.matchMedia("(prefers-reduced-motion: reduce)"),t=()=>m(e.matches||document.hidden);return t(),e.addEventListener("change",t),document.addEventListener("visibilitychange",t),()=>{e.removeEventListener("change",t),document.removeEventListener("visibilitychange",t)}},[u]);let g=d||h?"paused":"running",f="light"===s?"#fff":"#0b1f2a";return(0,a.jsxs)(20===o?"span":"div",{role:"status","aria-live":"polite",className:(0,i.cn)(20===o?"inline-flex":"flex","flex-col items-center shrink-0",r),children:["route"===u?(0,a.jsxs)("span",{className:"relative block h-11 w-[132px]","aria-hidden":"true",children:[(0,a.jsxs)("svg",{viewBox:"0 0 132 44",width:"132",height:"44",fill:"none",children:[(0,a.jsx)("path",{d:"M6 34 C 26 4, 52 4, 72 24 S 108 40, 126 10",stroke:f,strokeOpacity:"0.22",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:"1 9",className:"tb-route-line",style:{animationPlayState:g}}),(0,a.jsx)("circle",{cx:"6",cy:"34",r:"4",fill:f,opacity:"0.5"}),(0,a.jsx)("circle",{cx:"126",cy:"10",r:"4",fill:f,opacity:"0.5"})]}),(0,a.jsx)("span",{className:"tb-route-dot absolute left-0 top-0 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 roun
31ded-full bg-[#12c2d9] shadow-[0_0_16px_rgba(18,194,217,0.25)]",style:{animationPlayState:g}})]}):(0,a.jsx)(n.ld,{size:o,state:c,paused:d,theme:"light"===s?"dark":"light","aria-hidden":"true"}),t?(0,a.jsx)(20===o?"span":"p",{className:(0,i.cn)(20===o?"mt-1":"mt-4","text-sm font-semibold","light"===s?"text-white/80":"text-[#0b1f2a]/65"),children:t}):(0,a.jsx)("span",{className:"sr-only",children:"Loading"})]})}function c(e){let{message:t="Loadingâ¦",fullScreen:r=!0}=e;return(0,a.jsx)("div",{className:(0,i.cn)("flex items-center justify-center bg-[#f4f1ea] px-6",r?"min-h-screen":"min-h-[50vh]"),children:(0,a.jsx)(o,{variant:"route",label:t})})}},84171:function(e,t,r){r.d(t,{Hg:function(){return d},Ix:function(){return i},OM:function(){return s},qg:function(){return c},vY:function(){return o}});var a=r(26488);let l=["image/jpeg","image/jpg","image/png","image/webp","image/gif"];async function n(e){return new Promise((t,r)=>{let a=new Image,l=URL.createObjectURL(e);a.onload=()=>{URL.revokeObjectURL(l),t({width:a.width,height:a.height})},a.onerror=()=>{URL.revokeObjectURL(l),r(Error("Failed to load image for dimension check"))},a.src=l})}async function i(e,t){try{let o;let c=t.maxSizeMB||5,u=t.allowedTypes||l,h=t.folder||"uploads",m=function(e,t,r){if(!e||0===e.size)return{valid:!1,error:"File is empty or corrupted"};let a=1048576*t;return e.size>a?{valid:!1,error:"File size (".concat((e.size/1024/1024).toFixed(2),"MB) exceeds ").concat(t,"MB limit")}:r.includes(e.type)?{valid:!0}:{valid:!1,error:"Invalid file type (".concat(e.type,"). Allowed types: ").concat(r.join(", "))}}(e,c,u);if(!m.valid)return{success:!1,error:m.error};let g=e;if(t.optimize)try{var r,i,s;g=await d(e,null===(r=t.optimizeOptions)||void 0===r?void 0:r.maxWidth,null===(i=t.optimizeOptions)||void 0===i?void 0:i.maxHeight,null===(s=t.optimizeOptions)||void 0===s?void 0:s.quality)}catch(e){console.warn("â ï¸ Image optimization failed, using original:",e)}try{o=await n(g)}catch(e){console.warn("â ï¸ Could not get image dimensions:",e)}let f=await (0,a.NH)(g,{namespace:t.bucket,folder:h});return{success:!0,url:f.url,path:f.path,storageBucket:f.storageBucket,size:g.size,dimensions:o}}catch(e){return console.error("â Unexpected upload error:",e),{success:!1,error:e instanceof Error?e.message:"Upload failed unexpectedly"}}}async function s(e,t,r){let a=[];for(let l=0;l<e.length;l++){let n=await i(e[l],t);a.push(n),r&&r(l+1,e.length)}return a}async function o(e,t){return i(e,{bucket:"profile-avatars",userId:t,folder:"avatars",maxSizeMB:2,optimize:!0,optimizeOptions:{maxWidth:512,maxHeight:512,quality:.9}})}async function c(e,t,r){return i(e,{bucket:"location-images",userId:t,folder:r,maxSizeMB:5,optimize:!0,optimizeOptions:{maxWidth:1920,maxHeight:1080,quality:.85}})}async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1920,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1080,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.85;return HTMLCanvasElement.prototype.toBlob?new Promise((l,n)=>{let i=new FileReader;i.onload=i=>{var s;let o=new Image;o.onload=()=>{try{let i=document.createElement("canvas"),s=o.width,c=o.height;if(s<=t&&c<=r&&e.size<512e3){l(e);return}let d=s/c;(s>t||c>r)&&(d>t/r?(s=t,c=Math.round(t/d)):(c=r,s=Math.round(r*d))),i.width=s,i.height=c;let u=i.getContext("2d");if(!u){n(Error("Failed to get canvas context"));return}u.imageSmoothingEnabled=!0,u.imageSmoothingQuality="high",u.drawImage(o,0,0,s,c),i.toBlob(t=>{if(!t){n(Error("Failed to create blob"));return}let r=new File([t],e.name,{type:"image/jpeg",lastModified:Date.now()});l(r)},"image/jpeg",a)}catch(e){n(e)}},o.onerror=()=>n(Error("Failed to load image")),o.src=null===(s=i.target)||void 0===s?void 0:s.result},i.onerror=()=>n(Error("Failed to read file")),i.readAsDataURL(e)}):(console.warn("Browser does not support canvas.toBlob, returning original file"),e)}},26488:function(e,t,r){async function a(e,t){let r=await fetch("/api/storage/signed-upload",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({bucket:t.namespace,folder:t.folder||"uploads",fileName:e.name,contentType:e.type,fileSize:e.size})}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.error||"Failed to create upload URL");let l=await fetch(a.uploadUrl,{method:"PUT",headers:{"Content-Type":e.type},body:e});if(!l.ok)throw Error("Upload failed with status ".concat(l.status));return{url:a.url,path:a.path,storageBucket:a.storageBucket,size:e.size,contentType:e.type,name:e.name}}async function l(e,t,r){let l=[];for(let n of e)l.push(await a(n,t)),null==r||r(l.length,e.length);return l}async function n(e,t){let r=await fetch("/api/storage/delete",{method:"DELETE",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({bucket:e,paths:t})}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.error||"Delete failed")}r.d(t,{N1:function(){return l},NH:function(){return a},nZ:function(){return n}}),r(68571).env.NEXT_PUBLIC_R2_MEDIA_BASE_URL}}]);
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.