PageSourceSearch

https://app.searchpilot.com/assets/vite/index-Dg-vjK6y.js

js searchpilot.com collected 2026-09-24 17:42:25 UTC 38,042 bytes, 2 lines download raw bytes

1import{j as t,R as v,r as ge,z as u,u as U,s as M}from"./root-C9LVyve2.js";import{j as D,F as Ee,i as Q,k as xt,l as bt,m as gt,n as jt,G as yt,H as vt,o as Nt,h as N,J as _t,K as St,X as Ct,D as ae,s as re,t as le,u as ie,w as oe,I as Rt,x as ce,B as Te,T as kt,a as wt,b as je,c as O,d as Et,e as L,L as Ie,M as Fe,C as Tt,g as It,q as B,N as W,O as Ft,f as V,r as De,v as $e,A as C,y as se,P as Dt,S as G,Q as ye,R as $t,U as Pt,V as Ot,W as ve}from"./index-DxzqVku9.js";import{T as Lt,M as At,a as Mt,b as qt,c as Kt,d as Ut,F as Bt,D as Ht,A as Pe,e as Oe}from"./Matcher-D7pAnBUS.js";import{P as z,a as q,k as Le,f as Ae,T as Qt,v as Vt,C as zt,V as I,b as Wt,s as Gt,i as Yt,n as de,c as Jt,d as Xt,t as Zt}from"./matcherModel-DAG2F6ue.js";import{P as ue}from"./plus-DIKoTClW.js";import{c as es}from"./criteria-DwvHm8ut.js";import{N as A}from"./experimentStatus-CrBewWCL.js";import{q as Me}from"./queryOptions-BQvTFV_-.js";import{u as Y}from"./useMutation-CBnyrxiv.js";import{u as ts}from"./useRouterState-CJ66pkiW.js";import{F as ss}from"./FormField-BPbSNmIm.js";import"./RouterProvider-BasQyeSe.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"distillery-frontend"};var s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="0bb4ec7d-e3c1-4463-8cc1-017c92b29bae",e._sentryDebugIdIdentifier="sentry-dbid-0bb4ec7d-e3c1-4463-8cc1-017c92b29bae")}catch{}})();const qe=()=>Object.keys(Ae.step),me=e=>qe().includes(e),J=e=>me(e)?Ae.step[e]:[],Ke=e=>Le.step[e]?.payloadKey??"",$=(e,s)=>s===null?$(e,z)||$(e,q):Le.step[e]?.phases?.includes(s)??!1,ns=e=>{const s=$(e,z),n=$(e,q);return s===n?null:s?z:q},Ue=e=>qe().filter(s=>$(s,e)),as={add_before_css:"Insert HTML before the element",prepend_to_css:"Insert HTML after the opening tag",append_to_css:"Insert HTML before the closing tag",add_after_css:"Insert HTML after the element",add_class:"Add a class to the element",set_attribute:"Set an attribute on the element",update_element_type:"Change the element’s tag type",replace_inner:"Replace the element’s contents with HTML",replace_inner_text:"Replace the element’s contents with text",replace_within_css:"Find and replace within the element",remove_css:"Remove the element",remove_class:"Remove a class from the element",remove_attribute:"Remove an attribute from the element",set_header:"Set a header",update_header:"Update an existing header",append_header:"Append a value to a header",remove_header:"Remove a header",remove_header_matching:"Remove a header value by regex",set_status:"Change the status code",redirect:"Redirect to another path",set_path:"Rewrite the path",set_param:"Set a request parameter",update_param:"Update a request parameter",remove_param:"Remove a request parameter"},F=e=>as[e]??e.split("_").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" "),rs=[{key:"insert",label:"Insert HTML"},{key:"edit",label:"Edit"},{key:"replace",label:"Replace"},{key:"remove",label:"Remove"},{key:"header",label:"Header"},{key:"status",label:"Status code"},{key:"request",label:"Request modification"},{key:"other",label:"Other"}],ls={add_before_css:"insert",prepend_to_css:"insert",append_to_css:"insert",add_after_css:"insert",add_class:"edit",set_attribute:"edit",update_element_type:"edit",replace_inner:"replace",replace_inner_text:"replace",replace_within_css:"replace",remove_css:"remove",remove_class:"remove",remove_attribute:"remove",set_header:"header",update_header:"header",append_header:"header",remove_header:"header",remove_header_matching:"header",set_status:"status",redirect:"status",set_path:"request",set_param:"request",update_param:"request",remove_param:"request"},is=e=>ls[e]??"other",os={css_selector:"CSS selector",html:"HTML",key:"header key",regex:"target regex",replace:"replacement",element_type:"tag type"},cs=e=>os[e.name]??e.name.replace(/_/g," "),Be={"set_status.status":{placeholder:"e.g. 404",width:"w-32"},"redirect.status":{placeholder:"e.g. 301",width:"w-32"},"redirect.path":{placeholder:"e.g. /bathroom/sinks/"},"set_path.path":{placeholder:"e.g. /bathroom/sinks/"},"add_class.value":{placeholder:"class name(s)"},"remove_class.value":{placeholder:"class to remove"},"update_element_type.element_type":{placeholder:"e.g. h2",width:"w-32"},"replace_inner_text.text":{placeholder:"new text content"},"replace_within_css.regex":{placeholder:String.raw`e.g. out of stock`},"remove_header_matching.regex":{placeholder:"e.g. noindex"}},ds=(e,s)=>Be[`${e}.${s.name}`]?.placeholder??Qt[s.type],us=(e,s)=>({label:cs(s),placeholder:ds(e,s),width:Be[`${e}.${s.name}`]?.width??null});let ms=0;const hs=()=>`step-${ms+=1}`,ps=e=>e==="bool"?!1:e==="string_list"?[]:"",he=e=>({id:hs(),kind:e,fields:Object.fromEntries(J(e).map(s=>[s.jsonName,ps(s.type)])),enabled:!0}),fs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),He=e=>{if(!me(e.kind))return{kind:e.kind};const s=Object.fromEntries(Object.entries(e.fields).map(([n,a])=>[n,Array.isArray(a)?a.filter(r=>r!==""):a]));return{kind:e.kind,usedVariables:[],[Ke(e.kind)]:s}},xs=e=>({...He(e),enabled:e.enabled}),bs=e=>typeof e=="string"||typeof e=="boolean"?e:typeof e=="number"?String(e):Array.isArray(e)&&e.every(s=>typeof s=="string")?e:null,gs=e=>{const s=e.kind??"",n=e.enabled!==!1,a={...he(s),enabled:n};if(!me(s))return a;const r=e[Ke(s)],l=fs(r)?r:{},d=new Map(J(s).flatMap(c=>[[c.name,c.jsonName],[c.jsonName,c.jsonName]])),o={...a.fields};for(const[c,f]of Object.entries(l)){const g=d.get(c)??c,x=bs(f);x!==null&&(o[g]=x)}return{id:a.id,kind:s,fields:o,enabled:n}},js=(e,s)=>e.filter((n,a)=>a!==s),ys=(e,s,n)=>e.map((a,r)=>
1{if(r!==s)return a;const l=he(n);return{...l,id:a.id,enabled:a.enabled,fields:Object.fromEntries(Object.entries(l.fields).map(([d,o])=>[d,d in a.fields?a.fields[d]:o]))}}),vs=(e,s,n)=>e.map((a,r)=>r===s?{...a,enabled:n}:a),Ns=(e,s,n,a)=>e.map((r,l)=>l===s?{...r,fields:{...r.fields,[n]:a}}:r),_s=(e,s,n)=>{const a=s+n,r=e[s];if(r===void 0||a<0||a>=e.length)return e;const l=e.filter((d,o)=>o!==s);return l.splice(a,0,r),l},Ss=(e,s)=>{const n=e.field===""?"":`"${e.field}"`,a=e.context[zt.Phase]??"";switch(e.code){case I.UnsupportedKind:return`${F(s)} is not a step this spec version knows.`;case I.KindInvalidInPhase:return`${F(s)} cannot be used in the ${a} phase.`;case I.RequiredFieldMissing:return`${n} is required.`;case I.RequiredFieldEmpty:return`${n} cannot be empty.`;case I.PayloadMissing:return`${F(s)} has no settings.`;default:return`${e.code}${n===""?"":` (${n})`}`}},Cs=(e,s)=>s??($(e,q)?q:z),Qe=(e,s)=>e.flatMap((n,a)=>Vt(He(n),Cs(n.kind,s)).map(r=>({index:a,kind:n.kind,field:r.field,code:r.code,message:Ss(r,n.kind)}))),Rs=[I.RequiredFieldMissing,I.RequiredFieldEmpty],Ve=e=>Rs.includes(e.code),ks=e=>J(e.kind).map(s=>e.fields[s.jsonName]).map(s=>Array.isArray(s)?s.filter(n=>n!=="").join(", "):s).filter(s=>typeof s=="string"&&s!==""),ws="w-[280px] justify-between overflow-hidden",Ne="mt-2 w-5 shrink-0 text-right text-xs font-semibold tabular-nums text-sp-neutral-400",_e=["h-auto shrink-0 rounded p-1 text-sp-neutral-400","hover:bg-sp-neutral-50 hover:text-sp-neutral-600","disabled:pointer-events-none disabled:opacity-30"].join(" "),Es="border-sp-neutral-200 flex flex-wrap items-start gap-2 rounded-lg border bg-white p-3",Ts=({step:e,index:s,total:n,phase:a,violations:r,readOnly:l,onChangeKind:d,onSetEnabled:o,onSetField:c,onMove:f,onRemove:g})=>{const x=e.id,m=`step ${s+1} (${F(e.kind)})`,h=r.filter(i=>!Ve(i));if(l)return t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:D("flex items-start gap-2",!e.enabled&&"opacity-50"),children:[t.jsx("span",{className:Ne,children:s+1}),t.jsxs("p",{className:"mt-1.5 text-sm",children:[t.jsx("span",{className:"text-sp-primary font-medium",children:F(e.kind)})," ",ks(e).join(" "),!e.enabled&&t.jsx("span",{className:"text-sp-neutral-500 ml-2 text-xs",children:"(off)"})]})]}),r.map(i=>t.jsx("p",{className:"text-sp-error text-xs",children:i.message},`${i.field}-${i.code}`))]});const p=Ue(a),S=p.includes(e.kind)?p:[e.kind,...p],R=S.map(i=>({value:i,label:F(i)})),j=rs.map(i=>({...i,kinds:S.filter(b=>is(b)===i.key)})).filter(i=>i.kinds.length>0),E=i=>h.find(b=>b.field===i);return t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:Es,"data-step":s,children:[t.jsx(Ee,{className:"mt-1.5",checked:e.enabled,title:e.enabled?`Disable ${m}`:`Enable ${m}`,"aria-label":e.enabled?`Disable ${m}`:`Enable ${m}`,onCheckedChange:i=>o(s,i)}),t.jsx("span",{className:Ne,children:s+1}),t.jsxs("div",{className:"shrink-0",children:[t.jsx(Q,{htmlFor:`${x}-kind`,className:"sr-only",children:"Step type"}),t.jsxs(xt,{items:R,value:e.kind,onValueChange:i=>{i!==null&&d(s,i)},children:[t.jsx(bt,{id:`${x}-kind`,"aria-label":"Step type",className:D(Lt,ws),children:t.jsx("span",{className:"truncate text-left",children:t.jsx(gt,{})})}),t.jsx(jt,{className:D(Ut,Kt),children:j.map((i,b)=>t.jsxs(yt,{children:[t.jsx(vt,{className:D(Mt,b>0&&At),children:i.label}),i.kinds.map(k=>t.jsx(Nt,{value:k,className:qt,children:F(k)},k))]},i.key))})]})]}),t.jsx("div",{className:D("flex min-w-0 flex-1 flex-wrap items-center gap-2",!e.enabled&&"opacity-50"),children:J(e.kind).map(i=>t.jsx(Bt,{field:i,presentation:us(e.kind,i),inputId:`${x}-${i.name}`,value:e.fields[i.jsonName]??"",invalid:E(i.name)!==void 0,onChange:b=>c(s,i.jsonName,b)},i.name))}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[t.jsx(N,{type:"button",variant:"ghost",size:"sm",className:_e,disabled:s===0,onClick:()=>f(s,-1),"aria-label":`Move ${m} earlier`,children:t.jsx(_t,{"aria-hidden":"true"})}),t.jsx(N,{type:"button",variant:"ghost",size:"sm",className:_e,disabled:s===n-1,onClick:()=>f(s,1),"aria-label":`Move ${m} later`,children:t.jsx(St,{"aria-hidden":"true"})}),t.jsx(N,{type:"button",variant:"ghost",size:"sm",className:Ht,onClick:()=>g(s),"aria-label":`Remove ${m}`,children:t.jsx(Ct,{"aria-hidden":"true"})})]})]}),h.map(i=>t.jsx("p",{id:i.field===""?void 0:`${x}-${i.field}-error`,className:"text-sp-error pl-7 text-xs",children:i.message},`${i.field}-${i.code}`))]})},Is=e=>Ue(e)[0]??"",Fs=({value:e,phase:s,onChange:n,readOnly:a=!1})=>{const r=v.useMemo(()=>Qe(e,s),[e,s]);return e.length===0&&a?t.jsx("p",{className:"text-sp-neutral-500 text-sm",children:"No steps."}):t.jsxs("div",{className:"space-y-2",children:[e.map((l,d)=>t.jsx(Ts,{step:l,index:d,total:e.length,phase:s,readOnly:a,violations:r.filter(o=>o.index===d),onChangeKind:(o,c)=>n(ys(e,o,c)),onSetEnabled:(o,c)=>n(vs(e,o,c)),onSetField:(o,c,f)=>n(Ns(e,o,c,f)),onMove:(o,c)=>n(_s(e,o,c)),onRemove:o=>n(js(e,o))},l.id)),!a&&t.jsxs(t.Fragment,{children:[e.length===0&&t.jsx("div",{className:"border-sp-neutral-300 rounded-lg border border-dashed px-4 py-6 text-center",children:t.jsx("p",{className:"text-sp-neutral-500 text-sm",children:"No steps yet — this rule changes nothing. Add a step to give it an effect."})}),t.jsx("div",{className:"pt-1",children:t.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:Pe,onClick:()=>n([...e,he(Is(s))]),children:[t.jsx(ue,{"aria-hidden":"true"})," Add step"]})})]})]})},X=e=>{for(const n of e.steps){const a=ns(n.kind);if(a!==null)return a}const s=n=>Gt(n.kind)??n.children.reduce((a,r)=>a??s(r),null);return e.criteria===null?null:s(e.criteria)};function Ds(e={}
1){return{name:"",notes:"",criteria:null,steps:[],...e}}function ze(e={}){const[s,n]=ge.useState(()=>Ds(e)),a=ge.useCallback((r,l)=>{n(d=>({...d,[r]:l}))},[]);return{state:s,setField:a}}const We=(e,s)=>{const n=e.filter(s).length;return{outstanding:n,problems:e.length-n}},Ge=(e,s)=>We(e.criteria===null?[]:Wt(e.criteria,X(e),s),Yt),Ye=e=>We(Qe(e.steps,X(e)),Ve);function Je(e,s){if(e.name.trim()==="")return{canSubmit:!1,hint:"Name this rule to continue."};const n=Ye(e),a=Ge(e,s);return n.problems>0?{canSubmit:!1,hint:"Fix the highlighted steps."}:a.problems>0?{canSubmit:!1,hint:"Fix the highlighted criteria."}:n.outstanding>0?{canSubmit:!1,hint:"Finish the steps to continue."}:a.outstanding>0?{canSubmit:!1,hint:"Finish the criteria to continue."}:{canSubmit:!0,hint:null}}const Xe="Describe how the rule works, and what it does.",$s=["border-sp-neutral-300 w-full resize-y rounded-lg border px-3 py-2 text-sm","focus:border-sp-primary-300 focus:ring-sp-primary-100 focus:outline-none focus:ring-2"].join(" "),Ps=({open:e,onOpenChange:s,pageTemplateId:n,templateName:a,onCreate:r})=>t.jsx(ae,{open:e,onOpenChange:s,children:t.jsxs(re,{size:"lg","aria-labelledby":"new-rule-title",children:[t.jsx(le,{closeLabel:"Close",children:t.jsx(ie,{id:"new-rule-title",children:"New Rule"})}),t.jsx(Os,{pageTemplateId:n,templateName:a,onCreate:r,onCancel:()=>s(!1)})]})}),Os=({pageTemplateId:e,templateName:s,onCreate:n,onCancel:a})=>{const{state:r,setField:l}=ze(),[d,o]=v.useState(!1),c=v.useId(),f=de(e),g=Je(r,f),x=m=>{if(m.preventDefault(),g.canSubmit){const{name:h,notes:p,criteria:S}=r;n({name:h,notes:p,criteria:S})}};return t.jsxs("form",{onSubmit:x,className:"flex min-h-0 flex-col",children:[t.jsxs(oe,{className:"min-h-0 overflow-y-auto",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Q,{htmlFor:"new-rule-name",children:"Rule name"}),t.jsx(Rt,{id:"new-rule-name",value:r.name,onChange:m=>l("name",m.target.value),placeholder:"e.g. Breadcrumb schema injection"})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Q,{htmlFor:"new-rule-notes",children:"Notes"}),t.jsx("textarea",{id:"new-rule-notes",rows:6,value:r.notes,onChange:m=>l("notes",m.target.value),placeholder:Xe,className:$s})]}),d?t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("p",{className:"text-sp-neutral-800 text-sm font-medium",children:"Criteria"}),t.jsxs("p",{className:"text-sp-neutral-500 text-xs",children:["By default this rule applies to every page of ",t.jsx("b",{children:s})," with a healthy (200) response; the template's criteria and the rule's must both match."]}),t.jsx(Oe,{value:r.criteria,phase:X(r),normalisationId:f,onChange:m=>l("criteria",m),universeLabel:s})]}):t.jsxs("div",{children:[t.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:Pe,onClick:()=>o(!0),children:[t.jsx(ue,{"aria-hidden":"true"})," Add Criteria"]}),t.jsx("p",{className:"text-sp-neutral-500 mt-1 text-xs",children:"Add criteria to control when this rule is applied."})]})]}),t.jsxs(ce,{children:[g.hint!==null&&t.jsx("p",{id:c,className:"text-sp-neutral-500 mr-auto min-w-0 text-xs",children:g.hint}),t.jsx(N,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),t.jsx(N,{type:"submit",disabled:!g.canSubmit,"aria-describedby":g.hint!==null?c:void 0,children:"Add Rule"})]})]})},Ze={off:{label:"Off",variant:"outline",className:A},off_was_live:{label:"Off · previously live",variant:"outline",className:A},draft:{label:"Draft",variant:"outline",className:A},draft_was_live:{label:"Draft · previously live",variant:"outline",className:A},live:{label:"Live",variant:"success"},edited_not_live:{label:"Edited · not live yet",variant:"warning"},edited_still_live:{label:"Edited · still live",variant:"warning"}},et=e=>Object.prototype.hasOwnProperty.call(Ze,e),Ls=e=>et(e)?Ze[e]:{label:e,variant:"outline",className:A},Z={label:"Sync to live",destructive:!1,disabledReason:"Nothing to sync."},As={draft:{label:"Deploy to live",destructive:!1,disabledReason:null},draft_was_live:{label:"Deploy to live",destructive:!1,disabledReason:null},edited_not_live:{label:"Sync edits to live",destructive:!1,disabledReason:null},edited_still_live:{label:"Sync removal to live",destructive:!0,disabledReason:null},off:Z,off_was_live:Z,live:Z},tt=e=>et(e)?As[e]:{label:"Sync to live",destructive:!1,disabledReason:"Unknown status."},Ms=["live","off","off_was_live"],qs=e=>Ms.includes(e),st=({status:e,size:s})=>{const n=Ls(e);return t.jsx(Te,{variant:n.variant,size:s,className:n.className,children:n.label})},Ks=({rule:e})=>{const s=es(e.criteria),n=s===null?0:Jt(s);return n===0?t.jsx("span",{className:"text-sp-neutral-400",children:"No"}):t.jsxs("span",{className:"font-medium",children:["Yes (",n,")"]})},Us=({clientSlug:e,rules:s})=>t.jsxs(kt,{children:[t.jsx(wt,{children:t.jsxs(je,{children:[t.jsx(O,{children:"Name"}),t.jsx(O,{children:"Criteria"}),t.jsx(O,{className:"text-right",children:"Steps"}),t.jsx(O,{children:"Status"}),t.jsx(O,{className:"w-12"})]})}),t.jsx(Et,{children:s.map(n=>t.jsxs(je,{className:"hover:bg-sp-neutral-25 relative",children:[t.jsx(L,{children:t.jsx(Ie,{to:Fe(e,n.id),className:"text-sp-primary-600 hover:text-sp-primary font-medium after:absolute after:inset-0 hover:underline",children:n.name})}),t.jsx(L,{className:"text-sp-neutral-700",children:t.jsx(Ks,{rule:n})}),t.jsx(L,{className:"text-sp-neutral-700 text-right tabular-nums",children:n.steps.length}),t.jsx(L,{children:t.jsx(st,{status:n.status})}),t.jsx(L,{className:"text-right",children:t.jsx(Tt,{className:"text-sp-neutral-400 size-4","aria-hidden":"true"})})]},n.id))})]}),nt="ruleDraft",Bs=e=>({[nt]:e}),K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Se=e=>typeof e=="string"?e:"",at=e=>
1!K(e)||typeof e.kind!="string"?null:{kind:e.kind,fields:K(e.fields)?e.fields:{},children:(Array.isArray(e.children)?e.children:[]).map(at).filter(s=>s!==null)},Hs=e=>{if(!K(e))return null;const s=e[nt];return K(s)?{name:Se(s.name),notes:Se(s.notes),criteria:at(s.criteria)}:null},rt="ruleCreated",Qs=()=>({[rt]:!0}),Vs=e=>K(e)&&e[rt]===!0,zs=u.custom(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),{message:"Expected a JetEngine step object"}),Ws=u.object({id:u.number(),name:u.string(),notes:u.string(),phase:u.string(),criteria:Ft.nullable(),steps:u.array(zs),order:u.number(),enabled:u.boolean(),live:u.boolean(),status:u.string(),can_publish:u.boolean(),cannot_publish_reason:u.string().nullable()}).transform(e=>({id:e.id,name:e.name,notes:e.notes,phase:e.phase,criteria:e.criteria,steps:e.steps,order:e.order,enabled:e.enabled,live:e.live,status:e.status,canPublish:e.can_publish,cannotPublishReason:e.cannot_publish_reason})),Gs=u.object({results:u.array(Ws)});async function Ys(e){const{results:s}=await It(`/api/mach2/page_templates/${e}/rules/`,Gs);return s}const Js=u.object({rule_id:u.number(),name:u.string(),last_edited_by:u.object({first_name:u.string(),last_name:u.string()}).nullable()}).transform(e=>({ruleId:e.rule_id,name:e.name,lastEditedBy:e.last_edited_by===null?null:{firstName:e.last_edited_by.first_name,lastName:e.last_edited_by.last_name}})),Xs=u.object({kind:u.string(),key:u.string(),action:u.string(),rule_id:u.number().optional(),name:u.string().optional()}).transform(e=>({kind:e.kind,key:e.key,action:e.action,ruleId:e.rule_id,name:e.name})),Zs=u.object({statuses:u.array(u.object({rule_id:u.number(),status:u.string()}).transform(e=>({ruleId:e.rule_id,status:e.status}))),affected_rules:u.array(Js),changes:u.array(Xs)}).transform(e=>({statuses:e.statuses,affectedRules:e.affected_rules,changes:e.changes}));async function en(e){return B("/api/mach2/page_template_rules/changes/",{rule_ids:e},Zs)}const tn=u.object({publish_event_id:u.number(),status:u.string()}).transform(e=>({publishEventId:e.publish_event_id,status:e.status}));async function sn({ruleIds:e,notes:s="",token:n=""}){return B("/api/mach2/page_template_rules/publish/",{rule_ids:e,notes:s,token:n},tn)}function ne(e){if(!(e instanceof W))return{kind:"none"};const s=e.status===400?e.fieldError("token"):void 0;if(s!==void 0)return{kind:"rejected",message:s};if(e.status!==403||!("instruction"in e.fieldErrors))return{kind:"none"};const n=e.fieldError("instruction")??"",a=e.detail??e.message;return n===""?{kind:"no-device",detail:a}:{kind:"prompt",detail:a,instruction:n}}const pe=u.object({id:u.number()});async function nn({pageTemplateId:e,name:s,notes:n,criteria:a,steps:r,enabled:l}){return B("/api/mach2/page_template_rules/create/",{page_template_id:e,name:s,notes:n,criteria:a,steps:r,enabled:l},pe)}async function an({ruleId:e}){return B("/api/mach2/page_template_rules/delete/",{rule_id:e},pe)}async function rn({ruleId:e,name:s,notes:n,criteria:a,steps:r,enabled:l}){return B("/api/mach2/page_template_rules/update/",{rule_id:e,name:s,notes:n,criteria:a,steps:r,enabled:l},pe)}const P=e=>Me({queryKey:["pageTemplateRules",e],queryFn:()=>Ys(e),enabled:e!==null}),ln=e=>{const s=U();return Y({mutationFn:nn,onSuccess:()=>s.invalidateQueries({queryKey:P(e).queryKey})})},Ce=e=>{const s=U();return Y({mutationFn:rn,onSuccess:()=>s.invalidateQueries({queryKey:P(e).queryKey})})},on=e=>{const s=U();return Y({mutationFn:an,onSuccess:()=>s.invalidateQueries({queryKey:P(e).queryKey})})},cn=e=>Me({queryKey:["pageRuleChanges",[...e].sort((s,n)=>s-n)],queryFn:()=>en(e),staleTime:0,gcTime:0}),dn=e=>{const s=U();return Y({mutationFn:sn,onSuccess:()=>s.invalidateQueries({queryKey:P(e).queryKey})})},zn=()=>{const{clientSlug:e}=V.useParams(),{site:s,template:n}=V.useSearch(),[a,r]=v.useState(!1),d=v.useMemo(()=>De(e).find(p=>p.value===s),[e,s])!==void 0&&n!==void 0,o=M({...$e(s??""),enabled:d}),c=o.data?.find(p=>p.id===n)??null,f=M(P(c?.id??null)),g=p=>{r(!1),se().navigate({to:Dt(e),state:Bs(p)})},x=t.jsx("div",{"aria-busy":"true",children:t.jsx(G,{className:"h-40 w-full"})}),m=t.jsx(C,{variant:"info",children:"Choose a site and a page template to see its rules."}),h=()=>d?c===null?o.isPending?x:m:f.isError?t.jsx(C,{variant:"error",role:"alert",children:"Couldn't load this page template's rules. Reload to try again."}):f.isPending?x:f.data.length===0?t.jsx("div",{className:"border-border bg-background rounded-lg border",children:t.jsx("p",{className:"text-muted-foreground px-5 py-10 text-center text-sm",children:"No rules on this page template yet."})}):t.jsx("div",{className:"border-border bg-background overflow-hidden rounded-lg border",children:t.jsx(Us,{clientSlug:e,rules:f.data})}):m;return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-foreground text-lg font-semibold",children:"Page Rules"}),t.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"Always-on changes applied to pages in this template."})]}),d&&t.jsx(N,{onClick:()=>r(!0),disabled:c===null,children:"Create rule"})]}),h(),c!==null&&t.jsx(Ps,{open:a,onOpenChange:r,pageTemplateId:c.id,templateName:c.name,onCreate:g})]})}
1,Re=({title:e,subtitle:s,action:n,children:a})=>t.jsxs("section",{"aria-label":e,className:"border-border bg-background rounded-xl border",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4 px-5 py-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h3",{className:"text-sp-neutral-900 text-base font-semibold",children:e}),s!==void 0&&t.jsx("p",{className:"text-sp-neutral-500 mt-0.5 text-xs",children:s})]}),n!==void 0&&t.jsx("div",{className:"shrink-0",children:n})]}),a!==void 0&&t.jsx("div",{className:"border-border space-y-3 border-t p-5",children:a})]}),un=({name:e,notes:s,onNameChange:n,onNotesChange:a})=>t.jsxs("div",{className:"min-w-0",children:[t.jsx(ye,{variant:"heading",label:"Rule name",value:e,onChange:n,placeholder:"e.g. Breadcrumb schema injection",emptyLabel:"Name this rule"}),t.jsx(ye,{variant:"subheading",label:"Notes",value:s,onChange:a,placeholder:Xe,className:"mt-1.5 max-w-3xl"})]}),ke=({counts:e,noun:s})=>e.problems===0&&e.outstanding===0?null:t.jsxs("div",{className:"space-y-1",children:[e.problems>0&&t.jsxs("p",{className:"text-destructive text-xs",children:[e.problems," ",s," ",e.problems===1?"problem":"problems"," to fix before this rule can run."]}),e.outstanding>0&&t.jsx("p",{className:"text-sp-neutral-500 text-xs",children:e.outstanding===1?`One ${s} field is still empty.`:`${e.outstanding} ${s} fields are still empty.`})]}),mn=["name","criteria","steps"],ee=(e,s)=>e instanceof W?e.fieldErrors[s]??[]:[],lt=e=>{if(e===null)return[];if(!(e instanceof W))return[e.message];const s=Object.entries(e.fieldErrors).filter(([n])=>!mn.includes(n)).flatMap(([,n])=>n);return e.detail!==null?[e.detail,...s]:s.length===0&&Object.keys(e.fieldErrors).length===0?[e.message]:s},hn=e=>{if(e===null)return[];if(!(e instanceof W))return[e.message];const s=Object.values(e.fieldErrors).flat(),n=e.detail!==null?[e.detail,...s]:s;return n.length===0?[e.message]:n},pn=e=>{const s=ne(e);return s.kind==="prompt"?[]:s.kind==="no-device"?[s.detail]:lt(e)},we="Page rules are stored but not yet applied to live pages.",fn=(e,s)=>e?`Saved. ${we}`:s?`Rule created. ${we}`:null,te=({messages:e,className:s})=>e.length===0?null:t.jsx("div",{role:"alert",className:D("text-destructive space-y-1 text-xs",s),children:e.map((n,a)=>t.jsx("p",{children:n},`${a}-${n}`))}),xn=({pageTemplateId:e,templateName:s,initial:n,submitLabel:a,pending:r=!1,error:l=null,saved:d=!1,created:o=!1,deleteControl:c,statusControl:f,stepsControl:g,onSubmit:x,onCancel:m})=>{const{state:h,setField:p}=ze(n),S=v.useId(),[R,j]=v.useState(()=>(n?.criteria??null)!==null),E=()=>{j(!0)},i=de(e),b=X(h),k=Ye(h),y=Ge(h,i),_=Je(h,i),[T,dt]=v.useState(o?h:null),fe=T===h,H=fe?l:null,ut=ee(H,"name"),mt=ee(H,"steps"),ht=ee(H,"criteria"),xe=lt(H),be=fn(d,o),pt=w=>{w.preventDefault(),_.canSubmit&&!r&&(dt(h),x(h))};return t.jsxs("form",{onSubmit:pt,className:"flex h-full flex-col",children:[t.jsxs("header",{className:"border-sp-neutral-200 shrink-0 border-b bg-white px-8 py-6",children:[t.jsxs("div",{className:"flex items-start gap-4",children:[t.jsx(un,{name:h.name,notes:h.notes,onNameChange:w=>p("name",w),onNotesChange:w=>p("notes",w)}),f!==void 0&&t.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-3",children:f})]}),t.jsx(te,{messages:ut,className:"mt-2"})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-8",children:t.jsxs("div",{className:"space-y-4 py-6",children:[t.jsxs(Re,{title:"Rule Steps",subtitle:"Steps are applied in the order the targeted elements appear in the HTML.",action:g,children:[t.jsx(Fs,{value:h.steps,phase:b,onChange:w=>p("steps",w)}),t.jsx(ke,{counts:k,noun:"step"}),t.jsx(te,{messages:mt})]}),t.jsx(Re,{title:"Criteria",subtitle:t.jsxs(t.Fragment,{children:["Add criteria to control when this rule is applied. By default it applies to every page of ",t.jsx("b",{children:s})," with a healthy (200) response; the template's criteria and the rule's must both match."]}),action:R?void 0:t.jsxs(N,{type:"button",variant:"outline",size:"sm",onClick:E,children:[t.jsx(ue,{"aria-hidden":"true"})," Add Criteria"]}),children:R?t.jsxs(t.Fragment,{children:[t.jsx(Oe,{value:h.criteria,phase:b,normalisationId:i,onChange:w=>p("criteria",w),universeLabel:s}),t.jsx(ke,{counts:y,noun:"criteria"}),t.jsx(te,{messages:ht})]}):void 0})]})}),be!==null&&fe&&!r&&l===null&&t.jsx(C,{variant:"info",role:"status",className:"mx-8 mb-3 shrink-0",children:be}),xe.length>0&&t.jsx(C,{variant:"error",role:"alert",className:"mx-8 mb-3 shrink-0 flex-col gap-1",children:xe.map((w,ft)=>t.jsx("p",{children:w},`${ft}-${w}`))}),t.jsxs("div",{className:"border-sp-neutral-200 bg-background flex shrink-0 flex-wrap items-center gap-4 border-t px-8 py-4",children:[t.jsx(N,{type:"button",variant:"outline",onClick:m,children:"Cancel"}),c,_.hint!==null&&t.jsx("p",{id:S,className:"text-sp-neutral-500 min-w-0 flex-1 text-xs",children:_.hint}),t.jsx(N,{type:"submit",className:"ml-auto",disabled:!_.canSubmit||r,"aria-describedby":_.hint!==null?S:void 0,children:r?"Saving…":a})]})]})},bn=(e,s)=>({name:e.name.trim(),notes:e.notes,criteria:e.criteria===null?null:Zt(e.criteria,s),steps:e.steps.map(xs)}),gn=e=>({name:e.name,notes:e.notes,criteria:e.criteria===null?null:Xt(e.criteria),steps:e.steps.map(gs)}),jn=({open:e,onOpenChange:s,ruleName:n,live:a,pending:r=!1,error:l=null,onConfirm:d})=>t.jsx(ae,{open:e,onOpenChange:s,children:t.jsxs(re,{size:"sm","aria-labelledby":"delete-rule-title",children:[t.jsx(le,{closeLabel:"Close",children:t.jsx(ie,{id:"delete-rule-title",children:a?"Turn this rule off first":"Delete this rule?"})}),t.jsxs(oe,{children:[a?t.jsxs("div",{className:"space-y-3 text-sm",children:[t.jsxs("p",{className:"text-muted-foreground",children:[t.jsx("b",{children:n})," is live, so deleting it would leave the edge applying a rule no longer listed here. To remove it:"]}),t.jsxs("ol",{className:"text-muted-foreground list-decimal space-y-1 pl-5",children:[t.jsx("li",{children:"Turn the rule off."}),t.jsx("li",{children:"Publish the site, so the live version no longer has it."}),t.jsx("li",{children:"Delete it here."})]})]}):t.jsxs("p",{className:"text-muted-foreground text-sm",children:[t.jsx("b",{children:n})," and its steps will be removed. This cannot be undone."]}),l!==null&&t.jsx(C,{variant:"error",role:"alert",className:"mt-3",children:l.message})]}),t.jsxs(ce,{children:[t.jsx(N,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),!a&&t.jsx(N,{type:"button",variant:"destructive",disabled:r,onClick:d,children:r?"Deleting…":"Delete"})]})]})}),yn=({enabled:e,pending:s,error:n,onChange:a})=>{const r=hn(n);return t.jsxs("div",{className:"flex flex-col items-end gap-1",children:[t.jsx(Ee,{checked:e,disabled:s,title:e?"Disable this Rule":"Enable this Rule","aria-label":e?"Disable this Rule":"Enable this Rule",onCheckedChange:a}),r.length>0&&t.jsx("div",{role:"alert",className:"text-destructive max-w-xs text-right text-xs",children:r.map((l,d)=>t.jsx("p",{children:l},`${d}-${l}`))})]})},it=(e,s)=>Object.prototype.hasOwnProperty.call(e,s)?e[s]:void 0,vn={add:{label:"Add",variant:"success"},update:{label:"Update",variant:"warning"},remove:{label:"Remove",variant:"destructive"}},Nn=e=>it(vn,e)??{label:e,variant:"warning"},_n={rule:"Rules",criteria:"Page template criteria",normalisation:"URL normalisation",marker:"Page template names"},Sn=e=>it(_n,e)??e,Cn=e=>e.name??e.key,ot=e=>{if(e.lastEditedBy===null)return null;const s=`${e.lastEditedBy.firstName} ${e.lastEditedBy.lastName}`.trim();return s===""?null:s},Rn=e=>new Set(e.flatMap(s=>s.kind==="rule"&&s.ruleId!==void 0?[s.ruleId]:[])),kn=({changes:e})=>{const s=e.map(n=>n.kind).filter((n,a,r)=>r.indexOf(n)===a);return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{className:"text-sm font-medium",children:[e.length===1?"1 change":`${e.length} changes`," will go live"]}),s.map(n=>t.jsxs("div",{children:[t.jsx("p",{className:"text-sp-neutral-500 text-xs font-medium uppercase tracking-wide",children:Sn(n)}),t.jsx("ul",{className:"mt-1 space-y-1",children:e.filter(a=>a.kind===n).map(a=>{const r=Nn(a.action);return t.jsxs("li",{className:"flex list-none items-center gap-2 p-0 text-sm",children:[t.jsx(Te,{variant:r.variant,children:r.label}),t.jsx("span",{className:"min-w-0 truncate",children:Cn(a)})]},`${a.kind}-${a.key}-${a.action}`)}
1)})]},n))]})},wn=({ruleId:e,changes:s})=>{const n=s.affectedRules.filter(r=>r.ruleId!==e);if(n.length===0)return null;const a=Rn(s.changes);return t.jsxs(C,{variant:"warning",className:"flex-col gap-1",children:[t.jsx("p",{className:"font-medium",children:"Publishing this rule also publishes:"}),t.jsx("ul",{className:"space-y-0.5",children:n.map(r=>{const l=ot(r),d=[a.has(r.ruleId)?null:"affected by a shared change",l===null?null:`last edited by ${l}`].filter(o=>o!==null);return t.jsxs("li",{className:"list-none p-0",children:[t.jsx("b",{children:r.name}),d.length>0&&` — ${d.join(", ")}`]},r.ruleId)})})]})},En=({ruleId:e,affectedRules:s})=>{const n=s.find(r=>r.ruleId===e);if(n===void 0)return null;const a=ot(n);return t.jsxs("div",{children:[t.jsx("h3",{className:"text-foreground text-base font-medium",children:n.name}),a!==null&&t.jsxs("p",{className:"text-sp-neutral-500 text-sm",children:["Last edited by ",a]})]})},Tn=({open:e,onOpenChange:s,ruleId:n,changes:a,previewError:r,pending:l=!1,error:d=null,instruction:o=null,tokenError:c,onConfirm:f})=>{const[g,x]=v.useState(""),[m,h]=v.useState(""),p=v.useId();v.useEffect(()=>{e||(x(""),h(""))},[e]);const S=pn(d).filter(b=>b!==c),R=a!==null&&a.changes.length===0,j=r===null&&a!==null&&!R&&(d===null||o!==null),E=j&&!l&&(o===null||m!==""),i=b=>{b.preventDefault(),b.stopPropagation(),E&&f(g,m)};return t.jsx(ae,{open:e,onOpenChange:s,children:t.jsxs(re,{size:"md","aria-labelledby":"sync-rule-title",children:[t.jsx(le,{closeLabel:"Close",children:t.jsx(ie,{id:"sync-rule-title",children:"Sync to the live site"})}),t.jsxs("form",{onSubmit:i,children:[t.jsx(oe,{children:t.jsxs("div",{className:"space-y-3",children:[r!==null&&t.jsx(C,{variant:"error",role:"alert",children:"Couldn't work out what this would publish. Close this and try again."}),a===null&&r===null&&t.jsx("div",{"aria-busy":"true",children:t.jsx(G,{className:"h-24 w-full"})}),a!==null&&t.jsxs(t.Fragment,{children:[t.jsx(En,{ruleId:n,affectedRules:a.affectedRules}),t.jsx(wn,{ruleId:n,changes:a}),R?t.jsx(C,{variant:"info",children:"This rule already matches the live site. There is nothing to publish."}):t.jsx(kn,{changes:a.changes})]}),j&&t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Q,{htmlFor:p,children:"Notes (optional)"}),t.jsx($t,{id:p,value:g,placeholder:"What is going live, and why",onChange:b=>x(b.target.value)})]}),o!==null&&t.jsx(ss,{label:"Two-factor token",name:"token",autoComplete:"one-time-code",inputMode:"numeric",value:m,hint:o,error:c,className:"max-w-xs",onChange:b=>h(b.target.value)}),S.length>0&&t.jsxs(C,{variant:"error",role:"alert",className:"flex-col gap-1",children:[S.map((b,k)=>t.jsx("p",{children:b},`${k}-${b}`)),!j&&t.jsx("p",{children:"Close this and try again."})]})]})}),t.jsxs(ce,{children:[t.jsx(N,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),j&&t.jsx(N,{type:"submit",disabled:!E,children:l?"Syncing…":"Sync"})]})]})]})})},In=({pageTemplateId:e,rule:s,writing:n})=>{const[a,r]=v.useState(!1),[l,d]=v.useState(!1),[o,c]=v.useState(null),f=v.useId(),g=U(),x=tt(s.status),m=Fn(s,l,n),h=cn([s.id]),p=M({...h,enabled:a}),S=p.data??null,R=p.error,j=dn(e),E=ne(j.error);v.useEffect(()=>{l&&qs(s.status)&&d(!1)},[l,s.status]);const i=()=>{j.reset(),c(null),g.removeQueries({queryKey:h.queryKey}),r(!0)},b=(k,y)=>{d(!0),j.mutate({ruleIds:Dn(S),notes:k,token:y},{onSuccess:()=>r(!1),onError:_=>{d(!1);const T=ne(_);T.kind==="prompt"?c(T.instruction):T.kind!=="rejected"&&c(null)}})};return t.jsxs(t.Fragment,{children:[m!==null&&t.jsx("p",{id:f,className:"text-sp-neutral-500 text-xs",children:m}),t.jsx(N,{type:"button",variant:x.destructive?"destructive":"default",disabled:m!==null,"aria-describedby":m!==null?f:void 0,onClick:i,children:x.label}),t.jsx(Tn,{open:a,onOpenChange:r,ruleId:s.id,changes:S,previewError:R,pending:l,error:j.error,instruction:o,tokenError:E.kind==="rejected"?E.message:void 0,onConfirm:b})]})},Fn=(e,s,n)=>e.canPublish?s?"Syncing to the live site.":n?"Saving this rule.":tt(e.status).disabledReason:e.cannotPublishReason??"You cannot publish this site.",Dn=e
1=>(e?.affectedRules??[]).map(s=>s.ruleId),$n=({pageTemplate:e,ruleId:s,draft:n,created:a,onCreated:r,onDeleted:l,onCancel:d})=>{const o=s===null,c=M({...P(e.id),enabled:!o}),f=ln(e.id),g=Ce(e.id),x=on(e.id),m=o?f:g,h=Ce(e.id),p=m.isPending||h.isPending,[S,R]=v.useState(!1),j=c.data?.find(y=>String(y.id)===s)??null,E=y=>{const _=bn(y,de(e.id));if(j===null){f.mutate({pageTemplateId:e.id,..._,enabled:!0},{onSuccess:({id:T})=>r(T)});return}h.reset(),g.mutate({ruleId:j.id,..._,enabled:j.enabled})},i=y=>t.jsx(yn,{enabled:y.enabled,pending:p,error:h.error,onChange:_=>h.mutate({ruleId:y.id,name:y.name,notes:y.notes,criteria:y.criteria,steps:y.steps,enabled:_})}),b=y=>t.jsxs(t.Fragment,{children:[t.jsx(N,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>R(!0),children:"Delete rule"}),t.jsx(jn,{open:S,onOpenChange:R,ruleName:y.name,live:y.live,pending:x.isPending,error:x.error,onConfirm:()=>x.mutate({ruleId:y.id},{onSuccess:l})})]}),k=(y,_={})=>t.jsx(xn,{pageTemplateId:e.id,templateName:e.name,initial:y,submitLabel:o?"Create rule":"Save rule",pending:p,error:m.error,saved:!o&&g.isSuccess&&h.isIdle,created:a&&h.isIdle,deleteControl:_.deleteControl,statusControl:_.statusControl,stepsControl:_.stepsControl,onSubmit:E,onCancel:d});return o?k(n??void 0):c.isPending||!c.isFetchedAfterMount?t.jsx("div",{"aria-busy":"true",children:t.jsx(G,{className:"h-64 w-full"})}):c.isError?t.jsx(C,{variant:"error",role:"alert",children:"Couldn't load this rule. Reload to try again."}):j===null?t.jsxs("div",{className:"space-y-3",children:[t.jsxs(C,{variant:"info",children:["That rule is not on ",e.name,"."]}),t.jsx(N,{type:"button",variant:"outline",onClick:d,children:"Go to Page Rules"})]}):k(gn(j),{deleteControl:b(j),statusControl:t.jsxs(t.Fragment,{children:[t.jsx(st,{status:j.status,size:"md"}),t.jsx(In,{pageTemplateId:e.id,rule:j,writing:p})]}),stepsControl:i(j)})},ct=({ruleId:e})=>{const{clientSlug:s}=V.useParams(),{site:n,template:a}=V.useSearch(),r=ts({select:p=>p.location.state}),l=v.useMemo(()=>Hs(r),[r]),d=Vs(r),o=v.useMemo(()=>De(s).find(p=>p.value===n),[s,n]),c=M({...$e(n??""),enabled:o!==void 0}),f=c.data?.find(p=>p.id===a)??null,g=t.jsx(Ie,{to:ve(s,"rules"),className:Ot({variant:"outline"}),children:"Go to Page Rules"}),x=()=>{se().navigate({to:ve(s,"rules")})},m=p=>{se().navigate({to:Fe(s,p),state:Qs(),replace:!0})},h=()=>o===void 0||a===void 0?t.jsxs("div",{className:"space-y-3",children:[t.jsx(C,{variant:"info",children:"Choose a site and a page template on Page Rules, then create a rule from there."}),g]}):c.isPending?t.jsx(G,{className:"h-64 w-full"}):c.isError?t.jsx(C,{variant:"error",role:"alert",children:"Couldn't load this site's page templates. Reload to try again."}):f===null?t.jsxs("div",{className:"space-y-3",children:[t.jsxs(C,{variant:"info",children:["That page template is not on ",o.label,". Pick one on Page Rules."]}),g]}):t.jsx($n,{pageTemplate:f,ruleId:e,draft:l,created:d,onCreated:m,onDeleted:x,onCancel:x},e??"new");return t.jsx("div",{className:"h-full",children:h()})},Wn=()=>t.jsx(ct,{ruleId:null}),Gn=()=>{const{ruleId:e}=Pt.useParams();return t.jsx(ct,{ruleId:e})};export{Wn as CreateRule,Gn as EditRule,zn as Rules};
2//# sourceMappingURL=index-Dg-vjK6y.js.map

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.