1"use strict";(globalThis.webpackChunkui_js_core||=[]).push([[3052],{82708(e,a,t){t.d(a,{YourCacheNotesFeed:()=>YourCacheNotesFeed});var s=t(96540),o=t(20140),n=t(79025),c=t(40123);const i={hideFound:!1,hideUnavailable:!0},r="gc.dashboard.yourCacheNotes.filters",readFilters=()=>{try{const e=window.localStorage?.getItem(r);if(!e)return i;const a=JSON.parse(e);return{hideFound:"boolean"==typeof a?.hideFound?a.hideFound:i.hideFound,hideUnavailable:"boolean"==typeof a?.hideUnavailable?a.hideUnavailable:i.hideUnavailable}}catch{return i}};var l=t(43427),d=t(64764),h=t(78832),u=t(95466);const buildYourCacheNotesUrl=({take:e=5}={})=>{const a=new URLSearchParams({take:String(e)});return`${u.i}/geocaches/account/${window.App?.Settings?.get?.("user:info")?.referenceCode}/cachenotes/recent?${a.toString()}`},p={buildUrl:buildYourCacheNotesUrl,async fetchRecent({take:e=5,signal:a}={}){const t=await fetch(buildYourCacheNotesUrl({take:e}),{method:"GET",credentials:"same-origin",signal:a});if(!t.ok)throw new Error(`YourCacheNotes request failed with status ${t.status}`);return t.json()}};var g=t(85849),y=t(49586),m=t(45183);const f=(0,m.tv)({slots:{base:"bg-white rounded-lg flex gap-2 items-start w-full",iconContainer:"shrink-0",cacheIcon:"w-full h-full",body:"flex flex-col min-w-0 grow",geocacheLink:"font-bold text-blue-600 no-underline hover:underline focus:shadow-outline truncate",referenceCode:"text-gray-500 text-sm",noteText:"text-gray-700 break-words whitespace-pre-line",updated:"text-gray-500 text-sm",srOnly:"sr-only"},variants:{useCompactLayout:{true:{base:"px-3 py-1 gap-2",noteText:"text-sm mt-0.5",updated:"text-xs"},false:{base:"px-3 py-2 gap-3",noteText:"mt-1",updated:"mt-1"}},visuallyDisabled:{true:{geocacheLink:"line-through",cacheIcon:"opacity-60"}}},defaultVariants:{useCompactLayout:!1,visuallyDisabled:!1}});var x=t(74848);const YourCacheNotesFeedItem=({geocacheTypeLabels:e={},i18n:a={},item:t,useCompactLayout:o=!1})=>{const n=t.data?.geocache??{},c=!1===n.isAvailable||!1===n.isPublished,i=f({useCompactLayout:o,visuallyDisabled:c}),r=(0,s.useMemo)((()=>(e=>{const a=(e??"").trim();return a.length>240?`${a.slice(0,240).trimEnd()}â¦`:a})(t.data?.noteText)),[t.data?.noteText]),l=n.name??n.geocacheReferenceCode??"",d=t.links?.self??`/geocache/${n.geocacheReferenceCode??""}`,h=(0,x.jsx)(g.Z,{icons:{primary:{href:`/app/ui-icons/sprites/cache-types.svg#icon-${n.cacheTypeId}${c?"-disabled":""}`,ariaLabel:e[n.cacheTypeId??""]??"",className:i.cacheIcon()},secondary:n.isFound?{href:"/app/ui-icons/sprites/log-types.svg#icon-2"}:void 0},size:o?"small":"large"}),u=(a.NoteForFormat??"Your note for {0}").replace("{0}",l);return(0,x.jsxs)("div",{className:i.base(),"data-referencecode":n.geocacheReferenceCode,children:[(0,x.jsx)("div",{className:i.iconContainer(),children:h}),(0,x.jsxs)("div",{className:i.body(),children:[(0,x.jsx)("a",{className:i.geocacheLink(),href:d,children:l}),(0,x.jsx)("span",{className:i.referenceCode(),children:n.geocacheReferenceCode}),(0,x.jsxs)("p",{className:i.noteText(),children:[(0,x.jsx)("span",{className:i.srOnly(),children:u}),r]}),t.data?.dateTimeUpdatedUtc&&(0,x.jsx)("span",{className:i.updated(),children:(a.UpdatedFormat??"Updated {0}").replace("{0}",(0,y.po)(t.data.dateTimeUpdatedUtc))})]})]})};YourCacheNotesFeedItem.displayName="YourCacheNotesFeedItem";const b=(0,m.tv)({slots:{base:"max-w-full min-w-0",loading:"px-3",emptyState:"px-3 text-center text-gray-500",notesList:"flex flex-col gap-1 m-0 p-0 list-none",filterBar:"bg-white rounded-lg flex flex-wrap gap-x-5 gap-y-2 items-center px-3",filterRow:"flex gap-2 items-center",filterLabel:"text-gray-700 text-sm"},variants:{useCompactLayout:{true:{loading:"py-1",emptyState:"py-1",filterBar:"py-1"},false:{loading:"py-2",emptyState:"py-2",filterBar:"py-2"}}}}),YourCacheNotesFeed=({dashboardSettings:e,geocacheTypeLabels:a,i18n:t,isMobileDevice:i,useCompactLayout:u})=>{const g=c.c.yourCacheNotes,y=b({useCompactLayout:u}),{isExpanded:m,toggleExpanded:f}=(0,h.p)({dashboardSettings:e,settingKey:g.settingKey,isMobileDevice:i,usesIsCollapsedPattern:g.usesIsCollapsedPattern}
1),[v,C]=(0,s.useState)(!1),[N,w]=(0,s.useState)([]),[j,L]=(0,s.useState)(!1),[S,F]=(0,s.useState)(readFilters),T=(0,s.useRef)(!1);s.useEffect((()=>{if(!m||T.current)return;T.current=!0;(async()=>{try{w(await p.fetchRecent({take:25}))}catch(e){console.error("Error fetching your cache notes:",e),L(!0)}finally{C(!0)}})()}),[m]);const setFilter=e=>()=>{F((a=>{const t={...a,[e]:!a[e]};return(e=>{try{window.localStorage?.setItem(r,JSON.stringify(e))}catch{}})(t),t}))},U=(0,s.useMemo)((()=>((e,a)=>e.filter((e=>!(a.hideFound&&!0===e.data?.geocache?.isFound||a.hideUnavailable&&(e=>{const a=e.data?.geocache;return!0===a?.isArchived||!1===a?.isAvailable||!1===a?.isPublished})(e)))))(N,S).slice(0,5)),[N,S]),k=t.yourCacheNotes??{},I=N.length>0&&0===U.length,E=j?k.Error??"We couldn't load your cache notes.":I?k.NoMatches??"No cache notes match your filters.":k.Empty??"You haven't written any cache notes yet.",filter=(e,a)=>{const t=`your-cache-notes-filter-${e}`;return(0,x.jsxs)("div",{className:y.filterRow(),children:[(0,x.jsx)("span",{className:y.filterLabel(),id:t,children:a}),(0,x.jsx)(l.h,{active:S[e],onClick:setFilter(e),inputProps:{"aria-labelledby":t,"data-testid":t}})]})};return(0,x.jsxs)(o.iV,{id:"yourCacheNotes",className:y.base(),isExpanded:m,header:({contentId:e})=>(0,x.jsx)(n.h,{contentId:e,headerSize:"small",isExpanded:m,onToggle:f,title:k.Header??"Your cache notes"}),children:[!v&&m&&(0,x.jsx)(d.Gu,{size:"md","aria-label":t.playerDashboard?.Loading??"Loading",containerClassName:y.loading()}),v&&!j&&N.length>0&&(0,x.jsxs)("div",{className:y.filterBar(),children:[filter("hideFound",k.HideFound??"Hide found"),filter("hideUnavailable",k.HideUnavailable??"Hide archived and disabled")]}),v&&0===U.length?(0,x.jsx)("div",{className:y.emptyState(),children:E}):(0,x.jsx)("ul",{className:y.notesList(),children:U.map(((e,t)=>(0,x.jsx)("li",{children:(0,x.jsx)(YourCacheNotesFeedItem,{geocacheTypeLabels:a,i18n:k,item:e,useCompactLayout:u})},`${e.data?.geocache?.geocacheReferenceCode}-${t}`)))})]},"yourCacheNotes")};YourCacheNotesFeed.displayName="YourCacheNotesFeed"}}]);
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.