@nextcloud/files 3.0.0-beta.16 → 3.0.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,28 +1,28 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@nextcloud/auth"),E=require("@nextcloud/logger"),T=require("@nextcloud/l10n"),d=require("path"),x=require("@nextcloud/router"),b=require("webdav"),L=require("webdav/dist/node/request.js"),P=require("is-svg"),B=e=>e===null?E.getLoggerBuilder().setApp("files").build():E.getLoggerBuilder().setApp("files").setUid(e.uid).build(),s=B(u.getCurrentUser());class M{_entries=[];registerEntry(t){this.validateEntry(t),this._entries.push(t)}unregisterEntry(t){const r=typeof t=="string"?this.getEntryIndex(t):this.getEntryIndex(t.id);if(r===-1){s.warn("Entry not found, nothing removed",{entry:t,entries:this.getEntries()});return}this._entries.splice(r,1)}getEntries(t,r){return t&&r?this._entries.filter(i=>typeof i.if=="function"?i.if(t,r):!0):this._entries}getEntryIndex(t){return this._entries.findIndex(r=>r.id===t)}validateEntry(t){if(!t.id||!t.displayName||!(t.iconSvgInline||t.iconClass))throw new Error("Invalid entry");if(typeof t.id!="string"||typeof t.displayName!="string")throw new Error("Invalid id or displayName property");if(t.iconClass&&typeof t.iconClass!="string"||t.iconSvgInline&&typeof t.iconSvgInline!="string")throw new Error("Invalid icon provided");if(t.if!==void 0&&typeof t.if!="function")throw new Error("Invalid if property");if(t.templateName&&typeof t.templateName!="string")throw new Error("Invalid templateName property");if(t.handler&&typeof t.handler!="function")throw new Error("Invalid handler property");if(!t.templateName&&!t.handler)throw new Error("At least a templateName or a handler must be provided");if(this.getEntryIndex(t.id)!==-1)throw new Error("Duplicate entry")}}const h=function(){return typeof window._nc_newfilemenu>"u"&&(window._nc_newfilemenu=new M,s.debug("NewFileMenu initialized")),window._nc_newfilemenu},w=["B","KB","MB","GB","TB","PB"],f=["B","KiB","MiB","GiB","TiB","PiB"];function z(e,t=!1,r=!1){typeof e=="string"&&(e=Number(e));let i=e>0?Math.floor(Math.log(e)/Math.log(r?1024:1e3)):0;i=Math.min((r?f.length:w.length)-1,i);const a=r?f[i]:w[i];let n=(e/Math.pow(r?1024:1e3,i)).toFixed(1);return t===!0&&i===0?(n!=="0.0"?"< 1 ":"0 ")+(r?f[1]:w[1]):(i<2?n=parseFloat(n).toFixed(0):n=parseFloat(n).toLocaleString(T.getCanonicalLocale()),n+" "+a)}var m=(e=>(e.DEFAULT="default",e.HIDDEN="hidden",e))(m||{});class U{_action;constructor(t){this.validateAction(t),this._action=t}get id(){return this._action.id}get displayName(){return this._action.displayName}get iconSvgInline(){return this._action.iconSvgInline}get enabled(){return this._action.enabled}get exec(){return this._action.exec}get execBatch(){return this._action.execBatch}get order(){return this._action.order}get default(){return this._action.default}get inline(){return this._action.inline}get renderInline(){return this._action.renderInline}validateAction(t){if(!t.id||typeof t.id!="string")throw new Error("Invalid id");if(!t.displayName||typeof t.displayName!="function")throw new Error("Invalid displayName function");if(!t.iconSvgInline||typeof t.iconSvgInline!="function")throw new Error("Invalid iconSvgInline function");if(!t.exec||typeof t.exec!="function")throw new Error("Invalid exec function");if("enabled"in t&&typeof t.enabled!="function")throw new Error("Invalid enabled function");if("execBatch"in t&&typeof t.execBatch!="function")throw new Error("Invalid execBatch function");if("order"in t&&typeof t.order!="number")throw new Error("Invalid order");if(t.default&&!Object.values(m).includes(t.default))throw new Error("Invalid default");if("inline"in t&&typeof t.inline!="function")throw new Error("Invalid inline function");if("renderInline"in t&&typeof t.renderInline!="function")throw new Error("Invalid renderInline function")}}const k=function(e){if(typeof window._nc_fileactions>"u"&&(window._nc_fileactions=[],s.debug("FileActions initialized")),window._nc_fileactions.find(t=>t.id===e.id)){s.error(`FileAction ${e.id} already registered`,{action:e});return}window._nc_fileactions.push(e)},H=function(){return typeof window._nc_fileactions>"u"&&(window._nc_fileactions=[],s.debug("FileActions initialized")),window._nc_fileactions};class O{_header;constructor(t){this.validateHeader(t),this._header=t}get id(){return this._header.id}get order(){return this._header.order}get enabled(){return this._header.enabled}get render(){return this._header.render}get updated(){return this._header.updated}validateHeader(t){if(!t.id||!t.render||!t.updated)throw new Error("Invalid header: id, render and updated are required");if(typeof t.id!="string")throw new Error("Invalid id property");if(t.enabled!==void 0&&typeof t.enabled!="function")throw new Error("Invalid enabled property");if(t.render&&typeof t.render!="function")throw new Error("Invalid render property");if(t.updated&&typeof t.updated!="function")throw new Error("Invalid updated property")}}const K=function(e){if(typeof window._nc_filelistheader>"u"&&(window._nc_filelistheader=[],s.debug("FileListHeaders initialized")),window._nc_filelistheader.find(t=>t.id===e.id)){s.error(`Header ${e.id} already registered`,{header:e});return}window._nc_filelistheader.push(e)},j=function(){return typeof window._nc_filelistheader>"u"&&(window._nc_filelistheader=[],s.debug("FileListHeaders initialized")),window._nc_filelistheader};var o=(e=>(e[e.NONE=0]="NONE",e[e.CREATE=4]="CREATE",e[e.READ=1]="READ",e[e.UPDATE=2]="UPDATE",e[e.DELETE=8]="DELETE",e[e.SHARE=16]="SHARE",e[e.ALL=31]="ALL",e))(o||{});const g=["d:getcontentlength","d:getcontenttype","d:getetag","d:getlastmodified","d:quota-available-bytes","d:resourcetype","nc:has-preview","nc:is-encrypted","nc:mount-type","nc:share-attributes","oc:comments-unread","oc:favorite","oc:fileid","oc:owner-display-name","oc:owner-id","oc:permissions","oc:share-types","oc:size","ocs:share-permissions"],_={d:"DAV:",nc:"http://nextcloud.org/ns",oc:"http://owncloud.org/ns",ocs:"http://open-collaboration-services.org/ns"},G=function(e,t={nc:"http://nextcloud.org/ns"}){typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...g],window._nc_dav_namespaces={..._});const r={...window._nc_dav_namespaces,...t};if(window._nc_dav_properties.find(a=>a===e))return s.error(`${e} already registered`,{prop:e}),!1;if(e.startsWith("<")||e.split(":").length!==2)return s.error(`${e} is not valid. See example: 'oc:fileid'`,{prop:e}),!1;const i=e.split(":")[0];return r[i]?(window._nc_dav_properties.push(e),window._nc_dav_namespaces=r,!0):(s.error(`${e} namespace unknown`,{prop:e,namespaces:r}),!1)},c=function(){return typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...g]),window._nc_dav_properties.map(e=>`<${e} />`).join(" ")},l=function(){return typeof window._nc_dav_namespaces>"u"&&(window._nc_dav_namespaces={..._}),Object.keys(window._nc_dav_namespaces).map(e=>`xmlns:${e}="${window._nc_dav_namespaces?.[e]}"`).join(" ")},W=function(){return`<?xml version="1.0"?>
2
- <d:propfind ${l()}>
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@nextcloud/auth"),z=require("@nextcloud/logger"),gt=require("@nextcloud/l10n"),x=require("path"),Q=require("@nextcloud/router"),G=require("webdav"),mt=require("webdav/dist/node/request.js"),wt=t=>t===null?z.getLoggerBuilder().setApp("files").build():z.getLoggerBuilder().setApp("files").setUid(t.uid).build(),w=wt(_.getCurrentUser());class vt{_entries=[];registerEntry(e){this.validateEntry(e),this._entries.push(e)}unregisterEntry(e){const i=typeof e=="string"?this.getEntryIndex(e):this.getEntryIndex(e.id);if(i===-1){w.warn("Entry not found, nothing removed",{entry:e,entries:this.getEntries()});return}this._entries.splice(i,1)}getEntries(e,i){return e&&i?this._entries.filter(s=>typeof s.if=="function"?s.if(e,i):!0):this._entries}getEntryIndex(e){return this._entries.findIndex(i=>i.id===e)}validateEntry(e){if(!e.id||!e.displayName||!(e.iconSvgInline||e.iconClass))throw new Error("Invalid entry");if(typeof e.id!="string"||typeof e.displayName!="string")throw new Error("Invalid id or displayName property");if(e.iconClass&&typeof e.iconClass!="string"||e.iconSvgInline&&typeof e.iconSvgInline!="string")throw new Error("Invalid icon provided");if(e.if!==void 0&&typeof e.if!="function")throw new Error("Invalid if property");if(e.templateName&&typeof e.templateName!="string")throw new Error("Invalid templateName property");if(e.handler&&typeof e.handler!="function")throw new Error("Invalid handler property");if(!e.templateName&&!e.handler)throw new Error("At least a templateName or a handler must be provided");if(this.getEntryIndex(e.id)!==-1)throw new Error("Duplicate entry")}}const $=function(){return typeof window._nc_newfilemenu>"u"&&(window._nc_newfilemenu=new vt,w.debug("NewFileMenu initialized")),window._nc_newfilemenu},C=["B","KB","MB","GB","TB","PB"],D=["B","KiB","MiB","GiB","TiB","PiB"];function yt(t,e=!1,i=!1){typeof t=="string"&&(t=Number(t));let s=t>0?Math.floor(Math.log(t)/Math.log(i?1024:1e3)):0;s=Math.min((i?D.length:C.length)-1,s);const n=i?D[s]:C[s];let r=(t/Math.pow(i?1024:1e3,s)).toFixed(1);return e===!0&&s===0?(r!=="0.0"?"< 1 ":"0 ")+(i?D[1]:C[1]):(s<2?r=parseFloat(r).toFixed(0):r=parseFloat(r).toLocaleString(gt.getCanonicalLocale()),r+" "+n)}var k=(t=>(t.DEFAULT="default",t.HIDDEN="hidden",t))(k||{});class xt{_action;constructor(e){this.validateAction(e),this._action=e}get id(){return this._action.id}get displayName(){return this._action.displayName}get iconSvgInline(){return this._action.iconSvgInline}get enabled(){return this._action.enabled}get exec(){return this._action.exec}get execBatch(){return this._action.execBatch}get order(){return this._action.order}get default(){return this._action.default}get inline(){return this._action.inline}get renderInline(){return this._action.renderInline}validateAction(e){if(!e.id||typeof e.id!="string")throw new Error("Invalid id");if(!e.displayName||typeof e.displayName!="function")throw new Error("Invalid displayName function");if(!e.iconSvgInline||typeof e.iconSvgInline!="function")throw new Error("Invalid iconSvgInline function");if(!e.exec||typeof e.exec!="function")throw new Error("Invalid exec function");if("enabled"in e&&typeof e.enabled!="function")throw new Error("Invalid enabled function");if("execBatch"in e&&typeof e.execBatch!="function")throw new Error("Invalid execBatch function");if("order"in e&&typeof e.order!="number")throw new Error("Invalid order");if(e.default&&!Object.values(k).includes(e.default))throw new Error("Invalid default");if("inline"in e&&typeof e.inline!="function")throw new Error("Invalid inline function");if("renderInline"in e&&typeof e.renderInline!="function")throw new Error("Invalid renderInline function")}}const bt=function(t){if(typeof window._nc_fileactions>"u"&&(window._nc_fileactions=[],w.debug("FileActions initialized")),window._nc_fileactions.find(e=>e.id===t.id)){w.error(`FileAction ${t.id} already registered`,{action:t});return}window._nc_fileactions.push(t)},Et=function(){return typeof window._nc_fileactions>"u"&&(window._nc_fileactions=[],w.debug("FileActions initialized")),window._nc_fileactions};class Nt{_header;constructor(e){this.validateHeader(e),this._header=e}get id(){return this._header.id}get order(){return this._header.order}get enabled(){return this._header.enabled}get render(){return this._header.render}get updated(){return this._header.updated}validateHeader(e){if(!e.id||!e.render||!e.updated)throw new Error("Invalid header: id, render and updated are required");if(typeof e.id!="string")throw new Error("Invalid id property");if(e.enabled!==void 0&&typeof e.enabled!="function")throw new Error("Invalid enabled property");if(e.render&&typeof e.render!="function")throw new Error("Invalid render property");if(e.updated&&typeof e.updated!="function")throw new Error("Invalid updated property")}}const _t=function(t){if(typeof window._nc_filelistheader>"u"&&(window._nc_filelistheader=[],w.debug("FileListHeaders initialized")),window._nc_filelistheader.find(e=>e.id===t.id)){w.error(`Header ${t.id} already registered`,{header:t});return}window._nc_filelistheader.push(t)},At=function(){return typeof window._nc_filelistheader>"u"&&(window._nc_filelistheader=[],w.debug("FileListHeaders initialized")),window._nc_filelistheader};var m=(t=>(t[t.NONE=0]="NONE",t[t.CREATE=4]="CREATE",t[t.READ=1]="READ",t[t.UPDATE=2]="UPDATE",t[t.DELETE=8]="DELETE",t[t.SHARE=16]="SHARE",t[t.ALL=31]="ALL",t))(m||{});const R=["d:getcontentlength","d:getcontenttype","d:getetag","d:getlastmodified","d:quota-available-bytes","d:resourcetype","nc:has-preview","nc:is-encrypted","nc:mount-type","nc:share-attributes","oc:comments-unread","oc:favorite","oc:fileid","oc:owner-display-name","oc:owner-id","oc:permissions","oc:share-types","oc:size","ocs:share-permissions"],L={d:"DAV:",nc:"http://nextcloud.org/ns",oc:"http://owncloud.org/ns",ocs:"http://open-collaboration-services.org/ns"},Tt=function(t,e={nc:"http://nextcloud.org/ns"}){typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...R],window._nc_dav_namespaces={...L});const i={...window._nc_dav_namespaces,...e};if(window._nc_dav_properties.find(n=>n===t))return w.error(`${t} already registered`,{prop:t}),!1;if(t.startsWith("<")||t.split(":").length!==2)return w.error(`${t} is not valid. See example: 'oc:fileid'`,{prop:t}),!1;const s=t.split(":")[0];return i[s]?(window._nc_dav_properties.push(t),window._nc_dav_namespaces=i,!0):(w.error(`${t} namespace unknown`,{prop:t,namespaces:i}),!1)},T=function(){return typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...R]),window._nc_dav_properties.map(t=>`<${t} />`).join(" ")},I=function(){return typeof window._nc_dav_namespaces>"u"&&(window._nc_dav_namespaces={...L}),Object.keys(window._nc_dav_namespaces).map(t=>`xmlns:${t}="${window._nc_dav_namespaces?.[t]}"`).join(" ")},It=function(){return`<?xml version="1.0"?>
2
+ <d:propfind ${I()}>
3
3
  <d:prop>
