!function(e){var a={};function t(n){if(a[n])return a[n].exports;var s=a[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}t.m=e,t.c=a,t.d=function(e,a,n){t.o(e,a)||Object.defineProperty(e,a,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,a){if(1&a&&(e=t(e)),8&a)return e;if(4&a&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&a&&"string"!=typeof e)for(var s in e)t.d(n,s,function(a){return e[a]}.bind(null,s));return n},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},t.p="",t(t.s=0)}([function(e,a,t){"use strict";t.r(a);t(1),t(2),t(3),t(4),t(5),t(6),t(7),t(8),t(9)},function(e,a){!function(){OC.Share||(OC.Share={},OC.Share.Types={});var e=OC.Backbone.Model.extend({defaults:{publicUploadEnabled:!1,enforcePasswordForPublicLink:oc_appconfig.core.enforcePasswordForPublicLink,enableLinkPasswordByDefault:oc_appconfig.core.enableLinkPasswordByDefault,isDefaultExpireDateEnforced:!0===oc_appconfig.core.defaultExpireDateEnforced,isDefaultExpireDateEnabled:!0===oc_appconfig.core.defaultExpireDateEnabled,isRemoteShareAllowed:oc_appconfig.core.remoteShareAllowed,isMailShareAllowed:void 0!==oc_appconfig.shareByMailEnabled,defaultExpireDate:oc_appconfig.core.defaultExpireDate,isResharingAllowed:oc_appconfig.core.resharingAllowed,isPasswordForMailSharesRequired:void 0!==oc_appconfig.shareByMail&&oc_appconfig.shareByMail.enforcePasswordProtection,allowGroupSharing:oc_appconfig.core.allowGroupSharing},isPublicUploadEnabled:function(){return"yes"===$("#filestable").data("allow-public-upload")},isShareWithLinkAllowed:function(){return"yes"===$("#allowShareWithLink").val()},getFederatedShareDocLink:function(){return oc_appconfig.core.federatedCloudShareDoc},getDefaultExpirationDateString:function(){var e="";if(this.get("isDefaultExpireDateEnabled")){var a=moment.utc(),t=this.get("defaultExpireDate");a.add(t,"days"),e=a.format("YYYY-MM-DD 00:00:00")}return e}});OC.Share.ShareConfigModel=e}()},function(e,a){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n,s;n=Handlebars.template,(s=OC.Share.Templates=OC.Share.Templates||{}).sharedialoglinkshareview=n({1:function(e,a,t,n,s){var i,l=null!=a?a:e.nullContext||{};return'\n"},2:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h=e.escapeExpression;return'\t\t
  • \n\t\t\t
    \n\t\t\t'+h("function"===t(r=null!=(r=n.newShareLabel||(null!=a?a.newShareLabel:a))?r:d)?r.call(o,{name:"newShareLabel",hash:{},data:i}):r)+'\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
  • \n"},3:function(e,a,t,n,s){return"hidden"},5:function(e,a,t,n,s){var i,l;return"\t\t\t\t\t\t"+(null!=(i="function"==typeof(l=null!=(l=t.pendingPopoverMenu||(null!=a?a.pendingPopoverMenu:a))?l:t.helperMissing)?l.call(null!=a?a:e.nullContext||{},{name:"pendingPopoverMenu",hash:{},data:s}):l)?i:"")+"\n"},7:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\t\t
  • \n\t\t\t
    \n\t\t\t'+c(t(r=null!=(r=n.linkShareLabel||(null!=a?a.linkShareLabel:a))?r:d)===h?r.call(o,{name:"linkShareLabel",hash:{},data:i}):r)+'\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
  • \n"},8:function(e,a,t,n,s){var i,l;return"\t\t\t\t\t\t"+(null!=(i="function"==typeof(l=null!=(l=t.popoverMenu||(null!=a?a.popoverMenu:a))?l:t.helperMissing)?l.call(null!=a?a:e.nullContext||{},{name:"popoverMenu",hash:{},data:s}):l)?i:"")+"\n"},10:function(e,a,t,n,s){var i;return(null!=(i=t.if.call(null!=a?a:e.nullContext||{},null!=a?a.noSharingPlaceholder:a,{name:"if",hash:{},fn:e.program(11,s,0),inverse:e.noop,data:s}))?i:"")+"\n"},11:function(e,a,n,s,i){var l,r=null!=a?a:e.nullContext||{},o=n.helperMissing,d=e.escapeExpression;return''},compiler:[7,">= 4.0.0"],main:function(e,a,t,n,s){var i;return null!=(i=t.if.call(null!=a?a:e.nullContext||{},null!=a?a.shareAllowed:a,{name:"if",hash:{},fn:e.program(1,s,0),inverse:e.program(10,s,0),data:s}))?i:""},useData:!0}),s.sharedialoglinkshareview_popover_menu=n({1:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • \n\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • \n\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • \n"},3:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h=e.escapeExpression;return'\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • \n"},5:function(e,a,t,n,s){return'checked="checked"'},7:function(e,a,t,n,s){return'disabled="disabled"'},9:function(e,a,t,n,s){return"hidden"},11:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h=e.escapeExpression;return'\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • \n"},13:function(e,a,t,n,s){return"datepicker"},15:function(e,a,t,n,s){var i;return e.escapeExpression("function"==typeof(i=null!=(i=t.expireDate||(null!=a?a.expireDate:a))?i:t.helperMissing)?i.call(null!=a?a:e.nullContext||{},{name:"expireDate",hash:{},data:s}):i)},17:function(e,a,t,n,s){var i;return e.escapeExpression("function"==typeof(i=null!=(i=t.defaultExpireDate||(null!=a?a.defaultExpireDate:a))?i:t.helperMissing)?i.call(null!=a?a:e.nullContext||{},{name:"defaultExpireDate",hash:{},data:s}):i)},19:function(e,a,t,n,s){return"readonly"},21:function(e,a,n,s,i){var l,r=null!=a?a:e.nullContext||{},o=n.helperMissing,d=e.escapeExpression;return'\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t'+d("function"===t(l=null!=(l=n.label||(null!=a?a.label:a))?l:o)?l.call(r,{name:"label",hash:{},data:i}):l)+"\n\t\t\t\t\n\t\t\t
  • \n"},compiler:[7,">= 4.0.0"],main:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\n"},useData:!0}),s.sharedialoglinkshareview_popover_menu_pending=n({1:function(e,a,n,s,i){var l,r=null!=a?a:e.nullContext||{},o=n.helperMissing,d=e.escapeExpression;return'\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t

    '+d("function"===t(l=null!=(l=n.enforcedPasswordLabel||(null!=a?a.enforcedPasswordLabel:a))?l:o)?l.call(r,{name:"enforcedPasswordLabel",hash:{},data:i}):l)+'

    \n\t\t\t\t
    \n\t\t\t
  • \n\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t
  • \n'},compiler:[7,">= 4.0.0"],main:function(e,a,t,n,s){var i;return'\n"},useData:!0}),s.sharedialogresharerinfoview=n({1:function(e,a,t,n,s){var i;return'
    '+e.escapeExpression("function"==typeof(i=null!=(i=t.shareNote||(null!=a?a.shareNote:a))?i:t.helperMissing)?i.call(null!=a?a:e.nullContext||{},{name:"shareNote",hash:{},data:s}):i)+"
    "},compiler:[7,">= 4.0.0"],main:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h=e.escapeExpression;return'\n\t
    \n\t'+h("function"===t(r=null!=(r=n.sharedByText||(null!=a?a.sharedByText:a))?r:d)?r.call(o,{name:"sharedByText",hash:{},data:i}):r)+"\n
    \n"+(null!=(l=n.if.call(o,null!=a?a.hasShareNote:a,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))?l:"")+"\n"},useData:!0}),s.sharedialogshareelistview=n({1:function(e,a,t,n,s){var i;return null!=(i=t.unless.call(null!=a?a:e.nullContext||{},null!=a?a.isShareWithCurrentUser:a,{name:"unless",hash:{},fn:e.program(2,s,0),inverse:e.noop,data:s}))?i:""},2:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\t\t
  • \n\t\t\t
    \n\t\t\t'+c(t(r=null!=(r=n.shareWithDisplayName||(null!=a?a.shareWithDisplayName:a))?r:d)===h?r.call(o,{name:"shareWithDisplayName",hash:{},data:i}):r)+"\n"+(null!=(l=n.if.call(o,null!=a?a.canUpdateShareSettings:a,{name:"if",hash:{},fn:e.program(7,i,0),inverse:e.noop,data:i}))?l:"")+"\t\t
  • \n"},3:function(e,a,t,n,s){return"imageplaceholderseed"},5:function(e,a,n,s,i){var l,r=null!=a?a:e.nullContext||{},o=n.helperMissing,d=e.escapeExpression;return'data-seed="'+d("function"===t(l=null!=(l=n.shareWith||(null!=a?a.shareWith:a))?l:o)?l.call(r,{name:"shareWith",hash:{},data:i}):l)+" "+d("function"===t(l=null!=(l=n.shareType||(null!=a?a.shareType:a))?l:o)?l.call(r,{name:"shareType",hash:{},data:i}):l)+'"'},7:function(e,a,t,n,s){var i,l,r=null!=a?a:e.nullContext||{};return'\t\t\t\n'+(null!=(i=t.if.call(r,null!=a?a.editPermissionPossible:a,{name:"if",hash:{},fn:e.program(8,s,0),inverse:e.noop,data:s}))?i:"")+'\t\t\t\t
    \n\t\t\t\t\t'+(null!=(i="function"==typeof(l=null!=(l=t.popoverMenu||(null!=a?a.popoverMenu:a))?l:t.helperMissing)?l.call(r,{name:"popoverMenu",hash:{},data:s}):l)?i:"")+"\n\t\t\t\t
    \n\t\t\t
    \n"},8:function(e,a,n,s,i){var l,r=null!=a?a:e.nullContext||{},o=n.helperMissing,d="function",h=e.escapeExpression;return'\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n"},10:function(e,a,n,s,i){var l,r=null!=a?a:e.nullContext||{},o=n.helperMissing,d="function",h=e.escapeExpression;return'\t\t
  • \n\t\t\t
    \n\t\t\t'+h(t(l=null!=(l=n.shareInitiatorText||(null!=a?a.shareInitiatorText:a))?l:o)===d?l.call(r,{name:"shareInitiatorText",hash:{},data:i}):l)+'\n\t\t\t\n\t\t\t\t'+h(t(l=null!=(l=n.unshareLabel||(null!=a?a.unshareLabel:a))?l:o)===d?l.call(r,{name:"unshareLabel",hash:{},data:i}):l)+"\n\t\t\t\n\t\t
  • \n"},compiler:[7,">= 4.0.0"],main:function(e,a,t,n,s){var i,l=null!=a?a:e.nullContext||{};return'\n"},useData:!0}),s.sharedialogshareelistview_popover_menu=n({1:function(e,a,t,n,s){var i;return" "+(null!=(i=t.if.call(null!=a?a:e.nullContext||{},null!=a?a.sharePermissionPossible:a,{name:"if",hash:{},fn:e.program(2,s,0),inverse:e.noop,data:s}))?i:"")+" "},2:function(e,a,t,n,s){var i;return" "+(null!=(i=t.unless.call(null!=a?a:e.nullContext||{},null!=a?a.isMailShare:a,{name:"unless",hash:{},fn:e.program(3,s,0),inverse:e.noop,data:s}))?i:"")+" "},3:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\n\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t
  • \n\t\t\t"},4:function(e,a,t,n,s){return'checked="checked"'},6:function(e,a,t,n,s){var i,l=null!=a?a:e.nullContext||{};return"\t\t\t"+(null!=(i=t.if.call(l,null!=a?a.createPermissionPossible:a,{name:"if",hash:{},fn:e.program(7,s,0),inverse:e.noop,data:s}))?i:"")+"\n\t\t\t"+(null!=(i=t.if.call(l,null!=a?a.updatePermissionPossible:a,{name:"if",hash:{},fn:e.program(10,s,0),inverse:e.noop,data:s}))?i:"")+"\n\t\t\t"+(null!=(i=t.if.call(l,null!=a?a.deletePermissionPossible:a,{name:"if",hash:{},fn:e.program(13,s,0),inverse:e.noop,data:s}))?i:"")+"\n"},7:function(e,a,t,n,s){var i;return null!=(i=t.unless.call(null!=a?a:e.nullContext||{},null!=a?a.isMailShare:a,{name:"unless",hash:{},fn:e.program(8,s,0),inverse:e.noop,data:s}))?i:""},8:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t"},10:function(e,a,t,n,s){var i;return null!=(i=t.unless.call(null!=a?a:e.nullContext||{},null!=a?a.isMailShare:a,{name:"unless",hash:{},fn:e.program(11,s,0),inverse:e.noop,data:s}))?i:""},11:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t\t"},13:function(e,a,t,n,s){var i;return null!=(i=t.unless.call(null!=a?a:e.nullContext||{},null!=a?a.isMailShare:a,{name:"unless",hash:{},fn:e.program(14,s,0),inverse:e.noop,data:s}))?i:""},14:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t\t"},16:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return(null!=(l=n.if.call(o,null!=a?a.hasCreatePermission:a,{name:"if",hash:{},fn:e.program(17,i,0),inverse:e.noop,data:i}))?l:"")+'\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • \n\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • \n'+(null!=(l=n.if.call(o,null!=a?a.isTalkEnabled:a,{name:"if",hash:{},fn:e.program(24,i,0),inverse:e.noop,data:i}))?l:"")},17:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
  • \n"},19:function(e,a,t,n,s){var i;return null!=(i=t.if.call(null!=a?a:e.nullContext||{},null!=a?a.isPasswordForMailSharesRequired:a,{name:"if",hash:{},fn:e.program(20,s,0),inverse:e.noop,data:s}))?i:""},20:function(e,a,t,n,s){return'disabled=""'},22:function(e,a,t,n,s){return"hidden"},24:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
  • \n'},26:function(e,a,t,n,s){var i;return e.escapeExpression("function"==typeof(i=null!=(i=t.expireDate||(null!=a?a.expireDate:a))?i:t.helperMissing)?i.call(null!=a?a:e.nullContext||{},{name:"expireDate",hash:{},data:s}):i)},28:function(e,a,t,n,s){var i;return e.escapeExpression("function"==typeof(i=null!=(i=t.defaultExpireDate||(null!=a?a.defaultExpireDate:a))?i:t.helperMissing)?i.call(null!=a?a:e.nullContext||{},{name:"defaultExpireDate",hash:{},data:s}):i)},30:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h=e.escapeExpression;return'\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t'+h("function"===t(r=null!=(r=n.addNoteLabel||(null!=a?a.addNoteLabel:a))?r:d)?r.call(o,{name:"addNoteLabel",hash:{},data:i}):r)+'\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • \n\t\t\t
  • \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • \n'},compiler:[7,">= 4.0.0"],main:function(e,a,n,s,i){var l,r,o=null!=a?a:e.nullContext||{},d=n.helperMissing,h="function",c=e.escapeExpression;return'\n"},useData:!0}),s.sharedialogview=n({1:function(e,a,n,s,i){var l,r=null!=a?a:e.nullContext||{},o=n.helperMissing,d=e.escapeExpression;return'\t\n\t
    \n\t\t\n\t\t\n\t\t\n\t
    \n'},compiler:[7,">= 4.0.0"],main:function(e,a,t,n,s){var i;return'
    \n'+(null!=(i=t.if.call(null!=a?a:e.nullContext||{},null!=a?a.isSharingAllowed:a,{name:"if",hash:{},fn:e.program(1,s,0),inverse:e.noop,data:s}))?i:"")+'
    \n
    \n\n'},useData:!0})},function(e,a){!function(){OC.Share||(OC.Share={},OC.Share.Types={});var e=["id","file_parent","mail_send","file_source","item_source","permissions","storage","share_type","parent","stime"],a=OC.Backbone.Model.extend({_linkShareId:null,initialize:function(e,a){_.isUndefined(a.configModel)||(this.configModel=a.configModel),_.isUndefined(a.fileInfoModel)||(this.fileInfoModel=a.fileInfoModel),_.bindAll(this,"addShare")},defaults:{allowPublicUploadStatus:!1,permissions:0,linkShares:[]},saveLinkShare:function(e,a){a=a||{};var t,n=null;(e=_.extend({},e)).expiration&&(e.expireDate=e.expiration,delete e.expiration);var s=this.get("linkShares"),i=_.findIndex(s,function(a){return a.id===e.cid});return s.length>0&&-1!==i?(n=s[i].id,t=this.updateShare(n,e,a)):(e=_.defaults(e,{hideDownload:!1,password:"",passwordChanged:!1,sendPasswordByTalk:!1,permissions:OC.PERMISSION_READ,expireDate:this.configModel.getDefaultExpirationDateString(),shareType:OC.Share.SHARE_TYPE_LINK}),t=this.addShare(e,a)),t},addShare:function(e,a){e.shareType;e=_.extend({},e);var t=OC.getCapabilities().files_sharing.default_permissions||OC.PERMISSION_ALL,n=OC.PERMISSION_READ;return this.updatePermissionPossible()&&(n|=OC.PERMISSION_UPDATE),this.createPermissionPossible()&&(n|=OC.PERMISSION_CREATE),this.deletePermissionPossible()&&(n|=OC.PERMISSION_DELETE),this.configModel.get("isResharingAllowed")&&this.sharePermissionPossible()&&(n|=OC.PERMISSION_SHARE),e.permissions=t&n,_.isUndefined(e.path)&&(e.path=this.fileInfoModel.getFullPath()),this._addOrUpdateShare({type:"POST",url:this._getUrl("shares"),data:e,dataType:"json"},a)},updateShare:function(e,a,t){return this._addOrUpdateShare({type:"PUT",url:this._getUrl("shares/"+encodeURIComponent(e)),data:a,dataType:"json"},t)},_addOrUpdateShare:function(e,a){var n=this;return a=a||{},$.ajax(e).always(function(){_.isFunction(a.complete)&&a.complete(n)}).done(function(){n.fetch().done(function(){_.isFunction(a.success)&&a.success(n)})}).fail(function(e){var s=t("core","Error"),i=e.responseJSON;i&&i.ocs&&i.ocs.meta&&(s=i.ocs.meta.message),_.isFunction(a.error)?a.error(n,s):OC.dialogs.alert(s,t("core","Error while sharing"))})},removeShare:function(e,a){var n=this;return a=a||{},$.ajax({type:"DELETE",url:this._getUrl("shares/"+encodeURIComponent(e))}).done(function(){n.fetch({success:function(){_.isFunction(a.success)&&a.success(n)}})}).fail(function(e){var s=t("core","Error"),i=e.responseJSON;i.ocs&&i.ocs.meta&&(s=i.ocs.meta.message),_.isFunction(a.error)?a.error(n,s):OC.dialogs.alert(s,t("core","Error removing share"))})},isPublicUploadAllowed:function(){return this.get("allowPublicUploadStatus")},isPublicEditingAllowed:function(){return this.get("allowPublicEditingStatus")},isHideFileListSet:function(){return this.get("hideFileListStatus")},isFolder:function(){return"folder"===this.get("itemType")},isFile:function(){return"file"===this.get("itemType")},hasReshare:function(){var e=this.get("reshare");return _.isObject(e)&&!_.isUndefined(e.uid_owner)},hasUserShares:function(){return this.getSharesWithCurrentItem().length>0},hasLinkShares:function(){var e=this.get("linkShares");return!!(e&&e.length>0)},getReshareOwner:function(){return this.get("reshare").uid_owner},getReshareOwnerDisplayname:function(){return this.get("reshare").displayname_owner},getReshareNote:function(){return this.get("reshare").note},getReshareWith:function(){return this.get("reshare").share_with},getReshareWithDisplayName:function(){var e=this.get("reshare");return e.share_with_displayname||e.share_with},getReshareType:function(){return this.get("reshare").share_type},getExpireDate:function(e){return this._shareExpireDate(e)},getNote:function(e){return this._shareNote(e)},getSharesWithCurrentItem:function(){var e=this.get("shares")||[],a=this.fileInfoModel.get("id");return _.filter(e,function(e){return e.item_source===a})},getShareWith:function(e){var a=this.get("shares")[e];if(!_.isObject(a))throw"Unknown Share";return a.share_with},getShareWithDisplayName:function(e){var a=this.get("shares")[e];if(!_.isObject(a))throw"Unknown Share";return a.share_with_displayname},getShareWithAvatar:function(e){var a=this.get("shares")[e];if(!_.isObject(a))throw"Unknown Share";return a.share_with_avatar},getSharedBy:function(e){var a=this.get("shares")[e];if(!_.isObject(a))throw"Unknown Share";return a.uid_owner},getSharedByDisplayName:function(e){var a=this.get("shares")[e];if(!_.isObject(a))throw"Unknown Share";return a.displayname_owner},getFileOwnerUid:function(e){var a=this.get("shares")[e];if(!_.isObject(a))throw"Unknown Share";return a.uid_file_owner},findShareWithIndex:function(e){var a=this.get("shares");if(!_.isArray(a))throw"Unknown Share";for(var t=0;t0&&-1!==t?a[t].permissions:-1},_getUrl:function(e,a){return a=_.extend({format:"json"},a||{}),OC.linkToOCS("apps/files_sharing/api/v1",2)+e+"?"+OC.buildQueryString(a)},_fetchShares:function(){var e=this.fileInfoModel.getFullPath();return $.ajax({type:"GET",url:this._getUrl("shares",{path:e,reshares:!0})})},_fetchReshare:function(){if(this._reshareFetched)return $.Deferred().resolve([{ocs:{data:[this.get("reshare")]}}]);var e=this.fileInfoModel.getFullPath();return this._reshareFetched=!0,$.ajax({type:"GET",url:this._getUrl("shares",{path:e,shared_with_me:!0})})},_groupReshares:function(e){if(!e||!e.length)return!1;var a=e.shift(),t=a.permissions;return _.each(e,function(e){e.share_type===OC.Share.SHARE_TYPE_USER&&a.share_type===OC.Share.SHARE_TYPE_GROUP&&(a=e),t|=e.permissions}),a.permissions=t,a},fetch:function(e){var a=this;this.trigger("request",this);var t=$.when(this._fetchShares(),this._fetchReshare());return t.done(function(t,n){a.trigger("sync","GET",this);var s={};_.each(t[0].ocs.data,function(e){s[e.id]=e});var i=!1;n[0].ocs.data.length&&(i=a._groupReshares(n[0].ocs.data)),a.set(a.parse({shares:s,reshare:i})),!_.isUndefined(e)&&_.isFunction(e.success)&&e.success()}),t},_legacyFillCurrentShares:function(e){var a=this.fileInfoModel.get("id");if(!e||!e.length)return delete OC.Share.statuses[a],OC.Share.currentShares={},void(OC.Share.itemShares=[]);var t=OC.Share.statuses[a];t||(t={link:!1},OC.Share.statuses[a]=t),t.link=!1,OC.Share.currentShares={},OC.Share.itemShares=[],_.each(e,function(e){e.share_type===OC.Share.SHARE_TYPE_LINK?(OC.Share.itemShares[e.share_type]=!0,t.link=!0):(OC.Share.itemShares[e.share_type]||(OC.Share.itemShares[e.share_type]=[]),OC.Share.itemShares[e.share_type].push(e.share_with))})},parse:function(a){if(!1===a)return console.warn("no data was returned"),this.trigger("fetchError"),{};var t=this.fileInfoModel.get("permissions");_.isUndefined(a.reshare)||_.isUndefined(a.reshare.permissions)||a.reshare.uid_owner===OC.currentUser||(t&=a.reshare.permissions);var n=!1;_.isUndefined(a.shares)||$.each(a.shares,function(e,a){if(a.share_type===OC.Share.SHARE_TYPE_LINK)return n=!!(a.permissions&OC.PERMISSION_CREATE),!0});var s=!0;_.isUndefined(a.shares)||$.each(a.shares,function(e,a){if(a.share_type===OC.Share.SHARE_TYPE_LINK)return s=!!(a.permissions&OC.PERMISSION_UPDATE),!0});var i=!1;_.isUndefined(a.shares)||$.each(a.shares,function(e,a){if(a.share_type===OC.Share.SHARE_TYPE_LINK)return i=!(a.permissions&OC.PERMISSION_READ),!0});var l=_.map(a.shares,function(a){var t;for(t=0;t1&&"0"===e[0]&&"x"===e[1])return null;e=parseInt(e,10),isNaN(e)&&(e=null)}return e},getShareTypes:function(){var e;return e=_.pluck(this.getSharesWithCurrentItem(),"share_type"),this.hasLinkShares()&&e.push(OC.Share.SHARE_TYPE_LINK),_.uniq(e)}});OC.Share.ShareItemModel=a}()},function(e,a){ /** * @copyright 2017, Roeland Jago Douma * * @author Roeland Jago Douma * * @license GNU AGPL version 3 or any later version * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ !function(){OC.Share||(OC.Share={}),OC.Share.Social={};var e=OC.Backbone.Model.extend({defaults:{key:null,url:null,name:null,iconClass:null,newWindow:!0}});OC.Share.Social.Model=e;var a=OC.Backbone.Collection.extend({model:OC.Share.Social.Model,comparator:"key"});OC.Share.Social.Collection=new a}()},function(e,a){!function(){OC.Share||(OC.Share={});var e=OC.Backbone.View.extend({id:"shareDialogResharerInfo",tagName:"div",className:"reshare",configModel:void 0,_template:void 0,initialize:function(e){var a=this;if(this.model.on("change:reshare",function(){a.render()}),_.isUndefined(e.configModel))throw"missing OC.Share.ShareConfigModel";this.configModel=e.configModel},render:function(){if(!this.model.hasReshare()||this.model.getReshareOwner()===OC.currentUser)return this.$el.empty(),this;var e=this.template(),a=this.model.getReshareOwnerDisplayname(),n=this.model.getReshareNote(),s="";return s=this.model.getReshareType()===OC.Share.SHARE_TYPE_GROUP?t("core","Shared with you and the group {group} by {owner}",{group:this.model.getReshareWithDisplayName(),owner:a},void 0,{escape:!1}):this.model.getReshareType()===OC.Share.SHARE_TYPE_CIRCLE?t("core","Shared with you and {circle} by {owner}",{circle:this.model.getReshareWithDisplayName(),owner:a},void 0,{escape:!1}):this.model.getReshareType()===OC.Share.SHARE_TYPE_ROOM?this.model.get("reshare").share_with_displayname?t("core","Shared with you and the conversation {conversation} by {owner}",{conversation:this.model.getReshareWithDisplayName(),owner:a},void 0,{escape:!1}):t("core","Shared with you in a conversation by {owner}",{owner:a},void 0,{escape:!1}):t("core","Shared with you by {owner}",{owner:a},void 0,{escape:!1}),this.$el.html(e({reshareOwner:this.model.getReshareOwner(),sharedByText:s,shareNote:n,hasShareNote:""!==n})),this.$el.find(".avatar").each(function(){var e=$(this);e.avatar(e.data("username"),32)}),this.$el.find(".reshare").contactsMenu(this.model.getReshareOwner(),OC.Share.SHARE_TYPE_USER,this.$el),this},template:function(){return OC.Share.Templates.sharedialogresharerinfoview}});OC.Share.ShareDialogResharerInfoView=e}()},function(e,a){!function(){OC.Share||(OC.Share={});var e=t("core","Choose a password for the public link"),a=t("core",'Choose a password for the public link or press the "Enter" key'),n=OC.Backbone.View.extend({id:"shareDialogLinkShare",configModel:void 0,showLink:!0,showPending:!1,password:"",newShareId:"new-share",events:{"click .share-menu .icon-more":"onToggleMenu","change .hideDownloadCheckbox":"onHideDownloadChange","click input.share-pass-submit":"onPasswordEntered","keyup input.linkPassText":"onPasswordKeyUp","change .showPasswordCheckbox":"onShowPasswordClick","change .passwordByTalkCheckbox":"onPasswordByTalkChange","change .publicEditingCheckbox":"onAllowPublicEditingChange","click .linkText":"onLinkTextClick","click .pop-up":"onPopUpClick","change .publicUploadRadio":"onPublicUploadChange","click .expireDate":"onExpireDateChange","change .datepicker":"onChangeExpirationDate","click .datepicker":"showDatePicker","click .share-add":"showNoteForm","click .share-note-delete":"deleteNote","click .share-note-submit":"updateNote","click .unshare":"onUnshare","click .new-share":"newShare","submit .enforcedPassForm":"enforcedPasswordSet"},initialize:function(e){var a=this;if(this.model.on("change:permissions",function(){a.render()}),this.model.on("change:itemType",function(){a.render()}),this.model.on("change:allowPublicUploadStatus",function(){a.render()}),this.model.on("change:hideFileListStatus",function(){a.render()}),this.model.on("change:linkShares",function(e,t){var n,s=e.previous("linkShares");if(s.length===t.length)for(n=0;n .icon-loading-small");if(!i.hasClass("hidden")&&""===this.password)return!1;n.find(".icon").addClass("hidden"),i.removeClass("hidden"),OC.hideMenus();var l={},r=this.configModel.get("enforcePasswordForPublicLink");if(this.configModel.get("isDefaultExpireDateEnforced")){var o=this.configModel.get("defaultExpireDate"),d=moment().add(o,"day").format("DD-MM-YYYY");l.expireDate=d}r&&""!==this.password&&(l.password=this.password);var h=!1;r&&!this.showPending&&""===this.password?(this.showPending=s,(a=this.render()).$el.find(".pending #enforcedPassText").focus()):$.when(this.model.saveLinkShare(l,{success:function(){if(i.addClass("hidden"),n.find(".icon").removeClass("hidden"),a.render(),h){var e=a.$el.find("li[data-share-id]"),t=a.$el.find('li[data-share-id="'+h+'"]');if(t&&1===e.length){var s=t.find(".popovermenu");OC.showMenu(null,s)}}},error:function(){}})).fail(function(e){if(a.password="",r&&e&&e.responseJSON&&e.responseJSON.ocs.meta&&e.responseJSON.ocs.meta.message){var s=a.$el.find(".pending #enforcedPassText");s.tooltip("destroy"),s.attr("title",e.responseJSON.ocs.meta.message),s.tooltip({placement:"bottom",trigger:"manual"}),s.tooltip("show")}else OC.Notification.showTemporary(t("core","Unable to create a link share")),i.addClass("hidden"),n.find(".icon").removeClass("hidden")}).then(function(e){h=e.ocs.data.id})},enforcedPasswordSet:function(e){e.preventDefault();var a=$(e.target).find("input.enforcedPassText");this.password=a.val(),this.showPending=!1,this.newShare(e)},onLinkTextClick:function(e){var a=$(e.target).closest("li[data-share-id]").find(".linkText");a.focus(),a.select()},onHideDownloadChange:function(e){var a=$(e.target).closest("li[data-share-id]"),n=a.data("share-id"),s=a.find(".hideDownloadCheckbox");s.siblings(".icon-loading-small").removeClass("hidden").addClass("inlineblock");var i=!1;s.is(":checked")&&(i=!0),this.model.saveLinkShare({hideDownload:i,cid:n},{success:function(){s.siblings(".icon-loading-small").addClass("hidden").removeClass("inlineblock")},error:function(e,a){OC.Notification.showTemporary(t("core","Unable to toggle this option")),s.siblings(".icon-loading-small").addClass("hidden").removeClass("inlineblock")}})},onShowPasswordClick:function(e){var a=$(e.target).closest("li[data-share-id]"),t=a.data("share-id");a.find(".linkPass").slideToggle(OC.menuSpeed),a.find(".linkPassMenu").toggleClass("hidden"),a.find(".showPasswordCheckbox").is(":checked")?OC.Util.isIE()||a.find(".linkPassText").focus():this.model.saveLinkShare({password:"",cid:t})},onPasswordKeyUp:function(e){13===e.keyCode&&this.onPasswordEntered(e)},onPasswordEntered:function(t){var n=$(t.target).closest("li[data-share-id]"),s=n.data("share-id"),i=n.find(".linkPassMenu .icon-loading-small");if(i.hasClass("hidden")){var l=n.find(".linkPassText");l.removeClass("error");var r=l.val();if(n.find(".linkPassText").attr("placeholder")===a)r===a&&(r="");else if(""===r||"**********"===r||r===e)return;i.removeClass("hidden").addClass("inlineblock"),this.model.saveLinkShare({password:r,cid:s},{complete:function(e){i.removeClass("inlineblock").addClass("hidden")},error:function(e,a){var t=l.parent();t.tooltip("destroy"),l.addClass("error"),t.attr("title",a),t.tooltip({placement:"bottom",trigger:"manual"}),t.tooltip("show")}})}},onPasswordByTalkChange:function(e){var a=$(e.target).closest("li[data-share-id]"),n=a.data("share-id"),s=a.find(".passwordByTalkCheckbox");s.siblings(".icon-loading-small").removeClass("hidden").addClass("inlineblock");var i=!1;s.is(":checked")&&(i=!0),this.model.saveLinkShare({sendPasswordByTalk:i,cid:n},{success:function(){s.siblings(".icon-loading-small").addClass("hidden").removeClass("inlineblock")},error:function(e,a){OC.Notification.showTemporary(t("core","Unable to toggle this option")),s.siblings(".icon-loading-small").addClass("hidden").removeClass("inlineblock")}})},onAllowPublicEditingChange:function(e){var a=$(e.target).closest("li[data-share-id]"),n=a.data("share-id"),s=a.find(".publicEditingCheckbox");s.siblings(".icon-loading-small").removeClass("hidden").addClass("inlineblock");var i=OC.PERMISSION_READ;s.is(":checked")&&(i=OC.PERMISSION_UPDATE|OC.PERMISSION_READ),this.model.saveLinkShare({permissions:i,cid:n},{success:function(){s.siblings(".icon-loading-small").addClass("hidden").removeClass("inlineblock")},error:function(e,a){OC.Notification.showTemporary(t("core","Unable to toggle this option")),s.siblings(".icon-loading-small").addClass("hidden").removeClass("inlineblock")}})},onPublicUploadChange:function(e){var a=$(e.target).closest("li[data-share-id]").data("share-id"),t=e.currentTarget.value;this.model.saveLinkShare({permissions:t,cid:a})},showNoteForm:function(e){e.preventDefault(),e.stopPropagation();var a=$(e.target),t=(a.closest("li[data-share-id]"),a.closest("li")),n=t.next("li.share-note-form");t.find(".share-note-delete").toggleClass("hidden"),n.toggleClass("hidden"),n.find("textarea").focus()},deleteNote:function(e){e.preventDefault(),e.stopPropagation();var a=$(e.target),t=a.closest("li[data-share-id]").data("share-id"),n=a.closest("li"),s=n.next("li.share-note-form");s.find(".share-note").val(""),s.addClass("hidden"),n.find(".share-note-delete").addClass("hidden"),this.sendNote("",t,n)},updateNote:function(e){e.preventDefault(),e.stopPropagation();var a=$(e.target),t=a.closest("li[data-share-id]").data("share-id"),n=a.closest("li.share-note-form"),s=n.prev("li"),i=n.find(".share-note").val().trim();i.length<1||this.sendNote(i,t,s)},sendNote:function(e,a,t){var n=t.next("li.share-note-form"),s=n.find("input.share-note-submit"),i=n.find("input.share-note-error");s.prop("disabled",!0),t.find(".icon-loading-small").removeClass("hidden"),t.find(".icon-edit").hide();$.ajax({method:"PUT",url:OC.linkToOCS("apps/files_sharing/api/v1/shares",2)+a+"?"+OC.buildQueryString({format:"json"}),data:{note:e},complete:function(){s.prop("disabled",!1),t.find(".icon-loading-small").addClass("hidden"),t.find(".icon-edit").show()},error:function(){i.show(),setTimeout(function(){i.hide()},3e3)}})},render:function(){this.$el.find(".has-tooltip").tooltip(),this.password="";var n=this.template(),s=this.model.sharePermissionPossible();if(!s||!this.showLink||!this.configModel.isShareWithLinkAllowed()){var i={shareAllowed:!1};return s||(i.noSharingPlaceholder=t("core","Resharing is not allowed")),this.$el.html(n(i)),this}var l=this.model.isFolder()&&this.model.createPermissionPossible()&&this.configModel.isPublicUploadEnabled(),r="";this.model.isPublicEditingAllowed()&&(r='checked="checked"');var o=this.configModel.get("enforcePasswordForPublicLink"),d=(this.configModel.get("enableLinkPasswordByDefault"),this.configModel.get("enforcePasswordForPublicLink")?e:a),h=!this.model.isFolder()&&this.model.updatePermissionPossible(),c=this.configModel.get("isDefaultExpireDateEnforced"),u=new Date;u.setDate(u.getDate()+1),$.datepicker.setDefaults({minDate:u}),this.$el.find(".datepicker").datepicker({dateFormat:"dd-mm-yy"});var p=4;oc_capabilities.password_policy&&oc_capabilities.password_policy.minLength&&(p=oc_capabilities.password_policy.minLength);var m={urlLabel:t("core","Link"),hideDownloadLabel:t("core","Hide download"),enablePasswordLabel:o?t("core","Password protection enforced"):t("core","Password protect"),passwordLabel:t("core","Password"),passwordPlaceholderInitial:d,publicUpload:l,publicEditing:h,publicEditingChecked:r,publicEditingLabel:t("core","Allow editing"),mailPrivatePlaceholder:t("core","Email link to person"),mailButtonText:t("core","Send"),publicUploadRWLabel:t("core","Allow upload and editing"),publicUploadRLabel:t("core","Read only"),publicUploadWLabel:t("core","File drop (upload only)"),publicUploadRWValue:OC.PERMISSION_UPDATE|OC.PERMISSION_CREATE|OC.PERMISSION_READ|OC.PERMISSION_DELETE,publicUploadRValue:OC.PERMISSION_READ,publicUploadWValue:OC.PERMISSION_CREATE,expireDateLabel:c?t("core","Expiration date enforced"):t("core","Set expiration date"),expirationLabel:t("core","Expiration"),expirationDatePlaceholder:t("core","Expiration date"),isExpirationEnforced:c,isPasswordEnforced:o,defaultExpireDate:moment().add(1,"day").format("DD-MM-YYYY"),addNoteLabel:t("core","Note to recipient"),unshareLabel:t("core","Unshare"),unshareLinkLabel:t("core","Delete share link"),newShareLabel:t("core","Add another link")},f={isPasswordEnforced:o,enforcedPasswordLabel:t("core","Password protection for links is mandatory"),passwordPlaceholder:d,minPasswordLength:p},g=this.pendingPopoverMenuTemplate(_.extend({},f)),v=this.getShareeList();if(_.isArray(v))for(var S=0;S li").each(function(){var e=$(this),a=e.data("share-with"),t=e.data("share-type");e.find("div.avatar, span.username").contactsMenu(a,t,e)});var n=this;if(this.getShareeList().forEach(function(e){var a=n.$("#canEdit-"+n.cid+"-"+e.shareId);1===a.length&&(a.prop("checked","checked"===e.editPermissionState),e.isFolder&&a.prop("indeterminate","indeterminate"===e.editPermissionState))}),this.$(".popovermenu").on("afterHide",function(){n._menuOpen=!1}),this.$(".popovermenu").on("beforeHide",function(){var e=parseInt(n._menuOpen,10);if(!_.isNaN(e)){var a=".expirationDateContainer-"+n.cid+"-"+e,t="#expirationDatePicker-"+n.cid+"-"+e,s="#expireDate-"+n.cid+"-"+e;$(s).prop("checked")&&($(t).removeClass("hidden-visually"),$(a).removeClass("hasDatepicker"),$(a+" .ui-datepicker").hide())}}),!1!==this._menuOpen){var s=parseInt(this._menuOpen,10);if(!_.isNaN(s)){var i="li[data-share-id="+s+"]";OC.showMenu(null,this.$(i+" .sharingOptionsGroup .popovermenu"))}}return this._renderPermissionChange=!1,autosize(this.$el.find(".share-note-form .share-note")),this.delegateEvents(),this},template:function(e){var a=e.sharees;if(_.isArray(a))for(var t=0;t0)}}else"edit"===a.attr("name")&&a.is(":checked")&&(i|=OC.PERMISSION_UPDATE);$(".permissions",n).not('input[name="edit"]').filter(":checked").each(function(e,a){i|=$(a).data("permissions")}),n.find("input[type=checkbox]").prop("disabled",!0);var h=function(){n.find("input[type=checkbox]").prop("disabled",!1)};this.model.updateShare(s,{permissions:i},{error:function(e,a){OC.dialogs.alert(a,t("core","Error while sharing")),h()},success:h}),this._renderPermissionChange=s},onSecureDropChange:function(e){e.preventDefault(),e.stopPropagation();var a=$(e.target),n=a.closest("li[data-share-id]"),s=n.data("share-id"),i=OC.PERMISSION_CREATE|OC.PERMISSION_UPDATE|OC.PERMISSION_DELETE|OC.PERMISSION_READ;a.is(":checked")&&(i=OC.PERMISSION_CREATE|OC.PERMISSION_UPDATE|OC.PERMISSION_DELETE),n.find("input[type=checkbox]").prop("disabled",!0);var l=function(){n.find("input[type=checkbox]").prop("disabled",!1)};this.model.updateShare(s,{permissions:i},{error:function(e,a){OC.dialogs.alert(a,t("core","Error while sharing")),l()},success:l}),this._renderPermissionChange=s}});OC.Share.ShareDialogShareeListView=a}()},function(e,a){!function(){OC.Share||(OC.Share={});var e=OC.Backbone.View.extend({_templates:{},_showLink:!0,tagName:"div",configModel:void 0,resharerInfoView:void 0,linkShareView:void 0,shareeListView:void 0,_lastSuggestions:void 0,_pendingOperationsCount:0,events:{"focus .shareWithField":"onShareWithFieldFocus","input .shareWithField":"onShareWithFieldChanged","click .shareWithConfirm":"_confirmShare"},initialize:function(e){var a=this;if(this.model.on("fetchError",function(){OC.Notification.showTemporary(t("core","Share details could not be loaded for this item."))}),_.isUndefined(e.configModel))throw"missing OC.Share.ShareConfigModel";this.configModel=e.configModel,this.configModel.on("change:isRemoteShareAllowed",function(){a.render()}),this.configModel.on("change:isRemoteGroupShareAllowed",function(){a.render()}),this.model.on("change:permissions",function(){a.render()}),this.model.on("request",this._onRequest,this),this.model.on("sync",this._onEndRequest,this);var n={model:this.model,configModel:this.configModel},s={resharerInfoView:"ShareDialogResharerInfoView",linkShareView:"ShareDialogLinkShareView",shareeListView:"ShareDialogShareeListView"};for(var i in s){var l=s[i];this[i]=_.isUndefined(e[i])?new OC.Share[l](n):e[i]}_.bindAll(this,"autocompleteHandler","_onSelectRecipient","onShareWithFieldChanged","onShareWithFieldFocus"),OC.Plugins.attach("OC.Share.ShareDialogView",this)},onShareWithFieldChanged:function(){var e=this.$el.find(".shareWithField");e.val().length<2&&e.removeClass("error").tooltip("hide")},onShareWithFieldFocus:function(){this.$el.find(".shareWithField").autocomplete("search")},_getSuggestions:function(e,a,t){if(this._lastSuggestions&&this._lastSuggestions.searchTerm===e&&this._lastSuggestions.perPage===a&&this._lastSuggestions.model===t)return this._lastSuggestions.promise;var n=$.Deferred();return $.get(OC.linkToOCS("apps/files_sharing/api/v1")+"sharees",{format:"json",search:e,perPage:a,itemType:t.get("itemType")},function(s){if(100===s.ocs.meta.statuscode){var i=function(e,a,n,s,i,l,r){var o,d,h,c,u,p,m,f,g;for(void 0===i&&(i=[]),void 0===l&&(l=[]),void 0===r&&(r=[]),o=e.length,f=0;fn?1:0})),E=null,_=P.length,k=(s=[],0);k<_;k++)void 0!==P[k].uuid&&P[k].uuid===E&&(P[k].merged=!0),e!==P[k].name&&void 0!==P[k].merged||s.push(P[k]),E=P[k].uuid;var O=oc_config["sharing.maxAutocompleteResults"]>0&&Math.min(a,oc_config["sharing.maxAutocompleteResults"])<=Math.max(m.length+l.length,f.length+r.length,v.length+d.length,g.length+o.length,C.length+h.length,w.length+c.length,b.length+u.length,S.length);n.resolve(s,p,O)}else n.reject(s.ocs.meta.message);var x}).fail(function(){n.reject()}),this._lastSuggestions={searchTerm:e,perPage:a,model:t,promise:n.promise()},this._lastSuggestions.promise},autocompleteHandler:function(e,a){var s=$(".shareWithField"),i=this,l=this.$el.find(".shareWithLoading"),r=this.$el.find(".shareWithConfirm"),o=oc_config["sharing.minSearchStringLength"];if(e.term.trim().length0){if(s.autocomplete("option","autoFocus",!0),a(e),o){var d=t("core","This list is maybe truncated - please refine your search term to see more results.");$(".ui-autocomplete").append('
  • '+d+"
  • ")}}else{var h=t("core","No users or groups found for {search}",{search:s.val()});i.configModel.get("allowGroupSharing")||(h=t("core","No users found for {search}",{search:$(".shareWithField").val()})),s.addClass("error").attr("data-original-title",h).tooltip("hide").tooltip({placement:"bottom",trigger:"manual"}).tooltip("fixTitle").tooltip("show"),a()}}).fail(function(e){i._pendingOperationsCount--,0===i._pendingOperationsCount&&(l.addClass("hidden"),l.removeClass("inlineblock"),r.removeClass("hidden")),e?OC.Notification.showTemporary(t("core",'An error occurred ("{message}"). Please try again',{message:e})):OC.Notification.showTemporary(t("core","An error occurred. Please try again"))})},autocompleteRenderItem:function(e,a){var n="icon-user",s=escapeHTML(a.label),i="",l="";void 0!==a.type&&null!==a.type&&(l=function(e){switch(e){case"HOME":return t("core","Home");case"WORK":return t("core","Work");case"OTHER":return t("core","Other");default:return""+e}}(a.type)+" "),void 0!==a.name&&(s=escapeHTML(a.name)),a.value.shareType===OC.Share.SHARE_TYPE_GROUP?n="icon-contacts-dark":a.value.shareType===OC.Share.SHARE_TYPE_REMOTE?(n="icon-shared",i+=a.value.shareWith):a.value.shareType===OC.Share.SHARE_TYPE_REMOTE_GROUP?(s=t("core","{sharee} (remote group)",{sharee:s},void 0,{escape:!1}),n="icon-shared",i+=a.value.shareWith):a.value.shareType===OC.Share.SHARE_TYPE_EMAIL?(n="icon-mail",i+=a.value.shareWith):a.value.shareType===OC.Share.SHARE_TYPE_CIRCLE?(s=t("core","{sharee} ({type}, {owner})",{sharee:s,type:a.value.circleInfo,owner:a.value.circleOwner},void 0,{escape:!1}),n="icon-circle"):a.value.shareType===OC.Share.SHARE_TYPE_ROOM&&(n="icon-talk");var r=$("