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CAAA,OAAE,CAAM,CAAE,IACxC,GAAgB,CAAC,EAAa,QAAQ,CAAC,KACzC,EAAa,SAAS,CAAC,MAAM,CAAC,UAC9B,EAAe,KAEnB,EAAG,CAAE,QAAS,CAAA,CAAK,GAEnB,EACG,aAAa,CAAC,UACd,gBAAgB,CAAC,QAAS,EAAY,SAEzC,EAAY,gBAAgB,CAAC,QAAS,EAAY,YAElD,EAAqB,OAAO,CAAC,AAAC,IAC5B,EAAc,gBAAgB,CAAC,QAAS,EAC1C,GAEA,EAAY,OAAO,CAAC,AAAC,IACnB,EAAsB,GACtB,EAAiB,GACjB,GACF,GAEA,EAAK,OAAO,CAAC,AAAC,GAAQ,EAAI,gBAAgB,CAAC,QAAS,CAAC,CAAA,cAAE,CAAa,CAAE,IACpE,GAAM,CAAA,QAAE,CAAO,CAAE,CAAG,EACd,EAAa,EAAc,GAEjC,MACA,CAAM,CAAC,EAAW,CAAG,CAAC,CAAO,CAAC,EAAW,CAAC,CAC1C,EAAsB,GACtB,EAAiB,GACjB,IACA,SAAS,aAAa,CAAC,mBAAmB,cAAc,CAAC,CAAE,MAAO,MAAO,SAAU,QAAS,EAC9F,G","sources":["<anon>","src/public/js/cases.js"],"sourcesContent":["(function () {\nvar $791c8e204bbe8473$exports = {};\nconst $791c8e204bbe8473$var$capturesMap = {\n    'cases': \"\\u041A\\u0435\\u0439\\u0441\\u044B \\u043D\\u0430\\u0448\\u0438\\u0445 \\u043A\\u043B\\u0438\\u0435\\u043D\\u0442\\u043E\\u0432\\xa0\\u2014\\xa0\\u043A\\u0430\\u043A \\u0444\\u0438\\u0434\\u0431\\u0435\\u043A \\u0443\\u043B\\u0443\\u0447\\u0448\\u0430\\u0435\\u0442 \\u043F\\u0440\\u043E\\u0434\\u0443\\u043A\\u0442\\u044B\",\n    'clients': \"\\u041D\\u0430\\u043C \\u0434\\u043E\\u0432\\u0435\\u0440\\u044F\\u044E\\u0442 90+ \\u0432\\u0435\\u0434\\u0443\\u0449\\u0438\\u0445 \\u043A\\u043E\\u043C\\u043F\\u0430\\u043D\\u0438\\u0439 \\u0432\\xa0\\u0420\\u043E\\u0441\\u0441\\u0438\\u0438\\xa0\\u0438\\xa0\\u043C\\u0438\\u0440\\u0435\"\n};\nconst $791c8e204bbe8473$var$capture = document.querySelector(`h1.capture`);\nconst $791c8e204bbe8473$var$cases = [\n    ...document.querySelector('.content .cases').children\n];\nconst $791c8e204bbe8473$var$filtersSelects = [\n    ...document.querySelectorAll('.filtersWrapper .filter .select .currentValue')\n];\nconst $791c8e204bbe8473$var$emptyBlock = document.querySelector('.empty');\nconst $791c8e204bbe8473$var$tabs = [\n    ...document.querySelectorAll('.casesClients [data-tab]')\n];\nconst $791c8e204bbe8473$var$hash = location.hash.slice(1);\nconst $791c8e204bbe8473$var$activeTab = !$791c8e204bbe8473$var$hash || $791c8e204bbe8473$var$hash === 'form-demo' ? 'cases' : $791c8e204bbe8473$var$hash;\nconst $791c8e204bbe8473$var$queryParams = new URLSearchParams(location.search);\nconst $791c8e204bbe8473$var$activePageNodes = [\n    ...document.querySelectorAll(`[data-tab=\"${$791c8e204bbe8473$var$activeTab}\"]`)\n];\nconst $791c8e204bbe8473$var$allFilterOptionsList = [\n    ...document.querySelectorAll('.selectList li')\n];\nconst $791c8e204bbe8473$var$resetButton = document.querySelector('.resetButton');\nconst $791c8e204bbe8473$var$tags = [\n    ...document.querySelectorAll('.tags .tag')\n];\nconst $791c8e204bbe8473$var$YM_ID = 49633516;\nconst $791c8e204bbe8473$var$sectionName = window.location.href.includes('https://uxfeedback.ru') ? 'cases' : 'test_cases';\nlet $791c8e204bbe8473$var$openedFilter = null;\nconst $791c8e204bbe8473$var$filterTypes = [\n    'format',\n    'product',\n    'sphere'\n];\nconst $791c8e204bbe8473$var$filter = {\n    format: $791c8e204bbe8473$var$queryParams.get('format')?.split(',') || [\n        'all'\n    ],\n    product: $791c8e204bbe8473$var$queryParams.get('product')?.split(',') || [\n        'all'\n    ],\n    sphere: $791c8e204bbe8473$var$queryParams.get('sphere')?.split(',') || [\n        'all'\n    ]\n};\nif ($791c8e204bbe8473$var$activePageNodes.length > 0) {\n    $791c8e204bbe8473$var$capture.innerHTML = $791c8e204bbe8473$var$capturesMap[$791c8e204bbe8473$var$activeTab];\n    [\n        ...document.querySelectorAll(`.active[data-tab]`)\n    ].map((node)=>{\n        node.classList.remove('active');\n    });\n    $791c8e204bbe8473$var$activePageNodes.map((node)=>{\n        node.classList.add('active');\n    });\n}\nconst $791c8e204bbe8473$var$filterCases = ()=>{\n    const hiddenCases = $791c8e204bbe8473$var$cases.filter((item)=>!Object.values($791c8e204bbe8473$var$filter).every((filterValues)=>filterValues.some((value)=>item.dataset.types.includes(value))));\n    $791c8e204bbe8473$var$cases.forEach((item)=>item.classList.remove('hide'));\n    hiddenCases.forEach((item)=>item.classList.add('hide'));\n    if ([\n        ...new Set(Object.values($791c8e204bbe8473$var$filter).reduce((acc, filterValues)=>[\n                ...acc,\n                ...filterValues\n            ], []))\n    ].length > 1) $791c8e204bbe8473$var$resetButton.classList.add('active');\n    else $791c8e204bbe8473$var$resetButton.classList.remove('active');\n    if (hiddenCases.length === $791c8e204bbe8473$var$cases.length) $791c8e204bbe8473$var$emptyBlock.classList.add('show');\n    else $791c8e204bbe8473$var$emptyBlock.classList.remove('show');\n    const url = new URL(window.location.href);\n    url.search = '';\n    $791c8e204bbe8473$var$filterTypes.forEach((filterType)=>{\n        url.searchParams.append(filterType, $791c8e204bbe8473$var$filter[filterType].join(','));\n    });\n    window.history.pushState({}, '', url);\n};\nconst $791c8e204bbe8473$var$showFieldList = (element, text)=>{\n    document.querySelector('.field.active').classList.remove('active');\n    element.classList.add('active');\n    document.querySelector('.field-filter').classList.remove('active');\n    document.querySelector('.current-field span').textContent = text;\n};\nconst $791c8e204bbe8473$var$changeFilterText = (filterType)=>{\n    document.querySelector(`.filter.${filterType} .currentValue .value`).textContent = $791c8e204bbe8473$var$filter[filterType].map((value)=>document.querySelector(`[data-${filterType}=${value}] .name`).textContent).join(', ');\n};\nconst $791c8e204bbe8473$var$selectAll = (filterType)=>{\n    $791c8e204bbe8473$var$filter[filterType] = [\n        'all'\n    ];\n    $791c8e204bbe8473$var$allFilterOptionsList.filter((item)=>item.classList.contains(filterType)).forEach((item)=>item.classList.remove('active'));\n    document.querySelector(`[data-${filterType}=all]`).classList.add('active');\n    $791c8e204bbe8473$var$changeFilterText(filterType);\n    $791c8e204bbe8473$var$filterCases();\n};\nconst $791c8e204bbe8473$var$getFilterType = (dataset)=>{\n    if (dataset.format) return 'format';\n    if (dataset.product) return 'product';\n    return 'sphere';\n};\nconst $791c8e204bbe8473$var$changeFilterValues = (filterType, currentTarget)=>{\n    const { dataset: dataset } = currentTarget;\n    return currentTarget.classList.contains('active') ? $791c8e204bbe8473$var$filter[filterType].filter((filterItem)=>filterItem !== dataset[filterType]) : [\n        ...$791c8e204bbe8473$var$filter[filterType].filter((value)=>value !== 'all'),\n        dataset[filterType]\n    ];\n};\nconst $791c8e204bbe8473$var$setFilter = ({ currentTarget: currentTarget })=>{\n    const { dataset: dataset } = currentTarget;\n    const filterType = $791c8e204bbe8473$var$getFilterType(dataset);\n    const filterValues = $791c8e204bbe8473$var$changeFilterValues(filterType, currentTarget);\n    if (filterValues.length === 0 || dataset[filterType] === 'all') {\n        $791c8e204bbe8473$var$selectAll(filterType);\n        window.ym?.($791c8e204bbe8473$var$YM_ID, 'reachGoal', 'filters_cases_click', {\n            [$791c8e204bbe8473$var$sectionName]: {\n                article_filters: $791c8e204bbe8473$var$filter\n            }\n        });\n        return;\n    }\n    $791c8e204bbe8473$var$filter[filterType] = filterValues;\n    currentTarget.classList.toggle('active');\n    currentTarget.parentElement.querySelector(`[data-${filterType}=all]`).classList.remove('active');\n    $791c8e204bbe8473$var$changeFilterText(filterType);\n    $791c8e204bbe8473$var$filterCases();\n    window.ym?.($791c8e204bbe8473$var$YM_ID, 'reachGoal', 'filters_cases_click', {\n        [$791c8e204bbe8473$var$sectionName]: {\n            article_filters: $791c8e204bbe8473$var$filter\n        }\n    });\n};\nconst $791c8e204bbe8473$var$resetFilter = (type)=>()=>{\n        $791c8e204bbe8473$var$filterTypes.forEach((filterType)=>{\n            $791c8e204bbe8473$var$filter[filterType] = [\n                'all'\n            ];\n            $791c8e204bbe8473$var$selectAll(filterType);\n        });\n        if (type) window.ym?.($791c8e204bbe8473$var$YM_ID, 'reachGoal', 'filters_cases_click', {\n            [$791c8e204bbe8473$var$sectionName]: {\n                article_filters: {\n                    clear_all: type\n                }\n            }\n        });\n    };\nconst $791c8e204bbe8473$var$highlightFiltersItems = (filterType)=>{\n    document.querySelector(`[data-${filterType}=all]`).classList.remove('active');\n    $791c8e204bbe8473$var$allFilterOptionsList.filter((item)=>item.classList.contains(filterType) && $791c8e204bbe8473$var$filter[filterType].includes(item.dataset[filterType])).forEach((item)=>item.classList.add('active'));\n};\n$791c8e204bbe8473$var$tabs.map((tab)=>{\n    tab.addEventListener('click', (e)=>{\n        const { tab: tab } = e.target.dataset;\n        $791c8e204bbe8473$var$capture.innerHTML = $791c8e204bbe8473$var$capturesMap[tab];\n        [\n            ...document.querySelectorAll(`.active[data-tab]:not([data-tab=${tab}])`)\n        ].map((node)=>{\n            node.classList.remove('active');\n        });\n        [\n            ...document.querySelectorAll(`[data-tab=${tab}]`)\n        ].map((node)=>{\n            node.classList.add('active');\n        });\n    });\n});\n$791c8e204bbe8473$var$filtersSelects.map((filterElement)=>{\n    filterElement.addEventListener('click', ({ currentTarget: currentTarget })=>{\n        currentTarget.parentElement.classList.toggle('active');\n        $791c8e204bbe8473$var$openedFilter = currentTarget.parentElement;\n    });\n});\ndocument.addEventListener('click', ({ target: target })=>{\n    if ($791c8e204bbe8473$var$openedFilter && !$791c8e204bbe8473$var$openedFilter.contains(target)) {\n        $791c8e204bbe8473$var$openedFilter.classList.remove('active');\n        $791c8e204bbe8473$var$openedFilter = null;\n    }\n}, {\n    capture: true\n});\n$791c8e204bbe8473$var$emptyBlock.querySelector('.reset').addEventListener('click', $791c8e204bbe8473$var$resetFilter('page'));\n$791c8e204bbe8473$var$resetButton.addEventListener('click', $791c8e204bbe8473$var$resetFilter('filters'));\n$791c8e204bbe8473$var$allFilterOptionsList.forEach((optionElement)=>{\n    optionElement.addEventListener('click', $791c8e204bbe8473$var$setFilter);\n});\n$791c8e204bbe8473$var$filterTypes.forEach((filterType)=>{\n    $791c8e204bbe8473$var$highlightFiltersItems(filterType);\n    $791c8e204bbe8473$var$changeFilterText(filterType);\n    $791c8e204bbe8473$var$filterCases();\n});\n$791c8e204bbe8473$var$tags.forEach((tag)=>tag.addEventListener('click', ({ currentTarget: currentTarget })=>{\n        const { dataset: dataset } = currentTarget;\n        const filterType = $791c8e204bbe8473$var$getFilterType(dataset);\n        $791c8e204bbe8473$var$resetFilter()();\n        $791c8e204bbe8473$var$filter[filterType] = [\n            dataset[filterType]\n        ];\n        $791c8e204bbe8473$var$highlightFiltersItems(filterType);\n        $791c8e204bbe8473$var$changeFilterText(filterType);\n        $791c8e204bbe8473$var$filterCases();\n        document.querySelector('.filtersWrapper').scrollIntoView({\n            block: 'end',\n            behavior: 'smooth'\n        });\n    }));\n\n})();\n//# sourceMappingURL=cases.b8d84079.js.map\n","const capturesMap = {\n  'cases': 'Кейсы наших клиентов — как фидбек улучшает продукты',\n  'clients': 'Нам доверяют 90+ ведущих компаний в России и мире',\n}\nconst capture = document.querySelector(`h1.capture`);\nconst cases = [...document.querySelector('.content .cases').children];\nconst filtersSelects = [...document.querySelectorAll('.filtersWrapper .filter .select .currentValue')];\nconst emptyBlock = document.querySelector('.empty');\nconst tabs = [...document.querySelectorAll('.casesClients [data-tab]')];\nconst hash = location.hash.slice(1);\nconst activeTab = (!hash || hash === 'form-demo') ? 'cases' : hash;\nconst queryParams = new URLSearchParams(location.search);\nconst activePageNodes = [...document.querySelectorAll(`[data-tab=\"${activeTab}\"]`)];\nconst allFilterOptionsList = [...document.querySelectorAll('.selectList li')];\nconst resetButton = document.querySelector('.resetButton');\nconst tags = [...document.querySelectorAll('.tags .tag')];\nconst YM_ID = 49633516;\nconst sectionName = window.location.href.includes('https://uxfeedback.ru') ? 'cases' : 'test_cases';\nlet openedFilter = null;\nconst filterTypes = ['format', 'product', 'sphere'];\nconst filter = {\n  format: queryParams.get('format')?.split(',') || ['all'],\n  product: queryParams.get('product')?.split(',') || ['all'],\n  sphere: queryParams.get('sphere')?.split(',') || ['all'],\n};\n\nif (activePageNodes.length > 0) {\n  capture.innerHTML = capturesMap[activeTab];\n\n  [...document.querySelectorAll(`.active[data-tab]`)].map((node) => {\n    node.classList.remove('active');\n  })\n  activePageNodes.map((node) => {\n    node.classList.add('active');\n  });\n}\n\nconst filterCases = () => {\n  const hiddenCases = cases.filter((item) => !Object.values(filter).every((filterValues) => filterValues.some((value) => item.dataset.types.includes(value))));\n\n  cases.forEach((item) => item.classList.remove('hide'));\n  hiddenCases.forEach((item) => item.classList.add('hide'));\n\n  if ([...new Set(Object.values(filter).reduce((acc, filterValues) => [...acc, ...filterValues], []))].length > 1) {\n    resetButton.classList.add('active');\n  } else {\n    resetButton.classList.remove('active');\n  }\n\n  if (hiddenCases.length === cases.length) {\n    emptyBlock.classList.add('show');\n  } else {\n    emptyBlock.classList.remove('show');\n  }\n\n  const url = new URL(window.location.href);\n\n  url.search = '';\n  filterTypes.forEach((filterType) => {\n    url.searchParams.append(filterType, filter[filterType].join(','));\n  });\n  window.history.pushState({}, '', url);\n};\n\nconst showFieldList = (element, text) => {\n  document.querySelector('.field.active').classList.remove('active');\n  element.classList.add('active');\n  document.querySelector('.field-filter').classList.remove('active');\n  document.querySelector('.current-field span').textContent = text;\n}\n\nconst changeFilterText = (filterType) => {\n  document.querySelector(`.filter.${filterType} .currentValue .value`).textContent = filter[filterType]\n    .map((value) => document.querySelector(`[data-${filterType}=${value}] .name`).textContent)\n    .join(', ');\n}\n\nconst selectAll = (filterType) => {\n  filter[filterType] = ['all'];\n  allFilterOptionsList.filter((item) => item.classList.contains(filterType)).forEach((item) => item.classList.remove('active'));\n  document.querySelector(`[data-${filterType}=all]`).classList.add('active');\n  changeFilterText(filterType);\n  filterCases();\n}\n\nconst getFilterType = (dataset) => {\n  if (dataset.format) {\n    return 'format';\n  }\n\n  if (dataset.product) {\n    return 'product';\n  }\n\n  return 'sphere';\n};\n\nconst changeFilterValues = (filterType, currentTarget) => {\n  const { dataset } = currentTarget;\n\n  return currentTarget.classList.contains('active')\n    ? filter[filterType].filter((filterItem) => filterItem !== dataset[filterType])\n    : [...filter[filterType].filter((value) => value !== 'all'), dataset[filterType]];\n}\n\nconst setFilter = ({ currentTarget }) => {\n  const { dataset } = currentTarget;\n  const filterType = getFilterType(dataset);\n  const filterValues = changeFilterValues(filterType, currentTarget);\n\n  if (filterValues.length === 0 || dataset[filterType] === 'all') {\n    selectAll(filterType);\n    window.ym?.(YM_ID, 'reachGoal', 'filters_cases_click', { [sectionName]: { article_filters: filter } });\n\n    return;\n  }\n\n  filter[filterType] = filterValues;\n  currentTarget.classList.toggle('active');\n  currentTarget.parentElement.querySelector(`[data-${filterType}=all]`).classList.remove('active');\n  changeFilterText(filterType);\n  filterCases();\n  window.ym?.(YM_ID, 'reachGoal', 'filters_cases_click', { [sectionName]: { article_filters: filter } });\n};\n\nconst resetFilter = (type) => () => { \n  filterTypes.forEach((filterType) => {\n    filter[filterType] = ['all'];\n    selectAll(filterType);\n  })\n\n  if (type) {\n    window.ym?.(YM_ID, 'reachGoal', 'filters_cases_click', { [sectionName]: { article_filters: { clear_all: type } } });\n  }\n}\n\nconst highlightFiltersItems = (filterType) => {\n  document.querySelector(`[data-${filterType}=all]`).classList.remove('active');\n  allFilterOptionsList\n    .filter((item) => item.classList.contains(filterType) && filter[filterType].includes(item.dataset[filterType]))\n    .forEach((item) => item.classList.add('active'));\n}\n\ntabs.map((tab) => {\n  tab.addEventListener('click', (e) => {\n    const { tab } = e.target.dataset;\n\n    capture.innerHTML = capturesMap[tab];\n\n    [...document.querySelectorAll(`.active[data-tab]:not([data-tab=${tab}])`)].map((node) => {\n\n      node.classList.remove('active');\n    });\n    [...document.querySelectorAll(`[data-tab=${tab}]`)].map((node) => {\n      node.classList.add('active');\n    });\n  })\n})\n\nfiltersSelects.map((filterElement) => {\n  filterElement.addEventListener('click', ({ currentTarget }) => {\n    currentTarget.parentElement.classList.toggle('active');\n    openedFilter = currentTarget.parentElement;\n  });\n});\n\ndocument.addEventListener('click', ({ target }) => {\n  if (openedFilter && !openedFilter.contains(target)) {\n    openedFilter.classList.remove('active');\n    openedFilter = null;\n  }\n}, { capture: true });\n\nemptyBlock\n  .querySelector('.reset')\n  .addEventListener('click', resetFilter('page'));\n\nresetButton.addEventListener('click', resetFilter('filters'));\n\nallFilterOptionsList.forEach((optionElement) => {\n  optionElement.addEventListener('click', setFilter)\n});\n\nfilterTypes.forEach((filterType) => {\n  highlightFiltersItems(filterType)\n  changeFilterText(filterType);\n  filterCases();\n});\n\ntags.forEach((tag) => tag.addEventListener('click', ({ currentTarget }) => {\n  const { dataset } = currentTarget;\n  const filterType = getFilterType(dataset);\n\n  resetFilter()();\n  filter[filterType] = [dataset[filterType]];\n  highlightFiltersItems(filterType)\n  changeFilterText(filterType);\n  filterCases();\n  document.querySelector('.filtersWrapper').scrollIntoView({ block: 'end', behavior: 'smooth' });\n}))\n"],"names":["$791c8e204bbe8473$var$capturesMap","$791c8e204bbe8473$var$capture","document","querySelector","$791c8e204bbe8473$var$cases","children","$791c8e204bbe8473$var$filtersSelects","querySelectorAll","$791c8e204bbe8473$var$emptyBlock","$791c8e204bbe8473$var$tabs","$791c8e204bbe8473$var$hash","location","hash","slice","$791c8e204bbe8473$var$activeTab","$791c8e204bbe8473$var$queryParams","URLSearchParams","search","$791c8e204bbe8473$var$activePageNodes","$791c8e204bbe8473$var$allFilterOptionsList","$791c8e204bbe8473$var$resetButton","$791c8e204bbe8473$var$tags","$791c8e204bbe8473$var$sectionName","window","href","includes","$791c8e204bbe8473$var$openedFilter","$791c8e204bbe8473$var$filterTypes","$791c8e204bbe8473$var$filter","format","get","split","product","sphere","length","innerHTML","map","node","classList","remove","add","$791c8e204bbe8473$var$filterCases","hiddenCases","filter","item","Object","values","every","filterValues","some","value","dataset","types","forEach","Set","reduce","acc","url","URL","filterType","searchParams","append","join","history","pushState","$791c8e204bbe8473$var$changeFilterText","textContent","$791c8e204bbe8473$var$selectAll","contains","$791c8e204bbe8473$var$getFilterType","$791c8e204bbe8473$var$changeFilterValues","currentTarget","filterItem","$791c8e204bbe8473$var$setFilter","ym","article_filters","toggle","parentElement","$791c8e204bbe8473$var$resetFilter","type","clear_all","$791c8e204bbe8473$var$highlightFiltersItems","tab","addEventListener","e","target","filterElement","capture","optionElement","tag","scrollIntoView","block","behavior"],"version":3,"file":"cases.b8d84079.js.map"}