2025-04-17 10:37:22 +00:00
|
|
|
(()=>{"use strict";var e,t,r,n={35810:(e,t,r)=>{r.d(t,{Al:()=>n.r,E6:()=>p,H4:()=>n.c,KT:()=>f,PY:()=>n.b,Q$:()=>n.e,R3:()=>n.n,Ss:()=>ne,VL:()=>n.l,a7:()=>u,aX:()=>n.P,bh:()=>v,di:()=>d,lJ:()=>n.d,m1:()=>Te,nF:()=>h,pt:()=>n.F,ur:()=>N,v7:()=>E,vd:()=>n.s});var n=r(68251),i=r(87485),s=r(43627),o=r(53334),a=r(380),l=r(65606),u=(e=>(e[e.UploadFromDevice=0]="UploadFromDevice",e[e.CreateNew=1]="CreateNew",e[e.Other=2]="Other",e))(u||{});class c{_entries=[];registerEntry(e){this.validateEntry(e),e.category=e.category??1,this._entries.push(e)}unregisterEntry(e){const t="string"==typeof e?this.getEntryIndex(e):this.getEntryIndex(e.id);-1!==t?this._entries.splice(t,1):n.o.warn("Entry not found, nothing removed",{entry:e,entries:this.getEntries()})}getEntries(e){return e?this._entries.filter((t=>"function"!=typeof t.enabled||t.enabled(e))):this._entries}getEntryIndex(e){return this._entries.findIndex((t=>t.id===e))}validateEntry(e){if(!e.id||!e.displayName||!e.iconSvgInline&&!e.iconClass||!e.handler)throw new Error("Invalid entry");if("string"!=typeof e.id||"string"!=typeof e.displayName)throw new Error("Invalid id or displayName property");if(e.iconClass&&"string"!=typeof e.iconClass||e.iconSvgInline&&"string"!=typeof e.iconSvgInline)throw new Error("Invalid icon provided");if(void 0!==e.enabled&&"function"!=typeof e.enabled)throw new Error("Invalid enabled property");if("function"!=typeof e.handler)throw new Error("Invalid handler property");if("order"in e&&"number"!=typeof e.order)throw new Error("Invalid order property");if(-1!==this.getEntryIndex(e.id))throw new Error("Duplicate entry")}}var h=(e=>(e.ReservedName="reserved name",e.Character="character",e.Extension="extension",e))(h||{});class d extends Error{constructor(e){super(`Invalid ${e.reason} '${e.segment}' in filename '${e.filename}'`,{cause:e})}get filename(){return this.cause.filename}get reason(){return this.cause.reason}get segment(){return this.cause.segment}}function f(e){const t=(0,i.F)().files,r=t.forbidden_filename_characters??window._oc_config?.forbidden_filenames_characters??["/","\\"];for(const t of r)if(e.includes(t))throw new d({segment:t,reason:"character",filename:e});if(e=e.toLocaleLowerCase(),(t.forbidden_filenames??[".htaccess"]).includes(e))throw new d({filename:e,segment:e,reason:"reserved name"});const n=e.indexOf(".",1),s=e.substring(0,-1===n?void 0:n);if((t.forbidden_filename_basenames??[]).includes(s))throw new d({filename:e,segment:s,reason:"reserved name"});const o=t.forbidden_filename_extensions??[".part",".filepart"];for(const t of o)if(e.length>t.length&&e.endsWith(t))throw new d({segment:t,reason:"extension",filename:e})}function p(e,t,r){const n={suffix:e=>`(${e})`,ignoreFileExtension:!1,...r};let i=e,o=1;for(;t.includes(i);){const t=n.ignoreFileExtension?"":(0,s.extname)(e);i=`${(0,s.basename)(e,t)} ${n.suffix(o++)}${t}`}return i}const g=["B","KB","MB","GB","TB","PB"],m=["B","KiB","MiB","GiB","TiB","PiB"];function E(e,t=!1,r=!1,n=!1){r=r&&!n,"string"==typeof e&&(e=Number(e));let i=e>0?Math.floor(Math.log(e)/Math.log(n?1e3:1024)):0;i=Math.min((r?m.length:g.length)-1,i);const s=r?m[i]:g[i];let a=(e/Math.pow(n?1e3:1024,i)).toFixed(1);return!0===t&&0===i?("0.0"!==a?"< 1 ":"0 ")+(r?m[1]:g[1]):(a=i<2?parseFloat(a).toFixed(0):parseFloat(a).toLocaleString((0,o.lO)()),a+" "+s)}function b(e){return e instanceof Date?e.toISOString():String(e)}function N(e,t={}){const r={sortingMode:"basename",sortingOrder:"asc",...t};return function(e,t,r){r=r??[];const n=(t=t??[e=>e]).map(((e,t)=>"asc"===(r[t]??"asc")?1:-1)),i=Intl.Collator([(0,o.Z0)(),(0,o.lO)()],{numeric:!0,usage:"sort"});return[...e].sort(((e,r)=>{for(const[s,o]of t.entries()){const t=i.compare(b(o(e)),b(o(r)));if(0!==t)return t*n[s]}return 0}))}(e,[...r.sortFavoritesFirst?[e=>1!==e.attributes?.favorite]:[],...r.sortFoldersFirst?[e=>"folder"!==e.type]:[],..."basename"!==r.sortingMode?[e=>e[r.sortingMode]]:[],e=>{return(t=e.displayname||e.attributes?.displayname||e.basename).lastIndexOf(".")>0?t.slice(0,t.lastIndexOf(".")):t;var t},e=>e.basename],[...r.sortFavoritesFirst?["asc"]:[],...r.sor
|