4
- ${c()}
4
+ ${T()}
5
5
  </d:prop>
6
- </d:propfind>`},D=function(){return`<?xml version="1.0"?>
7
- <oc:filter-files ${l()}>
6
+ </d:propfind>`},tt=function(){return`<?xml version="1.0"?>
7
+ <oc:filter-files ${I()}>
8
8
  <d:prop>
9
- ${c()}
9
+ ${T()}
10
10
  </d:prop>
11
11
  <oc:filter-rules>
12
12
  <oc:favorite>1</oc:favorite>
13
13
  </oc:filter-rules>
14
- </oc:filter-files>`},J=function(e){return`<?xml version="1.0" encoding="UTF-8"?>
15
- <d:searchrequest ${l()}
14
+ </oc:filter-files>`},Pt=function(t){return`<?xml version="1.0" encoding="UTF-8"?>
15
+ <d:searchrequest ${I()}
16
16
  xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
17
17
  <d:basicsearch>
18
18
  <d:select>
19
19
  <d:prop>
20
- ${c()}
20
+ ${T()}
21
21
  </d:prop>
22
22
  </d:select>
23
23
  <d:from>
24
24
  <d:scope>
25
- <d:href>/files/${u.getCurrentUser()?.uid}/</d:href>
25
+ <d:href>/files/${_.getCurrentUser()?.uid}/</d:href>
26
26
  <d:depth>infinity</d:depth>
