@scaleflex/uploader 0.2.1 → 0.2.2

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.
@@ -0,0 +1,4317 @@
1
+ "use strict";const s=require("lit"),c=require("lit/decorators.js"),S=require("lit/directives/unsafe-svg.js"),z=require("lit/directives/unsafe-html.js");class $e{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 $(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 O(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 Se(){return new $e({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 De{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 Fe(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.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 je(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.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 J(n){return{Accept:"application/json","Content-Type":"application/json","uppy-auth-token":n}}function I(n){return n.replace(/\/+$/,"")}const Me={"google-drive":"drive",dropbox:"dropbox",onedrive:"onedrive",box:"box",instagram:"instagram",facebook:"facebook",unsplash:"unsplash"};function Y(n){return Me[n]??n}function Le(n,e){const t=I(n),i=btoa(JSON.stringify({origin:window.location.origin})),r=Y(e);return`${t}/${r}/connect?state=${encodeURIComponent(i)}`}async function Oe(n,e,t,i=""){const r=I(n),o=i?`/${i}`:"",a=Y(e),l=await fetch(`${r}/${a}/list${o}`,{method:"GET",headers:J(t),credentials:"same-origin"});if(l.status===401)throw new Q;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=I(n),r=await fetch(`${i}/${t}`,{method:"GET",headers:J(e),credentials:"same-origin"});if(r.status===401)throw new Q;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=I(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 Te(n,e,t,i,r,o=!1){const a=I(n),l=Y(e),d=o?`${a}/search/${l}/get/${i}`:`${a}/${l}/get/${i}`,p=o?{Accept:"application/json","Content-Type":"application/json"}:J(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 Q;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 Ae(n,e,t){const i=I(n),r=Y(e),o=await fetch(`${i}/${r}/logout`,{method:"GET",headers:J(t),credentials:"same-origin"});return o.ok?o.json():{ok:!1,revoked:!1}}function Ie(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 Q extends Error{constructor(){super("Authentication expired"),this.name="AuthExpiredError"}}function He(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 Te(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=`${Ie(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=f=>{var x,b,v;if(!i)try{const _=JSON.parse(f.data);switch(_.action){case"progress":{const k=_.payload,P=k.bytesUploaded??0,H=k.bytesTotal??(t.size||1);e.onProgress(P,H);break}case"success":{const k=_.payload;if(r==null||r.close(),(x=k.response)!=null&&x.responseText)try{const P=JSON.parse(k.response.responseText);if(P.status==="success"){e.onComplete(P);return}e.onError(new Error(P.msg||"Upload failed"));return}catch{}e.onError(new Error("Upload completed but no valid response received"));break}case"error":{r==null||r.close();const k=_.payload;let P=((b=k.error)==null?void 0:b.message)||"Upload failed";if((v=k.response)!=null&&v.responseText)try{const H=JSON.parse(k.response.responseText);P=H.hint||H.msg||H.message||P}catch{}e.onError(new Error(P));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 Ee{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"?($(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"||($(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")&&$(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||!me(t.status)||(this.abortUpload(e),$(this.store,e,{status:"cancelled"}))}cancelAll(){const{files:e}=this.store.getState();for(const t of e.values())me(t.status)&&(this.abortUpload(t.id),$(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){$(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 x=(d-t)/u;r=r===0?x:.3*x+.7*r}t=d,i=h;const f=p>0?d/p*100:0;$(this.store,e.id,{progress:f,bytesUploaded:d,speed:r}),this.updateTotalProgress()};let l;e.remoteInfo?l=He(e,{...o,onProgress:a}):e.remoteUrl?l=je(e,o):l=Fe(e,{...o,onProgress:a}),this.activeUploads.set(e.id,l)}handleComplete(e,t){this.activeUploads.delete(e),$(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);$(this.store,e,{status:"retrying",error:t.message,retryCount:o});const l=setTimeout(()=>{this.retryTimers.delete(e),$(this.store,e,{status:"queued"}),this.processQueue()},a);this.retryTimers.set(e,l)}else $(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?i/t*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 me(n){return n==="queued"||n==="uploading"||n==="retrying"}function ee(n){return`https://api.filerobot.com/${n}`}async function Ue(n,e){const t=`${ee(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 G(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=ee(n.container);if(n.mode==="security-template"){const t=await Ue(n.container,n.securityTemplateId);return{apiBase:e,headers:G(n,t),sassKey:t}}return{apiBase:e,headers:G(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 qe=0;function B(){return`file-${Date.now()}-${++qe}`}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 Ye(n){const e=n.lastIndexOf(".");return e>=0?n.slice(e+1).toUpperCase():""}const Ve={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 Ne(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())??"";return Ve[e]||""}function Xe(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 We(n,e,t){return oe(n,e,t)}function we(n){return n.allowedFileTypes?n.allowedFileTypes.join(","):""}const ye={"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 ze(n){return n.filter(e=>e in ye).map(e=>ye[e])}var Ge=Object.defineProperty,Ke=(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&&Ge(e,t,r),r};const Ze='<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"/>',Je='<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"/>',Qe='<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"/>',et='<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"/>',T=[{id:"device",label:"My Device",icon:Ze,iconColor:"#2563eb"},{id:"url",label:"URL link",icon:Je,iconColor:"#16a34a"},{id:"camera",label:"Camera",icon:Qe,iconColor:"#7c3aed"},{id:"screen-cast",label:"Screen capture",icon:et,iconColor:"#ea580c"}],le=class le extends s.LitElement{constructor(){super(...arguments),this.sources=T}_handleClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}render(){return s.html`
2
+ ${this.sources.map(e=>s.html`
3
+ <button @click=${()=>this._handleClick(e)}>
4
+ ${e.brandHtml?z.unsafeHTML(e.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${S.unsafeSVG(e.icon)}</svg>`}
5
+ ${e.label}
6
+ </button>
7
+ `)}
8
+ `}};le.styles=s.css`
9
+ :host {
10
+ display: flex;
11
+ flex-wrap: wrap;
12
+ gap: 8px;
13
+ justify-content: center;
14
+ }
15
+
16
+ button {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ gap: 9px;
20
+ padding: 13px 24px;
21
+ border-radius: 50px;
22
+ border: 1.5px solid var(--sfx-up-border, #e8edf5);
23
+ background: var(--sfx-up-bg, #fff);
24
+ font-size: 14px;
25
+ font-weight: 500;
26
+ color: var(--sfx-up-text-secondary, #475569);
27
+ cursor: pointer;
28
+ transition: all 0.18s ease;
29
+ white-space: nowrap;
30
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
31
+ font-family: inherit;
32
+ }
33
+
34
+ button:hover {
35
+ border-color: var(--sfx-up-primary, #2563eb);
36
+ color: var(--sfx-up-primary, #2563eb);
37
+ background: var(--sfx-up-primary-bg, #eff6ff);
38
+ box-shadow: 0 2px 10px var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.18));
39
+ transform: translateY(-1px);
40
+ }
41
+
42
+ button:active {
43
+ transform: translateY(0) scale(0.98);
44
+ }
45
+
46
+ :host > button > svg {
47
+ width: 17px;
48
+ height: 17px;
49
+ flex-shrink: 0;
50
+ fill: none;
51
+ stroke: currentColor;
52
+ stroke-width: 2;
53
+ stroke-linecap: round;
54
+ }
55
+
56
+ :host > button > svg.fill-icon {
57
+ fill: currentColor;
58
+ stroke: none;
59
+ stroke-width: 0;
60
+ }
61
+
62
+ .brand-ico {
63
+ width: 20px;
64
+ height: 20px;
65
+ border-radius: 5px;
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ flex-shrink: 0;
70
+ line-height: 1;
71
+ }
72
+
73
+ .brand-ico svg {
74
+ width: auto;
75
+ height: auto;
76
+ fill: white;
77
+ stroke: none;
78
+ stroke-width: 0;
79
+ }
80
+ `;let K=le;Ke([c.property({type:Array})],K.prototype,"sources");var tt=Object.defineProperty,U=(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&&tt(e,t,r),r};const _e=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=_e,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,f;const e=(u=this.shadowRoot)==null?void 0:u.querySelector(".more-wrap > button"),t=(f=this.shadowRoot)==null?void 0:f.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=_e}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
+ <button
82
+ class="src-pill"
83
+ @click=${t=>{t.stopPropagation(),this._onSourceIconClick(e)}}
84
+ >
85
+ ${e.brandHtml?z.unsafeHTML(e.brandHtml):s.html`<span class="pill-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
86
+ ${s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${S.unsafeSVG(e.icon)}</svg>`}
87
+ </span>`}
88
+ ${e.label}
89
+ </button>
90
+ `}_renderCard(e){return s.html`
91
+ <button
92
+ class="src-card"
93
+ aria-label=${e.label}
94
+ @click=${t=>{t.stopPropagation(),this._onSourceIconClick(e)}}
95
+ >
96
+ ${e.brandHtml?s.html`<span class="card-ico">${z.unsafeHTML(e.brandHtml)}</span>`:s.html`<span class="card-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
97
+ ${s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${S.unsafeSVG(e.icon)}</svg>`}
98
+ </span>`}
99
+ <span class="card-label">${e.label}</span>
100
+ </button>
101
+ `}_renderMoreCard(e){return s.html`
102
+ <div class="more-wrap ${this._moreOpen?"open":""}">
103
+ <button class="src-card" @click=${t=>this._toggleMore(t)}>
104
+ <span class="card-ico" style="color: var(--sfx-up-text-muted, #94a3b8)">
105
+ <svg viewBox="0 0 24 24" style="fill: currentColor; stroke: none">
106
+ <circle cx="5" cy="12" r="2.5"/>
107
+ <circle cx="12" cy="12" r="2.5"/>
108
+ <circle cx="19" cy="12" r="2.5"/>
109
+ </svg>
110
+ </span>
111
+ <span class="card-label">More</span>
112
+ </button>
113
+ <div class="more-dropdown">
114
+ ${e.map(t=>s.html`
115
+ <button class="more-item" @click=${i=>this._onMoreItemClick(t,i)}>
116
+ <div class="more-item-ico">
117
+ ${t.brandHtml?z.unsafeHTML(t.brandHtml):t.iconColor?s.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${S.unsafeSVG(t.icon)}</svg>`:s.svg`<svg viewBox="0 0 24 24">${S.unsafeSVG(t.icon)}</svg>`}
118
+ </div>
119
+ ${t.label}
120
+ </button>
121
+ `)}
122
+ </div>
123
+ </div>
124
+ `}_renderMoreDropdown(e){return s.html`
125
+ <div class="more-wrap ${this._moreOpen?"open":""}">
126
+ <button class="more-pill" @click=${t=>this._toggleMore(t)}>
127
+ More
128
+ <svg class="more-chevron" viewBox="0 0 24 24"><polyline points="6 9 12 15 18 9"/></svg>
129
+ </button>
130
+ <div class="more-dropdown">
131
+ ${e.map(t=>s.html`
132
+ <button class="more-item" @click=${i=>this._onMoreItemClick(t,i)}>
133
+ <div class="more-item-ico">
134
+ ${t.brandHtml?z.unsafeHTML(t.brandHtml):t.iconColor?s.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${S.unsafeSVG(t.icon)}</svg>`:s.svg`<svg viewBox="0 0 24 24">${S.unsafeSVG(t.icon)}</svg>`}
135
+ </div>
136
+ ${t.label}
137
+ </button>
138
+ `)}
139
+ </div>
140
+ </div>
141
+ `}render(){const e=["drop-zone",this._dragOver||this.externalDragOver?"drag-over":"",this.compact?"compact":""].filter(Boolean).join(" "),t=this.sources.slice(0,this._visiblePills),i=this.sources.slice(this._visiblePills);return s.html`
142
+ <div
143
+ class=${e}
144
+ role="button"
145
+ tabindex="0"
146
+ aria-label="Drop files here or click to browse"
147
+ @dragenter=${this._onDragEnter}
148
+ @dragover=${this._onDragOver}
149
+ @dragleave=${this._onDragLeave}
150
+ @drop=${this._onDrop}
151
+ @click=${this._onClick}
152
+ @keydown=${this._onKeyDown}
153
+ >
154
+ <div class="dz-glow"></div>
155
+ <div class="rings">
156
+ <div class="ring"></div>
157
+ <div class="ring"></div>
158
+ <div class="core">
159
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
160
+ <polyline points="16 16 12 12 8 16" />
161
+ <line x1="12" y1="12" x2="12" y2="21" />
162
+ <path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3" />
163
+ </svg>
164
+ </div>
165
+ </div>
166
+
167
+ <div class="title">
168
+ Drag & Drop or click to <span>browse</span>
169
+ </div>
170
+ ${this.compact?s.nothing:s.html`<div class="subtitle">Drop files anywhere on this page</div>`}
171
+
172
+ ${!this.compact&&this.sources.length>0?s.html`
173
+ <div class="import-divider"><span>or import from</span></div>
174
+ ${this.sourcesLayout==="cards"?s.html`
175
+ <div class="sources-cards">
176
+ ${t.map(r=>this._renderCard(r))}
177
+ ${i.length>0?this._renderMoreCard(i):s.nothing}
178
+ </div>
179
+ `:s.html`
180
+ <div class="sources-grid">
181
+ ${t.map(r=>this._renderPill(r))}
182
+ ${i.length>0?this._renderMoreDropdown(i):s.nothing}
183
+ </div>
184
+ `}
185
+ `:s.nothing}
186
+
187
+ ${this.compact&&this.sources.length>0?s.html`
188
+ <div class="sources-row">
189
+ ${this.sources.map(r=>s.html`
190
+ <button
191
+ class="src-ico"
192
+ style=${r.iconColor&&!r.brandHtml?`color:${r.iconColor}`:""}
193
+ data-tip=${r.label}
194
+ aria-label=${r.label}
195
+ @click=${o=>{o.stopPropagation(),this._onSourceIconClick(r)}}
196
+ >
197
+ ${r.brandHtml?z.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${S.unsafeSVG(r.icon)}</svg>`}
198
+ </button>
199
+ `)}
200
+ </div>
201
+ `:s.nothing}
202
+
203
+ <div class="ripple"></div>
204
+ <input
205
+ type="file"
206
+ multiple
207
+ accept=${this.accept||s.nothing}
208
+ @change=${this._onFileChange}
209
+ />
210
+ </div>
211
+ `}};de.styles=s.css`
212
+ :host {
213
+ display: flex;
214
+ flex-shrink: 0;
215
+ flex: 1;
216
+ min-height: 0;
217
+ }
218
+
219
+ :host([compact]) {
220
+ flex: 0 0 auto;
221
+ }
222
+
223
+ .drop-zone {
224
+ border: none;
225
+ border-radius: 12px;
226
+ background: var(--sfx-up-bg, #fff);
227
+ padding: 50px 40px 50px;
228
+ display: flex;
229
+ flex-direction: column;
230
+ align-items: center;
231
+ justify-content: center;
232
+ text-align: center;
233
+ cursor: pointer;
234
+ position: relative;
235
+ overflow: visible;
236
+ transition: background 0.22s;
237
+ user-select: none;
238
+ flex: 1;
239
+ }
240
+
241
+ .drop-zone:hover {
242
+ background: transparent;
243
+ }
244
+
245
+ /* Drag over state */
246
+ .drop-zone.drag-over {
247
+ background: var(--sfx-up-primary-bg, #eff6ff);
248
+ }
249
+
250
+ .drag-over .ring {
251
+ border-color: var(--sfx-up-primary, #2563eb);
252
+ animation-duration: 3s;
253
+ }
254
+
255
+ .drag-over .ring:nth-child(2) {
256
+ border-color: var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.4));
257
+ animation-duration: 2s;
258
+ }
259
+
260
+ .drag-over .core {
261
+ background: var(--sfx-up-primary, #2563eb);
262
+ color: var(--sfx-up-bg, #fff);
263
+ transform: scale(1.12);
264
+ box-shadow: 0 8px 24px var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.38));
265
+ }
266
+
267
+ /* Compact state when files exist */
268
+ .drop-zone.compact {
269
+ padding: 14px 16px;
270
+ flex-direction: row;
271
+ align-items: center;
272
+ gap: 12px;
273
+ justify-content: flex-start;
274
+ overflow: visible;
275
+ border: 1.5px dashed var(--sfx-up-ring-color, #c4d5ef);
276
+ border-radius: 12px;
277
+ animation: compactIn 0.3s ease both;
278
+ }
279
+
280
+ @keyframes compactIn {
281
+ from {
282
+ opacity: 0;
283
+ transform: translateY(-8px);
284
+ }
285
+ to {
286
+ opacity: 1;
287
+ transform: translateY(0);
288
+ }
289
+ }
290
+
291
+ /* --- Radial glow --- */
292
+ .dz-glow {
293
+ position: absolute;
294
+ width: 260px;
295
+ height: 260px;
296
+ top: 20px;
297
+ left: 50%;
298
+ transform: translateX(-50%);
299
+ background: radial-gradient(circle at center, rgba(37, 99, 235, 0.04) 0%, rgba(37, 99, 235, 0.02) 40%, transparent 70%);
300
+ border-radius: 50%;
301
+ pointer-events: none;
302
+ z-index: 0;
303
+ }
304
+
305
+ .compact .dz-glow {
306
+ display: none;
307
+ }
308
+
309
+ /* --- Rings --- */
310
+ .rings {
311
+ width: 120px;
312
+ height: 120px;
313
+ position: relative;
314
+ display: flex;
315
+ align-items: center;
316
+ justify-content: center;
317
+ margin-bottom: 24px;
318
+ flex-shrink: 0;
319
+ }
320
+
321
+ .ring {
322
+ position: absolute;
323
+ inset: 0;
324
+ border-radius: 50%;
325
+ border: 1.5px dashed var(--sfx-up-ring-color, #c4d5ef);
326
+ animation: slowSpin 20s linear infinite;
327
+ transition: border-color 0.3s;
328
+ }
329
+
330
+ .ring:nth-child(2) {
331
+ inset: 13px;
332
+ border-color: var(--sfx-up-ring-color-light, #d8e5f5);
333
+ border-style: dotted;
334
+ animation-direction: reverse;
335
+ animation-duration: 14s;
336
+ }
337
+
338
+ .compact .rings {
339
+ display: none;
340
+ }
341
+
342
+ /* --- Core icon --- */
343
+ .core {
344
+ width: 58px;
345
+ height: 58px;
346
+ border-radius: 50%;
347
+ background: var(--sfx-up-primary-bg, #eff6ff);
348
+ color: var(--sfx-up-primary, #2563eb);
349
+ display: flex;
350
+ align-items: center;
351
+ justify-content: center;
352
+ z-index: 1;
353
+ transition: all 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
354
+ box-shadow: 0 3px 12px rgba(37, 99, 235, 0.15);
355
+ }
356
+
357
+ .core svg {
358
+ width: 26px;
359
+ height: 26px;
360
+ }
361
+
362
+ .drop-zone:hover .core {
363
+ transform: translateY(-2px);
364
+ box-shadow: 0 5px 18px rgba(37, 99, 235, 0.22);
365
+ }
366
+
367
+ /* --- Text --- */
368
+ .title {
369
+ font-size: 20px;
370
+ font-weight: 700;
371
+ color: var(--sfx-up-text, #1e293b);
372
+ margin-bottom: 6px;
373
+ transition: font-size 0.3s, margin 0.3s;
374
+ }
375
+
376
+ .title span {
377
+ color: var(--sfx-up-primary, #2563eb);
378
+ cursor: pointer;
379
+ }
380
+
381
+ .subtitle {
382
+ font-size: 14px;
383
+ color: var(--sfx-up-text-muted, #94a3b8);
384
+ transition: opacity 0.15s;
385
+ margin-bottom: 24px;
386
+ }
387
+
388
+ .compact .title {
389
+ font-size: 14px;
390
+ font-weight: 600;
391
+ margin-bottom: 0;
392
+ white-space: nowrap;
393
+ overflow: hidden;
394
+ text-overflow: ellipsis;
395
+ }
396
+
397
+ .compact .subtitle {
398
+ display: none;
399
+ }
400
+
401
+ /* --- "or Import From" divider --- */
402
+ .import-divider {
403
+ display: flex;
404
+ align-items: center;
405
+ gap: 12px;
406
+ width: 100%;
407
+ max-width: 420px;
408
+ margin-bottom: 20px;
409
+ }
410
+
411
+ .import-divider::before,
412
+ .import-divider::after {
413
+ content: '';
414
+ flex: 1;
415
+ height: 1px;
416
+ background: var(--sfx-up-border, #e2e8f0);
417
+ }
418
+
419
+ .import-divider span {
420
+ font-size: 12px;
421
+ font-weight: 500;
422
+ color: var(--sfx-up-text-muted, #94a3b8);
423
+ white-space: nowrap;
424
+ letter-spacing: 0.3px;
425
+ }
426
+
427
+ .compact .import-divider {
428
+ display: none;
429
+ }
430
+
431
+ /* --- Source pills grid (expanded mode) --- */
432
+ .sources-grid {
433
+ display: flex;
434
+ justify-content: center;
435
+ align-items: center;
436
+ gap: 8px;
437
+ flex-wrap: wrap;
438
+ min-height: 92px;
439
+ }
440
+
441
+ .compact .sources-grid {
442
+ display: none;
443
+ }
444
+
445
+ .src-pill {
446
+ display: inline-flex;
447
+ align-items: center;
448
+ gap: 8px;
449
+ padding: 9px 18px;
450
+ height: 38px;
451
+ box-sizing: border-box;
452
+ border-radius: 50px;
453
+ border: 1.5px solid rgba(226, 232, 240, 0.6);
454
+ background: rgba(255, 255, 255, 0.7);
455
+ backdrop-filter: blur(8px);
456
+ -webkit-backdrop-filter: blur(8px);
457
+ font-size: 14px;
458
+ font-weight: 500;
459
+ color: var(--sfx-up-text-secondary, #475569);
460
+ cursor: pointer;
461
+ transition: all 0.15s ease;
462
+ white-space: nowrap;
463
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
464
+ font-family: inherit;
465
+ }
466
+
467
+ .src-pill:hover {
468
+ border-color: var(--sfx-up-primary, #2563eb);
469
+ color: var(--sfx-up-primary, #2563eb);
470
+ background: rgba(239, 246, 255, 0.85);
471
+ box-shadow: 0 2px 10px var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.18));
472
+ transform: translateY(-1px);
473
+ }
474
+
475
+ .src-pill:active {
476
+ transform: translateY(0) scale(0.98);
477
+ }
478
+
479
+ .src-pill .pill-ico {
480
+ display: flex;
481
+ align-items: center;
482
+ justify-content: center;
483
+ flex-shrink: 0;
484
+ }
485
+
486
+ .src-pill .pill-ico svg {
487
+ width: 16px;
488
+ height: 16px;
489
+ flex-shrink: 0;
490
+ fill: none;
491
+ stroke: currentColor;
492
+ stroke-width: 2;
493
+ stroke-linecap: round;
494
+ }
495
+
496
+ .src-pill .pill-ico svg.fill-icon {
497
+ fill: currentColor;
498
+ stroke: none;
499
+ stroke-width: 0;
500
+ }
501
+
502
+ .src-pill .brand-ico svg {
503
+ width: auto;
504
+ height: auto;
505
+ fill: white;
506
+ stroke: none;
507
+ stroke-width: 0;
508
+ }
509
+
510
+ .src-pill .canva-ico {
511
+ width: 22px;
512
+ height: 22px;
513
+ }
514
+
515
+ .src-pill .canva-ico svg {
516
+ width: 22px;
517
+ height: 22px;
518
+ }
519
+
520
+ /* --- Source cards grid (expanded mode, cards layout) --- */
521
+ .sources-cards {
522
+ display: flex;
523
+ justify-content: center;
524
+ gap: 10px;
525
+ flex-wrap: wrap;
526
+ width: 100%;
527
+ max-width: 700px;
528
+ }
529
+
530
+ .compact .sources-cards {
531
+ display: none;
532
+ }
533
+
534
+ .sources-cards > .more-wrap {
535
+ display: contents;
536
+ }
537
+
538
+ .sources-cards > .more-wrap > .src-card {
539
+ /* restore flex item behaviour lost by display:contents on the wrapper */
540
+ flex: 1;
541
+ min-width: 88px;
542
+ max-width: 130px;
543
+ }
544
+
545
+ .src-card {
546
+ display: flex;
547
+ flex-direction: column;
548
+ align-items: center;
549
+ justify-content: center;
550
+ gap: 10px;
551
+ padding: 20px 12px 16px;
552
+ border-radius: 16px;
553
+ border: 1.5px solid rgba(226, 232, 240, 0.6);
554
+ background: rgba(255, 255, 255, 0.7);
555
+ backdrop-filter: blur(8px);
556
+ -webkit-backdrop-filter: blur(8px);
557
+ cursor: pointer;
558
+ transition: all 0.18s ease;
559
+ flex: 1;
560
+ min-width: 88px;
561
+ max-width: 130px;
562
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
563
+ font-family: inherit;
564
+ }
565
+
566
+ .src-card:hover {
567
+ border-color: var(--sfx-up-primary, #2563eb);
568
+ background: rgba(239, 246, 255, 0.85);
569
+ box-shadow: 0 4px 14px var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.18));
570
+ transform: translateY(-2px);
571
+ }
572
+
573
+ .src-card:active {
574
+ transform: translateY(0) scale(0.97);
575
+ }
576
+
577
+ .src-card .card-ico {
578
+ display: flex;
579
+ align-items: center;
580
+ justify-content: center;
581
+ flex-shrink: 0;
582
+ width: 28px;
583
+ height: 28px;
584
+ }
585
+
586
+ .src-card .card-ico svg {
587
+ width: 28px;
588
+ height: 28px;
589
+ fill: none;
590
+ stroke: currentColor;
591
+ stroke-width: 2;
592
+ stroke-linecap: round;
593
+ }
594
+
595
+ .src-card .card-ico svg.fill-icon {
596
+ fill: currentColor;
597
+ stroke: none;
598
+ stroke-width: 0;
599
+ }
600
+
601
+ .src-card .card-label {
602
+ font-size: 12px;
603
+ font-weight: 500;
604
+ color: var(--sfx-up-text-secondary, #475569);
605
+ white-space: nowrap;
606
+ overflow: hidden;
607
+ text-overflow: ellipsis;
608
+ max-width: 100%;
609
+ }
610
+
611
+ .src-card .brand-ico {
612
+ width: 28px;
613
+ height: 28px;
614
+ border-radius: 7px;
615
+ }
616
+
617
+ .src-card .brand-ico svg {
618
+ width: 24px;
619
+ height: 24px;
620
+ fill: white;
621
+ stroke: none;
622
+ stroke-width: 0;
623
+ }
624
+
625
+ /* Google Drive has transparent background — show SVG at full card-ico size */
626
+ .src-card .brand-ico[style*="transparent"] {
627
+ background: none !important;
628
+ width: auto;
629
+ height: auto;
630
+ }
631
+
632
+ .src-card .brand-ico[style*="transparent"] svg {
633
+ width: 28px;
634
+ height: 28px;
635
+ }
636
+
637
+ .src-card .canva-ico {
638
+ width: 32px;
639
+ height: 32px;
640
+ }
641
+
642
+ .src-card .canva-ico svg {
643
+ width: 32px;
644
+ height: 32px;
645
+ }
646
+
647
+ /* --- "More" pill + dropdown --- */
648
+ .more-wrap {
649
+ position: relative;
650
+ }
651
+
652
+ .more-pill {
653
+ display: inline-flex;
654
+ align-items: center;
655
+ gap: 6px;
656
+ padding: 9px 18px;
657
+ border-radius: 50px;
658
+ border: 1.5px solid rgba(226, 232, 240, 0.6);
659
+ background: rgba(255, 255, 255, 0.7);
660
+ backdrop-filter: blur(8px);
661
+ -webkit-backdrop-filter: blur(8px);
662
+ font-size: 14px;
663
+ font-weight: 500;
664
+ color: var(--sfx-up-text-secondary, #475569);
665
+ cursor: pointer;
666
+ transition: all 0.15s ease;
667
+ white-space: nowrap;
668
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
669
+ font-family: inherit;
670
+ }
671
+
672
+ .more-pill:hover,
673
+ .more-wrap.open .more-pill {
674
+ border-color: var(--sfx-up-primary, #2563eb);
675
+ color: var(--sfx-up-primary, #2563eb);
676
+ background: rgba(239, 246, 255, 0.85);
677
+ box-shadow: 0 2px 10px var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.18));
678
+ }
679
+
680
+ .more-pill:hover {
681
+ transform: translateY(-1px);
682
+ }
683
+
684
+ .more-pill svg {
685
+ flex-shrink: 0;
686
+ fill: none;
687
+ stroke: currentColor;
688
+ stroke-width: 2.2;
689
+ stroke-linecap: round;
690
+ }
691
+
692
+ .more-chevron {
693
+ width: 12px;
694
+ height: 12px;
695
+ color: var(--sfx-up-text-muted, #94a3b8);
696
+ transition: transform 0.18s ease;
697
+ }
698
+
699
+ .more-wrap.open .more-chevron {
700
+ transform: rotate(180deg);
701
+ color: currentColor;
702
+ }
703
+
704
+ /* Dropdown uses position:fixed to escape overflow:hidden ancestors */
705
+ .more-dropdown {
706
+ position: fixed;
707
+ background: var(--sfx-up-bg, #fff);
708
+ border-radius: 12px;
709
+ box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
710
+ border: 1px solid var(--sfx-up-border, #e8edf5);
711
+ padding: 6px;
712
+ min-width: 210px;
713
+ max-height: 340px;
714
+ overflow-y: auto;
715
+ z-index: 99999;
716
+ opacity: 0;
717
+ visibility: hidden;
718
+ pointer-events: none;
719
+ transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
720
+ }
721
+
722
+ .more-dropdown.above {
723
+ transform: translateY(-6px);
724
+ }
725
+
726
+ .more-dropdown.below {
727
+ transform: translateY(6px);
728
+ }
729
+
730
+ .more-wrap.open .more-dropdown {
731
+ opacity: 1;
732
+ visibility: visible;
733
+ pointer-events: all;
734
+ transform: translateY(0);
735
+ }
736
+
737
+ .more-item {
738
+ display: flex;
739
+ align-items: center;
740
+ gap: 10px;
741
+ padding: 10px 14px;
742
+ border-radius: 6px;
743
+ border: none;
744
+ background: none;
745
+ width: 100%;
746
+ font-size: 13px;
747
+ font-weight: 500;
748
+ color: var(--sfx-up-text, #1e293b);
749
+ cursor: pointer;
750
+ transition: background 0.15s;
751
+ font-family: inherit;
752
+ white-space: nowrap;
753
+ }
754
+
755
+ .more-item:hover {
756
+ background: var(--sfx-up-primary-bg, #f5f7fa);
757
+ }
758
+
759
+ .more-item .more-item-ico {
760
+ width: 32px;
761
+ height: 32px;
762
+ border-radius: 8px;
763
+ background: var(--sfx-up-surface, #f8fafc);
764
+ display: flex;
765
+ align-items: center;
766
+ justify-content: center;
767
+ flex-shrink: 0;
768
+ }
769
+
770
+ .more-item .more-item-ico svg {
771
+ width: 16px;
772
+ height: 16px;
773
+ fill: none;
774
+ stroke: currentColor;
775
+ stroke-width: 2;
776
+ stroke-linecap: round;
777
+ }
778
+
779
+ .more-item .brand-ico {
780
+ width: 20px;
781
+ height: 20px;
782
+ border-radius: 5px;
783
+ display: flex;
784
+ align-items: center;
785
+ justify-content: center;
786
+ flex-shrink: 0;
787
+ }
788
+
789
+ .more-item .brand-ico svg {
790
+ fill: white;
791
+ stroke: none;
792
+ stroke-width: 0;
793
+ }
794
+
795
+ /* --- Brand icon container (for provider logos) --- */
796
+ .brand-ico {
797
+ width: 20px;
798
+ height: 20px;
799
+ border-radius: 5px;
800
+ display: flex;
801
+ align-items: center;
802
+ justify-content: center;
803
+ flex-shrink: 0;
804
+ line-height: 1;
805
+ }
806
+
807
+ .src-ico .brand-ico {
808
+ width: 20px;
809
+ height: 20px;
810
+ border-radius: 5px;
811
+ }
812
+
813
+ .src-ico .brand-ico svg {
814
+ width: 12px;
815
+ height: 12px;
816
+ stroke: none;
817
+ stroke-width: 0;
818
+ }
819
+
820
+ .src-ico .canva-ico,
821
+ .more-item .canva-ico {
822
+ width: 22px;
823
+ height: 22px;
824
+ }
825
+
826
+ .src-ico .canva-ico svg,
827
+ .more-item .canva-ico svg {
828
+ width: 22px;
829
+ height: 22px;
830
+ }
831
+
832
+ /* --- Source icons row (compact mode) --- */
833
+ .sources-row {
834
+ display: none;
835
+ }
836
+
837
+ .compact .sources-row {
838
+ display: flex;
839
+ align-items: center;
840
+ gap: 6px;
841
+ margin-left: auto;
842
+ flex-shrink: 0;
843
+ position: relative;
844
+ z-index: 20;
845
+ }
846
+
847
+ .src-divider {
848
+ width: 1px;
849
+ height: 24px;
850
+ background: var(--sfx-up-border, #e5e7eb);
851
+ margin-right: 4px;
852
+ flex-shrink: 0;
853
+ }
854
+
855
+ .src-ico {
856
+ width: 36px;
857
+ height: 36px;
858
+ border-radius: 8px;
859
+ border: 1.5px solid var(--sfx-up-border, #e2e8f0);
860
+ background: var(--sfx-up-surface, #f8fafc);
861
+ cursor: pointer;
862
+ display: flex;
863
+ align-items: center;
864
+ justify-content: center;
865
+ transition: all 0.15s ease;
866
+ position: relative;
867
+ flex-shrink: 0;
868
+ color: var(--sfx-up-text-muted, #6b7280);
869
+ padding: 0;
870
+ font-family: inherit;
871
+ }
872
+
873
+ .src-ico > svg {
874
+ width: 15px;
875
+ height: 15px;
876
+ fill: none;
877
+ stroke: currentColor;
878
+ stroke-width: 2;
879
+ stroke-linecap: round;
880
+ }
881
+
882
+ .src-ico > svg.fill-icon {
883
+ fill: currentColor;
884
+ stroke: none;
885
+ stroke-width: 0;
886
+ }
887
+
888
+ .src-ico:hover {
889
+ border-color: var(--sfx-up-primary, #2563eb);
890
+ background: var(--sfx-up-primary-bg, #eff6ff);
891
+ transform: translateY(-1px);
892
+ box-shadow: 0 2px 8px var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.18));
893
+ color: var(--sfx-up-primary, #2563eb);
894
+ }
895
+
896
+ .src-ico::after {
897
+ content: attr(data-tip);
898
+ position: absolute;
899
+ bottom: -28px;
900
+ left: 50%;
901
+ transform: translateX(-50%);
902
+ background: var(--sfx-up-bg, #fff);
903
+ color: var(--sfx-up-text, #374151);
904
+ font-size: 10px;
905
+ font-weight: 500;
906
+ border: 1px solid var(--sfx-up-border, #e5e7eb);
907
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
908
+ padding: 3px 8px;
909
+ border-radius: 5px;
910
+ white-space: nowrap;
911
+ opacity: 0;
912
+ visibility: hidden;
913
+ transition: opacity 0.15s, visibility 0.15s;
914
+ pointer-events: none;
915
+ z-index: 50;
916
+ font-family: inherit;
917
+ }
918
+
919
+ .src-ico:hover::after {
920
+ opacity: 1;
921
+ visibility: visible;
922
+ }
923
+
924
+ /* --- Ripple --- */
925
+ .ripple {
926
+ position: absolute;
927
+ width: 10px;
928
+ height: 10px;
929
+ border-radius: 50%;
930
+ background: var(--sfx-up-primary, #2563eb);
931
+ opacity: 0;
932
+ pointer-events: none;
933
+ transform: translate(-50%, -50%) scale(0);
934
+ }
935
+
936
+ .ripple.go {
937
+ animation: ripple 0.55s ease-out forwards;
938
+ }
939
+
940
+ /* --- Hidden input --- */
941
+ input[type='file'] {
942
+ display: none;
943
+ }
944
+
945
+ @keyframes slowSpin {
946
+ to {
947
+ transform: rotate(360deg);
948
+ }
949
+ }
950
+
951
+ @keyframes ripple {
952
+ from {
953
+ transform: translate(-50%, -50%) scale(0);
954
+ opacity: 0.18;
955
+ }
956
+ to {
957
+ transform: translate(-50%, -50%) scale(12);
958
+ opacity: 0;
959
+ }
960
+ }
961
+
962
+ .drop-zone:focus-visible,
963
+ .src-pill:focus-visible,
964
+ .src-card:focus-visible,
965
+ .more-pill:focus-visible,
966
+ .src-ico:focus-visible,
967
+ .more-item:focus-visible {
968
+ outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
969
+ outline-offset: 2px;
970
+ }
971
+
972
+ @media (max-width: 480px) {
973
+ .drop-zone:not(.compact) {
974
+ padding: 32px 20px;
975
+ }
976
+ .title { font-size: 16px; }
977
+ .rings { width: 90px; height: 90px; }
978
+ .core { width: 44px; height: 44px; }
979
+ .core svg { width: 20px; height: 20px; }
980
+ }
981
+
982
+ @media (prefers-reduced-motion: reduce) {
983
+ .ring {
984
+ animation: none;
985
+ }
986
+ .ripple.go {
987
+ animation: none;
988
+ }
989
+ .drop-zone.compact {
990
+ animation: none;
991
+ }
992
+ }
993
+ `;let y=de;U([c.property({type:Boolean,reflect:!0})],y.prototype,"compact");U([c.property({type:Boolean,attribute:"external-drag-over"})],y.prototype,"externalDragOver");U([c.property({type:String})],y.prototype,"accept");U([c.property({type:Array})],y.prototype,"sources");U([c.property({type:String,attribute:"sources-layout"})],y.prototype,"sourcesLayout");U([c.state()],y.prototype,"_dragOver");U([c.state()],y.prototype,"_moreOpen");U([c.state()],y.prototype,"_visiblePills");U([c.query(".ripple")],y.prototype,"_rippleEl");U([c.query('input[type="file"]')],y.prototype,"fileInput");const pe=class pe extends s.LitElement{render(){return s.html`
994
+ <div class="line"></div>
995
+ <div class="label">or import from</div>
996
+ <div class="line"></div>
997
+ `}};pe.styles=s.css`
998
+ :host {
999
+ display: flex;
1000
+ align-items: center;
1001
+ gap: 14px;
1002
+ padding: 20px 0;
1003
+ }
1004
+
1005
+ .line {
1006
+ flex: 1;
1007
+ height: 1px;
1008
+ background: var(--sfx-up-border-light, #f1f5f9);
1009
+ }
1010
+
1011
+ .label {
1012
+ font-size: 11px;
1013
+ font-weight: 600;
1014
+ color: var(--sfx-up-text-muted, #cbd5e1);
1015
+ text-transform: uppercase;
1016
+ letter-spacing: 1px;
1017
+ white-space: nowrap;
1018
+ }
1019
+ `;let se=pe;var rt=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&&rt(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
+ <div class="drop-tile" @click=${this._onDropTileClick}>
1021
+ <div class="drop-tile-rings">
1022
+ <div class="drop-tile-ring"></div>
1023
+ <div class="drop-tile-ring"></div>
1024
+ <div class="drop-tile-core">
1025
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
1026
+ <polyline points="16 16 12 12 8 16" />
1027
+ <line x1="12" y1="12" x2="12" y2="21" />
1028
+ <path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3" />
1029
+ </svg>
1030
+ </div>
1031
+ </div>
1032
+ <div class="drop-tile-text">Drop files or<br>click to <span>browse</span></div>
1033
+ ${t.length>0?s.html`
1034
+ <div class="drop-tile-sources">
1035
+ ${t.map(r=>s.html`
1036
+ <button
1037
+ class="drop-tile-src"
1038
+ style=${r.iconColor&&!r.brandHtml?`color:${r.iconColor}`:""}
1039
+ title=${r.label}
1040
+ @click=${o=>this._onSourceClick(o,r)}
1041
+ >
1042
+ ${r.brandHtml?z.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${S.unsafeSVG(r.icon)}</svg>`}
1043
+ </button>
1044
+ `)}
1045
+ ${i.length>0?s.html`
1046
+ <div class="drop-tile-more-wrap">
1047
+ <button class="drop-tile-more" title="More sources" @click=${r=>this._toggleMore(r)}>···</button>
1048
+ ${this._moreOpen?s.html`
1049
+ <div class="more-dropdown">
1050
+ ${i.map(r=>s.html`
1051
+ <button
1052
+ class="more-dropdown-item"
1053
+ @click=${o=>this._onMoreSourceClick(o,r)}
1054
+ >
1055
+ <span class="more-dropdown-ico" style=${r.iconColor&&!r.brandHtml?`color:${r.iconColor}`:""}>
1056
+ ${r.brandHtml?z.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${S.unsafeSVG(r.icon)}</svg>`}
1057
+ </span>
1058
+ ${r.label}
1059
+ </button>
1060
+ `)}
1061
+ </div>
1062
+ `:s.nothing}
1063
+ </div>
1064
+ `:s.nothing}
1065
+ </div>
1066
+ `:s.nothing}
1067
+ <input type="file" multiple accept=${this.accept||s.nothing} @change=${this._onFileInput} />
1068
+ </div>
1069
+ `}render(){return s.html`
1070
+ <div class="grid">
1071
+ ${this.showDropTile?this._renderDropTile():s.nothing}
1072
+ ${this.files.map((e,t)=>s.html`<sfx-file-item .file=${e} style="--tile-index:${t}"></sfx-file-item>`)}
1073
+ </div>
1074
+ `}};ce.styles=s.css`
1075
+ :host {
1076
+ display: block;
1077
+ flex: 1;
1078
+ min-height: 0;
1079
+ overflow-y: auto;
1080
+ padding-bottom: 8px;
1081
+ scrollbar-width: thin;
1082
+ scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
1083
+ scrollbar-gutter: stable;
1084
+ }
1085
+
1086
+ :host::-webkit-scrollbar {
1087
+ width: var(--sfx-scrollbar-w, 12px);
1088
+ }
1089
+
1090
+ :host::-webkit-scrollbar-track {
1091
+ background: transparent;
1092
+ margin: 8px 0;
1093
+ }
1094
+
1095
+ :host::-webkit-scrollbar-thumb {
1096
+ background: rgba(0, 0, 0, 0.15);
1097
+ border-radius: var(--sfx-scrollbar-radius, 6px);
1098
+ border-left: var(--sfx-scrollbar-inset, 3px) solid transparent;
1099
+ border-right: var(--sfx-scrollbar-inset, 3px) solid transparent;
1100
+ background-clip: padding-box;
1101
+ }
1102
+
1103
+ .grid {
1104
+ display: grid;
1105
+ grid-template-columns: repeat(auto-fill, minmax(var(--sfx-up-grid-min, max(24%, 140px)), 1fr));
1106
+ gap: 12px;
1107
+ padding: 2px 16px 16px 16px;
1108
+ }
1109
+
1110
+ @media (max-width: 480px) {
1111
+ .grid {
1112
+ grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
1113
+ gap: 8px;
1114
+ }
1115
+ }
1116
+
1117
+ /* --- Drop tile (first card in grid) --- */
1118
+ .drop-tile {
1119
+ border-radius: 10px;
1120
+ border: 1.5px dashed var(--sfx-up-border, #c4d5ef);
1121
+ background: var(--sfx-up-surface, #f8fafc);
1122
+ display: flex;
1123
+ flex-direction: column;
1124
+ align-items: center;
1125
+ justify-content: center;
1126
+ gap: 8px;
1127
+ cursor: pointer;
1128
+ transition: all 0.18s ease;
1129
+ padding: 16px 12px;
1130
+ position: relative;
1131
+ z-index: 1;
1132
+ }
1133
+
1134
+ .drop-tile:hover {
1135
+ border-color: var(--sfx-up-primary, #2563eb);
1136
+ background: var(--sfx-up-primary-bg, #eff6ff);
1137
+ }
1138
+
1139
+ .drop-tile-rings {
1140
+ width: 72px;
1141
+ height: 72px;
1142
+ position: relative;
1143
+ display: flex;
1144
+ align-items: center;
1145
+ justify-content: center;
1146
+ flex-shrink: 0;
1147
+ }
1148
+
1149
+ .drop-tile-ring {
1150
+ position: absolute;
1151
+ inset: 0;
1152
+ border-radius: 50%;
1153
+ border: 1px dashed var(--sfx-up-ring-color, #c4d5ef);
1154
+ animation: tileSpin 20s linear infinite;
1155
+ }
1156
+
1157
+ .drop-tile-ring:nth-child(2) {
1158
+ inset: 8px;
1159
+ border-color: var(--sfx-up-ring-color-light, #d8e5f5);
1160
+ border-style: dotted;
1161
+ animation-direction: reverse;
1162
+ animation-duration: 14s;
1163
+ }
1164
+
1165
+ @keyframes tileSpin {
1166
+ to { transform: rotate(360deg); }
1167
+ }
1168
+
1169
+ .drop-tile-core {
1170
+ width: 40px;
1171
+ height: 40px;
1172
+ border-radius: 50%;
1173
+ background: var(--sfx-up-primary-bg, #eff6ff);
1174
+ color: var(--sfx-up-primary, #2563eb);
1175
+ display: flex;
1176
+ align-items: center;
1177
+ justify-content: center;
1178
+ z-index: 1;
1179
+ box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
1180
+ transition: all 0.2s ease;
1181
+ }
1182
+
1183
+ .drop-tile:hover .drop-tile-core {
1184
+ transform: translateY(-1px);
1185
+ box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
1186
+ }
1187
+
1188
+ .drop-tile-core svg {
1189
+ width: 20px;
1190
+ height: 20px;
1191
+ }
1192
+
1193
+ .drop-tile-text {
1194
+ font-size: 12px;
1195
+ font-weight: 500;
1196
+ color: var(--sfx-up-text-secondary, #475569);
1197
+ text-align: center;
1198
+ line-height: 1.4;
1199
+ }
1200
+
1201
+ .drop-tile-text span {
1202
+ color: var(--sfx-up-primary, #2563eb);
1203
+ font-weight: 600;
1204
+ }
1205
+
1206
+ .drop-tile-sources {
1207
+ display: flex;
1208
+ gap: 4px;
1209
+ margin-top: 4px;
1210
+ }
1211
+
1212
+ .drop-tile-src {
1213
+ width: 28px;
1214
+ height: 28px;
1215
+ border-radius: 6px;
1216
+ border: 1px solid var(--sfx-up-border, #e2e8f0);
1217
+ background: var(--sfx-up-bg, #fff);
1218
+ display: flex;
1219
+ align-items: center;
1220
+ justify-content: center;
1221
+ cursor: pointer;
1222
+ transition: all 0.15s ease;
1223
+ padding: 0;
1224
+ color: var(--sfx-up-text-muted, #94a3b8);
1225
+ }
1226
+
1227
+ .drop-tile-src:hover {
1228
+ border-color: var(--sfx-up-primary, #2563eb);
1229
+ background: var(--sfx-up-primary-bg, #eff6ff);
1230
+ transform: translateY(-1px);
1231
+ box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
1232
+ }
1233
+
1234
+ .drop-tile-src svg {
1235
+ width: 14px;
1236
+ height: 14px;
1237
+ fill: none;
1238
+ stroke: currentColor;
1239
+ stroke-width: 2;
1240
+ stroke-linecap: round;
1241
+ stroke-linejoin: round;
1242
+ }
1243
+
1244
+ .drop-tile-src svg.fill-icon {
1245
+ fill: currentColor;
1246
+ stroke: none;
1247
+ }
1248
+
1249
+ .drop-tile-more-wrap {
1250
+ position: relative;
1251
+ }
1252
+
1253
+ .drop-tile-more {
1254
+ width: 28px;
1255
+ height: 28px;
1256
+ border-radius: 6px;
1257
+ border: 1px solid var(--sfx-up-border, #e2e8f0);
1258
+ background: var(--sfx-up-bg, #fff);
1259
+ display: flex;
1260
+ align-items: center;
1261
+ justify-content: center;
1262
+ cursor: pointer;
1263
+ transition: all 0.15s ease;
1264
+ padding: 0;
1265
+ color: var(--sfx-up-text-muted, #94a3b8);
1266
+ font-size: 14px;
1267
+ font-weight: 700;
1268
+ letter-spacing: 1px;
1269
+ }
1270
+
1271
+ .drop-tile-more:hover {
1272
+ border-color: var(--sfx-up-primary, #2563eb);
1273
+ background: var(--sfx-up-primary-bg, #eff6ff);
1274
+ transform: translateY(-1px);
1275
+ box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
1276
+ }
1277
+
1278
+ .more-dropdown {
1279
+ position: absolute;
1280
+ top: 36px;
1281
+ right: 0;
1282
+ background: #fff;
1283
+ border: 1px solid var(--sfx-up-border, #e2e8f0);
1284
+ border-radius: 10px;
1285
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
1286
+ padding: 6px;
1287
+ z-index: 10;
1288
+ min-width: 180px;
1289
+ animation: dropIn 0.15s ease;
1290
+ }
1291
+
1292
+ @keyframes dropIn {
1293
+ from { opacity: 0; transform: translateY(-4px); }
1294
+ to { opacity: 1; transform: translateY(0); }
1295
+ }
1296
+
1297
+ .more-dropdown-item {
1298
+ display: flex;
1299
+ align-items: center;
1300
+ gap: 10px;
1301
+ width: 100%;
1302
+ padding: 8px 12px;
1303
+ border: none;
1304
+ background: none;
1305
+ border-radius: 6px;
1306
+ cursor: pointer;
1307
+ font-size: 13px;
1308
+ font-weight: 500;
1309
+ color: var(--sfx-up-text, #1e293b);
1310
+ white-space: nowrap;
1311
+ transition: background 0.15s;
1312
+ font-family: inherit;
1313
+ }
1314
+
1315
+ .more-dropdown-item:hover {
1316
+ background: var(--sfx-up-primary-bg, #f5f7fa);
1317
+ }
1318
+
1319
+ .more-dropdown-ico {
1320
+ width: 32px;
1321
+ height: 32px;
1322
+ border-radius: 8px;
1323
+ background: var(--sfx-up-surface, #f8fafc);
1324
+ display: flex;
1325
+ align-items: center;
1326
+ justify-content: center;
1327
+ flex-shrink: 0;
1328
+ }
1329
+
1330
+ .more-dropdown-ico svg {
1331
+ width: 16px;
1332
+ height: 16px;
1333
+ fill: none;
1334
+ stroke: currentColor;
1335
+ stroke-width: 2;
1336
+ stroke-linecap: round;
1337
+ stroke-linejoin: round;
1338
+ }
1339
+
1340
+ .more-dropdown-ico svg.fill-icon {
1341
+ fill: currentColor;
1342
+ stroke: none;
1343
+ }
1344
+
1345
+ .more-dropdown-ico .brand-ico {
1346
+ width: 20px;
1347
+ height: 20px;
1348
+ border-radius: 5px;
1349
+ display: flex;
1350
+ align-items: center;
1351
+ justify-content: center;
1352
+ }
1353
+
1354
+ .more-dropdown-ico .brand-ico svg {
1355
+ fill: white;
1356
+ stroke: none;
1357
+ stroke-width: 0;
1358
+ }
1359
+
1360
+ .more-dropdown-ico .canva-ico {
1361
+ width: 22px;
1362
+ height: 22px;
1363
+ }
1364
+
1365
+ .more-dropdown-ico .canva-ico svg {
1366
+ width: 22px;
1367
+ height: 22px;
1368
+ }
1369
+
1370
+ input[type="file"] {
1371
+ display: none;
1372
+ }
1373
+ `;let D=ce;V([c.property({attribute:!1})],D.prototype,"files");V([c.property({type:Boolean})],D.prototype,"showDropTile");V([c.property({attribute:!1})],D.prototype,"sources");V([c.property({type:String})],D.prototype,"accept");V([c.state()],D.prototype,"_moreOpen");var it=Object.defineProperty,ot=(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 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=Ye(e.name),d=["tile",i?"done":"",r?"uploading":"",a?"rejected":""].filter(Boolean).join(" ");return s.html`
1374
+ <div class=${d} tabindex="0">
1375
+ <!-- Preview area -->
1376
+ <div class="preview">
1377
+ ${e.previewUrl?s.html`<div class="preview-bg" style="background-image:url(${e.previewUrl})"></div>`:s.html`
1378
+ <div class="preview-bg ${t}"></div>
1379
+ <div class="type-icon">
1380
+ <div class="type-icon-inner ${t}">
1381
+ ${this._renderTypeIcon(t)}
1382
+ ${l?s.html`<div class="ext-label">${l}</div>`:s.nothing}
1383
+ </div>
1384
+ </div>
1385
+ `}
1386
+
1387
+ <!-- Preview button -->
1388
+ ${!i&&!r&&!o&&e.status!=="rejected"?s.html`
1389
+ <button class="preview-btn" @click=${this._preview} aria-label="Preview file">
1390
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
1391
+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
1392
+ <circle cx="12" cy="12" r="3"/>
1393
+ </svg>
1394
+ Preview
1395
+ </button>
1396
+ `:s.nothing}
1397
+
1398
+ <!-- Spinner overlay -->
1399
+ <div class="spinner-overlay">
1400
+ <div class="spin-ring"></div>
1401
+ </div>
1402
+
1403
+ <!-- Done badge -->
1404
+ ${i?s.html`<div class="done-badge">
1405
+ <svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="3" stroke-linecap="round">
1406
+ <polyline points="20 6 9 17 4 12" />
1407
+ </svg>
1408
+ </div>`:s.nothing}
1409
+
1410
+ <!-- Progress bar -->
1411
+ ${e.status==="uploading"?s.html`
1412
+ <div class="progress">
1413
+ <div class="progress-fill" style="transform:scaleX(${Math.min(e.progress,100)/100})"></div>
1414
+ </div>
1415
+ `:s.nothing}
1416
+
1417
+ <!-- Error / rejected badge -->
1418
+ ${(o||a)&&e.error?s.html`<div class="error-badge" title=${e.error}>${e.error}</div>`:s.nothing}
1419
+
1420
+ <!-- Video duration badge -->
1421
+ ${e.duration!=null&&e.duration>0?s.html`<div class="duration-badge">${this._formatDuration(e.duration)}</div>`:s.nothing}
1422
+ </div>
1423
+
1424
+ <!-- Action buttons -->
1425
+ <div class="actions">
1426
+ ${o?s.html`
1427
+ <button class="act-btn retry" @click=${this._retry} title="Retry" aria-label="Retry upload">
1428
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
1429
+ <polyline points="23 4 23 10 17 10" />
1430
+ <path d="M20.49 15a9 9 0 11-2.12-9.36L23 10" />
1431
+ </svg>
1432
+ </button>
1433
+ `:s.nothing}
1434
+ <button class="act-btn del" @click=${this._remove} title="Remove" aria-label="Remove file">
1435
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
1436
+ <polyline points="3 6 5 6 21 6" />
1437
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" />
1438
+ <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
1439
+ <line x1="10" y1="11" x2="10" y2="17" />
1440
+ <line x1="14" y1="11" x2="14" y2="17" />
1441
+ </svg>
1442
+ </button>
1443
+ </div>
1444
+
1445
+ <!-- Info bar -->
1446
+ <div class="info">
1447
+ <div class="name" title=${e.name}>${e.name}</div>
1448
+ <div class="meta">${l||""}${e.size?` · ${R(e.size)}`:""}</div>
1449
+ </div>
1450
+ </div>
1451
+ `}_formatDuration(e){const t=Math.floor(e/60),i=Math.floor(e%60);return`${t}:${i.toString().padStart(2,"0")}`}_renderTypeIcon(e){switch(e){case"pdf":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>`;case"doc":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>`;case"vid":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>`;case"zip":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 8v13H3V8"/><path d="M1 3h22v5H1z"/><path d="M10 12h4"/></svg>`;default:return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z"/><polyline points="13 2 13 9 20 9"/></svg>`}}};fe.styles=s.css`
1452
+ :host {
1453
+ display: block;
1454
+ }
1455
+
1456
+ .tile {
1457
+ border-radius: 10px;
1458
+ background: var(--sfx-up-bg, #fff);
1459
+ border: 1px solid #dde3ed;
1460
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
1461
+ animation: tileIn 0.45s cubic-bezier(0.34, 1.2, 0.64, 1) both;
1462
+ animation-delay: calc(min(var(--tile-index, 0), 8) * 0.04s);
1463
+ will-change: transform, opacity;
1464
+ transition: box-shadow 0.15s, transform 0.15s;
1465
+ cursor: default;
1466
+ display: flex;
1467
+ flex-direction: column;
1468
+ position: relative;
1469
+ }
1470
+
1471
+ .tile:hover {
1472
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.08);
1473
+ }
1474
+
1475
+ /* --- Preview area --- */
1476
+ .preview {
1477
+ position: relative;
1478
+ aspect-ratio: 16 / 10;
1479
+ overflow: hidden;
1480
+ flex-shrink: 0;
1481
+ background: var(--sfx-up-border-light, #f3f4f6);
1482
+ border-radius: 10px 10px 0 0;
1483
+ }
1484
+
1485
+ .preview-bg {
1486
+ position: absolute;
1487
+ inset: 0;
1488
+ background-size: cover;
1489
+ background-position: center;
1490
+ transition: transform 0.4s ease;
1491
+ }
1492
+
1493
+ .tile:hover .preview-bg {
1494
+ transform: none;
1495
+ }
1496
+
1497
+ .preview-bg.pdf { background: linear-gradient(135deg, var(--destructive-10, #fef2f2), var(--destructive-10, #fee2e2)); }
1498
+ .preview-bg.doc { background: linear-gradient(135deg, var(--sfx-up-primary-bg, #eff6ff), var(--sfx-up-primary-bg, #dbeafe)); }
1499
+ .preview-bg.vid { background: linear-gradient(135deg, #f5f3ff, #ede9fe); }
1500
+ .preview-bg.zip { background: linear-gradient(135deg, var(--warning-10, #fffbeb), var(--warning-10, #fef3c7)); }
1501
+ .preview-bg.gen { background: linear-gradient(135deg, var(--sfx-up-border-light, #f8fafc), var(--sfx-up-border-light, #f1f5f9)); }
1502
+
1503
+ /* --- File type icon --- */
1504
+ .type-icon {
1505
+ position: absolute;
1506
+ inset: 0;
1507
+ display: flex;
1508
+ align-items: center;
1509
+ justify-content: center;
1510
+ pointer-events: none;
1511
+ }
1512
+
1513
+ .type-icon-inner {
1514
+ width: 44px;
1515
+ height: 44px;
1516
+ border-radius: 12px;
1517
+ display: flex;
1518
+ align-items: center;
1519
+ justify-content: center;
1520
+ background: rgba(255, 255, 255, 0.9);
1521
+ box-shadow: 0 2px 10px var(--sfx-up-shadow, rgba(0, 0, 0, 0.08));
1522
+ }
1523
+
1524
+ .type-icon-inner svg {
1525
+ width: 22px;
1526
+ height: 22px;
1527
+ }
1528
+
1529
+ .type-icon-inner.pdf { color: var(--sfx-up-error, #dc2626); }
1530
+ .type-icon-inner.doc { color: var(--sfx-up-primary, #1d4ed8); }
1531
+ .type-icon-inner.vid { color: #7c3aed; }
1532
+ .type-icon-inner.zip { color: var(--warning-foreground, #b45309); }
1533
+ .type-icon-inner.gen { color: var(--sfx-up-text-muted, #64748b); }
1534
+
1535
+ .ext-label {
1536
+ font-size: 12px;
1537
+ font-weight: 800;
1538
+ text-transform: uppercase;
1539
+ margin-top: 2px;
1540
+ }
1541
+
1542
+ .duration-badge {
1543
+ position: absolute;
1544
+ bottom: 6px;
1545
+ right: 6px;
1546
+ background: rgba(0, 0, 0, 0.65);
1547
+ color: #fff;
1548
+ font-size: 11px;
1549
+ font-weight: 600;
1550
+ padding: 2px 6px;
1551
+ border-radius: 4px;
1552
+ line-height: 1.3;
1553
+ pointer-events: none;
1554
+ z-index: 2;
1555
+ }
1556
+
1557
+ /* --- Info bar --- */
1558
+ .info {
1559
+ padding: 8px 12px;
1560
+ min-width: 0;
1561
+ }
1562
+
1563
+ .name {
1564
+ font-size: 14px;
1565
+ font-weight: 400;
1566
+ color: var(--foreground, var(--sfx-up-text, #111827));
1567
+ white-space: nowrap;
1568
+ overflow: hidden;
1569
+ text-overflow: ellipsis;
1570
+ margin-bottom: 2px;
1571
+ }
1572
+
1573
+ .meta {
1574
+ font-size: 12px;
1575
+ font-weight: 400;
1576
+ color: var(--sfx-up-text-muted, #9ca3af);
1577
+ white-space: nowrap;
1578
+ overflow: hidden;
1579
+ text-overflow: ellipsis;
1580
+ }
1581
+
1582
+ .tile.done {
1583
+ box-shadow: 0 0 0 2px var(--sfx-up-primary, #2563eb);
1584
+ }
1585
+
1586
+ /* --- Action buttons --- */
1587
+ .actions {
1588
+ position: absolute;
1589
+ top: 6px;
1590
+ right: 6px;
1591
+ display: flex;
1592
+ gap: 4px;
1593
+ opacity: 0;
1594
+ transition: opacity 0.15s;
1595
+ z-index: 10;
1596
+ }
1597
+
1598
+ .tile:hover .actions,
1599
+ .tile:focus-within .actions {
1600
+ opacity: 1;
1601
+ }
1602
+
1603
+ /* Touch devices: always show actions since there is no hover */
1604
+ @media (hover: none) {
1605
+ .actions { opacity: 1; }
1606
+ }
1607
+
1608
+ .act-btn {
1609
+ width: 26px;
1610
+ height: 26px;
1611
+ border-radius: 6px;
1612
+ border: none;
1613
+ background: var(--sfx-up-bg, #fff);
1614
+ box-shadow: 0 1px 4px var(--sfx-up-shadow, rgba(0, 0, 0, 0.15));
1615
+ cursor: pointer;
1616
+ display: flex;
1617
+ align-items: center;
1618
+ justify-content: center;
1619
+ transition: background 0.15s, transform 0.15s;
1620
+ color: var(--sfx-up-text-muted, #9ca3af);
1621
+ padding: 0;
1622
+ }
1623
+
1624
+ .act-btn:hover {
1625
+ background: var(--sfx-up-border-light, #f3f4f6);
1626
+ transform: scale(1.08);
1627
+ }
1628
+
1629
+ .act-btn.del:hover {
1630
+ background: var(--destructive-10, #fee2e2);
1631
+ color: var(--sfx-up-error, #dc2626);
1632
+ }
1633
+
1634
+ .act-btn.retry:hover {
1635
+ background: var(--sfx-up-primary-bg, #eff6ff);
1636
+ color: var(--sfx-up-primary, #2563eb);
1637
+ }
1638
+
1639
+ .act-btn svg {
1640
+ width: 11px;
1641
+ height: 11px;
1642
+ }
1643
+
1644
+ /* --- Preview button --- */
1645
+ .preview-btn {
1646
+ position: absolute;
1647
+ bottom: 50%;
1648
+ left: 50%;
1649
+ transform: translate(-50%, 50%);
1650
+ padding: 6px 16px;
1651
+ border-radius: 6px;
1652
+ border: 1.5px solid var(--sfx-up-primary, #2563eb);
1653
+ background: var(--sfx-up-bg, #fff);
1654
+ cursor: pointer;
1655
+ display: flex;
1656
+ align-items: center;
1657
+ gap: 5px;
1658
+ opacity: 0;
1659
+ transition: all 0.15s ease;
1660
+ color: var(--sfx-up-primary, #2563eb);
1661
+ font-family: inherit;
1662
+ font-size: 11px;
1663
+ font-weight: 600;
1664
+ white-space: nowrap;
1665
+ z-index: 5;
1666
+ }
1667
+
1668
+ .tile:hover .preview-btn,
1669
+ .tile:focus-within .preview-btn {
1670
+ opacity: 1;
1671
+ }
1672
+
1673
+ @media (hover: none) {
1674
+ .preview-btn { opacity: 1; }
1675
+ }
1676
+
1677
+ .preview-btn:hover {
1678
+ background: var(--sfx-up-primary, #2563eb);
1679
+ color: var(--sfx-up-bg, #fff);
1680
+ }
1681
+
1682
+ .preview-btn:hover svg {
1683
+ stroke: var(--sfx-up-bg, #fff);
1684
+ }
1685
+
1686
+ .preview-btn svg {
1687
+ width: 13px;
1688
+ height: 13px;
1689
+ }
1690
+
1691
+ /* --- Progress bar --- */
1692
+ .progress {
1693
+ position: absolute;
1694
+ bottom: 0;
1695
+ left: 0;
1696
+ right: 0;
1697
+ height: 2px;
1698
+ background: rgba(0, 0, 0, 0.06);
1699
+ }
1700
+
1701
+ .progress-fill {
1702
+ height: 100%;
1703
+ background: var(--sfx-up-primary, #2563eb);
1704
+ transform-origin: left;
1705
+ transition: transform 0.32s ease;
1706
+ }
1707
+
1708
+ /* --- Uploading spinner overlay --- */
1709
+ .spinner-overlay {
1710
+ position: absolute;
1711
+ inset: 0;
1712
+ display: flex;
1713
+ align-items: center;
1714
+ justify-content: center;
1715
+ background: rgba(0, 0, 0, 0.22);
1716
+ opacity: 0;
1717
+ transition: opacity 0.2s;
1718
+ pointer-events: none;
1719
+ }
1720
+
1721
+ .tile.uploading .spinner-overlay {
1722
+ opacity: 1;
1723
+ }
1724
+
1725
+ .spin-ring {
1726
+ width: 28px;
1727
+ height: 28px;
1728
+ border: 2.5px solid rgba(255, 255, 255, 0.22);
1729
+ border-top-color: #fff;
1730
+ border-radius: 50%;
1731
+ animation: spinRing 0.7s linear infinite;
1732
+ }
1733
+
1734
+ /* --- Done badge --- */
1735
+ .done-badge {
1736
+ position: absolute;
1737
+ top: 8px;
1738
+ left: 8px;
1739
+ width: 24px;
1740
+ height: 24px;
1741
+ border-radius: 50%;
1742
+ background: var(--sfx-up-primary, #2563eb);
1743
+ display: flex;
1744
+ align-items: center;
1745
+ justify-content: center;
1746
+ pointer-events: none;
1747
+ z-index: 10;
1748
+ }
1749
+
1750
+ .done-badge svg {
1751
+ width: 14px;
1752
+ height: 14px;
1753
+ }
1754
+
1755
+ /* --- Error / rejected state --- */
1756
+ .error-badge {
1757
+ position: absolute;
1758
+ bottom: 28px;
1759
+ left: 6px;
1760
+ right: 6px;
1761
+ font-size: 12px;
1762
+ font-weight: 600;
1763
+ color: #fff;
1764
+ background: var(--sfx-up-error, #dc2626);
1765
+ border-radius: 4px;
1766
+ padding: 3px 6px;
1767
+ text-align: center;
1768
+ white-space: nowrap;
1769
+ overflow: hidden;
1770
+ text-overflow: ellipsis;
1771
+ }
1772
+
1773
+ .tile.rejected {
1774
+ opacity: 0.6;
1775
+ box-shadow: 0 0 0 2px var(--sfx-up-error, #dc2626);
1776
+ }
1777
+
1778
+ @keyframes tileIn {
1779
+ 0% {
1780
+ opacity: 0;
1781
+ transform: scale(0.92) translateY(14px);
1782
+ }
1783
+ 60% {
1784
+ opacity: 1;
1785
+ }
1786
+ 80% {
1787
+ transform: scale(1.02) translateY(-2px);
1788
+ }
1789
+ 100% {
1790
+ opacity: 1;
1791
+ transform: scale(1) translateY(0);
1792
+ }
1793
+ }
1794
+
1795
+ @keyframes popBounce {
1796
+ 0% { transform: scale(0); opacity: 0; }
1797
+ 55% { transform: scale(1.2); opacity: 1; }
1798
+ 75% { transform: scale(0.94); }
1799
+ 100% { transform: scale(1); }
1800
+ }
1801
+
1802
+ @keyframes spinRing {
1803
+ to { transform: rotate(360deg); }
1804
+ }
1805
+
1806
+ .tile:focus-visible {
1807
+ outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
1808
+ outline-offset: 2px;
1809
+ }
1810
+
1811
+ .act-btn:focus-visible,
1812
+ .preview-btn:focus-visible {
1813
+ outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
1814
+ outline-offset: 2px;
1815
+ }
1816
+
1817
+ @media (prefers-reduced-motion: reduce) {
1818
+ .tile { animation: none; }
1819
+ .spin-ring { animation: none; }
1820
+ }
1821
+ `;let Z=fe;ot([c.property({attribute:!1})],Z.prototype,"file");const N=s.css`
1822
+ .btn,
1823
+ .btn-ghost,
1824
+ .btn-primary,
1825
+ .btn-sec,
1826
+ .btn-retry,
1827
+ .btn-upload,
1828
+ .btn-danger {
1829
+ height: 36px;
1830
+ padding: 0 16px;
1831
+ border-radius: 6px;
1832
+ border: none;
1833
+ font-family: inherit;
1834
+ font-size: 14px;
1835
+ font-weight: 500;
1836
+ cursor: pointer;
1837
+ display: inline-flex;
1838
+ align-items: center;
1839
+ justify-content: center;
1840
+ gap: 6px;
1841
+ transition: all 0.15s ease;
1842
+ white-space: nowrap;
1843
+ }
1844
+
1845
+ .btn svg,
1846
+ .btn-ghost svg,
1847
+ .btn-primary svg,
1848
+ .btn-sec svg,
1849
+ .btn-retry svg,
1850
+ .btn-upload svg,
1851
+ .btn-danger svg {
1852
+ width: 14px;
1853
+ height: 14px;
1854
+ }
1855
+
1856
+ .btn-ghost {
1857
+ background: none;
1858
+ color: var(--sfx-up-text-muted, #94a3b8);
1859
+ border: 1.5px solid var(--sfx-up-border, #e2e8f0);
1860
+ }
1861
+
1862
+ .btn-ghost:hover {
1863
+ background: var(--sfx-up-border-light, #f8faff);
1864
+ color: var(--sfx-up-text-secondary, #64748b);
1865
+ border-color: var(--sfx-up-border, #d1dff0);
1866
+ }
1867
+
1868
+ .btn-primary {
1869
+ background: linear-gradient(135deg, var(--sfx-up-primary, #2563eb), var(--sfx-up-primary-mid, #3b82f6));
1870
+ color: var(--primary-foreground, #fff);
1871
+ box-shadow: 0 2px 10px var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.28));
1872
+ position: relative;
1873
+ overflow: hidden;
1874
+ }
1875
+
1876
+ .btn-primary:hover:not(:disabled) {
1877
+ background: linear-gradient(135deg, var(--sfx-up-primary-hover, #1d4ed8), var(--sfx-up-primary, #2563eb));
1878
+ box-shadow: 0 4px 16px var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.38));
1879
+ transform: translateY(-1px);
1880
+ }
1881
+
1882
+ .btn-primary:active {
1883
+ transform: translateY(0);
1884
+ }
1885
+
1886
+ .btn-primary:disabled {
1887
+ opacity: 0.55;
1888
+ cursor: not-allowed;
1889
+ }
1890
+ `,X=s.css`
1891
+ button:focus-visible {
1892
+ outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
1893
+ outline-offset: 2px;
1894
+ }
1895
+ `;var st=Object.defineProperty,te=(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&&st(e,t,r),r};const ke=7,he=class he extends s.LitElement{constructor(){super(...arguments),this.fileCount=0,this.totalSize=0,this.thumbnails=[],this.primaryLabel="Done"}_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,ke),t=this.thumbnails.length-ke;return s.html`
1896
+ <div class="card" role="status" aria-live="polite">
1897
+ <div class="icon">
1898
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
1899
+ <polyline points="20 6 9 17 4 12" />
1900
+ </svg>
1901
+ </div>
1902
+ <div class="title">Uploaded successfully!</div>
1903
+ <div class="subtitle">All files are ready for use</div>
1904
+
1905
+ ${e.length>0?s.html`
1906
+ <div class="thumbs">
1907
+ ${e.map(i=>s.html`<img class="thumb" src=${i} alt="" />`)}
1908
+ ${t>0?s.html`<div class="thumb-more">+${t}</div>`:s.nothing}
1909
+ </div>
1910
+ `:s.nothing}
1911
+
1912
+ <div class="summary">${this.fileCount} ${this.fileCount===1?"file":"files"} · ${R(this.totalSize)} uploaded</div>
1913
+
1914
+ <div class="actions">
1915
+ <button class="btn-ghost" @click=${this._uploadMore}>Upload more</button>
1916
+ <button class="btn-primary" @click=${this._primaryAction}>${this.primaryLabel}</button>
1917
+ </div>
1918
+ </div>
1919
+ `}};he.styles=[N,X,s.css`
1920
+ :host {
1921
+ display: flex;
1922
+ flex: 1;
1923
+ justify-content: center;
1924
+ align-items: center;
1925
+ padding-bottom: 24px;
1926
+ }
1927
+
1928
+ .card {
1929
+ display: flex;
1930
+ flex-direction: column;
1931
+ align-items: center;
1932
+ text-align: center;
1933
+ animation: fadeUp 0.4s ease both;
1934
+ }
1935
+
1936
+ .icon {
1937
+ width: 64px;
1938
+ height: 64px;
1939
+ border-radius: 50%;
1940
+ background: #f0fdf4;
1941
+ display: flex;
1942
+ align-items: center;
1943
+ justify-content: center;
1944
+ margin-bottom: 18px;
1945
+ color: #22c55e;
1946
+ box-shadow: none;
1947
+ animation: popBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
1948
+ }
1949
+
1950
+ .icon svg {
1951
+ width: 30px;
1952
+ height: 30px;
1953
+ }
1954
+
1955
+ .title {
1956
+ font-size: 20px;
1957
+ font-weight: 700;
1958
+ color: var(--sfx-up-text, #0f172a);
1959
+ letter-spacing: -0.4px;
1960
+ margin-bottom: 8px;
1961
+ }
1962
+
1963
+ .subtitle {
1964
+ font-size: 14px;
1965
+ color: var(--sfx-up-text-muted, #94a3b8);
1966
+ line-height: 1.6;
1967
+ max-width: 320px;
1968
+ margin-bottom: 20px;
1969
+ }
1970
+
1971
+ /* --- Thumbnail strip --- */
1972
+ .thumbs {
1973
+ display: flex;
1974
+ justify-content: center;
1975
+ gap: 6px;
1976
+ margin-bottom: 14px;
1977
+ }
1978
+
1979
+ .thumb {
1980
+ width: 56px;
1981
+ height: 56px;
1982
+ border-radius: 8px;
1983
+ object-fit: cover;
1984
+ border: 1px solid var(--sfx-up-border, #e8eaed);
1985
+ }
1986
+
1987
+ .thumb-more {
1988
+ width: 56px;
1989
+ height: 56px;
1990
+ border-radius: 8px;
1991
+ background: var(--sfx-up-surface, #f8fafc);
1992
+ border: 1px solid var(--sfx-up-border, #e8eaed);
1993
+ display: flex;
1994
+ align-items: center;
1995
+ justify-content: center;
1996
+ font-size: 14px;
1997
+ font-weight: 600;
1998
+ color: var(--sfx-up-text-muted, #94a3b8);
1999
+ }
2000
+
2001
+ /* --- Summary chip --- */
2002
+ .summary {
2003
+ font-size: 14px;
2004
+ font-weight: 400;
2005
+ color: var(--sfx-up-text, #1e293b);
2006
+ background: var(--sfx-up-surface, #f8fafc);
2007
+ border-radius: 8px;
2008
+ padding: 6px 14px;
2009
+ margin-bottom: 22px;
2010
+ }
2011
+
2012
+ .actions {
2013
+ display: flex;
2014
+ gap: 8px;
2015
+ }
2016
+
2017
+ .actions .btn-primary {
2018
+ background: linear-gradient(135deg, #22c55e, #16a34a);
2019
+ box-shadow: 0 2px 10px rgba(34, 197, 94, 0.28);
2020
+ }
2021
+
2022
+ .actions .btn-primary:hover:not(:disabled) {
2023
+ background: linear-gradient(135deg, #16a34a, #15803d);
2024
+ box-shadow: 0 4px 16px rgba(34, 197, 94, 0.38);
2025
+ }
2026
+
2027
+ @keyframes fadeUp {
2028
+ from {
2029
+ opacity: 0;
2030
+ transform: translateY(12px);
2031
+ }
2032
+ to {
2033
+ opacity: 1;
2034
+ transform: translateY(0);
2035
+ }
2036
+ }
2037
+
2038
+ @keyframes popBounce {
2039
+ 0% { transform: scale(0); opacity: 0; }
2040
+ 55% { transform: scale(1.2); opacity: 1; }
2041
+ 75% { transform: scale(0.94); }
2042
+ 100% { transform: scale(1); }
2043
+ }
2044
+
2045
+ @media (max-width: 480px) {
2046
+ .icon { width: 48px; height: 48px; margin-bottom: 12px; }
2047
+ .icon svg { width: 24px; height: 24px; }
2048
+ .title { font-size: 18px; }
2049
+ .thumb, .thumb-more { width: 44px; height: 44px; }
2050
+ }
2051
+
2052
+ @media (prefers-reduced-motion: reduce) {
2053
+ .card { animation: none; }
2054
+ .icon { animation: none; }
2055
+ }
2056
+ `];let j=he;te([c.property({type:Number})],j.prototype,"fileCount");te([c.property({type:Number})],j.prototype,"totalSize");te([c.property({type:Array})],j.prototype,"thumbnails");te([c.property({type:String})],j.prototype,"primaryLabel");var at=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&&at(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`
2057
+ ${e?s.html`
2058
+ <div class="progress-row">
2059
+ <div class="progress-track" role="progressbar" aria-valuenow=${Math.round(this.uploadProgress)} aria-valuemin="0" aria-valuemax="100" aria-label="Upload progress">
2060
+ <div class="progress-fill" style="width:${this.uploadProgress}%"></div>
2061
+ </div>
2062
+ <span class="progress-label">${this.completedCount}/${this.fileCount} files</span>
2063
+ </div>
2064
+ `:s.nothing}
2065
+ <div class="buttons-row">
2066
+ <div class="left">
2067
+ ${this.showFillMetadata&&this.uploadState==="idle"?s.html`
2068
+ <button class="btn-sec" @click=${this._fillMetadata}>
2069
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2070
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
2071
+ <polyline points="14 2 14 8 20 8"/>
2072
+ <line x1="16" y1="13" x2="8" y2="13"/>
2073
+ <line x1="16" y1="17" x2="8" y2="17"/>
2074
+ <line x1="10" y1="9" x2="8" y2="9"/>
2075
+ </svg>
2076
+ Fill Metadata
2077
+ </button>
2078
+ `:s.nothing}
2079
+ </div>
2080
+ <div class="right">
2081
+ <button class="btn-ghost" @click=${this._clear}>
2082
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2083
+ <path d="M3 6h18" />
2084
+ <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" />
2085
+ <path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" />
2086
+ <line x1="10" y1="11" x2="10" y2="17" />
2087
+ <line x1="14" y1="11" x2="14" y2="17" />
2088
+ </svg>
2089
+ Clear
2090
+ </button>
2091
+ <button class="btn-sec" @click=${this._addMore}>
2092
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
2093
+ <line x1="12" y1="5" x2="12" y2="19" />
2094
+ <line x1="5" y1="12" x2="19" y2="12" />
2095
+ </svg>
2096
+ Add more
2097
+ </button>
2098
+ ${this.failedCount>0?s.html`
2099
+ <button class="btn-retry" @click=${this._retryAll}>
2100
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
2101
+ <polyline points="23 4 23 10 17 10" />
2102
+ <path d="M20.49 15a9 9 0 11-2.12-9.36L23 10" />
2103
+ </svg>
2104
+ Retry all (${this.failedCount})
2105
+ </button>
2106
+ `:s.nothing}
2107
+ ${this._renderUploadButton()}
2108
+ </div>
2109
+ </div>
2110
+ `}_renderUploadButton(){const e=this.uploadState==="uploading",t=this.uploadState==="done",i=["btn-primary",t?"done-state":""].filter(Boolean).join(" ");return s.html`
2111
+ <button
2112
+ class=${i}
2113
+ @click=${this._upload}
2114
+ ?disabled=${e}
2115
+ >
2116
+ ${e?s.html`<span class="btn-spin"></span> Uploading\u2026`:t?s.html`
2117
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
2118
+ <polyline points="20 6 9 17 4 12" />
2119
+ </svg>
2120
+ Done!
2121
+ `:s.html`
2122
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
2123
+ <polyline points="16 16 12 12 8 16" />
2124
+ <line x1="12" y1="12" x2="12" y2="21" />
2125
+ <path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3" />
2126
+ </svg>
2127
+ Upload
2128
+ `}
2129
+ </button>
2130
+ `}};ue.styles=[N,X,s.css`
2131
+ :host {
2132
+ display: flex;
2133
+ flex-direction: column;
2134
+ background: var(--sfx-up-bg, #ffffff);
2135
+ border-top: 1px solid var(--sfx-up-border, #e2e8f0);
2136
+ flex-shrink: 0;
2137
+ box-shadow: none;
2138
+ animation: barSlideUp 0.3s cubic-bezier(0.34, 1.2, 0.64, 1) both;
2139
+ }
2140
+
2141
+ @keyframes barSlideUp {
2142
+ from {
2143
+ opacity: 0;
2144
+ transform: translateY(12px);
2145
+ }
2146
+ to {
2147
+ opacity: 1;
2148
+ transform: translateY(0);
2149
+ }
2150
+ }
2151
+
2152
+ /* --- Progress row --- */
2153
+ .progress-row {
2154
+ display: flex;
2155
+ align-items: center;
2156
+ gap: 12px;
2157
+ padding: 10px 24px 0;
2158
+ }
2159
+
2160
+ .progress-track {
2161
+ flex: 1;
2162
+ height: 4px;
2163
+ background: var(--sfx-up-border, #e2e8f0);
2164
+ border-radius: 2px;
2165
+ overflow: hidden;
2166
+ }
2167
+
2168
+ .progress-fill {
2169
+ height: 100%;
2170
+ background: var(--sfx-up-primary, #2563eb);
2171
+ border-radius: 2px;
2172
+ transition: width 0.3s ease;
2173
+ }
2174
+
2175
+ .progress-label {
2176
+ font-size: 13px;
2177
+ font-weight: 600;
2178
+ color: var(--sfx-up-text, #1e293b);
2179
+ white-space: nowrap;
2180
+ flex-shrink: 0;
2181
+ }
2182
+
2183
+ /* --- Buttons row --- */
2184
+ .buttons-row {
2185
+ display: flex;
2186
+ align-items: center;
2187
+ justify-content: space-between;
2188
+ padding: 14px 24px;
2189
+ }
2190
+
2191
+ .left {
2192
+ display: flex;
2193
+ align-items: center;
2194
+ gap: 8px;
2195
+ }
2196
+
2197
+ .right {
2198
+ display: flex;
2199
+ align-items: center;
2200
+ gap: 8px;
2201
+ }
2202
+
2203
+ /* --- Button overrides (base in shared-styles) --- */
2204
+
2205
+ .btn-sec {
2206
+ background: var(--sfx-up-primary-bg, #eff6ff);
2207
+ color: var(--sfx-up-primary, #2563eb);
2208
+ border: 1.5px solid var(--sfx-up-primary-glow, rgba(37, 99, 235, 0.15));
2209
+ }
2210
+
2211
+ .btn-sec:hover {
2212
+ background: var(--sfx-up-primary-bg, #dbeafe);
2213
+ }
2214
+
2215
+ .btn-retry {
2216
+ background: var(--destructive-10, #fef2f2);
2217
+ color: var(--sfx-up-error, #dc2626);
2218
+ border: 1.5px solid var(--sfx-up-error, rgba(220, 38, 38, 0.2));
2219
+ }
2220
+
2221
+ .btn-retry:hover {
2222
+ background: var(--destructive-10, #fee2e2);
2223
+ color: var(--destructive-foreground, #b91c1c);
2224
+ border-color: var(--sfx-up-error, rgba(220, 38, 38, 0.35));
2225
+ }
2226
+
2227
+ .btn-primary {
2228
+ min-width: 110px;
2229
+ }
2230
+
2231
+ .btn-primary.done-state {
2232
+ background: var(--sfx-up-success, #16a34a);
2233
+ box-shadow: 0 2px 10px var(--sfx-up-shadow, rgba(22, 163, 74, 0.28));
2234
+ }
2235
+
2236
+ /* --- Spinner --- */
2237
+ .btn-spin {
2238
+ width: 14px;
2239
+ height: 14px;
2240
+ border: 2px solid rgba(255, 255, 255, 0.3);
2241
+ border-top-color: #fff;
2242
+ border-radius: 50%;
2243
+ animation: spinRing 0.7s linear infinite;
2244
+ }
2245
+
2246
+ /* --- Count --- */
2247
+ .count {
2248
+ font-size: 14px;
2249
+ font-weight: 700;
2250
+ color: var(--sfx-up-text, #1e293b);
2251
+ }
2252
+
2253
+ .count span {
2254
+ font-weight: 400;
2255
+ color: var(--sfx-up-text-muted, #94a3b8);
2256
+ }
2257
+
2258
+ @keyframes spinRing {
2259
+ to { transform: rotate(360deg); }
2260
+ }
2261
+
2262
+ @media (max-width: 480px) {
2263
+ .buttons-row {
2264
+ padding: 10px 12px;
2265
+ flex-wrap: wrap;
2266
+ gap: 8px;
2267
+ }
2268
+ button {
2269
+ height: 32px;
2270
+ font-size: 12px;
2271
+ }
2272
+ }
2273
+
2274
+ @media (prefers-reduced-motion: reduce) {
2275
+ :host { animation: none; }
2276
+ .btn-spin { animation: none; }
2277
+ }
2278
+ `];let E=ue;L([c.property({type:String})],E.prototype,"uploadState");L([c.property({type:Number})],E.prototype,"fileCount");L([c.property({type:Number})],E.prototype,"totalSize");L([c.property({type:Number})],E.prototype,"failedCount");L([c.property({type:Boolean})],E.prototype,"showFillMetadata");L([c.property({type:Number})],E.prototype,"completedCount");L([c.property({type:Number})],E.prototype,"uploadProgress");const nt='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(nt));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 lt=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&&lt(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`
2279
+ <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2280
+ <div class="card">
2281
+ <div class="head">
2282
+ <div class="head-icon">
2283
+ <svg viewBox="0 0 24 24">
2284
+ <path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71" />
2285
+ <path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71" />
2286
+ </svg>
2287
+ </div>
2288
+ <div class="title">Import from URL</div>
2289
+ <button class="close-btn" aria-label="Close" @click=${this._cancel}>\u2715</button>
2290
+ </div>
2291
+ <div class="body">
2292
+ <div class="field">
2293
+ <label for="urlInput">File URL</label>
2294
+ <input
2295
+ id="urlInput"
2296
+ type="url"
2297
+ placeholder="https://example.com/file.pdf"
2298
+ .value=${this._url}
2299
+ @input=${this._onUrlInput}
2300
+ />
2301
+ </div>
2302
+ <div class="field">
2303
+ <label for="nameInput">File name <span class="optional">(optional)</span></label>
2304
+ <input
2305
+ id="nameInput"
2306
+ type="text"
2307
+ placeholder="document.pdf"
2308
+ .value=${this._name}
2309
+ @input=${this._onNameInput}
2310
+ />
2311
+ </div>
2312
+ ${this._error?s.html`<div class="error">${this._error}</div>`:""}
2313
+ <div class="actions">
2314
+ <button class="btn btn-ghost" @click=${this._cancel}>Cancel</button>
2315
+ <button class="btn btn-primary" @click=${this._submit}>
2316
+ Import file
2317
+ </button>
2318
+ </div>
2319
+ </div>
2320
+ </div>
2321
+ </div>
2322
+ `}};xe.styles=[N,X,s.css`
2323
+ :host {
2324
+ display: block;
2325
+ }
2326
+
2327
+ .backdrop {
2328
+ position: fixed;
2329
+ inset: 0;
2330
+ z-index: 1000;
2331
+ background: var(--sfx-up-backdrop, rgba(0, 0, 0, 0.45));
2332
+ backdrop-filter: blur(6px);
2333
+ display: flex;
2334
+ align-items: center;
2335
+ justify-content: center;
2336
+ padding: 20px;
2337
+ animation: fadeIn 0.18s ease both;
2338
+ }
2339
+
2340
+ .card {
2341
+ background: var(--sfx-up-bg, #fff);
2342
+ border-radius: 12px;
2343
+ box-shadow: 0 28px 80px var(--sfx-up-shadow, rgba(0, 0, 0, 0.18)), 0 4px 16px rgba(0, 0, 0, 0.06);
2344
+ width: 100%;
2345
+ max-width: 480px;
2346
+ overflow: hidden;
2347
+ display: flex;
2348
+ flex-direction: column;
2349
+ transform: translateY(18px) scale(0.97);
2350
+ animation: slideUp 0.28s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
2351
+ }
2352
+
2353
+ .head {
2354
+ display: flex;
2355
+ align-items: center;
2356
+ gap: 10px;
2357
+ padding: 18px 20px 0;
2358
+ }
2359
+
2360
+ .head-icon {
2361
+ width: 32px;
2362
+ height: 32px;
2363
+ border-radius: 8px;
2364
+ background: var(--sfx-up-primary-bg, #f5f5f7);
2365
+ display: flex;
2366
+ align-items: center;
2367
+ justify-content: center;
2368
+ flex-shrink: 0;
2369
+ color: var(--sfx-up-primary, #2563eb);
2370
+ }
2371
+
2372
+ .head-icon svg {
2373
+ width: 18px;
2374
+ height: 18px;
2375
+ fill: none;
2376
+ stroke: currentColor;
2377
+ stroke-width: 2;
2378
+ stroke-linecap: round;
2379
+ }
2380
+
2381
+ .title {
2382
+ font-size: 16px;
2383
+ font-weight: 700;
2384
+ color: var(--sfx-up-text, #1a1a1a);
2385
+ flex: 1;
2386
+ }
2387
+
2388
+ .close-btn {
2389
+ width: 28px;
2390
+ height: 28px;
2391
+ border-radius: 8px;
2392
+ border: none;
2393
+ background: var(--sfx-up-border-light, #f0f0f0);
2394
+ color: var(--sfx-up-text-muted, #888);
2395
+ font-size: 14px;
2396
+ cursor: pointer;
2397
+ display: flex;
2398
+ align-items: center;
2399
+ justify-content: center;
2400
+ transition: background 0.15s, color 0.15s;
2401
+ flex-shrink: 0;
2402
+ line-height: 1;
2403
+ }
2404
+
2405
+ .close-btn:hover {
2406
+ background: var(--sfx-up-border, #e4e4e4);
2407
+ color: var(--sfx-up-text, #333);
2408
+ }
2409
+
2410
+ .body {
2411
+ padding: 18px 20px 20px;
2412
+ }
2413
+
2414
+ .field {
2415
+ margin-bottom: 14px;
2416
+ }
2417
+
2418
+ label {
2419
+ display: block;
2420
+ font-size: 12px;
2421
+ font-weight: 600;
2422
+ color: var(--sfx-up-text-muted, #aaa);
2423
+ margin-bottom: 5px;
2424
+ text-transform: uppercase;
2425
+ letter-spacing: 0.7px;
2426
+ }
2427
+
2428
+ label .optional {
2429
+ color: var(--sfx-up-border, #ccc);
2430
+ font-weight: 400;
2431
+ text-transform: none;
2432
+ letter-spacing: 0;
2433
+ }
2434
+
2435
+ input {
2436
+ width: 100%;
2437
+ height: 40px;
2438
+ border: 1.5px solid var(--sfx-up-border, #ebebeb);
2439
+ border-radius: 6px;
2440
+ padding: 0 14px;
2441
+ font-size: 14px;
2442
+ font-family: inherit;
2443
+ color: var(--sfx-up-text, #1a1a1a);
2444
+ background: var(--sfx-up-border-light, #fafafa);
2445
+ transition: border-color 0.15s, background 0.15s;
2446
+ outline: none;
2447
+ box-sizing: border-box;
2448
+ }
2449
+
2450
+ input:focus {
2451
+ border-color: var(--sfx-up-primary, #2563eb);
2452
+ background: var(--sfx-up-bg, #fff);
2453
+ }
2454
+
2455
+ input::placeholder {
2456
+ color: var(--sfx-up-text-muted, #ccc);
2457
+ text-align: center;
2458
+ }
2459
+
2460
+ .error {
2461
+ font-size: 12px;
2462
+ color: var(--sfx-up-error, #dc2626);
2463
+ margin-top: -6px;
2464
+ margin-bottom: 8px;
2465
+ }
2466
+
2467
+ .actions {
2468
+ display: flex;
2469
+ gap: 8px;
2470
+ justify-content: flex-end;
2471
+ margin-top: 18px;
2472
+ }
2473
+
2474
+
2475
+
2476
+ @keyframes fadeIn {
2477
+ from { opacity: 0; }
2478
+ to { opacity: 1; }
2479
+ }
2480
+
2481
+ @keyframes slideUp {
2482
+ from { transform: translateY(18px) scale(0.97); }
2483
+ to { transform: translateY(0) scale(1); }
2484
+ }
2485
+
2486
+ .close-btn:focus-visible {
2487
+ outline: 2px solid var(--sfx-up-primary, #2563eb);
2488
+ outline-offset: 2px;
2489
+ }
2490
+
2491
+ input:focus-visible {
2492
+ outline: none;
2493
+ }
2494
+
2495
+ `];let A=xe;ne([c.state()],A.prototype,"_url");ne([c.state()],A.prototype,"_name");ne([c.state()],A.prototype,"_error");var dt=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&&dt(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`
2496
+ <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2497
+ <div class="card">
2498
+ <div class="head">
2499
+ <div class="head-icon">
2500
+ <svg viewBox="0 0 24 24">
2501
+ <path d="M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"/>
2502
+ <circle cx="12" cy="13" r="4"/>
2503
+ </svg>
2504
+ </div>
2505
+ <div class="title">Camera</div>
2506
+ <button class="close-btn" aria-label="Close" @click=${this._cancel}>\u2715</button>
2507
+ </div>
2508
+ <div class="body">
2509
+ ${this._error?s.html`<div class="error">${this._error}</div>`:this._captured?s.html`
2510
+ <img class="preview-img" src=${this._previewUrl} alt="Captured photo" />
2511
+ <div class="actions">
2512
+ <button class="btn btn-ghost" @click=${this._retake}>Retake</button>
2513
+ <button class="btn btn-primary" @click=${this._usePhoto}>Use photo</button>
2514
+ </div>
2515
+ `:s.html`
2516
+ <video autoplay playsinline muted></video>
2517
+ <canvas></canvas>
2518
+ <div class="actions">
2519
+ <button class="btn-capture" @click=${this._capture}></button>
2520
+ </div>
2521
+ `}
2522
+ </div>
2523
+ </div>
2524
+ </div>
2525
+ `}};ge.styles=[N,X,s.css`
2526
+ :host { display: block; }
2527
+
2528
+ .backdrop {
2529
+ position: fixed; inset: 0; z-index: 1000;
2530
+ background: var(--sfx-up-backdrop, rgba(0, 0, 0, 0.45));
2531
+ backdrop-filter: blur(6px);
2532
+ display: flex; align-items: center; justify-content: center;
2533
+ padding: 20px;
2534
+ animation: fadeIn 0.18s ease both;
2535
+ }
2536
+
2537
+ .card {
2538
+ background: var(--sfx-up-bg, #fff);
2539
+ border-radius: 12px;
2540
+ box-shadow: 0 28px 80px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.06);
2541
+ width: 100%; max-width: 520px;
2542
+ height: 520px;
2543
+ overflow: hidden; display: flex; flex-direction: column;
2544
+ animation: slideUp 0.28s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
2545
+ }
2546
+
2547
+ .head {
2548
+ display: flex; align-items: center; gap: 10px;
2549
+ padding: 18px 20px 0;
2550
+ }
2551
+
2552
+ .head-icon {
2553
+ width: 32px; height: 32px; border-radius: 8px;
2554
+ background: var(--sfx-up-primary-bg, #f5f5f7);
2555
+ display: flex; align-items: center; justify-content: center;
2556
+ flex-shrink: 0; color: var(--sfx-up-primary, #2563eb);
2557
+ }
2558
+
2559
+ .head-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
2560
+
2561
+ .title { font-size: 16px; font-weight: 700; color: var(--sfx-up-text, #1a1a1a); flex: 1; }
2562
+
2563
+ .close-btn {
2564
+ width: 28px; height: 28px; border-radius: 8px; border: none;
2565
+ background: var(--sfx-up-border-light, #f0f0f0); color: var(--sfx-up-text-muted, #888); font-size: 14px; cursor: pointer;
2566
+ display: flex; align-items: center; justify-content: center;
2567
+ transition: background 0.15s, color 0.15s; flex-shrink: 0; line-height: 1;
2568
+ }
2569
+ .close-btn:hover { background: var(--sfx-up-border, #e4e4e4); color: var(--sfx-up-text, #333); }
2570
+
2571
+ .body { padding: 18px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; flex: 1; min-height: 0; justify-content: center; }
2572
+
2573
+ video, canvas {
2574
+ width: 100%; flex: 1; min-height: 0; border-radius: 12px;
2575
+ background: #000; object-fit: cover;
2576
+ }
2577
+
2578
+ canvas { display: none; }
2579
+
2580
+ .preview-img {
2581
+ width: 100%; max-height: 320px; border-radius: 12px;
2582
+ object-fit: contain; background: #000;
2583
+ }
2584
+
2585
+ .error { font-size: 13px; color: var(--sfx-up-error, #dc2626); text-align: center; padding: 40px 20px; }
2586
+
2587
+ .actions { display: flex; gap: 8px; justify-content: center; width: 100%; }
2588
+
2589
+ .btn-capture {
2590
+ width: 52px; height: 52px; border-radius: 50%; padding: 0;
2591
+ background: var(--sfx-up-error, #dc2626); border: 4px solid var(--sfx-up-bg, #fff);
2592
+ box-shadow: 0 0 0 2px var(--sfx-up-error, #dc2626), 0 4px 12px var(--sfx-up-shadow, rgba(220, 38, 38, 0.3));
2593
+ cursor: pointer; transition: all 0.15s;
2594
+ }
2595
+ .btn-capture:hover { background: var(--destructive-foreground, #b91c1c); transform: scale(1.05); }
2596
+
2597
+ .close-btn:focus-visible,
2598
+ .btn-capture:focus-visible {
2599
+ outline: 2px solid var(--sfx-up-primary, #2563eb);
2600
+ outline-offset: 2px;
2601
+ }
2602
+
2603
+ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2604
+ @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2605
+ `];let M=ge;re([c.state()],M.prototype,"_stream");re([c.state()],M.prototype,"_error");re([c.state()],M.prototype,"_captured");re([c.state()],M.prototype,"_previewUrl");var pt=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&&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`
2606
+ <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2607
+ <div class="card">
2608
+ <div class="head">
2609
+ <div class="head-icon">
2610
+ <svg viewBox="0 0 24 24">
2611
+ <rect x="2" y="3" width="20" height="14" rx="2"/>
2612
+ <circle cx="12" cy="10" r="3"/>
2613
+ <path d="M7 21h10"/>
2614
+ </svg>
2615
+ </div>
2616
+ <div class="title">Screen cast</div>
2617
+ <button class="close-btn" aria-label="Close" @click=${this._cancel}>\u2715</button>
2618
+ </div>
2619
+ <div class="body">
2620
+ ${this._error?s.html`<div class="error">${this._error}</div>`:this._recordedBlob?s.html`
2621
+ <video src=${this._previewUrl} controls></video>
2622
+ <div class="actions">
2623
+ <button class="btn btn-ghost" @click=${this._discard}>Discard</button>
2624
+ <button class="btn btn-primary" @click=${this._useRecording}>Use recording</button>
2625
+ </div>
2626
+ `:this._recording?s.html`
2627
+ <video autoplay playsinline muted></video>
2628
+ <div class="status"><div class="rec-dot"></div> Recording...</div>
2629
+ <div class="actions">
2630
+ <button class="btn btn-danger" @click=${this._stopRecording}>Stop recording</button>
2631
+ </div>
2632
+ `:s.html`
2633
+ <div class="start-view">
2634
+ <div class="start-icon">
2635
+ <svg viewBox="0 0 24 24">
2636
+ <rect x="2" y="3" width="20" height="14" rx="2"/>
2637
+ <circle cx="12" cy="10" r="3"/>
2638
+ <path d="M7 21h10"/>
2639
+ </svg>
2640
+ </div>
2641
+ <div class="start-text">Share your screen to record a video that will be added to your uploads.</div>
2642
+ <div class="actions">
2643
+ <button class="btn btn-ghost" @click=${this._cancel}>Cancel</button>
2644
+ <button class="btn btn-primary" @click=${this._startRecording}>Start recording</button>
2645
+ </div>
2646
+ </div>
2647
+ `}
2648
+ </div>
2649
+ </div>
2650
+ </div>
2651
+ `}};ve.styles=[N,X,s.css`
2652
+ :host { display: block; }
2653
+
2654
+ .backdrop {
2655
+ position: fixed; inset: 0; z-index: 1000;
2656
+ background: var(--sfx-up-backdrop, rgba(0, 0, 0, 0.45));
2657
+ backdrop-filter: blur(6px);
2658
+ display: flex; align-items: center; justify-content: center;
2659
+ padding: 20px;
2660
+ animation: fadeIn 0.18s ease both;
2661
+ }
2662
+
2663
+ .card {
2664
+ background: var(--sfx-up-bg, #fff);
2665
+ border-radius: 12px;
2666
+ box-shadow: 0 28px 80px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.06);
2667
+ width: 100%; max-width: 560px;
2668
+ overflow: hidden; display: flex; flex-direction: column;
2669
+ animation: slideUp 0.28s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
2670
+ }
2671
+
2672
+ .head {
2673
+ display: flex; align-items: center; gap: 10px;
2674
+ padding: 18px 20px 0;
2675
+ }
2676
+
2677
+ .head-icon {
2678
+ width: 32px; height: 32px; border-radius: 8px;
2679
+ background: var(--sfx-up-primary-bg, #f5f5f7);
2680
+ display: flex; align-items: center; justify-content: center;
2681
+ flex-shrink: 0; color: var(--sfx-up-primary, #2563eb);
2682
+ }
2683
+
2684
+ .head-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
2685
+
2686
+ .title { font-size: 16px; font-weight: 700; color: var(--sfx-up-text, #1a1a1a); flex: 1; }
2687
+
2688
+ .close-btn {
2689
+ width: 28px; height: 28px; border-radius: 8px; border: none;
2690
+ background: var(--sfx-up-border-light, #f0f0f0); color: var(--sfx-up-text-muted, #888); font-size: 14px; cursor: pointer;
2691
+ display: flex; align-items: center; justify-content: center;
2692
+ transition: background 0.15s, color 0.15s; flex-shrink: 0; line-height: 1;
2693
+ }
2694
+ .close-btn:hover { background: var(--sfx-up-border, #e4e4e4); color: var(--sfx-up-text, #333); }
2695
+
2696
+ .body { padding: 18px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
2697
+
2698
+ video {
2699
+ width: 100%; max-height: 320px; border-radius: 12px;
2700
+ background: #000; object-fit: contain;
2701
+ }
2702
+
2703
+ .error { font-size: 13px; color: var(--sfx-up-error, #dc2626); text-align: center; padding: 40px 20px; }
2704
+
2705
+ .status {
2706
+ font-size: 13px; color: var(--sfx-up-text-secondary, #475569);
2707
+ display: flex; align-items: center; gap: 8px;
2708
+ }
2709
+
2710
+ .rec-dot {
2711
+ width: 10px; height: 10px; border-radius: 50%;
2712
+ background: var(--sfx-up-error, #dc2626); animation: pulse 1s ease-in-out infinite;
2713
+ }
2714
+
2715
+ .actions { display: flex; gap: 8px; justify-content: center; width: 100%; }
2716
+
2717
+ .btn-danger {
2718
+ background: var(--sfx-up-error, #dc2626); color: var(--primary-foreground, #fff);
2719
+ box-shadow: 0 2px 10px var(--sfx-up-shadow, rgba(220, 38, 38, 0.28));
2720
+ }
2721
+ .btn-danger:hover { background: var(--destructive-foreground, #b91c1c); }
2722
+
2723
+ .start-view {
2724
+ display: flex; flex-direction: column; align-items: center; gap: 16px;
2725
+ padding: 30px 20px; text-align: center;
2726
+ }
2727
+
2728
+ .start-icon {
2729
+ width: 56px; height: 56px; border-radius: 16px;
2730
+ background: var(--sfx-up-primary-bg, #eff6ff);
2731
+ color: var(--sfx-up-primary, #2563eb);
2732
+ display: flex; align-items: center; justify-content: center;
2733
+ }
2734
+
2735
+ .start-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
2736
+
2737
+ .start-text {
2738
+ font-size: 14px; color: var(--sfx-up-text-secondary, #475569); max-width: 300px;
2739
+ }
2740
+
2741
+ .close-btn:focus-visible {
2742
+ outline: 2px solid var(--sfx-up-primary, #2563eb);
2743
+ outline-offset: 2px;
2744
+ }
2745
+
2746
+ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2747
+ @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2748
+ @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
2749
+ `];let F=ve;W([c.state()],F.prototype,"_stream");W([c.state()],F.prototype,"_recording");W([c.state()],F.prototype,"_error");W([c.state()],F.prototype,"_recordedBlob");W([c.state()],F.prototype,"_previewUrl");var ct=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&&ct(e,t,r),r};const Ce=new Set(["unsplash"]);var C;const m=(C=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=T,this._cachedSourcesConfig=void 0,this._rejectedTimers=new Map,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(Ce.has(e)){if(!customElements.get("sfx-search-provider-browser")){const{SfxSearchProviderBrowser:l}=await Promise.resolve().then(()=>require("./search-provider-browser-BM-foEWT.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-DajdSDoL.cjs"));customElements.define("sfx-provider-browser",l)}this._activeConnector=e}},this._onUrlSubmit=e=>{var h,u,f;this._showUrlDialog=!1;const{url:t,name:i}=e.detail,r=(h=this.config)==null?void 0:h.callbacks,o=Ne(i),a=o.startsWith("image/"),l=this._store.getState(),d=oe({name:i,size:0,type:o},l.restrictions,l.files);if(d){const x={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};O(this._store,x),this._dispatchPublic(g.FILE_REJECTED,{file:x,reason:d}),(u=r==null?void 0:r.onFileRejected)==null||u.call(r,x,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};O(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(f=r==null?void 0:r.onFileAdded)==null||f.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=>C._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;(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};O(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};O(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;this._dispatchPublic(g.COMPLETE_ACTION,{}),((e=this.config)==null?void 0:e.mode)==="modal"?this.close():((t=this.config)==null?void 0:t.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=Se(),this._storeCtrl=new De(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,((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(p=>p.status==="idle"||p.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||!C._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||!C._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=`
2750
+ [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; }
2751
+ [data-sfx-upload-float] .float-header { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; border-bottom:1px solid #e8edf5; }
2752
+ [data-sfx-upload-float] .float-header-left { display:flex; align-items:center; gap:8px; }
2753
+ [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; }
2754
+ [data-sfx-upload-float] .float-icon svg { width:14px; height:14px; }
2755
+ [data-sfx-upload-float] .float-icon.done { background:#f0fdf4; color:#22c55e; }
2756
+ [data-sfx-upload-float] .float-title { font-size:13px; font-weight:600; color:#1e293b; }
2757
+ [data-sfx-upload-float] .float-subtitle { font-size:11px; color:#94a3b8; }
2758
+ [data-sfx-upload-float] .float-actions { display:flex; gap:4px; }
2759
+ [data-sfx-upload-float] .float-actions button { width:26px; height:26px; border:none; background:none; cursor:pointer; border-radius:6px; display:flex; align-items:center; justify-content:center; color:#94a3b8; transition:background .15s; padding:0; }
2760
+ [data-sfx-upload-float] .float-actions button:hover { background:#f8fafc; color:#374151; }
2761
+ [data-sfx-upload-float] .float-actions button svg { width:14px; height:14px; }
2762
+ [data-sfx-upload-float] .float-progress { padding:10px 14px; border-bottom:1px solid #e8edf5; }
2763
+ [data-sfx-upload-float] .float-progress-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
2764
+ [data-sfx-upload-float] .float-progress-label { font-size:12px; color:#475569; }
2765
+ [data-sfx-upload-float] .float-progress-pct { font-size:12px; font-weight:600; color:#2563eb; }
2766
+ [data-sfx-upload-float] .float-progress-pct.done { color:#22c55e; }
2767
+ [data-sfx-upload-float] .float-bar { height:4px; background:#e8edf5; border-radius:2px; overflow:hidden; }
2768
+ [data-sfx-upload-float] .float-bar-fill { height:100%; background:#2563eb; border-radius:2px; transition:width .3s ease; }
2769
+ [data-sfx-upload-float] .float-bar-fill.done { background:#22c55e; }
2770
+ [data-sfx-upload-float] .float-items { max-height:200px; overflow-y:auto; }
2771
+ [data-sfx-upload-float] .float-item { display:flex; align-items:center; gap:10px; padding:8px 14px; border-bottom:1px solid #f1f5f9; }
2772
+ [data-sfx-upload-float] .float-item:last-child { border-bottom:none; }
2773
+ [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; }
2774
+ [data-sfx-upload-float] .float-item-thumb svg { width:16px; height:16px; }
2775
+ [data-sfx-upload-float] .float-item-info { flex:1; min-width:0; }
2776
+ [data-sfx-upload-float] .float-item-name { font-size:12px; font-weight:500; color:#1e293b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
2777
+ [data-sfx-upload-float] .float-item-size { font-size:11px; color:#94a3b8; }
2778
+ [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; }
2779
+ [data-sfx-upload-float] .float-item-done svg { width:12px; height:12px; }
2780
+ [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; }
2781
+ [data-sfx-upload-float] .float-item-error { color:#ef4444; width:16px; height:16px; flex-shrink:0; }
2782
+ [data-sfx-upload-float] .float-collapsed { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; width:320px; border-radius:12px; }
2783
+ [data-sfx-upload-float] .float-collapsed-left { display:flex; align-items:center; gap:8px; }
2784
+ [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; }
2785
+ [data-sfx-upload-float] .float-collapsed-icon { width:18px; height:18px; flex-shrink:0; }
2786
+ [data-sfx-upload-float] .float-collapsed-icon svg { width:18px; height:18px; }
2787
+ [data-sfx-upload-float] .float-collapsed-icon.done { color:#22c55e; }
2788
+ [data-sfx-upload-float] .float-collapsed-text { font-size:13px; font-weight:500; color:#1e293b; white-space:nowrap; }
2789
+ [data-sfx-upload-float] .float-collapsed-pct { font-size:13px; font-weight:600; color:#2563eb; }
2790
+ [data-sfx-upload-float] .float-collapsed-actions { display:flex; gap:4px; }
2791
+ [data-sfx-upload-float] .float-collapsed-actions button { width:26px; height:26px; border:none; background:none; cursor:pointer; border-radius:6px; display:flex; align-items:center; justify-content:center; color:#94a3b8; transition:background .15s; padding:0; }
2792
+ [data-sfx-upload-float] .float-collapsed-actions button:hover { background:#f1f5f9; color:#374151; }
2793
+ [data-sfx-upload-float] .float-collapsed-actions button svg { width:14px; height:14px; }
2794
+ @keyframes sfxFloatIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
2795
+ @keyframes sfxSpin { to{transform:rotate(360deg)} }
2796
+ `,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();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=ee(t.container),this._authHeaders=G(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 Ee(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;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 x=t.files.get(u);if(x){if(x.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 b=new Error(f.error??"Upload failed");this._dispatchPublic(g.UPLOAD_ERROR,{file:f,error:b}),(a=i==null?void 0:i.onUploadError)==null||a.call(i,f,b);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"&&x.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}),(p=i==null?void 0:i.onTotalProgress)==null||p.call(i,e.totalProgress,e.totalSpeed,u)}if(t.isUploading&&!e.isUploading){const u=[...e.files.values()];if(!u.some(x=>x.status==="cancelled")){const x=u.filter(v=>v.status==="complete"),b=u.filter(v=>v.status==="failed"||v.status==="error");this._dispatchPublic(g.ALL_COMPLETE,{successful:x,failed:b}),(h=i==null?void 0:i.onAllComplete)==null||h.call(i,x,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=T,this._cachedSources;const t=e.providers.length>0?ze(e.providers):[],i=e.customSources??[],r=T.filter(p=>p.id==="device"||p.id==="url"),o=T.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(C._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")?"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=We(l,d.restrictions,d.files);if(p){const f={id:B(),status:"rejected",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:p,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};O(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 x=(o=this.config)==null?void 0:o.rejectedFileAutoRemoveDelay,b=x===!1||x===0?0:x??4e3;if(b>0){const v=f.id,_=setTimeout(()=>{this._rejectedTimers.delete(v);const k=this._store.getState().files.get(v);k&&k.status==="rejected"&&be(this._store,v)},b);this._rejectedTimers.set(v,_)}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(O(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/")){Xe(l).then(x=>{if(!x)return;const b=this._store.getState(),v=b.files.get(u.id);if(v){const _=new Map(b.files);_.set(u.id,{...v,previewUrl:x}),this._store.setState({files:_})}else URL.revokeObjectURL(x)});const f=document.createElement("video");f.preload="metadata",f.src=URL.createObjectURL(l),f.onerror=()=>{URL.revokeObjectURL(f.src)},f.onloadedmetadata=()=>{const x=f.duration;if(URL.revokeObjectURL(f.src),!isFinite(x))return;const b=this._store.getState(),v=b.files.get(u.id);if(v){const _=new Map(b.files);_.set(u.id,{...v,duration:x}),this._store.setState({files:_})}}}}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)),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 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`
2797
+ ${this._isOpen&&!this._isMinimized?s.html`
2798
+ <div class="modal-backdrop" @click=${this._onModalBackdropClick}>
2799
+ <div class="modal-card">
2800
+ ${this._renderHeader()}
2801
+ ${this._renderBody()}
2802
+ </div>
2803
+ </div>
2804
+ `:s.nothing}
2805
+ `:s.html`
2806
+ <div class="inline">
2807
+ ${this._renderHeader()}
2808
+ ${this._renderBody()}
2809
+ </div>
2810
+ `}_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(f=>f.status==="complete").length,u=d.totalSpeed>0?(d.totalBytes-d.totalBytesUploaded)/d.totalSpeed:0;return s.html`
2811
+ <div class="header upload-header">
2812
+ <div class="float-header-left">
2813
+ <div class="float-icon">
2814
+ <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>
2815
+ </div>
2816
+ <div>
2817
+ <div class="float-title">Uploading ${p.length} ${p.length===1?"file":"files"}</div>
2818
+ <div class="float-subtitle">${h} of ${p.length}${u>0?` · ~${ie(u)} left`:""}</div>
2819
+ </div>
2820
+ </div>
2821
+ </div>
2822
+ `}const e=((a=this.config)==null?void 0:a.mode)??"modal",t=((l=this.config)==null?void 0:l.headerButton)??(e==="modal"?"close":"none"),i=e==="modal"?this._onModalDismiss:this._onInlineDismiss,r=t==="back"?s.html`<button class="header-btn header-btn-back" aria-label="Back to Asset Picker" @click=${i}>
2823
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2824
+ <polyline points="15 18 9 12 15 6"/>
2825
+ </svg>
2826
+ </button>`:s.nothing,o=t==="close"?s.html`<button class="header-btn header-btn-close" aria-label="Close" @click=${i}>
2827
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
2828
+ <line x1="18" y1="6" x2="6" y2="18" />
2829
+ <line x1="6" y1="6" x2="18" y2="18" />
2830
+ </svg>
2831
+ </button>`:s.nothing;return s.html`
2832
+ <div class="header">
2833
+ ${r}
2834
+ ${t!=="back"?s.html`
2835
+ <div class="header-icon">
2836
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
2837
+ <polyline points="16 16 12 12 8 16" />
2838
+ <line x1="12" y1="12" x2="12" y2="21" />
2839
+ <path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3" />
2840
+ </svg>
2841
+ </div>`:s.nothing}
2842
+ <div class="header-title">Upload Files</div>
2843
+ ${o}
2844
+ </div>
2845
+ `}_getImageDimensions(e){return e.previewUrl?this._dimCache.has(e.id)?Promise.resolve(this._dimCache.get(e.id)):new Promise(t=>{const i=new Image;i.onload=()=>{const r={w:i.naturalWidth,h:i.naturalHeight};this._dimCache.set(e.id,r),t(r)},i.onerror=()=>{this._dimCache.set(e.id,null),t(null)},i.src=e.previewUrl}):Promise.resolve(null)}_renderUploadOverlay(e){const t=this._storeCtrl.state,i=Math.round(t.totalProgress??0),r=e.filter(a=>a.status==="complete").length,o=t.totalSpeed>0?(t.totalBytes-t.totalBytesUploaded)/t.totalSpeed:0;return s.html`
2846
+ <div class="upload-overlay">
2847
+ <div class="upload-overlay-spinner"></div>
2848
+ <div class="upload-overlay-percent">${i}%</div>
2849
+ <div class="upload-overlay-title">Uploading ${e.length} ${e.length===1?"file":"files"}</div>
2850
+ <div class="upload-overlay-subtitle">${r} of ${e.length} complete${o>0?s.html` · ~${ie(o)} left`:s.nothing}</div>
2851
+ <div class="upload-overlay-bar">
2852
+ <div class="upload-overlay-bar-fill" style="width:${i}%"></div>
2853
+ </div>
2854
+ <button class="upload-overlay-minimize" @click=${this._onMinimize}>Minimize & continue in background</button>
2855
+ </div>
2856
+ `}_renderFloatingPill(e){const t=this._storeCtrl.state,i=Math.round(t.totalProgress??0),r=this._phase==="complete",o=e.filter(l=>l.status==="complete").length,a=t.totalSpeed>0?(t.totalBytes-t.totalBytesUploaded)/t.totalSpeed:0;return this._isPillExpanded===!1?s.html`
2857
+ <div class="upload-float float-collapsed">
2858
+ <div class="float-collapsed-left">
2859
+ ${r?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>`}
2860
+ <span class="float-collapsed-text">${r?"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</span>
2861
+ ${r?s.nothing:s.html`<span class="float-collapsed-pct">${i}%</span>`}
2862
+ </div>
2863
+ <div class="float-collapsed-actions">
2864
+ <button title="Expand" @click=${this._onPillClick}>
2865
+ <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>
2866
+ </button>
2867
+ <button title="Dismiss" @click=${this._onPillDismiss}>
2868
+ <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>
2869
+ </button>
2870
+ </div>
2871
+ </div>
2872
+ `:s.html`
2873
+ <div class="upload-float">
2874
+ <div class="float-header">
2875
+ <div class="float-header-left">
2876
+ <div class="float-icon ${r?"done":""}">
2877
+ ${r?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>`}
2878
+ </div>
2879
+ <div>
2880
+ <div class="float-title">${r?"Upload complete":`Uploading ${e.length} ${e.length===1?"file":"files"}`}</div>
2881
+ <div class="float-subtitle">${r?`${o} ${o===1?"file":"files"} uploaded`:`${o} of ${e.length}${a>0?` · ~${ie(a)} left`:""}`}</div>
2882
+ </div>
2883
+ </div>
2884
+ <div class="float-actions">
2885
+ <button title="Collapse" @click=${this._onPillClick}>
2886
+ <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>
2887
+ </button>
2888
+ <button title="Dismiss" @click=${this._onPillDismiss}>
2889
+ <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>
2890
+ </button>
2891
+ </div>
2892
+ </div>
2893
+ <div class="float-progress">
2894
+ <div class="float-progress-top">
2895
+ <span class="float-progress-label">Overall progress</span>
2896
+ <span class="float-progress-pct ${r?"done":""}">${r?"Done":`${i}%`}</span>
2897
+ </div>
2898
+ <div class="float-bar"><div class="float-bar-fill ${r?"done":""}" style="width:${r?100:i}%"></div></div>
2899
+ </div>
2900
+ <div class="float-items">
2901
+ ${e.map(l=>s.html`
2902
+ <div class="float-item">
2903
+ <div class="float-item-thumb">
2904
+ <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>
2905
+ </div>
2906
+ <div class="float-item-info">
2907
+ <div class="float-item-name">${l.name}</div>
2908
+ <div class="float-item-size">${R(l.size)}</div>
2909
+ </div>
2910
+ <div class="float-item-status">
2911
+ ${l.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>`:l.status==="failed"||l.status==="error"?s.html`<svg class="float-item-error" 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>`:s.html`<div class="float-item-spinner"></div>`}
2912
+ </div>
2913
+ </div>
2914
+ `)}
2915
+ </div>
2916
+ </div>
2917
+ `}_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`
2918
+ <div class="preview-topbar"></div>
2919
+ <div class="preview-layout">
2920
+ <div class="file-grid-side">
2921
+ <div class="file-grid-header">
2922
+ <span class="file-grid-header-text">${e.length} ${e.length===1?"asset":"assets"} · ${R(a)}</span>
2923
+ </div>
2924
+ <sfx-file-list
2925
+ .files=${e}
2926
+ .showDropTile=${!0}
2927
+ .sources=${this._mergedSources}
2928
+ .accept=${we(this._storeCtrl.state.restrictions)}
2929
+ @files-selected=${this._onFilesSelected}
2930
+ @source-click=${this._onDropTileSourceClick}
2931
+ ></sfx-file-list>
2932
+ </div>
2933
+ <div class="preview-divider"></div>
2934
+ <div class="preview-panel">
2935
+ <div class="preview-panel-header">
2936
+ <span class="preview-panel-filename" title=${t.name}>${t.name}</span>
2937
+ <div class="preview-header-actions">
2938
+ ${t.previewUrl||t.type.startsWith("video/")&&t.file?s.html`
2939
+ <button @click=${()=>{this._fullscreenPreviewUrl=t.previewUrl,this._fullscreenVideoFile=t.type.startsWith("video/")&&t.file?t.file:null,this._fullscreenZoomed=!1}} title="Fullscreen">
2940
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
2941
+ <polyline points="15 3 21 3 21 9" />
2942
+ <polyline points="9 21 3 21 3 15" />
2943
+ <line x1="21" y1="3" x2="14" y2="10" />
2944
+ <line x1="3" y1="21" x2="10" y2="14" />
2945
+ </svg>
2946
+ </button>
2947
+ `:s.nothing}
2948
+ <button @click=${()=>{this._previewFileId=null}} title="Close">
2949
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
2950
+ <line x1="18" y1="6" x2="6" y2="18" />
2951
+ <line x1="6" y1="6" x2="18" y2="18" />
2952
+ </svg>
2953
+ </button>
2954
+ </div>
2955
+ </div>
2956
+ ${t.type.startsWith("video/")&&t.file?s.html`
2957
+ <div class="preview-img-wrap">
2958
+ <video class="preview-image" src=${this._getVideoBlobUrl(t.file)} controls playsinline></video>
2959
+ <button class="preview-nav prev" ?disabled=${e.indexOf(t)===0} @click=${()=>this._navigatePreview(e,-1)}>
2960
+ <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>
2961
+ </button>
2962
+ <button class="preview-nav next" ?disabled=${e.indexOf(t)===e.length-1} @click=${()=>this._navigatePreview(e,1)}>
2963
+ <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>
2964
+ </button>
2965
+ </div>
2966
+ `:t.previewUrl?s.html`
2967
+ <div class="preview-img-wrap">
2968
+ <img class="preview-image" src=${t.previewUrl} alt=${t.name} />
2969
+ <button class="preview-nav prev" ?disabled=${e.indexOf(t)===0} @click=${()=>this._navigatePreview(e,-1)}>
2970
+ <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>
2971
+ </button>
2972
+ <button class="preview-nav next" ?disabled=${e.indexOf(t)===e.length-1} @click=${()=>this._navigatePreview(e,1)}>
2973
+ <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>
2974
+ </button>
2975
+ </div>
2976
+ `:s.html`
2977
+ <div class="preview-doc-wrap ${q(t)}">
2978
+ <div class="preview-doc-icon ${q(t)}">
2979
+ ${this._renderDocTypeIcon(q(t))}
2980
+ <span class="preview-doc-ext ${q(t)}">${i}</span>
2981
+ </div>
2982
+ <button class="preview-nav prev" ?disabled=${e.indexOf(t)===0} @click=${()=>this._navigatePreview(e,-1)}>
2983
+ <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>
2984
+ </button>
2985
+ <button class="preview-nav next" ?disabled=${e.indexOf(t)===e.length-1} @click=${()=>this._navigatePreview(e,1)}>
2986
+ <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>
2987
+ </button>
2988
+ </div>
2989
+ `}
2990
+ <div class="preview-meta-list">
2991
+ <div class="preview-meta-row">
2992
+ <span class="preview-meta-label">Type</span>
2993
+ <span class="preview-meta-value">${i}</span>
2994
+ </div>
2995
+ <div class="preview-meta-row">
2996
+ <span class="preview-meta-label">Size</span>
2997
+ <span class="preview-meta-value">${R(t.size)}</span>
2998
+ </div>
2999
+ <div class="preview-meta-row">
3000
+ <span class="preview-meta-label">Dimensions</span>
3001
+ <span class="preview-meta-value">${this._previewDims}</span>
3002
+ </div>
3003
+ <div class="preview-meta-row">
3004
+ <span class="preview-meta-label">Name</span>
3005
+ <span class="preview-meta-value truncate" title=${t.name}>${t.name}</span>
3006
+ </div>
3007
+ ${o?s.html`
3008
+ <div class="preview-meta-row">
3009
+ <span class="preview-meta-label">Folder</span>
3010
+ <span class="preview-meta-value">${o}</span>
3011
+ </div>`:s.html`
3012
+ <div class="preview-meta-row">
3013
+ <span class="preview-meta-label">Added</span>
3014
+ <span class="preview-meta-value">${r}</span>
3015
+ </div>`}
3016
+ </div>
3017
+ </div>
3018
+ </div>
3019
+ `}_renderDocTypeIcon(e){switch(e){case"pdf":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>`;case"doc":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>`;case"vid":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>`;case"zip":return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M21 8v13H3V8"/><path d="M1 3h22v5H1z"/><path d="M10 12h4"/></svg>`;default:return s.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z"/><polyline points="13 2 13 9 20 9"/></svg>`}}_navigatePreview(e,t){var o;const r=e.findIndex(a=>a.id===this._previewFileId)+t;if(r>=0&&r<e.length){const a=(o=this.shadowRoot)==null?void 0:o.querySelector(".preview-image[controls]");a&&(a.pause(),a.removeAttribute("src"),a.load()),this._previewFileId=e[r].id}}_renderBody(){var a,l,d;const e=this._storeCtrl.state,t=[...e.files.values()],i=this._phase,r=we(e.restrictions),o=t.length>0;return s.html`
3020
+ <div class="content"
3021
+ @files-selected=${this._onFilesSelected}
3022
+ @source-click=${this._onSourceClick}
3023
+ @file-remove=${this._onFileRemove}
3024
+ @file-preview=${this._onFilePreview}
3025
+ @file-retry=${this._onFileRetry}
3026
+ @fill-metadata=${this._onFillMetadata}
3027
+ @retry-all=${this._onRetryAll}
3028
+ @clear-all=${this._onClearAll}
3029
+ @add-more=${this._onAddMore}
3030
+ @upload-start=${this._onUploadStart}
3031
+ @upload-more=${this._onUploadMore}
3032
+ @primary-action=${this._onPrimaryAction}
3033
+ @connector-files-selected=${this._onConnectorFilesSelected}
3034
+ @connector-close=${this._onConnectorClose}
3035
+ @url-submit=${this._onUrlSubmit}
3036
+ @url-cancel=${this._onUrlCancel}
3037
+ @camera-capture=${this._onCameraCapture}
3038
+ @camera-cancel=${this._onCameraCancel}
3039
+ @screencast-capture=${this._onScreenCastCapture}
3040
+ @screencast-cancel=${this._onScreenCastCancel}
3041
+ >
3042
+ <div
3043
+ class="body ${o?"has-files":""} ${this._bodyDragOver?"body-drag-over":""}"
3044
+ @dragenter=${o?this._onBodyDragEnter:s.nothing}
3045
+ @dragover=${o?this._onBodyDragOver:s.nothing}
3046
+ @dragleave=${o?this._onBodyDragLeave:s.nothing}
3047
+ @drop=${o?this._onBodyDrop:s.nothing}
3048
+ >
3049
+ ${i==="complete"?s.html`
3050
+ <sfx-success-card
3051
+ .fileCount=${t.filter(p=>p.status==="complete").length}
3052
+ .totalSize=${t.filter(p=>p.status==="complete").reduce((p,h)=>p+(h.size||0),0)}
3053
+ .thumbnails=${t.filter(p=>p.status==="complete"&&p.previewUrl).map(p=>p.previewUrl)}
3054
+ ></sfx-success-card>
3055
+ `:i==="uploading"?this._renderUploadOverlay(t):s.html`
3056
+ ${o?s.nothing:s.html`<sfx-drop-zone
3057
+ .compact=${o}
3058
+ .externalDragOver=${this._bodyDragOver}
3059
+ .accept=${r}
3060
+ .sources=${this._mergedSources}
3061
+ .sourcesLayout=${((a=this.config)==null?void 0:a.sourcesLayout)??"pills"}
3062
+ ></sfx-drop-zone>`}
3063
+
3064
+ ${o?this._previewFileId?this._renderPreviewLayout(t):s.html`
3065
+ <div class="asset-count">${t.length} ${t.length===1?"file":"files"} · ${R(t.reduce((p,h)=>p+(h.size||0),0))}</div>
3066
+ <sfx-file-list
3067
+ .files=${t}
3068
+ .showDropTile=${!0}
3069
+ .sources=${this._mergedSources}
3070
+ .accept=${r}
3071
+ @files-selected=${this._onFilesSelected}
3072
+ @source-click=${this._onDropTileSourceClick}
3073
+ ></sfx-file-list>
3074
+ `:s.nothing}
3075
+ `}
3076
+ </div>
3077
+
3078
+ ${o&&i!=="complete"&&i!=="uploading"?s.html`
3079
+ <sfx-actions-bar
3080
+ .uploadState=${"idle"}
3081
+ .fileCount=${t.length}
3082
+ .totalSize=${t.reduce((p,h)=>p+(h.size||0),0)}
3083
+ .failedCount=${t.filter(p=>p.status==="failed"||p.status==="error").length}
3084
+ .completedCount=${t.filter(p=>p.status==="complete").length}
3085
+ .uploadProgress=${e.totalProgress??0}
3086
+ .showFillMetadata=${!!((l=this.config)!=null&&l.showFillMetadata)}
3087
+ ></sfx-actions-bar>
3088
+ `:s.nothing}
3089
+
3090
+ ${this._showUrlDialog?s.html`<sfx-url-dialog></sfx-url-dialog>`:s.nothing}
3091
+ ${this._showCameraDialog?s.html`<sfx-camera-dialog></sfx-camera-dialog>`:s.nothing}
3092
+ ${this._showScreenCastDialog?s.html`<sfx-screen-cast-dialog></sfx-screen-cast-dialog>`:s.nothing}
3093
+ ${this._activeConnector&&((d=this.config)!=null&&d.connectors)?s.html`
3094
+ <div class="connector-modal-backdrop" @click=${this._onConnectorBackdropClick}>
3095
+ <div class="connector-modal">
3096
+ ${Ce.has(this._activeConnector)?s.html`
3097
+ <sfx-search-provider-browser
3098
+ .provider=${this._activeConnector}
3099
+ .companionUrl=${this.config.connectors.companionUrl}
3100
+ ></sfx-search-provider-browser>
3101
+ `:s.html`
3102
+ <sfx-provider-browser
3103
+ .provider=${this._activeConnector}
3104
+ .companionUrl=${this.config.connectors.companionUrl}
3105
+ ></sfx-provider-browser>
3106
+ `}
3107
+ </div>
3108
+ </div>
3109
+ `:s.nothing}
3110
+
3111
+ ${this._fullscreenPreviewUrl||this._fullscreenVideoFile?s.html`
3112
+ <div
3113
+ class="fs-overlay ${this._fullscreenZoomed?"zoomed":""} ${this._fsDragging?"panning":""}"
3114
+ @click=${this._onFsOverlayClick}
3115
+ @mousedown=${this._onFsPanStart}
3116
+ @mousemove=${this._onFsPanMove}
3117
+ @mouseup=${this._onFsPanEnd}
3118
+ @mouseleave=${this._onFsPanEnd}
3119
+ @touchstart=${this._onFsTouchStart}
3120
+ @touchmove=${this._onFsTouchMove}
3121
+ @touchend=${this._onFsPanEnd}
3122
+ >
3123
+ <div class="fs-toolbar" @click=${p=>p.stopPropagation()}>
3124
+ <button class="fs-btn" @click=${this._onFsToggleZoom} title="${this._fullscreenZoomed?"Zoom out":"Zoom in"}">
3125
+ ${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>`}
3126
+ </button>
3127
+ <button class="fs-btn" @click=${this._onFsClose} title="Close">
3128
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
3129
+ <line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
3130
+ </svg>
3131
+ </button>
3132
+ </div>
3133
+ ${this._fullscreenVideoFile?s.html`<video
3134
+ class="fs-img"
3135
+ src=${this._getVideoBlobUrl(this._fullscreenVideoFile)}
3136
+ controls playsinline
3137
+ draggable="false"
3138
+ @click=${p=>p.stopPropagation()}
3139
+ ></video>`:s.html`<img
3140
+ class="fs-img"
3141
+ src=${this._fullscreenPreviewUrl}
3142
+ alt=""
3143
+ style=${this._fullscreenZoomed?`transform: scale(2) translate(${this._fsPanX}px, ${this._fsPanY}px)`:""}
3144
+ draggable="false"
3145
+ />`}
3146
+ <button class="fs-nav prev" @click=${p=>{p.stopPropagation(),this._navigateFs(-1)}}>
3147
+ <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>
3148
+ </button>
3149
+ <button class="fs-nav next" @click=${p=>{p.stopPropagation(),this._navigateFs(1)}}>
3150
+ <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>
3151
+ </button>
3152
+ </div>
3153
+ `:s.nothing}
3154
+ </div>
3155
+ `}_navigateFs(e){const t=[...this._store.getState().files.values()].filter(o=>o.previewUrl||o.type.startsWith("video/")&&o.file),i=t.findIndex(o=>o.id===this._previewFileId);if(i===-1)return;const r=i+e;if(r>=0&&r<t.length){const o=t[r];this._fullscreenPreviewUrl=o.previewUrl,this._fullscreenVideoFile=o.type.startsWith("video/")&&o.file?o.file:null,this._previewFileId=o.id,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0}}_getVideoBlobUrl(e){let t=this._videoBlobUrls.get(e);return t||(t=URL.createObjectURL(e),this._videoBlobUrls.set(e,t)),t}_revokeVideoBlobUrls(){for(const e of this._videoBlobUrls.values())URL.revokeObjectURL(e);this._videoBlobUrls.clear()}},C.styles=s.css`
3156
+ :host {
3157
+ display: block;
3158
+ font-family: var(--sfx-up-font, 'Inter', system-ui, -apple-system, sans-serif);
3159
+ color: var(--sfx-up-text, #1e293b);
3160
+ /* Bridge to Scaleflex design system with standalone fallbacks */
3161
+ --sfx-up-primary: var(--primary, #2563eb);
3162
+ --sfx-up-primary-hover: var(--primary-hover, #1d4ed8);
3163
+ --sfx-up-primary-mid: var(--primary-mid, #3b82f6);
3164
+ --sfx-up-primary-bg: var(--accent, #eff6ff);
3165
+ --sfx-up-primary-glow: rgba(37, 99, 235, 0.18);
3166
+ --sfx-up-success: var(--success, #16a34a);
3167
+ --sfx-up-error: var(--destructive, #dc2626);
3168
+ --sfx-up-text: var(--foreground, #1e293b);
3169
+ --sfx-up-text-secondary: var(--secondary-foreground, #475569);
3170
+ --sfx-up-text-muted: var(--muted-foreground, #94a3b8);
3171
+ --sfx-up-border: var(--border, #e8edf5);
3172
+ --sfx-up-border-light: var(--muted, #f1f5f9);
3173
+ --sfx-up-bg: var(--background, #ffffff);
3174
+ --sfx-up-radius: 16px;
3175
+ --sfx-up-font: 'Inter', system-ui, -apple-system, sans-serif;
3176
+ --sfx-up-shadow: var(--shadow, rgba(0, 0, 0, 0.1));
3177
+ --sfx-up-surface: var(--card, #f8fafc);
3178
+ --sfx-up-backdrop: rgba(0, 0, 0, 0.45);
3179
+ --sfx-up-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
3180
+ --sfx-up-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
3181
+ --sfx-up-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.06);
3182
+ --sfx-up-ring: var(--ring, oklch(0.578 0.198 268.129 / 0.7));
3183
+ --sfx-up-max-height: 88vh;
3184
+ }
3185
+
3186
+ /* --- Modal overlay --- */
3187
+ .modal-backdrop {
3188
+ position: fixed;
3189
+ inset: 0;
3190
+ background: var(--sfx-up-backdrop);
3191
+ backdrop-filter: blur(6px);
3192
+ display: flex;
3193
+ align-items: center;
3194
+ justify-content: center;
3195
+ z-index: 9999;
3196
+ padding: 24px;
3197
+ animation: fadeIn 0.2s ease;
3198
+ }
3199
+
3200
+ .modal-card {
3201
+ background: var(--sfx-up-bg, #fff);
3202
+ border-radius: 16px;
3203
+ box-shadow: 0 28px 80px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.06);
3204
+ width: 100%;
3205
+ max-width: 912px;
3206
+ min-height: var(--sfx-up-min-height, 660px);
3207
+ max-height: var(--sfx-up-max-height, 88vh);
3208
+ display: flex;
3209
+ flex-direction: column;
3210
+ overflow: hidden;
3211
+ position: relative;
3212
+ animation: modalIn 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
3213
+ }
3214
+
3215
+ /* --- Header --- */
3216
+ .header {
3217
+ display: flex;
3218
+ align-items: center;
3219
+ padding: 16px 24px;
3220
+ background: var(--sfx-up-bg, #fff);
3221
+ border-bottom: 1px solid var(--sfx-up-border, #e2e8f0);
3222
+ flex-shrink: 0;
3223
+ }
3224
+
3225
+ .header-icon {
3226
+ width: 32px;
3227
+ height: 32px;
3228
+ border-radius: 8px;
3229
+ background: var(--sfx-up-primary-bg, #eff6ff);
3230
+ color: var(--sfx-up-primary, #2563eb);
3231
+ display: flex;
3232
+ align-items: center;
3233
+ justify-content: center;
3234
+ margin-right: 12px;
3235
+ flex-shrink: 0;
3236
+ }
3237
+
3238
+ .header-icon-done {
3239
+ background: var(--sfx-up-primary-bg, #eff6ff);
3240
+ color: var(--sfx-up-primary, #2563eb);
3241
+ }
3242
+
3243
+ .header-icon svg {
3244
+ width: 16px;
3245
+ height: 16px;
3246
+ }
3247
+
3248
+ .header-title {
3249
+ font-size: 16px;
3250
+ font-weight: 700;
3251
+ color: var(--sfx-up-text, #111827);
3252
+ flex: 1;
3253
+ }
3254
+
3255
+ .header-btn {
3256
+ width: 30px;
3257
+ height: 30px;
3258
+ border-radius: 8px;
3259
+ border: none;
3260
+ background: var(--sfx-up-surface, #f8fafc);
3261
+ color: var(--sfx-up-text-muted, #94a3b8);
3262
+ cursor: pointer;
3263
+ display: flex;
3264
+ align-items: center;
3265
+ justify-content: center;
3266
+ transition: background 0.15s, color 0.15s;
3267
+ flex-shrink: 0;
3268
+ }
3269
+
3270
+ .header-btn svg {
3271
+ width: 16px;
3272
+ height: 16px;
3273
+ }
3274
+
3275
+ .header-btn:hover {
3276
+ background: var(--sfx-up-border, #e2e8f0);
3277
+ color: var(--sfx-up-text, #1e293b);
3278
+ }
3279
+
3280
+ .header-btn:focus-visible {
3281
+ outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
3282
+ outline-offset: 2px;
3283
+ }
3284
+
3285
+ .header-btn-back {
3286
+ margin-right: 12px;
3287
+ background: var(--sfx-up-primary-bg, #eff6ff);
3288
+ color: var(--sfx-up-primary, #2563eb);
3289
+ width: 32px;
3290
+ height: 32px;
3291
+ position: relative;
3292
+ }
3293
+
3294
+ .header-btn-back:hover {
3295
+ background: #dbeafe;
3296
+ color: var(--sfx-up-primary, #2563eb);
3297
+ box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
3298
+ }
3299
+
3300
+ .header-btn-back::after {
3301
+ content: 'Back to Asset Picker';
3302
+ position: absolute;
3303
+ left: calc(100% + 8px);
3304
+ top: 50%;
3305
+ transform: translateY(-50%);
3306
+ background: #fff;
3307
+ color: var(--sfx-up-text, #1e293b);
3308
+ font-size: 12px;
3309
+ font-weight: 500;
3310
+ white-space: nowrap;
3311
+ padding: 6px 12px;
3312
+ border-radius: 8px;
3313
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
3314
+ opacity: 0;
3315
+ pointer-events: none;
3316
+ transition: opacity 0.15s ease;
3317
+ z-index: 10;
3318
+ }
3319
+
3320
+ .header-btn-back:hover::after {
3321
+ opacity: 1;
3322
+ }
3323
+
3324
+ .header-btn-close {
3325
+ margin-left: auto;
3326
+ }
3327
+
3328
+ /* --- Responsive header buttons --- */
3329
+ @media (max-width: 768px) {
3330
+ .header-btn { width: 28px; height: 28px; }
3331
+ .header-btn svg { width: 14px; height: 14px; }
3332
+ }
3333
+ @media (max-width: 480px) {
3334
+ .header-btn { width: 26px; height: 26px; }
3335
+ }
3336
+
3337
+ /* --- Content wrapper (holds body + actions bar) --- */
3338
+ .content {
3339
+ flex: 1;
3340
+ display: flex;
3341
+ flex-direction: column;
3342
+ min-height: 0;
3343
+ }
3344
+
3345
+ /* --- Body --- */
3346
+ .body {
3347
+ flex: 1;
3348
+ overflow: hidden;
3349
+ padding: 24px;
3350
+ display: flex;
3351
+ flex-direction: column;
3352
+ align-items: stretch;
3353
+ justify-content: stretch;
3354
+ gap: 4px;
3355
+ min-height: 0;
3356
+ background: var(--sfx-up-bg, #fff);
3357
+ }
3358
+
3359
+ .body.body-drag-over {
3360
+ background: var(--sfx-up-primary-bg, #eff6ff);
3361
+ border-radius: 8px;
3362
+ position: relative;
3363
+ }
3364
+
3365
+ .body.body-drag-over::after {
3366
+ content: '';
3367
+ position: absolute;
3368
+ inset: 4px;
3369
+ border: 2px dashed var(--sfx-up-primary, #2563eb);
3370
+ border-radius: 8px;
3371
+ z-index: 100;
3372
+ pointer-events: none;
3373
+ }
3374
+
3375
+ .body.has-files {
3376
+ justify-content: flex-start;
3377
+ align-items: stretch;
3378
+ overflow: hidden;
3379
+ gap: 0;
3380
+ padding: 0 8px 0 8px;
3381
+ animation: bodyReveal 0.35s ease both;
3382
+ }
3383
+
3384
+ .body.has-files:has(.preview-layout) {
3385
+ padding-right: 0;
3386
+ }
3387
+
3388
+ @keyframes bodyReveal {
3389
+ from { opacity: 0.5; }
3390
+ to { opacity: 1; }
3391
+ }
3392
+
3393
+ .body.has-files::-webkit-scrollbar-thumb:hover {
3394
+ background: rgba(0, 0, 0, 0.25);
3395
+ }
3396
+
3397
+ .body sfx-drop-zone {
3398
+ position: relative;
3399
+ z-index: 1;
3400
+ overflow: visible;
3401
+ }
3402
+
3403
+ .asset-count {
3404
+ font-size: 14px;
3405
+ font-weight: 400;
3406
+ color: var(--sfx-up-text-secondary, #64748b);
3407
+ padding: 16px;
3408
+ min-height: 61px;
3409
+ box-sizing: border-box;
3410
+ display: flex;
3411
+ align-items: center;
3412
+ flex-shrink: 0;
3413
+ }
3414
+
3415
+ /* --- Inline mode --- */
3416
+ .inline {
3417
+ border: 1px solid var(--sfx-up-border, #e2e8f0);
3418
+ border-radius: var(--sfx-up-radius, 16px);
3419
+ background: var(--sfx-up-bg, #fff);
3420
+ display: flex;
3421
+ flex-direction: column;
3422
+ overflow: hidden;
3423
+ height: 100%;
3424
+ max-height: var(--sfx-up-max-height, 88vh);
3425
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
3426
+ transition: box-shadow 0.25s ease;
3427
+ animation: inlineIn 0.25s ease;
3428
+ }
3429
+
3430
+ .inline:hover {
3431
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.03);
3432
+ }
3433
+
3434
+ /* --- Preview split layout --- */
3435
+ .preview-layout {
3436
+ display: flex;
3437
+ flex: 1;
3438
+ min-height: 0;
3439
+ overflow: hidden;
3440
+ }
3441
+
3442
+ .preview-layout .file-grid-side {
3443
+ flex: 54;
3444
+ min-width: 0;
3445
+ min-height: 100%;
3446
+ overflow: hidden;
3447
+ display: flex;
3448
+ flex-direction: column;
3449
+ position: relative;
3450
+ --sfx-up-grid-min: max(48%, 140px);
3451
+ }
3452
+
3453
+ .preview-layout .file-grid-side::after {
3454
+ content: '';
3455
+ position: absolute;
3456
+ top: 0;
3457
+ bottom: 0;
3458
+ right: 14px;
3459
+ width: 1px;
3460
+ background: var(--sfx-up-border, #e8edf5);
3461
+ pointer-events: none;
3462
+ z-index: 3;
3463
+ }
3464
+
3465
+ .preview-layout sfx-file-list {
3466
+ padding-right: 16px;
3467
+ --sfx-scrollbar-w: 14px;
3468
+ --sfx-scrollbar-inset: 4px;
3469
+ --sfx-scrollbar-radius: 7px;
3470
+ }
3471
+
3472
+ .file-grid-header {
3473
+ display: flex;
3474
+ align-items: center;
3475
+ justify-content: space-between;
3476
+ gap: 8px;
3477
+ padding: 16px;
3478
+ min-height: 61px;
3479
+ box-sizing: border-box;
3480
+ flex-shrink: 0;
3481
+ position: sticky;
3482
+ top: 0;
3483
+ z-index: 2;
3484
+ background: var(--sfx-up-bg, #fff);
3485
+ }
3486
+
3487
+ .file-grid-header-text {
3488
+ font-size: 14px;
3489
+ font-weight: 400;
3490
+ color: var(--sfx-up-text-secondary, #64748b);
3491
+ }
3492
+
3493
+ .preview-topbar {
3494
+ display: flex;
3495
+ align-items: center;
3496
+ justify-content: space-between;
3497
+ flex-shrink: 0;
3498
+ padding: 0;
3499
+ }
3500
+
3501
+ .preview-divider {
3502
+ width: 1px;
3503
+ background: var(--sfx-up-border, #e8edf5);
3504
+ flex-shrink: 0;
3505
+ position: relative;
3506
+ display: flex;
3507
+ align-items: center;
3508
+ justify-content: center;
3509
+ }
3510
+
3511
+ .preview-divider::after {
3512
+ display: none;
3513
+ }
3514
+
3515
+ .preview-panel {
3516
+ flex: 46;
3517
+ min-width: 0;
3518
+ display: flex;
3519
+ flex-direction: column;
3520
+ overflow: hidden;
3521
+ padding: 0;
3522
+ }
3523
+
3524
+ .preview-panel::-webkit-scrollbar { width: 5px; }
3525
+ .preview-panel::-webkit-scrollbar-track { background: transparent; }
3526
+ .preview-panel::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
3527
+
3528
+ .preview-panel-header {
3529
+ display: flex;
3530
+ align-items: center;
3531
+ justify-content: space-between;
3532
+ gap: 8px;
3533
+ padding: 16px 24px 16px 16px;
3534
+ flex-shrink: 0;
3535
+ border-bottom: 1px solid var(--sfx-up-border, #e8edf5);
3536
+ }
3537
+
3538
+ .preview-header-actions {
3539
+ display: flex;
3540
+ align-items: center;
3541
+ gap: 4px;
3542
+ flex-shrink: 0;
3543
+ }
3544
+
3545
+ .preview-panel-filename {
3546
+ font-size: 16px;
3547
+ font-weight: 400;
3548
+ color: var(--sfx-up-text, #1e293b);
3549
+ white-space: nowrap;
3550
+ overflow: hidden;
3551
+ text-overflow: ellipsis;
3552
+ min-width: 0;
3553
+ }
3554
+
3555
+ .preview-panel-header button {
3556
+ width: 28px;
3557
+ height: 28px;
3558
+ border-radius: 6px;
3559
+ border: none;
3560
+ background: none;
3561
+ cursor: pointer;
3562
+ display: flex;
3563
+ align-items: center;
3564
+ justify-content: center;
3565
+ color: var(--sfx-up-text-muted, #9ca3af);
3566
+ transition: background 0.15s, color 0.15s;
3567
+ padding: 0;
3568
+ flex-shrink: 0;
3569
+ }
3570
+
3571
+ .preview-panel-header button:hover {
3572
+ background: var(--sfx-up-surface, #f8fafc);
3573
+ color: var(--sfx-up-text, #374151);
3574
+ }
3575
+
3576
+ .preview-panel-header button svg {
3577
+ width: 16px;
3578
+ height: 16px;
3579
+ }
3580
+
3581
+ .file-info-header {
3582
+ display: flex;
3583
+ align-items: center;
3584
+ justify-content: space-between;
3585
+ padding: 14px 0 10px;
3586
+ font-size: 14px;
3587
+ font-weight: 600;
3588
+ color: var(--sfx-up-text, #1e293b);
3589
+ border-top: 1px solid var(--sfx-up-border, #e8edf5);
3590
+ margin-top: 4px;
3591
+ flex-shrink: 0;
3592
+ }
3593
+
3594
+ .file-info-header svg {
3595
+ width: 16px;
3596
+ height: 16px;
3597
+ color: var(--sfx-up-text-muted, #9ca3af);
3598
+ }
3599
+
3600
+ .preview-doc-wrap {
3601
+ position: relative;
3602
+ flex: 1;
3603
+ min-height: 0;
3604
+ display: flex;
3605
+ align-items: center;
3606
+ justify-content: center;
3607
+ }
3608
+
3609
+ .preview-doc-wrap.pdf { background: linear-gradient(135deg, #fef2f2, #fee2e2); }
3610
+ .preview-doc-wrap.doc { background: linear-gradient(135deg, var(--sfx-up-primary-bg, #eff6ff), var(--sfx-up-primary-bg, #dbeafe)); }
3611
+ .preview-doc-wrap.vid { background: linear-gradient(135deg, #f5f3ff, #ede9fe); }
3612
+ .preview-doc-wrap.zip { background: linear-gradient(135deg, var(--warning-10, #fffbeb), var(--warning-10, #fef3c7)); }
3613
+ .preview-doc-wrap.gen { background: linear-gradient(135deg, var(--sfx-up-border-light, #f8fafc), var(--sfx-up-border-light, #f1f5f9)); }
3614
+
3615
+ .preview-doc-icon {
3616
+ display: flex;
3617
+ flex-direction: column;
3618
+ align-items: center;
3619
+ gap: 8px;
3620
+ }
3621
+
3622
+ .preview-doc-icon svg {
3623
+ width: 48px;
3624
+ height: 48px;
3625
+ stroke-width: 1.5;
3626
+ }
3627
+
3628
+ .preview-doc-icon.pdf svg { color: var(--sfx-up-error, #dc2626); }
3629
+ .preview-doc-icon.doc svg { color: var(--sfx-up-primary, #1d4ed8); }
3630
+ .preview-doc-icon.vid svg { color: #7c3aed; }
3631
+ .preview-doc-icon.zip svg { color: var(--warning-foreground, #b45309); }
3632
+ .preview-doc-icon.gen svg { color: var(--sfx-up-text-muted, #64748b); }
3633
+
3634
+ .preview-doc-ext {
3635
+ font-size: 13px;
3636
+ font-weight: 700;
3637
+ text-transform: uppercase;
3638
+ letter-spacing: 0.05em;
3639
+ }
3640
+
3641
+ .preview-doc-ext.pdf { color: var(--sfx-up-error, #dc2626); }
3642
+ .preview-doc-ext.doc { color: var(--sfx-up-primary, #1d4ed8); }
3643
+ .preview-doc-ext.vid { color: #7c3aed; }
3644
+ .preview-doc-ext.zip { color: var(--warning-foreground, #b45309); }
3645
+ .preview-doc-ext.gen { color: var(--sfx-up-text-muted, #64748b); }
3646
+
3647
+ .preview-img-wrap {
3648
+ position: relative;
3649
+ flex: 1;
3650
+ min-height: 0;
3651
+ background: var(--sfx-up-surface, #f1f5f9);
3652
+ }
3653
+
3654
+ .preview-image {
3655
+ width: 100%;
3656
+ height: 100%;
3657
+ object-fit: contain;
3658
+ display: block;
3659
+ border: none;
3660
+ }
3661
+
3662
+ .preview-nav {
3663
+ position: absolute;
3664
+ top: 50%;
3665
+ transform: translateY(-50%);
3666
+ width: 36px;
3667
+ height: 36px;
3668
+ border-radius: 50%;
3669
+ border: none;
3670
+ background: #fff;
3671
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
3672
+ cursor: pointer;
3673
+ display: flex;
3674
+ align-items: center;
3675
+ justify-content: center;
3676
+ color: var(--sfx-up-text, #1e293b);
3677
+ transition: all 0.15s;
3678
+ z-index: 2;
3679
+ padding: 0;
3680
+ }
3681
+
3682
+ .preview-nav:hover {
3683
+ box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
3684
+ transform: translateY(-50%) scale(1.06);
3685
+ }
3686
+
3687
+ .preview-nav:active {
3688
+ transform: translateY(-50%) scale(0.96);
3689
+ }
3690
+
3691
+ .preview-nav svg {
3692
+ width: 18px;
3693
+ height: 18px;
3694
+ }
3695
+
3696
+ .preview-nav.prev { left: 10px; }
3697
+ .preview-nav.next { right: 10px; }
3698
+
3699
+ .preview-nav:disabled {
3700
+ opacity: 0.35;
3701
+ cursor: default;
3702
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
3703
+ }
3704
+
3705
+ .preview-nav:disabled:hover {
3706
+ transform: translateY(-50%);
3707
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
3708
+ }
3709
+
3710
+ .preview-meta-list {
3711
+ display: flex;
3712
+ flex-direction: column;
3713
+ flex-shrink: 0;
3714
+ padding: 0 16px 12px;
3715
+ }
3716
+
3717
+ .preview-meta-row {
3718
+ display: flex;
3719
+ align-items: baseline;
3720
+ padding: 12px 0;
3721
+ }
3722
+
3723
+ .preview-meta-label {
3724
+ width: 110px;
3725
+ flex-shrink: 0;
3726
+ font-size: 14px;
3727
+ font-weight: 400;
3728
+ color: var(--sfx-up-text-muted, #94a3b8);
3729
+ }
3730
+
3731
+ .preview-meta-value {
3732
+ font-size: 14px;
3733
+ font-weight: 400;
3734
+ color: var(--foreground, var(--sfx-up-text, #1e293b));
3735
+ word-break: break-all;
3736
+ min-width: 0;
3737
+ }
3738
+
3739
+ .preview-meta-value.truncate {
3740
+ white-space: nowrap;
3741
+ overflow: hidden;
3742
+ text-overflow: ellipsis;
3743
+ word-break: normal;
3744
+ }
3745
+
3746
+ /* --- Upload overlay (in-modal) --- */
3747
+ .upload-overlay {
3748
+ display: flex;
3749
+ flex-direction: column;
3750
+ align-items: center;
3751
+ justify-content: center;
3752
+ flex: 1;
3753
+ gap: 8px;
3754
+ padding: 32px 24px;
3755
+ animation: fadeUp 0.3s ease both;
3756
+ }
3757
+
3758
+ .upload-overlay-spinner {
3759
+ width: 48px;
3760
+ height: 48px;
3761
+ border: 3px solid var(--sfx-up-border, #e2e8f0);
3762
+ border-top-color: var(--sfx-up-primary, #2563eb);
3763
+ border-radius: 50%;
3764
+ animation: spin 0.8s linear infinite;
3765
+ margin-bottom: 8px;
3766
+ }
3767
+
3768
+ .upload-overlay-percent {
3769
+ font-size: 40px;
3770
+ font-weight: 700;
3771
+ color: var(--sfx-up-primary, #2563eb);
3772
+ line-height: 1;
3773
+ }
3774
+
3775
+ .upload-overlay-title {
3776
+ font-size: 16px;
3777
+ font-weight: 600;
3778
+ color: var(--sfx-up-text, #1e293b);
3779
+ }
3780
+
3781
+ .upload-overlay-subtitle {
3782
+ font-size: 13px;
3783
+ color: var(--sfx-up-text-muted, #94a3b8);
3784
+ margin-bottom: 8px;
3785
+ }
3786
+
3787
+ .upload-overlay-bar {
3788
+ width: 240px;
3789
+ height: 6px;
3790
+ background: var(--sfx-up-border, #e2e8f0);
3791
+ border-radius: 3px;
3792
+ overflow: hidden;
3793
+ margin-bottom: 16px;
3794
+ }
3795
+
3796
+ .upload-overlay-bar-fill {
3797
+ height: 100%;
3798
+ background: var(--sfx-up-primary, #2563eb);
3799
+ border-radius: 3px;
3800
+ transition: width 0.3s ease;
3801
+ }
3802
+
3803
+ .upload-overlay-minimize {
3804
+ padding: 8px 20px;
3805
+ border: 1px solid var(--sfx-up-border, #e2e8f0);
3806
+ background: var(--sfx-up-bg, #fff);
3807
+ border-radius: 8px;
3808
+ font-size: 13px;
3809
+ font-weight: 500;
3810
+ color: var(--sfx-up-text-secondary, #475569);
3811
+ cursor: pointer;
3812
+ transition: all 0.15s;
3813
+ font-family: inherit;
3814
+ }
3815
+
3816
+ .upload-overlay-minimize:hover {
3817
+ border-color: var(--sfx-up-primary, #2563eb);
3818
+ color: var(--sfx-up-primary, #2563eb);
3819
+ }
3820
+
3821
+ .upload-header {
3822
+ justify-content: space-between;
3823
+ }
3824
+
3825
+ .upload-header .float-actions button {
3826
+ width: 28px;
3827
+ height: 28px;
3828
+ border: none;
3829
+ background: none;
3830
+ cursor: pointer;
3831
+ border-radius: 6px;
3832
+ display: flex;
3833
+ align-items: center;
3834
+ justify-content: center;
3835
+ color: var(--sfx-up-text-muted, #94a3b8);
3836
+ transition: background 0.15s;
3837
+ padding: 0;
3838
+ }
3839
+
3840
+ .upload-header .float-actions button:hover {
3841
+ background: var(--sfx-up-surface, #f8fafc);
3842
+ color: var(--sfx-up-text, #374151);
3843
+ }
3844
+
3845
+ .upload-header .float-actions button svg { width: 16px; height: 16px; }
3846
+
3847
+ @keyframes spin { to { transform: rotate(360deg); } }
3848
+ @keyframes fadeUp {
3849
+ from { opacity: 0; transform: translateY(12px); }
3850
+ to { opacity: 1; transform: translateY(0); }
3851
+ }
3852
+
3853
+ /* --- Floating upload card (Variant 3 style) --- */
3854
+ .upload-float {
3855
+ position: fixed;
3856
+ bottom: 24px;
3857
+ right: 24px;
3858
+ z-index: 10000;
3859
+ width: 320px;
3860
+ border-radius: 12px;
3861
+ background: var(--sfx-up-bg, #fff);
3862
+ box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
3863
+ overflow: hidden;
3864
+ font-family: inherit;
3865
+ animation: floatSlideIn 0.3s ease both;
3866
+ }
3867
+
3868
+ .float-header {
3869
+ display: flex;
3870
+ align-items: center;
3871
+ justify-content: space-between;
3872
+ padding: 10px 14px;
3873
+ border-bottom: 1px solid var(--sfx-up-border, #e8edf5);
3874
+ }
3875
+
3876
+ .float-header-left {
3877
+ display: flex;
3878
+ align-items: center;
3879
+ gap: 8px;
3880
+ }
3881
+
3882
+ .float-icon {
3883
+ width: 28px;
3884
+ height: 28px;
3885
+ border-radius: 6px;
3886
+ background: var(--sfx-up-primary-bg, #eff6ff);
3887
+ color: var(--sfx-up-primary, #2563eb);
3888
+ display: flex;
3889
+ align-items: center;
3890
+ justify-content: center;
3891
+ flex-shrink: 0;
3892
+ }
3893
+
3894
+ .float-icon svg { width: 14px; height: 14px; }
3895
+
3896
+ .float-icon.done {
3897
+ background: #f0fdf4;
3898
+ color: #22c55e;
3899
+ }
3900
+
3901
+ .float-title {
3902
+ font-size: 13px;
3903
+ font-weight: 600;
3904
+ color: var(--sfx-up-text, #1e293b);
3905
+ }
3906
+
3907
+ .float-subtitle {
3908
+ font-size: 11px;
3909
+ color: var(--sfx-up-text-muted, #94a3b8);
3910
+ }
3911
+
3912
+ .float-actions {
3913
+ display: flex;
3914
+ gap: 4px;
3915
+ }
3916
+
3917
+ .float-actions button {
3918
+ width: 26px;
3919
+ height: 26px;
3920
+ border: none;
3921
+ background: none;
3922
+ cursor: pointer;
3923
+ border-radius: 6px;
3924
+ display: flex;
3925
+ align-items: center;
3926
+ justify-content: center;
3927
+ color: var(--sfx-up-text-muted, #94a3b8);
3928
+ transition: background 0.15s;
3929
+ padding: 0;
3930
+ }
3931
+
3932
+ .float-actions button:hover {
3933
+ background: var(--sfx-up-surface, #f8fafc);
3934
+ color: var(--sfx-up-text, #374151);
3935
+ }
3936
+
3937
+ .float-actions button svg { width: 14px; height: 14px; }
3938
+
3939
+ .float-progress {
3940
+ padding: 10px 14px;
3941
+ border-bottom: 1px solid var(--sfx-up-border, #e8edf5);
3942
+ }
3943
+
3944
+ .float-progress-top {
3945
+ display: flex;
3946
+ align-items: center;
3947
+ justify-content: space-between;
3948
+ margin-bottom: 6px;
3949
+ }
3950
+
3951
+ .float-progress-label {
3952
+ font-size: 12px;
3953
+ color: var(--sfx-up-text-secondary, #475569);
3954
+ }
3955
+
3956
+ .float-progress-pct {
3957
+ font-size: 12px;
3958
+ font-weight: 600;
3959
+ color: var(--sfx-up-primary, #2563eb);
3960
+ }
3961
+
3962
+ .float-progress-pct.done {
3963
+ color: #22c55e;
3964
+ }
3965
+
3966
+ .float-bar {
3967
+ height: 4px;
3968
+ background: var(--sfx-up-border, #e8edf5);
3969
+ border-radius: 2px;
3970
+ overflow: hidden;
3971
+ }
3972
+
3973
+ .float-bar-fill {
3974
+ height: 100%;
3975
+ background: var(--sfx-up-primary, #2563eb);
3976
+ border-radius: 2px;
3977
+ transition: width 0.3s ease;
3978
+ }
3979
+
3980
+ .float-bar-fill.done {
3981
+ background: #22c55e;
3982
+ }
3983
+
3984
+ .float-items {
3985
+ max-height: 200px;
3986
+ overflow-y: auto;
3987
+ scrollbar-width: thin;
3988
+ scrollbar-color: rgba(0,0,0,0.1) transparent;
3989
+ }
3990
+
3991
+ .float-item {
3992
+ display: flex;
3993
+ align-items: center;
3994
+ gap: 10px;
3995
+ padding: 8px 14px;
3996
+ border-bottom: 1px solid #f1f5f9;
3997
+ }
3998
+
3999
+ .float-item:last-child { border-bottom: none; }
4000
+
4001
+ .float-item-thumb {
4002
+ width: 32px;
4003
+ height: 32px;
4004
+ border-radius: 6px;
4005
+ background: var(--sfx-up-surface, #f8fafc);
4006
+ display: flex;
4007
+ align-items: center;
4008
+ justify-content: center;
4009
+ color: var(--sfx-up-text-muted, #94a3b8);
4010
+ flex-shrink: 0;
4011
+ }
4012
+
4013
+ .float-item-thumb svg { width: 16px; height: 16px; }
4014
+
4015
+ .float-item-info { flex: 1; min-width: 0; }
4016
+
4017
+ .float-item-name {
4018
+ font-size: 12px;
4019
+ font-weight: 500;
4020
+ color: var(--sfx-up-text, #1e293b);
4021
+ white-space: nowrap;
4022
+ overflow: hidden;
4023
+ text-overflow: ellipsis;
4024
+ }
4025
+
4026
+ .float-item-size {
4027
+ font-size: 11px;
4028
+ color: var(--sfx-up-text-muted, #94a3b8);
4029
+ }
4030
+
4031
+ .float-item-done {
4032
+ width: 18px;
4033
+ height: 18px;
4034
+ border-radius: 50%;
4035
+ background: #f0fdf4;
4036
+ color: #22c55e;
4037
+ display: flex;
4038
+ align-items: center;
4039
+ justify-content: center;
4040
+ flex-shrink: 0;
4041
+ }
4042
+
4043
+ .float-item-done svg { width: 12px; height: 12px; }
4044
+
4045
+ .float-item-spinner {
4046
+ width: 16px;
4047
+ height: 16px;
4048
+ border: 2px solid var(--sfx-up-border, #e8edf5);
4049
+ border-top-color: var(--sfx-up-primary, #2563eb);
4050
+ border-radius: 50%;
4051
+ animation: spin 0.8s linear infinite;
4052
+ flex-shrink: 0;
4053
+ }
4054
+
4055
+ .float-item-error {
4056
+ color: #ef4444;
4057
+ width: 16px;
4058
+ height: 16px;
4059
+ flex-shrink: 0;
4060
+ }
4061
+
4062
+ @keyframes floatSlideIn {
4063
+ from { opacity: 0; transform: translateY(20px); }
4064
+ to { opacity: 1; transform: translateY(0); }
4065
+ }
4066
+
4067
+ /* --- Connector modal overlay --- */
4068
+ .connector-modal-backdrop {
4069
+ position: fixed;
4070
+ inset: 0;
4071
+ z-index: 1000;
4072
+ background: var(--sfx-up-backdrop);
4073
+ backdrop-filter: blur(6px);
4074
+ display: flex;
4075
+ align-items: center;
4076
+ justify-content: center;
4077
+ padding: 20px;
4078
+ animation: fadeIn 0.18s ease both;
4079
+ }
4080
+
4081
+ .connector-modal {
4082
+ background: var(--sfx-up-bg, #fff);
4083
+ border-radius: 12px;
4084
+ box-shadow: 0 28px 80px var(--sfx-up-shadow, rgba(0, 0, 0, 0.18)), 0 4px 16px oklch(0 0 0 / 0.06);
4085
+ width: 100%;
4086
+ max-width: 520px;
4087
+ height: 75vh;
4088
+ max-height: 640px;
4089
+ min-height: 400px;
4090
+ overflow: hidden;
4091
+ display: flex;
4092
+ flex-direction: column;
4093
+ animation: modalIn 0.28s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
4094
+ }
4095
+
4096
+ @keyframes fadeIn {
4097
+ from { opacity: 0; }
4098
+ to { opacity: 1; }
4099
+ }
4100
+
4101
+ @keyframes modalIn {
4102
+ from {
4103
+ opacity: 0;
4104
+ transform: scale(0.92) translateY(10px);
4105
+ }
4106
+ to {
4107
+ opacity: 1;
4108
+ transform: scale(1) translateY(0);
4109
+ }
4110
+ }
4111
+
4112
+ @keyframes inlineIn {
4113
+ from { opacity: 0; }
4114
+ to { opacity: 1; }
4115
+ }
4116
+
4117
+ /* --- Fullscreen preview overlay --- */
4118
+ .fs-overlay {
4119
+ position: fixed;
4120
+ inset: 0;
4121
+ z-index: 10000;
4122
+ background: rgba(0, 0, 0, 0.92);
4123
+ display: flex;
4124
+ align-items: center;
4125
+ justify-content: center;
4126
+ animation: fadeIn 0.2s ease;
4127
+ cursor: zoom-in;
4128
+ }
4129
+
4130
+ .fs-overlay.zoomed {
4131
+ cursor: grab;
4132
+ overflow: hidden;
4133
+ }
4134
+
4135
+ .fs-overlay.zoomed.panning {
4136
+ cursor: grabbing;
4137
+ }
4138
+
4139
+ .fs-overlay.zoomed .fs-img {
4140
+ max-width: none;
4141
+ max-height: none;
4142
+ width: auto;
4143
+ height: auto;
4144
+ }
4145
+
4146
+ .fs-img {
4147
+ max-width: 92vw;
4148
+ max-height: 88vh;
4149
+ object-fit: contain;
4150
+ border-radius: 4px;
4151
+ user-select: none;
4152
+ -webkit-user-drag: none;
4153
+ transition: transform 0.25s ease;
4154
+ }
4155
+
4156
+ .fs-overlay.panning .fs-img {
4157
+ transition: none;
4158
+ }
4159
+
4160
+ .fs-toolbar {
4161
+ position: fixed;
4162
+ top: 16px;
4163
+ right: 16px;
4164
+ display: flex;
4165
+ gap: 8px;
4166
+ z-index: 10001;
4167
+ }
4168
+
4169
+ .fs-btn {
4170
+ width: 40px;
4171
+ height: 40px;
4172
+ border-radius: 6px;
4173
+ border: none;
4174
+ background: rgba(255, 255, 255, 0.12);
4175
+ backdrop-filter: blur(8px);
4176
+ color: #fff;
4177
+ cursor: pointer;
4178
+ display: flex;
4179
+ align-items: center;
4180
+ justify-content: center;
4181
+ transition: background 0.15s;
4182
+ }
4183
+
4184
+ .fs-btn:hover {
4185
+ background: rgba(255, 255, 255, 0.25);
4186
+ }
4187
+
4188
+ .fs-btn svg {
4189
+ width: 20px;
4190
+ height: 20px;
4191
+ }
4192
+
4193
+ .fs-nav {
4194
+ position: fixed;
4195
+ top: 50%;
4196
+ transform: translateY(-50%);
4197
+ width: 44px;
4198
+ height: 44px;
4199
+ border-radius: 50%;
4200
+ border: none;
4201
+ background: rgba(255, 255, 255, 0.15);
4202
+ backdrop-filter: blur(8px);
4203
+ color: #fff;
4204
+ cursor: pointer;
4205
+ display: flex;
4206
+ align-items: center;
4207
+ justify-content: center;
4208
+ z-index: 10001;
4209
+ transition: background 0.15s;
4210
+ padding: 0;
4211
+ }
4212
+
4213
+ .fs-nav:hover { background: rgba(255, 255, 255, 0.3); }
4214
+ .fs-nav:disabled { opacity: 0.3; cursor: default; }
4215
+ .fs-nav:disabled:hover { background: rgba(255, 255, 255, 0.15); }
4216
+ .fs-nav svg { width: 22px; height: 22px; }
4217
+ .fs-nav.prev { left: 20px; }
4218
+ .fs-nav.next { right: 20px; }
4219
+
4220
+ .fs-filename {
4221
+ position: fixed;
4222
+ bottom: 20px;
4223
+ left: 50%;
4224
+ transform: translateX(-50%);
4225
+ color: rgba(255, 255, 255, 0.7);
4226
+ font-size: 13px;
4227
+ font-weight: 500;
4228
+ background: rgba(0, 0, 0, 0.4);
4229
+ backdrop-filter: blur(8px);
4230
+ padding: 6px 16px;
4231
+ border-radius: 8px;
4232
+ white-space: nowrap;
4233
+ z-index: 10001;
4234
+ }
4235
+
4236
+ .preview-nav:focus-visible,
4237
+ .fs-btn:focus-visible {
4238
+ outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
4239
+ outline-offset: 2px;
4240
+ }
4241
+
4242
+ @media (prefers-reduced-motion: reduce) {
4243
+ .modal-backdrop { animation: none; }
4244
+ .modal-card { animation: none; }
4245
+ .inline { animation: none; }
4246
+ .fs-overlay { animation: none; }
4247
+ .body.has-files { animation: none; }
4248
+ }
4249
+
4250
+ /* --- Responsive: Tablet (≤ 768px) --- */
4251
+ @media (max-width: 768px) {
4252
+ .modal-backdrop { padding: 12px; }
4253
+ .modal-card { border-radius: 12px; max-height: 92vh; }
4254
+ .header { padding: 12px 16px; }
4255
+ .header-icon { width: 28px; height: 28px; margin-right: 10px; }
4256
+ .header-icon svg { width: 14px; height: 14px; }
4257
+ .header-title { font-size: 14px; }
4258
+ .body { padding: 16px; }
4259
+ .body.has-files { padding: 0 8px; padding-bottom: 12px; }
4260
+ .asset-count { padding: 16px; }
4261
+
4262
+ .preview-layout { flex-direction: column; }
4263
+ .preview-layout .file-grid-side {
4264
+ width: 100%;
4265
+ max-height: 140px;
4266
+ overflow-x: auto;
4267
+ overflow-y: hidden;
4268
+ flex-shrink: 0;
4269
+ }
4270
+ .preview-panel { padding: 0 0 16px; }
4271
+
4272
+ .preview-topbar { padding: 8px 0; }
4273
+
4274
+ .inline { border-radius: 12px; }
4275
+
4276
+ .connector-modal-backdrop { padding: 8px; }
4277
+ .connector-modal {
4278
+ max-width: 100%;
4279
+ height: 85vh;
4280
+ max-height: none;
4281
+ border-radius: 14px;
4282
+ }
4283
+ }
4284
+
4285
+ /* --- Responsive: Mobile (≤ 480px) --- */
4286
+ @media (max-width: 480px) {
4287
+ .modal-backdrop { padding: 0; }
4288
+ .modal-card {
4289
+ border-radius: 0;
4290
+ max-height: 100vh;
4291
+ max-width: 100%;
4292
+ height: 100%;
4293
+ }
4294
+ .header { padding: 10px 14px; }
4295
+ .header-icon { width: 26px; height: 26px; margin-right: 8px; }
4296
+ .header-title { font-size: 14px; }
4297
+ .body { padding: 12px; }
4298
+ .body.has-files { padding: 0 8px; padding-bottom: 8px; }
4299
+ .asset-count { padding: 16px; }
4300
+
4301
+ .preview-layout .file-grid-side { max-height: 100px; }
4302
+ .preview-panel { padding: 0 0 12px; }
4303
+ .preview-meta-row { padding: 6px 0; }
4304
+ .preview-meta-label { width: 90px; font-size: 12px; }
4305
+ .preview-meta-value { font-size: 12px; }
4306
+
4307
+ .inline { max-height: 100vh; border-radius: 8px; box-shadow: none; }
4308
+
4309
+ .connector-modal-backdrop { padding: 0; }
4310
+ .connector-modal {
4311
+ border-radius: 0;
4312
+ height: 100vh;
4313
+ max-height: none;
4314
+ min-height: auto;
4315
+ }
4316
+ }
4317
+ `,C._MODIFIABLE_STATUSES=new Set(["idle","queued","rejected"]),C._RESERVED_IDS=new Set(["device","camera","url","screen-cast"]),C);w([c.property({attribute:!1})],m.prototype,"config");w([c.state()],m.prototype,"_isOpen");w([c.state()],m.prototype,"_activeConnector");w([c.state()],m.prototype,"_showUrlDialog");w([c.state()],m.prototype,"_showCameraDialog");w([c.state()],m.prototype,"_showScreenCastDialog");w([c.state()],m.prototype,"_previewFileId");w([c.state()],m.prototype,"_previewDims");w([c.state()],m.prototype,"_fullscreenPreviewUrl");w([c.state()],m.prototype,"_fullscreenVideoFile");w([c.state()],m.prototype,"_fullscreenZoomed");w([c.state()],m.prototype,"_bodyDragOver");w([c.state()],m.prototype,"_isMinimized");w([c.state()],m.prototype,"_isPillExpanded");let ft=m;exports.AuthExpiredError=Q;exports.CORE_SOURCES=T;exports.PublicEvents=g;exports.SfxActionsBar=E;exports.SfxCameraDialog=M;exports.SfxDropZone=y;exports.SfxFileItem=Z;exports.SfxFileList=D;exports.SfxImportDivider=se;exports.SfxScreenCastDialog=F;exports.SfxSourcePills=K;exports.SfxSuccessCard=j;exports.SfxUploader=ft;exports.SfxUrlDialog=A;exports.Store=$e;exports.UploadEngine=Ee;exports.buildAuthHeaders=G;exports.createStore=Se;exports.exchangeSassKey=Ue;exports.getApiBase=ee;exports.getAuthUrl=Le;exports.getProviderSources=ze;exports.listFiles=Oe;exports.listNextPage=Be;exports.logout=Ae;exports.resolveAuth=Pe;exports.searchProvider=Re;