"use strict";(globalThis.webpackChunkcookiez=globalThis.webpackChunkcookiez||[]).push([[7563],{77071(e,l,t){t.r(l),t.d(l,{default:()=>v});var n=t(52527),s=t(62481),i=t(4639),a=t(78048),o=t(50602),r=t(77374),c=t(74456),d=t(76656),h=t(23136),u=t(26368),g=t(73916),p=t(75260),m=t(95231),f=t(38516),x=t(45404),_=t(22863),k=t(69930),b=t(86087),A=t(27723),z=t(10790);const v=({open:e,onClose:l})=>{const{settings:t,updateSettings:r}=(0,_.t0)(),[d,h]=(0,b.useState)([""]),m=(0,b.useRef)(null),v=(0,b.useRef)(!1);(0,b.useEffect)(()=>{if(e){const e=t.disableBannerPages;h(e.length>0?[...e]:[""]),v.current=!1}},[e,t.disableBannerPages]),(0,b.useEffect)(()=>{v.current&&m.current&&(m.current.focus(),v.current=!1)},[d.length]);const y=e=>{f.KY.sendEvent(f.mk.popUpButtonClicked,{...x.Ve,target_value:e})},P=(0,b.useMemo)(()=>d.some(e=>e.trim().length>0&&!(0,k.A)(e.trim())),[d]),S=(0,b.useMemo)(()=>{const e=new Map,l=new Set;return d.forEach((t,n)=>{const s=t.trim();if(0===s.length)return;const i=e.get(s);void 0!==i?(l.add(i),l.add(n)):e.set(s,n)}),l},[d]),U=(e,l)=>{const t=e.trim();return t.length>0&&!(0,k.A)(t)?(0,A.__)("Please enter a valid URL (e.g. https://example.com).","cookiez"):S.has(l)?(0,A.__)("Please don't use duplicate URLs.","cookiez"):void 0},w=()=>{y("cancel"),l()};return(0,z.jsxs)(j,{open:e,onClose:l,fullWidth:!0,maxWidth:"sm","aria-labelledby":"disabled-pages-dialog-title",children:[(0,z.jsxs)(C,{id:"disabled-pages-dialog-title",children:[(0,A.__)("Disable banner on specific pages","cookiez"),(0,z.jsx)(g.A,{size:"small",onClick:w,"aria-label":(0,A.__)("Close","cookiez"),children:(0,z.jsx)(i.A,{fontSize:"small"})})]}),(0,z.jsx)(u.A,{}),(0,z.jsxs)(R,{children:[d.map((e,l)=>(0,z.jsxs)(a.A,{display:"flex",alignItems:"start",gap:1,children:[(0,z.jsx)(p.A,{fullWidth:!0,size:"small",color:"info",placeholder:(0,A.__)("https://example.com","cookiez"),value:e,onChange:e=>((e,l)=>{h(t=>t.map((t,n)=>n===e?l:t))})(l,e.target.value),inputRef:l===d.length-1?m:void 0,error:e.trim().length>0&&!(0,k.A)(e.trim())||S.has(l),helperText:U(e,l),inputProps:{dir:"ltr","aria-label":(0,A.sprintf)(
// translators: %d: URL number (1, 2, 3…)
// translators: %d: URL number (1, 2, 3…)
(0,A.__)("Page URL %d","cookiez"),l+1)}}),(0,z.jsx)(g.A,{size:"small",onClick:()=>(e=>{y("delete_url"),h(l=>{const t=l.filter((l,t)=>t!==e);return t.length>0?t:[""]})})(l),"aria-label":(0,A.__)("Remove URL","cookiez"),children:(0,z.jsx)(s.A,{fontSize:"small"})})]},l)),(0,z.jsx)(o.A,{variant:"text",color:"info",size:"small",startIcon:(0,z.jsx)(n.A,{}),onClick:()=>{v.current=!0,h(e=>[...e,""]),y("add_url")},sx:{alignSelf:"flex-start"},children:(0,A.__)("Add URL","cookiez")})]}),(0,z.jsx)(u.A,{}),(0,z.jsxs)(c.A,{children:[(0,z.jsx)(o.A,{variant:"outlined",color:"secondary",onClick:w,children:(0,A.__)("Cancel","cookiez")}),(0,z.jsx)(o.A,{variant:"contained",onClick:()=>{const e=d.map(e=>e.trim()).filter(e=>e.length>0);r({disableBannerPages:e}),e.length>0&&f.KY.sendEvent(f.mk.bannerDisabled,{source:"custom_banner_display",num_of_urls:e.length}),y("save"),l()},disabled:P||S.size>0,children:(0,A.__)("Save","cookiez")})]})]})},j=(0,m.I)(r.A)`
	max-height: 80vh;
	height: 100vh;
`,C=(0,m.I)(h.A)`
	display: flex;
	align-items: center;
	justify-content: space-between;
`,R=(0,m.I)(d.A)`
	display: flex;
	flex-direction: column;
	gap: ${({theme:e})=>e.spacing(2)};
	min-height: 200px;
`}}]);