27
27
  </d:scope>
28
28
  </d:from>
@@ -48,7 +48,7 @@
48
48
  <d:prop>
49
49
  <d:getlastmodified/>
50
50
  </d:prop>
51
- <d:literal>${e}</d:literal>
51
+ <d:literal>${t}</d:literal>
52
52
  </d:gt>
53
53
  </d:and>
54
54
  </d:where>
@@ -65,4 +65,10 @@
65
65
  <ns:firstresult>0</ns:firstresult>
66
66
  </d:limit>
67
67
  </d:basicsearch>
68
- </d:searchrequest>`},N=function(e=""){let t=o.NONE;return e&&((e.includes("C")||e.includes("K"))&&(t|=o.CREATE),e.includes("G")&&(t|=o.READ),(e.includes("W")||e.includes("N")||e.includes("V"))&&(t|=o.UPDATE),e.includes("D")&&(t|=o.DELETE),e.includes("R")&&(t|=o.SHARE)),t};var p=(e=>(e.Folder="folder",e.File="file",e))(p||{});const A=function(e,t){return e.match(t)!==null},I=(e,t)=>{if(e.id&&typeof e.id!="number")throw new Error("Invalid id type of value");if(!e.source)throw new Error("Missing mandatory source");try{new URL(e.source)}catch{throw new Error("Invalid source format, source must be a valid URL")}if(!e.source.startsWith("http"))throw new Error("Invalid source format, only http(s) is supported");if(e.mtime&&!(e.mtime instanceof Date))throw new Error("Invalid mtime type");if(e.crtime&&!(e.crtime instanceof Date))throw new Error("Invalid crtime type");if(!e.mime||typeof e.mime!="string"||!e.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))throw new Error("Missing or invalid mandatory mime");if("size"in e&&typeof e.size!="number"&&e.size!==void 0)throw new Error("Invalid size type");if("permissions"in e&&e.permissions!==void 0&&!(typeof e.permissions=="number"&&e.permissions>=o.NONE&&e.permissions<=o.ALL))throw new Error("Invalid permissions");if(e.owner&&e.owner!==null&&typeof e.owner!="string")throw new Error("Invalid owner type");if(e.attributes&&typeof e.attributes!="object")throw new Error("Invalid attributes type");if(e.root&&typeof e.root!="string")throw new Error("Invalid root type");if(e.root&&!e.root.startsWith("/"))throw new Error("Root must start with a leading slash");if(e.root&&!e.source.includes(e.root))throw new Error("Root must be part of the source");if(e.root&&A(e.source,t)){const r=e.source.match(t)[0];if(!e.source.includes(d.join(r,e.root)))throw new Error("The root must be relative to the service. e.g /files/emma")}};class v{_data;_attributes;_knownDavService=/(remote|public)\.php\/(web)?dav/i;constructor(t,r){I(t,r||this._knownDavService),this._data=t;const i={set:(a,n,V)=>(this.updateMtime(),Reflect.set(a,n,V)),deleteProperty:(a,n)=>(this.updateMtime(),Reflect.deleteProperty(a,n))};this._attributes=new Proxy(t.attributes||{},i),delete this._data.attributes,r&&(this._knownDavService=r)}get source(){return this._data.source.replace(/\/$/i,"")}get basename(){return d.basename(this.source)}get extension(){return d.extname(this.source)}get dirname(){if(this.root){const r=this.source.indexOf(this.root);return d.dirname(this.source.slice(r+this.root.length)||"/")}const t=new URL(this.source);return d.dirname(t.pathname)}get mime(){return this._data.mime}get mtime(){return this._data.mtime}get crtime(){return this._data.crtime}get size(){return this._data.size}get attributes(){return this._attributes}get permissions(){return this.owner===null&&!this.isDavRessource?o.READ:this._data.permissions!==void 0?this._data.permissions:o.NONE}get owner(){return this.isDavRessource?this._data.owner:null}get isDavRessource(){return A(this.source,this._knownDavService)}get root(){return this._data.root?this._data.root.replace(/^(.+)\/$/,"$1"):this.isDavRessource&&d.dirname(this.source).split(this._knownDavService).pop()||null}get path(){if(this.root){const t=this.source.indexOf(this.root);return this.source.slice(t+this.root.length)||"/"}return(this.dirname+"/"+this.basename).replace(/\/\//g,"/")}get fileid(){return this._data?.id||this.attributes?.fileid}move(t){I({...this._data,source:t},this._knownDavService),this._data.source=t,this.updateMtime()}rename(t){if(t.includes("/"))throw new Error("Invalid basename");this.move(d.dirname(this.source)+"/"+t)}updateMtime(){this._data.mtime&&(this._data.mtime=new Date)}}class R extends v{get type(){return p.File}}class F extends v{constructor(t){super({...t,mime:"httpd/unix-directory"})}get type(){return p.Folder}get extension(){return null}get mime(){return"httpd/unix-directory"}}const y=`/files/${u.getCurrentUser()?.uid}`,S=x.generateRemoteUrl("dav"),Q=function(e=S){const t=b.createClient(e,{headers:{requesttoken:u.getRequestToken()||""}});return b.getPatcher().patch("request",r=>(r.headers?.method&&(r.method=r.headers.method,delete r.headers.method),L.request(r))),t},X=async(e,t="/",r=y)=>(await e.getDirectoryContents(`${r}${t}`,{details:!0,data:D(),headers:{method:"REPORT"},includeSelf:!0})).data.filter(i=>i.filename!==t).map(i=>q(i,r)),q=function(e,t=y){const r=e.props,i=N(r?.permissions),a=u.getCurrentUser()?.uid,n={id:r?.fileid||0,source:x.generateRemoteUrl(`dav${t}${e.filename}`),mtime:new Date(Date.parse(e.lastmod)),mime:e.mime,size:r?.size||Number.parseInt(r.getcontentlength||"0"),permissions:i,owner:a,root:t,attributes:{...e,...r,hasPreview:r?.["has-preview"]}};return delete n.attributes?.props,e.type==="file"?new R(n):new F(n)};class C{_views=[];_currentView=null;register(t){if(this._views.find(r=>r.id===t.id))throw new Error(`View id ${t.id} is already registered`);this._views.push(t)}remove(t){const r=this._views.findIndex(i=>i.id===t);r!==-1&&this._views.splice(r,1)}get views(){return this._views}setActive(t){this._currentView=t}get active(){return this._currentView}}const Y=function(){return typeof window._nc_navigation>"u"&&(window._nc_navigation=new C,s.debug("Navigation service initialized")),window._nc_navigation};class ${_column;constructor(t){Z(t),this._column=t}get id(){return this._column.id}get title(){return this._column.title}get render(){return this._column.render}get sort(){return this._column.sort}get summary(){return this._column.summary}}const Z=function(e){if(!e.id||typeof e.id!="string")throw new Error("A column id is required");if(!e.title||typeof e.title!="string")throw new Error("A column title is required");if(!e.render||typeof e.render!="function")throw new Error("A render function is required");if(e.sort&&typeof e.sort!="function")throw new Error("Column sortFunction must be a function");if(e.summary&&typeof e.summary!="function")throw new Error("Column summary must be a function");return!0};class ee{_view;constructor(t){te(t),this._view=t}get id(){return this._view.id}get name(){return this._view.name}get caption(){return this._view.caption}get emptyTitle(){return this._view.emptyTitle}get emptyCaption(){return this._view.emptyCaption}get getContents(){return this._view.getContents}get icon(){return this._view.icon}get order(){return this._view.order}get params(){return this._view.params}get columns(){return this._view.columns}get emptyView(){return this._view.emptyView}get parent(){return this._view.parent}get sticky(){return this._view.sticky}get expanded(){return this._view.expanded}get defaultSortKey(){return this._view.defaultSortKey}}const te=function(e){if(!e.id||typeof e.id!="string")throw new Error("View id is required and must be a string");if(!e.name||typeof e.name!="string")throw new Error("View name is required and must be a string");if(e.columns&&e.columns.length>0&&(!e.caption||typeof e.caption!="string"))throw new Error("View caption is required for top-level views and must be a string");if(!e.getContents||typeof e.getContents!="function")throw new Error("View getContents is required and must be a function");if(!e.icon||typeof e.icon!="string"||!P(e.icon))throw new Error("View icon is required and must be a valid svg string");if(!("order"in e)||typeof e.order!="number")throw new Error("View order is required and must be a number");if(e.columns&&e.columns.forEach(t=>{if(!(t instanceof $))throw new Error("View columns must be an array of Column. Invalid column found")}),e.emptyView&&typeof e.emptyView!="function")throw new Error("View emptyView must be a function");if(e.parent&&typeof e.parent!="string")throw new Error("View parent must be a string");if("sticky"in e&&typeof e.sticky!="boolean")throw new Error("View sticky must be a boolean");if("expanded"in e&&typeof e.expanded!="boolean")throw new Error("View expanded must be a boolean");if(e.defaultSortKey&&typeof e.defaultSortKey!="string")throw new Error("View defaultSortKey must be a string");return!0},re=function(e){return h().registerEntry(e)},ie=function(e){return h().unregisterEntry(e)},ne=function(e){return h().getEntries(e)};exports.Column=$,exports.DefaultType=m,exports.File=R,exports.FileAction=U,exports.FileType=p,exports.Folder=F,exports.Header=O,exports.Navigation=C,exports.Node=v,exports.Permission=o,exports.View=ee,exports.addNewFileMenuEntry=re,exports.davGetClient=Q,exports.davGetDefaultPropfind=W,exports.davGetFavoritesReport=D,exports.davGetRecentSearch=J,exports.davParsePermissions=N,exports.davRemoteURL=S,exports.davResultToNode=q,exports.davRootPath=y,exports.defaultDavNamespaces=_,exports.defaultDavProperties=g,exports.formatFileSize=z,exports.getDavNameSpaces=l,exports.getDavProperties=c,exports.getFavoriteNodes=X,exports.getFileActions=H,exports.getFileListHeaders=j,exports.getNavigation=Y,exports.getNewFileMenuEntries=ne,exports.registerDavProperty=G,exports.registerFileAction=k,exports.registerFileListHeaders=K,exports.removeNewFileMenuEntry=ie;
68
+ </d:searchrequest>`},et=function(t=""){let e=m.NONE;return t&&((t.includes("C")||t.includes("K"))&&(e|=m.CREATE),t.includes("G")&&(e|=m.READ),(t.includes("W")||t.includes("N")||t.includes("V"))&&(e|=m.UPDATE),t.includes("D")&&(e|=m.DELETE),t.includes("R")&&(e|=m.SHARE)),e};var P=(t=>(t.Folder="folder",t.File="file",t))(P||{});const it=function(t,e){return t.match(e)!==null},X=(t,e)=>{if(t.id&&typeof t.id!="number")throw new Error("Invalid id type of value");if(!t.source)throw new Error("Missing mandatory source");try{new URL(t.source)}catch{throw new Error("Invalid source format, source must be a valid URL")}if(!t.source.startsWith("http"))throw new Error("Invalid source format, only http(s) is supported");if(t.mtime&&!(t.mtime instanceof Date))throw new Error("Invalid mtime type");if(t.crtime&&!(t.crtime instanceof Date))throw new Error("Invalid crtime type");if(!t.mime||typeof t.mime!="string"||!t.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))throw new Error("Missing or invalid mandatory mime");if("size"in t&&typeof t.size!="number"&&t.size!==void 0)throw new Error("Invalid size type");if("permissions"in t&&t.permissions!==void 0&&!(typeof t.permissions=="number"&&t.permissions>=m.NONE&&t.permissions<=m.ALL))throw new Error("Invalid permissions");if(t.owner&&t.owner!==null&&typeof t.owner!="string")throw new Error("Invalid owner type");if(t.attributes&&typeof t.attributes!="object")throw new Error("Invalid attributes type");if(t.root&&typeof t.root!="string")throw new Error("Invalid root type");if(t.root&&!t.root.startsWith("/"))throw new Error("Root must start with a leading slash");if(t.root&&!t.source.includes(t.root))throw new Error("Root must be part of the source");if(t.root&&it(t.source,e)){const i=t.source.match(e)[0];if(!t.source.includes(x.join(i,t.root)))throw new Error("The root must be relative to the service. e.g /files/emma")}};class j{_data;_attributes;_knownDavService=/(remote|public)\.php\/(web)?dav/i;constructor(e,i){X(e,i||this._knownDavService),this._data=e;const s={set:(n,r,l)=>(this.updateMtime(),Reflect.set(n,r,l)),deleteProperty:(n,r)=>(this.updateMtime(),Reflect.deleteProperty(n,r))};this._attributes=new Proxy(e.attributes||{},s),delete this._data.attributes,i&&(this._knownDavService=i)}get source(){return this._data.source.replace(/\/$/i,"")}get basename(){return x.basename(this.source)}get extension(){return x.extname(this.source)}get dirname(){if(this.root){const i=this.source.indexOf(this.root);return x.dirname(this.source.slice(i+this.root.length)||"/")}const e=new URL(this.source);return x.dirname(e.pathname)}get mime(){return this._data.mime}get mtime(){return this._data.mtime}get crtime(){return this._data.crtime}get size(){return this._data.size}get attributes(){return this._attributes}get permissions(){return this.owner===null&&!this.isDavRessource?m.READ:this._data.permissions!==void 0?this._data.permissions:m.NONE}get owner(){return this.isDavRessource?this._data.owner:null}get isDavRessource(){return it(this.source,this._knownDavService)}get root(){return this._data.root?this._data.root.replace(/^(.+)\/$/,"$1"):this.isDavRessource&&x.dirname(this.source).split(this._knownDavService).pop()||null}get path(){if(this.root){const e=this.source.indexOf(this.root);return this.source.slice(e+this.root.length)||"/"}return(this.dirname+"/"+this.basename).replace(/\/\//g,"/")}get fileid(){return this._data?.id||this.attributes?.fileid}move(e){X({...this._data,source:e},this._knownDavService),this._data.source=e,this.updateMtime()}rename(e){if(e.includes("/"))throw new Error("Invalid basename");this.move(x.dirname(this.source)+"/"+e)}updateMtime(){this._data.mtime&&(this._data.mtime=new Date)}}class nt extends j{get type(){return P.File}}class rt extends j{constructor(e){super({...e,mime:"httpd/unix-directory"})}get type(){return P.Folder}get extension(){return null}get mime(){return"httpd/unix-directory"}}const M=`/files/${_.getCurrentUser()?.uid}`,st=Q.generateRemoteUrl("dav"),Ot=function(t=st){const e=G.createClient(t,{headers:{requesttoken:_.getRequestToken()||""}});return G.getPatcher().patch("request",i=>(i.headers?.method&&(i.method=i.headers.method,delete i.headers.method),mt.request(i))),e},Ct=async(t,e="/",i=M)=>(await t.getDirectoryContents(`${i}${e}`,{details:!0,data:tt(),headers:{method:"REPORT"},includeSelf:!0})).data.filter(s=>s.filename!==e).map(s=>ot(s,i)),ot=function(t,e=M){const i=t.props,s=et(i?.permissions),n=_.getCurrentUser()?.uid,r={id:i?.fileid||0,source:Q.generateRemoteUrl(`dav${e}${t.filename}`),mtime:new Date(Date.parse(t.lastmod)),mime:t.mime,size:i?.size||Number.parseInt(i.getcontentlength||"0"),permissions:s,owner:n,root:e,attributes:{...t,...i,hasPreview:i?.["has-preview"]}};return delete r.attributes?.props,t.type==="file"?new nt(r):new rt(r)};class at{_views=[];_currentView=null;register(e){if(this._views.find(i=>i.id===e.id))throw new Error(`View id ${e.id} is already registered`);this._views.push(e)}remove(e){const i=this._views.findIndex(s=>s.id===e);i!==-1&&this._views.splice(i,1)}get views(){return this._views}setActive(e){this._currentView=e}get active(){return this._currentView}}const Dt=function(){return typeof window._nc_navigation>"u"&&(window._nc_navigation=new at,w.debug("Navigation service initialized")),window._nc_navigation};class lt{_column;constructor(e){St(e),this._column=e}get id(){return this._column.id}get title(){return this._column.title}get render(){return this._column.render}get sort(){return this._column.sort}get summary(){return this._column.summary}}const St=function(t){if(!t.id||typeof t.id!="string")throw new Error("A column id is required");if(!t.title||typeof t.title!="string")throw new Error("A column title is required");if(!t.render||typeof t.render!="function")throw new Error("A render function is required");if(t.sort&&typeof t.sort!="function")throw new Error("Column sortFunction must be a function");if(t.summary&&typeof t.summary!="function")throw new Error("Column summary must be a function");return!0};var B={},O={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",s="["+e+"]["+i+"]*",n=new RegExp("^"+s+"$"),r=function(o,a){const d=[];let u=a.exec(o);for(;u;){const h=[];h.startIndex=a.lastIndex-u[0].length;const c=u.length;for(let f=0;f<c;f++)h.push(u[f]);d.push(h),u=a.exec(o)}return d},l=function(o){const a=n.exec(o);return!(a===null||typeof a>"u")};t.isExist=function(o){return typeof o<"u"},t.isEmptyObject=function(o){return Object.keys(o).length===0},t.merge=function(o,a,d){if(a){const u=Object.keys(a),h=u.length;for(let c=0;c<h;c++)d==="strict"?o[u[c]]=[a[u[c]]]:o[u[c]]=a[u[c]]}},t.getValue=function(o){return t.isExist(o)?o:""},t.isName=l,t.getAllMatches=r,t.nameRegexp=s})(O);const q=O,Ft={allowBooleanAttributes:!1,unpairedTags:[]};B.validate=function(t,e){e=Object.assign({},Ft,e);const i=[];let s=!1,n=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let r=0;r<t.length;r++)if(t[r]==="<"&&t[r+1]==="?"){if(r+=2,r=K(t,r),r.err)return r}else if(t[r]==="<"){let l=r;if(r++,t[r]==="!"){r=W(t,r);continue}else{let o=!1;t[r]==="/"&&(o=!0,r++);let a="";for(;r<t.length&&t[r]!==">"&&t[r]!==" "&&t[r]!==" "&&t[r]!==`
69
+ `&&t[r]!=="\r";r++)a+=t[r];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),r--),!Bt(a)){let h;return a.trim().length===0?h="Invalid space after '<'.":h="Tag '"+a+"' is an invalid name.",p("InvalidTag",h,g(t,r))}const d=kt(t,r);if(d===!1)return p("InvalidAttr","Attributes for '"+a+"' have open quote.",g(t,r));let u=d.value;if(r=d.index,u[u.length-1]==="/"){const h=r-u.length;u=u.substring(0,u.length-1);const c=Y(u,e);if(c===!0)s=!0;else return p(c.err.code,c.err.msg,g(t,h+c.err.line))}else if(o)if(d.tagClosed){if(u.trim().length>0)return p("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",g(t,l));{const h=i.pop();if(a!==h.tagName){let c=g(t,h.tagStartPos);return p("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+c.line+", col "+c.col+") instead of closing tag '"+a+"'.",g(t,l))}i.length==0&&(n=!0)}}else return p("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",g(t,r));else{const h=Y(u,e);if(h!==!0)return p(h.err.code,h.err.msg,g(t,r-u.length+h.err.line));if(n===!0)return p("InvalidXml","Multiple possible root nodes found.",g(t,r));e.unpairedTags.indexOf(a)!==-1||i.push({tagName:a,tagStartPos:l}),s=!0}for(r++;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="!"){r++,r=W(t,r);continue}else if(t[r+1]==="?"){if(r=K(t,++r),r.err)return r}else break;else if(t[r]==="&"){const h=jt(t,r);if(h==-1)return p("InvalidChar","char '&' is not expected.",g(t,r));r=h}else if(n===!0&&!H(t[r]))return p("InvalidXml","Extra text at the end",g(t,r));t[r]==="<"&&r--}}else{if(H(t[r]))continue;return p("InvalidChar","char '"+t[r]+"' is not expected.",g(t,r))}if(s){if(i.length==1)return p("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",g(t,i[0].tagStartPos));if(i.length>0)return p("InvalidXml","Invalid '"+JSON.stringify(i.map(r=>r.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return p("InvalidXml","Start tag expected.",1);return!0};function H(t){return t===" "||t===" "||t===`
70
+ `||t==="\r"}function K(t,e){const i=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const s=t.substr(i,e-i);if(e>5&&s==="xml")return p("InvalidXml","XML declaration allowed only at the start of the document.",g(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function W(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let i=1;for(e+=8;e<t.length;e++)if(t[e]==="<")i++;else if(t[e]===">"&&(i--,i===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const Vt='"',$t="'";function kt(t,e){let i="",s="",n=!1;for(;e<t.length;e++){if(t[e]===Vt||t[e]===$t)s===""?s=t[e]:s!==t[e]||(s="");else if(t[e]===">"&&s===""){n=!0;break}i+=t[e]}return s!==""?!1:{value:i,index:e,tagClosed:n}}const Rt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Y(t,e){const i=q.getAllMatches(t,Rt),s={};for(let n=0;n<i.length;n++){if(i[n][1].length===0)return p("InvalidAttr","Attribute '"+i[n][2]+"' has no space in starting.",E(i[n]));if(i[n][3]!==void 0&&i[n][4]===void 0)return p("InvalidAttr","Attribute '"+i[n][2]+"' is without value.",E(i[n]));if(i[n][3]===void 0&&!e.allowBooleanAttributes)return p("InvalidAttr","boolean attribute '"+i[n][2]+"' is not allowed.",E(i[n]));const r=i[n][2];if(!Mt(r))return p("InvalidAttr","Attribute '"+r+"' is an invalid name.",E(i[n]));if(!s.hasOwnProperty(r))s[r]=1;else return p("InvalidAttr","Attribute '"+r+"' is repeated.",E(i[n]))}return!0}function Lt(t,e){let i=/\d/;for(t[e]==="x"&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(i))break}return-1}function jt(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Lt(t,e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(t[e]===";")break;return-1}return e}function p(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function Mt(t){return q.isName(t)}function Bt(t){return q.isName(t)}function g(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function E(t){return t.startIndex+t[1].length}var S={};const dt={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t}},qt=function(t){return Object.assign({},dt,t)};S.buildOptions=qt,S.defaultOptions=dt;class Ut{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,i){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:i})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var zt=Ut;const Gt=O;function Xt(t,e){const i={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let s=1,n=!1,r=!1,l="";for(;e<t.length;e++)if(t[e]==="<"&&!r){if(n&&Wt(t,e))e+=7,[entityName,val,e]=Ht(t,e+1),val.indexOf("&")===-1&&(i[Qt(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(n&&Yt(t,e))e+=8;else if(n&&Zt(t,e))e+=8;else if(n&&Jt(t,e))e+=9;else if(Kt)r=!0;else throw new Error("Invalid DOCTYPE");s++,l=""}else if(t[e]===">"){if(r?t[e-1]==="-"&&t[e-2]==="-"&&(r=!1,s--):s--,s===0)break}else t[e]==="["?n=!0:l+=t[e];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:i,i:e}}function Ht(t,e){let i="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)i+=t[e];if(i=i.trim(),i.indexOf(" ")!==-1)throw new Error("External entites are not supported");const s=t[e++];let n="";for(;e<t.length&&t[e]!==s;e++)n+=t[e];return[i,n,e]}function Kt(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Wt(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function Yt(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function Zt(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function Jt(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function Qt(t){if(Gt.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var te=Xt;const ee=/^[-+]?0x[a-fA-F0-9]+$/,ie=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const ne={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function re(t,e={}){if(e=Object.assign({},ne,e),!t||typeof t!="string")return t;let i=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(i))return t;if(e.hex&&ee.test(i))return Number.parseInt(i,16);{const s=ie.exec(i);if(s){const n=s[1],r=s[2];let l=se(s[3]);const o=s[4]||s[6];if(!e.leadingZeros&&r.length>0&&n&&i[2]!=="."||!e.leadingZeros&&r.length>0&&!n&&i[1]!==".")return t;{const a=Number(i),d=""+a;return d.search(/[eE]/)!==-1||o?e.eNotation?a:t:i.indexOf(".")!==-1?d==="0"&&l===""||d===l||n&&d==="-"+l?a:t:r?l===d||n+l===d?a:t:i===d||i===n+d?a:t}}else return t}}function se(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}var oe=re;const U=O,N=zt,ae=te,le=oe;"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,U.nameRegexp);let de=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"}},this.addExternalEntities=ue,this.parseXml=ge,this.parseTextData=ce,this.resolveNameSpace=he,this.buildAttributesMap=fe,this.isItStopNode=ye,this.replaceEntitiesValue=we,this.readStopNodeData=be,this.saveTextToParentTag=ve,this.addChild=me}};function ue(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:t[s]}}}function ce(t,e,i,s,n,r,l){if(t!==void 0&&(this.options.trimValues&&!s&&(t=t.trim()),t.length>0)){l||(t=this.replaceEntitiesValue(t));const o=this.options.tagValueProcessor(e,t,i,n,r);return o==null?t:typeof o!=typeof t||o!==t?o:this.options.trimValues?V(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?V(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function he(t){if(this.options.removeNSPrefix){const e=t.split(":"),i=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=i+e[1])}return t}const pe=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function fe(t,e,i){if(!this.options.ignoreAttributes&&typeof t=="string"){const s=U.getAllMatches(t,pe),n=s.length,r={};for(let l=0;l<n;l++){const o=this.resolveNameSpace(s[l][1]);let a=s[l][4],d=this.options.attributeNamePrefix+o;if(o.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a);const u=this.options.attributeValueProcessor(o,a,e);u==null?r[d]=a:typeof u!=typeof a||u!==a?r[d]=u:r[d]=V(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(r[d]=!0)}if(!Object.keys(r).length)return;if(this.options.attributesGroupName){const l={};return l[this.options.attributesGroupName]=r,l}return r}}const ge=function(t){t=t.replace(/\r\n?/g,`
71
+ `);const e=new N("!xml");let i=e,s="",n="";for(let r=0;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){const l=b(t,">",r,"Closing Tag is not closed.");let o=t.substring(r+2,l).trim();if(this.options.removeNSPrefix){const u=o.indexOf(":");u!==-1&&(o=o.substr(u+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&(s=this.saveTextToParentTag(s,i,n));const a=n.substring(n.lastIndexOf(".")+1);if(o&&this.options.unpairedTags.indexOf(o)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let d=0;a&&this.options.unpairedTags.indexOf(a)!==-1?(d=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=n.lastIndexOf("."),n=n.substring(0,d),i=this.tagsNodeStack.pop(),s="",r=l}else if(t[r+1]==="?"){let l=F(t,r,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,i,n),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const o=new N(l.tagName);o.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(o[":@"]=this.buildAttributesMap(l.tagExp,n,l.tagName)),this.addChild(i,o,n)}r=l.closeIndex+1}else if(t.substr(r+1,3)==="!--"){const l=b(t,"-->",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=t.substring(r+4,l-2);s=this.saveTextToParentTag(s,i,n),i.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=l}else if(t.substr(r+1,2)==="!D"){const l=ae(t,r);this.docTypeEntities=l.entities,r=l.i}else if(t.substr(r+1,2)==="!["){const l=b(t,"]]>",r,"CDATA is not closed.")-2,o=t.substring(r+9,l);if(s=this.saveTextToParentTag(s,i,n),this.options.cdataPropName)i.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]);else{let a=this.parseTextData(o,i.tagname,n,!0,!1,!0);a==null&&(a=""),i.add(this.options.textNodeName,a)}r=l+2}else{let l=F(t,r,this.options.removeNSPrefix),o=l.tagName,a=l.tagExp,d=l.attrExpPresent,u=l.closeIndex;this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&s&&i.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,i,n,!1));const h=i;if(h&&this.options.unpairedTags.indexOf(h.tagname)!==-1&&(i=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),o!==e.tagname&&(n+=n?"."+o:o),this.isItStopNode(this.options.stopNodes,n,o)){let c="";if(a.length>0&&a.lastIndexOf("/")===a.length-1)r=l.closeIndex;else if(this.options.unpairedTags.indexOf(o)!==-1)r=l.closeIndex;else{const v=this.readStopNodeData(t,o,u+1);if(!v)throw new Error(`Unexpected end of ${o}`);r=v.i,c=v.tagContent}const f=new N(o);o!==a&&d&&(f[":@"]=this.buildAttributesMap(a,n,o)),c&&(c=this.parseTextData(c,o,n,!0,d,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),f.add(this.options.textNodeName,c),this.addChild(i,f,n)}else{if(a.length>0&&a.lastIndexOf("/")===a.length-1){o[o.length-1]==="/"?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),a=o):a=a.substr(0,a.length-1),this.options.transformTagName&&(o=this.options.transformTagName(o));const c=new N(o);o!==a&&d&&(c[":@"]=this.buildAttributesMap(a,n,o)),this.addChild(i,c,n),n=n.substr(0,n.lastIndexOf("."))}else{const c=new N(o);this.tagsNodeStack.push(i),o!==a&&d&&(c[":@"]=this.buildAttributesMap(a,n,o)),this.addChild(i,c,n),i=c}s="",r=u}}else s+=t[r];return e.child};function me(t,e,i){const s=this.options.updateTag(e.tagname,i,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),t.addChild(e))}const we=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const i=this.docTypeEntities[e];t=t.replace(i.regx,i.val)}for(let e in this.lastEntities){const i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function ve(t,e,i,s){return t&&(s===void 0&&(s=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,i,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,s),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function ye(t,e,i){const s="*."+i;for(const n in t){const r=t[n];if(s===r||e===r)return!0}return!1}function xe(t,e,i=">"){let s,n="";for(let r=e;r<t.length;r++){let l=t[r];if(s)l===s&&(s="");else if(l==='"'||l==="'")s=l;else if(l===i[0])if(i[1]){if(t[r+1]===i[1])return{data:n,index:r}}else return{data:n,index:r};else l===" "&&(l=" ");n+=l}}function b(t,e,i,s){const n=t.indexOf(e,i);if(n===-1)throw new Error(s);return n+e.length-1}function F(t,e,i,s=">"){const n=xe(t,e+1,s);if(!n)return;let r=n.data;const l=n.index,o=r.search(/\s/);let a=r,d=!0;if(o!==-1&&(a=r.substr(0,o).replace(/\s\s*$/,""),r=r.substr(o+1)),i){const u=a.indexOf(":");u!==-1&&(a=a.substr(u+1),d=a!==n.data.substr(u+1))}return{tagName:a,tagExp:r,closeIndex:l,attrExpPresent:d}}function be(t,e,i){const s=i;let n=1;for(;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){const r=b(t,">",i,`${e} is not closed`);if(t.substring(i+2,r).trim()===e&&(n--,n===0))return{tagContent:t.substring(s,i),i:r};i=r}else if(t[i+1]==="?")i=b(t,"?>",i+1,"StopNode is not closed.");else if(t.substr(i+1,3)==="!--")i=b(t,"-->",i+3,"StopNode is not closed.");else if(t.substr(i+1,2)==="![")i=b(t,"]]>",i,"StopNode is not closed.")-2;else{const r=F(t,i,">");r&&((r&&r.tagName)===e&&r.tagExp[r.tagExp.length-1]!=="/"&&n++,i=r.closeIndex)}}function V(t,e,i){if(e&&typeof t=="string"){const s=t.trim();return s==="true"?!0:s==="false"?!1:le(t,i)}else return U.isExist(t)?t:""}var Ee=de,ut={};function Ne(t,e){return ct(t,e)}function ct(t,e,i){let s;const n={};for(let r=0;r<t.length;r++){const l=t[r],o=_e(l);let a="";if(i===void 0?a=o:a=i+"."+o,o===e.textNodeName)s===void 0?s=l[o]:s+=""+l[o];else{if(o===void 0)continue;if(l[o]){let d=ct(l[o],e,a);const u=Te(d,e);l[":@"]?Ae(d,l[":@"],a,e):Object.keys(d).length===1&&d[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?d=d[e.textNodeName]:Object.keys(d).length===0&&(e.alwaysCreateTextNode?d[e.textNodeName]="":d=""),n[o]!==void 0&&n.hasOwnProperty(o)?(Array.isArray(n[o])||(n[o]=[n[o]]),n[o].push(d)):e.isArray(o,a,u)?n[o]=[d]:n[o]=d}}}return typeof s=="string"?s.length>0&&(n[e.textNodeName]=s):s!==void 0&&(n[e.textNodeName]=s),n}function _e(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];if(s!==":@")return s}}function Ae(t,e,i,s){if(e){const n=Object.keys(e),r=n.length;for(let l=0;l<r;l++){const o=n[l];s.isArray(o,i+"."+o,!0,!0)?t[o]=[e[o]]:t[o]=e[o]}}}function Te(t,e){const{textNodeName:i}=e,s=Object.keys(t).length;return!!(s===0||s===1&&(t[i]||typeof t[i]=="boolean"||t[i]===0))}ut.prettify=Ne;const{buildOptions:Ie}=S,Pe=Ee,{prettify:Oe}=ut,Ce=B;let De=class{constructor(t){this.externalEntities={},this.options=Ie(t)}parse(t,e){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(e){e===!0&&(e={});const n=Ce.validate(t,e);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const i=new Pe(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(t);return this.options.preserveOrder||s===void 0?s:Oe(s,this.options)}addEntity(t,e){if(e.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(e==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}};var Se=De;const Fe=`
72
+ `;function Ve(t,e){let i="";return e.format&&e.indentBy.length>0&&(i=Fe),ht(t,e,"",i)}function ht(t,e,i,s){let n="",r=!1;for(let l=0;l<t.length;l++){const o=t[l],a=$e(o);let d="";if(i.length===0?d=a:d=`${i}.${a}`,a===e.textNodeName){let v=o[a];ke(d,e)||(v=e.tagValueProcessor(a,v),v=pt(v,e)),r&&(n+=s),n+=v,r=!1;continue}else if(a===e.cdataPropName){r&&(n+=s),n+=`<![CDATA[${o[a][0][e.textNodeName]}]]>`,r=!1;continue}else if(a===e.commentPropName){n+=s+`<!--${o[a][0][e.textNodeName]}-->`,r=!0;continue}else if(a[0]==="?"){const v=Z(o[":@"],e),ft=a==="?xml"?"":s;let A=o[a][0][e.textNodeName];A=A.length!==0?" "+A:"",n+=ft+`<${a}${A}${v}?>`,r=!0;continue}let u=s;u!==""&&(u+=e.indentBy);const h=Z(o[":@"],e),c=s+`<${a}${h}`,f=ht(o[a],e,d,u);e.unpairedTags.indexOf(a)!==-1?e.suppressUnpairedNode?n+=c+">":n+=c+"/>":(!f||f.length===0)&&e.suppressEmptyNode?n+=c+"/>":f&&f.endsWith(">")?n+=c+`>${f}${s}</${a}>`:(n+=c+">",f&&s!==""&&(f.includes("/>")||f.includes("</"))?n+=s+e.indentBy+f+s:n+=f,n+=`</${a}>`),r=!0}return n}function $e(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];if(s!==":@")return s}}function Z(t,e){let i="";if(t&&!e.ignoreAttributes)for(let s in t){let n=e.attributeValueProcessor(s,t[s]);n=pt(n,e),n===!0&&e.suppressBooleanAttributes?i+=` ${s.substr(e.attributeNamePrefix.length)}`:i+=` ${s.substr(e.attributeNamePrefix.length)}="${n}"`}return i}function ke(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let i=t.substr(t.lastIndexOf(".")+1);for(let s in e.stopNodes)if(e.stopNodes[s]===t||e.stopNodes[s]==="*."+i)return!0;return!1}function pt(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const s=e.entities[i];t=t.replace(s.regex,s.val)}return t}var Re=Ve;const Le=Re,je={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function y(t){this.options=Object.assign({},je,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=qe),this.processTextOrObjNode=Me,this.options.format?(this.indentate=Be,this.tagEndChar=`>
73
+ `,this.newLine=`
74
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}y.prototype.build=function(t){return this.options.preserveOrder?Le(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},y.prototype.j2x=function(t,e){let i="",s="";for(let n in t)if(typeof t[n]>"u")this.isAttribute(n)&&(s+="");else if(t[n]===null)this.isAttribute(n)?s+="":n[0]==="?"?s+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+n+"/"+this.tagEndChar;else if(t[n]instanceof Date)s+=this.buildTextValNode(t[n],n,"",e);else if(typeof t[n]!="object"){const r=this.isAttribute(n);if(r)i+=this.buildAttrPairStr(r,""+t[n]);else if(n===this.options.textNodeName){let l=this.options.tagValueProcessor(n,""+t[n]);s+=this.replaceEntitiesValue(l)}else s+=this.buildTextValNode(t[n],n,"",e)}else if(Array.isArray(t[n])){const r=t[n].length;let l="";for(let o=0;o<r;o++){const a=t[n][o];typeof a>"u"||(a===null?n[0]==="?"?s+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+n+"/"+this.tagEndChar:typeof a=="object"?this.options.oneListGroup?l+=this.j2x(a,e+1).val:l+=this.processTextOrObjNode(a,n,e):l+=this.buildTextValNode(a,n,"",e))}this.options.oneListGroup&&(l=this.buildObjectNode(l,n,"",e)),s+=l}else if(this.options.attributesGroupName&&n===this.options.attributesGroupName){const r=Object.keys(t[n]),l=r.length;for(let o=0;o<l;o++)i+=this.buildAttrPairStr(r[o],""+t[n][r[o]])}else s+=this.processTextOrObjNode(t[n],n,e);return{attrStr:i,val:s}},y.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function Me(t,e,i){const s=this.j2x(t,i+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,i):this.buildObjectNode(s.val,e,s.attrStr,i)}y.prototype.buildObjectNode=function(t,e,i,s){if(t==="")return e[0]==="?"?this.indentate(s)+"<"+e+i+"?"+this.tagEndChar:this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,r="";return e[0]==="?"&&(r="?",n=""),(i||i==="")&&t.indexOf("<")===-1?this.indentate(s)+"<"+e+i+r+">"+t+n:this.options.commentPropName!==!1&&e===this.options.commentPropName&&r.length===0?this.indentate(s)+`<!--${t}-->`+this.newLine:this.indentate(s)+"<"+e+i+r+this.tagEndChar+t+this.indentate(s)+n}},y.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e},y.prototype.buildTextValNode=function(t,e,i,s){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(s)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(s)+"<"+e+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),n===""?this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(s)+"<"+e+i+">"+n+"</"+e+this.tagEndChar}},y.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};function Be(t){return this.options.indentBy.repeat(t)}function qe(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}var Ue=y;const ze=B,Ge=Se,Xe=Ue;var J={XMLParser:Ge,XMLValidator:ze,XMLBuilder:Xe};function He(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);if(t=t.trim(),t.length===0||J.XMLValidator.validate(t)!==!0)return!1;let e;const i=new J.XMLParser;try{e=i.parse(t)}catch{return!1}return!(!e||!("svg"in e))}class Ke{_view;constructor(e){We(e),this._view=e}get id(){return this._view.id}get name(){return this._view.name}get caption(){return this._view.caption}get emptyTitle(){return this._view.emptyTitle}get emptyCaption(){return this._view.emptyCaption}get getContents(){return this._view.getContents}get icon(){return this._view.icon}set icon(e){this._view.icon=e}get order(){return this._view.order}set order(e){this._view.order=e}get params(){return this._view.params}set params(e){this._view.params=e}get columns(){return this._view.columns}get emptyView(){return this._view.emptyView}get parent(){return this._view.parent}get sticky(){return this._view.sticky}get expanded(){return this._view.expanded}set expanded(e){this._view.expanded=e}get defaultSortKey(){return this._view.defaultSortKey}}const We=function(t){if(!t.id||typeof t.id!="string")throw new Error("View id is required and must be a string");if(!t.name||typeof t.name!="string")throw new Error("View name is required and must be a string");if(t.columns&&t.columns.length>0&&(!t.caption||typeof t.caption!="string"))throw new Error("View caption is required for top-level views and must be a string");if(!t.getContents||typeof t.getContents!="function")throw new Error("View getContents is required and must be a function");if(!t.icon||typeof t.icon!="string"||!He(t.icon))throw new Error("View icon is required and must be a valid svg string");if(!("order"in t)||typeof t.order!="number")throw new Error("View order is required and must be a number");if(t.columns&&t.columns.forEach(e=>{if(!(e instanceof lt))throw new Error("View columns must be an array of Column. Invalid column found")}),t.emptyView&&typeof t.emptyView!="function")throw new Error("View emptyView must be a function");if(t.parent&&typeof t.parent!="string")throw new Error("View parent must be a string");if("sticky"in t&&typeof t.sticky!="boolean")throw new Error("View sticky must be a boolean");if("expanded"in t&&typeof t.expanded!="boolean")throw new Error("View expanded must be a boolean");if(t.defaultSortKey&&typeof t.defaultSortKey!="string")throw new Error("View defaultSortKey must be a string");return!0},Ye=function(t){return $().registerEntry(t)},Ze=function(t){return $().unregisterEntry(t)},Je=function(t,e){return $().getEntries(t,e)};exports.Column=lt,exports.DefaultType=k,exports.File=nt,exports.FileAction=xt,exports.FileType=P,exports.Folder=rt,exports.Header=Nt,exports.Navigation=at,exports.Node=j,exports.Permission=m,exports.View=Ke,exports.addNewFileMenuEntry=Ye,exports.davGetClient=Ot,exports.davGetDefaultPropfind=It,exports.davGetFavoritesReport=tt,exports.davGetRecentSearch=Pt,exports.davParsePermissions=et,exports.davRemoteURL=st,exports.davResultToNode=ot,exports.davRootPath=M,exports.defaultDavNamespaces=L,exports.defaultDavProperties=R,exports.formatFileSize=yt,exports.getDavNameSpaces=I,exports.getDavProperties=T,exports.getFavoriteNodes=Ct,exports.getFileActions=Et,exports.getFileListHeaders=At,exports.getNavigation=Dt,exports.getNewFileMenuEntries=Je,exports.registerDavProperty=Tt,exports.registerFileAction=bt,exports.registerFileListHeaders=_t,exports.removeNewFileMenuEntry=Ze;