Files
nextcloud-server/dist/folder-29HuacU_-GslSi8fz.chunk.mjs
nextcloud-command 78098c8325 chore(assets): Recompile assets
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2026-04-01 13:41:02 +00:00

3 lines
6.4 KiB
JavaScript

import{g as y,j as m,l as g,m as b,i as u,n as E}from"./index-Bp9-GhMo.chunk.mjs";window._nc_files_scope??={},window._nc_files_scope.v4_0??={};const R=window._nc_files_scope.v4_0,I=y().setApp("@nextcloud/files").detectUser().build(),d=Object.freeze({Folder:"folder",File:"file"}),o=Object.freeze({NONE:0,READ:1,UPDATE:2,CREATE:4,WRITE:4,DELETE:8,SHARE:16,ALL:31}),D=Object.freeze({NEW:"new",FAILED:"failed",LOADING:"loading",LOCKED:"locked"});function h(t,e){return t.match(e)!==null}function s(t,e){if(t.id&&typeof t.id!="number"&&typeof t.id!="string")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.root)throw new Error("Missing mandatory root");if(typeof t.root!="string")throw new Error("Invalid root type");if(!t.root.startsWith("/"))throw new Error("Root must start with a leading slash");if(!t.source.includes(t.root))throw new Error("Root must be part of the source");if(h(t.source,e)){const i=t.source.match(e)[0];if(!t.source.includes(E(i,t.root)))throw new Error("The root must be relative to the service. e.g /files/emma")}if(t.displayname&&typeof t.displayname!="string")throw new Error("Invalid displayname type");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>=o.NONE&&t.permissions<=o.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.status&&!Object.values(D).includes(t.status))throw new Error("Status must be a valid NodeStatus")}function S(t){t.mtime&&typeof t.mtime=="string"&&!isNaN(Date.parse(t.mtime))&&JSON.stringify(new Date(t.mtime))===JSON.stringify(t.mtime)&&(t.mtime=new Date(t.mtime)),t.crtime&&typeof t.crtime=="string"&&!isNaN(Date.parse(t.crtime))&&JSON.stringify(new Date(t.crtime))===JSON.stringify(t.crtime)&&(t.crtime=new Date(t.crtime))}function O(t){if(t instanceof RegExp)return t;const e=t.match(/(\/?)(.+)\1([a-z]*)/i);if(!e)throw new Error("Invalid regular expression format.");const i=Array.from(new Set(e[3])).filter(r=>"gimsuy".includes(r)).join("");return new RegExp(e[2],i)}class c{_attributes;_data;_knownDavService=/(remote|public)\.php\/(web)?dav/i;readonlyAttributes=Object.entries(Object.getOwnPropertyDescriptors(c.prototype)).filter(e=>typeof e[1].get=="function"&&e[0]!=="__proto__").map(e=>e[0]);handler={set:(e,i,r)=>this.readonlyAttributes.includes(i)?!1:Reflect.set(e,i,r),deleteProperty:(e,i)=>this.readonlyAttributes.includes(i)?!1:Reflect.deleteProperty(e,i)};constructor(...[e,i]){e.mime||(e.mime="application/octet-stream"),S(e),i=O(i||this._knownDavService),s(e,i),this._data={...e,attributes:{}},this._attributes=new Proxy(this._data.attributes,this.handler),this.update(e.attributes??{}),i&&(this._knownDavService=i)}get source(){return this._data.source.replace(/\/$/i,"")}get encodedSource(){const{origin:e}=new URL(this.source);return e+m(this.source.slice(e.length))}get basename(){return g(this.source)}get displayname(){return this._data.displayname||this.basename}set displayname(e){s({...this._data,displayname:e},this._knownDavService),this._data.displayname=e}get extension(){return b(this.source)}get dirname(){return u(this.path)}get mime(){return this._data.mime||"application/octet-stream"}set mime(e){e??="application/octet-stream",s({...this._data,mime:e},this._knownDavService),this._data.mime=e}get mtime(){return this._data.mtime}set mtime(e){s({...this._data,mtime:e},this._knownDavService),this._data.mtime=e}get crtime(){return this._data.crtime}get size(){return this._data.size}set size(e){s({...this._data,size:e},this._knownDavService),this.updateMtime(),this._data.size=e}get attributes(){return this._attributes}get permissions(){return this.owner===null&&!this.isDavResource?o.READ:this._data.permissions!==void 0?this._data.permissions:o.NONE}set permissions(e){s({...this._data,permissions:e},this._knownDavService),this.updateMtime(),this._data.permissions=e}get owner(){return this.isDavResource?this._data.owner:null}get isDavResource(){return h(this.source,this._knownDavService)}get root(){return this._data.root.replace(/^(.+)\/$/,"$1")}get path(){const e=this.source.indexOf("://"),i=this.source.slice(0,e),r=this.source.slice(e+3),a=r.indexOf("/"),l=r.slice(0,a),p=r.slice(a),w=`${i}://${l}${m(p)}`,f=new URL(w);let n=decodeURIComponent(f.pathname);this.isDavResource&&(n=n.split(this._knownDavService).pop());const _=n.indexOf(this.root),v=this.root.replace(/\/$/,"");return n.slice(_+v.length)||"/"}get fileid(){return typeof this._data?.id=="number"?this._data.id:void 0}get id(){if(!(typeof this._data?.id>"u"||typeof this._data.id=="number"&&this._data.id<0))return String(this._data.id)}get status(){return this._data?.status}set status(e){s({...this._data,status:e},this._knownDavService),this._data.status=e}move(e){s({...this._data,source:e},this._knownDavService);const i=this.basename;this._data.source=e,this.displayname===i&&this.basename!==i&&(this.displayname=this.basename)}rename(e){if(e.includes("/"))throw new Error("Invalid basename");this.move(u(this.source)+"/"+e)}updateMtime(){this._data.mtime&&(this._data.mtime=new Date)}update(e){for(const[i,r]of Object.entries(e))try{r===void 0?delete this.attributes[i]:this.attributes[i]=r}catch(a){if(a instanceof TypeError)continue;throw a}}clone(){return new this.constructor(structuredClone(this._data),this._knownDavService)}toJSON(){return JSON.stringify([structuredClone(this._data),this._knownDavService.toString()])}}class x extends c{constructor(...[e,i]){super(e,i)}get type(){return d.File}}class k extends c{constructor(...[e,i]){super({...e,mime:"httpd/unix-directory"},i)}get type(){return d.Folder}get extension(){return null}get mime(){return"httpd/unix-directory"}}export{d as F,D as N,o as P,x as a,k as b,I as l,R as s};
//# sourceMappingURL=folder-29HuacU_-GslSi8fz.chunk.mjs.map