@scaleflex/uploader 0.2.3 → 0.2.4

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.
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("lit"),p=require("lit/decorators.js"),U=require("lit/directives/unsafe-svg.js"),D=require("lit/directives/unsafe-html.js");class Se{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const t=this.state;this.state={...t,...e},this._notifying=!0;try{this.listeners.forEach(i=>i(this.state,t))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function S(n,e,t){const i=n.getState().files,r=i.get(e);if(!r)return;const o=new Map(i);o.set(e,{...r,...t}),n.setState({files:o})}function M(n,e){const t=new Map(n.getState().files);t.set(e.id,e),n.setState({files:t})}function be(n,e){const t=n.getState().files;if(!t.has(e))return;const i=new Map(t);i.delete(e),n.setState({files:i})}function Ee(){return new Se({files:new Map,queueConfig:{concurrency:3,autoProceed:!1,retryConfig:{maxRetries:0,baseDelay:1e3,maxDelay:3e4,backoffFactor:2}},isPaused:!1,restrictions:{maxFileSize:null,maxTotalFilesSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,blockedFileTypes:null},targetFolder:"/",totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0,isUploading:!1})}class Fe{constructor(e,t){this.host=e,this.store=t,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function Oe(n,e){const t=new XMLHttpRequest;let i=!1;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`;t.open("POST",o);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);t.upload.addEventListener("progress",l=>{l.lengthComputable&&!i&&e.onProgress(l.loaded,l.total)}),t.addEventListener("load",()=>{if(i)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{i||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{i||e.onError(new Error("Upload timed out"))});const a=new FormData;if(n.file){const l={name:n.name,type:n.type};Object.keys(n.meta).length>0&&(l.meta=n.meta),n.tags.length>0&&(l.tags=n.tags),a.append("info[files[]]",JSON.stringify(l)),a.append("files[]",n.file,n.name)}return t.timeout=6e4,t.send(a),{abort(){i=!0,t.abort()}}}function Te(n,e){const t=new XMLHttpRequest;let i=!1;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files/upload_url`;t.open("POST",o);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);if(t.setRequestHeader("Content-Type","application/json"),t.addEventListener("load",()=>{if(i)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{i||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{i||e.onError(new Error("Upload timed out"))}),!n.remoteUrl)return e.onError(new Error("Remote URL is required for URL upload")),{abort(){}};const a={files_urls:[{url:n.remoteUrl,name:n.name}],dir:e.folder};return t.timeout=6e4,t.send(JSON.stringify(a)),{abort(){i=!0,t.abort()}}}function Q(n){return{Accept:"application/json","Content-Type":"application/json","uppy-auth-token":n}}function H(n){return n.replace(/\/+$/,"")}const je={"google-drive":"drive",dropbox:"dropbox",onedrive:"onedrive",box:"box",instagram:"instagram",facebook:"facebook",unsplash:"unsplash"};function Y(n){return je[n]??n}function Le(n,e){const t=H(n),i=btoa(JSON.stringify({origin:window.location.origin})),r=Y(e);return`${t}/${r}/connect?state=${encodeURIComponent(i)}`}async function Me(n,e,t,i=""){const r=H(n),o=i?`/${i}`:"",a=Y(e),l=await fetch(`${r}/${a}/list${o}`,{method:"GET",headers:Q(t),credentials:"same-origin"});if(l.status===401)throw new ee;if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Companion list failed (HTTP ${l.status})`)}return l.json()}async function Be(n,e,t){const i=H(n),r=await fetch(`${i}/${t}`,{method:"GET",headers:Q(e),credentials:"same-origin"});if(r.status===401)throw new ee;if(!r.ok){const o=await r.json().catch(()=>null);throw new Error((o==null?void 0:o.message)||`Companion list failed (HTTP ${r.status})`)}return r.json()}async function Re(n,e,t,i){const r=H(n),o=Y(e),a=i?`q=${encodeURIComponent(t)}&${i}`:`q=${encodeURIComponent(t)}`,l=await fetch(`${r}/search/${o}/list?${a}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"},credentials:"same-origin"});if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Search failed (HTTP ${l.status})`)}return l.json()}async function Ae(n,e,t,i,r,o=!1){const a=H(n),l=Y(e),d=o?`${a}/search/${l}/get/${i}`:`${a}/${l}/get/${i}`,c=o?{Accept:"application/json","Content-Type":"application/json"}:Q(t),h=await fetch(d,{method:"POST",headers:c,credentials:"same-origin",body:JSON.stringify({...r,httpMethod:r.httpMethod??"POST",useFormData:r.useFormData??!0,fieldname:r.fieldname??"files[]"})});if(h.status===401)throw new ee;if(!h.ok){const x=await h.json().catch(()=>null);throw new Error((x==null?void 0:x.message)||`Companion upload failed (HTTP ${h.status})`)}return h.json()}async function Ie(n,e,t){const i=H(n),r=Y(e),o=await fetch(`${i}/${r}/logout`,{method:"GET",headers:Q(t),credentials:"same-origin"});return o.ok?o.json():{ok:!1,revoked:!1}}function He(n){var r;const t=((r=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(n))==null?void 0:r[1])??n;return`${location.protocol==="https:"?"wss":"ws"}://${t}`}class ee extends Error{constructor(){super("Authentication expired"),this.name="AuthExpiredError"}}function qe(n,e){const t=n.remoteInfo;if(!t)return e.onError(new Error("remoteInfo is required for companion upload")),{abort(){}};let i=!1,r=null;const a=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`,l={};n.meta&&Object.keys(n.meta).length>0&&Object.assign(l,n.meta),n.tags&&n.tags.length>0&&(l.tags=n.tags);const d=!t.token;return Ae(t.companionUrl,t.provider,t.token,t.requestPath,{fileId:t.fileId,endpoint:a,headers:e.authHeaders,size:t.size,metadata:Object.keys(l).length>0?l:void 0},d).then(c=>{if(i)return;const x=`${He(t.companionUrl)}/api/${c.token}`;try{r=new WebSocket(x)}catch{e.onError(new Error("Failed to connect to upload progress channel"));return}r.onmessage=u=>{var f,v,w;if(!i)try{const m=JSON.parse(u.data);switch(m.action){case"progress":{const b=m.payload,y=b.bytesUploaded??0,E=b.bytesTotal??(t.size||1);e.onProgress(y,E);break}case"success":{const b=m.payload;if(r==null||r.close(),(f=b.response)!=null&&f.responseText)try{const y=JSON.parse(b.response.responseText);if(y.status==="success"){e.onComplete(y);return}e.onError(new Error(y.msg||"Upload failed"));return}catch{}e.onError(new Error("Upload completed but no valid response received"));break}case"error":{r==null||r.close();const b=m.payload;let y=((v=b.error)==null?void 0:v.message)||"Upload failed";if((w=b.response)!=null&&w.responseText)try{const E=JSON.parse(b.response.responseText);y=E.hint||E.msg||E.message||y}catch{}e.onError(new Error(y));break}}}catch{}},r.onerror=()=>{i||e.onError(new Error("Upload progress connection failed"))},r.onclose=()=>{r=null}}).catch(c=>{i||e.onError(c instanceof Error?c:new Error(String(c)))}),{abort(){if(i=!0,r){try{r.send(JSON.stringify({action:"cancel",payload:{}}))}catch{}r.close(),r=null}}}}class Ue{constructor(e,t){this.activeUploads=new Map,this.retryTimers=new Map,this.unsubscribe=null,this.store=e,this.config=t}start(){this.unsubscribe||(this.unsubscribe=this.store.subscribe(()=>this.processQueue()),this.processQueue())}uploadAll(){const{files:e}=this.store.getState();let t=!1;for(const i of e.values())i.status==="idle"?(S(this.store,i.id,{status:"queued"}),t=!0):i.status==="queued"&&(t=!0);t&&(this.store.setState({isUploading:!0}),this.processQueue())}retryFile(e){const t=this.store.getState().files.get(e);!t||t.status!=="error"&&t.status!=="failed"||(S(this.store,e,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0}),this.processQueue())}retryAll(){const{files:e}=this.store.getState();for(const t of e.values())(t.status==="error"||t.status==="failed")&&S(this.store,t.id,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0});this.processQueue()}cancelFile(e){const t=this.store.getState().files.get(e);!t||!we(t.status)||(this.abortUpload(e),S(this.store,e,{status:"cancelled"}))}cancelAll(){const{files:e}=this.store.getState();for(const t of e.values())we(t.status)&&(this.abortUpload(t.id),S(this.store,t.id,{status:"cancelled"}));this.store.setState({isUploading:!1})}updateConfig(e){Object.assign(this.config,e)}destroy(){var e;for(const t of this.activeUploads.keys())this.abortUpload(t);for(const t of this.retryTimers.values())clearTimeout(t);this.retryTimers.clear(),(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=null}processQueue(){const e=this.store.getState();if(e.isPaused)return;const{concurrency:t}=e.queueConfig,i=this.activeUploads.size,r=t-i;if(r<=0)return;const a=[...e.files.values()].filter(l=>l.status==="queued").sort((l,d)=>l.retryCount!==d.retryCount?d.retryCount-l.retryCount:l.addedAt-d.addedAt).slice(0,r);for(const l of a)this.startUpload(l)}startUpload(e){S(this.store,e.id,{status:"uploading",error:null});let t=0,i=Date.now(),r=0;const o={apiBase:this.config.apiBase,authHeaders:this.config.authHeaders,folder:this.store.getState().targetFolder,onComplete:d=>this.handleComplete(e.id,d),onError:d=>this.handleError(e.id,d)},a=(d,c)=>{const h=Date.now(),x=(h-i)/1e3;if(x>0){const f=(d-t)/x;r=r===0?f:.3*f+.7*r}t=d,i=h;const u=c>0?Math.min(d/c*100,100):0;S(this.store,e.id,{progress:u,bytesUploaded:d,speed:r}),this.updateTotalProgress()};let l;e.remoteInfo?l=qe(e,{...o,onProgress:a}):e.remoteUrl?l=Te(e,o):l=Oe(e,{...o,onProgress:a}),this.activeUploads.set(e.id,l)}handleComplete(e,t){this.activeUploads.delete(e),S(this.store,e,{status:"complete",progress:100,response:t}),this.updateTotalProgress(),this.checkAllComplete(),this.processQueue()}handleError(e,t){this.activeUploads.delete(e);const i=this.store.getState().files.get(e);if(!i)return;const{retryConfig:r}=this.store.getState().queueConfig,o=i.retryCount+1;if(o<=r.maxRetries){const a=Math.min(r.baseDelay*Math.pow(r.backoffFactor,i.retryCount),r.maxDelay);S(this.store,e,{status:"retrying",error:t.message,retryCount:o});const l=setTimeout(()=>{this.retryTimers.delete(e),S(this.store,e,{status:"queued"}),this.processQueue()},a);this.retryTimers.set(e,l)}else S(this.store,e,{status:"failed",error:t.message}),this.checkAllComplete(),this.processQueue()}abortUpload(e){var i;(i=this.activeUploads.get(e))==null||i.abort(),this.activeUploads.delete(e);const t=this.retryTimers.get(e);t&&(clearTimeout(t),this.retryTimers.delete(e))}updateTotalProgress(){const{files:e}=this.store.getState();let t=0,i=0,r=0;for(const o of e.values())(o.status==="queued"||o.status==="uploading"||o.status==="retrying"||o.status==="complete"||o.status==="failed")&&(t+=o.size,i+=o.status==="complete"?o.size:o.bytesUploaded),o.status==="uploading"&&(r+=o.speed);this.store.setState({totalBytes:t,totalBytesUploaded:i,totalSpeed:r,totalProgress:t>0?Math.min(i/t*100,100):0})}checkAllComplete(){const{files:e}=this.store.getState();![...e.values()].some(i=>i.status==="queued"||i.status==="uploading"||i.status==="retrying")&&this.store.getState().isUploading&&this.store.setState({isUploading:!1})}}function we(n){return n==="queued"||n==="uploading"||n==="retrying"}function te(n){return`https://api.filerobot.com/${n}`}async function ze(n,e){const t=`${te(n)}/key/${encodeURIComponent(e)}`,i=new AbortController,r=setTimeout(()=>i.abort(),3e4);try{const o=await fetch(t,{signal:i.signal});if(clearTimeout(r),!o.ok)throw new Error(`SASS key exchange failed (HTTP ${o.status})`);const a=await o.json();if(a.status==="error")throw new Error(`SASS key exchange failed: ${a.msg||"Unknown error"}`);return a.key}catch(o){throw clearTimeout(r),o instanceof DOMException&&o.name==="AbortError"?new Error("SASS key exchange timed out"):o}}function K(n,e){const t={};switch(n.mode){case"security-template":if(!e)throw new Error("[sfx-uploader] Cannot build auth headers for security-template mode: SASS key exchange has not been performed. Call resolveAuth() first or use sass-key mode with a pre-resolved key.");t["X-Filerobot-Key"]=e;break;case"sass-key":t["X-Filerobot-Key"]=n.sassKey;break}return n.airboxPuid&&(t["X-Filerobot-Airbox-Puid"]=n.airboxPuid),t}async function Pe(n){const e=te(n.container);if(n.mode==="security-template"){const t=await ze(n.container,n.securityTemplateId);return{apiBase:e,headers:K(n,t),sassKey:t}}return{apiBase:e,headers:K(n)}}const g={FILE_ADDED:"sfx-file-added",FILE_REMOVED:"sfx-file-removed",FILE_REJECTED:"sfx-file-rejected",UPLOAD_STARTED:"sfx-upload-started",UPLOAD_PROGRESS:"sfx-upload-progress",UPLOAD_COMPLETE:"sfx-upload-complete",UPLOAD_ERROR:"sfx-upload-error",UPLOAD_RETRY:"sfx-upload-retry",ALL_COMPLETE:"sfx-all-complete",TOTAL_PROGRESS:"sfx-total-progress",BEFORE_UPLOAD:"sfx-before-upload",OPEN:"sfx-open",CLOSE:"sfx-close",CANCEL:"sfx-cancel",COMPLETE_ACTION:"sfx-complete-action",FILE_PREVIEW:"sfx-file-preview",FILL_METADATA:"sfx-fill-metadata"};let Ye=0;function B(){return`file-${Date.now()}-${++Ye}`}function R(n){if(n<=0)return"0 B";const e=["B","KB","MB","GB"],t=Math.min(Math.floor(Math.log(n)/Math.log(1024)),e.length-1),i=n/Math.pow(1024,t);return`${t===0?i:i.toFixed(1)} ${e[t]}`}function ie(n){if(!isFinite(n)||n<=0)return"0s";const e=Math.round(n);if(e<60)return`${e}s`;const t=Math.floor(e/60),i=e%60;return i>0?`${t}m ${i}s`:`${t}m`}function q(n){var t;const e=((t=n.name.split(".").pop())==null?void 0:t.toLowerCase())??"";return n.type.startsWith("image/")?"image":n.type.startsWith("video/")||["mp4","mov","avi","webm","mkv"].includes(e)?"vid":n.type==="application/pdf"||e==="pdf"?"pdf":["doc","docx","xls","xlsx","ppt","pptx","txt","rtf","odt"].includes(e)?"doc":["zip","rar","7z","tar","gz","bz2"].includes(e)?"zip":"gen"}function Ve(n){const e=n.lastIndexOf(".");return e>=0?n.slice(e+1).toUpperCase():""}const Ne={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",webm:"video/webm",pdf:"application/pdf",zip:"application/zip",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function Xe(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())??"";return Ne[e]||""}function We(n){return new Promise(e=>{const t=document.createElement("video");t.preload="metadata",t.muted=!0,t.playsInline=!0;const i=URL.createObjectURL(n);let r=!1;const o=()=>{r||(r=!0,e(null)),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(i)};t.addEventListener("seeked",()=>{try{const a=document.createElement("canvas");a.width=t.videoWidth||320,a.height=t.videoHeight||240;const l=a.getContext("2d");if(l){l.drawImage(t,0,0,a.width,a.height),a.toBlob(d=>{r||(r=!0,e(d?URL.createObjectURL(d):null),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(i))},"image/jpeg",.7);return}}catch{}o()},{once:!0}),t.addEventListener("error",()=>o(),{once:!0}),setTimeout(()=>o(),5e3),t.src=i,t.addEventListener("loadeddata",()=>{t.currentTime=.1},{once:!0})})}function oe(n,e,t){var i,r;if(e.maxFileSize!=null&&n.size>0&&n.size>e.maxFileSize)return`File exceeds ${(e.maxFileSize/1048576).toFixed(1)} MB limit`;if(e.maxTotalFilesSize!=null&&n.size>0){let o=n.size;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&(o+=a.size);if(o>e.maxTotalFilesSize)return"Total file size limit exceeded"}if(e.maxNumberOfFiles!=null){let o=0;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&o++;if(o>=e.maxNumberOfFiles)return`Maximum ${e.maxNumberOfFiles} files allowed`}if(e.allowedFileTypes!=null){const o=e.allowedFileTypes,a="."+(((i=n.name.split(".").pop())==null?void 0:i.toLowerCase())??"");if(!o.some(d=>d.startsWith(".")?a===d.toLowerCase():d.endsWith("/*")?n.type.startsWith(d.slice(0,-1)):n.type===d))return"File type not allowed"}if(e.blockedFileTypes!=null){const o=e.blockedFileTypes,a="."+(((r=n.name.split(".").pop())==null?void 0:r.toLowerCase())??"");if(o.some(d=>d.startsWith(".")?a===d.toLowerCase():d.endsWith("/*")?n.type.startsWith(d.slice(0,-1)):n.type===d))return"File type is blocked"}return null}function Ge(n,e,t){return oe(n,e,t)}function ye(n){return n.allowedFileTypes?n.allowedFileTypes.join(","):""}const _e={"google-drive":{id:"google-drive",label:"Google Drive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:transparent"><svg width="16" height="16" viewBox="0 0 87.3 78"><path d="M6.6 66.85l3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3L27.5 53H0c0 1.55.4 3.1 1.2 4.5z" fill="#0066da"/><path d="M43.65 25L29.9 1.2C28.55 2 27.4 3.1 26.6 4.5L1.2 48.5C.4 49.9 0 51.45 0 53h27.5z" fill="#00ac47"/><path d="M73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5H59.8l5.65 10.85z" fill="#ea4335"/><path d="M43.65 25L57.4 1.2C56.05.4 54.5 0 52.9 0H34.4c-1.6 0-3.15.45-4.5 1.2z" fill="#00832d"/><path d="M59.8 53H27.5L13.75 76.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z" fill="#2684fc"/><path d="M73.4 26.5l-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3L43.65 25 59.8 53h27.45c0-1.55-.4-3.1-1.2-4.5z" fill="#ffba00"/></svg></span>'},dropbox:{id:"dropbox",label:"Dropbox",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0061ff"><svg width="11" height="11" viewBox="0 0 528 512" fill="white"><path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zm-132 284.5l132-84.3 132 84.3-132 84.4-132-84.4zm132-116.6l132.3-84.3-132.3-83.9 131.6-84.3L528 116.3l-132.3 84.1L528 284.7l-132.4 83.9-131.2-84.4z"/></svg></span>'},onedrive:{id:"onedrive",label:"OneDrive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0078d4"><svg width="11" height="11" viewBox="0 0 24 24" fill="white"><path d="M10.5 13.5C10.5 11.57 12.07 10 14 10h6.5c.17 0 .34.01.5.02A6 6 0 009.01 11.6 4 4 0 0010.5 13.5zM12 14.5a5 5 0 00-5-5 5 5 0 00-5 5 3 3 0 003 3h9.5A3.5 3.5 0 0018 14c0-.18-.01-.35-.03-.52A5.48 5.48 0 0112 14.5z"/></svg></span>'},box:{id:"box",label:"Box",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0e50a0;font-size:9px;font-weight:800;color:#fff">box</span>'},instagram:{id:"instagram",label:"Instagram",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888)"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M12 2.16c2.94 0 3.29.01 4.45.06 1.07.05 1.8.22 2.43.46.66.25 1.21.6 1.77 1.16.55.55.9 1.1 1.16 1.77.25.64.41 1.37.46 2.43.05 1.16.06 1.51.06 4.45s-.01 3.29-.06 4.45c-.05 1.07-.22 1.8-.46 2.43a4.9 4.9 0 01-1.16 1.77c-.55.55-1.1.9-1.77 1.16-.64.25-1.37.41-2.43.46-1.16.05-1.51.06-4.45.06s-3.29-.01-4.45-.06c-1.07-.05-1.8-.22-2.43-.46a4.9 4.9 0 01-1.77-1.16 4.9 4.9 0 01-1.16-1.77c-.25-.64-.41-1.37-.46-2.43C2.17 15.29 2.16 14.94 2.16 12s.01-3.29.06-4.45c.05-1.07.22-1.8.46-2.43a4.9 4.9 0 011.16-1.77A4.9 4.9 0 015.61 2.2c.64-.25 1.37-.41 2.43-.46C9.21 2.17 9.56 2.16 12 2.16zM12 16a4 4 0 110-8 4 4 0 010 8zm6.4-9.85a1.44 1.44 0 100 2.88 1.44 1.44 0 000-2.88z"/></svg></span>'},facebook:{id:"facebook",label:"Facebook",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#1877f2"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M24 12.07C24 5.41 18.63 0 12 0S0 5.41 0 12.07c0 6.02 4.39 11.02 10.12 11.93v-8.44H7.08v-3.49h3.04V9.41c0-3.02 1.79-4.69 4.53-4.69 1.31 0 2.68.24 2.68.24v2.97h-1.51c-1.49 0-1.95.93-1.95 1.89v2.26h3.33l-.53 3.49h-2.8v8.44C19.61 23.09 24 18.09 24 12.07z"/></svg></span>'},unsplash:{id:"unsplash",label:"Unsplash",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#111"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M8.5 11.5v5h7v-5h5.5V21h-18v-9.5h5.5zm7-8v5h-7v-5h7z"/></svg></span>'}};function De(n){return n.filter(e=>e in _e).map(e=>_e[e])}var Ke=Object.defineProperty,Ze=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&Ke(e,t,r),r};const Je='<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>',Qe='<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>',et='<path d="M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"/><circle cx="12" cy="13" r="4"/>',tt='<rect x="2" y="3" width="20" height="14" rx="2"/><circle cx="12" cy="10" r="1"/><path d="M7 21l5-5 5 5"/>',A=[{id:"device",label:"My Device",icon:Je,iconColor:"#2563eb"},{id:"url",label:"URL link",icon:Qe,iconColor:"#16a34a"},{id:"camera",label:"Camera",icon:et,iconColor:"#7c3aed"},{id:"screen-cast",label:"Screen capture",icon:tt,iconColor:"#ea580c"}],le=class le extends s.LitElement{constructor(){super(...arguments),this.sources=A}_handleClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}render(){return s.html`
1
+ "use strict";const s=require("lit"),c=require("lit/decorators.js"),U=require("lit/directives/unsafe-svg.js"),D=require("lit/directives/unsafe-html.js");class Se{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const t=this.state;this.state={...t,...e},this._notifying=!0;try{this.listeners.forEach(i=>i(this.state,t))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function S(n,e,t){const i=n.getState().files,r=i.get(e);if(!r)return;const o=new Map(i);o.set(e,{...r,...t}),n.setState({files:o})}function T(n,e){const t=new Map(n.getState().files);t.set(e.id,e),n.setState({files:t})}function me(n,e){const t=n.getState().files;if(!t.has(e))return;const i=new Map(t);i.delete(e),n.setState({files:i})}function Ee(){return new Se({files:new Map,queueConfig:{concurrency:3,autoProceed:!1,retryConfig:{maxRetries:0,baseDelay:1e3,maxDelay:3e4,backoffFactor:2}},isPaused:!1,restrictions:{maxFileSize:null,maxTotalFilesSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,blockedFileTypes:null},targetFolder:"/",totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0,isUploading:!1})}class Fe{constructor(e,t){this.host=e,this.store=t,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function je(n,e){const t=new XMLHttpRequest;let i=!1;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`;t.open("POST",o);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);t.upload.addEventListener("progress",l=>{l.lengthComputable&&!i&&e.onProgress(l.loaded,l.total)}),t.addEventListener("load",()=>{if(i)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{i||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{i||e.onError(new Error("Upload timed out"))});const a=new FormData;if(n.file){const l={name:n.name,type:n.type};Object.keys(n.meta).length>0&&(l.meta=n.meta),n.tags.length>0&&(l.tags=n.tags),a.append("info[files[]]",JSON.stringify(l)),a.append("files[]",n.file,n.name)}return t.timeout=6e4,t.send(a),{abort(){i=!0,t.abort()}}}function Me(n,e){const t=new XMLHttpRequest;let i=!1;const o=`${e.apiBase.replace(/\/+$/,"")}/v4/files/upload_url`;t.open("POST",o);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);if(t.setRequestHeader("Content-Type","application/json"),t.addEventListener("load",()=>{if(i)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{i||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{i||e.onError(new Error("Upload timed out"))}),!n.remoteUrl)return e.onError(new Error("Remote URL is required for URL upload")),{abort(){}};const a={files_urls:[{url:n.remoteUrl,name:n.name}],dir:e.folder};return t.timeout=6e4,t.send(JSON.stringify(a)),{abort(){i=!0,t.abort()}}}function Q(n){return{Accept:"application/json","Content-Type":"application/json","uppy-auth-token":n}}function H(n){return n.replace(/\/+$/,"")}const Oe={"google-drive":"drive",dropbox:"dropbox",onedrive:"onedrive",box:"box",instagram:"instagram",facebook:"facebook",unsplash:"unsplash"};function Y(n){return Oe[n]??n}function Le(n,e){const t=H(n),i=btoa(JSON.stringify({origin:window.location.origin})),r=Y(e);return`${t}/${r}/connect?state=${encodeURIComponent(i)}`}async function Te(n,e,t,i=""){const r=H(n),o=i?`/${i}`:"",a=Y(e),l=await fetch(`${r}/${a}/list${o}`,{method:"GET",headers:Q(t),credentials:"same-origin"});if(l.status===401)throw new ee;if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Companion list failed (HTTP ${l.status})`)}return l.json()}async function Be(n,e,t){const i=H(n),r=await fetch(`${i}/${t}`,{method:"GET",headers:Q(e),credentials:"same-origin"});if(r.status===401)throw new ee;if(!r.ok){const o=await r.json().catch(()=>null);throw new Error((o==null?void 0:o.message)||`Companion list failed (HTTP ${r.status})`)}return r.json()}async function Re(n,e,t,i){const r=H(n),o=Y(e),a=i?`q=${encodeURIComponent(t)}&${i}`:`q=${encodeURIComponent(t)}`,l=await fetch(`${r}/search/${o}/list?${a}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"},credentials:"same-origin"});if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Search failed (HTTP ${l.status})`)}return l.json()}async function Ae(n,e,t,i,r,o=!1){const a=H(n),l=Y(e),d=o?`${a}/search/${l}/get/${i}`:`${a}/${l}/get/${i}`,p=o?{Accept:"application/json","Content-Type":"application/json"}:Q(t),h=await fetch(d,{method:"POST",headers:p,credentials:"same-origin",body:JSON.stringify({...r,httpMethod:r.httpMethod??"POST",useFormData:r.useFormData??!0,fieldname:r.fieldname??"files[]"})});if(h.status===401)throw new ee;if(!h.ok){const u=await h.json().catch(()=>null);throw new Error((u==null?void 0:u.message)||`Companion upload failed (HTTP ${h.status})`)}return h.json()}async function Ie(n,e,t){const i=H(n),r=Y(e),o=await fetch(`${i}/${r}/logout`,{method:"GET",headers:Q(t),credentials:"same-origin"});return o.ok?o.json():{ok:!1,revoked:!1}}function He(n){var r;const t=((r=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(n))==null?void 0:r[1])??n;return`${location.protocol==="https:"?"wss":"ws"}://${t}`}class ee extends Error{constructor(){super("Authentication expired"),this.name="AuthExpiredError"}}function qe(n,e){const t=n.remoteInfo;if(!t)return e.onError(new Error("remoteInfo is required for companion upload")),{abort(){}};let i=!1,r=null;const a=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`,l={};n.meta&&Object.keys(n.meta).length>0&&Object.assign(l,n.meta),n.tags&&n.tags.length>0&&(l.tags=n.tags);const d=!t.token;return Ae(t.companionUrl,t.provider,t.token,t.requestPath,{fileId:t.fileId,endpoint:a,headers:e.authHeaders,size:t.size,metadata:Object.keys(l).length>0?l:void 0},d).then(p=>{if(i)return;const u=`${He(t.companionUrl)}/api/${p.token}`;try{r=new WebSocket(u)}catch{e.onError(new Error("Failed to connect to upload progress channel"));return}r.onmessage=x=>{var f,v,w;if(!i)try{const b=JSON.parse(x.data);switch(b.action){case"progress":{const m=b.payload,y=m.bytesUploaded??0,E=m.bytesTotal??(t.size||1);e.onProgress(y,E);break}case"success":{const m=b.payload;if(r==null||r.close(),(f=m.response)!=null&&f.responseText)try{const y=JSON.parse(m.response.responseText);if(y.status==="success"){e.onComplete(y);return}e.onError(new Error(y.msg||"Upload failed"));return}catch{}e.onError(new Error("Upload completed but no valid response received"));break}case"error":{r==null||r.close();const m=b.payload;let y=((v=m.error)==null?void 0:v.message)||"Upload failed";if((w=m.response)!=null&&w.responseText)try{const E=JSON.parse(m.response.responseText);y=E.hint||E.msg||E.message||y}catch{}e.onError(new Error(y));break}}}catch{}},r.onerror=()=>{i||e.onError(new Error("Upload progress connection failed"))},r.onclose=()=>{r=null}}).catch(p=>{i||e.onError(p instanceof Error?p:new Error(String(p)))}),{abort(){if(i=!0,r){try{r.send(JSON.stringify({action:"cancel",payload:{}}))}catch{}r.close(),r=null}}}}class Ue{constructor(e,t){this.activeUploads=new Map,this.retryTimers=new Map,this.unsubscribe=null,this.store=e,this.config=t}start(){this.unsubscribe||(this.unsubscribe=this.store.subscribe(()=>this.processQueue()),this.processQueue())}uploadAll(){const{files:e}=this.store.getState();let t=!1;for(const i of e.values())i.status==="idle"?(S(this.store,i.id,{status:"queued"}),t=!0):i.status==="queued"&&(t=!0);t&&(this.store.setState({isUploading:!0}),this.processQueue())}retryFile(e){const t=this.store.getState().files.get(e);!t||t.status!=="error"&&t.status!=="failed"||(S(this.store,e,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0}),this.processQueue())}retryAll(){const{files:e}=this.store.getState();for(const t of e.values())(t.status==="error"||t.status==="failed")&&S(this.store,t.id,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0});this.processQueue()}cancelFile(e){const t=this.store.getState().files.get(e);!t||!we(t.status)||(this.abortUpload(e),S(this.store,e,{status:"cancelled"}))}cancelAll(){const{files:e}=this.store.getState();for(const t of e.values())we(t.status)&&(this.abortUpload(t.id),S(this.store,t.id,{status:"cancelled"}));this.store.setState({isUploading:!1})}updateConfig(e){Object.assign(this.config,e)}destroy(){var e;for(const t of this.activeUploads.keys())this.abortUpload(t);for(const t of this.retryTimers.values())clearTimeout(t);this.retryTimers.clear(),(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=null}processQueue(){const e=this.store.getState();if(e.isPaused)return;const{concurrency:t}=e.queueConfig,i=this.activeUploads.size,r=t-i;if(r<=0)return;const a=[...e.files.values()].filter(l=>l.status==="queued").sort((l,d)=>l.retryCount!==d.retryCount?d.retryCount-l.retryCount:l.addedAt-d.addedAt).slice(0,r);for(const l of a)this.startUpload(l)}startUpload(e){S(this.store,e.id,{status:"uploading",error:null});let t=0,i=Date.now(),r=0;const o={apiBase:this.config.apiBase,authHeaders:this.config.authHeaders,folder:this.store.getState().targetFolder,onComplete:d=>this.handleComplete(e.id,d),onError:d=>this.handleError(e.id,d)},a=(d,p)=>{const h=Date.now(),u=(h-i)/1e3;if(u>0){const f=(d-t)/u;r=r===0?f:.3*f+.7*r}t=d,i=h;const x=p>0?Math.min(d/p*100,100):0;S(this.store,e.id,{progress:x,bytesUploaded:d,speed:r}),this.updateTotalProgress()};let l;e.remoteInfo?l=qe(e,{...o,onProgress:a}):e.remoteUrl?l=Me(e,o):l=je(e,{...o,onProgress:a}),this.activeUploads.set(e.id,l)}handleComplete(e,t){this.activeUploads.delete(e),S(this.store,e,{status:"complete",progress:100,response:t}),this.updateTotalProgress(),this.checkAllComplete(),this.processQueue()}handleError(e,t){this.activeUploads.delete(e);const i=this.store.getState().files.get(e);if(!i)return;const{retryConfig:r}=this.store.getState().queueConfig,o=i.retryCount+1;if(o<=r.maxRetries){const a=Math.min(r.baseDelay*Math.pow(r.backoffFactor,i.retryCount),r.maxDelay);S(this.store,e,{status:"retrying",error:t.message,retryCount:o});const l=setTimeout(()=>{this.retryTimers.delete(e),S(this.store,e,{status:"queued"}),this.processQueue()},a);this.retryTimers.set(e,l)}else S(this.store,e,{status:"failed",error:t.message}),this.checkAllComplete(),this.processQueue()}abortUpload(e){var i;(i=this.activeUploads.get(e))==null||i.abort(),this.activeUploads.delete(e);const t=this.retryTimers.get(e);t&&(clearTimeout(t),this.retryTimers.delete(e))}updateTotalProgress(){const{files:e}=this.store.getState();let t=0,i=0,r=0;for(const o of e.values())(o.status==="queued"||o.status==="uploading"||o.status==="retrying"||o.status==="complete"||o.status==="failed")&&(t+=o.size,i+=o.status==="complete"?o.size:o.bytesUploaded),o.status==="uploading"&&(r+=o.speed);this.store.setState({totalBytes:t,totalBytesUploaded:i,totalSpeed:r,totalProgress:t>0?Math.min(i/t*100,100):0})}checkAllComplete(){const{files:e}=this.store.getState();![...e.values()].some(i=>i.status==="queued"||i.status==="uploading"||i.status==="retrying")&&this.store.getState().isUploading&&this.store.setState({isUploading:!1})}}function we(n){return n==="queued"||n==="uploading"||n==="retrying"}function te(n){return`https://api.filerobot.com/${n}`}async function Pe(n,e){const t=`${te(n)}/key/${encodeURIComponent(e)}`,i=new AbortController,r=setTimeout(()=>i.abort(),3e4);try{const o=await fetch(t,{signal:i.signal});if(clearTimeout(r),!o.ok)throw new Error(`SASS key exchange failed (HTTP ${o.status})`);const a=await o.json();if(a.status==="error")throw new Error(`SASS key exchange failed: ${a.msg||"Unknown error"}`);return a.key}catch(o){throw clearTimeout(r),o instanceof DOMException&&o.name==="AbortError"?new Error("SASS key exchange timed out"):o}}function K(n,e){const t={};switch(n.mode){case"security-template":if(!e)throw new Error("[sfx-uploader] Cannot build auth headers for security-template mode: SASS key exchange has not been performed. Call resolveAuth() first or use sass-key mode with a pre-resolved key.");t["X-Filerobot-Key"]=e;break;case"sass-key":t["X-Filerobot-Key"]=n.sassKey;break}return n.airboxPuid&&(t["X-Filerobot-Airbox-Puid"]=n.airboxPuid),t}async function ze(n){const e=te(n.container);if(n.mode==="security-template"){const t=await Pe(n.container,n.securityTemplateId);return{apiBase:e,headers:K(n,t),sassKey:t}}return{apiBase:e,headers:K(n)}}const g={FILE_ADDED:"sfx-file-added",FILE_REMOVED:"sfx-file-removed",FILE_REJECTED:"sfx-file-rejected",UPLOAD_STARTED:"sfx-upload-started",UPLOAD_PROGRESS:"sfx-upload-progress",UPLOAD_COMPLETE:"sfx-upload-complete",UPLOAD_ERROR:"sfx-upload-error",UPLOAD_RETRY:"sfx-upload-retry",ALL_COMPLETE:"sfx-all-complete",TOTAL_PROGRESS:"sfx-total-progress",BEFORE_UPLOAD:"sfx-before-upload",OPEN:"sfx-open",CLOSE:"sfx-close",CANCEL:"sfx-cancel",COMPLETE_ACTION:"sfx-complete-action",FILE_PREVIEW:"sfx-file-preview",FILL_METADATA:"sfx-fill-metadata"};let Ye=0;function B(){return`file-${Date.now()}-${++Ye}`}function R(n){if(n<=0)return"0 B";const e=["B","KB","MB","GB"],t=Math.min(Math.floor(Math.log(n)/Math.log(1024)),e.length-1),i=n/Math.pow(1024,t);return`${t===0?i:i.toFixed(1)} ${e[t]}`}function ie(n){if(!isFinite(n)||n<=0)return"0s";const e=Math.round(n);if(e<60)return`${e}s`;const t=Math.floor(e/60),i=e%60;return i>0?`${t}m ${i}s`:`${t}m`}function q(n){var t;const e=((t=n.name.split(".").pop())==null?void 0:t.toLowerCase())??"";return n.type.startsWith("image/")?"image":n.type.startsWith("video/")||["mp4","mov","avi","webm","mkv"].includes(e)?"vid":n.type==="application/pdf"||e==="pdf"?"pdf":["doc","docx","xls","xlsx","ppt","pptx","txt","rtf","odt"].includes(e)?"doc":["zip","rar","7z","tar","gz","bz2"].includes(e)?"zip":"gen"}function Ve(n){const e=n.lastIndexOf(".");return e>=0?n.slice(e+1).toUpperCase():""}const Ne={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",mp4:"video/mp4",mov:"video/quicktime",avi:"video/x-msvideo",webm:"video/webm",pdf:"application/pdf",zip:"application/zip",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function Xe(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())??"";return Ne[e]||""}function We(n){return new Promise(e=>{const t=document.createElement("video");t.preload="metadata",t.muted=!0,t.playsInline=!0;const i=URL.createObjectURL(n);let r=!1;const o=()=>{r||(r=!0,e(null)),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(i)};t.addEventListener("seeked",()=>{try{const a=document.createElement("canvas");a.width=t.videoWidth||320,a.height=t.videoHeight||240;const l=a.getContext("2d");if(l){l.drawImage(t,0,0,a.width,a.height),a.toBlob(d=>{r||(r=!0,e(d?URL.createObjectURL(d):null),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(i))},"image/jpeg",.7);return}}catch{}o()},{once:!0}),t.addEventListener("error",()=>o(),{once:!0}),setTimeout(()=>o(),5e3),t.src=i,t.addEventListener("loadeddata",()=>{t.currentTime=.1},{once:!0})})}function oe(n,e,t){var i,r;if(e.maxFileSize!=null&&n.size>0&&n.size>e.maxFileSize)return`File exceeds ${(e.maxFileSize/1048576).toFixed(1)} MB limit`;if(e.maxTotalFilesSize!=null&&n.size>0){let o=n.size;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&(o+=a.size);if(o>e.maxTotalFilesSize)return"Total file size limit exceeded"}if(e.maxNumberOfFiles!=null){let o=0;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&o++;if(o>=e.maxNumberOfFiles)return`Maximum ${e.maxNumberOfFiles} files allowed`}if(e.allowedFileTypes!=null){const o=e.allowedFileTypes,a="."+(((i=n.name.split(".").pop())==null?void 0:i.toLowerCase())??"");if(!o.some(d=>d.startsWith(".")?a===d.toLowerCase():d.endsWith("/*")?n.type.startsWith(d.slice(0,-1)):n.type===d))return"File type not allowed"}if(e.blockedFileTypes!=null){const o=e.blockedFileTypes,a="."+(((r=n.name.split(".").pop())==null?void 0:r.toLowerCase())??"");if(o.some(d=>d.startsWith(".")?a===d.toLowerCase():d.endsWith("/*")?n.type.startsWith(d.slice(0,-1)):n.type===d))return"File type is blocked"}return null}function Ge(n,e,t){return oe(n,e,t)}function ye(n){return n.allowedFileTypes?n.allowedFileTypes.join(","):""}const _e={"google-drive":{id:"google-drive",label:"Google Drive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:transparent"><svg width="16" height="16" viewBox="0 0 87.3 78"><path d="M6.6 66.85l3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3L27.5 53H0c0 1.55.4 3.1 1.2 4.5z" fill="#0066da"/><path d="M43.65 25L29.9 1.2C28.55 2 27.4 3.1 26.6 4.5L1.2 48.5C.4 49.9 0 51.45 0 53h27.5z" fill="#00ac47"/><path d="M73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5H59.8l5.65 10.85z" fill="#ea4335"/><path d="M43.65 25L57.4 1.2C56.05.4 54.5 0 52.9 0H34.4c-1.6 0-3.15.45-4.5 1.2z" fill="#00832d"/><path d="M59.8 53H27.5L13.75 76.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z" fill="#2684fc"/><path d="M73.4 26.5l-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3L43.65 25 59.8 53h27.45c0-1.55-.4-3.1-1.2-4.5z" fill="#ffba00"/></svg></span>'},dropbox:{id:"dropbox",label:"Dropbox",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0061ff"><svg width="11" height="11" viewBox="0 0 528 512" fill="white"><path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zm-132 284.5l132-84.3 132 84.3-132 84.4-132-84.4zm132-116.6l132.3-84.3-132.3-83.9 131.6-84.3L528 116.3l-132.3 84.1L528 284.7l-132.4 83.9-131.2-84.4z"/></svg></span>'},onedrive:{id:"onedrive",label:"OneDrive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0078d4"><svg width="11" height="11" viewBox="0 0 24 24" fill="white"><path d="M10.5 13.5C10.5 11.57 12.07 10 14 10h6.5c.17 0 .34.01.5.02A6 6 0 009.01 11.6 4 4 0 0010.5 13.5zM12 14.5a5 5 0 00-5-5 5 5 0 00-5 5 3 3 0 003 3h9.5A3.5 3.5 0 0018 14c0-.18-.01-.35-.03-.52A5.48 5.48 0 0112 14.5z"/></svg></span>'},box:{id:"box",label:"Box",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0e50a0;font-size:9px;font-weight:800;color:#fff">box</span>'},instagram:{id:"instagram",label:"Instagram",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888)"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M12 2.16c2.94 0 3.29.01 4.45.06 1.07.05 1.8.22 2.43.46.66.25 1.21.6 1.77 1.16.55.55.9 1.1 1.16 1.77.25.64.41 1.37.46 2.43.05 1.16.06 1.51.06 4.45s-.01 3.29-.06 4.45c-.05 1.07-.22 1.8-.46 2.43a4.9 4.9 0 01-1.16 1.77c-.55.55-1.1.9-1.77 1.16-.64.25-1.37.41-2.43.46-1.16.05-1.51.06-4.45.06s-3.29-.01-4.45-.06c-1.07-.05-1.8-.22-2.43-.46a4.9 4.9 0 01-1.77-1.16 4.9 4.9 0 01-1.16-1.77c-.25-.64-.41-1.37-.46-2.43C2.17 15.29 2.16 14.94 2.16 12s.01-3.29.06-4.45c.05-1.07.22-1.8.46-2.43a4.9 4.9 0 011.16-1.77A4.9 4.9 0 015.61 2.2c.64-.25 1.37-.41 2.43-.46C9.21 2.17 9.56 2.16 12 2.16zM12 16a4 4 0 110-8 4 4 0 010 8zm6.4-9.85a1.44 1.44 0 100 2.88 1.44 1.44 0 000-2.88z"/></svg></span>'},facebook:{id:"facebook",label:"Facebook",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#1877f2"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M24 12.07C24 5.41 18.63 0 12 0S0 5.41 0 12.07c0 6.02 4.39 11.02 10.12 11.93v-8.44H7.08v-3.49h3.04V9.41c0-3.02 1.79-4.69 4.53-4.69 1.31 0 2.68.24 2.68.24v2.97h-1.51c-1.49 0-1.95.93-1.95 1.89v2.26h3.33l-.53 3.49h-2.8v8.44C19.61 23.09 24 18.09 24 12.07z"/></svg></span>'},unsplash:{id:"unsplash",label:"Unsplash",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#111"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M8.5 11.5v5h7v-5h5.5V21h-18v-9.5h5.5zm7-8v5h-7v-5h7z"/></svg></span>'}};function De(n){return n.filter(e=>e in _e).map(e=>_e[e])}var Ke=Object.defineProperty,Ze=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&Ke(e,t,r),r};const Je='<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>',Qe='<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>',et='<path d="M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"/><circle cx="12" cy="13" r="4"/>',tt='<rect x="2" y="3" width="20" height="14" rx="2"/><circle cx="12" cy="10" r="1"/><path d="M7 21l5-5 5 5"/>',A=[{id:"device",label:"My Device",icon:Je,iconColor:"#2563eb"},{id:"url",label:"URL link",icon:Qe,iconColor:"#16a34a"},{id:"camera",label:"Camera",icon:et,iconColor:"#7c3aed"},{id:"screen-cast",label:"Screen capture",icon:tt,iconColor:"#ea580c"}],le=class le extends s.LitElement{constructor(){super(...arguments),this.sources=A}_handleClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}render(){return s.html`
2
2
  ${this.sources.map(e=>s.html`
3
3
  <button @click=${()=>this._handleClick(e)}>
4
4
  ${e.brandHtml?D.unsafeHTML(e.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${U.unsafeSVG(e.icon)}</svg>`}
@@ -77,7 +77,7 @@
77
77
  stroke: none;
78
78
  stroke-width: 0;
79
79
  }
80
- `;let Z=le;Ze([p.property({type:Array})],Z.prototype,"sources");var rt=Object.defineProperty,P=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&rt(e,t,r),r};const ke=3,de=class de extends s.LitElement{constructor(){super(...arguments),this.compact=!1,this.externalDragOver=!1,this.accept="",this.sources=[],this.sourcesLayout="pills",this._dragOver=!1,this._moreOpen=!1,this._visiblePills=ke,this._dragCounter=0,this._onDragEnter=e=>{e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._dragOver=!0)},this._onDragOver=e=>{e.preventDefault()},this._onDragLeave=e=>{e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._dragOver=!1)},this._onDrop=e=>{var i;e.preventDefault(),e.stopPropagation(),this._dragCounter=0,this._dragOver=!1;const t=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);t.length>0&&this._emitFiles(t)},this._onClick=e=>{const t=this.shadowRoot.querySelector(".drop-zone");if(t&&this._rippleEl){const i=t.getBoundingClientRect();this._rippleEl.style.left=`${e.clientX-i.left}px`,this._rippleEl.style.top=`${e.clientY-i.top}px`,this._rippleEl.classList.remove("go"),this._rippleEl.offsetWidth,this._rippleEl.classList.add("go")}this.browse()},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.browse())},this._onFileChange=e=>{const t=e.target,i=Array.from(t.files??[]);i.length>0&&this._emitFiles(i),t.value=""},this._onPaste=e=>{var r;if(!this.isConnected||this.offsetWidth===0)return;const t=(r=e.clipboardData)==null?void 0:r.items;if(!t)return;const i=[];for(const o of t)if(o.kind==="file"){const a=o.getAsFile();a&&i.push(a)}i.length>0&&(e.preventDefault(),this._emitFiles(i))},this._onDocClick=()=>{this._moreOpen&&(this._moreOpen=!1)},this._onDocKeyDown=e=>{e.key==="Escape"&&this._moreOpen&&(this._moreOpen=!1)},this._resizeTimer=null,this._onScrollOrResize=()=>{this._moreOpen&&this._positionDropdown(),this._resizeTimer&&clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(()=>this._updateVisiblePills(),100)}}browse(){var e;(e=this.fileInput)==null||e.click()}_onSourceIconClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}_emitFiles(e){this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:e},bubbles:!0,composed:!0}))}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen&&requestAnimationFrame(()=>this._positionDropdown())}_positionDropdown(){var x,u;const e=(x=this.shadowRoot)==null?void 0:x.querySelector(".more-wrap > button"),t=(u=this.shadowRoot)==null?void 0:u.querySelector(".more-dropdown");if(!e||!t)return;const i=e.getBoundingClientRect(),r=8,o=t.scrollHeight,a=t.offsetWidth,l=i.top,d=window.innerHeight-i.bottom;l>=o+r||l>d?(t.classList.add("above"),t.classList.remove("below"),t.style.top=`${i.top-o-r}px`):(t.classList.add("below"),t.classList.remove("above"),t.style.top=`${i.bottom+r}px`);let h=i.right-a;h=Math.max(8,Math.min(h,window.innerWidth-a-8)),t.style.left=`${h}px`}_onMoreItemClick(e,t){t.stopPropagation(),this._moreOpen=!1,this._onSourceIconClick(e)}_updateVisiblePills(){const e=window.innerWidth;this.sourcesLayout==="cards"?e<=480?this._visiblePills=2:e<=768?this._visiblePills=3:this._visiblePills=5:e<=480?this._visiblePills=1:e<=768?this._visiblePills=2:this._visiblePills=ke}connectedCallback(){super.connectedCallback(),document.addEventListener("paste",this._onPaste),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onDocKeyDown),window.addEventListener("scroll",this._onScrollOrResize,!0),window.addEventListener("resize",this._onScrollOrResize),this._updateVisiblePills()}updated(e){e.has("sourcesLayout")&&this._updateVisiblePills()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("paste",this._onPaste),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onDocKeyDown),window.removeEventListener("scroll",this._onScrollOrResize,!0),window.removeEventListener("resize",this._onScrollOrResize),this._resizeTimer&&clearTimeout(this._resizeTimer)}_renderPill(e){return s.html`
80
+ `;let Z=le;Ze([c.property({type:Array})],Z.prototype,"sources");var rt=Object.defineProperty,z=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&rt(e,t,r),r};const ke=3,de=class de extends s.LitElement{constructor(){super(...arguments),this.compact=!1,this.externalDragOver=!1,this.accept="",this.sources=[],this.sourcesLayout="pills",this._dragOver=!1,this._moreOpen=!1,this._visiblePills=ke,this._dragCounter=0,this._onDragEnter=e=>{e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._dragOver=!0)},this._onDragOver=e=>{e.preventDefault()},this._onDragLeave=e=>{e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._dragOver=!1)},this._onDrop=e=>{var i;e.preventDefault(),e.stopPropagation(),this._dragCounter=0,this._dragOver=!1;const t=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);t.length>0&&this._emitFiles(t)},this._onClick=e=>{const t=this.shadowRoot.querySelector(".drop-zone");if(t&&this._rippleEl){const i=t.getBoundingClientRect();this._rippleEl.style.left=`${e.clientX-i.left}px`,this._rippleEl.style.top=`${e.clientY-i.top}px`,this._rippleEl.classList.remove("go"),this._rippleEl.offsetWidth,this._rippleEl.classList.add("go")}this.browse()},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.browse())},this._onFileChange=e=>{const t=e.target,i=Array.from(t.files??[]);i.length>0&&this._emitFiles(i),t.value=""},this._onPaste=e=>{var r;if(!this.isConnected||this.offsetWidth===0)return;const t=(r=e.clipboardData)==null?void 0:r.items;if(!t)return;const i=[];for(const o of t)if(o.kind==="file"){const a=o.getAsFile();a&&i.push(a)}i.length>0&&(e.preventDefault(),this._emitFiles(i))},this._onDocClick=()=>{this._moreOpen&&(this._moreOpen=!1)},this._onDocKeyDown=e=>{e.key==="Escape"&&this._moreOpen&&(this._moreOpen=!1)},this._resizeTimer=null,this._onScrollOrResize=()=>{this._moreOpen&&this._positionDropdown(),this._resizeTimer&&clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(()=>this._updateVisiblePills(),100)}}browse(){var e;(e=this.fileInput)==null||e.click()}_onSourceIconClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}_emitFiles(e){this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:e},bubbles:!0,composed:!0}))}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen&&requestAnimationFrame(()=>this._positionDropdown())}_positionDropdown(){var u,x;const e=(u=this.shadowRoot)==null?void 0:u.querySelector(".more-wrap > button"),t=(x=this.shadowRoot)==null?void 0:x.querySelector(".more-dropdown");if(!e||!t)return;const i=e.getBoundingClientRect(),r=8,o=t.scrollHeight,a=t.offsetWidth,l=i.top,d=window.innerHeight-i.bottom;l>=o+r||l>d?(t.classList.add("above"),t.classList.remove("below"),t.style.top=`${i.top-o-r}px`):(t.classList.add("below"),t.classList.remove("above"),t.style.top=`${i.bottom+r}px`);let h=i.right-a;h=Math.max(8,Math.min(h,window.innerWidth-a-8)),t.style.left=`${h}px`}_onMoreItemClick(e,t){t.stopPropagation(),this._moreOpen=!1,this._onSourceIconClick(e)}_updateVisiblePills(){const e=window.innerWidth;this.sourcesLayout==="cards"?e<=480?this._visiblePills=2:e<=768?this._visiblePills=3:this._visiblePills=5:e<=480?this._visiblePills=1:e<=768?this._visiblePills=2:this._visiblePills=ke}connectedCallback(){super.connectedCallback(),document.addEventListener("paste",this._onPaste),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onDocKeyDown),window.addEventListener("scroll",this._onScrollOrResize,!0),window.addEventListener("resize",this._onScrollOrResize),this._updateVisiblePills()}updated(e){e.has("sourcesLayout")&&this._updateVisiblePills()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("paste",this._onPaste),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onDocKeyDown),window.removeEventListener("scroll",this._onScrollOrResize,!0),window.removeEventListener("resize",this._onScrollOrResize),this._resizeTimer&&clearTimeout(this._resizeTimer)}_renderPill(e){return s.html`
81
81
  <button
82
82
  class="src-pill"
83
83
  @click=${t=>{t.stopPropagation(),this._onSourceIconClick(e)}}
@@ -990,11 +990,11 @@
990
990
  animation: none;
991
991
  }
992
992
  }
993
- `;let C=de;P([p.property({type:Boolean,reflect:!0})],C.prototype,"compact");P([p.property({type:Boolean,attribute:"external-drag-over"})],C.prototype,"externalDragOver");P([p.property({type:String})],C.prototype,"accept");P([p.property({type:Array})],C.prototype,"sources");P([p.property({type:String,attribute:"sources-layout"})],C.prototype,"sourcesLayout");P([p.state()],C.prototype,"_dragOver");P([p.state()],C.prototype,"_moreOpen");P([p.state()],C.prototype,"_visiblePills");P([p.query(".ripple")],C.prototype,"_rippleEl");P([p.query('input[type="file"]')],C.prototype,"fileInput");const ce=class ce extends s.LitElement{render(){return s.html`
993
+ `;let C=de;z([c.property({type:Boolean,reflect:!0})],C.prototype,"compact");z([c.property({type:Boolean,attribute:"external-drag-over"})],C.prototype,"externalDragOver");z([c.property({type:String})],C.prototype,"accept");z([c.property({type:Array})],C.prototype,"sources");z([c.property({type:String,attribute:"sources-layout"})],C.prototype,"sourcesLayout");z([c.state()],C.prototype,"_dragOver");z([c.state()],C.prototype,"_moreOpen");z([c.state()],C.prototype,"_visiblePills");z([c.query(".ripple")],C.prototype,"_rippleEl");z([c.query('input[type="file"]')],C.prototype,"fileInput");const pe=class pe extends s.LitElement{render(){return s.html`
994
994
  <div class="line"></div>
995
995
  <div class="label">or import from</div>
996
996
  <div class="line"></div>
997
- `}};ce.styles=s.css`
997
+ `}};pe.styles=s.css`
998
998
  :host {
999
999
  display: flex;
1000
1000
  align-items: center;
@@ -1016,7 +1016,7 @@
1016
1016
  letter-spacing: 1px;
1017
1017
  white-space: nowrap;
1018
1018
  }
1019
- `;let se=ce;var it=Object.defineProperty,V=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&it(e,t,r),r};const pe=class pe extends s.LitElement{constructor(){super(...arguments),this.files=[],this.showDropTile=!1,this.sources=[],this.accept="",this._moreOpen=!1,this._outsideClickHandler=e=>{const t=e.composedPath(),i=this.renderRoot.querySelector(".drop-tile-more-wrap");i&&!t.includes(i)&&(this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0))}}_onDropTileClick(){const e=this.renderRoot.querySelector('input[type="file"]');e==null||e.click()}_onFileInput(e){const t=e.target,i=Array.from(t.files??[]);i.length>0&&this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:i},bubbles:!0,composed:!0})),t.value=""}_onSourceClick(e,t){if(e.stopPropagation(),t.id==="device"){const i=this.renderRoot.querySelector('input[type="file"]');i==null||i.click();return}this.dispatchEvent(new CustomEvent("source-click",{detail:{source:t},bubbles:!0,composed:!0}))}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen?requestAnimationFrame(()=>document.addEventListener("click",this._outsideClickHandler,!0)):document.removeEventListener("click",this._outsideClickHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0)}_onMoreSourceClick(e,t){this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0),this._onSourceClick(e,t)}_renderDropTile(){const t=this.sources.slice(0,3),i=this.sources.slice(3);return s.html`
1019
+ `;let se=pe;var it=Object.defineProperty,V=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&it(e,t,r),r};const ce=class ce extends s.LitElement{constructor(){super(...arguments),this.files=[],this.showDropTile=!1,this.sources=[],this.accept="",this._moreOpen=!1,this._outsideClickHandler=e=>{const t=e.composedPath(),i=this.renderRoot.querySelector(".drop-tile-more-wrap");i&&!t.includes(i)&&(this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0))}}_onDropTileClick(){const e=this.renderRoot.querySelector('input[type="file"]');e==null||e.click()}_onFileInput(e){const t=e.target,i=Array.from(t.files??[]);i.length>0&&this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:i},bubbles:!0,composed:!0})),t.value=""}_onSourceClick(e,t){if(e.stopPropagation(),t.id==="device"){const i=this.renderRoot.querySelector('input[type="file"]');i==null||i.click();return}this.dispatchEvent(new CustomEvent("source-click",{detail:{source:t},bubbles:!0,composed:!0}))}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen?requestAnimationFrame(()=>document.addEventListener("click",this._outsideClickHandler,!0)):document.removeEventListener("click",this._outsideClickHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0)}_onMoreSourceClick(e,t){this._moreOpen=!1,document.removeEventListener("click",this._outsideClickHandler,!0),this._onSourceClick(e,t)}_renderDropTile(){const t=this.sources.slice(0,3),i=this.sources.slice(3);return s.html`
1020
1020
  <div class="drop-tile" @click=${this._onDropTileClick}>
1021
1021
  <div class="drop-tile-rings">
1022
1022
  <div class="drop-tile-ring"></div>
@@ -1071,7 +1071,7 @@
1071
1071
  ${this.showDropTile?this._renderDropTile():s.nothing}
1072
1072
  ${this.files.map((e,t)=>s.html`<sfx-file-item .file=${e} style="--tile-index:${t}"></sfx-file-item>`)}
1073
1073
  </div>
1074
- `}};pe.styles=s.css`
1074
+ `}};ce.styles=s.css`
1075
1075
  :host {
1076
1076
  display: block;
1077
1077
  flex: 1;
@@ -1104,7 +1104,7 @@
1104
1104
  display: grid;
1105
1105
  grid-template-columns: repeat(auto-fill, minmax(var(--sfx-up-grid-min, max(24%, 140px)), 1fr));
1106
1106
  gap: 12px;
1107
- padding: 2px 12px 16px 16px;
1107
+ padding: 0 12px 16px 16px;
1108
1108
  }
1109
1109
 
1110
1110
  @media (max-width: 480px) {
@@ -1372,7 +1372,7 @@
1372
1372
  input[type="file"] {
1373
1373
  display: none;
1374
1374
  }
1375
- `;let F=pe;V([p.property({attribute:!1})],F.prototype,"files");V([p.property({type:Boolean})],F.prototype,"showDropTile");V([p.property({attribute:!1})],F.prototype,"sources");V([p.property({type:String})],F.prototype,"accept");V([p.state()],F.prototype,"_moreOpen");var ot=Object.defineProperty,st=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ot(e,t,r),r};const fe=class fe extends s.LitElement{_remove(){this.dispatchEvent(new CustomEvent("file-remove",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}_retry(){this.dispatchEvent(new CustomEvent("file-retry",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}_preview(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("file-preview",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}render(){const e=this.file;if(!e)return s.nothing;const t=q(e),i=e.status==="complete",r=e.status==="uploading",o=e.status==="error"||e.status==="failed",a=e.status==="rejected",l=Ve(e.name),d=["tile",i?"done":"",r?"uploading":"",a?"rejected":""].filter(Boolean).join(" ");return s.html`
1375
+ `;let F=ce;V([c.property({attribute:!1})],F.prototype,"files");V([c.property({type:Boolean})],F.prototype,"showDropTile");V([c.property({attribute:!1})],F.prototype,"sources");V([c.property({type:String})],F.prototype,"accept");V([c.state()],F.prototype,"_moreOpen");var ot=Object.defineProperty,st=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ot(e,t,r),r};const fe=class fe extends s.LitElement{_remove(){this.dispatchEvent(new CustomEvent("file-remove",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}_retry(){this.dispatchEvent(new CustomEvent("file-retry",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}_preview(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("file-preview",{detail:{fileId:this.file.id},bubbles:!0,composed:!0}))}render(){const e=this.file;if(!e)return s.nothing;const t=q(e),i=e.status==="complete",r=e.status==="uploading",o=e.status==="error"||e.status==="failed",a=e.status==="rejected",l=Ve(e.name),d=["tile",i?"done":"",r?"uploading":"",a?"rejected":""].filter(Boolean).join(" ");return s.html`
1376
1376
  <div class=${d} tabindex="0">
1377
1377
  <!-- Preview area -->
1378
1378
  <div class="preview">
@@ -1823,7 +1823,7 @@
1823
1823
  .tile { animation: none; }
1824
1824
  .spin-ring { animation: none; }
1825
1825
  }
1826
- `;let J=fe;st([p.property({attribute:!1})],J.prototype,"file");const N=s.css`
1826
+ `;let J=fe;st([c.property({attribute:!1})],J.prototype,"file");const N=s.css`
1827
1827
  .btn,
1828
1828
  .btn-ghost,
1829
1829
  .btn-primary,
@@ -1897,7 +1897,10 @@
1897
1897
  outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
1898
1898
  outline-offset: 2px;
1899
1899
  }
1900
- `;var at=Object.defineProperty,W=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&at(e,t,r),r};const Ce=7,he=class he extends s.LitElement{constructor(){super(...arguments),this.fileCount=0,this.totalSize=0,this.thumbnails=[],this.primaryLabel="Done",this.failedFiles=[]}_uploadMore(){this.dispatchEvent(new CustomEvent("upload-more",{bubbles:!0,composed:!0}))}_primaryAction(){this.dispatchEvent(new CustomEvent("primary-action",{bubbles:!0,composed:!0}))}render(){const e=this.thumbnails.slice(0,Ce),t=this.thumbnails.length-Ce,i=this.fileCount>0,r=this.failedFiles.length>0,o=r&&!i;return s.html`
1900
+ `;var at=Object.defineProperty,W=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&at(e,t,r),r};const Ce=7,he=class he extends s.LitElement{constructor(){super(...arguments),this.fileCount=0,this.totalSize=0,this.thumbnails=[],this.primaryLabel="Done",this.failedFiles=[]}_uploadMore(){this.dispatchEvent(new CustomEvent("upload-more",{bubbles:!0,composed:!0}))}_primaryAction(){this.dispatchEvent(new CustomEvent("primary-action",{bubbles:!0,composed:!0}))}_retryFile(e){this.dispatchEvent(new CustomEvent("file-retry",{bubbles:!0,composed:!0,detail:{fileId:e}}))}_retryAll(){this.dispatchEvent(new CustomEvent("retry-all",{bubbles:!0,composed:!0}))}_close(){this.dispatchEvent(new CustomEvent("close-uploader",{bubbles:!0,composed:!0}))}render(){const e=this.thumbnails.slice(0,Ce),t=this.thumbnails.length-Ce,i=this.fileCount>0,r=this.failedFiles.length>0,o=r&&!i;return s.html`
1901
+ <button class="close-btn" title="Close" @click=${this._close}>
1902
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
1903
+ </button>
1901
1904
  <div class="card" role="status" aria-live="polite">
1902
1905
  <div class="icon ${o?"error":r?"warning":""}">
1903
1906
  ${o?s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -1929,6 +1932,9 @@
1929
1932
  <div class="failed-name">${a.name}</div>
1930
1933
  <div class="failed-reason">${a.error}</div>
1931
1934
  </div>
1935
+ <button class="failed-retry" title="Retry" @click=${()=>this._retryFile(a.id)}>
1936
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2v6h-6"/><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M3 22v-6h6"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/></svg>
1937
+ </button>
1932
1938
  </div>
1933
1939
  `)}
1934
1940
  </div>
@@ -1936,6 +1942,7 @@
1936
1942
 
1937
1943
  <div class="actions">
1938
1944
  <button class="btn-ghost" @click=${this._uploadMore}>Upload more</button>
1945
+ ${r?s.html`<button class="btn-retry-all" @click=${this._retryAll}>Retry all (${this.failedFiles.length})</button>`:s.nothing}
1939
1946
  <button class="btn-primary" @click=${this._primaryAction}>${this.primaryLabel}</button>
1940
1947
  </div>
1941
1948
  </div>
@@ -1945,7 +1952,9 @@
1945
1952
  flex: 1;
1946
1953
  justify-content: center;
1947
1954
  align-items: center;
1948
- padding-bottom: 24px;
1955
+ padding: 24px 0;
1956
+ position: relative;
1957
+ overflow-y: auto;
1949
1958
  }
1950
1959
 
1951
1960
  .card {
@@ -2060,20 +2069,43 @@
2060
2069
  /* --- Failed files list --- */
2061
2070
  .failed-list {
2062
2071
  width: 100%;
2063
- max-width: 360px;
2072
+ max-width: 400px;
2073
+ max-height: 200px;
2064
2074
  margin-bottom: 20px;
2065
2075
  border-radius: 8px;
2066
2076
  border: 1px solid var(--sfx-up-border, #e8eaed);
2067
- overflow: hidden;
2077
+ overflow-y: auto;
2078
+ overflow-x: hidden;
2079
+ scrollbar-width: thin;
2080
+ scrollbar-color: rgba(0,0,0,0.15) transparent;
2081
+ }
2082
+
2083
+ .failed-list::-webkit-scrollbar {
2084
+ width: 6px;
2085
+ }
2086
+
2087
+ .failed-list::-webkit-scrollbar-track {
2088
+ background: transparent;
2089
+ margin: 6px 0;
2090
+ }
2091
+
2092
+ .failed-list::-webkit-scrollbar-thumb {
2093
+ background: rgba(0,0,0,0.15);
2094
+ border-radius: 3px;
2095
+ }
2096
+
2097
+ .failed-list::-webkit-scrollbar-thumb:hover {
2098
+ background: rgba(0,0,0,0.25);
2068
2099
  }
2069
2100
 
2070
2101
  .failed-item {
2071
2102
  display: flex;
2072
- align-items: flex-start;
2103
+ align-items: center;
2073
2104
  gap: 8px;
2074
2105
  padding: 8px 12px;
2075
- border-bottom: 1px solid var(--sfx-up-border, #f1f5f9);
2076
2106
  text-align: left;
2107
+ border-bottom: 1px solid var(--sfx-up-border, #f1f5f9);
2108
+ margin-right: 8px;
2077
2109
  }
2078
2110
 
2079
2111
  .failed-item:last-child {
@@ -2108,6 +2140,62 @@
2108
2140
  line-height: 1.4;
2109
2141
  }
2110
2142
 
2143
+ .failed-retry {
2144
+ width: 24px;
2145
+ height: 24px;
2146
+ border: none;
2147
+ background: none;
2148
+ color: var(--sfx-up-primary, #2563eb);
2149
+ cursor: pointer;
2150
+ padding: 4px;
2151
+ flex-shrink: 0;
2152
+ display: flex;
2153
+ align-items: center;
2154
+ justify-content: center;
2155
+ border-radius: 4px;
2156
+ margin-top: -2px;
2157
+ }
2158
+
2159
+ .failed-retry svg { width: 14px; height: 14px; }
2160
+
2161
+ .failed-retry:hover { background: var(--sfx-up-surface, #f8fafc); color: var(--sfx-up-primary-hover, #1d4ed8); }
2162
+
2163
+ .close-btn {
2164
+ position: absolute;
2165
+ top: 12px;
2166
+ right: 12px;
2167
+ width: 28px;
2168
+ height: 28px;
2169
+ border: none;
2170
+ background: none;
2171
+ color: var(--sfx-up-text-muted, #94a3b8);
2172
+ cursor: pointer;
2173
+ display: flex;
2174
+ align-items: center;
2175
+ justify-content: center;
2176
+ border-radius: 6px;
2177
+ padding: 0;
2178
+ }
2179
+
2180
+ .close-btn svg { width: 16px; height: 16px; }
2181
+
2182
+ .close-btn:hover { background: var(--sfx-up-surface, #f8fafc); color: var(--sfx-up-text, #1e293b); }
2183
+
2184
+ .btn-retry-all {
2185
+ padding: 8px 18px;
2186
+ border-radius: 8px;
2187
+ font-size: 13px;
2188
+ font-weight: 500;
2189
+ border: 1px solid var(--sfx-up-primary, #2563eb);
2190
+ background: #fff;
2191
+ color: var(--sfx-up-primary, #2563eb);
2192
+ cursor: pointer;
2193
+ }
2194
+
2195
+ .btn-retry-all:hover {
2196
+ background: var(--sfx-up-primary-bg, #eff6ff);
2197
+ }
2198
+
2111
2199
  @keyframes fadeUp {
2112
2200
  from {
2113
2201
  opacity: 0;
@@ -2137,7 +2225,7 @@
2137
2225
  .card { animation: none; }
2138
2226
  .icon { animation: none; }
2139
2227
  }
2140
- `];let O=he;W([p.property({type:Number})],O.prototype,"fileCount");W([p.property({type:Number})],O.prototype,"totalSize");W([p.property({type:Array})],O.prototype,"thumbnails");W([p.property({type:String})],O.prototype,"primaryLabel");W([p.property({type:Array})],O.prototype,"failedFiles");var nt=Object.defineProperty,L=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&nt(e,t,r),r};const ue=class ue extends s.LitElement{constructor(){super(...arguments),this.uploadState="idle",this.fileCount=0,this.totalSize=0,this.failedCount=0,this.showFillMetadata=!1,this.completedCount=0,this.uploadProgress=0}_clear(){this.dispatchEvent(new CustomEvent("clear-all",{bubbles:!0,composed:!0}))}_addMore(){this.dispatchEvent(new CustomEvent("add-more",{bubbles:!0,composed:!0}))}_fillMetadata(){this.dispatchEvent(new CustomEvent("fill-metadata",{bubbles:!0,composed:!0}))}_upload(){this.dispatchEvent(new CustomEvent("upload-start",{bubbles:!0,composed:!0}))}_retryAll(){this.dispatchEvent(new CustomEvent("retry-all",{bubbles:!0,composed:!0}))}render(){const e=this.uploadState==="uploading";return s.html`
2228
+ `];let j=he;W([c.property({type:Number})],j.prototype,"fileCount");W([c.property({type:Number})],j.prototype,"totalSize");W([c.property({type:Array})],j.prototype,"thumbnails");W([c.property({type:String})],j.prototype,"primaryLabel");W([c.property({type:Array})],j.prototype,"failedFiles");var nt=Object.defineProperty,L=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&nt(e,t,r),r};const ue=class ue extends s.LitElement{constructor(){super(...arguments),this.uploadState="idle",this.fileCount=0,this.totalSize=0,this.failedCount=0,this.showFillMetadata=!1,this.completedCount=0,this.uploadProgress=0}_clear(){this.dispatchEvent(new CustomEvent("clear-all",{bubbles:!0,composed:!0}))}_addMore(){this.dispatchEvent(new CustomEvent("add-more",{bubbles:!0,composed:!0}))}_fillMetadata(){this.dispatchEvent(new CustomEvent("fill-metadata",{bubbles:!0,composed:!0}))}_upload(){this.dispatchEvent(new CustomEvent("upload-start",{bubbles:!0,composed:!0}))}_retryAll(){this.dispatchEvent(new CustomEvent("retry-all",{bubbles:!0,composed:!0}))}render(){const e=this.uploadState==="uploading";return s.html`
2141
2229
  ${e?s.html`
2142
2230
  <div class="progress-row">
2143
2231
  <div class="progress-track" role="progressbar" aria-valuenow=${Math.round(this.uploadProgress)} aria-valuemin="0" aria-valuemax="100" aria-label="Upload progress">
@@ -2359,7 +2447,7 @@
2359
2447
  :host { animation: none; }
2360
2448
  .btn-spin { animation: none; }
2361
2449
  }
2362
- `];let z=ue;L([p.property({type:String})],z.prototype,"uploadState");L([p.property({type:Number})],z.prototype,"fileCount");L([p.property({type:Number})],z.prototype,"totalSize");L([p.property({type:Number})],z.prototype,"failedCount");L([p.property({type:Boolean})],z.prototype,"showFillMetadata");L([p.property({type:Number})],z.prototype,"completedCount");L([p.property({type:Number})],z.prototype,"uploadProgress");const lt='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ae(n,e){return t=>{if(t.key!=="Tab")return;const i=n();if(!i)return;const r=i.querySelector(e);if(!r)return;const o=Array.from(r.querySelectorAll(lt));if(o.length===0)return;const a=o[0],l=o[o.length-1],d=i.activeElement;t.shiftKey?(d===a||!r.contains(d))&&(t.preventDefault(),l.focus()):(d===l||!r.contains(d))&&(t.preventDefault(),a.focus())}}var dt=Object.defineProperty,ne=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&dt(e,t,r),r};const xe=class xe extends s.LitElement{constructor(){super(...arguments),this._url="",this._name="",this._error="",this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._onUrlInput=e=>{this._url=e.target.value,this._error="",this._autoName()},this._onNameInput=e=>{this._name=e.target.value},this._focusTrap=ae(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{var t;e.key==="Escape"&&this._cancel(),e.key==="Enter"&&((t=e.target)==null?void 0:t.tagName)==="INPUT"&&this._submit(),this._focusTrap(e)}}_autoName(){var e;if(!this._name)try{const t=new URL(this._url).pathname.split("/"),i=t[t.length-1];if(i){const r=(e=this.shadowRoot)==null?void 0:e.querySelector("#nameInput");r&&(r.placeholder=i)}}catch{}}_cancel(){this.dispatchEvent(new CustomEvent("url-cancel",{bubbles:!0,composed:!0}))}_submit(){const e=this._url.trim();if(!e){this._error="Please enter a URL";return}try{new URL(e)}catch{this._error="Please enter a valid URL";return}this._error="";let t=this._name.trim();if(!t)try{const i=new URL(e).pathname.split("/");t=i[i.length-1]||"imported-file"}catch{t="imported-file"}this.dispatchEvent(new CustomEvent("url-submit",{detail:{url:e,name:t},bubbles:!0,composed:!0}))}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var e,t;(t=(e=this.shadowRoot)==null?void 0:e.querySelector("#urlInput"))==null||t.focus()})}render(){return s.html`
2450
+ `];let P=ue;L([c.property({type:String})],P.prototype,"uploadState");L([c.property({type:Number})],P.prototype,"fileCount");L([c.property({type:Number})],P.prototype,"totalSize");L([c.property({type:Number})],P.prototype,"failedCount");L([c.property({type:Boolean})],P.prototype,"showFillMetadata");L([c.property({type:Number})],P.prototype,"completedCount");L([c.property({type:Number})],P.prototype,"uploadProgress");const lt='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ae(n,e){return t=>{if(t.key!=="Tab")return;const i=n();if(!i)return;const r=i.querySelector(e);if(!r)return;const o=Array.from(r.querySelectorAll(lt));if(o.length===0)return;const a=o[0],l=o[o.length-1],d=i.activeElement;t.shiftKey?(d===a||!r.contains(d))&&(t.preventDefault(),l.focus()):(d===l||!r.contains(d))&&(t.preventDefault(),a.focus())}}var dt=Object.defineProperty,ne=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&dt(e,t,r),r};const xe=class xe extends s.LitElement{constructor(){super(...arguments),this._url="",this._name="",this._error="",this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._onUrlInput=e=>{this._url=e.target.value,this._error="",this._autoName()},this._onNameInput=e=>{this._name=e.target.value},this._focusTrap=ae(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{var t;e.key==="Escape"&&this._cancel(),e.key==="Enter"&&((t=e.target)==null?void 0:t.tagName)==="INPUT"&&this._submit(),this._focusTrap(e)}}_autoName(){var e;if(!this._name)try{const t=new URL(this._url).pathname.split("/"),i=t[t.length-1];if(i){const r=(e=this.shadowRoot)==null?void 0:e.querySelector("#nameInput");r&&(r.placeholder=i)}}catch{}}_cancel(){this.dispatchEvent(new CustomEvent("url-cancel",{bubbles:!0,composed:!0}))}_submit(){const e=this._url.trim();if(!e){this._error="Please enter a URL";return}try{new URL(e)}catch{this._error="Please enter a valid URL";return}this._error="";let t=this._name.trim();if(!t)try{const i=new URL(e).pathname.split("/");t=i[i.length-1]||"imported-file"}catch{t="imported-file"}this.dispatchEvent(new CustomEvent("url-submit",{detail:{url:e,name:t},bubbles:!0,composed:!0}))}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var e,t;(t=(e=this.shadowRoot)==null?void 0:e.querySelector("#urlInput"))==null||t.focus()})}render(){return s.html`
2363
2451
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2364
2452
  <div class="card">
2365
2453
  <div class="head">
@@ -2576,7 +2664,7 @@
2576
2664
  outline: none;
2577
2665
  }
2578
2666
 
2579
- `];let I=xe;ne([p.state()],I.prototype,"_url");ne([p.state()],I.prototype,"_name");ne([p.state()],I.prototype,"_error");var ct=Object.defineProperty,re=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ct(e,t,r),r};const ge=class ge extends s.LitElement{constructor(){super(...arguments),this._stream=null,this._error="",this._captured=null,this._previewUrl="",this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._focusTrap=ae(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._capture=()=>{var r,o;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("video"),t=(o=this.shadowRoot)==null?void 0:o.querySelector("canvas");if(!e||!t)return;t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0),t.toBlob(a=>{a&&(this._captured=a,this._previewUrl=URL.createObjectURL(a),this._stopStream())},"image/jpeg",.92)},this._retake=()=>{this._previewUrl&&URL.revokeObjectURL(this._previewUrl),this._captured=null,this._previewUrl="",this._startCamera()},this._usePhoto=()=>{if(!this._captured)return;const e=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),t=new File([this._captured],`camera-${e}.jpg`,{type:"image/jpeg"});this.dispatchEvent(new CustomEvent("camera-capture",{detail:{file:t},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this._startCamera()}disconnectedCallback(){super.disconnectedCallback(),this._stopStream(),this._previewUrl&&URL.revokeObjectURL(this._previewUrl)}async _startCamera(){var e;try{this._stream=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),await this.updateComplete;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("video");t&&(t.srcObject=this._stream)}catch{this._error="Could not access camera. Please check your permissions."}}_stopStream(){var e;(e=this._stream)==null||e.getTracks().forEach(t=>t.stop()),this._stream=null}_cancel(){this._stopStream(),this.dispatchEvent(new CustomEvent("camera-cancel",{bubbles:!0,composed:!0}))}render(){return s.html`
2667
+ `];let I=xe;ne([c.state()],I.prototype,"_url");ne([c.state()],I.prototype,"_name");ne([c.state()],I.prototype,"_error");var pt=Object.defineProperty,re=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&pt(e,t,r),r};const ge=class ge extends s.LitElement{constructor(){super(...arguments),this._stream=null,this._error="",this._captured=null,this._previewUrl="",this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._focusTrap=ae(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._capture=()=>{var r,o;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("video"),t=(o=this.shadowRoot)==null?void 0:o.querySelector("canvas");if(!e||!t)return;t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0),t.toBlob(a=>{a&&(this._captured=a,this._previewUrl=URL.createObjectURL(a),this._stopStream())},"image/jpeg",.92)},this._retake=()=>{this._previewUrl&&URL.revokeObjectURL(this._previewUrl),this._captured=null,this._previewUrl="",this._startCamera()},this._usePhoto=()=>{if(!this._captured)return;const e=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),t=new File([this._captured],`camera-${e}.jpg`,{type:"image/jpeg"});this.dispatchEvent(new CustomEvent("camera-capture",{detail:{file:t},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this._startCamera()}disconnectedCallback(){super.disconnectedCallback(),this._stopStream(),this._previewUrl&&URL.revokeObjectURL(this._previewUrl)}async _startCamera(){var e;try{this._stream=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),await this.updateComplete;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("video");t&&(t.srcObject=this._stream)}catch{this._error="Could not access camera. Please check your permissions."}}_stopStream(){var e;(e=this._stream)==null||e.getTracks().forEach(t=>t.stop()),this._stream=null}_cancel(){this._stopStream(),this.dispatchEvent(new CustomEvent("camera-cancel",{bubbles:!0,composed:!0}))}render(){return s.html`
2580
2668
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2581
2669
  <div class="card">
2582
2670
  <div class="head">
@@ -2686,7 +2774,7 @@
2686
2774
 
2687
2775
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2688
2776
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2689
- `];let j=ge;re([p.state()],j.prototype,"_stream");re([p.state()],j.prototype,"_error");re([p.state()],j.prototype,"_captured");re([p.state()],j.prototype,"_previewUrl");var pt=Object.defineProperty,G=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&pt(e,t,r),r};const ve=class ve extends s.LitElement{constructor(){super(...arguments),this._stream=null,this._recording=!1,this._error="",this._recordedBlob=null,this._previewUrl="",this._recorder=null,this._chunks=[],this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._focusTrap=ae(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._startRecording=async()=>{var e;try{this._stream=await navigator.mediaDevices.getDisplayMedia({video:{width:1280,height:720,frameRate:5},audio:!0}),this._stream.getVideoTracks()[0].addEventListener("ended",()=>{this._stopRecording()}),this._recording=!0,await this.updateComplete;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("video");t&&(t.srcObject=this._stream),this._chunks=[];const i=MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm";this._recorder=new MediaRecorder(this._stream,{mimeType:i}),this._recorder.ondataavailable=r=>{r.data.size>0&&this._chunks.push(r.data)},this._recorder.onstop=()=>{var o;const r=new Blob(this._chunks,{type:"video/webm"});this._recordedBlob=r,this._previewUrl=URL.createObjectURL(r),(o=this._stream)==null||o.getTracks().forEach(a=>a.stop()),this._stream=null},this._recorder.start()}catch{this._error="Could not start screen capture. Please check your permissions."}},this._stopRecording=()=>{var e;this._recording=!1,((e=this._recorder)==null?void 0:e.state)==="recording"&&this._recorder.stop(),this._recorder=null},this._useRecording=()=>{if(!this._recordedBlob)return;const e=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),t=new File([this._recordedBlob],`screencap-${e}.webm`,{type:"video/webm"});this.dispatchEvent(new CustomEvent("screencast-capture",{detail:{file:t},bubbles:!0,composed:!0}))},this._discard=()=>{this._previewUrl&&URL.revokeObjectURL(this._previewUrl),this._recordedBlob=null,this._previewUrl=""}}disconnectedCallback(){super.disconnectedCallback(),this._stopAll(),this._previewUrl&&URL.revokeObjectURL(this._previewUrl)}_stopAll(){var e,t;(e=this._recorder)==null||e.stop(),this._recorder=null,(t=this._stream)==null||t.getTracks().forEach(i=>i.stop()),this._stream=null}_cancel(){this._stopAll(),this.dispatchEvent(new CustomEvent("screencast-cancel",{bubbles:!0,composed:!0}))}render(){return s.html`
2777
+ `];let O=ge;re([c.state()],O.prototype,"_stream");re([c.state()],O.prototype,"_error");re([c.state()],O.prototype,"_captured");re([c.state()],O.prototype,"_previewUrl");var ct=Object.defineProperty,G=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ct(e,t,r),r};const ve=class ve extends s.LitElement{constructor(){super(...arguments),this._stream=null,this._recording=!1,this._error="",this._recordedBlob=null,this._previewUrl="",this._recorder=null,this._chunks=[],this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._focusTrap=ae(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._startRecording=async()=>{var e;try{this._stream=await navigator.mediaDevices.getDisplayMedia({video:{width:1280,height:720,frameRate:5},audio:!0}),this._stream.getVideoTracks()[0].addEventListener("ended",()=>{this._stopRecording()}),this._recording=!0,await this.updateComplete;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("video");t&&(t.srcObject=this._stream),this._chunks=[];const i=MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm";this._recorder=new MediaRecorder(this._stream,{mimeType:i}),this._recorder.ondataavailable=r=>{r.data.size>0&&this._chunks.push(r.data)},this._recorder.onstop=()=>{var o;const r=new Blob(this._chunks,{type:"video/webm"});this._recordedBlob=r,this._previewUrl=URL.createObjectURL(r),(o=this._stream)==null||o.getTracks().forEach(a=>a.stop()),this._stream=null},this._recorder.start()}catch{this._error="Could not start screen capture. Please check your permissions."}},this._stopRecording=()=>{var e;this._recording=!1,((e=this._recorder)==null?void 0:e.state)==="recording"&&this._recorder.stop(),this._recorder=null},this._useRecording=()=>{if(!this._recordedBlob)return;const e=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),t=new File([this._recordedBlob],`screencap-${e}.webm`,{type:"video/webm"});this.dispatchEvent(new CustomEvent("screencast-capture",{detail:{file:t},bubbles:!0,composed:!0}))},this._discard=()=>{this._previewUrl&&URL.revokeObjectURL(this._previewUrl),this._recordedBlob=null,this._previewUrl=""}}disconnectedCallback(){super.disconnectedCallback(),this._stopAll(),this._previewUrl&&URL.revokeObjectURL(this._previewUrl)}_stopAll(){var e,t;(e=this._recorder)==null||e.stop(),this._recorder=null,(t=this._stream)==null||t.getTracks().forEach(i=>i.stop()),this._stream=null}_cancel(){this._stopAll(),this.dispatchEvent(new CustomEvent("screencast-cancel",{bubbles:!0,composed:!0}))}render(){return s.html`
2690
2778
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2691
2779
  <div class="card">
2692
2780
  <div class="head">
@@ -2830,14 +2918,15 @@
2830
2918
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2831
2919
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2832
2920
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
2833
- `];let T=ve;G([p.state()],T.prototype,"_stream");G([p.state()],T.prototype,"_recording");G([p.state()],T.prototype,"_error");G([p.state()],T.prototype,"_recordedBlob");G([p.state()],T.prototype,"_previewUrl");var ft=Object.defineProperty,k=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ft(e,t,r),r};const $e=new Set(["unsplash"]);var $;const _=($=class extends s.LitElement{constructor(){super(),this.config=null,this._isOpen=!1,this._activeConnector=null,this._showUrlDialog=!1,this._showCameraDialog=!1,this._showScreenCastDialog=!1,this._previewFileId=null,this._previewDims="—",this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0,this._fsDragging=!1,this._fsDragStartX=0,this._fsDragStartY=0,this._fsPanStartX=0,this._fsPanStartY=0,this._bodyDragOver=!1,this._isMinimized=!1,this._isPillExpanded=!1,this._bodyDragCounter=0,this._videoBlobUrls=new Map,this._engine=null,this._cachedSources=A,this._cachedSourcesConfig=void 0,this._rejectedTimers=new Map,this._closeOnCompleteTimer=null,this._apiBase=null,this._authHeaders=null,this._authResolveId=0,this._prevStoreState=null,this._unsubStoreEvents=null,this._portalContainer=null,this._onFilesSelected=e=>{this._processIncomingFiles(e.detail.files)},this._onDropTileSourceClick=e=>{this._handleSourceActivation(e.detail.source.id)},this._onSourceClick=async e=>{this._handleSourceActivation(e.detail.source)},this._handleSourceActivation=async e=>{var r,o;const t=this._mergedSources.find(a=>a.id===e);if(t!=null&&t.onActivate){try{t.onActivate(this)}catch(a){console.error(`[sfx-uploader] onActivate for custom source "${e}" threw:`,a)}return}if(e==="device"){const a=this.shadowRoot.querySelector("sfx-drop-zone");a==null||a.browse();return}if(e==="url"){this._showUrlDialog=!0;return}if(e==="camera"){this._showCameraDialog=!0;return}if(e==="screen-cast"){this._showScreenCastDialog=!0;return}if((((o=(r=this.config)==null?void 0:r.connectors)==null?void 0:o.providers)??[]).includes(e)){if($e.has(e)){if(!customElements.get("sfx-search-provider-browser")){const{SfxSearchProviderBrowser:l}=await Promise.resolve().then(()=>require("./search-provider-browser-KQs6JI8u.cjs"));customElements.define("sfx-search-provider-browser",l)}}else if(!customElements.get("sfx-provider-browser")){const{SfxProviderBrowser:l}=await Promise.resolve().then(()=>require("./provider-browser-DbjyF_Ou.cjs"));customElements.define("sfx-provider-browser",l)}this._activeConnector=e}},this._onUrlSubmit=e=>{var h,x,u;this._showUrlDialog=!1;const{url:t,name:i}=e.detail,r=(h=this.config)==null?void 0:h.callbacks,o=Xe(i),a=o.startsWith("image/"),l=this._store.getState(),d=oe({name:i,size:0,type:o},l.restrictions,l.files);if(d){const f={id:B(),status:"rejected",file:null,remoteUrl:t,name:i,size:0,type:o,previewUrl:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};M(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:d}),(x=r==null?void 0:r.onFileRejected)==null||x.call(r,f,d);return}const c={id:B(),status:"idle",file:null,remoteUrl:t,name:i,size:0,type:o,previewUrl:a?t:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};M(this._store,c),this._dispatchPublic(g.FILE_ADDED,{file:c}),(u=r==null?void 0:r.onFileAdded)==null||u.call(r,c),this._store.getState().queueConfig.autoProceed&&this.upload()},this._onUrlCancel=()=>{this._showUrlDialog=!1},this._onCameraCapture=e=>{this._showCameraDialog=!1,this._processIncomingFiles([e.detail.file])},this._onCameraCancel=()=>{this._showCameraDialog=!1},this._onScreenCastCapture=e=>{this._showScreenCastDialog=!1,this._processIncomingFiles([e.detail.file])},this._onScreenCastCancel=()=>{this._showScreenCastDialog=!1},this._onFileRemove=e=>{this._removeFile(e.detail.fileId)},this._onFilePreview=e=>{var i,r,o;const t=this._store.getState().files.get(e.detail.fileId);t&&(this._previewFileId=t.id,this._dispatchPublic(g.FILE_PREVIEW,{file:t}),(o=(r=(i=this.config)==null?void 0:i.callbacks)==null?void 0:r.onFilePreview)==null||o.call(r,t))},this._onFillMetadata=()=>{var t,i,r;const e=[...this._store.getState().files.values()].filter(o=>$._MODIFIABLE_STATUSES.has(o.status));this._dispatchPublic(g.FILL_METADATA,{files:e}),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onFillMetadata)==null||r.call(i,e)},this._onFileRetry=e=>{var t;this._ensureEngine(),(t=this._engine)==null||t.retryFile(e.detail.fileId)},this._onRetryAll=()=>{var e;this._ensureEngine(),(e=this._engine)==null||e.retryAll()},this._onClearAll=()=>{var i,r,o;const e=(i=this.config)==null?void 0:i.callbacks;this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),(r=this._engine)==null||r.cancelAll();const t=[...this._store.getState().files.values()];for(const a of t)a.previewUrl&&URL.revokeObjectURL(a.previewUrl),this._dispatchPublic(g.FILE_REMOVED,{file:a}),(o=e==null?void 0:e.onFileRemoved)==null||o.call(e,a);this._revokeVideoBlobUrls();for(const a of this._rejectedTimers.values())clearTimeout(a);this._rejectedTimers.clear(),this._dimCache.clear(),this._previewFileId=null,this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._store.setState({files:new Map,isUploading:!1,totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0})},this._onAddMore=()=>{var r;const e=this.shadowRoot.querySelector("sfx-drop-zone");if(e){e.browse();return}const t=this.shadowRoot.querySelector("sfx-file-list"),i=(r=t==null?void 0:t.shadowRoot)==null?void 0:r.querySelector('input[type="file"]');i==null||i.click()},this._onUploadStart=()=>{var e;if(this._phase==="complete"){((e=this.config)==null?void 0:e.clearOnComplete)!==!1&&this._onClearAll();return}this.upload()},this._onUploadMore=()=>{this._onClearAll()},this._onConnectorFilesSelected=e=>{var i,r,o;const t=(i=this.config)==null?void 0:i.callbacks;for(const a of e.detail.files){const l=this._store.getState(),d=oe({name:a.name,size:a.size,type:a.mimeType},l.restrictions,l.files);if(d){const h={id:B(),status:"rejected",file:null,remoteUrl:null,name:a.name,size:a.size,type:a.mimeType,previewUrl:a.thumbnail,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:a};M(this._store,h),this._dispatchPublic(g.FILE_REJECTED,{file:h,reason:d}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,h,d);continue}const c={id:B(),status:"idle",file:null,remoteUrl:null,name:a.name,size:a.size,type:a.mimeType,previewUrl:a.thumbnail,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:a};M(this._store,c),this._dispatchPublic(g.FILE_ADDED,{file:c}),(o=t==null?void 0:t.onFileAdded)==null||o.call(t,c)}this._activeConnector=null,this._store.getState().queueConfig.autoProceed&&this.upload()},this._onConnectorClose=()=>{this._activeConnector=null},this._onConnectorBackdropClick=e=>{e.target===e.currentTarget&&(this._activeConnector=null)},this._onPrimaryAction=()=>{var e,t,i,r,o;this._dispatchPublic(g.COMPLETE_ACTION,{}),(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCompleteAction)==null||i.call(t),((r=this.config)==null?void 0:r.mode)==="modal"?this.close():((o=this.config)==null?void 0:o.clearOnComplete)!==!1&&this._onClearAll()},this._onInlineDismiss=()=>{var e,t,i;(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||i.call(t),this._dispatchPublic(g.CANCEL,{})},this._onModalDismiss=()=>{var e,t,i;(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||i.call(t),this._dispatchPublic(g.CANCEL,{}),this.close()},this._onMinimize=()=>{this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()},this._onPillClick=()=>{this._isPillExpanded=!this._isPillExpanded,this.requestUpdate()},this._onPillDismiss=()=>{this._isMinimized=!1,this._isPillExpanded=!1,this._isOpen=!0,this.requestUpdate()},this._onModalBackdropClick=e=>{e.target===e.currentTarget&&this._onModalDismiss()},this._onBodyDragEnter=e=>{e.preventDefault(),this._bodyDragCounter++,this._bodyDragCounter===1&&(this._bodyDragOver=!0)},this._onBodyDragOver=e=>{e.preventDefault()},this._onBodyDragLeave=e=>{e.preventDefault(),this._bodyDragCounter--,this._bodyDragCounter<=0&&(this._bodyDragCounter=0,this._bodyDragOver=!1)},this._onBodyDrop=e=>{var i;e.preventDefault(),this._bodyDragCounter=0,this._bodyDragOver=!1;const t=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);t.length>0&&this._onFilesSelected(new CustomEvent("files-selected",{detail:{files:t}}))},this._onKeyDown=e=>{var t,i;if(e.key==="Escape"){if(this._fullscreenPreviewUrl||this._fullscreenVideoFile){this._onFsClose();return}this._isOpen&&((t=this.config)==null?void 0:t.mode)==="modal"&&(((i=this.config)==null?void 0:i.headerButton)??"close")!=="none"&&this._onModalDismiss()}},this._dimCache=new Map,this._onFsToggleZoom=e=>{e==null||e.stopPropagation(),this._fullscreenZoomed=!this._fullscreenZoomed,this._fullscreenZoomed||(this._fsPanX=0,this._fsPanY=0)},this._onFsOverlayClick=e=>{this._fsDragDidMove||this._onFsToggleZoom(e)},this._fsDragDidMove=!1,this._onFsPanStart=e=>{this._fullscreenZoomed&&(this._fsDragging=!0,this._fsDragDidMove=!1,this._fsDragStartX=e.clientX,this._fsDragStartY=e.clientY,this._fsPanStartX=this._fsPanX,this._fsPanStartY=this._fsPanY,e.preventDefault())},this._onFsPanMove=e=>{if(!this._fsDragging)return;const t=e.clientX-this._fsDragStartX,i=e.clientY-this._fsDragStartY;(Math.abs(t)>3||Math.abs(i)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+t,this._fsPanY=this._fsPanStartY+i,this.requestUpdate()},this._onFsPanEnd=()=>{this._fsDragging=!1,requestAnimationFrame(()=>{this._fsDragDidMove=!1})},this._onFsTouchStart=e=>{if(!this._fullscreenZoomed||e.touches.length!==1)return;const t=e.touches[0];this._fsDragging=!0,this._fsDragDidMove=!1,this._fsDragStartX=t.clientX,this._fsDragStartY=t.clientY,this._fsPanStartX=this._fsPanX,this._fsPanStartY=this._fsPanY},this._onFsTouchMove=e=>{if(!this._fsDragging||e.touches.length!==1)return;const t=e.touches[0],i=t.clientX-this._fsDragStartX,r=t.clientY-this._fsDragStartY;(Math.abs(i)>3||Math.abs(r)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+i,this._fsPanY=this._fsPanStartY+r,this.requestUpdate(),e.preventDefault()},this._onFsClose=e=>{e==null||e.stopPropagation(),this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0},this._store=Ee(),this._storeCtrl=new Fe(this,this._store)}open(){var e,t,i;this._isMinimized&&(this._isMinimized=!1,this._isPillExpanded=!1),!this._isOpen&&(this._isOpen=!0,(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onOpen)==null||i.call(t),this._dispatchPublic(g.OPEN,{}),this.requestUpdate())}close(){var e,t,i,r;this._isOpen&&(this._isOpen=!1,this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),((e=this.config)==null?void 0:e.clearOnClose)!==!1&&this._onClearAll(),this._previewFileId=null,(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onClose)==null||r.call(i),this._dispatchPublic(g.CLOSE,{}),this.requestUpdate())}upload(){var r,o,a,l,d;if(this._ensureEngine(),!this._engine){console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");return}const e=[...this._store.getState().files.values()].filter(c=>c.status==="idle"||c.status==="queued");if((o=(r=this.config)==null?void 0:r.callbacks)!=null&&o.onBeforeUpload&&this.config.callbacks.onBeforeUpload(e)===!1)return;const t=new CustomEvent(g.BEFORE_UPLOAD,{bubbles:!0,composed:!0,cancelable:!0,detail:{files:e}});this.dispatchEvent(t)&&(this._dispatchPublic(g.UPLOAD_STARTED,{files:e}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onUploadStarted)==null||d.call(l,e),this._engine.uploadAll())}addFiles(e){this._processIncomingFiles(e)}resumeUpload(e){var t;if(e&&e.length>0){const i=this._store.getState().files,r=new Map(i);let o=!1;for(const a of e){const l=i.get(a.id);l&&(r.set(a.id,{...l,...a}),o=!0)}o&&this._store.setState({files:r})}this._ensureEngine(),(t=this._engine)==null||t.uploadAll()}cancelUpload(){var e;(e=this._engine)==null||e.cancelAll()}getFiles(){return[...this._store.getState().files.values()]}getFile(e){return this._store.getState().files.get(e)}updateFileMeta(e,t,i){const r=this._store.getState().files,o=r.get(e);if(!o||!$._MODIFIABLE_STATUSES.has(o.status))return;const a=new Map(r);a.set(e,{...o,meta:t!=null?{...o.meta,...t}:o.meta,tags:i??o.tags}),this._store.setState({files:a})}updateFilesMeta(e){const t=this._store.getState().files,i=new Map(t);let r=!1;for(const{fileId:o,meta:a,tags:l}of e){const d=t.get(o);!d||!$._MODIFIABLE_STATUSES.has(d.status)||(i.set(o,{...d,meta:a!=null?{...d.meta,...a}:d.meta,tags:l??d.tags}),r=!0)}r&&this._store.setState({files:i})}updated(e){if(e.has("config")&&this.config&&this._applyConfig(this.config),e.has("_previewFileId")&&this._previewFileId){const t=this._previewFileId,i=this._store.getState().files.get(t);i?this._getImageDimensions(i).then(r=>{this._previewFileId===t&&(this._previewDims=r?`${r.w} × ${r.h}`:"—")}):this._previewDims="—"}this._updateFloatingPortal()}_injectFloatStyles(){if(document.querySelector("style[data-sfx-upload-float-styles]"))return;const e=document.createElement("style");e.setAttribute("data-sfx-upload-float-styles",""),e.textContent=`
2834
- [data-sfx-upload-float] .upload-float { position:fixed; bottom:24px; right:24px; z-index:10000; width:320px; border-radius:12px; background:#fff; box-shadow:0 8px 32px rgba(0,0,0,0.12),0 2px 8px rgba(0,0,0,0.06); overflow:hidden; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; animation:sfxFloatIn .3s ease both; }
2921
+ `];let M=ve;G([c.state()],M.prototype,"_stream");G([c.state()],M.prototype,"_recording");G([c.state()],M.prototype,"_error");G([c.state()],M.prototype,"_recordedBlob");G([c.state()],M.prototype,"_previewUrl");var ft=Object.defineProperty,k=(n,e,t,i)=>{for(var r=void 0,o=n.length-1,a;o>=0;o--)(a=n[o])&&(r=a(e,t,r)||r);return r&&ft(e,t,r),r};const $e=new Set(["unsplash"]);var $;const _=($=class extends s.LitElement{constructor(){super(),this.config=null,this._isOpen=!1,this._activeConnector=null,this._showUrlDialog=!1,this._showCameraDialog=!1,this._showScreenCastDialog=!1,this._previewFileId=null,this._previewDims="—",this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0,this._fsDragging=!1,this._fsDragStartX=0,this._fsDragStartY=0,this._fsPanStartX=0,this._fsPanStartY=0,this._bodyDragOver=!1,this._isMinimized=!1,this._isPillExpanded=!1,this._bodyDragCounter=0,this._videoBlobUrls=new Map,this._engine=null,this._cachedSources=A,this._cachedSourcesConfig=void 0,this._rejectedTimers=new Map,this._closeOnCompleteTimer=null,this._apiBase=null,this._authHeaders=null,this._authResolveId=0,this._prevStoreState=null,this._unsubStoreEvents=null,this._portalContainer=null,this._onFilesSelected=e=>{this._processIncomingFiles(e.detail.files)},this._onDropTileSourceClick=e=>{this._handleSourceActivation(e.detail.source.id)},this._onSourceClick=async e=>{this._handleSourceActivation(e.detail.source)},this._handleSourceActivation=async e=>{var r,o;const t=this._mergedSources.find(a=>a.id===e);if(t!=null&&t.onActivate){try{t.onActivate(this)}catch(a){console.error(`[sfx-uploader] onActivate for custom source "${e}" threw:`,a)}return}if(e==="device"){const a=this.shadowRoot.querySelector("sfx-drop-zone");a==null||a.browse();return}if(e==="url"){this._showUrlDialog=!0;return}if(e==="camera"){this._showCameraDialog=!0;return}if(e==="screen-cast"){this._showScreenCastDialog=!0;return}if((((o=(r=this.config)==null?void 0:r.connectors)==null?void 0:o.providers)??[]).includes(e)){if($e.has(e)){if(!customElements.get("sfx-search-provider-browser")){const{SfxSearchProviderBrowser:l}=await Promise.resolve().then(()=>require("./search-provider-browser-C0yqcOmH.cjs"));customElements.define("sfx-search-provider-browser",l)}}else if(!customElements.get("sfx-provider-browser")){const{SfxProviderBrowser:l}=await Promise.resolve().then(()=>require("./provider-browser-YA7MCWl4.cjs"));customElements.define("sfx-provider-browser",l)}this._activeConnector=e}},this._onUrlSubmit=e=>{var h,u,x;this._showUrlDialog=!1;const{url:t,name:i}=e.detail,r=(h=this.config)==null?void 0:h.callbacks,o=Xe(i),a=o.startsWith("image/"),l=this._store.getState(),d=oe({name:i,size:0,type:o},l.restrictions,l.files);if(d){const f={id:B(),status:"rejected",file:null,remoteUrl:t,name:i,size:0,type:o,previewUrl:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};T(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:d}),(u=r==null?void 0:r.onFileRejected)==null||u.call(r,f,d);return}const p={id:B(),status:"idle",file:null,remoteUrl:t,name:i,size:0,type:o,previewUrl:a?t:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};T(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(x=r==null?void 0:r.onFileAdded)==null||x.call(r,p),this._store.getState().queueConfig.autoProceed&&this.upload()},this._onUrlCancel=()=>{this._showUrlDialog=!1},this._onCameraCapture=e=>{this._showCameraDialog=!1,this._processIncomingFiles([e.detail.file])},this._onCameraCancel=()=>{this._showCameraDialog=!1},this._onScreenCastCapture=e=>{this._showScreenCastDialog=!1,this._processIncomingFiles([e.detail.file])},this._onScreenCastCancel=()=>{this._showScreenCastDialog=!1},this._onFileRemove=e=>{this._removeFile(e.detail.fileId)},this._onFilePreview=e=>{var i,r,o;const t=this._store.getState().files.get(e.detail.fileId);t&&(this._previewFileId=t.id,this._dispatchPublic(g.FILE_PREVIEW,{file:t}),(o=(r=(i=this.config)==null?void 0:i.callbacks)==null?void 0:r.onFilePreview)==null||o.call(r,t))},this._onFillMetadata=()=>{var t,i,r;const e=[...this._store.getState().files.values()].filter(o=>$._MODIFIABLE_STATUSES.has(o.status));this._dispatchPublic(g.FILL_METADATA,{files:e}),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onFillMetadata)==null||r.call(i,e)},this._onFileRetry=e=>{var t;this._ensureEngine(),(t=this._engine)==null||t.retryFile(e.detail.fileId)},this._onRetryAll=()=>{var e;this._ensureEngine(),(e=this._engine)==null||e.retryAll()},this._onClearAll=()=>{var i,r,o;const e=(i=this.config)==null?void 0:i.callbacks;this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),(r=this._engine)==null||r.cancelAll();const t=[...this._store.getState().files.values()];for(const a of t)a.previewUrl&&URL.revokeObjectURL(a.previewUrl),this._dispatchPublic(g.FILE_REMOVED,{file:a}),(o=e==null?void 0:e.onFileRemoved)==null||o.call(e,a);this._revokeVideoBlobUrls();for(const a of this._rejectedTimers.values())clearTimeout(a);this._rejectedTimers.clear(),this._dimCache.clear(),this._previewFileId=null,this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._store.setState({files:new Map,isUploading:!1,totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0})},this._onAddMore=()=>{var r;const e=this.shadowRoot.querySelector("sfx-drop-zone");if(e){e.browse();return}const t=this.shadowRoot.querySelector("sfx-file-list"),i=(r=t==null?void 0:t.shadowRoot)==null?void 0:r.querySelector('input[type="file"]');i==null||i.click()},this._onUploadStart=()=>{var e;if(this._phase==="complete"){((e=this.config)==null?void 0:e.clearOnComplete)!==!1&&this._onClearAll();return}this.upload()},this._onUploadMore=()=>{this._onClearAll()},this._onConnectorFilesSelected=e=>{var i,r,o;const t=(i=this.config)==null?void 0:i.callbacks;for(const a of e.detail.files){const l=this._store.getState(),d=oe({name:a.name,size:a.size,type:a.mimeType},l.restrictions,l.files);if(d){const h={id:B(),status:"rejected",file:null,remoteUrl:null,name:a.name,size:a.size,type:a.mimeType,previewUrl:a.thumbnail,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:a};T(this._store,h),this._dispatchPublic(g.FILE_REJECTED,{file:h,reason:d}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,h,d);continue}const p={id:B(),status:"idle",file:null,remoteUrl:null,name:a.name,size:a.size,type:a.mimeType,previewUrl:a.thumbnail,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:a};T(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(o=t==null?void 0:t.onFileAdded)==null||o.call(t,p)}this._activeConnector=null,this._store.getState().queueConfig.autoProceed&&this.upload()},this._onConnectorClose=()=>{this._activeConnector=null},this._onConnectorBackdropClick=e=>{e.target===e.currentTarget&&(this._activeConnector=null)},this._onPrimaryAction=()=>{var e,t,i,r,o;this._dispatchPublic(g.COMPLETE_ACTION,{}),(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCompleteAction)==null||i.call(t),((r=this.config)==null?void 0:r.mode)==="modal"?this.close():((o=this.config)==null?void 0:o.clearOnComplete)!==!1&&this._onClearAll()},this._onInlineDismiss=()=>{var e,t,i;(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||i.call(t),this._dispatchPublic(g.CANCEL,{})},this._onSuccessCardClose=()=>{var e,t,i,r;((e=this.config)==null?void 0:e.mode)==="inline"?(this._dispatchPublic(g.COMPLETE_ACTION,{}),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onCompleteAction)==null||r.call(i),this._onClearAll()):this._onModalDismiss()},this._onModalDismiss=()=>{var e,t,i,r;this._phase==="uploading"&&((e=this._engine)==null||e.cancelAll()),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onCancel)==null||r.call(i),this._dispatchPublic(g.CANCEL,{}),this.close()},this._onMinimize=()=>{this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()},this._onPillClick=()=>{this._isPillExpanded=!this._isPillExpanded,this.requestUpdate()},this._onPillExpand=()=>{this._isMinimized=!1,this._isPillExpanded=!1,this._isOpen=!0,this.requestUpdate()},this._onPillDismiss=()=>{var e,t,i,r;this._isMinimized=!1,this._isPillExpanded=!1,this._phase==="uploading"&&((e=this._engine)==null||e.cancelAll()),(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onCancel)==null||r.call(i),this._dispatchPublic(g.CANCEL,{}),this.close()},this._onModalBackdropClick=e=>{e.target===e.currentTarget&&this._onModalDismiss()},this._onBodyDragEnter=e=>{e.preventDefault(),this._bodyDragCounter++,this._bodyDragCounter===1&&(this._bodyDragOver=!0)},this._onBodyDragOver=e=>{e.preventDefault()},this._onBodyDragLeave=e=>{e.preventDefault(),this._bodyDragCounter--,this._bodyDragCounter<=0&&(this._bodyDragCounter=0,this._bodyDragOver=!1)},this._onBodyDrop=e=>{var i;e.preventDefault(),this._bodyDragCounter=0,this._bodyDragOver=!1;const t=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);t.length>0&&this._onFilesSelected(new CustomEvent("files-selected",{detail:{files:t}}))},this._onKeyDown=e=>{var t,i;if(e.key==="Escape"){if(this._fullscreenPreviewUrl||this._fullscreenVideoFile){this._onFsClose();return}this._isOpen&&((t=this.config)==null?void 0:t.mode)==="modal"&&(((i=this.config)==null?void 0:i.headerButton)??"close")!=="none"&&this._onModalDismiss()}},this._dimCache=new Map,this._onFsToggleZoom=e=>{e==null||e.stopPropagation(),this._fullscreenZoomed=!this._fullscreenZoomed,this._fullscreenZoomed||(this._fsPanX=0,this._fsPanY=0)},this._onFsOverlayClick=e=>{this._fsDragDidMove||this._onFsToggleZoom(e)},this._fsDragDidMove=!1,this._onFsPanStart=e=>{this._fullscreenZoomed&&(this._fsDragging=!0,this._fsDragDidMove=!1,this._fsDragStartX=e.clientX,this._fsDragStartY=e.clientY,this._fsPanStartX=this._fsPanX,this._fsPanStartY=this._fsPanY,e.preventDefault())},this._onFsPanMove=e=>{if(!this._fsDragging)return;const t=e.clientX-this._fsDragStartX,i=e.clientY-this._fsDragStartY;(Math.abs(t)>3||Math.abs(i)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+t,this._fsPanY=this._fsPanStartY+i,this.requestUpdate()},this._onFsPanEnd=()=>{this._fsDragging=!1,requestAnimationFrame(()=>{this._fsDragDidMove=!1})},this._onFsTouchStart=e=>{if(!this._fullscreenZoomed||e.touches.length!==1)return;const t=e.touches[0];this._fsDragging=!0,this._fsDragDidMove=!1,this._fsDragStartX=t.clientX,this._fsDragStartY=t.clientY,this._fsPanStartX=this._fsPanX,this._fsPanStartY=this._fsPanY},this._onFsTouchMove=e=>{if(!this._fsDragging||e.touches.length!==1)return;const t=e.touches[0],i=t.clientX-this._fsDragStartX,r=t.clientY-this._fsDragStartY;(Math.abs(i)>3||Math.abs(r)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+i,this._fsPanY=this._fsPanStartY+r,this.requestUpdate(),e.preventDefault()},this._onFsClose=e=>{e==null||e.stopPropagation(),this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0},this._store=Ee(),this._storeCtrl=new Fe(this,this._store)}open(){var e,t,i;this._isMinimized&&(this._isMinimized=!1,this._isPillExpanded=!1),!this._isOpen&&(this._isOpen=!0,(i=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onOpen)==null||i.call(t),this._dispatchPublic(g.OPEN,{}),this.requestUpdate())}close(){var e,t,i,r;this._isOpen&&(this._isOpen=!1,this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),((e=this.config)==null?void 0:e.clearOnClose)!==!1&&this._onClearAll(),this._previewFileId=null,(r=(i=(t=this.config)==null?void 0:t.callbacks)==null?void 0:i.onClose)==null||r.call(i),this._dispatchPublic(g.CLOSE,{}),this.requestUpdate())}upload(){var r,o,a,l,d,p,h;if(this._ensureEngine(),!this._engine){console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");return}const e=[...this._store.getState().files.values()].filter(u=>u.status==="idle"||u.status==="queued");if((o=(r=this.config)==null?void 0:r.callbacks)!=null&&o.onBeforeUpload&&this.config.callbacks.onBeforeUpload(e)===!1)return;const t=new CustomEvent(g.BEFORE_UPLOAD,{bubbles:!0,composed:!0,cancelable:!0,detail:{files:e}});this.dispatchEvent(t)&&(this._dispatchPublic(g.UPLOAD_STARTED,{files:e}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onUploadStarted)==null||d.call(l,e),this._engine.uploadAll(),(p=this.config)!=null&&p.minimizeOnUpload&&((h=this.config)==null?void 0:h.mode)!=="inline"&&(this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()))}addFiles(e){this._processIncomingFiles(e)}resumeUpload(e){var t;if(e&&e.length>0){const i=this._store.getState().files,r=new Map(i);let o=!1;for(const a of e){const l=i.get(a.id);l&&(r.set(a.id,{...l,...a}),o=!0)}o&&this._store.setState({files:r})}this._ensureEngine(),(t=this._engine)==null||t.uploadAll()}cancelUpload(){var e;(e=this._engine)==null||e.cancelAll()}getFiles(){return[...this._store.getState().files.values()]}getFile(e){return this._store.getState().files.get(e)}updateFileMeta(e,t,i){const r=this._store.getState().files,o=r.get(e);if(!o||!$._MODIFIABLE_STATUSES.has(o.status))return;const a=new Map(r);a.set(e,{...o,meta:t!=null?{...o.meta,...t}:o.meta,tags:i??o.tags}),this._store.setState({files:a})}updateFilesMeta(e){const t=this._store.getState().files,i=new Map(t);let r=!1;for(const{fileId:o,meta:a,tags:l}of e){const d=t.get(o);!d||!$._MODIFIABLE_STATUSES.has(d.status)||(i.set(o,{...d,meta:a!=null?{...d.meta,...a}:d.meta,tags:l??d.tags}),r=!0)}r&&this._store.setState({files:i})}updated(e){if(e.has("config")&&this.config&&this._applyConfig(this.config),e.has("_previewFileId")&&this._previewFileId){const t=this._previewFileId,i=this._store.getState().files.get(t);i?this._getImageDimensions(i).then(r=>{this._previewFileId===t&&(this._previewDims=r?`${r.w} × ${r.h}`:"—")}):this._previewDims="—"}this._updateFloatingPortal()}_injectFloatStyles(){if(document.querySelector("style[data-sfx-upload-float-styles]"))return;const e=document.createElement("style");e.setAttribute("data-sfx-upload-float-styles",""),e.textContent=`
2922
+ [data-sfx-upload-float] .upload-float { position:fixed; bottom:24px; right:24px; z-index:10000; width:470px; border-radius:12px; background:#fff; box-shadow:0 8px 32px rgba(0,0,0,0.12),0 2px 8px rgba(0,0,0,0.06); overflow:hidden; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; animation:sfxFloatIn .3s ease both; }
2835
2923
  [data-sfx-upload-float] .float-header { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; border-bottom:1px solid #e8edf5; }
2836
2924
  [data-sfx-upload-float] .float-header-left { display:flex; align-items:center; gap:8px; }
2837
2925
  [data-sfx-upload-float] .float-icon { width:28px; height:28px; border-radius:6px; background:#eff6ff; color:#2563eb; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
2838
2926
  [data-sfx-upload-float] .float-icon svg { width:14px; height:14px; }
2839
2927
  [data-sfx-upload-float] .float-icon.done { background:#f0fdf4; color:#22c55e; }
2840
2928
  [data-sfx-upload-float] .float-icon.warn { background:#fffbeb; color:#f59e0b; }
2929
+ [data-sfx-upload-float] .float-icon.error { background:#fef2f2; color:#ef4444; }
2841
2930
  [data-sfx-upload-float] .float-title { font-size:13px; font-weight:600; color:#1e293b; }
2842
2931
  [data-sfx-upload-float] .float-subtitle { font-size:11px; color:#94a3b8; }
2843
2932
  [data-sfx-upload-float] .float-actions { display:flex; gap:4px; }
@@ -2850,29 +2939,39 @@
2850
2939
  [data-sfx-upload-float] .float-progress-pct { font-size:12px; font-weight:600; color:#2563eb; }
2851
2940
  [data-sfx-upload-float] .float-progress-pct.done { color:#22c55e; }
2852
2941
  [data-sfx-upload-float] .float-progress-pct.warn { color:#f59e0b; }
2942
+ [data-sfx-upload-float] .float-progress-pct.error { color:#ef4444; }
2853
2943
  [data-sfx-upload-float] .float-bar { height:4px; background:#e8edf5; border-radius:2px; overflow:hidden; }
2854
2944
  [data-sfx-upload-float] .float-bar-fill { height:100%; background:#2563eb; border-radius:2px; transition:width .3s ease; }
2855
2945
  [data-sfx-upload-float] .float-bar-fill.done { background:#22c55e; }
2856
2946
  [data-sfx-upload-float] .float-bar-fill.warn { background:#f59e0b; }
2947
+ [data-sfx-upload-float] .float-bar-fill.error { background:#ef4444; }
2857
2948
  [data-sfx-upload-float] .float-items { max-height:200px; overflow-y:auto; }
2858
- [data-sfx-upload-float] .float-item { display:flex; align-items:center; gap:10px; padding:8px 14px; border-bottom:1px solid #f1f5f9; }
2949
+ [data-sfx-upload-float] .float-item { display:flex; align-items:center; gap:10px; padding:8px 14px; border-bottom:1px solid #f1f5f9; overflow:hidden; }
2859
2950
  [data-sfx-upload-float] .float-item:last-child { border-bottom:none; }
2860
2951
  [data-sfx-upload-float] .float-item-thumb { width:32px; height:32px; border-radius:6px; background:#f8fafc; display:flex; align-items:center; justify-content:center; color:#94a3b8; flex-shrink:0; }
2861
2952
  [data-sfx-upload-float] .float-item-thumb svg { width:16px; height:16px; }
2862
- [data-sfx-upload-float] .float-item-info { flex:1; min-width:0; }
2953
+ [data-sfx-upload-float] .float-item-info { flex:1; min-width:0; overflow:hidden; }
2863
2954
  [data-sfx-upload-float] .float-item-name { font-size:12px; font-weight:500; color:#1e293b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
2864
2955
  [data-sfx-upload-float] .float-item-size { font-size:11px; color:#94a3b8; }
2865
2956
  [data-sfx-upload-float] .float-item-done { width:18px; height:18px; border-radius:50%; background:#f0fdf4; color:#22c55e; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
2866
2957
  [data-sfx-upload-float] .float-item-done svg { width:12px; height:12px; }
2867
2958
  [data-sfx-upload-float] .float-item-spinner { width:16px; height:16px; border:2px solid #e8edf5; border-top-color:#2563eb; border-radius:50%; animation:sfxSpin .8s linear infinite; flex-shrink:0; }
2868
- [data-sfx-upload-float] .float-item-error { color:#ef4444; width:16px; height:16px; flex-shrink:0; cursor:help; }
2869
- [data-sfx-upload-float] .float-collapsed { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; width:320px; border-radius:12px; }
2959
+ [data-sfx-upload-float] .float-item-status { display:flex; flex-direction:row; align-items:center; gap:4px; flex-shrink:0; }
2960
+ [data-sfx-upload-float] .float-item-error-wrap { position:relative; display:flex; align-items:center; flex-shrink:0; }
2961
+ [data-sfx-upload-float] .float-item-error-icon { width:16px; height:16px; color:#ef4444; flex-shrink:0; cursor:pointer; }
2962
+ [data-sfx-upload-float] .float-item-tooltip { display:none; position:absolute; right:calc(100% + 8px); top:50%; transform:translateY(-50%); background:#fff; color:#1e293b; font-size:11px; padding:6px 10px; border-radius:6px; white-space:nowrap; pointer-events:none; z-index:10; box-shadow:0 2px 12px rgba(0,0,0,0.12),0 1px 4px rgba(0,0,0,0.08); }
2963
+ [data-sfx-upload-float] .float-item-error-wrap:hover .float-item-tooltip { display:block; }
2964
+ [data-sfx-upload-float] .float-item-retry { width:24px; height:24px; border:none; background:none; color:#2563eb; cursor:pointer; padding:4px; flex-shrink:0; display:flex; align-items:center; justify-content:center; border-radius:4px; }
2965
+ [data-sfx-upload-float] .float-item-retry svg { width:14px; height:14px; }
2966
+ [data-sfx-upload-float] .float-item-retry:hover { background:#f1f5f9; color:#1d4ed8; }
2967
+ [data-sfx-upload-float] .float-collapsed { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; width:470px; border-radius:12px; }
2870
2968
  [data-sfx-upload-float] .float-collapsed-left { display:flex; align-items:center; gap:8px; }
2871
2969
  [data-sfx-upload-float] .float-collapsed-spinner { width:18px; height:18px; border:2.5px solid #e8edf5; border-top-color:#2563eb; border-radius:50%; animation:sfxSpin .8s linear infinite; flex-shrink:0; }
2872
2970
  [data-sfx-upload-float] .float-collapsed-icon { width:18px; height:18px; flex-shrink:0; }
2873
2971
  [data-sfx-upload-float] .float-collapsed-icon svg { width:18px; height:18px; }
2874
2972
  [data-sfx-upload-float] .float-collapsed-icon.done { color:#22c55e; }
2875
2973
  [data-sfx-upload-float] .float-collapsed-icon.warn { color:#f59e0b; }
2974
+ [data-sfx-upload-float] .float-collapsed-icon.error { color:#ef4444; }
2876
2975
  [data-sfx-upload-float] .float-collapsed-text { font-size:13px; font-weight:500; color:#1e293b; white-space:nowrap; }
2877
2976
  [data-sfx-upload-float] .float-collapsed-pct { font-size:13px; font-weight:600; color:#2563eb; }
2878
2977
  [data-sfx-upload-float] .float-collapsed-actions { display:flex; gap:4px; }
@@ -2881,7 +2980,7 @@
2881
2980
  [data-sfx-upload-float] .float-collapsed-actions button svg { width:14px; height:14px; }
2882
2981
  @keyframes sfxFloatIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
2883
2982
  @keyframes sfxSpin { to{transform:rotate(360deg)} }
2884
- `,document.head.appendChild(e)}_updateFloatingPortal(){const e=[...this._storeCtrl.state.files.values()];this._isMinimized&&e.length>0?(this._injectFloatStyles(),this._portalContainer||(this._portalContainer=document.createElement("div"),this._portalContainer.setAttribute("data-sfx-upload-float",""),document.body.appendChild(this._portalContainer)),s.render(this._renderFloatingPill(e),this._portalContainer)):this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._onKeyDown),this._prevStoreState=this._store.getState(),this._unsubStoreEvents=this._store.subscribe(()=>this._onStoreChange())}disconnectedCallback(){var e,t,i,r;super.disconnectedCallback(),document.removeEventListener("keydown",this._onKeyDown),(e=this._unsubStoreEvents)==null||e.call(this),this._unsubStoreEvents=null,this._prevStoreState=null,(t=this._portalContainer)==null||t.remove(),this._portalContainer=null,document.querySelector("[data-sfx-upload-float]")||(i=document.querySelector("style[data-sfx-upload-float-styles]"))==null||i.remove(),this._revokeVideoBlobUrls();for(const o of this._rejectedTimers.values())clearTimeout(o);this._rejectedTimers.clear(),this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null);for(const o of this._store.getState().files.values())o.previewUrl&&URL.revokeObjectURL(o.previewUrl);(r=this._engine)==null||r.destroy(),this._engine=null}_applyConfig(e){const t={};if(e.targetFolder&&(t.targetFolder=e.targetFolder),e.restrictions&&(t.restrictions={...this._store.getState().restrictions,...e.restrictions}),e.concurrency!=null){const i=this._store.getState().queueConfig;t.queueConfig={...i,concurrency:e.concurrency}}if(e.autoProceed!=null){const i=t.queueConfig??this._store.getState().queueConfig;t.queueConfig={...i,autoProceed:e.autoProceed}}Object.keys(t).length>0&&this._store.setState(t),this._resolveAuthAndEngine(e),(e.mode==="inline"||!e.mode)&&(this._isOpen=!0)}async _resolveAuthAndEngine(e){var r,o;const t=e.auth;if(t.mode==="sass-key"){this._apiBase=te(t.container),this._authHeaders=K(t),this._ensureEngine(),(r=this._engine)==null||r.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders});return}const i=++this._authResolveId;try{const a=await Pe(t);if(i!==this._authResolveId)return;this._apiBase=a.apiBase,this._authHeaders=a.headers,this._ensureEngine(),(o=this._engine)==null||o.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders})}catch(a){if(i!==this._authResolveId)return;console.error("[sfx-uploader] Auth resolution failed:",a)}}_ensureEngine(){!this._engine&&this._apiBase&&this._authHeaders&&(this._engine=new Ue(this._store,{apiBase:this._apiBase,authHeaders:this._authHeaders}),this._engine.start())}_dispatchPublic(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}_onStoreChange(){var r,o,a,l,d,c,h,x;const e=this._store.getState(),t=this._prevStoreState;if(this._prevStoreState=e,!t)return;const i=(r=this.config)==null?void 0:r.callbacks;for(const[u,f]of e.files){const v=t.files.get(u);if(v){if(v.status!==f.status)switch(f.status){case"uploading":break;case"complete":f.response&&(this._dispatchPublic(g.UPLOAD_COMPLETE,{file:f,response:f.response}),(o=i==null?void 0:i.onUploadComplete)==null||o.call(i,f,f.response));break;case"error":case"failed":{const w=new Error(f.error??"Upload failed");this._dispatchPublic(g.UPLOAD_ERROR,{file:f,error:w}),(a=i==null?void 0:i.onUploadError)==null||a.call(i,f,w);break}case"retrying":this._dispatchPublic(g.UPLOAD_RETRY,{file:f,attempt:f.retryCount}),(l=i==null?void 0:i.onUploadRetry)==null||l.call(i,f,f.retryCount);break}f.status==="uploading"&&v.progress!==f.progress&&(this._dispatchPublic(g.UPLOAD_PROGRESS,{file:f,progress:f.progress,speed:f.speed}),(d=i==null?void 0:i.onUploadProgress)==null||d.call(i,f,f.progress,f.speed))}}if(e.totalProgress!==t.totalProgress||e.totalSpeed!==t.totalSpeed){const u=e.totalSpeed>0?(e.totalBytes-e.totalBytesUploaded)/e.totalSpeed:0;this._dispatchPublic(g.TOTAL_PROGRESS,{percentage:e.totalProgress,speed:e.totalSpeed,eta:u}),(c=i==null?void 0:i.onTotalProgress)==null||c.call(i,e.totalProgress,e.totalSpeed,u)}if(t.isUploading&&!e.isUploading){const u=[...e.files.values()];if(!u.some(v=>v.status==="cancelled")){const v=u.filter(b=>b.status==="complete"),w=u.filter(b=>b.status==="failed"||b.status==="error");this._dispatchPublic(g.ALL_COMPLETE,{successful:v,failed:w}),(h=i==null?void 0:i.onAllComplete)==null||h.call(i,v,w);const m=(x=this.config)==null?void 0:x.closeOnComplete;if(m){const b=typeof m=="number"?m:1500;this._closeOnCompleteTimer=setTimeout(()=>{var y,E,me;this._closeOnCompleteTimer=null,this._phase==="complete"&&(this._dispatchPublic(g.COMPLETE_ACTION,{}),(me=(E=(y=this.config)==null?void 0:y.callbacks)==null?void 0:E.onCompleteAction)==null||me.call(E),this.close())},b)}}}}get _mergedSources(){var d;const e=(d=this.config)==null?void 0:d.connectors;if(e===this._cachedSourcesConfig)return this._cachedSources;if(this._cachedSourcesConfig=e,!e)return this._cachedSources=A,this._cachedSources;const t=e.providers.length>0?De(e.providers):[],i=e.customSources??[],r=A.filter(c=>c.id==="device"||c.id==="url"),o=A.filter(c=>c.id!=="device"&&c.id!=="url"),a=new Set,l=[];for(const c of[...r,...t,...o,...i])if(!a.has(c.id)){if($._RESERVED_IDS.has(c.id)&&c.onActivate){console.warn(`[sfx-uploader] Custom source id "${c.id}" conflicts with a built-in source and was skipped.`);continue}a.add(c.id),l.push(c)}return this._cachedSources=l,this._cachedSources}get _phase(){const e=this._storeCtrl.state,t=[...e.files.values()];if(t.length===0)return"empty";if(e.isUploading)return"uploading";const i=new Set(["complete","rejected","cancelled","failed"]);return t.every(r=>i.has(r.status))&&t.some(r=>r.status==="complete"||r.status==="failed")?"complete":"ready"}_processIncomingFiles(e){var i,r,o,a;const t=(i=this.config)==null?void 0:i.callbacks;for(const l of e){const d=this._store.getState(),c=Ge(l,d.restrictions,d.files);if(c){const u=l.type.startsWith("image/")?URL.createObjectURL(l):null,f={id:B(),status:"rejected",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:u,duration:null,progress:0,speed:0,bytesUploaded:0,error:c,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};M(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:c}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,f,c);const v=(o=this.config)==null?void 0:o.rejectedFileAutoRemoveDelay,w=v===!1||v===0||v===void 0?0:v;if(w>0){const m=f.id,b=setTimeout(()=>{this._rejectedTimers.delete(m);const y=this._store.getState().files.get(m);y&&y.status==="rejected"&&be(this._store,m)},w);this._rejectedTimers.set(m,b)}continue}let h=null;l.type.startsWith("image/")&&(h=URL.createObjectURL(l));const x={id:B(),status:"idle",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:h,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};if(M(this._store,x),this._dispatchPublic(g.FILE_ADDED,{file:x}),(a=t==null?void 0:t.onFileAdded)==null||a.call(t,x),l.type.startsWith("video/")){We(l).then(f=>{if(!f)return;const v=this._store.getState(),w=v.files.get(x.id);if(w){const m=new Map(v.files);m.set(x.id,{...w,previewUrl:f}),this._store.setState({files:m})}else URL.revokeObjectURL(f)});const u=document.createElement("video");u.preload="metadata",u.src=URL.createObjectURL(l),u.onerror=()=>{URL.revokeObjectURL(u.src)},u.onloadedmetadata=()=>{const f=u.duration;if(URL.revokeObjectURL(u.src),!isFinite(f))return;const v=this._store.getState(),w=v.files.get(x.id);if(w){const m=new Map(v.files);m.set(x.id,{...w,duration:f}),this._store.setState({files:m})}}}}this._store.getState().queueConfig.autoProceed&&this.upload()}_removeFile(e){var o,a,l,d;const t=this._store.getState().files.get(e);if(!t)return;const i={...t};if((this._fullscreenPreviewUrl&&this._fullscreenPreviewUrl===t.previewUrl||this._fullscreenVideoFile&&this._fullscreenVideoFile===t.file)&&(this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null),t.previewUrl&&URL.revokeObjectURL(t.previewUrl),t.file){const c=this._videoBlobUrls.get(t.file);c&&(URL.revokeObjectURL(c),this._videoBlobUrls.delete(t.file))}(t.status==="uploading"||t.status==="queued"||t.status==="retrying")&&((o=this._engine)==null||o.cancelFile(e)),be(this._store,e),this._dimCache.delete(e);const r=this._rejectedTimers.get(e);if(r&&(clearTimeout(r),this._rejectedTimers.delete(e)),this._previewFileId===e){const c=[...this._store.getState().files.values()];this._previewFileId=c.length>0?c[0].id:null}this._dispatchPublic(g.FILE_REMOVED,{file:i}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onFileRemoved)==null||d.call(l,i)}render(){var t;const e=((t=this.config)==null?void 0:t.mode)??"modal";return[...this._storeCtrl.state.files.values()],e==="modal"?s.html`
2983
+ `,document.head.appendChild(e)}_updateFloatingPortal(){const e=[...this._storeCtrl.state.files.values()];this._isMinimized&&e.length>0?(this._injectFloatStyles(),this._portalContainer||(this._portalContainer=document.createElement("div"),this._portalContainer.setAttribute("data-sfx-upload-float",""),document.body.appendChild(this._portalContainer)),s.render(this._renderFloatingPill(e),this._portalContainer)):this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._onKeyDown),this._prevStoreState=this._store.getState(),this._unsubStoreEvents=this._store.subscribe(()=>this._onStoreChange())}disconnectedCallback(){var e,t,i,r;super.disconnectedCallback(),document.removeEventListener("keydown",this._onKeyDown),(e=this._unsubStoreEvents)==null||e.call(this),this._unsubStoreEvents=null,this._prevStoreState=null,(t=this._portalContainer)==null||t.remove(),this._portalContainer=null,document.querySelector("[data-sfx-upload-float]")||(i=document.querySelector("style[data-sfx-upload-float-styles]"))==null||i.remove(),this._revokeVideoBlobUrls();for(const o of this._rejectedTimers.values())clearTimeout(o);this._rejectedTimers.clear(),this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null);for(const o of this._store.getState().files.values())o.previewUrl&&URL.revokeObjectURL(o.previewUrl);(r=this._engine)==null||r.destroy(),this._engine=null}_applyConfig(e){const t={};if(e.targetFolder&&(t.targetFolder=e.targetFolder),e.restrictions&&(t.restrictions={...this._store.getState().restrictions,...e.restrictions}),e.concurrency!=null){const i=this._store.getState().queueConfig;t.queueConfig={...i,concurrency:e.concurrency}}if(e.autoProceed!=null){const i=t.queueConfig??this._store.getState().queueConfig;t.queueConfig={...i,autoProceed:e.autoProceed}}Object.keys(t).length>0&&this._store.setState(t),this._resolveAuthAndEngine(e),(e.mode==="inline"||!e.mode)&&(this._isOpen=!0)}async _resolveAuthAndEngine(e){var r,o;const t=e.auth;if(t.mode==="sass-key"){this._apiBase=te(t.container),this._authHeaders=K(t),this._ensureEngine(),(r=this._engine)==null||r.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders});return}const i=++this._authResolveId;try{const a=await ze(t);if(i!==this._authResolveId)return;this._apiBase=a.apiBase,this._authHeaders=a.headers,this._ensureEngine(),(o=this._engine)==null||o.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders})}catch(a){if(i!==this._authResolveId)return;console.error("[sfx-uploader] Auth resolution failed:",a)}}_ensureEngine(){!this._engine&&this._apiBase&&this._authHeaders&&(this._engine=new Ue(this._store,{apiBase:this._apiBase,authHeaders:this._authHeaders}),this._engine.start())}_dispatchPublic(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}_onStoreChange(){var r,o,a,l,d,p,h,u;const e=this._store.getState(),t=this._prevStoreState;if(this._prevStoreState=e,!t)return;const i=(r=this.config)==null?void 0:r.callbacks;for(const[x,f]of e.files){const v=t.files.get(x);if(v){if(v.status!==f.status)switch(f.status){case"uploading":break;case"complete":f.response&&(this._dispatchPublic(g.UPLOAD_COMPLETE,{file:f,response:f.response}),(o=i==null?void 0:i.onUploadComplete)==null||o.call(i,f,f.response));break;case"error":case"failed":{const w=new Error(f.error??"Upload failed");this._dispatchPublic(g.UPLOAD_ERROR,{file:f,error:w}),(a=i==null?void 0:i.onUploadError)==null||a.call(i,f,w);break}case"retrying":this._dispatchPublic(g.UPLOAD_RETRY,{file:f,attempt:f.retryCount}),(l=i==null?void 0:i.onUploadRetry)==null||l.call(i,f,f.retryCount);break}f.status==="uploading"&&v.progress!==f.progress&&(this._dispatchPublic(g.UPLOAD_PROGRESS,{file:f,progress:f.progress,speed:f.speed}),(d=i==null?void 0:i.onUploadProgress)==null||d.call(i,f,f.progress,f.speed))}}if(e.totalProgress!==t.totalProgress||e.totalSpeed!==t.totalSpeed){const x=e.totalSpeed>0?(e.totalBytes-e.totalBytesUploaded)/e.totalSpeed:0;this._dispatchPublic(g.TOTAL_PROGRESS,{percentage:e.totalProgress,speed:e.totalSpeed,eta:x}),(p=i==null?void 0:i.onTotalProgress)==null||p.call(i,e.totalProgress,e.totalSpeed,x)}if(t.isUploading&&!e.isUploading){const x=[...e.files.values()];if(!x.some(v=>v.status==="cancelled")){const v=x.filter(m=>m.status==="complete"),w=x.filter(m=>m.status==="failed"||m.status==="error");this._dispatchPublic(g.ALL_COMPLETE,{successful:v,failed:w}),(h=i==null?void 0:i.onAllComplete)==null||h.call(i,v,w);const b=(u=this.config)==null?void 0:u.closeOnComplete;if(b){const m=typeof b=="number"?b:1500;this._closeOnCompleteTimer=setTimeout(()=>{var y,E,be;this._closeOnCompleteTimer=null,this._phase==="complete"&&(this._dispatchPublic(g.COMPLETE_ACTION,{}),(be=(E=(y=this.config)==null?void 0:y.callbacks)==null?void 0:E.onCompleteAction)==null||be.call(E),this.close())},m)}}}}get _mergedSources(){var d;const e=(d=this.config)==null?void 0:d.connectors;if(e===this._cachedSourcesConfig)return this._cachedSources;if(this._cachedSourcesConfig=e,!e)return this._cachedSources=A,this._cachedSources;const t=e.providers.length>0?De(e.providers):[],i=e.customSources??[],r=A.filter(p=>p.id==="device"||p.id==="url"),o=A.filter(p=>p.id!=="device"&&p.id!=="url"),a=new Set,l=[];for(const p of[...r,...t,...o,...i])if(!a.has(p.id)){if($._RESERVED_IDS.has(p.id)&&p.onActivate){console.warn(`[sfx-uploader] Custom source id "${p.id}" conflicts with a built-in source and was skipped.`);continue}a.add(p.id),l.push(p)}return this._cachedSources=l,this._cachedSources}get _phase(){const e=this._storeCtrl.state,t=[...e.files.values()];if(t.length===0)return"empty";if(e.isUploading)return"uploading";const i=new Set(["complete","rejected","cancelled","failed"]);return t.every(r=>i.has(r.status))&&t.some(r=>r.status==="complete"||r.status==="failed")?"complete":"ready"}_processIncomingFiles(e){var i,r,o,a;const t=(i=this.config)==null?void 0:i.callbacks;for(const l of e){const d=this._store.getState(),p=Ge(l,d.restrictions,d.files);if(p){const x=l.type.startsWith("image/")?URL.createObjectURL(l):null,f={id:B(),status:"rejected",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:x,duration:null,progress:0,speed:0,bytesUploaded:0,error:p,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};T(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:p}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,f,p);const v=(o=this.config)==null?void 0:o.rejectedFileAutoRemoveDelay,w=v===!1||v===0||v===void 0?0:v;if(w>0){const b=f.id,m=setTimeout(()=>{this._rejectedTimers.delete(b);const y=this._store.getState().files.get(b);y&&y.status==="rejected"&&me(this._store,b)},w);this._rejectedTimers.set(b,m)}continue}let h=null;l.type.startsWith("image/")&&(h=URL.createObjectURL(l));const u={id:B(),status:"idle",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:h,duration:null,progress:0,speed:0,bytesUploaded:0,error:null,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};if(T(this._store,u),this._dispatchPublic(g.FILE_ADDED,{file:u}),(a=t==null?void 0:t.onFileAdded)==null||a.call(t,u),l.type.startsWith("video/")){We(l).then(f=>{if(!f)return;const v=this._store.getState(),w=v.files.get(u.id);if(w){const b=new Map(v.files);b.set(u.id,{...w,previewUrl:f}),this._store.setState({files:b})}else URL.revokeObjectURL(f)});const x=document.createElement("video");x.preload="metadata",x.src=URL.createObjectURL(l),x.onerror=()=>{URL.revokeObjectURL(x.src)},x.onloadedmetadata=()=>{const f=x.duration;if(URL.revokeObjectURL(x.src),!isFinite(f))return;const v=this._store.getState(),w=v.files.get(u.id);if(w){const b=new Map(v.files);b.set(u.id,{...w,duration:f}),this._store.setState({files:b})}}}}this._store.getState().queueConfig.autoProceed&&this.upload()}_removeFile(e){var o,a,l,d;const t=this._store.getState().files.get(e);if(!t)return;const i={...t};if((this._fullscreenPreviewUrl&&this._fullscreenPreviewUrl===t.previewUrl||this._fullscreenVideoFile&&this._fullscreenVideoFile===t.file)&&(this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null),t.previewUrl&&URL.revokeObjectURL(t.previewUrl),t.file){const p=this._videoBlobUrls.get(t.file);p&&(URL.revokeObjectURL(p),this._videoBlobUrls.delete(t.file))}(t.status==="uploading"||t.status==="queued"||t.status==="retrying")&&((o=this._engine)==null||o.cancelFile(e)),me(this._store,e),this._dimCache.delete(e);const r=this._rejectedTimers.get(e);if(r&&(clearTimeout(r),this._rejectedTimers.delete(e)),this._previewFileId===e){const p=[...this._store.getState().files.values()];this._previewFileId=p.length>0?p[0].id:null}this._dispatchPublic(g.FILE_REMOVED,{file:i}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onFileRemoved)==null||d.call(l,i)}render(){var t;const e=((t=this.config)==null?void 0:t.mode)??"modal";return[...this._storeCtrl.state.files.values()],e==="modal"?s.html`
2885
2984
  ${this._isOpen&&!this._isMinimized?s.html`
2886
2985
  <div class="modal-backdrop" @click=${this._onModalBackdropClick}>
2887
2986
  <div class="modal-card">
@@ -2895,15 +2994,15 @@
2895
2994
  ${this._renderHeader()}
2896
2995
  ${this._renderBody()}
2897
2996
  </div>
2898
- `}_renderHeader(){var a,l;if(this._phase==="complete")return s.nothing;if(this._phase==="uploading"){const d=this._storeCtrl.state,c=[...d.files.values()],h=c.filter(u=>u.status==="complete").length,x=d.totalSpeed>0?(d.totalBytes-d.totalBytesUploaded)/d.totalSpeed:0;return s.html`
2997
+ `}_renderHeader(){var a,l;if(this._phase==="complete")return s.nothing;if(this._phase==="uploading"){const d=this._storeCtrl.state,p=[...d.files.values()],h=p.filter(x=>x.status==="complete").length,u=d.totalSpeed>0?(d.totalBytes-d.totalBytesUploaded)/d.totalSpeed:0;return s.html`
2899
2998
  <div class="header upload-header">
2900
2999
  <div class="float-header-left">
2901
3000
  <div class="float-icon">
2902
3001
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><polyline points="16 16 12 12 8 16"/><line x1="12" y1="12" x2="12" y2="21"/><path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3"/></svg>
2903
3002
  </div>
2904
3003
  <div>
2905
- <div class="float-title">Uploading ${c.length} ${c.length===1?"file":"files"}</div>
2906
- <div class="float-subtitle">${h} of ${c.length}${x>0?` · ~${ie(x)} left`:""}</div>
3004
+ <div class="float-title">Uploading ${p.length} ${p.length===1?"file":"files"}</div>
3005
+ <div class="float-subtitle">${h} of ${p.length}${u>0?` · ~${ie(u)} left`:""}</div>
2907
3006
  </div>
2908
3007
  </div>
2909
3008
  </div>
@@ -2944,15 +3043,18 @@
2944
3043
  `}_renderFloatingPill(e){const t=this._storeCtrl.state,i=Math.round(t.totalProgress??0),r=this._phase==="complete",o=e.filter(d=>d.status==="complete").length,a=e.filter(d=>d.status==="failed").length,l=t.totalSpeed>0?(t.totalBytes-t.totalBytesUploaded)/t.totalSpeed:0;return this._isPillExpanded===!1?s.html`
2945
3044
  <div class="upload-float float-collapsed">
2946
3045
  <div class="float-collapsed-left">
2947
- ${r?a>0?s.html`<div class="float-collapsed-icon warn"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></div>`:s.html`<div class="float-collapsed-icon done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>`:s.html`<div class="float-collapsed-spinner"></div>`}
2948
- <span class="float-collapsed-text">${r?a>0?`${a} ${a===1?"file":"files"} not uploaded`:"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</span>
3046
+ ${r?a>0?o>0?s.html`<div class="float-collapsed-icon warn"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></div>`:s.html`<div class="float-collapsed-icon error"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg></div>`:s.html`<div class="float-collapsed-icon done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>`:s.html`<div class="float-collapsed-spinner"></div>`}
3047
+ <span class="float-collapsed-text">${r?a>0?o>0?"Partially uploaded":"Upload failed":"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</span>
2949
3048
  ${r?s.nothing:s.html`<span class="float-collapsed-pct">${i}%</span>`}
2950
3049
  </div>
2951
3050
  <div class="float-collapsed-actions">
3051
+ <button title="Open uploader" @click=${this._onPillExpand}>
3052
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
3053
+ </button>
2952
3054
  <button title="Expand" @click=${this._onPillClick}>
2953
3055
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="18 15 12 9 6 15"/></svg>
2954
3056
  </button>
2955
- <button title="Dismiss" @click=${this._onPillDismiss}>
3057
+ <button title="Close" @click=${this._onPillDismiss}>
2956
3058
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
2957
3059
  </button>
2958
3060
  </div>
@@ -2961,19 +3063,22 @@
2961
3063
  <div class="upload-float">
2962
3064
  <div class="float-header">
2963
3065
  <div class="float-header-left">
2964
- <div class="float-icon ${r?a>0?"warn":"done":""}">
2965
- ${r?a>0?s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><polyline points="16 16 12 12 8 16"/><line x1="12" y1="12" x2="12" y2="21"/><path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3"/></svg>`}
3066
+ <div class="float-icon ${r?a>0?o>0?"warn":"error":"done":""}">
3067
+ ${r?a>0?o>0?s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><polyline points="16 16 12 12 8 16"/><line x1="12" y1="12" x2="12" y2="21"/><path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3"/></svg>`}
2966
3068
  </div>
2967
3069
  <div>
2968
- <div class="float-title">${r?a>0?`${a} ${a===1?"file":"files"} not uploaded`:"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</div>
3070
+ <div class="float-title">${r?a>0?o>0?"Partially uploaded":"Upload failed":"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</div>
2969
3071
  <div class="float-subtitle">${r?`${o} ${o===1?"file":"files"} uploaded${a>0?`, ${a} failed`:""}`:`${o} of ${e.length}${l>0?` · ~${ie(l)} left`:""}`}</div>
2970
3072
  </div>
2971
3073
  </div>
2972
3074
  <div class="float-actions">
3075
+ <button title="Expand" @click=${this._onPillExpand}>
3076
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
3077
+ </button>
2973
3078
  <button title="Collapse" @click=${this._onPillClick}>
2974
3079
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="6 9 12 15 18 9"/></svg>
2975
3080
  </button>
2976
- <button title="Dismiss" @click=${this._onPillDismiss}>
3081
+ <button title="Close" @click=${this._onPillDismiss}>
2977
3082
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
2978
3083
  </button>
2979
3084
  </div>
@@ -2981,28 +3086,35 @@
2981
3086
  <div class="float-progress">
2982
3087
  <div class="float-progress-top">
2983
3088
  <span class="float-progress-label">Overall progress</span>
2984
- <span class="float-progress-pct ${r?a>0?"warn":"done":""}">${r?"Done":`${i}%`}</span>
3089
+ <span class="float-progress-pct ${r?a>0?o>0?"warn":"error":"done":""}">${r?"Done":`${i}%`}</span>
2985
3090
  </div>
2986
- <div class="float-bar"><div class="float-bar-fill ${r?a>0?"warn":"done":""}" style="width:${r?100:i}%"></div></div>
3091
+ <div class="float-bar"><div class="float-bar-fill ${r?a>0?o>0?"warn":"error":"done":""}" style="width:${r?100:i}%"></div></div>
2987
3092
  </div>
2988
3093
  <div class="float-items">
2989
- ${e.map(d=>s.html`
3094
+ ${e.map(d=>{const p=d.status==="failed"||d.status==="error";return s.html`
2990
3095
  <div class="float-item">
2991
- <div class="float-item-thumb">
2992
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>
3096
+ <div class="float-item-thumb" style=${d.previewUrl?`background-image:url(${d.previewUrl});background-size:cover;background-position:center`:""}>
3097
+ ${d.previewUrl?s.nothing:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`}
2993
3098
  </div>
2994
3099
  <div class="float-item-info">
2995
3100
  <div class="float-item-name">${d.name}</div>
2996
3101
  <div class="float-item-size">${R(d.size)}</div>
2997
3102
  </div>
2998
3103
  <div class="float-item-status">
2999
- ${d.status==="complete"?s.html`<div class="float-item-done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>`:d.status==="failed"||d.status==="error"?s.html`<svg class="float-item-error" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><title>${d.error||"Upload failed"}</title><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>`:s.html`<div class="float-item-spinner"></div>`}
3104
+ ${d.status==="complete"?s.html`<div class="float-item-done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>`:p?s.html`
3105
+ <div class="float-item-error-wrap">
3106
+ <svg class="float-item-error-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
3107
+ <span class="float-item-tooltip">${d.error||"Upload failed"}</span>
3108
+ </div>
3109
+ <button class="float-item-retry" @click=${()=>{var h;this._ensureEngine(),(h=this._engine)==null||h.retryFile(d.id)}}>
3110
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2v6h-6"/><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M3 22v-6h6"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/></svg>
3111
+ </button>`:s.html`<div class="float-item-spinner"></div>`}
3000
3112
  </div>
3001
3113
  </div>
3002
- `)}
3114
+ `})}
3003
3115
  </div>
3004
3116
  </div>
3005
- `}_renderPreviewLayout(e){var l;if(e.length===0)return s.nothing;const t=e.find(d=>d.id===this._previewFileId)??e[0],i=((l=t.name.split(".").pop())==null?void 0:l.toUpperCase())||"",r=new Date(t.addedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),o=this._store.getState().targetFolder,a=e.reduce((d,c)=>d+(c.size||0),0);return s.html`
3117
+ `}_renderPreviewLayout(e){var l;if(e.length===0)return s.nothing;const t=e.find(d=>d.id===this._previewFileId)??e[0],i=((l=t.name.split(".").pop())==null?void 0:l.toUpperCase())||"",r=new Date(t.addedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),o=this._store.getState().targetFolder,a=e.reduce((d,p)=>d+(p.size||0),0);return s.html`
3006
3118
  <div class="preview-topbar"></div>
3007
3119
  <div class="preview-layout">
3008
3120
  <div class="file-grid-side">
@@ -3135,10 +3247,13 @@
3135
3247
  >
3136
3248
  ${i==="complete"?s.html`
3137
3249
  <sfx-success-card
3138
- .fileCount=${t.filter(c=>c.status==="complete").length}
3139
- .totalSize=${t.filter(c=>c.status==="complete").reduce((c,h)=>c+(h.size||0),0)}
3140
- .thumbnails=${t.filter(c=>c.status==="complete"&&c.previewUrl).map(c=>c.previewUrl)}
3141
- .failedFiles=${t.filter(c=>c.status==="failed").map(c=>({name:c.name,error:c.error||"Upload failed"}))}
3250
+ .fileCount=${t.filter(p=>p.status==="complete").length}
3251
+ .totalSize=${t.filter(p=>p.status==="complete").reduce((p,h)=>p+(h.size||0),0)}
3252
+ .thumbnails=${t.filter(p=>p.status==="complete"&&p.previewUrl).map(p=>p.previewUrl)}
3253
+ .failedFiles=${t.filter(p=>p.status==="failed").map(p=>({id:p.id,name:p.name,error:p.error||"Upload failed"}))}
3254
+ @close-uploader=${this._onSuccessCardClose}
3255
+ @file-retry=${this._onFileRetry}
3256
+ @retry-all=${this._onRetryAll}
3142
3257
  ></sfx-success-card>
3143
3258
  `:i==="uploading"?this._renderUploadOverlay(t):s.html`
3144
3259
  ${o?s.nothing:s.html`<sfx-drop-zone
@@ -3150,7 +3265,7 @@
3150
3265
  ></sfx-drop-zone>`}
3151
3266
 
3152
3267
  ${o?this._previewFileId?this._renderPreviewLayout(t):s.html`
3153
- <div class="asset-count">${t.length} ${t.length===1?"file":"files"} · ${R(t.reduce((c,h)=>c+(h.size||0),0))}</div>
3268
+ <div class="asset-count">${t.length} ${t.length===1?"file":"files"} · ${R(t.reduce((p,h)=>p+(h.size||0),0))}</div>
3154
3269
  <sfx-file-list
3155
3270
  .files=${t}
3156
3271
  .showDropTile=${!0}
@@ -3166,9 +3281,9 @@
3166
3281
  <sfx-actions-bar
3167
3282
  .uploadState=${"idle"}
3168
3283
  .fileCount=${t.length}
3169
- .totalSize=${t.reduce((c,h)=>c+(h.size||0),0)}
3170
- .failedCount=${t.filter(c=>c.status==="failed"||c.status==="error").length}
3171
- .completedCount=${t.filter(c=>c.status==="complete").length}
3284
+ .totalSize=${t.reduce((p,h)=>p+(h.size||0),0)}
3285
+ .failedCount=${t.filter(p=>p.status==="failed"||p.status==="error").length}
3286
+ .completedCount=${t.filter(p=>p.status==="complete").length}
3172
3287
  .uploadProgress=${e.totalProgress??0}
3173
3288
  .showFillMetadata=${!!((l=this.config)!=null&&l.showFillMetadata)}
3174
3289
  ></sfx-actions-bar>
@@ -3207,7 +3322,7 @@
3207
3322
  @touchmove=${this._onFsTouchMove}
3208
3323
  @touchend=${this._onFsPanEnd}
3209
3324
  >
3210
- <div class="fs-toolbar" @click=${c=>c.stopPropagation()}>
3325
+ <div class="fs-toolbar" @click=${p=>p.stopPropagation()}>
3211
3326
  <button class="fs-btn" @click=${this._onFsToggleZoom} title="${this._fullscreenZoomed?"Zoom out":"Zoom in"}">
3212
3327
  ${this._fullscreenZoomed?s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/></svg>`:s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>`}
3213
3328
  </button>
@@ -3222,7 +3337,7 @@
3222
3337
  src=${this._getVideoBlobUrl(this._fullscreenVideoFile)}
3223
3338
  controls playsinline
3224
3339
  draggable="false"
3225
- @click=${c=>c.stopPropagation()}
3340
+ @click=${p=>p.stopPropagation()}
3226
3341
  ></video>`:s.html`<img
3227
3342
  class="fs-img"
3228
3343
  src=${this._fullscreenPreviewUrl}
@@ -3230,10 +3345,10 @@
3230
3345
  style=${this._fullscreenZoomed?`transform: scale(2) translate(${this._fsPanX}px, ${this._fsPanY}px)`:""}
3231
3346
  draggable="false"
3232
3347
  />`}
3233
- <button class="fs-nav prev" @click=${c=>{c.stopPropagation(),this._navigateFs(-1)}}>
3348
+ <button class="fs-nav prev" @click=${p=>{p.stopPropagation(),this._navigateFs(-1)}}>
3234
3349
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="15 18 9 12 15 6"/></svg>
3235
3350
  </button>
3236
- <button class="fs-nav next" @click=${c=>{c.stopPropagation(),this._navigateFs(1)}}>
3351
+ <button class="fs-nav next" @click=${p=>{p.stopPropagation(),this._navigateFs(1)}}>
3237
3352
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="9 6 15 12 9 18"/></svg>
3238
3353
  </button>
3239
3354
  </div>
@@ -3536,19 +3651,11 @@
3536
3651
  }
3537
3652
 
3538
3653
  .preview-layout .file-grid-side::after {
3539
- content: '';
3540
- position: absolute;
3541
- top: 0;
3542
- bottom: 0;
3543
- right: 14px;
3544
- width: 1px;
3545
- background: var(--sfx-up-border, #e8edf5);
3546
- pointer-events: none;
3547
- z-index: 3;
3654
+ display: none;
3548
3655
  }
3549
3656
 
3550
3657
  .preview-layout sfx-file-list {
3551
- padding-right: 16px;
3658
+ padding-right: 6px;
3552
3659
  --sfx-scrollbar-w: 14px;
3553
3660
  --sfx-scrollbar-inset-left: 2px;
3554
3661
  --sfx-scrollbar-inset-right: 6px;
@@ -3839,6 +3946,7 @@
3839
3946
  flex: 1;
3840
3947
  gap: 8px;
3841
3948
  padding: 32px 24px;
3949
+ position: relative;
3842
3950
  animation: fadeUp 0.3s ease both;
3843
3951
  }
3844
3952
 
@@ -3943,7 +4051,7 @@
3943
4051
  bottom: 24px;
3944
4052
  right: 24px;
3945
4053
  z-index: 10000;
3946
- width: 320px;
4054
+ width: 470px;
3947
4055
  border-radius: 12px;
3948
4056
  background: var(--sfx-up-bg, #fff);
3949
4057
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
@@ -3985,6 +4093,11 @@
3985
4093
  color: #22c55e;
3986
4094
  }
3987
4095
 
4096
+ .float-icon.error {
4097
+ background: #fef2f2;
4098
+ color: #ef4444;
4099
+ }
4100
+
3988
4101
  .float-title {
3989
4102
  font-size: 13px;
3990
4103
  font-weight: 600;
@@ -4046,9 +4159,9 @@
4046
4159
  color: var(--sfx-up-primary, #2563eb);
4047
4160
  }
4048
4161
 
4049
- .float-progress-pct.done {
4050
- color: #22c55e;
4051
- }
4162
+ .float-progress-pct.done { color: #22c55e; }
4163
+ .float-progress-pct.warn { color: #f59e0b; }
4164
+ .float-progress-pct.error { color: #ef4444; }
4052
4165
 
4053
4166
  .float-bar {
4054
4167
  height: 4px;
@@ -4064,13 +4177,14 @@
4064
4177
  transition: width 0.3s ease;
4065
4178
  }
4066
4179
 
4067
- .float-bar-fill.done {
4068
- background: #22c55e;
4069
- }
4180
+ .float-bar-fill.done { background: #22c55e; }
4181
+ .float-bar-fill.warn { background: #f59e0b; }
4182
+ .float-bar-fill.error { background: #ef4444; }
4070
4183
 
4071
4184
  .float-items {
4072
4185
  max-height: 200px;
4073
4186
  overflow-y: auto;
4187
+ overflow-x: hidden;
4074
4188
  scrollbar-width: thin;
4075
4189
  scrollbar-color: rgba(0,0,0,0.1) transparent;
4076
4190
  }
@@ -4081,6 +4195,7 @@
4081
4195
  gap: 10px;
4082
4196
  padding: 8px 14px;
4083
4197
  border-bottom: 1px solid #f1f5f9;
4198
+ overflow: hidden;
4084
4199
  }
4085
4200
 
4086
4201
  .float-item:last-child { border-bottom: none; }
@@ -4099,7 +4214,7 @@
4099
4214
 
4100
4215
  .float-item-thumb svg { width: 16px; height: 16px; }
4101
4216
 
4102
- .float-item-info { flex: 1; min-width: 0; }
4217
+ .float-item-info { flex: 1; min-width: 0; overflow: hidden; }
4103
4218
 
4104
4219
  .float-item-name {
4105
4220
  font-size: 12px;
@@ -4139,13 +4254,69 @@
4139
4254
  flex-shrink: 0;
4140
4255
  }
4141
4256
 
4142
- .float-item-error {
4143
- color: #ef4444;
4257
+ .float-item-error-wrap {
4258
+ position: relative;
4259
+ display: flex;
4260
+ align-items: center;
4261
+ flex-shrink: 0;
4262
+ }
4263
+
4264
+ .float-item-error-icon {
4144
4265
  width: 16px;
4145
4266
  height: 16px;
4267
+ color: #ef4444;
4146
4268
  flex-shrink: 0;
4269
+ cursor: pointer;
4147
4270
  }
4148
4271
 
4272
+ .float-item-tooltip {
4273
+ display: none;
4274
+ position: absolute;
4275
+ right: calc(100% + 8px);
4276
+ top: 50%;
4277
+ transform: translateY(-50%);
4278
+ background: #fff;
4279
+ color: #1e293b;
4280
+ font-size: 11px;
4281
+ padding: 6px 10px;
4282
+ border-radius: 6px;
4283
+ white-space: nowrap;
4284
+ pointer-events: none;
4285
+ z-index: 10;
4286
+ box-shadow: 0 2px 12px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
4287
+ }
4288
+
4289
+ .float-item-error-wrap:hover .float-item-tooltip {
4290
+ display: block;
4291
+ }
4292
+
4293
+ .float-item-status {
4294
+ display: flex;
4295
+ flex-direction: row;
4296
+ align-items: center;
4297
+ gap: 4px;
4298
+ flex-shrink: 0;
4299
+ }
4300
+
4301
+ .float-item-retry {
4302
+ width: 24px;
4303
+ height: 24px;
4304
+ border: none;
4305
+ background: none;
4306
+ color: var(--sfx-up-primary, #2563eb);
4307
+ cursor: pointer;
4308
+ padding: 4px;
4309
+ flex-shrink: 0;
4310
+ display: flex;
4311
+ align-items: center;
4312
+ justify-content: center;
4313
+ border-radius: 4px;
4314
+ }
4315
+
4316
+ .float-item-retry svg { width: 16px; height: 16px; }
4317
+
4318
+ .float-item-retry:hover { background: var(--sfx-up-surface, #f8fafc); color: var(--sfx-up-primary-hover, #1d4ed8); }
4319
+
4149
4320
  @keyframes floatSlideIn {
4150
4321
  from { opacity: 0; transform: translateY(20px); }
4151
4322
  to { opacity: 1; transform: translateY(0); }
@@ -4404,4 +4575,4 @@
4404
4575
  .modal-card { min-height: auto; }
4405
4576
  .inline { min-height: auto; }
4406
4577
  }
4407
- `,$._MODIFIABLE_STATUSES=new Set(["idle","queued","rejected"]),$._RESERVED_IDS=new Set(["device","camera","url","screen-cast"]),$);k([p.property({attribute:!1})],_.prototype,"config");k([p.state()],_.prototype,"_isOpen");k([p.state()],_.prototype,"_activeConnector");k([p.state()],_.prototype,"_showUrlDialog");k([p.state()],_.prototype,"_showCameraDialog");k([p.state()],_.prototype,"_showScreenCastDialog");k([p.state()],_.prototype,"_previewFileId");k([p.state()],_.prototype,"_previewDims");k([p.state()],_.prototype,"_fullscreenPreviewUrl");k([p.state()],_.prototype,"_fullscreenVideoFile");k([p.state()],_.prototype,"_fullscreenZoomed");k([p.state()],_.prototype,"_bodyDragOver");k([p.state()],_.prototype,"_isMinimized");k([p.state()],_.prototype,"_isPillExpanded");let ht=_;exports.AuthExpiredError=ee;exports.CORE_SOURCES=A;exports.PublicEvents=g;exports.SfxActionsBar=z;exports.SfxCameraDialog=j;exports.SfxDropZone=C;exports.SfxFileItem=J;exports.SfxFileList=F;exports.SfxImportDivider=se;exports.SfxScreenCastDialog=T;exports.SfxSourcePills=Z;exports.SfxSuccessCard=O;exports.SfxUploader=ht;exports.SfxUrlDialog=I;exports.Store=Se;exports.UploadEngine=Ue;exports.buildAuthHeaders=K;exports.createStore=Ee;exports.exchangeSassKey=ze;exports.getApiBase=te;exports.getAuthUrl=Le;exports.getProviderSources=De;exports.listFiles=Me;exports.listNextPage=Be;exports.logout=Ie;exports.resolveAuth=Pe;exports.searchProvider=Re;
4578
+ `,$._MODIFIABLE_STATUSES=new Set(["idle","queued","rejected"]),$._RESERVED_IDS=new Set(["device","camera","url","screen-cast"]),$);k([c.property({attribute:!1})],_.prototype,"config");k([c.state()],_.prototype,"_isOpen");k([c.state()],_.prototype,"_activeConnector");k([c.state()],_.prototype,"_showUrlDialog");k([c.state()],_.prototype,"_showCameraDialog");k([c.state()],_.prototype,"_showScreenCastDialog");k([c.state()],_.prototype,"_previewFileId");k([c.state()],_.prototype,"_previewDims");k([c.state()],_.prototype,"_fullscreenPreviewUrl");k([c.state()],_.prototype,"_fullscreenVideoFile");k([c.state()],_.prototype,"_fullscreenZoomed");k([c.state()],_.prototype,"_bodyDragOver");k([c.state()],_.prototype,"_isMinimized");k([c.state()],_.prototype,"_isPillExpanded");let ht=_;exports.AuthExpiredError=ee;exports.CORE_SOURCES=A;exports.PublicEvents=g;exports.SfxActionsBar=P;exports.SfxCameraDialog=O;exports.SfxDropZone=C;exports.SfxFileItem=J;exports.SfxFileList=F;exports.SfxImportDivider=se;exports.SfxScreenCastDialog=M;exports.SfxSourcePills=Z;exports.SfxSuccessCard=j;exports.SfxUploader=ht;exports.SfxUrlDialog=I;exports.Store=Se;exports.UploadEngine=Ue;exports.buildAuthHeaders=K;exports.createStore=Ee;exports.exchangeSassKey=Pe;exports.getApiBase=te;exports.getAuthUrl=Le;exports.getProviderSources=De;exports.listFiles=Te;exports.listNextPage=Be;exports.logout=Ie;exports.resolveAuth=ze;exports.searchProvider=Re;