1import{j as e}from"./ui-vendor-DSl4G1OJ.js";import{V as P,c as B}from"./VerticalWorkspaceShell-BUakdUdH.js";import{Y as V,J as F,q as h,r as j,w as Q,x as z,an as N,ao as C,ap as w,aq as k,ar as S,B as x,G as D}from"./index-iv8p4bGb.js";import{u as q}from"./useVerticalWorkspace-BGTbrq7V.js";import{m as g}from"./verticalAuth-DqXEwJv0.js";import{E as K}from"./ExploreCouncilAdmin-1gZsE2pd.js";import{l as L,a as E}from"./react-vendor-JYAUlju1.js";import{u as A}from"./useMutation-CCxofYKg.js";import{A as W,a as G}from"./alert-DqdctsC-.js";import{B as p}from"./badge-BmcgN26q.js";import{C as H}from"./checkbox-DrqWENIb.js";import{I as c}from"./input-Cbpm_RuX.js";import{T as M}from"./textarea-BRROE69Y.js";import{m as U}from"./portalNavConfig-C4GEqJnP.js";import{i as J}from"./verticalModules-DrtAjsbu.js";import{C as Y}from"./target-BhiqlrDH.js";import{C as $}from"./compass-CDFQcs-U.js";import{L as O}from"./layout-dashboard-CtcoWl-n.js";import"./PortalConfigurationNotice-Dgvk_vzZ.js";import"./PrivacyCollectionNotice-C9UGCs1Z.js";import"./SearchResultsStatus-BAW4zQz1.js";import"./popover-DEdUl_IA.js";import"./settings-2-CGmnlkBo.js";import"./search-T0VyIefC.js";import"./verticalReturnTo-B6yAEc6z.js";import"./ExploreGuidePage-DEqdThVg.js";import"./map-pin-DEg-YZMi.js";import"./building-2-Nk2huxI0.js";import"./users-round-DZsl1kUg.js";import"./book-open-DtepqIpV.js";import"./shield-check-DdfSfcbh.js";import"./radio-CWAv4kFy.js";import"./file-clock-Ds5Ea1Xx.js";import"./lock-keyhole-DOVzMmwd.js";import"./heart-handshake-y3moal3U.js";import"./check-check-Cw6RZ6ve.js";import"./arrow-up-right-COe01Lj2.js";import"./utensils-DIy0ns5D.js";import"./layout-grid-B4uhkAVg.js";import"./exploreLivingPolicy-7zZNUqhj.js";import"./GameGuide-Ij0p5X1k.js";import"./circle-help-ms_ZceeK.js";import"./gamepad-2-hmChFUOi.js";import"./shopping-basket-BNCr6aoj.js";import"./calendar-days-BVXeHu32.js";import"./newspaper-CNavWVwr.js";import"./sparkles-B69mEhZg.js";import"./image-CXOC1B2L.js";import"./wifi-off-CjigeRmc.js";import"./droplets-h56iYgE4.js";import"./wallet-DvcdSpiq.js";import"./user-round-B4bN6HjC.js";import"./phone-3sP_NsCN.js";import"./paw-print-C-RpNn8r.js";import"./message-circle-CJrNXJUk.js";import"./house-wtkLENOb.js";import"./file-text-BAux0Bto.js";import"./coffee-rTdsowb4.js";import"./clipboard-list-UebIQ0GV.js";import"./bus-CZoRz5sV.js";import"./accessibility-BhcpKZbd.js";import"./arrow-down-BMLTH7xt.js";import"./leaf-DsWhn8fF.js";import"./circle-check-CkPJ4dRt.js";import"./ExploreMemberWorkspace-DODEKPMc.js";import"./MyLifeOrganiser-B_3vUx-O.js";import"./personalToolsPolicy-BM9zy_en.js";import"./calendar-check-_eoiXHa_.js";import"./plus-CUoCthEr.js";import"./pencil-CNiM8VJV.js";import"./printer-BGRXm7h5.js";import"./arrow-right-CpQyeIWr.js";import"./ReadAloudButton-xIWtzl9L.js";import"./portalAnalytics-DjFkLM7J.js";import"./operatorWorkflowApi-DwMjzjiG.js";import"./supabaseFunctions-Xsh4_ii9.js";import"./volume-2-BnUTl3at.js";import"./PortalDailyCuppaView-Cb1H9VZo.js";import"./PortalSectionWrapper-BcJSG08A.js";import"./heart-BPFyKUkJ.js";import"./utensils-crossed-DN5plLEW.js";import"./users-DbO-ebqj.js";import"./bell-C5vVma6p.js";import"./wrench-Bw5Exsal.js";import"./palette-CbfG7AQ6.js";import"./circle-user-BKU7QE1X.js";import"./activity-DXsghgOT.js";import"./flower-2-tVIDRMED.js";import"./door-open-C5_rd61i.js";import"./key-round-BlddUsqF.js";import"./calendar-clock-C-Thri2i.js";import"./megaphone-eKmCVPjV.js";import"./handshake-CAGXZ2Vx.js";import"./heart-pulse-DDyL749i.js";import"./layout-list-DuiYQ2bp.js";import"./client-CzRsoSvn.js";import"./index-BJGahwfI.js";import"./PortalImage-BbpNRxd9.js";import"./quote-CtQXGx6V.js";import"./list-checks-Q0Kixbmy.js";import"./archive-D-wQiML4.js";import"./external-link-BHekLCTg.js";import"./smile-4vMTvo4m.js";import"./send-BQLfd1fb.js";import"./PersonalWorkspace-Csln88Ti.js";import"./spreadsheetCsv-4akGStHQ.js";import"./book-user-Ds0VMWUB.js";import"./star-qjwcq55i.js";import"./BasketWatchView-BqgQW2qH.js";import"./lazyPortalView-D_lJRNm_.js";import"./VerticalGames-hybZ3l15.js";import"./PortalScoreHistory-BVl_Z9KX.js";import"./prototypePortalAssets-DRKpqVfj.js";
1import"./car-8wW68Fif.js";import"./mail-C6tfkY_l.js";import"./shopping-cart-9WYIsMA4.js";import"./trophy-CetmQQEo.js";import"./GameSessionPlayer-h0C_5nrc.js";import"./eye-BYyEwTRq.js";import"./lightbulb-C1BwJnva.js";import"./clock-5zm-oHtJ.js";import"./volume-x-SfaEfpUl.js";import"./circle-x-B0v3n1Tf.js";import"./undo-2-Bay1gl_t.js";import"./arrow-left-CB-rKhHH.js";import"./link-2-D4CoXOf2.js";import"./life-buoy-gqvf2NHR.js";import"./sticky-note-CCKGNJaT.js";import"./tv-minimal-D4A3PPFB.js";import"./chart-column-Lvf8PWcm.js";import"./audio-lines-CLwpQQld.js";import"./rocket-Caxl3fhV.js";import"./productVerticalConfig-DqKc_rbH.js";const X=["daily_cuppa","guide","event","reading","recipe","game","support","meal","offer","directory"];function Z(){const{regionSlug:i=""}=L(),s=q("explore",i,["editor","vertical_admin"]),d=V(),[n,v]=E.useState("overview"),[r,a]=E.useState({content_type:"guide",slug:"",title:"",summary:"",body:"",destination_url:"",provider_name:"",is_paid:!1,sponsor_label:"",support_priority:0,publication_state:"draft",scheduled_for:""}),_=()=>d.invalidateQueries({queryKey:["vertical-workspace","explore",i]}),u=A({mutationFn:()=>g("explore",i,"explore-item-save",r),onSuccess:()=>{a({...r,slug:"",title:"",summary:"",body:"",destination_url:"",provider_name:"",is_paid:!1,sponsor_label:"",support_priority:0}),_()}}),f=A({mutationFn:t=>g("explore",i,"explore-submission-transition",t),onSuccess:_}),o=s.data;if(!o)return e.jsx(P,{workspace:s});const y=o.portal.village_name||o.portal.operator_name||"Explore",R=t=>o.grants.some(m=>m.capabilities.includes("*")||m.capabilities.includes(t)),T={overview:O,content:$,submissions:Y},I=U.explore.filter(t=>[t.module,...t.moduleAny||[]].some(m=>J("explore",m,o.portal.feature_flags,o.portal.vertical_config))).filter(t=>!t.capabilityAny||t.capabilityAny.some(R)).map(t=>{const m=T[t.key];return{key:t.key,label:t.label,icon:e.jsx(m,{className:"h-5 w-5"})}});return e.jsxs(B,{productName:"PiP Explore Editorial",organisationName:y,userName:o.session.display_name,items:I,active:n,onNavigate:v,onLogout:s.logout,children:[e.jsxs(F,{children:[e.jsxs("title",{children:[y," | Explore editorial"]}),e.jsx("meta",{name:"robots",content:"noindex,nofollow"})]}),n==="overview"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx(p,{children:"Editorial workspace"}),e.jsx("h2",{className:"mt-3 text-3xl font-bold",children:"Explore overview"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"Review and publish useful local content. Paid placements remain clearly labelled and cannot outrank support information."})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsx(b,{value:o.explore_items?.filter(t=>t.publication_state==="published").length||0,label:"published"}),e.jsx(b,{value:o.explore_items?.filter(t=>t.publication_state!=="published").length||0,label:"in workflow"}),e.jsx(b,{value:o.submissions?.filter(t=>t.status==="submitted").length||0,label:"awaiting review"})]})]}),n==="content"&&e.jsxs("section",{className:"grid gap-6 xl:grid-cols-[minmax(0,1fr)_420px]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold",children:"Editorial content"}),e.jsx("div",{className:"mt-5 space-y-3",children:o.explore_items?.map(t=>e.jsx(h,{children:e.jsx(j,{className:"p-5",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{variant:"outline",children:t.content_type.replaceAll("_"," ")}),t.is_paid&&e.jsxs(p,{children:["Paid · ",t.sponsor_label]})]}),e.jsx("p",{className:"mt-2 font-semibold",children:t.title}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t.summary})]}),e.jsx(p,{variant:"secondary",children:t.publication_state})]})})},t.id))})]}),e.jsxs(h,{children:[e.jsx(Q,{children:e.jsx(z,{children:"Create an item"})}),e.jsxs(j,{className:"space-y-4",children:[e.jsx(l,{label:"Type",children:e.jsxs(N,{value:r.content_type,onValueChange:t=>a({...r,content_type:t}),children:[e.jsx(C,{children:e.jsx(w,{})}),e.jsx(k,{children:X.map(t=>e.jsx(S,{value:t,children:t.replaceAll("_"," ")},t))})]})}),e.jsx(l,{label:"Title",children:e.jsx(c,{value:r.title,onChange:t=>a({...r,title:t.target.value})})}),e.jsx(l,{label:"URL slug",children:e.jsx(c,{value:r.slug,onChange:t=>a({...r,slug:t.target.value})})}),e.jsx(l,{label:"Summary",children:e.jsx(M,{value:r.summary,onChange:t=>a({...r,summary:t.target.value})})}),e.jsx(l,{label:"Destination URL (optional)",children:e.jsx(c,{type:"url",value:r.destination_url,onChange:t=>a({...r,destination_url:t.target.value})})}),e.jsxs("label",{className:"flex min-h-11 items-center gap-3",children:[e.jsx(H,{checked:r.is_paid,onCheckedChange:t=>a({...r,is_paid:t===!0})}),e.jsx("span",{className:"text-sm font-medium",children:"Paid or featured placement"})]}),r.is_paid&&e.jsx(l,{label:"Sponsor label",children:e.jsx(c,{value:r.sponsor_label,onChange:t=>a({...r,sponsor_label:t.target.value}),placeholder:"Sponsored byâ¦"})}),e.jsx(l,{label:"Publication state",children:e.jsxs(N,{value:r.publication_state,onValueChange:t=>a({...r,publication_state:t}),children:[e.jsx(C,{children:e.jsx(w,{})}),e.jsx(k,{children:["draft","review","approved","scheduled","published"].map(t=>e.jsx(S,{value:t,children:t},t))})]})}),r.publication_state==="scheduled"&&e.jsx(l,{label:"Go live at",children:e.jsx(c,{type:"datetime-local",value:r.scheduled_for,onChange:t=>a({...r,scheduled_for:t.target.value})})}),u.error&&e.jsx(ee,{error:u.error}),e.jsx(x,{onClick:()=>u.mutate(),disabled:!r.title||!r.slug||!r.summary||r.is_paid&&!r.sponsor_label||r.publication_state==="scheduled"&&!r.scheduled_for||u.isPending,children:"Save content"})]})]})]}),n==="submissions"&&e.jsxs("section",{children:[e.jsx("h2",{className:"text-3xl font-bold",children:"Submission review"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"Providers and PiP organisations submit for editorial review; submissions never publish automatically."}),e.jsx("div",{className:"mt-5 space-y-3",children:o.submissions?.map(t=>e.jsx(h,{children:e.jsx(j,{className:"p-5",children:e.jsxs("div",{className:"flex flex-wrap justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(p,{variant:"outline",children:t.submitter_kind}),e.jsx("p",{className:"mt-2 font-semibold",children:String(t.payload?.title||t.content_type)}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[t.submitter_name," · ",t.contact_email]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t.status})]}),t.status==="submitted"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{size:"sm",onClick:()=>f.mutate({id:t.id,status:"approved"}),children:"Approve"}),e.jsx(x,{size:"sm",variant:"outline",onClick:()=>f.mutate({id:t.id,status:"changes_requested"}),children:"Request changes"}),e.jsx(x,{size:"sm",variant:"destructive",onClick:()=>f.mutate({id:t.id,status:"rejected"}),children:"Reject"})]})]})})},t.id))})]})]})}function l({label:i,children:s}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{children:i}),s]})}function b({value:i,label:s}){return e.jsx(h,{children:e.jsxs(j,{className:"p-5",children:[e.jsx("p",{className:"text-3xl font-bold",children:i}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s})]})})}function ee({error:i}){return e.jsx(W,{variant:"destructive",children:e.jsx(G,{children:i.message})})}function kr(){const{regionSlug:i=""}=L(),s=q("explore",i,["editor","vertical_admin"]),d=V();return s.data?s.data.explore_living?e.jsx(K,{data:s.data,onLogout:s.logout,mutate:async(n,v)=>{const r=await g("explore",i,n,v);return await Promise.all([d.invalidateQueries({queryKey:["vertical-workspace","explore",i]}),d.invalidateQueries({queryKey:["explore-public",i]})]),r}}):e.jsx(Z,{}):e.jsx(P,{workspace:s})}export{kr 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.