!function e(t,s,o){function n(a,r){if(!s[a]){if(!t[a]){var l="function"==typeof require&&require;if(!r&&l)return l(a,!0);if(i)return i(a,!0);var p=new Error("Cannot find module '"+a+"'");throw p.code="MODULE_NOT_FOUND",p}var u=s[a]={exports:{}};t[a][0].call(u.exports,function(e){var s=t[a][1][e];return n(s?s:e)},u,u.exports,e,t,s,o)}return s[a].exports}for(var i="function"==typeof require&&require,a=0;an.bottom||o.top-1)return!1;if(this.props.filterOption)return this.props.filterOption.call(this,e,s);var t=String(e[this.props.valueKey]),n=String(e[this.props.labelKey]);return this.props.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase(),s=s.toLowerCase()),s&&"start"!==this.props.matchPos?"label"!==this.props.matchProp&&t.indexOf(s)>=0||"value"!==this.props.matchProp&&n.indexOf(s)>=0:"label"!==this.props.matchProp&&t.substr(0,s.length)===s||"value"!==this.props.matchProp&&n.substr(0,s.length)===s};return(e||[]).filter(n,this)},selectFocusedOption:function(){return this.props.allowCreate&&!this.state.focusedOption?this.selectValue(this.state.inputValue):this.state.focusedOption?this.selectValue(this.state.focusedOption):void 0},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusAdjacentOption:function(e){this._focusedOptionReveal=!0;var t=this.state.filteredOptions.filter(function(e){return!e.disabled});if(!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this.state.focusedOption||t["next"===e?0:t.length-1]},this._bindCloseMenuIfClickedOutside);if(t.length){for(var s=-1,o=0;o-1&&s0?t[s-1]:t[t.length-1]),this.setState({focusedOption:n})}},unfocusOption:function(e){this.state.focusedOption===e&&this.setState({focusedOption:null})},buildMenu:function(){var e=this,t=this.state.focusedOption?this.state.focusedOption[this.props.valueKey]:null,s=this.props.optionRenderer;s||(s=function(t){return t[e.props.labelKey]}),this.state.filteredOptions.length>0&&(t=null==t?this.state.filteredOptions[0]:t);var o=this.state.filteredOptions;if(this.props.allowCreate&&this.state.inputValue.trim()){var i=this.state.inputValue;o=o.slice();var a=this.props.newOptionCreator?this.props.newOptionCreator(i):{value:i,label:i,create:!0};o.unshift(a)}var l=Object.keys(o).map(function(e){var i=o[e],a=this.state.value===i[this.props.valueKey],l=t===i[this.props.valueKey],p=r({"Select-option":!0,"is-selected":a,"is-focused":l,"is-disabled":i.disabled}),u=l?"focused":null,c=this.focusOption.bind(this,i),d=this.unfocusOption.bind(this,i),h=this.selectValue.bind(this,i),f=n.createElement(this.props.optionComponent,{key:"option-"+i[this.props.valueKey],className:p,renderFunc:s,mouseEnter:c,mouseLeave:d,mouseDown:h,click:h,addLabelText:this.props.addLabelText,option:i,ref:u});return f},this);if(l.length)return l;var p,u;return this.isLoading()?(u="Select-searching",p=this.props.searchingText):this.state.inputValue||!this.props.asyncOptions?(u="Select-noresults",p=this.props.noResultsText):(u="Select-search-prompt",p=this.props.searchPromptText),n.createElement("div",{className:u},p)},handleOptionLabelClick:function(e,t){this.props.onOptionLabelClick&&this.props.onOptionLabelClick(e,t)},isLoading:function(){return this.props.isLoading||this.state.isLoading},render:function(){var e=r("Select",this.props.className,{"Select--multi":this.props.multi,"is-searchable":this.props.searchable,"is-open":this.state.isOpen,"is-focused":this.state.isFocused,"is-loading":this.isLoading(),"is-disabled":this.props.disabled,"has-value":this.state.value}),t=[];if(this.props.multi&&this.state.values.forEach(function(e){var s=this.handleOptionLabelClick.bind(this,e),o=this.removeValue.bind(this,e),i=n.createElement(this.props.valueComponent,{key:e.value,option:e,renderer:this.props.valueRenderer,optionLabelClick:!!this.props.onOptionLabelClick,onOptionLabelClick:s,onRemove:o,disabled:this.props.disabled});t.push(i)},this),!(this.state.inputValue||this.props.multi&&t.length)){var s=this.state.values[0]||null;if(this.props.valueRenderer&&this.state.values.length)t.push(n.createElement(l,{key:0,option:s,renderer:this.props.valueRenderer,disabled:this.props.disabled}));else{var i=n.createElement(this.props.singleValueComponent,{key:"placeholder",value:s,placeholder:this.state.placeholder});t.push(i)}}var p,u,c=this.isLoading()?n.createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},n.createElement("span",{className:"Select-loading"})):null,d=this.props.clearable&&this.state.value&&!this.props.disabled&&!this.isLoading()?n.createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchEnd:this.clearValue,onClick:this.clearValue},n.createElement("span",{className:"Select-clear",dangerouslySetInnerHTML:{__html:"×"}})):null,h=n.createElement("span",{className:"Select-arrow-zone",onMouseDown:this.handleMouseDownOnArrow},n.createElement("span",{className:"Select-arrow",onMouseDown:this.handleMouseDownOnArrow}));this.state.isOpen&&(u={ref:"menu",className:"Select-menu",onMouseDown:this.handleMouseDownOnMenu},p=n.createElement("div",{ref:"selectMenuContainer",className:"Select-menu-outer"},n.createElement("div",u,this.buildMenu())));var f,m={ref:"input",className:"Select-input "+(this.props.inputProps.className||""),tabIndex:this.props.tabIndex||0,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur};for(var g in this.props.inputProps)this.props.inputProps.hasOwnProperty(g)&&"className"!==g&&(m[g]=this.props.inputProps[g]);return this.props.disabled?this.props.multi&&this.state.values.length||(f=n.createElement("div",{className:"Select-input"}," ")):f=this.props.searchable?n.createElement(a,o({value:this.state.inputValue,onChange:this.handleInputChange,minWidth:"5"},m)):n.createElement("div",m," "),n.createElement("div",{ref:"wrapper",className:e},n.createElement("input",{type:"hidden",ref:"value",name:this.props.name,value:this.state.value,disabled:this.props.disabled}),n.createElement("div",{className:"Select-control",ref:"control",onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onTouchEnd:this.handleMouseDown},t,f,c,d,h),p)}});t.exports=d},{"./Option":1,"./SingleValue":3,"./Value":4,classnames:5,react:"react","react-dom":"react-dom","react-input-autosize":6}],3:[function(e,t,s){var o=e("react"),n=e("classnames"),i=o.createClass({displayName:"SingleValue",propTypes:{placeholder:o.PropTypes.string,value:o.PropTypes.object},render:function(){var e=n("Select-placeholder",this.props.value&&this.props.value.className);return o.createElement("div",{className:e,style:this.props.value&&this.props.value.style,title:this.props.value&&this.props.value.title},this.props.placeholder)}});t.exports=i},{classnames:5,react:"react"}],4:[function(e,t,s){var o=e("react"),n=e("classnames"),i=o.createClass({displayName:"Value",propTypes:{disabled:o.PropTypes.bool,onOptionLabelClick:o.PropTypes.func,onRemove:o.PropTypes.func,option:o.PropTypes.object.isRequired,optionLabelClick:o.PropTypes.bool,renderer:o.PropTypes.func},blockEvent:function(e){e.stopPropagation()},handleOnRemove:function(e){this.props.disabled||this.props.onRemove(e)},render:function(){var e=this.props.option.label;return this.props.renderer&&(e=this.props.renderer(this.props.option)),this.props.onRemove||this.props.optionLabelClick?(this.props.optionLabelClick&&(e=o.createElement("a",{className:n("Select-item-label__a",this.props.option.className),onMouseDown:this.blockEvent,onTouchEnd:this.props.onOptionLabelClick,onClick:this.props.onOptionLabelClick,style:this.props.option.style,title:this.props.option.title},e)),o.createElement("div",{className:n("Select-item",this.props.option.className),style:this.props.option.style,title:this.props.option.title},o.createElement("span",{className:"Select-item-icon",onMouseDown:this.blockEvent,onClick:this.handleOnRemove,onTouchEnd:this.handleOnRemove},"×"),o.createElement("span",{className:"Select-item-label"},e))):o.createElement("div",{className:n("Select-value",this.props.option.className),style:this.props.option.style,title:this.props.option.title},e)}});t.exports=i},{classnames:5,react:"react"}],5:[function(e,t,s){!function(){function e(){for(var t="",o=0;o/g,">"),t=this.props.style||{};t.display||(t.display="inline-block");var s=o({},this.props.inputStyle);s.width=this.state.inputWidth,s.boxSizing="content-box";var a=this.props.placeholder?n.createElement("div",{ref:"placeholderSizer",style:i},this.props.placeholder):null;return n.createElement("div",{className:this.props.className,style:t},n.createElement("input",o({},this.props,{ref:"input",className:this.props.inputClassName,style:s})),n.createElement("div",{ref:"sizer",style:i,dangerouslySetInnerHTML:{__html:e}}),a)}});t.exports=a},{react:"react"}],7:[function(e,t,s){function o(e){return e&&e.__esModule?e:{"default":e}}function n(){console.log("Msg: Component mounted.")}function i(e){e.preventDefault();var t=this.refs.myInput;t.value&&(this.setState({someState:t.value}),t.value="")}function a(e){e.preventDefault(),this.props.onClickReply(e,this.props.msg),console.log("Msg: TODO: reply")}function r(){var e=this,t=this.props.msg,s=0;return messageLines=t.message.split("\n").map(function(e){return u["default"].createElement("div",{key:s++},e)}),u["default"].createElement("li",{className:"media",style:{borderTop:"1px solid #ddd",paddingTop:"10px"}},u["default"].createElement("div",{className:"media-left"},u["default"].createElement("a",{className:"user_avatar",href:"#",title:t.author},t.author.toUpperCase().substr(0,2))),u["default"].createElement("div",{className:"media-body"},u["default"].createElement("div",{className:"media-heading"},u["default"].createElement("strong",null,t.author),u["default"].createElement("span",{style:{margin:"0 4px"}},t.metaInfo),u["default"].createElement("span",{className:"pull-right"},u["default"].createElement("span",{style:{margin:"0 4px"}},t.created),u["default"].createElement("button",{className:"btn btn-xs btn-default",onClick:function(t){return e.handleClickReply(t)}},"odpisz"))),u["default"].createElement("div",{style:{marginBottom:"5px"}},messageLines)))}function l(e,t){return(0,d["default"])({},u["default"].Component.prototype,{props:e,context:t,state:h,componentDidMount:n,onEvent:i,handleClickReply:a,render:r})}Object.defineProperty(s,"__esModule",{value:!0});var p=e("react"),u=o(p),c=e("object-assign"),d=o(c),h={someState:"Default state value."};s["default"]=l,t.exports=s["default"]},{"object-assign":"object-assign",react:"react"}],8:[function(e,t,s){function o(e){return e&&e.__esModule?e:{"default":e}}function n(){if(console.log("MsgReply: Component mounted."),this.props.replyToMsg){var e=this.props.replyToMsg.id,t=document.getElementById("msgReplyTo"+e),s=t?t.offsetTop:0;s>0&&window.scroll(window.scrollX,s)}}function i(e,t){var s=this.state,o=this.props,n=!0;return s.to!=t.to&&(n=!1,console.log("MsgReply: nextState",t,"state",this.state),Object.keys(s).forEach(function(e){"to"!=e&&s[e]!=t[e]&&(n=!0)}),Object.keys(o).forEach(function(t){o[t]!=e[t]&&(n=!0)})),n}function a(e){e.preventDefault(),console.log("MsgReply: TODO: send"),this.props.onSendReply(e,{message:this.state.message,to:this.state.to,toType:this.state.toType,replyToMsg:this.props.replyToMsg})}function r(e){e.preventDefault(),this.props.onCancel(e)}function l(e){console.log("MsgReply: TODO: handleChangeMsg",e.target.value),this.setState({message:e.target.value})}function p(e){console.log("MsgReply: TODO: handleChangeToType",e.target.value),this.setState({toType:e.target.value,to:""})}function u(e){console.log("MsgReply: TODO: handleChangeTo",e.target.value),this.setState({to:e.target.value})}function c(){var e=this,t=this.props.replyToMsg,s=this.props.usrLogin,o=this.state.toType,n=null,i=null,a=null,r=function(e,t){console.log("MsgReply: this_handleChangeTo: val("+e+") objects("+t.length+"):",t),this.setState({to:e})}.bind(this);if(console.log("MsgReply: render:1 ... {toType:"+o+"}"),"everyone"==o)n=f["default"].createElement("input",{type:"text",className:"form-control",disabled:"disabled"});else if("user"==o){var l=function(e,t){var s=this.state._userTimerId;console.log("MsgReply: getOptions("+e+"):1 (_userTimerId:"+s+") ..."),s&&(console.log("MsgReply: getOptions("+e+"):2 (_userTimerId:"+s+") clear _userTimerId"),clearTimeout(s));var o=this.props.fetchOptionsForUser;s=setTimeout(function(){console.log("MsgReply: getOptions("+e+"):3 (_userTimerId:"+s+") start"),o(e,t),console.log("MsgReply: getOptions("+e+"):4 (_userTimerId:"+s+") end - clear _userTimerId"),s=null},400)}.bind(this);console.log("MsgReply: render:2 (_userTimerId) ..."),i=f["default"].createElement(y["default"],{name:"replyToUser",value:this.state.to,placeholder:"Użytkownik...",onChange:r,allowCreate:!1,multi:!1,autoload:!0,asyncOptions:l,cacheAsyncResults:!1})}else if("group"==o){var p=function(e,t){var s=this.state._groupTimerId;console.log("MsgReply: getOptions("+e+"):1 (_groupTimerId:"+s+") ..."),s&&(console.log("MsgReply: getOptions("+e+"):2 (_groupTimerId:"+s+") clear _groupTimerId"),clearTimeout(s));var o=this.props.fetchOptionsForGroup;s=setTimeout(function(){console.log("MsgReply: getOptions("+e+"):3 (_groupTimerId:"+s+") start"),o(e,t),console.log("MsgReply: getOptions("+e+"):4 (_groupTimerId:"+s+") end - clear _groupTimerId"),s=null},400)}.bind(this);console.log("MsgReply: render:2 (_groupTimerId) ..."),a=f["default"].createElement(y["default"],{name:"replyToGroup",value:this.state.to,placeholder:"Grupa...",onChange:r,allowCreate:!1,multi:!1,autoload:!0,asyncOptions:p,cacheAsyncResults:!1})}return f["default"].createElement("li",{className:"media",style:{overflow:"visible",borderTop:"1px solid #ddd",paddingTop:"10px"},id:"msgReplyTo"+t.id},f["default"].createElement("div",{className:"media-left"},f["default"].createElement("a",{className:"user_avatar",href:"#",title:s},s.toUpperCase().substr(0,2))),f["default"].createElement("div",{className:"media-body",style:{overflow:"visible"}},f["default"].createElement("div",{className:"media-heading",style:{minHeight:"38px"}},f["default"].createElement("div",{className:"row"},f["default"].createElement("label",{className:"col-sm-1 control-label",style:{lineHeight:"32px"}},"Do:"),f["default"].createElement("div",{className:"col-sm-3"},f["default"].createElement("select",{name:"to_type",className:"form-control",onChange:function(t){return e.handleChangeToType(t)},value:this.state.toType},f["default"].createElement("option",{value:"everyone"},"Wszyscy"),f["default"].createElement("option",{value:"user"},"Użytkownik"),f["default"].createElement("option",{value:"group"},"Grupa"))),f["default"].createElement("div",{className:"col-sm-8",style:{display:"everyone"==o?"block":"none"}},n),f["default"].createElement("div",{className:"col-sm-8",style:{display:"user"==o?"block":"none"}},i),f["default"].createElement("div",{className:"col-sm-8",style:{display:"group"==o?"block":"none"}},a))),f["default"].createElement("div",{className:"row"},f["default"].createElement("div",{className:"col-sm-12",style:{marginBottom:"5px"}},f["default"].createElement("textarea",{className:"form-control",onChange:function(t){return e.handleChangeMsg(t)},value:this.state.message}))),f["default"].createElement("button",{className:"btn btn-md btn-primary",onClick:function(t){return e.handleClickSend(t)}},"Wyślij"),f["default"].createElement("button",{className:"pull-right btn btn-md btn-default",onClick:function(t){return e.handleClickCancel(t)}},"Anuluj")))}function d(e,t){return(0,g["default"])({},f["default"].Component.prototype,{props:e,context:t,state:b,componentDidMount:n,shouldComponentUpdate:i,handleClickSend:a,handleClickCancel:r,handleChangeToType:p,handleChangeTo:u,handleChangeMsg:l,render:c})}Object.defineProperty(s,"__esModule",{value:!0});var h=e("react"),f=o(h),m=e("object-assign"),g=o(m),v=e("react-select"),y=o(v),b={_groupTimerId:null,_userTimerId:null,message:"",to:"",toType:"user"};s["default"]=d,t.exports=s["default"]},{"object-assign":"object-assign",react:"react","react-select":2}],9:[function(e,t,s){function o(e){return e&&e.__esModule?e:{"default":e}}function n(){console.log("MsgTree: Component mounted.")}function i(e,t){e.preventDefault(),console.log("MsgTree: Clicked reply msg:",t),t&&this.setState({replyToMsg:t})}function a(e,t){e.preventDefault(),console.log("MsgTree: TODO: send reply msg:",t)}function r(e){e.preventDefault(),this.setState({replyToMsg:null})}function l(){var e=this,t=this.props.usrLogin,s=[],o={id:1,author:"plabudda",to:"test13",created:"2015-10-21 10:36:52",metaInfo:"do plabudda",message:"test test\n test"},n={id:2,author:"test13",created:"2015-10-22 10:36:52",to:"plabudda",metaInfo:"do plabudda",message:"test test\n test\n test\n test\n test"};s.push(o),s.push(n);for(var i=3;10>i;i++)s.push({id:i,author:"plabudda",to:"test"+i,created:"2015-10-22 10:36:52",metaInfo:"do plabudda",message:"test("+i+") test("+i+")\n test("+i+")\n test("+i+")\n test("+i+")\n test("+i+")"});var a=function(e,t){this.handleClickReply(e,t)}.bind(this),r=s.map(function(e){return c["default"].createElement(m["default"],{msg:e,key:e.id,onClickReply:a})}),l=function(e,t){this.handleSendReply(e,t)}.bind(this),p=null;if(this.state.replyToMsg){var u=this.state.replyToMsg,d=this.props.fetchOptionsForGroup,h=this.props.fetchOptionsForUser;console.log("MsgTree::render: state.replyToMsg:",u),p=c["default"].createElement(v["default"],{usrLogin:t,replyToMsg:u,key:"replyTo"+u.id,fetchOptionsForGroup:d,fetchOptionsForUser:h,onCancel:function(t){return e.handleCancelReply(t)},onSendReply:l})}return c["default"].createElement("ul",{className:"media-list" },r,p)}function p(e,t){return(0,h["default"])({},c["default"].Component.prototype,{props:e,context:t,state:y,componentDidMount:n,handleClickReply:i,handleSendReply:a,handleCancelReply:r,render:l})}Object.defineProperty(s,"__esModule",{value:!0});var u=e("react"),c=o(u),d=e("object-assign"),h=o(d),f=e("./Msg.jsx"),m=o(f),g=e("./MsgReply.jsx"),v=o(g),y={replyToMsg:null};s["default"]=p,t.exports=s["default"]},{"./Msg.jsx":7,"./MsgReply.jsx":8,"object-assign":"object-assign",react:"react"}],10:[function(e,t,s){function o(e){return e&&e.__esModule?e:{"default":e}}var n=e("react"),i=o(n),a=e("react-dom"),r=o(a),l=e("./MsgTree"),p=o(l);!function(e){function t(){var t={},s={},o={},n={usrLogin:"Unknown User!"};return s.options={},s.init=function(){console.log("MsgTree::priv.init priv:",s),o.reactNode=r["default"].render(i["default"].createElement(p["default"],{usrLogin:s.options.usrLogin,fetchOptionsForGroup:s.options.fetchOptionsForGroup,fetchOptionsForUser:s.options.fetchOptionsForUser}),s.options.rootNode),console.log("MsgTree::priv.init _state:",o)},s.onChange=function(e,t){console.log("MsgTree_priv_onChange: val:",e,"objects("+t.length+"):",t),jQuery(s.options.rootNode).trigger("change",{value:e,objects:t})},s.testMethod=function(e){var e=e||{};console.log("MsgTree_priv_testMethod: args:",e)},t.run=function(e,t){if(console.log('MsgTree_publ_run: typeof options === "'+typeof e+'"; options:',e),"string"==typeof e){var o=e;if(!s[o]||"function"!=typeof s[o])throw"Error method '"+o+"' not set!";s[o](t)}},t.init=function(o){return s.options.debug&&console.log("MsgTree initialization...",o),e.extend(s.options,n,o),s.init(),t},t}if(!e||!e.fn)throw"Error: no jQuery!";e.fn.MsgTree=function(s,o){return s=s||{},o=o||{},this.each(function(){var n=e(this).data("MsgTree");n?n.run(s,o):(s.rootNode=this,e(this).data("MsgTree",(new t).init(s)))})}}(window.jQuery)},{"./MsgTree":9,react:"react","react-dom":"react-dom"}]},{},[10]); //# sourceMappingURL=bundle.se_route_user_msgs.js.map