bonuspluscomponents 0.0.197 → 0.0.198
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -235,4 +235,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
235
235
|
`)),"")}function tO(e,t,r,n){if(!e)return!1;const a=n.formatByString(n.date(pf),t).replace(r,Vo),i=n.formatByString(n.date(ff),t).replace(r,"_"),s=i===a&&e===i;return!s&&n.lib!=="luxon"&&process.env.NODE_ENV!=="production"&&(t.includes("MMM")?console.warn(["Mask does not support literals such as 'MMM'.","Either use numbers with fix length or disable mask feature with 'disableMaskedInput' prop","Falling down to uncontrolled no-mask input."].join(`
|
|
236
236
|
`)):i&&i!==a?console.warn(["Mask does not support numbers with variable length such as 'M'.","Either use numbers with fix length or disable mask feature with 'disableMaskedInput' prop","Falling down to uncontrolled no-mask input."].join(`
|
|
237
237
|
`)):e&&console.warn([`The mask "${e}" you passed is not valid for the format used ${t}.`,"Falling down to uncontrolled no-mask input."].join(`
|
|
238
|
-
`))),s}const rO=(e,t)=>r=>{let n=0;return r.split("").map((o,a)=>{if(t.lastIndex=0,n>e.length-1)return"";const i=e[n],s=e[n+1],l=t.test(o)?o:"",u=i===Vo?l:i+l;return n+=u.length,a===r.length-1&&s&&s!==Vo?u?u+s:"":u}).join("")},nO=({acceptRegex:e=/[\d]/gi,disabled:t,disableMaskedInput:r,ignoreInvalidInputs:n,inputFormat:o,inputProps:a,label:i,mask:s,onChange:l,rawValue:u,readOnly:d,rifmFormatter:p,TextFieldProps:h,validationError:v})=>{const g=et(),m=g.getFormatHelperText(o),{shouldUseMaskedInput:y,maskToUse:E}=w.useMemo(()=>{if(r)return{shouldUseMaskedInput:!1,maskToUse:""};const I=eO(s,o,e,g);return{shouldUseMaskedInput:tO(I,o,e,g),maskToUse:I}},[e,r,o,s,g]),M=w.useMemo(()=>y&&E?rO(E,e):I=>I,[e,E,y]),x=u===null?null:g.date(u),[C,b]=w.useState(x),[T,O]=w.useState(Dc(g,u,o)),j=w.useRef(),L=w.useRef(g.locale),S=w.useRef(o);w.useEffect(()=>{const I=u!==j.current,N=g.locale!==L.current,A=o!==S.current;if(j.current=u,L.current=g.locale,S.current=o,!I&&!N&&!A)return;const H=u===null?null:g.date(u),Z=u===null||g.isValid(H);let ee=C===null&&H===null;if(C!==null&&H!==null){const $=g.isEqual(C,H);if($)ee=!0;else{const F=Math.abs(g.getDiff(C,H));ee=F===0?$:F<1e3}}if(!N&&!A&&(!Z||ee))return;const k=Dc(g,u,o);b(H),O(k)},[g,u,o,C]);const Y=I=>{const N=I===""||I===s?"":I;O(N);const A=N===null?null:g.parse(N,o);n&&!g.isValid(A)||(b(A),l(A,N||void 0))},Q=JD({value:T,onChange:Y,format:p||M});return D({label:i,disabled:t,error:v,inputProps:D({},y?Q:{value:T,onChange:I=>{Y(I.currentTarget.value)}},{disabled:t,placeholder:m,readOnly:d,type:y?"tel":"text"},a)},h)},oO=["className","components","disableOpenPicker","getOpenDialogAriaText","InputAdornmentProps","InputProps","inputRef","openPicker","OpenPickerButtonProps","renderInput"],hf=w.forwardRef(function(t,r){const{className:n,components:o={},disableOpenPicker:a,getOpenDialogAriaText:i,InputAdornmentProps:s,InputProps:l,inputRef:u,openPicker:d,OpenPickerButtonProps:p,renderInput:h}=t,v=fe(t,oO),g=un(),m=i??g.openDatePickerDialogue,y=et(),E=nO(v),M=(s==null?void 0:s.position)||"end",x=o.OpenPickerIcon||zd;return h(D({ref:r,inputRef:u,className:n},E,{InputProps:D({},l,{[`${M}Adornment`]:a?void 0:f.jsx(ZD,D({position:M},s,{children:f.jsx(dn,D({edge:M,disabled:v.disabled||v.readOnly,"aria-label":m(v.rawValue,y)},p,{onClick:d,children:f.jsx(x,{})}))}))})}))});function Oc(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const aO=(e,t)=>{const[r,n]=w.useState(Oc);return zt(()=>{const a=()=>{n(Oc())};return window.addEventListener("orientationchange",a),()=>{window.removeEventListener("orientationchange",a)}},[]),Rd(e,["hours","minutes","seconds"])?!1:(t||r)==="landscape"},iO=({autoFocus:e,openView:t})=>{const[r,n]=w.useState(e?t:null),o=w.useCallback(a=>i=>{n(i?a:s=>a===s?null:s)},[]);return{focusedView:r,setFocusedView:o}};function sO(e){return W.generateUtilityClass("MuiCalendarOrClockPicker",e)}W.generateUtilityClasses("MuiCalendarOrClockPicker",["root","mobileKeyboardInputView"]);const lO=["autoFocus","className","parsedValue","DateInputProps","isMobileKeyboardViewOpen","onDateChange","onViewChange","openTo","orientation","showToolbar","toggleMobileKeyboardView","ToolbarComponent","toolbarFormat","toolbarPlaceholder","toolbarTitle","views","dateRangeIcon","timeIcon","hideTabs","classes"],cO=e=>{const{classes:t}=e,r={root:["root"],mobileKeyboardInputView:["mobileKeyboardInputView"]};return W.unstable_composeClasses(r,sO,t)},uO=ce("div",{name:"MuiCalendarOrClockPicker",slot:"MobileKeyboardInputView",overridesResolver:(e,t)=>t.mobileKeyboardInputView})({padding:"16px 24px"}),dO=ce("div",{name:"MuiCalendarOrClockPicker",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e})=>D({display:"flex",flexDirection:"column"},e.isLandscape&&{flexDirection:"row"})),fO={fullWidth:!0},kc=e=>e==="year"||e==="month"||e==="day",Mc=e=>e==="hours"||e==="minutes"||e==="seconds";let _c=!1;function pO(e){var t,r;const n=Re({props:e,name:"MuiCalendarOrClockPicker"}),{autoFocus:o,parsedValue:a,DateInputProps:i,isMobileKeyboardViewOpen:s,onDateChange:l,onViewChange:u,openTo:d,orientation:p,showToolbar:h,toggleMobileKeyboardView:v,ToolbarComponent:g=()=>null,toolbarFormat:m,toolbarPlaceholder:y,toolbarTitle:E,views:M,dateRangeIcon:x,timeIcon:C,hideTabs:b}=n,T=fe(n,lO),O=(t=T.components)==null?void 0:t.Tabs,j=aO(M,p),L=w.useContext(fn),S=cO(n),Y=h??L!=="desktop",Q=!b&&typeof window<"u"&&window.innerHeight>667,X=w.useCallback((k,$)=>{l(k,L,$)},[l,L]),I=w.useCallback(k=>{s&&v(),u&&u(k)},[s,u,v]);process.env.NODE_ENV!=="production"&&!_c&&!M.includes(d)&&(console.warn(`MUI: \`openTo="${d}"\` is not a valid prop.`,`It must be an element of \`views=["${M.join('", "')}"]\`.`),_c=!0);const{openView:N,setOpenView:A,handleChangeAndOpenNext:H}=Ds({view:void 0,views:M,openTo:d,onChange:X,onViewChange:I}),{focusedView:Z,setFocusedView:ee}=iO({autoFocus:o,openView:N});return f.jsxs(dO,{ownerState:{isLandscape:j},className:S.root,children:[Y&&f.jsx(g,D({},T,{views:M,isLandscape:j,parsedValue:a,onChange:X,setOpenView:A,openView:N,toolbarTitle:E,toolbarFormat:m,toolbarPlaceholder:y,isMobileKeyboardViewOpen:s,toggleMobileKeyboardView:v})),Q&&!!O&&f.jsx(O,D({dateRangeIcon:x,timeIcon:C,view:N,onChange:A},(r=T.componentsProps)==null?void 0:r.tabs)),f.jsx(Os,{children:s?f.jsx(uO,{className:S.mobileKeyboardInputView,children:f.jsx(hf,D({},i,{ignoreInvalidInputs:!0,disableOpenPicker:!0,TextFieldProps:fO}))}):f.jsxs(w.Fragment,{children:[kc(N)&&f.jsx(Xd,D({autoFocus:o,date:a,onViewChange:A,onChange:H,view:N,views:M.filter(kc),focusedView:Z,onFocusedViewChange:ee},T)),Mc(N)&&f.jsx(ef,D({},T,{autoFocus:o,date:a,view:N,views:M.filter(Mc),onChange:H,onViewChange:A,showViewSwitcher:L==="desktop"}))]})})]})}const hO=({open:e,onOpen:t,onClose:r})=>{const n=w.useRef(typeof e=="boolean").current,[o,a]=w.useState(!1);w.useEffect(()=>{if(n){if(typeof e!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");a(e)}},[n,e]);const i=w.useCallback(s=>{n||a(s),s&&t&&t(),!s&&r&&r()},[n,t,r]);return{isOpen:o,setIsOpen:i}},mO=(e,t)=>{const{onAccept:r,onChange:n,value:o,closeOnSelect:a}=e,i=et(),{isOpen:s,setIsOpen:l}=hO(e),u=w.useMemo(()=>t.parseInput(i,o),[t,i,o]),[d,p]=w.useState(u),[h,v]=w.useState(()=>({committed:u,draft:u,resetFallback:u})),g=w.useCallback(T=>{v(O=>{switch(T.action){case"setAll":case"acceptAndClose":return{draft:T.value,committed:T.value,resetFallback:T.value};case"setCommitted":return D({},O,{draft:T.value,committed:T.value});case"setDraft":return D({},O,{draft:T.value});default:return O}}),(T.forceOnChangeCall||!T.skipOnChangeCall&&!t.areValuesEqual(i,h.committed,T.value))&&n(T.value),T.action==="acceptAndClose"&&(l(!1),r&&!t.areValuesEqual(i,h.resetFallback,T.value)&&r(T.value))},[r,n,l,h,i,t]);w.useEffect(()=>{i.isValid(u)&&p(u)},[i,u]),w.useEffect(()=>{s&&g({action:"setAll",value:u,skipOnChangeCall:!0})},[s]),t.areValuesEqual(i,h.committed,u)||g({action:"setCommitted",value:u,skipOnChangeCall:!0});const m=w.useMemo(()=>({open:s,onClear:()=>{g({value:t.emptyValue,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,t.emptyValue)})},onAccept:()=>{g({value:h.draft,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,u)})},onDismiss:()=>{g({value:h.committed,action:"acceptAndClose"})},onCancel:()=>{g({value:h.resetFallback,action:"acceptAndClose"})},onSetToday:()=>{g({value:t.getTodayValue(i),action:"acceptAndClose"})}}),[g,s,i,h,t,o,u]),[y,E]=w.useState(!1),M=w.useMemo(()=>({parsedValue:h.draft,isMobileKeyboardViewOpen:y,toggleMobileKeyboardView:()=>E(!y),onDateChange:(T,O,j="partial")=>{switch(j){case"shallow":return g({action:"setDraft",value:T,skipOnChangeCall:!0});case"partial":return g({action:"setDraft",value:T});case"finish":return g(a??O==="desktop"?{value:T,action:"acceptAndClose"}:{value:T,action:"setCommitted"});default:throw new Error("MUI: Invalid selectionState passed to `onDateChange`")}}}),[g,y,h.draft,a]),x=w.useCallback((T,O)=>{const j=t.valueReducer?t.valueReducer(i,d,T):T;n(j,O)},[n,t,d,i]),C=w.useMemo(()=>({onChange:x,open:s,rawValue:o,openPicker:()=>l(!0)}),[x,s,o,l]),b={pickerProps:M,inputProps:C,wrapperProps:m};return w.useDebugValue(b,()=>({MuiPickerState:{dateState:h,other:b}})),b},vO=["onChange","PopperProps","PaperProps","ToolbarComponent","TransitionComponent","value","components","componentsProps"],mf=w.forwardRef(function(t,r){const n=VP(t,"MuiDesktopDatePicker"),o=IE(n)!==null,{pickerProps:a,inputProps:i,wrapperProps:s}=mO(n,WP),{PopperProps:l,PaperProps:u,ToolbarComponent:d=gD,TransitionComponent:p,components:h,componentsProps:v}=n,g=fe(n,vO),m=D({},i,g,{components:h,componentsProps:v,ref:r,validationError:o});return f.jsx(YD,D({},s,{DateInputProps:m,KeyboardDateInputComponent:hf,PopperProps:l,PaperProps:u,TransitionComponent:p,components:h,componentsProps:v,children:f.jsx(pO,D({},a,{autoFocus:!0,toolbarTitle:n.label||n.toolbarTitle,ToolbarComponent:d,DateInputProps:m,components:h,componentsProps:v},g))}))});process.env.NODE_ENV!=="production"&&(mf.propTypes={acceptRegex:c.instanceOf(RegExp),autoFocus:c.bool,children:c.node,className:c.string,closeOnSelect:c.bool,components:c.object,componentsProps:c.object,dayOfWeekFormatter:c.func,defaultCalendarMonth:c.any,disabled:c.bool,disableFuture:c.bool,disableHighlightToday:c.bool,disableMaskedInput:c.bool,disableOpenPicker:c.bool,disablePast:c.bool,getOpenDialogAriaText:c.func,getViewSwitchingButtonText:c.func,ignoreInvalidInputs:c.bool,InputAdornmentProps:c.object,inputFormat:c.string,InputProps:c.object,inputRef:c.oneOfType([c.func,c.shape({current:c.object})]),label:c.node,leftArrowButtonText:c.string,loading:c.bool,mask:c.string,maxDate:c.any,minDate:c.any,onAccept:c.func,onChange:c.func.isRequired,onClose:c.func,onError:c.func,onMonthChange:c.func,onOpen:c.func,onViewChange:c.func,onYearChange:c.func,open:c.bool,OpenPickerButtonProps:c.object,openTo:c.oneOf(["day","month","year"]),orientation:c.oneOf(["landscape","portrait"]),PaperProps:c.object,PopperProps:c.object,readOnly:c.bool,reduceAnimations:c.bool,renderDay:c.func,renderInput:c.func.isRequired,renderLoading:c.func,rifmFormatter:c.func,rightArrowButtonText:c.string,shouldDisableDate:c.func,shouldDisableMonth:c.func,shouldDisableYear:c.func,showDaysOutsideCurrentMonth:c.bool,showToolbar:c.bool,ToolbarComponent:c.elementType,toolbarFormat:c.string,toolbarPlaceholder:c.node,toolbarTitle:c.node,TransitionComponent:c.elementType,value:c.any,views:c.arrayOf(c.oneOf(["day","month","year"]).isRequired)});const hi=({title:e,value:t,readonly:r,onChange:n,required:o,id:a,fullWidth:i=!0})=>f.jsx(mf,{disabled:r,label:e,value:t,onChange:s=>n(s),renderInput:s=>{var u,d,p;let l;return(u=s.inputProps)!=null&&u.placeholder&&(l=(p=(d=s.inputProps)==null?void 0:d.placeholder)==null?void 0:p.slice(),s.inputProps.placeholder=void 0),f.jsx(W.TextField,{...s,required:o,sx:{width:"100%"},placeholder:l,autoComplete:"off",variant:"standard",error:!1})}});var Ms={},gO=ft;Object.defineProperty(Ms,"__esModule",{value:!0});var mi=Ms.default=void 0,yO=gO(pt()),bO=f,xO=(0,yO.default)((0,bO.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");mi=Ms.default=xO;var _s={},wO=ft;Object.defineProperty(_s,"__esModule",{value:!0});var vf=_s.default=void 0,CO=wO(pt()),EO=f,TO=(0,CO.default)((0,EO.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");vf=_s.default=TO;const PO=({dates:e,readonly:t,onChange:r,title:n})=>{const[o,a]=R.useState(Math.random()),[i,s]=R.useState(e??[null]),{ToIsoWithoutTimeZone:l,ParseDataToRusLocale:u}=Gn();R.useEffect(()=>{r(i.filter(h=>!!h&&Date.parse(h)).map(h=>l(h)).join(","))},[i]);const d=()=>{s(h=>[...h,null]),a(Math.random())},p=h=>{s(v=>[...v.filter((g,m)=>m!==h)]),a(Math.random())};return i.length<2?f.jsx(jo,{dateAdapter:ci,locale:ui,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(hi,{id:"",title:n??"День рождения родственника",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(v=>(v[i.length-1]=h,[...v]))}),!!Date.parse(i[0]??"")&&!t&&f.jsx(W.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(mi,{})})]})}):f.jsxs("div",{children:[f.jsx("div",{style:{marginBottom:"1em"},children:"День рождения родственников"}),f.jsx("div",{style:{borderLeft:"solid 1px #88888850",paddingLeft:"1em"},children:f.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[f.jsx("div",{style:{display:"flex",gap:"1em",flexWrap:"wrap"},children:i.filter((h,v)=>v<i.length-1).map((h,v)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em",backgroundColor:"rgba(204, 204, 204, 0.5)",padding:"0 .5em",borderRadius:"5px"},children:[f.jsx("div",{children:h&&u(h.toString())}),f.jsx("div",{children:!t&&f.jsx(W.IconButton,{size:"small",color:"primary",onClick:()=>p(v),children:f.jsx(vf,{})})})]},v))}),f.jsx("div",{children:f.jsx(jo,{dateAdapter:ci,locale:ui,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(hi,{id:"",title:"День рождения",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(v=>(v[i.length-1]=h,[...v]))}),!t&&f.jsx(W.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(mi,{})})]})})})]})})]})},DO=({id:e,defaultChecked:t,title:r,readonly:n,required:o,onChange:a,value:i})=>{const s=W.useTheme(),l=(u,d=!1)=>{if(!o)return;const p=new CustomEvent(In,{detail:{id:e,empty:!u,label:r}});document.dispatchEvent(p)};return R.useEffect(()=>{setTimeout(()=>l(i),1)},[]),R.useEffect(()=>{l(i,!0)},[i]),f.jsxs("div",{style:{display:"flex",gap:"1em",alignItems:"center"},children:[f.jsx(W.Checkbox,{required:o,sx:{padding:0},readOnly:n,checked:i,onChange:()=>a(!i)}),f.jsx(W.Box,{sx:{fontSize:"1rem",a:{color:s.palette.info.main,textDecoration:"none"}},component:"div",dangerouslySetInnerHTML:{__html:r}})]})},OO=({control:e,isReg:t,readonlyControls:r,onChangeRadio:n})=>{var a,i,s,l,u,d;const o=(p,h=!1)=>{if(!e.validation.required)return;const v=new CustomEvent(In,{detail:{id:e.id,empty:!p,label:e.title}});document.dispatchEvent(v)};return R.useEffect(()=>{setTimeout(()=>{var p,h;return o((h=(p=e.values)==null?void 0:p.find(v=>v.selected))==null?void 0:h.id)},1)},[]),f.jsx(W.Box,{sx:{minWidth:120},children:f.jsxs(W.FormControl,{fullWidth:!0,variant:"standard",required:(a=e==null?void 0:e.validation)==null?void 0:a.required,children:[f.jsx(W.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(W.Select,{required:(i=e==null?void 0:e.validation)==null?void 0:i.required,readOnly:!t&&((s=e==null?void 0:e.validation)==null?void 0:s.readOnly)&&(r==null?void 0:r.includes(e.id)),labelId:`select-${e.id}`,value:((u=(l=e.values)==null?void 0:l.find(p=>p.selected))==null?void 0:u.id)||"",label:e.title,onChange:p=>{var v,g;(v=e.values)==null||v.filter(m=>m.id!==p.target.value).forEach(m=>m.selected=!1);let h=(g=e.values)==null?void 0:g.find(m=>m.id===p.target.value);h&&(o(!0,!0),h.selected=!0),n({...e,values:e.values})},children:(d=e.values)==null?void 0:d.map(p=>f.jsx(W.MenuItem,{value:p.id,children:p.text},p.id))})]})})},kO=({control:e,value:t,onChange:r,onChangeRadio:n,onChangeChecked:o,isReg:a,readonlyControls:i})=>{var s,l,u,d,p,h,v,g;switch(e.type){case Er.Textbox:return f.jsx(No,{value:t,onChange:m=>r(m.target.value),required:(s=e==null?void 0:e.validation)==null?void 0:s.required,id:e.id,label:e.title,disabled:!a&&((l=e==null?void 0:e.validation)==null?void 0:l.readOnly)&&(i==null?void 0:i.includes(e.id)),autoComplete:"off",variant:"standard",fullWidth:!0});case Er.RadiobuttonGroup:return f.jsx(OO,{control:e,isReg:a,readonlyControls:i,onChangeRadio:n});case Er.Select:return f.jsx(W.Box,{sx:{minWidth:120,maxHeight:"400px"},children:f.jsxs(W.FormControl,{fullWidth:!0,variant:"standard",required:(u=e==null?void 0:e.validation)==null?void 0:u.required,children:[f.jsx(W.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(W.Select,{sx:{maxHeight:"300px"},readOnly:!a&&((d=e==null?void 0:e.validation)==null?void 0:d.readOnly)&&(i==null?void 0:i.includes(e.id)),labelId:`select-${e.id}`,value:e.text,label:e.title,onChange:m=>r(m.target.value),children:(p=e.values)==null?void 0:p.map(m=>f.jsx(W.MenuItem,{value:m.id,children:m.text},m.id))})]})});case Er.Date:return f.jsx(jo,{dateAdapter:ci,locale:ui,children:f.jsx(hi,{id:e.id,title:e.title,value:t,readonly:!a&&((h=e==null?void 0:e.validation)==null?void 0:h.readOnly)&&!!(i!=null&&i.includes(e.id)),onChange:m=>r(m),required:(v=e==null?void 0:e.validation)==null?void 0:v.required})});case Er.ParentBirthday:return f.jsx(PO,{title:e.title,onChange:m=>r(m),readonly:!a,dates:e.dates??[null]});case Er.Checkbox:return f.jsx(DO,{id:e.id,onChange:m=>o(m),required:(g=e==null?void 0:e.validation)==null?void 0:g.required,readonly:!a,value:e.checked,title:e.title,defaultChecked:e.defaultChecked})}return f.jsx("div",{})},MO=e=>{const t=()=>{const n=new RegExp(/^\.*/);return e.type!==null?e.type===Cn.Email?new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/):e.type===Cn.Url||e.type===Cn.Date?n:e.type===Cn.Phone?new RegExp(/^[+]?[\d]{10,11}$/):n:n},r=n=>{let o=!0;return e!=null&&e.minTextLength&&(o=o&&n.length>=(e==null?void 0:e.minTextLength)),e!=null&&e.maxTextLength&&(o=o&&n.length<=(e==null?void 0:e.maxTextLength)),o};return n=>t().test(n)?r(n)?{isError:!1}:{isError:!0,message:`Строка не удовлетворяет нужному размеру (${e.minTextLength??0}-${e.maxTextLength??255})`}:{isError:!0,message:"Строка введена неверно"}},gf=({onControlsGet:e,buttonSaveText:t,isReg:r=!1,previewControls:n})=>{const{apiAxios:o,additionalData:a,VKUserId:i,setCabinetSettings:s,setPhoneNumber:l,telegramInfo:u,linkId:d,refferalCode:p,cabinetUISettings:h}=R.useContext(dt),{setIsLoading:v}=R.useContext(fr),{showErrorAlert:g}=R.useContext(ir),{setOpenedPage:m}=R.useContext(Fn),[y,E]=R.useState(!1),[M,x]=R.useState(n??[]);R.useEffect(()=>{x(n??[])},[n]);const[C,b]=R.useState([]),[T,O]=R.useState(Math.random()),[j,L]=R.useState(!1),{validationPopup:S,formIsValid:Y,setValidations:Q}=ms({}),{ToIsoWithoutTimeZone:X}=Gn();R.useEffect(()=>{Q(M.map(k=>({id:k.id,label:k.title,validator:MO(k.validation)})))},[M]);const I=()=>{const k={};return M.map($=>k[$.id]=$.text),k};R.useEffect(()=>{n||(async()=>{v("GetControls",!0);const $=await o().post("/externalCustomerCabinet/form/registration",{});e==null||e($.data.controls);let F=$.data.controls;F.some(U=>U.id==="parentphone")&&p&&(F=F.filter(U=>U.id!=="parentphone")),x(F),b($.data.controls.filter(U=>{var q;return((q=U.validation)==null?void 0:q.readOnly)&&!!U.text})),v("GetControls",!1)})()},[]);const N=()=>{Y()&&!n&&(L(!0),o().patch("/externalCustomerCabinet/form/registration",{recommend:p,linkId:d,controls:M,...a,VKUserId:i,...u??{}}).then(k=>{s($=>({...$,isReg:!1})),l(k.data.phoneNumber),E(!0),m("info"),b(M.filter($=>{var F;return((F=$.validation)==null?void 0:F.readOnly)&&!!$.text})),r&&(h!=null&&h.ymIdentifier)&&(h!=null&&h.ymReachGoalIdentifier)&&ym(h==null?void 0:h.ymIdentifier,"reachGoal",h==null?void 0:h.ymReachGoalIdentifier)}).catch(k=>{g(k.response.data.msg)}).finally(()=>{L(!1)}))},A=(k,$)=>{Date.parse($)&&($=X($)),x(F=>{const U=F.find(q=>q.id===k);return U&&(U.text=$),[...F]})},H=(k,$)=>{x(F=>{const U=F.find(q=>q.id===k);return U&&(U.checked=$),[...F]})},Z=k=>{x($=>{let F=$.find(U=>U.id===k.id);return F&&(F={...k},O(Math.random())),[...$]})};return{controlsForm:f.jsxs(W.Container,{maxWidth:"sm",children:[S,f.jsxs(W.Typography,{component:"div",style:{display:"flex",flexDirection:"column",gap:"1.5em",marginBottom:"1em"},children:[f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:M==null?void 0:M.map((k,$)=>f.jsx("div",{children:f.jsx(kO,{isReg:r,control:k,onChange:F=>A(k.id,F),onChangeChecked:F=>H(k.id,F),onChangeRadio:F=>Z(F),value:k.text??"",readonlyControls:C.map(F=>F.id)})},$))}),f.jsx("div",{style:{display:"flex",justifyContent:"center"},children:f.jsx(hs,{isLoading:j,onClick:()=>N(),children:t||"Сохранить анкету"})})]})]}),setControls:x,saved:y,setSaved:E,GetObjectByControls:I}},_O=()=>{R.useContext(dt);const{controlsForm:e,saved:t,setSaved:r}=gf({buttonSaveText:"Регистрация",isReg:!0});return f.jsx("div",{children:f.jsxs("div",{children:[f.jsx(ca,{style:{marginBottom:"1em"},children:"Для использования полного функционала бота необходимо зарегистрироваться"}),e]})})},RO=()=>{const{controlsForm:e,saved:t,setSaved:r}=gf({buttonSaveText:"Редактирование анкеты",isReg:!1});return f.jsx("div",{children:e})},SO=({})=>{const{cabinetSettings:e}=R.useContext(dt),{currentMode:t}=R.useContext(ln);return f.jsx(W.Backdrop,{sx:{color:"#fff",zIndex:r=>r.zIndex.drawer+1,backgroundColor:t==="light"?"#e9e9e9":"#191919"},open:!!e&&!(e!=null&&e.cabinetEnabled),children:f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em",alignItems:"center"},children:f.jsx("div",{children:"Бот сейчас отключен"})})})},$O=({showHeader:e})=>{var m;const{cabinetSettings:t,cabinetUISettings:r}=R.useContext(dt),{setTheme:n,theme:o,currentMode:a}=R.useContext(ln),{isLoading:i}=R.useContext(fr),{openedPage:s,setOpenedPage:l}=R.useContext(Fn),u=(y,E)=>{l(E)},d=()=>{var y,E,M,x,C,b,T,O,j,L,S,Y,Q,X,I,N,A,H,Z,ee,k,$,F,U,q,J,re,B,V,z,oe,ue;return a==="light"?{primary:{main:((E=(y=r==null?void 0:r.theme)==null?void 0:y.light)==null?void 0:E.theme)??"#ffffff",contrastText:((x=(M=r==null?void 0:r.theme)==null?void 0:M.light)==null?void 0:x.text)??"#ffffff"},text:{primary:((b=(C=r==null?void 0:r.theme)==null?void 0:C.light)==null?void 0:b.theme)??"#ffffff"},background:{default:((O=(T=r==null?void 0:r.theme)==null?void 0:T.light)==null?void 0:O.background)??"#ffffff"},components:{MuiPaper:{styleOverrides:{root:{backgroundColor:((L=(j=r==null?void 0:r.theme)==null?void 0:j.light)==null?void 0:L.background)??"#ffffff"}}},MuiInput:{styleOverrides:{root:{color:((Y=(S=r==null?void 0:r.theme)==null?void 0:S.light)==null?void 0:Y.theme)??"#ffffff","&::before":{borderBottom:`solid 1px ${((X=(Q=r==null?void 0:r.theme)==null?void 0:Q.light)==null?void 0:X.theme)??"#ffffff"}`}}}},MuiFormLabel:{styleOverrides:{root:{color:((N=(I=r==null?void 0:r.theme)==null?void 0:I.light)==null?void 0:N.theme)??"#ffffff"}}}}}:{primary:{main:((H=(A=r==null?void 0:r.theme)==null?void 0:A.dark)==null?void 0:H.theme)??"#ffffff",contrastText:((ee=(Z=r==null?void 0:r.theme)==null?void 0:Z.dark)==null?void 0:ee.text)??"#000000"},text:{primary:(($=(k=r==null?void 0:r.theme)==null?void 0:k.dark)==null?void 0:$.theme)??"#ffffff"},background:{default:((U=(F=r==null?void 0:r.theme)==null?void 0:F.dark)==null?void 0:U.background)??"#000000"},components:{MuiPaper:{styleOverrides:{root:{backgroundColor:((J=(q=r==null?void 0:r.theme)==null?void 0:q.dark)==null?void 0:J.background)??"#000000"}}},MuiInput:{styleOverrides:{root:{color:((B=(re=r==null?void 0:r.theme)==null?void 0:re.dark)==null?void 0:B.theme)??"#ffffff","&::before":{borderBottom:`solid 1px ${((z=(V=r==null?void 0:r.theme)==null?void 0:V.dark)==null?void 0:z.theme)??"#ffffff"}`}}}},MuiFormLabel:{styleOverrides:{root:{color:((ue=(oe=r==null?void 0:r.theme)==null?void 0:oe.dark)==null?void 0:ue.theme)??"#000000"}}}}}};R.useEffect(()=>{const y=d();n(E=>({...bi,palette:{...E.palette,...y},components:{...E.components,...y.components}}))},[r]);const{popups:p,closePopupById:h}=R.useContext(ir),g=[{icon:f.jsx(Mu,{}),value:"info",label:"Карта",page:f.jsx(x1,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ou,{}),value:"receipt",label:"История",page:f.jsx(Xb,{}),active:t==null?void 0:t.canShowPurchaseHistory,disabled:t==null?void 0:t.isReg},{icon:f.jsx(_u,{}),value:"appeals",label:"Обращения",page:f.jsx(S0,{}),active:t==null?void 0:t.canShowAppeals,disabled:t==null?void 0:t.isReg},{icon:f.jsx(_o,{}),value:"businessInfo",label:"Информация",page:f.jsx(Qb,{}),active:t==null?void 0:t.canShowBusinessInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(ku,{}),value:"personInfo",label:"Клиент",page:f.jsx(RO,{}),active:t==null?void 0:t.canEditPersonInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ru,{}),value:"registration",label:"Регистрация",page:f.jsx(_O,{}),active:t==null?void 0:t.isReg,disabled:!1}].filter(y=>y.active&&!y.disabled);return f.jsxs(W.Box,{sx:{bgcolor:"background.default"},className:"page_view",children:[e&&f.jsx($c,{}),f.jsx($0,{show:i}),f.jsx(SO,{}),p.map((y,E)=>f.jsx(zu,{title:y.title,opened:!0,setOpened:()=>h(y.id),children:f.jsx("div",{children:y.content})})),f.jsx("div",{className:"page_view__page scrollbar",children:(m=g.find(y=>y.value===s))==null?void 0:m.page}),f.jsx("div",{className:"page_view__navigation",children:f.jsx("div",{children:f.jsx(W.BottomNavigation,{sx:{borderTop:"solid 1px #88888850",bgcolor:"background.default"},value:s,onChange:u,children:g.map((y,E)=>f.jsx(W.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:y.label,value:y.value,icon:y.icon},E))})})})]})};exports.AppContext=dt;exports.AppProvider=Ff;exports.BonusPlusThemeContext=ln;exports.BonusPlusThemeProvider=Uf;exports.ErrorBoundary=Yf;exports.Header=$c;exports.LoadingContext=fr;exports.LoadingProvider=Nf;exports.PageContext=Fn;exports.PageProvider=If;exports.PopupContext=ir;exports.PopupProvider=Lb;exports.Router=$O;
|
|
238
|
+
`))),s}const rO=(e,t)=>r=>{let n=0;return r.split("").map((o,a)=>{if(t.lastIndex=0,n>e.length-1)return"";const i=e[n],s=e[n+1],l=t.test(o)?o:"",u=i===Vo?l:i+l;return n+=u.length,a===r.length-1&&s&&s!==Vo?u?u+s:"":u}).join("")},nO=({acceptRegex:e=/[\d]/gi,disabled:t,disableMaskedInput:r,ignoreInvalidInputs:n,inputFormat:o,inputProps:a,label:i,mask:s,onChange:l,rawValue:u,readOnly:d,rifmFormatter:p,TextFieldProps:h,validationError:v})=>{const g=et(),m=g.getFormatHelperText(o),{shouldUseMaskedInput:y,maskToUse:E}=w.useMemo(()=>{if(r)return{shouldUseMaskedInput:!1,maskToUse:""};const I=eO(s,o,e,g);return{shouldUseMaskedInput:tO(I,o,e,g),maskToUse:I}},[e,r,o,s,g]),M=w.useMemo(()=>y&&E?rO(E,e):I=>I,[e,E,y]),x=u===null?null:g.date(u),[C,b]=w.useState(x),[T,O]=w.useState(Dc(g,u,o)),j=w.useRef(),L=w.useRef(g.locale),S=w.useRef(o);w.useEffect(()=>{const I=u!==j.current,N=g.locale!==L.current,A=o!==S.current;if(j.current=u,L.current=g.locale,S.current=o,!I&&!N&&!A)return;const H=u===null?null:g.date(u),Z=u===null||g.isValid(H);let ee=C===null&&H===null;if(C!==null&&H!==null){const $=g.isEqual(C,H);if($)ee=!0;else{const F=Math.abs(g.getDiff(C,H));ee=F===0?$:F<1e3}}if(!N&&!A&&(!Z||ee))return;const k=Dc(g,u,o);b(H),O(k)},[g,u,o,C]);const Y=I=>{const N=I===""||I===s?"":I;O(N);const A=N===null?null:g.parse(N,o);n&&!g.isValid(A)||(b(A),l(A,N||void 0))},Q=JD({value:T,onChange:Y,format:p||M});return D({label:i,disabled:t,error:v,inputProps:D({},y?Q:{value:T,onChange:I=>{Y(I.currentTarget.value)}},{disabled:t,placeholder:m,readOnly:d,type:y?"tel":"text"},a)},h)},oO=["className","components","disableOpenPicker","getOpenDialogAriaText","InputAdornmentProps","InputProps","inputRef","openPicker","OpenPickerButtonProps","renderInput"],hf=w.forwardRef(function(t,r){const{className:n,components:o={},disableOpenPicker:a,getOpenDialogAriaText:i,InputAdornmentProps:s,InputProps:l,inputRef:u,openPicker:d,OpenPickerButtonProps:p,renderInput:h}=t,v=fe(t,oO),g=un(),m=i??g.openDatePickerDialogue,y=et(),E=nO(v),M=(s==null?void 0:s.position)||"end",x=o.OpenPickerIcon||zd;return h(D({ref:r,inputRef:u,className:n},E,{InputProps:D({},l,{[`${M}Adornment`]:a?void 0:f.jsx(ZD,D({position:M},s,{children:f.jsx(dn,D({edge:M,disabled:v.disabled||v.readOnly,"aria-label":m(v.rawValue,y)},p,{onClick:d,children:f.jsx(x,{})}))}))})}))});function Oc(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const aO=(e,t)=>{const[r,n]=w.useState(Oc);return zt(()=>{const a=()=>{n(Oc())};return window.addEventListener("orientationchange",a),()=>{window.removeEventListener("orientationchange",a)}},[]),Rd(e,["hours","minutes","seconds"])?!1:(t||r)==="landscape"},iO=({autoFocus:e,openView:t})=>{const[r,n]=w.useState(e?t:null),o=w.useCallback(a=>i=>{n(i?a:s=>a===s?null:s)},[]);return{focusedView:r,setFocusedView:o}};function sO(e){return W.generateUtilityClass("MuiCalendarOrClockPicker",e)}W.generateUtilityClasses("MuiCalendarOrClockPicker",["root","mobileKeyboardInputView"]);const lO=["autoFocus","className","parsedValue","DateInputProps","isMobileKeyboardViewOpen","onDateChange","onViewChange","openTo","orientation","showToolbar","toggleMobileKeyboardView","ToolbarComponent","toolbarFormat","toolbarPlaceholder","toolbarTitle","views","dateRangeIcon","timeIcon","hideTabs","classes"],cO=e=>{const{classes:t}=e,r={root:["root"],mobileKeyboardInputView:["mobileKeyboardInputView"]};return W.unstable_composeClasses(r,sO,t)},uO=ce("div",{name:"MuiCalendarOrClockPicker",slot:"MobileKeyboardInputView",overridesResolver:(e,t)=>t.mobileKeyboardInputView})({padding:"16px 24px"}),dO=ce("div",{name:"MuiCalendarOrClockPicker",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e})=>D({display:"flex",flexDirection:"column"},e.isLandscape&&{flexDirection:"row"})),fO={fullWidth:!0},kc=e=>e==="year"||e==="month"||e==="day",Mc=e=>e==="hours"||e==="minutes"||e==="seconds";let _c=!1;function pO(e){var t,r;const n=Re({props:e,name:"MuiCalendarOrClockPicker"}),{autoFocus:o,parsedValue:a,DateInputProps:i,isMobileKeyboardViewOpen:s,onDateChange:l,onViewChange:u,openTo:d,orientation:p,showToolbar:h,toggleMobileKeyboardView:v,ToolbarComponent:g=()=>null,toolbarFormat:m,toolbarPlaceholder:y,toolbarTitle:E,views:M,dateRangeIcon:x,timeIcon:C,hideTabs:b}=n,T=fe(n,lO),O=(t=T.components)==null?void 0:t.Tabs,j=aO(M,p),L=w.useContext(fn),S=cO(n),Y=h??L!=="desktop",Q=!b&&typeof window<"u"&&window.innerHeight>667,X=w.useCallback((k,$)=>{l(k,L,$)},[l,L]),I=w.useCallback(k=>{s&&v(),u&&u(k)},[s,u,v]);process.env.NODE_ENV!=="production"&&!_c&&!M.includes(d)&&(console.warn(`MUI: \`openTo="${d}"\` is not a valid prop.`,`It must be an element of \`views=["${M.join('", "')}"]\`.`),_c=!0);const{openView:N,setOpenView:A,handleChangeAndOpenNext:H}=Ds({view:void 0,views:M,openTo:d,onChange:X,onViewChange:I}),{focusedView:Z,setFocusedView:ee}=iO({autoFocus:o,openView:N});return f.jsxs(dO,{ownerState:{isLandscape:j},className:S.root,children:[Y&&f.jsx(g,D({},T,{views:M,isLandscape:j,parsedValue:a,onChange:X,setOpenView:A,openView:N,toolbarTitle:E,toolbarFormat:m,toolbarPlaceholder:y,isMobileKeyboardViewOpen:s,toggleMobileKeyboardView:v})),Q&&!!O&&f.jsx(O,D({dateRangeIcon:x,timeIcon:C,view:N,onChange:A},(r=T.componentsProps)==null?void 0:r.tabs)),f.jsx(Os,{children:s?f.jsx(uO,{className:S.mobileKeyboardInputView,children:f.jsx(hf,D({},i,{ignoreInvalidInputs:!0,disableOpenPicker:!0,TextFieldProps:fO}))}):f.jsxs(w.Fragment,{children:[kc(N)&&f.jsx(Xd,D({autoFocus:o,date:a,onViewChange:A,onChange:H,view:N,views:M.filter(kc),focusedView:Z,onFocusedViewChange:ee},T)),Mc(N)&&f.jsx(ef,D({},T,{autoFocus:o,date:a,view:N,views:M.filter(Mc),onChange:H,onViewChange:A,showViewSwitcher:L==="desktop"}))]})})]})}const hO=({open:e,onOpen:t,onClose:r})=>{const n=w.useRef(typeof e=="boolean").current,[o,a]=w.useState(!1);w.useEffect(()=>{if(n){if(typeof e!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");a(e)}},[n,e]);const i=w.useCallback(s=>{n||a(s),s&&t&&t(),!s&&r&&r()},[n,t,r]);return{isOpen:o,setIsOpen:i}},mO=(e,t)=>{const{onAccept:r,onChange:n,value:o,closeOnSelect:a}=e,i=et(),{isOpen:s,setIsOpen:l}=hO(e),u=w.useMemo(()=>t.parseInput(i,o),[t,i,o]),[d,p]=w.useState(u),[h,v]=w.useState(()=>({committed:u,draft:u,resetFallback:u})),g=w.useCallback(T=>{v(O=>{switch(T.action){case"setAll":case"acceptAndClose":return{draft:T.value,committed:T.value,resetFallback:T.value};case"setCommitted":return D({},O,{draft:T.value,committed:T.value});case"setDraft":return D({},O,{draft:T.value});default:return O}}),(T.forceOnChangeCall||!T.skipOnChangeCall&&!t.areValuesEqual(i,h.committed,T.value))&&n(T.value),T.action==="acceptAndClose"&&(l(!1),r&&!t.areValuesEqual(i,h.resetFallback,T.value)&&r(T.value))},[r,n,l,h,i,t]);w.useEffect(()=>{i.isValid(u)&&p(u)},[i,u]),w.useEffect(()=>{s&&g({action:"setAll",value:u,skipOnChangeCall:!0})},[s]),t.areValuesEqual(i,h.committed,u)||g({action:"setCommitted",value:u,skipOnChangeCall:!0});const m=w.useMemo(()=>({open:s,onClear:()=>{g({value:t.emptyValue,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,t.emptyValue)})},onAccept:()=>{g({value:h.draft,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,u)})},onDismiss:()=>{g({value:h.committed,action:"acceptAndClose"})},onCancel:()=>{g({value:h.resetFallback,action:"acceptAndClose"})},onSetToday:()=>{g({value:t.getTodayValue(i),action:"acceptAndClose"})}}),[g,s,i,h,t,o,u]),[y,E]=w.useState(!1),M=w.useMemo(()=>({parsedValue:h.draft,isMobileKeyboardViewOpen:y,toggleMobileKeyboardView:()=>E(!y),onDateChange:(T,O,j="partial")=>{switch(j){case"shallow":return g({action:"setDraft",value:T,skipOnChangeCall:!0});case"partial":return g({action:"setDraft",value:T});case"finish":return g(a??O==="desktop"?{value:T,action:"acceptAndClose"}:{value:T,action:"setCommitted"});default:throw new Error("MUI: Invalid selectionState passed to `onDateChange`")}}}),[g,y,h.draft,a]),x=w.useCallback((T,O)=>{const j=t.valueReducer?t.valueReducer(i,d,T):T;n(j,O)},[n,t,d,i]),C=w.useMemo(()=>({onChange:x,open:s,rawValue:o,openPicker:()=>l(!0)}),[x,s,o,l]),b={pickerProps:M,inputProps:C,wrapperProps:m};return w.useDebugValue(b,()=>({MuiPickerState:{dateState:h,other:b}})),b},vO=["onChange","PopperProps","PaperProps","ToolbarComponent","TransitionComponent","value","components","componentsProps"],mf=w.forwardRef(function(t,r){const n=VP(t,"MuiDesktopDatePicker"),o=IE(n)!==null,{pickerProps:a,inputProps:i,wrapperProps:s}=mO(n,WP),{PopperProps:l,PaperProps:u,ToolbarComponent:d=gD,TransitionComponent:p,components:h,componentsProps:v}=n,g=fe(n,vO),m=D({},i,g,{components:h,componentsProps:v,ref:r,validationError:o});return f.jsx(YD,D({},s,{DateInputProps:m,KeyboardDateInputComponent:hf,PopperProps:l,PaperProps:u,TransitionComponent:p,components:h,componentsProps:v,children:f.jsx(pO,D({},a,{autoFocus:!0,toolbarTitle:n.label||n.toolbarTitle,ToolbarComponent:d,DateInputProps:m,components:h,componentsProps:v},g))}))});process.env.NODE_ENV!=="production"&&(mf.propTypes={acceptRegex:c.instanceOf(RegExp),autoFocus:c.bool,children:c.node,className:c.string,closeOnSelect:c.bool,components:c.object,componentsProps:c.object,dayOfWeekFormatter:c.func,defaultCalendarMonth:c.any,disabled:c.bool,disableFuture:c.bool,disableHighlightToday:c.bool,disableMaskedInput:c.bool,disableOpenPicker:c.bool,disablePast:c.bool,getOpenDialogAriaText:c.func,getViewSwitchingButtonText:c.func,ignoreInvalidInputs:c.bool,InputAdornmentProps:c.object,inputFormat:c.string,InputProps:c.object,inputRef:c.oneOfType([c.func,c.shape({current:c.object})]),label:c.node,leftArrowButtonText:c.string,loading:c.bool,mask:c.string,maxDate:c.any,minDate:c.any,onAccept:c.func,onChange:c.func.isRequired,onClose:c.func,onError:c.func,onMonthChange:c.func,onOpen:c.func,onViewChange:c.func,onYearChange:c.func,open:c.bool,OpenPickerButtonProps:c.object,openTo:c.oneOf(["day","month","year"]),orientation:c.oneOf(["landscape","portrait"]),PaperProps:c.object,PopperProps:c.object,readOnly:c.bool,reduceAnimations:c.bool,renderDay:c.func,renderInput:c.func.isRequired,renderLoading:c.func,rifmFormatter:c.func,rightArrowButtonText:c.string,shouldDisableDate:c.func,shouldDisableMonth:c.func,shouldDisableYear:c.func,showDaysOutsideCurrentMonth:c.bool,showToolbar:c.bool,ToolbarComponent:c.elementType,toolbarFormat:c.string,toolbarPlaceholder:c.node,toolbarTitle:c.node,TransitionComponent:c.elementType,value:c.any,views:c.arrayOf(c.oneOf(["day","month","year"]).isRequired)});const hi=({title:e,value:t,readonly:r,onChange:n,required:o,id:a,fullWidth:i=!0})=>f.jsx(mf,{disabled:r,label:e,value:t,onChange:s=>n(s),renderInput:s=>{var u,d,p;let l;return(u=s.inputProps)!=null&&u.placeholder&&(l=(p=(d=s.inputProps)==null?void 0:d.placeholder)==null?void 0:p.slice(),s.inputProps.placeholder=void 0),f.jsx(W.TextField,{...s,required:o,sx:{width:"100%"},placeholder:l,autoComplete:"off",variant:"standard",error:!1})}});var Ms={},gO=ft;Object.defineProperty(Ms,"__esModule",{value:!0});var mi=Ms.default=void 0,yO=gO(pt()),bO=f,xO=(0,yO.default)((0,bO.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");mi=Ms.default=xO;var _s={},wO=ft;Object.defineProperty(_s,"__esModule",{value:!0});var vf=_s.default=void 0,CO=wO(pt()),EO=f,TO=(0,CO.default)((0,EO.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");vf=_s.default=TO;const PO=({dates:e,readonly:t,onChange:r,title:n})=>{const[o,a]=R.useState(Math.random()),[i,s]=R.useState(e??[null]),{ToIsoWithoutTimeZone:l,ParseDataToRusLocale:u}=Gn();R.useEffect(()=>{r(i.filter(h=>!!h&&Date.parse(h)).map(h=>l(h)).join(","))},[i]);const d=()=>{s(h=>[...h,null]),a(Math.random())},p=h=>{s(v=>[...v.filter((g,m)=>m!==h)]),a(Math.random())};return i.length<2?f.jsx(jo,{dateAdapter:ci,locale:ui,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(hi,{id:"",title:n??"День рождения родственника",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(v=>(v[i.length-1]=h,[...v]))}),!!Date.parse(i[0]??"")&&!t&&f.jsx(W.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(mi,{})})]})}):f.jsxs("div",{children:[f.jsx("div",{style:{marginBottom:"1em"},children:"День рождения родственников"}),f.jsx("div",{style:{borderLeft:"solid 1px #88888850",paddingLeft:"1em"},children:f.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[f.jsx("div",{style:{display:"flex",gap:"1em",flexWrap:"wrap"},children:i.filter((h,v)=>v<i.length-1).map((h,v)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em",backgroundColor:"rgba(204, 204, 204, 0.5)",padding:"0 .5em",borderRadius:"5px"},children:[f.jsx("div",{children:h&&u(h.toString())}),f.jsx("div",{children:!t&&f.jsx(W.IconButton,{size:"small",color:"primary",onClick:()=>p(v),children:f.jsx(vf,{})})})]},v))}),f.jsx("div",{children:f.jsx(jo,{dateAdapter:ci,locale:ui,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(hi,{id:"",title:"День рождения",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(v=>(v[i.length-1]=h,[...v]))}),!t&&f.jsx(W.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(mi,{})})]})})})]})})]})},DO=({id:e,defaultChecked:t,title:r,readonly:n,required:o,onChange:a,value:i})=>{const s=W.useTheme(),l=(u,d=!1)=>{if(!o)return;const p=new CustomEvent(In,{detail:{id:e,empty:!u,label:r}});document.dispatchEvent(p)};return R.useEffect(()=>{setTimeout(()=>l(i),1)},[]),R.useEffect(()=>{l(i,!0)},[i]),f.jsxs("div",{style:{display:"flex",gap:"1em",alignItems:"center"},children:[f.jsx(W.Checkbox,{required:o,sx:{padding:0},readOnly:n,checked:i,onChange:()=>a(!i)}),f.jsx(W.Box,{sx:{fontSize:"1rem",a:{color:s.palette.info.main,textDecoration:"none"}},component:"div",dangerouslySetInnerHTML:{__html:r}})]})},OO=({control:e,isReg:t,readonlyControls:r,onChangeRadio:n})=>{var a,i,s,l,u,d;const o=(p,h=!1)=>{if(!e.validation.required)return;const v=new CustomEvent(In,{detail:{id:e.id,empty:!p,label:e.title}});document.dispatchEvent(v)};return R.useEffect(()=>{setTimeout(()=>{var p,h;return o((h=(p=e.values)==null?void 0:p.find(v=>v.selected))==null?void 0:h.id)},1)},[]),f.jsx(W.Box,{sx:{minWidth:120},children:f.jsxs(W.FormControl,{fullWidth:!0,variant:"standard",required:(a=e==null?void 0:e.validation)==null?void 0:a.required,children:[f.jsx(W.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(W.Select,{required:(i=e==null?void 0:e.validation)==null?void 0:i.required,readOnly:!t&&((s=e==null?void 0:e.validation)==null?void 0:s.readOnly)&&(r==null?void 0:r.includes(e.id)),labelId:`select-${e.id}`,value:((u=(l=e.values)==null?void 0:l.find(p=>p.selected))==null?void 0:u.id)||"",label:e.title,onChange:p=>{var v,g;(v=e.values)==null||v.filter(m=>m.id!==p.target.value).forEach(m=>m.selected=!1);let h=(g=e.values)==null?void 0:g.find(m=>m.id===p.target.value);h&&(o(!0,!0),h.selected=!0),n({...e,values:e.values})},children:(d=e.values)==null?void 0:d.map(p=>f.jsx(W.MenuItem,{value:p.id,children:p.text},p.id))})]})})},kO=({control:e,value:t,onChange:r,onChangeRadio:n,onChangeChecked:o,isReg:a,readonlyControls:i})=>{var s,l,u,d,p,h,v,g;switch(e.type){case Er.Textbox:return f.jsx(No,{value:t,onChange:m=>r(m.target.value),required:(s=e==null?void 0:e.validation)==null?void 0:s.required,id:e.id,label:e.title,disabled:!a&&((l=e==null?void 0:e.validation)==null?void 0:l.readOnly)&&(i==null?void 0:i.includes(e.id)),autoComplete:"off",variant:"standard",fullWidth:!0});case Er.RadiobuttonGroup:return f.jsx(OO,{control:e,isReg:a,readonlyControls:i,onChangeRadio:n});case Er.Select:return f.jsx(W.Box,{sx:{minWidth:120,maxHeight:"400px"},children:f.jsxs(W.FormControl,{fullWidth:!0,variant:"standard",required:(u=e==null?void 0:e.validation)==null?void 0:u.required,children:[f.jsx(W.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(W.Select,{sx:{maxHeight:"300px"},readOnly:!a&&((d=e==null?void 0:e.validation)==null?void 0:d.readOnly)&&(i==null?void 0:i.includes(e.id)),labelId:`select-${e.id}`,value:e.text,label:e.title,onChange:m=>r(m.target.value),children:(p=e.values)==null?void 0:p.map(m=>f.jsx(W.MenuItem,{value:m.id,children:m.text},m.id))})]})});case Er.Date:return f.jsx(jo,{dateAdapter:ci,locale:ui,children:f.jsx(hi,{id:e.id,title:e.title,value:t,readonly:!a&&((h=e==null?void 0:e.validation)==null?void 0:h.readOnly)&&!!(i!=null&&i.includes(e.id)),onChange:m=>r(m),required:(v=e==null?void 0:e.validation)==null?void 0:v.required})});case Er.ParentBirthday:return f.jsx(PO,{title:e.title,onChange:m=>r(m),readonly:!a,dates:e.dates??[null]});case Er.Checkbox:return f.jsx(DO,{id:e.id,onChange:m=>o(m),required:(g=e==null?void 0:e.validation)==null?void 0:g.required,readonly:!a,value:e.checked,title:e.title,defaultChecked:e.defaultChecked})}return f.jsx("div",{})},MO=e=>{const t=()=>{const n=new RegExp(/^\.*/);return e.type!==null?e.type===Cn.Email?new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/):e.type===Cn.Url||e.type===Cn.Date?n:e.type===Cn.Phone?new RegExp(/^[+]?[\d]{10,11}$/):n:n},r=n=>{let o=!0;return e!=null&&e.minTextLength&&(o=o&&n.length>=(e==null?void 0:e.minTextLength)),e!=null&&e.maxTextLength&&(o=o&&n.length<=(e==null?void 0:e.maxTextLength)),o};return n=>t().test(n)?r(n)?{isError:!1}:{isError:!0,message:`Строка не удовлетворяет нужному размеру (${e.minTextLength??0}-${e.maxTextLength??255})`}:{isError:!0,message:"Строка введена неверно"}},gf=({onControlsGet:e,buttonSaveText:t,isReg:r=!1,previewControls:n})=>{const{apiAxios:o,additionalData:a,VKUserId:i,setCabinetSettings:s,setPhoneNumber:l,telegramInfo:u,linkId:d,refferalCode:p,cabinetUISettings:h}=R.useContext(dt),{setIsLoading:v}=R.useContext(fr),{showErrorAlert:g}=R.useContext(ir),{setOpenedPage:m}=R.useContext(Fn),[y,E]=R.useState(!1),[M,x]=R.useState(n??[]);R.useEffect(()=>{x(n??[])},[n]);const[C,b]=R.useState([]),[T,O]=R.useState(Math.random()),[j,L]=R.useState(!1),{validationPopup:S,formIsValid:Y,setValidations:Q}=ms({}),{ToIsoWithoutTimeZone:X}=Gn();R.useEffect(()=>{Q(M.map(k=>({id:k.id,label:k.title,validator:MO(k.validation)})))},[M]);const I=()=>{const k={};return M.map($=>k[$.id]=$.text),k};R.useEffect(()=>{n||(async()=>{v("GetControls",!0);const $=await o().post("/externalCustomerCabinet/form/registration",{});e==null||e($.data.controls);let F=$.data.controls;F.some(U=>U.id==="parentphone")&&p&&(F=F.filter(U=>U.id!=="parentphone")),x(F),b($.data.controls.filter(U=>{var q;return((q=U.validation)==null?void 0:q.readOnly)&&!!U.text})),v("GetControls",!1)})()},[]);const N=()=>{Y()&&!n&&(L(!0),o().patch("/externalCustomerCabinet/form/registration",{recommend:p,linkId:d,controls:M,...a,VKUserId:i,...u??{}}).then(k=>{s($=>({...$,isReg:!1})),l(k.data.phoneNumber),E(!0),m("info"),b(M.filter($=>{var F;return((F=$.validation)==null?void 0:F.readOnly)&&!!$.text})),r&&(h!=null&&h.ymIdentifier)&&(h!=null&&h.ymReachGoalIdentifier)&&ym(h==null?void 0:h.ymIdentifier,"reachGoal",h==null?void 0:h.ymReachGoalIdentifier)}).catch(k=>{g(k.response.data.msg)}).finally(()=>{L(!1)}))},A=(k,$)=>{Date.parse($)&&($=X($)),x(F=>{const U=F.find(q=>q.id===k);return U&&(U.text=$),[...F]})},H=(k,$)=>{x(F=>{const U=F.find(q=>q.id===k);return U&&(U.checked=$),[...F]})},Z=k=>{x($=>{let F=$.find(U=>U.id===k.id);return F&&(F={...k},O(Math.random())),[...$]})};return{controlsForm:f.jsxs(W.Container,{maxWidth:"sm",children:[S,f.jsxs(W.Typography,{component:"div",style:{display:"flex",flexDirection:"column",gap:"1.5em",marginBottom:"1em"},children:[f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:M==null?void 0:M.map((k,$)=>f.jsx("div",{children:f.jsx(kO,{isReg:r,control:k,onChange:F=>A(k.id,F),onChangeChecked:F=>H(k.id,F),onChangeRadio:F=>Z(F),value:k.text??"",readonlyControls:C.map(F=>F.id)})},$))}),f.jsx("div",{style:{display:"flex",justifyContent:"center"},children:f.jsx(hs,{isLoading:j,onClick:()=>N(),children:t||"Сохранить анкету"})})]})]}),setControls:x,saved:y,setSaved:E,GetObjectByControls:I}},_O=()=>{R.useContext(dt);const{controlsForm:e,saved:t,setSaved:r}=gf({buttonSaveText:"Регистрация",isReg:!0});return f.jsx("div",{children:f.jsxs("div",{children:[f.jsx(ca,{style:{marginBottom:"1em"},children:"Для использования полного функционала бота необходимо зарегистрироваться"}),e]})})},RO=()=>{const{controlsForm:e,saved:t,setSaved:r}=gf({buttonSaveText:"Редактирование анкеты",isReg:!1});return f.jsx("div",{children:e})},SO=({})=>{const{cabinetSettings:e}=R.useContext(dt),{currentMode:t}=R.useContext(ln);return f.jsx(W.Backdrop,{sx:{color:t==="light"?"#191919":"#e9e9e9",zIndex:r=>r.zIndex.drawer+1,backgroundColor:t==="light"?"#e9e9e9":"#191919"},open:!!e&&!(e!=null&&e.cabinetEnabled),children:f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em",alignItems:"center"},children:f.jsx("div",{children:"Бот сейчас отключен"})})})},$O=({showHeader:e})=>{var m;const{cabinetSettings:t,cabinetUISettings:r}=R.useContext(dt),{setTheme:n,theme:o,currentMode:a}=R.useContext(ln),{isLoading:i}=R.useContext(fr),{openedPage:s,setOpenedPage:l}=R.useContext(Fn),u=(y,E)=>{l(E)},d=()=>{var y,E,M,x,C,b,T,O,j,L,S,Y,Q,X,I,N,A,H,Z,ee,k,$,F,U,q,J,re,B,V,z,oe,ue;return a==="light"?{primary:{main:((E=(y=r==null?void 0:r.theme)==null?void 0:y.light)==null?void 0:E.theme)??"#ffffff",contrastText:((x=(M=r==null?void 0:r.theme)==null?void 0:M.light)==null?void 0:x.text)??"#ffffff"},text:{primary:((b=(C=r==null?void 0:r.theme)==null?void 0:C.light)==null?void 0:b.theme)??"#ffffff"},background:{default:((O=(T=r==null?void 0:r.theme)==null?void 0:T.light)==null?void 0:O.background)??"#ffffff"},components:{MuiPaper:{styleOverrides:{root:{backgroundColor:((L=(j=r==null?void 0:r.theme)==null?void 0:j.light)==null?void 0:L.background)??"#ffffff"}}},MuiInput:{styleOverrides:{root:{color:((Y=(S=r==null?void 0:r.theme)==null?void 0:S.light)==null?void 0:Y.theme)??"#ffffff","&::before":{borderBottom:`solid 1px ${((X=(Q=r==null?void 0:r.theme)==null?void 0:Q.light)==null?void 0:X.theme)??"#ffffff"}`}}}},MuiFormLabel:{styleOverrides:{root:{color:((N=(I=r==null?void 0:r.theme)==null?void 0:I.light)==null?void 0:N.theme)??"#ffffff"}}}}}:{primary:{main:((H=(A=r==null?void 0:r.theme)==null?void 0:A.dark)==null?void 0:H.theme)??"#ffffff",contrastText:((ee=(Z=r==null?void 0:r.theme)==null?void 0:Z.dark)==null?void 0:ee.text)??"#000000"},text:{primary:(($=(k=r==null?void 0:r.theme)==null?void 0:k.dark)==null?void 0:$.theme)??"#ffffff"},background:{default:((U=(F=r==null?void 0:r.theme)==null?void 0:F.dark)==null?void 0:U.background)??"#000000"},components:{MuiPaper:{styleOverrides:{root:{backgroundColor:((J=(q=r==null?void 0:r.theme)==null?void 0:q.dark)==null?void 0:J.background)??"#000000"}}},MuiInput:{styleOverrides:{root:{color:((B=(re=r==null?void 0:r.theme)==null?void 0:re.dark)==null?void 0:B.theme)??"#ffffff","&::before":{borderBottom:`solid 1px ${((z=(V=r==null?void 0:r.theme)==null?void 0:V.dark)==null?void 0:z.theme)??"#ffffff"}`}}}},MuiFormLabel:{styleOverrides:{root:{color:((ue=(oe=r==null?void 0:r.theme)==null?void 0:oe.dark)==null?void 0:ue.theme)??"#000000"}}}}}};R.useEffect(()=>{const y=d();n(E=>({...bi,palette:{...E.palette,...y},components:{...E.components,...y.components}}))},[r]);const{popups:p,closePopupById:h}=R.useContext(ir),g=[{icon:f.jsx(Mu,{}),value:"info",label:"Карта",page:f.jsx(x1,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ou,{}),value:"receipt",label:"История",page:f.jsx(Xb,{}),active:t==null?void 0:t.canShowPurchaseHistory,disabled:t==null?void 0:t.isReg},{icon:f.jsx(_u,{}),value:"appeals",label:"Обращения",page:f.jsx(S0,{}),active:t==null?void 0:t.canShowAppeals,disabled:t==null?void 0:t.isReg},{icon:f.jsx(_o,{}),value:"businessInfo",label:"Информация",page:f.jsx(Qb,{}),active:t==null?void 0:t.canShowBusinessInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(ku,{}),value:"personInfo",label:"Клиент",page:f.jsx(RO,{}),active:t==null?void 0:t.canEditPersonInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ru,{}),value:"registration",label:"Регистрация",page:f.jsx(_O,{}),active:t==null?void 0:t.isReg,disabled:!1}].filter(y=>y.active&&!y.disabled);return f.jsxs(W.Box,{sx:{bgcolor:"background.default"},className:"page_view",children:[e&&f.jsx($c,{}),f.jsx($0,{show:i}),f.jsx(SO,{}),p.map((y,E)=>f.jsx(zu,{title:y.title,opened:!0,setOpened:()=>h(y.id),children:f.jsx("div",{children:y.content})})),f.jsx("div",{className:"page_view__page scrollbar",children:(m=g.find(y=>y.value===s))==null?void 0:m.page}),f.jsx("div",{className:"page_view__navigation",children:f.jsx("div",{children:f.jsx(W.BottomNavigation,{sx:{borderTop:"solid 1px #88888850",bgcolor:"background.default"},value:s,onChange:u,children:g.map((y,E)=>f.jsx(W.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:y.label,value:y.value,icon:y.icon},E))})})})]})};exports.AppContext=dt;exports.AppProvider=Ff;exports.BonusPlusThemeContext=ln;exports.BonusPlusThemeProvider=Uf;exports.ErrorBoundary=Yf;exports.Header=$c;exports.LoadingContext=fr;exports.LoadingProvider=Nf;exports.PageContext=Fn;exports.PageProvider=If;exports.PopupContext=ir;exports.PopupProvider=Lb;exports.Router=$O;
|
|
@@ -21781,7 +21781,7 @@ const ck = ({ dates: e, readonly: t, onChange: r, title: n }) => {
|
|
|
21781
21781
|
Gc,
|
|
21782
21782
|
{
|
|
21783
21783
|
sx: {
|
|
21784
|
-
color: "#
|
|
21784
|
+
color: t === "light" ? "#191919" : "#e9e9e9",
|
|
21785
21785
|
zIndex: (r) => r.zIndex.drawer + 1,
|
|
21786
21786
|
backgroundColor: t === "light" ? "#e9e9e9" : "#191919"
|
|
21787
21787
|
},
|
|
@@ -235,4 +235,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
235
235
|
`)),"")}function vD(e,t,n,r){if(!e)return!1;const a=r.formatByString(r.date(nf),t).replace(n,va),i=r.formatByString(r.date(tf),t).replace(n,"_"),s=i===a&&e===i;return!s&&r.lib!=="luxon"&&process.env.NODE_ENV!=="production"&&(t.includes("MMM")?console.warn(["Mask does not support literals such as 'MMM'.","Either use numbers with fix length or disable mask feature with 'disableMaskedInput' prop","Falling down to uncontrolled no-mask input."].join(`
|
|
236
236
|
`)):i&&i!==a?console.warn(["Mask does not support numbers with variable length such as 'M'.","Either use numbers with fix length or disable mask feature with 'disableMaskedInput' prop","Falling down to uncontrolled no-mask input."].join(`
|
|
237
237
|
`)):e&&console.warn([`The mask "${e}" you passed is not valid for the format used ${t}.`,"Falling down to uncontrolled no-mask input."].join(`
|
|
238
|
-
`))),s}const gD=(e,t)=>n=>{let r=0;return n.split("").map((o,a)=>{if(t.lastIndex=0,r>e.length-1)return"";const i=e[r],s=e[r+1],u=t.test(o)?o:"",c=i===va?u:i+u;return r+=c.length,a===n.length-1&&s&&s!==va?c?c+s:"":c}).join("")},yD=({acceptRegex:e=/[\d]/gi,disabled:t,disableMaskedInput:n,ignoreInvalidInputs:r,inputFormat:o,inputProps:a,label:i,mask:s,onChange:u,rawValue:c,readOnly:d,rifmFormatter:p,TextFieldProps:h,validationError:v})=>{const g=Je(),m=g.getFormatHelperText(o),{shouldUseMaskedInput:y,maskToUse:E}=w.useMemo(()=>{if(n)return{shouldUseMaskedInput:!1,maskToUse:""};const I=mD(s,o,e,g);return{shouldUseMaskedInput:vD(I,o,e,g),maskToUse:I}},[e,n,o,s,g]),M=w.useMemo(()=>y&&E?gD(E,e):I=>I,[e,E,y]),x=c===null?null:g.date(c),[C,b]=w.useState(x),[T,O]=w.useState(ef(g,c,o)),j=w.useRef(),L=w.useRef(g.locale),$=w.useRef(o);w.useEffect(()=>{const I=c!==j.current,N=g.locale!==L.current,A=o!==$.current;if(j.current=c,L.current=g.locale,$.current=o,!I&&!N&&!A)return;const H=c===null?null:g.date(c),Z=c===null||g.isValid(H);let ee=C===null&&H===null;if(C!==null&&H!==null){const R=g.isEqual(C,H);if(R)ee=!0;else{const F=Math.abs(g.getDiff(C,H));ee=F===0?R:F<1e3}}if(!N&&!A&&(!Z||ee))return;const k=ef(g,c,o);b(H),O(k)},[g,c,o,C]);const Y=I=>{const N=I===""||I===s?"":I;O(N);const A=N===null?null:g.parse(N,o);r&&!g.isValid(A)||(b(A),u(A,N||void 0))},Q=hD({value:T,onChange:Y,format:p||M});return D({label:i,disabled:t,error:v,inputProps:D({},y?Q:{value:T,onChange:I=>{Y(I.currentTarget.value)}},{disabled:t,placeholder:m,readOnly:d,type:y?"tel":"text"},a)},h)},bD=["className","components","disableOpenPicker","getOpenDialogAriaText","InputAdornmentProps","InputProps","inputRef","openPicker","OpenPickerButtonProps","renderInput"],rf=w.forwardRef(function(t,n){const{className:r,components:o={},disableOpenPicker:a,getOpenDialogAriaText:i,InputAdornmentProps:s,InputProps:u,inputRef:c,openPicker:d,OpenPickerButtonProps:p,renderInput:h}=t,v=fe(t,bD),g=or(),m=i??g.openDatePickerDialogue,y=Je(),E=yD(v),M=(s==null?void 0:s.position)||"end",x=o.OpenPickerIcon||kd;return h(D({ref:n,inputRef:c,className:r},E,{InputProps:D({},u,{[`${M}Adornment`]:a?void 0:f.jsx(pD,D({position:M},s,{children:f.jsx(ar,D({edge:M,disabled:v.disabled||v.readOnly,"aria-label":m(v.rawValue,y)},p,{onClick:d,children:f.jsx(x,{})}))}))})}))});function of(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const xD=(e,t)=>{const[n,r]=w.useState(of);return It(()=>{const a=()=>{r(of())};return window.addEventListener("orientationchange",a),()=>{window.removeEventListener("orientationchange",a)}},[]),cd(e,["hours","minutes","seconds"])?!1:(t||n)==="landscape"},wD=({autoFocus:e,openView:t})=>{const[n,r]=w.useState(e?t:null),o=w.useCallback(a=>i=>{r(i?a:s=>a===s?null:s)},[]);return{focusedView:n,setFocusedView:o}};function CD(e){return W.generateUtilityClass("MuiCalendarOrClockPicker",e)}W.generateUtilityClasses("MuiCalendarOrClockPicker",["root","mobileKeyboardInputView"]);const ED=["autoFocus","className","parsedValue","DateInputProps","isMobileKeyboardViewOpen","onDateChange","onViewChange","openTo","orientation","showToolbar","toggleMobileKeyboardView","ToolbarComponent","toolbarFormat","toolbarPlaceholder","toolbarTitle","views","dateRangeIcon","timeIcon","hideTabs","classes"],TD=e=>{const{classes:t}=e,n={root:["root"],mobileKeyboardInputView:["mobileKeyboardInputView"]};return W.unstable_composeClasses(n,CD,t)},PD=ue("div",{name:"MuiCalendarOrClockPicker",slot:"MobileKeyboardInputView",overridesResolver:(e,t)=>t.mobileKeyboardInputView})({padding:"16px 24px"}),DD=ue("div",{name:"MuiCalendarOrClockPicker",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e})=>D({display:"flex",flexDirection:"column"},e.isLandscape&&{flexDirection:"row"})),OD={fullWidth:!0},af=e=>e==="year"||e==="month"||e==="day",sf=e=>e==="hours"||e==="minutes"||e==="seconds";let lf=!1;function kD(e){var t,n;const r=Se({props:e,name:"MuiCalendarOrClockPicker"}),{autoFocus:o,parsedValue:a,DateInputProps:i,isMobileKeyboardViewOpen:s,onDateChange:u,onViewChange:c,openTo:d,orientation:p,showToolbar:h,toggleMobileKeyboardView:v,ToolbarComponent:g=()=>null,toolbarFormat:m,toolbarPlaceholder:y,toolbarTitle:E,views:M,dateRangeIcon:x,timeIcon:C,hideTabs:b}=r,T=fe(r,ED),O=(t=T.components)==null?void 0:t.Tabs,j=xD(M,p),L=w.useContext(ir),$=TD(r),Y=h??L!=="desktop",Q=!b&&typeof window<"u"&&window.innerHeight>667,X=w.useCallback((k,R)=>{u(k,L,R)},[u,L]),I=w.useCallback(k=>{s&&v(),c&&c(k)},[s,c,v]);process.env.NODE_ENV!=="production"&&!lf&&!M.includes(d)&&(console.warn(`MUI: \`openTo="${d}"\` is not a valid prop.`,`It must be an element of \`views=["${M.join('", "')}"]\`.`),lf=!0);const{openView:N,setOpenView:A,handleChangeAndOpenNext:H}=bs({view:void 0,views:M,openTo:d,onChange:X,onViewChange:I}),{focusedView:Z,setFocusedView:ee}=wD({autoFocus:o,openView:N});return f.jsxs(DD,{ownerState:{isLandscape:j},className:$.root,children:[Y&&f.jsx(g,D({},T,{views:M,isLandscape:j,parsedValue:a,onChange:X,setOpenView:A,openView:N,toolbarTitle:E,toolbarFormat:m,toolbarPlaceholder:y,isMobileKeyboardViewOpen:s,toggleMobileKeyboardView:v})),Q&&!!O&&f.jsx(O,D({dateRangeIcon:x,timeIcon:C,view:N,onChange:A},(n=T.componentsProps)==null?void 0:n.tabs)),f.jsx(ws,{children:s?f.jsx(PD,{className:$.mobileKeyboardInputView,children:f.jsx(rf,D({},i,{ignoreInvalidInputs:!0,disableOpenPicker:!0,TextFieldProps:OD}))}):f.jsxs(w.Fragment,{children:[af(N)&&f.jsx(jd,D({autoFocus:o,date:a,onViewChange:A,onChange:H,view:N,views:M.filter(af),focusedView:Z,onFocusedViewChange:ee},T)),sf(N)&&f.jsx(Fd,D({},T,{autoFocus:o,date:a,view:N,views:M.filter(sf),onChange:H,onViewChange:A,showViewSwitcher:L==="desktop"}))]})})]})}const MD=({open:e,onOpen:t,onClose:n})=>{const r=w.useRef(typeof e=="boolean").current,[o,a]=w.useState(!1);w.useEffect(()=>{if(r){if(typeof e!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");a(e)}},[r,e]);const i=w.useCallback(s=>{r||a(s),s&&t&&t(),!s&&n&&n()},[r,t,n]);return{isOpen:o,setIsOpen:i}},_D=(e,t)=>{const{onAccept:n,onChange:r,value:o,closeOnSelect:a}=e,i=Je(),{isOpen:s,setIsOpen:u}=MD(e),c=w.useMemo(()=>t.parseInput(i,o),[t,i,o]),[d,p]=w.useState(c),[h,v]=w.useState(()=>({committed:c,draft:c,resetFallback:c})),g=w.useCallback(T=>{v(O=>{switch(T.action){case"setAll":case"acceptAndClose":return{draft:T.value,committed:T.value,resetFallback:T.value};case"setCommitted":return D({},O,{draft:T.value,committed:T.value});case"setDraft":return D({},O,{draft:T.value});default:return O}}),(T.forceOnChangeCall||!T.skipOnChangeCall&&!t.areValuesEqual(i,h.committed,T.value))&&r(T.value),T.action==="acceptAndClose"&&(u(!1),n&&!t.areValuesEqual(i,h.resetFallback,T.value)&&n(T.value))},[n,r,u,h,i,t]);w.useEffect(()=>{i.isValid(c)&&p(c)},[i,c]),w.useEffect(()=>{s&&g({action:"setAll",value:c,skipOnChangeCall:!0})},[s]),t.areValuesEqual(i,h.committed,c)||g({action:"setCommitted",value:c,skipOnChangeCall:!0});const m=w.useMemo(()=>({open:s,onClear:()=>{g({value:t.emptyValue,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,t.emptyValue)})},onAccept:()=>{g({value:h.draft,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,c)})},onDismiss:()=>{g({value:h.committed,action:"acceptAndClose"})},onCancel:()=>{g({value:h.resetFallback,action:"acceptAndClose"})},onSetToday:()=>{g({value:t.getTodayValue(i),action:"acceptAndClose"})}}),[g,s,i,h,t,o,c]),[y,E]=w.useState(!1),M=w.useMemo(()=>({parsedValue:h.draft,isMobileKeyboardViewOpen:y,toggleMobileKeyboardView:()=>E(!y),onDateChange:(T,O,j="partial")=>{switch(j){case"shallow":return g({action:"setDraft",value:T,skipOnChangeCall:!0});case"partial":return g({action:"setDraft",value:T});case"finish":return g(a??O==="desktop"?{value:T,action:"acceptAndClose"}:{value:T,action:"setCommitted"});default:throw new Error("MUI: Invalid selectionState passed to `onDateChange`")}}}),[g,y,h.draft,a]),x=w.useCallback((T,O)=>{const j=t.valueReducer?t.valueReducer(i,d,T):T;r(j,O)},[r,t,d,i]),C=w.useMemo(()=>({onChange:x,open:s,rawValue:o,openPicker:()=>u(!0)}),[x,s,o,u]),b={pickerProps:M,inputProps:C,wrapperProps:m};return w.useDebugValue(b,()=>({MuiPickerState:{dateState:h,other:b}})),b},SD=["onChange","PopperProps","PaperProps","ToolbarComponent","TransitionComponent","value","components","componentsProps"],uf=w.forwardRef(function(t,n){const r=oP(t,"MuiDesktopDatePicker"),o=tE(r)!==null,{pickerProps:a,inputProps:i,wrapperProps:s}=_D(r,aP),{PopperProps:u,PaperProps:c,ToolbarComponent:d=RP,TransitionComponent:p,components:h,componentsProps:v}=r,g=fe(r,SD),m=D({},i,g,{components:h,componentsProps:v,ref:n,validationError:o});return f.jsx(iD,D({},s,{DateInputProps:m,KeyboardDateInputComponent:rf,PopperProps:u,PaperProps:c,TransitionComponent:p,components:h,componentsProps:v,children:f.jsx(kD,D({},a,{autoFocus:!0,toolbarTitle:r.label||r.toolbarTitle,ToolbarComponent:d,DateInputProps:m,components:h,componentsProps:v},g))}))});process.env.NODE_ENV!=="production"&&(uf.propTypes={acceptRegex:l.instanceOf(RegExp),autoFocus:l.bool,children:l.node,className:l.string,closeOnSelect:l.bool,components:l.object,componentsProps:l.object,dayOfWeekFormatter:l.func,defaultCalendarMonth:l.any,disabled:l.bool,disableFuture:l.bool,disableHighlightToday:l.bool,disableMaskedInput:l.bool,disableOpenPicker:l.bool,disablePast:l.bool,getOpenDialogAriaText:l.func,getViewSwitchingButtonText:l.func,ignoreInvalidInputs:l.bool,InputAdornmentProps:l.object,inputFormat:l.string,InputProps:l.object,inputRef:l.oneOfType([l.func,l.shape({current:l.object})]),label:l.node,leftArrowButtonText:l.string,loading:l.bool,mask:l.string,maxDate:l.any,minDate:l.any,onAccept:l.func,onChange:l.func.isRequired,onClose:l.func,onError:l.func,onMonthChange:l.func,onOpen:l.func,onViewChange:l.func,onYearChange:l.func,open:l.bool,OpenPickerButtonProps:l.object,openTo:l.oneOf(["day","month","year"]),orientation:l.oneOf(["landscape","portrait"]),PaperProps:l.object,PopperProps:l.object,readOnly:l.bool,reduceAnimations:l.bool,renderDay:l.func,renderInput:l.func.isRequired,renderLoading:l.func,rifmFormatter:l.func,rightArrowButtonText:l.string,shouldDisableDate:l.func,shouldDisableMonth:l.func,shouldDisableYear:l.func,showDaysOutsideCurrentMonth:l.bool,showToolbar:l.bool,ToolbarComponent:l.elementType,toolbarFormat:l.string,toolbarPlaceholder:l.node,toolbarTitle:l.node,TransitionComponent:l.elementType,value:l.any,views:l.arrayOf(l.oneOf(["day","month","year"]).isRequired)});const Ps=({title:e,value:t,readonly:n,onChange:r,required:o,id:a,fullWidth:i=!0})=>f.jsx(uf,{disabled:n,label:e,value:t,onChange:s=>r(s),renderInput:s=>{var c,d,p;let u;return(c=s.inputProps)!=null&&c.placeholder&&(u=(p=(d=s.inputProps)==null?void 0:d.placeholder)==null?void 0:p.slice(),s.inputProps.placeholder=void 0),f.jsx(W.TextField,{...s,required:o,sx:{width:"100%"},placeholder:u,autoComplete:"off",variant:"standard",error:!1})}});var Ds={},$D=dt;Object.defineProperty(Ds,"__esModule",{value:!0});var Os=Ds.default=void 0,RD=$D(ft()),ND=f,jD=(0,RD.default)((0,ND.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Os=Ds.default=jD;var ks={},AD=dt;Object.defineProperty(ks,"__esModule",{value:!0});var cf=ks.default=void 0,ID=AD(ft()),LD=f,BD=(0,ID.default)((0,LD.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");cf=ks.default=BD;const FD=({dates:e,readonly:t,onChange:n,title:r})=>{const[o,a]=S.useState(Math.random()),[i,s]=S.useState(e??[null]),{ToIsoWithoutTimeZone:u,ParseDataToRusLocale:c}=Br();S.useEffect(()=>{n(i.filter(h=>!!h&&Date.parse(h)).map(h=>u(h)).join(","))},[i]);const d=()=>{s(h=>[...h,null]),a(Math.random())},p=h=>{s(v=>[...v.filter((g,m)=>m!==h)]),a(Math.random())};return i.length<2?f.jsx(Qo,{dateAdapter:ps,locale:ms,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Ps,{id:"",title:r??"День рождения родственника",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(v=>(v[i.length-1]=h,[...v]))}),!!Date.parse(i[0]??"")&&!t&&f.jsx(W.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Os,{})})]})}):f.jsxs("div",{children:[f.jsx("div",{style:{marginBottom:"1em"},children:"День рождения родственников"}),f.jsx("div",{style:{borderLeft:"solid 1px #88888850",paddingLeft:"1em"},children:f.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[f.jsx("div",{style:{display:"flex",gap:"1em",flexWrap:"wrap"},children:i.filter((h,v)=>v<i.length-1).map((h,v)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em",backgroundColor:"rgba(204, 204, 204, 0.5)",padding:"0 .5em",borderRadius:"5px"},children:[f.jsx("div",{children:h&&c(h.toString())}),f.jsx("div",{children:!t&&f.jsx(W.IconButton,{size:"small",color:"primary",onClick:()=>p(v),children:f.jsx(cf,{})})})]},v))}),f.jsx("div",{children:f.jsx(Qo,{dateAdapter:ps,locale:ms,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Ps,{id:"",title:"День рождения",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(v=>(v[i.length-1]=h,[...v]))}),!t&&f.jsx(W.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Os,{})})]})})})]})})]})},VD=({id:e,defaultChecked:t,title:n,readonly:r,required:o,onChange:a,value:i})=>{const s=W.useTheme(),u=(c,d=!1)=>{if(!o)return;const p=new CustomEvent(Fr,{detail:{id:e,empty:!c,label:n}});document.dispatchEvent(p)};return S.useEffect(()=>{setTimeout(()=>u(i),1)},[]),S.useEffect(()=>{u(i,!0)},[i]),f.jsxs("div",{style:{display:"flex",gap:"1em",alignItems:"center"},children:[f.jsx(W.Checkbox,{required:o,sx:{padding:0},readOnly:r,checked:i,onChange:()=>a(!i)}),f.jsx(W.Box,{sx:{fontSize:"1rem",a:{color:s.palette.info.main,textDecoration:"none"}},component:"div",dangerouslySetInnerHTML:{__html:n}})]})},WD=({control:e,isReg:t,readonlyControls:n,onChangeRadio:r})=>{var a,i,s,u,c,d;const o=(p,h=!1)=>{if(!e.validation.required)return;const v=new CustomEvent(Fr,{detail:{id:e.id,empty:!p,label:e.title}});document.dispatchEvent(v)};return S.useEffect(()=>{setTimeout(()=>{var p,h;return o((h=(p=e.values)==null?void 0:p.find(v=>v.selected))==null?void 0:h.id)},1)},[]),f.jsx(W.Box,{sx:{minWidth:120},children:f.jsxs(W.FormControl,{fullWidth:!0,variant:"standard",required:(a=e==null?void 0:e.validation)==null?void 0:a.required,children:[f.jsx(W.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(W.Select,{required:(i=e==null?void 0:e.validation)==null?void 0:i.required,readOnly:!t&&((s=e==null?void 0:e.validation)==null?void 0:s.readOnly)&&(n==null?void 0:n.includes(e.id)),labelId:`select-${e.id}`,value:((c=(u=e.values)==null?void 0:u.find(p=>p.selected))==null?void 0:c.id)||"",label:e.title,onChange:p=>{var v,g;(v=e.values)==null||v.filter(m=>m.id!==p.target.value).forEach(m=>m.selected=!1);let h=(g=e.values)==null?void 0:g.find(m=>m.id===p.target.value);h&&(o(!0,!0),h.selected=!0),r({...e,values:e.values})},children:(d=e.values)==null?void 0:d.map(p=>f.jsx(W.MenuItem,{value:p.id,children:p.text},p.id))})]})})},UD=({control:e,value:t,onChange:n,onChangeRadio:r,onChangeChecked:o,isReg:a,readonlyControls:i})=>{var s,u,c,d,p,h,v,g;switch(e.type){case Rn.Textbox:return f.jsx(Ho,{value:t,onChange:m=>n(m.target.value),required:(s=e==null?void 0:e.validation)==null?void 0:s.required,id:e.id,label:e.title,disabled:!a&&((u=e==null?void 0:e.validation)==null?void 0:u.readOnly)&&(i==null?void 0:i.includes(e.id)),autoComplete:"off",variant:"standard",fullWidth:!0});case Rn.RadiobuttonGroup:return f.jsx(WD,{control:e,isReg:a,readonlyControls:i,onChangeRadio:r});case Rn.Select:return f.jsx(W.Box,{sx:{minWidth:120,maxHeight:"400px"},children:f.jsxs(W.FormControl,{fullWidth:!0,variant:"standard",required:(c=e==null?void 0:e.validation)==null?void 0:c.required,children:[f.jsx(W.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(W.Select,{sx:{maxHeight:"300px"},readOnly:!a&&((d=e==null?void 0:e.validation)==null?void 0:d.readOnly)&&(i==null?void 0:i.includes(e.id)),labelId:`select-${e.id}`,value:e.text,label:e.title,onChange:m=>n(m.target.value),children:(p=e.values)==null?void 0:p.map(m=>f.jsx(W.MenuItem,{value:m.id,children:m.text},m.id))})]})});case Rn.Date:return f.jsx(Qo,{dateAdapter:ps,locale:ms,children:f.jsx(Ps,{id:e.id,title:e.title,value:t,readonly:!a&&((h=e==null?void 0:e.validation)==null?void 0:h.readOnly)&&!!(i!=null&&i.includes(e.id)),onChange:m=>n(m),required:(v=e==null?void 0:e.validation)==null?void 0:v.required})});case Rn.ParentBirthday:return f.jsx(FD,{title:e.title,onChange:m=>n(m),readonly:!a,dates:e.dates??[null]});case Rn.Checkbox:return f.jsx(VD,{id:e.id,onChange:m=>o(m),required:(g=e==null?void 0:e.validation)==null?void 0:g.required,readonly:!a,value:e.checked,title:e.title,defaultChecked:e.defaultChecked})}return f.jsx("div",{})},YD=e=>{const t=()=>{const r=new RegExp(/^\.*/);return e.type!==null?e.type===zr.Email?new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/):e.type===zr.Url||e.type===zr.Date?r:e.type===zr.Phone?new RegExp(/^[+]?[\d]{10,11}$/):r:r},n=r=>{let o=!0;return e!=null&&e.minTextLength&&(o=o&&r.length>=(e==null?void 0:e.minTextLength)),e!=null&&e.maxTextLength&&(o=o&&r.length<=(e==null?void 0:e.maxTextLength)),o};return r=>t().test(r)?n(r)?{isError:!1}:{isError:!0,message:`Строка не удовлетворяет нужному размеру (${e.minTextLength??0}-${e.maxTextLength??255})`}:{isError:!0,message:"Строка введена неверно"}},df=({onControlsGet:e,buttonSaveText:t,isReg:n=!1,previewControls:r})=>{const{apiAxios:o,additionalData:a,VKUserId:i,setCabinetSettings:s,setPhoneNumber:u,telegramInfo:c,linkId:d,refferalCode:p,cabinetUISettings:h}=S.useContext(ct),{setIsLoading:v}=S.useContext(un),{showErrorAlert:g}=S.useContext(tn),{setOpenedPage:m}=S.useContext(mr),[y,E]=S.useState(!1),[M,x]=S.useState(r??[]);S.useEffect(()=>{x(r??[])},[r]);const[C,b]=S.useState([]),[T,O]=S.useState(Math.random()),[j,L]=S.useState(!1),{validationPopup:$,formIsValid:Y,setValidations:Q}=Gi({}),{ToIsoWithoutTimeZone:X}=Br();S.useEffect(()=>{Q(M.map(k=>({id:k.id,label:k.title,validator:YD(k.validation)})))},[M]);const I=()=>{const k={};return M.map(R=>k[R.id]=R.text),k};S.useEffect(()=>{r||(async()=>{v("GetControls",!0);const R=await o().post("/externalCustomerCabinet/form/registration",{});e==null||e(R.data.controls);let F=R.data.controls;F.some(U=>U.id==="parentphone")&&p&&(F=F.filter(U=>U.id!=="parentphone")),x(F),b(R.data.controls.filter(U=>{var q;return((q=U.validation)==null?void 0:q.readOnly)&&!!U.text})),v("GetControls",!1)})()},[]);const N=()=>{Y()&&!r&&(L(!0),o().patch("/externalCustomerCabinet/form/registration",{recommend:p,linkId:d,controls:M,...a,VKUserId:i,...c??{}}).then(k=>{s(R=>({...R,isReg:!1})),u(k.data.phoneNumber),E(!0),m("info"),b(M.filter(R=>{var F;return((F=R.validation)==null?void 0:F.readOnly)&&!!R.text})),n&&(h!=null&&h.ymIdentifier)&&(h!=null&&h.ymReachGoalIdentifier)&&ym(h==null?void 0:h.ymIdentifier,"reachGoal",h==null?void 0:h.ymReachGoalIdentifier)}).catch(k=>{g(k.response.data.msg)}).finally(()=>{L(!1)}))},A=(k,R)=>{Date.parse(R)&&(R=X(R)),x(F=>{const U=F.find(q=>q.id===k);return U&&(U.text=R),[...F]})},H=(k,R)=>{x(F=>{const U=F.find(q=>q.id===k);return U&&(U.checked=R),[...F]})},Z=k=>{x(R=>{let F=R.find(U=>U.id===k.id);return F&&(F={...k},O(Math.random())),[...R]})};return{controlsForm:f.jsxs(W.Container,{maxWidth:"sm",children:[$,f.jsxs(W.Typography,{component:"div",style:{display:"flex",flexDirection:"column",gap:"1.5em",marginBottom:"1em"},children:[f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:M==null?void 0:M.map((k,R)=>f.jsx("div",{children:f.jsx(UD,{isReg:n,control:k,onChange:F=>A(k.id,F),onChangeChecked:F=>H(k.id,F),onChangeRadio:F=>Z(F),value:k.text??"",readonlyControls:C.map(F=>F.id)})},R))}),f.jsx("div",{style:{display:"flex",justifyContent:"center"},children:f.jsx(qi,{isLoading:j,onClick:()=>N(),children:t||"Сохранить анкету"})})]})]}),setControls:x,saved:y,setSaved:E,GetObjectByControls:I}},HD=()=>{S.useContext(ct);const{controlsForm:e,saved:t,setSaved:n}=df({buttonSaveText:"Регистрация",isReg:!0});return f.jsx("div",{children:f.jsxs("div",{children:[f.jsx(Wo,{style:{marginBottom:"1em"},children:"Для использования полного функционала бота необходимо зарегистрироваться"}),e]})})},zD=()=>{const{controlsForm:e,saved:t,setSaved:n}=df({buttonSaveText:"Редактирование анкеты",isReg:!1});return f.jsx("div",{children:e})},qD=({})=>{const{cabinetSettings:e}=S.useContext(ct),{currentMode:t}=S.useContext(An);return f.jsx(W.Backdrop,{sx:{color:"#fff",zIndex:n=>n.zIndex.drawer+1,backgroundColor:t==="light"?"#e9e9e9":"#191919"},open:!!e&&!(e!=null&&e.cabinetEnabled),children:f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em",alignItems:"center"},children:f.jsx("div",{children:"Бот сейчас отключен"})})})},GD=({showHeader:e})=>{var m;const{cabinetSettings:t,cabinetUISettings:n}=S.useContext(ct),{setTheme:r,theme:o,currentMode:a}=S.useContext(An),{isLoading:i}=S.useContext(un),{openedPage:s,setOpenedPage:u}=S.useContext(mr),c=(y,E)=>{u(E)},d=()=>{var y,E,M,x,C,b,T,O,j,L,$,Y,Q,X,I,N,A,H,Z,ee,k,R,F,U,q,J,re,B,V,z,oe,ce;return a==="light"?{primary:{main:((E=(y=n==null?void 0:n.theme)==null?void 0:y.light)==null?void 0:E.theme)??"#ffffff",contrastText:((x=(M=n==null?void 0:n.theme)==null?void 0:M.light)==null?void 0:x.text)??"#ffffff"},text:{primary:((b=(C=n==null?void 0:n.theme)==null?void 0:C.light)==null?void 0:b.theme)??"#ffffff"},background:{default:((O=(T=n==null?void 0:n.theme)==null?void 0:T.light)==null?void 0:O.background)??"#ffffff"},components:{MuiPaper:{styleOverrides:{root:{backgroundColor:((L=(j=n==null?void 0:n.theme)==null?void 0:j.light)==null?void 0:L.background)??"#ffffff"}}},MuiInput:{styleOverrides:{root:{color:((Y=($=n==null?void 0:n.theme)==null?void 0:$.light)==null?void 0:Y.theme)??"#ffffff","&::before":{borderBottom:`solid 1px ${((X=(Q=n==null?void 0:n.theme)==null?void 0:Q.light)==null?void 0:X.theme)??"#ffffff"}`}}}},MuiFormLabel:{styleOverrides:{root:{color:((N=(I=n==null?void 0:n.theme)==null?void 0:I.light)==null?void 0:N.theme)??"#ffffff"}}}}}:{primary:{main:((H=(A=n==null?void 0:n.theme)==null?void 0:A.dark)==null?void 0:H.theme)??"#ffffff",contrastText:((ee=(Z=n==null?void 0:n.theme)==null?void 0:Z.dark)==null?void 0:ee.text)??"#000000"},text:{primary:((R=(k=n==null?void 0:n.theme)==null?void 0:k.dark)==null?void 0:R.theme)??"#ffffff"},background:{default:((U=(F=n==null?void 0:n.theme)==null?void 0:F.dark)==null?void 0:U.background)??"#000000"},components:{MuiPaper:{styleOverrides:{root:{backgroundColor:((J=(q=n==null?void 0:n.theme)==null?void 0:q.dark)==null?void 0:J.background)??"#000000"}}},MuiInput:{styleOverrides:{root:{color:((B=(re=n==null?void 0:n.theme)==null?void 0:re.dark)==null?void 0:B.theme)??"#ffffff","&::before":{borderBottom:`solid 1px ${((z=(V=n==null?void 0:n.theme)==null?void 0:V.dark)==null?void 0:z.theme)??"#ffffff"}`}}}},MuiFormLabel:{styleOverrides:{root:{color:((ce=(oe=n==null?void 0:n.theme)==null?void 0:oe.dark)==null?void 0:ce.theme)??"#000000"}}}}}};S.useEffect(()=>{const y=d();r(E=>({...Da,palette:{...E.palette,...y},components:{...E.components,...y.components}}))},[n]);const{popups:p,closePopupById:h}=S.useContext(tn),g=[{icon:f.jsx(Nu,{}),value:"info",label:"Карта",page:f.jsx(F0,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx($u,{}),value:"receipt",label:"История",page:f.jsx(yb,{}),active:t==null?void 0:t.canShowPurchaseHistory,disabled:t==null?void 0:t.isReg},{icon:f.jsx(ju,{}),value:"appeals",label:"Обращения",page:f.jsx(Zb,{}),active:t==null?void 0:t.canShowAppeals,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ao,{}),value:"businessInfo",label:"Информация",page:f.jsx(bb,{}),active:t==null?void 0:t.canShowBusinessInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ru,{}),value:"personInfo",label:"Клиент",page:f.jsx(zD,{}),active:t==null?void 0:t.canEditPersonInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Au,{}),value:"registration",label:"Регистрация",page:f.jsx(HD,{}),active:t==null?void 0:t.isReg,disabled:!1}].filter(y=>y.active&&!y.disabled);return f.jsxs(W.Box,{sx:{bgcolor:"background.default"},className:"page_view",children:[e&&f.jsx(Is,{}),f.jsx(Jb,{show:i}),f.jsx(qD,{}),p.map((y,E)=>f.jsx(uc,{title:y.title,opened:!0,setOpened:()=>h(y.id),children:f.jsx("div",{children:y.content})})),f.jsx("div",{className:"page_view__page scrollbar",children:(m=g.find(y=>y.value===s))==null?void 0:m.page}),f.jsx("div",{className:"page_view__navigation",children:f.jsx("div",{children:f.jsx(W.BottomNavigation,{sx:{borderTop:"solid 1px #88888850",bgcolor:"background.default"},value:s,onChange:c,children:g.map((y,E)=>f.jsx(W.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:y.label,value:y.value,icon:y.icon},E))})})})]})};Ye.AppContext=ct,Ye.AppProvider=Rf,Ye.BonusPlusThemeContext=An,Ye.BonusPlusThemeProvider=Af,Ye.ErrorBoundary=If,Ye.Header=Is,Ye.LoadingContext=un,Ye.LoadingProvider=Of,Ye.PageContext=mr,Ye.PageProvider=_f,Ye.PopupContext=tn,Ye.PopupProvider=ib,Ye.Router=GD,Object.defineProperty(Ye,Symbol.toStringTag,{value:"Module"})});
|
|
238
|
+
`))),s}const gD=(e,t)=>n=>{let r=0;return n.split("").map((o,a)=>{if(t.lastIndex=0,r>e.length-1)return"";const i=e[r],s=e[r+1],u=t.test(o)?o:"",c=i===va?u:i+u;return r+=c.length,a===n.length-1&&s&&s!==va?c?c+s:"":c}).join("")},yD=({acceptRegex:e=/[\d]/gi,disabled:t,disableMaskedInput:n,ignoreInvalidInputs:r,inputFormat:o,inputProps:a,label:i,mask:s,onChange:u,rawValue:c,readOnly:d,rifmFormatter:p,TextFieldProps:h,validationError:v})=>{const g=Je(),m=g.getFormatHelperText(o),{shouldUseMaskedInput:y,maskToUse:E}=w.useMemo(()=>{if(n)return{shouldUseMaskedInput:!1,maskToUse:""};const I=mD(s,o,e,g);return{shouldUseMaskedInput:vD(I,o,e,g),maskToUse:I}},[e,n,o,s,g]),M=w.useMemo(()=>y&&E?gD(E,e):I=>I,[e,E,y]),x=c===null?null:g.date(c),[C,b]=w.useState(x),[T,O]=w.useState(ef(g,c,o)),j=w.useRef(),L=w.useRef(g.locale),$=w.useRef(o);w.useEffect(()=>{const I=c!==j.current,N=g.locale!==L.current,A=o!==$.current;if(j.current=c,L.current=g.locale,$.current=o,!I&&!N&&!A)return;const H=c===null?null:g.date(c),Z=c===null||g.isValid(H);let ee=C===null&&H===null;if(C!==null&&H!==null){const R=g.isEqual(C,H);if(R)ee=!0;else{const F=Math.abs(g.getDiff(C,H));ee=F===0?R:F<1e3}}if(!N&&!A&&(!Z||ee))return;const k=ef(g,c,o);b(H),O(k)},[g,c,o,C]);const Y=I=>{const N=I===""||I===s?"":I;O(N);const A=N===null?null:g.parse(N,o);r&&!g.isValid(A)||(b(A),u(A,N||void 0))},Q=hD({value:T,onChange:Y,format:p||M});return D({label:i,disabled:t,error:v,inputProps:D({},y?Q:{value:T,onChange:I=>{Y(I.currentTarget.value)}},{disabled:t,placeholder:m,readOnly:d,type:y?"tel":"text"},a)},h)},bD=["className","components","disableOpenPicker","getOpenDialogAriaText","InputAdornmentProps","InputProps","inputRef","openPicker","OpenPickerButtonProps","renderInput"],rf=w.forwardRef(function(t,n){const{className:r,components:o={},disableOpenPicker:a,getOpenDialogAriaText:i,InputAdornmentProps:s,InputProps:u,inputRef:c,openPicker:d,OpenPickerButtonProps:p,renderInput:h}=t,v=fe(t,bD),g=or(),m=i??g.openDatePickerDialogue,y=Je(),E=yD(v),M=(s==null?void 0:s.position)||"end",x=o.OpenPickerIcon||kd;return h(D({ref:n,inputRef:c,className:r},E,{InputProps:D({},u,{[`${M}Adornment`]:a?void 0:f.jsx(pD,D({position:M},s,{children:f.jsx(ar,D({edge:M,disabled:v.disabled||v.readOnly,"aria-label":m(v.rawValue,y)},p,{onClick:d,children:f.jsx(x,{})}))}))})}))});function of(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const xD=(e,t)=>{const[n,r]=w.useState(of);return It(()=>{const a=()=>{r(of())};return window.addEventListener("orientationchange",a),()=>{window.removeEventListener("orientationchange",a)}},[]),cd(e,["hours","minutes","seconds"])?!1:(t||n)==="landscape"},wD=({autoFocus:e,openView:t})=>{const[n,r]=w.useState(e?t:null),o=w.useCallback(a=>i=>{r(i?a:s=>a===s?null:s)},[]);return{focusedView:n,setFocusedView:o}};function CD(e){return W.generateUtilityClass("MuiCalendarOrClockPicker",e)}W.generateUtilityClasses("MuiCalendarOrClockPicker",["root","mobileKeyboardInputView"]);const ED=["autoFocus","className","parsedValue","DateInputProps","isMobileKeyboardViewOpen","onDateChange","onViewChange","openTo","orientation","showToolbar","toggleMobileKeyboardView","ToolbarComponent","toolbarFormat","toolbarPlaceholder","toolbarTitle","views","dateRangeIcon","timeIcon","hideTabs","classes"],TD=e=>{const{classes:t}=e,n={root:["root"],mobileKeyboardInputView:["mobileKeyboardInputView"]};return W.unstable_composeClasses(n,CD,t)},PD=ue("div",{name:"MuiCalendarOrClockPicker",slot:"MobileKeyboardInputView",overridesResolver:(e,t)=>t.mobileKeyboardInputView})({padding:"16px 24px"}),DD=ue("div",{name:"MuiCalendarOrClockPicker",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e})=>D({display:"flex",flexDirection:"column"},e.isLandscape&&{flexDirection:"row"})),OD={fullWidth:!0},af=e=>e==="year"||e==="month"||e==="day",sf=e=>e==="hours"||e==="minutes"||e==="seconds";let lf=!1;function kD(e){var t,n;const r=Se({props:e,name:"MuiCalendarOrClockPicker"}),{autoFocus:o,parsedValue:a,DateInputProps:i,isMobileKeyboardViewOpen:s,onDateChange:u,onViewChange:c,openTo:d,orientation:p,showToolbar:h,toggleMobileKeyboardView:v,ToolbarComponent:g=()=>null,toolbarFormat:m,toolbarPlaceholder:y,toolbarTitle:E,views:M,dateRangeIcon:x,timeIcon:C,hideTabs:b}=r,T=fe(r,ED),O=(t=T.components)==null?void 0:t.Tabs,j=xD(M,p),L=w.useContext(ir),$=TD(r),Y=h??L!=="desktop",Q=!b&&typeof window<"u"&&window.innerHeight>667,X=w.useCallback((k,R)=>{u(k,L,R)},[u,L]),I=w.useCallback(k=>{s&&v(),c&&c(k)},[s,c,v]);process.env.NODE_ENV!=="production"&&!lf&&!M.includes(d)&&(console.warn(`MUI: \`openTo="${d}"\` is not a valid prop.`,`It must be an element of \`views=["${M.join('", "')}"]\`.`),lf=!0);const{openView:N,setOpenView:A,handleChangeAndOpenNext:H}=bs({view:void 0,views:M,openTo:d,onChange:X,onViewChange:I}),{focusedView:Z,setFocusedView:ee}=wD({autoFocus:o,openView:N});return f.jsxs(DD,{ownerState:{isLandscape:j},className:$.root,children:[Y&&f.jsx(g,D({},T,{views:M,isLandscape:j,parsedValue:a,onChange:X,setOpenView:A,openView:N,toolbarTitle:E,toolbarFormat:m,toolbarPlaceholder:y,isMobileKeyboardViewOpen:s,toggleMobileKeyboardView:v})),Q&&!!O&&f.jsx(O,D({dateRangeIcon:x,timeIcon:C,view:N,onChange:A},(n=T.componentsProps)==null?void 0:n.tabs)),f.jsx(ws,{children:s?f.jsx(PD,{className:$.mobileKeyboardInputView,children:f.jsx(rf,D({},i,{ignoreInvalidInputs:!0,disableOpenPicker:!0,TextFieldProps:OD}))}):f.jsxs(w.Fragment,{children:[af(N)&&f.jsx(jd,D({autoFocus:o,date:a,onViewChange:A,onChange:H,view:N,views:M.filter(af),focusedView:Z,onFocusedViewChange:ee},T)),sf(N)&&f.jsx(Fd,D({},T,{autoFocus:o,date:a,view:N,views:M.filter(sf),onChange:H,onViewChange:A,showViewSwitcher:L==="desktop"}))]})})]})}const MD=({open:e,onOpen:t,onClose:n})=>{const r=w.useRef(typeof e=="boolean").current,[o,a]=w.useState(!1);w.useEffect(()=>{if(r){if(typeof e!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");a(e)}},[r,e]);const i=w.useCallback(s=>{r||a(s),s&&t&&t(),!s&&n&&n()},[r,t,n]);return{isOpen:o,setIsOpen:i}},_D=(e,t)=>{const{onAccept:n,onChange:r,value:o,closeOnSelect:a}=e,i=Je(),{isOpen:s,setIsOpen:u}=MD(e),c=w.useMemo(()=>t.parseInput(i,o),[t,i,o]),[d,p]=w.useState(c),[h,v]=w.useState(()=>({committed:c,draft:c,resetFallback:c})),g=w.useCallback(T=>{v(O=>{switch(T.action){case"setAll":case"acceptAndClose":return{draft:T.value,committed:T.value,resetFallback:T.value};case"setCommitted":return D({},O,{draft:T.value,committed:T.value});case"setDraft":return D({},O,{draft:T.value});default:return O}}),(T.forceOnChangeCall||!T.skipOnChangeCall&&!t.areValuesEqual(i,h.committed,T.value))&&r(T.value),T.action==="acceptAndClose"&&(u(!1),n&&!t.areValuesEqual(i,h.resetFallback,T.value)&&n(T.value))},[n,r,u,h,i,t]);w.useEffect(()=>{i.isValid(c)&&p(c)},[i,c]),w.useEffect(()=>{s&&g({action:"setAll",value:c,skipOnChangeCall:!0})},[s]),t.areValuesEqual(i,h.committed,c)||g({action:"setCommitted",value:c,skipOnChangeCall:!0});const m=w.useMemo(()=>({open:s,onClear:()=>{g({value:t.emptyValue,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,t.emptyValue)})},onAccept:()=>{g({value:h.draft,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,c)})},onDismiss:()=>{g({value:h.committed,action:"acceptAndClose"})},onCancel:()=>{g({value:h.resetFallback,action:"acceptAndClose"})},onSetToday:()=>{g({value:t.getTodayValue(i),action:"acceptAndClose"})}}),[g,s,i,h,t,o,c]),[y,E]=w.useState(!1),M=w.useMemo(()=>({parsedValue:h.draft,isMobileKeyboardViewOpen:y,toggleMobileKeyboardView:()=>E(!y),onDateChange:(T,O,j="partial")=>{switch(j){case"shallow":return g({action:"setDraft",value:T,skipOnChangeCall:!0});case"partial":return g({action:"setDraft",value:T});case"finish":return g(a??O==="desktop"?{value:T,action:"acceptAndClose"}:{value:T,action:"setCommitted"});default:throw new Error("MUI: Invalid selectionState passed to `onDateChange`")}}}),[g,y,h.draft,a]),x=w.useCallback((T,O)=>{const j=t.valueReducer?t.valueReducer(i,d,T):T;r(j,O)},[r,t,d,i]),C=w.useMemo(()=>({onChange:x,open:s,rawValue:o,openPicker:()=>u(!0)}),[x,s,o,u]),b={pickerProps:M,inputProps:C,wrapperProps:m};return w.useDebugValue(b,()=>({MuiPickerState:{dateState:h,other:b}})),b},SD=["onChange","PopperProps","PaperProps","ToolbarComponent","TransitionComponent","value","components","componentsProps"],uf=w.forwardRef(function(t,n){const r=oP(t,"MuiDesktopDatePicker"),o=tE(r)!==null,{pickerProps:a,inputProps:i,wrapperProps:s}=_D(r,aP),{PopperProps:u,PaperProps:c,ToolbarComponent:d=RP,TransitionComponent:p,components:h,componentsProps:v}=r,g=fe(r,SD),m=D({},i,g,{components:h,componentsProps:v,ref:n,validationError:o});return f.jsx(iD,D({},s,{DateInputProps:m,KeyboardDateInputComponent:rf,PopperProps:u,PaperProps:c,TransitionComponent:p,components:h,componentsProps:v,children:f.jsx(kD,D({},a,{autoFocus:!0,toolbarTitle:r.label||r.toolbarTitle,ToolbarComponent:d,DateInputProps:m,components:h,componentsProps:v},g))}))});process.env.NODE_ENV!=="production"&&(uf.propTypes={acceptRegex:l.instanceOf(RegExp),autoFocus:l.bool,children:l.node,className:l.string,closeOnSelect:l.bool,components:l.object,componentsProps:l.object,dayOfWeekFormatter:l.func,defaultCalendarMonth:l.any,disabled:l.bool,disableFuture:l.bool,disableHighlightToday:l.bool,disableMaskedInput:l.bool,disableOpenPicker:l.bool,disablePast:l.bool,getOpenDialogAriaText:l.func,getViewSwitchingButtonText:l.func,ignoreInvalidInputs:l.bool,InputAdornmentProps:l.object,inputFormat:l.string,InputProps:l.object,inputRef:l.oneOfType([l.func,l.shape({current:l.object})]),label:l.node,leftArrowButtonText:l.string,loading:l.bool,mask:l.string,maxDate:l.any,minDate:l.any,onAccept:l.func,onChange:l.func.isRequired,onClose:l.func,onError:l.func,onMonthChange:l.func,onOpen:l.func,onViewChange:l.func,onYearChange:l.func,open:l.bool,OpenPickerButtonProps:l.object,openTo:l.oneOf(["day","month","year"]),orientation:l.oneOf(["landscape","portrait"]),PaperProps:l.object,PopperProps:l.object,readOnly:l.bool,reduceAnimations:l.bool,renderDay:l.func,renderInput:l.func.isRequired,renderLoading:l.func,rifmFormatter:l.func,rightArrowButtonText:l.string,shouldDisableDate:l.func,shouldDisableMonth:l.func,shouldDisableYear:l.func,showDaysOutsideCurrentMonth:l.bool,showToolbar:l.bool,ToolbarComponent:l.elementType,toolbarFormat:l.string,toolbarPlaceholder:l.node,toolbarTitle:l.node,TransitionComponent:l.elementType,value:l.any,views:l.arrayOf(l.oneOf(["day","month","year"]).isRequired)});const Ps=({title:e,value:t,readonly:n,onChange:r,required:o,id:a,fullWidth:i=!0})=>f.jsx(uf,{disabled:n,label:e,value:t,onChange:s=>r(s),renderInput:s=>{var c,d,p;let u;return(c=s.inputProps)!=null&&c.placeholder&&(u=(p=(d=s.inputProps)==null?void 0:d.placeholder)==null?void 0:p.slice(),s.inputProps.placeholder=void 0),f.jsx(W.TextField,{...s,required:o,sx:{width:"100%"},placeholder:u,autoComplete:"off",variant:"standard",error:!1})}});var Ds={},$D=dt;Object.defineProperty(Ds,"__esModule",{value:!0});var Os=Ds.default=void 0,RD=$D(ft()),ND=f,jD=(0,RD.default)((0,ND.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Os=Ds.default=jD;var ks={},AD=dt;Object.defineProperty(ks,"__esModule",{value:!0});var cf=ks.default=void 0,ID=AD(ft()),LD=f,BD=(0,ID.default)((0,LD.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");cf=ks.default=BD;const FD=({dates:e,readonly:t,onChange:n,title:r})=>{const[o,a]=S.useState(Math.random()),[i,s]=S.useState(e??[null]),{ToIsoWithoutTimeZone:u,ParseDataToRusLocale:c}=Br();S.useEffect(()=>{n(i.filter(h=>!!h&&Date.parse(h)).map(h=>u(h)).join(","))},[i]);const d=()=>{s(h=>[...h,null]),a(Math.random())},p=h=>{s(v=>[...v.filter((g,m)=>m!==h)]),a(Math.random())};return i.length<2?f.jsx(Qo,{dateAdapter:ps,locale:ms,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Ps,{id:"",title:r??"День рождения родственника",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(v=>(v[i.length-1]=h,[...v]))}),!!Date.parse(i[0]??"")&&!t&&f.jsx(W.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Os,{})})]})}):f.jsxs("div",{children:[f.jsx("div",{style:{marginBottom:"1em"},children:"День рождения родственников"}),f.jsx("div",{style:{borderLeft:"solid 1px #88888850",paddingLeft:"1em"},children:f.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[f.jsx("div",{style:{display:"flex",gap:"1em",flexWrap:"wrap"},children:i.filter((h,v)=>v<i.length-1).map((h,v)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em",backgroundColor:"rgba(204, 204, 204, 0.5)",padding:"0 .5em",borderRadius:"5px"},children:[f.jsx("div",{children:h&&c(h.toString())}),f.jsx("div",{children:!t&&f.jsx(W.IconButton,{size:"small",color:"primary",onClick:()=>p(v),children:f.jsx(cf,{})})})]},v))}),f.jsx("div",{children:f.jsx(Qo,{dateAdapter:ps,locale:ms,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Ps,{id:"",title:"День рождения",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(v=>(v[i.length-1]=h,[...v]))}),!t&&f.jsx(W.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Os,{})})]})})})]})})]})},VD=({id:e,defaultChecked:t,title:n,readonly:r,required:o,onChange:a,value:i})=>{const s=W.useTheme(),u=(c,d=!1)=>{if(!o)return;const p=new CustomEvent(Fr,{detail:{id:e,empty:!c,label:n}});document.dispatchEvent(p)};return S.useEffect(()=>{setTimeout(()=>u(i),1)},[]),S.useEffect(()=>{u(i,!0)},[i]),f.jsxs("div",{style:{display:"flex",gap:"1em",alignItems:"center"},children:[f.jsx(W.Checkbox,{required:o,sx:{padding:0},readOnly:r,checked:i,onChange:()=>a(!i)}),f.jsx(W.Box,{sx:{fontSize:"1rem",a:{color:s.palette.info.main,textDecoration:"none"}},component:"div",dangerouslySetInnerHTML:{__html:n}})]})},WD=({control:e,isReg:t,readonlyControls:n,onChangeRadio:r})=>{var a,i,s,u,c,d;const o=(p,h=!1)=>{if(!e.validation.required)return;const v=new CustomEvent(Fr,{detail:{id:e.id,empty:!p,label:e.title}});document.dispatchEvent(v)};return S.useEffect(()=>{setTimeout(()=>{var p,h;return o((h=(p=e.values)==null?void 0:p.find(v=>v.selected))==null?void 0:h.id)},1)},[]),f.jsx(W.Box,{sx:{minWidth:120},children:f.jsxs(W.FormControl,{fullWidth:!0,variant:"standard",required:(a=e==null?void 0:e.validation)==null?void 0:a.required,children:[f.jsx(W.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(W.Select,{required:(i=e==null?void 0:e.validation)==null?void 0:i.required,readOnly:!t&&((s=e==null?void 0:e.validation)==null?void 0:s.readOnly)&&(n==null?void 0:n.includes(e.id)),labelId:`select-${e.id}`,value:((c=(u=e.values)==null?void 0:u.find(p=>p.selected))==null?void 0:c.id)||"",label:e.title,onChange:p=>{var v,g;(v=e.values)==null||v.filter(m=>m.id!==p.target.value).forEach(m=>m.selected=!1);let h=(g=e.values)==null?void 0:g.find(m=>m.id===p.target.value);h&&(o(!0,!0),h.selected=!0),r({...e,values:e.values})},children:(d=e.values)==null?void 0:d.map(p=>f.jsx(W.MenuItem,{value:p.id,children:p.text},p.id))})]})})},UD=({control:e,value:t,onChange:n,onChangeRadio:r,onChangeChecked:o,isReg:a,readonlyControls:i})=>{var s,u,c,d,p,h,v,g;switch(e.type){case Rn.Textbox:return f.jsx(Ho,{value:t,onChange:m=>n(m.target.value),required:(s=e==null?void 0:e.validation)==null?void 0:s.required,id:e.id,label:e.title,disabled:!a&&((u=e==null?void 0:e.validation)==null?void 0:u.readOnly)&&(i==null?void 0:i.includes(e.id)),autoComplete:"off",variant:"standard",fullWidth:!0});case Rn.RadiobuttonGroup:return f.jsx(WD,{control:e,isReg:a,readonlyControls:i,onChangeRadio:r});case Rn.Select:return f.jsx(W.Box,{sx:{minWidth:120,maxHeight:"400px"},children:f.jsxs(W.FormControl,{fullWidth:!0,variant:"standard",required:(c=e==null?void 0:e.validation)==null?void 0:c.required,children:[f.jsx(W.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(W.Select,{sx:{maxHeight:"300px"},readOnly:!a&&((d=e==null?void 0:e.validation)==null?void 0:d.readOnly)&&(i==null?void 0:i.includes(e.id)),labelId:`select-${e.id}`,value:e.text,label:e.title,onChange:m=>n(m.target.value),children:(p=e.values)==null?void 0:p.map(m=>f.jsx(W.MenuItem,{value:m.id,children:m.text},m.id))})]})});case Rn.Date:return f.jsx(Qo,{dateAdapter:ps,locale:ms,children:f.jsx(Ps,{id:e.id,title:e.title,value:t,readonly:!a&&((h=e==null?void 0:e.validation)==null?void 0:h.readOnly)&&!!(i!=null&&i.includes(e.id)),onChange:m=>n(m),required:(v=e==null?void 0:e.validation)==null?void 0:v.required})});case Rn.ParentBirthday:return f.jsx(FD,{title:e.title,onChange:m=>n(m),readonly:!a,dates:e.dates??[null]});case Rn.Checkbox:return f.jsx(VD,{id:e.id,onChange:m=>o(m),required:(g=e==null?void 0:e.validation)==null?void 0:g.required,readonly:!a,value:e.checked,title:e.title,defaultChecked:e.defaultChecked})}return f.jsx("div",{})},YD=e=>{const t=()=>{const r=new RegExp(/^\.*/);return e.type!==null?e.type===zr.Email?new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/):e.type===zr.Url||e.type===zr.Date?r:e.type===zr.Phone?new RegExp(/^[+]?[\d]{10,11}$/):r:r},n=r=>{let o=!0;return e!=null&&e.minTextLength&&(o=o&&r.length>=(e==null?void 0:e.minTextLength)),e!=null&&e.maxTextLength&&(o=o&&r.length<=(e==null?void 0:e.maxTextLength)),o};return r=>t().test(r)?n(r)?{isError:!1}:{isError:!0,message:`Строка не удовлетворяет нужному размеру (${e.minTextLength??0}-${e.maxTextLength??255})`}:{isError:!0,message:"Строка введена неверно"}},df=({onControlsGet:e,buttonSaveText:t,isReg:n=!1,previewControls:r})=>{const{apiAxios:o,additionalData:a,VKUserId:i,setCabinetSettings:s,setPhoneNumber:u,telegramInfo:c,linkId:d,refferalCode:p,cabinetUISettings:h}=S.useContext(ct),{setIsLoading:v}=S.useContext(un),{showErrorAlert:g}=S.useContext(tn),{setOpenedPage:m}=S.useContext(mr),[y,E]=S.useState(!1),[M,x]=S.useState(r??[]);S.useEffect(()=>{x(r??[])},[r]);const[C,b]=S.useState([]),[T,O]=S.useState(Math.random()),[j,L]=S.useState(!1),{validationPopup:$,formIsValid:Y,setValidations:Q}=Gi({}),{ToIsoWithoutTimeZone:X}=Br();S.useEffect(()=>{Q(M.map(k=>({id:k.id,label:k.title,validator:YD(k.validation)})))},[M]);const I=()=>{const k={};return M.map(R=>k[R.id]=R.text),k};S.useEffect(()=>{r||(async()=>{v("GetControls",!0);const R=await o().post("/externalCustomerCabinet/form/registration",{});e==null||e(R.data.controls);let F=R.data.controls;F.some(U=>U.id==="parentphone")&&p&&(F=F.filter(U=>U.id!=="parentphone")),x(F),b(R.data.controls.filter(U=>{var q;return((q=U.validation)==null?void 0:q.readOnly)&&!!U.text})),v("GetControls",!1)})()},[]);const N=()=>{Y()&&!r&&(L(!0),o().patch("/externalCustomerCabinet/form/registration",{recommend:p,linkId:d,controls:M,...a,VKUserId:i,...c??{}}).then(k=>{s(R=>({...R,isReg:!1})),u(k.data.phoneNumber),E(!0),m("info"),b(M.filter(R=>{var F;return((F=R.validation)==null?void 0:F.readOnly)&&!!R.text})),n&&(h!=null&&h.ymIdentifier)&&(h!=null&&h.ymReachGoalIdentifier)&&ym(h==null?void 0:h.ymIdentifier,"reachGoal",h==null?void 0:h.ymReachGoalIdentifier)}).catch(k=>{g(k.response.data.msg)}).finally(()=>{L(!1)}))},A=(k,R)=>{Date.parse(R)&&(R=X(R)),x(F=>{const U=F.find(q=>q.id===k);return U&&(U.text=R),[...F]})},H=(k,R)=>{x(F=>{const U=F.find(q=>q.id===k);return U&&(U.checked=R),[...F]})},Z=k=>{x(R=>{let F=R.find(U=>U.id===k.id);return F&&(F={...k},O(Math.random())),[...R]})};return{controlsForm:f.jsxs(W.Container,{maxWidth:"sm",children:[$,f.jsxs(W.Typography,{component:"div",style:{display:"flex",flexDirection:"column",gap:"1.5em",marginBottom:"1em"},children:[f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:M==null?void 0:M.map((k,R)=>f.jsx("div",{children:f.jsx(UD,{isReg:n,control:k,onChange:F=>A(k.id,F),onChangeChecked:F=>H(k.id,F),onChangeRadio:F=>Z(F),value:k.text??"",readonlyControls:C.map(F=>F.id)})},R))}),f.jsx("div",{style:{display:"flex",justifyContent:"center"},children:f.jsx(qi,{isLoading:j,onClick:()=>N(),children:t||"Сохранить анкету"})})]})]}),setControls:x,saved:y,setSaved:E,GetObjectByControls:I}},HD=()=>{S.useContext(ct);const{controlsForm:e,saved:t,setSaved:n}=df({buttonSaveText:"Регистрация",isReg:!0});return f.jsx("div",{children:f.jsxs("div",{children:[f.jsx(Wo,{style:{marginBottom:"1em"},children:"Для использования полного функционала бота необходимо зарегистрироваться"}),e]})})},zD=()=>{const{controlsForm:e,saved:t,setSaved:n}=df({buttonSaveText:"Редактирование анкеты",isReg:!1});return f.jsx("div",{children:e})},qD=({})=>{const{cabinetSettings:e}=S.useContext(ct),{currentMode:t}=S.useContext(An);return f.jsx(W.Backdrop,{sx:{color:t==="light"?"#191919":"#e9e9e9",zIndex:n=>n.zIndex.drawer+1,backgroundColor:t==="light"?"#e9e9e9":"#191919"},open:!!e&&!(e!=null&&e.cabinetEnabled),children:f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em",alignItems:"center"},children:f.jsx("div",{children:"Бот сейчас отключен"})})})},GD=({showHeader:e})=>{var m;const{cabinetSettings:t,cabinetUISettings:n}=S.useContext(ct),{setTheme:r,theme:o,currentMode:a}=S.useContext(An),{isLoading:i}=S.useContext(un),{openedPage:s,setOpenedPage:u}=S.useContext(mr),c=(y,E)=>{u(E)},d=()=>{var y,E,M,x,C,b,T,O,j,L,$,Y,Q,X,I,N,A,H,Z,ee,k,R,F,U,q,J,re,B,V,z,oe,ce;return a==="light"?{primary:{main:((E=(y=n==null?void 0:n.theme)==null?void 0:y.light)==null?void 0:E.theme)??"#ffffff",contrastText:((x=(M=n==null?void 0:n.theme)==null?void 0:M.light)==null?void 0:x.text)??"#ffffff"},text:{primary:((b=(C=n==null?void 0:n.theme)==null?void 0:C.light)==null?void 0:b.theme)??"#ffffff"},background:{default:((O=(T=n==null?void 0:n.theme)==null?void 0:T.light)==null?void 0:O.background)??"#ffffff"},components:{MuiPaper:{styleOverrides:{root:{backgroundColor:((L=(j=n==null?void 0:n.theme)==null?void 0:j.light)==null?void 0:L.background)??"#ffffff"}}},MuiInput:{styleOverrides:{root:{color:((Y=($=n==null?void 0:n.theme)==null?void 0:$.light)==null?void 0:Y.theme)??"#ffffff","&::before":{borderBottom:`solid 1px ${((X=(Q=n==null?void 0:n.theme)==null?void 0:Q.light)==null?void 0:X.theme)??"#ffffff"}`}}}},MuiFormLabel:{styleOverrides:{root:{color:((N=(I=n==null?void 0:n.theme)==null?void 0:I.light)==null?void 0:N.theme)??"#ffffff"}}}}}:{primary:{main:((H=(A=n==null?void 0:n.theme)==null?void 0:A.dark)==null?void 0:H.theme)??"#ffffff",contrastText:((ee=(Z=n==null?void 0:n.theme)==null?void 0:Z.dark)==null?void 0:ee.text)??"#000000"},text:{primary:((R=(k=n==null?void 0:n.theme)==null?void 0:k.dark)==null?void 0:R.theme)??"#ffffff"},background:{default:((U=(F=n==null?void 0:n.theme)==null?void 0:F.dark)==null?void 0:U.background)??"#000000"},components:{MuiPaper:{styleOverrides:{root:{backgroundColor:((J=(q=n==null?void 0:n.theme)==null?void 0:q.dark)==null?void 0:J.background)??"#000000"}}},MuiInput:{styleOverrides:{root:{color:((B=(re=n==null?void 0:n.theme)==null?void 0:re.dark)==null?void 0:B.theme)??"#ffffff","&::before":{borderBottom:`solid 1px ${((z=(V=n==null?void 0:n.theme)==null?void 0:V.dark)==null?void 0:z.theme)??"#ffffff"}`}}}},MuiFormLabel:{styleOverrides:{root:{color:((ce=(oe=n==null?void 0:n.theme)==null?void 0:oe.dark)==null?void 0:ce.theme)??"#000000"}}}}}};S.useEffect(()=>{const y=d();r(E=>({...Da,palette:{...E.palette,...y},components:{...E.components,...y.components}}))},[n]);const{popups:p,closePopupById:h}=S.useContext(tn),g=[{icon:f.jsx(Nu,{}),value:"info",label:"Карта",page:f.jsx(F0,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx($u,{}),value:"receipt",label:"История",page:f.jsx(yb,{}),active:t==null?void 0:t.canShowPurchaseHistory,disabled:t==null?void 0:t.isReg},{icon:f.jsx(ju,{}),value:"appeals",label:"Обращения",page:f.jsx(Zb,{}),active:t==null?void 0:t.canShowAppeals,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ao,{}),value:"businessInfo",label:"Информация",page:f.jsx(bb,{}),active:t==null?void 0:t.canShowBusinessInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Ru,{}),value:"personInfo",label:"Клиент",page:f.jsx(zD,{}),active:t==null?void 0:t.canEditPersonInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Au,{}),value:"registration",label:"Регистрация",page:f.jsx(HD,{}),active:t==null?void 0:t.isReg,disabled:!1}].filter(y=>y.active&&!y.disabled);return f.jsxs(W.Box,{sx:{bgcolor:"background.default"},className:"page_view",children:[e&&f.jsx(Is,{}),f.jsx(Jb,{show:i}),f.jsx(qD,{}),p.map((y,E)=>f.jsx(uc,{title:y.title,opened:!0,setOpened:()=>h(y.id),children:f.jsx("div",{children:y.content})})),f.jsx("div",{className:"page_view__page scrollbar",children:(m=g.find(y=>y.value===s))==null?void 0:m.page}),f.jsx("div",{className:"page_view__navigation",children:f.jsx("div",{children:f.jsx(W.BottomNavigation,{sx:{borderTop:"solid 1px #88888850",bgcolor:"background.default"},value:s,onChange:c,children:g.map((y,E)=>f.jsx(W.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:y.label,value:y.value,icon:y.icon},E))})})})]})};Ye.AppContext=ct,Ye.AppProvider=Rf,Ye.BonusPlusThemeContext=An,Ye.BonusPlusThemeProvider=Af,Ye.ErrorBoundary=If,Ye.Header=Is,Ye.LoadingContext=un,Ye.LoadingProvider=Of,Ye.PageContext=mr,Ye.PageProvider=_f,Ye.PopupContext=tn,Ye.PopupProvider=ib,Ye.Router=GD,Object.defineProperty(Ye,Symbol.toStringTag,{value:"Module"})});
|