14 lines
98 KiB
JavaScript
14 lines
98 KiB
JavaScript
!function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(a,r,function(t){return e[t]}.bind(null,r));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/content/modulebz/js/react/",n(n.s=13)}([function(e,t,n){e.exports=n(9)()},function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";e.exports=n(7)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r}));var a=function(){return"undefined"!=typeof window?window:e},r=function(){var e=a();return e&&e.tinymce?e.tinymce:null}}).call(this,n(11))},function(e,t,n){"use strict";var a;window.Select=class extends React.Component{constructor(e){var t,n,a,r,s,i,l,o,c;if(super(e),c=null,null!=(t=this.prepareData(e.data))&&null!=e.id)for(a=0,r=t.length;a<r;a++)if(n=t[a],parseInt(n.id)===parseInt(e.id)){c=n;break}this.state={open:null!=e.open?e.open:e.open=!1,data:null!=t?t:[],selected:null!=c?c:null!=(s=t[0])?s:null,ajax:null!=(i=e.ajax)&&i,controller:null!=(l=e.controller)?l:"",placeholder:null!=(o=e.placeholder)?o:"",search:"",statuses:!0===e.statuses},this.input=null,this.inputSearch=null,this.roller=null,this.toggle=this.toggle.bind(this),this.prepareData=this.prepareData.bind(this),this.preventClose=this.preventClose.bind(this)}preventClose(e){return null!=e&&e.stopPropagation(),null!=e?e.preventDefault():void 0}prepareData(e){var t,n,a,r;if(n=[],Array.isArray(e)){if("string"==typeof e[0])for(t in e)r=e[t],n.push({id:parseInt(t),title:r})}else for(t in e)r=e[t],n.push({id:parseInt(t),title:r});if(0===n.length&&(n=e),!0===this.props.statuses)for(t in n){if("string"==typeof(r=n[t]).title)switch(parseInt(r.type)){case OrderStatusType.NEW:a=React.createElement("div",{class:"status st-new"},React.createElement("div",{class:"st-round"}),React.createElement("div",{class:"st-txt ch-black"},r.title));break;case OrderStatusType.WORK:a=React.createElement("div",{class:"status st-work"},React.createElement("div",{class:"st-round"}),React.createElement("div",{class:"st-txt ch-black"},r.title));break;case OrderStatusType.WAIT:a=React.createElement("div",{class:"status st-need-pay"},React.createElement("div",{class:"st-round"}),React.createElement("div",{class:"st-txt ch-black"},r.title));break;case OrderStatusType.PART:a=React.createElement("div",{class:"status st-half-pay"},React.createElement("div",{class:"st-round"}),React.createElement("div",{class:"st-txt ch-black"},r.title));break;case OrderStatusType.FINISH:a=React.createElement("div",{class:"status st-end"},React.createElement("div",{class:"st-round"}),React.createElement("div",{class:"st-txt ch-black"},r.title));break;case OrderStatusType.CANCEL:a=React.createElement("div",{class:"status st-new"},React.createElement("div",{class:"st-round"}),React.createElement("div",{class:"st-txt ch-black"},r.title))}else a=r.title;n[t].title=a}return n}getValue(){return null!=this.state.selected?this.state.selected.id:0}close(){return this.setState({open:!1})}open(){return this.setState({open:!0},this.afterOpen)}afterOpen(){return $(this.roller).perfectScrollbar("update")}toggle(){return this.state.open?this.close():this.open()}componentDidMount(){return $(this.roller).perfectScrollbar(),document.addEventListener("click",this.handleOuterClick.bind(this))}componentWillUnmount(){return document.removeEventListener("click",this.handleOuterClick.bind(this))}handleOuterClick(e){if(0===this.$wrap.has(e.target).length)return this.close()}aOnSelect(){var e;return this.close(),"function"==typeof(e=this.props).onSelect?e.onSelect(this.state.selected):void 0}onSelect(e,t){return null!=e&&e.stopPropagation(),null!=e&&e.preventDefault(),this,this.setState({selected:t},this.aOnSelect.bind(this))}refWrap(e){return this.wrap=e,this.$wrap=$(this.wrap)}aAjaxSearch(e){var t;return t=this.prepareData(e),this.setState({data:t},this.afterOpen)}ajaxSearch(){return API(this.state.controller+"/getNameList",{q:this.input.value,dataType:"JSON"},this.aAjaxSearch.bind(this))}search(){return this.setState({search:this.inputSearch.value})}renderItem(e,t){var n,a=this;return n=!0,""!==this.state.search&&"string"==typeof e.title&&(n=e.title.toLowerCase().indexOf(this.state.search.toLowerCase())>-1),n?React.createElement("div",{onClick:function(t){return a.onSelect(t,e)},className:"option"},e.title):null}render(){var e,t,n,a,r,s,i,l=this;return this,t=!0===this.state.open,({selected:s,search:r,ajax:e,placeholder:n}=this.state),i=null,null!=s&&(i=s.title),React.createElement("div",{className:["select c-100",t?"open":""].join(" "),ref:this.refWrap.bind(this)},React.createElement("div",{className:"i_wrap",onClick:this.toggle},React.createElement("div",{className:null!=(a=this.props.titleClass)?a:"i"},i)),React.createElement("div",{className:"options_bg",onClick:this.close.bind(this)},React.createElement("div",{className:"options _roller",ref:function(e){return l.roller=e}},React.createElement("div",null,e?React.createElement("input",{onKeyUp:this.ajaxSearch.bind(this),ref:function(e){return l.input=e},onClick:this.preventClose,className:"i",placeholder:n+" - поиск"}):null,!0===this.props.search?React.createElement("input",{onKeyUp:this.search.bind(this),ref:function(e){return l.inputSearch=e},class:"i",placeholder:n+" - поиск",onClick:this.preventClose}):null,Array.isArray(this.state.data)?this.state.data.map(this.renderItem.bind(this)):null))))}};a=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"];var r;window.Calendar=class extends React.Component{constructor(e){var t,n,a,r,s;if(super(e),t=new Date,a=new Date(t.getFullYear(),t.getMonth(),t.getDate()),s=null,null!=this.props.value)switch(typeof(r=e.value)){case"string":n=r.split("-"),s=new Date(n[0],n[1]-1,n[2]);break;case"number":s=new Date(1e3*parseInt(r))}this.state={year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),today:a,value:s,opened:!1},this.days=0,this.onCancel=this.onCancel.bind(this),this.onSubmit=this.onSubmit.bind(this),this.open=this.open.bind(this),this.close=this.close.bind(this)}onCancel(){var e;return this.close(),"function"==typeof(e=this.props).onCancel?e.onCancel():void 0}onSubmit(){var e;return this.close(),"function"==typeof(e=this.props).onSubmit?e.onSubmit(this.state.value):void 0}open(){return this.setState({opened:!0})}close(){return this.setState({opened:!1})}prevMonth(){var e,t;return({month:e,year:t}=this.state),--e<0&&(e=11,t--),this.setState({month:e,year:t})}nextMonth(){var e,t;return({month:e,year:t}=this.state),++e>11&&(e=0,t++),this.setState({month:e,year:t})}getNextMonth(e){return++e>11&&(e=0),e}getPrevMonth(e){return++e<0&&(e=11),e}daysInMonth(e,t){return 33-new Date(e,t,33).getDate()}renderPrevNext(e){return React.createElement("div",{class:"td na"},e)}selectDay(e,t,n){return this.setState({value:new Date(e,t,n)},this.onSubmit)}renderDate(e){var t,n,a,r,s,i,l,o;return({year:o,month:r,date:t,value:i}=this.state),s=new Date(o,r,e).getTime(),l=null,null!=i&&(l=new Date(i.getFullYear(),i.getMonth(),i.getDate())),a=s===this.state.today.getTime(),n=s===(null!=l?l.getTime():void 0),React.createElement("div",{onClick:this.selectDay.bind(this,o,r,e),class:["td",a?"cal-today":"",n?"selected round":""].join(" ")},e)}renderWeek(e){var t,n,a,r,s;for(n=[],t=a=r=e,s=e+6;r<=s?a<=s:a>=s;t=r<=s?++a:--a)t>this.days?(t-=this.days,n.push(this.renderPrevNext(t))):n.push(this.renderDate(t));return React.createElement("div",{class:"tr"},n)}render(){var e,t,n,r,s,i,l,o,c,u,d,h;for(u=this,({month:s,year:h,opened:i}=this.state),this.getNextMonth(s),this.getNextMonth(s),l=this.daysInMonth(h,s-1),t=this.daysInMonth(h,s),e=new Date(h,s,1).getDay()-1,this.days=t,e<0&&(e=6),d=[],n=r=7-e+1,o=t;r<=o;n=r+=7)d.push(n);return React.createElement("div",{className:"f fcenter datepicker_wrap "+(i?"open":"")},React.createElement("div",{className:"datepicker_bg",onClick:this.onCancel}),React.createElement("div",{className:"datepicker_content"},React.createElement("div",{className:"datepicker_title"},React.createElement("div",{className:"icon prev pointer",onClick:this.prevMonth.bind(this)}),React.createElement("div",{class:"ch-blue"},a[s]+" "+this.state.year),React.createElement("div",{className:"icon next pointer",onClick:this.nextMonth.bind(this)})),React.createElement("div",{class:"datepicker"},React.createElement("div",{class:"tr"},React.createElement("div",{class:"th"},"пн"),React.createElement("div",{class:"th"},"вт"),React.createElement("div",{class:"th"},"ср"),React.createElement("div",{class:"th"},"чт"),React.createElement("div",{class:"th"},"пт"),React.createElement("div",{class:"th"},"сб"),React.createElement("div",{class:"th"},"вс")),React.createElement("div",{class:"tr"},e>0?function(){for(var t=[],n=c=l-(e-1);c<=l?n<=l:n>=l;c<=l?n++:n--)t.push(n);return t}.apply(this).map(u.renderPrevNext.bind(u)):null,function(){for(var t=[],n=1,a=7-e;1<=a?n<=a:n>=a;1<=a?n++:n--)t.push(n);return t}.apply(this).map(u.renderDate.bind(u))),d.map(u.renderWeek.bind(u)))))}},window.Datepicker=class extends React.Component{constructor(e){var t,n,a,r,s;super(e),s=null,console.log("datepicker_typeof",typeof e.value,e.value),null!=(r=e.value)&&""!==r&&"0000-00-00"!==r&&"0"!==r&&0!==r&&(s=3===(a=r.toString().split("-")).length?new Date(a[0],a[1]-1,a[2]):new Date(1e3*parseInt(r))),this.state={name:null!=(t=e.name)?t:"",value:s,placeholder:null!=(n=e.placeholder)?n:"",timepicker:!0===e.timepicker},this.input=null,this.calendar=null,this.onCancel=this.onCancel.bind(this),this.onSubmit=this.onSubmit.bind(this),this.openCalendar=this.openCalendar.bind(this)}openCalendar(){return this.calendar.open()}getValue(){var e,t,n,a,r;return r="",null!=(t="undefined"!=typeof value&&null!==value?value:this.state.value)&&""!==t?(n=(e=t.getDate())<10?"0"+e:e,a=(e=t.getMonth()+1)<10?"0"+e:e,r=[t.getFullYear(),a,n].join("-"),this.state.timepicker&&(r=t.getTime()/1e3)):(r="0000-00-00",this.state.timepicker&&(r=0)),r}onCancel(){return this.calendar.close()}onSubmit(e){return this.setState({value:e}),null!=e&&(this.input.value=this.formatValue(e)),this.calendar.close()}formatValue(e){var t,n,a;return n=null!=e&&void 0!==e?e:this.state.value,console.log("formatValue",e,this.state.value),a="",null!=n&&""!==n&&(a=[(t=n.getDate())<10?"0"+t:t,(t=n.getMonth()+1)<10?"0"+t:t,n.getFullYear()].join("."),this.state.timepicker&&(a+=" "+((t=n.getHours())<10?"0"+t:t)+":"+((t=n.getHours())<10?"0"+t:t))),a}render(){var e,t,n,a,r=this;return({name:e,placeholder:t,timepicker:n}=this.state),a=this.formatValue(),React.createElement("div",null,React.createElement("input",{ref:function(e){return r.input=e},type:"text",name:e,value:a,placeholder:t,className:"i",autoComplete:"off",onClick:this.openCalendar}),React.createElement(Calendar,{onCancel:this.onCancel,onSubmit:this.onSubmit,value:this.getValue(),timepicker:n,ref:function(e){return r.calendar=e}}))}},window.Contact=class extends React.Component{constructor(e){var t,n,a,r,s,i,l,o,c,u,d;if(super(e),t=null!=(s=e.data)?s:{},d=Contacts.TYPES[0],null!=t.type)for(u=parseInt(t.type),a=0,r=(i=Contacts.TYPES).length;a<r;a++)(n=i[a]).id===u&&(d=n);this.state={type:d,removed:!1},this.select=React.createElement(Select,{data:Contacts.TYPES,id:1,titleClass:"code code-arrow",onSelect:this.setType.bind(this)}),this.remove=this.remove.bind(this),this.getValue=this.getValue.bind(this),this.value=null,this.comment=null,this.valueValue=null!=(l=t.value)?l:"",this.commentValue=null!=(o=t.comment)?o:"",this.id=null!=(c=t.id)?c:""}remove(){return this.setState({removed:!0})}setType(e){return this.setState({type:e})}getValue(){return{id:this.id,value:this.value.value,comment:this.comment.value,type:this.state.type.id}}render(){var e,t=this;return this.state.removed?null:(e=this.state.type,React.createElement("div",{className:"label l-big",key:(new Date).getTime()},React.createElement("div",{className:"row r6"},React.createElement("div",{className:"c c-10 pt-9"},React.createElement("div",{className:"hind h-left"},React.createElement("div",{className:"h-title"},React.createElement(Select,{data:Contacts.TYPES,id:this.state.type.id,titleClass:"code code-arrow",onSelect:this.setType.bind(this)})),React.createElement("div",{className:"h-body"},"Поменять тип контакта"))),React.createElement("div",{className:"c c-90"},React.createElement("div",{className:"label l-min"},React.createElement("div",{className:"row r6 flex f-middle"},React.createElement("div",{className:"c c-91"},React.createElement("input",{type:"text",placeholder:e.placeholder,className:"text c-100",ref:function(e){return t.value=e},defaultValue:this.valueValue,onKeyUp:function(e){return t.valueValue=e.target.value}})),React.createElement("div",{className:"c c-9"},React.createElement("div",{className:"hind h-left",onClick:this.remove},React.createElement("div",{className:"h-title"},React.createElement("div",{className:"icon ic-del-gray pointer db"})),React.createElement("div",{className:"h-body h-auto"},"Удалить"))))),React.createElement("div",{className:"label l-min"},React.createElement("input",{type:"text",placeholder:"Комментарий",className:"text c-100",ref:function(e){return t.comment=e},defaultValue:this.commentValue,onKeyUp:function(e){return t.commentValue=e.target.value}}))))))}},window.Contacts=function(){class e extends React.Component{constructor(e){var t;super(e),t=[],Array.isArray(e.value)&&(t=e.value),this.state={contacts:t},this.addContact=this.addContact.bind(this),this.addButton=React.createElement("div",{class:"label l-big",onClick:this.addContact},React.createElement("button",{class:"btn-icon btn-i-blue"},React.createElement("span",null,"Добавить еще метод связи"))),this.contacts={}}getValue(){var e,t,n;for(e in t=[],this.contacts)null==(n=this.contacts[e])||n.state.removed||t.push(n.getValue());return t}renderContact(e,t){var n=this;return React.createElement(Contact,{data:e,ref:function(e){return n.contacts[t]=e}})}addContact(){var e;return(e=this.state.contacts).push({}),this.setState({contacts:e})}render(){var e;return this,(e=this.state.contacts.map(this.renderContact.bind(this))).push(this.addButton),e}}return e.TYPES=[{id:1,title:React.createElement("div",{className:"icon ic-small ic-leftbar phone"}),placeholder:"Телефон"},{id:4,title:React.createElement("div",{className:"icon ic-mail"}),placeholder:"Email"}],e}.call(void 0),window.SwitchIOS=class extends React.Component{constructor(e){var t,n;super(e),this.state={checked:null!=(t=e.checked)&&t,label:null!=(n=e.label)?n:""},this.toggle=this.toggle.bind(this)}getValue(){return this.state.checked?1:0}aToggle(){var e;return"function"==typeof(e=this.props).onChange?e.onChange(this.state.checked):void 0}toggle(){return this.setState({checked:!this.state.checked},this.aToggle)}setValueSilence(e){return this.setState({checked:e})}componentWillReceiveProps(e){}render(){var e;return({checked:e}=this.state),React.createElement("div",{class:" f fvcenter",onClick:this.toggle},React.createElement("div",{class:["switch mr-10",e?"selected":""].join(" ")}),React.createElement("span",{class:""},this.state.label))}},window.Dropper=class extends React.Component{constructor(e){var t,n;switch(super(e),this.state={files:[],uploads:[]},this.buttonTitle=null!=(t=e.buttonTitle)?t:"Загрузить",this.file=null,this.type=null!=(n=e.type)?n:"image",this.sendFiles=this.sendFiles.bind(this),this.sendFile=this.sendFile.bind(this),this.changeFiles=this.changeFiles.bind(this),this.url="",this.type){case"image":this.url="/api/common.image/upload/";break;case"dsek_file":this.url="/api/themes.dsek.file/upload/";break;case"kptracking_file":this.url="/api/themes.kptracking.file/upload/"}}changeFiles(){return this.sendFiles()}clickChooseFile(){return console.log("click clack",this.file),$(this.file).click()}sendFiles(){var e,t,n,a,r,s,i,l,o;for(t in o=[],n=this.file.files)void 0!==(e=n[t])&&void 0!==e.type&&((null!=e&&null!=(a=e.type)?a.match(/image.*/):void 0)||(null!=e&&null!=(r=e.type)?r.match(/audio.*/):void 0)||(null!=e&&null!=(s=e.type)?s.match(/text.*/):void 0)||(null!=e&&null!=(i=e.type)?i.match(/application.*/):void 0)||(null!=e&&null!=(l=e.type)?l.match(/video.*/):void 0))?o.push(this.sendFile(e)):o.push(void 0);return o}sendFile(e){var t;return({uploads:t}=this.state),t.push(React.createElement(r,{file:e,url:this.url,callback:this.props.callback,data:this.props.data})),this.setState({uploads:t})}render(){var e,t=this;return e=this.state.uploads,React.createElement("div",null,React.createElement("div",{className:"uploads"},e),React.createElement("input",{type:"file",ref:function(e){return t.file=e},onChange:this.changeFiles,className:"dn"}),React.createElement("button",{type:"button",className:"btn blue small ml-0",onClick:this.clickChooseFile.bind(this)},this.buttonTitle))}};r=class extends React.Component{constructor(e){var t,n;super(e),this.file=e.file,this.reader=null,this.url=e.url,this.data=null!=(t=e.data)?t:[],this.callback=null!=(n=e.callback)?n:null,this.state={percent:0,uploaded:!1},this.createRequestObject=this.createRequestObject.bind(this),this.onLoadEnd=this.onLoadEnd.bind(this),this.onProgress=this.onProgress.bind(this),this.onReadyStateChange=this.onReadyStateChange.bind(this)}createRequestObject(){if("undefined"==typeof XMLHttpRequest){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}throw new Error("This browser does not support XMLHttpRequest.")}return new XMLHttpRequest}onLoadEnd(e){var t,n,a,r,s;for(n in r=this.file,a=this.data,console.log("upload_to",this.url,a),(s=this.createRequestObject()).upload.addEventListener("progress",this.onProgress,!1),s.onreadystatechange=this.onReadyStateChange,s.open("POST",this.url),"xxxxxxxxx",s.setRequestHeader("Content-Type","multipart/form-data; boundary=xxxxxxxxx"),s.setRequestHeader("Cache-Control","no-cache"),t="--xxxxxxxxx\r\n",t+="Content-Disposition: form-data; name='myFile'; filename='"+r.name+"'\r\n",t+="Content-Type: "+r.type+"\r\n\r\n",t+=this.reader.result+"\r\n",t+="--xxxxxxxxx\r\n",a)t+='Content-Disposition: form-data; name="'+n+'"\r\n\r\n',t+=a[n]+"\r\n",t+="--xxxxxxxxx\r\n";return s.sendAsBinary?s.sendAsBinary(t):s.send(t)}onReadyStateChange(e){var t,n;if(4===(n=e.target).readyState&&200===n.status&&null!=this.callback){t=n.responseText;try{t=JSON.parse(t)}catch(e){t=n.responseText}return this.callback(t),this.setState({uploaded:!0})}}onProgress(e){var t;return t=0,e.lengthComputable&&(t=100*e.loaded/e.total),this.setState({percent:t})}componentDidMount(){return this.sendFile()}sendFile(){return this.reader=new FileReader,this.reader.onloadend=this.onLoadEnd,this.reader.readAsDataURL(this.file)}render(){var e,t;return({percent:e,uploaded:t}=this.state),t?null:React.createElement("div",null,e,"%")}};var s;window.ImagePicker=class extends React.Component{constructor(e){var t,n;super(e),this.state={value:null!=(t=e.value)?t:0,src:null!=(n=e.src)?n:""},this.onUpload=this.onUpload.bind(this),this.getValue=this.getValue.bind(this)}getValue(){return this.state.value}onUpload(e){return console.log("onUpload",e),this.setState({value:e.id,src:e.link})}render(){var e;return({src:e}=this.state),React.createElement("div",{class:"image_picker"},""!==e?React.createElement("img",{src:e}):null,React.createElement(Dropper,{buttonTitle:"Выбрать изображение",callback:this.onUpload,type:"image"}))}};s=function(){class e{}return e.TEXT=1,e.NUMBER=2,e.VALUES_ONE=3,e.VALUES_MANY=4,e}.call(void 0);var i,l,o;window.PropValues=class extends React.Component{constructor(e){var t,n,a,r;super(e),r=null,(t=null!=(n=e.data)?n:[]).length>0&&(r=t[0]),this.state={data:t,value:null!=(a=e.value)?a:{},selected:r},this.onSelect=this.onSelect.bind(this),this.enterTextValue=this.enterTextValue.bind(this),this.onChangeMany=this.onChangeMany.bind(this),this.onChangeOne=this.onChangeOne.bind(this),this.input=null,this.properties={}}getValue(){return this.state.value}onSelect(e){return this.setState({selected:e})}onChangeMany(e,t,n){var a,r;if(({value:r}=this.state),void 0===r[e]&&(r[e]=[]),console.log(e,t,n),n)r[e].push({value:t.id,title:t.title});else for(a in r[e])if(r[e][a].value===t.id){r[e].splice(a,1);break}return this.setState({value:r})}onChangeOne(e,t,n){var a,r;if(({value:r}=this.state),void 0===r[e]&&(r[e]=[]),n)for(a in r[e]=[{value:t.id,title:t.title}],this.properties[e])this.properties[e][a].setValueSilence(a===t.id);else for(a in r[e]=[],this.properties[e])this.properties[e][a].setValueSilence(!1);return this.setState({value:r})}enterTextValue(){var e,t,n;return({selected:e,value:n}=this.state),t=this.input.value,n[parseInt(e.id)]=""===t?[]:[{title:t,value:t}],this.setState({value:n})}render(){var e,t,n,a,r,i,l,o,c,u,d,h,p,m,f,v,E,R,b,g,y,_,C,S,N,w,k,T,O,x,A,I=this;for(({data:t,value:O,selected:N}=this.state),w=this,x=[],r=0,o=t.length;r<o;r++)if(O[(E=t[r]).id]){for(T=[],i=0,c=(R=O[E.id]).length;i<c;i++)k=R[i],T.push(React.createElement("div",{className:"sub_color"},k.title));T.length>0&&x.push(React.createElement("div",null,React.createElement("div",{className:"h2 "+(x.length>0?"mt-20":"")},E.title),T))}if(A=[],null!==N)switch(parseInt(N.type)){case s.TEXT:case s.NUMBER:n="",void 0!==O[N.id]&&(n=null!=(b=null!=(g=O[N.id][0])?g.title:void 0)?b:""),A.push(React.createElement("div",{class:"input_wrap",key:"prop"+N.id},React.createElement("div",{class:"label"},"Значение"),React.createElement("input",{placeholder:"Введите значение",defaultValue:n,className:"i",onKeyUp:this.enterTextValue,ref:function(e){return I.input=e}})));break;case s.TEXT:case s.VALUES_MANY:if(e={},void 0!==O[N.id])for(l=0,u=(y=O[N.id]).length;l<u;l++)a=y[l],e[a.value]=!0;for(this.properties[N.id]={},A.push(React.createElement("div",{class:"label",key:"prop"+N.id},"Можно выбрать несколько значений")),m=0,d=(_=N.values).length;m<d;m++)a=_[m],A.push(React.createElement("div",{key:"prop"+N.id+"value"+a.id,className:A.length>0?"mt-20":""},React.createElement(SwitchIOS,{label:a.title,checked:!0===e[a.id],onChange:this.onChangeMany.bind(null,N.id,a)})));break;case s.TEXT:case s.VALUES_ONE:if(e={},void 0!==O[N.id])for(f=0,h=(C=O[N.id]).length;f<h;f++)a=C[f],e[a.value]=!0;for(this.properties[N.id]={},A.push(React.createElement("div",{class:"label",key:"prop"+N.id},"Можно выбрать только одно значение")),v=0,p=(S=N.values).length;v<p;v++)!function(t,n){A.push(React.createElement("div",{key:"prop"+n.id+"value"+t.id,className:A.length>0?"mt-20":""},React.createElement(SwitchIOS,{label:t.title,checked:!0===e[t.id],ref:function(e){return w.properties[n.id][t.id]=e},onChange:w.onChangeOne.bind(null,n.id,t)})))}(a=S[v],N)}return React.createElement("div",{className:"mt-20"},React.createElement("div",{className:"row2"},React.createElement("div",{className:"c c-50"},React.createElement("div",{className:"h1"},"Выберите параметр"),React.createElement(Select,{data:t,onSelect:this.onSelect,search:!0}),React.createElement("div",{className:"mt-20"},A)),React.createElement("div",{className:"c c-50"},React.createElement("div",{className:"h1"},"Выбранные значения"),x)))}};l=function(){class e{}return e.TEXT=1,e.NUMBER=2,e.VALUES_ONE=3,e.VALUES_MANY=4,e}.call(void 0),o=function(){class e{}return e.PRICE=1,e.COMPONENT=2,e.COMPONENT_LIST=3,e.GROWTH=4,e}.call(void 0);window.ShopItemPropValues=class extends React.Component{constructor(e){var t,n,a,r,s;super(e),s=null,(t=null!=(n=e.data)?n:[]).length>0&&(s=t[0]),null==e.value&&(e.value={}),this.state={data:t,value:null!=(a=e.value.vals)?a:{},price_type:null!=(r=e.value.price_type)?r:1,selected:s},this.onSelect=this.onSelect.bind(this),this.enterTextValue=this.enterTextValue.bind(this),this.onChangeMany=this.onChangeMany.bind(this),this.onChangeManyDefault=this.onChangeManyDefault.bind(this),this.onChangeOne=this.onChangeOne.bind(this),this.input=null,this.properties={},this.defaults={},this.prices={}}getValue(){var e,t,n,a;for(t in({value:a}=this.state),a)for(e in a[t])n=a[t][e],a[t][e].is_default=a[t][e].is_default?1:0,void 0!==this.prices[t]&&void 0!==this.prices[t][n.value]&&null!=this.prices[t][n.value]&&(a[t][e].price=this.prices[t][n.value].getValue());return a}onSelect(e){return this.setState({selected:e})}onChangeManyDefault(e,t,n){var a,r,s;for(a in({value:s}=this.state),s[e])r=s[e][a],s[e][a].is_default=!1,r.value===t.id&&(s[e][a].is_default=n);for(a in this.defaults[e])null!=this.defaults[e][a]&&void 0!==this.defaults[e][a]&&(this.defaults[e][a].setValueSilence(!1),a===t.id&&this.defaults[e][a].setValueSilence(n));return this.setState({value:s})}onChangeMany(e,t,n){var a,r;if(({value:r}=this.state),void 0===r[e]&&(r[e]=[]),n)r[e].push({value:t.id,title:t.title});else for(a in r[e])if(r[e][a].value===t.id){r[e].splice(a,1);break}return this.setState({value:r})}onChangeOne(e,t,n){var a,r;if(({value:r}=this.state),void 0===r[e]&&(r[e]=[]),n)for(a in r[e]=[{value:t.id,title:t.title}],this.properties[e])this.properties[e][a].setValueSilence(a===t.id);else for(a in r[e]=[],this.properties[e])this.properties[e][a].setValueSilence(!1);return this.setState({value:r})}enterTextValue(){var e,t,n;return({selected:e,value:n}=this.state),t=this.input.value,n[parseInt(e.id)]=""===t?[]:[{title:t,value:t}],this.setState({value:n})}render(){var e,t,n,a,r,s,o,c,u,d,h,p,m,f,v,E,R,b,g,y,_,C,S,N,w,k,T,O,x,A,I,L,D,M,P=this;for(({data:t,value:L,selected:O}=this.state),x=this,D=[],o=0,h=t.length;o<h;o++)if(L[(y=t[o]).id]){for(I=[],c=0,p=(_=L[y.id]).length;c<p;c++)A=_[c],I.push(React.createElement("div",{className:"sub_color"},A.title));I.length>0&&D.push(React.createElement("div",null,React.createElement("div",{className:"h2 "+(D.length>0?"mt-20":"")},y.title),I))}if(M=[],null!==O)switch(parseInt(O.type)){case l.TEXT:case l.NUMBER:n="",void 0!==L[O.id]&&(n=null!=(C=null!=(S=L[O.id][0])?S.title:void 0)?C:""),M.push(React.createElement("div",{class:"input_wrap",key:"prop"+O.id},React.createElement("div",{class:"label"},"Значение"),React.createElement("input",{placeholder:"Введите значение",defaultValue:n,className:"i",onKeyUp:this.enterTextValue,ref:function(e){return P.input=e}})));break;case l.TEXT:case l.VALUES_MANY:if(e={},void 0!==L[O.id])for(d=0,m=(N=L[O.id]).length;d<m;d++)a=N[d],e[a.value]=!0;for(this.properties[O.id]={},this.defaults[O.id]={},M.push(React.createElement("div",{class:"label",key:"prop"+O.id},"Можно выбрать несколько значений")),R=0,f=(w=O.values).length;R<f;R++)a=w[R],r=!0===e[a.id],s=O.is_price&&r,u="prop"+O.id+"value"+a.id,void 0===x.prices[O.id]&&(x.prices[O.id]={}),M.push(React.createElement("div",{key:u,className:M.length>0?"mt-20":""},React.createElement("div",{class:s?"row2":""},React.createElement("div",{class:s?"c c-50":""},React.createElement(SwitchIOS,{label:a.title,checked:r,onChange:this.onChangeMany.bind(null,O.id,a)})),s?React.createElement("div",{className:"c c-50"},function(e,t){var n,a;if(n=!1,void 0!==x.state.value[e.id])for(a in x.state.value[e.id])if((A=x.state.value[e.id][a]).value===t.id){n=A.is_default,console.log("is_def",A);break}return React.createElement(SwitchIOS,{label:"По умолчанию",ref:function(n){return x.defaults[e.id][t.id]=n},checked:n,onChange:x.onChangeManyDefault.bind(null,e.id,t)})}(O,a)):null),O.is_price?function(e,t,n,a){var r,s;if(r={},void 0!==x.state.value[n.id])for(s in x.state.value[n.id])if((A=x.state.value[n.id][s]).value===a.id){r=A.price;break}return React.createElement(i,{visible:e,type:t,price:r,ref:function(e){return x.prices[n.id][a.id]=e}})}(r,this.state.price_type,O,a):null));break;case l.TEXT:case l.VALUES_ONE:if(e={},void 0!==L[O.id])for(b=0,v=(k=L[O.id]).length;b<v;b++)a=k[b],e[a.value]=!0;for(this.properties[O.id]={},M.push(React.createElement("div",{class:"label",key:"prop"+O.id},"Можно выбрать только одно значение")),g=0,E=(T=O.values).length;g<E;g++)!function(t,n){M.push(React.createElement("div",{key:"prop"+n.id+"value"+t.id,className:M.length>0?"mt-20":""},React.createElement(SwitchIOS,{label:t.title,checked:!0===e[t.id],ref:function(e){return x.properties[n.id][t.id]=e},onChange:x.onChangeOne.bind(null,n.id,t)})))}(a=T[g],O)}return React.createElement("div",{className:"mt-20"},React.createElement("div",{className:"row2"},React.createElement("div",{className:"c c-50"},React.createElement("div",{className:"h1"},"Выберите параметр"),React.createElement(Select,{data:t,onSelect:this.onSelect,search:!0}),React.createElement("div",{className:"mt-20"},M)),React.createElement("div",{className:"c c-50"},React.createElement("div",{className:"h1"},"Выбранные значения"),D)))}};i=class extends React.Component{constructor(e){var t;super(e),t=void 0===e.price?{}:e.price,this.state={type:parseInt(e.type),visible:e.visible,price:null!=t?t:{}},this.types=[{id:1,title:"Значение"},{id:2,title:"Процент"}]}componentWillReceiveProps(e){return this.setState({visible:e.visible})}getValue(){var e,t;return{item_price:null!=this.item_price&&void 0!==this.item_price?this.item_price.value:0,item_type:null!=this.item_type&&void 0!==this.item_type?"function"==typeof(e=this.item_type).getValue?e.getValue():void 0:0,component_price:null!=this.component_price&&void 0!==this.component_price?this.component_price.value:0,component_type:null!=this.component_type&&void 0!==this.component_type?"function"==typeof(t=this.component_type).getValue?t.getValue():void 0:0}}render(){var e,t,n,a,r,s,i,l,c,u,d,h,p,m=this;return({type:h,visible:p,price:i}=this.state),p?(r=null!=(l=i.item_price)?l:0,s=null!=(c=i.item_type)?c:1,e=null!=(u=i.component_price)?u:0,t=null!=(d=i.component_type)?d:1,a=h===o.PRICE||h===o.COMPONENT||h===o.COMPONENT_LIST,n=h===o.COMPONENT,React.createElement("div",null,a?React.createElement("div",{className:"row2 mt-10"},React.createElement("div",{className:"c c-60"},React.createElement("div",{className:"input_wrap"},React.createElement("div",{className:"label"},"Цена на товар"),React.createElement("input",{type:"text",placeholder:"100",className:"i c-100",autoComplete:"off",defaultValue:r,ref:function(e){return m.item_price=e}}))),React.createElement("div",{className:"c c-40"},React.createElement("div",{className:"input_wrap"},React.createElement("div",{className:"label"},"Тип"),React.createElement(Select,{data:this.types,id:s,ref:function(e){return m.item_type=e}})))):null,n?React.createElement("div",{className:"row2 mt-10"},React.createElement("div",{className:"c c-60"},React.createElement("div",{className:"input_wrap"},React.createElement("div",{className:"label"},"Цена на компонент"),React.createElement("input",{type:"text",placeholder:"100",className:"i c-100",autoComplete:"off",defaultValue:e,ref:function(e){return m.component_price=e}}))),React.createElement("div",{className:"c c-40"},React.createElement("div",{className:"input_wrap"},React.createElement("div",{className:"label"},"Тип"),React.createElement(Select,{data:this.types,id:t,ref:function(e){return m.component_type=e}})))):null)):null}};window.CategoryChoose=class extends React.Component{constructor(e){var t,n;super(e),this.state={value:null!=(t=e.value)?t:[],data:null!=(n=e.data)?n:{}},this.renderCat=this.renderCat.bind(this),this.toggleValue=this.toggleValue.bind(this),this.selectAll=this.selectAll.bind(this),this.deselectAll=this.deselectAll.bind(this)}selectAll(){return this.setState({value:Object.keys(this.state.data.a)})}deselectAll(){return this.setState({value:[]})}getValue(){return this.state.value}toggleValue(e,t){var n,a;return({value:a}=this.state),(n=a.indexOf(e))>=0||(n=a.indexOf(parseInt(e)))>=0?a.splice(n,1):a.push(e),this.setState({value:a})}renderCat(e){var t,n,a,r,s;return({data:r,value:s}=this.state),t=r.a[e],n=[],Array.isArray(r.a[e].cats)&&(n=r.a[e].cats.map(this.renderCat)),a=s.indexOf(e)>=0||s.indexOf(parseInt(e))>=0,React.createElement("div",null,React.createElement("div",{className:"choose_category mt-5"+(a?" selected":""),onClick:this.toggleValue.bind(this,e)},t.title),n.length>0?React.createElement("div",{className:"mt-5 ml-5 sub"},n):null)}render(){var e,t,n;return({data:t,value:n}=this.state),console.log(t,n),e=[],Array.isArray(t.main)&&(e=t.main.map(this.renderCat)),React.createElement("div",null,React.createElement("div",{class:"ml-5"},React.createElement(MiniHelp,{title:"Кликайте по элементам, чтобы выбрать, или снять выделение."})),React.createElement("div",{className:"f mt-20 ml-5"},React.createElement("div",null,"Выбрано: ",n.length),React.createElement("div",{class:"link ml-10 mr-10",onClick:this.selectAll},"Выбрать все"),React.createElement("div",{class:"clear ml-20 mt-3",onClick:this.deselectAll},"Снять выбор со всех")),React.createElement("div",{class:"mt-20 choose_categories"},e))}};var c,u,d,h=n(2),p=n(0),m=function(){return(m=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},f={onActivate:p.func,onAddUndo:p.func,onBeforeAddUndo:p.func,onBeforeExecCommand:p.func,onBeforeGetContent:p.func,onBeforeRenderUI:p.func,onBeforeSetContent:p.func,onBeforePaste:p.func,onBlur:p.func,onChange:p.func,onClearUndos:p.func,onClick:p.func,onContextMenu:p.func,onCopy:p.func,onCut:p.func,onDblclick:p.func,onDeactivate:p.func,onDirty:p.func,onDrag:p.func,onDragDrop:p.func,onDragEnd:p.func,onDragGesture:p.func,onDragOver:p.func,onDrop:p.func,onExecCommand:p.func,onFocus:p.func,onFocusIn:p.func,onFocusOut:p.func,onGetContent:p.func,onHide:p.func,onInit:p.func,onKeyDown:p.func,onKeyPress:p.func,onKeyUp:p.func,onLoadContent:p.func,onMouseDown:p.func,onMouseEnter:p.func,onMouseLeave:p.func,onMouseMove:p.func,onMouseOut:p.func,onMouseOver:p.func,onMouseUp:p.func,onNodeChange:p.func,onObjectResizeStart:p.func,onObjectResized:p.func,onObjectSelected:p.func,onPaste:p.func,onPostProcess:p.func,onPostRender:p.func,onPreProcess:p.func,onProgressState:p.func,onRedo:p.func,onRemove:p.func,onReset:p.func,onSaveContent:p.func,onSelectionChange:p.func,onSetAttrib:p.func,onSetContent:p.func,onShow:p.func,onSubmit:p.func,onUndo:p.func,onVisualAid:p.func},v=m({apiKey:p.string,id:p.string,inline:p.bool,init:p.object,initialValue:p.string,onEditorChange:p.func,outputFormat:p.oneOf(["html","text"]),value:p.string,tagName:p.string,cloudChannel:p.string,plugins:p.oneOfType([p.string,p.array]),toolbar:p.oneOfType([p.string,p.array]),disabled:p.bool,textareaName:p.string,tinymceScriptSrc:p.string,scriptLoading:p.shape({async:p.bool,defer:p.bool,delay:p.number})},f),E=function(e){return"function"==typeof e},R=function(e){return e in f},b=function(e){return e.substr(2)},g=function(e,t,n,a,r){return function(e,t,n,a,r,s,i){var l=Object.keys(r).filter(R),o=Object.keys(s).filter(R),c=l.filter((function(e){return void 0===s[e]})),u=o.filter((function(e){return void 0===r[e]}));c.forEach((function(e){var t=b(e),a=i[t];n(t,a),delete i[t]})),u.forEach((function(n){var r=a(e,n),s=b(n);i[s]=r,t(s,r)}))}(r,e.on.bind(e),e.off.bind(e),(function(t,n){return function(a){var r;return null===(r=t(n))||void 0===r?void 0:r(a,e)}}),t,n,a)},y=0,_=function(e){var t=Date.now();return e+"_"+Math.floor(1e9*Math.random())+ ++y+String(t)},C=function(e){return null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase())},S=function(e){return void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" ")},N=function(){return{listeners:[],scriptId:_("tiny-script"),scriptLoading:!1,scriptLoaded:!1}},w=(c=N(),{load:function(e,t,n,a,r,s){var i=function(){return function(e,t,n,a,r,s){var i=t.createElement("script");i.referrerPolicy="origin",i.type="application/javascript",i.id=e,i.src=n,i.async=a,i.defer=r;var l=function(){i.removeEventListener("load",l),s()};i.addEventListener("load",l),t.head&&t.head.appendChild(i)}(c.scriptId,e,t,n,a,(function(){c.listeners.forEach((function(e){return e()})),c.scriptLoaded=!0}))};c.scriptLoaded?s():(c.listeners.push(s),c.scriptLoading||(c.scriptLoading=!0,r>0?setTimeout(i,r):i()))},reinitialize:function(){c=N()}}),k=n(3),T=(u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),O=function(){return(O=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},x=function(e){function t(t){var n,a,r,s=e.call(this,t)||this;return s.handleEditorChange=function(e){var t=s.editor;if(t&&t.initialized){var n=t.getContent();if(n!==s.currentContent&&(s.currentContent=n,E(s.props.onEditorChange))){var a=s.props.outputFormat,r="html"===a?n:t.getContent({format:a});s.props.onEditorChange(r,t)}}},s.initialise=function(){var e=s.elementRef.current;if(e){var t=Object(k.a)();if(!t)throw new Error("tinymce should have been loaded into global scope");var n,a,r=O(O({},s.props.init),{selector:void 0,target:e,readonly:s.props.disabled,inline:s.inline,plugins:(n=s.props.init&&s.props.init.plugins,a=s.props.plugins,S(n).concat(S(a))),toolbar:s.props.toolbar||s.props.init&&s.props.init.toolbar,setup:function(t){s.editor=t,s.bindHandlers({}),s.inline&&!C(e)&&t.once("PostRender",(function(e){t.setContent(s.getInitialValue(),{no_events:!0})})),s.props.init&&E(s.props.init.setup)&&s.props.init.setup(t)},init_instance_callback:function(e){var t,n,a=s.getInitialValue();s.currentContent=null!==(t=s.currentContent)&&void 0!==t?t:e.getContent(),s.currentContent!==a&&(s.currentContent=a,e.setContent(a),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));var r=null!==(n=s.props.disabled)&&void 0!==n&&n;e.setMode(r?"readonly":"design"),s.props.init&&E(s.props.init.init_instance_callback)&&s.props.init.init_instance_callback(e)}});s.inline||(e.style.visibility=""),C(e)&&(e.value=s.getInitialValue()),t.init(r)}},s.id=s.props.id||_("tiny-react"),s.elementRef=h.createRef(),s.inline=null!==(r=null!==(n=s.props.inline)&&void 0!==n?n:null===(a=s.props.init)||void 0===a?void 0:a.inline)&&void 0!==r&&r,s.boundHandlers={},s}return T(t,e),t.prototype.componentDidUpdate=function(e){var t,n,a=this;if(this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=null!==(t=this.currentContent)&&void 0!==t?t:this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){var r=this.editor;r.undoManager.transact((function(){var e=r.selection.getBookmark(3);r.setContent(a.props.value);try{r.selection.moveToBookmark(e)}catch(e){}}))}if(this.props.disabled!==e.disabled){var s=null!==(n=this.props.disabled)&&void 0!==n&&n;this.editor.setMode(s?"readonly":"design")}}},t.prototype.componentDidMount=function(){var e,t,n,a,r,s;null!==Object(k.a)()?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&w.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),null!==(t=null===(e=this.props.scriptLoading)||void 0===e?void 0:e.async)&&void 0!==t&&t,null!==(a=null===(n=this.props.scriptLoading)||void 0===n?void 0:n.defer)&&void 0!==a&&a,null!==(s=null===(r=this.props.scriptLoading)||void 0===r?void 0:r.delay)&&void 0!==s?s:0,this.initialise)},t.prototype.componentWillUnmount=function(){var e=this,t=this.editor;t&&(t.off("change keyup compositionend setcontent",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((function(n){t.off(n,e.boundHandlers[n])})),this.boundHandlers={},t.remove(),this.editor=void 0)},t.prototype.render=function(){return this.inline?this.renderInline():this.renderIframe()},t.prototype.renderInline=function(){var e=this.props.tagName,t=void 0===e?"div":e;return h.createElement(t,{ref:this.elementRef,id:this.id})},t.prototype.renderIframe=function(){return h.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})},t.prototype.getScriptSrc=function(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;var e=this.props.cloudChannel;return"https://cdn.tiny.cloud/1/"+(this.props.apiKey?this.props.apiKey:"no-api-key")+"/tinymce/"+e+"/tinymce.min.js"},t.prototype.getInitialValue=function(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""},t.prototype.bindHandlers=function(e){var t=this;if(void 0!==this.editor){g(this.editor,e,this.props,this.boundHandlers,(function(e){return t.props[e]}));var n=function(e){return void 0!==e.onEditorChange||void 0!==e.value},a=n(e),r=n(this.props);!a&&r?this.editor.on("change keyup compositionend setcontent",this.handleEditorChange):a&&!r&&this.editor.off("change keyup compositionend setcontent",this.handleEditorChange)}},t.propTypes=v,t.defaultProps={cloudChannel:"5"},t}(h.Component),A={apiKey:"60vsy7x42oflvd2aqbpvnaz1c3ega0bkep1xkjr7qbf53x18",config:{height:500,menubar:"",toolbar:"styleselect | bold italic underline link numlist bullist table image | alignleft aligncenter alignjustify alignright | code | outdent indent | forecolor backcolor | hr | insertdatetime | ltr rtl | emoticons | fullscreen",plugins:"code link lists code table image directionality emoticons fullscreen hr insertdatetime advlist autolink charmap print preview anchor",images_upload_url:"/api/common.image/uploadAccountTinyMCE/",images_reuse_filename:!0,images_upload_base_path:window.location.origin,relative_urls:!1,remove_script_host:!0,document_base_url:window.location.origin,valid_elements:"*[*]"},signConfig:{menubar:"",toolbar:"bold italic underline link",plugins:"link "}},I=(window.Textarea=class extends React.Component{constructor(e){var t;super(e),t=e,e.html=!1,this.state=t,console.log("props",e,t),this.getValue=this.getValue.bind(this)}setHtml(e){var t,n;return console.log(e,"x"),({html:t}=this.state),n=t?this.state.value:this.input.value,this.setState({html:e,value:n})}getValue(){var e,t;return({html:e}=this.state),t=e?this.state.value:this.input.value,console.log("getValue",this.state,t),t}render(){var e,t,n,a,r=this;return({value:a,placeholder:n,html:e,label:t}=this.state),React.createElement("div",{className:"c-100"},React.createElement("div",{className:"f label fvcenter"},React.createElement("div",null,t),React.createElement("div",{className:"dib ml-20"},React.createElement(SwitchIOS,{onChange:this.setHtml.bind(this),label:"HTML"}))),e?React.createElement(x,{apiKey:A.apiKey,init:A.config,value:a,onEditorChange:function(e){return r.setState({value:e})}}):React.createElement("textarea",{ref:function(e){return r.input=e},defaultValue:a,placeholder:n,className:"i c-100"}))}},n(1)),L=n.n(I);window.INPUT_TYPE=d=function(){class e{}return e.HIDDEN=1,e.TEXT=2,e.SELECT=3,e.DATE=4,e.SELECT_SEARCH=5,e.SUBMIT=6,e.SELECT_MULTI=7,e.DATE_RANGE_TIME=8,e.DATE_TIME=9,e.TEXTAREA=10,e.CHECKBOX=11,e.YANDEX_COUNTRY_CITY=12,e.SWITCH_IOS=13,e.COLOR_PICKER=14,e.AVATAR_PICKER=15,e.SELECT_AJAX=16,e.CANCEL=17,e.EMAIL=18,e.SCRIPT=19,e.HTML=20,e.IMAGE=21,e.RADIO=22,e.VIDEO=23,e.CONTACTS=24,e.SUBMIT_AND_CLOSE=25,e.SHOP_ITEM_VALUES=26,e.CATEGORY_CHOOSE=27,e.PASSWORD=28,e.DSEK_FILES=30,e.KPTRACKING_FILE=31,e.TIME=34,e}.call(void 0);t.a=window.Input=function(){class e extends React.Component{constructor(e){var t;super(e),this.state={data:null!=e.data?e.data:e.data={},value:null!=e.value?e.value:e.value=null,show:!0,name:null!=(t=e.name)?t:""},this.input=null,this.type=null,L()(this)}show(){return this.setState({show:!0})}hide(){return this.setState({show:!1})}onChange(e){var t,n;return({name:n}=this.state),"function"==typeof(t=this.props).onChange?t.onChange(n):void 0}onKeyUp(){var e,t;return({name:t}=this.state),"function"==typeof(e=this.props).onKeyUp?e.onKeyUp(t):void 0}getValue(){var e;return e=null,null!=this.input&&(e=null!=this.input.getValue?this.input.getValue():this.input.value),e}render(){var t,n,a,r,s,i,l,o,c,u,h,p,m,f,v,E,R,b,g,y,_,C,S,N,w,k,T,O,x,A,I,L,D,M,P,U=this;switch(i=!0,({show:I}=this.state),c=null!=(p=(s=null!=(h=this.state.data)?h:{})[Form.INPUT_OPT])?p:s,M=null!=(C=null!=(S=s[Form.TYPE])?S:c[e.TYPE])?C:s[e.TYPE],u=null!=(N=c[e.PLACEHOLDER])?N:"",o=null!=(w=null!=(k=c[e.NAME])?k:s[Form.KEY_VALUE])?w:"",l=null!=(T=c[e.LABEL])?T:"",P=null!=(O=c[e.VALUE])?O:this.state.value,t=null!=(x=c[e.CHECKED])&&x,L=null!=(m=c[e.SRC])?m:"",a=null!=(f=c[e.CONTROLLER])?f:"",r=null!=(v=c[e.CSS_CLASS])?v:"",n="c "+(null!=(E=s[Form.COL_CLASSES])?E:"c-100"),null!=s[Form.COL_CLASSES]&&""===s[Form.COL_CLASSES]&&(n=""),D={},I||(D={display:"none"}),M){case d.TEXT:M="text";break;case d.PASSWORD:M="password";break;case d.TIME:M="time"}if(null===M)return null;switch(M){case d.SCRIPT:case d.HTML:return null;case d.SHOP_ITEM_VALUES:l="",A=React.createElement(ShopItemPropValues,{ref:function(e){return U.input=e},value:P,data:null!=(R=c[e.OPTIONS])?R:{}});break;case d.CATEGORY_CHOOSE:l="",A=React.createElement(CategoryChoose,{ref:function(e){return U.input=e},value:P,data:null!=(b=c[e.OPTIONS])?b:{}});break;case d.IMAGE:A=React.createElement(ImagePicker,{ref:function(e){return U.input=e},value:P,src:L});break;case d.SUBMIT:A=React.createElement("button",{className:"btn "+r,ref:function(e){return U.input=e},onClick:this.props.onSubmit,type:"button"},l),l="",i=!1,n="cc";break;case d.SUBMIT_AND_CLOSE:if(!0===this.props.hideSubmitAndClose)return null;A=React.createElement("button",{className:"btn "+r,ref:function(e){return U.input=e},onClick:this.props.onSubmitAndClose,type:"button"},l),l="",i=!1;break;case d.DSEK_FILES:A=React.createElement(DsekFiles,{ref:function(e){return U.input=e},label:u,value:P});break;case d.KPTRACKING_FILE:A=React.createElement(KPTrackingFiles,{ref:function(e){return U.input=e},label:u,value:P});break;case d.SWITCH_IOS:case d.CHECKBOX:A=React.createElement(SwitchIOS,{ref:function(e){return U.input=e},checked:t,label:u});break;case d.CONTACTS:A=React.createElement(Contacts,{ref:function(e){return U.input=e},value:P});break;case d.DATE:A=React.createElement(Datepicker,{ref:function(e){return U.input=e},value:P,placeholder:u});break;case d.DATE_TIME:A=React.createElement(Datepicker,{ref:function(e){return U.input=e},value:P,timepicker:!0,placeholder:u});break;case d.SELECT:A=React.createElement(Select,{ref:function(e){return U.input=e},id:P,data:null!=(g=c[e.OPTIONS])?g:{},placeholder:u});break;case d.SELECT_SEARCH:A=React.createElement(Select,{ref:function(e){return U.input=e},id:P,data:null!=(y=c[e.OPTIONS])?y:{},placeholder:u,search:!0});break;case d.SELECT_AJAX:A=React.createElement(Select,{ref:function(e){return U.input=e},id:P,data:null!=(_=c[e.OPTIONS])?_:{},ajax:!0,controller:a,placeholder:u});break;case d.TEXTAREA:A=React.createElement(Textarea,{ref:function(e){return U.input=e},value:P,label:l,placeholder:u,className:"i c-100"}),l="";break;case d.HIDDEN:l="",i=!1,A=React.createElement("input",{ref:function(e){return U.input=e},type:"hidden",name:o,defaultValue:P});break;default:A=React.createElement("input",{ref:function(e){return U.input=e},type:M,name:o,defaultValue:P,placeholder:u,className:"i c-100",autoComplete:"off",onKeyUp:this.onKeyUp,onChange:this.onChange})}return l=""!==l?React.createElement("div",{className:"label",dangerouslySetInnerHTML:{__html:l}}):null,i&&(A=React.createElement("div",{className:"input_wrap"},l,A)),""!==n?React.createElement("div",{style:D,className:n},A):A}}return e.NAME=1,e.VALUE=2,e.LABEL=3,e.PLACEHOLDER=4,e.OPTIONS=5,e.CONTROLLER=6,e.CSS_CLASS=7,e.DATA=8,e.LINK=9,e.WITHNULLROW=10,e.ONLY_ADD_VALUE=11,e.THEME=12,e.VALIDATION=13,e.RULES=14,e.CHECKED=15,e.DISABLED=16,e.SRC=17,e.TYPE=18,e}.call(void 0)},function(module,__webpack_exports__,__webpack_require__){"use strict";var _input_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(4),react_autobind__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),react_autobind__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(react_autobind__WEBPACK_IMPORTED_MODULE_1__),Form,indexOf=[].indexOf,_unused_webpack_default_export=Form=function(){class Form extends React.Component{constructor(e){var t,n,a;super(e),t=!0===e.ajaxFast,this.state={inputs:null!=e.inputs?e.inputs:e.inputs=[],values:null!=e.values?e.values:e.values=[],ajaxFast:t,ajaxInitData:null!=(n=e.ajaxInitData)?n:{},loading:t,controller:null!=(a=e.controller)?a:"",hideSubmitAndClose:!0===e.hideSubmitAndClose},react_autobind__WEBPACK_IMPORTED_MODULE_1___default()(this),this.inputs={},this.form=null}componentDidMount(){var e,t,n,a;return a=this,({ajaxFast:e,controller:n,ajaxInitData:t}=this.state),e?API(n+"/getCardInfo/",{id:0,dataType:"JSON",init_data:t},(function(e){return a.setState({loading:!1,inputs:e.form},a.checkRules)})):this.checkRules()}onCancel(){var e;return"function"==typeof(e=this.props).onCancel?e.onCancel():void 0}getValues(){var e,t;for(e in t={},this.inputs)t[e]=this.inputs[e].getValue();return t}onSubmitAndClose(e){var t,n;return null!=e&&e.preventDefault(),n=this.getValues(),"function"==typeof(t=this.props).onSubmitAndClose&&t.onSubmitAndClose({form:this.form,values:n}),!1}onSubmit(e){var t,n;return null!=e&&e.preventDefault(),n=this.getValues(),"function"==typeof(t=this.props).onSubmit&&t.onSubmit({form:this.form,values:n}),!1}onChange(){return this.checkRules(name)}onKeyUp(e){return this.checkRules(e,"onkeyup")}checkRule(){}doRuleActions(actions,reverse=!1){var action,input,name,results,x;for(name in results=[],actions)if(action=actions[name],input=this.inputs[name],null!=input&&void 0!==input){switch(console.log("action",action),action.action){case"show":reverse?input.hide():input.show();break;case"hide":reverse?input.show():input.hide()}console.log("typeof",typeof action.js_function),"string"==typeof action.js_function?(x=eval(action.js_function),console.log("XXXX",x),results.push(x({values:this.getValues(),inputs:this.inputs,form:this}))):results.push(void 0)}else results.push(void 0);return results}checkRules(e=null,t=null){var n,a,r,s,i,l,o;if(o=this.getValues(),void 0===this.rules)return null;for(a in n=this.rules,null!=e&&void 0!==e&&(n={},void 0!==this.rules[e]&&(n[e]=this.rules[e])),r=[],n)i=n[a],l=o[a],r.push(function(){var e,n,a;for(a=[],e=0,n=i.length;e<n;e++)if(s=i[e],null===t||s.operator===t)switch(s.operator){case"in":a.push(this.doRuleActions(s.actions,indexOf.call(s.value,l)<0));break;case"onkeyup":a.push(this.doRuleActions(s.actions));break;default:a.push(void 0)}return a}.call(this));return r}addInput(e,t,n,a){var r,s=this;return({hideSubmitAndClose:r}=this.state),React.createElement(_input_js__WEBPACK_IMPORTED_MODULE_0__.a,{key:e,data:t,value:a,name:n,ref:function(e){return s.inputs[n]=e},onSubmit:this.onSubmit,onSubmitAndClose:this.onSubmitAndClose,hideSubmitAndClose:r,onChange:this.onChange,onKeyUp:this.onKeyUp})}renderInput(e,t){var n,a,r,s,i,l,o,c,u;if(null===e)return null;if(c="",a=[],!1,e[Form.VIEW]===Form.TITLE)return null;if(e[Form.VIEW]===Form.RULES)return this.rules=e[Form.RULES],null;if(e[Form.VIEW]===Form.ROW){if(c=null!=(i=e[Form.ROW_CLASSES])?i:"",null!=e[Form.COLS])for(r in e[Form.COLS])null!==(n=e[Form.COLS][r])&&(n[Form.VIEW]===Form.TITLE?a.push(React.createElement("div",{class:"c"},React.createElement("div",{class:"h1"},n[Form.TITLE_TEXT]))):(void 0===(s=n[Form.KEY_VALUE])&&(s=n[Form.INPUT_OPT][_input_js__WEBPACK_IMPORTED_MODULE_0__.a.NAME]),u=this.state.values[s],a.push(this.addInput(r,n,s,u))))}else s=null!=(l=null!=(o=e.name)?o:e[Form.KEY_VALUE])?l:void 0,u=e.value,void 0===s&&(console.warn("В форме поле ввода без аттрибута name",e),s="input"+(new Date).getTime()),void 0===u&&(u=this.state.values[s]),1===e[Form.TYPE],a.push(this.addInput(t,e,s,u));return React.createElement("div",{className:"row2 "+c},a)}render(){var e,t,n=this;return({loading:t}=this.state),t?React.createElement("div",null,"Загрузка..."):(e=this.state.inputs.map(this.renderInput.bind(this)),React.createElement("form",{onSubmit:this.onSubmit,ref:function(e){return n.form=e}},e,React.createElement("div",{className:"res"})))}}return Form.VALUES=1,Form.INPUTS=2,Form.INPUT=3,Form.KEY_VALUE=4,Form.TYPE=5,Form.LABEL=6,Form.VIEW=7,Form.INPUT_OPT=8,Form.ON_SUBMIT=9,Form.ROW=10,Form.ROW_CLASSES=11,Form.COL_CLASSES=12,Form.COLS=13,Form.CONTROLLER=14,Form.ACTION=15,Form.COL_CLASSES_ALL_FORCE=16,Form.TITLE=17,Form.TITLE_TEXT=18,Form.BUTTONS=19,Form.BUTTON=20,Form.INPUT_ALL_THEME_FORCE=21,Form.FORM_WRAP=22,Form.RULES=23,Form}.call(void 0);window.Form=Form},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(void 0===e)return void console.error("Autobind error: No context provided.");var t=Object.getPrototypeOf(e);r=arguments.length>1?Array.prototype.slice.call(arguments,1):Object.getOwnPropertyNames(t);r.forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);void 0!==n?-1===a.indexOf(e)&&"function"==typeof n.value&&Object.defineProperty(t,e,s(t,e,n)):console.warn('Autobind: "'+e+'" method not found in class.')}))};var a=["constructor","render","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","componentWillUpdate","componentDidUpdate","componentWillUnmount"],r=[];function s(e,t,n){var a=n.value;return{configurable:!0,get:function(){if(this===e||this.hasOwnProperty(t))return a;var n=a.bind(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n}}}e.exports=t.default},function(e,t,n){"use strict";
|
||
/** @license React v17.0.2
|
||
* react.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var a=n(8),r=60103,s=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var i=60109,l=60110,o=60112;t.Suspense=60113;var c=60115,u=60116;if("function"==typeof Symbol&&Symbol.for){var d=Symbol.for;r=d("react.element"),s=d("react.portal"),t.Fragment=d("react.fragment"),t.StrictMode=d("react.strict_mode"),t.Profiler=d("react.profiler"),i=d("react.provider"),l=d("react.context"),o=d("react.forward_ref"),t.Suspense=d("react.suspense"),c=d("react.memo"),u=d("react.lazy")}var h="function"==typeof Symbol&&Symbol.iterator;function p(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},f={};function v(e,t,n){this.props=e,this.context=t,this.refs=f,this.updater=n||m}function E(){}function R(e,t,n){this.props=e,this.context=t,this.refs=f,this.updater=n||m}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(p(85));this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},E.prototype=v.prototype;var b=R.prototype=new E;b.constructor=R,a(b,v.prototype),b.isPureReactComponent=!0;var g={current:null},y=Object.prototype.hasOwnProperty,_={key:!0,ref:!0,__self:!0,__source:!0};function C(e,t,n){var a,s={},i=null,l=null;if(null!=t)for(a in void 0!==t.ref&&(l=t.ref),void 0!==t.key&&(i=""+t.key),t)y.call(t,a)&&!_.hasOwnProperty(a)&&(s[a]=t[a]);var o=arguments.length-2;if(1===o)s.children=n;else if(1<o){for(var c=Array(o),u=0;u<o;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(a in o=e.defaultProps)void 0===s[a]&&(s[a]=o[a]);return{$$typeof:r,type:e,key:i,ref:l,props:s,_owner:g.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var N=/\/+/g;function w(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function k(e,t,n,a,i){var l=typeof e;"undefined"!==l&&"boolean"!==l||(e=null);var o=!1;if(null===e)o=!0;else switch(l){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case r:case s:o=!0}}if(o)return i=i(o=e),e=""===a?"."+w(o,0):a,Array.isArray(i)?(n="",null!=e&&(n=e.replace(N,"$&/")+"/"),k(i,t,n,"",(function(e){return e}))):null!=i&&(S(i)&&(i=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(N,"$&/")+"/")+e)),t.push(i)),1;if(o=0,a=""===a?".":a+":",Array.isArray(e))for(var c=0;c<e.length;c++){var u=a+w(l=e[c],c);o+=k(l,t,n,u,i)}else if("function"==typeof(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=h&&e[h]||e["@@iterator"])?e:null}(e)))for(e=u.call(e),c=0;!(l=e.next()).done;)o+=k(l=l.value,t,n,u=a+w(l,c++),i);else if("object"===l)throw t=""+e,Error(p(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return o}function T(e,t,n){if(null==e)return e;var a=[],r=0;return k(e,a,"","",(function(e){return t.call(n,e,r++)})),a}function O(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var x={current:null};function A(){var e=x.current;if(null===e)throw Error(p(321));return e}var I={ReactCurrentDispatcher:x,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:g,IsSomeRendererActing:{current:!1},assign:a};t.Children={map:T,forEach:function(e,t,n){T(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return T(e,(function(){t++})),t},toArray:function(e){return T(e,(function(e){return e}))||[]},only:function(e){if(!S(e))throw Error(p(143));return e}},t.Component=v,t.PureComponent=R,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,t.cloneElement=function(e,t,n){if(null==e)throw Error(p(267,e));var s=a({},e.props),i=e.key,l=e.ref,o=e._owner;if(null!=t){if(void 0!==t.ref&&(l=t.ref,o=g.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(u in t)y.call(t,u)&&!_.hasOwnProperty(u)&&(s[u]=void 0===t[u]&&void 0!==c?c[u]:t[u])}var u=arguments.length-2;if(1===u)s.children=n;else if(1<u){c=Array(u);for(var d=0;d<u;d++)c[d]=arguments[d+2];s.children=c}return{$$typeof:r,type:e.type,key:i,ref:l,props:s,_owner:o}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:l,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:i,_context:e},e.Consumer=e},t.createElement=C,t.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:o,render:e}},t.isValidElement=S,t.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:O}},t.memo=function(e,t){return{$$typeof:c,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return A().useCallback(e,t)},t.useContext=function(e,t){return A().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return A().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return A().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return A().useLayoutEffect(e,t)},t.useMemo=function(e,t){return A().useMemo(e,t)},t.useReducer=function(e,t,n){return A().useReducer(e,t,n)},t.useRef=function(e){return A().useRef(e)},t.useState=function(e){return A().useState(e)},t.version="17.0.2"},function(e,t,n){"use strict";
|
||
/*
|
||
object-assign
|
||
(c) Sindre Sorhus
|
||
@license MIT
|
||
*/var a=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function i(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach((function(e){a[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},a)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,o=i(e),c=1;c<arguments.length;c++){for(var u in n=Object(arguments[c]))r.call(n,u)&&(o[u]=n[u]);if(a){l=a(n);for(var d=0;d<l.length;d++)s.call(n,l[d])&&(o[l[d]]=n[l[d]])}}return o}},function(e,t,n){"use strict";var a=n(10);function r(){}function s(){}s.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,s,i){if(i!==a){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:r};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n;window.initReact=function(e,t={}){var a,r,s,i,l,o,c,u,d,h,p,m,f,v,E,R;for(r in null==t&&(t={}),R=(new Date).getTime(),s=function(e,n="data"){t=e.getAttribute("data-"+n);try{t=JSON.parse(t)}catch(e){e,t={}}return e.removeAttribute("data-"+n),t},(v=function(t,n){var a,r,s,i,l;for(l=[],r=0,s=(i=e[0].querySelectorAll(t)).length;r<s;r++)a=i[r],l.push(ReactDOM.render(n,a));return l})(".r_portfolio_list",React.createElement(PortfolioList,{data:t.portfolio_list})),v(".r_news_list",React.createElement(NewsAnnotationList,{data:t.news_annotation})),v(".r_service_list",React.createElement(ServiceList,{data:t.service_list})),v(".r_service_icons",React.createElement(ServiceIconsList,{data:t.service_icons})),v(".r_updates_list",React.createElement(UpdatesAnnotationList,{data:t.updates_annotation})),v(".r_announcement_list",React.createElement(AnnouncementAnnotationList,{data:t.announcement_annotation})),v(".r_turnkey_list",React.createElement(TurnkeyAnnotationList,{data:t.turnkey_annotation})),v(".r_money_dash.new",React.createElement(MoneyDash,{type:"new"})),t.money_data)null!=(a=t.money_data[r]).minus&&v('.r_money_minus[data-date="'+r+'"]',React.createElement(MoneyList,{type:"minus",data:a.minus})),null!=a.plus&&v('.r_money_plus[data-date="'+r+'"]',React.createElement(MoneyList,{type:"plus",data:a.plus})),null!=a.transfer&&v('.r_money_transfer[data-date="'+r+'"]',React.createElement(MoneyList,{type:"transfer",data:a.transfer}));for(l=0,u=(a=e[0].querySelectorAll(".r_table")).length;l<u;l++)i=a[l],ReactDOM.render(React.createElement(Table,{data:s(i)}),i);for(o=0,d=(a=e[0].querySelectorAll(".r_card")).length;o<d;o++)i=a[o],t=i.getAttribute("data-data"),void 0!==window[t]?(console.log(t,window[t]),t=JSON.parse(window[t])):t=s(i),ReactDOM.render(React.createElement(Card,{data:t}),i);for(p=0,h=(a=e[0].querySelectorAll("#form_auth")).length;p<h;p++)i=a[p],(m={})[Input.PLACEHOLDER]="Логин",m[Input.TYPE]=INPUT_TYPE.TEXT,(c={})[Form.INPUT_OPT]=m,c[Form.KEY_VALUE]="login",(m={})[Input.PLACEHOLDER]="Пароль",m[Input.TYPE]=INPUT_TYPE.PASSWORD,(f={})[Form.INPUT_OPT]=m,f[Form.KEY_VALUE]="pass",(m={})[Input.TYPE]=INPUT_TYPE.SUBMIT,m[Input.LABEL]="Авторизоваться",m[Input.CSS_CLASS]="blue",(E={})[Form.INPUT_OPT]=m,ReactDOM.render(React.createElement(Form,{inputs:[c,f,E],onSubmit:n}),i);return console.log("React Render",(new Date).getTime()-R)},window.firstInitReact=function(e,t={}){},n=function(e){var t;return(t=e.values).dataType="JSON",API("core.user.account/login",t,(function(e){return 1===e.e?console.log(e):window.location.reload()}))}},function(e,t,n){"use strict";n.r(t);var a,r,s=n(1),i=n.n(s),l=n(2),o=n.n(l),c=class extends o.a.Component{constructor(e){var t;super(e),this.state={checked:null!=e.checked?e.checked:e.checked=!1,disabled:null!=(t=e.disabled)&&t},i()(this)}componentWillReceiveProps(e){return this.setState({checked:e.checked})}shouldComponentUpdate(e,t){return t.checked!==this.state.checked}setValue(e){return this.setState({checked:e})}aToggle(e){var t;return"function"==typeof(t=this.props).onChange?t.onChange(e):void 0}toggle(e=null){var t,n;if(({disabled:n}=this.state),null!=e&&e.stopPropagation(),!n)return t=!this.state.checked,this.setState({checked:t},this.aToggle.bind(this,t))}render(){var e,t;return({checked:e,disabled:t}=this.state),o.a.createElement("div",{class:"checkbox "+(e?"checked":"")+(t?" disabled":""),onClick:this.toggle},o.a.createElement("input",{type:"checkbox",defaultChecked:this.state.checked,checked:e}))}};window.Thead=class extends React.Component{constructor(e){var t;super(e),this.state={columns:null!=(t=e.columns)?t:[],hide_thead:!0===e.hide_thead,sortable:!0===e.sortable},i()(this),this.filter_inputs={},this.timeout=null}setSelected(e){return this.setState({selected:!0===e})}onSelect(e){var t;return"function"==typeof(t=this.props).onSelect?t.onSelect(e):void 0}getFilterData(){var e,t,n;for(e in t={},this.filter_inputs)""!==(n=this.filter_inputs[e]).value&&(t[e]=n.value);return t}prepareToFilter(){return clearTimeout(this.timeout),this.timeout=setTimeout(this.filter,350)}filter(){var e;return e=this.getFilterData(),this.props.onSetFilter(e)}renderFilter(e){var t,n,a=this;switch(t=null,n=e.filter,e.type){case 2:t=React.createElement("input",{class:"i c-100",onKeyUp:this.prepareToFilter,placeholder:e.name,ref:function(t){return a.filter_inputs[e.id]=t},defaultValue:n})}return React.createElement("th",null,t)}renderTh(e){return React.createElement("th",null,React.createElement("div",{className:"text"},e.name))}render(){var e,t,n,a;return({columns:e,hide_thead:t,sortable:a}=this.state),n=!0,a&&(n=!1),t?null:React.createElement("thead",null,React.createElement("tr",null,a?React.createElement("th",{class:"c-1"}):null,React.createElement("th",{class:"c-1"},React.createElement(c,{checked:this.state.selected,onChange:this.onSelect})),e.map(this.renderTh)),n?React.createElement("tr",null,React.createElement("th",null," "),e.map(this.renderFilter)):null)}},n(5);r=function(){class e{}return e.FORM=1,e.TABLE=2,e}.call(void 0),a=function(){class e{}return e.NAME=1,e.CONTENT=2,e.TYPE=3,e.INIT_OPEN=4,e}.call(void 0);var u;window.Card=class extends React.Component{constructor(e){var t,n,a,r,s,i;super(e),t=null!=(a=(null!=(n=e.options)?n:{}).controller_method)?a:"getCardInfo",this.state={ajax:!0===e.ajax,controller:null!=(r=e.controller)?r:"",id:null!=(s=e.id)?s:"",loading:!0===e.ajax,data:null!=(i=e.data)?i:[],tab:null,in_modal:!0===e.in_modal,controller_method:t},this.aRefresh=this.aRefresh.bind(this),this.onSubmit=this.onSubmit.bind(this),this.onSubmitAndClose=this.onSubmitAndClose.bind(this),this.uaddEntity=this.uaddEntity.bind(this),this.aUaddEntity=this.aUaddEntity.bind(this),this.updateRender=this.updateRender.bind(this),this.tabs=null,this.pages=null}onSubmitAndClose(e){var t;return this.uaddEntity(e),"function"==typeof(t=this.props).onClose?t.onClose():void 0}onSubmit(e){return this.uaddEntity(e)}aUaddEntity(e,t){return console.log("aUaddEntity",e,t),e.success?(Notify.create({text:"Успешно сохранено"}),Controllers.update(t.controller)):Notify.create({color:"red",text:"Ошибка при сохранении: "+x.error})}uaddEntity(e){var t,n;return t=(n=e.values).controller,API(t+"/uadd",{values:n,dataType:"JSON"},this.aUaddEntity,{controller:t})}updateRender(){return $(this.pages).perfectScrollbar("update"),$(this.tabs).perfectScrollbar("update"),$(".content").perfectScrollbar("update")}aRefresh(e,t){return console.log("aRefresh",e),this.setState({loading:!1,data:e,tab:null},(function(){return $(this.pages).perfectScrollbar(),$(this.tabs).perfectScrollbar(),this.checkInitTab()}))}refresh(){var e,t,n;return({controller:e,id:n,controller_method:t}=this.state),API(e+"/"+t,{id:n,dataType:"JSON"},this.aRefresh)}checkInitTab(){var e,t,n,r,s;if(this,({tab:r,data:e}=this.state),null===r&&void 0!==e.tabs&&Array.isArray(e.tabs)){for(t in n=[],e.tabs)if(null!==(s=e.tabs[t])){if(console.log(t,s,s[a.INIT_OPEN]),!0===s[a.INIT_OPEN]){r=t,this.setTab(r);break}n.push(void 0)}return n}}componentDidMount(){return!0===this.state.ajax?this.refresh():this.checkInitTab()}setTab(e=null){return this.setState({tab:e},this.updateRender)}render(){var e,t,n,s,i,l,o,c,u,d,h,p,m,f,v=this;if(({loading:u,data:n,tab:p,title:f,in_modal:o}=this.state),s=!o,h=[],m=[],t=null,l=null,!u)if(void 0!==n.form)t=React.createElement("div",{class:"f1_db card_form_edit"},React.createElement("div",{class:"row"},React.createElement("div",{class:"c"},React.createElement("div",{class:"h"},n.title,". Редактирование"))),React.createElement("div",{class:"block"},React.createElement("div",{class:"body"},React.createElement("div",{class:"cont"},React.createElement(Form,{values:n.values,inputs:n.form,onSubmit:this.onSubmit,onSubmitAndClose:this.onSubmitAndClose,hideSubmitAndClose:s})))));else{for(c in n.tabs)null!==(i=n.tabs[c])&&(""!==n.image&&(l=React.createElement("img",{src:n.image})),m.push(React.createElement("div",{onClick:this.setTab.bind(this,c),key:c,className:"tab"+(c===p?" selected":"")},i[a.NAME])),e=i[a.CONTENT],t=null,i[a.TYPE]===r.TABLE&&(t=React.createElement("div",{className:"table"},React.createElement(Table,{data:e}))),i[a.TYPE]===r.FORM&&(t=React.createElement("div",{className:"cont"},React.createElement(Form,{values:e.values,inputs:e.inputs,onSubmit:this.onSubmit,onSubmitAndClose:this.onSubmitAndClose,hideSubmitAndClose:s}))),d=React.createElement("div",{className:"card_page",key:c},React.createElement("div",{className:"h"},i[a.NAME]),React.createElement("div",{className:"page_content"},React.createElement("div",{className:"block"},React.createElement("div",{className:"body"},t)))),(null===p||-1===p||p===c)&&h.push(d));m.length>0&&null!==p&&-1!==p&&m.push(React.createElement("div",{onClick:this.setTab.bind(this,-1),key:m.length,className:"tab"},"Показать всё")),t=React.createElement("div",{className:"card_content"},React.createElement("div",{className:"pages",ref:function(e){return v.pages=e}},React.createElement("div",{className:"pages_content"},h)),React.createElement("div",{className:"tabs",ref:function(e){return v.tabs=e}},React.createElement("div",null,l,m)))}return React.createElement("div",{className:"card"},u?React.createElement("div",{className:"card_loading"},"Загрузка..."):t)}};u=function(){class e{}return e.NONE=-1,e.LINK=1,e.CARD=2,e.OPEN_UADD=3,e}.call(void 0);var d,h,p;window.Tr=class extends React.Component{constructor(e){super(e),this.state=this.prepareProps(e),i()(this)}onTdInputChange(e){return console.warn("onTdInputChange ДОДЕЛАТЬ!!!!",e)}trClick(e){var t,n,a,r;switch(({row_click:r,controller:n,id:a}=this.state),r){case u.CARD:return e.preventDefault(),Modals.openCard(n,a);case u.OPEN_UADD:return e.preventDefault(),"function"==typeof(t=this.props).openUadd?t.openUadd():void 0}}prepareProps(e){var t,n,a,r;return{id:null!=(t=e.id)?t:0,data:e.data,controller:null!=(n=e.controller)?n:"",column_render:null!=(a=e.column_render)?a:{},row_click:null!=(r=e.row_click)?r:u.NONE,sortable:!0===e.sortable}}componentWillReceiveProps(e){var t,n,a,r;for(t in n=!1,e.id!==this.props.id&&(n=!0),e.data)if(a=e.data[t],r=this.props.data[t],(null!=a?a.value:void 0)!==(null!=r?r.value:void 0)){n=!0;break}if(n)return this.setState(this.prepareProps(e))}onClickLink(e,t,n){return void 0!==n.COLUMN_RENDER_CARD_CONTROLLER?(e.preventDefault(),e.stopPropagation(),Modals.openCard(n.COLUMN_RENDER_CARD_CONTROLLER,this.state.id,{controller_method:n.COLUMN_RENDER_CARD_FORM_METHOD})):!0===n.COLUMN_RENDER_LINK_MODAL?(e.preventDefault(),Modals.openCard(this.state.controller,this.state.id)):void 0}onSelect(e){return this.setState({selected:e},this.props.onSelect)}setSelect(e){return this.setState({selected:!0===e})}renderTd(e){var t,n,a,r,s,i,l,o,c,u,d,h,p,m,f;if(h=this,f=e.value,({id:a,data:n}=this.state),t=this.state.column_render[e.column],null!==e.input&&(f=React.createElement(Input,{key:e.column+this.state.id,data:e.input,value:e.data,onChange:this.onTdInputChange.bind(this,e.column)})),null!=t)if(!0===(o=t.COLUMN_RENDER_AS_HTML))f=React.createElement("span",{dangerouslySetInnerHTML:{__html:f}});else if(!0===(o=t.COLUMN_RENDER_IMAGE_WRAP)&&(f=React.createElement("img",{src:f})),void 0!==(o=t.COLUMN_RENDER_LINK_ID)&&""!==o){if(l=o+a+"/",void 0!==t.COLUMN_RENDER_LINK_COLUMN_ID)for(s=0,i=n.length;s<i;s++)(m=n[s]).column===t.COLUMN_RENDER_LINK_COLUMN_ID&&(l=0!==m._value&&"0"!==m._value?o+m._value+"/":"#");console.log("cr.COLUMN_RENDER_LINK_BLANK",t.COLUMN_RENDER_LINK_BLANK,!0===t.COLUMN_RENDER_LINK_BLANK),r=!0===t.COLUMN_RENDER_LINK_BLANK,f=React.createElement("a",{href:l,className:null!=(c=t.COLUMN_RENDER_LINK_CSS_CLASS)?c:"",onClick:function(n){return h.onClickLink(n,e,t)},"data-modal":!0===t.COLUMN_RENDER_LINK_MODAL,target:r?"_blank":""},f)}else!0===t.COLUMN_RENDER_LINK_MODAL&&(f=React.createElement("div",{className:null!=(u=t.COLUMN_RENDER_LINK_CSS_CLASS)?u:"",onClick:function(n){return h.onClickLink(n,e,t)},"data-modal":!0===t.COLUMN_RENDER_LINK_MODAL},f));return p=null!=(d=e.td_class)?d:"",React.createElement("td",null,React.createElement("div",{className:"td_cont "+p},f))}render(){var e,t,n,a;return({data:e,id:t,sortable:a,selected:n}=this.state),React.createElement("tr",{onClick:this.trClick,"data-id":t},a?React.createElement("td",{class:"c-1"},React.createElement("div",{class:"icon up_down small pointer"})):null,React.createElement("td",{class:"c-1"},React.createElement(c,{onChange:this.onSelect.bind(this),checked:n})),e.map(this.renderTd))}},window.Tbody=class extends React.Component{constructor(e){var t,n,a,r,s;super(e),this.state={columns:null!=(t=e.columns)?t:[],data:null!=(n=e.data)?n:[],controller:null!=(a=e.controller)?a:"",column_render:null!=(r=e.column_render)?r:{},row_click:null!=(s=e.row_click)?s:"",sortable:!0===e.sortable},i()(this),this.tbody=null,this.rows={}}onSelect(){var e;return"function"==typeof(e=this.props).onSelect?e.onSelect():void 0}getSelected(){var e,t,n;for(e in t=[],this.rows)null!=(n=this.rows[e])&&n.state.selected&&t.push(n);return t}selectAll(e=!0){var t,n,a;for(t in n=[],this.rows)null!=(a=this.rows[t])?n.push(a.setSelect(e)):n.push(void 0);return n}componentWillReceiveProps(e){return this.setState({data:e.data})}init(){var e,t;if(console.log("intiSortable??"),({controller:e,data:t}=this.state),this.state.sortable)return $(this.tbody).sortable({handle:".up_down",start:function(e,t,n){return $(n).hide()},stop:function(t,n,a){var r,s,i;return i=(r=$(n)).index(),s=r.attr("data-id"),API(e+"/updatePosForID",{id:s,pos:i})}})}componentDidMount(){return this.init()}renderTr(e){var t=this;return React.createElement(Tr,{data:e.data,id:e.id,controller:this.state.controller,column_render:this.state.column_render,row_click:this.state.row_click,key:e.id,openUadd:this.props.openUadd,sortable:this.state.sortable,onSelect:this.onSelect,ref:function(n){return t.rows[e.id]=n}})}render(){var e,t=this;return({data:e}=this.state),React.createElement("tbody",{ref:function(e){return t.tbody=e}},e.map(this.renderTr))}},window.TableTitle=class extends React.Component{constructor(e){var t,n,a;super(e),this.state={controller:null!=(t=e.controller)?t:"",title:null!=(n=e.title)?n:"",init_data:null!=(a=e.init_data)?a:[],hide_title:!0===e.hide_title,selectedCount:0},this.modalIndex=null,i()(this)}deleteSelected(){}setSelectCount(e){return this.setState({selectedCount:e})}closeModal(){var e;return null!=(e=Modals.rModals[this.modalIndex])&&"function"==typeof e.close?e.close():void 0}aOnSubmit(e,t){return console.log("aOnSubmit",e,t),e.success?(Notify.create({text:"Успешно сохранено"}),this.closeModal(),t.openCard&&Modals.openCard(this.state.controller,e.id),Controllers.update(this.state.controller)):Notify.create({color:"red",text:"Ошибка при сохранении: "+e.error})}deleteSelections(){var e;return"function"==typeof(e=this.props).onDelete?e.onDelete():void 0}onSubmitAndClose(e){return this.onSubmit(e,!1)}onSubmit(e,t=!0){var n,a;return n=(a=e.values).controller,API(n+"/uadd",{values:a,dataType:"JSON"},this.aOnSubmit,{openCard:t})}createNew(){var e,t;return({title:t,init_data:e}=this.state),this.modalIndex=Modals.create({scrollable:!0,width:800,content:React.createElement("div",{class:"f1_db"},React.createElement("div",{class:"row"},React.createElement("div",{class:"c"},React.createElement("div",{class:"h"},t,". Добавление"))),React.createElement("div",{class:"block"},React.createElement("div",{class:"body"},React.createElement("div",{class:"cont"},React.createElement(Form,{ajaxFast:!0,ajaxInitData:e,controller:this.state.controller,onSubmit:this.onSubmit,onSubmitAndClose:this.onSubmitAndClose,values:e})))))})}render(){var e,t,n;return({hide_title:t,selectedCount:n}=this.state),t?null:(e=[],n&&e.push(React.createElement("button",{type:"button",className:"btn red small",onClick:this.deleteSelections},"Удалить")),React.createElement("div",{class:"table_title"},React.createElement("div",{class:"btns"},React.createElement("button",{type:"button",className:"btn blue small",onClick:this.createNew},"Добавить"),e)))}},window.Pagination=class extends React.Component{constructor(e){var t,n;super(e),this.state={pages:null!=(t=e.pages)?t:0,now:null!=(n=e.now)?n:0,wing:3}}aSetPage(){var e;return"function"==typeof(e=this.props).onChange?e.onChange(this.state.now):void 0}setPage(e){return this.setState({now:e},this.aSetPage.bind(this))}setNow(e){return this.setState({now:e})}prev(){if(this.state.now>1)return this.setPage(this.state.now-1)}next(){if(this.state.now<this.state.pages)return this.setPage(this.state.now+1)}componentWillReceiveProps(e){return this.setState({pages:e.pages})}render(){var e,t,n,a,r,s,i,l,o,c,u,d,h,p,m,f,v,E,R,b;if(t=this.state.wing,n=this.state.pages,d=this.state.now,e=[],n>1){for(e.push(1),a=r=2,m=c=Math.min(n,t);2<=m?r<=m:r>=m;a=2<=m?++r:--r)e.push(a);if((c=Math.max(c+1,d-t))<=(u=Math.min(n,d+t)))for(a=s=f=c,v=u;f<=v?s<=v:s>=v;a=f<=v?++s:--s)e.push(a);if((c=Math.max(u+1,n-t))<=n)for(a=i=E=c,R=n;E<=R?i<=R:i>=R;a=E<=R?++i:--i)e.push(a)}for(h=[],p=0,o=0,l=e.length;o<l;o++)(a=e[o])-p>1&&h.push(React.createElement("span",null,"...")),h.push(React.createElement("a",{onClick:this.setPage.bind(this,a),className:a===d?"selected":""},a)),p=a;return b={},0===h.length&&(b={display:"none"}),React.createElement("div",{className:"pagination",style:b},React.createElement("a",{className:d<2?"disable":"",onClick:this.prev.bind(this)},"<"),h,React.createElement("a",{className:this.state.now===this.state.pages?"disable":"",onClick:this.next.bind(this)},">"))}};window.Modal=d=class extends React.Component{constructor(e){var t,n,a,r;super(e),console.log("modal",e),t=null!=(n=e.data)?n:{},this.state={closed:!1,content:null!=(a=t.content)?a:null,scrollable:!0===t.scrollable,width:null!=(r=t.width)?r:null},this.close=this.close.bind(this),this.wrap=null}componentDidMount(){if(this.state.scrollable)return $(this.wrap).perfectScrollbar()}close(){var e;return this.setState({closed:!0}),"function"==typeof(e=this.props).onClose?e.onClose():void 0}render(){var e,t,n,a,r=this;return({closed:e,content:t,width:a}=this.state),e?null:(n={},null!=a&&(n.width=a+"px"),React.createElement("div",{className:"background"},React.createElement("div",{className:"background_click",onClick:this.close}),React.createElement("div",{className:"modal",ref:function(e){return r.wrap=e},style:n},React.createElement("div",{className:"modal_content"},t))))}};window.ModalWrap=h=class extends React.Component{constructor(e){super(e),this.state={index:0},this.modals={},this.rModals={},this.create=this.create.bind(this),this.onClose=this.onClose.bind(this)}getBodyWrap(){var e;return null===(e=document.getElementById("background"))&&(e=document.body),e}onClose(e){if(delete this.modals[e],0===Object.keys(this.modals).length)return this.getBodyWrap().classList.remove("modaled")}create(e){var t,n=this;return({index:t}=this.state),t++,this.modals[t]=React.createElement(d,{data:e,key:t,ref:function(e){return n.rModals[t]=e},onClose:this.onClose.bind(this,t)}),this.setState({index:t}),this.getBodyWrap().classList.add("modaled"),t}openCard(e,t,n={}){var a,r,s;return r=null,s=this,a=function(){return s.rModals[r].close()},r=Modals.create({content:React.createElement(Card,{ajax:!0,controller:e,id:t,in_modal:!0,onClose:a,options:n}),scrollable:!0})}render(){var e,t;for(e in t=[],this.modals)t.push(this.modals[e]);return t}};p=function(){var e;return e=document.createElement("div"),document.body.appendChild(e),ReactDOM.render(React.createElement(h,{ref:function(e){return window.Modals=e}}),e)},document.addEventListener("DOMContentLoaded",p);window.MiniHelp=class extends React.Component{constructor(e){super(e)}render(){return React.createElement("div",{class:"minihelp"},React.createElement("div",{class:"icon help small"}),React.createElement("div",{class:"text"},this.props.title))}};window.psUpdate=function(){return $(".ps-container").perfectScrollbar("update")},window.Controllers=function(){class e{static update(e){var t,n,a,r;for(n in null==(t=this.controllers)[e]&&(t[e]=[]),a=[],this.controllers[e])r=this.controllers[e][n],a.push("function"==typeof r.reload?r.reload():void 0);return a}static add(e,t){var n;return null==(n=this.controllers)[e]&&(n[e]=[]),this.controllers[e].push(t)}static remove(e,t){var n,a,r;for(a in null==(n=this.controllers)[e]&&(n[e]=[]),r=[],this.controllers[e]){if(this.controllers[e][a]===t){this.controllers[e].splice(a,1);break}r.push(void 0)}return r}}return e.controllers={},e}.call(void 0);var m,f,v;window.Table=class extends React.Component{constructor(e){super(e),this.state=this.prepareProps(e),this.pagination=null,this.force_page=null,i()(this)}prepareProps(e){var t,n,a,r,s,i,l,o,c,u,d,h,p,m,f;return t=e.data,console.log("query",t,t.query),{columns:null!=(n=t.columns)?n:[],data:null!=(a=t.data)?a:[],pages:null!=(o=t.pages)?o:0,page:null!=(c=t.page)?c:0,controller:null!=(u=t.controller)?u:"",column_render:null!=(d=t.column_render)?d:{},title:null!=(h=t.title)?h:{},init_data:null!=(p=t.init_data)?p:{},row_click:null!=(m=t.row_click)?m:-1,count:null!=(f=t.count)?f:10,where:null!=(r=t.where)?r:null,hide_thead:!0===t.hide_thead,hide_title:!0===t.hide_title,sortable:!0===t.sortable,hide_columns:null!=(s=t.hide_columns)?s:[],sort:null!=(i=t.sort)?i:[],filter:null!=(l=t.filter)?l:[]}}destroy(){return Controllers.remove(this.state.controller,this)}componentDidMount(){return $(this.wrap).on("destroyed ",this.destroy),Controllers.add(this.state.controller,this),A.P.initMini($(this.wrap))}aReload(e){var t;try{e=JSON.parse(e)}catch(t){t,e={}}return t=this.prepareProps({data:e}),this.setState(t,(function(){return psUpdate(),this.tbody.init()})),A.P.initMini($(this.wrap))}openUadd(){var e;return null!=(e=this.title)?e.createNew():void 0}reload(){var e,t,n,a,r,s,i,l,o,c,u,d,h;return({count:e,row_click:o,init_data:i,where:h,hide_thead:a,hide_title:r,hide_columns:n,sortable:d,sort:u,filter:t}=this.state),l=0,null!==this.force_page?(l=this.force_page,this.force_page=null):null!=this.pagination&&(l=this.pagination.state.now-1),c={page:l,2:u,7:e,4:h,row_click:o,init_data:i,hide_thead:a,hide_title:r,HIDE_COLUMNS:n,sortable:d,filter:t},API(this.state.controller+"/getTableData",c,this.aReload.bind(this)),s={page:l,count:e,filter:t},H.SEARCH.setValue(this.state.controller,JSON.stringify(s))}onDelete(){var e,t,n,a,r;for(r=this.tbody.getSelected(),t=[],this.onSelectAll(!1),n=0,a=r.length;n<a;n++)e=r[n],t.push(e.state.id);return API(this.state.controller+"/removeByIds",{ids:t},this.reload)}onSelectAll(e){return this.tbody.selectAll(e),this.title.setSelectCount(e?this.state.data.length:0),this.thead.setSelected(e)}onSelectRow(){var e;return e=this.tbody.getSelected(),this.title.setSelectCount(e.length),this.thead.setSelected(e.length===this.state.data.length)}setFilter(e){return this.force_page=0,this.pagination.setNow(1),this.setState({filter:e},this.reload)}render(){var e,t,n,a,r,s,i,l,o,c,u=this;return({columns:e,data:n,pages:l,page:i,controller:t,title:c,init_data:s,hide_thead:a,hide_title:r,sortable:o}=this.state),React.createElement("div",{ref:function(e){return u.wrap=e}},React.createElement(TableTitle,{controller:t,title:c,init_data:s,ref:function(e){return u.title=e},hide_title:r,onDelete:this.onDelete}),React.createElement("table",{cellPadding:0,cellSpacing:0},React.createElement(Thead,{columns:e,hide_thead:a,sortable:o,ref:function(e){return u.thead=e},onSelect:this.onSelectAll,onSetFilter:this.setFilter}),React.createElement(Tbody,{columns:e,data:n,controller:t,column_render:this.state.column_render,row_click:this.state.row_click,openUadd:this.openUadd,sortable:o,onSelect:this.onSelectRow,ref:function(e){return u.tbody=e}})),React.createElement(Pagination,{ref:function(e){return u.pagination=e},pages:l,now:i+1,onChange:this.reload}))}},window.NotifyWrap=f=class extends React.Component{constructor(e){super(e),this.state={index:0},this.notifies={}}create(e){var t;return({index:t}=this.state),t++,this.notifies[t]=React.createElement(m,{key:t,data:e}),this.setState({index:t})}render(){var e,t;for(t in e=[],this.notifies)e.push(this.notifies[t]);return React.createElement("div",null,e)}};m=class extends React.Component{constructor(e){super(e),this.state=this.prepare(e.data),this.close=this.close.bind(this)}prepare(e){var t,n,a;return{opened:!1,removed:!1,timeout:null!=(t=e.timeout)?t:3e3,text:null!=(n=e.text)?n:"",color:null!=(a=e.color)?a:""}}close(){var e;return(e=this).setState({opened:!1}),setTimeout((function(){return e.setState({removed:!0}),e=null}),150)}componentDidMount(){var e;return e=this,setTimeout((function(){return e.setState({opened:!0})}),10),setTimeout(this.close,this.state.timeout)}render(){var e,t,n,a;return({opened:t,removed:n,text:a,color:e}=this.state),n?null:React.createElement("div",{className:"notify "+e+(t?" opened":""),onClick:this.close},a)}},v=function(){var e;return(e=document.createElement("div")).id="notifies",document.body.appendChild(e),ReactDOM.render(React.createElement(f,{ref:function(e){return window.Notify=e}}),e)},document.addEventListener("DOMContentLoaded",v);window.AnnotationDash=class extends React.Component{constructor(e){super(e)}render(){return React.createElement(Dash,{data:this.props.data})}},window.NewsAnnotationList=class extends React.Component{constructor(e){var t,n,a,r,s;for(super(e),t=[],a=0,r=(s=this.props.data).length;a<r;a++)(n=s[a]).text=n.annotation,n.ratio="2-3",n.column="c-25",t.push(n);this.state={data:t}}render(){var e;return this.state.data.length>0?React.createElement("div",null,React.createElement(Title,{title:"НОВОСТИ",more:"/news/",more_text:"Смотреть все новости"}),React.createElement("div",{className:"dashes"},function(){var t,n,a,r;for(r=[],t=0,n=(a=this.state.data).length;t<n;t++)e=a[t],r.push(React.createElement(AnnotationDash,{data:e}));return r}.call(this))):null}},window.PortfolioList=class extends React.Component{constructor(e){var t,n,a,r,s;for(super(e),t=[],a=0,r=(s=this.props.data).length;a<r;a++)(n=s[a]).text=n.annotation,n.ratio="2-3",n.column="c-1-3",t.push(n);this.state={data:t}}render(){var e;return this.state.data.length>0?React.createElement("div",null,React.createElement(Title,{title:"ПОРТФОЛИО",more:"/portfolio/",more_text:"Смотреть все работы"}),React.createElement("div",{className:"dashes"},function(){var t,n,a,r;for(r=[],t=0,n=(a=this.state.data).length;t<n;t++)e=a[t],r.push(React.createElement(AnnotationDash,{data:e}));return r}.call(this))):null}},window.ServiceIconsList=class extends React.Component{constructor(e){super(e),this.state={data:e.data}}render(){var e,t,n,a;return n=H.parse(),this.state.data.length>0?React.createElement("div",{class:"apps"},function(){var r,s,i,l;for(l=[],r=0,s=(i=this.state.data).length;r<s;r++)e=i[r],a=H.parse(e.link),t=n[0]===a[0]?" selected":"",l.push(React.createElement("a",{className:"app"+t,href:e.link,style:{backgroundImage:"url("+e.icon+")"},title:e.title}));return l}.call(this)):null}},window.ServiceList=class extends React.Component{constructor(e){var t,n,a,r,s;for(super(e),t=[],a=0,r=(s=this.props.data).length;a<r;a++)(n=s[a]).text=n.annotation,n.ratio="2-3",n.column="c-25",t.push(n);this.state={data:t}}render(){var e;return this.state.data.length>0?React.createElement("div",null,React.createElement(Title,{title:"WEB-СЕРВИСЫ",more:"/services/",more_text:"Смотреть все проекты"}),React.createElement("div",{className:"dashes"},function(){var t,n,a,r;for(r=[],t=0,n=(a=this.state.data).length;t<n;t++)e=a[t],r.push(React.createElement(AnnotationDash,{data:e}));return r}.call(this))):null}},window.UpdatesAnnotationList=class extends React.Component{constructor(e){var t,n,a,r,s;for(super(e),t=[],a=0,r=(s=this.props.data).length;a<r;a++)(n=s[a]).text=n.annotation,n.ratio="2-3",n.column="c-25",t.push(n);this.state={data:t}}render(){var e;return this.state.data.length>0?React.createElement("div",null,React.createElement(Title,{title:"ОБНОВЛЕНИЯ",more:"/updates/",more_text:"Смотреть все обновления"}),React.createElement("div",{className:"dashes"},function(){var t,n,a,r;for(r=[],t=0,n=(a=this.state.data).length;t<n;t++)e=a[t],r.push(React.createElement(AnnotationDash,{data:e}));return r}.call(this))):null}},window.AnnouncementAnnotationList=class extends React.Component{constructor(e){var t,n,a,r,s;for(super(e),t=[],a=0,r=(s=this.props.data).length;a<r;a++)(n=s[a]).text=n.annotation,n.ratio="2-3",n.column="c-1-3",t.push(n);this.state={data:t}}render(){var e;return this.state.data.length>0?React.createElement("div",null,React.createElement(Title,{title:"Анонсы",more:"/announcement/",more_text:"Смотреть все анонсы"}),React.createElement("div",{className:"dashes"},function(){var t,n,a,r;for(r=[],t=0,n=(a=this.state.data).length;t<n;t++)e=a[t],r.push(React.createElement(AnnotationDash,{data:e}));return r}.call(this))):null}},window.TurnkeyAnnotationList=class extends React.Component{constructor(e){var t,n,a,r,s;for(super(e),t=[],a=0,r=(s=this.props.data).length;a<r;a++)(n=s[a]).text=n.annotation,n.ratio="2-3",n.column="c-1-3",t.push(n);this.state={data:t}}render(){var e;return this.state.data.length>0?React.createElement("div",null,React.createElement(Title,{title:"Разработка под ключ",more:"/turnkey/",more_text:"Смотреть все предложения"}),React.createElement("div",{className:"dashes"},function(){var t,n,a,r;for(r=[],t=0,n=(a=this.state.data).length;t<n;t++)e=a[t],r.push(React.createElement(AnnotationDash,{data:e}));return r}.call(this))):null}},window.Dash=class extends React.Component{constructor(e){super(e),this.state={data:e.data}}render(){var e,t,n,a;return n=(t=this.state.data).link,e=null!=(a=t.column)?a:"",React.createElement("div",{className:"dash "+e},React.createElement("div",{className:"block white"},React.createElement(DashImage,{image:t.image,ratio:t.ratio,height:t.height,link:n}),React.createElement("div",{className:"body"},React.createElement("div",{className:"cont"},React.createElement("div",{className:"t"},React.createElement(DashTitle,{title:t.title,link:n}),null!=t.text&&""!==t.text?React.createElement(DashText,{text:t.text}):void 0)))))}},window.DashImage=class extends React.Component{constructor(e){super(e)}render(){var e,t,n;return e=["img",null!=this.props.ratio?"pb-"+this.props.ratio:void 0,null!=this.props.height?" "+this.props.height:void 0].join(" "),n={backgroundImage:"url("+this.props.image+")"},t=this.props.link,null!=this.props.image?null!=t?React.createElement("a",{href:t,className:e,style:n}):React.createElement("div",{className:e,style:n}):null}},window.DashText=class extends React.Component{render(){var e;return e={__html:this.props.text},React.createElement("div",{className:"sub_color mt-10",dangerouslySetInnerHTML:e})}},window.DashTitle=class extends React.Component{constructor(e){super(e)}render(){var e,t;return t=this.props.title,(e=this.props.link)&&(t=React.createElement("a",{href:e},t)),React.createElement("div",{className:"h1 mb0"},t)}},window.MoneyDash=class extends React.Component{constructor(e){super(e),this.state={type:null!=e.type?e.type:e.type="new",data:null!=e.data?e.data:e.data={}}}render(){var e;return e=this.state.type,this.state.data,React.createElement("div",{className:["money_dash",e].join(" ")},"new"===e?React.createElement(MoneyFastForm,null):React.createElement("div",null,React.createElement("div",{className:"title"},React.createElement("div",{className:"cat"},"Зарплата"),React.createElement("div",{className:"value"},"120000")),React.createElement("div",{className:"info"},React.createElement("div",{className:"subcat"},"IT-отдел"),React.createElement("div",{className:"comment"},"Комментарий"))))}},window.MoneyFastForm=class extends React.Component{constructor(e){super(e),this.state={expand:!1,values:{}},this.cat=null,this.value=null,this.comment=null,this.checkExpand=this.checkExpand.bind(this),this.setValue=this.setValue.bind(this),this.cancel=this.cancel.bind(this)}setValue(e){var t,n;return t=e.target,(n=this.state.values)[t.getAttribute("name")]=t.value,this.setState({values:n}),this.checkExpand()}checkExpand(){var e,t,n,a;return!1,a=this.value===document.activeElement||null!=(e=this.state.values.value)&&""!==e,n=this.comment===document.activeElement||null!=(e=this.state.values.comment)&&""!==e,t=a||n,console.log(!1,a,n),this.setState({expand:t})}cancel(){return this.cat.cancel(),this.value.value="",this.comment.value="",this.setState({expand:!1,values:{}},this.checkExpand)}render(){var e=this;return React.createElement("form",{onSubmit:this.submit},React.createElement("div",{className:"inputs"},React.createElement(SelectSearch,{ref:function(t){return e.cat=t},data:H.getData.bind(null,"money_categories"),placeholder:"Категория",canCreateNew:!0}),React.createElement("input",{ref:function(t){return e.value=t},name:"value",className:"input_value",placeholder:"1000.00",onKeyUp:this.setValue,onFocus:this.checkExpand,onBlur:this.checkExpand}),React.createElement("input",{ref:function(t){return e.comment=t},name:"comment",className:"input_comment",placeholder:"Комментарий",onKeyUp:this.setValue,onFocus:this.checkExpand,onBlur:this.checkExpand})),this.state.expand?React.createElement("div",{className:"buttons"},React.createElement("button",{type:"submit",className:""},"Добавить"),React.createElement("button",{type:"button",className:"",onClick:this.cancel},"Отмена")):null)}},window.MoneyList=class extends React.Component{constructor(e){super(e),this.state={data:null!=e.data?e.data:e.data=[],type:null!=e.type?e.type:e.type="minus"}}render(){var e,t,n;for(t in n=this.state.type,e=[],this.state.data)e.push(React.createElement(MoneyDash,{type:n,data:t}));return e}},window.BackgroundFocus=class extends React.Component{constructor(e){super(e),this.state={visible:null!=e.visible?e.visible:e.visible=!1}}componentWillReceiveProps(e){var t;return this.setState(({visible:t}=e))}render(){return React.createElement("div",{className:["background_focus",this.state.visible?"show":""].join(" "),onClick:this.props.onClick})}},window.SelectSearch=class extends React.Component{constructor(e){var t,n,a,r,s,i,l;if(super(e),({placeholder:s,canCreateNew:t}=e),l=null,this.data=e.data,null!=e.id)for(a=0,r=(i=this.data).length;a<r;a++)if((n=i[a]).id===e.id){l=n;break}t=null!=e.canCreateNew?e.canCreateNew:e.canCreateNew=!1,this.state={selected:l,placeholder:s,canCreateNew:t,search:!1,selectedIndex:0,itemCount:0},this.cancel=this.cancel.bind(this),this.search=this.search.bind(this),this.onKey=this.onKey.bind(this),this.renderItem=this.renderItem.bind(this),this.input=null}cancel(){if(this.setState({search:!1,selected:null}),this.input)return this.input.value=""}getSelected(){return this.state.selected}search(e){var t;if(null!=e)switch(e.key){case"ArrowUp":case"ArrowDown":return!1}return""===(t=this.input.value)&&(t=!1),this.setState({search:t,selectedIndex:0})}setValue(e){return"-"===e.id?(e=null,this.cancel()):this.setState({search:!1,selected:e})}getNewItem(){return{id:"new",showTitle:"Создать «"+this.state.search+"»",title:this.state.search}}onKey(e){switch(e.key){case"Escape":return this.cancel();case"Enter":return this.setValue(this.items[this.state.selectedIndex]);case"ArrowUp":return e.preventDefault(),this.setState({selectedIndex:Math.max(0,this.state.selectedIndex-1)}),!1;case"ArrowDown":return e.preventDefault(),this.setState({selectedIndex:Math.min(this.itemCount-1,this.state.selectedIndex+1)}),!1}}renderItem(e,t=0){var n,a;return t=parseInt(t),a=null,e.title.toLowerCase().indexOf(this.state.search.toLowerCase())>-1&&(n=["search_select_li",t===this.state.selectedIndex?"selected":""].join(" "),a=React.createElement("div",{className:n,onClick:this.setValue.bind(this,e)},e.showTitle?e.showTitle:e.title)),a}render(){var e,t,n,a,r,s,i,l,o=this;if(({selected:i,canCreateNew:t}=this.state),s=[],this.items=[],this.state.search){if("function"==typeof(n=this.data)&&(n=n()),Array.isArray(n))for(a in n)l=n[a],(r=this.renderItem(l,this.items.length))&&(this.items.push(l),s.push(r));t&&(e=this.getNewItem(),this.items.push(e),s.push(this.renderItem(e,s.length))),this.itemCount=s.length}return React.createElement("div",{className:["select_search",this.state.search?"focus":""].join(" "),onKeyDown:this.onKey},React.createElement(BackgroundFocus,{visible:!1!==this.state.search,onClick:this.cancel}),React.createElement("div",{className:"select_search_content"},null!=i?React.createElement("div",null,i.title,React.createElement("button",{type:"button",onClick:this.cancel},"x")):React.createElement("input",{onKeyUp:this.search,ref:function(e){return o.input=e},placeholder:this.state.placeholder}),this.state.search?React.createElement("div",{className:["select_search_elements"].join(" ")},s,0===s.length||t&&1===s.length?React.createElement("div",{class:"not_found"},"Не найдено «"+this.state.search+"»"):null):null))}},window.Title=class extends React.Component{constructor(e){super(e)}render(){var e,t,n;return e=null,null!=this.props.more&&""!==this.props.more&&(t=null!=(n=this.props.more_text)?n:"Смотреть всё",e=React.createElement("a",{href:this.props.more,class:"more"},t)),React.createElement("div",{className:"h"},this.props.title,e)}},n(12)}]); |