1import{D as Xe,a7 as Ze,c as et,d as tt,r as d,g as we,j as e,f as Z,X as _e,i as at}from"./index-CpHwTPqd.js";import{R as st}from"./quill.snow-DSSmNAs_.js";import{E as lt}from"./jspdf.es.min-D-KzfYPt.js";import{H as rt}from"./HarleyMediaImagePicker-BSGNi_-J.js";import{u as it,g as u,m as O,r as ct,s as nt}from"./harleyMediaWorkspace-BlCwSWJR.js";import{P as ot}from"./PublicLinkComplianceGate-CyButsyG.js";import{fetchCollectiveCmsDirectory as dt}from"./collectiveCmsDirectory-Cw4Vc2OF.js";import{c as mt}from"./collectiveShareDraft-fgDA22TU.js";import{P as L}from"./plus-BjrAjV9M.js";import{T as W}from"./trash-2-CFMI7UQv.js";import{S as pt}from"./save-BKlPnqXm.js";import{U as Ce}from"./users-CNU6WonV.js";import{I as xt}from"./image-C5zNMVxa.js";import{D as ht}from"./download-m-6Th4ZW.js";import{S as ut}from"./share-2-CJ1wsUCi.js";import{M as bt}from"./message-square-5z3MJun1.js";import{B as ft}from"./book-open-Ny56Igho.js";import{E as gt}from"./earth-jtXELJz2.js";import{A as kt}from"./archive-BxOZBRoE.js";import{F as yt}from"./file-text-CkBVcOFV.js";import"./mediaCompression-ALNaq7V1.js";import"./loader-circle-vI1Os_F6.js";import"./upload-DUmZ79-G.js";import"./check-DphAC2Ko.js";import"./shield-check-B2viwPKP.js";/** 2 * @license lucide-react v0.475.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 */const jt=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],vt=Xe("FileDown",jt),De={title:"Untitled",content_html:"",plain_text:"",excerpt:"",featured_image_url:"",category:""},Nt={toolbar:[[{header:[1,2,3,!1]}],["bold","italic","underline","strike"],[{list:"ordered"},{list:"bullet"}],["blockquote","link"],[{align:[]}],["clean"]]},wt=["header","bold","italic","underline","strike","list","bullet","blockquote","link","align"];function _t({value:s,readOnly:m,onChange:h}){const b=d.useRef(null),y=()=>{const l=b.current;l&&(l.style.height="0px",l.style.height=`${l.scrollHeight}px`)};return d.useEffect(()=>{y()},[s]),e.jsx("textarea",{ref:b,rows:1,value:s||"",readOnly:m,onChange:h,onInput:y,className:"block w-full min-h-[1.9em] resize-none overflow-hidden bg-transparent text-4xl sm:text-6xl font-black tracking-[-.065em] leading-[.92] outline-none placeholder:text-black/15 whitespace-pre-wrap break-words",placeholder:"Untitled","aria-label":"Document title"})}function T(s=""){if(typeof document>"u")return String(s).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();const m=document.createElement("div");return m.innerHTML=s,String(m.textContent||m.innerText||"").replace(/\u00a0/g," ").trim()}function Se(s=""){var h,b;const m=String(s||"");if(!m)return"";if(typeof document<"u"){const y=document.createElement("div");return y.innerHTML=m,((h=y.querySelector("img[src]"))==null?void 0:h.getAttribute("src"))||""}return((b=m.match(/<img[^>]+src=["']([^"']+)["']/i))==null?void 0:b[1])||""}const F=s=>JSON.stringify([(s==null?void 0:s.title)||"",(s==null?void 0:s.content_html)||"",(s==null?void 0:s.excerpt)||"",(s==null?void 0:s.featured_image_url)||"",(s==null?void 0:s.category)||""]),Me=s=>(String(s||"document").trim().replace(/[^a-z0-9]+/gi,"-").replace(/^-|-$/g,"").slice(0,70)||"document")+".pdf",Ct={id:"demo",title:"Build the Archive While You Build the Work.",category:"Field Note / HARLEY.OS",excerpt:"A read-only Composer example showing how HARLEY.OS users can turn working ideas into durable creative artifacts.",featured_image_url:"https://base44.app/api/apps/6922b730a7db492527c5451b/files/mp/public/6922b730a7db492527c5451b/c260da9c5_b36ff7646_IMG_2957.jpg",content_html:"<p>Most creative work disappears into messages, camera rolls, notes apps and half-finished files. Composer gives the thinking behind the work a permanent place to live.</p><p>Use it to explain the decision behind a design, write the story of a release, document a client strategy, publish a travel field note, turn a lesson into a guide, or capture the idea before the platform that inspired it changes again.</p><blockquote><strong>The finished artifact matters. The record of how you got there becomes part of the value too.</strong></blockquote><p>Start private. Add collaborators when the work needs another perspective. When it is ready, route the same document into Collective, your public Harley Media page, a website, or a PDF without rebuilding it somewhere else.</p><p><strong>ESSAY · CLIENT BRIEF · CASE STUDY · FIELD NOTE · MANIFESTO · PROPOSAL</strong></p>",plain_text:"Most creative work disappears into messages, camera rolls, notes apps and half-finished files. Composer gives the thinking behind the work a permanent place to live.",status:"demo"};function Dt({onNew:s,busy:m}){return e.jsx("div",{className:"min-h-[62vh] border border-black/10 bg-white p-6 sm:p-8 lg:p-10 flex items-center justify-center",children:e.jsxs("div",{className:"max-w-xl text-center",children:[e.jsx("div",{className:"mx-auto w-12 h-12 border border-black/10 flex items-center justify-center",children:e.jsx(yt,{className:"w-5 h-5"})}),e.jsx("p",{className:"mt-5 text-[8px] font-black uppercase tracking-[.18em] text-[#D62828]",children:"Harley Media / Composer"}),e.jsx("h1",{className:"mt-2 text-4xl sm:text-5xl font-black tracking-[-.06em]",children:"WRITE IT HERE."}),e.jsx("p",{className:"mt-4 text-sm leading-6 text-black/45",children:"Turn unfinished thinking into an essay, client brief, proposal, field note, case study, release note, manifesto or working document. Start privately, then route the finished work wherever it needs to go."}),e.jsx("div",{className:"mt-6 grid grid-cols-2 sm:grid-cols-3 gap-1 text-[7px] font-black uppercase tracking-[.08em] text-black/45",children:["Draft privately","Add a featured image","Invite collaborators","Share to Collective","Publish to a
6site","Export as PDF"].map(h=>e.jsx("div",{className:"border border-black/10 px-3 py-2",children:h},h))}),e.jsxs("button",{onClick:s,disabled:m,className:"mt-6 min-h-11 px-5 bg-black text-white text-[8px] font-black uppercase tracking-[.13em] disabled:opacity-40",children:[e.jsx(L,{className:"inline w-4 h-4 mr-2"}),"New document"]})]})})}function Zt(){var fe,ge,ke,ye,je,ve;const{documentId:s}=Ze(),m=s==="demo",h=et(),b=tt(),y=it(),[l,N]=d.useState(De),[R,B]=d.useState(""),[ee,p]=d.useState(""),[n,o]=d.useState(""),[Te,te]=d.useState(!1),[qe,q]=d.useState(!1),[Pe,Ae]=d.useState(""),[ae,P]=d.useState([]),[Q,Ee]=d.useState("view"),[se,le]=d.useState(!1),[A,Ue]=d.useState(""),[Ie,C]=d.useState(!1),[He,D]=d.useState(""),[Oe,E]=d.useState(!1),[x,We]=d.useState(null),[U,Fe]=d.useState([]),[re,z]=d.useState(""),K=d.useRef(null),g=we({queryKey:["harleyMediaDocument",s],queryFn:()=>u("getDocument",{id:s}),enabled:!!s&&!m,staleTime:10*1e3,retry:3,retryDelay:t=>Math.min(350*(t+1),1200),refetchOnWindowFocus:!1}),ie=we({queryKey:["harleyMediaComposerDestinations"],queryFn:()=>u("composerDestinations"),enabled:!!s&&se,staleTime:60*1e3}),Y=((fe=y.data)==null?void 0:fe.documents)||[],$=((ge=y.data)==null?void 0:ge.shared_documents)||[],ce=m?null:Y.find(t=>t.id===s),I=m?null:$.find(t=>t.id===s),ne=ce||I||null,i=m?Ct:((ke=g.data)==null?void 0:ke.document)||ne||null,M=m?"view":((ye=g.data)==null?void 0:ye.access)||(ce?"owner":(I==null?void 0:I.collaboration_access)||""),G=m?[]:((je=g.data)==null?void 0:je.members)||[],k=["owner","edit"].includes(M),w=M==="owner",_=i!=null&&i.public_enabled?(i==null?void 0:i.access_scope)==="members"?"members":"link":"private",oe=d.useMemo(()=>[...Y,...$].filter((a,c,r)=>a.status!=="archived"&&r.findIndex(f=>f.id===a.id)===c).sort((a,c)=>new Date(c.updated_at||c.created_at||0)-new Date(a.updated_at||a.created_at||0)),[Y,$]);d.useEffect(()=>{if(!i)return;const t={...De,...i};N(t),B(F(t)),p("")},[i==null?void 0:i.id,i==null?void 0:i.updated_at]),d.useEffect(()=>{if(!s||!k||!(i!=null&&i.id))return;const t=F(l);if(!R||t===R)return;p("Unsaved");const a=window.setTimeout(async()=>{try{const c=T(l.content_html),r=await u("updateDocument",{id:s,title:l.title,contentHtml:l.content_html,plainText:c,excerpt:l.excerpt,featuredImageUrl:l.featured_image_url,category:l.category});N(f=>({...f,...r.document})),B(F({...l,...r.document})),p("Saved"),b.invalidateQueries({queryKey:["harleyMediaWorkspace"]})}catch(c){p((c==null?void 0:c.message)||"Save failed")}},1400);return()=>window.clearTimeout(a)},[l.title,l.content_html,l.excerpt,l.featured_image_url,l.category,s,k,R,i==null?void 0:i.id,b]);const J=async()=>{o("create");try{const t=await u("createDocument",{title:"Untitled",contentHtml:"",plainText:""});await b.invalidateQueries({queryKey:["harleyMediaWorkspace"]}),h("/HarleyMedia/composer/"+t.document.id)}catch(t){p((t==null?void 0:t.message)||"Unable to create document.")}finally{o("")}},v=async()=>{if(!s||!k)return i;o("save");try{const t=T(l.content_html),a=await u("updateDocument",{id:s,title:l.title,contentHtml:l.content_html,plainText:t,excerpt:l.excerpt,featuredImageUrl:l.featured_image_url,category:l.category});return N(c=>({...c,...a.document})),B(F({...l,...a.document})),p("Saved"),b.invalidateQueries({queryKey:["harleyMediaWorkspace"]}),a.document}finally{o("")}},Le=async()=>{if(!(!w||!confirm("Archive this Composer document?"))){o("archive");try{await u("archiveDocument",{id:s}),await b.invalidateQueries({queryKey:["harleyMediaWorkspace"]}),h("/HarleyMedia/composer")}finally{o("")}}},V=async(t,a)=>{var c;if((c=a==null?void 0:a.stopPropagation)==null||c.call(a),!(!(t!=null&&t.id)||t.collaboration_access)&&confirm("Delete ââ"+(t.title||"Untitled")+"â permanently? This cannot be undone.")){o("delete-"+t.id);try{await u("deleteDocument",{id:t.id}),await b.invalidateQueries({queryKey:["harleyMediaWorkspace"]}),s===t.id&&h("/HarleyMedia/composer")}catch(r){p((r==null?void 0:r.message)||"Unable to delete document.")}finally{o("")}}},Re=async t=>{if(Ae(t),t.trim().length<2){P([]);return}try{const a=await u("searchCollaborators",{query:t.trim()});P(a.members||[])}catch{P([])}},Be=async t=>{o("collab-"+t.user_id);try{await v(),await u("addDocumentMember",{documentId:s,memberUserId:t.user_id,access:Q}),await g.refetch(),P(a=>a.filter(c=>c.user_id!==t.user_id))}finally{o("")}},Qe=async t=>
6{o("remove-"+t.member_user_id);try{await u("removeDocumentMember",{documentId:s,memberUserId:t.member_user_id}),await g.refetch()}finally{o("")}},de=async(t,a)=>{if(!(!w||!s)){o("audience-"+t);try{await v(),t==="private"?await u("unpublishDocument",{id:s}):await u("publishDocument",{id:s,scope:t,compliance:a}),await Promise.all([g.refetch(),b.invalidateQueries({queryKey:["harleyMediaWorkspace"]})]),p(t==="private"?"Document is private":t==="members"?"HARLEY.OS members can read this document":"Anyone with the link can read this document")}catch(c){p((c==null?void 0:c.message)||"Unable to update access.")}finally{o("")}}},ze=t=>{if(t!==_){if(t==="link"&&(i==null?void 0:i.public_compliance_status)!=="approved"){D("access-link"),C(!0);return}de(t)}},Ke=async()=>{const t=O(i==null?void 0:i.public_slug);if(t)try{await navigator.clipboard.writeText(t),p("Document link copied")}catch{p(t)}},me=async t=>{o("messages");try{await v(),await u("publishDocument",{id:s,compliance:t}),await g.refetch(),h("/Collective/messages?hmType=document&hmId="+encodeURIComponent(s))}catch(a){p((a==null?void 0:a.message)||"Unable to prepare document for Messages.")}finally{o("")}},pe=async t=>{o("top8");try{const a=await v()||i,c=await u("publishDocument",{id:s,compliance:t}),r=c.document||a,f=c.url||O(r==null?void 0:r.public_slug),j=await nt({title:(r==null?void 0:r.title)||l.title,url:f,resourceType:"document",resourceId:s,thumbnailUrl:Se((r==null?void 0:r.content_html)||l.content_html)||(r==null?void 0:r.featured_image_url)||l.featured_image_url||"",description:(r==null?void 0:r.excerpt)||l.excerpt||T((r==null?void 0:r.content_html)||l.content_html).slice(0,260)});await g.refetch(),h(j.destination)}catch(a){p((a==null?void 0:a.message)||"Unable to share to Top 8.")}finally{o("")}},xe=async t=>{o("collective"),z("");try{const a=await v()||i,c=await u("publishDocument",{id:s,compliance:t}),r=c.document||a||l,f=c.url||O(r==null?void 0:r.public_slug);if(!f)throw new Error("Unable to prepare a readable Composer link.");const j=(r==null?void 0:r.content_html)||l.content_html||"",S=T(j),X=Se(j)||(r==null?void 0:r.featured_image_url)||l.featured_image_url||"",H=await dt(),Ne=Array.isArray(H==null?void 0:H.publish_destinations)?H.publish_destinations:[];if(!Ne.length)throw new Error("No Collective publishing destination is available for this account.");We({resource_type:"document",resource_id:s,resource_url:f,resource_title:(r==null?void 0:r.title)||l.title||"Untitled",resource_excerpt:(r==null?void 0:r.excerpt)||l.excerpt||S.slice(0,260),resource_image_url:X,resource_source:"harley_media",message:`Shared from Workspace. 7${f}`}),Fe(Ne),E(!0),await g.refetch()}catch(a){const c=(a==null?void 0:a.message)||"Unable to prepare this document for Collective.";z(c),p(c)}finally{o("")}},Ye=()=>{if((i==null?void 0:i.public_compliance_status)==="approved"){xe();return}D("collective"),C(!0)},$e=()=>{if((i==null?void 0:i.public_compliance_status)==="approved"){me();return}D("messages"),C(!0)},Ge=()=>{if((i==null?void 0:i.public_compliance_status)==="approved"){pe();return}D("top8"),C(!0)},Je=async t=>{C(!1);const a=He;D(""),a==="collective"?await xe(t):a==="messages"?await me(t):a==="top8"?await pe(t):a==="access-link"&&await de("link",t)},he=t=>{if(!x||!(t!=null&&t.id))return;const a=mt({destination:{type:t.type,id:t.id,name:t.name||""},resource:x,message:x.message||"Shared from Workspace."});if(!a){z("Unable to prepare the Collective share draft.");return}E(!1);const c=t.type==="room"?"room":"channel";h(`/Collective?${c}=${encodeURIComponent(t.id)}&shareDraft=${encodeURIComponent(a)}`)},ue=async t=>{if(s){o(t?"pdf-file":"pdf");try{await v();const a=new lt({orientation:"portrait",unit:"pt",format:"a4"});if(K.current)await a.html(K.current,{margin:[48,48,48,48],autoPaging:"text",width:500,windowWidth:700,html2canvas:{scale:.85,useCORS:!0,backgroundColor:"#ffffff"}});else{const X=a.splitTextToSize(T(l.content_html),500);a.text(X,48,70)}if(!t){a.save(Me(l.title));return}const c=a.output("blob"),r=Me(l.title),f=new File([c],r,{type:"application/pdf"}),j=await u("preflightUpload",{name:r,sizeBytes:f.size});if((j==null?void 0:j.allowed)!==!0)throw new Error((j==null?void 0:j.error)||"The PDF does not fit in your Workspace storage.");const S=await at.integrations.Core.UploadFile({file:f});if(!(S!=null&&S.file_url))throw new Error("PDF upload did not return a file URL.");await ct("createFileRecord",{fileUrl:S.file_url,name:r,originalName:r,mimeType:"application/pdf",sizeBytes:f.size,folderId:"",previewImageUrl:l.featured_image_url||"",sourceType:"composer",sourceId:s}),await u("updateDocument",{id:s,lastExportedAt:new Date().toISOString()}).catch(()=>null),await b.invalidateQueries({queryKey:["harleyMediaWorkspace"]}),p("PDF saved to Files")}catch(a){p((a==null?void 0:a.message)||"PDF export failed.")}finally{o("")}}},be=async(t=!1)=>{var c;const a=(((c=ie.data)==null?void 0:c.blog_pages)||[]).find(r=>r.id===A);if(a){o("blog");try{await v(),await u("addDocumentToBlog",{documentId:s,siteId:a.site_id,pageId:a.id,status:t?"published":"draft"}),p(t?"Published to Website blog":"Added to Website blog drafts"),le(!1),b.invalidateQueries({queryKey:["harleyMediaSite",a.site_id]})}catch(r){p((r==null?void 0:r.message)||"Unable to add to blog.")}finally{o("")}}},Ve=async()=>{o("public");try{await v(),await u("attachDocumentToPublicPage",{documentId:s}),p("Added to Public Page"),b.invalidateQueries({queryKey:["harleyMediaPageEditor"]})}catch(t){p((t==null?void 0:t.message)||"Unable to attach to Public Page.")}finally{o("")}};return y.isLoading&&!y.data?e.jsx("div",{className:"min-h-[55vh] flex items-center justify-center",children:e.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-black/15 border-t-black animate-spin"})}):s?(g.isLoading||y.isLoading)&&!i?e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:e.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-black/15 border-t-black animate-spin"})}):i?e.jsxs("div",{className:"-mx-3 sm:-mx-6 -my-4 sm:-my-7 min-h-[calc(100dvh-112px)] bg-[#e7e3da]",children:[e.jsxs("header",{className:"sticky top-0 z-30 min-h-14 border-b border-black/10 bg-[#f4f2ec]/95 backdrop-blur-xl px-3 sm:px-5 flex flex-wrap items-center gap-2",children:[e.jsx("button",{onClick:()=>h("/HarleyMedia/composer"),className:"h-9 px-3 border border-black/10 bg-white text-[8px] font-black uppercase",children:"Composer"}),e.jsxs("div",{className:"min-w-0 mr-auto",children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.14em] text-[#D62828]",children:m?"Demo / Read only":g.isError&&ne?"Reconnectingâ¦":M==="owner"?"Private workspace":M==="edit"?"Shared / Edit":"Shared / Read only"}),e.jsx("p",{className:"text-sm font-black truncate max-w-[40vw]",children:l.title||"Untitled"})]}),ee&&e.jsx("span",{className:"hidden sm:inline text-[7px] font-black uppercase tracking-[.12em] text-black/35",children:ee}),k&&e.jsxs("button",{onClick:v,disabled:n==="save",className:"h-9 px-3 bg-black text-white inline-flex items-center gap-2 text-[8px] font-black uppercase",children:[e.jsx(pt,{className:"w-3.5 h-3.5"}),n==="save"?"Savingâ¦":"Save"]}),w&&e.jsxs("button",{onClick:()=>q(!0),className:"h-9 px-3 border border-black/10 bg-white inline-flex items-center gap-2 text-[8px] font-black uppercase",children:[e.jsx(Ce,{className:"w-3.5 h-3.5"}),"Access"]})]}),e.jsxs("div",{className:"grid min-h-[calc(100dvh-170px)] xl:grid-cols-[220px_minmax(0,1fr)_300px]",children:[e.jsxs("aside",{className:"hidden xl:block border-r border-black/10 bg-[#f4f2ec] p-3 overflow-y-auto",children:[e.jsxs("button",{onClick:J,className:"w-full min-h-10 bg-black text-white text-[8px] font-black uppercase",children:[e.jsx(L,{className:"w-3.5 h-3.5 inline mr-2"}),"New document"]}),e.jsx("p",{className:"mt-5 text-[7px] font-black uppercase tracking-[.15em] text-black/30",children:"My documents"}),e.jsxs("div",{className:"mt-2 divide-y divide-black/8",children:[oe.map(t=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("button",{onClick:()=>h("/HarleyMedia/composer/"+t.id),className:"min-w-0 flex-1 py-3 text-left "+(t.id===s?"text-[#D62828]":""),children:[e.jsx("p",{className:"text-[11px] font-black leading-4 whitespace-normal break-words",children:t.title||"Untitled"}),e.jsx("p",{className:"mt-1 text-[7px] uppercase text-black/30",children:t.collaboration_access?"Shared with me":"Workspace"})]}),!t.collaboration_access&&e.jsx("button",{type:"button",onClick:a=>V(t,a),disabled:n==="delete-"+t.id,"aria-label":"Delete "+(t.title||"document"),title:"Delete document",className:"w-8 h-8 flex-shrink-0 text-red-600 flex items-center justify-center hover:bg-red-50 disabled:opacity-35",children:e.jsx(W,{className:"w-3.5 h-3.5"})})]},t.id)),e.jsxs("button",{type:"button",onClick:()=>h("/HarleyMedia/composer/demo"),className:"w-full py-3 text-left "+(m?"text-[#D62828]":""),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"min-w-0 flex-1 text-[11px] font-black leading-4 whitespace-normal break-words",children:"Build the Archive While You Build the Work."}),e.jsx("span",{className:"flex-shrink-0 border border-[#D62828]/25 px-1.5 py-0.5 text-[6px] font-black uppercase tracking-[.1em] text-[#D62828]",children:"Demo"})]}),e.jsx("p",{className:"mt-1 text-[7px] uppercase text-black/30",children:"Read only · Platform example"})]})]})]}),e.jsx("main",{className:"min-w-0 bg-[#dcd8cf] p-3 sm:p-5 overflow-y-auto",children:e.jsxs("article",{className:"mx-auto max-w-[860px] min-h-[1050px] bg-white shadow-[0_20px_70px_rgba(0,0,0,.08)] border border-black/8",children:[l.featured_image_url&&e.jsx("div",{className:"aspect-[16/7] overflow-hidden border-b border-black/8",children:e.jsx("img",{src:Z(l.featured_image_url,{w:1400,q:72}),alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"p-5 sm:p-8 lg:p-12",children:[e.jsx(_t,{value:l.title||"",readOnly:!k,onChange:t=>N({...l,title:t.target.value})}),e.jsxs("div",{className:"mt-5 grid sm:grid-cols-[1fr_1fr] gap-3 border-b border-black/10 pb-5",children:[e.jsx("input",{value:l.category||"",readOnly:!k,onChange:t=>N({...l,category:t.target.value}),placeholder:"Category",className:"bg-transparent text-[8px] font-black uppercase tracking-[.15em] outline-none placeholder:text-black/25"}),e.jsx("input",{value:l.excerpt||"",readOnly:!k,onChange:t=>N({...l,excerpt:t.target.value}),placeholder:"Short description / excerpt",className:"bg-transparent text-xs text-black/45 outline-none sm:text-right placeholder:text-black/25"})]}),e.jsx("div",{className:"mt-7 composer-quill "+(k?"":"composer-readonly"),children:e.jsx(st,{theme:k?"snow":"bubble",readOnly:!k,value:l.content_html||"",onChange:t=>N({...l,content_html:t}),modules:k?Nt:{toolbar:!1},formats:wt,placeholder:"Start writingâ¦"})})]})]})}),e.jsxs("aside",{className:"border-t xl:border-t-0 xl:border-l border-black/10 bg-[#f4f2ec] p-4 space-y-4 overflow-y-auto xl:sticky xl:top-32 xl:self-start xl:max-h-[calc(100dvh-144px)]",children:[e.jsxs("section",{children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.15em] text-black/30",children:"Document"}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-1",children:[e.jsxs("button",{onClick:()=>te(!0),disabled:!k,className:"min-h-10 border border-black/10 bg-white text-[7px] font-black uppercase disabled:opacity-30",children:[e.jsx(xt,{className:"w-3.5 h-3.5 inline mr-1"}),"Featured"]}),e.jsxs("button",{onClick:()=>ue(!1),disabled:n==="pdf",className:"min-h-10 border border-black/10 bg-white text-[7px] font-black uppercase",children:[e.jsx(ht,{className:"w-3.5 h-3.5 inline mr-1"}),"PDF"]}),e.jsxs("button",{onClick:()=>ue(!0),disabled:n==="pdf-file",className:"col-span-2 min-h-10 border border-black/10 bg-white text-[7px] font-black uppercase",children:[e.jsx(vt,{className:"w-3.5 h-3.5 inline mr-1"}),"Save PDF to Files"]})]})]}),w&&e.jsxs("section",{className:"border-t border-black/10 pt-4",children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.15em] text-black/30",children:"Share / Route"}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-1",children:[e.jsxs("button",{onClick:Ye,disabled:n==="collective",className:"min-h-10 border border-black/10 bg-white text-[7px] font-black uppercase disabled:opacity-40",children:[e.jsx(ut,{className:"w-3.5 h-3.5 inline mr-1"}),n==="collective"?"Preparingâ¦":"Collective"]}),e.jsxs("button",{onClick:$e,disabled:n==="messages",className:"min-h-10 border border-black/10 bg-white text-[7px] font-black uppercase disabled:opacity-40",children:[e.jsx(bt,{className:"w-3.5 h-3.5 inline mr-1"}),n==="messages"?"Preparingâ¦":"Messages"]}),e.jsxs("button",{onClick:Ge,disabled:n==="top8",className:"col-span-2 min-h-10 border border-black/10 bg-white text-[7px] font-black uppercase",children:[e.jsx(Ce,{className:"w-3.5 h-3.5 inline mr-1"}),n==="top8"?"Sharingâ¦":"Share to Top 8"]})]}),e.jsx("p",{className:"mt-2 text-[8px] leading-4 text-black/35",children:"Collective lets you choose an allowed Channel or Room, then opens that destination with an editable share draft. Messages grants the recipient read access automatically. Existing edit permission is preserved. Top 8 grants read access to accepted members before posting the document in the group channel."})]}),w&&e.jsxs("section",{className:"border-t border-black/10 pt-4",children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.15em] text-black/30",children:"Publish elsewhere"}),e.jsxs("div",{className:"mt-3 space-y-1",children:[e.jsxs("button",{onClick:()=>le(t=>!t),className:"w-full min-h-10 border border-black/10 bg-white text-[7px] font-black uppercase",children:[e.jsx(ft,{className:"w-3.5 h-3.5 inline mr-1"}),"Website Blog"]}),e.jsxs("button",{onClick:Ve,disabled:n==="public",className:"w-full min-h-10 border border-black/10 bg-white text-[7px] font-black uppercase",children:[e.jsx(gt,{className:"w-3.5 h-3.5 inline mr-1"}),"Attach to Public Page"]})]}),se&&e.jsxs("div",{className:"mt-2 border border-black/10 bg-white p-3",children:[e.jsxs("select",{value:A,onChange:t=>Ue(t.target.value),className:"w-full h-10 border border-black/10 px-2 text-xs",children:[e.jsx("option",{value:"",children:"Choose blog pageâ¦"}),(((ve=ie.data)==null?void 0:ve.blog_pages)||[]).map(t=>e.jsxs("option",{value:t.id,children:[t.site_title," · ",t.title]},t.id))]}),e.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-1",children:[e.jsx("button",{onClick:()=>be(!1),disabled:!A||n==="blog",className:"h-9 border border-black/10 text-[7px] font-black uppercase",children:"Add draft"}),e.jsx("button",{onClick:()=>be(!0),disabled:!A||n==="blog",className:"h-9 bg-black text-white text-[7px] font-black uppercase",children:"Publish"})]})]})]}),e.jsxs("section",{className:"border-t border-black/10 pt-4",children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.15em] text-black/30",children:"Access"}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[e.jsx("p",{className:"text-xs font-black",children:w?_==="link"?"Anyone with link":_==="members"?"HARLEY.OS members":"Private by default":M==="edit"?"Can edit":"Read only"}),w&&e.jsx("button",{onClick:()=>q(!0),className:"text-[7px] font-black uppercase underline underline-offset-4",children:"Manage access"})]})]}),w&&e.jsxs("div",{className:"grid grid-cols-2 gap-1",children:[e.jsxs("button",{onClick:Le,disabled:n==="archive",className:"min-h-10 border border-black/10 bg-white text-[7px] font-black uppercase text-black/45",children:[e.jsx(kt,{className:"w-3.5 h-3.5 inline mr-1"}),"Archive"]}),e.jsxs("button",{onClick:t=>V(i,t),disabled:n==="delete-"+s,className:"min-h-10 border border-red-500/20 bg-white text-red-600 text-[7px] font-black uppercase",children:[e.jsx(W,{className:"w-3.5 h-3.5 inline mr-1"}),"Delete"]})]})]})]}
7),e.jsx(rt,{open:Te,title:"Choose featured image",onClose:()=>te(!1),onSelect:t=>N(a=>({...a,featured_image_url:t})),includeCollective:!0}),e.jsx(ot,{open:Ie,onCancel:()=>{C(!1),D("")},onConfirm:Je,busy:n==="collective"||n==="messages"||n==="top8"||n==="audience-link",title:"Make this document public",description:"One last check before this document is shared publicly.",confirmLabel:"Make Live"}),Oe&&e.jsx("div",{className:"fixed inset-0 z-[430] bg-black/65 p-3 sm:p-6 flex items-center justify-center",onClick:()=>E(!1),children:e.jsxs("div",{className:"w-full max-w-2xl max-h-[90vh] overflow-hidden bg-[#f4f2ec] border border-black/10 shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("header",{className:"min-h-16 px-4 sm:px-5 border-b border-black/10 flex items-center gap-3",children:[e.jsxs("div",{className:"min-w-0 mr-auto",children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.16em] text-[#D62828]",children:"Composer / Share to Collective"}),e.jsx("h2",{className:"text-xl sm:text-2xl font-black tracking-[-.04em]",children:"Choose a destination."})]}),e.jsx("button",{type:"button",onClick:()=>E(!1),className:"w-10 h-10 flex items-center justify-center border border-black/10 bg-white","aria-label":"Close Collective destination picker",children:e.jsx(_e,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"max-h-[calc(90vh-64px)] overflow-y-auto p-4 sm:p-5",children:[e.jsx("div",{className:"border border-black/10 bg-white overflow-hidden",children:e.jsxs("div",{className:x!=null&&x.resource_image_url?"grid sm:grid-cols-[160px_1fr] min-h-32":"block min-h-32",children:[x!=null&&x.resource_image_url?e.jsx("img",{src:Z(x.resource_image_url,{w:560,q:76}),alt:"",className:"w-full h-40 sm:h-full object-cover"}):null,e.jsxs("div",{className:"p-4 sm:p-5",children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.15em] text-black/35",children:"Harley Media / Composer"}),e.jsx("p",{className:"mt-1 text-lg font-black tracking-[-.03em]",children:(x==null?void 0:x.resource_title)||l.title}),(x==null?void 0:x.resource_excerpt)&&e.jsx("p",{className:"mt-2 text-[10px] leading-5 text-black/45 line-clamp-3",children:x.resource_excerpt}),e.jsx("p",{className:"mt-3 text-[8px] text-black/35 truncate",children:x==null?void 0:x.resource_url})]})]})}),e.jsx("p",{className:"mt-4 text-[9px] leading-5 text-black/45",children:"Nothing posts yet. Choose a Channel or Room below; Collective will open that exact destination with this share card and a message ready for you to edit before posting."}),re&&e.jsx("p",{className:"mt-3 text-xs text-red-600",children:re}),e.jsxs("div",{className:"mt-5 space-y-5",children:[U.some(t=>t.type==="channel")&&e.jsxs("section",{children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.16em] text-black/30",children:"Channels"}),e.jsx("div",{className:"mt-2 border-y border-black/10 divide-y divide-black/8",children:U.filter(t=>t.type==="channel").map(t=>e.jsxs("button",{type:"button",onClick:()=>he(t),className:"w-full min-h-14 px-3 py-3 bg-white hover:bg-black/[.025] flex items-center gap-3 text-left",children:[e.jsx("span",{className:"w-8 h-8 border border-black/10 bg-[#f4f2ec] flex items-center justify-center font-black",children:t.icon||"#"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("p",{className:"text-sm font-black truncate",children:["#",t.name]}),t.is_general&&e.jsx("span",{className:"text-[6px] font-black uppercase tracking-[.12em] text-purple-600",children:"Available to all"})]}),t.description&&e.jsx("p",{className:"mt-0.5 text-[8px] text-black/35 truncate",children:t.description})]}),e.jsx("span",{className:"text-lg text-black/25",children:"â"})]},"channel-"+t.id))})]}),U.some(t=>t.type==="room")&&e.jsxs("section",{children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.16em] text-black/30",children:"Rooms"}),e.jsx("div",{className:"mt-2 border-y border-black/10 divide-y divide-black/8",children:U.filter(t=>t.type==="room").map(t=>e.jsxs("button",{type:"button",onClick:()=>he(t),className:"w-full min-h-14 px-3 py-3 bg-white hover:bg-black/[.025] flex items-center gap-3 text-left",children:[e.jsx("span",{className:"w-8 h-8 border border-black/10 bg-[#f4f2ec] flex items-center justify-center",children:t.icon||"ð¬"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-black truncate",children:t.name}),e.jsx("p",{className:"mt-0.5 text-[8px] text-black/35 truncate",children:t.is_vendor_room?t.vend
7or_name?t.vendor_name+" supporter Room":"Supporter Room":t.description||"Collective Room"})]}),e.jsx("span",{className:"text-lg text-black/25",children:"â"})]},"room-"+t.id))})]})]})]})]})}),qe&&e.jsx("div",{className:"fixed inset-0 z-[410] bg-black/60 p-4 flex items-center justify-center",onClick:()=>q(!1),children:e.jsxs("div",{className:"w-full max-w-xl max-h-[88vh] overflow-hidden bg-[#f4f2ec]",onClick:t=>t.stopPropagation(),children:[e.jsxs("header",{className:"h-14 border-b border-black/10 px-4 flex items-center",children:[e.jsxs("div",{className:"mr-auto min-w-0",children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.14em] text-[#D62828]",children:"Composer / Access"}),e.jsx("p",{className:"font-black truncate",children:l.title})]}),e.jsx("button",{onClick:()=>q(!1),className:"w-9 h-9 flex items-center justify-center","aria-label":"Close access settings",children:e.jsx(_e,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 overflow-y-auto max-h-[calc(88vh-56px)]",children:[e.jsxs("section",{children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.14em] text-black/30",children:"General access"}),e.jsx("div",{className:"mt-2 space-y-1",children:[["private","Private","Only you and people added below can open this document."],["members","HARLEY.OS members","Any signed-in Passport member can read the document."],["link","Anyone with the link","Anyone who has the harley.media link can read the document."]].map(([t,a,c])=>e.jsxs("button",{type:"button",onClick:()=>ze(t),disabled:n.startsWith("audience-"),className:"w-full min-h-16 border px-3 py-3 flex items-center gap-3 text-left transition-colors disabled:opacity-50 "+(_===t?"border-black bg-white":"border-black/10 bg-white/55 hover:bg-white"),children:[e.jsx("span",{className:"w-4 h-4 rounded-full border flex items-center justify-center flex-shrink-0 "+(_===t?"border-black":"border-black/20"),children:_===t&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#D62828]"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-sm font-black",children:a}),e.jsx("span",{className:"mt-1 block text-[8px] leading-4 text-black/35",children:c})]}),n==="audience-"+t&&e.jsx("span",{className:"text-[7px] font-black uppercase text-black/30",children:"Savingâ¦"})]},t))}),_!=="private"&&(i==null?void 0:i.public_slug)&&e.jsxs("div",{className:"mt-2 border border-black/10 bg-white p-3 flex items-center gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.12em] text-black/30",children:_==="members"?"Member link":"Share link"}),e.jsx("p",{className:"mt-1 text-[9px] truncate",children:O(i.public_slug)})]}),e.jsx("button",{type:"button",onClick:Ke,className:"h-9 px-3 border border-black/10 text-[7px] font-black uppercase",children:"Copy link"})]})]}),e.jsxs("section",{className:"mt-5 border-t border-black/10 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[7px] font-black uppercase tracking-[.14em] text-black/30",children:"People with direct access"}),e.jsx("p",{className:"mt-1 text-[8px] text-black/35",children:"Add specific members as read-only collaborators or editors."})]}),e.jsxs("span",{className:"text-[7px] font-black uppercase text-black/25",children:[G.length," added"]})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-[1fr_auto] gap-2",children:[e.jsx("input",{value:Pe,onChange:t=>Re(t.target.value),placeholder:"Search Passport members or vendors",className:"h-11 border border-black/10 bg-white px-3 text-sm"}),e.jsxs("select",{value:Q,onChange:t=>Ee(t.target.value),className:"h-11 border border-black/10 bg-white px-3 text-[8px] font-black uppercase",children:[e.jsx("option",{value:"view",children:"Read only"}),e.jsx("option",{value:"edit",children:"Can edit"})]})]}),ae.length>0&&e.jsx("div",{className:"mt-2 border border-black/10 bg-white divide-y divide-black/8",children:ae.map(t=>{var a;return e.jsxs("button",{onClick:()=>Be(t),className:"w-full min-h-14 px-3 flex items-center gap-3 text-left",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-black/5 overflow-hidden flex items-center justify-center",children:t.avatar_url?e.jsx("img",{src:Z(t.avatar_url,{w:96,q:70}),alt:"",className:"w-full h-full object-cover"}):e.jsx("span",{className:"font-black",children:((a=t.display_name)==null?void 0:a[0])||"M"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-black truncate",children:t.display_name}),e.jsx("p",{className:"text-[7px] uppercase text-black/30",children:Q==="edit"?"Can edit":"Read only"})]}),e.jsx(L,{className:"w-4 h-4 text-black/30"})]},t.user_id)})}),e.jsxs("div",{className:"mt-4 border-t border-black/10",children:[G.map(t=>e.jsxs("div",{className:"min-h-12 border-b border-black/8 flex items-center gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[10px] font-black truncate",children:t.display_name}),e.jsx("p",{className:"text-[7px] uppercase text-black/30",children:t.access==="edit"?"Can edit":"Read only"})]}),e.jsxs("button",{onClick:()=>Qe(t),disabled:n==="remove-"+t.member_user_id,className:"text-[7px] font-black uppercase text-red-600",children:[e.jsx(W,{className:"w-3.5 h-3.5 inline mr-1"}),"Remove"]})]},t.id)),!G.length&&e.jsx("p",{className:"py-5 text-xs text-black/35",children:"No one has been added directly."})]})]})]})]})}),e.jsx("div",{className:"fixed left-[-9999px] top-0 w-[700px] bg-white text-black pointer-events-none","aria-hidden":"true",children:e.jsxs("article",{ref:K,className:"p-12",children:[e.jsx("h1",{className:"text-5xl font-black",children:l.title}),l.category&&e.jsx("p",{className:"mt-3 text-xs uppercase",children:l.category}),l.featured_image_url&&e.jsx("img",{src:l.featured_image_url,alt:"",className:"mt-6 w-full max-h-[360px] object-cover"}),e.jsx("div",{className:"mt-8 text-base leading-7",dangerouslySetInnerHTML:{__html:l.content_html||"<p></p>"}})]})}),e.jsx("style",{children:` 8 .composer-quill .ql-toolbar.ql-snow{border:0;border-bottom:1px solid rgba(0,0,0,.1);padding:10px 0} 9 .composer-quill .ql-container.ql-snow{border:0;font-family:Arial,Helvetica,sans-serif} 10 .composer-quill .ql-editor{min-height:620px;padding:24px 0;font-size:16px;line-height:1.85;color:#171717} 11 .composer-quill .ql-editor h1{font-size:2.2rem;line-height:1.05;font-weight:900;letter-spacing:-.05em;margin:1.4em 0 .5em} 12 .composer-quill .ql-editor h2{font-size:1.7rem;line-height:1.1;font-weight:900;letter-spacing:-.04em;margin:1.3em 0 .45em} 13 .composer-quill .ql-editor blockquote{border-left:3px solid #D62828;padding-left:18px;color:rgba(0,0,0,.6)} 14 .composer-readonly .ql-editor{padding-top:10px} 15 `})]}):e.jsxs("div",{className:"border border-amber-500/20 bg-amber-50 p-8",children:[e.jsx("p",{className:"font-black",children:"This document did not load."}),e.jsx("p",{className:"mt-2 text-sm text-black/45",children:"The connection may have been interrupted. Try again rather than losing your place."}),e.jsx("button",{type:"button",onClick:()=>g.refetch(),className:"mt-4 h-10 px-4 bg-black text-white text-[8px] font-black uppercase tracking-[.12em]",children:"Try again"})]}):e.jsxs("div",{className:"grid gap-5 lg:grid-cols-[280px_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"border border-black/10 bg-white p-4 h-fit",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[8px] font-black uppercase tracking-[.16em] text-[#D62828]",children:"Composer"}),e.jsx("p",{className:"mt-1 text-xl font-black",children:"Documents"})]}),e.jsx("button",{onClick:J,disabled:n==="create",className:"w-9 h-9 bg-black text-white flex items-center justify-center",children:e.jsx(L,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"mt-4 divide-y divide-black/8",children:[oe.slice(0,30).map(t=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>h("/HarleyMedia/composer/"+t.id),className:"min-w-0 flex-1 py-3 text-left",children:[e.jsx("p",{className:"text-sm font-black leading-5 whitespace-normal break-words",children:t.title||"Untitled"}),e.jsxs("p",{className:"mt-1 text-[7px] font-black uppercase tracking-[.11em] text-black/30",children:[t.collaboration_access?t.collaboration_access+" access":"Private"," · ",t.updated_at?new Date(t.updated_at).toLocaleDateString():""]})]}),!t.collaboration_access&&e.jsx("button",{type:"button",onClick:a=>V(t,a),disabled:n==="delete-"+t.id,"aria-label":"Delete "+(t.title||"document"),title:"Delete document",className:"w-9 h-9 flex-shrink-0 border border-black/10 text-red-600 flex items-center justify-center hover:bg-red-50 disabled:opacity-35",children:e.jsx(W,{className:"w-4 h-4"})})]},t.id)),e.jsxs("button",{type:"button",onClick:()=>h("/HarleyMedia/composer/demo"),className:"w-full py-3 text-left group",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"min-w-0 flex-1 text-sm font-black leading-5 whitespace-normal break-words group-hover:text-[#D62828]",children:"Build the Archive While You Build the Work."}),e.jsx("span",{className:"flex-shrink-0 border border-[#D62828]/25 px-1.5 py-0.5 text-[6px] font-black uppercase tracking-[.1em] text-[#D62828]",children:"Demo"})]}),e.jsx("p",{className:"mt-1 text-[7px] font-black uppercase tracking-[.11em] text-black/30",children:"Read only · Harley Media example"})]})]})]}),e.jsx(Dt,{onNew:J,busy:n==="create"})]})}
15export{Zt 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.