/*! For license information please see systemtags-init.js.LICENSE.txt */ (()=>{var e,t={36834:(e,t,s)=>{"use strict";var n=s(25883),r=s(53334),i=s(85072),o=s.n(i),a=s(97825),l=s.n(a),c=s(77659),d=s.n(c),A=s(55056),p=s.n(A),u=s(10540),g=s.n(u),f=s(41113),m=s.n(f),h=s(73911),y={};y.styleTagTransform=m(),y.setAttributes=p(),y.insert=d().bind(null,"head"),y.domAPI=l(),y.insertStyleElement=g(),o()(h.A,y),h.A&&h.A.locals&&h.A.locals;const C=/[\p{Lu}]/u,v=/[\p{Ll}]/u,w=/^[\p{Lu}](?![\p{Lu}])/gu,b=/([\p{Alpha}\p{N}_]|$)/u,x=/[_.\- ]+/,T=new RegExp("^"+x.source),_=new RegExp(x.source+b.source,"gu"),L=new RegExp("\\d+"+b.source,"gu");function B(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},0===(e=Array.isArray(e)?e.map((e=>e.trim())).filter((e=>e.length)).join("-"):e.trim()).length)return"";const s=!1===t.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t.locale),n=!1===t.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(t.locale);return 1===e.length?x.test(e)?"":t.pascalCase?n(e):s(e):(e!==s(e)&&(e=((e,t,s,n)=>{let r=!1,i=!1,o=!1,a=!1;for(let l=0;l2)||"-"===e[l-3],r&&C.test(c)?(e=e.slice(0,l)+"-"+e.slice(l),r=!1,o=i,i=!0,l++):i&&o&&v.test(c)&&(!a||n)?(e=e.slice(0,l-1)+"-"+e.slice(l-1),o=i,i=!1,r=!0):(r=t(c)===c&&s(c)!==c,o=i,i=s(c)===c&&t(c)!==c)}return e})(e,s,n,t.preserveConsecutiveUppercase)),e=e.replace(T,""),e=t.preserveConsecutiveUppercase?((e,t)=>(w.lastIndex=0,e.replaceAll(w,(e=>t(e)))))(e,s):s(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),((e,t)=>(_.lastIndex=0,L.lastIndex=0,e.replaceAll(L,((s,n,r)=>["_","-"].includes(e.charAt(r+s.length))?s:t(s))).replaceAll(_,((e,s)=>t(s)))))(e,n))}const E=function(e){const t=e.attributes?.["system-tags"]?.["system-tag"];return void 0===t?[]:[t].flat().map((e=>"string"==typeof e?e:e.text))},O=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s=document.createElement("li");return s.classList.add("files-list__system-tag"),s.textContent=e,t&&s.classList.add("files-list__system-tag--more"),s},P=new n.hY({id:"system-tags",displayName:()=>"",iconSvgInline:()=>"",enabled(e){if(1!==e.length)return!1;const t=e[0];return 0!==E(t).length},exec:async()=>null,async renderInline(e){const t=E(e);if(0===t.length)return null;const s=document.createElement("ul");if(s.classList.add("files-list__system-tags"),1===t.length)s.setAttribute("aria-label",(0,r.Tl)("files","This file has the tag {tag}",{tag:t[0]}));else{const e=t.slice(0,-1).join(", "),n=t[t.length-1];s.setAttribute("aria-label",(0,r.Tl)("files","This file has the tags {firstTags} and {lastTag}",{firstTags:e,lastTag:n}))}if(s.append(O(t[0])),t.length>1){const e=O("+"+(t.length-1),!0);e.setAttribute("title",t.slice(1).join(", ")),s.append(e)}return s},order:0});(0,n.Yc)("nc:system-tags"),(0,n.Gg)(P);var I=s(21777),R=(s(65043),s(60669));const j=(0,s(63814).dC)("dav"),S=(0,R.UU)(j),U=e=>{S.setHeaders({"X-Requested-With":"XMLHttpRequest",requesttoken:e??""})};(0,I.zo)(U),U((0,I.do)());const N=(0,s(35947).YK)().setApp("systemtags").detectUser().build(),z="/systemtags",Y=(0,n.H4)(),k=e=>(0,n.Al)(e),G=e=>`\n\n\t\n\t\t${(0,n.VX)()}\n\t\n\t\n\t\t${e}\n\t\n`,$=function(e){return new n.vd({id:e.id,source:`${n.PY}${z}/${e.id}`,owner:String((0,I.HW)()?.uid??"anonymous"),root:z,displayname:e.displayName,permissions:n.aX.READ,attributes:{...e,"is-tag":!0}})};(0,n.bh)().register(new n.Ss({id:"tags",name:(0,r.Tl)("systemtags","Tags"),caption:(0,r.Tl)("systemtags","List of tags and their associated files and folders."),emptyTitle:(0,r.Tl)("systemtags","No tags found"),emptyCaption:(0,r.Tl)("systemtags","Tags you have created will show up here."),icon:'',order:25,getContents:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";const t=(await(async()=>{try{const{data:e}=await S.getDirectoryContents("/systemtags",{data:'\n\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n',details:!0,glob:"/systemtags/*"});return(e=>e.map((e=>{let{props:t}=e;return Object.fromEntries(Object.entries(t).map((e=>{let[t,s]=e;return[B(t),"displayName"===B(t)?String(s):s]})))})))(e)}catch(e){throw N.error((0,r.Tl)("systemtags","Failed to load tags"),{error:e}),new Error((0,r.Tl)("systemtags","Failed to load tags"))}})()).filter((e=>e.userVisible));if("/"===e)return{folder:new n.vd({id:0,source:`${n.PY}${z}`,owner:(0,I.HW)()?.uid,root:z,permissions:n.aX.NONE}),contents:t.map($)};const s=parseInt(e.split("/",2)[1]),i=t.find((e=>e.id===s));if(!i)throw new Error("Tag not found");return{folder:$(i),contents:(await Y.getDirectoryContents(n.lJ,{details:!0,data:G(s),headers:{method:"REPORT"}})).data.map(k)}}}))},42634:()=>{},59169:()=>{},63779:()=>{},73911:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});var n=s(71354),r=s.n(n),i=s(76314),o=s.n(i)()(r());o.push([e.id,".files-list__system-tags{--min-size: 32px;display:none;justify-content:center;align-items:center;min-width:calc(var(--min-size)*2);max-width:300px}.files-list__system-tag{padding:5px 10px;border:1px solid;border-radius:var(--border-radius-pill);border-color:var(--color-border);color:var(--color-text-maxcontrast);height:var(--min-size);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:22px;text-align:center}.files-list__system-tag--more{overflow:visible;text-overflow:initial}.files-list__system-tag+.files-list__system-tag{margin-left:5px}@media(min-width: 512px){.files-list__system-tags{display:flex}}","",{version:3,sources:["webpack://./apps/systemtags/src/css/fileEntryInlineSystemTags.scss"],names:[],mappings:"AAsBA,yBACC,gBAAA,CACA,YAAA,CACA,sBAAA,CACA,kBAAA,CACA,iCAAA,CACA,eAAA,CAGD,wBACC,gBAAA,CACA,gBAAA,CACA,uCAAA,CACA,gCAAA,CACA,mCAAA,CACA,sBAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CACA,gBAAA,CACA,iBAAA,CAEA,8BACC,gBAAA,CACA,qBAAA,CAID,gDACC,eAAA,CAIF,yBACC,yBACC,YAAA,CAAA",sourcesContent:["/**\n * @copyright Copyright (c) 2023 Lucas Azevedo \n *\n * @author Lucas Azevedo \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\n.files-list__system-tags {\n\t--min-size: 32px;\n\tdisplay: none;\n\tjustify-content: center;\n\talign-items: center;\n\tmin-width: calc(var(--min-size) * 2);\n\tmax-width: 300px;\n}\n\n.files-list__system-tag {\n\tpadding: 5px 10px;\n\tborder: 1px solid;\n\tborder-radius: var(--border-radius-pill);\n\tborder-color: var(--color-border);\n\tcolor: var(--color-text-maxcontrast);\n\theight: var(--min-size);\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tline-height: 22px; // min-size - 2 * 5px padding\n\ttext-align: center;\n\n\t&--more {\n\t\toverflow: visible;\n\t\ttext-overflow: initial;\n\t}\n\n\t// Proper spacing if multiple shown\n\t& + .files-list__system-tag {\n\t\tmargin-left: 5px;\n\t}\n}\n\n@media (min-width: 512px) {\n\t.files-list__system-tags {\n\t\tdisplay: flex;\n\t}\n}\n"],sourceRoot:""}]);const a=o},77199:()=>{},86833:()=>{}},s={};function n(e){var r=s[e];if(void 0!==r)return r.exports;var i=s[e]={id:e,loaded:!1,exports:{}};return t[e].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.m=t,e=[],n.O=(t,s,r,i)=>{if(!s){var o=1/0;for(d=0;d=i)&&Object.keys(n.O).every((e=>n.O[e](s[l])))?s.splice(l--,1):(a=!1,i0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[s,r,i]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.e=()=>Promise.resolve(),n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.j=2766,(()=>{n.b=document.baseURI||self.location.href;var e={2766:0};n.O.j=t=>0===e[t];var t=(t,s)=>{var r,i,o=s[0],a=s[1],l=s[2],c=0;if(o.some((t=>0!==e[t]))){for(r in a)n.o(a,r)&&(n.m[r]=a[r]);if(l)var d=l(n)}for(t&&t(s);cn(36834)));r=n.O(r)})(); //# sourceMappingURL=systemtags-init.js.map?v=e5d16e60eea350559e32