text: /*!   */
  !function(){angular.module("chrome",[]).factory("chrome",function(){return window.chrome})}(),function(){var a=angular.module("chrome.downloads",["chrome","rx"]);a.service("chromeDownloads",["chrome","rx",function(a,b){this.download=function(c){return b.Observable.fromChromeCallback(a.downloads.download,null,a.downloads)(c)}}])}(),function(){var a=angular.module("chrome.identity",["chrome","rx"]);a.service("chromeIdentity",["chrome","rx",function(a,b){this.login=function(c){return angular.isDefined(a.identity)?b.Observable.fromChromeCallback(a.identity.launchWebAuthFlow,null,a.identity)(c):b.Observable.fromChromeCallback(a.runtime.sendMessage,null,a.runtime)({"function":"identity.launchWebAuthFlow",params:[c]})}}])}(),function(){var a=angular.module("chrome.storage",["chrome","rx"]);a.service("chromeStorage",["chrome","rx",function(a,b){this.getLocal=function(c){return b.Observable.fromChromeCallback(a.storage.local.get,null,a.storage.local)(c).map(function(a){return a[c]})},this.setLocal=function(c){return b.Observable.fromChromeCallback(a.storage.local.set,null,a.storage.local)(c)},this.removeLocal=function(c){return b.Observable.fromChromeCallback(a.storage.local.remove,null,a.storage.local)(c)}}])}(),function(){angular.module("crypto",["rx"]).factory("crypto",["rx",function(a){return{getRandomValues:function(a){return window.crypto.getRandomValues(a)},digest:function(b,c){return a.Observable.fromPromise(window.crypto.subtle.digest(b,c))}}}])}(),function(){angular.module("json.patch",[]).factory("jsonpatch",function(){return window.jsonpatch})}(),function(){angular.module("moment",[]).factory("moment",function(){return window.moment})}(),function(){Rx.Observable.fromChromeCallback=function(a,b,c,d){return b||(b=Rx.Scheduler.immediate),function(){var e=Array.prototype.slice.call(arguments,0);return new Rx.AnonymousObservable(function(f){return b.schedule(function(){function b(a){chrome.runtime.lastError&&(f.onError(chrome.runtime.lastError.message),f.onCompleted());var b=a||[void 0];if(d)try{b=d(arguments)}catch(c){return void f.onError(c)}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)})})}},Rx.Observable.fromChromeEvent=function(a,b){return Rx.Observable.fromEventPattern(function(b){a.addListener(b)},function(b){a.removeListener(b)},b)}}(),function(){var a=angular.module("rx.http",["rx"]);a.factory("http",["$http","rx",function(a,b){function c(a){var b=new FormData;for(var c in a)if(a.hasOwnProperty(c)&&angular.isDefined(a[c])){var d=a[c];Array.isArray(d)?(d.unshift(c),b.append.apply(b,d)):b.append(c,d)}return b}function d(d,e,f,g){return f=f||{},f.headers=f.headers||{},b.Observable.fromPromise(a(angular.extend(f,{url:e,method:d},g?{data:c(g),transformRequest:angular.identity,headers:angular.extend(f.headers,{"Content-Type":void 0})}:{})))}function e(a,c,e,f){var g=d(a,c,e,f),h=new b.AsyncSubject;return g.subscribe(h),h.asObservable()}return{getObservable:d,request:e}}])}(),function(){var a=angular.module("box.auth",["rx","box.conf","chrome.identity","crypto"]);a.provider("boxApiAuth",["authUrl","clientId","clientSecret","redirectUri",function(a,b,c,d){function e(a){return function(b){if(b){var c=b.match(/[&\?]error=([^&]+)/);if(c)throw new Error("Error extracting code");var d=b.match(/[&\?]state=([\w\/\-]+)/);if(!d||d[1]!==a)throw new Error("Returned csrf token does not match the one sent!");return b.match(/[&\?]code=([\w\/\-]+)/)[1]}return f()}}var f,g={url:a+"/authorize?client_id="+b+"&response_type=code&redirect_uri="+d,interactive:!0};f=function(){throw new Error("unknown error extracting code")},this.setThrowError=function(a){f=a};var h=null;this.$get=["rx","chromeIdentity","http","crypto",function(f,i,j,k){return{login:function(){var a=new Uint8Array(16);k.getRandomValues(a);var b="box_csrf_token_"+Array.prototype.map.call(a,function(a){var b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return b.charAt(a%b.length)}).join(""),c=JSON.parse(JSON.stringify(g));return c.url+="&state="+b,i.login(c).map(e(b))},getToken:function(e){return j.request("POST",a+"/token",null,{grant_type:"authorization_code",code:e,client_id:b,client_secret:c,redirect_uri:d})},refreshToken:function(e){var g=new f.Subject;return null===h&&(h=j.request("POST",a+"/token",null,{grant_type:"refresh_token",refresh_token:e,client_id:b,client_secret:c,redirect_uri:d}).publish().refCount(),h.subscribe(angular.noop,angular.noop,function(){h=null})),h.subscribe(g),g.asObservable()}}}]}])}(),function(){var a=angular.module("box.conf",[]),b=chrome.runtime||{},c=b.id;a.constant("authUrl","https://www.box.com/api/oauth2"),a.constant("redirectUri","https://"+c+".chromiumapp.org/provider_cb"),a.constant("apiUrl","https://api.box.com/2.0"),a.constant("uploadUrl","https://upload.box.com/api/2.0")}(),function(){var a=angular.module("box.http",["rx","rx.http","box.conf","chrome.storage","crypto","moment"]);a.factory("boxHttp",["rx","chromeStorage","http","boxApiAuth","moment",function(a,b,c,d,e){function f(a){var c=e(),d=e();c.add("days",60),d.add("seconds",a.expires_in),b.setLocal({refresh_token:{token:a.refresh_token,expires_at:c.toDate().toString()},access_token:{token:a.access_token,expires_at:d.toDate().toString()}}).subscribe(angular.noop)}function g(){b.removeLocal("access_token").concat(b.removeLocal("refresh_token")).subscribe(angular.noop)}function h(){return d.login().flatMap(function(a){return d.getToken(a)}).map(function(a){return a.data}).do(f)}function i(a){return!angular.isDefined(a)||!angular.isDefined(a.token)||!angular.isDefined(a.expires_at)||e().isAfter(e(a.expires_at))}function j(c){return b.getLocal("refresh_token").flatMap(function(b){function e(){return c?a.Observable.throw(new Error("Not logged in!")):h()}return i(b)?e():d.refreshToken(b.token).map(function(a){return a.data}).onErrorResumeNext(a.Observable.defer(e).do(g)).take(1)}).do(f).map(function(a){return{token:a.access_token}})}function k(c){return b.getLocal("access_token").flatMap(function(b){return i(b)?j(c):a.Observable.return(b)}).map(function(a){return a.token})}function l(b,d,e,f,g){return b.flatMap(function(a){return angular.extend(f.headers,{Authorization:"Bearer "+a}),c.getObservable(d,e,f,g)}).flatMap(function(b){switch(b.status){case 401:return l(h().map(function(a){return a.access_token}),d,e,f,g);case 202:case 429:return l(a.Observable.timer(1e3*parseInt(b.headers["Retry-After"],10)).flatMap(function(){return k()}),d,e,f,g);default:return a.Observable.return(b.data)}})}function m(){}function n(a){return function(){var b=Array.prototype.slice.call(arguments,0);return b.unshift(a),this.request.apply(this,b)}}return m.prototype={request:function(b,c,d,e){var f=new a.AsyncSubject;return d=d||{},d.headers=d.headers||this.defaultHeaders,l(k(),b,c,d,e).subscribe(f),f.asObservable()},get:n("GET"),post:n("POST"),put:n("PUT"),"delete":n("DELETE"),options:n("OPTIONS"),auth:k,defaultHeaders:{}},m.prototype.constructor=m,new m}]),a.factory("boxHttpResponseInterceptor",["$q","apiUrl",function(a,b){return{responseError:function(c){try{if(0===c.config.url.indexOf(b)&&(401===c.status||429===c.status))return c}catch(d){return a.reject(c)}return a.reject(c)}}}]),a.config(["$httpProvider",function(a){a.interceptors.push("boxHttpResponseInterceptor")}])}(),function(){var a=angular.module("box.sdk",["rx","chrome.storage","box.auth","box.conf","box.http","box.objects","box.util"]);a.factory("boxSdk",["$timeout","rx","boxHttp","apiUrl","authUrl","crypto","BoxCollaboration","BoxFile","BoxFolder","BoxTask","BoxUser","BoxGroup","getAll","clientId","clientSecret","chromeStorage","BoxComment","http","boxObjectBase","responseTranslator","BoxEvent",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u){function v(){this.boxHttp=c}return v.prototype=angular.extend(Object.create(s),{logout:function(){return p.getLocal("refresh_token").flatMap(function(a){return p.removeLocal("access_token").concat(p.removeLocal("refresh_token")).concat(r.request("POST",e+"/revoke",null,{client_id:n,client_secret:o,token:a.token}))}).takeLast(1)},getFolder:function(a){return this.boxHttp.get(d+"/folders/"+a).map(function(a){return new i(a)})},getFile:function(a){return this.boxHttp.get(d+"/files/"+a).map(function(a){return new h(a)})},getTrashedFolder:function(a){return this.boxHttp.get(d+"/folders/"+a+"/trash").map(function(a){return new i(a)})},getTrashedFile:function(a){return this.boxHttp.get(d+"/files/"+a+"/trash").map(function(a){return new h(a)})},getTrashedItems:function(a){var b=this.boxHttp;return m(function(c,e){return b.get(d+"/folders/trash/items",{fields:a,limit:c,offset:e})},t.translateResponse)},getPendingCollaborations:function(){return this.boxHttp.get(d+"/collaborations?pending").flatMap(function(a){return b.Observable.fromArray(a.entries.map(function(a){return new g(a)}))})},search:function(a,b){var c=this.boxHttp;return m(function(e,f){return c.get(d+"/search",{params:angular.extend(b||{},{query:a,limit:e,offset:f})})},t.translateResponse)},createTask:function(a,b){return this.boxHttp.post(d+"/tasks",null,angular.extend(b,{item:{type:"file",id:a.id},action:"review"})).map(function(a){return new j(a)})},getUserInfo:function(){return this.boxHttp.get(d+"/users/me").map(function(a){return new k(a)})},getUsers:function(a){var b=this.boxHttp;return m(function(c,e){return b.get(d+"/users",{params:{filter_term:a,limit:c,offset:e}})},function(a){return new k(a)})},createUser:function(a){return this.boxHttp.post(d+"/users",null,a).map(function(a){return new k(a)})},getGroups:function(){return this.boxHttp.get(d+"/groups").flatMap(function(a){return b.Observable.fromArray(a.entries.map(function(a){return new l(a)}))})},createGroup:function(a){return this.boxHttp.post(d+"/groups",null,{name:a}).map(function(a){return new l(a)})},subscribeToEvents:function(c){function e(a){return f.options(d+"/events").flatMap(function(c){return f.get(c.entries[0].url+"&stream_position="+a).flatMap(function(c){if("new_change"===c.message){var e=-1;return b.Observable.while(function(){return 0!==e},b.Observable.defer(function(){return b.Observable.return(a)}).flatMap(function(c){return f.get(d+"/events?stream_position="+c).do(function(b){e=b.chunk_size,a=b.next_stream_position}).flatMap(function(a){return b.Observable.fromArray(a.entries).map(function(b){return new u(b,a.next_stream_position)})})}))}return"reconnect"===c.message,b.Observable.empty()}).timeout(1e3*c.entries[0].retry_timeout,b.Observable.defer(function(){return b.Observable.empty()})).map(function(b){return{result:b,streamPosition:a}})})}var f=this.boxHttp,g=b.Observable.return(c);angular.isDefined(c)||(g=f.get(d+"/events?stream_position=now").map(function(a){return a.next_stream_position}));var h=new b.ReplaySubject;return g.subscribe(function(b){function c(){e(d).do(function(a){d=a.streamPosition}).subscribe(function(a){h.onNext(a.result)},function(a){h.onError(a)},function(){a(c,1)})}var d=b;c()}),h.asObservable()}}),new v}]),a.config(["boxApiAuthProvider",function(a){a.setThrowError(function(){throw chrome.runtime.lastError})}])}(),function(){var a=angular.module("box.util",["rx"]);a.provider("getAll",function(){var a=20;this.setDefaultLimit=function(b){a=b},this.$get=["rx",function(b){return function(c,d){var e=a,f=0,g=-1;return b.Observable.while(function(){return-1===g||g>f},b.Observable.defer(function(){return b.Observable.return({limit:e,offset:f})}).flatMap(function(a){return c(a.limit,a.offset).do(function(a){f+=e,g=a.total_count}).flatMap(function(a){return b.Observable.fromArray(a.entries.map(d).filter(function(a){return null!==a}))})}))}}]}),a.service("responseTranslator",[function(){var a=[];this.registerTranslator=function(b){a.push(b)},this.translateResponse=function(b){var c=a.map(function(a){return a(b)}).filter(angular.identity);return c.length>0?c[0]:b},this.registerDefaultTranslator=function(a,b){this.registerTranslator(function(c){return c.type===a?new b(c):null})}}])}(),function(){var a=angular.module("box.objects",["rx","box.conf","box.http","box.util","chrome.downloads"]);a.factory("boxObjectBase",["apiUrl","boxHttp",function(a,b){function c(a){var b=Object.create(this.defaultHeaders||{});this.defaultHeaders=angular.extend(b,{"As-User":a.id})}var d=Object.getPrototypeOf(b).constructor;return c.prototype=Object.create(new d),{url:function(){return a+"/"+this.urlType+"/"+this.id},asUser:function(a){function b(){d.apply(this,e)}var d=this.constructor,e=[];b.prototype=Object.create(d.prototype);for(var f=0;f<d.length-1;f++)e.push(null);e.push(this);var g=new b;return g.boxHttp=new c(a),g}}}])}(),function(){angular.module("box.objects").factory("BoxCollaboration",["boxHttp","boxObjectBase","responseTranslator",function(a,b,c){function d(b){angular.extend(this,b),this.boxHttp=a}return d.prototype=angular.extend(Object.create(b),{urlType:"collaborations",edit:function(a,b){return this.boxHttp.put(this.url(),{role:a,status:b}).map(function(a){return new d(a)})},"delete":function(){return this.boxHttp.delete(this.url())},getInfo:function(){return this.boxHttp.get(this.url()).map(function(a){return new d(a)})}}),d.prototype.constructor=d,c.registerDefaultTranslator("collaboration",d),d}])}(),function(){angular.module("box.objects").factory("BoxComment",["boxHttp","boxObjectBase","responseTranslator",function(a,b,c){function d(b){angular.extend(this,b),this.boxHttp=a}return d.prototype=angular.extend(Object.create(b),{urlType:"comments",updateMessage:function(a){return this.boxHttp.put(this.url(),null,{message:a}).map(function(a){return new d(a)})},getInfo:function(){return this.boxHttp.get(this.url()).map(function(a){return new d(a)})},"delete":function(){return this.boxHttp.delete(this.url())}}),d.prototype.constructor=d,c.registerDefaultTranslator("comment",d),d}])}(),function(){angular.module("box.objects").factory("BoxEvent",["boxHttp","boxObjectBase","responseTranslator",function(a,b,c){function d(a,b){angular.extend(this,a),this.streamPosition=b,angular.isDefined(this.source)&&(this.source=c.translateResponse(this.source))}return d.prototype=angular.extend(Object.create(b),{}),d.prototype.constructor=d,d}])}(),function(){angular.module("box.objects").factory("BoxFile",["rx","crypto","chromeDownloads","apiUrl","uploadUrl","boxHttp","boxItem","BoxFileVersion","BoxComment","BoxTask","BoxMetadata","responseTranslator",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(a){angular.extend(this,a),this.boxHttp=f}return m.prototype=angular.extend(Object.create(g),{urlType:"files",download:function(a){var b=this.url()+"/content";return a&&a.version&&(b+="?version="+a.version),this.boxHttp.auth().flatMap(function(a){return c.download({url:b,headers:[{Authorization:"Bearer "+a}]})})},getContent:function(a){return this.boxHttp.get(this.url()+"/content",{params:a,responseType:"blob"})},replace:function(a,c,d,f){var g=this.boxHttp,h=this.etag,i=this.id;return b.digest("SHA-1",c).map(function(a){return Array.prototype.map.call(new Uint8Array(a),function(a){return("0"+a.toString(16)).slice(-2)}).join("")}).flatMap(function(b){return g.post(e+"/files/"+i+"/content",{headers:angular.extend({"Content-MD5":b},f?{"If-Match":h}:{})},{filename:[new Blob([c]),a],content_modified_at:d}).map(function(a){return new m(a.entries[0])})})},getHistory:function(){var b=this;return this.boxHttp.get(this.url()+"/versions").flatMap(function(c){return a.Observable.fromArray(c.entries.map(function(a){return new h(b,a)}))})},getThumbnail:function(a,b){return this.boxHttp.get(this.url()+"/thumbnail."+a,{responseType:"blob",params:b})},getComments:function(){return this.boxHttp.get(this.url()+"/comments").flatMap(function(b){return a.Observable.fromArray(b.entries.map(function(a){return new i(a)}))})},getTasks:function(){return this.boxHttp.get(this.url()+"/tasks").flatMap(function(b){return a.Observable.fromArray(b.entries.map(function(a){return new j(a)}))})},getMetadata:function(a){var b=this;return this.boxHttp.get(this.url()+"/metadata/"+a).map(function(a){return new k(b,a)})},createMetadata:function(a,b){var c=this;return this.boxHttp.post(this.url()+"/metadata/"+a,null,b).map(function(a){return new k(c,a)})}}),m.prototype.constructor=m,l.registerDefaultTranslator("file",m),m}])}(),function(){angular.module("box.objects").factory("BoxFileVersion",["boxHttp","boxObjectBase","responseTranslator",function(a,b,c){function d(b,c){this.file=b,angular.extend(this,c),this.boxHttp=a}return d.prototype=angular.extend(Object.create(b),{url:function(){return this.file.url()+"/versions"},promoteToCurrent:function(){var a=this.file;return this.boxHttp.post(this.url()+"/current",null,{type:"file_version",id:this.id}).map(function(b){return new d(a,b)})},"delete":function(){return this.boxHttp.delete(this.url()+"/"+this.id)},download:function(){return this.file.download({version:this.id})}}),d.prototype.constructor=d,c.registerDefaultTranslator("file_version",d),d}])}(),function(){angular.module("box.objects").factory("BoxFolder",["rx","crypto","apiUrl","uploadUrl","boxHttp","boxItem","BoxCollaboration","BoxFile","getAll","responseTranslator",function(a,b,c,d,e,f,g,h,i,j){function k(a){angular.extend(this,a),this.boxHttp=e}return k.prototype=angular.extend(Object.create(f),{urlType:"folders",getItems:function(a){var b=this.url(),c=this.boxHttp;return i(function(d,e){return c.get(b+"/items",{params:{fields:a,offset:e,limit:d}})},j.translateResponse)},createSubfolder:function(a){return this.boxHttp.post(c+"/folders",null,{name:a,parent:{id:this.id}}).map(function(a){return new k(a)})},getCollaborations:function(){return this.boxHttp.get(this.url()+"/collaborations").flatMap(function(b){return a.Observable.fromArray(b.entries.map(function(a){return new g(a)}))})},addCollaboration:function(a,b,d){return this.boxHttp.post(c+"/collaborations",angular.isDefined(d)?{notify:d}:null,{item:{type:this.type,id:this.id},accessible_by:b,role:a}).map(function(a){return new g(a)})},uploadFileTo:function(a,c,e,f){var g=this.boxHttp,i=this.id;return b.digest("SHA-1",c).map(function(a){return Array.prototype.map.call(new Uint8Array(a),function(a){return("0"+a.toString(16)).slice(-2)}).join("")}).flatMap(function(b){return g.post(d+"/files/content",{headers:{"Content-MD5":b}},{filename:[new Blob([c]),a],parent_id:i,content_created_at:e,content_modified_at:f}).map(function(a){return new h(a.entries[0])})})}}),k.prototype.constructor=k,j.registerDefaultTranslator("folder",k),k}])}(),function(){angular.module("box.objects").factory("BoxGroup",["boxHttp","boxObjectBase","apiUrl","BoxCollaboration","rx","responseTranslator",function(a,b,c,d,e,f){function g(b){angular.extend(this,b),this.boxHttp=a}return g.prototype=angular.extend(Object.create(b),{urlType:"groups",update:function(a){return this.boxHttp.put(this.url(),null,a).map(function(a){return new g(a)})},"delete":function(){return this.boxHttp.delete(this.url())},getMemberships:function(){return this.boxHttp.get(this.url()+"/memberships").flatMap(function(a){return e.Observable.fromArray(a.entries)})},addMember:function(a,b){return this.boxHttp.post(c+"/group_memberships",null,{user:{id:a.id},group:{id:this.id},role:b})},updateMembership:function(a,b){return this.boxHttp.put(c+"/group_memberships/"+a.id,null,{role:b})},deleteMembership:function(a){return this.boxHttp.delete(c+"/group_memberships/"+a.id)},getCollaborations:function(){return this.boxHttp.get(this.url()+"/collaborations").flatMap(function(a){return e.Observable.fromArray(a.entries.map(function(a){return new d(a)}))})}}),g.prototype.constructor=g,f.registerDefaultTranslator("group",g),g}])}(),function(){angular.module("box.objects").factory("boxItem",["boxHttp","boxObjectBase","BoxComment","apiUrl",function(a,b,c,d){return angular.extend(Object.create(b),{updateInfo:function(a,b){var c=this.constructor;return this.boxHttp.put(this.url(),{headers:b?{"If-Match":this.etag}:{}},a).map(function(a){return new c(a)})},getSharedLink:function(a,b,c){return this.updateInfo({shared_link:{access:a,unshared_at:b,permissions:c}})},copyTo:function(a,b){var c=this.constructor;return this.boxHttp.post(this.url()+"/copy",null,{parent:{id:a.id},name:b||this.name}).map(function(a){return new c(a)})},"delete":function(a,b){return this.boxHttp.delete(this.url(),{headers:b?{"If-Match":this.etag}:{},params:{recursive:!!a}})},commentOn:function(a){return this.boxHttp.post(d+"/comments",null,{item:{type:this.type,id:this.id},message:a}).map(function(a){return new c(a)})},restoreFromTrash:function(a,b){var c=this.constructor;return this.boxHttp.post(this.url(),null,{parent:{id:a.id},name:b||this.name}).map(function(a){return new c(a)})},deleteFromTrash:function(a){return this.boxHttp.delete(this.url()+"/trash",{headers:a?{"If-Match":this.etag}:{}})}})}])}(),function(){angular.module("box.objects").factory("BoxMetadata",["boxHttp","boxObjectBase",function(a,b){function c(b,c){this.file=b,angular.extend(this,c),this.boxHttp=a}function d(){this.ops=[]}return c.prototype=angular.extend(Object.create(b),{url:function(){return this.file.url()+"/metadata/"+this.$type},sendUpdate:function(a){var b=this.file;return this.boxHttp.put(this.url(),{headers:{"Content-Type":"application/json-patch+json"}},a.ops).map(function(a){return new c(b,a)})},"delete":function(){return this.boxHttp.delete(this.url())},startUpdate:function(){return new d}}),d.prototype={add:function(a,b){this.ops.push({op:"add",path:a,value:b})},remove:function(a,b){b&&this.test(a,b),this.ops.push({op:"remove",path:a})},replace:function(a,b,c){c&&this.test(a,c),this.ops.push({op:"replace",path:a,value:b})},test:function(a,b){this.ops.push({op:"test",path:a,value:b})}},c.prototype.constructor=c,c}])}(),function(){angular.module("box.objects").factory("BoxTask",["rx","boxHttp","apiUrl","boxObjectBase","BoxTaskAssignment","responseTranslator",function(a,b,c,d,e,f){function g(a){angular.extend(this,a),this.boxHttp=b}return g.prototype=angular.extend(Object.create(d),{urlType:"tasks",getInfo:function(){return this.boxHttp.get(this.url()).map(function(a){return new g(a)})},update:function(a){return this.boxHttp.put(this.url(),null,a).map(function(a){return new g(a)})},"delete":function(){return this.boxHttp.delete(this.url())},getAssignments:function(){var b=this;return this.boxHttp.get(this.url()+"/assignments").flatMap(function(c){return a.Observable.fromArray(c.entries.map(function(a){return new e(b,a)}))})},assignTo:function(a){return this.boxHttp.post(c+"/task_assignments",null,{task:{id:this.id,type:"task"},assign_to:{id:a.id,login:a.login}}).map(function(a){return new e(a)})}}),g.prototype.constructor=g,f.registerDefaultTranslator("task",g),g}])}(),function(){angular.module("box.objects").factory("BoxTaskAssignment",["boxHttp","boxObjectBase","responseTranslator",function(a,b,c){function d(b,c){this.task=b,angular.extend(this,c),this.boxHttp=a}return d.prototype=angular.extend(Object.create(b),{urlType:"task_assignments",getInfo:function(){var a=this.task;return this.boxHttp.get(this.url()).map(function(b){return new d(a,b)})},"delete":function(){return this.boxHttp.delete(this.url())},update:function(a,b){return this.boxHttp.put(this.url(),null,{message:a,resolution_state:b}).map(function(a){return new d(a)})}}),d.prototype.constructor=d,c.registerDefaultTranslator("task_assignment",d),d}])}(),function(){angular.module("box.objects").factory("BoxUser",["rx","apiUrl","boxHttp","boxObjectBase","BoxCollaboration","BoxComment","BoxFile","BoxFileVersion","BoxFolder","BoxGroup","boxItem","BoxMetadata","BoxTask","BoxTaskAssignment","responseTranslator",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){function p(a){angular.extend(this,a),this.boxHttp=c}return p.prototype=angular.extend(Object.create(d),{urlType:"users",assignTaskTo:function(a){return this.boxHttp.post(b+"/task_assignments",null,{task:{id:a.id,type:"task"},assign_to:{id:this.id,login:this.login}}).map(function(a){return new n(a)})},update:function(a,b){return this.boxHttp.put(this.url(),angular.isDefined(b)?{notify:b}:null,a).map(function(a){return new p(a)})},"delete":function(a,b){return this.boxHttp.delete(this.url(),angular.extend({},angular.isDefined(a)?{notify:a}:{},angular.isDefined(b)?{force:b}:{}))},giveRootFolderToUser:function(a){return this.boxHttp.put(this.url()+"/folders/0",null,{owned_by:{id:a.id}}).map(function(a){return new i(a)})},getEmailAliases:function(){return this.boxHttp.get(this.url()+"/email_aliases").flatMap(function(b){return a.Observable.fromArray(b.entries)})},addEmailAlias:function(a){return this.boxHttp.post(this.url()+"/email_aliases",null,{email:a})},deleteEmailAlias:function(a){return this.boxHttp.delete(this.url()+"/email_aliases/"+a.id)}}),p.prototype.constructor=p,o.registerDefaultTranslator("user",p),p}])}(),function(){angular.module("box.ui",["rx","chrome","ui.bootstrap","box.sdk"])}(),function(){function a(a){"use strict";return{scope:{item:"="},link:function(b){b.selectFolder=function(b){a.selectItem(b)}},template:'<span ng-if="!!item" class="box-breadcrumb"><span data-ng-repeat="parent in item.path_collection.entries"><span class="box-breadcrumb box-breadcrumb-parent" data-ng-click="selectFolder(parent)">{{parent.name}}</span><span> / </span></span><span class="box-breadcrumb box-breadcrumb-leaf" data-ng-click="selectFolder(item)">{{item.name}}</span></span>',restrict:"EA",replace:!0}}function b(a){"use strict";return{template:'<div class="box-item"><div ng-if="!!item"><div class="box-item-thumbnail"><span box-item-thumbnail item="item" thumbnail-size="thumbnailSize"></span></div><div class="box-item-body" ng-click="select()" ng-dblclick="select() && $emit(\'closeModal\')">    <span class="box-item-body-title">{{item.name}}</span>    <span class="box-item-body-size">{{item.size | bytes}}</span>    <span class="box-item-body-date">{{item.modified_at | date : \'mediumDate\'}}</span></div></div></div>',scope:{item:"=",thumbnailSize:"="},link:function(b,c){b.select=function(){return a.selectItem(b.item),c.addClass("selected"),!0},a.selectedItem.subscribe(function(a){a.id!==b.item.id&&c.removeClass("selected")})},replace:!0,restrict:"EA"}}function c(a){"use strict";return{scope:{item:"=",thumbnailSize:"="},template:"<span></span>",link:function(b,c){if("folder"===b.item.type){var d=new Image;d.src=a.runtime.getURL("img/folder.jpg"),c.empty(),c.append(d)}else"file"===b.item.type&&b.item.getThumbnail("png",b.thumbnailSize).subscribe(function(a){var d=new Image;d.height=b.thumbnailSize.min_height,d.width=b.thumbnailSize.min_width,-1!==a.type.indexOf("text/")&&(a=new Blob([a],{type:"image/png"})),d.src=window.URL.createObjectURL(a),d.onload=function(){window.URL.revokeObjectURL(d.src)},c.empty(),c.append(d)})},replace:!0,restrict:"EA"}}function d(a){"use strict";return{template:'<div><span box-folder-view folder-id="0"></span></div>',replace:!0,restrict:"EA",link:function(){a.selectItem({type:"folder",id:"0"})}}}function e(a,b){"use strict";return{template:'<div><div class="item-view-header">    <span box-breadcrumbs item="folder"></span></div><div class="item-view-body">    <div class="folder-view-item-wrapper" ng-repeat="item in items">        <div box-item item="item" thumbnail-size="thumbnailSize"></div>    </div></div></div>',scope:{folderId:"@"},replace:!0,restrict:"EA",link:function(c){angular.extend(c,{items:[],thumbnailSize:{min_width:32,max_width:32,min_height:32,max_height:32}}),c.getFolder=function(b){c.items=[],a.getFolder(b).do(function(a){c.name=a.name,c.folder=a}).flatMap(function(a){return a.getItems("size,modified_at,name")}).subscribe(function(a){a.modified_at=new Date(a.modified_at),c.items.push(a)})},c.selectedItemDisposable=b.selectedItem.subscribe(function(a){"folder"===a.type?(c.folderId=a.id,c.getFolder(a.id)):c.fileId=a.id})}}}var f=angular.module("box.ui");f.directive("boxBreadcrumbs",["boxItemSelected",a]),f.directive("boxItem",["boxItemSelected",b]),f.directive("boxItemThumbnail",["chrome",c]),f.directive("boxAllFiles",["boxItemSelected",d]),f.directive("boxFolderView",["boxSdk","boxItemSelected",e])}(),function(){function a(){"use strict";return function(a,b){if(isNaN(parseFloat(a))||!isFinite(a))return"-";if(0===parseFloat(a))return"0 bytes";"undefined"==typeof b&&(b=1);var c=["bytes","kB","MB","GB","TB","PB"],d=Math.floor(Math.log(a)/Math.log(1024));return(a/Math.pow(1024,Math.floor(d))).toFixed(b)+" "+c[d]}}var b=angular.module("box.ui");b.filter("bytes",a)}(),function(){function a(a){"use strict";var b=new a.ReplaySubject(1);return{selectItem:function(a){b.onNext(a)},selectedItem:b.asObservable()}}function b(a,b,c,d){"use strict";var e=Object.freeze({SAVE_AS:"Save File As",OPEN_FILE:"Open File",OPEN_FOLDER:"Open Folder"});return{mode:e,open:function(f,g,h){var i=a.open(angular.extend(h||{},{template:'<div>   <div class="modal-header">       <h3 class="modal-title">'+f+'</h3>   </div>   <div class="modal-body">       <span box-all-files></span>       <div><label>Filename: <input type="text" ng-model="filename" /></label></div>   </div>   <div class="modal-footer">       <button class="btn btn-primary" ng-click="close()">OK</button>       <button class="btn btn-warning" ng-click="$dismiss()">Cancel</button>   </div></div>',controller:function(a){a.filename=g,a.close=function(){c.selectedItem.map(function(b){switch(f){case e.SAVE_AS:return b.filename=a.filename,b;case e.OPEN_FILE:if("folder"===b.type)throw new Error("Invalid selection - select a file.");return b;case e.OPEN_FOLDER:return"folder"===b.type?b:new d(b.parent);default:return b}}).subscribe(i.close.bind(i),i.dismiss.bind(i),angular.noop)},a.$on("closeModal",a.close),c.selectedItem.subscribe(function(b){"file"===b.type&&(a.filename=b.name)})}}));return b.Observable.fromPromise(i.result)}}}var c=angular.module("box.ui");c.factory("boxItemSelected",["rx",a]),c.factory("boxItemPicker",["$modal","rx","boxItemSelected","BoxFolder",b])}();