/*
* Kendo UI Web v2013.1.319 (http://kendoui.com)
* Copyright 2013 Telerik AD. All rights reserved.
*
* Kendo UI Web commercial licenses may be obtained at
* https://www.kendoui.com/purchase/license-agreement/kendo-ui-web-commercial.aspx
* If you do not own a commercial license, this file shall be governed by the
* GNU General Public License (GPL) version 3.
* For GPL requirements, please review: http://www.gnu.org/copyleft/gpl.html
*/
("function"==typeof define&&define.amd?define:function(e,t){return t()})(["./kendo.listview.min","./kendo.upload.min"],function(){(function(e,t){function a(e,t,a){var i,n;e.on("dragenter"+F,function(){t(),n=new Date,i||(i=setInterval(function(){var e=new Date-n;e>100&&(a(),clearInterval(i),i=null)},100))}).on("dragover"+F,function(){n=new Date})}function i(e,t){var a=e[t];return p(a)?a.field||t:a}function n(e,a){return e!==t&&e.match(/\/$/)||(e=(e||"")+"/"),e+a}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}var r,s,l,d,u=window.kendo,c=u.ui.Widget,p=e.isPlainObject,f=e.proxy,h=e.extend,m=u.support.placeholder,g=u.support.browser,v=e.isFunction,_=/(^\/|\/$)/g,k="change",b="apply",w="error",y="click",F=".kendoImageBrowser",S=".kendoBreadcrumbs",x=".kendoSearchBox",N="name",B="size",T="type",C={field:T,dir:"asc"},D=u.template('
';h(!0,u.data,{schemas:{imagebrowser:{data:function(e){return e.items||e||[]},model:{id:"name",fields:{name:"name",size:"size",type:"type"}}}}}),h(!0,u.data,{transports:{imagebrowser:u.data.RemoteTransport.extend({init:function(t){u.data.RemoteTransport.fn.init.call(this,e.extend(!0,{},this.options,t))},_call:function(t,a){a.data=e.extend({},a.data,{path:this.options.path()}),v(this.options[t])?this.options[t].call(this,a):u.data.RemoteTransport.fn[t].call(this,a)},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"}}})}}),r=g.msie&&8>g.version?function(e){return e.offsetTop}:function(t){return t.offsetTop-e(t).height()},s=c.extend({init:function(e,t){var a=this;t=t||{},c.fn.init.call(a,e,t),a.element.addClass("k-imagebrowser"),a.element.on(y+F,".k-toolbar button:not(.k-state-disabled):has(.k-delete)",f(a._deleteClick,a)).on(y+F,".k-toolbar button:not(.k-state-disabled):has(.k-addfolder)",f(a._addClick,a)).on("keydown"+F,"li.k-state-selected input",f(a._directoryKeyDown,a)).on("blur"+F,"li.k-state-selected input",f(a._directoryBlur,a)),a._dataSource(),a.refresh(),a.path(a.options.path)},options:{name:"ImageBrowser",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 files here to upload",search:"Search"},transport:{},path:"/",fileTypes:"*.png,*.gif,*.jpg,*.jpeg"},events:[w,k,b],destroy:function(){var e=this;c.fn.destroy.call(e),e.dataSource.unbind(w,e._errorHandler),e.element.add(e.list).add(e.toolbar).off(F),e.arrangeByPopup&&e.arrangeByPopup.destroy(),u.destroy(e.element)},value:function(){var e,a=this,i=a._selectedItem(),o=a.options.transport.imageUrl;return i&&"f"===i.get(a._getFieldName(T))?(e=n(a.path(),i.get(a._getFieldName(N))).replace(_,""),o&&(e=v(o)?o(e):u.format(o,e)),e):t},_selectedItem:function(){var e=this.listView,a=e.select();return a.length?this.dataSource.getByUid(a.attr(u.attr("uid"))):t},_toolbar:function(){var t,a,i=this,n=u.template(U),o=i.options.messages,r=[{text:o.orderByName,value:"name",ns:u.ns},{text:o.orderBySize,value:"size",ns:u.ns}];i.toolbar=e(n({messages:o,showUpload:i.options.transport.uploadUrl,showCreate:i.options.transport.create,showDelete:i.options.transport.destroy})).appendTo(i.element).find(".k-upload input").kendoUpload({multiple:!1,localization:{dropFilesHere:o.dropFilesHere},async:{saveUrl:i.options.transport.uploadUrl,autoUpload:!0},upload:f(i._fileUpload,i)}).end(),i.upload=i.toolbar.find(".k-upload input").data("kendoUpload"),t=i.toolbar.find(".k-tiles-arrange a"),i.arrangeByPopup=a=e("