1import{j as e,L as R,r as _,a as k,S as U,b as N}from"./index-SdUtrJj4.js";import{d as B,e as C,f as S,s as E}from"./useApprovedKnowledge-DcS9ELHh.js";import{U as D}from"./UsageNotePublic-CAP5DZEp.js";import{a as I,D as T,b as q}from"./KnowledgeEditor-CmV_ipZP.js";const z=new Set(["formulation","binder_choice","why_binder","binder_oil","why_added","grinding","film_strength","handling","alternative","drying_oil","mixing_behaviour","mixing_yellows","mixing_reds","mixing_complement","mixing_earths","mixing","best_uses","best_use_underpaint","best_use_landscape","best_use_portrait","best_use_glazing","best_use_flesh","best_use_flesh_interior","best_use_botanical","palette_role","palette_role_zorn","tinting","caveat","caveat_caution","caveat_bronzing","caveat_lightfastness","status"]),P=new Set(["historical","historical_context"]),K=s=>!s||s.trim().length<80;function A({wc:s,oilNote:t,pigNote:i}){if(!s)return null;const l=(s.pigment_code||"").toUpperCase().split(/[,/]/)[0]||null,n=(s.description||"").trim(),c=K(n),x=c?null:{text:n,evidenceClass:"A"},o={pigment_code:s.pigment_code||null,single_pigment:(s.pigment_c
1ode||"").split(",").filter(Boolean).length<=1,transparency:s.transparency||null,granulation:s.granulation||null,staining:s.staining_power||null,lightfastness:s.lightfastness||null,tint_rating:s.tint_power||null,vegan:s.vegan??null},u=((i==null?void 0:i.claims)||[]).filter(d=>/^watercolour_/.test(d.field)),m=((i==null?void 0:i.claims)||[]).filter(d=>!/^watercolour_/.test(d.field)&&!/^oil_/.test(d.field)&&d.field!=="master_palette_role"),g=((t==null?void 0:t.claims)||[]).filter(d=>P.has(d.field)||d.field==="colour_character").map(d=>({field:d.field,value:d.value,evidenceClass:d.evidence_class,safe:P.has(d.field)?"medium_neutral":"needs_validation",source_url:d.source_url})),p=((t==null?void 0:t.claims)||[]).filter(d=>z.has(d.field)).length,a=[];c&&a.push("watercolour character","granulation behaviour","staining & lifting","best use (watercolour)","mixing (watercolour)","cross-medium difference"),m.some(d=>/historical/.test(d.field))||a.push("pigment history (if any)");const h=m.some(d=>/historical/.test(d.field))||g.some(d=>d.safe==="medium_neutral");let f;return!c&&h?f="Strong":!c||h?f="Useful but incomplete":f="Still needs expert input",{code:l,isStub:c,authored:x,specs:o,pigWatercolourSpecs:u,pigmentContext:m,oilCandidates:g,rejectedOilCount:p,missingExpertise:a,previewQuality:f}}function Q(s,t){const i=[],l=new Date().toISOString().slice(0,10),n=((s==null?void 0:s.description)||"").trim();n.length>=80&&i.push({field:"colour_character",value:n,evidence_class:"A",source_type:"product_description",source_content_id:s.slug,source_title:s.name,source_field:"description",extraction_date:l,temporal_status:"current",explicit:!0});for(const c of(t==null?void 0:t.claims)||[])!c||/^watercolour_/.test(c.field)||/^oil_/.test(c.field)||c.field==="master_palette_role"||/historical/.test(c.field)&&i.push({...c,evidence_class:c.evidence_class||"A"});return i}const M=s=>/^spec_/i.test(s)||/^oil_/i.test(s)||/^wc_/i.test(s),$=new Set(["colour_character","colour_character_product","best_use","best_use_underpaint","best_use_landscape","best_use_portrait","best_use_glazing","best_use_flesh","best_use_flesh_interior","best_use_botanical","best_use_palette","mixing","mixing_yellows","mixing_reds","mixing_complement","mixing_earths","mixing_lightener","mixing_violets","mixing_greens_greys","palette_role","palette_role_zorn","historical","historical_context"]);function H(s){var i;const t={};for(const l of s||[])!(l!=null&&l.field)||!(l!=null&&l.value)||l.evidence_class==="D"||M(l.field)||$.has(l.field)||(t[i=l.field]||(t[i]=[])).push(String(l.value).trim().toLowerCase());return Object.entries(t).filter(([,l])=>new Set(l).size>1).map(([l])=>l)}function G(s){const t=(s==null?void 0:s.claims)||[],i=[...new Set(t.map(c=>c.source_type).filter(Boolean))],l=[...new Set(t.map(c=>c.source_title).filter(Boolean))].slice(0,2),n=[...new Set(t.map(c=>c.extraction_date).filter(Boolean))];return{count:t.length,types:i,titles:l,extracted:n[0]||null}}function V(s){const t={current:0,historical:0,formulation_specific:0,unknown_period:0};for(const i of(s==null?void 0:s.claims)||[])t[i.temporal_status||"current"]=(t[i.temporal_status||"current"]||0)+1;return t}function J(s,t){const i=s.claims||[],l=((t==null?void 0:t.chemistry)||"").toLowerCase(),n=((t==null?void 0:t.name)||"").toLowerCase(),c=((t==null?void 0:t.pigment_code)||"").toUpperCase(),x=((t==null?void 0:t.colour_family)||"").toLowerCase(),o=[];return i.filter(u=>/mixing|best_use|palette_role/.test(u.field)).length>=2&&o.push("mixing-rich"),i.filter(u=>/formulation|binder|grinding|film|handling|alternative|drying|why_added|why_binder/.test(u.field)).length>=2&&o.push("formulation-rich"),i.some(u=>/historical/.test(u.field))&&o.push("historical"),(/cadmium/.test(n)||/cadmium/.test(l))&&o.push("cadmium"),(/^PW/.test(c)||/white/.test(n))&&o.push("white"),(/^PB/.test(c)||x==="blue")&&o.push("blue"),(/burnt|raw|umber|sienna|ochre/.test(n)||/earth/.test(l)||x==="earth")&&o.push("earth"),/\borganic\b/.test(l)&&!/cadmium/.test(n)&&o.push("modern organic"),o}function X(s,t){var p;const i=Object.fromEntries((t||[]).map(a=>[a.slug,a])),n=(s||[]).filter(a=>a.approval_status==="expert_reviewed"&&Array.isArray(a.claims)&&a.claims.length).map(a=>{const h=i[a.product_slug],f=J(a,h),d=(a.claims||[]).filter(j=>j.evidence_class==="A").length;return{note:a,product:h,cats:f,claimCount:(a.claims||[]).length,thin:d<=2&&(
1a.claims||[]).length<=2}}),c={};for(const a of n)(c[p=a.cats[0]||"general"]||(c[p]=[])).push(a);const x=["mixing-rich","formulation-rich","historical","earth","cadmium","white","blue","modern organic"],o=[],u=new Set;let m=!0;for(;o.length<24&&m;){m=!1;for(const a of x){const h=(c[a]||[]).find(f=>!u.has(f.note.id));if(h&&(u.add(h.note.id),o.push({...h,pilotCategory:a}),m=!0),o.length>=24)break}}const g=n.find(a=>a.thin&&!u.has(a.note.id));g&&(u.add(g.note.id),o.push({...g,pilotCategory:"thin-but-valid"}));for(const a of n){if(o.length>=25)break;u.has(a.note.id)||(u.add(a.note.id),o.push({...a,pilotCategory:a.cats[0]||"general"}))}return o.slice(0,25)}function Y(s,t,i){const l=Object.fromEntries((t||[]).filter(o=>o.watercolour_counterpart_slug).map(o=>[o.watercolour_counterpart_slug,o])),n=Object.fromEntries((i||[]).map(o=>[(o.pigment_code||"").toUpperCase(),o])),x=(s||[]).map(o=>{const u=(o.pigment_code||"").toUpperCase().split(/[,/]/)[0],m=l[o.slug],g=n[u],p=A({wc:o,oilNote:m,pigNote:g});if(!p)return null;const a=!p.isStub,h=!a&&p.pigmentContext.length<3&&p.oilCandidates.length>0,f=a&&p.previewQuality!=="Still needs expert input"&&!h;return{wc:o,oilNote:m,pigNote:g,k:p,qualifies:f}}).filter(Boolean).filter(o=>o.qualifies);return x.sort((o,u)=>{const m=o.k.previewQuality==="Strong"?1:0;return(u.k.previewQuality==="Strong"?1:0)-m||u.k.pigmentContext.length-o.k.pigmentContext.length||(u.wc.description||"").length-(o.wc.description||"").length}),x.slice(0,15)}function v({label:s,value:t}){return!t&&t!==!1&&t!==0?null:e.jsxs("div",{className:"flex gap-3 py-1.5 border-b border-border/50",children:[e.jsx("dt",{className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] text-muted-foreground w-32 shrink-0 pt-0.5",children:s}),e.jsx("dd",{className:"text-sm text-foreground/80",children:String(t)})]})}function Z({wc:s,oilNote:t,pigNote:i,className:l=""}){var m,g;if(!s)return null;const n=A({wc:s,oilNote:t,pigNote:i});if(!n)return null;const c=[...n.pigmentContext.filter(p=>/historical/.test(p.field)),...n.oCandidates.filter(p=>p.safe==="medium_neutral")],x=c.length>0,o=n.specs.transparency||n.specs.granulation||n.specs.staining||n.specs.lightfastness||n.specs.tint_rating,u=n.code||s.name;return e.jsxs("section",{className:`border border-border bg-card p-6 md:p-8 my-10 ${l}`,children:[e.jsx("div",{className:"font-mono-tech text-[10px] uppercase tracking-[0.2em] text-primary mb-1",children:"Watercolour preview"}),e.jsx("div",{className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] text-foreground/45 mb-6",children:"Review only · not published"}),u&&e.jsxs("div",{className:"mb-7",children:[e.jsx("h3",{className:"font-display text-xl text-foreground mb-2",children:"About this colour"}),e.jsxs("p",{className:"text-foreground/80 leading-relaxed",children:[s.name,n.code&&e.jsxs(e.Fragment,{children:[" uses ",e.jsx("span",{className:"font-mono-tech text-primary",children:n.code})]}),n.specs.single_pigment?", a single-pigment":", a multi-pigment"," Michael Harding watercolour."]})]}),o&&e.jsxs("div",{className:"mb-7",children:[e.jsx("h3",{className:"font-display text-xl text-foreground mb-3",children:"Watercolour behaviour"}),e.jsxs("dl",{children:[e.jsx(v,{label:"Transparency",value:n.specs.transparency}),e.jsx(v,{label:"Granulation",value:n.specs.granulation}),e.jsx(v,{label:"Staining",value:n.specs.staining}),e.jsx(v,{label:"Lightfastness",value:n.specs.lightfastness}),n.specs.tint_rating&&e.jsxs("div",{className:"flex gap-3 py-1.5 border-b border-border/50",children:[e.jsx("dt",{className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] text-muted-foreground w-32 shrink-0 pt-0.5",children:"Tinting rating"}),e.jsxs("dd",{className:"text-sm text-foreground/80",children:[n.specs.tint_rating,e.jsx("span",{className:"ml-2 text-[10px] font-mono-tech uppercase tracking-[0.14em] text-foreground/40",children:"raw rating · scale TBC"})]})]})]})]}),x&&n.code&&e.jsxs("div",{className:"mb-7",children:[e.jsx("h3",{className:"font-display text-xl text-foreground mb-2",children:"Pigment background"}
1),e.jsx("p",{className:"text-foreground/80 leading-relaxed",children:((m=c[0])==null?void 0:m.value)||((g=c[0])==null?void 0:g.value)}),e.jsxs(R,{to:`/pigments/${encodeURIComponent(n.code)}`,className:"mt-2 inline-block font-mono-tech text-[11px] uppercase tracking-[0.18em] text-primary link-underline",children:["Full ",n.code," pigment entry â"]})]}),n.authored&&e.jsxs("div",{className:"mb-7",children:[e.jsx("h3",{className:"font-display text-xl text-foreground mb-2",children:"From the studio"}),e.jsx("p",{className:"text-foreground/80 leading-relaxed",children:n.authored.text}),e.jsx("div",{className:"mt-2 font-mono-tech text-[10px] uppercase tracking-[0.14em] text-foreground/40",children:"From the Michael Harding studio"})]}),e.jsxs("div",{className:"border-t border-border pt-4 mt-4 space-y-2",children:[n.oCandidates.filter(p=>p.safe==="needs_validation").length>0&&e.jsxs("p",{className:"font-mono-tech text-[10px] uppercase tracking-[0.14em] text-amber-700",children:["â ",n.oCandidates.filter(p=>p.safe==="needs_validation").length," oil colour-character claim(s) held for expert validation (not transferred)"]}),n.rejectedOilCount>0&&e.jsxs("p",{className:"font-mono-tech text-[10px] uppercase tracking-[0.14em] text-foreground/40",children:[n.rejectedOilCount," oil-specific claim(s) correctly excluded (formulation, mixing, use, binder, drying)"]}),n.missingExpertise.length>0&&e.jsxs("p",{className:"font-mono-tech text-[10px] uppercase tracking-[0.14em] text-foreground/40",children:["Expert gap: ",n.missingExpertise.join(" · ")]})]})]})}const ee=[{key:"oil",label:"Oil usage notes (25)"},{key:"watercolour",label:"Watercolour previews (15)"}];function te({note:s}){const t=G(s);return e.jsxs("div",{className:"text-xs text-foreground/60 leading-relaxed",children:[e.jsx("span",{className:"font-mono-tech text-[10px] uppercase tracking-[0.14em] text-foreground/45",children:"Provenance · "}),t.count," claims from ",t.types.join(", ")||"â",t.titles.length>0&&e.jsxs(e.Fragment,{children:[" · ",t.titles.join(" · ")]}),t.extracted&&e.jsxs(e.Fragment,{children:[" · extracted ",t.extracted]})]})}function se({note:s}){const t=V(s),i=[];return t.current&&i.push(`${t.current} current`),t.historical&&i.push(`${t.historical} historical`),t.formulation_specific&&i.push(`${t.formulation_specific} formulation-specific`),i.length?e.jsxs("div",{className:"font-mono-tech text-[10px] uppercase tracking-[0.14em] text-foreground/45",children:["Temporal · ",i.join(" · ")]}):null}function ne({note:s}){const t=H(s.claims||[]);return t.length?e.jsxs("div",{className:"text-[11px] font-mono-tech uppercase tracking-[0.14em] text-amber-700 border border-amber-300/60 bg-amber-50/60 px-3 py-2",children:["â Conflicting claims on: ",t.join(", ")]}):null}function le(){var y,w;const[s,t]=_.useState("oil"),[i,l]=_.useState({open:!1,record:null}),[n,c]=_.useState(()=>new Set),x=B(),o=C("product_usage"),u=C("pigment_behaviour"),{data:m=[]}=k({queryKey:["products","pubpilot"],queryFn:()=>N.entities.Product.list("sort_order",1e3)}),{data:g=[]}=k({queryKey:["products","Watercolour","pubpilot"],queryFn:()=>N.entities.Product.filter({category:"Watercolour"},"sort_order",300)}),p=((y=o.data)==null?void 0:y.records)||[],a=((w=u.data)==null?void 0:w.records)||[],h=_.useMemo(()=>X(p,m),[p,m]),f=_.useMemo(()=>Y(g,p,a),[g,p,a]),d=async r=>{await S("product_usage",r,"approved"),x()},j=async r=>{await S("product_usage",r,"archived"),x()},L=r=>l({open:!0,record:r}),F=async(r,b)=>{await E(r,b),x(),l({open:!1,record:null})},O=async r=>{const b=Q(r.wc,r.pigNote);await E("product_usage",{product_slug:r.wc.slug,approval_status:"approved",source_author:q,source_role:T,reviewed_date:new Date().toISOString().slice(0,10),claims:b}),x()},W=r=>c(b=>new Set(b).add(r));return e.jsxs("section",{className:"pt-32 md:pt-40 pb-24 bg-background min-h-screen",children:[e.jsx(U,{title:"Publication Pilot",description:"Controlled publication review for oil usage notes and watercolour previews.",noindex:!0}),e.jsxs("div",{className:"mx-auto max-w-[1100px] px-6 md:px-10",children:[e.jsx("h1",{className:"font-display text-3xl md:text-4xl font-medium mb-2",children:"Publication Pilot"}
1),e.jsx("p",{className:"text-foreground/60 text-sm leading-relaxed mb-8 max-w-2xl",children:"Review proposed public wording for a balanced sample of expert-reviewed oil usage notes and qualifying watercolour previews. Approve to publish on the product page; reject to archive. No record is approved automatically."}),e.jsx("div",{className:"flex gap-2 mb-10 border-b border-border pb-3",children:ee.map(r=>e.jsx("button",{onClick:()=>t(r.key),className:`font-mono-tech text-[11px] uppercase tracking-[0.16em] px-4 py-2 border transition-colors ${s===r.key?"bg-foreground text-background border-foreground":"border-border text-foreground/60 hover:border-foreground"}`,children:r.label},r.key))}),s==="oil"&&e.jsxs("div",{className:"space-y-10",children:[o.isLoading&&e.jsx("div",{className:"font-mono-tech text-[11px] uppercase tracking-[0.2em] text-muted-foreground",children:"Loading recordsâ¦"}),h.map(r=>{var b;return e.jsxs("article",{className:"border border-border p-6 md:p-8",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1 mb-4",children:[e.jsx("h2",{className:"font-display text-2xl font-medium",children:((b=r.product)==null?void 0:b.name)||r.note.product_slug}),e.jsx("span",{className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] text-primary",children:r.pilotCategory}),e.jsx("span",{className:"font-mono-tech text-[10px] uppercase tracking-[0.12em] text-foreground/40",children:r.note.product_slug})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-mono-tech text-[10px] uppercase tracking-[0.18em] text-foreground/45 mb-2",children:"Proposed public wording"}),e.jsx(D,{note:r.note})]}),e.jsxs("div",{className:"space-y-2 border-t border-border pt-4",children:[e.jsx(te,{note:r.note}),e.jsx(se,{note:r.note}),e.jsx(ne,{note:r.note})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-5",children:[e.jsx("button",{onClick:()=>d(r.note.id),className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] bg-primary text-background px-5 py-2.5 hover:bg-primary/90",children:"Approve & publish"}),e.jsx("button",{onClick:()=>j(r.note.id),className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] border border-border px-5 py-2.5 hover:border-foreground",children:"Reject (archive)"}),e.jsx("button",{onClick:()=>L(r.note),className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] text-foreground/60 px-5 py-2.5 hover:text-foreground",children:"Edit"})]})]},r.note.id)})]}),s==="watercolour"&&e.jsxs("div",{className:"space-y-10",children:[u.isLoading&&e.jsx("div",{className:"font-mono-tech text-[11px] uppercase tracking-[0.2em] text-muted-foreground",children:"Loading recordsâ¦"}),f.length===0&&e.jsx("div",{className:"font-mono-tech text-[11px] uppercase tracking-[0.2em] text-muted-foreground",children:"No qualifying watercolour previews yet."}),f.map(r=>e.jsxs("article",{className:"border border-border p-6 md:p-8",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1 mb-4",children:[e.jsx("h2",{className:"font-display text-2xl font-medium",children:r.wc.name}),e.jsx("span",{className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] text-primary",children:r.k.code}),e.jsx("span",{className:"font-mono-tech text-[10px] uppercase tracking-[0.12em] text-foreground/40",children:r.k.previewQuality})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"font-mono-tech text-[10px] uppercase tracking-[0.18em] text-foreground/45 mb-2",children:"Proposed public wording"}),e.jsx(Z,{wc:r.wc,oilNote:r.oilNote,pigNote:r.pigNote})]}),e.jsxs("div",{className:"space-y-2 border-t border-border pt-4",children:[e.jsxs("div",{className:"text-xs text-foreground/60 leading-relaxed",children:[e.jsx("span",{className:"font-mono-tech text-[10px] uppercase tracking-[0.14em] text-foreground/45",children:"Pigment context · "}),r.k.pigmentContext.length," medium-neutral claim(s)"]}),r.k.oilCandidates.filter(b=>b.safe==="needs_validation").length>0&&e.jsxs("div",{className:"font-mono-tech text-[10px] uppercase tracking-[0.14em] text-amber-700",children:["â ",r.k.oilCandidates.filter(b=>b.safe==="needs_validation").length," oil-derived claim(s) held (not published)"]}),r.k.missingExpertise.length>0&&e.jsxs("div",{className:"font-mono-tech text-[10px] uppercase tracking-[0.14em] text-foreground
1/45",children:["Expert gap · ",r.k.missingExpertise.join(" · ")]})]}),!n.has(r.wc.slug)&&e.jsxs("div",{className:"flex flex-wrap gap-3 mt-5",children:[e.jsx("button",{onClick:()=>O(r),className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] bg-primary text-background px-5 py-2.5 hover:bg-primary/90",children:"Approve & publish"}),e.jsx("button",{onClick:()=>W(r.wc.slug),className:"font-mono-tech text-[10px] uppercase tracking-[0.16em] border border-border px-5 py-2.5 hover:border-foreground",children:"Reject"})]}),n.has(r.wc.slug)&&e.jsx("div",{className:"font-mono-tech text-[10px] uppercase tracking-[0.14em] text-foreground/45 mt-4",children:"Rejected for this session."})]},r.wc.slug))]})]}),i.open&&e.jsx("div",{className:"fixed inset-0 bg-foreground/40 flex items-start justify-center overflow-y-auto pt-16 pb-16 px-4 z-50",children:e.jsx("div",{className:"w-full max-w-2xl bg-background",children:e.jsx(I,{type:"product_usage",record:i.record,onSave:F,onClose:()=>l({open:!1,record:null})})})})]})}export{le 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.