1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{g as h,h as w,i as C}from"./sections-EXVdmBFY.js";import{u as P,C as F,S as I}from"./SharingScopePicker-CajJSJS_.js";import{u as j,a1 as R,b7 as k,d as x}from"./index-BKzE8EQ8.js";import{r as c}from"./vendor-react-E98sgxjj.js";import{b as q,u as D,a as E}from"./vendor-query-bOUN_gKe.js";import{g as y,e as O}from"./chatRoomStore-oLAeRb02.js";import{u as Q}from"./usePlayFeatures-C6KNVcgO.js";import{useGameSettings as T}from"./GameSettingsLayout-D9S5c2Df.js";import"./useLocaleNavigate-BNriJdRU.js";import"./vendor-fa-Bn2dnpnC.js";import"./NotificationPrompt-DCfg1qM2.js";import"./useNotifications-CrW-0d5F.js";import"./PayoutCountryModal-MHoRKH3v.js";import"./usePublishingFeatures-C8zY31rs.js";import"./useVisibilityControl-m_534sCR.js";import"./index-i1nPji9k.js";import"./paywall-CG7xVZtx.js";import"./plans-CbMJY2XS.js";import"./pricingExperiments-zMZby8z7.js";import"./organization-BuGhuc22.js";import"./useIsStaff-DZf24Ivp.js";import"./makeCopy-DTZjoJnY.js";import"./MakeCopy-DWExybqc.js";function z({game:s}){const{t:a}=j("company"),t=P(s),r=s.organization?.name??"";return t.scope?e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-lg text-foreground",children:a("sharing.sectionTitle")}),e.jsxs("div",{className:"rounded-md border border-border bg-card p-6",children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharing.whoCanOpen")}),e.jsx(F,{orgName:r})]}),e.jsx(I,{value:t.scope,onChange:t.setScope,orgName:r,canPublishPublicly:t.canPublishPublicly,readOnly:!t.canChange,busy:t.isSaving})]})]}):null}function G({game:s}){const{gameChat:a,ready:t}=Q(),{t:r,ready:S}=j("gameChat",{useSuspense:!1}),d=q(),u=c.useId(),m=c.useId(),n=s.organization?null:s.public_id??null,g=t&&a&&!!n,p=["game-chat-room",n],l=D({queryKey:p,queryFn:async()=>(await y.history(n,{limit:1})).room,enabled:g,staleTime:3e4,retry:!1}),[N,b]=c.useState(null),f=E({mutationFn:i=>y.updateSettings(n,{enabled:i}),onMutate:i=>b(i),onSuccess:i=>{d.setQueryData(p,i),O(n)?.applyRoom(i),d.invalidateQueries({queryKey:["game-settings",String(s.id)]})},onError:()=>R.error(r("settings.failed")),onSettled:()=>b(null)});if(!g||!S||l.isError&&k(l.error))return null;const o=N??l.data?.enabled??s.chat_enabled??!0,v=l.isPending||f.isPending;return e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-lg text-foreground",children:r("settings.title")}),e.jsx("div",{className:"rounded-md border border-border bg-card p-6",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{id:u,className:"text-base text-foreground",children:r("settings.label")}),e.jsx("p",{id:m,className:"mt-1 text-sm text-muted-foreground",children:r(o?"settings.onDesc":"settings.offDesc")})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":o,"aria-labelledby":u,"aria-describedby":m,disabled:v,onClick:()=>f.mutate(!o),className:x("relative h-6 w-11 shrink-0 cursor-pointer rounded-full transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card","disabled:cursor-not-allowed disabled:opacity-40",o?"bg-accent":"bg-foreground
1/15"),children:e.jsx("span",{"aria-hidden":"true",className:x("absolute top-0.5 h-5 w-5 rounded-full bg-white shadow-sm transition-all duration-200",o?"left-[22px]":"left-0.5")})})]})})]})}function ce(){const{game:s}=T();return s.organization?e.jsxs(e.Fragment,{children:[e.jsx(z,{game:s}),e.jsx(h,{game:s})]}):e.jsxs(e.Fragment,{children:[e.jsx(w,{game:s}),e.jsx(C,{game:s}),e.jsx(G,{game:s}),e.jsx(h,{game:s})]})}export{ce 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.