!function(t){vare={};functioni(n){if(e[n])returne[n].exports;vars=e[n]={i:n,l:!1,exports:{}};returnt[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeofSymbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)returnt;if(4&e&&"object"==typeoft&&t&&t.__esModule)returnt;varn=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeoft)for(varsint)i.d(n,s,function(e){returnt[e]}.bind(null,s));returnn},i.n=function(t){vare=t&&t.__esModule?function(){returnt.default}:function(){returnt};returni.d(e,"a",e),e},i.o=function(t,e){returnObject.prototype.hasOwnProperty.call(t,e)},i.p="/js/",i(i.s=8)}([function(t,e,i){"use strict";varn=i(2),s=i.n(n),o=i(3),r=i.n(o)()(s.a);r.push([t.i,"#app-content-systemtagsfilter .select2-container{width:30%;margin-left:10px}#app-sidebar .app-sidebar-header__action .tag-label{cursor:pointer;padding:13px 0;display:flex;color:var(--color-text-light);position:relative;margin-top:-20px}\n","",{version:3,sources:["webpack://./apps/systemtags/src/css/systemtagsfilelist.scss"],names:[],mappings:"AASA,iDACC,SAAU,CACV,gBAAiB,CACjB,oDAGA,cAAe,CACf,cAAe,CACf,YAAa,CACb,6BAA8B,CAC9B,iBAAkB,CAClB,gBAAiB",sourcesContent:["/*\n * Copyright (c) 2016\n *\n * This file is licensed under the Affero General Public License version 3\n * or later.\n *\n * See the COPYING-README file.\n *\n */\n#app-content-systemtagsfilter .select2-container {\n\twidth: 30%;\n\tmargin-left: 10px;\n}\n\n#app-sidebar .app-sidebar-header__action .tag-label {\n\tcursor: pointer;\n\tpadding: 13px 0;\n\tdisplay: flex;\n\tcolor: var(--color-text-light);\n\tposition: relative;\n\tmargin-top: -20px;\n}\n"],sourceRoot:""}]),e.a=r},function(t,e,i){"use strict";varn,s=function(){returnvoid0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},o=function(){vart={};returnfunction(e){if(void0===t[e]){vari=document.querySelector(e);if(window.HTMLIFrameElement&&iinstanceofwindow.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}t[e]=i}returnt[e]}}(),r=[];functiona(t){for(vare=-1,i=0;i<r.length;i++)if(r[i].identifier===t){e=i;break}returne}functionl(t,e){for(vari={},n=[],s=0;s<t.length;s++){varo=t[s],l=e.base?o[0]+e.base:o[0],c=i[l]||0,u="".concat(l," ").concat(c);i[l]=c+1;vard=a(u),f={css:o[1],media:o[2],sourceMap:o[3]};-1!==d?(r[d].references++,r[d].updater(f)):r.push({identifier:u,updater:m(f,e),references:1}),n.push(u)}returnn}functionc(t){vare=document.createElement("style"),n=t.attributes||{};if(void0===n.nonce){vars=i.nc;s&&(n.nonce=s)}if(Object.keys(n).forEach((function(t){e.setAttribute(t,n[t])})),"function"==typeoft.insert)t.insert(e);else{varr=o(t.insert||"head");if(!r)thrownewError("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(e)}returne}varu,d=(u=[],function(t,e){returnu[t]=e,u.filter(Boolean).join("\n")});functionf(t,e,i,n){vars=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(t.styleSheet)t.styleSheet.cssText=d(e,s);else{varo=document.createTextNode(s),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(o,r[e]):t.appendChild(o)}}functionp(t,e,i){varn=i.css,s=i.media,o=i.sourceMap;if(s?t.setAttribute("media",s):t.removeAttribute("media"),o&&"undefined"!=typeofbtoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}varh=null,g=0;functionm(t,e){vari,n,s;if(e.singleton){varo=g++;i=h||(h=c(e)),n=f.bind(null,i,o,!1),s=f.bind(null,i,o,!0)}elsei=c(e),n=p.bind(null,i,e),s=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(i)
varn;(n=function(t,e){this.initialize(t,e)}).prototype=_.extend({},OCA.Files.FileList.prototype,{id:"systemtagsfilter",appName:t("systemtags","Tagged files"),_systemTagIds:[],_lastUsedTags:[],_clientSideSort:!0,_allowSelection:!1,_filterField:null,initialize:function(t,e){if(OCA.Files.FileList.prototype.initialize.apply(this,arguments),!this.initialized){e&&e.systemTagIds&&(this._systemTagIds=e.systemTagIds),OC.Plugins.attach("OCA.SystemTags.FileList",this);vari=this.$el.find("#controls").empty();_.defer(_.bind(this._getLastUsedTags,this)),this._initFilterField(i)}},destroy:function(){this.$filterField.remove(),OCA.Files.FileList.prototype.destroy.apply(this,arguments)},_getLastUsedTags:function(){vart=this;$.ajax({type:"GET",url:OC.generateUrl("/apps/systemtags/lastused"),success:function(e){t._lastUsedTags=e}})},_initFilterField:function(e){vari=this;returnthis.$filterField=$('<input type="hidden" name="tags"/>'),e.append(this.$filterField),this.$filterField.select2({placeholder:t("systemtags","Select tags to filter by"),allowClear:!1,multiple:!0,toggleSelect:!0,separator:",",query:_.bind(this._queryTagsAutocomplete,this),id:function(t){returnt.id},initSelection:function(t,e){vari=$(t).val().trim();if(i){varn=i.split(","),s=[];OC.SystemTags.collection.fetch({success:function(){_.each(n,(function(t){vare=OC.SystemTags.collection.get(t);_.isUndefined(e)||s.push(e.toJSON())})),e(s)}})}elsee([])},formatResult:function(t){returnOC.SystemTags.getDescriptiveTag(t)},formatSelection:function(t){returnOC.SystemTags.getDescriptiveTag(t)[0].outerHTML},sortResults:function(t){returnt.sort((function(t,e){varn=i._lastUsedTags.indexOf(t.id),s=i._lastUsedTags.indexOf(e.id);returnn!==s?-1===s?-1:-1===n?1:n<s?-1:1:OC.Util.naturalSortCompare(t.name,e.name)})),t},escapeMarkup:function(t){returnt},formatNoMatches:function(){returnt("systemtags","No tags found")}}),this.$filterField.on("change",_.bind(this._onTagsChanged,this)),this.$filterField},_queryTagsAutocomplete:function(t){OC.SystemTags.collection.fetch({success:function(){vare=OC.SystemTags.collection.filterByName(t.term);t.callback({results:_.invoke(e,"toJSON")})}})},_onUrlChanged:function(t){if(t.dir){vare=_.filter(t.dir.split("/"),(function(t){return""!==t.trim()}));this.$filterField.select2("val",e||[]),this._systemTagIds=e,this.reload()}},_onTagsChanged:function(t){vare=$(t.target).val().trim();this._systemTagIds=""!==e?e.split(","):[],this.$el.trigger($.Event("changeDirectory",{dir:this._systemTagIds.join("/")})),this.reload()},updateEmptyContent:function(){vare=this.getCurrentDirectory();"/"===e?(this._systemTagIds.length?this.$el.find("#emptycontent").html('<div class="icon-systemtags"></div><h2>'+t("systemtags","No files found for the selected tags")+"</h2>"):this.$el.find("#emptycontent").html('<div class="icon-systemtags"></div><h2>'+t("systemtags","Please select tags to filter by")+"</h2>"),this.$el.find("#emptycontent").toggleClass("hidden",!this.isEmpty),this.$el.find("#filestable thead th").toggleClass("hidden",this.isEmpty)):OCA.Files.FileList.prototype.updateEmptyContent.apply(this,arguments)},getDirectoryPermissions:function(){returnOC.PERMISSION_READ|OC.PERMISSION_DELETE},updateStorageStatistics:function(){},reload:function(){if(this._setCurrentDir("/",!1),!this._systemTagIds.length)returnthis.updateEmptyContent(),this.setFiles([]),$.Deferred().resolve();this._selectedFiles={},this._selectionSummary.clear(),this._currentFileModel&&this._currentFileModel.off(),this._currentFileModel=null,this.$el.find(".select-all").prop("checked",!1),this.showMask(),this._reloadCall=this.filesClient.getFilteredFiles({systemTagIds:this._systemTagIds},{properties:this._getWebdavProperties()}),this._detailsView&&this._updateDetailsView(null);vart=this.reloadCallback.bind(this);returnthis._reloadCall.then(t,t)},reloadCallback:function(t,e){returne&&e.unshift({}),OCA.Files.FileList.prototype.reloadCallback.call(this,t,e)}}),OCA.SystemTags.FileList=n},function(t,e){OCA.SystemTags=_.extend({},OCA.SystemTags),OCA.SystemTags||(OCA.SystemTags={}),OCA.SystemTags.Fi