import{j as s}from"./index-CURqmKkP.js";import{r as n}from"./vendor-animations-CsoOZIH8.js";import{I as e}from"./inputmask-Cr-e3LsO.js";import{T as a}from"./TextInput-ChlOps7_.js";import{T as u}from"./TextInput-CeFymY_W.js";const r={"*":{validator:"[0-9A-Za-z.!@#$%&'*+/=?^_`{|}~-]",casing:"lower"}},i={telegram:new e({mask:"t.me/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/^https?:\/\//g,"")},definitions:r}),twitch:new e({mask:"twitch.com/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/(^https?:\/\/(www.twitch.tv\/)?)|(^www.twitch.tv\/)/g,"")},definitions:r}),youtube:new e({mask:"youtube.com/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/(^https?:\/\/(www.)?)|(^www.)/g,"")},definitions:r}),vk:new e({mask:"vk.com/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/^https?:\/\//g,"")},definitions:r}),vkLive:new e({mask:"live.vkvideo.ru/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/^https?:\/\//g,"")},definitions:r}),kick:new e({mask:"kick.com/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/^https?:\/\//g,"")},definitions:r})},p={telegram:"t.me/",youtube:"youtube.com/",twitch:"twitch.com/",vk:"vk.com/",vkLive:"live.vkvideo.ru/",kick:"kick.com/"};class k extends n.Component{constructor(){super(...arguments),this.inputRef=n.createRef()}componentDidMount(){this.inputRef.current&&!this.props.isLoading&&i[this.props.type].mask(this.inputRef.current)}componentDidUpdate(o){!this.props.isLoading&&this.props.isLoading!==o.isLoading&&this.inputRef.current&&!this.inputRef.current.inputmask&&i[this.props.type].mask(this.inputRef.current)}render(){return this.props.inputVersion===2?s.jsx(a,{inputRef:this.inputRef,title:this.props.title,placeholder:p[this.props.type],value:this.props.value,onChange:o=>this.props.setValue(o),onEnter:this.props.onEnter,errorText:this.props.errorText}):s.jsx(u,{inputRef:this.inputRef,title:this.props.title,placeholder:p[this.props.type],value:this.props.value,onChange:o=>this.props.setValue(o.target.value),onEnter:this.props.onEnter,errorText:this.props.errorText})}}export{k as S};