text: /*
  * Kendo UI v2015.3.1111 (http://www.telerik.com/kendo-ui)
  * Copyright 2015 Telerik AD. All rights reserved.
  *
  * Kendo UI commercial licenses may be obtained at
  * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
  * If you do not own a commercial license, this file shall be governed by the trial license terms.
  */
  !function(e,define){define(["./kendo.listview.min","./kendo.dropdownlist.min","./kendo.upload.min"],e)}(function(){return function(e,t){function n(e,t,n){var i,o;e.on("dragenter"+k,function(){t(),o=new Date,i||(i=setInterval(function(){var e=new Date-o;e>100&&(n(),clearInterval(i),i=null)},100))}).on("dragover"+k,function(){o=new Date})}function i(e,n){return e!==t&&e.match(/\/$/)||(e=(e||"")+"/"),e+n}function o(e){if(!e)return"";var t=" bytes";return e>=1073741824?(t=" GB",e/=1073741824):e>=1048576?(t=" MB",e/=1048576):e>=1024&&(t=" KB",e/=1024),Math.round(100*e)/100+t}function r(e,t){var n=e[t];return d(n)?n.from||n.field||t:n}var s,a,l,c,h=window.kendo,u=h.ui.Widget,d=e.isPlainObject,f=e.proxy,p=e.extend,g=h.support.placeholder,m=h.support.browser,v=h.isFunction,_=/(^\/|\/$)/g,w="change",y="apply",b="error",x="click",k=".kendoFileBrowser",C=".kendoBreadcrumbs",S=".kendoSearchBox",T="name",A="size",D="type",M={field:D,dir:"asc"},E=h.template('<li class="k-tile-empty"><strong>${text}</strong></li>'),P='<div class="k-widget k-filebrowser-toolbar k-header k-floatwrap"><div class="k-toolbar-wrap"># if (showUpload) { # <div class="k-widget k-upload"><div class="k-button k-button-icontext k-upload-button"><span class="k-icon k-add"></span>#=messages.uploadFile#<input type="file" name="file" /></div></div># } ## if (showCreate) { #<button type="button" class="k-button k-button-icon"><span class="k-icon k-addfolder" /></button># } ## if (showDelete) { #<button type="button" class="k-button k-button-icon k-state-disabled"><span class="k-icon k-delete" /></button>&nbsp;# } #</div><div class="k-tiles-arrange"><label>#=messages.orderBy#: <select /></label></a></div></div>';p(!0,h.data,{schemas:{filebrowser:{data:function(e){return e.items||e||[]},model:{id:"name",fields:{name:"name",size:"size",type:"type"}}}}}),p(!0,h.data,{transports:{filebrowser:h.data.RemoteTransport.extend({init:function(t){h.data.RemoteTransport.fn.init.call(this,e.extend(!0,{},this.options,t))},_call:function(t,n){n.data=e.extend({},n.data,{path:this.options.path()}),v(this.options[t])?this.options[t].call(this,n):h.data.RemoteTransport.fn[t].call(this,n)},read:function(e){this._call("read",e)},create:function(e){this._call("create",e)},destroy:function(e){this._call("destroy",e)},update:function(){},options:{read:{type:"POST"},update:{type:"POST"},create:{type:"POST"},destroy:{type:"POST"}}})}}),s=m.msie&&8>m.version?function(e){return e.offsetTop}:function(t){return t.offsetTop-e(t).height()},a=u.extend({init:function(e,t){var n=this;t=t||{},u.fn.init.call(n,e,t),n.element.addClass("k-filebrowser"),n.element.on(x+k,".k-filebrowser-toolbar button:not(.k-state-disabled):has(.k-delete)",f(n._deleteClick,n)).on(x+k,".k-filebrowser-toolbar button:not(.k-state-disabled):has(.k-addfolder)",f(n._addClick,n)).on("keydown"+k,"li.k-state-selected input",f(n._directoryKeyDown,n)).on("blur"+k,"li.k-state-selected input",f(n._directoryBlur,n)),n._dataSource(),n.refresh(),n.path(n.options.path)},options:{name:"FileBrowser",messages:{uploadFile:"Upload",orderBy:"Arrange by",orderByName:"Name",orderBySize:"Size",directoryNotFound:"A directory with this name was not found.",emptyFolder:"Empty Folder",deleteFile:'Are you sure you want to delete "{0}"?',invalidFileType:'The selected file "{0}" is not valid. Supported file types are {1}.',overwriteFile:'A file with name "{0}" already exists in the current directory. Do you want to overwrite it?',dropFilesHere:"drop file here to upload",search:"Search"},transport:{},path:"/",fileTypes:"*.*"},events:[b,w,y],destroy:function(){var e=this;u.fn.destroy.call(e),e.dataSource.unbind(b,e._errorHandler),e.element.add(e.list).add(e.toolbar).off(k),h.destroy(e.element)},value:function(){var e,n=this,o=n._selectedItem(),r=n.options.transport.fileUrl;return o&&"f"===o.get(D)?(e=i(n.path(),o.get(T)).replace(_,""),r&&(e=v(r)?r(e):h.format(r,encodeURIComponent(e))),e):t},_selectedItem:function(){var e=this.listView,n=e.select();return n.length?this.dataSource.getByUid(n.attr(h.attr("uid"))):t},_toolbar:function(){var t=this,n=h.template(P),i=t.options.messages,o=[{text:i.orderByName,value:"name"},{text:i.orderBySize,value:"size"}];t.toolbar=e(n({messages:i,showUpload:t.options.transport.uploadUrl,showCreate:t.options.transport.create,showDelete:t.options.transport.destroy})).appendTo(t.element).find(".k-upload input").kendoUpload({multiple:!1,localization:{dropFilesHere:i.dropFilesHere},async:{saveUrl:t.options.transport.uploadUrl,autoUpload:!0},upload:f(t._fileUpload,t),error:function(e){t._error({xhr:e.XMLHttpRequest,status:"error"})}}).end(),t.upload=t.toolbar.find(".k-upload input").data("kendoUpload"),t.arrangeBy=t.toolbar.find(".k-tiles-arrange select").kendoDropDownList({dataSource:o,dataTextField:"text",dataValueField:"value",change:function(){t.orderBy(this.value())}}).data("kendoDropDownList"),t._attachDropzoneEvents()},_attachDropzoneEvents:function(){var t=this;t.options.transport.uploadUrl&&(n(e(document.documentElement),e.proxy(t._dropEnter,t),e.proxy(t._dropLeave,t)),t._scrollHandler=f(t._positionDropzone,t))},_dropEnter:function(){this._positionDropzone(),e(document).on("scroll"+k,this._scrollHandler)},_dropLeave:function(){this._removeDropzone(),e(document).off("scroll"+k,this._scrollHandler)},_positionDropzone:function(){var e=this,t=e.element,n=t.offset();e.toolbar.find(".k-dropzone").addClass("k-filebrowser-dropzone").offset(n).css({width:t[0].clientWidth,height:t[0].clientHeight,lineHeight:t[0].clientHeight+"px"})},_removeDropzone:function(){this.toolbar.find(".k-dropzone").removeClass("k-filebrowser-dropzone").css({width:"",height:"",lineHeight:"",top:"",left:""})},_deleteClick:function(){var e=this,t=e.listView.select(),n=h.format(e.options.messages.deleteFile,t.find("strong").text());t.length&&e._showMessage(n,"confirm")&&e.listView.remove(t)},_addClick:function(){this.createDirectory()},_getFieldName:function(e){return r(this.dataSource.reader.model.fields,e)},_fileUpload:function(e){var t,n=this,i=n.options,o=i.fileTypes,r=RegExp(("("+o.split(",").join(")|(")+")").replace(/\*\./g,".*."),"i"),s=e.files[0].name,a=T,l=A;r.test(s)?(e.data={path:n.path()},t=n._createFile(s),t?n.upload.one("success",function(e){t.set(a,e.response[n._getFieldName(a)]),t.set(l,e.response[n._getFieldName(l)]),n._tiles=n.listView.items().filter("["+h.attr("type")+"=f]")}):e.preventDefault()):(e.preventDefault(),n._showMessage(h.format(i.messages.invalidFileType,s,o)))},_findFile:function(e){var t,n,i,o=this.dataSource.data(),r=D,s=T;for(e=e.toLowerCase(),t=0,i=o.length;i>t;t++)if("f"===o[t].get(r)&&o[t].get(s).toLowerCase()===e){n=o[t];break}return n},_createFile:function(e){var t,n,i=this,o=0,r={},s=D,a=i.dataSource.view(),l=i._findFile(e);if(l&&!i._showMessage(h.format(i.options.messages.overwriteFile,e),"confirm"))return null;if(l)return l;for(t=0,n=a.length;n>t;t++)if("f"===a[t].get(s)){o=t;break}return r[s]="f",r[T]=e,r[A]=0,i.dataSource.insert(++o,r)},createDirectory:function(){var e,t,n=this,i=0,o=D,r=T,s=n.dataSource.data(),a=n._nameDirectory(),l=new n.dataSource.reader.model;for(e=0,t=s.length;t>e;e++)"d"===s[e].get(o)&&(i=e);l.set(o,"d"),l.set(r,a),n.listView.one("dataBound",function(){var e=n.listView.items().filter("["+h.attr("uid")+"="+l.uid+"]"),t=e.find("input");e.length&&this.edit(e),this.element.scrollTop(e.attr("offsetTop")-this.element[0].offsetHeight),setTimeout(function(){t.select()})}).one("save",function(e){var t=e.model.get(r);t?e.model.set(r,n._nameExists(t,l.uid)?n._nameDirectory():t):e.model.set(r,a)}),n.dataSource.insert(++i,l)},_directoryKeyDown:function(e){13==e.keyCode&&e.currentTarget.blur()},_directoryBlur:function(){this.listView.save()},_nameExists:function(e,t){var n,i,o=this.dataSource.data(),r=D,s=T;for(n=0,i=o.length;i>n;n++)if("d"===o[n].get(r)&&o[n].get(s).toLowerCase()===e.toLowerCase()&&o[n].uid!==t)return!0;return!1},_nameDirectory:function(){var t,n,i,o="New folder",r=this.dataSource.data(),s=[],a=D,l=T;for(n=0,i=r.length;i>n;n++)"d"===r[n].get(a)&&r[n].get(l).toLowerCase().indexOf(o.toLowerCase())>-1&&s.push(r[n].get(l));if(e.inArray(o,s)>-1){n=2;do t=o+" ("+n+")",n++;while(e.inArray(t,s)>-1);o=t}return o},orderBy:function(e){this.dataSource.sort([{field:D,dir:"asc"},{field:e,dir:"asc"}])},search:function(e){this.dataSource.filter({field:T,operator:"contains",value:e})},_content:function(){var t=this;t.list=e('<ul class="k-reset k-floats k-tiles" />').appendTo(t.element).on("dblclick"+k,"li",f(t._dblClick,t)),t.listView=new h.ui.ListView(t.list,{dataSource:t.dataSource,template:t._itemTmpl(),editTemplate:t._editTmpl(),selectable:!0,autoBind:!1,dataBinding:function(e){t.toolbar.find(".k-delete").parent().addClass("k-state-disabled"),("remove"===e.action||"sync"===e.action)&&e.preventDefault()},dataBound:function(){t.dataSource.view().length?t._tiles=this.items().filter("["+h.attr("type")+"=f]"):this.wrapper.append(E({text:t.options.messages.emptyFolder}))},change:f(t._listViewChange,t)})},_dblClick:function(t){var n,o=this,r=e(t.currentTarget);r.hasClass("k-edit-item")&&o._directoryBlur(),r.filter("["+h.attr("type")+"=d]").length?(n=o.dataSource.getByUid(r.attr(h.attr("uid"))),n&&(o.path(i(o.path(),n.get(T))),o.breadcrumbs.value(o.path()))):r.filter("["+h.attr("type")+"=f]").length&&o.trigger(y)},_listViewChange:function(){var e=this._selectedItem();e&&(this.toolbar.find(".k-delete").parent().removeClass("k-state-disabled"),"f"===e.get(D)&&this.trigger(w))},_dataSource:function(){var e,t=this,n=t.options,i=n.transport,o=p({},M),r={field:T,dir:"asc"},s={type:i.type||"filebrowser",sort:[o,r]};d(i)&&(i.path=f(t.path,t),s.transport=i),d(n.schema)?s.schema=n.schema:i.type&&d(h.data.schemas[i.type])&&(e=h.data.schemas[i.type]),t.dataSource&&t._errorHandler?t.dataSource.unbind(b,t._errorHandler):t._errorHandler=f(t._error,t),t.dataSource=h.data.DataSource.create(s).bind(b,t._errorHandler)},_navigation:function(){var t=this,n=e('<div class="k-floatwrap"><input/><input/></div>').appendTo(this.element);t.breadcrumbs=n.find("input:first").kendoBreadcrumbs({value:t.options.path,change:function(){t.path(this.value())}}).data("kendoBreadcrumbs"),t.searchBox=n.parent().find("input:last").kendoSearchBox({label:t.options.messages.search,change:function(){t.search(this.value())}}).data("kendoSearchBox")},_error:function(e){var t,n=this;n.trigger(b,e)||(t=e.xhr.status,"error"==e.status?"404"==t?n._showMessage(n.options.messages.directoryNotFound):"0"!=t&&n._showMessage("Error! The requested URL returned "+t+" - "+e.xhr.statusText):"timeout"==t&&n._showMessage("Error! Server timeout."))},_showMessage:function(e,t){return window[t||"alert"](e)},refresh:function(){var e=this;e._navigation(),e._toolbar(),e._content()},_editTmpl:function(){var e='<li class="k-tile k-state-selected" '+h.attr("uid")+'="#=uid#" ';return e+=h.attr("type")+'="${'+D+'}">',e+="#if("+D+' == "d") { #',e+='<div class="k-thumb"><span class="k-icon k-folder"></span></div>',e+="#}else{#",e+='<div class="k-thumb"><span class="k-icon k-loading"></span></div>',e+="#}#",e+="#if("+D+' == "d") { #',e+='<input class="k-input" '+h.attr("bind")+'="value:'+T+'"/>',e+="#}#",e+="</li>",f(h.template(e),{sizeFormatter:o})},_itemTmpl:function(){var e='<li class="k-tile" '+h.attr("uid")+'="#=uid#" ';return e+=h.attr("type")+'="${'+D+'}">',e+="#if("+D+' == "d") { #',e+='<div class="k-thumb"><span class="k-icon k-folder"></span></div>',e+="#}else{#",e+='<div class="k-thumb"><span class="k-icon k-file"></span></div>',e+="#}#",e+="<strong>${"+T+"}</strong>",e+="#if("+D+' == "f") { # <span class="k-filesize">${this.sizeFormatter('+A+")}</span> #}#",e+="</li>",f(h.template(e),{sizeFormatter:o})},path:function(e){var n=this,i=n._path||"";return e!==t?(n._path=e.replace(_,"")+"/",n.dataSource.read({path:n._path}),t):(i&&(i=i.replace(_,"")),"/"===i||""===i?"":i+"/")}}),l=u.extend({init:function(e,t){var n=this;t=t||{},u.fn.init.call(n,e,t),g&&n.element.attr("placeholder",n.options.label),n._wrapper(),n.element.on("keydown"+S,f(n._keydown,n)).on("change"+S,f(n._updateValue,n)),n.wrapper.on(x+S,"a",f(n._click,n)),g||n.element.on("focus"+S,f(n._focus,n)).on("blur"+S,f(n._blur,n))},options:{name:"SearchBox",label:"Search",value:""},events:[w],destroy:function(){var e=this;e.wrapper.add(e.element).add(e.label).off(S),u.fn.destroy.call(e)},_keydown:function(e){13===e.keyCode&&this._updateValue()},_click:function(e){e.preventDefault(),this._updateValue()},_updateValue:function(){var e=this,t=e.element.val();t!==e.value()&&(e.value(t),e.trigger(w))},_blur:function(){this._updateValue(),this._toggleLabel()},_toggleLabel:function(){g||this.label.toggle(!this.element.val())},_focus:function(){this.label.hide()},_wrapper:function(){var t=this.element,n=t.parents(".k-search-wrap");t[0].style.width="",t.addClass("k-input"),n.length||(n=t.wrap(e('<div class="k-widget k-search-wrap k-textbox"/>')).parent(),g||e('<label style="display:block">'+this.options.label+"</label>").insertBefore(t),e('<a href="#" class="k-icon k-i-search k-search"/>').appendTo(n)),this.wrapper=n,this.label=n.find(">label")},value:function(e){var n=this;return e!==t?(n.options.value=e,n.element.val(e),n._toggleLabel(),t):n.options.value}}),c=u.extend({init:function(e,t){var n=this;t=t||{},u.fn.init.call(n,e,t),n._wrapper(),n.wrapper.on("focus"+C,"input",f(n._focus,n)).on("blur"+C,"input",f(n._blur,n)).on("keydown"+C,"input",f(n._keydown,n)).on(x+C,"a.k-i-arrow-n:first",f(n._rootClick,n)).on(x+C,"a:not(.k-i-arrow-n)",f(n._click,n)),n.value(n.options.value)},options:{name:"Breadcrumbs",gap:50},events:[w],destroy:function(){var e=this;u.fn.destroy.call(e),e.wrapper.add(e.wrapper.find("input")).add(e.wrapper.find("a")).off(C)},_update:function(e){e="/"===(e||"").charAt(0)?e:"/"+(e||""),e!==this.value()&&(this.value(e),this.trigger(w))},_click:function(t){t.preventDefault(),this._update(this._path(e(t.target).prevAll("a:not(.k-i-arrow-n)").addBack()))},_rootClick:function(e){e.preventDefault(),this._update("")},_focus:function(){var e=this,t=e.element;e.overlay.hide(),e.element.val(e.value()),setTimeout(function(){t.select()})},_blur:function(){if(!this.overlay.is(":visible")){var e=this,t=e.element,n=t.val().replace(/\/{2,}/g,"/");e.overlay.show(),t.val(""),e._update(n)}},_keydown:function(e){var t=this;13===e.keyCode&&(t._blur(),setTimeout(function(){t.overlay.find("a:first").focus()}))},_wrapper:function(){var t,n=this.element,i=n.parents(".k-breadcrumbs");n[0].style.width="",n.addClass("k-input"),i.length||(i=n.wrap(e('<div class="k-widget k-breadcrumbs k-textbox"/>')).parent()),t=i.find(".k-breadcrumbs-wrap"),t.length||(t=e('<div class="k-breadcrumbs-wrap"/>').appendTo(i)),this.wrapper=i,this.overlay=t},refresh:function(){var n,i,o,r,s="",a=this.value();for(a!==t&&a.match(/^\//)||(a="/"+(a||"")),n=a.split("/"),o=0,r=n.length;r>o;o++)i=n[o],i&&(s||(s+='<a href="#" class="k-icon k-i-arrow-n">root</a>'),s+='<a class="k-link" href="#">'+n[o]+"</a>",s+='<span class="k-icon k-i-arrow-e">&gt;</span>');this.overlay.empty().append(e(s)),this._adjustSectionWidth()},_adjustSectionWidth:function(){var t,n=this,i=n.wrapper,o=i.width()-n.options.gap,r=n.overlay.find("a");r.each(function(n){t=e(this),t.parent().width()>o&&(n==r.length-1?t.width(o):t.prev().addBack().hide())})},value:function(e){return e!==t?(this._value=e.replace(/\/{2,}/g,"/"),this.refresh(),t):this._value},_path:function(t){return"/"+e.map(t,function(t){return e(t).text()}).join("/")}}),h.ui.plugin(a),h.ui.plugin(c),h.ui.plugin(l)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});