1import {U,B}from'./chunk-Dqg8SbJv.js';import {E,aG as Q$1,a3 as Qo,ao as Fe,ai as s,aj as r$1,aC as b,aU as L,aW as R,bW as C,y as yE,U as Ut,c as Mi,m as mw,d as tl,t as th,w as wD,g as Bv,Q as Qp,T as TD,b as kD,_ as _u,H as HD,e as Mu,s as sl,A as _D,C as MD,a$ as xh,b0 as Mw,G as zp,v as vh,O as Ow,b1 as Nw,V as Ih,cY as Dh,Z as Zp,W as Of}from'./main-2XDYXT5E.js';var W=()=>[],G=(n,e)=>e.contribution.id,X=(n,e)=>e.atUtc;function J(n,e){n&1&&(Mi(0,"p",1),mw(1,"Reading the inbox..."),tl());}function Q(n,e){if(n&1){let t=kD();Mi(0,"p",7),mw(1),Mi(2,"button",8),th("click",function(){_u(t);let d=HD();return Mu(d.load())}),mw(3,"Try again"),tl()();}if(n&2){let t=HD();Bv(),sl("",t.error()," ");}}function Y(n,e){if(n&1&&(Mi(0,"span",13),mw(1),tl()),n&2){HD();let t=Nw(0);Bv(),vh(t.context.itemKind);}}function Z(n,e){if(n&1&&(Mi(0,"a",14),mw(1,"Go to it"),tl()),n&2){let t=e,i=HD(3);Qp("routerLink",i.path(t))("queryParams",i.query(t));}}function tt(n,e){if(n&1&&(Mi(0,"p",15),mw(1),tl()),n&2){HD();let t=Nw(0);Bv(),vh(t.text);}}function et(n,e){if(n&1&&(Mi(0,"p",16)(1,"a",22),mw(2),tl()()),n&2){HD();let t=Nw(0);Bv(),Qp("href",t.link,Of),Bv(),vh(t.link);}}function nt(n,e){n&1&&Zp(0,"img",23),n&2&&Qp("src",e,Of);}function it(n,e){if(n&1){let t=kD();Mi(0,"button",25),th("click",function(){_u(t),HD(2);let d=Nw(0),p=HD(2);return Mu(p.loadPhoto(d.id))}),mw(1,"Show the photo"),tl();}}function ot(n,e){if(n&1&&wD(0,nt,1,1,"img",23)(1,it,2,0,"button",24),n&2){let t;HD();let i=Nw(0),d=HD(2);TD((t=d.photos()[i.id])?0:1,t);}}function at(n,e){if(n&1&&(Mi(0,"span"),mw(1),tl()),n&2){HD();let t=Nw(0);Bv(),vh(t.createdAtUtc.slice(0,16).replace("T"," "));}}function rt(n,e){if(n&1&&(Mi(0,"span"),mw(1),tl()),n&2){HD();let t=Nw(0),i=HD(2);Bv(),Ih("playing ",t.context.playingTitle,"",t.context.playingSeconds!=null?" at "+i.mmss(t.context.playingSeconds):"");}}function lt(n,e){if(n&1&&(Mi(0,"p",18),mw(1),tl()),n&2){HD();let t=Nw(0);Bv(),vh(t.context.description);}}function st(n,e){if(n&1&&(Mi(0,"p",19),mw(1),tl()),n&2){let t=e.$implicit;Bv(),Dh("Replied ",t.atUtc.slice(0,10)," to ",t.to,"",t.delivered?"":" (not delivered: "+(t.note||"no mail sender")+")",': "',t.text,'"');}}function dt(n,e){if(n&1){let t=kD();Mi(0,"div",20)(1,"button",26),th("click",function(){_u(t),HD();let d=Nw(0),p=HD(2);return Mu(p.accept(d))}),mw(2),tl(),Mi(3,"label",27),mw(4,"Reason to reject "),Mi(5,"input",28),th("input",function(d){_u(t),HD();let p=Nw(0),c=HD(2);return Mu(c.setReason(p.id,d))}),tl()(),Mi(6,"button",29),th("click",function(){_u(t),HD();let d=Nw(0),p=HD(2);return Mu(p.reject(d))}),mw(7,"Reject"),tl()();}if(n&2){HD();let t=Nw(0),i=HD(2);Bv(),Qp("disabled",i.busy()===t.id),Bv(),sl(" Accept",t.userId?" and credit":""),Bv(3),Qp("value",i.reasons()[t.id]??""),Bv(),Qp("disabled",i.busy()===t.id||!(i.reasons()[t.id]??"").trim());}}function ct(n,e){if(n&1&&(Mi(0,"span"),mw(1),tl()),n&2){HD(2);let t=Nw(0);Bv(),sl("- ",t.reviewNote);}}function pt(n,e){if(n&1&&(Mi(0,"span"),mw(1),tl()),n&2){HD(2);let t=Nw(0);Bv(),sl("(",t.pointsAwarded," points credited)");}}function ut(n,e){if(n&1&&(Mi(0,"p",21)(1,"b"),mw(2),tl(),wD(3,ct,2,1,"span"),wD(4,pt,2,1,"span"),tl()),n&2){HD();let t=Nw(0);Bv(2),vh(t.status),Bv(),TD(t.reviewNote?3:-1),Bv(),TD(t.pointsAwarded?4:-1);}}function _t(n,e){if(n&1){let t=kD();Mi(0,"div",20)(1,"label",27),mw(2,"Reply by email "),Mi(3,"input",30),th("input",function(d){_u(t),HD();let p=Nw(0),c=HD(2);return Mu(c.setReply(p.id,d))}),tl()(),Mi(4,"button",31),th("click",function(){_u(t),HD();let d=Nw(0),p=HD(2);return Mu(p.reply(d))}),mw(5,"Send reply"),tl()();}if(n&2){HD();let t=Nw(0),i=HD(2);Bv(3),Qp("value",i.replies()[t.id]??""),Bv(),Qp("disabled",i.busy()===t.id||!(i.replies()[t.id]??"").trim());}}function mt(n,e){n&1&&(Mi(0,"p",7),mw(1),tl()),n&2&&(Bv(),vh(e));}function Ct(n,e){if(n&1&&(xh(0),Mi(1,"article",9)(2,"div",10)(3,"span",11),mw(4),tl(),Mi(5,"b",12),mw(6),tl(),wD(7,Y,2,1,"span",13),wD(8,Z,2,2,"a",14),tl(),wD(9,tt,2,1,"p",15),wD(10,et,3,2,"p",16),wD(11,ot,2,1),Mi(12,"div",17)(13,"span"),mw(14),tl(),wD(15,at,2,1,"span"),wD(16,rt,2,2,"span"),tl(),wD(17,lt,2,1,"p",18),_D(18,st,2,4,"p",19,X),wD(20,dt,8,4,"div",20)(21,ut,5,3,"p",21),wD(22,_t,6,2,"div",20),wD(23,mt,2,1,"p",7),tl()),n&2){let t,i,d=e.$implicit,p=HD(2),
1c=Mw(d.contribution);Bv(),zp("data-contribution",c.id),Bv(2),zp("data-k",c.kind),Bv(),vh(p.label(c.kind)),Bv(2),vh(c.context.songTitle||c.context.itemTitle||c.context.route||"the site"),Bv(),TD(c.context.itemKind?7:-1),Bv(),TD((t=p.href(c))?8:-1,t),Bv(),TD(c.text?9:-1),Bv(),TD(c.link?10:-1),Bv(),TD(c.photoPath?11:-1),Bv(3),vh(d.by?"from "+d.by:c.email?"signed out, "+c.email:"signed out, no email"),Bv(),TD(c.createdAtUtc?15:-1),Bv(),TD(c.context.playingTitle?16:-1),Bv(),TD(c.context.description?17:-1),Bv(),MD(c.replies??Ow(17,W)),Bv(2),TD(c.status==="new"?20:21),Bv(2),TD(c.email?22:-1),Bv(),TD((i=p.rowErr()[c.id])?23:-1,i);}}function xt(n,e){if(n&1&&(Mi(0,"p",1),mw(1),tl()),n&2){let t=HD(2);Bv(),sl("Nothing ",t.status()==="all"?"":t.status()," here.");}}function gt(n,e){if(n&1&&_D(0,Ct,24,18,"article",9,G,false,xt,2,1,"p",1),n&2){let t=HD();MD(t.items());}}var bt={fix:"Fix",idea:"Idea",info:"Info",photo:"Photo",problem:"Problem"};function yt(n){let e=Math.floor(n);return `${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}function ht(n){let e=n.itemLink||n.route;return e&&e.startsWith("/")&&!e.startsWith("//")?e:null}var H=class n{api=E(Q$1);status=Qo("new");kind=Qo("all");item=Qo("");statusOpts=U(["new","accepted","rejected","all"]);kindOpts=U(["all","fix","idea","info","photo","problem"]);state=Qo("loading");error=Qo("");items=Qo([]);busy=Qo("");reasons=Qo({});replies=Qo({});rowErr=Qo({});photos=Qo({});mmss=yt;constructor(){let e=new URLSearchParams(location.search);e.get("item")&&this.item.set(e.get("item")),this.load(),E(Fe).onDestroy(()=>Object.values(this.photos()).forEach(t=>URL.revokeObjectURL(t)));}label(e){return bt[e]??e}href(e){return ht(e.context)}path(e){return e.split("?")[0]}query(e){let t=e.split("?")[1];return t?Object.fromEntries(new URLSearchParams(t)):null}setStatus(e){this.status.set(e),this.load();}setKind(e){this.kind.set(e),this.load();}setItem(e){this.item.set(e.target.value.trim()),this.load();}setReason(e,t){this.reasons.set(s(r$1({},this.reasons()),{[e]:t.target.value}));}setReply(e,t){this.replies.set(s(r$1({},this.replies()),{[e]:t.target.value}));}async load(){this.state.set("loading");try{let e=await this.api.get("droplab/contributions",{status:this.status(),kind:this.kind()==="all"?void 0:this.kind(),item:this.item()||void 0});this.items.set(Array.isArray(e?.items)?e.items:[]),this.state.set("ready");}catch(e){this.error.set(e instanceof b&&e.status===403?"This inbox is for staff.":"The inbox could not be read just now."),this.state.set("failed");}}async loadPhoto(e){try{let t=L(),i=await fetch(`${R}/droplab/contributions/${encodeURIComponent(e)}/photo`,{headers:r$1({"X-Org-Id":C},t?{Authorization:`Bearer ${t}`}:{})});if(!i.ok)throw new Error(String(i.status));this.photos.set(s(r$1({},this.photos()),{[e]:URL.createObjectURL(await i.blob())}));}catch{this.rowErr.set(s(r$1({},this.rowErr()),{[e]:"The photo could not be loaded."}));}}replace(e){this.items.set(this.items().map(t=>t.contribution.id===e.id?s(r$1({},t),{contribution:e}):t));}fail(e,t){this.rowErr.set(s(r$1({},this.rowErr()),{[e]:t instanceof b&&t.message?t.message:"That did not go through - try again."}));}async accept(e){this.busy.set(e.id);try{this.replace((await this.api.post(`droplab/contributions/${encodeURIComponent(e.id)}/accept`,{})).contribution);}catch(t){this.fail(e.id,t);}finally{this.busy.set("");}}async reject(e){let t=(this.reasons()[e.id]??"").trim();if(t){this.busy.set(e.id);try{this.replace((await this.api.post(`droplab/contributions/${encodeURIComponent(e.id)}/reject`,{reason:t})).contribution);}catch(i){this.fail(e.id,i);}finally{this.busy.set("");}}}async reply(e){let t=(this.replies()[e.id]??"").trim();if(t){this.busy.set(e.id);try{let i=await this.api.post(`droplab/contributions/${encodeURIComponent(e.id)}/reply`,{text:t});this.replace(i.contribution),this.replies.set(s(r$1({},this.replies()),{[e.id]:""})),i.delivered||this.rowErr.set(s(r$1({},this.rowErr()),{[e.id]:`Saved, but not delivered: ${i.note||"no mail sender"}`}));}catch(i){this.fail(e.id,i);}finally{this.busy.set("");}}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=yE({type:n,selectors:[["dl-contributions"]],decls:14,vars:6,consts:[[1,"ct"],[1,"lede"],[1,"filters"],["label","Status","data-status-filter","",3,"valueChange","options","value"],["label","Kind","data-kind-filter","",3,"valueChange","options","value"],[1,"item"],["type","search","placeholder","show, song, album id or title","data-item-filter","",3,"change","value"],["role","alert",1,"err"],["type","button",3,"click"],[1,"row"],[1,"top"],[1,"k"],[1,"what"],[1,"ik"],["data-go","",3,"routerLink","queryParams"],[1,"txt"],[1,"lnk"],[1,"meta"],[1,"desc"],[1,"rep"],[1,"act"],[1,"done"],["target","_blank","rel","noopener noreferrer",3,"href"],["alt","Attached photo",1,"ph",3,"src"],["type","button",1,"ghost"],["type","button",1,"ghost",3,"click"],["type","button","data-accept","",1,"ok",3,"click","disabled"],[1,"wide"],["maxlength","500",3,"input","value"],["type","button","data-reject","",1,"no",3,"click","disabled"],["maxlength","4000",3,"input","value"],["type","button","data-reply","",1,"no",3,"click","disabled"]],template:function(t,i){if(t&1&&(Mi(0,"div",0)(1,"h1"),mw(2,"Contributions"),tl(),Mi(3,"p",1),mw(4,"What fans sent from the right-click / long-press menu: fixes, ideas, info, photos and problems. Accepting credits a member with points; a reply is emailed to whoever sent it."),tl(),Mi(5,"div",2)(6,"rts-seg-pill",3),th("valueChange",function(p){return i.setStatus(p)}),tl(),Mi(7,"rts-seg-pill",4),th("valueChange",function(p){return i.setKind(p)}),tl(),Mi(8,"label",5),mw(9,"Item "),Mi(10,"input",6),th("change",function(p){return i.setItem(p)}),tl()()(),wD(11,J,2,0,"p",1)(12,Q,4,1,"p",7)(13,gt,3,1),tl()),t&2){let d;Bv(6),Qp("options",i.statusOpts)("value",i.status()),Bv(),Qp("options",i.kindOpts)("value",i.kind()),Bv(3),Qp("value",i.item()),Bv(),TD((d=i.state())==="loading"?11:d==="failed"?12:13);}},dependencies:[Ut,B],styles:[".ct[_ngcontent-%COMP%]{padding:16px}h1[_ngcontent-%COMP%]{margin:0 0 6px}.lede[_ngcontent-%COMP%]{color:var(--liner,#BBAFA3);line-height:1.5}.filters[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:12px;align-items:end;margin:12px 0 16px}.item[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;font-size:14px;color:var(--liner,#BBAFA3);flex:1;min-width:220px}input[_ngcontent-%COMP%]{min-height:44px;border-radius:8px;padding:0 8px;font-size:16px;background:var(--amp-tolex,#111);color:var(--tape-label,#EDE4D3);border:1px solid var(--ctl-edge,#7F6D5C)}.row[_ngcontent-%COMP%]{border:1px solid var(--line,#3a3029);border-radius:12px;padding:12px 14px;margin-bottom:12px;display:grid;gap:8px;font-size:15px}.top[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:10px;align-items:baseline}.k[_ngcontent-%COMP%]{font:700 13px var(--body,system-ui);padding:2px 10px;border-radius:999px;background:var(--whiskey,#C98A3B);
1color:#1a120b}.k[data-k=idea][_ngcontent-%COMP%]{background:var(--harp,#7FB7E8)}.k[data-k=problem][_ngcontent-%COMP%]{background:#e98a7a}.ik[_ngcontent-%COMP%]{color:var(--liner,#BBAFA3);font-size:14px}.top[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .lnk[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--harp,#7FB7E8)}.txt[_ngcontent-%COMP%]{margin:0;white-space:pre-wrap;line-height:1.5}.lnk[_ngcontent-%COMP%]{margin:0;overflow-wrap:anywhere}.ph[_ngcontent-%COMP%]{max-width:min(420px,100%);max-height:320px;border-radius:8px;object-fit:contain;background:#000}.meta[_ngcontent-%COMP%]{display:flex;gap:12px;flex-wrap:wrap;color:var(--liner,#BBAFA3);font-size:14px}.desc[_ngcontent-%COMP%], .rep[_ngcontent-%COMP%]{margin:0;color:var(--liner,#BBAFA3);font-size:14px;line-height:1.4}.act[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;align-items:end}.act[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;font-size:14px;color:var(--liner,#BBAFA3)}.act[_ngcontent-%COMP%] .wide[_ngcontent-%COMP%]{grid-column:1 / -2}button[_ngcontent-%COMP%]{min-height:44px;border-radius:999px;border:0;cursor:pointer;font:700 15px inherit;padding:0 18px}.ok[_ngcontent-%COMP%]{background:var(--whiskey,#C98A3B);color:#1a120b}.no[_ngcontent-%COMP%], .ghost[_ngcontent-%COMP%]{background:transparent;border:1px solid var(--ctl-edge,#7F6D5C)!important;color:inherit;justify-self:start}button[disabled][_ngcontent-%COMP%]{opacity:.55;cursor:default}.err[_ngcontent-%COMP%]{color:var(--tape-label,#EDE4D3);margin:0}.done[_ngcontent-%COMP%]{color:var(--liner,#BBAFA3);display:flex;gap:8px;flex-wrap:wrap;margin:0}@media(max-width:600px){.act[_ngcontent-%COMP%] .wide[_ngcontent-%COMP%]{grid-column:1 / -1}}"]})}; 2export{H as DlContributionsComponent,ht as itemHref,yt as mmss};
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.