summaryrefslogtreecommitdiffhomepage
path: root/frontend/build/static/js/main.c5c614da.chunk.js.map
blob: 4e63f6e06fc8fb98bfa262b251dbab39c4c27d60 (plain)
1
{"version":3,"sources":["@redux/constants/index.ts","utilites/validate.ts","utilites/hooks.ts","utilites/index.ts","@redux/reducers/mapper.ts","@redux/reducers/movie.ts","@redux/reducers/series.ts","@storage/local.ts","@redux/reducers/site.ts","@redux/reducers/system.ts","@redux/reducers/index.ts","@redux/store/index.ts","apis/badges.ts","apis/base.ts","apis/episodes.ts","apis/files.ts","apis/history.ts","apis/movies.ts","apis/providers.ts","apis/series.ts","apis/subtitles.ts","apis/system.ts","apis/utils.ts","apis/index.ts","@redux/actions/factory.ts","@redux/actions/system.ts","@redux/actions/site.ts","@redux/actions/movie.ts","@redux/actions/providers.ts","@redux/actions/series.ts","@redux/hooks/base.ts","@redux/hooks/index.ts","@redux/hooks/site.ts","components/inputs/Chips.tsx","components/inputs/FileBrowser.tsx","components/inputs/FileForm.tsx","components/inputs/Selector.tsx","components/async.tsx","components/inputs/Slider.tsx","components/buttons.tsx","components/ContentHeader/Button.tsx","components/ContentHeader/Group.tsx","components/ContentHeader/index.tsx","components/LanguageSelector.tsx","components/modals/provider.tsx","components/modals/SeriesUploadModal.tsx","components/modals/BaseModal.tsx","generic/blacklist.tsx","components/modals/HistoryModal.tsx","components/modals/ItemEditorModal.tsx","components/modals/MovieUploadModal.tsx","components/tables/plugins/useAsyncPagination.tsx","components/tables/plugins/useCustomSelection.tsx","components/tables/plugins/useDefaultSettings.tsx","components/modals/SubtitleToolModal.tsx","components/modals/toolOptions.ts","components/SearchBar.tsx","components/tables/BaseTable.tsx","components/tables/SimpleTable.tsx","components/tables/GroupTable.tsx","components/index.tsx","components/tables/PageControl.tsx","components/tables/PageTable.tsx","@static/logo64.png","Sidebar/items.tsx","Sidebar/index.tsx","Sidebar/list.ts","App/Header.tsx","App/notifications/index.tsx","404/index.tsx","Blacklist/Movies/table.tsx","Blacklist/Movies/index.tsx","Blacklist/Series/table.tsx","Blacklist/Series/index.tsx","Blacklist/Router.tsx","History/generic/index.tsx","History/Movies/index.tsx","History/Series/index.tsx","History/Statistics/options.ts","History/Statistics/index.tsx","History/Router.tsx","generic/BaseItemView/table.tsx","generic/BaseItemView/index.tsx","Movies/index.tsx","components/modals/ManualSearchModal.tsx","generic/ItemOverview.tsx","Movies/Detail/table.tsx","Movies/Detail/index.tsx","Movies/Router.tsx","Series/index.tsx","Series/Episodes/components.tsx","Series/Episodes/table.tsx","Series/Episodes/index.tsx","Series/Router.tsx","Settings/keys.ts","Settings/components/provider.tsx","Settings/components/hooks.ts","Settings/components/collapse.tsx","Settings/components/container.tsx","Settings/components/forms.tsx","Settings/components/index.tsx","Settings/General/options.ts","Settings/General/index.tsx","Settings/Languages/components.tsx","Settings/Languages/options.ts","Settings/Languages/modal.tsx","Settings/Languages/table.tsx","Settings/Languages/index.tsx","Settings/Notifications/components.tsx","Settings/Notifications/index.tsx","Settings/Providers/list.ts","Settings/Providers/components.tsx","Settings/Providers/index.tsx","Settings/components/pathMapper.tsx","Settings/Radarr/index.tsx","Settings/Scheduler/options.ts","Settings/Scheduler/index.tsx","Settings/options.ts","Settings/Sonarr/index.tsx","Settings/Subtitles/options.ts","Settings/Subtitles/index.tsx","Settings/UI/options.ts","Settings/UI/index.tsx","Settings/Router.tsx","System/Logs/modal.tsx","System/Logs/table.tsx","System/Logs/index.tsx","System/Providers/table.tsx","System/Providers/index.tsx","System/Releases/index.tsx","System/Status/index.tsx","System/Tasks/table.tsx","System/Tasks/index.tsx","System/Router.tsx","Wanted/generic/index.tsx","Wanted/Movies/index.tsx","Wanted/Series/index.tsx","Wanted/Router.tsx","App/Router.tsx","App/index.tsx","Auth/index.tsx","@static/logo128.png","index.tsx"],"names":["PROVIDER_UPDATE_LIST","SYSTEM_UPDATE_LANGUAGES_LIST","SYSTEM_UPDATE_LANGUAGES_PROFILE_LIST","SYSTEM_UPDATE_STATUS","SYSTEM_UPDATE_TASKS","SYSTEM_UPDATE_LOGS","SYSTEM_UPDATE_RELEASES","SYSTEM_UPDATE_SETTINGS","SYSTEM_RUN_TASK","SERIES_UPDATE_WANTED_RANGE","SERIES_UPDATE_WANTED_LIST","SERIES_UPDATE_EPISODE_LIST","SERIES_UPDATE_HISTORY_LIST","SERIES_UPDATE_INFO","SERIES_UPDATE_RANGE","SERIES_UPDATE_BLACKLIST","MOVIES_UPDATE_WANTED_RANGE","MOVIES_UPDATE_WANTED_LIST","MOVIES_UPDATE_HISTORY_LIST","MOVIES_UPDATE_INFO","MOVIES_UPDATE_RANGE","MOVIES_UPDATE_BLACKLIST","SITE_AUTH_SUCCESS","SITE_NEED_AUTH","SITE_INITIALIZED","SITE_INITIALIZE_FAILED","SITE_SAVE_LOCALSTORAGE","SITE_NOTIFICATIONS_ADD","SITE_NOTIFICATIONS_REMOVE","SITE_NOTIFICATIONS_REMOVE_BY_TIMESTAMP","SITE_SIDEBAR_UPDATE","SITE_BADGE_UPDATE","SITE_OFFLINE_UPDATE","isReactText","v","isString","isNumber","isNullable","isNull","isUndefined","isNonNullable","isMovie","useBaseUrl","slash","url","window","Bazarr","baseUrl","endsWith","useAutoUpdate","action","interval","useEffect","hd","undefined","setInterval","clearInterval","useWhenLoadingFinish","state","callback","curr","expected","onSame","onDiff","useState","setPrevious","prev","useWatcher","updating","updateAsyncState","promise","setter","defaultVal","data","then","catch","err","error","GetItemId","item","radarrId","sonarrEpisodeId","isSeries","sonarrSeriesId","buildOrderList","items","order","flatMap","mergeArray","olds","news","comparer","list","filter","forEach","idx","findIndex","n","push","BuildKey","args","join","Reload","location","reload","ScrollToTop","scrollTo","defVal","payload","loading","updateOrderIdState","id","total","parameters","start","length","idState","reduce","dataOrder","map","newItems","newOrder","countDist","Array","fill","splice","reducer","handleActions","wantedMovieList","historyList","movieList","blacklist","wantedEpisodesList","stateItems","episodeList","seriesList","uiPageSizeKey","storage","parseInt","localStorage","getItem","setItem","toString","updateLocalStorage","pageSize","auth","initialized","settings","key","value","alerts","notifications","timestamp","sidebar","next","badges","throw","offline","movies","episodes","providers","languages","enabledLanguage","enabled","languagesProfiles","status","tasks","job_id","job_running","logs","releases","combineReducers","system","series","movie","site","plugins","trunk","store","createStore","rootReducer","applyMiddleware","path","params","apis","axios","get","a","Promise","resolve","reject","result","BaseApi","prefix","this","object","form","FormData","val","append","formdata","createFormdata","post","patch","delete","seriesid","reason","episodeid","res","all","name","browse","timeframe","provider","language","radarrid","profileid","names","filenames","username","password","performAction","taskid","protocol","query","recreateAxios","apiKey","apikey","Axios","create","baseURL","defaults","headers","common","source","initialize","CancelToken","interceptors","request","use","config","cancelToken","token","response","resp","onOnline","handleError","onOffline","message","reduxStore","getState","dispatch","siteUpdateOffline","code","siteRedirectToAuth","gLimiter","Map","gArgs","asyncActionFactory","type","previousArgs","date","Date","isEqual","previousExec","getTime","set","createAsyncAction","combineActionFactory","dispatchers","fn","createCombineAction","combineAsyncActionFactory","promises","createAsyncCombineAction","callbackActionFactory","success","createCallbackAction","systemUpdateLanguagesAll","systemUpdateLanguages","systemUpdateLanguagesProfiles","SystemApi","languagesProfileList","systemUpdateStatus","systemUpdateTasks","getTasks","systemRunTasks","systemUpdateLogs","systemUpdateReleases","systemUpdateSettings","systemUpdateSettingsAll","bootstrap","siteInitialized","siteInitializeFailed","createAction","siteAuthSuccess","badgeUpdateAll","BadgesApi","siteSaveLocalstorage","siteAddError","siteRemoveError","siteRemoveErrorByTimestamp","siteChangeSidebar","movieUpdateWantedList","MoviesApi","wantedBy","movieUpdateWantedByRange","wanted","movieUpdateWantedBy","movieUpdateHistoryList","history","movieUpdateByRange","moviesBy","movieUpdateInfo","movieUpdateInfoAll","movieUpdateBlacklist","providerUpdateList","ProvidersApi","providerUpdateAll","seriesUpdateWantedList","EpisodesApi","seriesUpdateBy","SeriesApi","episodeUpdateBy","bySeriesId","seriesUpdateByRange","seriesBy","seriesUpdateWantedByRange","seriesUpdateWantedBy","episodeUpdateBySeriesId","seriesUpdateHistoryList","seriesUpdateInfoAll","seriesUpdateBlacklist","useReduxStore","selector","useSelector","useReduxAction","useDispatch","useCallback","useReduxActionWith","callbackAction","stateBuilder","t","d","useSystemSettings","s","useLanguageProfiles","useProfileBy","profiles","useMemo","find","profileId","useLanguages","useLanguageGetter","code2","useProfileItems","profile","getter","hi","forced","useRawSeries","useSerieBy","updateSerie","updateEpisodes","isNaN","useEpisodesBy","seriesId","useRawMovies","useMovieBy","updateMovies","useProviders","useNotification","sec","add","remove","msg","setTimeout","useIsSonarrEnabled","general","use_sonarr","useIsRadarrEnabled","use_radarr","SplitKeys","Chips","defaultValue","disabled","onChange","chips","setChips","input","useRef","addChip","newChips","removeChip","clearInput","current","onKeyUp","event","pressed","currentTarget","includes","preventDefault","onKeyDown","onBlur","chipElements","title","className","onClick","ref","backKey","getLastSeparator","lastIndexOf","extractPath","raw","slice","FileBrowser","load","drop","show","canShow","text","setText","setPath","setLoading","previous","tree","setTree","requestItems","Dropdown","Item","Spinner","size","animation","elements","startsWith","eventKey","icon","children","faFolder","faFile","Header","faReply","Divider","newPath","finally","onSelect","focus","onToggle","open","_","meta","Toggle","as","Form","Control","placeholder","e","Menu","style","maxHeight","overflowY","FileForm","files","emptyText","multiple","fileList","setFileList","label","File","custom","target","file","Selector","props","clearable","options","nameFromItems","wrapper","defaultWrapper","valueWrapper","isLoading","isSearchable","isMulti","closeMenuOnSelect","isClearable","isDisabled","classNamePrefix","isArray","RequestState","Slider","min","max","tooltips","onAfterChange","step","handle","left","offset","SliderTooltips","cls","tipsCls","AsyncStateOverlay","exist","missing","onError","Container","Alert","variant","Heading","faExclamationTriangle","PromiseOverlay","AsyncSelector","AsyncButton","propChildren","onSuccess","noReset","button","Invalid","setState","setHandle","Error","Success","clearTimeout","click","faCircleNotch","spin","faCheck","faTimes","ActionBadge","Badge","ActionButton","destructive","other","ActionButtonItem","Fragment","width","ContentHeaderButton","updatingIcon","displayIcon","faSpinner","ContentHeaderGroup","pos","ContentHeader","childItem","scroll","rowCls","Row","Button","Group","setUpdate","LanguageSelector","l","ModalContext","React","createContext","PayloadContext","p","useShowModal","useContext","keys","setKeys","payloads","setPayloads","useCloseModal","newKey","pop","newPayload","useIsModalShow","useOnModalShow","isShow","usePayload","State","ModalProvider","setKey","setPayload","Provider","BaseModal","closeable","modalKey","footer","closeModal","canClose","Modal","centered","onHide","backdrop","closeButton","Body","Footer","hidden","BlacklistButton","update","subs_id","subtitles_path","blacklisted","faFileExcel","MovieHistoryModal","modal","setHistory","columns","accessor","Cell","row","long","original","addBlacklist","PageTable","EpisodeHistoryModal","episode","Editor","submit","profileOptions","setId","setUpdating","itemId","fluid","Label","audio_language","MovieUploadModal","availableLanguages","uploading","setUpload","setLanguage","defaultLanguage","useLanguageBy","setFile","setForced","canUpload","uploadSubtitles","lang","Check","defaultChecked","checked","SeriesUploadModal","pending","setPending","processState","setProcessState","filelist","states","info","subState","Valid","infos","instance","didCheck","subtitles","Warning","Update","checkEpisodes","SubtitlesApi","results","episodeMap","ep","season","filename","pd","updateLanguage","setFiles","f","uploadStates","every","tableShow","loose","color","msgs","faInfoCircle","messages","externalUpdate","change","newInfo","faTrash","updateItem","newPending","index","SimpleTable","responsive","pluginName","ActionLoadingChange","useAsyncPagination","hooks","stateReducers","useInstance","useOptions","pageToLoad","needLoadingScreen","asyncState","pageIndex","pageStart","pageEnd","isInitializedError","isLoadingError","manualPagination","initialState","asyncLoader","asyncId","rows","nextPage","previousPage","gotoPage","ensurePluginOrder","totalCount","pageCount","Math","ceil","setPageToLoad","newGoto","updater","page","newPrevious","newNext","newPages","num","Object","assign","Checkbox","forwardRef","indeterminate","idIn","rest","defaultRef","resolvedRef","useCustomSelection","visibleColumnsDeps","deps","isSelecting","visibleColumns","selectedRowIds","getToggleAllRowsSelectedProps","getToggleRowSelectedProps","selectHide","useDefaultSettings","autoResetPage","availableTranslation","af","sq","am","ar","hy","az","eu","be","bn","bs","bg","ca","ceb","ny","co","hr","cs","da","nl","en","eo","et","tl","fi","fr","fy","gl","ka","de","el","gu","ht","ha","haw","iw","hmn","hu","is","ig","ga","it","ja","jw","kn","kk","km","ko","ku","ky","lo","la","lv","lt","lb","mk","mg","ms","ml","mt","mi","mr","mn","my","ne","no","ps","fa","pl","pt","pa","ro","ru","sm","gd","sr","st","sn","sd","si","sk","sl","so","es","su","sw","sv","tg","ta","te","th","tr","uk","ur","uz","vi","cy","xh","yi","yo","zu","fil","he","colorOptions","StateIcon","faQuestionCircle","Pending","faClock","Processing","Done","AddColorModal","process","selection","setSelection","FrameRateModal","from","setFrom","to","setTo","canSave","submodProcessFrameRate","InputGroup","parseFloat","AdjustTimesModal","isPlus","setPlus","setOffset","updateOffset","newOffset","some","h","m","Prepend","faPlus","faMinus","TranslateModal","available","selectedLanguage","STM","selections","setSelections","closeUntil","useCloseModalUntil","override","modify","showModal","stateList","getIdAndType","_language","useRowSelect","ButtonGroup","k","faPlay","split","faDeaf","faCode","faImage","faMagic","faTextHeight","faExchangeAlt","faPaintBrush","faFilm","faLanguage","SearchBar","onSearch","onFocus","setResults","useHistory","search","debounceSearch","throttle","clear","its","link","useStyleAndOptions","hoverable","striped","borderless","small","hideHeader","headersRenderer","rowRenderer","DefaultHeaderRenderer","col","getHeaderProps","render","DefaultRowRenderer","getRowProps","cells","cell","column","getCellProps","BaseTable","prepareRow","tableProps","tableBodyProps","colCount","empty","hRenderer","rRenderer","hover","headerGroup","getHeaderGroupProps","colSpan","useTable","getTableProps","getTableBodyProps","headerGroups","renderCell","isGrouped","getToggleRowExpandedProps","canExpand","isAggregated","renderRow","rotation","isExpanded","faChevronCircleRight","isPlaceholder","renderHeaders","GroupTable","HistoryAction","useGroupBy","useSortBy","useExpanded","PageControl","count","canPrevious","canNext","goto","loadState","end","pageButtons","abs","Pagination","active","arr","Ellipsis","Col","Prev","Next","async","autoScroll","canSelect","allPlugins","usePagination","canNextPage","canPreviousPage","setPageSize","globalPageSize","selecting","orderIdStateValidater","HistoryIcon","Delete","Download","faDownload","Manual","faUser","Sync","Upgrade","faRecycle","Upload","faCloudUploadAlt","MessageIcon","iconProps","popover","Popover","Content","OverlayTrigger","overlay","LoadingIndicator","DateFormatter","format","moment","fromNow","LanguageText","HiddenKeysContext","BadgesContext","LinkItem","toggle","SidebarToggleContext","badgeValue","badge","activeClassName","CollapseItem","hiddenKeys","toggleSidebar","itemKey","toLowerCase","sidebarKey","updateSidebar","useUpdateSidebar","child","childValue","collapseBoxClass","childrenElems","hiddenKey","ch","ListGroupItem","Collapse","in","DisplayItem","SonarrDisabledKey","RadarrDisabledKey","SidebarList","faCogs","faLaptop","Sidebar","Wanted","Series","Movies","System","Providers","sonarrEnabled","radarrEnabled","pathname","len","sidebarItems","Image","alt","src","logo","height","ListGroup","SearchItem","year","setNeedAuth","canLogout","dropdown","alignRight","restart","shutdown","logout","reconnecting","setReconnect","reconnect","Navbar","Brand","href","faBars","noGutters","xs","faHeart","faNetworkWired","NotificationToast","removeNotification","Toast","onClose","capitalize","NotificationContainer","RouterEmptyPath","EmptyPage","fasEyeSlash","Table","deleteBlacklist","BlacklistMoviesView","useBlacklistMovies","Helmet","BlacklistSeriesView","useBlacklistSeries","Router","sonarr","radarr","exact","HistoryGenericView","tableUpdater","typeName","MoviesHistoryView","useMoviesHistory","tableUpdate","SeriesHistoryView","useSeriesHistory","actionOptions","timeframeOptions","converter","merge","providerLabel","SelectorContainer","lg","HistoryStats","providerList","setTimeframe","setAction","setProvider","HistoryApi","stats","ResponsiveContainer","BarChart","CartesianGrid","strokeDasharray","XAxis","dataKey","YAxis","allowDecimals","Tooltip","Legend","verticalAlign","Bar","dirtyItems","editMode","select","loader","updateRow","orderList","ExtendItemComparer","ItemEditorModal","lhs","rhs","BaseItemView","updateAction","shared","pendingEditMode","setPendingEdit","setEdit","edit","setDirty","changeProfiles","newDirty","startEdit","endEdit","cancel","ids","saveItems","faUndo","faList","MovieView","faBookmark","farBookmark","sceneName","faWrench","ManualSearchModal","onDownload","setResult","searching","setSearch","setStart","reset","score","hearing_impaired","rel","display","uploader","matches","dont_matches","dont","content","block","matchElements","dontElements","DetailBadge","desc","ItemOverview","details","detailBadges","tags","faTags","audioBadges","faMusic","profileItems","languageBadges","faStream","alternativePopover","Title","alternativeTitles","backgroundRepeat","backgroundSize","backgroundPosition","backgroundImage","fanart","backgroundColor","poster","fasClone","overview","missingText","downloadSubtitles","faSearch","deleteSubtitles","missing_subtitles","concat","download","subtitle","downloadMovieSubtitle","withRouter","match","Number","valid","setValid","validator","allowEdit","faSync","faHistory","faToolbox","SubtitleToolModal","SeriesView","episodeFileCount","episodeMissingCount","progress","ProgressBar","now","SubtitleAction","downloadEpisodeSubtitle","faBriefcase","maxSeason","sortBy","groupBy","expanded","serie","faHdd","faAdjust","seriesType","Episodes","enabledLanguageKey","languageProfileKey","notificationsKey","seriesEnabledKey","moviesEnabledKey","StagedChangesContext","SettingsProvider","updateStorage","stagedChange","setChange","dispatcher","setDispatcher","cleanup","saveSettings","JSON","stringify","submitHooks","setSettings","saveLocalStorage","newDispatch","defaultDispatcher","dispatchMaps","firstKey","lostValues","when","faSave","useStagedValues","useSingleUpdate","staged","changes","useExtract","validate","useStore","extractValue","useLatest","stagedValue","CollapseContext","CollapseUpdateContext","useCollapse","CollapseBox","context","on","indent","header","Input","ColCard","Card","subheader","plus","Subtitle","Message","Text","beforeStaged","controlled","settingKey","collapse","inline","isBoolean","selectorValidator","slider","URLTestButton","category","setTitle","setVar","address","port","ssl","testUrl","UtilsApi","urlTest","version","securityOptions","proxyOptions","branchOptions","characters","settingApiKey","baseUrlOverride","base_url","SettingsGeneralView","copied","setCopy","canUpdate","Append","field","document","createElement","innerText","body","appendChild","setSelectionRange","execCommand","copyToClipboard","wait","toggleState","faClipboard","charAt","floor","random","useEnabledLanguages","ProfileSelector","useProfiles","cutoffOptions","LanguagesProfileModal","cutoff","setProfile","newOptions","updateProfile","addItem","audio_exclude","ItemBadge","originalProfiles","setProfiles","nextProfileId","prof","submitProfiles","isCutoff","EnabledLanguageContext","LanguagesProfileContext","latest","SettingsLanguagesView","notificationComparer","one","another","NotificationModal","compare","newArray","inn","useUpdateArray","setCurrent","onShow","updateUrl","newCurrent","testNotification","NotificationView","useLatestMergeArray","SettingsNotificationsView","ProviderList","description","defaultKey","keyNameOverride","skip_wrong_fps","vip","use_hash","ModalKey","ProviderKey","ProviderView","cards","ProviderModal","setInfo","updateGlobal","obj","useMultiUpdate","deletePayload","newProviders","addProvider","modification","checks","visibleKey","SettingsProvidersView","PathMappingTable","getSupportKey","getEnabledKey","addRow","FilesApi","updateCell","newItem","faArrowCircleRight","bazarr","SettingsRadarrView","seriesSyncOptions","episodesSyncOptions","moviesSyncOptions","diskUpdateOptions","dayOptions","upgradeOptions","SettingsSchedulerView","timeOptions","seriesTypeOptions","SettingsSonarrView","folderOptions","antiCaptchaOption","buildColor","subzeroOverride","subzero_mods","subzeroColorOverride","SettingsSubtitlesView","pageSizeOptions","SettingsUIView","General","UI","Sonarr","Radarr","Languages","Subtitles","Scheduler","Notifications","SystemLogModal","stack","mapTypeToIcon","faBug","faExclamationCircle","faQuestion","faLayerGroup","SystemLogsView","resetting","setReset","deleteLogs","SystemProvidersView","headerBadgeCls","InfoElement","prerelease","replace","ReleasesView","CRow","InfoContainer","SystemStatusView","bazarr_version","sonarr_version","radarr_version","operating_system","python_version","bazarr_directory","bazarr_config_directory","faPaperPlane","faGithub","faWikipediaW","faDiscord","run","runTask","SystemTasksView","Tasks","Status","Logs","Releases","GenericWantedView","searchAll","WantedMoviesView","useWantedMovies","movieid","WantedSeriesView","useWantedSeries","redirectPath","InitializationErrorView","App","ReduxBootstrap","notify","hasUpdate","setSidebar","AuthPage","setUsername","setPassword","setError","updateError","authState","onSubmit","login","required","MainRouter","basename","Auth","ReactDOM","getElementById"],"mappings":"+cACaA,EAAuB,uBAGvBC,EAA+B,4BAC/BC,EACX,gCACWC,EAAuB,uBACvBC,EAAsB,sBACtBC,EAAqB,qBACrBC,EAAyB,yBACzBC,EAAyB,yBACzBC,EAAkB,kBAGlBC,EAA6B,6BAC7BC,EAA4B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B,IAAjB37B,EAAMsC,OAApB,SACE,+BACE,eAACuY,GAAA,EAAD,CAAOC,QAAQ,SAASrG,UAAU,MAAlC,SACGzU,WAKT,eAAC,KAAK+f,OAAN,UACE,eAAC,KAAD,CAAQzU,KAAK,SAAS8H,SAAU7T,EAAUslC,OAAK,EAA/C,SACGtlC,EACC,eAAC0W,GAAA,EAAD,CAASC,KAAK,KAAKC,UAAU,WAE7B,qBEnFV4iC,GAAgC,WACpC,IAAM76C,EAAUL,KAEhB,OACE,eAAC,IAAD,CAAem7C,SAAU96C,EAAzB,SACE,gBAAC,IAAD,WACE,eAAC,IAAD,CAAOwhC,OAAK,EAACj5B,KAAK,SAAlB,SACE,eAACwyC,GAAD,MAEF,eAAC,IAAD,CAAOxyC,KAAK,IAAZ,SACE,eAAC,GAAD,YAOVyyC,IAASzkB,OACP,eAAC,IAAD,CAAUpuB,MAAOA,GAAjB,SAGE,eAAC,GAAD,MAGF6nC,SAASiL,eAAe,W","file":"static/js/main.c5c614da.chunk.js","sourcesContent":["// Provider action\nexport const PROVIDER_UPDATE_LIST = \"UPDATE_PROVIDER_LIST\";\n\n// System action\nexport const SYSTEM_UPDATE_LANGUAGES_LIST = \"UPDATE_ALL_LANGUAGES_LIST\";\nexport const SYSTEM_UPDATE_LANGUAGES_PROFILE_LIST =\n  \"UPDATE_LANGUAGES_PROFILE_LIST\";\nexport const SYSTEM_UPDATE_STATUS = \"UPDATE_SYSTEM_STATUS\";\nexport const SYSTEM_UPDATE_TASKS = \"UPDATE_SYSTEM_TASKS\";\nexport const SYSTEM_UPDATE_LOGS = \"UPDATE_SYSTEM_LOGS\";\nexport const SYSTEM_UPDATE_RELEASES = \"SYSTEM_UPDATE_RELEASES\";\nexport const SYSTEM_UPDATE_SETTINGS = \"UPDATE_SYSTEM_SETTINGS\";\nexport const SYSTEM_RUN_TASK = \"SYSTEM_RUN_TASK\";\n\n// Series action\nexport const SERIES_UPDATE_WANTED_RANGE = \"SERIES_UPDATE_WANTED_RANGE\";\nexport const SERIES_UPDATE_WANTED_LIST = \"UPDATE_SERIES_WANTED_LIST\";\nexport const SERIES_UPDATE_EPISODE_LIST = \"UPDATE_SERIES_EPISODE_LIST\";\nexport const SERIES_UPDATE_HISTORY_LIST = \"UPDATE_SERIES_HISTORY_LIST\";\nexport const SERIES_UPDATE_INFO = \"UPDATE_SEIRES_INFO\";\nexport const SERIES_UPDATE_RANGE = \"SERIES_UPDATE_RANGE\";\nexport const SERIES_UPDATE_BLACKLIST = \"UPDATE_SERIES_BLACKLIST\";\n\n// Movie action\nexport const MOVIES_UPDATE_LIST = \"UPDATE_MOVIE_LIST\";\nexport const MOVIES_UPDATE_WANTED_RANGE = \"MOVIES_UPDATE_WANTED_RANGE\";\nexport const MOVIES_UPDATE_WANTED_LIST = \"UPDATE_MOVIE_WANTED_LIST\";\nexport const MOVIES_UPDATE_HISTORY_LIST = \"UPDATE_MOVIE_HISTORY_LIST\";\nexport const MOVIES_UPDATE_INFO = \"UPDATE_MOVIE_INFO\";\nexport const MOVIES_UPDATE_RANGE = \"MOVIES_UPDATE_RANGE\";\nexport const MOVIES_UPDATE_BLACKLIST = \"UPDATE_MOVIES_BLACKLIST\";\n\n// Site Action\nexport const SITE_AUTH_SUCCESS = \"SITE_AUTH_SUCCESS\";\nexport const SITE_NEED_AUTH = \"SITE_NEED_AUTH\";\nexport const SITE_INITIALIZED = \"SITE_SYSTEM_INITIALIZED\";\nexport const SITE_INITIALIZE_FAILED = \"SITE_INITIALIZE_FAILED\";\nexport const SITE_SAVE_LOCALSTORAGE = \"SITE_SAVE_LOCALSTORAGE\";\nexport const SITE_NOTIFICATIONS_ADD = \"SITE_NOTIFICATIONS_ADD\";\nexport const SITE_NOTIFICATIONS_REMOVE = \"SITE_NOTIFICATIONS_REMOVE\";\nexport const SITE_NOTIFICATIONS_REMOVE_BY_TIMESTAMP =\n  \"SITE_NOTIFICATIONS_REMOVE_BY_TIMESTAMP\";\nexport const SITE_SIDEBAR_UPDATE = \"SITE_SIDEBAR_UPDATE\";\nexport const SITE_BADGE_UPDATE = \"SITE_BADGE_UPDATE\";\nexport const SITE_OFFLINE_UPDATE = \"SITE_OFFLINE_UPDATE\";\n","import { isNull, isNumber, isString, isUndefined } from \"lodash\";\nimport { ReactText } from \"react\";\n\nexport function isReactText(v: any): v is ReactText {\n  return isString(v) || isNumber(v);\n}\n\nexport function isNullable(v: any): v is Nullable<any> {\n  return isNull(v) || isUndefined(v);\n}\n\nexport function isNonNullable(v: any): v is NonNullable<any> {\n  return !isNullable(v);\n}\n\nexport function isMovie(v: any): v is Item.Movie {\n  return \"radarrId\" in v;\n}\n\nexport function isEpisode(v: any): v is Item.Episode {\n  return \"sonarrEpisodeId\" in v;\n}\n\nexport function isSeries(v: any): v is Item.Series {\n  return \"episodeFileCount\" in v;\n}\n","import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { mergeArray } from \".\";\n\nexport function useBaseUrl(slash: boolean = false) {\n  if (process.env.NODE_ENV === \"development\") {\n    return \"/\";\n  } else {\n    let url = window.Bazarr.baseUrl ?? \"/\";\n    if (slash && !url.endsWith(\"/\")) {\n      url += \"/\";\n    }\n    return url;\n  }\n}\n\nexport function useCanUpdateInject() {\n  if (process.env.NODE_ENV === \"development\") {\n    return process.env[\"REACT_APP_CAN_UPDATE\"] === \"true\";\n  } else {\n    return window.Bazarr.canUpdate;\n  }\n}\n\nexport function useHasUpdateInject() {\n  if (process.env.NODE_ENV === \"development\") {\n    return process.env[\"REACT_APP_HAS_UPDATE\"] === \"true\";\n  } else {\n    return window.Bazarr.hasUpdate;\n  }\n}\n\nexport function useSessionStorage(\n  key: string\n): [StorageType, React.Dispatch<StorageType>] {\n  const dispatch: React.Dispatch<StorageType> = useCallback(\n    (value) => {\n      if (value !== null) {\n        sessionStorage.setItem(key, value);\n      } else {\n        sessionStorage.removeItem(key);\n      }\n    },\n    [key]\n  );\n  return [sessionStorage.getItem(key), dispatch];\n}\n\nexport function useMergeArray<T>(\n  olds: readonly T[],\n  news: readonly T[],\n  comparer: Comparer<NonNullable<T>>\n) {\n  return useMemo(() => mergeArray(olds, news, comparer), [\n    olds,\n    news,\n    comparer,\n  ]);\n}\n\nexport function useAutoUpdate(action: () => void, interval?: number) {\n  useEffect(() => {\n    action();\n\n    let hd: NodeJS.Timeout | null = null;\n    if (interval !== undefined) {\n      hd = setInterval(action, interval);\n    }\n    return () => {\n      if (hd !== null) {\n        clearInterval(hd);\n      }\n    };\n  }, [action, interval]);\n}\n\nexport function useWatcher<T>(\n  curr: T,\n  expected: T,\n  onSame?: () => void,\n  onDiff?: () => void\n) {\n  const [, setPrevious] = useState(curr);\n\n  useEffect(() => {\n    setPrevious((prev) => {\n      if (prev !== curr) {\n        if (curr !== expected) {\n          onDiff && onDiff();\n        } else {\n          onSame && onSame();\n        }\n      }\n      return curr;\n    });\n  }, [curr, expected, onDiff, onSame]);\n}\n\nexport function useWhenLoadingFinish(\n  state: Readonly<AsyncState<any>>,\n  callback: () => void\n) {\n  return useWatcher(state.updating, true, undefined, callback);\n}\n","import { Dispatch } from \"react\";\nimport { isEpisode, isMovie, isNullable, isSeries } from \"./validate\";\n\nexport function updateAsyncState<T>(\n  promise: Promise<T>,\n  setter: (state: AsyncState<T>) => void,\n  defaultVal: T\n) {\n  setter({\n    updating: true,\n    data: defaultVal,\n  });\n  promise\n    .then((data) => {\n      setter({\n        updating: false,\n        data: data,\n      });\n    })\n    .catch((err) => {\n      setter({\n        updating: false,\n        error: err,\n        data: defaultVal,\n      });\n    });\n}\n\nexport function copyToClipboard(s: string) {\n  let field = document.createElement(\"textarea\");\n  field.innerText = s;\n  document.body.appendChild(field);\n  field.select();\n  field.setSelectionRange(0, 9999);\n  document.execCommand(\"copy\");\n  field.remove();\n}\n\nexport function toggleState(\n  dispatch: Dispatch<boolean>,\n  wait: number,\n  start: boolean = false\n) {\n  dispatch(!start);\n  setTimeout(() => dispatch(start), wait);\n}\n\nexport function submodProcessColor(s: string) {\n  return `color(name=${s})`;\n}\n\nexport function GetItemId(item: any): number {\n  if (isMovie(item)) {\n    return item.radarrId;\n  } else if (isEpisode(item)) {\n    return item.sonarrEpisodeId;\n  } else if (isSeries(item)) {\n    return item.sonarrSeriesId;\n  } else {\n    return -1;\n  }\n}\n\nexport function buildOrderList<T>(state: OrderIdState<T>): T[] {\n  const { items, order } = state;\n  return order.flatMap((v) => {\n    if (v !== null && v in items) {\n      const item = items[v];\n      return [item];\n    }\n\n    return [];\n  });\n}\n\n// Replace elements in old array with news\nexport function mergeArray<T>(\n  olds: readonly T[],\n  news: readonly T[],\n  comparer: Comparer<NonNullable<T>>\n) {\n  const list = [...olds];\n  const newList = news.filter((v) => !isNullable(v)) as NonNullable<T>[];\n  // Performance\n  newList.forEach((v) => {\n    const idx = list.findIndex((n, idx) => {\n      if (!isNullable(n)) {\n        return comparer(n, v);\n      } else {\n        return false;\n      }\n    });\n    if (idx !== -1) {\n      list[idx] = v;\n    } else {\n      list.push(v);\n    }\n  });\n  return list;\n}\n\nexport function BuildKey(...args: any[]) {\n  return args.join(\"-\");\n}\n\nexport function Reload() {\n  window.location.reload();\n}\n\nexport function ScrollToTop() {\n  window.scrollTo(0, 0);\n}\n\nexport * from \"./hooks\";\nexport * from \"./validate\";\n","import { mergeArray } from \"../../utilites\";\nimport { AsyncAction } from \"../types\";\n\nexport function updateAsyncState<Payload>(\n  action: AsyncAction<Payload>,\n  defVal: Readonly<Payload>\n): AsyncState<Payload> {\n  if (action.payload.loading) {\n    return {\n      updating: true,\n      data: defVal,\n    };\n  } else if (action.error !== undefined) {\n    return {\n      updating: false,\n      error: action.payload.item as Error,\n      data: defVal,\n    };\n  } else {\n    return {\n      updating: false,\n      error: undefined,\n      data: action.payload.item as Payload,\n    };\n  }\n}\n\nexport function updateOrderIdState<T extends LooseObject>(\n  action: AsyncAction<AsyncDataWrapper<T>>,\n  state: AsyncState<OrderIdState<T>>,\n  id: ItemIdType<T>\n): AsyncState<OrderIdState<T>> {\n  if (action.payload.loading) {\n    return {\n      ...state,\n      updating: true,\n    };\n  } else if (action.error !== undefined) {\n    return {\n      ...state,\n      updating: false,\n      error: action.payload.item as Error,\n    };\n  } else {\n    const { data, total } = action.payload.item as AsyncDataWrapper<T>;\n    const [start, length] = action.payload.parameters;\n\n    // Convert item list to object\n    const idState: IdState<T> = data.reduce<IdState<T>>((prev, curr) => {\n      const tid = curr[id];\n      prev[tid] = curr;\n      return prev;\n    }, {});\n\n    const dataOrder: number[] = data.map((v) => v[id]);\n\n    let newItems = { ...state.data.items, ...idState };\n    let newOrder = state.data.order;\n\n    const countDist = total - newOrder.length;\n    if (countDist > 0) {\n      newOrder.push(...Array(countDist).fill(null));\n    } else if (countDist < 0) {\n      // Completely drop old data if list has shrinked\n      newOrder = Array(total).fill(null);\n      newItems = { ...idState };\n    }\n\n    if (typeof start === \"number\" && typeof length === \"number\") {\n      newOrder.splice(start, length, ...dataOrder);\n    } else if (start === undefined) {\n      // Full Update\n      newOrder = dataOrder;\n    }\n\n    return {\n      updating: false,\n      data: {\n        items: newItems,\n        order: newOrder,\n      },\n    };\n  }\n}\n\nexport function updateAsyncList<T, ID extends keyof T>(\n  action: AsyncAction<T[]>,\n  state: AsyncState<T[]>,\n  match: ID\n): AsyncState<T[]> {\n  if (action.payload.loading) {\n    return {\n      ...state,\n      updating: true,\n    };\n  } else if (action.error !== undefined) {\n    return {\n      ...state,\n      updating: false,\n      error: action.payload.item as Error,\n    };\n  } else {\n    const list = state.data as T[];\n    const payload = action.payload.item as T[];\n    const result = mergeArray(list, payload, (l, r) => l[match] === r[match]);\n\n    return {\n      updating: false,\n      data: result,\n    };\n  }\n}\n","import { handleActions } from \"redux-actions\";\nimport {\n  MOVIES_UPDATE_BLACKLIST,\n  MOVIES_UPDATE_HISTORY_LIST,\n  MOVIES_UPDATE_INFO,\n  MOVIES_UPDATE_RANGE,\n  MOVIES_UPDATE_WANTED_LIST,\n  MOVIES_UPDATE_WANTED_RANGE,\n} from \"../constants\";\nimport { AsyncAction } from \"../types\";\nimport { updateAsyncState, updateOrderIdState } from \"./mapper\";\n\nconst reducer = handleActions<ReduxStore.Movie, any>(\n  {\n    [MOVIES_UPDATE_WANTED_LIST]: (\n      state,\n      action: AsyncAction<AsyncDataWrapper<Wanted.Movie>>\n    ) => {\n      return {\n        ...state,\n        wantedMovieList: updateOrderIdState(\n          action,\n          state.wantedMovieList,\n          \"radarrId\"\n        ),\n      };\n    },\n    [MOVIES_UPDATE_WANTED_RANGE]: (\n      state,\n      action: AsyncAction<AsyncDataWrapper<Wanted.Movie>>\n    ) => {\n      return {\n        ...state,\n        wantedMovieList: updateOrderIdState(\n          action,\n          state.wantedMovieList,\n          \"radarrId\"\n        ),\n      };\n    },\n    [MOVIES_UPDATE_HISTORY_LIST]: (\n      state,\n      action: AsyncAction<History.Movie[]>\n    ) => {\n      return {\n        ...state,\n        historyList: updateAsyncState(action, state.historyList.data),\n      };\n    },\n    [MOVIES_UPDATE_INFO]: (\n      state,\n      action: AsyncAction<AsyncDataWrapper<Item.Movie>>\n    ) => {\n      return {\n        ...state,\n        movieList: updateOrderIdState(action, state.movieList, \"radarrId\"),\n      };\n    },\n    [MOVIES_UPDATE_RANGE]: (\n      state,\n      action: AsyncAction<AsyncDataWrapper<Item.Movie>>\n    ) => {\n      return {\n        ...state,\n        movieList: updateOrderIdState(action, state.movieList, \"radarrId\"),\n      };\n    },\n    [MOVIES_UPDATE_BLACKLIST]: (\n      state,\n      action: AsyncAction<Blacklist.Movie[]>\n    ) => {\n      return {\n        ...state,\n        blacklist: updateAsyncState(action, state.blacklist.data),\n      };\n    },\n  },\n  {\n    movieList: { updating: true, data: { items: {}, order: [] } },\n    wantedMovieList: { updating: true, data: { items: {}, order: [] } },\n    historyList: { updating: true, data: [] },\n    blacklist: { updating: true, data: [] },\n  }\n);\n\nexport default reducer;\n","import { handleActions } from \"redux-actions\";\nimport {\n  SERIES_UPDATE_BLACKLIST,\n  SERIES_UPDATE_EPISODE_LIST,\n  SERIES_UPDATE_HISTORY_LIST,\n  SERIES_UPDATE_INFO,\n  SERIES_UPDATE_RANGE,\n  SERIES_UPDATE_WANTED_LIST,\n  SERIES_UPDATE_WANTED_RANGE,\n} from \"../constants\";\nimport { AsyncAction } from \"../types\";\nimport { updateAsyncState, updateOrderIdState } from \"./mapper\";\n\nconst reducer = handleActions<ReduxStore.Series, any>(\n  {\n    [SERIES_UPDATE_WANTED_LIST]: (\n      state,\n      action: AsyncAction<AsyncDataWrapper<Wanted.Episode>>\n    ) => {\n      return {\n        ...state,\n        wantedEpisodesList: updateOrderIdState(\n          action,\n          state.wantedEpisodesList,\n          \"sonarrEpisodeId\"\n        ),\n      };\n    },\n    [SERIES_UPDATE_WANTED_RANGE]: (\n      state,\n      action: AsyncAction<AsyncDataWrapper<Wanted.Episode>>\n    ) => {\n      return {\n        ...state,\n        wantedEpisodesList: updateOrderIdState(\n          action,\n          state.wantedEpisodesList,\n          \"sonarrEpisodeId\"\n        ),\n      };\n    },\n    [SERIES_UPDATE_EPISODE_LIST]: (\n      state,\n      action: AsyncAction<Item.Episode[]>\n    ) => {\n      const { updating, error, data: items } = updateAsyncState(action, []);\n\n      const stateItems = { ...state.episodeList.data };\n\n      if (items.length > 0) {\n        const id = items[0].sonarrSeriesId;\n        stateItems[id] = items;\n      }\n\n      return {\n        ...state,\n        episodeList: {\n          updating,\n          error,\n          data: stateItems,\n        },\n      };\n    },\n    [SERIES_UPDATE_HISTORY_LIST]: (\n      state,\n      action: AsyncAction<History.Episode[]>\n    ) => {\n      return {\n        ...state,\n        historyList: updateAsyncState(action, state.historyList.data),\n      };\n    },\n    [SERIES_UPDATE_INFO]: (\n      state,\n      action: AsyncAction<AsyncDataWrapper<Item.Series>>\n    ) => {\n      return {\n        ...state,\n        seriesList: updateOrderIdState(\n          action,\n          state.seriesList,\n          \"sonarrSeriesId\"\n        ),\n      };\n    },\n    [SERIES_UPDATE_RANGE]: (\n      state,\n      action: AsyncAction<AsyncDataWrapper<Item.Series>>\n    ) => {\n      return {\n        ...state,\n        seriesList: updateOrderIdState(\n          action,\n          state.seriesList,\n          \"sonarrSeriesId\"\n        ),\n      };\n    },\n    [SERIES_UPDATE_BLACKLIST]: (\n      state,\n      action: AsyncAction<Blacklist.Episode[]>\n    ) => {\n      return {\n        ...state,\n        blacklist: updateAsyncState(action, state.blacklist.data),\n      };\n    },\n  },\n  {\n    seriesList: { updating: true, data: { items: {}, order: [] } },\n    wantedEpisodesList: { updating: true, data: { items: {}, order: [] } },\n    episodeList: { updating: true, data: {} },\n    historyList: { updating: true, data: [] },\n    blacklist: { updating: true, data: [] },\n  }\n);\n\nexport default reducer;\n","export const uiPageSizeKey = \"storage-ui-pageSize\";\n\nexport const storage: LocalStorageType = {\n  get pageSize(): number {\n    return parseInt(localStorage.getItem(uiPageSizeKey) ?? \"50\");\n  },\n  set pageSize(v: number) {\n    localStorage.setItem(uiPageSizeKey, v.toString());\n  },\n};\n","import { Action, handleActions } from \"redux-actions\";\nimport { storage } from \"../../@storage/local\";\nimport {\n  SITE_AUTH_SUCCESS,\n  SITE_BADGE_UPDATE,\n  SITE_INITIALIZED,\n  SITE_INITIALIZE_FAILED,\n  SITE_NEED_AUTH,\n  SITE_NOTIFICATIONS_ADD,\n  SITE_NOTIFICATIONS_REMOVE,\n  SITE_NOTIFICATIONS_REMOVE_BY_TIMESTAMP,\n  SITE_OFFLINE_UPDATE,\n  SITE_SAVE_LOCALSTORAGE,\n  SITE_SIDEBAR_UPDATE,\n} from \"../constants\";\nimport { AsyncAction } from \"../types\";\n\nfunction updateLocalStorage(): Partial<ReduxStore.Site> {\n  return {\n    pageSize: storage.pageSize,\n  };\n}\n\nconst reducer = handleActions<ReduxStore.Site, any>(\n  {\n    [SITE_NEED_AUTH]: (state) => ({\n      ...state,\n      auth: false,\n    }),\n    [SITE_AUTH_SUCCESS]: (state) => ({\n      ...state,\n      auth: true,\n    }),\n    [SITE_INITIALIZED]: (state) => ({\n      ...state,\n      initialized: true,\n    }),\n    [SITE_INITIALIZE_FAILED]: (state) => ({\n      ...state,\n      initialized: \"An Error Occurred When Initializing Bazarr UI\",\n    }),\n    [SITE_SAVE_LOCALSTORAGE]: (state, action: Action<LooseObject>) => {\n      const settings = action.payload;\n      for (const key in settings) {\n        const value = settings[key];\n        localStorage.setItem(key, value);\n      }\n      return {\n        ...state,\n        ...updateLocalStorage(),\n      };\n    },\n    [SITE_NOTIFICATIONS_ADD]: (\n      state,\n      action: Action<ReduxStore.Notification>\n    ) => {\n      const alerts = [\n        ...state.notifications.filter((v) => v.id !== action.payload.id),\n        action.payload,\n      ];\n      return { ...state, notifications: alerts };\n    },\n    [SITE_NOTIFICATIONS_REMOVE]: (state, action: Action<string>) => {\n      const alerts = state.notifications.filter((v) => v.id !== action.payload);\n      return { ...state, notifications: alerts };\n    },\n    [SITE_NOTIFICATIONS_REMOVE_BY_TIMESTAMP]: (state, action: Action<Date>) => {\n      const alerts = state.notifications.filter(\n        (v) => v.timestamp !== action.payload\n      );\n      return { ...state, notifications: alerts };\n    },\n    [SITE_SIDEBAR_UPDATE]: (state, action: Action<string>) => {\n      return {\n        ...state,\n        sidebar: action.payload,\n      };\n    },\n    [SITE_BADGE_UPDATE]: {\n      next: (state, action: AsyncAction<Badge>) => {\n        const badges = action.payload.item;\n        if (badges && action.error !== true) {\n          return { ...state, badges: badges as Badge };\n        }\n        return state;\n      },\n      throw: (state) => state,\n    },\n    [SITE_OFFLINE_UPDATE]: (state, action: Action<boolean>) => {\n      return { ...state, offline: action.payload };\n    },\n  },\n  {\n    initialized: false,\n    auth: true,\n    pageSize: 50,\n    notifications: [],\n    sidebar: \"\",\n    badges: {\n      movies: 0,\n      episodes: 0,\n      providers: 0,\n    },\n    offline: false,\n    ...updateLocalStorage(),\n  }\n);\n\nexport default reducer;\n","import { Action, handleActions } from \"redux-actions\";\nimport {\n  PROVIDER_UPDATE_LIST,\n  SYSTEM_RUN_TASK,\n  SYSTEM_UPDATE_LANGUAGES_LIST,\n  SYSTEM_UPDATE_LANGUAGES_PROFILE_LIST,\n  SYSTEM_UPDATE_LOGS,\n  SYSTEM_UPDATE_RELEASES,\n  SYSTEM_UPDATE_SETTINGS,\n  SYSTEM_UPDATE_STATUS,\n  SYSTEM_UPDATE_TASKS,\n} from \"../constants\";\nimport { updateAsyncState } from \"./mapper\";\n\nconst reducer = handleActions<ReduxStore.System, any>(\n  {\n    [SYSTEM_UPDATE_LANGUAGES_LIST]: (state, action) => {\n      const languages = updateAsyncState<Array<ApiLanguage>>(action, []);\n      const enabledLanguage: AsyncState<ApiLanguage[]> = {\n        ...languages,\n        data: languages.data.filter((v) => v.enabled),\n      };\n      const newState = {\n        ...state,\n        languages,\n        enabledLanguage,\n      };\n      return newState;\n    },\n    [SYSTEM_UPDATE_LANGUAGES_PROFILE_LIST]: (state, action) => {\n      const newState = {\n        ...state,\n        languagesProfiles: updateAsyncState<Array<Profile.Languages>>(\n          action,\n          []\n        ),\n      };\n      return newState;\n    },\n    [SYSTEM_UPDATE_STATUS]: (state, action) => {\n      return {\n        ...state,\n        status: updateAsyncState<System.Status | undefined>(\n          action,\n          state.status.data\n        ),\n      };\n    },\n    [SYSTEM_UPDATE_TASKS]: (state, action) => {\n      return {\n        ...state,\n        tasks: updateAsyncState<Array<System.Task>>(action, state.tasks.data),\n      };\n    },\n    [SYSTEM_RUN_TASK]: (state, action: Action<string>) => {\n      const id = action.payload;\n      const tasks = state.tasks;\n      const newItems = [...tasks.data];\n\n      const idx = newItems.findIndex((v) => v.job_id === id);\n\n      if (idx !== -1) {\n        newItems[idx].job_running = true;\n      }\n\n      return {\n        ...state,\n        tasks: {\n          ...tasks,\n          data: newItems,\n        },\n      };\n    },\n    [PROVIDER_UPDATE_LIST]: (state, action) => {\n      return {\n        ...state,\n        providers: updateAsyncState(action, state.providers.data),\n      };\n    },\n    [SYSTEM_UPDATE_LOGS]: (state, action) => {\n      return {\n        ...state,\n        logs: updateAsyncState(action, state.logs.data),\n      };\n    },\n    [SYSTEM_UPDATE_RELEASES]: (state, action) => {\n      return {\n        ...state,\n        releases: updateAsyncState(action, state.releases.data),\n      };\n    },\n    [SYSTEM_UPDATE_SETTINGS]: (state, action) => {\n      return {\n        ...state,\n        settings: updateAsyncState(action, state.settings.data),\n      };\n    },\n  },\n  {\n    languages: { updating: true, data: [] },\n    enabledLanguage: { updating: true, data: [] },\n    languagesProfiles: { updating: true, data: [] },\n    status: {\n      updating: true,\n      data: undefined,\n    },\n    tasks: {\n      updating: true,\n      data: [],\n    },\n    providers: {\n      updating: true,\n      data: [],\n    },\n    logs: {\n      updating: true,\n      data: [],\n    },\n    releases: {\n      updating: true,\n      data: [],\n    },\n    settings: {\n      updating: true,\n      data: undefined,\n    },\n  }\n);\n\nexport default reducer;\n","import { combineReducers } from \"redux\";\nimport movie from \"./movie\";\nimport series from \"./series\";\nimport site from \"./site\";\nimport system from \"./system\";\n\nexport default combineReducers({\n  system,\n  series,\n  movie,\n  site,\n});\n","import { applyMiddleware, createStore } from \"redux\";\nimport logger from \"redux-logger\";\nimport promise from \"redux-promise\";\nimport trunk from \"redux-thunk\";\nimport rootReducer from \"../reducers\";\n\nconst plugins = [promise, trunk];\n\nif (\n  process.env.NODE_ENV === \"development\" &&\n  process.env[\"REACT_APP_LOG_REDUX_EVENT\"] !== \"false\"\n) {\n  plugins.push(logger);\n}\n\nconst store = createStore(rootReducer, applyMiddleware(...plugins));\nexport default store;\n","import { AxiosResponse } from \"axios\";\nimport apis from \".\";\n\nclass BadgesApi {\n  get<T>(path: string, params?: any): Promise<AxiosResponse<T>> {\n    return apis.axios.get(`/badges${path}`, { params });\n  }\n\n  async all(): Promise<Badge> {\n    return new Promise<Badge>((resolve, reject) => {\n      this.get<Badge>(\"\")\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch(reject);\n    });\n  }\n}\n\nexport default new BadgesApi();\n","import { AxiosResponse } from \"axios\";\nimport apis from \".\";\n\nclass BaseApi {\n  prefix: string;\n\n  constructor(prefix: string) {\n    this.prefix = prefix;\n  }\n\n  private createFormdata(object?: LooseObject) {\n    if (object) {\n      let form = new FormData();\n\n      for (const key in object) {\n        const data = object[key];\n        if (data instanceof Array) {\n          if (data.length > 0) {\n            data.forEach((val) => form.append(key, val));\n          } else {\n            form.append(key, \"\");\n          }\n        } else {\n          form.append(key, object[key]);\n        }\n      }\n      return form;\n    } else {\n      return undefined;\n    }\n  }\n\n  protected get<T>(path: string, params?: any): Promise<AxiosResponse<T>> {\n    return apis.axios.get(this.prefix + path, { params });\n  }\n\n  protected post<T>(\n    path: string,\n    formdata?: LooseObject,\n    params?: any\n  ): Promise<AxiosResponse<T>> {\n    const form = this.createFormdata(formdata);\n    return apis.axios.post(this.prefix + path, form, { params });\n  }\n\n  protected patch<T>(\n    path: string,\n    formdata?: LooseObject,\n    params?: any\n  ): Promise<AxiosResponse<T>> {\n    const form = this.createFormdata(formdata);\n    return apis.axios.patch(this.prefix + path, form, { params });\n  }\n\n  protected delete<T>(\n    path: string,\n    formdata?: any,\n    params?: any\n  ): Promise<AxiosResponse<T>> {\n    const form = this.createFormdata(formdata);\n    return apis.axios.delete(this.prefix + path, { params, data: form });\n  }\n}\n\nexport default BaseApi;\n","import BaseApi from \"./base\";\n\nclass EpisodeApi extends BaseApi {\n  constructor() {\n    super(\"/episodes\");\n  }\n\n  async bySeriesId(seriesid: number): Promise<Array<Item.Episode>> {\n    return new Promise<Array<Item.Episode>>((resolve, reject) => {\n      this.get<DataWrapper<Array<Item.Episode>>>(\"\", { seriesid })\n        .then((result) => {\n          resolve(result.data.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async wanted(start: number, length: number) {\n    return new Promise<AsyncDataWrapper<Wanted.Episode>>((resolve, reject) => {\n      this.get<AsyncDataWrapper<Wanted.Episode>>(\"/wanted\", { start, length })\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  // TODO: Implement this on backend\n  async wantedBy(episodeid?: number) {\n    return new Promise<AsyncDataWrapper<Wanted.Episode>>((resolve, reject) => {\n      this.get<AsyncDataWrapper<Wanted.Episode>>(\"/wanted\", { episodeid })\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async byEpisodeId(episodeid: number): Promise<Array<Item.Episode>> {\n    return new Promise<Array<Item.Episode>>((resolve, reject) => {\n      this.get<DataWrapper<Array<Item.Episode>>>(\"\", { episodeid })\n        .then((result) => {\n          resolve(result.data.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async history(episodeid?: number): Promise<Array<History.Episode>> {\n    return new Promise<Array<History.Episode>>((resolve, reject) => {\n      this.get<DataWrapper<Array<History.Episode>>>(\"/history\", { episodeid })\n        .then((result) => {\n          resolve(result.data.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async downloadSubtitles(\n    seriesid: number,\n    episodeid: number,\n    form: FormType.Subtitle\n  ): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      this.patch(\"/subtitles\", form, { seriesid, episodeid })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async uploadSubtitles(\n    seriesid: number,\n    episodeid: number,\n    form: FormType.UploadSubtitle\n  ): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      this.post(\"/subtitles\", form, { seriesid, episodeid })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async deleteSubtitles(\n    seriesid: number,\n    episodeid: number,\n    form: FormType.DeleteSubtitle\n  ): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      this.delete(\"/subtitles\", form, { seriesid, episodeid })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async blacklist(): Promise<Array<Blacklist.Episode>> {\n    return new Promise<Array<Blacklist.Episode>>((resolve, reject) => {\n      this.get<DataWrapper<Array<Blacklist.Episode>>>(\"/blacklist\")\n        .then((res) => {\n          resolve(res.data.data);\n        })\n        .catch(reject);\n    });\n  }\n\n  async addBlacklist(\n    seriesid: number,\n    episodeid: number,\n    form: FormType.AddBlacklist\n  ): Promise<void> {\n    return new Promise((resolve, reject) => {\n      this.post<void>(\"/blacklist\", form, { seriesid, episodeid })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async deleteBlacklist(\n    all?: boolean,\n    form?: FormType.DeleteBlacklist\n  ): Promise<void> {\n    return new Promise((resolve, reject) => {\n      this.delete<void>(\"/blacklist\", form, { all })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n}\n\nexport default new EpisodeApi();\n","import BaseApi from \"./base\";\n\nclass FilesApi extends BaseApi {\n  constructor() {\n    super(\"/files\");\n  }\n\n  async browse(name: string, path?: string): Promise<FileTree[]> {\n    return new Promise((resolve, reject) => {\n      this.get<FileTree[]>(name, { path })\n        .then((res) => resolve(res.data))\n        .catch(reject);\n    });\n  }\n\n  async bazarr(path?: string): Promise<FileTree[]> {\n    return this.browse(\"\", path);\n  }\n\n  async sonarr(path?: string): Promise<FileTree[]> {\n    return this.browse(\"/sonarr\", path);\n  }\n\n  async radarr(path?: string): Promise<FileTree[]> {\n    return this.browse(\"/radarr\", path);\n  }\n}\n\nexport default new FilesApi();\n","import BaseApi from \"./base\";\n\nclass HistoryApi extends BaseApi {\n  constructor() {\n    super(\"/history\");\n  }\n\n  async stats(\n    timeframe?: History.TimeframeOptions,\n    action?: History.ActionOptions,\n    provider?: string,\n    language?: LanguageCodeType\n  ): Promise<History.Stat> {\n    return new Promise((resolve, reject) => {\n      this.get<History.Stat>(\"/stats\", {\n        timeframe,\n        action,\n        provider,\n        language,\n      })\n        .then((res) => resolve(res.data))\n        .catch(reject);\n    });\n  }\n}\n\nexport default new HistoryApi();\n","import BaseApi from \"./base\";\n\nclass MovieApi extends BaseApi {\n  constructor() {\n    super(\"/movies\");\n  }\n\n  async blacklist(): Promise<Array<Blacklist.Movie>> {\n    return new Promise<Array<Blacklist.Movie>>((resolve, reject) => {\n      this.get<DataWrapper<Array<Blacklist.Movie>>>(\"/blacklist\")\n        .then((res) => {\n          resolve(res.data.data);\n        })\n        .catch(reject);\n    });\n  }\n\n  async addBlacklist(\n    radarrid: number,\n    form: FormType.AddBlacklist\n  ): Promise<void> {\n    return new Promise((resolve, reject) => {\n      this.post<void>(\"/blacklist\", form, { radarrid })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async deleteBlacklist(\n    all?: boolean,\n    form?: FormType.DeleteBlacklist\n  ): Promise<void> {\n    return new Promise((resolve, reject) => {\n      this.delete<void>(\"/blacklist\", form, { all })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async movies(id?: number[]) {\n    return new Promise<AsyncDataWrapper<Item.Movie>>((resolve, reject) => {\n      this.get<AsyncDataWrapper<Item.Movie>>(\"\", { radarrid: id })\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async moviesBy(start: number, length: number) {\n    return new Promise<AsyncDataWrapper<Item.Movie>>((resolve, reject) => {\n      this.get<AsyncDataWrapper<Item.Movie>>(\"\", { start, length })\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async modify(form: FormType.ModifyItem) {\n    return new Promise<void>((resolve, reject) => {\n      this.post<void>(\"\", { radarrid: form.id, profileid: form.profileid })\n        .then(() => resolve())\n        .catch((err) => reject(err));\n    });\n  }\n\n  async wanted(start: number, length: number) {\n    return new Promise<AsyncDataWrapper<Wanted.Movie>>((resolve, reject) => {\n      this.get<AsyncDataWrapper<Wanted.Movie>>(\"/wanted\", { start, length })\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  // TODO: Implement this on backend\n  async wantedBy(radarrid?: number) {\n    return new Promise<AsyncDataWrapper<Wanted.Movie>>((resolve, reject) => {\n      this.get<AsyncDataWrapper<Wanted.Movie>>(\"/wanted\", { radarrid })\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async history(id?: number): Promise<Array<History.Movie>> {\n    return new Promise<Array<History.Movie>>((resolve, reject) => {\n      this.get<DataWrapper<Array<History.Movie>>>(\"/history\", {\n        radarrid: id,\n      })\n        .then((result) => {\n          resolve(result.data.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async action(action: FormType.MoviesAction) {\n    return new Promise<void>((resolve, reject) => {\n      this.patch(\"\", action)\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async downloadSubtitles(id: number, form: FormType.Subtitle): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      this.patch(\"/subtitles\", form, { radarrid: id })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async uploadSubtitles(\n    id: number,\n    form: FormType.UploadSubtitle\n  ): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      this.post(\"/subtitles\", form, { radarrid: id })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async deleteSubtitles(\n    id: number,\n    form: FormType.DeleteSubtitle\n  ): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      this.delete(\"/subtitles\", form, { radarrid: id })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n}\n\nexport default new MovieApi();\n","import BaseApi from \"./base\";\n\nclass ProviderApi extends BaseApi {\n  constructor() {\n    super(\"/providers\");\n  }\n\n  async providers() {\n    return new Promise<Array<System.Provider>>((resolve, reject) => {\n      this.get<DataWrapper<Array<System.Provider>>>(\"\")\n        .then((result) => {\n          resolve(result.data.data);\n        })\n        .catch(reject);\n    });\n  }\n\n  async reset() {\n    return new Promise<void>((resolve, reject) => {\n      this.post<void>(\"\", { action: \"reset\" })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async movies(id: number) {\n    return new Promise<SearchResultType[]>((resolve, reject) => {\n      this.get<DataWrapper<SearchResultType[]>>(\"/movies\", { radarrid: id })\n        .then((result) => resolve(result.data.data))\n        .catch(reject);\n    });\n  }\n\n  async downloadMovieSubtitle(radarrid: number, form: FormType.ManualDownload) {\n    return new Promise<void>((resolve, reject) => {\n      this.post<void>(\"/movies\", form, { radarrid })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async episodes(id: number) {\n    return new Promise<SearchResultType[]>((resolve, reject) => {\n      this.get<DataWrapper<SearchResultType[]>>(\"/episodes\", {\n        episodeid: id,\n      })\n        .then((result) => resolve(result.data.data))\n        .catch(reject);\n    });\n  }\n\n  async downloadEpisodeSubtitle(\n    seriesid: number,\n    episodeid: number,\n    form: FormType.ManualDownload\n  ) {\n    return new Promise<void>((resolve, reject) => {\n      this.post<void>(\"/episodes\", form, { seriesid, episodeid })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n}\n\nexport default new ProviderApi();\n","import BaseApi from \"./base\";\n\nclass SeriesApi extends BaseApi {\n  constructor() {\n    super(\"/series\");\n  }\n\n  async series(id?: number[]) {\n    return new Promise<AsyncDataWrapper<Item.Series>>((resolve, reject) => {\n      this.get<AsyncDataWrapper<Item.Series>>(\"\", { seriesid: id })\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async seriesBy(start: number, length: number) {\n    return new Promise<AsyncDataWrapper<Item.Series>>((resolve, reject) => {\n      this.get<AsyncDataWrapper<Item.Series>>(\"\", { start, length })\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async modify(form: FormType.ModifyItem) {\n    return new Promise<void>((resolve, reject) => {\n      this.post<void>(\"\", { seriesid: form.id, profileid: form.profileid })\n        .then(() => resolve())\n        .catch((err) => reject(err));\n    });\n  }\n\n  async action(form: FormType.SeriesAction) {\n    return new Promise<void>((resolve, reject) => {\n      this.patch(\"\", form)\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n}\n\nexport default new SeriesApi();\n","import BaseApi from \"./base\";\n\nclass SubtitlesApi extends BaseApi {\n  constructor() {\n    super(\"/subtitles\");\n  }\n\n  async info(names: string[]) {\n    return new Promise<SubtitleInfo[]>((resolve, reject) => {\n      this.get<DataWrapper<SubtitleInfo[]>>(`/info`, {\n        filenames: names,\n      })\n        .then((result) => resolve(result.data.data))\n        .catch(reject);\n    });\n  }\n\n  async modify(action: string, form: FormType.ModifySubtitle) {\n    return new Promise<void>((resolve, reject) => {\n      this.patch<void>(\"\", form, { action })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n}\n\nexport default new SubtitlesApi();\n","import BaseApi from \"./base\";\n\nclass SystemApi extends BaseApi {\n  constructor() {\n    super(\"/system\");\n  }\n\n  private async performAction(action: string) {\n    return new Promise((resolve, reject) => {\n      this.post<void>(\"\", undefined, { action })\n        .then(resolve)\n        .catch(reject);\n    });\n  }\n\n  async login(username: string, password: string) {\n    return new Promise((resolve, reject) => {\n      this.post<void>(\"/account\", { username, password }, { action: \"login\" })\n        .then(resolve)\n        .catch(reject);\n    });\n  }\n\n  async logout() {\n    return new Promise((resolve, reject) => {\n      this.post<void>(\"/account\", undefined, { action: \"logout\" })\n        .then(resolve)\n        .catch(reject);\n    });\n  }\n\n  async shutdown() {\n    return this.performAction(\"shutdown\");\n  }\n\n  async restart() {\n    return this.performAction(\"restart\");\n  }\n\n  async settings() {\n    return new Promise<Settings>((resolve, reject) => {\n      this.get<Settings>(\"/settings\")\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch(reject);\n    });\n  }\n\n  async setSettings(data: object) {\n    return new Promise<void>((resolve, reject) => {\n      this.post<void>(\"/settings\", data)\n        .then((res) => {\n          resolve();\n        })\n        .catch(reject);\n    });\n  }\n\n  async languages() {\n    return new Promise<Array<ApiLanguage>>((resolve, reject) => {\n      this.get<Array<ApiLanguage>>(\"/languages\")\n        .then((result) => {\n          resolve(result.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async languagesProfileList() {\n    return new Promise<Array<Profile.Languages>>((resolve, reject) => {\n      this.get<Array<Profile.Languages>>(\"/languages/profiles\")\n        .then((result) => resolve(result.data))\n        .catch(reject);\n    });\n  }\n\n  async status() {\n    return new Promise<System.Status>((resolve, reject) => {\n      this.get<DataWrapper<System.Status>>(\"/status\")\n        .then((result) => {\n          resolve(result.data.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async logs() {\n    return new Promise<Array<System.Log>>((resolve, reject) => {\n      this.get<DataWrapper<Array<System.Log>>>(\"/logs\")\n        .then((result) => resolve(result.data.data))\n        .catch((err) => reject(err));\n    });\n  }\n\n  async releases() {\n    return new Promise<Array<ReleaseInfo>>((resolve, reject) => {\n      this.get<DataWrapper<Array<ReleaseInfo>>>(\"/releases\")\n        .then((result) => resolve(result.data.data))\n        .catch(reject);\n    });\n  }\n\n  async deleteLogs() {\n    return new Promise<void>((resolve, reject) => {\n      this.delete<void>(\"/logs\")\n        .then(() => resolve())\n        .catch((err) => reject(err));\n    });\n  }\n\n  async getTasks() {\n    return new Promise<System.Task>((resolve, reject) => {\n      this.get<DataWrapper<System.Task>>(\"/tasks\")\n        .then((result) => {\n          resolve(result.data.data);\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async runTask(id: string) {\n    return new Promise<void>((resolve, reject) => {\n      this.post<void>(\"/tasks\", { taskid: id })\n        .then(() => {\n          resolve();\n        })\n        .catch((reason) => {\n          reject(reason);\n        });\n    });\n  }\n\n  async testNotification(protocol: string, path: string) {\n    return new Promise<void>((resolve, reject) => {\n      this.patch<void>(\"/notifications\", { protocol, path })\n        .then(() => resolve())\n        .catch(reject);\n    });\n  }\n\n  async search(query: string) {\n    return new Promise<ItemSearchResult[]>((resolve, reject) => {\n      this.get<ItemSearchResult[]>(\"/searches\", { query })\n        .then((res) => resolve(res.data))\n        .catch(reject);\n    });\n  }\n}\n\nexport default new SystemApi();\n","import Axios, { AxiosInstance } from \"axios\";\n\ntype UrlTestResponse =\n  | {\n      status: true;\n      version: string;\n    }\n  | {\n      status: false;\n      error: string;\n    };\n\nclass RequestUtils {\n  private axios!: AxiosInstance;\n\n  constructor() {\n    if (process.env.NODE_ENV === \"development\") {\n      this.recreateAxios(\"/\", process.env.REACT_APP_APIKEY!);\n    } else {\n      const baseUrl =\n        window.Bazarr.baseUrl === \"/\" ? \"/\" : `${window.Bazarr.baseUrl}/`;\n      this.recreateAxios(baseUrl, window.Bazarr.apiKey);\n    }\n  }\n\n  private recreateAxios(url: string, apikey: string) {\n    this.axios = Axios.create({\n      baseURL: url,\n    });\n\n    this.axios.defaults.headers.post[\"Content-Type\"] = \"application/json\";\n    this.axios.defaults.headers.common[\"x-api-key\"] = apikey;\n  }\n\n  urlTest(\n    protocol: string,\n    url: string,\n    params?: any\n  ): Promise<UrlTestResponse> {\n    return new Promise<UrlTestResponse>((resolve, reject) => {\n      this.axios\n        .get(`test/${protocol}/${url}api/system/status`, { params })\n        .then((result) => resolve(result.data))\n        .catch(reject);\n    });\n  }\n}\n\nexport default new RequestUtils();\n","import Axios, { AxiosError, AxiosInstance, CancelTokenSource } from \"axios\";\nimport { siteRedirectToAuth, siteUpdateOffline } from \"../@redux/actions\";\nimport reduxStore from \"../@redux/store\";\nclass Api {\n  axios!: AxiosInstance;\n  source!: CancelTokenSource;\n\n  constructor() {\n    if (process.env.NODE_ENV === \"development\") {\n      this.initialize(\"/api/\", process.env[\"REACT_APP_APIKEY\"]!);\n    } else {\n      const baseUrl =\n        window.Bazarr.baseUrl === \"/\"\n          ? \"/api/\"\n          : `${window.Bazarr.baseUrl}/api/`;\n      this.initialize(baseUrl, window.Bazarr.apiKey);\n    }\n  }\n\n  initialize(url: string, apikey: string) {\n    this.axios = Axios.create({\n      baseURL: url,\n    });\n\n    this.axios.defaults.headers.post[\"Content-Type\"] = \"application/json\";\n    this.axios.defaults.headers.common[\"X-API-KEY\"] = apikey;\n\n    this.source = Axios.CancelToken.source();\n\n    this.axios.interceptors.request.use((config) => {\n      config.cancelToken = this.source.token;\n      return config;\n    });\n\n    this.axios.interceptors.response.use(\n      (resp) => {\n        this.onOnline();\n        if (resp.status >= 200 && resp.status < 300) {\n          return Promise.resolve(resp);\n        } else {\n          this.handleError(resp.status);\n          return Promise.reject(resp);\n        }\n      },\n      (error: AxiosError) => {\n        if (error.response) {\n          const response = error.response;\n          this.handleError(response.status);\n          this.onOnline();\n        } else {\n          this.onOffline();\n          error.message = \"You have disconnected to Bazarr backend\";\n        }\n        return Promise.reject(error);\n      }\n    );\n  }\n\n  onOnline() {\n    const offline = reduxStore.getState().site.offline;\n    if (offline) {\n      reduxStore.dispatch(siteUpdateOffline(false));\n    }\n  }\n\n  onOffline() {\n    reduxStore.dispatch(siteUpdateOffline(true));\n  }\n\n  handleError(code: number) {\n    switch (code) {\n      case 401:\n        reduxStore.dispatch(siteRedirectToAuth());\n        break;\n      case 500:\n        break;\n      default:\n        break;\n    }\n  }\n}\n\nexport default new Api();\nexport { default as BadgesApi } from \"./badges\";\nexport { default as EpisodesApi } from \"./episodes\";\nexport { default as FilesApi } from \"./files\";\nexport { default as HistoryApi } from \"./history\";\nexport { default as MoviesApi } from \"./movies\";\nexport { default as ProvidersApi } from \"./providers\";\nexport { default as SeriesApi } from \"./series\";\nexport { default as SubtitlesApi } from \"./subtitles\";\nexport { default as SystemApi } from \"./system\";\nexport { default as UtilsApi } from \"./utils\";\n","import { isEqual } from \"lodash\";\nimport { log } from \"../../utilites/logger\";\nimport {\n  ActionCallback,\n  ActionDispatcher,\n  AsyncActionCreator,\n  AsyncActionDispatcher,\n  AvailableCreator,\n  AvailableType,\n  PromiseCreator,\n} from \"../types\";\n\n// Limiter the call to API\nconst gLimiter: Map<PromiseCreator, Date> = new Map();\nconst gArgs: Map<PromiseCreator, any[]> = new Map();\n\nconst LIMIT_CALL_MS = 200;\n\nfunction asyncActionFactory<T extends PromiseCreator>(\n  type: string,\n  promise: T,\n  args: Parameters<T>\n): AsyncActionDispatcher<PromiseType<ReturnType<T>>> {\n  return (dispatch) => {\n    const previousArgs = gArgs.get(promise);\n    const date = new Date();\n\n    if (isEqual(previousArgs, args)) {\n      // Get last execute date\n      const previousExec = gLimiter.get(promise);\n      if (previousExec) {\n        const distInMs = date.getTime() - previousExec.getTime();\n        if (distInMs < LIMIT_CALL_MS) {\n          log(\n            \"warning\",\n            \"Multiple calls to API within the range\",\n            promise,\n            args\n          );\n          return Promise.resolve();\n        }\n      }\n    } else {\n      gArgs.set(promise, args);\n    }\n\n    gLimiter.set(promise, date);\n\n    dispatch({\n      type,\n      payload: {\n        loading: true,\n        parameters: args,\n      },\n    });\n\n    return new Promise((resolve, reject) => {\n      promise(...args)\n        .then((val) => {\n          dispatch({\n            type,\n            payload: {\n              loading: false,\n              item: val,\n              parameters: args,\n            },\n          });\n          resolve();\n        })\n        .catch((err) => {\n          dispatch({\n            type,\n            error: true,\n            payload: {\n              loading: false,\n              item: err,\n              parameters: args,\n            },\n          });\n          reject(err);\n        });\n    });\n  };\n}\n\nexport function createAsyncAction<T extends PromiseCreator>(\n  type: string,\n  promise: T\n) {\n  return (...args: Parameters<T>) => asyncActionFactory(type, promise, args);\n}\n\n// Create a action which combine multiple ActionDispatcher and execute them at once\nfunction combineActionFactory(\n  dispatchers: AvailableType<any>[]\n): ActionDispatcher {\n  return (dispatch) => {\n    dispatchers.forEach((fn) => {\n      if (typeof fn === \"function\") {\n        fn(dispatch);\n      } else {\n        dispatch(fn);\n      }\n    });\n  };\n}\n\nexport function createCombineAction<T extends AvailableCreator>(fn: T) {\n  return (...args: Parameters<T>) => combineActionFactory(fn(...args));\n}\n\nfunction combineAsyncActionFactory(\n  dispatchers: AsyncActionDispatcher<any>[]\n): AsyncActionDispatcher<any> {\n  return (dispatch) => {\n    const promises = dispatchers.map((v) => v(dispatch));\n    return Promise.all(promises) as Promise<any>;\n  };\n}\n\nexport function createAsyncCombineAction<T extends AsyncActionCreator>(fn: T) {\n  return (...args: Parameters<T>) => combineAsyncActionFactory(fn(...args));\n}\n\nexport function callbackActionFactory(\n  dispatchers: AsyncActionDispatcher<any>[],\n  success: ActionCallback,\n  error?: ActionCallback\n): ActionDispatcher<any> {\n  return (dispatch) => {\n    const promises = dispatchers.map((v) => v(dispatch));\n    Promise.all(promises)\n      .then(() => {\n        const action = success();\n        if (action !== undefined) {\n          dispatch(action);\n        }\n      })\n      .catch(() => {\n        const action = error && error();\n        if (action !== undefined) {\n          dispatch(action);\n        }\n      });\n  };\n}\n\nexport function createCallbackAction<T extends AsyncActionCreator>(\n  fn: T,\n  success: ActionCallback,\n  error?: ActionCallback\n) {\n  return (...args: Parameters<T>) =>\n    callbackActionFactory(fn(args), success, error);\n}\n","import { Action } from \"redux-actions\";\nimport { SystemApi } from \"../../apis\";\nimport {\n  SYSTEM_RUN_TASK,\n  SYSTEM_UPDATE_LANGUAGES_LIST,\n  SYSTEM_UPDATE_LANGUAGES_PROFILE_LIST,\n  SYSTEM_UPDATE_LOGS,\n  SYSTEM_UPDATE_RELEASES,\n  SYSTEM_UPDATE_SETTINGS,\n  SYSTEM_UPDATE_STATUS,\n  SYSTEM_UPDATE_TASKS,\n} from \"../constants\";\nimport { createAsyncAction, createAsyncCombineAction } from \"./factory\";\n\nexport const systemUpdateLanguagesAll = createAsyncCombineAction(() => [\n  systemUpdateLanguages(),\n  systemUpdateLanguagesProfiles(),\n]);\n\nexport const systemUpdateLanguages = createAsyncAction(\n  SYSTEM_UPDATE_LANGUAGES_LIST,\n  () => SystemApi.languages()\n);\n\nexport const systemUpdateLanguagesProfiles = createAsyncAction(\n  SYSTEM_UPDATE_LANGUAGES_PROFILE_LIST,\n  () => SystemApi.languagesProfileList()\n);\n\nexport const systemUpdateStatus = createAsyncAction(SYSTEM_UPDATE_STATUS, () =>\n  SystemApi.status()\n);\n\nexport const systemUpdateTasks = createAsyncAction(SYSTEM_UPDATE_TASKS, () =>\n  SystemApi.getTasks()\n);\n\nexport function systemRunTasks(id: string): Action<string> {\n  return {\n    type: SYSTEM_RUN_TASK,\n    payload: id,\n  };\n}\n\nexport const systemUpdateLogs = createAsyncAction(SYSTEM_UPDATE_LOGS, () =>\n  SystemApi.logs()\n);\n\nexport const systemUpdateReleases = createAsyncAction(\n  SYSTEM_UPDATE_RELEASES,\n  () => SystemApi.releases()\n);\n\nexport const systemUpdateSettings = createAsyncAction(\n  SYSTEM_UPDATE_SETTINGS,\n  () => SystemApi.settings()\n);\n\nexport const systemUpdateSettingsAll = createAsyncCombineAction(() => [\n  systemUpdateSettings(),\n  systemUpdateLanguagesAll(),\n]);\n","import { createAction } from \"redux-actions\";\nimport { BadgesApi } from \"../../apis\";\nimport {\n  SITE_AUTH_SUCCESS,\n  SITE_BADGE_UPDATE,\n  SITE_INITIALIZED,\n  SITE_INITIALIZE_FAILED,\n  SITE_NEED_AUTH,\n  SITE_NOTIFICATIONS_ADD,\n  SITE_NOTIFICATIONS_REMOVE,\n  SITE_NOTIFICATIONS_REMOVE_BY_TIMESTAMP,\n  SITE_OFFLINE_UPDATE,\n  SITE_SAVE_LOCALSTORAGE,\n  SITE_SIDEBAR_UPDATE,\n} from \"../constants\";\nimport { createAsyncAction, createCallbackAction } from \"./factory\";\nimport { systemUpdateLanguagesAll, systemUpdateSettings } from \"./system\";\n\nexport const bootstrap = createCallbackAction(\n  () => [systemUpdateLanguagesAll(), systemUpdateSettings()],\n  () => siteInitialized(),\n  () => siteInitializeFailed()\n);\n\nconst siteInitializeFailed = createAction(SITE_INITIALIZE_FAILED);\n\nconst siteInitialized = createAction(SITE_INITIALIZED);\n\nexport const siteRedirectToAuth = createAction(SITE_NEED_AUTH);\n\nexport const siteAuthSuccess = createAction(SITE_AUTH_SUCCESS);\n\nexport const badgeUpdateAll = createAsyncAction(SITE_BADGE_UPDATE, () =>\n  BadgesApi.all()\n);\n\nexport const siteSaveLocalstorage = createAction(\n  SITE_SAVE_LOCALSTORAGE,\n  (settings: LooseObject) => settings\n);\n\nexport const siteAddError = createAction(\n  SITE_NOTIFICATIONS_ADD,\n  (err: ReduxStore.Notification) => err\n);\n\nexport const siteRemoveError = createAction(\n  SITE_NOTIFICATIONS_REMOVE,\n  (id: string) => id\n);\n\nexport const siteRemoveErrorByTimestamp = createAction(\n  SITE_NOTIFICATIONS_REMOVE_BY_TIMESTAMP,\n  (date: Date) => date\n);\n\nexport const siteChangeSidebar = createAction(\n  SITE_SIDEBAR_UPDATE,\n  (id: string) => id\n);\n\nexport const siteUpdateOffline = createAction(\n  SITE_OFFLINE_UPDATE,\n  (state: boolean) => state\n);\n","import { MoviesApi } from \"../../apis\";\nimport {\n  MOVIES_UPDATE_BLACKLIST,\n  MOVIES_UPDATE_HISTORY_LIST,\n  MOVIES_UPDATE_INFO,\n  MOVIES_UPDATE_LIST,\n  MOVIES_UPDATE_RANGE,\n  MOVIES_UPDATE_WANTED_LIST,\n  MOVIES_UPDATE_WANTED_RANGE,\n} from \"../constants\";\nimport {\n  createAsyncAction,\n  createAsyncCombineAction,\n  createCombineAction,\n} from \"./factory\";\nimport { badgeUpdateAll } from \"./site\";\n\nexport const movieUpdateList = createAsyncAction(MOVIES_UPDATE_LIST, () =>\n  MoviesApi.movies()\n);\n\nconst movieUpdateWantedList = createAsyncAction(\n  MOVIES_UPDATE_WANTED_LIST,\n  (radarrid?: number) => MoviesApi.wantedBy(radarrid)\n);\n\nexport const movieUpdateWantedByRange = createAsyncAction(\n  MOVIES_UPDATE_WANTED_RANGE,\n  (start: number, length: number) => MoviesApi.wanted(start, length)\n);\n\nexport const movieUpdateWantedBy = createCombineAction((radarrid?: number) => [\n  movieUpdateWantedList(radarrid),\n  badgeUpdateAll(),\n]);\n\nexport const movieUpdateHistoryList = createAsyncAction(\n  MOVIES_UPDATE_HISTORY_LIST,\n  () => MoviesApi.history()\n);\n\nexport const movieUpdateByRange = createAsyncAction(\n  MOVIES_UPDATE_RANGE,\n  (start: number, length: number) => MoviesApi.moviesBy(start, length)\n);\n\nconst movieUpdateInfo = createAsyncAction(MOVIES_UPDATE_INFO, (id?: number[]) =>\n  MoviesApi.movies(id)\n);\n\nexport const movieUpdateInfoAll = createAsyncCombineAction((id?: number[]) => [\n  movieUpdateInfo(id),\n  badgeUpdateAll(),\n]);\n\nexport const movieUpdateBlacklist = createAsyncAction(\n  MOVIES_UPDATE_BLACKLIST,\n  () => MoviesApi.blacklist()\n);\n","import { ProvidersApi } from \"../../apis\";\nimport { PROVIDER_UPDATE_LIST } from \"../constants\";\nimport { createAsyncAction, createCombineAction } from \"./factory\";\nimport { badgeUpdateAll } from \"./site\";\n\nconst providerUpdateList = createAsyncAction(PROVIDER_UPDATE_LIST, () =>\n  ProvidersApi.providers()\n);\n\nexport const providerUpdateAll = createCombineAction(() => [\n  providerUpdateList(),\n  badgeUpdateAll(),\n]);\n","import { EpisodesApi, SeriesApi } from \"../../apis\";\nimport {\n  SERIES_UPDATE_BLACKLIST,\n  SERIES_UPDATE_EPISODE_LIST,\n  SERIES_UPDATE_HISTORY_LIST,\n  SERIES_UPDATE_INFO,\n  SERIES_UPDATE_RANGE,\n  SERIES_UPDATE_WANTED_LIST,\n  SERIES_UPDATE_WANTED_RANGE,\n} from \"../constants\";\nimport {\n  createAsyncAction,\n  createAsyncCombineAction,\n  createCombineAction,\n} from \"./factory\";\nimport { badgeUpdateAll } from \"./site\";\n\nconst seriesUpdateWantedList = createAsyncAction(\n  SERIES_UPDATE_WANTED_LIST,\n  (episodeid?: number) => EpisodesApi.wantedBy(episodeid)\n);\n\nconst seriesUpdateBy = createAsyncAction(SERIES_UPDATE_INFO, (id?: number[]) =>\n  SeriesApi.series(id)\n);\n\nconst episodeUpdateBy = createAsyncAction(\n  SERIES_UPDATE_EPISODE_LIST,\n  (seriesid: number) => EpisodesApi.bySeriesId(seriesid)\n);\n\nexport const seriesUpdateByRange = createAsyncAction(\n  SERIES_UPDATE_RANGE,\n  (start: number, length: number) => SeriesApi.seriesBy(start, length)\n);\n\nexport const seriesUpdateWantedByRange = createAsyncAction(\n  SERIES_UPDATE_WANTED_RANGE,\n  (start: number, length: number) => EpisodesApi.wanted(start, length)\n);\n\nexport const seriesUpdateWantedBy = createCombineAction(\n  (episodeid?: number) => [seriesUpdateWantedList(episodeid), badgeUpdateAll()]\n);\n\nexport const episodeUpdateBySeriesId = createCombineAction(\n  (seriesid: number) => [episodeUpdateBy(seriesid), badgeUpdateAll()]\n);\n\nexport const seriesUpdateHistoryList = createAsyncAction(\n  SERIES_UPDATE_HISTORY_LIST,\n  () => EpisodesApi.history()\n);\n\nexport const seriesUpdateInfoAll = createAsyncCombineAction(\n  (seriesid?: number[]) => [seriesUpdateBy(seriesid), badgeUpdateAll()]\n);\n\nexport const seriesUpdateBlacklist = createAsyncAction(\n  SERIES_UPDATE_BLACKLIST,\n  () => EpisodesApi.blacklist()\n);\n","import { useCallback } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { createCallbackAction } from \"../actions/factory\";\nimport { ActionCallback, AsyncActionDispatcher } from \"../types\";\n\n// function use\nexport function useReduxStore<T extends (store: ReduxStore) => any>(\n  selector: T\n) {\n  return useSelector<ReduxStore, ReturnType<T>>(selector);\n}\n\nexport function useReduxAction<T extends (...args: any[]) => void>(action: T) {\n  const dispatch = useDispatch();\n  return useCallback((...args: Parameters<T>) => dispatch(action(...args)), [\n    action,\n    dispatch,\n  ]);\n}\n\nexport function useReduxActionWith<\n  T extends (...args: any[]) => AsyncActionDispatcher<any>\n>(action: T, success: ActionCallback) {\n  const dispatch = useDispatch();\n  return useCallback(\n    (...args: Parameters<T>) => {\n      const callbackAction = createCallbackAction(\n        () => [action(...args)],\n        success\n      );\n\n      dispatch(callbackAction());\n    },\n    [dispatch, action, success]\n  );\n}\n","import { useCallback, useMemo } from \"react\";\nimport { buildOrderList } from \"../../utilites\";\nimport {\n  episodeUpdateBySeriesId,\n  movieUpdateBlacklist,\n  movieUpdateHistoryList,\n  movieUpdateInfoAll,\n  movieUpdateWantedBy,\n  providerUpdateAll,\n  seriesUpdateBlacklist,\n  seriesUpdateHistoryList,\n  seriesUpdateInfoAll,\n  seriesUpdateWantedBy,\n  systemUpdateLanguages,\n  systemUpdateLanguagesProfiles,\n  systemUpdateSettingsAll,\n} from \"../actions\";\nimport { useReduxAction, useReduxStore } from \"./base\";\n\nfunction stateBuilder<T, D extends (...args: any[]) => any>(\n  t: T,\n  d: D\n): [Readonly<T>, D] {\n  return [t, d];\n}\n\nexport function useSystemSettings() {\n  const action = useReduxAction(systemUpdateSettingsAll);\n  const items = useReduxStore((s) => s.system.settings);\n  return stateBuilder(items, action);\n}\n\nexport function useLanguageProfiles() {\n  const action = useReduxAction(systemUpdateLanguagesProfiles);\n  const items = useReduxStore((s) => s.system.languagesProfiles.data);\n\n  return stateBuilder(items, action);\n}\n\nexport function useProfileBy(id: number | null | undefined) {\n  const [profiles] = useLanguageProfiles();\n  return useMemo(() => profiles.find((v) => v.profileId === id), [\n    id,\n    profiles,\n  ]);\n}\n\nexport function useLanguages(enabled: boolean = false) {\n  const action = useReduxAction(systemUpdateLanguages);\n  const items = useReduxStore((s) =>\n    enabled ? s.system.enabledLanguage.data : s.system.languages.data\n  );\n  return stateBuilder(items, action);\n}\n\nfunction useLanguageGetter(enabled: boolean = false) {\n  const [languages] = useLanguages(enabled);\n  return useCallback(\n    (code?: string) => {\n      if (code === undefined) {\n        return undefined;\n      } else {\n        return languages.find((v) => v.code2 === code);\n      }\n    },\n    [languages]\n  );\n}\n\nexport function useLanguageBy(code?: string) {\n  const getter = useLanguageGetter();\n  return useMemo(() => getter(code), [code, getter]);\n}\n\n// Convert languageprofile items to language\nexport function useProfileItems(profile?: Profile.Languages) {\n  const getter = useLanguageGetter(true);\n\n  return useMemo(\n    () =>\n      profile?.items.map<Language>(({ language, hi, forced }) => {\n        const name = getter(language)?.name ?? \"\";\n        return {\n          hi: hi === \"True\",\n          forced: forced === \"True\",\n          code2: language,\n          name,\n        };\n      }) ?? [],\n    [getter, profile?.items]\n  );\n}\n\nexport function useRawSeries() {\n  const action = useReduxAction(seriesUpdateInfoAll);\n  const items = useReduxStore((d) => d.series.seriesList);\n  return stateBuilder(items, action);\n}\n\nexport function useSeries(order = true) {\n  const [rawSeries, action] = useRawSeries();\n  const series = useMemo<AsyncState<Item.Series[]>>(() => {\n    const state = rawSeries.data;\n    if (order) {\n      return {\n        ...rawSeries,\n        data: buildOrderList(state),\n      };\n    } else {\n      return {\n        ...rawSeries,\n        data: Object.values(state.items),\n      };\n    }\n  }, [rawSeries, order]);\n  return stateBuilder(series, action);\n}\n\nexport function useSerieBy(id?: number) {\n  const [series, updateSerie] = useRawSeries();\n  const updateEpisodes = useReduxAction(episodeUpdateBySeriesId);\n  const serie = useMemo<AsyncState<Item.Series | null>>(() => {\n    const items = series.data.items;\n    let item: Item.Series | null = null;\n    if (id && !isNaN(id) && id in items) {\n      item = items[id];\n    }\n    return {\n      ...series,\n      data: item,\n    };\n  }, [id, series]);\n\n  const update = useCallback(() => {\n    if (id && !isNaN(id)) {\n      updateSerie([id]);\n      updateEpisodes(id);\n    }\n  }, [id, updateSerie, updateEpisodes]);\n\n  return stateBuilder(serie, update);\n}\n\nexport function useEpisodesBy(seriesId?: number) {\n  const action = useReduxAction(episodeUpdateBySeriesId);\n  const callback = useCallback(() => {\n    if (seriesId !== undefined && !isNaN(seriesId)) {\n      action(seriesId);\n    }\n  }, [action, seriesId]);\n\n  const list = useReduxStore((d) => d.series.episodeList);\n\n  const items = useMemo(() => {\n    if (seriesId !== undefined && !isNaN(seriesId)) {\n      return list.data[seriesId] ?? [];\n    } else {\n      return [];\n    }\n  }, [seriesId, list.data]);\n\n  const state: AsyncState<Item.Episode[]> = {\n    ...list,\n    data: items,\n  };\n\n  return stateBuilder(state, callback);\n}\n\nexport function useRawMovies() {\n  const action = useReduxAction(movieUpdateInfoAll);\n  const items = useReduxStore((d) => d.movie.movieList);\n  return stateBuilder(items, action);\n}\n\nexport function useMovies(order = true) {\n  const [rawMovies, action] = useRawMovies();\n  const movies = useMemo<AsyncState<Item.Movie[]>>(() => {\n    const state = rawMovies.data;\n    if (order) {\n      return {\n        ...rawMovies,\n        data: buildOrderList(state),\n      };\n    } else {\n      return {\n        ...rawMovies,\n        data: Object.values(state.items),\n      };\n    }\n  }, [rawMovies, order]);\n  return stateBuilder(movies, action);\n}\n\nexport function useMovieBy(id?: number) {\n  const [movies, updateMovies] = useRawMovies();\n  const movie = useMemo<AsyncState<Item.Movie | null>>(() => {\n    const items = movies.data.items;\n    let item: Item.Movie | null = null;\n    if (id && !isNaN(id) && id in items) {\n      item = items[id];\n    }\n    return {\n      ...movies,\n      data: item,\n    };\n  }, [id, movies]);\n\n  const update = useCallback(() => {\n    if (id && !isNaN(id)) {\n      updateMovies([id]);\n    }\n  }, [id, updateMovies]);\n\n  return stateBuilder(movie, update);\n}\n\nexport function useWantedSeries() {\n  const action = useReduxAction(seriesUpdateWantedBy);\n  const items = useReduxStore((d) => d.series.wantedEpisodesList);\n\n  return stateBuilder(items, action);\n}\n\nexport function useWantedMovies() {\n  const action = useReduxAction(movieUpdateWantedBy);\n  const items = useReduxStore((d) => d.movie.wantedMovieList);\n\n  return stateBuilder(items, action);\n}\n\nexport function useProviders() {\n  const action = useReduxAction(providerUpdateAll);\n  const items = useReduxStore((d) => d.system.providers);\n\n  return stateBuilder(items, action);\n}\n\nexport function useBlacklistMovies() {\n  const action = useReduxAction(movieUpdateBlacklist);\n  const items = useReduxStore((d) => d.movie.blacklist);\n\n  return stateBuilder(items, action);\n}\n\nexport function useBlacklistSeries() {\n  const action = useReduxAction(seriesUpdateBlacklist);\n  const items = useReduxStore((d) => d.series.blacklist);\n\n  return stateBuilder(items, action);\n}\n\nexport function useMoviesHistory() {\n  const action = useReduxAction(movieUpdateHistoryList);\n  const items = useReduxStore((s) => s.movie.historyList);\n\n  return stateBuilder(items, action);\n}\n\nexport function useSeriesHistory() {\n  const action = useReduxAction(seriesUpdateHistoryList);\n  const items = useReduxStore((s) => s.series.historyList);\n\n  return stateBuilder(items, action);\n}\n","import { useCallback } from \"react\";\nimport { useSystemSettings } from \".\";\nimport { siteAddError, siteRemoveErrorByTimestamp } from \"../actions\";\nimport { useReduxAction, useReduxStore } from \"./base\";\n\nexport function useNotification(id: string, sec: number = 5) {\n  const add = useReduxAction(siteAddError);\n  const remove = useReduxAction(siteRemoveErrorByTimestamp);\n\n  return useCallback(\n    (msg: Omit<ReduxStore.Notification, \"id\" | \"timestamp\">) => {\n      const error: ReduxStore.Notification = {\n        ...msg,\n        id,\n        timestamp: new Date(),\n      };\n      add(error);\n      setTimeout(() => remove(error.timestamp), sec * 1000);\n    },\n    [add, remove, sec, id]\n  );\n}\n\nexport function useIsOffline() {\n  return useReduxStore((s) => s.site.offline);\n}\n\nexport function useIsSonarrEnabled() {\n  const [settings] = useSystemSettings();\n  return settings.data?.general.use_sonarr ?? true;\n}\n\nexport function useIsRadarrEnabled() {\n  const [settings] = useSystemSettings();\n  return settings.data?.general.use_radarr ?? true;\n}\n","import React, {\n  FocusEvent,\n  FunctionComponent,\n  KeyboardEvent,\n  useCallback,\n  useMemo,\n  useRef,\n  useState,\n} from \"react\";\nimport \"./chip.scss\";\n\nconst SplitKeys = [\"Tab\", \"Enter\", \" \", \",\", \";\", \".\"];\n\nexport interface ChipsProps {\n  disabled?: boolean;\n  defaultValue?: readonly string[];\n  onChange?: (v: string[]) => void;\n}\n\nexport const Chips: FunctionComponent<ChipsProps> = ({\n  defaultValue,\n  disabled,\n  onChange,\n}) => {\n  const [chips, setChips] = useState(defaultValue ?? []);\n\n  const input = useRef<HTMLInputElement>(null);\n\n  const addChip = useCallback(\n    (value: string) => {\n      const newChips = [...chips];\n      newChips.push(value);\n      setChips(newChips);\n      onChange && onChange(newChips);\n    },\n    [chips, onChange]\n  );\n\n  const removeChip = useCallback(\n    (idx?: number) => {\n      idx = idx ?? chips.length - 1;\n      if (idx !== -1) {\n        const newChips = [...chips];\n        newChips.splice(idx, 1);\n        setChips(newChips);\n        onChange && onChange(newChips);\n      }\n    },\n    [chips, onChange]\n  );\n\n  const clearInput = useCallback(() => {\n    if (input.current) {\n      input.current.value = \"\";\n    }\n  }, [input]);\n\n  const onKeyUp = useCallback(\n    (event: KeyboardEvent<HTMLInputElement>) => {\n      const pressed = event.key;\n      const value = event.currentTarget.value;\n      if (SplitKeys.includes(pressed) && value.length !== 0) {\n        event.preventDefault();\n        addChip(value);\n        clearInput();\n      } else if (pressed === \"Backspace\" && value.length === 0) {\n        event.preventDefault();\n        removeChip();\n      }\n    },\n    [addChip, removeChip, clearInput]\n  );\n\n  const onKeyDown = useCallback((event: KeyboardEvent<HTMLInputElement>) => {\n    const pressed = event.key;\n    const value = event.currentTarget.value;\n    if (SplitKeys.includes(pressed) && value.length !== 0) {\n      event.preventDefault();\n    }\n  }, []);\n\n  const onBlur = useCallback(\n    (event: FocusEvent<HTMLInputElement>) => {\n      const value = event.currentTarget.value;\n      if (value.length !== 0) {\n        event.preventDefault();\n        addChip(value);\n        clearInput();\n      }\n    },\n    [addChip, clearInput]\n  );\n\n  const chipElements = useMemo(\n    () =>\n      chips.map((v, idx) => (\n        <span\n          key={idx}\n          title={v}\n          className={`custom-chip ${disabled ? \"\" : \"active\"}`}\n          onClick={() => {\n            if (!disabled) {\n              removeChip(idx);\n            }\n          }}\n        >\n          {v}\n        </span>\n      )),\n    [chips, removeChip, disabled]\n  );\n\n  return (\n    <div className=\"form-control custom-chip-input d-flex\">\n      <div className=\"chip-container\">{chipElements}</div>\n      <input\n        disabled={disabled}\n        className=\"main-input p-0\"\n        ref={input}\n        onKeyUp={onKeyUp}\n        onKeyDown={onKeyDown}\n        onBlur={onBlur}\n      ></input>\n    </div>\n  );\n};\n","import { faFile, faFolder } from \"@fortawesome/free-regular-svg-icons\";\nimport { faReply } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, {\n  FunctionComponent,\n  useEffect,\n  useMemo,\n  useRef,\n  useState,\n} from \"react\";\nimport { Dropdown, DropdownProps, Form, Spinner } from \"react-bootstrap\";\n\nconst backKey = \"--back--\";\n\nfunction getLastSeparator(path: string): number {\n  let idx = path.lastIndexOf(\"/\");\n  if (idx === -1) {\n    idx = path.lastIndexOf(\"\\\\\");\n  }\n  return idx;\n}\n\nfunction extractPath(raw: string) {\n  if (raw.endsWith(\"/\") || raw.endsWith(\"\\\\\")) {\n    return raw;\n  } else {\n    const idx = getLastSeparator(raw);\n    return raw.slice(0, idx + 1);\n  }\n}\n\ninterface Props {\n  defaultValue?: string;\n  load: (path: string) => Promise<FileTree[]>;\n  onChange?: (path: string) => void;\n  drop?: DropdownProps[\"drop\"];\n}\n\nexport const FileBrowser: FunctionComponent<Props> = ({\n  defaultValue,\n  onChange,\n  load,\n  drop,\n}) => {\n  const [show, canShow] = useState(false);\n  const [text, setText] = useState(defaultValue ?? \"\");\n  const [path, setPath] = useState(() => extractPath(text));\n  const [loading, setLoading] = useState(true);\n\n  const filter = useMemo(() => {\n    const idx = getLastSeparator(text);\n    return text.slice(idx + 1);\n  }, [text]);\n\n  const previous = useMemo(() => {\n    const idx = getLastSeparator(path.slice(0, -1));\n    return path.slice(0, idx + 1);\n  }, [path]);\n\n  const [tree, setTree] = useState<FileTree[]>([]);\n\n  const requestItems = useMemo(() => {\n    if (loading) {\n      return (\n        <Dropdown.Item>\n          <Spinner size=\"sm\" animation=\"border\"></Spinner>\n        </Dropdown.Item>\n      );\n    }\n\n    const elements = [];\n\n    elements.push(\n      ...tree\n        .filter((v) => v.name.startsWith(filter))\n        .map((v) => (\n          <Dropdown.Item eventKey={v.path} key={v.name}>\n            <FontAwesomeIcon\n              icon={v.children ? faFolder : faFile}\n              className=\"mr-2\"\n            ></FontAwesomeIcon>\n            <span>{v.name}</span>\n          </Dropdown.Item>\n        ))\n    );\n\n    if (elements.length === 0) {\n      elements.push(<Dropdown.Header key=\"no-files\">No Files</Dropdown.Header>);\n    }\n\n    if (previous.length !== 0) {\n      return [\n        <Dropdown.Item eventKey={backKey} key=\"back\">\n          <FontAwesomeIcon icon={faReply} className=\"mr-2\"></FontAwesomeIcon>\n          <span>Back</span>\n        </Dropdown.Item>,\n        <Dropdown.Divider key=\"back-divider\"></Dropdown.Divider>,\n        ...elements,\n      ];\n    } else {\n      return elements;\n    }\n  }, [tree, filter, previous, loading]);\n\n  useEffect(() => {\n    if (text === path) {\n      return;\n    }\n\n    const newPath = extractPath(text);\n    if (newPath !== path) {\n      setPath(newPath);\n      onChange && onChange(newPath);\n    }\n  }, [path, text, onChange]);\n\n  const input = useRef<HTMLInputElement>(null);\n\n  useEffect(() => {\n    if (show) {\n      setLoading(true);\n      load(path)\n        .then((res) => {\n          setTree(res);\n        })\n        .finally(() => setLoading(false));\n    }\n  }, [path, load, show]);\n\n  return (\n    <Dropdown\n      show={show}\n      drop={drop}\n      onSelect={(key) => {\n        if (!key) {\n          return;\n        }\n\n        if (key !== backKey) {\n          setText(key);\n        } else {\n          setText(previous);\n        }\n        input.current?.focus();\n      }}\n      onToggle={(open, _, meta) => {\n        if (!open && meta.source !== \"select\") {\n          canShow(false);\n        } else if (open) {\n          canShow(true);\n        }\n      }}\n    >\n      <Dropdown.Toggle\n        as={Form.Control}\n        placeholder=\"Click to start\"\n        type=\"text\"\n        value={text}\n        onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n          setText(e.currentTarget.value);\n        }}\n        ref={input}\n      ></Dropdown.Toggle>\n      <Dropdown.Menu\n        className=\"w-100\"\n        style={{ maxHeight: 256, overflowY: \"auto\" }}\n      >\n        {requestItems}\n      </Dropdown.Menu>\n    </Dropdown>\n  );\n};\n","import React, {\n  ChangeEvent,\n  FunctionComponent,\n  useEffect,\n  useMemo,\n  useRef,\n  useState,\n} from \"react\";\nimport { Form } from \"react-bootstrap\";\n\nexport interface FileFormProps {\n  disabled?: boolean;\n  multiple?: boolean;\n  emptyText: string;\n  value?: File[];\n  onChange?: (files: File[]) => void;\n}\n\nexport const FileForm: FunctionComponent<FileFormProps> = ({\n  value: files,\n  emptyText,\n  multiple,\n  disabled,\n  onChange,\n}) => {\n  const [fileList, setFileList] = useState<File[]>([]);\n\n  const input = useRef<HTMLInputElement>(null);\n\n  useEffect(() => {\n    if (files) {\n      setFileList(files);\n\n      if (files.length === 0 && input.current) {\n        // Manual reset file input\n        input.current.value = \"\";\n      }\n    }\n  }, [files]);\n\n  const label = useMemo(() => {\n    if (fileList.length === 0) {\n      return emptyText;\n    } else {\n      if (multiple) {\n        return `${fileList.length} Files`;\n      } else {\n        return fileList[0].name;\n      }\n    }\n  }, [fileList, emptyText, multiple]);\n\n  return (\n    <Form.File\n      disabled={disabled}\n      custom\n      label={label}\n      multiple={multiple}\n      ref={input}\n      onChange={(e: ChangeEvent<HTMLInputElement>) => {\n        const { files } = e.target;\n        if (files) {\n          const list: File[] = [];\n          for (const file of files) {\n            list.push(file);\n          }\n          setFileList(list);\n          onChange && onChange(list);\n        }\n      }}\n    ></Form.File>\n  );\n};\n","import { isArray } from \"lodash\";\nimport React, { useCallback, useMemo } from \"react\";\nimport ReactSelect from \"react-select\";\nimport \"./selector.scss\";\n\nexport interface SelectorProps<T, M extends boolean> {\n  className?: string;\n  placeholder?: string;\n  options: readonly SelectorOption<T>[];\n  disabled?: boolean;\n  clearable?: boolean;\n  loading?: boolean;\n  multiple?: M;\n  onChange?: (k: SelectorValueType<T, M>) => void;\n  label?: (item: T) => string;\n  defaultValue?: SelectorValueType<T, M>;\n  value?: SelectorValueType<T, M>;\n}\n\nexport function Selector<T = string, M extends boolean = false>(\n  props: SelectorProps<T, M>\n) {\n  const {\n    className,\n    placeholder,\n    label,\n    disabled,\n    clearable,\n    loading,\n    options,\n    multiple,\n    onChange,\n    defaultValue,\n    value,\n  } = props;\n\n  const nameFromItems = useCallback(\n    (item: T) => {\n      return options.find((v) => v.value === item)?.label;\n    },\n    [options]\n  );\n\n  // TODO: Force as any\n  const wrapper = useCallback(\n    (value: SelectorValueType<T, M> | undefined | null): any => {\n      if (value !== null && value !== undefined) {\n        if (multiple) {\n          return (value as SelectorValueType<T, true>).map((v) => ({\n            label: label ? label(v) : nameFromItems(v) ?? \"Unknown\",\n            value: v,\n          }));\n        } else {\n          const v = value as T;\n          return {\n            label: label ? label(v) : nameFromItems(v) ?? \"Unknown\",\n            value: v,\n          };\n        }\n      }\n\n      return value;\n    },\n    [label, multiple, nameFromItems]\n  );\n\n  const defaultWrapper = useMemo(() => wrapper(defaultValue), [\n    defaultValue,\n    wrapper,\n  ]);\n\n  const valueWrapper = useMemo(() => wrapper(value), [wrapper, value]);\n\n  return (\n    <ReactSelect\n      isLoading={loading}\n      placeholder={placeholder}\n      isSearchable={options.length >= 10}\n      isMulti={multiple}\n      closeMenuOnSelect={!multiple}\n      defaultValue={defaultWrapper}\n      value={valueWrapper}\n      isClearable={clearable}\n      isDisabled={disabled}\n      options={options}\n      className={`custom-selector w-100 ${className ?? \"\"}`}\n      classNamePrefix=\"selector\"\n      onChange={(v) => {\n        if (onChange) {\n          let res: T | T[] | null = null;\n          if (isArray(v)) {\n            res = (v as ReadonlyArray<SelectorOption<T>>).map(\n              (val) => val.value\n            );\n          } else {\n            res = (v as SelectorOption<T>)?.value ?? null;\n          }\n          // TODO: Force as any\n          onChange(res as any);\n        }\n      }}\n    ></ReactSelect>\n  );\n}\n","import {\n  faCheck,\n  faCircleNotch,\n  faExclamationTriangle,\n  faTimes,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, {\n  FunctionComponent,\n  PropsWithChildren,\n  useCallback,\n  useEffect,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Alert, Button, ButtonProps, Container } from \"react-bootstrap\";\nimport { LoadingIndicator } from \".\";\nimport { useNotification } from \"../@redux/hooks/site\";\nimport { Reload } from \"../utilites\";\nimport { Selector, SelectorProps } from \"./inputs\";\n\nenum RequestState {\n  Success,\n  Error,\n  Invalid,\n}\n\ninterface AsyncStateOverlayProps<T> {\n  state: AsyncState<T>;\n  exist?: (item: T) => boolean;\n  children?: (item: NonNullable<Readonly<T>>, error?: Error) => JSX.Element;\n}\n\nfunction defaultExist(item: any) {\n  if (item instanceof Array) {\n    return item.length !== 0;\n  } else {\n    return item !== null && item !== undefined;\n  }\n}\n\nexport function AsyncStateOverlay<T>(props: AsyncStateOverlayProps<T>) {\n  const { exist, state, children } = props;\n  const missing = exist ? !exist(state.data) : !defaultExist(state.data);\n\n  const onError = useNotification(\"async-overlay\");\n\n  useEffect(() => {\n    if (!state.updating && state.error !== undefined && !missing) {\n      onError({\n        type: \"error\",\n        message: state.error.message,\n      });\n    }\n  }, [state, onError, missing]);\n\n  if (state.updating) {\n    if (missing) {\n      return <LoadingIndicator></LoadingIndicator>;\n    }\n  } else {\n    if (state.error && missing) {\n      return (\n        <Container>\n          <Alert variant=\"danger\" className=\"my-4\">\n            <Alert.Heading>\n              <FontAwesomeIcon\n                className=\"mr-2\"\n                icon={faExclamationTriangle}\n              ></FontAwesomeIcon>\n              <span>Ouch! You got an error</span>\n            </Alert.Heading>\n            <p>{state.error.message}</p>\n            <hr></hr>\n            <div className=\"d-flex justify-content-end\">\n              <Button variant=\"outline-danger\" onClick={Reload}>\n                Reload\n              </Button>\n            </div>\n          </Alert>\n        </Container>\n      );\n    }\n  }\n\n  return children ? children(state.data!, state.error) : null;\n}\n\ninterface PromiseProps<T> {\n  promise: () => Promise<T>;\n  children: FunctionComponent<T>;\n}\n\nexport function PromiseOverlay<T>({ promise, children }: PromiseProps<T>) {\n  const [item, setItem] = useState<T | null>(null);\n\n  useEffect(() => {\n    promise()\n      .then((result) => setItem(result))\n      .catch(() => {});\n  }, [promise]);\n\n  if (item === null) {\n    return <LoadingIndicator></LoadingIndicator>;\n  } else {\n    return children(item);\n  }\n}\n\ntype ExtractAS<T extends AsyncState<any[]>> = Unpacked<AsyncPayload<T>>;\n\ntype AsyncSelectorProps<T extends AsyncState<any[]>> = {\n  state: T;\n  label: (item: ExtractAS<T>) => string;\n};\n\ntype RemovedSelectorProps<T, M extends boolean> = Omit<\n  SelectorProps<T, M>,\n  \"loading\" | \"options\"\n>;\n\nexport function AsyncSelector<\n  T extends AsyncState<any[]>,\n  M extends boolean = false\n>(\n  props: Override<AsyncSelectorProps<T>, RemovedSelectorProps<ExtractAS<T>, M>>\n) {\n  const { label, state, ...selector } = props;\n\n  const options = useMemo<SelectorOption<ExtractAS<T>>[]>(\n    () =>\n      state.data.map((v) => ({\n        label: label(v),\n        value: v,\n      })),\n    [state, label]\n  );\n\n  return (\n    <Selector\n      loading={state.updating}\n      options={options}\n      label={label}\n      {...selector}\n    ></Selector>\n  );\n}\n\ninterface AsyncButtonProps<T> {\n  as?: ButtonProps[\"as\"];\n  variant?: ButtonProps[\"variant\"];\n  size?: ButtonProps[\"size\"];\n\n  className?: string;\n  disabled?: boolean;\n  onChange?: (v: boolean) => void;\n\n  noReset?: boolean;\n\n  promise: () => Promise<T> | null;\n  onSuccess?: (result: T) => void;\n  error?: () => void;\n}\n\nexport function AsyncButton<T>(\n  props: PropsWithChildren<AsyncButtonProps<T>>\n): JSX.Element {\n  const {\n    children: propChildren,\n    className,\n    promise,\n    onSuccess,\n    noReset,\n    error,\n    onChange,\n    disabled,\n    ...button\n  } = props;\n\n  const [loading, setLoading] = useState(false);\n\n  const [state, setState] = useState(RequestState.Invalid);\n\n  const [, setHandle] = useState<Nullable<NodeJS.Timeout>>(null);\n\n  useEffect(() => {\n    if (noReset) {\n      return;\n    }\n\n    if (state === RequestState.Error || state === RequestState.Success) {\n      const handle = setTimeout(() => setState(RequestState.Invalid), 2 * 1000);\n      setHandle(handle);\n    }\n\n    // Clear timeout handle so we wont leak memory\n    return () => {\n      setHandle((handle) => {\n        if (handle) {\n          clearTimeout(handle);\n        }\n        return null;\n      });\n    };\n  }, [state, noReset]);\n\n  const click = useCallback(() => {\n    if (state !== RequestState.Invalid) {\n      return;\n    }\n\n    const result = promise();\n\n    if (result) {\n      setLoading(true);\n      onChange && onChange(true);\n      result\n        .then((res) => {\n          setState(RequestState.Success);\n          onSuccess && onSuccess(res);\n        })\n        .catch(() => {\n          setState(RequestState.Error);\n          error && error();\n        })\n        .finally(() => {\n          setLoading(false);\n          onChange && onChange(false);\n        });\n    }\n  }, [error, onChange, promise, onSuccess, state]);\n\n  let children = propChildren;\n  if (loading) {\n    children = <FontAwesomeIcon icon={faCircleNotch} spin></FontAwesomeIcon>;\n  }\n\n  if (state === RequestState.Success) {\n    children = <FontAwesomeIcon icon={faCheck}></FontAwesomeIcon>;\n  } else if (state === RequestState.Error) {\n    children = <FontAwesomeIcon icon={faTimes}></FontAwesomeIcon>;\n  }\n\n  return (\n    <Button\n      className={className}\n      disabled={loading || disabled || state !== RequestState.Invalid}\n      {...button}\n      onClick={click}\n    >\n      {children}\n    </Button>\n  );\n}\n","import RcSlider from \"rc-slider\";\nimport \"rc-slider/assets/index.css\";\nimport React, { FunctionComponent, useMemo } from \"react\";\nimport \"./slider.scss\";\n\ntype TooltipsOptions = boolean | \"Always\";\n\nexport interface SliderProps {\n  tooltips?: TooltipsOptions;\n  min?: number;\n  max?: number;\n  start?: number;\n  defaultValue?: number;\n  onAfterChange?: (value: number) => void;\n  onChange?: (value: number) => void;\n}\n\nexport const Slider: FunctionComponent<SliderProps> = ({\n  min,\n  max,\n  tooltips,\n  defaultValue,\n  onChange,\n  onAfterChange,\n}) => {\n  return (\n    <div className=\"d-flex flex-row align-items-center py-2\">\n      <span className=\"text-muted pr-3\">{min ?? 0}</span>\n      <RcSlider\n        min={min ?? 0}\n        max={max ?? 100}\n        className=\"custom-rc-slider\"\n        step={1}\n        defaultValue={defaultValue}\n        onChange={onChange}\n        onAfterChange={onAfterChange}\n        handle={(props) => (\n          <div\n            className=\"rc-slider-handle\"\n            style={{\n              left: `${props.offset}%`,\n            }}\n          >\n            <SliderTooltips\n              tooltips={tooltips}\n              value={props.value}\n            ></SliderTooltips>\n          </div>\n        )}\n      ></RcSlider>\n      <span className=\"text-muted pl-3\">{max ?? 100}</span>\n    </div>\n  );\n};\n\nconst SliderTooltips: FunctionComponent<{\n  tooltips?: TooltipsOptions;\n  value: number;\n}> = ({ tooltips, value }) => {\n  const cls = useMemo(() => {\n    const tipsCls = [\"rc-slider-handle-tips\"];\n    if (tooltips !== undefined) {\n      if (typeof tooltips === \"string\") {\n        tipsCls.push(\"rc-slider-handle-tips-always\");\n      } else if (tooltips === false) {\n        tipsCls.push(\"rc-slider-handle-tips-hidden\");\n      }\n    }\n    return tipsCls.join(\" \");\n  }, [tooltips]);\n\n  return <span className={cls}>{value}</span>;\n};\n","import { IconDefinition } from \"@fortawesome/fontawesome-common-types\";\nimport { faCircleNotch } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, MouseEvent } from \"react\";\nimport { Badge, Button, ButtonProps } from \"react-bootstrap\";\n\nexport const ActionBadge: FunctionComponent<{\n  icon: IconDefinition;\n  onClick?: (e: MouseEvent) => void;\n}> = ({ icon, onClick }) => {\n  return (\n    <Button\n      as={Badge}\n      className=\"mx-1 p-1\"\n      variant=\"secondary\"\n      onClick={onClick}\n    >\n      <FontAwesomeIcon icon={icon}></FontAwesomeIcon>\n    </Button>\n  );\n};\n\ninterface ActionButtonProps extends ActionButtonItemProps {\n  disabled?: boolean;\n  destructive?: boolean;\n  variant?: string;\n  onClick?: (e: MouseEvent) => void;\n  className?: string;\n  size?: ButtonProps[\"size\"];\n}\n\nexport const ActionButton: FunctionComponent<ActionButtonProps> = ({\n  onClick,\n  destructive,\n  disabled,\n  variant,\n  className,\n  size,\n  ...other\n}) => {\n  return (\n    <Button\n      disabled={other.loading || disabled}\n      size={size ?? \"sm\"}\n      variant={variant ?? \"light\"}\n      className={`text-nowrap ${className ?? \"\"}`}\n      onClick={onClick}\n    >\n      <ActionButtonItem {...other}></ActionButtonItem>\n    </Button>\n  );\n};\n\ninterface ActionButtonItemProps {\n  loading?: boolean;\n  icon: IconDefinition;\n  children?: string;\n}\n\nexport const ActionButtonItem: FunctionComponent<ActionButtonItemProps> = ({\n  icon,\n  children,\n  loading,\n}) => {\n  return (\n    <React.Fragment>\n      <FontAwesomeIcon\n        style={{ width: \"1rem\" }}\n        icon={loading ? faCircleNotch : icon}\n        spin={loading}\n      ></FontAwesomeIcon>\n      {children && !loading ? (\n        <span className=\"ml-2 font-weight-bold\">{children}</span>\n      ) : null}\n    </React.Fragment>\n  );\n};\n","import { IconDefinition } from \"@fortawesome/fontawesome-svg-core\";\nimport { faSpinner } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, {\n  FunctionComponent,\n  MouseEvent,\n  PropsWithChildren,\n  useCallback,\n  useState,\n} from \"react\";\nimport { Button } from \"react-bootstrap\";\n\ninterface CHButtonProps {\n  disabled?: boolean;\n  hidden?: boolean;\n  icon: IconDefinition;\n  updating?: boolean;\n  updatingIcon?: IconDefinition;\n  onClick?: (e: MouseEvent) => void;\n}\n\nconst ContentHeaderButton: FunctionComponent<CHButtonProps> = (props) => {\n  const { children, icon, disabled, updating, updatingIcon, onClick } = props;\n\n  let displayIcon = icon;\n  if (updating) {\n    displayIcon = updatingIcon ? updatingIcon : faSpinner;\n  }\n\n  return (\n    <Button\n      variant=\"dark\"\n      className=\"d-flex flex-column text-nowrap py-1\"\n      disabled={disabled || updating}\n      onClick={onClick}\n    >\n      <FontAwesomeIcon\n        className=\"mx-auto my-1\"\n        icon={displayIcon}\n        spin={updating}\n      ></FontAwesomeIcon>\n      <span className=\"align-bottom text-themecolor small text-center\">\n        {children}\n      </span>\n    </Button>\n  );\n};\n\ntype CHAsyncButtonProps<T extends () => Promise<any>> = {\n  promise: T;\n  onSuccess?: (item: PromiseType<ReturnType<T>>) => void;\n} & Omit<CHButtonProps, \"updating\" | \"updatingIcon\" | \"onClick\">;\n\nexport function ContentHeaderAsyncButton<T extends () => Promise<any>>(\n  props: PropsWithChildren<CHAsyncButtonProps<T>>\n): JSX.Element {\n  const { promise, onSuccess, ...button } = props;\n\n  const [updating, setUpdate] = useState(false);\n\n  const click = useCallback(() => {\n    setUpdate(true);\n    promise().then((val) => {\n      setUpdate(false);\n      onSuccess && onSuccess(val);\n    });\n  }, [onSuccess, promise]);\n\n  return (\n    <ContentHeaderButton\n      updating={updating}\n      onClick={click}\n      {...button}\n    ></ContentHeaderButton>\n  );\n}\n\nexport default ContentHeaderButton;\n","import React, { FunctionComponent } from \"react\";\n\ntype GroupPosition = \"start\" | \"end\";\ninterface GroupProps {\n  pos: GroupPosition;\n}\n\nconst ContentHeaderGroup: FunctionComponent<GroupProps> = (props) => {\n  const { children, pos } = props;\n\n  const className = `d-flex flex-grow-1 align-items-center justify-content-${pos}`;\n  return <div className={className}>{children}</div>;\n};\n\nexport default ContentHeaderGroup;\n","import React, { FunctionComponent, useMemo } from \"react\";\nimport { Row } from \"react-bootstrap\";\nimport ContentHeaderButton, { ContentHeaderAsyncButton } from \"./Button\";\nimport ContentHeaderGroup from \"./Group\";\nimport \"./style.scss\";\n\ninterface Props {\n  scroll?: boolean;\n  className?: string;\n}\n\ndeclare type Header = FunctionComponent<Props> & {\n  Button: typeof ContentHeaderButton;\n  AsyncButton: typeof ContentHeaderAsyncButton;\n  Group: typeof ContentHeaderGroup;\n};\n\nexport const ContentHeader: Header = ({ children, scroll, className }) => {\n  const cls = useMemo(() => {\n    const rowCls = [\"content-header\", \"bg-dark\", \"p-2\"];\n\n    if (className !== undefined) {\n      rowCls.push(className);\n    }\n\n    if (scroll !== false) {\n      rowCls.push(\"scroll\");\n    }\n    return rowCls.join(\" \");\n  }, [scroll, className]);\n\n  let childItem: React.ReactNode;\n\n  if (scroll !== false) {\n    childItem = (\n      <div className=\"d-flex flex-nowrap flex-grow-1\">{children}</div>\n    );\n  } else {\n    childItem = children;\n  }\n  return <Row className={cls}>{childItem}</Row>;\n};\n\nContentHeader.Button = ContentHeaderButton;\nContentHeader.Group = ContentHeaderGroup;\nContentHeader.AsyncButton = ContentHeaderAsyncButton;\n\nexport default ContentHeader;\n","import React, { useMemo } from \"react\";\nimport { Selector, SelectorProps } from \"../components\";\n\ninterface Props {\n  options: readonly Language[];\n}\n\ntype RemovedSelectorProps<M extends boolean> = Omit<\n  SelectorProps<Language, M>,\n  \"label\" | \"placeholder\"\n>;\n\nexport type LanguageSelectorProps<M extends boolean> = Override<\n  Props,\n  RemovedSelectorProps<M>\n>;\n\nexport function LanguageSelector<M extends boolean = false>(\n  props: LanguageSelectorProps<M>\n) {\n  const { options, ...selector } = props;\n\n  const items = useMemo<SelectorOption<Language>[]>(\n    () =>\n      options.map((v) => ({\n        label: v.name,\n        value: v,\n      })),\n    [options]\n  );\n\n  return (\n    <Selector\n      placeholder=\"Language...\"\n      options={items}\n      label={(l) => l.name}\n      {...selector}\n    ></Selector>\n  );\n}\n","import React, {\n  Dispatch,\n  FunctionComponent,\n  useCallback,\n  useContext,\n  useEffect,\n  useMemo,\n  useState,\n} from \"react\";\nimport { log } from \"../../utilites/logger\";\n\nconst ModalContext = React.createContext<[string[], Dispatch<string[]>]>([\n  [],\n  (s) => {},\n]);\n\nconst PayloadContext = React.createContext<[any[], Dispatch<any[]>]>([\n  [],\n  (p) => {},\n]);\n\n// TODO: Performance\nexport function useShowModal() {\n  const [keys, setKeys] = useContext(ModalContext);\n  const [payloads, setPayloads] = useContext(PayloadContext);\n  return useCallback(\n    <T,>(key: string, payload?: T) => {\n      log(\"info\", `modal ${key} sending payload`, payload);\n\n      setKeys([...keys, key]);\n      setPayloads([...payloads, payload ?? null]);\n    },\n    [keys, payloads, setKeys, setPayloads]\n  );\n}\n\nexport function useCloseModal() {\n  const [keys, setKeys] = useContext(ModalContext);\n  const [payloads, setPayloads] = useContext(PayloadContext);\n  return useCallback(() => {\n    const newKey = [...keys];\n    newKey.pop();\n    const newPayload = [...payloads];\n    newPayload.pop();\n    setKeys(newKey);\n    setPayloads(newPayload);\n  }, [keys, payloads, setKeys, setPayloads]);\n}\n\nexport function useCloseModalUntil(key: string) {\n  const [keys, setKeys] = useContext(ModalContext);\n  const [payloads, setPayloads] = useContext(PayloadContext);\n  return useCallback(() => {\n    const idx = keys.findIndex((v) => v === key);\n    if (idx !== -1) {\n      const newKey = keys.slice(0, idx + 1);\n      const newPayload = payloads.slice(0, idx + 1);\n      setKeys(newKey);\n      setPayloads(newPayload);\n    } else {\n      log(\"error\", \"Cannot close modal, key is unavailable\");\n    }\n  }, [keys, payloads, setKeys, setPayloads, key]);\n}\n\nexport function useIsModalShow(key: string) {\n  const keys = useContext(ModalContext)[0];\n  return key === keys[keys.length - 1];\n}\n\nexport function useOnModalShow(key: string, show: () => void) {\n  const isShow = useIsModalShow(key);\n  useEffect(() => {\n    if (isShow) {\n      show();\n    }\n  }, [isShow, show]);\n}\n\nexport function usePayload<T>(key: string): T | null {\n  const payloads = useContext(PayloadContext)[0];\n  const keys = useContext(ModalContext)[0];\n  return useMemo(() => {\n    const idx = keys.findIndex((v) => v === key);\n    return idx !== -1 ? payloads[idx] : null;\n  }, [keys, payloads, key]);\n}\n\nexport const ModalProvider: FunctionComponent = ({ children }) => {\n  const [key, setKey] = useState<string[]>([]);\n  const [payload, setPayload] = useState<any[]>([]);\n\n  return (\n    <ModalContext.Provider value={[key, setKey]}>\n      <PayloadContext.Provider value={[payload, setPayload]}>\n        {children}\n      </PayloadContext.Provider>\n    </ModalContext.Provider>\n  );\n};\n","import {\n  faCheck,\n  faCircleNotch,\n  faExclamationTriangle,\n  faInfoCircle,\n  faTrash,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useEffect,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Button, Container, Form } from \"react-bootstrap\";\nimport { Column, TableUpdater } from \"react-table\";\nimport {\n  AsyncButton,\n  FileForm,\n  LanguageSelector,\n  MessageIcon,\n  SimpleTable,\n  useCloseModal,\n  usePayload,\n} from \"..\";\nimport {\n  useEpisodesBy,\n  useProfileBy,\n  useProfileItems,\n} from \"../../@redux/hooks\";\nimport { EpisodesApi, SubtitlesApi } from \"../../apis\";\nimport { Selector } from \"../inputs\";\nimport BaseModal, { BaseModalProps } from \"./BaseModal\";\n\nenum State {\n  Update,\n  Valid,\n  Warning,\n  Error,\n}\n\ninterface PendingSubtitle {\n  form: FormType.UploadSubtitle;\n  didCheck: boolean;\n  instance?: Item.Episode;\n}\n\ntype SubtitleState = {\n  state: State;\n  infos: string[];\n};\n\ntype ProcessState = {\n  [name: string]: SubtitleState;\n};\n\ntype EpisodeMap = {\n  [name: string]: Item.Episode;\n};\n\ninterface MovieProps {}\n\nconst SeriesUploadModal: FunctionComponent<MovieProps & BaseModalProps> = (\n  modal\n) => {\n  const series = usePayload<Item.Series>(modal.modalKey);\n\n  const [episodes, updateEpisodes] = useEpisodesBy(series?.sonarrSeriesId);\n\n  const [uploading, setUpload] = useState(false);\n\n  const closeModal = useCloseModal();\n\n  const [pending, setPending] = useState<PendingSubtitle[]>([]);\n\n  const [processState, setProcessState] = useState<ProcessState>({});\n\n  const profile = useProfileBy(series?.profileId);\n\n  const languages = useProfileItems(profile);\n\n  const filelist = useMemo(() => pending.map((v) => v.form.file), [pending]);\n\n  // Vaildate\n  useEffect(() => {\n    const states = pending.reduce<ProcessState>((prev, info) => {\n      const subState: SubtitleState = {\n        state: State.Valid,\n        infos: [],\n      };\n\n      const { form, instance } = info;\n\n      if (!info.didCheck) {\n        subState.state = State.Update;\n      } else if (!instance) {\n        subState.infos.push(\"Season or episode info is missing\");\n        subState.state = State.Error;\n      } else {\n        if (\n          instance.subtitles.find((v) => v.code2 === form.language) !==\n          undefined\n        ) {\n          subState.infos.push(\"Overwrite existing subtitle\");\n          subState.state = State.Warning;\n        }\n      }\n\n      prev[form.file.name] = subState;\n      return prev;\n    }, {});\n\n    setProcessState(states);\n  }, [pending]);\n\n  const checkEpisodes = useCallback(\n    async (list: PendingSubtitle[]) => {\n      const names = list.map((v) => v.form.file.name);\n\n      if (names.length > 0) {\n        const results = await SubtitlesApi.info(names);\n\n        const episodeMap = results.reduce<EpisodeMap>((prev, curr) => {\n          const ep = episodes.data.find(\n            (v) => v.season === curr.season && v.episode === curr.episode\n          );\n          if (ep) {\n            prev[curr.filename] = ep;\n          }\n          return prev;\n        }, {});\n\n        setPending((pd) =>\n          pd.map((v) => ({\n            ...v,\n            didCheck: true,\n            instance: episodeMap[v.form.file.name],\n          }))\n        );\n      }\n    },\n    [episodes.data]\n  );\n\n  const updateLanguage = useCallback(\n    (lang: Nullable<Language>) => {\n      if (lang) {\n        const list = pending.map((v) => {\n          const form = v.form;\n          return {\n            ...v,\n            form: {\n              ...form,\n              language: lang.code2,\n              hi: lang.hi ?? false,\n              forced: lang.forced ?? false,\n            },\n          };\n        });\n        setPending(list);\n      }\n    },\n    [pending]\n  );\n\n  const setFiles = useCallback(\n    (files: File[]) => {\n      // At lease 1 language is required\n      const lang = languages[0];\n      const list: PendingSubtitle[] = files.map((f) => {\n        return {\n          form: {\n            file: f,\n            language: lang.code2,\n            hi: lang.hi ?? false,\n            forced: lang.forced ?? false,\n          },\n          didCheck: false,\n        };\n      });\n      setPending(list);\n\n      const states = files.reduce<ProcessState>(\n        (v, curr) => ({\n          ...v,\n          [curr.name]: { state: State.Update, infos: [] },\n        }),\n        {}\n      );\n      setProcessState(states);\n      checkEpisodes(list);\n    },\n    [languages, checkEpisodes]\n  );\n\n  const uploadSubtitles = useCallback(async () => {\n    if (series === null) {\n      return;\n    }\n\n    const { sonarrSeriesId: seriesid } = series;\n\n    let uploadStates = pending.reduce<ProcessState>((prev, curr) => {\n      prev[curr.form.file.name] = { state: State.Update, infos: [] };\n      return prev;\n    }, {});\n\n    setProcessState(uploadStates);\n\n    for (const info of pending) {\n      if (info.instance) {\n        const { sonarrEpisodeId: episodeid } = info.instance;\n        await EpisodesApi.uploadSubtitles(seriesid, episodeid, info.form);\n\n        uploadStates = {\n          ...uploadStates,\n          [info.form.file.name]: { state: State.Valid, infos: [] },\n        };\n\n        setProcessState(uploadStates);\n      }\n    }\n  }, [series, pending]);\n\n  const canUpload = useMemo(\n    () => pending.length > 0 && pending.every((v) => v.instance !== undefined),\n    [pending]\n  );\n\n  const tableShow = pending.length > 0;\n\n  const columns = useMemo<Column<PendingSubtitle>[]>(\n    () => [\n      {\n        id: \"Icon\",\n        accessor: \"instance\",\n        className: \"text-center\",\n        Cell: ({ row, loose }) => {\n          const {\n            form: { file },\n          } = row.original;\n\n          const name = file.name;\n          const states = loose![1] as ProcessState;\n\n          let icon = faCircleNotch;\n          let color: string | undefined = undefined;\n          let spin = false;\n          let msgs: string[] = [];\n\n          if (name in states) {\n            const state = states[name];\n            msgs = state.infos;\n            switch (state.state) {\n              case State.Error:\n                icon = faExclamationTriangle;\n                color = \"var(--danger)\";\n                break;\n              case State.Valid:\n                icon = faCheck;\n                color = \"var(--success)\";\n                break;\n              case State.Warning:\n                icon = faInfoCircle;\n                color = \"var(--warning)\";\n                break;\n              case State.Update:\n                spin = true;\n                break;\n              default:\n                break;\n            }\n          }\n\n          return (\n            <MessageIcon\n              messages={msgs}\n              color={color}\n              icon={icon}\n              spin={spin}\n            ></MessageIcon>\n          );\n        },\n      },\n      {\n        Header: \"File\",\n        accessor: (d) => d.form.file.name,\n      },\n      {\n        Header: \"Episode\",\n        accessor: \"instance\",\n        className: \"vw-1\",\n        Cell: ({ value, loose, row, externalUpdate }) => {\n          const availables = loose![2] as Item.Episode[];\n\n          const options = availables.map<SelectorOption<Item.Episode>>(\n            (ep) => ({\n              label: `(${ep.season}x${ep.episode}) ${ep.title}`,\n              value: ep,\n            })\n          );\n\n          const change = useCallback(\n            (ep: Nullable<Item.Episode>) => {\n              if (ep) {\n                const newInfo = { ...row.original };\n                newInfo.instance = ep;\n                externalUpdate && externalUpdate(row, newInfo);\n              }\n            },\n            [row, externalUpdate]\n          );\n\n          return (\n            <Selector\n              options={options}\n              value={value ?? null}\n              onChange={change}\n            ></Selector>\n          );\n        },\n      },\n      {\n        accessor: \"form\",\n        Cell: ({ row, externalUpdate, loose }) => {\n          const [uploading] = loose!;\n          return (\n            <Button\n              size=\"sm\"\n              variant=\"light\"\n              disabled={uploading}\n              onClick={() => {\n                externalUpdate && externalUpdate(row);\n              }}\n            >\n              <FontAwesomeIcon icon={faTrash}></FontAwesomeIcon>\n            </Button>\n          );\n        },\n      },\n    ],\n    []\n  );\n\n  const updateItem = useCallback<TableUpdater<PendingSubtitle>>(\n    (row, info?: PendingSubtitle) => {\n      setPending((pd) => {\n        const newPending = [...pd];\n        if (info) {\n          newPending[row.index] = info;\n        } else {\n          newPending.splice(row.index, 1);\n        }\n        return newPending;\n      });\n    },\n    []\n  );\n\n  const footer = (\n    <div className=\"d-flex flex-row flex-grow-1 justify-content-between\">\n      <div className=\"w-25\">\n        <LanguageSelector\n          disabled={uploading}\n          options={languages}\n          defaultValue={languages.length > 0 ? languages[0] : undefined}\n          onChange={updateLanguage}\n        ></LanguageSelector>\n      </div>\n      <div>\n        <Button\n          hidden={uploading}\n          disabled={pending.length === 0}\n          variant=\"outline-secondary\"\n          className=\"mr-2\"\n          onClick={() => setFiles([])}\n        >\n          Clean\n        </Button>\n        <AsyncButton\n          noReset\n          disabled={!canUpload}\n          onChange={setUpload}\n          promise={uploadSubtitles}\n          onSuccess={() => {\n            closeModal();\n            setFiles([]);\n            updateEpisodes();\n          }}\n        >\n          Upload\n        </AsyncButton>\n      </div>\n    </div>\n  );\n\n  return (\n    <BaseModal\n      size=\"lg\"\n      title=\"Upload Subtitles\"\n      closeable={!uploading}\n      footer={footer}\n      {...modal}\n    >\n      <Container fluid className=\"flex-column\">\n        <Form>\n          <Form.Group>\n            <FileForm\n              emptyText=\"Select...\"\n              disabled={tableShow || languages.length === 0}\n              multiple\n              value={filelist}\n              onChange={setFiles}\n            ></FileForm>\n          </Form.Group>\n        </Form>\n        <div hidden={!tableShow}>\n          <SimpleTable\n            columns={columns}\n            data={pending}\n            loose={[uploading, processState, episodes.data]}\n            responsive={false}\n            externalUpdate={updateItem}\n          ></SimpleTable>\n        </div>\n      </Container>\n    </BaseModal>\n  );\n};\n\nexport default SeriesUploadModal;\n","import React, { FunctionComponent } from \"react\";\nimport { Modal } from \"react-bootstrap\";\nimport { useIsModalShow } from \".\";\nimport { useCloseModal } from \"./provider\";\n\nexport interface BaseModalProps {\n  modalKey: string;\n  size?: \"sm\" | \"lg\" | \"xl\";\n  closeable?: boolean;\n  title?: string;\n  footer?: JSX.Element;\n}\n\nexport const BaseModal: FunctionComponent<BaseModalProps> = (props) => {\n  const { size, closeable, modalKey, title, children, footer } = props;\n\n  const show = useIsModalShow(modalKey);\n  const closeModal = useCloseModal();\n\n  const canClose = closeable !== false;\n\n  return (\n    <Modal\n      centered\n      size={size}\n      show={show}\n      onHide={closeModal}\n      backdrop={canClose ? undefined : \"static\"}\n    >\n      <Modal.Header closeButton={canClose}>{title}</Modal.Header>\n      <Modal.Body>{children}</Modal.Body>\n      <Modal.Footer hidden={footer === undefined}>{footer}</Modal.Footer>\n    </Modal>\n  );\n};\n\nexport default BaseModal;\n","import { faFileExcel } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent } from \"react\";\nimport { AsyncButton } from \"../components\";\n\ninterface Props {\n  history: History.Base;\n  update: () => void;\n  promise: (form: FormType.AddBlacklist) => Promise<void>;\n}\n\nexport const BlacklistButton: FunctionComponent<Props> = ({\n  history,\n  update,\n  promise,\n}) => {\n  const { provider, subs_id, language, subtitles_path, blacklisted } = history;\n\n  if (subs_id && provider && language) {\n    return (\n      <AsyncButton\n        size=\"sm\"\n        variant=\"light\"\n        noReset\n        disabled={blacklisted}\n        promise={() => {\n          const { code2 } = language;\n          const form: FormType.AddBlacklist = {\n            provider,\n            subs_id,\n            subtitles_path,\n            language: code2,\n          };\n          return promise(form);\n        }}\n        onSuccess={update}\n      >\n        <FontAwesomeIcon icon={faFileExcel}></FontAwesomeIcon>\n      </AsyncButton>\n    );\n  } else {\n    return null;\n  }\n};\n","import React, {\n  FunctionComponent,\n  useCallback,\n  useEffect,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Column } from \"react-table\";\nimport { AsyncStateOverlay, HistoryIcon, LanguageText, PageTable } from \"..\";\nimport { EpisodesApi, MoviesApi } from \"../../apis\";\nimport { BlacklistButton } from \"../../generic/blacklist\";\nimport { updateAsyncState } from \"../../utilites\";\nimport BaseModal, { BaseModalProps } from \"./BaseModal\";\nimport { usePayload } from \"./provider\";\n\nexport const MovieHistoryModal: FunctionComponent<BaseModalProps> = (props) => {\n  const { ...modal } = props;\n\n  const movie = usePayload<Item.Movie>(modal.modalKey);\n\n  const [history, setHistory] = useState<AsyncState<History.Movie[]>>({\n    updating: false,\n    data: [],\n  });\n\n  const update = useCallback(() => {\n    if (movie) {\n      updateAsyncState(MoviesApi.history(movie.radarrId), setHistory, []);\n    }\n  }, [movie]);\n\n  useEffect(() => {\n    update();\n  }, [update]);\n\n  const columns = useMemo<Column<History.Movie>[]>(\n    () => [\n      {\n        accessor: \"action\",\n        className: \"text-center\",\n        Cell: (row) => {\n          return <HistoryIcon action={row.value}></HistoryIcon>;\n        },\n      },\n      {\n        Header: \"Language\",\n        accessor: \"language\",\n        Cell: ({ value }) => {\n          if (value) {\n            return <LanguageText text={value} long></LanguageText>;\n          } else {\n            return null;\n          }\n        },\n      },\n      {\n        Header: \"Provider\",\n        accessor: \"provider\",\n      },\n      {\n        Header: \"Score\",\n        accessor: \"score\",\n      },\n      {\n        Header: \"Date\",\n        accessor: \"timestamp\",\n      },\n      {\n        // Actions\n        accessor: \"blacklisted\",\n        Cell: ({ row }) => {\n          const original = row.original;\n          return (\n            <BlacklistButton\n              update={update}\n              promise={(form) =>\n                MoviesApi.addBlacklist(original.radarrId, form)\n              }\n              history={original}\n            ></BlacklistButton>\n          );\n        },\n      },\n    ],\n    [update]\n  );\n\n  return (\n    <BaseModal title={`History - ${movie?.title ?? \"\"}`} {...modal}>\n      <AsyncStateOverlay state={history}>\n        {(data) => (\n          <PageTable\n            emptyText=\"No History Found\"\n            columns={columns}\n            data={data}\n          ></PageTable>\n        )}\n      </AsyncStateOverlay>\n    </BaseModal>\n  );\n};\n\ninterface EpisodeHistoryProps {}\n\nexport const EpisodeHistoryModal: FunctionComponent<\n  BaseModalProps & EpisodeHistoryProps\n> = (props) => {\n  const episode = usePayload<Item.Episode>(props.modalKey);\n\n  const [history, setHistory] = useState<AsyncState<History.Episode[]>>({\n    updating: false,\n    data: [],\n  });\n\n  const update = useCallback(() => {\n    if (episode) {\n      updateAsyncState(\n        EpisodesApi.history(episode.sonarrEpisodeId),\n        setHistory,\n        []\n      );\n    }\n  }, [episode]);\n\n  useEffect(() => update(), [update]);\n\n  const columns = useMemo<Column<History.Episode>[]>(\n    () => [\n      {\n        accessor: \"action\",\n        className: \"text-center\",\n        Cell: (row) => {\n          return <HistoryIcon action={row.value}></HistoryIcon>;\n        },\n      },\n      {\n        Header: \"Language\",\n        accessor: \"language\",\n        Cell: ({ value }) => {\n          if (value) {\n            return <LanguageText text={value} long></LanguageText>;\n          } else {\n            return null;\n          }\n        },\n      },\n      {\n        Header: \"Provider\",\n        accessor: \"provider\",\n      },\n      {\n        Header: \"Score\",\n        accessor: \"score\",\n      },\n      {\n        Header: \"Date\",\n        accessor: \"timestamp\",\n      },\n      {\n        // Actions\n        accessor: \"blacklisted\",\n        Cell: ({ row }) => {\n          const original = row.original;\n          const { sonarrSeriesId, sonarrEpisodeId } = original;\n          return (\n            <BlacklistButton\n              history={original}\n              update={update}\n              promise={(form) =>\n                EpisodesApi.addBlacklist(sonarrSeriesId, sonarrEpisodeId, form)\n              }\n            ></BlacklistButton>\n          );\n        },\n      },\n    ],\n    [update]\n  );\n\n  return (\n    <BaseModal title={`History - ${episode?.title ?? \"\"}`} {...props}>\n      <AsyncStateOverlay state={history}>\n        {(data) => (\n          <PageTable\n            emptyText=\"No History Found\"\n            columns={columns}\n            data={data}\n          ></PageTable>\n        )}\n      </AsyncStateOverlay>\n    </BaseModal>\n  );\n};\n","import React, { FunctionComponent, useMemo, useState } from \"react\";\nimport { Container, Form } from \"react-bootstrap\";\nimport { AsyncButton, Selector } from \"../\";\nimport { useLanguageProfiles } from \"../../@redux/hooks\";\nimport { GetItemId } from \"../../utilites\";\nimport BaseModal, { BaseModalProps } from \"./BaseModal\";\nimport { useCloseModal, usePayload } from \"./provider\";\n\ninterface Props {\n  submit: (form: FormType.ModifyItem) => Promise<void>;\n  onSuccess?: (item: Item.Base) => void;\n}\n\nconst Editor: FunctionComponent<Props & BaseModalProps> = (props) => {\n  const { onSuccess, submit, ...modal } = props;\n\n  const [profiles] = useLanguageProfiles();\n\n  const item = usePayload<Item.Base>(modal.modalKey);\n\n  const closeModal = useCloseModal();\n\n  const profileOptions = useMemo<SelectorOption<number>[]>(\n    () =>\n      profiles.map((v) => {\n        return { label: v.name, value: v.profileId };\n      }),\n    [profiles]\n  );\n  const [id, setId] = useState<Nullable<number>>(null);\n\n  const [updating, setUpdating] = useState(false);\n\n  const footer = useMemo(\n    () => (\n      <AsyncButton\n        noReset\n        onChange={setUpdating}\n        promise={() => {\n          if (item) {\n            const itemId = GetItemId(item);\n            return submit({\n              id: [itemId],\n              profileid: [id],\n            });\n          } else {\n            return null;\n          }\n        }}\n        onSuccess={() => {\n          closeModal();\n          onSuccess && item && onSuccess(item);\n        }}\n      >\n        Save\n      </AsyncButton>\n    ),\n    [closeModal, id, item, onSuccess, submit]\n  );\n\n  return (\n    <BaseModal\n      closeable={!updating}\n      footer={footer}\n      title={item?.title}\n      {...modal}\n    >\n      <Container fluid>\n        <Form>\n          <Form.Group>\n            <Form.Label>Audio</Form.Label>\n            <Form.Control\n              type=\"text\"\n              disabled\n              defaultValue={item?.audio_language.map((v) => v.name).join(\", \")}\n            ></Form.Control>\n          </Form.Group>\n          <Form.Group>\n            <Form.Label>Languages Profiles</Form.Label>\n            <Selector\n              clearable\n              options={profileOptions}\n              defaultValue={item?.profileId}\n              onChange={(v) => setId(v === undefined ? null : v)}\n            ></Selector>\n          </Form.Group>\n        </Form>\n      </Container>\n    </BaseModal>\n  );\n};\n\nexport default Editor;\n","import React, { FunctionComponent, useEffect, useMemo, useState } from \"react\";\nimport { Container, Form } from \"react-bootstrap\";\nimport {\n  AsyncButton,\n  FileForm,\n  LanguageSelector,\n  useCloseModal,\n  usePayload,\n} from \"..\";\nimport {\n  useLanguageBy,\n  useLanguages,\n  useMovieBy,\n  useProfileBy,\n} from \"../../@redux/hooks\";\nimport { MoviesApi } from \"../../apis\";\nimport BaseModal, { BaseModalProps } from \"./BaseModal\";\ninterface MovieProps {}\n\nconst MovieUploadModal: FunctionComponent<MovieProps & BaseModalProps> = (\n  props\n) => {\n  const modal = props;\n\n  const [availableLanguages] = useLanguages(true);\n\n  const movie = usePayload<Item.Movie>(modal.modalKey);\n  const [, update] = useMovieBy(movie?.radarrId);\n\n  const closeModal = useCloseModal();\n\n  const [uploading, setUpload] = useState(false);\n\n  const [language, setLanguage] = useState<Nullable<Language>>(null);\n\n  const profile = useProfileBy(movie?.profileId);\n\n  const defaultLanguage = useLanguageBy(profile?.items[0]?.language);\n\n  useEffect(() => setLanguage(defaultLanguage ?? null), [defaultLanguage]);\n\n  const [file, setFile] = useState<Nullable<File>>(null);\n  const [forced, setForced] = useState(false);\n\n  const canUpload = useMemo(() => {\n    return file !== null && language?.code2;\n  }, [language, file]);\n\n  const footer = (\n    <AsyncButton\n      noReset\n      disabled={!canUpload}\n      onChange={setUpload}\n      promise={() => {\n        if (file && movie && language) {\n          return MoviesApi.uploadSubtitles(movie.radarrId, {\n            file: file,\n            forced,\n            hi: false,\n            language: language.code2,\n          });\n        } else {\n          return null;\n        }\n      }}\n      onSuccess={() => {\n        closeModal();\n        update();\n      }}\n    >\n      Upload\n    </AsyncButton>\n  );\n\n  return (\n    <BaseModal\n      title={`Upload - ${movie?.title}`}\n      closeable={!uploading}\n      footer={footer}\n      {...modal}\n    >\n      <Container fluid>\n        <Form>\n          <Form.Group>\n            <Form.Label>Language</Form.Label>\n            <LanguageSelector\n              options={availableLanguages}\n              value={language}\n              onChange={(lang) => {\n                if (lang) {\n                  setLanguage(lang);\n                }\n              }}\n            ></LanguageSelector>\n          </Form.Group>\n          <Form.Group>\n            <Form.Label>Subtitle File</Form.Label>\n            <FileForm\n              emptyText=\"Select...\"\n              onChange={(list) => {\n                setFile(list[0]);\n              }}\n            ></FileForm>\n          </Form.Group>\n          <Form.Group>\n            <Form.Check\n              custom\n              id=\"forced-checkbox\"\n              defaultChecked={forced}\n              onChange={(e) => setForced(e.target.checked)}\n              label=\"Forced\"\n            ></Form.Check>\n          </Form.Group>\n        </Form>\n      </Container>\n    </BaseModal>\n  );\n};\n\nexport default MovieUploadModal;\n","import { isNull } from \"lodash\";\nimport { useCallback, useEffect, useMemo } from \"react\";\nimport {\n  ActionType,\n  ensurePluginOrder,\n  Hooks,\n  ReducerTableState,\n  TableInstance,\n  TableOptions,\n  TableState,\n} from \"react-table\";\nimport { isNonNullable } from \"../../../utilites\";\nimport { PageControlAction } from \"../types\";\n\nconst pluginName = \"useAsyncPagination\";\n\nconst ActionLoadingChange = \"loading-change\";\n\nfunction useAsyncPagination<T extends object>(hooks: Hooks<T>) {\n  hooks.stateReducers.push(reducer);\n  hooks.useInstance.push(useInstance);\n  hooks.useOptions.push(useOptions);\n}\nuseAsyncPagination.pluginName = pluginName;\n\nfunction reducer<T extends object>(\n  state: TableState<T>,\n  action: ActionType,\n  previous: TableState<T> | undefined,\n  instance: TableInstance<T> | undefined\n): ReducerTableState<T> {\n  if (action.type === ActionLoadingChange && instance) {\n    let pageToLoad:\n      | PageControlAction\n      | undefined = action.pageToLoad as PageControlAction;\n    let needLoadingScreen = false;\n    const { asyncState } = instance;\n    const { pageIndex, pageSize } = state;\n    let index = pageIndex;\n    if (pageToLoad === \"prev\") {\n      index -= 1;\n    } else if (pageToLoad === \"next\") {\n      index += 1;\n    } else if (typeof pageToLoad === \"number\") {\n      index = pageToLoad;\n    }\n    const pageStart = index * pageSize;\n    const pageEnd = pageStart + pageSize;\n    if (asyncState) {\n      const error = asyncState.error;\n      const order = asyncState.data.order.slice(pageStart, pageEnd);\n\n      const isInitializedError = order.length === 0 && error !== undefined;\n      const isLoadingError = order.length !== 0 && order.every(isNull);\n\n      if (isInitializedError || isLoadingError) {\n        needLoadingScreen = true;\n      } else if (order.every(isNonNullable)) {\n        pageToLoad = undefined;\n      }\n    }\n    return { ...state, pageToLoad, needLoadingScreen };\n  }\n  return state;\n}\n\nfunction useOptions<T extends object>(options: TableOptions<T>) {\n  options.manualPagination = true;\n  if (options.initialState === undefined) {\n    options.initialState = {};\n  }\n  options.initialState.pageToLoad = 0;\n  options.initialState.needLoadingScreen = true;\n  return options;\n}\n\nfunction useInstance<T extends object>(instance: TableInstance<T>) {\n  const {\n    plugins,\n    asyncLoader,\n    dispatch,\n    asyncState,\n    asyncId,\n    rows,\n    nextPage,\n    previousPage,\n    gotoPage,\n    state: { pageIndex, pageSize, pageToLoad },\n  } = instance;\n\n  ensurePluginOrder(plugins, [\"usePagination\"], pluginName);\n\n  const totalCount = asyncState?.data.order.length ?? 0;\n  const pageCount = Math.ceil(totalCount / pageSize);\n  const pageStart = pageIndex * pageSize;\n  const pageEnd = pageStart + pageSize;\n\n  useEffect(() => {\n    // TODO Lazy Load\n    if (pageToLoad === undefined) {\n      return;\n    }\n    asyncLoader && asyncLoader(pageStart, pageSize);\n  }, [asyncLoader, pageStart, pageSize, pageToLoad]);\n\n  const setPageToLoad = useCallback(\n    (pageToLoad?: PageControlAction) => {\n      dispatch({ type: ActionLoadingChange, pageToLoad });\n    },\n    [dispatch]\n  );\n\n  useEffect(() => {\n    if (asyncState?.updating === false) {\n      setPageToLoad();\n    }\n  }, [asyncState?.updating, setPageToLoad]);\n\n  const newGoto = useCallback(\n    (updater: number | ((pageIndex: number) => number)) => {\n      let page: number;\n      if (typeof updater === \"number\") {\n        page = updater;\n      } else {\n        page = updater(pageIndex);\n      }\n      if (page === pageIndex) {\n        return;\n      }\n      setPageToLoad(page);\n      gotoPage(page);\n    },\n    [pageIndex, setPageToLoad, gotoPage]\n  );\n\n  const newPrevious = useCallback(() => {\n    if (pageIndex === 0) {\n      return;\n    }\n    setPageToLoad(\"prev\");\n    previousPage();\n  }, [setPageToLoad, previousPage, pageIndex]);\n\n  const newNext = useCallback(() => {\n    if (pageIndex === pageCount) {\n      return;\n    }\n    setPageToLoad(\"next\");\n    nextPage();\n  }, [setPageToLoad, nextPage, pageCount, pageIndex]);\n\n  const newPages = useMemo(() => {\n    // TODO: Performance\n\n    const order = (asyncState?.data.order\n      .slice(pageStart, pageEnd)\n      .filter(isNonNullable) ?? []) as number[];\n\n    return order.flatMap((num) => {\n      const row = rows.find((v) => asyncId && asyncId(v.original) === num);\n      if (row) {\n        return [row];\n      } else {\n        return [];\n      }\n    });\n  }, [pageStart, pageEnd, asyncId, asyncState?.data.order, rows]);\n\n  Object.assign<TableInstance<T>, Partial<TableInstance<T>>>(instance, {\n    previousPage: newPrevious,\n    nextPage: newNext,\n    gotoPage: newGoto,\n    page: newPages,\n    pageCount,\n  });\n}\n\nexport default useAsyncPagination;\n","import React, { forwardRef, useEffect, useRef } from \"react\";\nimport { Form } from \"react-bootstrap\";\nimport {\n  CellProps,\n  Column,\n  ColumnInstance,\n  ensurePluginOrder,\n  HeaderProps,\n  Hooks,\n  MetaBase,\n  TableInstance,\n  TableToggleCommonProps,\n} from \"react-table\";\n\nconst pluginName = \"useCustomSelection\";\n\nconst checkboxId = \"---selection---\";\n\ninterface CheckboxProps {\n  idIn: string;\n}\n\nconst Checkbox = forwardRef<\n  HTMLInputElement,\n  TableToggleCommonProps & CheckboxProps\n>(({ indeterminate, idIn, ...rest }, ref) => {\n  const defaultRef = useRef<HTMLInputElement>(null);\n  const resolvedRef = ref || defaultRef;\n\n  useEffect(() => {\n    if (typeof resolvedRef === \"object\" && resolvedRef.current) {\n      resolvedRef.current.indeterminate = indeterminate ?? false;\n    }\n  }, [resolvedRef, indeterminate]);\n\n  return <Form.Check custom id={idIn} ref={resolvedRef} {...rest}></Form.Check>;\n});\n\nfunction useCustomSelection<T extends object>(hooks: Hooks<T>) {\n  hooks.visibleColumnsDeps.push((deps, { instance }) => [\n    ...deps,\n    instance.isSelecting,\n  ]);\n  hooks.visibleColumns.push(visibleColumns);\n  hooks.useInstance.push(useInstance);\n}\n\nuseCustomSelection.pluginName = pluginName;\n\nfunction useInstance<T extends object>(instance: TableInstance<T>) {\n  const {\n    plugins,\n    rows,\n    onSelect,\n    isSelecting,\n    state: { selectedRowIds },\n  } = instance;\n\n  ensurePluginOrder(plugins, [\"useRowSelect\"], pluginName);\n\n  useEffect(() => {\n    // Performance\n    if (isSelecting) {\n      const items = Object.keys(selectedRowIds).flatMap(\n        (v) => rows.find((n) => n.id === v)?.original ?? []\n      );\n      onSelect && onSelect(items);\n    }\n  }, [selectedRowIds, onSelect, rows, isSelecting]);\n}\n\nfunction visibleColumns<T extends object>(\n  columns: ColumnInstance<T>[],\n  meta: MetaBase<T>\n): Column<T>[] {\n  const { instance } = meta;\n  if (instance.isSelecting) {\n    const checkbox: Column<T> = {\n      id: checkboxId,\n      Header: ({ getToggleAllRowsSelectedProps }: HeaderProps<any>) => (\n        <Checkbox\n          idIn=\"table-header-selection\"\n          {...getToggleAllRowsSelectedProps()}\n        ></Checkbox>\n      ),\n      Cell: ({ row }: CellProps<any>) => (\n        <Checkbox\n          idIn={`table-cell-${row.index}`}\n          {...row.getToggleRowSelectedProps()}\n        ></Checkbox>\n      ),\n    };\n    return [checkbox, ...columns.filter((v) => v.selectHide !== true)];\n  } else {\n    return columns;\n  }\n}\n\nexport default useCustomSelection;\n","import { Hooks, TableOptions } from \"react-table\";\nimport { useReduxStore } from \"../../../@redux/hooks/base\";\n\nconst pluginName = \"useLocalSettings\";\n\nfunction useDefaultSettings<T extends object>(hooks: Hooks<T>) {\n  hooks.useOptions.push(useOptions);\n}\nuseDefaultSettings.pluginName = pluginName;\n\nfunction useOptions<T extends object>(options: TableOptions<T>) {\n  const { pageSize } = useReduxStore((s) => s.site);\n\n  if (options.autoResetPage === undefined) {\n    options.autoResetPage = false;\n  }\n\n  if (options.initialState === undefined) {\n    options.initialState = {};\n  }\n\n  options.initialState.needLoadingScreen = false;\n\n  if (options.initialState.pageSize === undefined) {\n    options.initialState.pageSize = pageSize;\n  }\n\n  if (options.asyncLoader === undefined) {\n    options.initialState.pageToLoad = undefined;\n  }\n\n  return options;\n}\n\nexport default useDefaultSettings;\n","import { faQuestionCircle } from \"@fortawesome/free-regular-svg-icons\";\nimport {\n  faCheck,\n  faCircleNotch,\n  faClock,\n  faCode,\n  faDeaf,\n  faExchangeAlt,\n  faFilm,\n  faImage,\n  faLanguage,\n  faMagic,\n  faMinus,\n  faPaintBrush,\n  faPlay,\n  faPlus,\n  faTextHeight,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useMemo,\n  useState,\n} from \"react\";\nimport {\n  Badge,\n  Button,\n  ButtonGroup,\n  Dropdown,\n  Form,\n  InputGroup,\n} from \"react-bootstrap\";\nimport { Column, useRowSelect } from \"react-table\";\nimport {\n  ActionButton,\n  ActionButtonItem,\n  LanguageSelector,\n  LanguageText,\n  Selector,\n  SimpleTable,\n  usePayload,\n  useShowModal,\n} from \"..\";\nimport { useLanguages } from \"../../@redux/hooks\";\nimport { SubtitlesApi } from \"../../apis\";\nimport { isMovie, submodProcessColor } from \"../../utilites\";\nimport { log } from \"../../utilites/logger\";\nimport { useCustomSelection } from \"../tables/plugins\";\nimport BaseModal, { BaseModalProps } from \"./BaseModal\";\nimport { useCloseModalUntil } from \"./provider\";\nimport { availableTranslation, colorOptions } from \"./toolOptions\";\n\ntype SupportType = Item.Episode | Item.Movie;\n\ntype TableColumnType = FormType.ModifySubtitle & {\n  _language: Language;\n};\n\nenum State {\n  Pending,\n  Processing,\n  Done,\n}\n\ntype ProcessState = StrictObject<State>;\n\n// TODO: Extract this\ninterface StateIconProps {\n  state: State;\n}\n\nconst StateIcon: FunctionComponent<StateIconProps> = ({ state }) => {\n  let icon = faQuestionCircle;\n  switch (state) {\n    case State.Pending:\n      icon = faClock;\n      break;\n    case State.Processing:\n      icon = faCircleNotch;\n      break;\n    case State.Done:\n      icon = faCheck;\n      break;\n  }\n  return (\n    <FontAwesomeIcon\n      icon={icon}\n      spin={state === State.Processing}\n    ></FontAwesomeIcon>\n  );\n};\n\nfunction getIdAndType(item: SupportType): [number, \"episode\" | \"movie\"] {\n  if (isMovie(item)) {\n    return [item.radarrId, \"movie\"];\n  } else {\n    return [item.sonarrEpisodeId, \"episode\"];\n  }\n}\n\nfunction submodProcessFrameRate(from: number, to: number) {\n  return `change_FPS(from=${from},to=${to})`;\n}\n\nfunction submodProcessOffset(h: number, m: number, s: number, ms: number) {\n  return `shift_offset(h=${h},m=${m},s=${s},ms=${ms})`;\n}\n\ninterface ToolModalProps {\n  process: (\n    action: string,\n    override?: Partial<FormType.ModifySubtitle>\n  ) => void;\n}\n\nconst AddColorModal: FunctionComponent<BaseModalProps & ToolModalProps> = (\n  props\n) => {\n  const { process, ...modal } = props;\n  const [selection, setSelection] = useState<Nullable<string>>(null);\n\n  const submit = useCallback(() => {\n    if (selection) {\n      const action = submodProcessColor(selection);\n      process(action);\n    }\n  }, [selection, process]);\n\n  const footer = useMemo(\n    () => (\n      <Button disabled={selection === null} onClick={submit}>\n        Save\n      </Button>\n    ),\n    [selection, submit]\n  );\n  return (\n    <BaseModal title=\"Choose Color\" footer={footer} {...modal}>\n      <Selector options={colorOptions} onChange={setSelection}></Selector>\n    </BaseModal>\n  );\n};\n\nconst FrameRateModal: FunctionComponent<BaseModalProps & ToolModalProps> = (\n  props\n) => {\n  const { process, ...modal } = props;\n\n  const [from, setFrom] = useState<Nullable<number>>(null);\n  const [to, setTo] = useState<Nullable<number>>(null);\n\n  const canSave = from !== null && to !== null && from !== to;\n\n  const submit = useCallback(() => {\n    if (canSave) {\n      const action = submodProcessFrameRate(from!, to!);\n      process(action);\n    }\n  }, [canSave, from, to, process]);\n\n  const footer = useMemo(\n    () => (\n      <Button disabled={!canSave} onClick={submit}>\n        Save\n      </Button>\n    ),\n    [submit, canSave]\n  );\n\n  return (\n    <BaseModal title=\"Change Frame Rate\" footer={footer} {...modal}>\n      <InputGroup className=\"px-2\">\n        <Form.Control\n          placeholder=\"From\"\n          type=\"number\"\n          onChange={(e) => {\n            const value = parseFloat(e.currentTarget.value);\n            if (isNaN(value)) {\n              setFrom(null);\n            } else {\n              setFrom(value);\n            }\n          }}\n        ></Form.Control>\n        <Form.Control\n          placeholder=\"To\"\n          type=\"number\"\n          onChange={(e) => {\n            const value = parseFloat(e.currentTarget.value);\n            if (isNaN(value)) {\n              setTo(null);\n            } else {\n              setTo(value);\n            }\n          }}\n        ></Form.Control>\n      </InputGroup>\n    </BaseModal>\n  );\n};\n\nconst AdjustTimesModal: FunctionComponent<BaseModalProps & ToolModalProps> = (\n  props\n) => {\n  const { process, ...modal } = props;\n\n  const [isPlus, setPlus] = useState(true);\n  const [offset, setOffset] = useState<[number, number, number, number]>([\n    0,\n    0,\n    0,\n    0,\n  ]);\n\n  const updateOffset = useCallback(\n    (idx: number) => {\n      return (e: any) => {\n        let value = parseFloat(e.currentTarget.value);\n        if (isNaN(value)) {\n          value = 0;\n        }\n        const newOffset = [...offset] as [number, number, number, number];\n        newOffset[idx] = value;\n        setOffset(newOffset);\n      };\n    },\n    [offset]\n  );\n\n  const canSave = offset.some((v) => v !== 0);\n\n  const submit = useCallback(() => {\n    if (canSave) {\n      const newOffset = offset.map((v) => (isPlus ? v : -v));\n      const action = submodProcessOffset(\n        newOffset[0],\n        newOffset[1],\n        newOffset[2],\n        newOffset[3]\n      );\n      process(action);\n    }\n  }, [process, canSave, offset, isPlus]);\n\n  const footer = useMemo(\n    () => (\n      <Button disabled={!canSave} onClick={submit}>\n        Save\n      </Button>\n    ),\n    [submit, canSave]\n  );\n\n  return (\n    <BaseModal title=\"Adjust Times\" footer={footer} {...modal}>\n      <InputGroup>\n        <InputGroup.Prepend>\n          <Button\n            variant=\"secondary\"\n            title={isPlus ? \"Later\" : \"Earlier\"}\n            onClick={() => setPlus(!isPlus)}\n          >\n            <FontAwesomeIcon icon={isPlus ? faPlus : faMinus}></FontAwesomeIcon>\n          </Button>\n        </InputGroup.Prepend>\n        <Form.Control\n          type=\"number\"\n          placeholder=\"hour\"\n          onChange={updateOffset(0)}\n        ></Form.Control>\n        <Form.Control\n          type=\"number\"\n          placeholder=\"min\"\n          onChange={updateOffset(1)}\n        ></Form.Control>\n        <Form.Control\n          type=\"number\"\n          placeholder=\"sec\"\n          onChange={updateOffset(2)}\n        ></Form.Control>\n        <Form.Control\n          type=\"number\"\n          placeholder=\"ms\"\n          onChange={updateOffset(3)}\n        ></Form.Control>\n      </InputGroup>\n    </BaseModal>\n  );\n};\n\nconst TranslateModal: FunctionComponent<BaseModalProps & ToolModalProps> = ({\n  process,\n  ...modal\n}) => {\n  const [languages] = useLanguages(true);\n\n  const available = useMemo(\n    () => languages.filter((v) => v.code2 in availableTranslation),\n    [languages]\n  );\n\n  const [selectedLanguage, setLanguage] = useState<Nullable<Language>>(null);\n\n  const submit = useCallback(() => {\n    if (selectedLanguage) {\n      process(\"translate\", { language: selectedLanguage.code2 });\n    }\n  }, [selectedLanguage, process]);\n\n  const footer = useMemo(\n    () => (\n      <Button disabled={!selectedLanguage} onClick={submit}>\n        Translate\n      </Button>\n    ),\n    [submit, selectedLanguage]\n  );\n\n  return (\n    <BaseModal title=\"Translate to\" footer={footer} {...modal}>\n      <Form.Label>\n        Enabled languages not listed here are unsupported by Google Translate.\n      </Form.Label>\n      <LanguageSelector\n        options={available}\n        onChange={setLanguage}\n      ></LanguageSelector>\n    </BaseModal>\n  );\n};\n\ninterface STMProps {\n  update: () => void;\n}\n\nconst STM: FunctionComponent<BaseModalProps & STMProps> = ({\n  update,\n  ...props\n}) => {\n  const items = usePayload<SupportType[]>(props.modalKey);\n\n  const [updating, setUpdate] = useState<boolean>(false);\n  const [processState, setProcessState] = useState<ProcessState>({});\n  const [selections, setSelections] = useState<TableColumnType[]>([]);\n\n  const closeUntil = useCloseModalUntil(props.modalKey);\n\n  const process = useCallback(\n    async (action: string, override?: Partial<FormType.ModifySubtitle>) => {\n      log(\"info\", \"executing action\", action);\n      closeUntil();\n      setUpdate(true);\n\n      let states = selections.reduce<ProcessState>(\n        (v, curr) => ({ [curr.path]: State.Pending, ...v }),\n        {}\n      );\n      setProcessState(states);\n\n      for (const raw of selections) {\n        states = {\n          ...states,\n          [raw.path]: State.Processing,\n        };\n        setProcessState(states);\n        const form: FormType.ModifySubtitle = {\n          id: raw.id,\n          type: raw.type,\n          language: raw.language,\n          path: raw.path,\n          ...override,\n        };\n        await SubtitlesApi.modify(action, form);\n\n        states = {\n          ...states,\n          [raw.path]: State.Done,\n        };\n        setProcessState(states);\n      }\n      setUpdate(false);\n\n      update();\n    },\n    [closeUntil, selections, update]\n  );\n\n  const showModal = useShowModal();\n\n  const columns: Column<TableColumnType>[] = useMemo<Column<TableColumnType>[]>(\n    () => [\n      {\n        id: \"state\",\n        accessor: \"path\",\n        selectHide: true,\n        Cell: ({ value, loose }) => {\n          if (loose) {\n            const stateList = loose[0] as ProcessState;\n            if (value in stateList) {\n              const state = stateList[value];\n              return <StateIcon state={state}></StateIcon>;\n            }\n          }\n          return null;\n        },\n      },\n      {\n        Header: \"Language\",\n        accessor: \"_language\",\n        Cell: ({ value }) => (\n          <Badge variant=\"secondary\">\n            <LanguageText text={value} long></LanguageText>\n          </Badge>\n        ),\n      },\n      {\n        id: \"file\",\n        Header: \"File\",\n        accessor: \"path\",\n        Cell: (row) => {\n          const path = row.value!;\n\n          let idx = path.lastIndexOf(\"/\");\n\n          if (idx === -1) {\n            idx = path.lastIndexOf(\"\\\\\");\n          }\n\n          if (idx !== -1) {\n            return path.slice(idx + 1);\n          } else {\n            return path;\n          }\n        },\n      },\n    ],\n    []\n  );\n\n  const data = useMemo<TableColumnType[]>(\n    () =>\n      items?.flatMap((item) => {\n        const [id, type] = getIdAndType(item);\n        return item.subtitles.flatMap((v) => {\n          if (v.path !== null) {\n            return [\n              {\n                id,\n                type,\n                language: v.code2,\n                path: v.path,\n                _language: v,\n              },\n            ];\n          } else {\n            return [];\n          }\n        });\n      }) ?? [],\n    [items]\n  );\n\n  const plugins = [useRowSelect, useCustomSelection];\n\n  const footer = useMemo(\n    () => (\n      <Dropdown as={ButtonGroup} onSelect={(k) => k && process(k)}>\n        <ActionButton\n          size=\"sm\"\n          loading={updating}\n          disabled={selections.length === 0}\n          icon={faPlay}\n          onClick={() => process(\"sync\")}\n        >\n          Sync\n        </ActionButton>\n        <Dropdown.Toggle\n          disabled={updating || selections.length === 0}\n          split\n          variant=\"light\"\n          size=\"sm\"\n          className=\"px-2\"\n        ></Dropdown.Toggle>\n        <Dropdown.Menu>\n          <Dropdown.Item eventKey=\"remove_HI\">\n            <ActionButtonItem icon={faDeaf}>Remove HI Tags</ActionButtonItem>\n          </Dropdown.Item>\n          <Dropdown.Item eventKey=\"remove_tags\">\n            <ActionButtonItem icon={faCode}>Remove Style Tags</ActionButtonItem>\n          </Dropdown.Item>\n          <Dropdown.Item eventKey=\"OCR_fixes\">\n            <ActionButtonItem icon={faImage}>OCR Fixes</ActionButtonItem>\n          </Dropdown.Item>\n          <Dropdown.Item eventKey=\"common\">\n            <ActionButtonItem icon={faMagic}>Common Fixes</ActionButtonItem>\n          </Dropdown.Item>\n          <Dropdown.Item eventKey=\"fix_uppercase\">\n            <ActionButtonItem icon={faTextHeight}>\n              Fix Uppercase\n            </ActionButtonItem>\n          </Dropdown.Item>\n          <Dropdown.Item eventKey=\"reverse_rtl\">\n            <ActionButtonItem icon={faExchangeAlt}>\n              Reverse RTL\n            </ActionButtonItem>\n          </Dropdown.Item>\n          <Dropdown.Item onSelect={() => showModal(\"add-color\")}>\n            <ActionButtonItem icon={faPaintBrush}>Add Color</ActionButtonItem>\n          </Dropdown.Item>\n          <Dropdown.Item onSelect={() => showModal(\"change-frame-rate\")}>\n            <ActionButtonItem icon={faFilm}>Change Frame Rate</ActionButtonItem>\n          </Dropdown.Item>\n          <Dropdown.Item onSelect={() => showModal(\"adjust-times\")}>\n            <ActionButtonItem icon={faClock}>Adjust Times</ActionButtonItem>\n          </Dropdown.Item>\n          <Dropdown.Item onSelect={() => showModal(\"translate-sub\")}>\n            <ActionButtonItem icon={faLanguage}>Translate</ActionButtonItem>\n          </Dropdown.Item>\n        </Dropdown.Menu>\n      </Dropdown>\n    ),\n    [showModal, updating, selections.length, process]\n  );\n\n  return (\n    <React.Fragment>\n      <BaseModal\n        title={\"Subtitle Tools\"}\n        footer={footer}\n        closeable={!updating}\n        {...props}\n      >\n        <SimpleTable\n          isSelecting={!updating && data.length !== 0}\n          emptyText=\"No External Subtitles Found\"\n          plugins={plugins}\n          columns={columns}\n          onSelect={setSelections}\n          data={data}\n          loose={[processState]}\n        ></SimpleTable>\n      </BaseModal>\n      <AddColorModal process={process} modalKey=\"add-color\"></AddColorModal>\n      <FrameRateModal\n        process={process}\n        modalKey=\"change-frame-rate\"\n      ></FrameRateModal>\n      <AdjustTimesModal\n        process={process}\n        modalKey=\"adjust-times\"\n      ></AdjustTimesModal>\n      <TranslateModal\n        process={process}\n        modalKey=\"translate-sub\"\n      ></TranslateModal>\n    </React.Fragment>\n  );\n};\n\nexport default STM;\n","export const availableTranslation = {\n  af: \"afrikaans\",\n  sq: \"albanian\",\n  am: \"amharic\",\n  ar: \"arabic\",\n  hy: \"armenian\",\n  az: \"azerbaijani\",\n  eu: \"basque\",\n  be: \"belarusian\",\n  bn: \"bengali\",\n  bs: \"bosnian\",\n  bg: \"bulgarian\",\n  ca: \"catalan\",\n  ceb: \"cebuano\",\n  ny: \"chichewa\",\n  \"zh-cn\": \"chinese (simplified)\",\n  \"zh-tw\": \"chinese (traditional)\",\n  co: \"corsican\",\n  hr: \"croatian\",\n  cs: \"czech\",\n  da: \"danish\",\n  nl: \"dutch\",\n  en: \"english\",\n  eo: \"esperanto\",\n  et: \"estonian\",\n  tl: \"filipino\",\n  fi: \"finnish\",\n  fr: \"french\",\n  fy: \"frisian\",\n  gl: \"galician\",\n  ka: \"georgian\",\n  de: \"german\",\n  el: \"greek\",\n  gu: \"gujarati\",\n  ht: \"haitian creole\",\n  ha: \"hausa\",\n  haw: \"hawaiian\",\n  iw: \"hebrew\",\n  hi: \"hindi\",\n  hmn: \"hmong\",\n  hu: \"hungarian\",\n  is: \"icelandic\",\n  ig: \"igbo\",\n  id: \"indonesian\",\n  ga: \"irish\",\n  it: \"italian\",\n  ja: \"japanese\",\n  jw: \"javanese\",\n  kn: \"kannada\",\n  kk: \"kazakh\",\n  km: \"khmer\",\n  ko: \"korean\",\n  ku: \"kurdish (kurmanji)\",\n  ky: \"kyrgyz\",\n  lo: \"lao\",\n  la: \"latin\",\n  lv: \"latvian\",\n  lt: \"lithuanian\",\n  lb: \"luxembourgish\",\n  mk: \"macedonian\",\n  mg: \"malagasy\",\n  ms: \"malay\",\n  ml: \"malayalam\",\n  mt: \"maltese\",\n  mi: \"maori\",\n  mr: \"marathi\",\n  mn: \"mongolian\",\n  my: \"myanmar (burmese)\",\n  ne: \"nepali\",\n  no: \"norwegian\",\n  ps: \"pashto\",\n  fa: \"persian\",\n  pl: \"polish\",\n  pt: \"portuguese\",\n  pa: \"punjabi\",\n  ro: \"romanian\",\n  ru: \"russian\",\n  sm: \"samoan\",\n  gd: \"scots gaelic\",\n  sr: \"serbian\",\n  st: \"sesotho\",\n  sn: \"shona\",\n  sd: \"sindhi\",\n  si: \"sinhala\",\n  sk: \"slovak\",\n  sl: \"slovenian\",\n  so: \"somali\",\n  es: \"spanish\",\n  su: \"sundanese\",\n  sw: \"swahili\",\n  sv: \"swedish\",\n  tg: \"tajik\",\n  ta: \"tamil\",\n  te: \"telugu\",\n  th: \"thai\",\n  tr: \"turkish\",\n  uk: \"ukrainian\",\n  ur: \"urdu\",\n  uz: \"uzbek\",\n  vi: \"vietnamese\",\n  cy: \"welsh\",\n  xh: \"xhosa\",\n  yi: \"yiddish\",\n  yo: \"yoruba\",\n  zu: \"zulu\",\n  fil: \"Filipino\",\n  he: \"Hebrew\",\n};\n\nexport const colorOptions: SelectorOption<string>[] = [\n  {\n    label: \"White\",\n    value: \"white\",\n  },\n  {\n    label: \"Light Gray\",\n    value: \"lightgray\",\n  },\n  {\n    label: \"Red\",\n    value: \"red\",\n  },\n  {\n    label: \"Green\",\n    value: \"green\",\n  },\n  {\n    label: \"Yellow\",\n    value: \"yellow\",\n  },\n  {\n    label: \"Blue\",\n    value: \"blue\",\n  },\n  {\n    label: \"Magenta\",\n    value: \"magenta\",\n  },\n  {\n    label: \"Cyan\",\n    value: \"cyan\",\n  },\n  {\n    label: \"Black\",\n    value: \"black\",\n  },\n  {\n    label: \"Dark Red\",\n    value: \"darkred\",\n  },\n  {\n    label: \"Dark Green\",\n    value: \"darkgreen\",\n  },\n  {\n    label: \"Dark Yellow\",\n    value: \"darkyellow\",\n  },\n  {\n    label: \"Dark Blue\",\n    value: \"darkblue\",\n  },\n  {\n    label: \"Dark Magenta\",\n    value: \"darkmagenta\",\n  },\n  {\n    label: \"Dark Cyan\",\n    value: \"darkcyan\",\n  },\n  {\n    label: \"Dark Grey\",\n    value: \"darkgrey\",\n  },\n];\n","import { throttle } from \"lodash\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useEffect,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Dropdown, Form } from \"react-bootstrap\";\nimport { useHistory } from \"react-router\";\n\nexport interface SearchResult {\n  name: string;\n  link?: string;\n}\n\ninterface Props {\n  className?: string;\n  onSearch: (text: string) => Promise<SearchResult[]>;\n  onFocus?: () => void;\n  onBlur?: () => void;\n}\n\nexport const SearchBar: FunctionComponent<Props> = ({\n  onSearch,\n  onFocus,\n  onBlur,\n  className,\n}) => {\n  const [text, setText] = useState(\"\");\n\n  const [results, setResults] = useState<SearchResult[]>([]);\n\n  const history = useHistory();\n\n  const search = useCallback(\n    (value: string) => {\n      if (value === \"\") {\n        setResults([]);\n      } else {\n        onSearch(value).then((res) => setResults(res));\n      }\n    },\n    [onSearch]\n  );\n\n  const debounceSearch = useMemo(() => throttle(search, 500), [search]);\n\n  useEffect(() => {\n    debounceSearch(text);\n  }, [text, debounceSearch]);\n\n  const clear = useCallback(() => {\n    setText(\"\");\n    setResults([]);\n  }, []);\n\n  const items = useMemo(() => {\n    const its = results.map((v) => (\n      <Dropdown.Item\n        key={v.name}\n        eventKey={v.link}\n        disabled={v.link === undefined}\n      >\n        <span>{v.name}</span>\n      </Dropdown.Item>\n    ));\n\n    if (its.length === 0) {\n      its.push(<Dropdown.Header key=\"notify\">No Found</Dropdown.Header>);\n    }\n\n    return its;\n  }, [results]);\n\n  return (\n    <Dropdown\n      show={text.length !== 0}\n      className={className}\n      onFocus={onFocus}\n      onBlur={onBlur}\n      onSelect={(link) => {\n        if (link) {\n          clear();\n          history.push(link);\n        }\n      }}\n    >\n      <Form.Control\n        type=\"text\"\n        size=\"sm\"\n        placeholder=\"Search...\"\n        value={text}\n        onChange={(e) => setText(e.currentTarget.value)}\n      ></Form.Control>\n      <Dropdown.Menu style={{ maxHeight: 256, overflowY: \"auto\" }}>\n        {items}\n      </Dropdown.Menu>\n    </Dropdown>\n  );\n};\n","import React, { useMemo } from \"react\";\nimport { Table } from \"react-bootstrap\";\nimport {\n  HeaderGroup,\n  Row,\n  TableBodyProps,\n  TableOptions,\n  TableProps,\n} from \"react-table\";\n\nexport interface BaseTableProps<T extends object> extends TableStyleProps<T> {\n  // Table Options\n  headers: HeaderGroup<T>[];\n  rows: Row<T>[];\n  headersRenderer?: (headers: HeaderGroup<T>[]) => JSX.Element[];\n  rowRenderer?: (row: Row<T>) => Nullable<JSX.Element>;\n  prepareRow: (row: Row<T>) => void;\n  tableProps: TableProps;\n  tableBodyProps: TableBodyProps;\n}\n\nexport interface TableStyleProps<T extends object> {\n  emptyText?: string;\n  responsive?: boolean;\n  hoverable?: boolean;\n  striped?: boolean;\n  borderless?: boolean;\n  small?: boolean;\n  hideHeader?: boolean;\n  headersRenderer?: (headers: HeaderGroup<T>[]) => JSX.Element[];\n  rowRenderer?: (row: Row<T>) => Nullable<JSX.Element>;\n}\n\ninterface ExtractResult<T extends object> {\n  style: TableStyleProps<T>;\n  options: TableOptions<T>;\n}\n\nexport function useStyleAndOptions<T extends object>(\n  props: TableStyleProps<T> & TableOptions<T>\n): ExtractResult<T> {\n  const {\n    emptyText,\n    responsive,\n    hoverable,\n    striped,\n    borderless,\n    small,\n    hideHeader,\n    headersRenderer,\n    rowRenderer,\n    ...options\n  } = props;\n  return {\n    style: {\n      emptyText,\n      responsive,\n      hoverable,\n      striped,\n      borderless,\n      small,\n      hideHeader,\n      headersRenderer,\n      rowRenderer,\n    },\n    options,\n  };\n}\n\nfunction DefaultHeaderRenderer<T extends object>(\n  headers: HeaderGroup<T>[]\n): JSX.Element[] {\n  return headers.map((col) => (\n    <th {...col.getHeaderProps()}>{col.render(\"Header\")}</th>\n  ));\n}\n\nfunction DefaultRowRenderer<T extends object>(row: Row<T>): JSX.Element | null {\n  return (\n    <tr {...row.getRowProps()}>\n      {row.cells.map((cell) => (\n        <td className={cell.column.className} {...cell.getCellProps()}>\n          {cell.render(\"Cell\")}\n        </td>\n      ))}\n    </tr>\n  );\n}\n\nexport default function BaseTable<T extends object>(props: BaseTableProps<T>) {\n  const {\n    emptyText,\n    responsive,\n    hoverable,\n    striped,\n    borderless,\n    small,\n    hideHeader,\n\n    headers,\n    rows,\n    headersRenderer,\n    rowRenderer,\n    prepareRow,\n    tableProps,\n    tableBodyProps,\n  } = props;\n\n  const colCount = useMemo(() => {\n    return headers.reduce(\n      (prev, curr) => (curr.headers.length > prev ? curr.headers.length : prev),\n      0\n    );\n  }, [headers]);\n\n  const empty = rows.length === 0;\n\n  const hRenderer = headersRenderer ?? DefaultHeaderRenderer;\n  const rRenderer = rowRenderer ?? DefaultRowRenderer;\n\n  return (\n    <Table\n      size={small ? \"sm\" : undefined}\n      striped={striped ?? true}\n      borderless={borderless ?? true}\n      hover={hoverable}\n      responsive={responsive ?? true}\n      {...tableProps}\n    >\n      <thead hidden={hideHeader}>\n        {headers.map((headerGroup) => (\n          <tr {...headerGroup.getHeaderGroupProps()}>\n            {hRenderer(headerGroup.headers)}\n          </tr>\n        ))}\n      </thead>\n      <tbody {...tableBodyProps}>\n        {emptyText && empty ? (\n          <tr>\n            <td colSpan={colCount} className=\"text-center\">\n              {emptyText}\n            </td>\n          </tr>\n        ) : (\n          rows.map((row) => {\n            prepareRow(row);\n            return rRenderer(row);\n          })\n        )}\n      </tbody>\n    </Table>\n  );\n}\n","import { PluginHook, TableOptions, useTable } from \"react-table\";\nimport BaseTable, { TableStyleProps, useStyleAndOptions } from \"./BaseTable\";\nimport { useDefaultSettings } from \"./plugins\";\n\ntype Props<T extends object> = TableOptions<T> &\n  TableStyleProps<T> & {\n    plugins?: PluginHook<T>[];\n  };\n\nexport default function SimpleTable<T extends object>(props: Props<T>) {\n  const { plugins, ...other } = props;\n  const { style, options } = useStyleAndOptions(other);\n\n  const instance = useTable(options, useDefaultSettings, ...(plugins ?? []));\n\n  const {\n    getTableProps,\n    getTableBodyProps,\n    headerGroups,\n    rows,\n    prepareRow,\n  } = instance;\n\n  return (\n    <BaseTable\n      {...style}\n      headers={headerGroups}\n      rows={rows}\n      prepareRow={prepareRow}\n      tableProps={getTableProps()}\n      tableBodyProps={getTableBodyProps()}\n    ></BaseTable>\n  );\n}\n","import { faChevronCircleRight } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React from \"react\";\nimport {\n  Cell,\n  HeaderGroup,\n  Row,\n  TableOptions,\n  useExpanded,\n  useGroupBy,\n  useSortBy,\n} from \"react-table\";\nimport { TableStyleProps } from \"./BaseTable\";\nimport SimpleTable from \"./SimpleTable\";\n\nfunction renderCell<T extends object = {}>(cell: Cell<T, any>, row: Row<T>) {\n  if (cell.isGrouped) {\n    return (\n      <span {...row.getToggleRowExpandedProps()}>{cell.render(\"Cell\")}</span>\n    );\n  } else if (row.canExpand || cell.isAggregated) {\n    return null;\n  } else {\n    return cell.render(\"Cell\");\n  }\n}\n\nfunction renderRow<T extends object>(row: Row<T>) {\n  if (row.canExpand) {\n    const cell = row.cells.find((cell) => cell.isGrouped);\n    if (cell) {\n      const rotation = row.isExpanded ? 90 : undefined;\n      return (\n        <tr {...row.getRowProps()}>\n          <td\n            className=\"p-0\"\n            {...cell.getCellProps()}\n            colSpan={row.cells.length}\n          >\n            <span\n              {...row.getToggleRowExpandedProps()}\n              className=\"d-flex align-items-center p-2\"\n            >\n              {cell.render(\"Cell\")}\n              <FontAwesomeIcon\n                className=\"mx-2\"\n                icon={faChevronCircleRight}\n                rotation={rotation}\n              ></FontAwesomeIcon>\n            </span>\n          </td>\n        </tr>\n      );\n    } else {\n      return null;\n    }\n  } else {\n    return (\n      <tr {...row.getRowProps()}>\n        {row.cells\n          .filter((cell) => !cell.isPlaceholder)\n          .map((cell) => (\n            <td className={cell.column.className} {...cell.getCellProps()}>\n              {renderCell(cell, row)}\n            </td>\n          ))}\n      </tr>\n    );\n  }\n}\n\nfunction renderHeaders<T extends object>(\n  headers: HeaderGroup<T>[]\n): JSX.Element[] {\n  return headers\n    .filter((col) => !col.isGrouped)\n    .map((col) => <th {...col.getHeaderProps()}>{col.render(\"Header\")}</th>);\n}\n\ntype Props<T extends object> = TableOptions<T> & TableStyleProps<T>;\n\nfunction GroupTable<T extends object = {}>(props: Props<T>) {\n  const plugins = [useGroupBy, useSortBy, useExpanded];\n  return (\n    <SimpleTable\n      {...props}\n      plugins={plugins}\n      headersRenderer={renderHeaders}\n      rowRenderer={renderRow}\n    ></SimpleTable>\n  );\n}\n\nexport default GroupTable;\n","import {\n  faClock,\n  faCloudUploadAlt,\n  faDownload,\n  faRecycle,\n  faTrash,\n  faUser,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport {\n  FontAwesomeIcon,\n  FontAwesomeIconProps,\n} from \"@fortawesome/react-fontawesome\";\nimport moment from \"moment\";\nimport React, { FunctionComponent, useMemo } from \"react\";\nimport {\n  OverlayTrigger,\n  Popover,\n  Spinner,\n  SpinnerProps,\n} from \"react-bootstrap\";\n\nenum HistoryAction {\n  Delete = 0,\n  Download,\n  Manual,\n  Upgrade,\n  Upload,\n  Sync,\n}\n\nexport const HistoryIcon: FunctionComponent<{\n  action: number;\n  title?: string;\n}> = (props) => {\n  const { action, title } = props;\n  let icon = null;\n  switch (action) {\n    case HistoryAction.Delete:\n      icon = faTrash;\n      break;\n    case HistoryAction.Download:\n      icon = faDownload;\n      break;\n    case HistoryAction.Manual:\n      icon = faUser;\n      break;\n    case HistoryAction.Sync:\n      icon = faClock;\n      break;\n    case HistoryAction.Upgrade:\n      icon = faRecycle;\n      break;\n    case HistoryAction.Upload:\n      icon = faCloudUploadAlt;\n      break;\n  }\n  if (icon) {\n    return <FontAwesomeIcon title={title} icon={icon}></FontAwesomeIcon>;\n  } else {\n    return null;\n  }\n};\n\ninterface MessageIconProps extends FontAwesomeIconProps {\n  messages: string[];\n}\n\nexport const MessageIcon: FunctionComponent<MessageIconProps> = (props) => {\n  const { messages, ...iconProps } = props;\n\n  const popover = (\n    <Popover hidden={messages.length === 0} id=\"overlay-icon\">\n      <Popover.Content>\n        {messages.map((m) => (\n          <li key={m}>{m}</li>\n        ))}\n      </Popover.Content>\n    </Popover>\n  );\n\n  return (\n    <OverlayTrigger overlay={popover}>\n      <FontAwesomeIcon {...iconProps}></FontAwesomeIcon>\n    </OverlayTrigger>\n  );\n};\n\nexport const LoadingIndicator: FunctionComponent<{\n  animation?: SpinnerProps[\"animation\"];\n}> = ({ children, animation: style }) => {\n  return (\n    <div className=\"d-flex flex-column flex-grow-1 align-items-center py-5\">\n      <Spinner animation={style ?? \"border\"} className=\"mb-2\"></Spinner>\n      {children}\n    </div>\n  );\n};\n\ninterface FormatterProps {\n  format?: string;\n  children: string | Date;\n}\n\nexport const DateFormatter: FunctionComponent<FormatterProps> = ({\n  children,\n  format,\n}) => {\n  const result = useMemo(\n    () => moment(children, format ?? \"DD/MM/YYYY h:mm:ss\").fromNow(),\n    [children, format]\n  );\n  return <span>{result}</span>;\n};\n\ninterface LanguageTextProps {\n  text: Language;\n  className?: string;\n  long?: boolean;\n}\n\nexport const LanguageText: FunctionComponent<LanguageTextProps> = ({\n  text,\n  className,\n  long,\n}) => {\n  const result = useMemo(() => {\n    let lang = text.code2;\n    let hi = \":HI\";\n    let forced = \":Forced\";\n    if (long) {\n      lang = text.name;\n      hi = \" HI\";\n      forced = \" Forced\";\n    }\n\n    let res = lang;\n    if (text.hi) {\n      res += hi;\n    } else if (text.forced) {\n      res += forced;\n    }\n    return res;\n  }, [text, long]);\n  return (\n    <span title={text.name} className={className}>\n      {result}\n    </span>\n  );\n};\n\nexport * from \"./async\";\nexport * from \"./buttons\";\nexport * from \"./ContentHeader\";\nexport * from \"./inputs\";\nexport * from \"./LanguageSelector\";\nexport * from \"./modals\";\nexport * from \"./SearchBar\";\nexport * from \"./tables\";\n","import React, { FunctionComponent, useMemo } from \"react\";\nimport { Col, Container, Pagination, Row } from \"react-bootstrap\";\nimport { PageControlAction } from \"./types\";\ninterface Props {\n  count: number;\n  index: number;\n  size: number;\n  total: number;\n  canPrevious: boolean;\n  previous: () => void;\n  canNext: boolean;\n  next: () => void;\n  goto: (idx: number) => void;\n  loadState?: PageControlAction;\n}\n\nconst PageControl: FunctionComponent<Props> = ({\n  count,\n  index,\n  size,\n  total,\n  canPrevious,\n  previous,\n  canNext,\n  next,\n  goto,\n  loadState,\n}) => {\n  const empty = total === 0;\n  const start = empty ? 0 : size * index + 1;\n  const end = Math.min(size * (index + 1), total);\n\n  const loading = loadState !== undefined;\n\n  const pageButtons = useMemo(\n    () =>\n      [...Array(count).keys()]\n        .map((idx) => {\n          if (Math.abs(idx - index) >= 4 && idx !== 0 && idx !== count - 1) {\n            return null;\n          } else {\n            return (\n              <Pagination.Item\n                key={idx}\n                disabled={loading}\n                active={index === idx}\n                onClick={() => goto(idx)}\n              >\n                {idx + 1}\n              </Pagination.Item>\n            );\n          }\n        })\n        .flatMap((item, idx, arr) => {\n          if (item === null) {\n            if (arr[idx + 1] === null) {\n              return [];\n            } else {\n              return (\n                <Pagination.Ellipsis key={idx} disabled></Pagination.Ellipsis>\n              );\n            }\n          } else {\n            return [item];\n          }\n        }),\n    [count, index, goto, loading]\n  );\n\n  return (\n    <Container fluid className=\"mb-3\">\n      <Row>\n        <Col className=\"d-flex align-items-center justify-content-start\">\n          <span>\n            Show {start} to {end} of {total} entries\n          </span>\n        </Col>\n        <Col className=\"d-flex justify-content-end\">\n          <Pagination className=\"m-0\" hidden={count <= 1}>\n            <Pagination.Prev\n              onClick={previous}\n              disabled={!canPrevious && loading}\n            ></Pagination.Prev>\n            {pageButtons}\n            <Pagination.Next\n              onClick={next}\n              disabled={!canNext && loading}\n            ></Pagination.Next>\n          </Pagination>\n        </Col>\n      </Row>\n    </Container>\n  );\n};\n\nexport default PageControl;\n","import { isNull, isUndefined } from \"lodash\";\nimport React, { useCallback, useEffect } from \"react\";\nimport {\n  PluginHook,\n  TableOptions,\n  usePagination,\n  useRowSelect,\n  useTable,\n} from \"react-table\";\nimport { useReduxStore } from \"../../@redux/hooks/base\";\nimport { ScrollToTop } from \"../../utilites\";\nimport { AsyncStateOverlay } from \"../async\";\nimport BaseTable, { TableStyleProps, useStyleAndOptions } from \"./BaseTable\";\nimport PageControl from \"./PageControl\";\nimport {\n  useAsyncPagination,\n  useCustomSelection,\n  useDefaultSettings,\n} from \"./plugins\";\n\ntype Props<T extends object> = TableOptions<T> &\n  TableStyleProps<T> & {\n    async?: boolean;\n    canSelect?: boolean;\n    autoScroll?: boolean;\n    plugins?: PluginHook<T>[];\n  };\n\nexport default function PageTable<T extends object>(props: Props<T>) {\n  const { async, autoScroll, canSelect, plugins, ...remain } = props;\n  const { style, options } = useStyleAndOptions(remain);\n\n  const allPlugins: PluginHook<T>[] = [useDefaultSettings, usePagination];\n\n  if (async) {\n    allPlugins.push(useAsyncPagination);\n  }\n\n  if (canSelect) {\n    allPlugins.push(useRowSelect, useCustomSelection);\n  }\n\n  if (plugins) {\n    allPlugins.push(...plugins);\n  }\n\n  const instance = useTable(options, ...allPlugins);\n\n  const {\n    getTableProps,\n    getTableBodyProps,\n    headerGroups,\n    rows,\n    prepareRow,\n\n    // page\n    page,\n    canNextPage,\n    canPreviousPage,\n    pageCount,\n    gotoPage,\n    nextPage,\n    previousPage,\n    setPageSize,\n    state: { pageIndex, pageSize, pageToLoad, needLoadingScreen },\n  } = instance;\n\n  const globalPageSize = useReduxStore((s) => s.site.pageSize);\n\n  // Scroll to top when page is changed\n  useEffect(() => {\n    if (autoScroll) {\n      ScrollToTop();\n    }\n  }, [pageIndex, autoScroll]);\n\n  useEffect(() => {\n    const selecting = options.isSelecting;\n    if (canSelect && !isUndefined(selecting)) {\n      if (selecting) {\n        setPageSize(rows.length);\n      } else {\n        setPageSize(globalPageSize);\n      }\n    }\n  }, [\n    canSelect,\n    globalPageSize,\n    options.isSelecting,\n    rows.length,\n    setPageSize,\n  ]);\n\n  const total = options.asyncState\n    ? options.asyncState.data.order.length\n    : rows.length;\n\n  const orderIdStateValidater = useCallback(\n    (state: OrderIdState<any>) => {\n      const start = pageIndex * pageSize;\n      const end = start + pageSize;\n      return state.order.slice(start, end).every(isNull) === false;\n    },\n    [pageIndex, pageSize]\n  );\n\n  if (needLoadingScreen && options.asyncState) {\n    return (\n      <AsyncStateOverlay\n        state={options.asyncState}\n        exist={orderIdStateValidater}\n      ></AsyncStateOverlay>\n    );\n  }\n\n  return (\n    <React.Fragment>\n      <BaseTable\n        {...style}\n        headers={headerGroups}\n        rows={page}\n        prepareRow={prepareRow}\n        tableProps={getTableProps()}\n        tableBodyProps={getTableBodyProps()}\n      ></BaseTable>\n      <PageControl\n        loadState={pageToLoad}\n        count={pageCount}\n        index={pageIndex}\n        size={pageSize}\n        total={total}\n        canPrevious={canPreviousPage}\n        canNext={canNextPage}\n        previous={previousPage}\n        next={nextPage}\n        goto={gotoPage}\n      ></PageControl>\n    </React.Fragment>\n  );\n}\n","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAAC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gC+qLKzGQ5YNuh1iYuLU7dv35Yp1B9KT09Xhw8fNr9YOqmpqap3b4YsKzVjxgx14sQJ9v9PIZ82/4+QxipJWozgsSjRqk7RyJEji32djD3mxi/y50MvhV6CB6y0O8OHDy9x8WAXR37b9bnVb6JK8yFP748PPoP0hg0b5MuWLVu2yB57sEaHUFFRUbpXr156586dptQuMHDa/0mFPHjZSiYLBlGHs2fPqgYN+H7DC3A92WvjbktBQYHKy8sThyNjgyj6FnjOI8XplUeO4NbvQGeEjReyWB9E5cqVxRy39gjzKa7nbZouPJ7TaGOsEN1bFN9DsNexsKwtWrTg1PcHTvtC9+WDUmDgsYTEOhlGtGLVxzvPrt+GFXsdGFqmp02bZi7nPKZPn267/hsvTlZB8gKE06Bxx7JDsuQtDz9DGstkc+ngh2G9tG1Q7nVQhXh3foP0smXLzE8EL/Pnz7eV/wUqdcp7HX6FgnZM4IDHeEaWEeIbZhVaeYusFDt16iQvKQQLmJLtaE8xDM6vTs3RkI6IiCiOwXtbcIWXmZlp7XtOdYxyDQgfQn9C8qqKtSADSVZWlqz6WAaIzsD3oYDDV9a4xaInTZqkz58/b4rnP/bt26dTUlKsYcO7PhXydPsGmAjoW4gRCLJ65LrB3b1WXmjUMOA5ISHB2vOs+JeQXwa6N4UNwR7B11vFaEpOTtbz5s3TsN9f6/U6mrCHDh3SaWlpGra8e8gufdvTIb6mWyH4y63LIMT+EOPRmjKDO9CM1GzTpo3sOdB4oSFDaETRT3flyhWJ6cvNzbWbl4TvItM9zUXNIcjDjVVeAuHXfheiSyYO4uDJsDzGp3CqYq8hhRA9NdyJ+QdiL8qC6KXiuZ9Q6j9Wq9p4T0j7swAAAABJRU5ErkJggg==\"","import { IconDefinition } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useContext, useMemo } from \"react\";\nimport { Badge, Collapse, ListGroupItem } from \"react-bootstrap\";\nimport { NavLink } from \"react-router-dom\";\nimport { useSidebarKey, useUpdateSidebar } from \".\";\nimport { SidebarToggleContext } from \"../App\";\nimport {\n  BadgeProvider,\n  ChildBadgeProvider,\n  CollapseItemType,\n  LinkItemType,\n} from \"./types\";\n\nexport const HiddenKeysContext = React.createContext<string[]>([]);\n\nexport const BadgesContext = React.createContext<BadgeProvider>({});\n\nexport const LinkItem: FunctionComponent<LinkItemType> = ({\n  link,\n  name,\n  icon,\n}) => {\n  const badges = useContext(BadgesContext);\n  const toggle = useContext(SidebarToggleContext);\n\n  const badgeValue = useMemo(() => {\n    let badge: Nullable<number> = null;\n    if (name in badges) {\n      let item = badges[name];\n      if (typeof item === \"number\") {\n        badge = item;\n      }\n    }\n    return badge;\n  }, [badges, name]);\n\n  return (\n    <NavLink\n      activeClassName=\"sb-active\"\n      className=\"list-group-item list-group-item-action sidebar-button\"\n      to={link}\n      onClick={toggle}\n    >\n      <DisplayItem\n        badge={badgeValue ?? undefined}\n        name={name}\n        icon={icon}\n      ></DisplayItem>\n    </NavLink>\n  );\n};\n\nexport const CollapseItem: FunctionComponent<CollapseItemType> = ({\n  icon,\n  name,\n  children,\n}) => {\n  const badges = useContext(BadgesContext);\n  const hiddenKeys = useContext(HiddenKeysContext);\n  const toggleSidebar = useContext(SidebarToggleContext);\n\n  const itemKey = name.toLowerCase();\n\n  const sidebarKey = useSidebarKey();\n  const updateSidebar = useUpdateSidebar();\n\n  const [badgeValue, childValue] = useMemo<\n    [Nullable<number>, Nullable<ChildBadgeProvider>]\n  >(() => {\n    let badge: Nullable<number> = null;\n    let child: Nullable<ChildBadgeProvider> = null;\n\n    if (name in badges) {\n      const item = badges[name];\n      if (typeof item === \"number\") {\n        badge = item;\n      } else if (typeof item === \"object\") {\n        badge = 0;\n        child = item;\n        for (const it in item) {\n          badge += item[it];\n        }\n      }\n    }\n    return [badge, child];\n  }, [badges, name]);\n\n  const active = useMemo(() => sidebarKey === itemKey, [sidebarKey, itemKey]);\n\n  const collapseBoxClass = useMemo(\n    () => `sidebar-collapse-box ${active ? \"active\" : \"\"}`,\n    [active]\n  );\n\n  const childrenElems = useMemo(\n    () =>\n      children\n        .filter((v) => !hiddenKeys.includes(v.hiddenKey ?? \"\"))\n        .map((ch) => {\n          let badge: Nullable<number> = null;\n          if (childValue && ch.name in childValue) {\n            badge = childValue[ch.name];\n          }\n          return (\n            <NavLink\n              key={ch.name}\n              activeClassName=\"sb-active\"\n              className=\"list-group-item list-group-item-action sidebar-button sb-collapse\"\n              to={ch.link}\n              onClick={toggleSidebar}\n            >\n              <DisplayItem\n                badge={badge === 0 ? undefined : badge ?? undefined}\n                name={ch.name}\n              ></DisplayItem>\n            </NavLink>\n          );\n        }),\n    [children, hiddenKeys, childValue, toggleSidebar]\n  );\n\n  if (childrenElems.length === 0) {\n    return null;\n  }\n\n  return (\n    <div className={collapseBoxClass}>\n      <ListGroupItem\n        action\n        className=\"sidebar-button\"\n        onClick={() => {\n          if (active) {\n            updateSidebar(\"\");\n          } else {\n            updateSidebar(itemKey);\n          }\n        }}\n      >\n        <DisplayItem\n          badge={badgeValue === 0 ? undefined : badgeValue ?? undefined}\n          icon={icon}\n          name={name}\n        ></DisplayItem>\n      </ListGroupItem>\n      <Collapse in={active}>\n        <div className=\"sidebar-collapse\">{childrenElems}</div>\n      </Collapse>\n    </div>\n  );\n};\n\ninterface DisplayProps {\n  name: string;\n  icon?: IconDefinition;\n  badge?: number;\n}\n\nconst DisplayItem: FunctionComponent<DisplayProps> = ({\n  name,\n  icon,\n  badge,\n}) => (\n  <React.Fragment>\n    {icon && (\n      <FontAwesomeIcon size=\"1x\" className=\"icon\" icon={icon}></FontAwesomeIcon>\n    )}\n    <span className=\"d-flex flex-grow-1 justify-content-between\">\n      {name} <Badge variant=\"secondary\">{badge}</Badge>\n    </span>\n  </React.Fragment>\n);\n","import React, {\n  FunctionComponent,\n  useContext,\n  useEffect,\n  useMemo,\n} from \"react\";\nimport { Container, Image, ListGroup } from \"react-bootstrap\";\nimport { useHistory } from \"react-router-dom\";\nimport { badgeUpdateAll, siteChangeSidebar } from \"../@redux/actions\";\nimport { useReduxAction, useReduxStore } from \"../@redux/hooks/base\";\nimport { useIsRadarrEnabled, useIsSonarrEnabled } from \"../@redux/hooks/site\";\nimport logo from \"../@static/logo64.png\";\nimport { SidebarToggleContext } from \"../App\";\nimport { useAutoUpdate } from \"../utilites/hooks\";\nimport {\n  BadgesContext,\n  CollapseItem,\n  HiddenKeysContext,\n  LinkItem,\n} from \"./items\";\nimport { RadarrDisabledKey, SidebarList, SonarrDisabledKey } from \"./list\";\nimport \"./style.scss\";\nimport { BadgeProvider } from \"./types\";\n\nexport function useSidebarKey() {\n  return useReduxStore((s) => s.site.sidebar);\n}\n\nexport function useUpdateSidebar() {\n  return useReduxAction(siteChangeSidebar);\n}\n\ninterface Props {\n  open?: boolean;\n}\n\nconst Sidebar: FunctionComponent<Props> = ({ open }) => {\n  const updateBadges = useReduxAction(badgeUpdateAll);\n  useAutoUpdate(updateBadges);\n\n  const toggle = useContext(SidebarToggleContext);\n\n  const { movies, episodes, providers } = useReduxStore((s) => s.site.badges);\n\n  const badges = useMemo<BadgeProvider>(\n    () => ({\n      Wanted: {\n        Series: episodes,\n        Movies: movies,\n      },\n      System: {\n        Providers: providers,\n      },\n    }),\n    [movies, episodes, providers]\n  );\n\n  const sonarrEnabled = useIsSonarrEnabled();\n  const radarrEnabled = useIsRadarrEnabled();\n\n  const hiddenKeys = useMemo<string[]>(() => {\n    const list = [];\n    if (!sonarrEnabled) {\n      list.push(SonarrDisabledKey);\n    }\n    if (!radarrEnabled) {\n      list.push(RadarrDisabledKey);\n    }\n    return list;\n  }, [sonarrEnabled, radarrEnabled]);\n\n  const history = useHistory();\n\n  const updateSidebar = useUpdateSidebar();\n\n  useEffect(() => {\n    const path = history.location.pathname.split(\"/\");\n    const len = path.length;\n    if (len >= 3) {\n      updateSidebar(path[len - 2]);\n    } else {\n      updateSidebar(path[len - 1]);\n    }\n  }, [history.location.pathname, updateSidebar]);\n\n  const cls = [\"sidebar-container\"];\n  const overlay = [\"sidebar-overlay\"];\n\n  if (open === true) {\n    cls.push(\"open\");\n    overlay.push(\"open\");\n  }\n\n  const sidebarItems = useMemo(\n    () =>\n      SidebarList.map((v) => {\n        if (hiddenKeys.includes(v.hiddenKey ?? \"\")) {\n          return null;\n        }\n        if (\"children\" in v) {\n          return <CollapseItem key={v.name} {...v}></CollapseItem>;\n        } else {\n          return <LinkItem key={v.link} {...v}></LinkItem>;\n        }\n      }),\n    [hiddenKeys]\n  );\n\n  return (\n    <React.Fragment>\n      <aside className={cls.join(\" \")}>\n        <Container className=\"sidebar-title d-flex align-items-center d-md-none\">\n          <Image alt=\"brand\" src={logo} width=\"32\" height=\"32\"></Image>\n        </Container>\n        <HiddenKeysContext.Provider value={hiddenKeys}>\n          <BadgesContext.Provider value={badges}>\n            <ListGroup variant=\"flush\">{sidebarItems}</ListGroup>\n          </BadgesContext.Provider>\n        </HiddenKeysContext.Provider>\n      </aside>\n      <div className={overlay.join(\" \")} onClick={toggle}></div>\n    </React.Fragment>\n  );\n};\n\nexport default Sidebar;\n","import {\n  faClock,\n  faCogs,\n  faExclamationTriangle,\n  faFileExcel,\n  faFilm,\n  faLaptop,\n  faPlay,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { SidebarDefinition } from \"./types\";\n\nexport const SonarrDisabledKey = \"sonarr-disabled\";\nexport const RadarrDisabledKey = \"radarr-disabled\";\n\nexport const SidebarList: SidebarDefinition[] = [\n  {\n    icon: faPlay,\n    name: \"Series\",\n    link: \"/series\",\n    hiddenKey: SonarrDisabledKey,\n  },\n  {\n    icon: faFilm,\n    name: \"Movies\",\n    link: \"/movies\",\n    hiddenKey: RadarrDisabledKey,\n  },\n  {\n    icon: faClock,\n    name: \"History\",\n    children: [\n      {\n        name: \"Series\",\n        link: \"/history/series\",\n        hiddenKey: SonarrDisabledKey,\n      },\n      {\n        name: \"Movies\",\n        link: \"/history/movies\",\n        hiddenKey: RadarrDisabledKey,\n      },\n      {\n        name: \"Statistics\",\n        link: \"/history/stats\",\n      },\n    ],\n  },\n  {\n    icon: faFileExcel,\n    name: \"Blacklist\",\n    children: [\n      {\n        name: \"Series\",\n        link: \"/blacklist/series\",\n        hiddenKey: SonarrDisabledKey,\n      },\n      {\n        name: \"Movies\",\n        link: \"/blacklist/movies\",\n        hiddenKey: RadarrDisabledKey,\n      },\n    ],\n  },\n  {\n    icon: faExclamationTriangle,\n    name: \"Wanted\",\n    children: [\n      {\n        name: \"Series\",\n        link: \"/wanted/series\",\n        hiddenKey: SonarrDisabledKey,\n      },\n      {\n        name: \"Movies\",\n        link: \"/wanted/movies\",\n        hiddenKey: RadarrDisabledKey,\n      },\n    ],\n  },\n  {\n    icon: faCogs,\n    name: \"Settings\",\n    children: [\n      {\n        name: \"General\",\n        link: \"/settings/general\",\n      },\n      {\n        name: \"Languages\",\n        link: \"/settings/languages\",\n      },\n      {\n        name: \"Providers\",\n        link: \"/settings/providers\",\n      },\n      {\n        name: \"Subtitles\",\n        link: \"/settings/subtitles\",\n      },\n      {\n        name: \"Sonarr\",\n        link: \"/settings/sonarr\",\n      },\n      {\n        name: \"Radarr\",\n        link: \"/settings/radarr\",\n      },\n      {\n        name: \"Notifications\",\n        link: \"/settings/notifications\",\n      },\n      {\n        name: \"Scheduler\",\n        link: \"/settings/scheduler\",\n      },\n      {\n        name: \"UI\",\n        link: \"/settings/ui\",\n      },\n    ],\n  },\n  {\n    icon: faLaptop,\n    name: \"System\",\n    children: [\n      {\n        name: \"Tasks\",\n        link: \"/system/tasks\",\n      },\n      {\n        name: \"Logs\",\n        link: \"/system/logs\",\n      },\n      {\n        name: \"Providers\",\n        link: \"/system/providers\",\n      },\n      {\n        name: \"Status\",\n        link: \"/system/status\",\n      },\n      {\n        name: \"Releases\",\n        link: \"/system/releases\",\n      },\n    ],\n  },\n];\n","import {\n  faBars,\n  faHeart,\n  faNetworkWired,\n  faUser,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useContext,\n  useMemo,\n  useState,\n} from \"react\";\nimport {\n  Button,\n  Col,\n  Container,\n  Dropdown,\n  Image,\n  Navbar,\n  Row,\n} from \"react-bootstrap\";\nimport { SidebarToggleContext } from \".\";\nimport { siteRedirectToAuth } from \"../@redux/actions\";\nimport { useSystemSettings } from \"../@redux/hooks\";\nimport { useReduxAction } from \"../@redux/hooks/base\";\nimport { useIsOffline } from \"../@redux/hooks/site\";\nimport logo from \"../@static/logo64.png\";\nimport { SystemApi } from \"../apis\";\nimport { ActionButton, SearchBar, SearchResult } from \"../components\";\nimport { useBaseUrl } from \"../utilites\";\nimport \"./header.scss\";\n\nasync function SearchItem(text: string) {\n  const results = await SystemApi.search(text);\n\n  return results.map<SearchResult>((v) => {\n    let link: string;\n    if (v.sonarrSeriesId) {\n      link = `/series/${v.sonarrSeriesId}`;\n    } else if (v.radarrId) {\n      link = `/movies/${v.radarrId}`;\n    } else {\n      link = \"\";\n    }\n    return {\n      name: `${v.title} (${v.year})`,\n      link,\n    };\n  });\n}\n\ninterface Props {}\n\nconst Header: FunctionComponent<Props> = () => {\n  const setNeedAuth = useReduxAction(siteRedirectToAuth);\n\n  const [settings] = useSystemSettings();\n\n  const canLogout = (settings.data?.auth.type ?? \"none\") !== \"none\";\n\n  const toggleSidebar = useContext(SidebarToggleContext);\n\n  const offline = useIsOffline();\n\n  const dropdown = useMemo(\n    () => (\n      <Dropdown alignRight>\n        <Dropdown.Toggle className=\"dropdown-hidden\" as={Button}>\n          <FontAwesomeIcon icon={faUser}></FontAwesomeIcon>\n        </Dropdown.Toggle>\n        <Dropdown.Menu>\n          <Dropdown.Item\n            onClick={() => {\n              SystemApi.restart();\n            }}\n          >\n            Restart\n          </Dropdown.Item>\n          <Dropdown.Item\n            onClick={() => {\n              SystemApi.shutdown();\n            }}\n          >\n            Shutdown\n          </Dropdown.Item>\n          <Dropdown.Divider hidden={!canLogout}></Dropdown.Divider>\n          <Dropdown.Item\n            hidden={!canLogout}\n            onClick={() => {\n              SystemApi.logout().then(() => setNeedAuth());\n            }}\n          >\n            Logout\n          </Dropdown.Item>\n        </Dropdown.Menu>\n      </Dropdown>\n    ),\n    [canLogout, setNeedAuth]\n  );\n\n  const [reconnecting, setReconnect] = useState(false);\n  const reconnect = useCallback(() => {\n    setReconnect(true);\n    SystemApi.status().finally(() => setReconnect(false));\n  }, []);\n\n  const baseUrl = useBaseUrl();\n\n  return (\n    <Navbar bg=\"primary\" className=\"flex-grow-1 px-0\">\n      <div className=\"header-icon px-3 m-0 d-none d-md-block\">\n        <Navbar.Brand href={baseUrl} className=\"\">\n          <Image alt=\"brand\" src={logo} width=\"32\" height=\"32\"></Image>\n        </Navbar.Brand>\n      </div>\n      <Button className=\"mx-2 m-0 d-md-none\" onClick={toggleSidebar}>\n        <FontAwesomeIcon icon={faBars}></FontAwesomeIcon>\n      </Button>\n      <Container fluid>\n        <Row noGutters className=\"flex-grow-1\">\n          <Col xs={6} sm={4} className=\"d-flex align-items-center\">\n            <SearchBar onSearch={SearchItem}></SearchBar>\n          </Col>\n          <Col className=\"d-flex flex-row align-items-center justify-content-end pr-2\">\n            <Button\n              href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XHHRWXT9YB7WE&source=url\"\n              target=\"_blank\"\n            >\n              <FontAwesomeIcon icon={faHeart}></FontAwesomeIcon>\n            </Button>\n            {offline ? (\n              <ActionButton\n                loading={reconnecting}\n                className=\"ml-2\"\n                variant=\"warning\"\n                icon={faNetworkWired}\n                onClick={reconnect}\n              >\n                Reconnect\n              </ActionButton>\n            ) : (\n              dropdown\n            )}\n          </Col>\n        </Row>\n      </Container>\n    </Navbar>\n  );\n};\n\nexport default Header;\n","import { faExclamationTriangle } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { capitalize } from \"lodash\";\nimport React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { Toast } from \"react-bootstrap\";\nimport { siteRemoveError } from \"../../@redux/actions\";\nimport { useReduxAction, useReduxStore } from \"../../@redux/hooks/base\";\nimport \"./style.scss\";\n\nfunction useNotificationList() {\n  return useReduxStore((s) => s.site.notifications);\n}\n\nfunction useRemoveNotification() {\n  return useReduxAction(siteRemoveError);\n}\n\nexport interface NotificationContainerProps {}\n\nconst NotificationContainer: FunctionComponent<NotificationContainerProps> = () => {\n  const list = useNotificationList();\n\n  const items = useMemo(\n    () =>\n      list.map((v, idx) => (\n        <NotificationToast key={v.id} {...v}></NotificationToast>\n      )),\n    [list]\n  );\n  return (\n    <div className=\"alert-container\">\n      <div className=\"toast-container\">{items}</div>\n    </div>\n  );\n};\n\ntype MessageHolderProps = ReduxStore.Notification & {};\n\nconst NotificationToast: FunctionComponent<MessageHolderProps> = (props) => {\n  const { message, id, type } = props;\n  const removeNotification = useRemoveNotification();\n\n  const remove = useCallback(() => removeNotification(id), [\n    removeNotification,\n    id,\n  ]);\n\n  return (\n    <Toast onClose={remove} animation={false}>\n      <Toast.Header>\n        <FontAwesomeIcon\n          className=\"mr-1\"\n          icon={faExclamationTriangle}\n        ></FontAwesomeIcon>\n        <strong className=\"mr-auto\">{capitalize(type)}</strong>\n      </Toast.Header>\n      <Toast.Body>{message}</Toast.Body>\n    </Toast>\n  );\n};\n\nexport default NotificationContainer;\n","import { faEyeSlash as fasEyeSlash } from \"@fortawesome/free-regular-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent } from \"react\";\nimport { Container } from \"react-bootstrap\";\n\nexport const RouterEmptyPath = \"/empty-page\";\n\nconst EmptyPage: FunctionComponent = () => {\n  return (\n    <Container className=\"d-flex flex-column align-items-center my-5\">\n      <h1>\n        <FontAwesomeIcon className=\"mr-2\" icon={fasEyeSlash}></FontAwesomeIcon>\n        404\n      </h1>\n      <p>The Request URL No Found</p>\n    </Container>\n  );\n};\n\nexport default EmptyPage;\n","import { faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useMemo } from \"react\";\nimport { Link } from \"react-router-dom\";\nimport { Column } from \"react-table\";\nimport { MoviesApi } from \"../../apis\";\nimport { AsyncButton, LanguageText, PageTable } from \"../../components\";\n\ninterface Props {\n  blacklist: readonly Blacklist.Movie[];\n  update: () => void;\n}\n\nconst Table: FunctionComponent<Props> = ({ blacklist, update }) => {\n  const columns = useMemo<Column<Blacklist.Movie>[]>(\n    () => [\n      {\n        Header: \"Name\",\n        accessor: \"title\",\n        className: \"text-nowrap\",\n        Cell: (row) => {\n          const target = `/movies/${row.row.original.radarrId}`;\n          return (\n            <Link to={target}>\n              <span>{row.value}</span>\n            </Link>\n          );\n        },\n      },\n      {\n        Header: \"Language\",\n        accessor: \"language\",\n        Cell: ({ value }) => {\n          if (value) {\n            return <LanguageText text={value} long></LanguageText>;\n          } else {\n            return null;\n          }\n        },\n      },\n      {\n        Header: \"Provider\",\n        accessor: \"provider\",\n      },\n      {\n        Header: \"Date\",\n        accessor: \"timestamp\",\n      },\n      {\n        accessor: \"subs_id\",\n        Cell: (row) => {\n          const subs_id = row.value;\n\n          return (\n            <AsyncButton\n              size=\"sm\"\n              variant=\"light\"\n              noReset\n              promise={() =>\n                MoviesApi.deleteBlacklist(false, {\n                  provider: row.row.original.provider,\n                  subs_id,\n                })\n              }\n              onSuccess={update}\n            >\n              <FontAwesomeIcon icon={faTrash}></FontAwesomeIcon>\n            </AsyncButton>\n          );\n        },\n      },\n    ],\n    [update]\n  );\n  return (\n    <PageTable\n      emptyText=\"No Blacklisted Movies Subtitles\"\n      columns={columns}\n      data={blacklist}\n    ></PageTable>\n  );\n};\n\nexport default Table;\n","import { faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport React, { FunctionComponent } from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { useBlacklistMovies } from \"../../@redux/hooks\";\nimport { MoviesApi } from \"../../apis\";\nimport { AsyncStateOverlay, ContentHeader } from \"../../components\";\nimport { useAutoUpdate } from \"../../utilites/hooks\";\nimport Table from \"./table\";\n\ninterface Props {}\n\nconst BlacklistMoviesView: FunctionComponent<Props> = () => {\n  const [blacklist, update] = useBlacklistMovies();\n  useAutoUpdate(update);\n  return (\n    <AsyncStateOverlay state={blacklist}>\n      {(data) => (\n        <Container fluid>\n          <Helmet>\n            <title>Movies Blacklist - Bazarr</title>\n          </Helmet>\n          <ContentHeader>\n            <ContentHeader.AsyncButton\n              icon={faTrash}\n              disabled={data.length === 0}\n              promise={() => MoviesApi.deleteBlacklist(true)}\n              onSuccess={update}\n            >\n              Remove All\n            </ContentHeader.AsyncButton>\n          </ContentHeader>\n          <Row>\n            <Table blacklist={data} update={update}></Table>\n          </Row>\n        </Container>\n      )}\n    </AsyncStateOverlay>\n  );\n};\n\nexport default BlacklistMoviesView;\n","import { faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useMemo } from \"react\";\nimport { Link } from \"react-router-dom\";\nimport { Column } from \"react-table\";\nimport { EpisodesApi } from \"../../apis\";\nimport { AsyncButton, LanguageText, PageTable } from \"../../components\";\n\ninterface Props {\n  blacklist: readonly Blacklist.Episode[];\n  update: () => void;\n}\n\nconst Table: FunctionComponent<Props> = ({ blacklist, update }) => {\n  const columns = useMemo<Column<Blacklist.Episode>[]>(\n    () => [\n      {\n        Header: \"Series\",\n        accessor: \"seriesTitle\",\n        className: \"text-nowrap\",\n        Cell: (row) => {\n          const target = `/series/${row.row.original.sonarrSeriesId}`;\n          return (\n            <Link to={target}>\n              <span>{row.value}</span>\n            </Link>\n          );\n        },\n      },\n      {\n        Header: \"Episode\",\n        accessor: \"episode_number\",\n      },\n      {\n        accessor: \"episodeTitle\",\n      },\n      {\n        Header: \"Language\",\n        accessor: \"language\",\n        Cell: ({ value }) => {\n          if (value) {\n            return <LanguageText text={value} long></LanguageText>;\n          } else {\n            return null;\n          }\n        },\n      },\n      {\n        Header: \"Provider\",\n        accessor: \"provider\",\n      },\n      {\n        Header: \"Date\",\n        accessor: \"timestamp\",\n      },\n      {\n        accessor: \"subs_id\",\n        Cell: (row) => {\n          const subs_id = row.value;\n          return (\n            <AsyncButton\n              size=\"sm\"\n              variant=\"light\"\n              noReset\n              promise={() =>\n                EpisodesApi.deleteBlacklist(false, {\n                  provider: row.row.original.provider,\n                  subs_id,\n                })\n              }\n              onSuccess={update}\n            >\n              <FontAwesomeIcon icon={faTrash}></FontAwesomeIcon>\n            </AsyncButton>\n          );\n        },\n      },\n    ],\n    [update]\n  );\n  return (\n    <PageTable\n      emptyText=\"No Blacklisted Series Subtitles\"\n      columns={columns}\n      data={blacklist}\n    ></PageTable>\n  );\n};\n\nexport default Table;\n","import { faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport React, { FunctionComponent } from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { useBlacklistSeries } from \"../../@redux/hooks\";\nimport { EpisodesApi } from \"../../apis\";\nimport { AsyncStateOverlay, ContentHeader } from \"../../components\";\nimport { useAutoUpdate } from \"../../utilites\";\nimport Table from \"./table\";\n\ninterface Props {}\n\nconst BlacklistSeriesView: FunctionComponent<Props> = () => {\n  const [blacklist, update] = useBlacklistSeries();\n  useAutoUpdate(update);\n  return (\n    <AsyncStateOverlay state={blacklist}>\n      {(data) => (\n        <Container fluid>\n          <Helmet>\n            <title>Series Blacklist - Bazarr</title>\n          </Helmet>\n          <ContentHeader>\n            <ContentHeader.AsyncButton\n              icon={faTrash}\n              disabled={data.length === 0}\n              promise={() => EpisodesApi.deleteBlacklist(true)}\n              onSuccess={update}\n            >\n              Remove All\n            </ContentHeader.AsyncButton>\n          </ContentHeader>\n          <Row>\n            <Table blacklist={data} update={update}></Table>\n          </Row>\n        </Container>\n      )}\n    </AsyncStateOverlay>\n  );\n};\n\nexport default BlacklistSeriesView;\n","import React, { FunctionComponent } from \"react\";\nimport { Redirect, Route, Switch } from \"react-router-dom\";\nimport { RouterEmptyPath } from \"../404\";\nimport { useIsRadarrEnabled, useIsSonarrEnabled } from \"../@redux/hooks/site\";\nimport BlacklistMovies from \"./Movies\";\nimport BlacklistSeries from \"./Series\";\n\nconst Router: FunctionComponent = () => {\n  const sonarr = useIsSonarrEnabled();\n  const radarr = useIsRadarrEnabled();\n  return (\n    <Switch>\n      {sonarr && (\n        <Route exact path=\"/blacklist/series\">\n          <BlacklistSeries></BlacklistSeries>\n        </Route>\n      )}\n      {radarr && (\n        <Route path=\"/blacklist/movies\">\n          <BlacklistMovies></BlacklistMovies>\n        </Route>\n      )}\n      <Route path=\"/blacklist/*\">\n        <Redirect to={RouterEmptyPath}></Redirect>\n      </Route>\n    </Switch>\n  );\n};\n\nexport default Router;\n","import { capitalize } from \"lodash\";\nimport React, { FunctionComponent } from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { Column, TableUpdater } from \"react-table\";\nimport { AsyncStateOverlay, PageTable } from \"../../components\";\n\ninterface Props {\n  type: \"movies\" | \"series\";\n  state: Readonly<AsyncState<History.Base[]>>;\n  columns: Column<History.Base>[];\n  tableUpdater?: TableUpdater<History.Base>;\n}\n\nconst HistoryGenericView: FunctionComponent<Props> = ({\n  state,\n  columns,\n  type,\n  tableUpdater,\n}) => {\n  const typeName = capitalize(type);\n  return (\n    <Container fluid>\n      <Helmet>\n        <title>{typeName} History - Bazarr</title>\n      </Helmet>\n      <Row>\n        <AsyncStateOverlay state={state}>\n          {(data) => (\n            <PageTable\n              emptyText={`Nothing Found in ${typeName} History`}\n              columns={columns}\n              data={data}\n              externalUpdate={tableUpdater}\n            ></PageTable>\n          )}\n        </AsyncStateOverlay>\n      </Row>\n    </Container>\n  );\n};\n\nexport default HistoryGenericView;\n","import { faInfoCircle } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { Badge, OverlayTrigger, Popover } from \"react-bootstrap\";\nimport { Link } from \"react-router-dom\";\nimport { Column, Row } from \"react-table\";\nimport { useMoviesHistory } from \"../../@redux/hooks\";\nimport { MoviesApi } from \"../../apis\";\nimport { HistoryIcon, LanguageText } from \"../../components\";\nimport { BlacklistButton } from \"../../generic/blacklist\";\nimport { useAutoUpdate } from \"../../utilites/hooks\";\nimport HistoryGenericView from \"../generic\";\n\ninterface Props {}\n\nconst MoviesHistoryView: FunctionComponent<Props> = () => {\n  const [movies, update] = useMoviesHistory();\n  useAutoUpdate(update);\n\n  const tableUpdate = useCallback((row: Row<History.Base>) => update(), [\n    update,\n  ]);\n\n  const columns: Column<History.Movie>[] = useMemo<Column<History.Movie>[]>(\n    () => [\n      {\n        accessor: \"action\",\n        className: \"text-center\",\n        Cell: (row) => <HistoryIcon action={row.value}></HistoryIcon>,\n      },\n      {\n        Header: \"Name\",\n        accessor: \"title\",\n        className: \"text-nowrap\",\n        Cell: (row) => {\n          const target = `/movies/${row.row.original.radarrId}`;\n\n          return (\n            <Link to={target}>\n              <span>{row.value}</span>\n            </Link>\n          );\n        },\n      },\n      {\n        Header: \"Language\",\n        accessor: \"language\",\n        Cell: ({ value }) => {\n          if (value) {\n            return (\n              <Badge variant=\"secondary\">\n                <LanguageText text={value} long></LanguageText>\n              </Badge>\n            );\n          } else {\n            return null;\n          }\n        },\n      },\n      {\n        Header: \"Score\",\n        accessor: \"score\",\n      },\n      {\n        Header: \"Date\",\n        accessor: \"timestamp\",\n        className: \"text-nowrap\",\n      },\n      {\n        accessor: \"description\",\n        Cell: ({ row, value }) => {\n          const overlay = (\n            <Popover id={`description-${row.id}`}>\n              <Popover.Content>{value}</Popover.Content>\n            </Popover>\n          );\n          return (\n            <OverlayTrigger overlay={overlay}>\n              <FontAwesomeIcon size=\"sm\" icon={faInfoCircle}></FontAwesomeIcon>\n            </OverlayTrigger>\n          );\n        },\n      },\n      {\n        accessor: \"blacklisted\",\n        Cell: ({ row, externalUpdate }) => {\n          const original = row.original;\n          return (\n            <BlacklistButton\n              history={original}\n              update={() => externalUpdate && externalUpdate(row)}\n              promise={(form) =>\n                MoviesApi.addBlacklist(original.radarrId, form)\n              }\n            ></BlacklistButton>\n          );\n        },\n      },\n    ],\n    []\n  );\n\n  return (\n    <HistoryGenericView\n      type=\"movies\"\n      state={movies}\n      columns={columns as Column<History.Base>[]}\n      tableUpdater={tableUpdate}\n    ></HistoryGenericView>\n  );\n};\n\nexport default MoviesHistoryView;\n","import { faInfoCircle } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { Badge, OverlayTrigger, Popover } from \"react-bootstrap\";\nimport { Link } from \"react-router-dom\";\nimport { Column, Row } from \"react-table\";\nimport { useSeriesHistory } from \"../../@redux/hooks\";\nimport { EpisodesApi } from \"../../apis\";\nimport { HistoryIcon, LanguageText } from \"../../components\";\nimport { BlacklistButton } from \"../../generic/blacklist\";\nimport { useAutoUpdate } from \"../../utilites/hooks\";\nimport HistoryGenericView from \"../generic\";\n\ninterface Props {}\n\nconst SeriesHistoryView: FunctionComponent<Props> = () => {\n  const [series, update] = useSeriesHistory();\n  useAutoUpdate(update);\n\n  const tableUpdate = useCallback((row: Row<History.Base>) => update(), [\n    update,\n  ]);\n\n  const columns: Column<History.Episode>[] = useMemo<Column<History.Episode>[]>(\n    () => [\n      {\n        accessor: \"action\",\n        className: \"text-center\",\n        Cell: ({ value }) => <HistoryIcon action={value}></HistoryIcon>,\n      },\n      {\n        Header: \"Series\",\n        accessor: \"seriesTitle\",\n        Cell: (row) => {\n          const target = `/series/${row.row.original.sonarrSeriesId}`;\n\n          return (\n            <Link to={target}>\n              <span>{row.value}</span>\n            </Link>\n          );\n        },\n      },\n      {\n        Header: \"Episode\",\n        accessor: \"episode_number\",\n      },\n      {\n        Header: \"Title\",\n        accessor: \"episodeTitle\",\n      },\n      {\n        Header: \"Language\",\n        accessor: \"language\",\n        Cell: ({ value }) => {\n          if (value) {\n            return (\n              <Badge variant=\"secondary\">\n                <LanguageText text={value} long></LanguageText>\n              </Badge>\n            );\n          } else {\n            return null;\n          }\n        },\n      },\n      {\n        Header: \"Score\",\n        accessor: \"score\",\n      },\n      {\n        Header: \"Date\",\n        accessor: \"timestamp\",\n        className: \"text-nowrap\",\n      },\n      {\n        accessor: \"description\",\n        Cell: ({ row, value }) => {\n          const overlay = (\n            <Popover id={`description-${row.id}`}>\n              <Popover.Content>{value}</Popover.Content>\n            </Popover>\n          );\n          return (\n            <OverlayTrigger overlay={overlay}>\n              <FontAwesomeIcon size=\"sm\" icon={faInfoCircle}></FontAwesomeIcon>\n            </OverlayTrigger>\n          );\n        },\n      },\n      {\n        accessor: \"blacklisted\",\n        Cell: ({ row, externalUpdate }) => {\n          const original = row.original;\n\n          const { sonarrEpisodeId, sonarrSeriesId } = original;\n          return (\n            <BlacklistButton\n              history={original}\n              update={() => externalUpdate && externalUpdate(row)}\n              promise={(form) =>\n                EpisodesApi.addBlacklist(sonarrSeriesId, sonarrEpisodeId, form)\n              }\n            ></BlacklistButton>\n          );\n        },\n      },\n    ],\n    []\n  );\n\n  return (\n    <HistoryGenericView\n      type=\"series\"\n      state={series}\n      columns={columns as Column<History.Base>[]}\n      tableUpdater={tableUpdate}\n    ></HistoryGenericView>\n  );\n};\n\nexport default SeriesHistoryView;\n","export const actionOptions: SelectorOption<History.ActionOptions>[] = [\n  {\n    label: \"Automatically Downloaded\",\n    value: 0,\n  },\n  {\n    label: \"Manually Downloaded\",\n    value: 1,\n  },\n  {\n    label: \"Upgraded\",\n    value: 2,\n  },\n];\n\nexport const timeframeOptions: SelectorOption<History.TimeframeOptions>[] = [\n  {\n    label: \"Last Week\",\n    value: \"week\",\n  },\n  {\n    label: \"Last Month\",\n    value: \"month\",\n  },\n  {\n    label: \"Last Trimester\",\n    value: \"trimester\",\n  },\n  {\n    label: \"Last Year\",\n    value: \"year\",\n  },\n];\n","import { merge } from \"lodash\";\nimport React, { FunctionComponent, useCallback, useState } from \"react\";\nimport { Col, Container } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport {\n  Bar,\n  BarChart,\n  CartesianGrid,\n  Legend,\n  ResponsiveContainer,\n  Tooltip,\n  XAxis,\n  YAxis,\n} from \"recharts\";\nimport { useLanguages, useProviders } from \"../../@redux/hooks\";\nimport { HistoryApi } from \"../../apis\";\nimport {\n  AsyncSelector,\n  ContentHeader,\n  LanguageSelector,\n  PromiseOverlay,\n  Selector,\n} from \"../../components\";\nimport { useAutoUpdate } from \"../../utilites/hooks\";\nimport { actionOptions, timeframeOptions } from \"./options\";\n\nfunction converter(item: History.Stat) {\n  const movies = item.movies.map((v) => ({\n    date: v.date,\n    movies: v.count,\n  }));\n  const series = item.series.map((v) => ({\n    date: v.date,\n    series: v.count,\n  }));\n  const result = merge(movies, series);\n  return result;\n}\n\nconst providerLabel = (item: System.Provider) => item.name;\n\nconst SelectorContainer: FunctionComponent = ({ children }) => (\n  <Col xs={6} lg={3} className=\"p-1\">\n    {children}\n  </Col>\n);\n\nconst HistoryStats: FunctionComponent = () => {\n  const [languages] = useLanguages(true);\n\n  const [providerList, update] = useProviders();\n  useAutoUpdate(update);\n\n  const [timeframe, setTimeframe] = useState<History.TimeframeOptions>(\"month\");\n  const [action, setAction] = useState<Nullable<History.ActionOptions>>(null);\n  const [lang, setLanguage] = useState<Nullable<Language>>(null);\n  const [provider, setProvider] = useState<Nullable<System.Provider>>(null);\n\n  const promise = useCallback(() => {\n    return HistoryApi.stats(\n      timeframe,\n      action ?? undefined,\n      provider?.name,\n      lang?.code2\n    );\n  }, [timeframe, lang?.code2, action, provider]);\n\n  return (\n    // TODO: Responsive\n    <Container fluid className=\"vh-75\">\n      <Helmet>\n        <title>History Statistics - Bazarr</title>\n      </Helmet>\n      <PromiseOverlay promise={promise}>\n        {(data) => (\n          <React.Fragment>\n            <ContentHeader scroll={false}>\n              <SelectorContainer>\n                <Selector\n                  placeholder=\"Time...\"\n                  options={timeframeOptions}\n                  value={timeframe}\n                  onChange={(v) => setTimeframe(v ?? \"month\")}\n                ></Selector>\n              </SelectorContainer>\n              <SelectorContainer>\n                <Selector\n                  placeholder=\"Action...\"\n                  clearable\n                  options={actionOptions}\n                  value={action}\n                  onChange={setAction}\n                ></Selector>\n              </SelectorContainer>\n              <SelectorContainer>\n                <AsyncSelector\n                  placeholder=\"Provider...\"\n                  clearable\n                  state={providerList}\n                  label={providerLabel}\n                  onChange={setProvider}\n                ></AsyncSelector>\n              </SelectorContainer>\n              <SelectorContainer>\n                <LanguageSelector\n                  clearable\n                  options={languages}\n                  value={lang}\n                  onChange={setLanguage}\n                ></LanguageSelector>\n              </SelectorContainer>\n            </ContentHeader>\n            <ResponsiveContainer height=\"100%\">\n              <BarChart data={converter(data)}>\n                <CartesianGrid strokeDasharray=\"4 2\"></CartesianGrid>\n                <XAxis dataKey=\"date\"></XAxis>\n                <YAxis allowDecimals={false}></YAxis>\n                <Tooltip></Tooltip>\n                <Legend verticalAlign=\"top\"></Legend>\n                <Bar name=\"Series\" dataKey=\"series\" fill=\"#2493B6\"></Bar>\n                <Bar name=\"Movies\" dataKey=\"movies\" fill=\"#FFC22F\"></Bar>\n              </BarChart>\n            </ResponsiveContainer>\n          </React.Fragment>\n        )}\n      </PromiseOverlay>\n    </Container>\n  );\n};\n\nexport default HistoryStats;\n","import React, { FunctionComponent } from \"react\";\nimport { Redirect, Route, Switch } from \"react-router-dom\";\nimport { RouterEmptyPath } from \"../404\";\nimport { useIsRadarrEnabled, useIsSonarrEnabled } from \"../@redux/hooks/site\";\nimport MoviesHistory from \"./Movies\";\nimport SeriesHistory from \"./Series\";\nimport HistoryStats from \"./Statistics\";\n\nconst Router: FunctionComponent = () => {\n  const sonarr = useIsSonarrEnabled();\n  const radarr = useIsRadarrEnabled();\n  return (\n    <Switch>\n      {sonarr && (\n        <Route exact path=\"/history/series\">\n          <SeriesHistory></SeriesHistory>\n        </Route>\n      )}\n      {radarr && (\n        <Route exact path=\"/history/movies\">\n          <MoviesHistory></MoviesHistory>\n        </Route>\n      )}\n      <Route exact path=\"/history/stats\">\n        <HistoryStats></HistoryStats>\n      </Route>\n      <Route path=\"/history/*\">\n        <Redirect to={RouterEmptyPath}></Redirect>\n      </Route>\n    </Switch>\n  );\n};\n\nexport default Router;\n","import React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { TableUpdater } from \"react-table\";\nimport { ExtendItemComparer, SharedProps } from \".\";\nimport { useLanguageProfiles } from \"../../@redux/hooks\";\nimport { ItemEditorModal, PageTable, useShowModal } from \"../../components\";\nimport { buildOrderList, GetItemId, useMergeArray } from \"../../utilites\";\n\ninterface Props extends SharedProps {\n  dirtyItems: readonly Item.Base[];\n  editMode: boolean;\n  select: React.Dispatch<Item.Base[]>;\n  update: (ids?: number[]) => void;\n}\n\nconst Table: FunctionComponent<Props> = ({\n  state,\n  dirtyItems,\n  update,\n  modify,\n  editMode,\n  select,\n  columns,\n  loader,\n  name,\n}) => {\n  const showModal = useShowModal();\n\n  const updateRow = useCallback<TableUpdater<Item.Base>>(\n    (row, modalKey: string) => {\n      showModal(modalKey, row.original);\n    },\n    [showModal]\n  );\n\n  const idState = state.data;\n\n  const orderList = useMemo(() => buildOrderList(idState), [idState]);\n\n  const data = useMergeArray(orderList, dirtyItems, ExtendItemComparer);\n\n  const [profiles] = useLanguageProfiles();\n\n  return (\n    <React.Fragment>\n      <PageTable\n        async\n        autoScroll\n        canSelect\n        columns={columns}\n        data={data}\n        asyncState={state}\n        asyncId={GetItemId}\n        asyncLoader={loader}\n        loose={[profiles]}\n        isSelecting={editMode}\n        onSelect={select}\n        emptyText={`No ${name} Found`}\n        externalUpdate={updateRow}\n      ></PageTable>\n      <ItemEditorModal\n        modalKey=\"edit\"\n        submit={modify}\n        onSuccess={(item) => {\n          const id = GetItemId(item);\n          update([id]);\n        }}\n      ></ItemEditorModal>\n    </React.Fragment>\n  );\n};\n\nexport default Table;\n","import { faCheck, faList, faUndo } from \"@fortawesome/free-solid-svg-icons\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Container, Dropdown, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { Column } from \"react-table\";\nimport { useLanguageProfiles } from \"../../@redux/hooks\";\nimport { useReduxActionWith } from \"../../@redux/hooks/base\";\nimport { AsyncActionDispatcher } from \"../../@redux/types\";\nimport { ContentHeader } from \"../../components\";\nimport { GetItemId, isNonNullable, mergeArray } from \"../../utilites\";\nimport Table from \"./table\";\n\nexport interface SharedProps {\n  name: string;\n  loader: (start: number, length: number) => void;\n  columns: Column<Item.Base>[];\n  modify: (form: FormType.ModifyItem) => Promise<void>;\n  state: AsyncState<OrderIdState<Item.Base>>;\n}\n\nexport function ExtendItemComparer(lhs: Item.Base, rhs: Item.Base): boolean {\n  return GetItemId(lhs) === GetItemId(rhs);\n}\n\ninterface Props extends SharedProps {\n  updateAction: (id?: number[]) => AsyncActionDispatcher<any>;\n}\n\nconst BaseItemView: FunctionComponent<Props> = ({\n  updateAction,\n  ...shared\n}) => {\n  const state = shared.state;\n\n  const [pendingEditMode, setPendingEdit] = useState(false);\n  const [editMode, setEdit] = useState(false);\n\n  const onUpdated = useCallback(() => {\n    setPendingEdit((edit) => {\n      // Hack to remove all dependencies\n      setEdit(edit);\n      return edit;\n    });\n    setDirty([]);\n  }, []);\n\n  const update = useReduxActionWith(updateAction, onUpdated);\n\n  const [selections, setSelections] = useState<Item.Base[]>([]);\n  const [dirtyItems, setDirty] = useState<Item.Base[]>([]);\n\n  const [profiles] = useLanguageProfiles();\n\n  const profileOptions = useMemo<JSX.Element[]>(() => {\n    const items: JSX.Element[] = [];\n    items.push(\n      <Dropdown.Item key=\"clear-profile\">Clear Profile</Dropdown.Item>\n    );\n    items.push(<Dropdown.Divider key=\"dropdown-divider\"></Dropdown.Divider>);\n    items.push(\n      ...profiles.map((v) => (\n        <Dropdown.Item key={v.profileId} eventKey={v.profileId.toString()}>\n          {v.name}\n        </Dropdown.Item>\n      ))\n    );\n    return items;\n  }, [profiles]);\n\n  const changeProfiles = useCallback(\n    (key: Nullable<string>) => {\n      const id = key ? parseInt(key) : null;\n      const newItems = selections.map((v) => {\n        const item = { ...v };\n        item.profileId = id;\n        return item;\n      });\n      const newDirty = mergeArray(dirtyItems, newItems, ExtendItemComparer);\n      setDirty(newDirty);\n    },\n    [selections, dirtyItems]\n  );\n\n  const startEdit = useCallback(() => {\n    if (shared.state.data.order.every(isNonNullable)) {\n      setEdit(true);\n    } else {\n      update();\n    }\n    setPendingEdit(true);\n  }, [shared.state.data.order, update]);\n\n  const endEdit = useCallback(\n    (cancel: boolean = false) => {\n      if (!cancel && dirtyItems.length > 0) {\n        const ids = dirtyItems.map(GetItemId);\n        update(ids);\n      } else {\n        setEdit(false);\n        setDirty([]);\n      }\n      setPendingEdit(false);\n      setSelections([]);\n    },\n    [dirtyItems, update]\n  );\n\n  const saveItems = useCallback(() => {\n    const form: FormType.ModifyItem = {\n      id: [],\n      profileid: [],\n    };\n    dirtyItems.forEach((v) => {\n      const id = GetItemId(v);\n      form.id.push(id);\n      form.profileid.push(v.profileId);\n    });\n    return shared.modify(form);\n  }, [dirtyItems, shared]);\n\n  return (\n    <Container fluid>\n      <Helmet>\n        <title>{shared.name} - Bazarr</title>\n      </Helmet>\n      <ContentHeader scroll={false}>\n        {editMode ? (\n          <React.Fragment>\n            <ContentHeader.Group pos=\"start\">\n              <Dropdown onSelect={changeProfiles}>\n                <Dropdown.Toggle\n                  disabled={selections.length === 0}\n                  variant=\"light\"\n                >\n                  Change Profile\n                </Dropdown.Toggle>\n                <Dropdown.Menu>{profileOptions}</Dropdown.Menu>\n              </Dropdown>\n            </ContentHeader.Group>\n            <ContentHeader.Group pos=\"end\">\n              <ContentHeader.Button icon={faUndo} onClick={() => endEdit(true)}>\n                Cancel\n              </ContentHeader.Button>\n              <ContentHeader.AsyncButton\n                icon={faCheck}\n                disabled={dirtyItems.length === 0}\n                promise={saveItems}\n                onSuccess={() => endEdit()}\n              >\n                Save\n              </ContentHeader.AsyncButton>\n            </ContentHeader.Group>\n          </React.Fragment>\n        ) : (\n          <ContentHeader.Button\n            updating={pendingEditMode !== editMode}\n            disabled={state.data.order.length === 0 && state.updating}\n            icon={faList}\n            onClick={startEdit}\n          >\n            Mass Edit\n          </ContentHeader.Button>\n        )}\n      </ContentHeader>\n      <Row>\n        <Table\n          {...shared}\n          update={update}\n          dirtyItems={dirtyItems}\n          editMode={editMode}\n          select={setSelections}\n        ></Table>\n      </Row>\n    </Container>\n  );\n};\n\nexport default BaseItemView;\n","import { faBookmark as farBookmark } from \"@fortawesome/free-regular-svg-icons\";\nimport {\n  faBookmark,\n  faCheck,\n  faExclamationTriangle,\n  faWrench,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useMemo } from \"react\";\nimport { Badge } from \"react-bootstrap\";\nimport { Link } from \"react-router-dom\";\nimport { Column } from \"react-table\";\nimport { movieUpdateByRange, movieUpdateInfoAll } from \"../@redux/actions\";\nimport { useRawMovies } from \"../@redux/hooks\";\nimport { useReduxAction } from \"../@redux/hooks/base\";\nimport { MoviesApi } from \"../apis\";\nimport { ActionBadge } from \"../components\";\nimport BaseItemView from \"../generic/BaseItemView\";\n\ninterface Props {}\n\nconst MovieView: FunctionComponent<Props> = () => {\n  const [movies] = useRawMovies();\n  const load = useReduxAction(movieUpdateByRange);\n  const columns: Column<Item.Movie>[] = useMemo<Column<Item.Movie>[]>(\n    () => [\n      {\n        accessor: \"monitored\",\n        selectHide: true,\n        Cell: ({ value }) => (\n          <FontAwesomeIcon\n            title={value ? \"monitored\" : \"unmonitored\"}\n            icon={value ? faBookmark : farBookmark}\n          ></FontAwesomeIcon>\n        ),\n      },\n      {\n        Header: \"Name\",\n        accessor: \"title\",\n        className: \"text-nowrap\",\n        Cell: ({ row, value, isSelecting: select }) => {\n          if (select) {\n            return value;\n          } else {\n            const target = `/movies/${row.original.radarrId}`;\n            return (\n              <Link to={target} title={row.original.sceneName ?? value}>\n                <span>{value}</span>\n              </Link>\n            );\n          }\n        },\n      },\n      {\n        Header: \"Exist\",\n        accessor: \"exist\",\n        selectHide: true,\n        Cell: ({ row, value }) => {\n          const exist = value;\n          const { path } = row.original;\n          return (\n            <FontAwesomeIcon\n              title={path}\n              icon={exist ? faCheck : faExclamationTriangle}\n            ></FontAwesomeIcon>\n          );\n        },\n      },\n      {\n        Header: \"Audio\",\n        accessor: \"audio_language\",\n        Cell: (row) => {\n          return row.value.map((v) => (\n            <Badge variant=\"secondary\" className=\"mr-2\" key={v.code2}>\n              {v.name}\n            </Badge>\n          ));\n        },\n      },\n      {\n        Header: \"Languages Profile\",\n        accessor: \"profileId\",\n        Cell: ({ value, loose }) => {\n          if (loose) {\n            // Define in generic/BaseItemView/table.tsx\n            const profiles = loose[0] as Profile.Languages[];\n            return profiles.find((v) => v.profileId === value)?.name ?? null;\n          } else {\n            return null;\n          }\n        },\n      },\n      {\n        accessor: \"missing_subtitles\",\n        selectHide: true,\n        Cell: (row) => {\n          const missing = row.value;\n          return missing.map((v) => (\n            <Badge className=\"mx-2\" variant=\"warning\" key={v.code2}>\n              {v.code2}\n            </Badge>\n          ));\n        },\n      },\n      {\n        accessor: \"radarrId\",\n        selectHide: true,\n        Cell: ({ row, externalUpdate }) => (\n          <ActionBadge\n            icon={faWrench}\n            onClick={() => externalUpdate && externalUpdate(row, \"edit\")}\n          ></ActionBadge>\n        ),\n      },\n    ],\n    []\n  );\n\n  return (\n    <BaseItemView\n      state={movies}\n      name=\"Movies\"\n      loader={load}\n      updateAction={movieUpdateInfoAll}\n      columns={columns as Column<Item.Base>[]}\n      modify={(form) => MoviesApi.modify(form)}\n    ></BaseItemView>\n  );\n};\n\nexport default MovieView;\n","import {\n  faCheck,\n  faDownload,\n  faInfoCircle,\n  faTimes,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useEffect,\n  useMemo,\n  useState,\n} from \"react\";\nimport {\n  Badge,\n  Button,\n  Col,\n  Container,\n  Dropdown,\n  OverlayTrigger,\n  Popover,\n  Row,\n} from \"react-bootstrap\";\nimport { Column } from \"react-table\";\nimport {\n  AsyncButton,\n  BaseModal,\n  BaseModalProps,\n  LanguageText,\n  LoadingIndicator,\n  PageTable,\n  usePayload,\n} from \"..\";\nimport { ProvidersApi } from \"../../apis\";\nimport { isMovie } from \"../../utilites\";\n\ntype SupportType = Item.Movie | Item.Episode;\n\ninterface Props {\n  onSelect: (item: SupportType, result: SearchResultType) => Promise<void>;\n  onDownload?: () => void;\n}\n\nexport const ManualSearchModal: FunctionComponent<Props & BaseModalProps> = (\n  props\n) => {\n  const { onSelect, onDownload, ...modal } = props;\n\n  const [result, setResult] = useState<SearchResultType[]>([]);\n  const [searching, setSearch] = useState(false);\n  const [start, setStart] = useState(false);\n\n  const item = usePayload<SupportType>(modal.modalKey);\n\n  const search = useCallback(() => {\n    if (item) {\n      setStart(true);\n      setSearch(true);\n      let promise: Promise<SearchResultType[]>;\n      if (isMovie(item)) {\n        promise = ProvidersApi.movies(item.radarrId);\n      } else {\n        promise = ProvidersApi.episodes(item.sonarrEpisodeId);\n      }\n      promise.then((data) => setResult(data)).finally(() => setSearch(false));\n    }\n  }, [item]);\n\n  const reset = useCallback(() => {\n    setStart(false);\n    setSearch(false);\n  }, []);\n\n  useEffect(() => {\n    if (item) {\n      reset();\n    }\n  }, [item, reset]);\n\n  const columns = useMemo<Column<SearchResultType>[]>(\n    () => [\n      {\n        Header: \"Score\",\n        accessor: (d) => `${d.score}%`,\n      },\n      {\n        accessor: \"language\",\n        Cell: ({ row: { original }, value }) => {\n          const lang: Language = {\n            code2: value,\n            hi: original.hearing_impaired === \"True\",\n            forced: original.forced === \"True\",\n            name: \"\",\n          };\n          return (\n            <Badge variant=\"secondary\">\n              <LanguageText text={lang}></LanguageText>\n            </Badge>\n          );\n        },\n      },\n      {\n        Header: \"Provider\",\n        accessor: \"provider\",\n        Cell: (row) => {\n          const value = row.value;\n          const { url } = row.row.original;\n          if (url) {\n            return (\n              <a href={url} target=\"_blank\" rel=\"noopener noreferrer\">\n                {value}\n              </a>\n            );\n          } else {\n            return value;\n          }\n        },\n      },\n      {\n        Header: \"Release\",\n        accessor: \"release_info\",\n        className: \"text-nowrap\",\n        Cell: (row) => {\n          const value = row.value;\n\n          const items = useMemo(\n            () =>\n              value.slice(1).map((v, idx) => (\n                <Dropdown.Item key={idx} disabled className=\"text-dark\">\n                  {v}\n                </Dropdown.Item>\n              )),\n            [value]\n          );\n\n          if (value.length !== 0) {\n            const display = value[0];\n            return (\n              <Dropdown>\n                <Dropdown.Toggle\n                  disabled={value.length === 1}\n                  className=\"dropdown-hidden text-dark\"\n                  variant={value.length === 1 ? \"link\" : \"light\"}\n                >\n                  {display}\n                </Dropdown.Toggle>\n                <Dropdown.Menu>{items}</Dropdown.Menu>\n              </Dropdown>\n            );\n          } else {\n            return \"Cannot get release info\";\n          }\n        },\n      },\n      {\n        Header: \"Upload\",\n        accessor: (d) => d.uploader ?? \"-\",\n      },\n      {\n        accessor: \"matches\",\n        Cell: (row) => {\n          const { matches, dont_matches } = row.row.original;\n          return <StateIcon matches={matches} dont={dont_matches}></StateIcon>;\n        },\n      },\n      {\n        accessor: \"subtitle\",\n        Cell: ({ row, externalUpdate }) => {\n          const result = row.original;\n          return (\n            <AsyncButton\n              size=\"sm\"\n              variant=\"light\"\n              noReset\n              promise={() => onSelect(item!, result)}\n              onSuccess={() => externalUpdate && externalUpdate(row)}\n            >\n              <FontAwesomeIcon icon={faDownload}></FontAwesomeIcon>\n            </AsyncButton>\n          );\n        },\n      },\n    ],\n    [onSelect, item]\n  );\n\n  const content = useMemo<JSX.Element>(() => {\n    if (!start) {\n      return (\n        <div className=\"px-4 py-5\">\n          <p className=\"mb-3 small\">{item?.path ?? \"\"}</p>\n          <Button variant=\"primary\" block onClick={search}>\n            Start Search\n          </Button>\n        </div>\n      );\n    } else if (searching) {\n      return <LoadingIndicator animation=\"grow\"></LoadingIndicator>;\n    } else {\n      return (\n        <React.Fragment>\n          <p className=\"mb-3 small\">{item?.path ?? \"\"}</p>\n          <PageTable\n            emptyText=\"No Result\"\n            columns={columns}\n            data={result}\n            externalUpdate={onDownload}\n          ></PageTable>\n        </React.Fragment>\n      );\n    }\n  }, [start, searching, columns, result, search, item?.path, onDownload]);\n\n  const footer = useMemo(\n    () => (\n      <Button variant=\"light\" disabled={!start} onClick={reset}>\n        Reset\n      </Button>\n    ),\n    [start, reset]\n  );\n\n  const title = useMemo(() => {\n    let title = \"Unknown\";\n\n    if (item) {\n      if (item.sceneName) {\n        title = item.sceneName;\n      } else if (isMovie(item)) {\n        title = item.title;\n      } else {\n        title = item.title;\n      }\n    }\n    return `Search - ${title}`;\n  }, [item]);\n\n  return (\n    <BaseModal\n      closeable={!searching}\n      size=\"xl\"\n      title={title}\n      footer={footer}\n      {...modal}\n    >\n      {content}\n    </BaseModal>\n  );\n};\n\nconst StateIcon: FunctionComponent<{ matches: string[]; dont: string[] }> = ({\n  matches,\n  dont,\n}) => {\n  let icon = faCheck;\n  let color = \"var(--success)\";\n  if (dont.length > 0) {\n    icon = faInfoCircle;\n    color = \"var(--warning)\";\n  }\n\n  const matchElements = useMemo(\n    () =>\n      matches.map((v, idx) => (\n        <p key={`match-${idx}`} className=\"text-nowrap m-0\">\n          {v}\n        </p>\n      )),\n    [matches]\n  );\n  const dontElements = useMemo(\n    () =>\n      dont.map((v, idx) => (\n        <p key={`dont-${idx}`} className=\"text-nowrap m-0\">\n          {v}\n        </p>\n      )),\n    [dont]\n  );\n\n  const popover = useMemo(\n    () => (\n      <Popover id=\"manual-search-matches-info\">\n        <Popover.Content>\n          <Container fluid>\n            <Row>\n              <Col xs={6}>\n                <FontAwesomeIcon\n                  color=\"var(--success)\"\n                  icon={faCheck}\n                ></FontAwesomeIcon>\n                {matchElements}\n              </Col>\n              <Col xs={6}>\n                <FontAwesomeIcon\n                  color=\"var(--danger)\"\n                  icon={faTimes}\n                ></FontAwesomeIcon>\n                {dontElements}\n              </Col>\n            </Row>\n          </Container>\n        </Popover.Content>\n      </Popover>\n    ),\n    [matchElements, dontElements]\n  );\n\n  return (\n    <OverlayTrigger overlay={popover}>\n      <FontAwesomeIcon icon={icon} color={color}></FontAwesomeIcon>\n    </OverlayTrigger>\n  );\n};\n","import {\n  faClone as fasClone,\n  faFolder,\n} from \"@fortawesome/free-regular-svg-icons\";\nimport {\n  faLanguage,\n  faMusic,\n  faStream,\n  faTags,\n  IconDefinition,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useMemo } from \"react\";\nimport {\n  Badge,\n  Col,\n  Container,\n  Image,\n  OverlayTrigger,\n  Popover,\n  Row,\n} from \"react-bootstrap\";\nimport { useProfileBy, useProfileItems } from \"../@redux/hooks\";\nimport { LanguageText } from \"../components\";\nimport { BuildKey } from \"../utilites\";\n\ninterface Props {\n  item: Item.Base;\n  details?: { icon: IconDefinition; text: string }[];\n}\n\nconst ItemOverview: FunctionComponent<Props> = (props) => {\n  const { item, details } = props;\n\n  const detailBadges = useMemo(() => {\n    const badges: (JSX.Element | null)[] = [];\n    badges.push(\n      <DetailBadge key=\"file-path\" icon={faFolder} desc=\"File Path\">\n        {item.path}\n      </DetailBadge>\n    );\n\n    badges.push(\n      ...(details?.map((val, idx) => (\n        <DetailBadge key={BuildKey(idx, \"detail\", val.text)} icon={val.icon}>\n          {val.text}\n        </DetailBadge>\n      )) ?? [])\n    );\n\n    if (item.tags.length > 0) {\n      badges.push(\n        <DetailBadge key=\"tags\" icon={faTags} desc=\"Tags\">\n          {item.tags.join(\"|\")}\n        </DetailBadge>\n      );\n    }\n\n    return badges;\n  }, [details, item.path, item.tags]);\n\n  const audioBadges = useMemo(\n    () =>\n      item.audio_language.map((v, idx) => (\n        <DetailBadge\n          key={BuildKey(idx, \"audio\", v.code2)}\n          icon={faMusic}\n          desc=\"Audio Language\"\n        >\n          {v.name}\n        </DetailBadge>\n      )),\n    [item.audio_language]\n  );\n\n  const profile = useProfileBy(item.profileId);\n  const profileItems = useProfileItems(profile);\n\n  const languageBadges = useMemo(() => {\n    const badges: (JSX.Element | null)[] = [];\n\n    if (profile) {\n      badges.push(\n        <DetailBadge\n          key=\"language-profile\"\n          icon={faStream}\n          desc=\"Languages Profile\"\n        >\n          {profile.name}\n        </DetailBadge>\n      );\n\n      badges.push(\n        ...profileItems.map((v, idx) => (\n          <DetailBadge\n            key={BuildKey(idx, \"lang\", v.code2)}\n            icon={faLanguage}\n            desc=\"Language\"\n          >\n            <LanguageText long text={v}></LanguageText>\n          </DetailBadge>\n        ))\n      );\n    }\n\n    return badges;\n  }, [profile, profileItems]);\n\n  const alternativePopover = useMemo(\n    () => (\n      <Popover id=\"item-overview-alternative\">\n        <Popover.Title>Alternate Titles</Popover.Title>\n        <Popover.Content>\n          {item.alternativeTitles.map((v, idx) => (\n            <li key={idx}>{v}</li>\n          ))}\n        </Popover.Content>\n      </Popover>\n    ),\n    [item.alternativeTitles]\n  );\n\n  return (\n    <Container\n      fluid\n      style={{\n        backgroundRepeat: \"no-repeat\",\n        backgroundSize: \"cover\",\n        backgroundPosition: \"top center\",\n        backgroundImage: `url('${item.fanart}')`,\n      }}\n    >\n      <Row\n        className=\"p-4 pb-4\"\n        style={{\n          backgroundColor: \"rgba(0,0,0,0.7)\",\n        }}\n      >\n        <Col sm=\"auto\">\n          <Image\n            className=\"d-none d-sm-block my-2\"\n            style={{\n              maxHeight: 250,\n            }}\n            src={item.poster}\n          ></Image>\n        </Col>\n        <Col>\n          <Container fluid className=\"text-white\">\n            <Row>\n              <h1>{item.title}</h1>\n              <span hidden={item.alternativeTitles.length === 0}>\n                <OverlayTrigger overlay={alternativePopover}>\n                  <FontAwesomeIcon\n                    className=\"mx-2\"\n                    icon={fasClone}\n                  ></FontAwesomeIcon>\n                </OverlayTrigger>\n              </span>\n            </Row>\n            <Row>{detailBadges}</Row>\n            <Row>{audioBadges}</Row>\n            <Row>{languageBadges}</Row>\n            <Row>\n              <span>{item.overview}</span>\n            </Row>\n          </Container>\n        </Col>\n      </Row>\n    </Container>\n  );\n};\n\ninterface ItemBadgeProps {\n  icon: IconDefinition;\n  children: string | JSX.Element;\n  desc?: string;\n}\n\nconst DetailBadge: FunctionComponent<ItemBadgeProps> = ({\n  icon,\n  desc,\n  children,\n}) => (\n  <Badge title={desc} variant=\"secondary\" className=\"mr-2 my-1 text-truncate\">\n    <FontAwesomeIcon icon={icon}></FontAwesomeIcon>\n    <span className=\"ml-1\">{children}</span>\n  </Badge>\n);\n\nexport default ItemOverview;\n","import { faSearch, faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useMemo } from \"react\";\nimport { Badge } from \"react-bootstrap\";\nimport { Column } from \"react-table\";\nimport { MoviesApi } from \"../../apis\";\nimport { AsyncButton, LanguageText, SimpleTable } from \"../../components\";\n\nconst missingText = \"Missing Subtitles\";\n\ninterface Props {\n  movie: Item.Movie;\n  update: (id: number) => void;\n}\n\nconst Table: FunctionComponent<Props> = (props) => {\n  const { movie, update } = props;\n\n  const columns: Column<Subtitle>[] = useMemo<Column<Subtitle>[]>(\n    () => [\n      {\n        Header: \"Subtitle Path\",\n        accessor: \"path\",\n        Cell: (row) => {\n          if (row.value === null || row.value.length === 0) {\n            return \"Video File Subtitle Track\";\n          } else if (row.value === missingText) {\n            return <span className=\"text-muted\">{row.value}</span>;\n          } else {\n            return row.value;\n          }\n        },\n      },\n      {\n        Header: \"Language\",\n        accessor: \"name\",\n        Cell: ({ row }) => {\n          if (row.original.path === missingText) {\n            return (\n              <Badge variant=\"primary\">\n                <LanguageText text={row.original} long></LanguageText>\n              </Badge>\n            );\n          } else {\n            return (\n              <Badge variant=\"secondary\">\n                <LanguageText text={row.original} long></LanguageText>\n              </Badge>\n            );\n          }\n        },\n      },\n      {\n        accessor: \"code2\",\n        Cell: (row) => {\n          const { original } = row.row;\n          if (original.path === null || original.path.length === 0) {\n            return null;\n          } else if (original.path === missingText) {\n            return (\n              <AsyncButton\n                promise={() =>\n                  MoviesApi.downloadSubtitles(movie.radarrId, {\n                    language: original.code2,\n                    hi: original.hi,\n                    forced: original.forced,\n                  })\n                }\n                onSuccess={() => update(movie.radarrId)}\n                variant=\"light\"\n                size=\"sm\"\n              >\n                <FontAwesomeIcon icon={faSearch}></FontAwesomeIcon>\n              </AsyncButton>\n            );\n          } else {\n            return (\n              <AsyncButton\n                variant=\"light\"\n                size=\"sm\"\n                promise={() =>\n                  MoviesApi.deleteSubtitles(movie.radarrId, {\n                    language: original.code2,\n                    hi: original.hi,\n                    forced: original.forced,\n                    path: original.path ?? \"\",\n                  })\n                }\n                onSuccess={() => update(movie.radarrId)}\n              >\n                <FontAwesomeIcon icon={faTrash}></FontAwesomeIcon>\n              </AsyncButton>\n            );\n          }\n        },\n      },\n    ],\n    [movie, update]\n  );\n\n  const data: Subtitle[] = useMemo(() => {\n    const missing = movie.missing_subtitles.map((item) => {\n      item.path = missingText;\n      return item;\n    });\n\n    return movie.subtitles.concat(missing);\n  }, [movie.missing_subtitles, movie.subtitles]);\n\n  return (\n    <SimpleTable\n      columns={columns}\n      data={data}\n      emptyText=\"No Subtitles Found For This Movie\"\n    ></SimpleTable>\n  );\n};\n\nexport default Table;\n","import {\n  faCloudUploadAlt,\n  faHistory,\n  faSearch,\n  faSync,\n  faToolbox,\n  faUser,\n  faWrench,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport React, { FunctionComponent, useCallback, useState } from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { Redirect, RouteComponentProps, withRouter } from \"react-router-dom\";\nimport { RouterEmptyPath } from \"../../404\";\nimport { useMovieBy } from \"../../@redux/hooks\";\nimport { MoviesApi, ProvidersApi } from \"../../apis\";\nimport {\n  ContentHeader,\n  ItemEditorModal,\n  LoadingIndicator,\n  MovieHistoryModal,\n  MovieUploadModal,\n  SubtitleToolModal,\n  useShowModal,\n} from \"../../components\";\nimport { ManualSearchModal } from \"../../components/modals/ManualSearchModal\";\nimport ItemOverview from \"../../generic/ItemOverview\";\nimport { useAutoUpdate, useWhenLoadingFinish } from \"../../utilites\";\nimport Table from \"./table\";\n\nconst download = (item: any, result: SearchResultType) => {\n  item = item as Item.Movie;\n  const { language, hearing_impaired, forced, provider, subtitle } = result;\n  return ProvidersApi.downloadMovieSubtitle(item.radarrId, {\n    language,\n    hi: hearing_impaired,\n    forced,\n    provider,\n    subtitle,\n  });\n};\n\ninterface Params {\n  id: string;\n}\n\ninterface Props extends RouteComponentProps<Params> {}\n\nconst MovieDetailView: FunctionComponent<Props> = ({ match }) => {\n  const id = Number.parseInt(match.params.id);\n  const [movie, update] = useMovieBy(id);\n  useAutoUpdate(update);\n  const item = movie.data;\n\n  const showModal = useShowModal();\n\n  const [valid, setValid] = useState(true);\n\n  const validator = useCallback(() => {\n    if (movie.data === null) {\n      setValid(false);\n    }\n  }, [movie.data]);\n\n  useWhenLoadingFinish(movie, validator);\n\n  if (isNaN(id) || !valid) {\n    return <Redirect to={RouterEmptyPath}></Redirect>;\n  }\n\n  if (!item) {\n    return <LoadingIndicator></LoadingIndicator>;\n  }\n\n  const allowEdit = item.profileId !== undefined;\n\n  return (\n    <Container fluid>\n      <Helmet>\n        <title>{item.title} - Bazarr (Movies)</title>\n      </Helmet>\n      <ContentHeader>\n        <ContentHeader.Group pos=\"start\">\n          <ContentHeader.AsyncButton\n            icon={faSync}\n            promise={() =>\n              MoviesApi.action({ action: \"scan-disk\", radarrid: item.radarrId })\n            }\n            onSuccess={update}\n          >\n            Scan Disk\n          </ContentHeader.AsyncButton>\n          <ContentHeader.AsyncButton\n            icon={faSearch}\n            disabled={item.profileId === null}\n            promise={() =>\n              MoviesApi.action({\n                action: \"search-missing\",\n                radarrid: item.radarrId,\n              })\n            }\n            onSuccess={update}\n          >\n            Search\n          </ContentHeader.AsyncButton>\n          <ContentHeader.Button\n            icon={faUser}\n            disabled={item.profileId === null}\n            onClick={() => showModal<Item.Movie>(\"manual-search\", item)}\n          >\n            Manual\n          </ContentHeader.Button>\n          <ContentHeader.Button\n            icon={faHistory}\n            onClick={() => showModal(\"history\", item)}\n          >\n            History\n          </ContentHeader.Button>\n          <ContentHeader.Button\n            icon={faToolbox}\n            onClick={() => showModal(\"tools\", [item])}\n          >\n            Tools\n          </ContentHeader.Button>\n        </ContentHeader.Group>\n\n        <ContentHeader.Group pos=\"end\">\n          <ContentHeader.Button\n            disabled={!allowEdit || item.profileId === null}\n            icon={faCloudUploadAlt}\n            onClick={() => showModal(\"upload\", item)}\n          >\n            Upload\n          </ContentHeader.Button>\n          <ContentHeader.Button\n            icon={faWrench}\n            onClick={() => showModal(\"edit\", item)}\n          >\n            Edit Movie\n          </ContentHeader.Button>\n        </ContentHeader.Group>\n      </ContentHeader>\n      <Row>\n        <ItemOverview item={item} details={[]}></ItemOverview>\n      </Row>\n      <Row>\n        <Table movie={item} update={update}></Table>\n      </Row>\n      <ItemEditorModal\n        modalKey=\"edit\"\n        submit={(form) => MoviesApi.modify(form)}\n        onSuccess={update}\n      ></ItemEditorModal>\n      <SubtitleToolModal\n        modalKey=\"tools\"\n        size=\"lg\"\n        update={update}\n      ></SubtitleToolModal>\n      <MovieHistoryModal modalKey=\"history\" size=\"lg\"></MovieHistoryModal>\n      <MovieUploadModal modalKey=\"upload\" size=\"lg\"></MovieUploadModal>\n      <ManualSearchModal\n        modalKey=\"manual-search\"\n        onDownload={update}\n        onSelect={download}\n      ></ManualSearchModal>\n    </Container>\n  );\n};\n\nexport default withRouter(MovieDetailView);\n","import React, { FunctionComponent } from \"react\";\nimport { Route, Switch } from \"react-router-dom\";\nimport Movie from \".\";\nimport MovieDetail from \"./Detail\";\n\ninterface Props {}\n\nconst Router: FunctionComponent<Props> = () => {\n  return (\n    <Switch>\n      <Route exact path=\"/movies\">\n        <Movie></Movie>\n      </Route>\n      <Route path=\"/movies/:id\">\n        <MovieDetail></MovieDetail>\n      </Route>\n    </Switch>\n  );\n};\n\nexport default Router;\n","import {\n  faCheck,\n  faExclamationTriangle,\n  faWrench,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useMemo } from \"react\";\nimport { Badge, ProgressBar } from \"react-bootstrap\";\nimport { Link } from \"react-router-dom\";\nimport { Column } from \"react-table\";\nimport { seriesUpdateByRange, seriesUpdateInfoAll } from \"../@redux/actions\";\nimport { useRawSeries } from \"../@redux/hooks\";\nimport { useReduxAction } from \"../@redux/hooks/base\";\nimport { SeriesApi } from \"../apis\";\nimport { ActionBadge } from \"../components\";\nimport BaseItemView from \"../generic/BaseItemView\";\n\ninterface Props {}\n\nconst SeriesView: FunctionComponent<Props> = () => {\n  const [series] = useRawSeries();\n  const load = useReduxAction(seriesUpdateByRange);\n  const columns: Column<Item.Series>[] = useMemo<Column<Item.Series>[]>(\n    () => [\n      {\n        Header: \"Name\",\n        accessor: \"title\",\n        className: \"text-nowrap\",\n        Cell: ({ row, value, isSelecting: select }) => {\n          if (select) {\n            return value;\n          } else {\n            const target = `/series/${row.original.sonarrSeriesId}`;\n            return (\n              <Link to={target}>\n                <span>{value}</span>\n              </Link>\n            );\n          }\n        },\n      },\n      {\n        Header: \"Exist\",\n        accessor: \"exist\",\n        selectHide: true,\n        Cell: (row) => {\n          const exist = row.value;\n          const { path } = row.row.original;\n          return (\n            <FontAwesomeIcon\n              title={path}\n              icon={exist ? faCheck : faExclamationTriangle}\n            ></FontAwesomeIcon>\n          );\n        },\n      },\n      {\n        Header: \"Audio\",\n        accessor: \"audio_language\",\n        Cell: (row) => {\n          return row.value.map((v) => (\n            <Badge variant=\"secondary\" className=\"mr-2\" key={v.code2}>\n              {v.name}\n            </Badge>\n          ));\n        },\n      },\n      {\n        Header: \"Languages Profile\",\n        accessor: \"profileId\",\n        Cell: ({ value, loose }) => {\n          if (loose) {\n            // Define in generic/BaseItemView/table.tsx\n            const profiles = loose[0] as Profile.Languages[];\n            return profiles.find((v) => v.profileId === value)?.name ?? null;\n          } else {\n            return null;\n          }\n        },\n      },\n      {\n        Header: \"Episodes\",\n        accessor: \"episodeFileCount\",\n        selectHide: true,\n        Cell: (row) => {\n          const {\n            episodeFileCount,\n            episodeMissingCount,\n            profileId,\n          } = row.row.original;\n          let progress = 0;\n          let label = \"\";\n          if (episodeFileCount === 0 || !profileId) {\n            progress = 0.0;\n          } else {\n            progress = episodeFileCount - episodeMissingCount;\n            label = `${\n              episodeFileCount - episodeMissingCount\n            }/${episodeFileCount}`;\n          }\n\n          const color = episodeMissingCount === 0 ? \"primary\" : \"warning\";\n\n          return (\n            <ProgressBar\n              className=\"my-a\"\n              variant={color}\n              min={0}\n              max={episodeFileCount}\n              now={progress}\n              label={label}\n            ></ProgressBar>\n          );\n        },\n      },\n      {\n        accessor: \"sonarrSeriesId\",\n        selectHide: true,\n        Cell: ({ row, externalUpdate }) => (\n          <ActionBadge\n            icon={faWrench}\n            onClick={() => {\n              externalUpdate && externalUpdate(row, \"edit\");\n            }}\n          ></ActionBadge>\n        ),\n      },\n    ],\n    []\n  );\n\n  return (\n    <BaseItemView\n      state={series}\n      name=\"Series\"\n      updateAction={seriesUpdateInfoAll}\n      loader={load}\n      columns={columns as Column<Item.Base>[]}\n      modify={(form) => SeriesApi.modify(form)}\n    ></BaseItemView>\n  );\n};\n\nexport default SeriesView;\n","import { faSearch, faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent } from \"react\";\nimport { Badge } from \"react-bootstrap\";\nimport { useSerieBy } from \"../../@redux/hooks\";\nimport { EpisodesApi } from \"../../apis\";\nimport { AsyncButton, LanguageText } from \"../../components\";\n\ninterface Props {\n  seriesid: number;\n  episodeid: number;\n  missing?: boolean;\n  subtitle: Subtitle;\n}\n\nexport const SubtitleAction: FunctionComponent<Props> = ({\n  seriesid,\n  episodeid,\n  missing,\n  subtitle,\n}) => {\n  const { hi, forced } = subtitle;\n\n  const [, update] = useSerieBy(seriesid);\n\n  const path = subtitle.path;\n\n  if (missing || path) {\n    return (\n      <AsyncButton\n        promise={() => {\n          if (missing) {\n            return EpisodesApi.downloadSubtitles(seriesid, episodeid, {\n              hi,\n              forced,\n              language: subtitle.code2,\n            });\n          } else if (path) {\n            return EpisodesApi.deleteSubtitles(seriesid, episodeid, {\n              hi,\n              forced,\n              path: path,\n              language: subtitle.code2,\n            });\n          } else {\n            return null;\n          }\n        }}\n        onSuccess={update}\n        as={Badge}\n        className=\"mr-1\"\n        variant={missing ? \"primary\" : \"secondary\"}\n      >\n        <LanguageText className=\"pr-1\" text={subtitle}></LanguageText>\n        <FontAwesomeIcon\n          size=\"sm\"\n          icon={missing ? faSearch : faTrash}\n        ></FontAwesomeIcon>\n      </AsyncButton>\n    );\n  } else {\n    return (\n      <Badge className=\"mr-1\" variant=\"secondary\">\n        <LanguageText text={subtitle} long={false}></LanguageText>\n      </Badge>\n    );\n  }\n};\n","import { faBookmark as farBookmark } from \"@fortawesome/free-regular-svg-icons\";\nimport {\n  faBookmark,\n  faBriefcase,\n  faHistory,\n  faUser,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { Badge, ButtonGroup } from \"react-bootstrap\";\nimport { Column, TableOptions, TableUpdater } from \"react-table\";\nimport { ProvidersApi } from \"../../apis\";\nimport {\n  ActionButton,\n  AsyncStateOverlay,\n  EpisodeHistoryModal,\n  GroupTable,\n  SubtitleToolModal,\n  useShowModal,\n} from \"../../components\";\nimport { ManualSearchModal } from \"../../components/modals/ManualSearchModal\";\nimport { BuildKey } from \"../../utilites\";\nimport { SubtitleAction } from \"./components\";\n\ninterface Props {\n  episodes: AsyncState<Item.Episode[]>;\n  update: () => void;\n}\n\nconst download = (item: any, result: SearchResultType) => {\n  item = item as Item.Episode;\n  const { language, hearing_impaired, forced, provider, subtitle } = result;\n  return ProvidersApi.downloadEpisodeSubtitle(\n    item.sonarrSeriesId,\n    item.sonarrEpisodeId,\n    {\n      language,\n      hi: hearing_impaired,\n      forced,\n      provider,\n      subtitle,\n    }\n  );\n};\n\nconst Table: FunctionComponent<Props> = ({ episodes, update }) => {\n  const showModal = useShowModal();\n\n  const columns: Column<Item.Episode>[] = useMemo<Column<Item.Episode>[]>(\n    () => [\n      {\n        accessor: \"monitored\",\n        Cell: (row) => {\n          return (\n            <FontAwesomeIcon\n              title={row.value ? \"monitored\" : \"unmonitored\"}\n              icon={row.value ? faBookmark : farBookmark}\n            ></FontAwesomeIcon>\n          );\n        },\n      },\n      {\n        accessor: \"season\",\n        Cell: (row) => {\n          return `Season ${row.value}`;\n        },\n      },\n      {\n        Header: \"Episode\",\n        accessor: \"episode\",\n      },\n      {\n        Header: \"Title\",\n        accessor: \"title\",\n        className: \"text-nowrap\",\n      },\n      {\n        Header: \"Audio\",\n        accessor: \"audio_language\",\n        Cell: (row) => {\n          return row.value.map((v) => (\n            <Badge variant=\"secondary\" key={v.code2}>\n              {v.name}\n            </Badge>\n          ));\n        },\n      },\n      {\n        Header: \"Subtitles\",\n        accessor: \"missing_subtitles\",\n        Cell: ({ row }) => {\n          const episode = row.original;\n\n          const seriesid = episode.sonarrSeriesId;\n\n          const elements = useMemo(() => {\n            const episodeid = episode.sonarrEpisodeId;\n\n            const missing = episode.missing_subtitles.map((val, idx) => (\n              <SubtitleAction\n                missing\n                key={BuildKey(idx, val.code2, \"missing\")}\n                seriesid={seriesid}\n                episodeid={episodeid}\n                subtitle={val}\n              ></SubtitleAction>\n            ));\n\n            const existing = episode.subtitles.filter(\n              (val) =>\n                episode.missing_subtitles.findIndex(\n                  (v) => v.code2 === val.code2\n                ) === -1\n            );\n\n            const subtitles = existing.map((val, idx) => (\n              <SubtitleAction\n                key={BuildKey(idx, val.code2, \"valid\")}\n                seriesid={seriesid}\n                episodeid={episodeid}\n                subtitle={val}\n              ></SubtitleAction>\n            ));\n\n            return [...missing, ...subtitles];\n          }, [episode, seriesid]);\n\n          return elements;\n        },\n      },\n      {\n        Header: \"Actions\",\n        accessor: \"sonarrEpisodeId\",\n        Cell: ({ row, externalUpdate }) => {\n          return (\n            <ButtonGroup>\n              <ActionButton\n                icon={faUser}\n                onClick={() => {\n                  externalUpdate && externalUpdate(row, \"manual-search\");\n                }}\n              ></ActionButton>\n              <ActionButton\n                icon={faHistory}\n                onClick={() => {\n                  externalUpdate && externalUpdate(row, \"history\");\n                }}\n              ></ActionButton>\n              <ActionButton\n                icon={faBriefcase}\n                onClick={() => {\n                  externalUpdate && externalUpdate(row, \"tools\");\n                }}\n              ></ActionButton>\n            </ButtonGroup>\n          );\n        },\n      },\n    ],\n    []\n  );\n\n  const updateRow = useCallback<TableUpdater<Item.Episode>>(\n    (row, modalKey: string) => {\n      if (modalKey === \"tools\") {\n        showModal(modalKey, [row.original]);\n      } else {\n        showModal(modalKey, row.original);\n      }\n    },\n    [showModal]\n  );\n\n  const maxSeason = useMemo(\n    () =>\n      episodes.data.reduce<number>(\n        (prev, curr) => Math.max(prev, curr.season),\n        0\n      ),\n    [episodes]\n  );\n\n  const options: TableOptions<Item.Episode> = useMemo(() => {\n    return {\n      columns,\n      data: episodes.data,\n      externalUpdate: updateRow,\n      initialState: {\n        sortBy: [\n          { id: \"season\", desc: true },\n          { id: \"episode\", desc: true },\n        ],\n        groupBy: [\"season\"],\n        expanded: {\n          [`season:${maxSeason}`]: true,\n        },\n      },\n    };\n  }, [episodes, columns, maxSeason, updateRow]);\n\n  return (\n    <React.Fragment>\n      <AsyncStateOverlay state={episodes}>\n        {() => (\n          <GroupTable\n            emptyText=\"No Episode Found For This Series\"\n            {...options}\n          ></GroupTable>\n        )}\n      </AsyncStateOverlay>\n      <SubtitleToolModal\n        modalKey=\"tools\"\n        size=\"lg\"\n        update={update}\n      ></SubtitleToolModal>\n      <EpisodeHistoryModal modalKey=\"history\" size=\"lg\"></EpisodeHistoryModal>\n      <ManualSearchModal\n        modalKey=\"manual-search\"\n        onDownload={update}\n        onSelect={download}\n      ></ManualSearchModal>\n    </React.Fragment>\n  );\n};\n\nexport default Table;\n","import {\n  faAdjust,\n  faBriefcase,\n  faCloudUploadAlt,\n  faHdd,\n  faSearch,\n  faSync,\n  faWrench,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { Redirect, RouteComponentProps, withRouter } from \"react-router-dom\";\nimport { RouterEmptyPath } from \"../../404\";\nimport { useEpisodesBy, useSerieBy } from \"../../@redux/hooks\";\nimport { SeriesApi } from \"../../apis\";\nimport {\n  ContentHeader,\n  ItemEditorModal,\n  LoadingIndicator,\n  SeriesUploadModal,\n  useShowModal,\n} from \"../../components\";\nimport ItemOverview from \"../../generic/ItemOverview\";\nimport { useAutoUpdate, useWhenLoadingFinish } from \"../../utilites\";\nimport Table from \"./table\";\n\ninterface Params {\n  id: string;\n}\n\ninterface Props extends RouteComponentProps<Params> {}\n\nconst SeriesEpisodesView: FunctionComponent<Props> = (props) => {\n  const { match } = props;\n  const id = Number.parseInt(match.params.id);\n  const [serie, update] = useSerieBy(id);\n  const item = serie.data;\n\n  const [episodes] = useEpisodesBy(serie.data?.sonarrSeriesId);\n\n  useAutoUpdate(update);\n\n  const available = episodes.data.length !== 0;\n\n  const details = useMemo(\n    () => [\n      {\n        icon: faHdd,\n        text: `${item?.episodeFileCount} files`,\n      },\n      {\n        icon: faAdjust,\n        text: item?.seriesType ?? \"\",\n      },\n    ],\n    [item]\n  );\n\n  const showModal = useShowModal();\n\n  const [valid, setValid] = useState(true);\n\n  const validator = useCallback(() => {\n    if (serie.data === null) {\n      setValid(false);\n    }\n  }, [serie.data]);\n\n  useWhenLoadingFinish(serie, validator);\n\n  if (isNaN(id) || !valid) {\n    return <Redirect to={RouterEmptyPath}></Redirect>;\n  }\n\n  if (!item) {\n    return <LoadingIndicator></LoadingIndicator>;\n  }\n\n  return (\n    <Container fluid>\n      <Helmet>\n        <title>{item.title} - Bazarr (Series)</title>\n      </Helmet>\n      <ContentHeader>\n        <ContentHeader.Group pos=\"start\">\n          <ContentHeader.AsyncButton\n            icon={faSync}\n            disabled={!available}\n            promise={() =>\n              SeriesApi.action({ action: \"scan-disk\", seriesid: id })\n            }\n            onSuccess={update}\n          >\n            Scan Disk\n          </ContentHeader.AsyncButton>\n          <ContentHeader.AsyncButton\n            icon={faSearch}\n            promise={() =>\n              SeriesApi.action({ action: \"search-missing\", seriesid: id })\n            }\n            onSuccess={update}\n            disabled={\n              item.episodeFileCount === 0 ||\n              item.profileId === null ||\n              !available\n            }\n          >\n            Search\n          </ContentHeader.AsyncButton>\n        </ContentHeader.Group>\n        <ContentHeader.Group pos=\"end\">\n          <ContentHeader.Button\n            disabled={item.episodeFileCount === 0 || !available}\n            icon={faBriefcase}\n            onClick={() => showModal(\"tools\", episodes.data)}\n          >\n            Tools\n          </ContentHeader.Button>\n          <ContentHeader.Button\n            disabled={\n              item.episodeFileCount === 0 ||\n              item.profileId === null ||\n              !available\n            }\n            icon={faCloudUploadAlt}\n            onClick={() => showModal(\"upload\", item)}\n          >\n            Upload\n          </ContentHeader.Button>\n          <ContentHeader.Button\n            icon={faWrench}\n            onClick={() => showModal(\"edit\", item)}\n          >\n            Edit Series\n          </ContentHeader.Button>\n        </ContentHeader.Group>\n      </ContentHeader>\n      <Row>\n        <ItemOverview item={item} details={details}></ItemOverview>\n      </Row>\n      <Row>\n        <Table episodes={episodes} update={update}></Table>\n      </Row>\n      <ItemEditorModal\n        modalKey=\"edit\"\n        submit={(form) => SeriesApi.modify(form)}\n        onSuccess={update}\n      ></ItemEditorModal>\n      <SeriesUploadModal modalKey=\"upload\"></SeriesUploadModal>\n    </Container>\n  );\n};\n\nexport default withRouter(SeriesEpisodesView);\n","import React, { FunctionComponent } from \"react\";\nimport { Route, Switch } from \"react-router-dom\";\nimport Series from \".\";\nimport Episodes from \"./Episodes\";\n\ninterface Props {}\n\nconst Router: FunctionComponent<Props> = () => {\n  return (\n    <Switch>\n      <Route exact path=\"/series\">\n        <Series></Series>\n      </Route>\n      <Route path=\"/series/:id\">\n        <Episodes></Episodes>\n      </Route>\n    </Switch>\n  );\n};\n\nexport default Router;\n","export const enabledLanguageKey = \"languages-enabled\";\nexport const languageProfileKey = \"languages-profiles\";\nexport const notificationsKey = \"notifications-providers\";\n\nexport const pathMappingsKey = \"settings-general-path_mappings\";\nexport const pathMappingsMovieKey = \"settings-general-path_mappings_movie\";\n\nexport const seriesEnabledKey = \"settings-general-use_sonarr\";\nexport const moviesEnabledKey = \"settings-general-use_radarr\";\n","import { faSave } from \"@fortawesome/free-solid-svg-icons\";\nimport { merge } from \"lodash\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useEffect,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { Prompt } from \"react-router\";\nimport {\n  siteSaveLocalstorage,\n  systemUpdateSettingsAll,\n} from \"../../@redux/actions\";\nimport { useReduxAction, useReduxActionWith } from \"../../@redux/hooks/base\";\nimport { SystemApi } from \"../../apis\";\nimport { ContentHeader } from \"../../components\";\nimport { log } from \"../../utilites/logger\";\nimport {\n  enabledLanguageKey,\n  languageProfileKey,\n  notificationsKey,\n} from \"../keys\";\n\ntype SettingDispatcher = Record<string, (settings: LooseObject) => void>;\n\nexport const StagedChangesContext = React.createContext<\n  SimpleStateType<LooseObject>\n>([{}, () => {}]);\n\nfunction submitHooks(settings: LooseObject) {\n  if (languageProfileKey in settings) {\n    const item = settings[languageProfileKey];\n    settings[languageProfileKey] = JSON.stringify(item);\n  }\n\n  if (enabledLanguageKey in settings) {\n    const item = settings[enabledLanguageKey] as Language[];\n    settings[enabledLanguageKey] = item.map((v) => v.code2);\n  }\n\n  if (notificationsKey in settings) {\n    const item = settings[notificationsKey] as Settings.NotificationInfo[];\n    settings[notificationsKey] = item.map((v) => JSON.stringify(v));\n  }\n}\n\ninterface Props {\n  title: string;\n  children: JSX.Element | JSX.Element[];\n}\n\nconst SettingsProvider: FunctionComponent<Props> = (props) => {\n  const { children, title } = props;\n\n  const updateStorage = useReduxAction(siteSaveLocalstorage);\n\n  const [stagedChange, setChange] = useState<LooseObject>({});\n  const [updating, setUpdating] = useState(false);\n  const [dispatcher, setDispatcher] = useState<SettingDispatcher>({});\n\n  const cleanup = useCallback(() => {\n    setChange({});\n    setUpdating(false);\n  }, []);\n\n  const update = useReduxActionWith(systemUpdateSettingsAll, cleanup);\n\n  const saveSettings = useCallback(\n    (settings: LooseObject) => {\n      submitHooks(settings);\n      setUpdating(true);\n      log(\"info\", \"submitting settings\", settings);\n      SystemApi.setSettings(settings).finally(update);\n    },\n    [update]\n  );\n\n  const saveLocalStorage = useCallback(\n    (settings: LooseObject) => {\n      updateStorage(settings);\n      setChange({});\n    },\n    [updateStorage]\n  );\n\n  useEffect(() => {\n    // Update dispatch\n    const newDispatch: SettingDispatcher = {};\n    newDispatch[\"__default__\"] = saveSettings;\n    newDispatch[\"storage\"] = saveLocalStorage;\n    setDispatcher(newDispatch);\n  }, [saveSettings, saveLocalStorage]);\n\n  const defaultDispatcher = useMemo(() => dispatcher[\"__default__\"], [\n    dispatcher,\n  ]);\n\n  const submit = useCallback(() => {\n    const dispatchMaps = new Map<string, LooseObject>();\n\n    // Separate settings by key\n    for (const key in stagedChange) {\n      const keys = key.split(\"-\");\n      const firstKey = keys[0];\n      if (firstKey.length === 0) {\n        continue;\n      }\n\n      const object = dispatchMaps.get(firstKey);\n      if (object) {\n        object[key] = stagedChange[key];\n      } else {\n        dispatchMaps.set(firstKey, { [key]: stagedChange[key] });\n      }\n    }\n\n    let lostValues = {};\n\n    dispatchMaps.forEach((v, k) => {\n      if (k in dispatcher) {\n        dispatcher[k](v);\n      } else {\n        lostValues = merge(lostValues, v);\n      }\n    });\n    // send to default dispatcher\n    defaultDispatcher(lostValues);\n  }, [stagedChange, dispatcher, defaultDispatcher]);\n\n  return (\n    <Container fluid>\n      <Helmet>\n        <title>{title}</title>\n      </Helmet>\n      <Prompt\n        when={Object.keys(stagedChange).length > 0}\n        message=\"You have unsaved changes, are you sure you want to leave?\"\n      ></Prompt>\n      <ContentHeader>\n        <ContentHeader.Button\n          icon={faSave}\n          updating={updating}\n          disabled={Object.keys(stagedChange).length === 0}\n          onClick={submit}\n        >\n          Save\n        </ContentHeader.Button>\n      </ContentHeader>\n      <StagedChangesContext.Provider value={[stagedChange, setChange]}>\n        <Row className=\"p-4\">\n          <Container>{children}</Container>\n        </Row>\n      </StagedChangesContext.Provider>\n    </Container>\n  );\n};\n\nexport default SettingsProvider;\n","import { isArray, isEqual } from \"lodash\";\nimport { useCallback, useContext, useMemo } from \"react\";\nimport { useStore } from \"react-redux\";\nimport { useSystemSettings } from \"../../@redux/hooks\";\nimport { mergeArray } from \"../../utilites\";\nimport { log } from \"../../utilites/logger\";\nimport { StagedChangesContext } from \"./provider\";\n\nexport function useStagedValues(): LooseObject {\n  const [values] = useContext(StagedChangesContext);\n  return values;\n}\n\nexport function useSingleUpdate() {\n  const [, update] = useContext(StagedChangesContext);\n  return useCallback(\n    (v: any, key: string) => {\n      update((staged) => {\n        const changes = { ...staged };\n        changes[key] = v;\n\n        log(\"info\", \"stage settings\", changes);\n\n        return changes;\n      });\n    },\n    [update]\n  );\n}\n\nexport function useMultiUpdate() {\n  const [, update] = useContext(StagedChangesContext);\n  return useCallback(\n    (obj: LooseObject) => {\n      update((staged) => {\n        const changes = { ...staged, ...obj };\n\n        log(\"info\", \"stage settings\", changes);\n\n        return changes;\n      });\n    },\n    [update]\n  );\n}\n\ntype ValidateFuncType<T> = (v: any) => v is T;\n\nexport type OverrideFuncType<T> = (settings: Settings, store: ReduxStore) => T;\n\nexport function useExtract<T>(\n  key: string,\n  validate: ValidateFuncType<T>,\n  override?: OverrideFuncType<T>\n): Readonly<Nullable<T>> {\n  const [systemSettings] = useSystemSettings();\n  const settings = systemSettings.data;\n\n  const store = useStore<ReduxStore>();\n\n  const extractValue = useMemo(() => {\n    let value: Nullable<T> = null;\n\n    if (settings === undefined) {\n      return value;\n    }\n\n    let path = key.split(\"-\");\n\n    if (path[0] !== \"settings\") {\n      return null;\n    } else {\n      path = path.slice(0);\n    }\n\n    let item: LooseObject = settings;\n    for (const key of path) {\n      if (key in item) {\n        item = item[key];\n      }\n\n      if (validate(item)) {\n        value = item;\n        break;\n      }\n    }\n\n    return value;\n  }, [key, settings, validate]);\n\n  if (override && settings !== undefined) {\n    // TODO: Temporarily override\n    return override(settings, store.getState());\n  } else {\n    return extractValue;\n  }\n}\n\nexport function useUpdateArray<T>(\n  key: string,\n  compare?: (one: T, another: T) => boolean\n) {\n  const update = useSingleUpdate();\n  const stagedValue = useStagedValues();\n\n  if (compare === undefined) {\n    compare = isEqual;\n  }\n\n  const staged: T[] = useMemo(() => {\n    if (key in stagedValue) {\n      return stagedValue[key];\n    } else {\n      return [];\n    }\n  }, [key, stagedValue]);\n\n  return useCallback(\n    (v: T) => {\n      const newArray = [...staged];\n      const idx = newArray.findIndex((inn) => compare!(inn, v));\n      if (idx !== -1) {\n        newArray[idx] = v;\n      } else {\n        newArray.push(v);\n      }\n      update(newArray, key);\n    },\n    [compare, staged, key, update]\n  );\n}\n\nexport function useLatest<T>(\n  key: string,\n  validate: ValidateFuncType<T>,\n  override?: OverrideFuncType<T>\n): Readonly<Nullable<T>> {\n  const extractValue = useExtract<T>(key, validate, override);\n  const stagedValue = useStagedValues();\n  if (key in stagedValue) {\n    return stagedValue[key] as T;\n  } else {\n    return extractValue;\n  }\n}\n\n// Merge Two Array\nexport function useLatestMergeArray<T>(\n  key: string,\n  compare: Comparer<T>,\n  override?: OverrideFuncType<T[]>\n): Readonly<Nullable<T[]>> {\n  const extractValue = useExtract<T[]>(key, isArray, override);\n  const stagedValue = useStagedValues();\n\n  if (compare === undefined) {\n    compare = isEqual;\n  }\n\n  let staged: T[] | undefined = undefined;\n  if (key in stagedValue) {\n    staged = stagedValue[key];\n  }\n\n  return useMemo(() => {\n    if (staged !== undefined && extractValue) {\n      return mergeArray(extractValue, staged, compare);\n    } else {\n      return extractValue;\n    }\n  }, [extractValue, staged, compare]);\n}\n","import React, {\n  Dispatch,\n  FunctionComponent,\n  useContext,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Collapse } from \"react-bootstrap\";\n\ntype SupportType = string | boolean;\n\nconst CollapseContext = React.createContext<\n  [SupportType, Dispatch<SupportType>]\n>([\"\", (s) => {}]);\nconst CollapseUpdateContext = React.createContext<Dispatch<SupportType>>(\n  (s) => {}\n);\n\nexport function useCollapse() {\n  return useContext(CollapseUpdateContext);\n}\n\ninterface CollapseBoxType {\n  Control: typeof CollapseBoxControl;\n  Content: typeof CollapseBoxContent;\n}\n\nconst CollapseBox: CollapseBoxType & FunctionComponent = ({ children }) => {\n  const state = useState<boolean | string>(false);\n\n  return (\n    <CollapseContext.Provider value={state}>\n      {children}\n    </CollapseContext.Provider>\n  );\n};\n\nconst CollapseBoxControl: FunctionComponent = ({ children }) => {\n  const context = useContext(CollapseContext);\n  return (\n    <CollapseUpdateContext.Provider value={context[1]}>\n      {children}\n    </CollapseUpdateContext.Provider>\n  );\n};\n\ninterface ContentProps {\n  on?: (k: string) => boolean;\n  eventKey?: string;\n  indent?: boolean;\n  children: JSX.Element | JSX.Element[];\n}\n\nconst CollapseBoxContent: FunctionComponent<ContentProps> = ({\n  on,\n  eventKey,\n  indent,\n  children,\n}) => {\n  const [value] = useContext(CollapseContext);\n\n  const open = useMemo(() => {\n    if (on && typeof value === \"string\") {\n      return on(value);\n    } else if (eventKey) {\n      return value === eventKey;\n    } else {\n      return value === true;\n    }\n  }, [on, value, eventKey]);\n\n  return (\n    <Collapse in={open} className={indent === false ? undefined : \"pl-4\"}>\n      <div>{children}</div>\n    </Collapse>\n  );\n};\n\nCollapseBox.Control = CollapseBoxControl;\nCollapseBox.Content = CollapseBoxContent;\n\nexport default CollapseBox;\n","import { faPlus } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent } from \"react\";\nimport { Card as BSCard, Col, Form, Row } from \"react-bootstrap\";\nimport \"./style.scss\";\n\ninterface GroupProps {\n  header: string;\n  hidden?: boolean;\n}\n\nexport const Group: FunctionComponent<GroupProps> = ({\n  header,\n  hidden,\n  children,\n}) => {\n  return (\n    <Row hidden={hidden} className=\"flex-column mt-3\">\n      <Col>\n        <h4>{header}</h4>\n        <hr></hr>\n      </Col>\n      <Col>{children}</Col>\n    </Row>\n  );\n};\n\nexport interface InputProps {\n  name?: string;\n  hidden?: boolean;\n}\n\nexport const Input: FunctionComponent<InputProps> = ({\n  children,\n  name,\n  hidden,\n}) => {\n  return (\n    <Form.Group hidden={hidden}>\n      {name && <Form.Label>{name}</Form.Label>}\n      {children}\n    </Form.Group>\n  );\n};\n\ninterface CardProps {\n  header?: string;\n  subheader?: string;\n  plus?: boolean;\n  onClick?: () => void;\n}\n\nexport const ColCard: FunctionComponent<CardProps> = (props) => {\n  return (\n    <Col className=\"p-2\" xs={6} lg={4}>\n      <Card {...props}></Card>\n    </Col>\n  );\n};\n\nexport const Card: FunctionComponent<CardProps> = ({\n  header,\n  subheader,\n  plus,\n  onClick,\n}) => {\n  return (\n    <BSCard className=\"settings-card\" onClick={() => onClick && onClick()}>\n      {plus ? (\n        <BSCard.Body className=\"d-flex justify-content-center align-items-center\">\n          <FontAwesomeIcon size=\"2x\" icon={faPlus}></FontAwesomeIcon>\n        </BSCard.Body>\n      ) : (\n        <BSCard.Body>\n          <BSCard.Title className=\"text-nowrap text-truncate\">\n            {header}\n          </BSCard.Title>\n          <BSCard.Subtitle\n            hidden={subheader === undefined}\n            className=\"small text-nowrap text-truncate\"\n          >\n            {subheader}\n          </BSCard.Subtitle>\n        </BSCard.Body>\n      )}\n    </BSCard>\n  );\n};\n","import { isArray, isBoolean, isNull, isNumber, isString } from \"lodash\";\nimport React, { FunctionComponent, useEffect } from \"react\";\nimport {\n  Button as BSButton,\n  ButtonProps as BSButtonProps,\n  Form,\n} from \"react-bootstrap\";\nimport { useCollapse, useLatest } from \".\";\nimport {\n  Chips as CChips,\n  ChipsProps as CChipsProps,\n  Selector as CSelector,\n  SelectorProps as CSelectorProps,\n  Slider as CSlider,\n  SliderProps as CSliderProps,\n} from \"../../components\";\nimport { isReactText } from \"../../utilites\";\nimport { OverrideFuncType, useSingleUpdate } from \"./hooks\";\n\nexport const Message: FunctionComponent<{\n  type?: \"warning\" | \"info\";\n}> = ({ type, children }) => {\n  const cls = [\"pr-4\"];\n  cls.push(type === \"warning\" ? \"text-warning\" : \"text-muted\");\n\n  return <Form.Text className={cls.join(\" \")}>{children}</Form.Text>;\n};\n\nexport interface BaseInput<T> {\n  disabled?: boolean;\n  settingKey: string;\n  override?: OverrideFuncType<T>;\n  beforeStaged?: (v: T) => any;\n}\n\nexport interface TextProps extends BaseInput<React.ReactText> {\n  placeholder?: React.ReactText;\n  password?: boolean;\n  controlled?: boolean;\n}\n\nexport const Text: FunctionComponent<TextProps> = ({\n  placeholder,\n  disabled,\n  beforeStaged,\n  controlled,\n  override,\n  password,\n  settingKey,\n}) => {\n  const value = useLatest<React.ReactText>(settingKey, isReactText, override);\n\n  const update = useSingleUpdate();\n  const collapse = useCollapse();\n\n  return (\n    <Form.Control\n      type={password ? \"password\" : \"text\"}\n      placeholder={placeholder?.toString()}\n      disabled={disabled}\n      defaultValue={controlled ? undefined : value ?? undefined}\n      value={controlled ? value ?? undefined : undefined}\n      onChange={(e) => {\n        const val = e.currentTarget.value;\n        collapse(val.toString());\n        const value = beforeStaged ? beforeStaged(val) : val;\n        update(value, settingKey);\n      }}\n    ></Form.Control>\n  );\n};\n\nexport interface CheckProps extends BaseInput<boolean> {\n  label?: string;\n  inline?: boolean;\n}\n\nexport const Check: FunctionComponent<CheckProps> = ({\n  label,\n  inline,\n  override,\n  disabled,\n  settingKey,\n}) => {\n  const update = useSingleUpdate();\n  const collapse = useCollapse();\n\n  const value = useLatest<boolean>(settingKey, isBoolean, override);\n\n  useEffect(() => collapse(value ?? false), [collapse, value]);\n\n  return (\n    <Form.Check\n      custom\n      type=\"checkbox\"\n      id={settingKey}\n      inline={inline}\n      label={label}\n      onChange={(e) => {\n        const { checked } = e.currentTarget;\n        update(checked, settingKey);\n      }}\n      disabled={disabled}\n      checked={value ?? undefined}\n    ></Form.Check>\n  );\n};\n\nfunction selectorValidator<T>(v: any): v is T {\n  return isString(v) || isNumber(v) || isArray(v);\n}\n\ntype SelectorProps<T, M extends boolean> = BaseInput<SelectorValueType<T, M>> &\n  CSelectorProps<T, M>;\n\nexport function Selector<\n  T extends string | string[] | number | number[],\n  M extends boolean = false\n>(props: SelectorProps<T, M>) {\n  const update = useSingleUpdate();\n  const collapse = useCollapse();\n\n  const { settingKey, override, beforeStaged, ...selector } = props;\n\n  const value = useLatest<SelectorValueType<T, M>>(\n    settingKey,\n    selectorValidator,\n    override\n  );\n\n  useEffect(() => {\n    if (isString(value) || isNull(value)) {\n      collapse(value ?? \"\");\n    }\n  });\n\n  return (\n    <CSelector\n      {...selector}\n      // TODO: Force as any\n      defaultValue={value as any}\n      onChange={(v) => {\n        v = beforeStaged ? beforeStaged(v) : v;\n        update(v, settingKey);\n      }}\n    ></CSelector>\n  );\n}\n\ntype SliderProps = {} & BaseInput<number> &\n  Omit<CSliderProps, \"onChange\" | \"onAfterChange\">;\n\nexport const Slider: FunctionComponent<SliderProps> = (props) => {\n  const { settingKey, override, ...slider } = props;\n\n  const update = useSingleUpdate();\n\n  const defaultValue = useLatest<number>(settingKey, isNumber, override);\n\n  return (\n    <CSlider\n      onAfterChange={(v) => {\n        update(v, settingKey);\n      }}\n      defaultValue={defaultValue ?? undefined}\n      {...slider}\n    ></CSlider>\n  );\n};\n\ntype ChipsProp = {} & BaseInput<string[]> &\n  Omit<CChipsProps, \"onChange\" | \"defaultValue\">;\n\nexport const Chips: FunctionComponent<ChipsProp> = (props) => {\n  const { settingKey, override, ...chips } = props;\n\n  const update = useSingleUpdate();\n\n  const defaultValue = useLatest<string[]>(settingKey, isArray, override);\n\n  return (\n    <CChips\n      defaultValue={defaultValue ?? undefined}\n      onChange={(v) => {\n        update(v, settingKey);\n      }}\n      {...chips}\n    ></CChips>\n  );\n};\n\ntype ButtonProps = {\n  onClick?: (\n    update: (v: any, key: string) => void,\n    key: string,\n    value?: string\n  ) => void;\n} & Omit<BaseInput<string>, \"override\" | \"beforeStaged\">;\n\nexport const Button: FunctionComponent<Override<ButtonProps, BSButtonProps>> = (\n  props\n) => {\n  const { onClick, settingKey, ...button } = props;\n\n  const value = useLatest<string>(settingKey, isString);\n  const update = useSingleUpdate();\n\n  return (\n    <BSButton\n      onClick={() => {\n        onClick && onClick(update, settingKey, value ?? undefined);\n      }}\n      {...button}\n    ></BSButton>\n  );\n};\n","import { isBoolean, isNumber, isString } from \"lodash\";\nimport React, { FunctionComponent, useCallback, useState } from \"react\";\nimport { Button } from \"react-bootstrap\";\nimport { UtilsApi } from \"../../apis\";\nimport { useLatest } from \"./hooks\";\n\nexport const URLTestButton: FunctionComponent<{\n  category: \"sonarr\" | \"radarr\";\n}> = ({ category }) => {\n  const [title, setTitle] = useState(\"Test\");\n  const [variant, setVar] = useState(\"primary\");\n\n  const address = useLatest<string>(`settings-${category}-ip`, isString);\n  const port = useLatest<number>(`settings-${category}-port`, isNumber);\n  const url = useLatest<string>(`settings-${category}-base_url`, isString);\n  const apikey = useLatest<string>(`settings-${category}-apikey`, isString);\n  const ssl = useLatest<boolean>(`settings-${category}-ssl`, isBoolean);\n\n  const click = useCallback(() => {\n    if (address && apikey && ssl !== null) {\n      let testUrl: string;\n      if (port) {\n        testUrl = `${address}:${port}${url ?? \"\"}`;\n      } else {\n        testUrl = `${address}${url ?? \"\"}`;\n      }\n      const request = {\n        protocol: ssl ? \"https\" : \"http\",\n        url: testUrl,\n        params: {\n          apikey: apikey,\n        },\n      };\n\n      if (!request.url.endsWith(\"/\")) {\n        request.url += \"/\";\n      }\n\n      UtilsApi.urlTest(request.protocol, request.url, request.params).then(\n        (result) => {\n          if (result.status) {\n            setTitle(`Version: ${result.version}`);\n            setVar(\"success\");\n          } else {\n            setTitle(result.error);\n            setVar(\"danger\");\n          }\n        }\n      );\n    }\n  }, [address, port, url, apikey, ssl]);\n\n  return (\n    <Button\n      onClick={click}\n      variant={variant}\n      title={title}\n      className=\"text-truncate text-nowrap\"\n    >\n      {title}\n    </Button>\n  );\n};\n\nexport * from \"./collapse\";\nexport { default as CollapseBox } from \"./collapse\";\nexport * from \"./container\";\nexport * from \"./forms\";\nexport * from \"./hooks\";\nexport * from \"./provider\";\nexport { default as SettingsProvider } from \"./provider\";\n","export const securityOptions: SelectorOption<string>[] = [\n  {\n    label: \"Basic\",\n    value: \"basic\",\n  },\n  {\n    label: \"Form\",\n    value: \"form\",\n  },\n];\n\nexport const proxyOptions: SelectorOption<string>[] = [\n  {\n    label: \"Socks5\",\n    value: \"socks5\",\n  },\n  {\n    label: \"HTTP(S)\",\n    value: \"http\",\n  },\n];\n\nexport const branchOptions: SelectorOption<string>[] = [\n  {\n    label: \"master\",\n    value: \"master\",\n  },\n  {\n    label: \"development\",\n    value: \"development\",\n  },\n];\n","import {\n  faCheck,\n  faClipboard,\n  faSync,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useState } from \"react\";\nimport { InputGroup } from \"react-bootstrap\";\nimport {\n  copyToClipboard,\n  toggleState,\n  useCanUpdateInject,\n} from \"../../utilites\";\nimport {\n  Button,\n  Check,\n  Chips,\n  CollapseBox,\n  Group,\n  Input,\n  Message,\n  Selector,\n  SettingsProvider,\n  Text,\n} from \"../components\";\nimport { branchOptions, proxyOptions, securityOptions } from \"./options\";\n\nconst characters = \"abcdef0123456789\";\nconst settingApiKey = \"settings-auth-apikey\";\n\nconst generateApiKey = () => {\n  return Array(32)\n    .fill(null)\n    .map(() => characters.charAt(Math.floor(Math.random() * characters.length)))\n    .join(\"\");\n};\n\nconst baseUrlOverride = (settings: Settings) =>\n  settings.general.base_url?.slice(1) ?? \"\";\n\nconst SettingsGeneralView: FunctionComponent = () => {\n  const [copied, setCopy] = useState(false);\n\n  const canUpdate = useCanUpdateInject();\n\n  return (\n    <SettingsProvider title=\"General - Bazarr (Settings)\">\n      <Group header=\"Host\">\n        <Input name=\"Address\">\n          <Text placeholder=\"0.0.0.0\" settingKey=\"settings-general-ip\"></Text>\n          <Message>Valid IPv4 address or '0.0.0.0' for all interfaces</Message>\n        </Input>\n        <Input name=\"Port\">\n          <Text placeholder={6767} settingKey=\"settings-general-port\"></Text>\n        </Input>\n        <Input name=\"Base URL\">\n          <InputGroup>\n            <InputGroup.Prepend>\n              <InputGroup.Text>/</InputGroup.Text>\n            </InputGroup.Prepend>\n            <Text\n              settingKey=\"settings-general-base_url\"\n              override={baseUrlOverride}\n              beforeStaged={(v) => \"/\" + v}\n            ></Text>\n          </InputGroup>\n          <Message>Reverse proxy support</Message>\n        </Input>\n      </Group>\n      <Group header=\"Security\">\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input name=\"Authentication\">\n              <Selector\n                clearable\n                options={securityOptions}\n                settingKey=\"settings-auth-type\"\n                beforeStaged={(v) => (v === null ? \"None\" : v)}\n              ></Selector>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content on={(k) => k !== \"\" && k !== \"None\"}>\n            <Input name=\"Username\">\n              <Text settingKey=\"settings-auth-username\"></Text>\n            </Input>\n            <Input name=\"Password\">\n              <Text password settingKey=\"settings-auth-password\"></Text>\n            </Input>\n          </CollapseBox.Content>\n        </CollapseBox>\n        <Input name=\"API Key\">\n          <InputGroup>\n            <Text disabled controlled settingKey={settingApiKey}></Text>\n            <InputGroup.Append>\n              <Button\n                variant={copied ? \"success\" : \"light\"}\n                settingKey={settingApiKey}\n                onClick={(update, key, value) => {\n                  if (value) {\n                    copyToClipboard(value);\n                    toggleState(setCopy, 1500);\n                  }\n                }}\n              >\n                <FontAwesomeIcon\n                  icon={copied ? faCheck : faClipboard}\n                ></FontAwesomeIcon>\n              </Button>\n              <Button\n                variant=\"danger\"\n                settingKey={settingApiKey}\n                onClick={(update, key) => {\n                  update(generateApiKey(), key);\n                }}\n              >\n                <FontAwesomeIcon icon={faSync}></FontAwesomeIcon>\n              </Button>\n            </InputGroup.Append>\n          </InputGroup>\n        </Input>\n      </Group>\n      <Group header=\"Proxy\">\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input>\n              <Selector\n                clearable\n                settingKey=\"settings-proxy-type\"\n                options={proxyOptions}\n                beforeStaged={(v) => (v === null ? \"None\" : v)}\n              ></Selector>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content on={(k) => k !== \"\" && k !== \"None\"}>\n            <Input name=\"Host\">\n              <Text settingKey=\"settings-proxy-url\"></Text>\n            </Input>\n            <Input name=\"Port\">\n              <Text settingKey=\"settings-proxy-port\"></Text>\n            </Input>\n            <Input name=\"Username\">\n              <Text settingKey=\"settings-proxy-username\"></Text>\n            </Input>\n            <Input name=\"Password\">\n              <Text password settingKey=\"settings-proxy-password\"></Text>\n              <Message>\n                You only need to enter a username and password if one is\n                required. Leave them blank otherwise\n              </Message>\n            </Input>\n            <Input name=\"Ignored Addresses\">\n              <Chips settingKey=\"settings-proxy-exclude\"></Chips>\n              <Message>'*.' as a wildcard for subdomains</Message>\n            </Input>\n          </CollapseBox.Content>\n        </CollapseBox>\n      </Group>\n      <Group header=\"Updates\" hidden={!canUpdate}>\n        <Input>\n          <Check\n            label=\"Automatic\"\n            settingKey=\"settings-general-auto_update\"\n          ></Check>\n          <Message>Automatically download and install updates</Message>\n        </Input>\n        <Input>\n          <Selector\n            options={branchOptions}\n            settingKey=\"settings-general-branch\"\n          ></Selector>\n          <Message>Branch used by update mechanism</Message>\n        </Input>\n      </Group>\n      <Group header=\"Logging\">\n        <Input>\n          <Check label=\"Debug\" settingKey=\"settings-general-debug\"></Check>\n          <Message>Debug logging should only be enabled temporarily</Message>\n        </Input>\n      </Group>\n      <Group header=\"Analytics\">\n        <Input>\n          <Check label=\"Enable\" settingKey=\"settings-analytics-enabled\"></Check>\n          <Message>\n            Send anonymous usage information, nothing that can identify you.\n            This includes information on which providers you use, what languages\n            you search for, Bazarr, Python, Sonarr, Radarr and what OS version\n            you are using. We will use this information to prioritize features\n            and bug fixes. Please, keep this enabled as this is the only way we\n            have to better understand how you use Bazarr.\n          </Message>\n        </Input>\n      </Group>\n    </SettingsProvider>\n  );\n};\n\nexport default SettingsGeneralView;\n","import React, { FunctionComponent, useMemo } from \"react\";\nimport { useEnabledLanguages, useProfiles } from \".\";\nimport { LanguageSelector as CLanguageSelector } from \"../../components\";\nimport { BaseInput, Selector, useSingleUpdate } from \"../components\";\n\ninterface LanguageSelectorProps {\n  options: readonly Language[];\n}\n\nexport const LanguageSelector: FunctionComponent<\n  LanguageSelectorProps & BaseInput<string[]>\n> = ({ settingKey, options }) => {\n  const enabled = useEnabledLanguages();\n  const update = useSingleUpdate();\n\n  return (\n    <CLanguageSelector\n      multiple\n      defaultValue={enabled}\n      options={options}\n      onChange={(val) => {\n        update(val, settingKey);\n      }}\n    ></CLanguageSelector>\n  );\n};\n\ninterface ProfileSelectorProps {}\n\nexport const ProfileSelector: FunctionComponent<\n  ProfileSelectorProps & BaseInput<Profile.Languages>\n> = ({ settingKey }) => {\n  const profiles = useProfiles();\n\n  const profileOptions = useMemo<SelectorOption<number>[]>(\n    () =>\n      profiles.map((v) => {\n        return { label: v.name, value: v.profileId };\n      }),\n    [profiles]\n  );\n\n  return (\n    <Selector\n      clearable\n      options={profileOptions}\n      settingKey={settingKey}\n      beforeStaged={(v) => (v === null ? \"\" : v)}\n    ></Selector>\n  );\n};\n","export const anyCutoff = 65535;\n\nexport const cutoffOptions: SelectorOption<number>[] = [\n  {\n    label: \"Any\",\n    value: anyCutoff,\n  },\n];\n","import { faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useEffect,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Button, Form } from \"react-bootstrap\";\nimport { Column, TableUpdater } from \"react-table\";\nimport { useEnabledLanguages } from \".\";\nimport {\n  ActionButton,\n  BaseModal,\n  BaseModalProps,\n  LanguageSelector,\n  Selector,\n  SimpleTable,\n  useCloseModal,\n  usePayload,\n} from \"../../components\";\nimport { Input, Message } from \"../components\";\nimport { cutoffOptions } from \"./options\";\ninterface Props {\n  update: (profile: Profile.Languages) => void;\n}\n\nfunction createDefaultProfile(): Profile.Languages {\n  return {\n    profileId: -1,\n    name: \"\",\n    items: [],\n    cutoff: null,\n  };\n}\n\nconst LanguagesProfileModal: FunctionComponent<Props & BaseModalProps> = (\n  props\n) => {\n  const { update, ...modal } = props;\n\n  const profile = usePayload<Profile.Languages>(modal.modalKey);\n\n  const closeModal = useCloseModal();\n\n  const languages = useEnabledLanguages();\n\n  const [current, setProfile] = useState(profile ?? createDefaultProfile());\n\n  useEffect(() => {\n    if (profile) {\n      setProfile(profile);\n    }\n  }, [profile]);\n\n  const cutoff: SelectorOption<number>[] = useMemo(() => {\n    const options = [...cutoffOptions];\n\n    const newOptions = current.items.map<SelectorOption<number>>((v) => ({\n      label: `ID ${v.id} (${v.language})`,\n      value: v.id,\n    }));\n\n    options.push(...newOptions);\n\n    return options;\n  }, [current.items]);\n\n  const updateProfile = useCallback(\n    <K extends keyof Profile.Languages>(\n      key: K,\n      value: Profile.Languages[K]\n    ) => {\n      const object = { ...current };\n      object[key] = value;\n      setProfile(object);\n    },\n    [current]\n  );\n\n  const updateRow = useCallback<TableUpdater<Profile.Item>>(\n    (row, item: Profile.Item) => {\n      const list = [...current.items];\n      if (item) {\n        list[row.index] = item;\n      } else {\n        list.splice(row.index, 1);\n      }\n      updateProfile(\"items\", list);\n    },\n    [current.items, updateProfile]\n  );\n\n  const addItem = useCallback(() => {\n    const id =\n      1 +\n      current.items.reduce<number>((val, item) => Math.max(item.id, val), 0);\n\n    if (languages.length > 0) {\n      const language = languages[0].code2;\n\n      const item: Profile.Item = {\n        id,\n        language,\n        audio_exclude: \"False\",\n        hi: \"False\",\n        forced: \"False\",\n      };\n\n      const list = [...current.items];\n\n      list.push(item);\n      updateProfile(\"items\", list);\n    }\n  }, [current.items, updateProfile, languages]);\n\n  const canSave = current.name.length > 0 && current.items.length > 0;\n\n  const footer = (\n    <Button\n      disabled={!canSave}\n      onClick={() => {\n        closeModal();\n        update(current);\n      }}\n    >\n      Save\n    </Button>\n  );\n\n  const columns = useMemo<Column<Profile.Item>[]>(\n    () => [\n      {\n        Header: \"ID\",\n        accessor: \"id\",\n      },\n      {\n        Header: \"Language\",\n        accessor: \"language\",\n        Cell: ({ value, row, externalUpdate }) => {\n          const code = value;\n          const item = row.original;\n          const lang = useMemo(() => languages.find((l) => l.code2 === code), [\n            code,\n          ]);\n          return (\n            <div style={{ width: \"8rem\" }}>\n              <LanguageSelector\n                options={languages}\n                defaultValue={lang}\n                onChange={(l) => {\n                  if (l) {\n                    item.language = l.code2;\n                    externalUpdate && externalUpdate(row, item);\n                  }\n                }}\n              ></LanguageSelector>\n            </div>\n          );\n        },\n      },\n      {\n        Header: \"Forced\",\n        accessor: \"forced\",\n        Cell: ({ row, value, externalUpdate }) => {\n          const item = row.original;\n          return (\n            <Form.Check\n              custom\n              id={`${item.language}-forced`}\n              defaultChecked={value === \"True\"}\n              onChange={(v) => {\n                item.forced = v.target.checked ? \"True\" : \"False\";\n                externalUpdate && externalUpdate(row, item);\n              }}\n            ></Form.Check>\n          );\n        },\n      },\n      {\n        Header: \"HI\",\n        accessor: \"hi\",\n        Cell: ({ row, value, externalUpdate }) => {\n          const item = row.original;\n          return (\n            <Form.Check\n              custom\n              id={`${item.language}-hi`}\n              defaultChecked={value === \"True\"}\n              onChange={(v) => {\n                item.hi = v.target.checked ? \"True\" : \"False\";\n                externalUpdate && externalUpdate(row, item);\n              }}\n            ></Form.Check>\n          );\n        },\n      },\n      {\n        Header: \"Exclude Audio\",\n        accessor: \"audio_exclude\",\n        Cell: ({ row, value, externalUpdate }) => {\n          const item = row.original;\n          return (\n            <Form.Check\n              custom\n              id={`${item.language}-audio`}\n              defaultChecked={value === \"True\"}\n              onChange={(v) => {\n                item.audio_exclude = v.target.checked ? \"True\" : \"False\";\n                externalUpdate && externalUpdate(row, item);\n              }}\n            ></Form.Check>\n          );\n        },\n      },\n      {\n        id: \"action\",\n        accessor: \"id\",\n        Cell: ({ row, externalUpdate }) => {\n          return (\n            <ActionButton\n              icon={faTrash}\n              onClick={() => externalUpdate && externalUpdate(row)}\n            ></ActionButton>\n          );\n        },\n      },\n    ],\n    [languages]\n  );\n\n  return (\n    <BaseModal size=\"lg\" title=\"Languages Profile\" footer={footer} {...modal}>\n      <Input>\n        <Form.Control\n          type=\"text\"\n          placeholder=\"Name\"\n          value={current?.name}\n          onChange={(v) => {\n            updateProfile(\"name\", v.target.value);\n          }}\n        ></Form.Control>\n      </Input>\n      <Input>\n        <SimpleTable\n          responsive={false}\n          columns={columns}\n          data={current?.items ?? []}\n          externalUpdate={updateRow}\n        ></SimpleTable>\n        <Button block variant=\"light\" onClick={addItem}>\n          Add\n        </Button>\n      </Input>\n      <Input name=\"Cutoff\">\n        <Selector\n          clearable\n          options={cutoff}\n          value={current?.cutoff}\n          onChange={(num) => updateProfile(\"cutoff\", num)}\n        ></Selector>\n        <Message>Ignore others if existing</Message>\n      </Input>\n    </BaseModal>\n  );\n};\n\nexport default LanguagesProfileModal;\n","import { faTrash, faWrench } from \"@fortawesome/free-solid-svg-icons\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Badge, Button, ButtonGroup } from \"react-bootstrap\";\nimport { Column, TableUpdater } from \"react-table\";\nimport { useProfiles } from \".\";\nimport { ActionButton, SimpleTable, useShowModal } from \"../../components\";\nimport { useSingleUpdate } from \"../components\";\nimport { languageProfileKey } from \"../keys\";\nimport Modal from \"./modal\";\nimport { anyCutoff } from \"./options\";\n\nconst Table: FunctionComponent = () => {\n  const originalProfiles = useProfiles();\n\n  const [profiles, setProfiles] = useState([...originalProfiles]);\n\n  const nextProfileId = useMemo(\n    () =>\n      1 +\n      profiles.reduce<number>((val, prof) => Math.max(prof.profileId, val), 0),\n    [profiles]\n  );\n\n  const update = useSingleUpdate();\n\n  const showModal = useShowModal();\n\n  const submitProfiles = useCallback(\n    (list: Profile.Languages[]) => {\n      update(list, languageProfileKey);\n      setProfiles(list);\n    },\n    [update]\n  );\n\n  const updateProfile = useCallback(\n    (profile: Profile.Languages) => {\n      const list = [...profiles];\n      const idx = list.findIndex((v) => v.profileId === profile.profileId);\n\n      if (idx !== -1) {\n        list[idx] = profile;\n      } else {\n        list.push(profile);\n      }\n      submitProfiles(list);\n    },\n    [profiles, submitProfiles]\n  );\n\n  const updateRow = useCallback<TableUpdater<Profile.Languages>>(\n    (row, item?: Profile.Languages) => {\n      if (item) {\n        showModal(\"profile\", item);\n      } else {\n        const list = [...profiles];\n        list.splice(row.index, 1);\n        submitProfiles(list);\n      }\n    },\n    [submitProfiles, showModal, profiles]\n  );\n\n  const columns = useMemo<Column<Profile.Languages>[]>(\n    () => [\n      {\n        Header: \"Name\",\n        accessor: \"name\",\n      },\n      {\n        Header: \"Languages\",\n        accessor: \"items\",\n        Cell: (row) => {\n          const items = row.value;\n          const cutoff = row.row.original.cutoff;\n          return items.map((v) => {\n            const isCutoff = v.id === cutoff || cutoff === anyCutoff;\n            return (\n              <ItemBadge\n                key={v.id}\n                cutoff={isCutoff}\n                className=\"mx-1\"\n                item={v}\n              ></ItemBadge>\n            );\n          });\n        },\n      },\n      {\n        accessor: \"profileId\",\n        Cell: ({ row, externalUpdate }) => {\n          const profile = row.original;\n\n          return (\n            <ButtonGroup>\n              <ActionButton\n                icon={faWrench}\n                onClick={() => {\n                  externalUpdate && externalUpdate(row, profile);\n                }}\n              ></ActionButton>\n              <ActionButton\n                icon={faTrash}\n                onClick={() => externalUpdate && externalUpdate(row)}\n              ></ActionButton>\n            </ButtonGroup>\n          );\n        },\n      },\n    ],\n    []\n  );\n\n  return (\n    <React.Fragment>\n      <SimpleTable\n        columns={columns}\n        data={profiles}\n        externalUpdate={updateRow}\n      ></SimpleTable>\n      <Button\n        block\n        variant=\"light\"\n        onClick={() => {\n          const profile = {\n            profileId: nextProfileId,\n            name: \"\",\n            items: [],\n            cutoff: null,\n          };\n          showModal(\"profile\", profile);\n        }}\n      >\n        Add New Profile\n      </Button>\n      <Modal update={updateProfile} modalKey=\"profile\"></Modal>\n    </React.Fragment>\n  );\n};\n\ninterface ItemProps {\n  className?: string;\n  item: Profile.Item;\n  cutoff: boolean;\n}\n\nconst ItemBadge: FunctionComponent<ItemProps> = ({\n  cutoff,\n  item,\n  className,\n}) => {\n  const text = useMemo(() => {\n    let result = item.language;\n    if (item.hi === \"True\") {\n      result += \":HI\";\n    } else if (item.forced === \"True\") {\n      result += \":Forced\";\n    }\n    return result;\n  }, [item.hi, item.forced, item.language]);\n  return (\n    <Badge\n      className={className}\n      title={cutoff ? \"Ignore others if this one is available\" : undefined}\n      variant={cutoff ? \"primary\" : \"secondary\"}\n    >\n      {text}\n    </Badge>\n  );\n};\n\nexport default Table;\n","import { isArray } from \"lodash\";\nimport React, { FunctionComponent, useContext } from \"react\";\nimport { useLanguageProfiles, useLanguages } from \"../../@redux/hooks\";\nimport {\n  Check,\n  CollapseBox,\n  Group,\n  Input,\n  Message,\n  SettingsProvider,\n  useLatest,\n} from \"../components\";\nimport { enabledLanguageKey, languageProfileKey } from \"../keys\";\nimport { LanguageSelector, ProfileSelector } from \"./components\";\nimport Table from \"./table\";\n\nconst EnabledLanguageContext = React.createContext<readonly Language[]>([]);\nconst LanguagesProfileContext = React.createContext<\n  readonly Profile.Languages[]\n>([]);\n\nexport function useEnabledLanguages() {\n  const list = useContext(EnabledLanguageContext);\n  const latest = useLatest<Language[]>(enabledLanguageKey, isArray);\n\n  if (latest) {\n    return latest;\n  } else {\n    return list;\n  }\n}\n\nexport function useProfiles() {\n  const list = useContext(LanguagesProfileContext);\n  const latest = useLatest<Profile.Languages[]>(languageProfileKey, isArray);\n\n  if (latest) {\n    return latest;\n  } else {\n    return list;\n  }\n}\n\ninterface Props {}\n\nconst SettingsLanguagesView: FunctionComponent<Props> = () => {\n  const [languages] = useLanguages(false);\n  const [enabled] = useLanguages(true);\n  const [profiles] = useLanguageProfiles();\n\n  return (\n    <SettingsProvider title=\"Languages - Bazarr (Settings)\">\n      <EnabledLanguageContext.Provider value={enabled}>\n        <LanguagesProfileContext.Provider value={profiles}>\n          <Group header=\"Subtitles Language\">\n            <Input>\n              <Check\n                label=\"Single Language\"\n                settingKey=\"settings-general-single_language\"\n              ></Check>\n              <Message>\n                Download a single Subtitles file without adding the language\n                code to the filename.\n              </Message>\n              <Message type=\"warning\">\n                We don't recommend enabling this option unless absolutely\n                required (ie: media player not supporting language code in\n                subtitles filename). Results may vary.\n              </Message>\n            </Input>\n            <Input name=\"Languages Filter\">\n              <LanguageSelector\n                settingKey={enabledLanguageKey}\n                options={languages}\n              ></LanguageSelector>\n            </Input>\n          </Group>\n          <Group header=\"Languages Profiles\">\n            <Table></Table>\n          </Group>\n          <Group header=\"Default Settings\">\n            <CollapseBox>\n              <CollapseBox.Control>\n                <Input>\n                  <Check\n                    label=\"Series\"\n                    settingKey=\"settings-general-serie_default_enabled\"\n                  ></Check>\n                  <Message>\n                    Apply only to Series added to Bazarr after enabling this\n                    option.\n                  </Message>\n                </Input>\n              </CollapseBox.Control>\n              <CollapseBox.Content indent>\n                <Input name=\"Profile\">\n                  <ProfileSelector settingKey=\"settings-general-serie_default_profile\"></ProfileSelector>\n                </Input>\n              </CollapseBox.Content>\n            </CollapseBox>\n            <CollapseBox>\n              <CollapseBox.Control>\n                <Input>\n                  <Check\n                    label=\"Movies\"\n                    settingKey=\"settings-general-movie_default_enabled\"\n                  ></Check>\n                  <Message>\n                    Apply only to Movies added to Bazarr after enabling this\n                    option.\n                  </Message>\n                </Input>\n              </CollapseBox.Control>\n              <CollapseBox.Content>\n                <Input name=\"Profile\">\n                  <ProfileSelector settingKey=\"settings-general-movie_default_profile\"></ProfileSelector>\n                </Input>\n              </CollapseBox.Content>\n            </CollapseBox>\n          </Group>\n        </LanguagesProfileContext.Provider>\n      </EnabledLanguageContext.Provider>\n    </SettingsProvider>\n  );\n};\n\nexport default SettingsLanguagesView;\n","import React, {\n  FunctionComponent,\n  useCallback,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Button, Col, Container, Form, Row } from \"react-bootstrap\";\nimport { SystemApi } from \"../../apis\";\nimport {\n  AsyncButton,\n  BaseModal,\n  BaseModalProps,\n  Selector,\n  useCloseModal,\n  useOnModalShow,\n  usePayload,\n  useShowModal,\n} from \"../../components\";\nimport { BuildKey } from \"../../utilites\";\nimport { ColCard, useLatestMergeArray, useUpdateArray } from \"../components\";\nimport { notificationsKey } from \"../keys\";\n\ninterface ModalProps {\n  selections: readonly Settings.NotificationInfo[];\n}\n\nconst notificationComparer = (\n  one: Settings.NotificationInfo,\n  another: Settings.NotificationInfo\n) => one.name === another.name;\n\nconst NotificationModal: FunctionComponent<ModalProps & BaseModalProps> = ({\n  selections,\n  ...modal\n}) => {\n  const options = useMemo<SelectorOption<Settings.NotificationInfo>[]>(\n    () =>\n      selections\n        .filter((v) => !v.enabled)\n        .map((v) => ({\n          label: v.name,\n          value: v,\n        })),\n    [selections]\n  );\n\n  const update = useUpdateArray<Settings.NotificationInfo>(\n    notificationsKey,\n    notificationComparer\n  );\n\n  const payload = usePayload<Settings.NotificationInfo>(modal.modalKey);\n\n  const [current, setCurrent] = useState<Nullable<Settings.NotificationInfo>>(\n    payload ?? null\n  );\n\n  const onShow = useCallback(() => setCurrent(payload ?? null), [payload]);\n\n  useOnModalShow(modal.modalKey, onShow);\n\n  const updateUrl = useCallback(\n    (s: string) => {\n      if (current) {\n        const newCurrent = { ...current };\n        newCurrent.url = s;\n        setCurrent(newCurrent);\n      }\n    },\n    [current]\n  );\n\n  const closeModal = useCloseModal();\n\n  const canSave =\n    current !== null && current?.url !== null && current?.url.length !== 0;\n\n  const footer = useMemo(\n    () => (\n      <React.Fragment>\n        <AsyncButton\n          className=\"mr-auto\"\n          disabled={!canSave}\n          variant=\"outline-secondary\"\n          promise={() => {\n            if (current && current.url) {\n              return SystemApi.testNotification(current.name, current.url);\n            } else {\n              return null;\n            }\n          }}\n        >\n          Test\n        </AsyncButton>\n        <Button\n          hidden={payload === null}\n          variant=\"danger\"\n          onClick={() => {\n            if (current) {\n              current.enabled = false;\n              update(current);\n            }\n            closeModal();\n          }}\n        >\n          Remove\n        </Button>\n        <Button\n          disabled={!canSave}\n          onClick={() => {\n            if (current) {\n              current.enabled = true;\n              update(current);\n            }\n            closeModal();\n          }}\n        >\n          Save\n        </Button>\n      </React.Fragment>\n    ),\n    [canSave, closeModal, current, update, payload]\n  );\n\n  return (\n    <BaseModal title=\"Notification\" footer={footer} {...modal}>\n      <Container fluid>\n        <Row>\n          <Col xs={12}>\n            <Selector\n              disabled={payload !== null}\n              options={options}\n              value={current}\n              onChange={setCurrent}\n              label={(v) => v.name}\n            ></Selector>\n          </Col>\n          <Col hidden={current === null}>\n            <Form.Group className=\"mt-4\">\n              <Form.Control\n                as=\"textarea\"\n                rows={4}\n                placeholder=\"URL\"\n                value={current?.url ?? \"\"}\n                onChange={(e) => {\n                  const value = e.currentTarget.value;\n                  updateUrl(value);\n                }}\n              ></Form.Control>\n            </Form.Group>\n          </Col>\n        </Row>\n      </Container>\n    </BaseModal>\n  );\n};\n\nexport const NotificationView: FunctionComponent = () => {\n  const notifications = useLatestMergeArray<Settings.NotificationInfo>(\n    notificationsKey,\n    notificationComparer,\n    (settings) => settings.notifications.providers\n  );\n\n  const showModal = useShowModal();\n\n  const elements = useMemo(() => {\n    return notifications\n      ?.filter((v) => v.enabled)\n      .map((v, idx) => (\n        <ColCard\n          key={BuildKey(idx, v.name)}\n          header={v.name}\n          onClick={() => showModal(\"notifications\", v)}\n        ></ColCard>\n      ));\n  }, [notifications, showModal]);\n\n  return (\n    <Container fluid>\n      <Row>\n        {elements}{\" \"}\n        <ColCard plus onClick={() => showModal(\"notifications\")}></ColCard>\n      </Row>\n      <NotificationModal\n        selections={notifications ?? []}\n        modalKey=\"notifications\"\n      ></NotificationModal>\n    </Container>\n  );\n};\n","import React, { FunctionComponent } from \"react\";\nimport { Alert } from \"react-bootstrap\";\nimport { Check, Group, Input, Message, SettingsProvider } from \"../components\";\nimport { NotificationView } from \"./components\";\n\nconst SettingsNotificationsView: FunctionComponent = () => {\n  return (\n    <SettingsProvider title=\"Notifications - Bazarr (Settings)\">\n      <Alert variant=\"secondary\">\n        Thanks to caronc for his work on{\" \"}\n        <a\n          href=\"https://github.com/caronc/apprise\"\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n        >\n          apprise\n        </a>\n        , the core of the Bazarr notification system.\n      </Alert>\n      <Alert variant=\"secondary\">\n        Please follow instructions on his{\" \"}\n        <a\n          href=\"https://github.com/caronc/apprise/wiki\"\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n        >\n          Wiki\n        </a>{\" \"}\n        to configure your notification providers.\n      </Alert>\n      <Group header=\"Notifications\">\n        <NotificationView></NotificationView>\n      </Group>\n      <Group header=\"Options\">\n        <Input>\n          <Check\n            label=\"Silent for Manual Actions\"\n            settingKey=\"settings-general-dont_notify_manual_actions\"\n          ></Check>\n          <Message>\n            Suppress notifications when manually download/upload subtitles.\n          </Message>\n        </Input>\n      </Group>\n    </SettingsProvider>\n  );\n};\n\nexport default SettingsNotificationsView;\n","import { ReactText } from \"react\";\n\ntype AvailableType = ReactText | boolean;\nexport interface ProviderInfo {\n  key: string;\n  name?: string;\n  description?: string;\n  message?: string;\n  defaultKey?: {\n    [key: string]: AvailableType;\n  };\n  keyNameOverride?: {\n    [key: string]: string;\n  };\n}\n\nexport const ProviderList: Readonly<ProviderInfo[]> = [\n  {\n    key: \"addic7ed\",\n    description: \"Requires Anti-Captcha Provider\",\n    defaultKey: {\n      username: \"\",\n      password: \"\",\n    },\n  },\n  { key: \"argenteam\", description: \"Spanish Subtitles Provider\" },\n  {\n    key: \"assrt\",\n    description: \"Chinese Subtitles Provider\",\n    defaultKey: {\n      token: \"\",\n    },\n  },\n  {\n    key: \"betaseries\",\n    name: \"BetaSeries\",\n    description: \"French / English Provider for TV Shows Only\",\n    defaultKey: {\n      token: \"\",\n    },\n    keyNameOverride: {\n      token: \"API KEY\",\n    },\n  },\n  {\n    key: \"bsplayer\",\n    name: \"BSplayer\",\n  },\n  {\n    key: \"greeksubs\",\n    name: \"GreekSubs\",\n    description: \"Greek Subtitles Provider\",\n  },\n  {\n    key: \"greeksubtitles\",\n    name: \"GreekSubtitles\",\n    description: \"Greek Subtitles Provider\",\n  },\n  { key: \"hosszupuska\", description: \"Hungarian Subtitles Provider\" },\n  {\n    key: \"legendasdivx\",\n    name: \"LegendasDivx\",\n    description: \"Brazilian / Portuguese Subtitles Provider\",\n    defaultKey: {\n      username: \"\",\n      password: \"\",\n      skip_wrong_fps: false,\n    },\n    keyNameOverride: {\n      skip_wrong_fps: \"Skip Wrong FPS\",\n    },\n  },\n  {\n    key: \"legendastv\",\n    name: \"LegendasTV\",\n    description: \"Brazilian / Portuguese Subtitles Provider\",\n    defaultKey: {\n      username: \"\",\n      password: \"\",\n    },\n  },\n  { key: \"napiprojekt\", description: \"Polish Subtitles Provider\" },\n  {\n    key: \"napisy24\",\n    description: \"Polish Subtitles Provider\",\n    message:\n      \"The provided credentials must have API access. Leave empty to use the defaults.\",\n    defaultKey: {\n      username: \"\",\n      password: \"\",\n    },\n  },\n  { key: \"nekur\", description: \"Latvian Subtitles Provider\" },\n  {\n    key: \"opensubtitles\",\n    name: \"OpenSubtitles.org\",\n    defaultKey: {\n      username: \"\",\n      password: \"\",\n      vip: false,\n      ssl: false,\n      skip_wrong_fps: false,\n    },\n    keyNameOverride: {\n      vip: \"VIP\",\n      ssl: \"Use SSL\",\n      skip_wrong_fps: \"Skip Wrong FPS\",\n    },\n  },\n  {\n    key: \"opensubtitlescom\",\n    name: \"OpenSubtitles.com\",\n    defaultKey: {\n      username: \"\",\n      password: \"\",\n      use_hash: false,\n    },\n    keyNameOverride: {\n      use_hash: \"Use Hash\",\n    },\n  },\n  { key: \"podnapisi\" },\n  {\n    key: \"regielive\",\n    name: \"RegieLive\",\n    description: \"Romanian Subtitles Provider\",\n  },\n  {\n    key: \"soustitres\",\n    name: \"Sous-Titres.eu\",\n    description: \"Mostly French Subtitles Provider\",\n  },\n  { key: \"subdivx\", description: \"Spanish Subtitles Provider\" },\n  {\n    key: \"subssabbz\",\n    name: \"Subs.sab.bz\",\n    description: \"Bulgarian Subtitles Provider\",\n  },\n  {\n    key: \"subs4free\",\n    name: \"Subs4Free\",\n    description: \"Greek Subtitles Provider\",\n  },\n  {\n    key: \"subs4series\",\n    name: \"Subs4Series\",\n    description: \"Greek Subtitles Provider\",\n  },\n  {\n    key: \"subscene\",\n    description: \"Requires Anti-Captcha Provider\",\n    defaultKey: {\n      username: \"\",\n      password: \"\",\n    },\n  },\n  { key: \"subscenter\" },\n  {\n    key: \"subsunacs\",\n    name: \"Subsunacs.net\",\n    description: \"Bulgarian Subtitles Provider\",\n  },\n  {\n    key: \"subtitri\",\n    name: \"subtitri.id.lv\",\n    description: \"Latvian Subtitles Provider\",\n  },\n  {\n    key: \"subtitulamos\",\n    name: \"Subtitulamos.tv\",\n    description: \"Spanish Subtitles Provider\",\n  },\n  { key: \"sucha\", description: \"Spanish Subtitles Provider\" },\n  { key: \"supersubtitles\" },\n  {\n    key: \"titlovi\",\n    defaultKey: {\n      username: \"\",\n      password: \"\",\n    },\n  },\n  { key: \"titrari\", name: \"Titrari.ro\" },\n  {\n    key: \"tusubtitulo\",\n    name: \"Tusubtitulo.com\",\n    description: \"Spanish / English Subtitles Provider for TV Shows\",\n  },\n  { key: \"tvsubtitles\", name: \"TVSubtitles\" },\n  { key: \"wizdom\", description: \"Wizdom.xyz Subtitles Provider.\" },\n  {\n    key: \"xsubs\",\n    name: \"XSubs\",\n    description: \"Greek Subtitles Provider\",\n    defaultKey: {\n      username: \"\",\n      password: \"\",\n    },\n  },\n  {\n    key: \"yavka\",\n    name: \"Yavka.net\",\n    description: \"Bulgarian Subtitles Provider\",\n  },\n  { key: \"yify\", name: \"YIFY Subtitles\" },\n  { key: \"zimuku\", description: \"Chinese Subtitles Provider\" },\n];\n","import { capitalize, isArray, isBoolean } from \"lodash\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useMemo,\n  useState,\n} from \"react\";\nimport { Button, Col, Container, Row } from \"react-bootstrap\";\nimport {\n  BaseModal,\n  Selector,\n  useCloseModal,\n  useOnModalShow,\n  usePayload,\n  useShowModal,\n} from \"../../components\";\nimport { BuildKey, isReactText } from \"../../utilites\";\nimport {\n  Check,\n  ColCard,\n  Message,\n  StagedChangesContext,\n  Text,\n  useLatest,\n  useMultiUpdate,\n} from \"../components\";\nimport { ProviderInfo, ProviderList } from \"./list\";\n\nconst ModalKey = \"provider-modal\";\nconst ProviderKey = \"settings-general-enabled_providers\";\n\nexport const ProviderView: FunctionComponent = () => {\n  const providers = useLatest<string[]>(ProviderKey, isArray);\n\n  const showModal = useShowModal();\n\n  const select = useCallback(\n    (v?: ProviderInfo) => {\n      showModal(ModalKey, v ?? null);\n    },\n    [showModal]\n  );\n\n  const cards = useMemo(() => {\n    if (providers) {\n      return providers\n        .flatMap((v) => {\n          const item = ProviderList.find((inn) => inn.key === v);\n          if (item) {\n            return item;\n          } else {\n            return [];\n          }\n        })\n        .map((v, idx) => (\n          <ColCard\n            key={BuildKey(idx, v.name)}\n            header={v.name ?? capitalize(v.key)}\n            subheader={v.description}\n            onClick={() => select(v)}\n          ></ColCard>\n        ));\n    } else {\n      return [];\n    }\n  }, [providers, select]);\n\n  return (\n    <Container fluid>\n      <Row>\n        {cards}\n        <ColCard key=\"add-card\" plus onClick={select}></ColCard>\n      </Row>\n    </Container>\n  );\n};\n\nexport const ProviderModal: FunctionComponent = () => {\n  const payload = usePayload<ProviderInfo>(ModalKey);\n\n  const [staged, setChange] = useState<LooseObject>({});\n\n  const [info, setInfo] = useState<Nullable<ProviderInfo>>(payload ?? null);\n\n  const onShow = useCallback(() => setInfo(payload ?? null), [payload]);\n\n  useOnModalShow(ModalKey, onShow);\n\n  const providers = useLatest<string[]>(ProviderKey, isArray);\n\n  const closeModal = useCloseModal();\n\n  const updateGlobal = useMultiUpdate();\n\n  const deletePayload = useCallback(() => {\n    if (payload && providers) {\n      const idx = providers.findIndex((v) => v === payload.key);\n      if (idx !== -1) {\n        const newProviders = [...providers];\n        newProviders.splice(idx, 1);\n        updateGlobal({ [ProviderKey]: newProviders });\n        closeModal();\n      }\n    }\n  }, [payload, providers, updateGlobal, closeModal]);\n\n  const addProvider = useCallback(() => {\n    if (info && providers) {\n      const changes = { ...staged };\n\n      // Add this provider if not exist\n      if (providers.find((v) => v === info.key) === undefined) {\n        const newProviders = [...providers, info.key];\n        changes[ProviderKey] = newProviders;\n      }\n\n      updateGlobal(changes);\n      closeModal();\n    }\n  }, [info, providers, staged, closeModal, updateGlobal]);\n\n  const canSave = info !== null;\n\n  const footer = useMemo(\n    () => (\n      <React.Fragment>\n        <Button hidden={!payload} variant=\"danger\" onClick={deletePayload}>\n          Delete\n        </Button>\n        <Button disabled={!canSave} onClick={addProvider}>\n          Save\n        </Button>\n      </React.Fragment>\n    ),\n    [canSave, payload, deletePayload, addProvider]\n  );\n\n  const onSelect = useCallback((item: Nullable<ProviderInfo>) => {\n    if (item) {\n      setInfo(item);\n    } else {\n      setInfo({\n        key: \"\",\n        description: \"Unknown Provider\",\n      });\n    }\n  }, []);\n\n  const options = useMemo<SelectorOption<ProviderInfo>[]>(\n    () =>\n      ProviderList.filter(\n        (v) => providers?.find((p) => p === v.key) === undefined\n      ).map((v) => ({\n        label: v.name ?? capitalize(v.key),\n        value: v,\n      })),\n    [providers]\n  );\n\n  const modification = useMemo(() => {\n    if (info === null) {\n      return null;\n    }\n\n    const defaultKey = info.defaultKey;\n    const override = info.keyNameOverride ?? {};\n    if (defaultKey === undefined) {\n      return null;\n    }\n\n    const itemKey = info.key;\n\n    const elements: JSX.Element[] = [];\n    const checks: JSX.Element[] = [];\n\n    for (const key in defaultKey) {\n      const value = defaultKey[key];\n      let visibleKey = key;\n\n      if (visibleKey in override) {\n        visibleKey = override[visibleKey];\n      } else {\n        visibleKey = capitalize(key);\n      }\n\n      if (isReactText(value)) {\n        elements.push(\n          <Col key={key} xs={12} className=\"mt-2\">\n            <Text\n              password={key === \"password\"}\n              placeholder={visibleKey}\n              settingKey={`settings-${itemKey}-${key}`}\n            ></Text>\n          </Col>\n        );\n      } else if (isBoolean(value)) {\n        checks.push(\n          <Check\n            key={key}\n            inline\n            label={visibleKey}\n            settingKey={`settings-${itemKey}-${key}`}\n          ></Check>\n        );\n      }\n    }\n\n    return (\n      <Row>\n        {elements}\n        <Col hidden={checks.length === 0} className=\"mt-2\">\n          {checks}\n        </Col>\n      </Row>\n    );\n  }, [info]);\n\n  return (\n    <BaseModal title=\"Provider\" footer={footer} modalKey={ModalKey}>\n      <StagedChangesContext.Provider value={[staged, setChange]}>\n        <Container>\n          <Row>\n            <Col>\n              <Selector\n                disabled={payload !== null}\n                options={options}\n                value={info}\n                label={(v) => v?.name ?? capitalize(v?.key ?? \"\")}\n                onChange={onSelect}\n              ></Selector>\n            </Col>\n          </Row>\n          <Row>\n            <Col className=\"mb-2\">\n              <Message>{info?.description}</Message>\n            </Col>\n          </Row>\n          {modification}\n          <Row hidden={info?.message === undefined}>\n            <Col>\n              <Message>{info?.message}</Message>\n            </Col>\n          </Row>\n        </Container>\n      </StagedChangesContext.Provider>\n    </BaseModal>\n  );\n};\n","import React, { FunctionComponent } from \"react\";\nimport { Group, Input, SettingsProvider } from \"../components\";\nimport { ProviderModal, ProviderView } from \"./components\";\n\nconst SettingsProvidersView: FunctionComponent = () => {\n  return (\n    <SettingsProvider title=\"Providers - Bazarr (Settings)\">\n      <Group header=\"Providers\">\n        <Input>\n          <ProviderView></ProviderView>\n        </Input>\n      </Group>\n      <ProviderModal></ProviderModal>\n    </SettingsProvider>\n  );\n};\n\nexport default SettingsProvidersView;\n","import { faArrowCircleRight, faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { capitalize, isArray, isBoolean } from \"lodash\";\nimport React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { Button } from \"react-bootstrap\";\nimport { Column, TableUpdater } from \"react-table\";\nimport { FilesApi } from \"../../apis\";\nimport { ActionButton, FileBrowser, SimpleTable } from \"../../components\";\nimport {\n  moviesEnabledKey,\n  pathMappingsKey,\n  pathMappingsMovieKey,\n  seriesEnabledKey,\n} from \"../keys\";\nimport { Message } from \"./forms\";\nimport { useExtract, useLatest, useSingleUpdate } from \"./hooks\";\n\ntype SupportType = \"sonarr\" | \"radarr\";\n\nfunction getSupportKey(type: SupportType) {\n  if (type === \"sonarr\") {\n    return pathMappingsKey;\n  } else {\n    return pathMappingsMovieKey;\n  }\n}\n\nfunction getEnabledKey(type: SupportType) {\n  if (type === \"sonarr\") {\n    return seriesEnabledKey;\n  } else {\n    return moviesEnabledKey;\n  }\n}\n\ninterface PathMappingItem {\n  from: string;\n  to: string;\n}\n\ninterface TableProps {\n  type: SupportType;\n}\n\nexport const PathMappingTable: FunctionComponent<TableProps> = ({ type }) => {\n  const key = getSupportKey(type);\n  const items = useLatest<[string, string][]>(key, isArray);\n\n  const enabledKey = getEnabledKey(type);\n  const enabled = useExtract<boolean>(enabledKey, isBoolean);\n\n  const update = useSingleUpdate();\n\n  const updateRow = useCallback(\n    (newItems: PathMappingItem[]) => {\n      update(\n        newItems.map((v) => [v.from, v.to]),\n        key\n      );\n    },\n    [key, update]\n  );\n\n  const addRow = useCallback(() => {\n    if (items) {\n      const newItems = [...items, [\"\", \"\"]];\n      update(newItems, key);\n    }\n  }, [items, key, update]);\n\n  const data = useMemo<PathMappingItem[]>(\n    () => items?.map((v) => ({ from: v[0], to: v[1] })) ?? [],\n    [items]\n  );\n\n  const request = useMemo(() => {\n    if (type === \"sonarr\") {\n      return (path: string) => FilesApi.sonarr(path);\n    } else {\n      return (path: string) => FilesApi.radarr(path);\n    }\n  }, [type]);\n\n  const updateCell = useCallback<TableUpdater<PathMappingItem>>(\n    (row, item?: PathMappingItem) => {\n      const newItems = [...data];\n      if (item) {\n        newItems[row.index] = item;\n      } else {\n        newItems.splice(row.index, 1);\n      }\n      updateRow(newItems);\n    },\n    [data, updateRow]\n  );\n\n  const columns = useMemo<Column<PathMappingItem>[]>(\n    () => [\n      {\n        Header: capitalize(type),\n        accessor: \"from\",\n        Cell: ({ value, row, externalUpdate }) => (\n          <FileBrowser\n            drop=\"up\"\n            defaultValue={value}\n            load={request}\n            onChange={(path) => {\n              const newItem = { ...row.original };\n              newItem.from = path;\n              externalUpdate && externalUpdate(row, newItem);\n            }}\n          ></FileBrowser>\n        ),\n      },\n      {\n        id: \"arrow\",\n        className: \"text-center\",\n        Cell: () => (\n          <FontAwesomeIcon icon={faArrowCircleRight}></FontAwesomeIcon>\n        ),\n      },\n      {\n        Header: \"Bazarr\",\n        accessor: \"to\",\n        Cell: ({ value, row, externalUpdate }) => (\n          <FileBrowser\n            drop=\"up\"\n            defaultValue={value}\n            load={(path) => FilesApi.bazarr(path)}\n            onChange={(path) => {\n              const newItem = { ...row.original };\n              newItem.to = path;\n              externalUpdate && externalUpdate(row, newItem);\n            }}\n          ></FileBrowser>\n        ),\n      },\n      {\n        id: \"action\",\n        accessor: \"to\",\n        Cell: ({ row, externalUpdate }) => (\n          <ActionButton\n            icon={faTrash}\n            onClick={() => {\n              externalUpdate && externalUpdate(row);\n            }}\n          ></ActionButton>\n        ),\n      },\n    ],\n    [type, request]\n  );\n\n  if (enabled) {\n    return (\n      <React.Fragment>\n        <SimpleTable\n          emptyText=\"No Mapping\"\n          responsive={false}\n          columns={columns}\n          data={data}\n          externalUpdate={updateCell}\n        ></SimpleTable>\n        <Button block variant=\"light\" onClick={addRow}>\n          Add\n        </Button>\n      </React.Fragment>\n    );\n  } else {\n    return (\n      <Message>\n        Path Mappings will be available after staged changes are saved\n      </Message>\n    );\n  }\n};\n","import React, { FunctionComponent, useCallback } from \"react\";\nimport { InputGroup } from \"react-bootstrap\";\nimport {\n  Check,\n  Chips,\n  CollapseBox,\n  Group,\n  Input,\n  Message,\n  SettingsProvider,\n  Slider,\n  Text,\n  URLTestButton,\n} from \"../components\";\nimport { PathMappingTable } from \"../components/pathMapper\";\nimport { moviesEnabledKey } from \"../keys\";\n\ninterface Props {}\n\nconst SettingsRadarrView: FunctionComponent<Props> = () => {\n  const baseUrlOverride = useCallback((settings: Settings) => {\n    return settings.radarr.base_url?.slice(1) ?? \"\";\n  }, []);\n\n  return (\n    <SettingsProvider title=\"Radarr - Bazarr (Settings)\">\n      <CollapseBox>\n        <CollapseBox.Control>\n          <Group header=\"Use Radarr\">\n            <Input>\n              <Check label=\"Enabled\" settingKey={moviesEnabledKey}></Check>\n            </Input>\n          </Group>\n        </CollapseBox.Control>\n        <CollapseBox.Content indent={false}>\n          <Group header=\"Host\">\n            <Input name=\"Address\">\n              <Text settingKey=\"settings-radarr-ip\"></Text>\n              <Message>Hostname or IPv4 Address</Message>\n            </Input>\n            <Input name=\"Port\">\n              <Text settingKey=\"settings-radarr-port\"></Text>\n            </Input>\n            <Input name=\"Base URL\">\n              <InputGroup>\n                <InputGroup.Prepend>\n                  <InputGroup.Text>/</InputGroup.Text>\n                </InputGroup.Prepend>\n                <Text\n                  settingKey=\"settings-radarr-base_url\"\n                  override={baseUrlOverride}\n                  beforeStaged={(v) => \"/\" + v}\n                ></Text>\n              </InputGroup>\n            </Input>\n            <Input name=\"API Key\">\n              <Text settingKey=\"settings-radarr-apikey\"></Text>\n            </Input>\n            <Input>\n              <Check label=\"SSL\" settingKey=\"settings-radarr-ssl\"></Check>\n            </Input>\n            <Input>\n              <URLTestButton category=\"radarr\"></URLTestButton>\n            </Input>\n          </Group>\n          <Group header=\"Options\">\n            <Input name=\"Minimum Score\">\n              <Slider settingKey=\"settings-general-minimum_score_movie\"></Slider>\n            </Input>\n            <Input name=\"Excluded Tags\">\n              <Chips settingKey=\"settings-radarr-excluded_tags\"></Chips>\n              <Message>\n                Movies with those tags (case sensitive) in Radarr will be\n                excluded from automatic download of subtitles.\n              </Message>\n            </Input>\n            <Input>\n              <Check\n                label=\"Download Only Monitored\"\n                settingKey=\"settings-radarr-only_monitored\"\n              ></Check>\n              <Message>\n                Automatic download of subtitles will only happen for monitored\n                movies in Radarr.\n              </Message>\n            </Input>\n          </Group>\n          <Group header=\"Path Mappings\">\n            <PathMappingTable type=\"radarr\"></PathMappingTable>\n          </Group>\n        </CollapseBox.Content>\n      </CollapseBox>\n    </SettingsProvider>\n  );\n};\n\nexport default SettingsRadarrView;\n","export const seriesSyncOptions: SelectorOption<number>[] = [\n  { label: \"1 Minute\", value: 1 },\n  { label: \"5 Minutes\", value: 5 },\n  { label: \"15 Minutes\", value: 15 },\n  { label: \"1 Hour\", value: 60 },\n  { label: \"3 Hours\", value: 180 },\n];\n\nexport const episodesSyncOptions: SelectorOption<number>[] = [\n  { label: \"5 Minutes\", value: 5 },\n  { label: \"15 Minutes\", value: 15 },\n  { label: \"1 Hour\", value: 60 },\n  { label: \"3 Hours\", value: 180 },\n  { label: \"6 Hours\", value: 360 },\n];\n\nexport const moviesSyncOptions = episodesSyncOptions;\n\nexport const diskUpdateOptions: SelectorOption<string>[] = [\n  { label: \"Manually\", value: \"Manually\" },\n  { label: \"Daily\", value: \"Daily\" },\n  { label: \"Weekly\", value: \"Weekly\" },\n];\n\nexport const dayOptions: SelectorOption<number>[] = [\n  { label: \"Monday\", value: 0 },\n  { label: \"Tuesday\", value: 1 },\n  { label: \"Wednesday\", value: 2 },\n  { label: \"Thursday\", value: 3 },\n  { label: \"Friday\", value: 4 },\n  { label: \"Saturday\", value: 5 },\n  { label: \"Sunday\", value: 6 },\n];\n\nexport const upgradeOptions: SelectorOption<number>[] = [\n  { label: \"3 Hours\", value: 3 },\n  { label: \"6 Hours\", value: 6 },\n  { label: \"12 Hours\", value: 12 },\n  { label: \"24 Hours\", value: 24 },\n];\n","import React, { FunctionComponent, useMemo } from \"react\";\nimport {\n  CollapseBox,\n  Group,\n  Input,\n  Selector,\n  SettingsProvider,\n} from \"../components\";\nimport {\n  dayOptions,\n  diskUpdateOptions,\n  episodesSyncOptions,\n  moviesSyncOptions,\n  seriesSyncOptions,\n  upgradeOptions,\n} from \"./options\";\n\nconst SettingsSchedulerView: FunctionComponent = () => {\n  const timeOptions = useMemo(() => {\n    return Array(24)\n      .fill(null)\n      .map<SelectorOption<number>>((_, idx) => ({\n        label: `${idx}:00`,\n        value: idx,\n      }));\n  }, []);\n\n  return (\n    <SettingsProvider title=\"Scheduler - Bazarr (Settings)\">\n      <Group header=\"Sonarr/Radarr Sync\">\n        <Input name=\"Update Series List from Sonarr\">\n          <Selector\n            options={seriesSyncOptions}\n            settingKey=\"settings-sonarr-series_sync\"\n          ></Selector>\n        </Input>\n        <Input name=\"Update Episodes List from Sonarr\">\n          <Selector\n            options={episodesSyncOptions}\n            settingKey=\"settings-sonarr-episodes_sync\"\n          ></Selector>\n        </Input>\n        <Input name=\"Update Movies List from Radarr\">\n          <Selector\n            options={moviesSyncOptions}\n            settingKey=\"settings-radarr-movies_sync\"\n          ></Selector>\n        </Input>\n      </Group>\n      <Group header=\"Disk Indexing\">\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input name=\"Update all Episode Subtitles from Disk\">\n              <Selector\n                settingKey=\"settings-sonarr-full_update\"\n                options={diskUpdateOptions}\n              ></Selector>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content on={(k) => k === \"Weekly\"}>\n            <Input name=\"Day of The Week\">\n              <Selector\n                settingKey=\"settings-sonarr-full_update_day\"\n                options={dayOptions}\n              ></Selector>\n            </Input>\n          </CollapseBox.Content>\n          <CollapseBox.Content on={(k) => k === \"Daily\" || k === \"Weekly\"}>\n            <Input name=\"Time of The Day\">\n              <Selector\n                settingKey=\"settings-sonarr-full_update_hour\"\n                options={timeOptions}\n              ></Selector>\n            </Input>\n          </CollapseBox.Content>\n        </CollapseBox>\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input name=\"Update all Movie Subtitles from Disk\">\n              <Selector\n                settingKey=\"settings-radarr-full_update\"\n                options={diskUpdateOptions}\n              ></Selector>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content on={(k) => k === \"Weekly\"}>\n            <Input name=\"Day of The Week\">\n              <Selector\n                settingKey=\"settings-radarr-full_update_day\"\n                options={dayOptions}\n              ></Selector>\n            </Input>\n          </CollapseBox.Content>\n          <CollapseBox.Content on={(k) => k === \"Daily\" || k === \"Weekly\"}>\n            <Input name=\"Time of The Day\">\n              <Selector\n                settingKey=\"settings-radarr-full_update_hour\"\n                options={timeOptions}\n              ></Selector>\n            </Input>\n          </CollapseBox.Content>\n        </CollapseBox>\n      </Group>\n      <Group header=\"Search and Upgrade Subtitles\">\n        <Input name=\"Search for Missing Series Subtitles\">\n          <Selector\n            settingKey=\"settings-general-wanted_search_frequency\"\n            options={upgradeOptions}\n          ></Selector>\n        </Input>\n        <Input name=\"Search for Missing Movies Subtitles\">\n          <Selector\n            options={upgradeOptions}\n            settingKey=\"settings-general-wanted_search_frequency_movie\"\n          ></Selector>\n        </Input>\n        <Input name=\"Upgrade Previously Downloaded Subtitles\">\n          <Selector\n            options={upgradeOptions}\n            settingKey=\"settings-general-upgrade_frequency\"\n          ></Selector>\n        </Input>\n      </Group>\n    </SettingsProvider>\n  );\n};\n\nexport default SettingsSchedulerView;\n","export const seriesTypeOptions: SelectorOption<string>[] = [\n  { label: \"Standard\", value: \"standard\" },\n  { label: \"Anime\", value: \"anime\" },\n  { label: \"Daily\", value: \"daily\" },\n];\n","import React, { FunctionComponent, useCallback } from \"react\";\nimport { InputGroup } from \"react-bootstrap\";\nimport {\n  Check,\n  Chips,\n  CollapseBox,\n  Group,\n  Input,\n  Message,\n  Selector,\n  SettingsProvider,\n  Slider,\n  Text,\n  URLTestButton,\n} from \"../components\";\nimport { PathMappingTable } from \"../components/pathMapper\";\nimport { seriesEnabledKey } from \"../keys\";\nimport { seriesTypeOptions } from \"../options\";\n\ninterface Props {}\n\nconst SettingsSonarrView: FunctionComponent<Props> = () => {\n  const baseUrlOverride = useCallback((settings: Settings) => {\n    return settings.sonarr.base_url?.slice(1) ?? \"\";\n  }, []);\n\n  return (\n    <SettingsProvider title=\"Sonarr - Bazarr (Settings)\">\n      <CollapseBox>\n        <CollapseBox.Control>\n          <Group header=\"Use Sonarr\">\n            <Input>\n              <Check label=\"Enabled\" settingKey={seriesEnabledKey}></Check>\n            </Input>\n          </Group>\n        </CollapseBox.Control>\n        <CollapseBox.Content indent={false}>\n          <Group header=\"Host\">\n            <Input name=\"Address\">\n              <Text settingKey=\"settings-sonarr-ip\"></Text>\n              <Message>Hostname or IPv4 Address</Message>\n            </Input>\n            <Input name=\"Port\">\n              <Text settingKey=\"settings-sonarr-port\"></Text>\n            </Input>\n            <Input name=\"Base URL\">\n              <InputGroup>\n                <InputGroup.Prepend>\n                  <InputGroup.Text>/</InputGroup.Text>\n                </InputGroup.Prepend>\n                <Text\n                  settingKey=\"settings-sonarr-base_url\"\n                  override={baseUrlOverride}\n                  beforeStaged={(v) => \"/\" + v}\n                ></Text>\n              </InputGroup>\n            </Input>\n            <Input name=\"API Key\">\n              <Text settingKey=\"settings-sonarr-apikey\"></Text>\n            </Input>\n            <Input>\n              <Check label=\"SSL\" settingKey=\"settings-sonarr-ssl\"></Check>\n            </Input>\n            <Input>\n              <URLTestButton category=\"sonarr\"></URLTestButton>\n            </Input>\n          </Group>\n          <Group header=\"Options\">\n            <Input name=\"Minimum Score\">\n              <Slider settingKey=\"settings-general-minimum_score\"></Slider>\n            </Input>\n            <Input name=\"Excluded Tags\">\n              <Chips settingKey=\"settings-sonarr-excluded_tags\"></Chips>\n              <Message>\n                Episodes from series with those tags (case sensitive) in Sonarr\n                will be excluded from automatic download of subtitles.\n              </Message>\n            </Input>\n            <Input name=\"Excluded Series Types\">\n              <Selector\n                settingKey=\"settings-sonarr-excluded_series_types\"\n                multiple\n                options={seriesTypeOptions}\n              ></Selector>\n              <Message>\n                Episodes from series with those types in Sonarr will be excluded\n                from automatic download of subtitles.\n              </Message>\n            </Input>\n            <Input>\n              <Check\n                label=\"Download Only Monitored\"\n                settingKey=\"settings-sonarr-only_monitored\"\n              ></Check>\n              <Message>\n                Automatic download of subtitles will only happen for monitored\n                episodes in Sonarr.\n              </Message>\n            </Input>\n          </Group>\n          <Group header=\"Path Mappings\">\n            <PathMappingTable type=\"sonarr\"></PathMappingTable>\n          </Group>\n        </CollapseBox.Content>\n      </CollapseBox>\n    </SettingsProvider>\n  );\n};\n\nexport default SettingsSonarrView;\n","export const folderOptions: SelectorOption<string>[] = [\n  {\n    label: \"AlongSide Media File\",\n    value: \"current\",\n  },\n  {\n    label: \"Relative Path to Media File\",\n    value: \"relative\",\n  },\n  {\n    label: \"Absolute Path\",\n    value: \"absolute\",\n  },\n];\n\nexport const antiCaptchaOption: SelectorOption<string>[] = [\n  {\n    label: \"Anti-Captcha\",\n    value: \"anti-captcha\",\n  },\n  {\n    label: \"Death by Captcha\",\n    value: \"death-by-captcha\",\n  },\n];\n\nfunction buildColor(name: string) {\n  return `color(name=${name})`;\n}\n\nexport const colorOptions: SelectorOption<string>[] = [\n  {\n    label: \"White\",\n    value: buildColor(\"white\"),\n  },\n  {\n    label: \"Light Gray\",\n    value: buildColor(\"lightgray\"),\n  },\n  {\n    label: \"Red\",\n    value: buildColor(\"red\"),\n  },\n  {\n    label: \"Green\",\n    value: buildColor(\"green\"),\n  },\n  {\n    label: \"Yellow\",\n    value: buildColor(\"yellow\"),\n  },\n  {\n    label: \"Blue\",\n    value: buildColor(\"blue\"),\n  },\n  {\n    label: \"Magenta\",\n    value: buildColor(\"magenta\"),\n  },\n  {\n    label: \"Cyan\",\n    value: buildColor(\"cyan\"),\n  },\n  {\n    label: \"Black\",\n    value: buildColor(\"black\"),\n  },\n  {\n    label: \"Dark Red\",\n    value: buildColor(\"darkred\"),\n  },\n  {\n    label: \"Dark Green\",\n    value: buildColor(\"darkgreen\"),\n  },\n  {\n    label: \"Dark Yellow\",\n    value: buildColor(\"darkyellow\"),\n  },\n  {\n    label: \"Dark Blue\",\n    value: buildColor(\"darkblue\"),\n  },\n  {\n    label: \"Dark Magenta\",\n    value: buildColor(\"darkmagenta\"),\n  },\n  {\n    label: \"Dark Cyan\",\n    value: buildColor(\"darkcyan\"),\n  },\n  {\n    label: \"Dark Grey\",\n    value: buildColor(\"darkgrey\"),\n  },\n];\n","import React, { FunctionComponent } from \"react\";\nimport {\n  Check,\n  CollapseBox,\n  Group,\n  Input,\n  Message,\n  Selector,\n  SettingsProvider,\n  Slider,\n  Text,\n} from \"../components\";\nimport { antiCaptchaOption, colorOptions, folderOptions } from \"./options\";\n\nconst subzeroOverride = (key: string) => {\n  return (settings: Settings) => {\n    return settings.general.subzero_mods?.includes(key) ?? false;\n  };\n};\n\nconst subzeroColorOverride = (settings: Settings) => {\n  return (\n    settings.general.subzero_mods?.find((v) => v.startsWith(\"color\")) ?? null\n  );\n};\n\nconst SettingsSubtitlesView: FunctionComponent = () => {\n  return (\n    <SettingsProvider title=\"Subtitles - Bazarr (Settings)\">\n      <Group header=\"Subtitles Options\">\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input name=\"Subtitle Folder\">\n              <Selector\n                options={folderOptions}\n                settingKey=\"settings-general-subfolder\"\n              ></Selector>\n              <Message>\n                Choose the folder you wish to store/read the subtitles\n              </Message>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content on={(k) => k !== \"\" && k !== \"current\"}>\n            <Input name=\"Custom Subtitles Folder\">\n              <Text settingKey=\"settings-general-subfolder_custom\"></Text>\n            </Input>\n          </CollapseBox.Content>\n        </CollapseBox>\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input>\n              <Check\n                label=\"Upgrade Previously Downloaded Subtitles\"\n                settingKey=\"settings-general-upgrade_subs\"\n              ></Check>\n              <Message>\n                Schedule a task to upgrade subtitles previously downloaded by\n                Bazarr.\n              </Message>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content>\n            <Input>\n              <Slider\n                settingKey=\"settings-general-days_to_upgrade_subs\"\n                max={30}\n              ></Slider>\n              <Message>\n                Number of days to go back in history to upgrade subtitles\n              </Message>\n            </Input>\n            <Input>\n              <Check\n                label=\"Upgrade Manually Downloaded or Translated Subtitles\"\n                settingKey=\"settings-general-upgrade_manual\"\n              ></Check>\n              <Message>\n                Enable or disable upgrade of manually downloaded or translated\n                subtitles.\n              </Message>\n            </Input>\n          </CollapseBox.Content>\n        </CollapseBox>\n      </Group>\n      <Group header=\"Anti-Captcha Options\">\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input>\n              <Selector\n                clearable\n                settingKey=\"settings-general-anti_captcha_provider\"\n                beforeStaged={(v) => (v === undefined ? \"None\" : v)}\n                options={antiCaptchaOption}\n              ></Selector>\n              <Message>\n                Choose the anti-captcha provider you want to use\n              </Message>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content eventKey=\"anti-captcha\">\n            <Input>\n              <a href=\"http://getcaptchasolution.com/eixxo1rsnw\">\n                Anti-Captcha.com\n              </a>\n            </Input>\n            <Input name=\"Account Key\">\n              <Text settingKey=\"settings-anticaptcha-anti_captcha_key\"></Text>\n            </Input>\n          </CollapseBox.Content>\n          <CollapseBox.Content eventKey=\"death-by-captcha\">\n            <Input>\n              <a href=\"https://www.deathbycaptcha.com\">DeathByCaptcha.com</a>\n            </Input>\n            <Input name=\"Username\">\n              <Text settingKey=\"settings-deathbycaptcha-username\"></Text>\n            </Input>\n            <Input name=\"Password\">\n              <Text\n                password\n                settingKey=\"settings-deathbycaptcha-password\"\n              ></Text>\n            </Input>\n          </CollapseBox.Content>\n        </CollapseBox>\n      </Group>\n      <Group header=\"Performance / Optimization\">\n        <Input>\n          <Check\n            label=\"Adaptive Searching\"\n            settingKey=\"settings-general-adaptive_searching\"\n          ></Check>\n          <Message>\n            When searching for subtitles, Bazarr will search less frequently to\n            limit call to providers.\n          </Message>\n        </Input>\n        <Input>\n          <Check\n            label=\"Search Enabled Providers Simultaneously\"\n            settingKey=\"settings-general-multithreading\"\n          ></Check>\n          <Message>\n            Search multiple providers at once (Don't choose this on low powered\n            devices)\n          </Message>\n        </Input>\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input>\n              <Check\n                label=\"Use Embedded Subtitles\"\n                settingKey=\"settings-general-use_embedded_subs\"\n              ></Check>\n              <Message>\n                Use embedded subtitles in media files when determining missing\n                ones.\n              </Message>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content>\n            <Input>\n              <Check\n                label=\"Ignore Embedded PGS Subtitles\"\n                settingKey=\"settings-general-ignore_pgs_subs\"\n              ></Check>\n              <Message>\n                Ignores PGS Subtitles in Embedded Subtitles detection.\n              </Message>\n            </Input>\n            <Input>\n              <Check\n                label=\"Ignore Embedded VobSub Subtitles\"\n                settingKey=\"settings-general-ignore_vobsub_subs\"\n              ></Check>\n              <Message>\n                Ignores VobSub Subtitles in Embedded Subtitles detection.\n              </Message>\n            </Input>\n            <Input>\n              <Check\n                label=\"Show Only Desired Languages\"\n                settingKey=\"settings-general-embedded_subs_show_desired\"\n              ></Check>\n              <Message>\n                Hide embedded subtitles for languages that are not currently\n                desired.\n              </Message>\n            </Input>\n          </CollapseBox.Content>\n        </CollapseBox>\n      </Group>\n      <Group header=\"Post-Processing\">\n        <Input>\n          <Check\n            label=\"Encode Subtitles To UTF8\"\n            settingKey=\"settings-general-utf8_encode\"\n          ></Check>\n          <Message>\n            Re-encode downloaded Subtitles to UTF8. Should be left enabled in\n            most case.\n          </Message>\n        </Input>\n        <Input>\n          <Check\n            label=\"Hearing Impaired\"\n            override={subzeroOverride(\"remove_HI\")}\n            settingKey=\"subzero-remove_HI\"\n          ></Check>\n          <Message>\n            Removes tags, text and characters from subtitles that are meant for\n            hearing impaired people.\n          </Message>\n        </Input>\n        <Input>\n          <Check\n            label=\"Remove Tags\"\n            override={subzeroOverride(\"remove_tags\")}\n            settingKey=\"subzero-remove_tags\"\n          ></Check>\n          <Message>\n            Removes all possible style tags from the subtitle, such as font,\n            bold, color etc.\n          </Message>\n        </Input>\n        <Input>\n          <Check\n            label=\"OCR Fixes\"\n            override={subzeroOverride(\"OCR_fixed\")}\n            settingKey=\"subzero-OCR_fixed\"\n          ></Check>\n          <Message>\n            Fix issues that happen when a subtitle gets converted from bitmap to\n            text through OCR.\n          </Message>\n        </Input>\n        <Input>\n          <Check\n            label=\"Common Fixes\"\n            override={subzeroOverride(\"common\")}\n            settingKey=\"subzero-common\"\n          ></Check>\n          <Message>\n            Fix common and whitespace/punctuation issues in subtitles.\n          </Message>\n        </Input>\n        <Input>\n          <Check\n            label=\"Fix Uppercase\"\n            override={subzeroOverride(\"fix_uppercase\")}\n            settingKey=\"subzero-fix_uppercase\"\n          ></Check>\n          <Message>\n            Tries to make subtitles that are completely uppercase readable.\n          </Message>\n        </Input>\n        <Input name=\"Color\">\n          <Selector\n            clearable\n            options={colorOptions}\n            override={subzeroColorOverride}\n            settingKey=\"subzero-color\"\n          ></Selector>\n          <Message>\n            Adds color to your subtitles (for playback devices/software that\n            don't ship their own color modes; only works for players that\n            support color tags).\n          </Message>\n        </Input>\n        <Input>\n          <Check\n            label=\"Reverse RTL\"\n            override={subzeroOverride(\"reverse_rtl\")}\n            settingKey=\"subzero-reverse_rtl\"\n          ></Check>\n          <Message>\n            Reverses the punctuation in right-to-left subtitles for problematic\n            playback devices.\n          </Message>\n        </Input>\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input>\n              <Check\n                label=\"Permission (chmod)\"\n                settingKey=\"settings-general-chmod_enabled\"\n              ></Check>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content>\n            <Input>\n              <Text\n                placeholder=\"0777\"\n                settingKey=\"settings-general-chmod\"\n              ></Text>\n              <Message>Must be 4 digit octal</Message>\n            </Input>\n          </CollapseBox.Content>\n        </CollapseBox>\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input>\n              <Check\n                label=\"Automatic Subtitles Synchronization\"\n                settingKey=\"settings-subsync-use_subsync\"\n              ></Check>\n              <Message>\n                Enable the automatic subtitles synchronization after downloading\n                a subtitles.\n              </Message>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content>\n            <Input>\n              <Check label=\"Debug\" settingKey=\"settings-subsync-debug\"></Check>\n              <Message>\n                Do not actually sync the subtitles but generate a .tar.gz file\n                to be able to open an issue for ffsubsync. This file will reside\n                alongside the media file.\n              </Message>\n            </Input>\n            <CollapseBox>\n              <CollapseBox.Control>\n                <Input>\n                  <Check\n                    label=\"Series Score Threshold\"\n                    settingKey=\"settings-subsync-use_subsync_threshold\"\n                  ></Check>\n                </Input>\n              </CollapseBox.Control>\n              <CollapseBox.Content indent={false}>\n                <Input>\n                  <Slider settingKey=\"settings-subsync-subsync_threshold\"></Slider>\n                </Input>\n              </CollapseBox.Content>\n            </CollapseBox>\n            <CollapseBox>\n              <CollapseBox.Control>\n                <Input>\n                  <Check\n                    label=\"Movies Score Threshold\"\n                    settingKey=\"settings-subsync-use_subsync_movie_threshold\"\n                  ></Check>\n                </Input>\n              </CollapseBox.Control>\n              <CollapseBox.Content indent={false}>\n                <Input>\n                  <Slider settingKey=\"settings-subsync-subsync_movie_threshold\"></Slider>\n                </Input>\n              </CollapseBox.Content>\n            </CollapseBox>\n          </CollapseBox.Content>\n        </CollapseBox>\n        <CollapseBox>\n          <CollapseBox.Control>\n            <Input>\n              <Check\n                settingKey=\"settings-general-use_postprocessing\"\n                label=\"Custom Post-Processing\"\n              ></Check>\n              <Message>\n                Enable the post-processing execution after downloading a\n                subtitles.\n              </Message>\n            </Input>\n          </CollapseBox.Control>\n          <CollapseBox.Content>\n            <CollapseBox>\n              <CollapseBox.Control>\n                <Input>\n                  <Check\n                    settingKey=\"settings-general-use_postprocessing_threshold\"\n                    label=\"Series Score Threshold\"\n                  ></Check>\n                </Input>\n              </CollapseBox.Control>\n              <CollapseBox.Content indent={false}>\n                <Input>\n                  <Slider settingKey=\"settings-general-postprocessing_threshold\"></Slider>\n                </Input>\n              </CollapseBox.Content>\n            </CollapseBox>\n            <CollapseBox>\n              <CollapseBox.Control>\n                <Input>\n                  <Check\n                    settingKey=\"settings-general-use_postprocessing_threshold_movie\"\n                    label=\"Movies Score Threshold\"\n                  ></Check>\n                </Input>\n              </CollapseBox.Control>\n              <CollapseBox.Content indent={false}>\n                <Input>\n                  <Slider settingKey=\"settings-general-postprocessing_threshold_movie\"></Slider>\n                </Input>\n              </CollapseBox.Content>\n            </CollapseBox>\n            <Input name=\"Command\">\n              <Text settingKey=\"settings-general-postprocessing_cmd\"></Text>\n            </Input>\n            <Message>Variables you can use in your command</Message>\n            <Message>\n              <b>{\"{{directory}}\"}</b> Full path of the episode file parent\n              directory\n            </Message>\n            <Message>\n              <b>{\"{{episode}}\"}</b> Full path of the episode file\n            </Message>\n            <Message>\n              <b>{\"{{episode_name}}\"}</b> Filename of the episode without parent\n              directory or extension\n            </Message>\n            <Message>\n              <b>{\"{{subtitles}}\"}</b> Full path of the subtitles file\n            </Message>\n            <Message>\n              <b>{\"{{subtitles_language}}\"}</b> Language of the subtitles file\n            </Message>\n            <Message>\n              <b>{\"{{subtitles_language_code2}}\"}</b> 2-letter ISO-639 language\n              code of the subtitles language\n            </Message>\n            <Message>\n              <b>{\"{{subtitles_language_code3}}\"}</b> 3-letter ISO-639 language\n              code of the subtitles language\n            </Message>\n            <Message>\n              <b>{\"{{episode_language}}\"}</b> Audio language of the episode file\n            </Message>\n            <Message>\n              <b>{\"{{episode_language_code2}}\"}</b> 2-letter ISO-639 language\n              code of the episode audio language\n            </Message>\n            <Message>\n              <b>{\"{{episode_language_code3}}\"}</b> 3-letter ISO-639 language\n              code of the episode audio language\n            </Message>\n            <Message>\n              <b>{\"{{score}}\"}</b> Score of the subtitle file\n            </Message>\n            <Message>\n              <b>{\"{{subtitle_id}}\"}</b> Provider ID of the subtitle file\n            </Message>\n            <Message>\n              <b>{\"{{series_id}}\"}</b> Sonarr series ID (Empty if movie)\n            </Message>\n            <Message>\n              <b>{\"{{episode_id}}\"}</b> Sonarr episode ID or Radarr movie ID\n            </Message>\n          </CollapseBox.Content>\n        </CollapseBox>\n      </Group>\n    </SettingsProvider>\n  );\n};\n\nexport default SettingsSubtitlesView;\n","export const pageSizeOptions: SelectorOption<number>[] = [\n  {\n    label: \"25\",\n    value: 25,\n  },\n  {\n    label: \"50\",\n    value: 50,\n  },\n  {\n    label: \"100\",\n    value: 100,\n  },\n  {\n    label: \"250\",\n    value: 250,\n  },\n  {\n    label: \"500\",\n    value: 500,\n  },\n  {\n    label: \"1000\",\n    value: 1000,\n  },\n];\n","import React, { FunctionComponent } from \"react\";\nimport { uiPageSizeKey } from \"../../@storage/local\";\nimport { Group, Input, Selector, SettingsProvider } from \"../components\";\nimport { pageSizeOptions } from \"./options\";\n\nconst SettingsUIView: FunctionComponent = () => {\n  return (\n    <SettingsProvider title=\"Interface - Bazarr (Settings)\">\n      <Group header=\"UI\">\n        <Input name=\"Page Size\">\n          <Selector\n            options={pageSizeOptions}\n            settingKey={uiPageSizeKey}\n            override={(_, s) => s.site.pageSize}\n          ></Selector>\n        </Input>\n      </Group>\n    </SettingsProvider>\n  );\n};\n\nexport default SettingsUIView;\n","import React, { FunctionComponent } from \"react\";\nimport { Redirect, Route, Switch } from \"react-router-dom\";\nimport { RouterEmptyPath } from \"../404\";\nimport { systemUpdateSettings } from \"../@redux/actions\";\nimport { useReduxAction } from \"../@redux/hooks/base\";\nimport { useAutoUpdate } from \"../utilites/hooks\";\nimport General from \"./General\";\nimport Languages from \"./Languages\";\nimport Notifications from \"./Notifications\";\nimport Providers from \"./Providers\";\nimport Radarr from \"./Radarr\";\nimport Scheduler from \"./Scheduler\";\nimport Sonarr from \"./Sonarr\";\nimport Subtitles from \"./Subtitles\";\nimport UI from \"./UI\";\n\ninterface Props {}\n\nconst Router: FunctionComponent<Props> = () => {\n  const update = useReduxAction(systemUpdateSettings);\n  useAutoUpdate(update);\n\n  return (\n    <Switch>\n      <Route exact path=\"/settings\">\n        <Redirect exact to=\"/settings/general\"></Redirect>\n      </Route>\n      <Route exact path=\"/settings/general\">\n        <General></General>\n      </Route>\n      <Route exact path=\"/settings/ui\">\n        <UI></UI>\n      </Route>\n      <Route exact path=\"/settings/sonarr\">\n        <Sonarr></Sonarr>\n      </Route>\n      <Route exact path=\"/settings/radarr\">\n        <Radarr></Radarr>\n      </Route>\n      <Route exact path=\"/settings/languages\">\n        <Languages></Languages>\n      </Route>\n      <Route exact path=\"/settings/subtitles\">\n        <Subtitles></Subtitles>\n      </Route>\n      <Route exact path=\"/settings/scheduler\">\n        <Scheduler></Scheduler>\n      </Route>\n      <Route exact path=\"/settings/providers\">\n        <Providers></Providers>\n      </Route>\n      <Route exact path=\"/settings/notifications\">\n        <Notifications></Notifications>\n      </Route>\n      <Route path=\"/settings/*\">\n        <Redirect to={RouterEmptyPath}></Redirect>\n      </Route>\n    </Switch>\n  );\n};\n\nexport default Router;\n","import React, { FunctionComponent, useMemo } from \"react\";\nimport { BaseModal, BaseModalProps, usePayload } from \"../../components\";\n\ninterface Props extends BaseModalProps {}\n\nconst SystemLogModal: FunctionComponent<Props> = ({ ...modal }) => {\n  const stack = usePayload<string>(modal.modalKey);\n  const result = useMemo(\n    () =>\n      stack?.split(\"\\\\n\").map((v, idx) => (\n        <p key={idx} className=\"text-nowrap my-1\">\n          {v}\n        </p>\n      )),\n    [stack]\n  );\n  return (\n    <BaseModal title=\"Stack traceback\" {...modal}>\n      <pre>\n        <code className=\"zmdi-language-python-alt\">{result}</code>\n      </pre>\n    </BaseModal>\n  );\n};\n\nexport default SystemLogModal;\n","import { IconDefinition } from \"@fortawesome/fontawesome-svg-core\";\nimport {\n  faBug,\n  faCode,\n  faExclamationCircle,\n  faInfoCircle,\n  faLayerGroup,\n  faQuestion,\n} from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { isUndefined } from \"lodash\";\nimport React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { Column, Row } from \"react-table\";\nimport {\n  ActionButton,\n  DateFormatter,\n  PageTable,\n  useShowModal,\n} from \"../../components\";\nimport SystemLogModal from \"./modal\";\n\ninterface Props {\n  logs: readonly System.Log[];\n}\n\nfunction mapTypeToIcon(type: System.LogType): IconDefinition {\n  switch (type) {\n    case \"DEBUG\":\n      return faCode;\n    case \"ERROR\":\n      return faBug;\n    case \"INFO\":\n      return faInfoCircle;\n    case \"WARNING\":\n      return faExclamationCircle;\n    default:\n      return faQuestion;\n  }\n}\n\nconst Table: FunctionComponent<Props> = ({ logs }) => {\n  const showModal = useShowModal();\n  const show = useCallback(\n    (row: Row<System.Log>, text: string) =>\n      showModal<string>(\"system-log\", text),\n    [showModal]\n  );\n  const columns: Column<System.Log>[] = useMemo<Column<System.Log>[]>(\n    () => [\n      {\n        accessor: \"type\",\n        Cell: (row) => (\n          <FontAwesomeIcon icon={mapTypeToIcon(row.value)}></FontAwesomeIcon>\n        ),\n      },\n      {\n        Header: \"Message\",\n        accessor: \"message\",\n      },\n      {\n        Header: \"Time\",\n        accessor: \"timestamp\",\n        className: \"text-nowrap\",\n        Cell: (row) => <DateFormatter>{row.value}</DateFormatter>,\n      },\n      {\n        accessor: \"exception\",\n        Cell: ({ row, value, externalUpdate }) => {\n          if (!isUndefined(value)) {\n            return (\n              <ActionButton\n                icon={faLayerGroup}\n                onClick={() => externalUpdate && externalUpdate(row, value)}\n              ></ActionButton>\n            );\n          } else {\n            return null;\n          }\n        },\n      },\n    ],\n    []\n  );\n\n  return (\n    <React.Fragment>\n      <PageTable\n        columns={columns}\n        data={logs}\n        externalUpdate={show}\n      ></PageTable>\n      <SystemLogModal size=\"xl\" modalKey=\"system-log\"></SystemLogModal>\n    </React.Fragment>\n  );\n};\n\nexport default Table;\n","import { faDownload, faSync, faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport React, { FunctionComponent, useCallback, useState } from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { systemUpdateLogs } from \"../../@redux/actions\";\nimport { useReduxAction, useReduxStore } from \"../../@redux/hooks/base\";\nimport { SystemApi } from \"../../apis\";\nimport { AsyncStateOverlay, ContentHeader } from \"../../components\";\nimport { useBaseUrl } from \"../../utilites\";\nimport { useAutoUpdate } from \"../../utilites/hooks\";\nimport Table from \"./table\";\n\ninterface Props {}\n\nconst SystemLogsView: FunctionComponent<Props> = () => {\n  const logs = useReduxStore(({ system }) => system.logs);\n  const update = useReduxAction(systemUpdateLogs);\n  useAutoUpdate(update);\n\n  const [resetting, setReset] = useState(false);\n\n  const baseUrl = useBaseUrl(true);\n\n  const download = useCallback(() => {\n    window.open(`${baseUrl}bazarr.log`);\n  }, [baseUrl]);\n\n  return (\n    <AsyncStateOverlay state={logs}>\n      {(data) => (\n        <Container fluid>\n          <Helmet>\n            <title>Logs - Bazarr (System)</title>\n          </Helmet>\n          <ContentHeader>\n            <ContentHeader.Button\n              updating={logs.updating}\n              icon={faSync}\n              onClick={update}\n            >\n              Refresh\n            </ContentHeader.Button>\n            <ContentHeader.Button icon={faDownload} onClick={download}>\n              Download\n            </ContentHeader.Button>\n            <ContentHeader.Button\n              updating={resetting}\n              icon={faTrash}\n              onClick={() => {\n                setReset(true);\n                SystemApi.deleteLogs().finally(() => {\n                  setReset(false);\n                  update();\n                });\n              }}\n            >\n              Empty\n            </ContentHeader.Button>\n          </ContentHeader>\n          <Row>\n            <Table logs={data}></Table>\n          </Row>\n        </Container>\n      )}\n    </AsyncStateOverlay>\n  );\n};\n\nexport default SystemLogsView;\n","import React, { FunctionComponent, useMemo } from \"react\";\nimport { Column } from \"react-table\";\nimport { SimpleTable } from \"../../components\";\n\ninterface Props {\n  providers: readonly System.Provider[];\n}\n\nconst Table: FunctionComponent<Props> = (props) => {\n  const columns: Column<System.Provider>[] = useMemo<Column<System.Provider>[]>(\n    () => [\n      {\n        Header: \"Name\",\n        accessor: \"name\",\n      },\n      {\n        Header: \"Status\",\n        accessor: \"status\",\n      },\n      {\n        Header: \"Next Retry\",\n        accessor: \"retry\",\n      },\n    ],\n    []\n  );\n\n  return <SimpleTable columns={columns} data={props.providers}></SimpleTable>;\n};\n\nexport default Table;\n","import { faSync, faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport React, { FunctionComponent } from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { useProviders } from \"../../@redux/hooks\";\nimport { ProvidersApi } from \"../../apis\";\nimport { AsyncStateOverlay, ContentHeader } from \"../../components\";\nimport { useAutoUpdate } from \"../../utilites/hooks\";\nimport Table from \"./table\";\n\ninterface Props {}\n\nconst SystemProvidersView: FunctionComponent<Props> = () => {\n  const [providers, update] = useProviders();\n  useAutoUpdate(update);\n\n  return (\n    <AsyncStateOverlay state={providers}>\n      {(data) => (\n        <Container fluid>\n          <Helmet>\n            <title>Providers - Bazarr (System)</title>\n          </Helmet>\n          <ContentHeader>\n            <ContentHeader.Button\n              updating={providers.updating}\n              icon={faSync}\n              onClick={update}\n            >\n              Refresh\n            </ContentHeader.Button>\n            <ContentHeader.AsyncButton\n              icon={faTrash}\n              promise={() => ProvidersApi.reset()}\n              onSuccess={update}\n            >\n              Reset\n            </ContentHeader.AsyncButton>\n          </ContentHeader>\n          <Row>\n            <Table providers={data}></Table>\n          </Row>\n        </Container>\n      )}\n    </AsyncStateOverlay>\n  );\n};\n\nexport default SystemProvidersView;\n","import React, { FunctionComponent, useMemo } from \"react\";\nimport { Badge, Card, Col, Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { systemUpdateReleases } from \"../../@redux/actions\";\nimport { useReduxAction, useReduxStore } from \"../../@redux/hooks/base\";\nimport { AsyncStateOverlay } from \"../../components\";\nimport { BuildKey } from \"../../utilites\";\nimport { useAutoUpdate } from \"../../utilites/hooks\";\n\ninterface Props {}\n\nconst ReleasesView: FunctionComponent<Props> = () => {\n  const releases = useReduxStore(({ system }) => system.releases);\n  const update = useReduxAction(systemUpdateReleases);\n  useAutoUpdate(update);\n\n  return (\n    <AsyncStateOverlay state={releases}>\n      {(item) => (\n        <Container fluid className=\"px-5 py-4 bg-light\">\n          <Helmet>\n            <title>Releases - Bazarr (System)</title>\n          </Helmet>\n          <Row>\n            {item.map((v, idx) => (\n              <Col xs={12} key={BuildKey(idx, v.date)}>\n                <InfoElement {...v}></InfoElement>\n              </Col>\n            ))}\n          </Row>\n        </Container>\n      )}\n    </AsyncStateOverlay>\n  );\n};\n\nconst headerBadgeCls = \"mr-2\";\n\nconst InfoElement: FunctionComponent<ReleaseInfo> = ({\n  name,\n  body,\n  date,\n  prerelease,\n  current,\n}) => {\n  const infos = useMemo(\n    () => body.map((v) => v.replace(/(\\s\\[.*?\\])\\(.*?\\)/, \"\")),\n    [body]\n  );\n  return (\n    <Card className=\"mb-4 mx-3 d-flex flex-grow-1\">\n      <Card.Header>\n        <span className={headerBadgeCls}>{name}</span>\n        <Badge className={headerBadgeCls} variant=\"info\">\n          {date}\n        </Badge>\n        <Badge\n          className={headerBadgeCls}\n          variant={prerelease ? \"danger\" : \"success\"}\n        >\n          {prerelease ? \"Development\" : \"Master\"}\n        </Badge>\n        <Badge className={headerBadgeCls} hidden={!current} variant=\"primary\">\n          Installed\n        </Badge>\n      </Card.Header>\n      <Card.Body>\n        <Card.Text>\n          From newest to oldest:\n          {infos.map((v, idx) => (\n            <li key={idx}>{v}</li>\n          ))}\n        </Card.Text>\n      </Card.Body>\n    </Card>\n  );\n};\n\nexport default ReleasesView;\n","import { IconDefinition } from \"@fortawesome/fontawesome-common-types\";\nimport {\n  faDiscord,\n  faGithub,\n  faWikipediaW,\n} from \"@fortawesome/free-brands-svg-icons\";\nimport { faPaperPlane } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent } from \"react\";\nimport { Col, Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { systemUpdateStatus } from \"../../@redux/actions\";\nimport { useReduxAction, useReduxStore } from \"../../@redux/hooks/base\";\nimport { useAutoUpdate } from \"../../utilites/hooks\";\n\ninterface InfoProps {\n  title: string;\n  children: React.ReactNode;\n}\n\nfunction CRow(props: InfoProps): JSX.Element {\n  const { title, children } = props;\n  return (\n    <Row>\n      <Col sm={4}>\n        <b>{title}</b>\n      </Col>\n      <Col>{children}</Col>\n    </Row>\n  );\n}\n\ninterface IconProps {\n  icon: IconDefinition;\n  link: string;\n  children: string;\n}\n\nfunction Label(props: IconProps): JSX.Element {\n  const { icon, link, children } = props;\n  return (\n    <React.Fragment>\n      <FontAwesomeIcon icon={icon} style={{ width: \"2rem\" }}></FontAwesomeIcon>\n      <a href={link} target=\"_blank\" rel=\"noopener noreferrer\">\n        {children}\n      </a>\n    </React.Fragment>\n  );\n}\n\nconst InfoContainer: FunctionComponent<{ title: string }> = ({\n  title,\n  children,\n}) => {\n  return (\n    <Container className=\"py-3\">\n      <h4>{title}</h4>\n      <hr></hr>\n      {children}\n    </Container>\n  );\n};\n\ninterface Props {}\n\nconst SystemStatusView: FunctionComponent<Props> = () => {\n  const status = useReduxStore((s) => s.system.status.data);\n  const update = useReduxAction(systemUpdateStatus);\n  useAutoUpdate(update);\n\n  return (\n    <Container className=\"p-5\">\n      <Helmet>\n        <title>Status - Bazarr (System)</title>\n      </Helmet>\n      <Row>\n        <InfoContainer title=\"About\">\n          <CRow title=\"Bazarr Version\">\n            <span>{status?.bazarr_version}</span>\n          </CRow>\n          <CRow title=\"Sonarr Version\">\n            <span>{status?.sonarr_version}</span>\n          </CRow>\n          <CRow title=\"Radarr Version\">\n            <span>{status?.radarr_version}</span>\n          </CRow>\n          <CRow title=\"Operating System\">\n            <span>{status?.operating_system}</span>\n          </CRow>\n          <CRow title=\"Python Version\">\n            <span>{status?.python_version}</span>\n          </CRow>\n          <CRow title=\"Bazarr Directory\">\n            <span>{status?.bazarr_directory}</span>\n          </CRow>\n          <CRow title=\"Bazarr Config Directory\">\n            <span>{status?.bazarr_config_directory}</span>\n          </CRow>\n        </InfoContainer>\n      </Row>\n      <Row>\n        <InfoContainer title=\"More Info\">\n          <CRow title=\"Home Page\">\n            <Label icon={faPaperPlane} link=\"https://www.bazarr.media/\">\n              Bazarr Website\n            </Label>\n          </CRow>\n          <CRow title=\"Source\">\n            <Label\n              icon={faGithub}\n              link=\"https://github.com/morpheus65535/bazarr\"\n            >\n              Bazarr on Github\n            </Label>\n          </CRow>\n          <CRow title=\"Wiki\">\n            <Label\n              icon={faWikipediaW}\n              link=\"https://github.com/morpheus65535/bazarr/wiki\"\n            >\n              Bazarr Wiki\n            </Label>\n          </CRow>\n          <CRow title=\"Discord\">\n            <Label icon={faDiscord} link=\"https://discord.gg/MH2e2eb\">\n              Bazarr on Discord\n            </Label>\n          </CRow>\n        </InfoContainer>\n      </Row>\n    </Container>\n  );\n};\n\nexport default SystemStatusView;\n","import { faSync } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useMemo } from \"react\";\nimport { Column } from \"react-table\";\nimport { systemRunTasks } from \"../../@redux/actions\";\nimport { useReduxAction } from \"../../@redux/hooks/base\";\nimport { SystemApi } from \"../../apis\";\nimport { AsyncButton, SimpleTable } from \"../../components\";\n\ninterface Props {\n  tasks: readonly System.Task[];\n}\n\nconst Table: FunctionComponent<Props> = ({ tasks }) => {\n  const run = useReduxAction(systemRunTasks);\n  const columns: Column<System.Task>[] = useMemo<Column<System.Task>[]>(\n    () => [\n      {\n        Header: \"Name\",\n        accessor: \"name\",\n        className: \"text-nowrap\",\n      },\n      {\n        Header: \"Interval\",\n        accessor: \"interval\",\n        className: \"text-nowrap\",\n      },\n      {\n        Header: \"Next Execution\",\n        accessor: \"next_run_in\",\n        className: \"text-nowrap\",\n      },\n      {\n        accessor: \"job_running\",\n        Cell: (row) => {\n          const { job_id } = row.row.original;\n          return (\n            <AsyncButton\n              promise={() => SystemApi.runTask(job_id)}\n              onSuccess={() => run(job_id)}\n              variant=\"light\"\n              size=\"sm\"\n              disabled={row.value}\n            >\n              <FontAwesomeIcon icon={faSync} spin={row.value}></FontAwesomeIcon>\n            </AsyncButton>\n          );\n        },\n      },\n    ],\n    [run]\n  );\n\n  return <SimpleTable columns={columns} data={tasks}></SimpleTable>;\n};\n\nexport default Table;\n","import { faSync } from \"@fortawesome/free-solid-svg-icons\";\nimport React, { FunctionComponent } from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { systemUpdateTasks } from \"../../@redux/actions\";\nimport { useReduxAction, useReduxStore } from \"../../@redux/hooks/base\";\nimport { AsyncStateOverlay, ContentHeader } from \"../../components\";\nimport { useAutoUpdate } from \"../../utilites\";\nimport Table from \"./table\";\n\ninterface Props {}\n\nconst SystemTasksView: FunctionComponent<Props> = () => {\n  const tasks = useReduxStore((s) => s.system.tasks);\n  const update = useReduxAction(systemUpdateTasks);\n\n  // TODO: Use Websocket\n  useAutoUpdate(update, 10 * 1000);\n\n  return (\n    <AsyncStateOverlay state={tasks}>\n      {(data) => (\n        <Container fluid>\n          <Helmet>\n            <title>Tasks - Bazarr (System)</title>\n          </Helmet>\n          <ContentHeader>\n            <ContentHeader.Button\n              updating={tasks.updating}\n              icon={faSync}\n              onClick={update}\n            >\n              Refresh\n            </ContentHeader.Button>\n          </ContentHeader>\n          <Row>\n            <Table tasks={data}></Table>\n          </Row>\n        </Container>\n      )}\n    </AsyncStateOverlay>\n  );\n};\n\nexport default SystemTasksView;\n","import React, { FunctionComponent } from \"react\";\nimport { Redirect, Route, Switch } from \"react-router-dom\";\nimport { RouterEmptyPath } from \"../404\";\nimport Logs from \"./Logs\";\nimport Providers from \"./Providers\";\nimport Releases from \"./Releases\";\nimport Status from \"./Status\";\nimport Tasks from \"./Tasks\";\n\nconst Router: FunctionComponent = () => {\n  return (\n    <Switch>\n      <Route exact path=\"/system/tasks\">\n        <Tasks></Tasks>\n      </Route>\n      <Route exact path=\"/system/status\">\n        <Status></Status>\n      </Route>\n      <Route exact path=\"/system/providers\">\n        <Providers></Providers>\n      </Route>\n      <Route exact path=\"/system/logs\">\n        <Logs></Logs>\n      </Route>\n      <Route exact path=\"/system/releases\">\n        <Releases></Releases>\n      </Route>\n      <Route path=\"/system/*\">\n        <Redirect to={RouterEmptyPath}></Redirect>\n      </Route>\n    </Switch>\n  );\n};\n\nexport default Router;\n","import { faSearch } from \"@fortawesome/free-solid-svg-icons\";\nimport { capitalize } from \"lodash\";\nimport React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { Container, Row } from \"react-bootstrap\";\nimport { Helmet } from \"react-helmet\";\nimport { Column, TableUpdater } from \"react-table\";\nimport { ContentHeader, PageTable } from \"../../components\";\nimport { buildOrderList, GetItemId } from \"../../utilites\";\n\ninterface Props {\n  type: \"movies\" | \"series\";\n  columns: Column<Wanted.Base>[];\n  state: Readonly<AsyncState<OrderIdState<Wanted.Base>>>;\n  loader: (start: number, length: number) => void;\n  update: (id?: number) => void;\n  searchAll: () => Promise<void>;\n}\n\nconst GenericWantedView: FunctionComponent<Props> = ({\n  type,\n  columns,\n  state,\n  update,\n  loader,\n  searchAll,\n}) => {\n  const typeName = capitalize(type);\n\n  const data = useMemo(() => buildOrderList(state.data), [state.data]);\n\n  const updater = useCallback<TableUpdater<Wanted.Base>>(\n    (row, id: number) => {\n      update(id);\n    },\n    [update]\n  );\n\n  return (\n    <Container fluid>\n      <Helmet>\n        <title>Wanted {typeName} - Bazarr</title>\n      </Helmet>\n      <ContentHeader>\n        <ContentHeader.AsyncButton\n          disabled={data.length === 0}\n          promise={searchAll}\n          onSuccess={update as () => void}\n          icon={faSearch}\n        >\n          Search All\n        </ContentHeader.AsyncButton>\n      </ContentHeader>\n      <Row>\n        <PageTable\n          async\n          asyncState={state}\n          asyncId={GetItemId}\n          asyncLoader={loader}\n          emptyText={`No Missing ${typeName} Subtitles`}\n          columns={columns}\n          externalUpdate={updater}\n          data={data}\n        ></PageTable>\n      </Row>\n    </Container>\n  );\n};\n\nexport default GenericWantedView;\n","import { faSearch } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { Badge } from \"react-bootstrap\";\nimport { Link } from \"react-router-dom\";\nimport { Column } from \"react-table\";\nimport { movieUpdateWantedByRange } from \"../../@redux/actions\";\nimport { useWantedMovies } from \"../../@redux/hooks\";\nimport { useReduxAction } from \"../../@redux/hooks/base\";\nimport { MoviesApi } from \"../../apis\";\nimport { AsyncButton, LanguageText } from \"../../components\";\nimport { BuildKey } from \"../../utilites\";\nimport GenericWantedView from \"../generic\";\n\ninterface Props {}\n\nconst WantedMoviesView: FunctionComponent<Props> = () => {\n  const [movies, update] = useWantedMovies();\n\n  const loader = useReduxAction(movieUpdateWantedByRange);\n\n  const searchAll = useCallback(\n    () => MoviesApi.action({ action: \"search-wanted\" }),\n    []\n  );\n\n  const columns: Column<Wanted.Movie>[] = useMemo<Column<Wanted.Movie>[]>(\n    () => [\n      {\n        Header: \"Name\",\n        accessor: \"title\",\n        Cell: (row) => {\n          const target = `/movies/${row.row.original.radarrId}`;\n          return (\n            <Link to={target}>\n              <span>{row.value}</span>\n            </Link>\n          );\n        },\n      },\n      {\n        Header: \"Missing\",\n        accessor: \"missing_subtitles\",\n        Cell: ({ row, value, externalUpdate }) => {\n          const wanted = row.original;\n          const hi = wanted.hearing_impaired;\n          const movieid = wanted.radarrId;\n\n          return value.map((item, idx) => (\n            <AsyncButton\n              as={Badge}\n              key={BuildKey(idx, item.code2)}\n              className=\"mx-1 mr-2\"\n              variant=\"secondary\"\n              promise={() =>\n                MoviesApi.downloadSubtitles(movieid, {\n                  language: item.code2,\n                  hi,\n                  forced: false,\n                })\n              }\n              onSuccess={() => externalUpdate && externalUpdate(row, movieid)}\n            >\n              <LanguageText className=\"pr-1\" text={item}></LanguageText>\n              <FontAwesomeIcon size=\"sm\" icon={faSearch}></FontAwesomeIcon>\n            </AsyncButton>\n          ));\n        },\n      },\n    ],\n    []\n  );\n\n  return (\n    <GenericWantedView\n      type=\"movies\"\n      columns={columns as Column<Wanted.Base>[]}\n      state={movies}\n      update={update}\n      loader={loader}\n      searchAll={searchAll}\n    ></GenericWantedView>\n  );\n};\n\nexport default WantedMoviesView;\n","import { faSearch } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, { FunctionComponent, useCallback, useMemo } from \"react\";\nimport { Badge } from \"react-bootstrap\";\nimport { Link } from \"react-router-dom\";\nimport { Column } from \"react-table\";\nimport { seriesUpdateWantedByRange } from \"../../@redux/actions\";\nimport { useWantedSeries } from \"../../@redux/hooks\";\nimport { useReduxAction } from \"../../@redux/hooks/base\";\nimport { EpisodesApi, SeriesApi } from \"../../apis\";\nimport { AsyncButton, LanguageText } from \"../../components\";\nimport { BuildKey } from \"../../utilites\";\nimport GenericWantedView from \"../generic\";\n\ninterface Props {}\n\nconst WantedSeriesView: FunctionComponent<Props> = () => {\n  const [series, update] = useWantedSeries();\n\n  const loader = useReduxAction(seriesUpdateWantedByRange);\n\n  const searchAll = useCallback(\n    () => SeriesApi.action({ action: \"search-wanted\" }),\n    []\n  );\n\n  const columns: Column<Wanted.Episode>[] = useMemo<Column<Wanted.Episode>[]>(\n    () => [\n      {\n        Header: \"Name\",\n        accessor: \"seriesTitle\",\n        Cell: (row) => {\n          const target = `/series/${row.row.original.sonarrSeriesId}`;\n          return (\n            <Link to={target}>\n              <span>{row.value}</span>\n            </Link>\n          );\n        },\n      },\n      {\n        Header: \"Episode\",\n        accessor: \"episode_number\",\n      },\n      {\n        accessor: \"episodeTitle\",\n      },\n      {\n        Header: \"Missing\",\n        accessor: \"missing_subtitles\",\n        Cell: ({ row, externalUpdate: update, value }) => {\n          const wanted = row.original;\n          const hi = wanted.hearing_impaired;\n          const seriesid = wanted.sonarrSeriesId;\n          const episodeid = wanted.sonarrEpisodeId;\n\n          return value.map((item, idx) => (\n            <AsyncButton\n              as={Badge}\n              key={BuildKey(idx, item.code2)}\n              className=\"mx-1 mr-2\"\n              variant=\"secondary\"\n              promise={() =>\n                EpisodesApi.downloadSubtitles(seriesid, episodeid, {\n                  language: item.code2,\n                  hi,\n                  forced: false,\n                })\n              }\n              onSuccess={() => update && update(row, episodeid)}\n            >\n              <LanguageText className=\"pr-1\" text={item}></LanguageText>\n              <FontAwesomeIcon size=\"sm\" icon={faSearch}></FontAwesomeIcon>\n            </AsyncButton>\n          ));\n        },\n      },\n    ],\n    []\n  );\n\n  return (\n    <GenericWantedView\n      type=\"series\"\n      columns={columns as Column<Wanted.Base>[]}\n      state={series}\n      update={update}\n      loader={loader}\n      searchAll={searchAll}\n    ></GenericWantedView>\n  );\n};\n\nexport default WantedSeriesView;\n","import React, { FunctionComponent } from \"react\";\nimport { Redirect, Route, Switch } from \"react-router-dom\";\nimport { RouterEmptyPath } from \"../404\";\nimport { useIsRadarrEnabled, useIsSonarrEnabled } from \"../@redux/hooks/site\";\nimport Movies from \"./Movies\";\nimport Series from \"./Series\";\n\nconst Router: FunctionComponent = () => {\n  const sonarr = useIsSonarrEnabled();\n  const radarr = useIsRadarrEnabled();\n  return (\n    <Switch>\n      {sonarr && (\n        <Route exact path=\"/wanted/series\">\n          <Series></Series>\n        </Route>\n      )}\n      {radarr && (\n        <Route exact path=\"/wanted/movies\">\n          <Movies></Movies>\n        </Route>\n      )}\n      <Route path=\"/wanted/*\">\n        <Redirect to={RouterEmptyPath}></Redirect>\n      </Route>\n    </Switch>\n  );\n};\n\nexport default Router;\n","import React, { FunctionComponent, useEffect, useMemo } from \"react\";\nimport { Redirect, Route, Switch, useHistory } from \"react-router-dom\";\nimport EmptyPage, { RouterEmptyPath } from \"../404\";\nimport { useIsRadarrEnabled, useIsSonarrEnabled } from \"../@redux/hooks/site\";\nimport BlacklistRouter from \"../Blacklist/Router\";\nimport HistoryRouter from \"../History/Router\";\nimport MovieRouter from \"../Movies/Router\";\nimport SeriesRouter from \"../Series/Router\";\nimport SettingRouter from \"../Settings/Router\";\nimport SystemRouter from \"../System/Router\";\nimport { ScrollToTop } from \"../utilites\";\nimport WantedRouter from \"../Wanted/Router\";\n\nconst Router: FunctionComponent<{ className?: string }> = ({ className }) => {\n  const sonarr = useIsSonarrEnabled();\n  const radarr = useIsRadarrEnabled();\n  const redirectPath = useMemo(() => {\n    if (sonarr) {\n      return \"/series\";\n    } else if (radarr) {\n      return \"/movies\";\n    } else {\n      return \"/settings\";\n    }\n  }, [sonarr, radarr]);\n\n  const history = useHistory();\n\n  useEffect(() => {\n    ScrollToTop();\n  }, [history.location]);\n\n  return (\n    <div className={className}>\n      <Switch>\n        <Route exact path=\"/\">\n          <Redirect exact to={redirectPath}></Redirect>\n        </Route>\n        {sonarr && (\n          <Route path=\"/series\">\n            <SeriesRouter></SeriesRouter>\n          </Route>\n        )}\n        {radarr && (\n          <Route path=\"/movies\">\n            <MovieRouter></MovieRouter>\n          </Route>\n        )}\n        <Route path=\"/wanted\">\n          <WantedRouter></WantedRouter>\n        </Route>\n        <Route path=\"/history\">\n          <HistoryRouter></HistoryRouter>\n        </Route>\n        <Route path=\"/blacklist\">\n          <BlacklistRouter></BlacklistRouter>\n        </Route>\n        <Route path=\"/settings\">\n          <SettingRouter></SettingRouter>\n        </Route>\n        <Route path=\"/system\">\n          <SystemRouter></SystemRouter>\n        </Route>\n        <Route exact path={RouterEmptyPath}>\n          <EmptyPage></EmptyPage>\n        </Route>\n        <Route path=\"*\">\n          <Redirect to={RouterEmptyPath}></Redirect>\n        </Route>\n      </Switch>\n    </div>\n  );\n};\n\nexport default Router;\n","import { faExclamationTriangle } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport React, {\n  FunctionComponent,\n  useCallback,\n  useEffect,\n  useState,\n} from \"react\";\nimport { Alert, Button, Container, Row } from \"react-bootstrap\";\nimport { Redirect } from \"react-router-dom\";\nimport { bootstrap as ReduxBootstrap } from \"../@redux/actions\";\nimport { useReduxAction, useReduxStore } from \"../@redux/hooks/base\";\nimport { useNotification } from \"../@redux/hooks/site\";\nimport { LoadingIndicator, ModalProvider } from \"../components\";\nimport Sidebar from \"../Sidebar\";\nimport { Reload, useHasUpdateInject } from \"../utilites\";\nimport Header from \"./Header\";\nimport NotificationContainer from \"./notifications\";\nimport Router from \"./Router\";\n\n// Sidebar Toggle\nexport const SidebarToggleContext = React.createContext<() => void>(() => {});\n\ninterface Props {}\n\nconst App: FunctionComponent<Props> = () => {\n  const bootstrap = useReduxAction(ReduxBootstrap);\n\n  const { initialized, auth } = useReduxStore((s) => s.site);\n\n  const notify = useNotification(\"has-update\", 10);\n\n  // Has any update?\n  const hasUpdate = useHasUpdateInject();\n  useEffect(() => {\n    if (initialized) {\n      if (hasUpdate) {\n        notify({\n          type: \"info\",\n          message: \"A new version of Bazarr is ready, restart is required\",\n          // TODO: Restart action\n        });\n      }\n    }\n  }, [initialized, hasUpdate, notify]);\n\n  useEffect(() => {\n    bootstrap();\n  }, [bootstrap]);\n\n  const [sidebar, setSidebar] = useState(false);\n  const toggleSidebar = useCallback(() => setSidebar(!sidebar), [sidebar]);\n\n  if (!auth) {\n    return <Redirect to=\"/login\"></Redirect>;\n  }\n\n  if (typeof initialized === \"boolean\" && initialized === false) {\n    return (\n      <LoadingIndicator>\n        <span>Please wait</span>\n      </LoadingIndicator>\n    );\n  } else if (typeof initialized === \"string\") {\n    return <InitializationErrorView>{initialized}</InitializationErrorView>;\n  }\n\n  return (\n    <SidebarToggleContext.Provider value={toggleSidebar}>\n      <Row noGutters className=\"header-container\">\n        <Header></Header>\n      </Row>\n      <Row noGutters className=\"flex-nowrap\">\n        <Sidebar open={sidebar}></Sidebar>\n        <ModalProvider>\n          <Router className=\"d-flex flex-row flex-grow-1 main-router\"></Router>\n        </ModalProvider>\n      </Row>\n      <NotificationContainer></NotificationContainer>\n    </SidebarToggleContext.Provider>\n  );\n};\n\nconst InitializationErrorView: FunctionComponent<{\n  children: string;\n}> = ({ children }) => {\n  return (\n    <Container className=\"my-3\">\n      <Alert\n        className=\"d-flex flex-nowrap justify-content-between align-items-center\"\n        variant=\"danger\"\n      >\n        <div>\n          <FontAwesomeIcon\n            className=\"mr-2\"\n            icon={faExclamationTriangle}\n          ></FontAwesomeIcon>\n          <span>{children}</span>\n        </div>\n        <Button variant=\"outline-danger\" onClick={Reload}>\n          Reload\n        </Button>\n      </Alert>\n    </Container>\n  );\n};\n\nexport default App;\n","import React, { FunctionComponent, useCallback, useState } from \"react\";\nimport {\n  Alert,\n  Button,\n  Card,\n  Collapse,\n  Form,\n  Image,\n  Spinner,\n} from \"react-bootstrap\";\nimport { Redirect } from \"react-router-dom\";\nimport { siteAuthSuccess } from \"../@redux/actions\";\nimport { useReduxAction, useReduxStore } from \"../@redux/hooks/base\";\nimport logo from \"../@static/logo128.png\";\nimport { SystemApi } from \"../apis\";\nimport \"./style.scss\";\n\ninterface Props {}\n\nconst AuthPage: FunctionComponent<Props> = () => {\n  const [username, setUsername] = useState(\"\");\n  const [password, setPassword] = useState(\"\");\n  const [error, setError] = useState(\"\");\n\n  const [updating, setUpdate] = useState(false);\n\n  const updateError = useCallback((msg: string) => {\n    setError(msg);\n    setTimeout(() => setError(\"\"), 2000);\n  }, []);\n\n  const onSuccess = useReduxAction(siteAuthSuccess);\n\n  const authState = useReduxStore((s) => s.site.auth);\n\n  const onError = useCallback(() => {\n    setUpdate(false);\n    updateError(\"Login Failed\");\n  }, [updateError]);\n\n  if (authState) {\n    return <Redirect to=\"/\"></Redirect>;\n  }\n\n  return (\n    <div className=\"d-flex bg-light vh-100 justify-content-center align-items-center\">\n      <Card className=\"auth-card shadow\">\n        <Form\n          onSubmit={(e) => {\n            e.preventDefault();\n            if (!updating) {\n              setUpdate(true);\n              SystemApi.login(username, password)\n                .then(onSuccess)\n                .catch(onError);\n            }\n          }}\n        >\n          <Card.Body>\n            <Form.Group className=\"mb-5 d-flex justify-content-center\">\n              <Image width=\"64\" height=\"64\" src={logo}></Image>\n            </Form.Group>\n            <Form.Group>\n              <Form.Control\n                disabled={updating}\n                name=\"username\"\n                type=\"text\"\n                placeholder=\"Username\"\n                required\n                onChange={(e) => setUsername(e.currentTarget.value)}\n              ></Form.Control>\n            </Form.Group>\n            <Form.Group>\n              <Form.Control\n                disabled={updating}\n                name=\"password\"\n                type=\"password\"\n                placeholder=\"Password\"\n                required\n                onChange={(e) => setPassword(e.currentTarget.value)}\n              ></Form.Control>\n            </Form.Group>\n            <Collapse in={error.length !== 0}>\n              <div>\n                <Alert variant=\"danger\" className=\"m-0\">\n                  {error}\n                </Alert>\n              </div>\n            </Collapse>\n          </Card.Body>\n          <Card.Footer>\n            <Button type=\"submit\" disabled={updating} block>\n              {updating ? (\n                <Spinner size=\"sm\" animation=\"border\"></Spinner>\n              ) : (\n                \"LOGIN\"\n              )}\n            </Button>\n          </Card.Footer>\n        </Form>\n      </Card>\n    </div>\n  );\n};\n\nexport default AuthPage;\n","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABJZSURBVHhe7Z17cBRFHsdbEEwUeaM85JWIEErAA+9C5GVpAWdELgEOuVSKOuuQE4SSiJAqq6RKr668s4wxQgiVO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LtQMItwQdMMoDymLq1KlqpUMoM68gDrEKFpDkKiKUkJDAzct82Rg2B5D3wsJCuyUPhLJ6jBRXYCkZ9gTS7xCCoakva+N4Buv4yLtaFiSUDWLzxHVcflgWwWTJknn4HTg5n8QbyOOMGTPsz/YQygRhepoF6A1gaCqtjSF4IMHN2ckXMdZBnmDS7TDIQxn8idQsI3HD5ByeyJZCQUOYM2eOo2t6rIE8vPjii04VDyHv3P+yuQMPJOmGpgpBKmAP7xSuxq3gWmEWn5mZqfrnq0JekWeNDTikOjYE+B8uWLCA+yK6FVzbvHnz/DnMIm/ZpGCssZsliE/wT5LlicEU4hjm5OQYmzdv5i5p0QLnxjXg3u4we2cKeUBekCfXVbzbWyLC1cwk4VfjGDIENvxPPfUUS01NZWlpaWzYsGFNjmcciJqaGh4/EaF09+/fz4Mvwy/BBxdIy0l/J8Fa15XEUleEEHYIdwVvV78jZjSAwYMH8zA2iGhGXTLr1q0bo9uI9L6BN465yyb9mLmnEjyS4FyC7fOqq6v5JloIsIiIaN9++y2jkTx/vx/giYNQLAj2i/l7q2eKJiRgoQnPy4h4ZVl6jpJwDYtJ6OI97kMxQjwMRhAfdRzpV6RhpMGkcG1yjP4eeywhji7i7WNzhfAHTAwj8dAAnEgmDRGvCIz4EAlr6fC2xLIqNkC0L69iC11UMF6xmyp20URIdTjFItAuwunj115PihMY+z8OKRI8PD+Q4AAAAABJRU5ErkJggg==\"","import \"@fontsource/roboto/300.css\";\nimport React, { FunctionComponent } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Provider } from \"react-redux\";\nimport { Route, Switch } from \"react-router\";\nimport { BrowserRouter } from \"react-router-dom\";\nimport store from \"./@redux/store\";\nimport \"./@scss/index.scss\";\nimport App from \"./App\";\nimport Auth from \"./Auth\";\nimport { useBaseUrl } from \"./utilites\";\n\nconst MainRouter: FunctionComponent = () => {\n  const baseUrl = useBaseUrl();\n\n  return (\n    <BrowserRouter basename={baseUrl}>\n      <Switch>\n        <Route exact path=\"/login\">\n          <Auth></Auth>\n        </Route>\n        <Route path=\"/\">\n          <App></App>\n        </Route>\n      </Switch>\n    </BrowserRouter>\n  );\n};\n\nReactDOM.render(\n  <Provider store={store}>\n    {/* TODO: Enabled Strict Mode after react-bootstrap upgrade to bootstrap 5 */}\n    {/* <React.StrictMode> */}\n    <MainRouter></MainRouter>\n    {/* </React.StrictMode> */}\n  </Provider>,\n  document.getElementById(\"root\")\n);\n"],"sourceRoot":""}