PageSourceSearch

https://www.guycameron.me/vite/assets/index-BPDZgMu-.js

js guycameron.me collected 2026-09-29 11:55:50 UTC 5,968 bytes, 1 lines download raw bytes

1import{j as e,R as f}from"./RenderReact-D01794dB.js";import{d as k,c as P}from"./clsx-B7rjN5bm.js";import{V as _}from"./index-BrgB-2s_.js";import{i as v}from"./inflection-CWKxl8AH.js";import{I as w}from"./iconify-DOvuEbFR.js";import{A as S,P as E}from"./AboutApi-DmUH4GHw.js";import{C as T}from"./CoursesApi-ClUw1aGa.js";import{P as $}from"./PagesApi-DGafhDXz.js";import{P as F}from"./PeopleApi-D-1u5crk.js";import{P as I}from"./PostsApi-CHaDVD5T.js";import{P as A}from"./ProfileApi-BtOn0-RE.js";import{P as V}from"./ProjectsApi-DHur6cy1.js";import{S as O}from"./SpecialPagesApi-tir_EuXF.js";import{u as D}from"./index.esm-BxfKy9L_.js";import"./isObjectLike-nLWjQ9zq.js";import"./index-CFcgNnu0.js";function R({children:m,title:t,isClosing:a,onClose:l,isSaving:c}){return e.jsx("div",{className:"mb-2 bg-gray-100 border border-gray-200 shadow rounded-lg",children:e.jsxs("div",{className:"flex flex-col gap-2 px-3 py-2 font-owlstown",children:[e.jsxs("div",{className:"flex flex-row items-center gap-4",children:[e.jsx("div",{className:"flex-none",children:e.jsx("div",{className:"text-sm text-gray-500",children:t})}),e.jsx("div",{className:"flex-1"}),c?e.jsxs("div",{className:"flex-none flex flex-row items-center gap-3",children:[e.jsx("div",{className:"loading loading-sm loading-spinner"}),e.jsx("div",{className:"text-sm text-gray-400",children:"Saving…"})]}):e.jsx("div",{className:"tooltip tooltip-bottom","data-tip":"Your changes are auto-saved.",children:e.jsx(w,{icon:"material-symbols:task-alt",className:"text-gray-400",style:{display:"block",fontSize:"1.25rem"}})}),e.jsx("button",{className:"btn btn-xs btn-square btn-ghost",onClick:l,children:a?e.jsx("span",{className:"loading loading-spinner loading-xs"}):e.jsx(w,{icon:"material-symbols:close",height:"24"})})]}),m]})})}function U({values:m,onUpdate:t,debouncedFields:a=[]}){const l=D({mode:"onChange",values:m}),{handleSubmit:c,watch:h,formState:{errors:y},setError:u}=l,g=f.useCallback(k(()=>{c(d=>{t(d).catch(i=>{if(i.response)for(let o in i.response.data)u(o,{type:"manual",message:i.response.data[o]})})})()},1e3),[u]);return f.useEffect(()=>{const n=h((d,{name:i,type:o})=>{a.includes(i)?g():c(x=>t(x))()});return()=>{n.unsubscribe()}},[c,h]),l}const z={About:S,Course:T,Page:$,Person:F,Post:I,Profile:A,Project:V,Publication:E,SpecialPage:O},K={About:["title","subtitle","show_title"],Course:["title","subtitle"],Page:["title","subtitle"],Person:["title","subtitle"],Post:["title","subtitle"],Profile:["title","subtitle"],Project:["title","subtitle"],Publication:["title"],SpecialPage:["title","subtitle","show_title"]};function ie(m){const{record:t,record_type:a,site_id:l,site_subdomain:c,editable_key:h}=m,[y,u]=f.useState(!1),[g,n]=f.useState(!1),d=v.underscore(v.pluralize(a)),i=K[a],{register:o,getValues:b,setValue:x,formState:{errors:s}}=U({values:t,onUpdate:p=>{n(!0);const r=z[a];if(!(r!=null&&r.update)){n(!1),alert(`Unknown API for ${a}`);return}let j;return r===S||r===A?j=r.update(l,p):j=r.update(l,t.id,p),j.then(()=>{n(!1);const N=`/editable/${l}/${d}/${t.id}/title/content`;_(N,{contentType:"text/vnd.turbo-stream.html",responseKind:"turbo-stream"})}).catch(N=>{throw n(!1),N})},debouncedFields:["title","subtitle"]}),C=()=>{u(!0);const p=`/editable/${l}/${d}/${t.id}/title`;_(p,{contentType:"text/vnd.turbo-stream.html",responseKind:"turbo-stream"})};return e.jsx(R,{title:"Title",isClosing:y,onClose:C,isSaving:g,children:e.jsxs("div",{className:"flex flex-col gap-2",children:[i.indexOf("title")>=0&&e.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[e.jsxs("label",{className:P("input flex items-center gap-2 w-full",(s==null?void 0:s.title)&&"input-error"),children:[e.jsx("div",{className:"text-gray-500",children:"Title"}),e.jsx("input",{type:"text",className:"grow",...o("title")}),(s==null?void 0:s.title)&&e.jsx("label",{className:"label ",children:e.jsx("span",{className:"label-text-alt text-red-500",children:s.title.message})})]}),t.member_site_info&&b("title")!==t.member_site_info.title&&e.jsxs("div",{className:"flex justify-between items-center bg-gray-50 p-2 rounded text-sm",children:[e.jsxs("span",{className:"text-gray-600",children:["Site title is: ",e.jsx("span",{className:"font-semibold",children:t.member_site_info.title})]}),e.jsx("button",{type:"button",className:"btn btn-xs btn-outline",onClick:()=>{x("title",t.member_site_info.title,{shouldValidate:!0,shouldDirty:!0})},children:"Sync from Site"})]})]}),i.indexOf("subtitle")>=0&&e.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[e.jsxs("label",{className:P("input flex items-center gap-2 w-full",(s==null?void 0:s.subtitle)&&"input-error"),children:[e.jsx("div",{className:"text-gray-500",children:"Subtitle"}),e.jsx("input",{type:"text",className:"grow",...o("subtitle")}),(s==null?void 0:s.subtitle)&&e.jsx("label",{className:"label ",children:e.jsx("span",{className:"label-text-alt text-red-500",children:s.subtitle.message})})]}),t.member_site_info&&b("subtitle")!==t.member_site_info.subtitle&&e.jsxs("div",{className:"flex justify-between items-center bg-gray-50 p-2 rounded text-sm",children:[e.jsxs("span",{className:"text-gray-600",children:["Site subtitle is: ",e.jsx("span",{className:"font-semibold",children:t.member_site_info.subtitle})]}),e.jsx("button",{type:"button",className:"btn btn-xs btn-outline",onClick:()=>{x("subtitle",t.member_site_info.subtitle,{shouldValidate:!0,shouldDirty:!0})},children:"Sync from Site"})]})]}),i.indexOf("show_title")>=0&&e.jsxs("fieldset",{className:"fieldset",children:[e.jsxs("label",{className:"cursor-pointer label gap-2 justify-start",children:[e.jsx("div",{className:"label-text flex-none",children:"Show title on page"}),e.jsx("input",{type:"checkbox",className:"toggle",...o("show_title")})]}),!b("show_title")&&e.jsx("div",{className:"label pt-0",children:e.jsx("div",{className:"label-text-alt",children:"Title will still appear in browser tabs and search results."})})]})]})})}export{ie 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.