1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="465c5319-7c29-4831-bdb8-676edce8b83a",e._sentryDebugIdIdentifier="sentry-dbid-465c5319-7c29-4831-bdb8-676edce8b83a")}catch(e){}}();"use strict";(self.webpackChunkaudioboom_web=self.webpackChunkaudioboom_web||[]).push([[3346],{3346:function(e,t,l){l.d(t,{MultiCategoryPicker:function(){return p},default:function(){return g}});var n=l(74848),i=l(96540),a=l(20311),s=l.n(a);let r=(e,t)=>e.title.localeCompare(t.title);var o=e=>{let{initialValue:t=null,name:l,onChange:a,className:o,categories:d}=e,[u,c]=i.useState(t),[p,g]=i.useState(t);p!==t&&(g(t),c(t));let h=e=>{let{value:t}=e.currentTarget,l=""===t?null:parseInt(t);c(l),a&&a(l)},b=d.reduce((e,t)=>e.set(t.id,t),new Map),f=d.reduce((e,t)=>e.set(t.parent_id,t),new Map).get(null);s()(f,"couldn't find the everything-category");let m=b.get(u),v=null,x=null;if(m)if(m.parent_id===f.id)v=m.id,x=null;else{let e=b.get(m.parent_id);s()(e,"missing parent"),v=e.id,x=m.id}let y=d.filter(e=>e.parent_id===f.id).sort(r),j=v?d.filter(e=>e.parent_id===v).sort(r):[];return(0,n.jsxs)("div",{className:`df ${o||""}`,children:[l?(0,n.jsx)("input",{type:"hidden",name:l,value:u||""}):null,(0,n.jsxs)("select",{className:"form-select",value:String(v||""),onChange:h,children:[(0,n.jsx)("option",{value:"",children:"-- Choose a category --"}),y.map(e=>(0,n.jsx)("option",{value:e.id,children:e.title},e.id))]}),(0,n.jsxs)("select",{className:"form-select mls",value:String(x||""),onChange:h,disabled:0===j.length,children:[(0,n.jsx)("option",{value:v||"",children:j.length>0?"-- optional subcategory --":""}),j.map(e=>(0,n.jsx)("option",{value:e.id,children:e.title},e.id))]})]})},d=l(16509),u=l(77688),c=l(15685),p=({categories:e,initialValue:t,name:l})=>{let[a,s]=i.useState(t&&t.length>0?t:[null]),r=(e,t)=>{let l=[...a];l[e]=t,s(l)};return(0,n.jsxs)("div",{children:[a.filter(d.i).map((e,t)=>(0,n.jsx)("input",{type:"hidden",name:l,value:e},t)),a.map((t,l)=>(0,n.jsxs)("div",{className:"mbm l-flex-centre-children-v",children:[(0,n.jsx)(o,{className:"flex-grow-1",categories:e,initialValue:t,onChange:e=>r(l,e)}),l>0?(0,n.jsx)("button",{type:"button",className:"btn","aria-label":"Remove",onClick:e=>{let t;e.preventDefault(),(t=[...a]).splice(l,1),s(t)},children:(0,n.jsx)(u.A,{icon:c.Jyw})}):null]},l)),(0,n.jsxs)("div",{className:"form-text text-muted",children:["You can select up to 3 categories or subcategories."," ",a.length<3?(0,n.jsx)("a",{href:"#",role:"button",onClick:e=>{e.preventDefault(),r(a.length,null)},children:"Add a category"}):null]})]})},g=o}}]);
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.