@scaleflex/uploader 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- "use strict";const s=require("lit"),c=require("lit/decorators.js"),z=require("lit/directives/unsafe-svg.js"),M=require("lit/directives/unsafe-html.js");class Se{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const t=this.state;this.state={...t,...e},this._notifying=!0;try{this.listeners.forEach(o=>o(this.state,t))}finally{this._notifying=!1}if(this._pendingState){const o=this._pendingState;this._pendingState=null,this.setState(o)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function S(n,e,t){const o=n.getState().files,r=o.get(e);if(!r)return;const i=new Map(o);i.set(e,{...r,...t}),n.setState({files:i})}function L(n,e){const t=new Map(n.getState().files);t.set(e.id,e),n.setState({files:t})}function me(n,e){const t=n.getState().files;if(!t.has(e))return;const o=new Map(t);o.delete(e),n.setState({files:o})}function Ee(){return new Se({files:new Map,queueConfig:{concurrency:3,autoProceed:!1,retryConfig:{maxRetries:0,baseDelay:1e3,maxDelay:3e4,backoffFactor:2}},isPaused:!1,restrictions:{maxFileSize:null,maxTotalFilesSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,blockedFileTypes:null},targetFolder:"/",totalProgress:0,totalSpeed:0,totalBytesUploaded:0,totalBytes:0,isUploading:!1})}class je{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 Me(n,e){const t=new XMLHttpRequest;let o=!1;const i=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`;t.open("POST",i);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);t.upload.addEventListener("progress",l=>{l.lengthComputable&&!o&&e.onProgress(l.loaded,l.total)}),t.addEventListener("load",()=>{if(o)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{o||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{o||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(){o=!0,t.abort()}}}function Oe(n,e){const t=new XMLHttpRequest;let o=!1;const i=`${e.apiBase.replace(/\/+$/,"")}/v4/files/upload_url`;t.open("POST",i);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);if(t.setRequestHeader("Content-Type","application/json"),t.addEventListener("load",()=>{if(o)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{o||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{o||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(){o=!0,t.abort()}}}function Q(n){return{Accept:"application/json","Content-Type":"application/json","uppy-auth-token":n}}function H(n){return n.replace(/\/+$/,"")}const Re={"google-drive":"drive",dropbox:"dropbox",onedrive:"onedrive",box:"box",instagram:"instagram",facebook:"facebook",unsplash:"unsplash"};function Y(n){return Re[n]??n}function Le(n,e){const t=H(n),o=btoa(JSON.stringify({origin:window.location.origin})),r=Y(e);return`${t}/${r}/connect?state=${encodeURIComponent(o)}`}async function Te(n,e,t,o=""){const r=H(n),i=o?`/${o}`:"",a=Y(e),l=await fetch(`${r}/${a}/list${i}`,{method:"GET",headers:Q(t),credentials:"same-origin"});if(l.status===401)throw new ee;if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Companion list failed (HTTP ${l.status})`)}return l.json()}async function Be(n,e,t){const o=H(n),r=await fetch(`${o}/${t}`,{method:"GET",headers:Q(e),credentials:"same-origin"});if(r.status===401)throw new ee;if(!r.ok){const i=await r.json().catch(()=>null);throw new Error((i==null?void 0:i.message)||`Companion list failed (HTTP ${r.status})`)}return r.json()}async function Ae(n,e,t,o){const r=H(n),i=Y(e),a=o?`q=${encodeURIComponent(t)}&${o}`:`q=${encodeURIComponent(t)}`,l=await fetch(`${r}/search/${i}/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 Ie(n,e,t,o,r,i=!1){const a=H(n),l=Y(e),d=i?`${a}/search/${l}/get/${o}`:`${a}/${l}/get/${o}`,p=i?{Accept:"application/json","Content-Type":"application/json"}:Q(t),h=await fetch(d,{method:"POST",headers:p,credentials:"same-origin",body:JSON.stringify({...r,httpMethod:r.httpMethod??"POST",useFormData:r.useFormData??!0,fieldname:r.fieldname??"files[]"})});if(h.status===401)throw new ee;if(!h.ok){const u=await h.json().catch(()=>null);throw new Error((u==null?void 0:u.message)||`Companion upload failed (HTTP ${h.status})`)}return h.json()}async function He(n,e,t){const o=H(n),r=Y(e),i=await fetch(`${o}/${r}/logout`,{method:"GET",headers:Q(t),credentials:"same-origin"});return i.ok?i.json():{ok:!1,revoked:!1}}function qe(n){var r;const t=((r=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(n))==null?void 0:r[1])??n;return`${location.protocol==="https:"?"wss":"ws"}://${t}`}class ee extends Error{constructor(){super("Authentication expired"),this.name="AuthExpiredError"}}function Ye(n,e){const t=n.remoteInfo;if(!t)return e.onError(new Error("remoteInfo is required for companion upload")),{abort(){}};let o=!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 Ie(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(o)return;const u=`${qe(t.companionUrl)}/api/${p.token}`;try{r=new WebSocket(u)}catch{e.onError(new Error("Failed to connect to upload progress channel"));return}r.onmessage=x=>{var f,v,w;if(!o)try{const b=JSON.parse(x.data);switch(b.action){case"progress":{const m=b.payload,_=m.bytesUploaded??0,E=m.bytesTotal??(t.size||1);e.onProgress(_,E);break}case"success":{const m=b.payload;if(r==null||r.close(),(f=m.response)!=null&&f.responseText)try{const _=JSON.parse(m.response.responseText);if(_.status==="success"){e.onComplete(_);return}e.onError(new Error(_.msg||"Upload failed"));return}catch{}e.onError(new Error("Upload completed but no valid response received"));break}case"error":{r==null||r.close();const m=b.payload;let _=((v=m.error)==null?void 0:v.message)||"Upload failed";if((w=m.response)!=null&&w.responseText)try{const E=JSON.parse(m.response.responseText);_=E.hint||E.msg||E.message||_}catch{}e.onError(new Error(_));break}}}catch{}},r.onerror=()=>{o||e.onError(new Error("Upload progress connection failed"))},r.onclose=()=>{r=null}}).catch(p=>{o||e.onError(p instanceof Error?p:new Error(String(p)))}),{abort(){if(o=!0,r){try{r.send(JSON.stringify({action:"cancel",payload:{}}))}catch{}r.close(),r=null}}}}class Pe{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 o of e.values())o.status==="idle"?(S(this.store,o.id,{status:"queued"}),t=!0):o.status==="queued"&&(t=!0);t&&(this.store.setState({isUploading:!0}),this.processQueue())}retryFile(e){const t=this.store.getState().files.get(e);!t||t.status!=="error"&&t.status!=="failed"||(S(this.store,e,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0}),this.processQueue())}retryAll(){const{files:e}=this.store.getState();for(const t of e.values())(t.status==="error"||t.status==="failed")&&S(this.store,t.id,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0});this.processQueue()}cancelFile(e){const t=this.store.getState().files.get(e);!t||!we(t.status)||(this.abortUpload(e),S(this.store,e,{status:"cancelled"}))}cancelAll(){const{files:e}=this.store.getState();for(const t of e.values())we(t.status)&&(this.abortUpload(t.id),S(this.store,t.id,{status:"cancelled"}));this.store.setState({isUploading:!1})}updateConfig(e){Object.assign(this.config,e)}destroy(){var e;for(const t of this.activeUploads.keys())this.abortUpload(t);for(const t of this.retryTimers.values())clearTimeout(t);this.retryTimers.clear(),(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=null}processQueue(){const e=this.store.getState();if(e.isPaused)return;const{concurrency:t}=e.queueConfig,o=this.activeUploads.size,r=t-o;if(r<=0)return;const a=[...e.files.values()].filter(l=>l.status==="queued").sort((l,d)=>l.retryCount!==d.retryCount?d.retryCount-l.retryCount:l.addedAt-d.addedAt).slice(0,r);for(const l of a)this.startUpload(l)}startUpload(e){S(this.store,e.id,{status:"uploading",error:null});let t=0,o=Date.now(),r=0;const i={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-o)/1e3;if(u>0){const f=(d-t)/u;r=r===0?f:.3*f+.7*r}t=d,o=h;const x=p>0?Math.min(d/p*100,100):0;S(this.store,e.id,{progress:x,bytesUploaded:d,speed:r}),this.updateTotalProgress()};let l;e.remoteInfo?l=Ye(e,{...i,onProgress:a}):e.remoteUrl?l=Oe(e,i):l=Me(e,{...i,onProgress:a}),this.activeUploads.set(e.id,l)}handleComplete(e,t){this.activeUploads.delete(e),S(this.store,e,{status:"complete",progress:100,response:t}),this.updateTotalProgress(),this.checkAllComplete(),this.processQueue()}handleError(e,t){this.activeUploads.delete(e);const o=this.store.getState().files.get(e);if(!o)return;const{retryConfig:r}=this.store.getState().queueConfig,i=o.retryCount+1;if(i<=r.maxRetries){const a=Math.min(r.baseDelay*Math.pow(r.backoffFactor,o.retryCount),r.maxDelay);S(this.store,e,{status:"retrying",error:t.message,retryCount:i});const l=setTimeout(()=>{this.retryTimers.delete(e),S(this.store,e,{status:"queued"}),this.processQueue()},a);this.retryTimers.set(e,l)}else S(this.store,e,{status:"failed",error:t.message}),this.checkAllComplete(),this.processQueue()}abortUpload(e){var o;(o=this.activeUploads.get(e))==null||o.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,o=0,r=0;for(const i of e.values())(i.status==="queued"||i.status==="uploading"||i.status==="retrying"||i.status==="complete"||i.status==="failed")&&(t+=i.size,o+=i.status==="complete"?i.size:i.bytesUploaded),i.status==="uploading"&&(r+=i.speed);this.store.setState({totalBytes:t,totalBytesUploaded:o,totalSpeed:r,totalProgress:t>0?Math.min(o/t*100,100):0})}checkAllComplete(){const{files:e}=this.store.getState();![...e.values()].some(o=>o.status==="queued"||o.status==="uploading"||o.status==="retrying")&&this.store.getState().isUploading&&this.store.setState({isUploading:!1})}}function we(n){return n==="queued"||n==="uploading"||n==="retrying"}function te(n){return`https://api.filerobot.com/${n}`}async function Ue(n,e){const t=`${te(n)}/key/${encodeURIComponent(e)}`,o=new AbortController,r=setTimeout(()=>o.abort(),3e4);try{const i=await fetch(t,{signal:o.signal});if(clearTimeout(r),!i.ok)throw new Error(`SASS key exchange failed (HTTP ${i.status})`);const a=await i.json();if(a.status==="error")throw new Error(`SASS key exchange failed: ${a.msg||"Unknown error"}`);return a.key}catch(i){throw clearTimeout(r),i instanceof DOMException&&i.name==="AbortError"?new Error("SASS key exchange timed out"):i}}function K(n,e){const t={};switch(n.mode){case"security-template":if(!e)throw new Error("[sfx-uploader] Cannot build auth headers for security-template mode: SASS key exchange has not been performed. Call resolveAuth() first or use sass-key mode with a pre-resolved key.");t["X-Filerobot-Key"]=e;break;case"sass-key":t["X-Filerobot-Key"]=n.sassKey;break}return n.airboxPuid&&(t["X-Filerobot-Airbox-Puid"]=n.airboxPuid),t}async function ze(n){const e=te(n.container);if(n.mode==="security-template"){const t=await Ue(n.container,n.securityTemplateId);return{apiBase:e,headers:K(n,t),sassKey:t}}return{apiBase:e,headers:K(n)}}const g={FILE_ADDED:"sfx-file-added",FILE_REMOVED:"sfx-file-removed",FILE_REJECTED:"sfx-file-rejected",UPLOAD_STARTED:"sfx-upload-started",UPLOAD_PROGRESS:"sfx-upload-progress",UPLOAD_COMPLETE:"sfx-upload-complete",UPLOAD_ERROR:"sfx-upload-error",UPLOAD_RETRY:"sfx-upload-retry",ALL_COMPLETE:"sfx-all-complete",TOTAL_PROGRESS:"sfx-total-progress",BEFORE_UPLOAD:"sfx-before-upload",OPEN:"sfx-open",CLOSE:"sfx-close",CANCEL:"sfx-cancel",COMPLETE_ACTION:"sfx-complete-action",FILE_PREVIEW:"sfx-file-preview",FILL_METADATA:"sfx-fill-metadata"};let Ve=0;function T(){return`file-${Date.now()}-${++Ve}`}function B(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),o=n/Math.pow(1024,t);return`${t===0?o:o.toFixed(1)} ${e[t]}`}function oe(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),o=e%60;return o>0?`${t}m ${o}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 Ne(n){const e=n.lastIndexOf(".");return e>=0?n.slice(e+1).toUpperCase():""}const Xe={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 We(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())??"";return Xe[e]||""}function Ge(n){return new Promise(e=>{const t=document.createElement("video");t.preload="metadata",t.muted=!0,t.playsInline=!0;const o=URL.createObjectURL(n);let r=!1;const i=()=>{r||(r=!0,e(null)),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(o)};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(o))},"image/jpeg",.7);return}}catch{}i()},{once:!0}),t.addEventListener("error",()=>i(),{once:!0}),setTimeout(()=>i(),5e3),t.src=o,t.addEventListener("loadeddata",()=>{t.currentTime=.1},{once:!0})})}function ie(n,e,t){var o,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 i=n.size;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&(i+=a.size);if(i>e.maxTotalFilesSize)return"Total file size limit exceeded"}if(e.maxNumberOfFiles!=null){let i=0;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&i++;if(i>=e.maxNumberOfFiles)return`Maximum ${e.maxNumberOfFiles} files allowed`}if(e.allowedFileTypes!=null){const i=e.allowedFileTypes,a="."+(((o=n.name.split(".").pop())==null?void 0:o.toLowerCase())??"");if(!i.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 i=e.blockedFileTypes,a="."+(((r=n.name.split(".").pop())==null?void 0:r.toLowerCase())??"");if(i.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 Ke(n,e,t){return ie(n,e,t)}function ye(n){return n.allowedFileTypes?n.allowedFileTypes.join(","):""}const _e={"google-drive":{id:"google-drive",label:"Google Drive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:transparent"><svg width="16" height="16" viewBox="0 0 87.3 78"><path d="M6.6 66.85l3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3L27.5 53H0c0 1.55.4 3.1 1.2 4.5z" fill="#0066da"/><path d="M43.65 25L29.9 1.2C28.55 2 27.4 3.1 26.6 4.5L1.2 48.5C.4 49.9 0 51.45 0 53h27.5z" fill="#00ac47"/><path d="M73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5H59.8l5.65 10.85z" fill="#ea4335"/><path d="M43.65 25L57.4 1.2C56.05.4 54.5 0 52.9 0H34.4c-1.6 0-3.15.45-4.5 1.2z" fill="#00832d"/><path d="M59.8 53H27.5L13.75 76.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z" fill="#2684fc"/><path d="M73.4 26.5l-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3L43.65 25 59.8 53h27.45c0-1.55-.4-3.1-1.2-4.5z" fill="#ffba00"/></svg></span>'},dropbox:{id:"dropbox",label:"Dropbox",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0061ff"><svg width="11" height="11" viewBox="0 0 528 512" fill="white"><path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zm-132 284.5l132-84.3 132 84.3-132 84.4-132-84.4zm132-116.6l132.3-84.3-132.3-83.9 131.6-84.3L528 116.3l-132.3 84.1L528 284.7l-132.4 83.9-131.2-84.4z"/></svg></span>'},onedrive:{id:"onedrive",label:"OneDrive",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0078d4"><svg width="11" height="11" viewBox="0 0 24 24" fill="white"><path d="M10.5 13.5C10.5 11.57 12.07 10 14 10h6.5c.17 0 .34.01.5.02A6 6 0 009.01 11.6 4 4 0 0010.5 13.5zM12 14.5a5 5 0 00-5-5 5 5 0 00-5 5 3 3 0 003 3h9.5A3.5 3.5 0 0018 14c0-.18-.01-.35-.03-.52A5.48 5.48 0 0112 14.5z"/></svg></span>'},box:{id:"box",label:"Box",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#0e50a0;font-size:9px;font-weight:800;color:#fff">box</span>'},instagram:{id:"instagram",label:"Instagram",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888)"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M12 2.16c2.94 0 3.29.01 4.45.06 1.07.05 1.8.22 2.43.46.66.25 1.21.6 1.77 1.16.55.55.9 1.1 1.16 1.77.25.64.41 1.37.46 2.43.05 1.16.06 1.51.06 4.45s-.01 3.29-.06 4.45c-.05 1.07-.22 1.8-.46 2.43a4.9 4.9 0 01-1.16 1.77c-.55.55-1.1.9-1.77 1.16-.64.25-1.37.41-2.43.46-1.16.05-1.51.06-4.45.06s-3.29-.01-4.45-.06c-1.07-.05-1.8-.22-2.43-.46a4.9 4.9 0 01-1.77-1.16 4.9 4.9 0 01-1.16-1.77c-.25-.64-.41-1.37-.46-2.43C2.17 15.29 2.16 14.94 2.16 12s.01-3.29.06-4.45c.05-1.07.22-1.8.46-2.43a4.9 4.9 0 011.16-1.77A4.9 4.9 0 015.61 2.2c.64-.25 1.37-.41 2.43-.46C9.21 2.17 9.56 2.16 12 2.16zM12 16a4 4 0 110-8 4 4 0 010 8zm6.4-9.85a1.44 1.44 0 100 2.88 1.44 1.44 0 000-2.88z"/></svg></span>'},facebook:{id:"facebook",label:"Facebook",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#1877f2"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M24 12.07C24 5.41 18.63 0 12 0S0 5.41 0 12.07c0 6.02 4.39 11.02 10.12 11.93v-8.44H7.08v-3.49h3.04V9.41c0-3.02 1.79-4.69 4.53-4.69 1.31 0 2.68.24 2.68.24v2.97h-1.51c-1.49 0-1.95.93-1.95 1.89v2.26h3.33l-.53 3.49h-2.8v8.44C19.61 23.09 24 18.09 24 12.07z"/></svg></span>'},unsplash:{id:"unsplash",label:"Unsplash",fillIcon:!0,icon:"",brandHtml:'<span class="brand-ico" style="background:#111"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M8.5 11.5v5h7v-5h5.5V21h-18v-9.5h5.5zm7-8v5h-7v-5h7z"/></svg></span>'}};function De(n){return n.filter(e=>e in _e).map(e=>_e[e])}var Ze=Object.defineProperty,Je=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&Ze(e,t,r),r};const Qe='<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"/>',et='<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"/>',tt='<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"/>',rt='<rect x="2" y="3" width="20" height="14" rx="2"/><circle cx="12" cy="10" r="1"/><path d="M7 21l5-5 5 5"/>',A=[{id:"device",label:"My Device",icon:Qe,iconColor:"#2563eb"},{id:"url",label:"URL link",icon:et,iconColor:"#16a34a"},{id:"camera",label:"Camera",icon:tt,iconColor:"#7c3aed"},{id:"screen-cast",label:"Screen capture",icon:rt,iconColor:"#ea580c"}],le=class le extends s.LitElement{constructor(){super(...arguments),this.sources=A}_handleClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}render(){return s.html`
1
+ "use strict";const s=require("lit"),c=require("lit/decorators.js"),z=require("lit/directives/unsafe-svg.js"),j=require("lit/directives/unsafe-html.js");class Pe{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(o=>o(this.state,t))}finally{this._notifying=!1}if(this._pendingState){const o=this._pendingState;this._pendingState=null,this.setState(o)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function S(n,e,t){const o=n.getState().files,r=o.get(e);if(!r)return;const i=new Map(o);i.set(e,{...r,...t}),n.setState({files:i})}function L(n,e){const t=new Map(n.getState().files);t.set(e.id,e),n.setState({files:t})}function ye(n,e){const t=n.getState().files;if(!t.has(e))return;const o=new Map(t);o.delete(e),n.setState({files:o})}function Ue(){return new Pe({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 Me{constructor(e,t){this.host=e,this.store=t,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function Oe(n,e){const t=new XMLHttpRequest;let o=!1;const i=`${e.apiBase.replace(/\/+$/,"")}/v4/files?folder=${encodeURIComponent(e.folder)}`;t.open("POST",i);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);t.upload.addEventListener("progress",l=>{l.lengthComputable&&!o&&e.onProgress(l.loaded,l.total)}),t.addEventListener("load",()=>{if(o)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{o||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{o||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(){o=!0,t.abort()}}}function Le(n,e){const t=new XMLHttpRequest;let o=!1;const i=`${e.apiBase.replace(/\/+$/,"")}/v4/files/upload_url`;t.open("POST",i);for(const[l,d]of Object.entries(e.authHeaders))t.setRequestHeader(l,d);if(t.setRequestHeader("Content-Type","application/json"),t.addEventListener("load",()=>{if(o)return;let l;try{l=JSON.parse(t.responseText)}catch{e.onError(new Error(`Invalid JSON response (HTTP ${t.status})`));return}t.status>=200&&t.status<300&&l.status==="success"?e.onComplete(l):e.onError(new Error(l.hint||l.msg||`Upload failed (HTTP ${t.status})`))}),t.addEventListener("error",()=>{o||e.onError(new Error("Network error — check your connection"))}),t.addEventListener("timeout",()=>{o||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(){o=!0,t.abort()}}}function Q(n){return{Accept:"application/json","Content-Type":"application/json","uppy-auth-token":n}}function H(n){return n.replace(/\/+$/,"")}const Te={"google-drive":"drive",dropbox:"dropbox",onedrive:"onedrive",box:"box",instagram:"instagram",facebook:"facebook",unsplash:"unsplash"};function Y(n){return Te[n]??n}function Be(n,e){const t=H(n),o=btoa(JSON.stringify({origin:window.location.origin})),r=Y(e);return`${t}/${r}/connect?state=${encodeURIComponent(o)}`}async function Ae(n,e,t,o=""){const r=H(n),i=o?`/${o}`:"",a=Y(e),l=await fetch(`${r}/${a}/list${i}`,{method:"GET",headers:Q(t),credentials:"same-origin"});if(l.status===401)throw new ee;if(!l.ok){const d=await l.json().catch(()=>null);throw new Error((d==null?void 0:d.message)||`Companion list failed (HTTP ${l.status})`)}return l.json()}async function Ie(n,e,t){const o=H(n),r=await fetch(`${o}/${t}`,{method:"GET",headers:Q(e),credentials:"same-origin"});if(r.status===401)throw new ee;if(!r.ok){const i=await r.json().catch(()=>null);throw new Error((i==null?void 0:i.message)||`Companion list failed (HTTP ${r.status})`)}return r.json()}async function He(n,e,t,o){const r=H(n),i=Y(e),a=o?`q=${encodeURIComponent(t)}&${o}`:`q=${encodeURIComponent(t)}`,l=await fetch(`${r}/search/${i}/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 qe(n,e,t,o,r,i=!1){const a=H(n),l=Y(e),d=i?`${a}/search/${l}/get/${o}`:`${a}/${l}/get/${o}`,p=i?{Accept:"application/json","Content-Type":"application/json"}:Q(t),h=await fetch(d,{method:"POST",headers:p,credentials:"same-origin",body:JSON.stringify({...r,httpMethod:r.httpMethod??"POST",useFormData:r.useFormData??!0,fieldname:r.fieldname??"files[]"})});if(h.status===401)throw new ee;if(!h.ok){const u=await h.json().catch(()=>null);throw new Error((u==null?void 0:u.message)||`Companion upload failed (HTTP ${h.status})`)}return h.json()}async function Ye(n,e,t){const o=H(n),r=Y(e),i=await fetch(`${o}/${r}/logout`,{method:"GET",headers:Q(t),credentials:"same-origin"});return i.ok?i.json():{ok:!1,revoked:!1}}function Ve(n){var r;const t=((r=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(n))==null?void 0:r[1])??n;return`${location.protocol==="https:"?"wss":"ws"}://${t}`}class ee extends Error{constructor(){super("Authentication expired"),this.name="AuthExpiredError"}}function Ne(n,e){const t=n.remoteInfo;if(!t)return e.onError(new Error("remoteInfo is required for companion upload")),{abort(){}};let o=!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 qe(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(o)return;const u=`${Ve(t.companionUrl)}/api/${p.token}`;try{r=new WebSocket(u)}catch{e.onError(new Error("Failed to connect to upload progress channel"));return}r.onmessage=x=>{var f,v,w;if(!o)try{const b=JSON.parse(x.data);switch(b.action){case"progress":{const m=b.payload,_=m.bytesUploaded??0,E=m.bytesTotal??(t.size||1);e.onProgress(_,E);break}case"success":{const m=b.payload;if(r==null||r.close(),(f=m.response)!=null&&f.responseText)try{const _=JSON.parse(m.response.responseText);if(_.status==="success"){e.onComplete(_);return}e.onError(new Error(_.msg||"Upload failed"));return}catch{}e.onError(new Error("Upload completed but no valid response received"));break}case"error":{r==null||r.close();const m=b.payload;let _=((v=m.error)==null?void 0:v.message)||"Upload failed";if((w=m.response)!=null&&w.responseText)try{const E=JSON.parse(m.response.responseText);_=E.hint||E.msg||E.message||_}catch{}e.onError(new Error(_));break}}}catch{}},r.onerror=()=>{o||e.onError(new Error("Upload progress connection failed"))},r.onclose=()=>{r=null}}).catch(p=>{o||e.onError(p instanceof Error?p:new Error(String(p)))}),{abort(){if(o=!0,r){try{r.send(JSON.stringify({action:"cancel",payload:{}}))}catch{}r.close(),r=null}}}}class ze{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 o of e.values())o.status==="idle"?(S(this.store,o.id,{status:"queued"}),t=!0):o.status==="queued"&&(t=!0);t&&(this.store.setState({isUploading:!0}),this.processQueue())}retryFile(e){const t=this.store.getState().files.get(e);!t||t.status!=="error"&&t.status!=="failed"||(S(this.store,e,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0}),this.processQueue())}retryAll(){const{files:e}=this.store.getState();for(const t of e.values())(t.status==="error"||t.status==="failed")&&S(this.store,t.id,{status:"queued",error:null,progress:0,bytesUploaded:0,speed:0});this.processQueue()}cancelFile(e){const t=this.store.getState().files.get(e);!t||!_e(t.status)||(this.abortUpload(e),S(this.store,e,{status:"cancelled"}))}cancelAll(){const{files:e}=this.store.getState();for(const t of e.values())_e(t.status)&&(this.abortUpload(t.id),S(this.store,t.id,{status:"cancelled"}));this.store.setState({isUploading:!1})}updateConfig(e){Object.assign(this.config,e)}destroy(){var e;for(const t of this.activeUploads.keys())this.abortUpload(t);for(const t of this.retryTimers.values())clearTimeout(t);this.retryTimers.clear(),(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=null}processQueue(){const e=this.store.getState();if(e.isPaused)return;const{concurrency:t}=e.queueConfig,o=this.activeUploads.size,r=t-o;if(r<=0)return;const a=[...e.files.values()].filter(l=>l.status==="queued").sort((l,d)=>l.retryCount!==d.retryCount?d.retryCount-l.retryCount:l.addedAt-d.addedAt).slice(0,r);for(const l of a)this.startUpload(l)}startUpload(e){S(this.store,e.id,{status:"uploading",error:null});let t=0,o=Date.now(),r=0;const i={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-o)/1e3;if(u>0){const f=(d-t)/u;r=r===0?f:.3*f+.7*r}t=d,o=h;const x=p>0?Math.min(d/p*100,100):0;S(this.store,e.id,{progress:x,bytesUploaded:d,speed:r}),this.updateTotalProgress()};let l;e.remoteInfo?l=Ne(e,{...i,onProgress:a}):e.remoteUrl?l=Le(e,i):l=Oe(e,{...i,onProgress:a}),this.activeUploads.set(e.id,l)}handleComplete(e,t){this.activeUploads.delete(e),S(this.store,e,{status:"complete",progress:100,response:t}),this.updateTotalProgress(),this.checkAllComplete(),this.processQueue()}handleError(e,t){this.activeUploads.delete(e);const o=this.store.getState().files.get(e);if(!o)return;const{retryConfig:r}=this.store.getState().queueConfig,i=o.retryCount+1;if(i<=r.maxRetries){const a=Math.min(r.baseDelay*Math.pow(r.backoffFactor,o.retryCount),r.maxDelay);S(this.store,e,{status:"retrying",error:t.message,retryCount:i});const l=setTimeout(()=>{this.retryTimers.delete(e),S(this.store,e,{status:"queued"}),this.processQueue()},a);this.retryTimers.set(e,l)}else S(this.store,e,{status:"failed",error:t.message}),this.checkAllComplete(),this.processQueue()}abortUpload(e){var o;(o=this.activeUploads.get(e))==null||o.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,o=0,r=0;for(const i of e.values())(i.status==="queued"||i.status==="uploading"||i.status==="retrying"||i.status==="complete"||i.status==="failed")&&(t+=i.size,o+=i.status==="complete"?i.size:i.bytesUploaded),i.status==="uploading"&&(r+=i.speed);this.store.setState({totalBytes:t,totalBytesUploaded:o,totalSpeed:r,totalProgress:t>0?Math.min(o/t*100,100):0})}checkAllComplete(){const{files:e}=this.store.getState();![...e.values()].some(o=>o.status==="queued"||o.status==="uploading"||o.status==="retrying")&&this.store.getState().isUploading&&this.store.setState({isUploading:!1})}}function _e(n){return n==="queued"||n==="uploading"||n==="retrying"}function te(n){return`https://api.filerobot.com/${n}`}async function De(n,e){const t=`${te(n)}/key/${encodeURIComponent(e)}`,o=new AbortController,r=setTimeout(()=>o.abort(),3e4);try{const i=await fetch(t,{signal:o.signal});if(clearTimeout(r),!i.ok)throw new Error(`SASS key exchange failed (HTTP ${i.status})`);const a=await i.json();if(a.status==="error")throw new Error(`SASS key exchange failed: ${a.msg||"Unknown error"}`);return a.key}catch(i){throw clearTimeout(r),i instanceof DOMException&&i.name==="AbortError"?new Error("SASS key exchange timed out"):i}}function K(n,e){const t={};switch(n.mode){case"security-template":if(!e)throw new Error("[sfx-uploader] Cannot build auth headers for security-template mode: SASS key exchange has not been performed. Call resolveAuth() first or use sass-key mode with a pre-resolved key.");t["X-Filerobot-Key"]=e;break;case"sass-key":t["X-Filerobot-Key"]=n.sassKey;break}return n.airboxPuid&&(t["X-Filerobot-Airbox-Puid"]=n.airboxPuid),t}async function Fe(n){const e=te(n.container);if(n.mode==="security-template"){const t=await De(n.container,n.securityTemplateId);return{apiBase:e,headers:K(n,t),sassKey:t}}return{apiBase:e,headers:K(n)}}const g={FILE_ADDED:"sfx-file-added",FILE_REMOVED:"sfx-file-removed",FILE_REJECTED:"sfx-file-rejected",UPLOAD_STARTED:"sfx-upload-started",UPLOAD_PROGRESS:"sfx-upload-progress",UPLOAD_COMPLETE:"sfx-upload-complete",UPLOAD_ERROR:"sfx-upload-error",UPLOAD_RETRY:"sfx-upload-retry",ALL_COMPLETE:"sfx-all-complete",TOTAL_PROGRESS:"sfx-total-progress",BEFORE_UPLOAD:"sfx-before-upload",OPEN:"sfx-open",CLOSE:"sfx-close",CANCEL:"sfx-cancel",COMPLETE_ACTION:"sfx-complete-action",FILE_PREVIEW:"sfx-file-preview",FILL_METADATA:"sfx-fill-metadata"};let Xe=0;function T(){return`file-${Date.now()}-${++Xe}`}function B(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),o=n/Math.pow(1024,t);return`${t===0?o:o.toFixed(1)} ${e[t]}`}function oe(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),o=e%60;return o>0?`${t}m ${o}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 We(n){const e=n.lastIndexOf(".");return e>=0?n.slice(e+1).toUpperCase():""}const Ge={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 Ke(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())??"";return Ge[e]||""}function Ze(n){return new Promise(e=>{const t=document.createElement("video");t.preload="metadata",t.muted=!0,t.playsInline=!0;const o=URL.createObjectURL(n);let r=!1;const i=()=>{r||(r=!0,e(null)),t.removeAttribute("src"),t.load(),URL.revokeObjectURL(o)};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(o))},"image/jpeg",.7);return}}catch{}i()},{once:!0}),t.addEventListener("error",()=>i(),{once:!0}),setTimeout(()=>i(),5e3),t.src=o,t.addEventListener("loadeddata",()=>{t.currentTime=.1},{once:!0})})}function ie(n,e,t){var o,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 i=n.size;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&(i+=a.size);if(i>e.maxTotalFilesSize)return"Total file size limit exceeded"}if(e.maxNumberOfFiles!=null){let i=0;for(const a of t.values())a.status!=="rejected"&&a.status!=="cancelled"&&i++;if(i>=e.maxNumberOfFiles)return`Maximum ${e.maxNumberOfFiles} files allowed`}if(e.allowedFileTypes!=null){const i=e.allowedFileTypes,a="."+(((o=n.name.split(".").pop())==null?void 0:o.toLowerCase())??"");if(!i.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 i=e.blockedFileTypes,a="."+(((r=n.name.split(".").pop())==null?void 0:r.toLowerCase())??"");if(i.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 Je(n,e,t){return ie(n,e,t)}function ke(n){return n.allowedFileTypes?n.allowedFileTypes.join(","):""}const Ce={"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 Re(n){return n.filter(e=>e in Ce).map(e=>Ce[e])}var Qe=Object.defineProperty,et=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&Qe(e,t,r),r};const tt='<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"/>',rt='<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"/>',ot='<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"/>',it='<rect x="2" y="3" width="20" height="14" rx="2"/><circle cx="12" cy="10" r="1"/><path d="M7 21l5-5 5 5"/>',A=[{id:"device",label:"My Device",icon:tt,iconColor:"#2563eb"},{id:"url",label:"URL link",icon:rt,iconColor:"#16a34a"},{id:"camera",label:"Camera",icon:ot,iconColor:"#7c3aed"},{id:"screen-cast",label:"Screen capture",icon:it,iconColor:"#ea580c"}],pe=class pe extends s.LitElement{constructor(){super(...arguments),this.sources=A}_handleClick(e){this.dispatchEvent(new CustomEvent("source-click",{detail:{source:e.id},bubbles:!0,composed:!0}))}render(){return s.html`
2
2
  ${this.sources.map(e=>s.html`
3
3
  <button @click=${()=>this._handleClick(e)}>
4
- ${e.brandHtml?M.unsafeHTML(e.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${z.unsafeSVG(e.icon)}</svg>`}
4
+ ${e.brandHtml?j.unsafeHTML(e.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${z.unsafeSVG(e.icon)}</svg>`}
5
5
  ${e.label}
6
6
  </button>
7
7
  `)}
8
- `}};le.styles=s.css`
8
+ `}};pe.styles=s.css`
9
9
  :host {
10
10
  display: flex;
11
11
  flex-wrap: wrap;
@@ -77,32 +77,33 @@
77
77
  stroke: none;
78
78
  stroke-width: 0;
79
79
  }
80
- `;let Z=le;Je([c.property({type:Array})],Z.prototype,"sources");function Fe(n){let e=n;for(;e;){if(e instanceof HTMLDialogElement&&e.open)return e;e instanceof ShadowRoot?e=e.host:e=e.parentNode}return document.body}var ot=Object.defineProperty,U=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&ot(e,t,r),r};const ke=3,de=class de extends s.LitElement{constructor(){super(...arguments),this.compact=!1,this.externalDragOver=!1,this.accept="",this.sources=[],this.sourcesLayout="pills",this._dragOver=!1,this._moreOpen=!1,this._visiblePills=ke,this._dragCounter=0,this._onDragEnter=e=>{e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._dragOver=!0)},this._onDragOver=e=>{e.preventDefault()},this._onDragLeave=e=>{e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._dragOver=!1)},this._onDrop=e=>{var o;e.preventDefault(),e.stopPropagation(),this._dragCounter=0,this._dragOver=!1;const t=Array.from(((o=e.dataTransfer)==null?void 0:o.files)??[]);t.length>0&&this._emitFiles(t)},this._onClick=e=>{const t=this.shadowRoot.querySelector(".drop-zone");if(t&&this._rippleEl){const o=t.getBoundingClientRect();this._rippleEl.style.left=`${e.clientX-o.left}px`,this._rippleEl.style.top=`${e.clientY-o.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,o=Array.from(t.files??[]);o.length>0&&this._emitFiles(o),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 o=[];for(const i of t)if(i.kind==="file"){const a=i.getAsFile();a&&o.push(a)}o.length>0&&(e.preventDefault(),this._emitFiles(o))},this._portalContainer=null,this._onDocClick=e=>{var t;this._moreOpen&&((t=this._portalContainer)!=null&&t.contains(e.target)||(this._moreOpen=!1,this._updateDropdownPortal()))},this._onDocKeyDown=e=>{e.key==="Escape"&&this._moreOpen&&(this._moreOpen=!1,this._updateDropdownPortal())},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._updateDropdownPortal()}_updateDropdownPortal(){if(this._moreOpen){const e=this.sources.slice(this._visiblePills);this._portalContainer||(this._portalContainer=document.createElement("div"),this._portalContainer.setAttribute("data-sfx-more-dropdown",""),this._injectDropdownStyles(),Fe(this).appendChild(this._portalContainer)),s.render(s.html`<div class="sfx-more-dropdown open">
80
+ `;let Z=pe;et([c.property({type:Array})],Z.prototype,"sources");function je(n){let e=n;for(;e;){if(e instanceof ShadowRoot){e=e.host;continue}if(e instanceof HTMLDialogElement&&e.open)return e;if(e instanceof Element&&e.shadowRoot){const t=e.shadowRoot.querySelector("dialog[open]");if(t instanceof HTMLDialogElement)return t}e=e.parentNode}return document.body}var st=Object.defineProperty,U=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&st(e,t,r),r};const $e=3,se=new CSSStyleSheet;se.replaceSync(`
81
+ [data-sfx-more-dropdown] { position:absolute; top:0; left:0; width:0; height:0; overflow:visible; pointer-events:none; }
82
+ [data-sfx-more-dropdown] .sfx-more-dropdown { position:fixed; background:#fff; border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,0.14),0 2px 8px rgba(0,0,0,0.06); border:1px solid #e8edf5; padding:6px; min-width:210px; max-height:340px; overflow-y:auto; z-index:99999; opacity:0; visibility:hidden; pointer-events:none; transition:opacity .18s ease,visibility .18s ease,transform .18s ease; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; }
83
+ [data-sfx-more-dropdown] .sfx-more-dropdown.open { opacity:1; visibility:visible; pointer-events:all; }
84
+ [data-sfx-more-dropdown] .sfx-more-item { display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:6px; border:none; background:none; width:100%; font-size:13px; font-weight:500; color:#1e293b; cursor:pointer; transition:background .15s; font-family:inherit; white-space:nowrap; }
85
+ [data-sfx-more-dropdown] .sfx-more-item:hover { background:#f5f7fa; }
86
+ [data-sfx-more-dropdown] .sfx-more-item-ico { width:32px; height:32px; border-radius:8px; background:#f8fafc; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
87
+ [data-sfx-more-dropdown] .sfx-more-item-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
88
+ [data-sfx-more-dropdown] .sfx-more-item .brand-ico { width:20px; height:20px; border-radius:5px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
89
+ [data-sfx-more-dropdown] .sfx-more-item .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
90
+ [data-sfx-more-dropdown] .sfx-more-item .canva-ico { width:22px; height:22px; }
91
+ [data-sfx-more-dropdown] .sfx-more-item .canva-ico svg { width:22px; height:22px; }
92
+ `);const ce=class ce 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 o;e.preventDefault(),e.stopPropagation(),this._dragCounter=0,this._dragOver=!1;const t=Array.from(((o=e.dataTransfer)==null?void 0:o.files)??[]);t.length>0&&this._emitFiles(t)},this._onClick=e=>{const t=this.shadowRoot.querySelector(".drop-zone");if(t&&this._rippleEl){const o=t.getBoundingClientRect();this._rippleEl.style.left=`${e.clientX-o.left}px`,this._rippleEl.style.top=`${e.clientY-o.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,o=Array.from(t.files??[]);o.length>0&&this._emitFiles(o),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 o=[];for(const i of t)if(i.kind==="file"){const a=i.getAsFile();a&&o.push(a)}o.length>0&&(e.preventDefault(),this._emitFiles(o))},this._portalContainer=null,this._onDocClick=e=>{var t;this._moreOpen&&((t=this._portalContainer)!=null&&t.contains(e.target)||(this._moreOpen=!1,this._updateDropdownPortal()))},this._onDocKeyDown=e=>{e.key==="Escape"&&this._moreOpen&&(this._moreOpen=!1,this._updateDropdownPortal())},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._updateDropdownPortal()}_updateDropdownPortal(){if(this._moreOpen){const e=this.sources.slice(this._visiblePills);this._portalContainer||(this._portalContainer=document.createElement("div"),this._portalContainer.setAttribute("data-sfx-more-dropdown",""),je(this).appendChild(this._portalContainer),this._injectDropdownStyles()),s.render(s.html`<div class="sfx-more-dropdown open">
81
93
  ${e.map(t=>s.html`
82
94
  <button class="sfx-more-item" @click=${o=>this._onMoreItemClick(t,o)}>
83
95
  <div class="sfx-more-item-ico">
84
- ${t.brandHtml?M.unsafeHTML(t.brandHtml):t.iconColor?s.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${z.unsafeSVG(t.icon)}</svg>`:s.svg`<svg viewBox="0 0 24 24">${z.unsafeSVG(t.icon)}</svg>`}
96
+ ${t.brandHtml?j.unsafeHTML(t.brandHtml):t.iconColor?s.html`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${z.unsafeSVG(t.icon)}</svg>`:s.svg`<svg viewBox="0 0 24 24">${z.unsafeSVG(t.icon)}</svg>`}
85
97
  </div>
86
98
  ${t.label}
87
99
  </button>
88
100
  `)}
89
- </div>`,this._portalContainer),requestAnimationFrame(()=>this._positionDropdown())}else this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}_injectDropdownStyles(){if(document.querySelector("style[data-sfx-more-dropdown-styles]"))return;const e=document.createElement("style");e.setAttribute("data-sfx-more-dropdown-styles",""),e.textContent=`
90
- [data-sfx-more-dropdown] .sfx-more-dropdown { position:fixed; background:#fff; border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,0.14),0 2px 8px rgba(0,0,0,0.06); border:1px solid #e8edf5; padding:6px; min-width:210px; max-height:340px; overflow-y:auto; z-index:99999; opacity:0; visibility:hidden; pointer-events:none; transition:opacity .18s ease,visibility .18s ease,transform .18s ease; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; }
91
- [data-sfx-more-dropdown] .sfx-more-dropdown.open { opacity:1; visibility:visible; pointer-events:all; }
92
- [data-sfx-more-dropdown] .sfx-more-item { display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:6px; border:none; background:none; width:100%; font-size:13px; font-weight:500; color:#1e293b; cursor:pointer; transition:background .15s; font-family:inherit; white-space:nowrap; }
93
- [data-sfx-more-dropdown] .sfx-more-item:hover { background:#f5f7fa; }
94
- [data-sfx-more-dropdown] .sfx-more-item-ico { width:32px; height:32px; border-radius:8px; background:#f8fafc; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
95
- [data-sfx-more-dropdown] .sfx-more-item-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
96
- [data-sfx-more-dropdown] .sfx-more-item .brand-ico { width:20px; height:20px; border-radius:5px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
97
- [data-sfx-more-dropdown] .sfx-more-item .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
98
- [data-sfx-more-dropdown] .sfx-more-item .canva-ico { width:22px; height:22px; }
99
- [data-sfx-more-dropdown] .sfx-more-item .canva-ico svg { width:22px; height:22px; }
100
- `,document.head.appendChild(e)}_positionDropdown(){var u,x;const e=(u=this.shadowRoot)==null?void 0:u.querySelector(".more-wrap > button"),t=(x=this._portalContainer)==null?void 0:x.querySelector(".sfx-more-dropdown");if(!e||!t)return;const o=e.getBoundingClientRect(),r=8,i=t.scrollHeight,a=t.offsetWidth,l=o.top,d=window.innerHeight-o.bottom;l>=i+r||l>d?t.style.top=`${o.top-i-r}px`:t.style.top=`${o.bottom+r}px`;let h=o.right-a;h=Math.max(8,Math.min(h,window.innerWidth-a-8)),t.style.left=`${h}px`}_onMoreItemClick(e,t){t.stopPropagation(),this._moreOpen=!1,this._onSourceIconClick(e)}_updateVisiblePills(){const e=window.innerWidth;this.sourcesLayout==="cards"?e<=480?this._visiblePills=2:e<=768?this._visiblePills=3:this._visiblePills=5:e<=480?this._visiblePills=1:e<=768?this._visiblePills=2:this._visiblePills=ke}connectedCallback(){super.connectedCallback(),document.addEventListener("paste",this._onPaste),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onDocKeyDown),window.addEventListener("scroll",this._onScrollOrResize,!0),window.addEventListener("resize",this._onScrollOrResize),this._updateVisiblePills()}updated(e){e.has("sourcesLayout")&&this._updateVisiblePills()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("paste",this._onPaste),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onDocKeyDown),window.removeEventListener("scroll",this._onScrollOrResize,!0),window.removeEventListener("resize",this._onScrollOrResize),this._resizeTimer&&clearTimeout(this._resizeTimer),this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}_renderPill(e){return s.html`
101
+ </div>`,this._portalContainer),requestAnimationFrame(()=>this._positionDropdown())}else this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}_injectDropdownStyles(){var t;const e=(t=this._portalContainer)==null?void 0:t.getRootNode();e&&(e.adoptedStyleSheets.includes(se)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,se]))}_positionDropdown(){var u,x;const e=(u=this.shadowRoot)==null?void 0:u.querySelector(".more-wrap > button"),t=(x=this._portalContainer)==null?void 0:x.querySelector(".sfx-more-dropdown");if(!e||!t)return;const o=e.getBoundingClientRect(),r=8,i=t.scrollHeight,a=t.offsetWidth,l=o.top,d=window.innerHeight-o.bottom;l>=i+r||l>d?t.style.top=`${o.top-i-r}px`:t.style.top=`${o.bottom+r}px`;let h=o.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),this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}_renderPill(e){return s.html`
101
102
  <button
102
103
  class="src-pill"
103
104
  @click=${t=>{t.stopPropagation(),this._onSourceIconClick(e)}}
104
105
  >
105
- ${e.brandHtml?M.unsafeHTML(e.brandHtml):s.html`<span class="pill-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
106
+ ${e.brandHtml?j.unsafeHTML(e.brandHtml):s.html`<span class="pill-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
106
107
  ${s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${z.unsafeSVG(e.icon)}</svg>`}
107
108
  </span>`}
108
109
  ${e.label}
@@ -113,7 +114,7 @@
113
114
  aria-label=${e.label}
114
115
  @click=${t=>{t.stopPropagation(),this._onSourceIconClick(e)}}
115
116
  >
116
- ${e.brandHtml?s.html`<span class="card-ico">${M.unsafeHTML(e.brandHtml)}</span>`:s.html`<span class="card-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
117
+ ${e.brandHtml?s.html`<span class="card-ico">${j.unsafeHTML(e.brandHtml)}</span>`:s.html`<span class="card-ico" style=${e.iconColor?`color:${e.iconColor}`:""}>
117
118
  ${s.svg`<svg viewBox="0 0 24 24" class=${e.fillIcon?"fill-icon":""}>${z.unsafeSVG(e.icon)}</svg>`}
118
119
  </span>`}
119
120
  <span class="card-label">${e.label}</span>
@@ -194,7 +195,7 @@
194
195
  aria-label=${r.label}
195
196
  @click=${i=>{i.stopPropagation(),this._onSourceIconClick(r)}}
196
197
  >
197
- ${r.brandHtml?M.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${z.unsafeSVG(r.icon)}</svg>`}
198
+ ${r.brandHtml?j.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${z.unsafeSVG(r.icon)}</svg>`}
198
199
  </button>
199
200
  `)}
200
201
  </div>
@@ -208,7 +209,7 @@
208
209
  @change=${this._onFileChange}
209
210
  />
210
211
  </div>
211
- `}};de.styles=s.css`
212
+ `}};ce.styles=s.css`
212
213
  :host {
213
214
  display: flex;
214
215
  flex-shrink: 0;
@@ -990,11 +991,11 @@
990
991
  animation: none;
991
992
  }
992
993
  }
993
- `;let C=de;U([c.property({type:Boolean,reflect:!0})],C.prototype,"compact");U([c.property({type:Boolean,attribute:"external-drag-over"})],C.prototype,"externalDragOver");U([c.property({type:String})],C.prototype,"accept");U([c.property({type:Array})],C.prototype,"sources");U([c.property({type:String,attribute:"sources-layout"})],C.prototype,"sourcesLayout");U([c.state()],C.prototype,"_dragOver");U([c.state()],C.prototype,"_moreOpen");U([c.state()],C.prototype,"_visiblePills");U([c.query(".ripple")],C.prototype,"_rippleEl");U([c.query('input[type="file"]')],C.prototype,"fileInput");const pe=class pe extends s.LitElement{render(){return s.html`
994
+ `;let C=ce;U([c.property({type:Boolean,reflect:!0})],C.prototype,"compact");U([c.property({type:Boolean,attribute:"external-drag-over"})],C.prototype,"externalDragOver");U([c.property({type:String})],C.prototype,"accept");U([c.property({type:Array})],C.prototype,"sources");U([c.property({type:String,attribute:"sources-layout"})],C.prototype,"sourcesLayout");U([c.state()],C.prototype,"_dragOver");U([c.state()],C.prototype,"_moreOpen");U([c.state()],C.prototype,"_visiblePills");U([c.query(".ripple")],C.prototype,"_rippleEl");U([c.query('input[type="file"]')],C.prototype,"fileInput");const fe=class fe extends s.LitElement{render(){return s.html`
994
995
  <div class="line"></div>
995
996
  <div class="label">or import from</div>
996
997
  <div class="line"></div>
997
- `}};pe.styles=s.css`
998
+ `}};fe.styles=s.css`
998
999
  :host {
999
1000
  display: flex;
1000
1001
  align-items: center;
@@ -1016,31 +1017,32 @@
1016
1017
  letter-spacing: 1px;
1017
1018
  white-space: nowrap;
1018
1019
  }
1019
- `;let se=pe;var it=Object.defineProperty,V=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&it(e,t,r),r};const ce=class ce extends s.LitElement{constructor(){super(...arguments),this.files=[],this.showDropTile=!1,this.sources=[],this.accept="",this._moreOpen=!1,this._portalContainer=null,this._outsideClickHandler=e=>{var r;if((r=this._portalContainer)!=null&&r.contains(e.target))return;const t=this.renderRoot.querySelector(".drop-tile-more-wrap"),o=e.composedPath();t&&o.includes(t)||(this._moreOpen=!1,this._closePortal(),document.removeEventListener("click",this._outsideClickHandler,!0))},this._onScrollOrResize=()=>{this._moreOpen&&this._positionPortal()},this._onKeyDown=e=>{e.key==="Escape"&&this._moreOpen&&(this._moreOpen=!1,this._closePortal(),this._removeGlobalListeners())}}_onDropTileClick(){const e=this.renderRoot.querySelector('input[type="file"]');e==null||e.click()}_onFileInput(e){const t=e.target,o=Array.from(t.files??[]);o.length>0&&this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:o},bubbles:!0,composed:!0})),t.value=""}_onSourceClick(e,t){if(e.stopPropagation(),t.id==="device"){const o=this.renderRoot.querySelector('input[type="file"]');o==null||o.click();return}this.dispatchEvent(new CustomEvent("source-click",{detail:{source:t},bubbles:!0,composed:!0}))}_addGlobalListeners(){requestAnimationFrame(()=>document.addEventListener("click",this._outsideClickHandler,!0)),document.addEventListener("keydown",this._onKeyDown),window.addEventListener("scroll",this._onScrollOrResize,!0),window.addEventListener("resize",this._onScrollOrResize)}_removeGlobalListeners(){document.removeEventListener("click",this._outsideClickHandler,!0),document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("scroll",this._onScrollOrResize,!0),window.removeEventListener("resize",this._onScrollOrResize)}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen?(this._openPortal(),this._addGlobalListeners()):(this._closePortal(),this._removeGlobalListeners())}_openPortal(){const e=this.sources.slice(3);this._portalContainer||(this._portalContainer=document.createElement("div"),this._portalContainer.setAttribute("data-sfx-tile-dropdown",""),this._injectTileDropdownStyles(),Fe(this).appendChild(this._portalContainer)),s.render(s.html`<div class="sfx-tile-dropdown">
1020
+ `;let ae=fe;var at=Object.defineProperty,V=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&at(e,t,r),r};const ne=new CSSStyleSheet;ne.replaceSync(`
1021
+ [data-sfx-tile-dropdown] { position:absolute; top:0; left:0; width:0; height:0; overflow:visible; pointer-events:none; }
1022
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown { position:fixed; background:#fff; border:1px solid #e2e8f0; border-radius:10px; box-shadow:0 4px 20px rgba(0,0,0,0.12); padding:6px; z-index:99999; min-width:180px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; animation:sfxTileDropIn .15s ease; }
1023
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-item { display:flex; align-items:center; gap:10px; width:100%; padding:8px 12px; border:none; background:none; border-radius:6px; cursor:pointer; font-size:13px; font-weight:500; color:#1e293b; white-space:nowrap; transition:background .15s; font-family:inherit; }
1024
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-item:hover { background:#f5f7fa; }
1025
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico { width:32px; height:32px; border-radius:8px; background:#f8fafc; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
1026
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
1027
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico svg.fill-icon { fill:currentColor; stroke:none; }
1028
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .brand-ico { width:20px; height:20px; border-radius:5px; display:flex; align-items:center; justify-content:center; }
1029
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
1030
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico { width:22px; height:22px; }
1031
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico svg { width:22px; height:22px; }
1032
+ @keyframes sfxTileDropIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
1033
+ `);const he=class he extends s.LitElement{constructor(){super(...arguments),this.files=[],this.showDropTile=!1,this.sources=[],this.accept="",this._moreOpen=!1,this._portalContainer=null,this._outsideClickHandler=e=>{var r;if((r=this._portalContainer)!=null&&r.contains(e.target))return;const t=this.renderRoot.querySelector(".drop-tile-more-wrap"),o=e.composedPath();t&&o.includes(t)||(this._moreOpen=!1,this._closePortal(),document.removeEventListener("click",this._outsideClickHandler,!0))},this._onScrollOrResize=()=>{this._moreOpen&&this._positionPortal()},this._onKeyDown=e=>{e.key==="Escape"&&this._moreOpen&&(this._moreOpen=!1,this._closePortal(),this._removeGlobalListeners())}}_onDropTileClick(){const e=this.renderRoot.querySelector('input[type="file"]');e==null||e.click()}_onFileInput(e){const t=e.target,o=Array.from(t.files??[]);o.length>0&&this.dispatchEvent(new CustomEvent("files-selected",{detail:{files:o},bubbles:!0,composed:!0})),t.value=""}_onSourceClick(e,t){if(e.stopPropagation(),t.id==="device"){const o=this.renderRoot.querySelector('input[type="file"]');o==null||o.click();return}this.dispatchEvent(new CustomEvent("source-click",{detail:{source:t},bubbles:!0,composed:!0}))}_addGlobalListeners(){requestAnimationFrame(()=>document.addEventListener("click",this._outsideClickHandler,!0)),document.addEventListener("keydown",this._onKeyDown),window.addEventListener("scroll",this._onScrollOrResize,!0),window.addEventListener("resize",this._onScrollOrResize)}_removeGlobalListeners(){document.removeEventListener("click",this._outsideClickHandler,!0),document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("scroll",this._onScrollOrResize,!0),window.removeEventListener("resize",this._onScrollOrResize)}_toggleMore(e){e.stopPropagation(),this._moreOpen=!this._moreOpen,this._moreOpen?(this._openPortal(),this._addGlobalListeners()):(this._closePortal(),this._removeGlobalListeners())}_openPortal(){const e=this.sources.slice(3);this._portalContainer||(this._portalContainer=document.createElement("div"),this._portalContainer.setAttribute("data-sfx-tile-dropdown",""),je(this).appendChild(this._portalContainer),this._injectTileDropdownStyles()),s.render(s.html`<div class="sfx-tile-dropdown">
1020
1034
  ${e.map(t=>s.html`
1021
1035
  <button
1022
1036
  class="sfx-tile-dropdown-item"
1023
1037
  @click=${o=>this._onMoreSourceClick(o,t)}
1024
1038
  >
1025
1039
  <span class="sfx-tile-dropdown-ico" style=${t.iconColor&&!t.brandHtml?`color:${t.iconColor}`:""}>
1026
- ${t.brandHtml?M.unsafeHTML(t.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${t.fillIcon?"fill-icon":""}>${z.unsafeSVG(t.icon)}</svg>`}
1040
+ ${t.brandHtml?j.unsafeHTML(t.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${t.fillIcon?"fill-icon":""}>${z.unsafeSVG(t.icon)}</svg>`}
1027
1041
  </span>
1028
1042
  ${t.label}
1029
1043
  </button>
1030
1044
  `)}
1031
- </div>`,this._portalContainer),requestAnimationFrame(()=>this._positionPortal())}_positionPortal(){var u;const e=this.renderRoot.querySelector(".drop-tile-more"),t=(u=this._portalContainer)==null?void 0:u.querySelector(".sfx-tile-dropdown");if(!e||!t)return;const o=e.getBoundingClientRect(),r=6,i=t.scrollHeight,a=t.offsetWidth,l=o.top,d=window.innerHeight-o.bottom;l>=i+r||l>d?t.style.top=`${o.top-i-r}px`:t.style.top=`${o.bottom+r}px`;let h=o.right-a;h=Math.max(8,Math.min(h,window.innerWidth-a-8)),t.style.left=`${h}px`}_closePortal(){this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}_injectTileDropdownStyles(){if(document.querySelector("style[data-sfx-tile-dropdown-styles]"))return;const e=document.createElement("style");e.setAttribute("data-sfx-tile-dropdown-styles",""),e.textContent=`
1032
- [data-sfx-tile-dropdown] .sfx-tile-dropdown { position:fixed; background:#fff; border:1px solid #e2e8f0; border-radius:10px; box-shadow:0 4px 20px rgba(0,0,0,0.12); padding:6px; z-index:99999; min-width:180px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; animation:sfxTileDropIn .15s ease; }
1033
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-item { display:flex; align-items:center; gap:10px; width:100%; padding:8px 12px; border:none; background:none; border-radius:6px; cursor:pointer; font-size:13px; font-weight:500; color:#1e293b; white-space:nowrap; transition:background .15s; font-family:inherit; }
1034
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-item:hover { background:#f5f7fa; }
1035
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico { width:32px; height:32px; border-radius:8px; background:#f8fafc; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
1036
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
1037
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico svg.fill-icon { fill:currentColor; stroke:none; }
1038
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .brand-ico { width:20px; height:20px; border-radius:5px; display:flex; align-items:center; justify-content:center; }
1039
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
1040
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico { width:22px; height:22px; }
1041
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico svg { width:22px; height:22px; }
1042
- @keyframes sfxTileDropIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
1043
- `,document.head.appendChild(e)}disconnectedCallback(){super.disconnectedCallback(),this._moreOpen=!1,this._closePortal(),this._removeGlobalListeners()}_onMoreSourceClick(e,t){this._moreOpen=!1,this._closePortal(),this._removeGlobalListeners(),this._onSourceClick(e,t)}_renderDropTile(){const t=this.sources.slice(0,3),o=this.sources.slice(3);return s.html`
1045
+ </div>`,this._portalContainer),requestAnimationFrame(()=>this._positionPortal())}_positionPortal(){var u;const e=this.renderRoot.querySelector(".drop-tile-more"),t=(u=this._portalContainer)==null?void 0:u.querySelector(".sfx-tile-dropdown");if(!e||!t)return;const o=e.getBoundingClientRect(),r=6,i=t.scrollHeight,a=t.offsetWidth,l=o.top,d=window.innerHeight-o.bottom;l>=i+r||l>d?t.style.top=`${o.top-i-r}px`:t.style.top=`${o.bottom+r}px`;let h=o.right-a;h=Math.max(8,Math.min(h,window.innerWidth-a-8)),t.style.left=`${h}px`}_closePortal(){this._portalContainer&&(s.render(s.nothing,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null)}_injectTileDropdownStyles(){var t;const e=(t=this._portalContainer)==null?void 0:t.getRootNode();e&&(e.adoptedStyleSheets.includes(ne)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,ne]))}disconnectedCallback(){super.disconnectedCallback(),this._moreOpen=!1,this._closePortal(),this._removeGlobalListeners()}_onMoreSourceClick(e,t){this._moreOpen=!1,this._closePortal(),this._removeGlobalListeners(),this._onSourceClick(e,t)}_renderDropTile(){const t=this.sources.slice(0,3),o=this.sources.slice(3);return s.html`
1044
1046
  <div class="drop-tile" @click=${this._onDropTileClick}>
1045
1047
  <div class="drop-tile-rings">
1046
1048
  <div class="drop-tile-ring"></div>
@@ -1063,7 +1065,7 @@
1063
1065
  title=${r.label}
1064
1066
  @click=${i=>this._onSourceClick(i,r)}
1065
1067
  >
1066
- ${r.brandHtml?M.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${z.unsafeSVG(r.icon)}</svg>`}
1068
+ ${r.brandHtml?j.unsafeHTML(r.brandHtml):s.svg`<svg viewBox="0 0 24 24" class=${r.fillIcon?"fill-icon":""}>${z.unsafeSVG(r.icon)}</svg>`}
1067
1069
  </button>
1068
1070
  `)}
1069
1071
  ${o.length>0?s.html`
@@ -1080,7 +1082,7 @@
1080
1082
  ${this.showDropTile?this._renderDropTile():s.nothing}
1081
1083
  ${this.files.map((e,t)=>s.html`<sfx-file-item .file=${e} style="--tile-index:${t}"></sfx-file-item>`)}
1082
1084
  </div>
1083
- `}};ce.styles=s.css`
1085
+ `}};he.styles=s.css`
1084
1086
  :host {
1085
1087
  display: block;
1086
1088
  flex: 1;
@@ -1381,7 +1383,7 @@
1381
1383
  input[type="file"] {
1382
1384
  display: none;
1383
1385
  }
1384
- `;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 st=Object.defineProperty,at=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&st(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),o=e.status==="complete",r=e.status==="uploading",i=e.status==="error"||e.status==="failed",a=e.status==="rejected",l=Ne(e.name),d=["tile",o?"done":"",r?"uploading":"",a?"rejected":""].filter(Boolean).join(" ");return s.html`
1386
+ `;let D=he;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 nt=Object.defineProperty,lt=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&nt(e,t,r),r};const ue=class ue 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),o=e.status==="complete",r=e.status==="uploading",i=e.status==="error"||e.status==="failed",a=e.status==="rejected",l=We(e.name),d=["tile",o?"done":"",r?"uploading":"",a?"rejected":""].filter(Boolean).join(" ");return s.html`
1385
1387
  <div class=${d} tabindex="0">
1386
1388
  <!-- Preview area -->
1387
1389
  <div class="preview">
@@ -1459,7 +1461,7 @@
1459
1461
  <div class="meta">${l||""}${e.size?` · ${B(e.size)}`:""}</div>
1460
1462
  </div>
1461
1463
  </div>
1462
- `}_formatDuration(e){const t=Math.floor(e/60),o=Math.floor(e%60);return`${t}:${o.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`
1464
+ `}_formatDuration(e){const t=Math.floor(e/60),o=Math.floor(e%60);return`${t}:${o.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>`}}};ue.styles=s.css`
1463
1465
  :host {
1464
1466
  display: block;
1465
1467
  }
@@ -1840,7 +1842,7 @@
1840
1842
  .tile { animation: none; }
1841
1843
  .spin-ring { animation: none; }
1842
1844
  }
1843
- `;let J=fe;at([c.property({attribute:!1})],J.prototype,"file");const N=s.css`
1845
+ `;let J=ue;lt([c.property({attribute:!1})],J.prototype,"file");const N=s.css`
1844
1846
  .btn,
1845
1847
  .btn-ghost,
1846
1848
  .btn-primary,
@@ -1914,7 +1916,7 @@
1914
1916
  outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
1915
1917
  outline-offset: 2px;
1916
1918
  }
1917
- `;var nt=Object.defineProperty,W=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&nt(e,t,r),r};const Ce=7,he=class he extends s.LitElement{constructor(){super(...arguments),this.fileCount=0,this.totalSize=0,this.thumbnails=[],this.primaryLabel="Done",this.failedFiles=[]}_uploadMore(){this.dispatchEvent(new CustomEvent("upload-more",{bubbles:!0,composed:!0}))}_primaryAction(){this.dispatchEvent(new CustomEvent("primary-action",{bubbles:!0,composed:!0}))}_retryFile(e){this.dispatchEvent(new CustomEvent("file-retry",{bubbles:!0,composed:!0,detail:{fileId:e}}))}_retryAll(){this.dispatchEvent(new CustomEvent("retry-all",{bubbles:!0,composed:!0}))}_close(){this.dispatchEvent(new CustomEvent("close-uploader",{bubbles:!0,composed:!0}))}render(){const e=this.thumbnails.slice(0,Ce),t=this.thumbnails.length-Ce,o=this.fileCount>0,r=this.failedFiles.length>0,i=r&&!o;return s.html`
1919
+ `;var dt=Object.defineProperty,W=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&dt(e,t,r),r};const Se=7,xe=class xe extends s.LitElement{constructor(){super(...arguments),this.fileCount=0,this.totalSize=0,this.thumbnails=[],this.primaryLabel="Done",this.failedFiles=[]}_uploadMore(){this.dispatchEvent(new CustomEvent("upload-more",{bubbles:!0,composed:!0}))}_primaryAction(){this.dispatchEvent(new CustomEvent("primary-action",{bubbles:!0,composed:!0}))}_retryFile(e){this.dispatchEvent(new CustomEvent("file-retry",{bubbles:!0,composed:!0,detail:{fileId:e}}))}_retryAll(){this.dispatchEvent(new CustomEvent("retry-all",{bubbles:!0,composed:!0}))}_close(){this.dispatchEvent(new CustomEvent("close-uploader",{bubbles:!0,composed:!0}))}render(){const e=this.thumbnails.slice(0,Se),t=this.thumbnails.length-Se,o=this.fileCount>0,r=this.failedFiles.length>0,i=r&&!o;return s.html`
1918
1920
  <button class="close-btn" title="Close" @click=${this._close}>
1919
1921
  <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>
1920
1922
  </button>
@@ -1963,7 +1965,7 @@
1963
1965
  <button class="btn-primary" @click=${this._primaryAction}>${this.primaryLabel}</button>
1964
1966
  </div>
1965
1967
  </div>
1966
- `}};he.styles=[N,X,s.css`
1968
+ `}};xe.styles=[N,X,s.css`
1967
1969
  :host {
1968
1970
  display: flex;
1969
1971
  flex: 1;
@@ -2242,7 +2244,7 @@
2242
2244
  .card { animation: none; }
2243
2245
  .icon { animation: none; }
2244
2246
  }
2245
- `];let F=he;W([c.property({type:Number})],F.prototype,"fileCount");W([c.property({type:Number})],F.prototype,"totalSize");W([c.property({type:Array})],F.prototype,"thumbnails");W([c.property({type:String})],F.prototype,"primaryLabel");W([c.property({type:Array})],F.prototype,"failedFiles");var lt=Object.defineProperty,R=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&lt(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`
2247
+ `];let F=xe;W([c.property({type:Number})],F.prototype,"fileCount");W([c.property({type:Number})],F.prototype,"totalSize");W([c.property({type:Array})],F.prototype,"thumbnails");W([c.property({type:String})],F.prototype,"primaryLabel");W([c.property({type:Array})],F.prototype,"failedFiles");var pt=Object.defineProperty,O=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&pt(e,t,r),r};const ge=class ge 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`
2246
2248
  ${e?s.html`
2247
2249
  <div class="progress-row">
2248
2250
  <div class="progress-track" role="progressbar" aria-valuenow=${Math.round(this.uploadProgress)} aria-valuemin="0" aria-valuemax="100" aria-label="Upload progress">
@@ -2316,7 +2318,7 @@
2316
2318
  Upload
2317
2319
  `}
2318
2320
  </button>
2319
- `}};ue.styles=[N,X,s.css`
2321
+ `}};ge.styles=[N,X,s.css`
2320
2322
  :host {
2321
2323
  display: flex;
2322
2324
  flex-direction: column;
@@ -2464,7 +2466,7 @@
2464
2466
  :host { animation: none; }
2465
2467
  .btn-spin { animation: none; }
2466
2468
  }
2467
- `];let P=ue;R([c.property({type:String})],P.prototype,"uploadState");R([c.property({type:Number})],P.prototype,"fileCount");R([c.property({type:Number})],P.prototype,"totalSize");R([c.property({type:Number})],P.prototype,"failedCount");R([c.property({type:Boolean})],P.prototype,"showFillMetadata");R([c.property({type:Number})],P.prototype,"completedCount");R([c.property({type:Number})],P.prototype,"uploadProgress");const dt='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 o=n();if(!o)return;const r=o.querySelector(e);if(!r)return;const i=Array.from(r.querySelectorAll(dt));if(i.length===0)return;const a=i[0],l=i[i.length-1],d=o.activeElement;t.shiftKey?(d===a||!r.contains(d))&&(t.preventDefault(),l.focus()):(d===l||!r.contains(d))&&(t.preventDefault(),a.focus())}}var pt=Object.defineProperty,ne=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&pt(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("/"),o=t[t.length-1];if(o){const r=(e=this.shadowRoot)==null?void 0:e.querySelector("#nameInput");r&&(r.placeholder=o)}}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 o=new URL(e).pathname.split("/");t=o[o.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`
2469
+ `];let P=ge;O([c.property({type:String})],P.prototype,"uploadState");O([c.property({type:Number})],P.prototype,"fileCount");O([c.property({type:Number})],P.prototype,"totalSize");O([c.property({type:Number})],P.prototype,"failedCount");O([c.property({type:Boolean})],P.prototype,"showFillMetadata");O([c.property({type:Number})],P.prototype,"completedCount");O([c.property({type:Number})],P.prototype,"uploadProgress");const ct='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function le(n,e){return t=>{if(t.key!=="Tab")return;const o=n();if(!o)return;const r=o.querySelector(e);if(!r)return;const i=Array.from(r.querySelectorAll(ct));if(i.length===0)return;const a=i[0],l=i[i.length-1],d=o.activeElement;t.shiftKey?(d===a||!r.contains(d))&&(t.preventDefault(),l.focus()):(d===l||!r.contains(d))&&(t.preventDefault(),a.focus())}}var ft=Object.defineProperty,de=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&ft(e,t,r),r};const ve=class ve 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=le(()=>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("/"),o=t[t.length-1];if(o){const r=(e=this.shadowRoot)==null?void 0:e.querySelector("#nameInput");r&&(r.placeholder=o)}}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 o=new URL(e).pathname.split("/");t=o[o.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`
2468
2470
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2469
2471
  <div class="card">
2470
2472
  <div class="head">
@@ -2508,7 +2510,7 @@
2508
2510
  </div>
2509
2511
  </div>
2510
2512
  </div>
2511
- `}};xe.styles=[N,X,s.css`
2513
+ `}};ve.styles=[N,X,s.css`
2512
2514
  :host {
2513
2515
  display: block;
2514
2516
  }
@@ -2681,7 +2683,7 @@
2681
2683
  outline: none;
2682
2684
  }
2683
2685
 
2684
- `];let I=xe;ne([c.state()],I.prototype,"_url");ne([c.state()],I.prototype,"_name");ne([c.state()],I.prototype,"_error");var ct=Object.defineProperty,re=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&ct(e,t,r),r};const ge=class ge extends s.LitElement{constructor(){super(...arguments),this._stream=null,this._error="",this._captured=null,this._previewUrl="",this._onBackdropClick=e=>{e.target===e.currentTarget&&this._cancel()},this._focusTrap=ae(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._capture=()=>{var r,i;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("video"),t=(i=this.shadowRoot)==null?void 0:i.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`
2686
+ `];let I=ve;de([c.state()],I.prototype,"_url");de([c.state()],I.prototype,"_name");de([c.state()],I.prototype,"_error");var ht=Object.defineProperty,re=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&ht(e,t,r),r};const be=class be 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=le(()=>this.shadowRoot,".card"),this._onKeyDown=e=>{e.key==="Escape"&&this._cancel(),this._focusTrap(e)},this._capture=()=>{var r,i;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("video"),t=(i=this.shadowRoot)==null?void 0:i.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`
2685
2687
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2686
2688
  <div class="card">
2687
2689
  <div class="head">
@@ -2711,7 +2713,7 @@
2711
2713
  </div>
2712
2714
  </div>
2713
2715
  </div>
2714
- `}};ge.styles=[N,X,s.css`
2716
+ `}};be.styles=[N,X,s.css`
2715
2717
  :host { display: block; }
2716
2718
 
2717
2719
  .backdrop {
@@ -2791,7 +2793,7 @@
2791
2793
 
2792
2794
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2793
2795
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2794
- `];let O=ge;re([c.state()],O.prototype,"_stream");re([c.state()],O.prototype,"_error");re([c.state()],O.prototype,"_captured");re([c.state()],O.prototype,"_previewUrl");var ft=Object.defineProperty,G=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&ft(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 o=MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm";this._recorder=new MediaRecorder(this._stream,{mimeType:o}),this._recorder.ondataavailable=r=>{r.data.size>0&&this._chunks.push(r.data)},this._recorder.onstop=()=>{var i;const r=new Blob(this._chunks,{type:"video/webm"});this._recordedBlob=r,this._previewUrl=URL.createObjectURL(r),(i=this._stream)==null||i.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(o=>o.stop()),this._stream=null}_cancel(){this._stopAll(),this.dispatchEvent(new CustomEvent("screencast-cancel",{bubbles:!0,composed:!0}))}render(){return s.html`
2796
+ `];let M=be;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 ut=Object.defineProperty,G=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&ut(e,t,r),r};const me=class me 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=le(()=>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 o=MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm";this._recorder=new MediaRecorder(this._stream,{mimeType:o}),this._recorder.ondataavailable=r=>{r.data.size>0&&this._chunks.push(r.data)},this._recorder.onstop=()=>{var i;const r=new Blob(this._chunks,{type:"video/webm"});this._recordedBlob=r,this._previewUrl=URL.createObjectURL(r),(i=this._stream)==null||i.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(o=>o.stop()),this._stream=null}_cancel(){this._stopAll(),this.dispatchEvent(new CustomEvent("screencast-cancel",{bubbles:!0,composed:!0}))}render(){return s.html`
2795
2797
  <div class="backdrop" @click=${this._onBackdropClick} @keydown=${this._onKeyDown}>
2796
2798
  <div class="card">
2797
2799
  <div class="head">
@@ -2837,7 +2839,7 @@
2837
2839
  </div>
2838
2840
  </div>
2839
2841
  </div>
2840
- `}};ve.styles=[N,X,s.css`
2842
+ `}};me.styles=[N,X,s.css`
2841
2843
  :host { display: block; }
2842
2844
 
2843
2845
  .backdrop {
@@ -2935,7 +2937,7 @@
2935
2937
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2936
2938
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
2937
2939
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
2938
- `];let j=ve;G([c.state()],j.prototype,"_stream");G([c.state()],j.prototype,"_recording");G([c.state()],j.prototype,"_error");G([c.state()],j.prototype,"_recordedBlob");G([c.state()],j.prototype,"_previewUrl");var ht=Object.defineProperty,k=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&ht(e,t,r),r};const $e=new Set(["unsplash"]);var $;const y=($=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._splitPct=68,this._isResizing=!1,this._splitRafId=0,this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0,this._fsDragging=!1,this._fsDragStartX=0,this._fsDragStartY=0,this._fsPanStartX=0,this._fsPanStartY=0,this._bodyDragOver=!1,this._isMinimized=!1,this._isPillExpanded=!1,this._bodyDragCounter=0,this._videoBlobUrls=new Map,this._engine=null,this._cachedSources=A,this._cachedSourcesConfig=void 0,this._rejectedTimers=new Map,this._closeOnCompleteTimer=null,this._apiBase=null,this._authHeaders=null,this._authResolveId=0,this._prevStoreState=null,this._unsubStoreEvents=null,this._portalContainer=null,this._onFilesSelected=e=>{this._processIncomingFiles(e.detail.files)},this._onDropTileSourceClick=e=>{this._handleSourceActivation(e.detail.source.id)},this._onSourceClick=async e=>{this._handleSourceActivation(e.detail.source)},this._handleSourceActivation=async e=>{var r,i;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((((i=(r=this.config)==null?void 0:r.connectors)==null?void 0:i.providers)??[]).includes(e)){if($e.has(e)){if(!customElements.get("sfx-search-provider-browser")){const{SfxSearchProviderBrowser:l}=await Promise.resolve().then(()=>require("./search-provider-browser-DqKnNu87.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-B85iISh9.cjs"));customElements.define("sfx-provider-browser",l)}this._activeConnector=e}},this._onUrlSubmit=e=>{var h,u,x;this._showUrlDialog=!1;const{url:t,name:o}=e.detail,r=(h=this.config)==null?void 0:h.callbacks,i=We(o),a=i.startsWith("image/"),l=this._store.getState(),d=ie({name:o,size:0,type:i},l.restrictions,l.files);if(d){const f={id:T(),status:"rejected",file:null,remoteUrl:t,name:o,size:0,type:i,previewUrl:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};L(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:d}),(u=r==null?void 0:r.onFileRejected)==null||u.call(r,f,d);return}const p={id:T(),status:"idle",file:null,remoteUrl:t,name:o,size:0,type:i,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};L(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(x=r==null?void 0:r.onFileAdded)==null||x.call(r,p),this._store.getState().queueConfig.autoProceed&&this.upload()},this._onUrlCancel=()=>{this._showUrlDialog=!1},this._onCameraCapture=e=>{this._showCameraDialog=!1,this._processIncomingFiles([e.detail.file])},this._onCameraCancel=()=>{this._showCameraDialog=!1},this._onScreenCastCapture=e=>{this._showScreenCastDialog=!1,this._processIncomingFiles([e.detail.file])},this._onScreenCastCancel=()=>{this._showScreenCastDialog=!1},this._onFileRemove=e=>{this._removeFile(e.detail.fileId)},this._onFilePreview=e=>{var o,r,i;const t=this._store.getState().files.get(e.detail.fileId);t&&(this._previewFileId=t.id,this._dispatchPublic(g.FILE_PREVIEW,{file:t}),(i=(r=(o=this.config)==null?void 0:o.callbacks)==null?void 0:r.onFilePreview)==null||i.call(r,t))},this._onFillMetadata=()=>{var t,o,r;const e=[...this._store.getState().files.values()].filter(i=>$._MODIFIABLE_STATUSES.has(i.status));this._dispatchPublic(g.FILL_METADATA,{files:e}),(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onFillMetadata)==null||r.call(o,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 o,r,i;const e=(o=this.config)==null?void 0:o.callbacks;this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),(r=this._engine)==null||r.cancelAll();const t=[...this._store.getState().files.values()];for(const a of t)a.previewUrl&&URL.revokeObjectURL(a.previewUrl),this._dispatchPublic(g.FILE_REMOVED,{file:a}),(i=e==null?void 0:e.onFileRemoved)==null||i.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"),o=(r=t==null?void 0:t.shadowRoot)==null?void 0:r.querySelector('input[type="file"]');o==null||o.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 o,r,i;const t=(o=this.config)==null?void 0:o.callbacks;for(const a of e.detail.files){const l=this._store.getState(),d=ie({name:a.name,size:a.size,type:a.mimeType},l.restrictions,l.files);if(d){const h={id:T(),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};L(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:T(),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};L(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(i=t==null?void 0:t.onFileAdded)==null||i.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,o,r,i;this._dispatchPublic(g.COMPLETE_ACTION,{}),(o=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCompleteAction)==null||o.call(t),((r=this.config)==null?void 0:r.mode)==="modal"?this.close():((i=this.config)==null?void 0:i.clearOnComplete)!==!1&&this._onClearAll()},this._onInlineDismiss=()=>{var e,t,o;(o=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||o.call(t),this._dispatchPublic(g.CANCEL,{})},this._onSuccessCardClose=()=>{var e,t,o,r;((e=this.config)==null?void 0:e.mode)==="inline"?(this._dispatchPublic(g.COMPLETE_ACTION,{}),(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onCompleteAction)==null||r.call(o),this._onClearAll()):this._onModalDismiss()},this._onModalDismiss=()=>{var e,t,o,r;this._phase==="uploading"&&((e=this._engine)==null||e.cancelAll()),(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onCancel)==null||r.call(o),this._dispatchPublic(g.CANCEL,{}),this.close()},this._onMinimize=()=>{this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()},this._onPillClick=()=>{this._isPillExpanded=!this._isPillExpanded,this.requestUpdate()},this._onPillExpand=()=>{this._isMinimized=!1,this._isPillExpanded=!1,this._isOpen=!0,this.requestUpdate()},this._onPillDismiss=()=>{var e,t,o,r;this._isMinimized=!1,this._isPillExpanded=!1,this._phase==="uploading"&&((e=this._engine)==null||e.cancelAll()),(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onCancel)==null||r.call(o),this._dispatchPublic(g.CANCEL,{}),this.close()},this._onModalBackdropClick=e=>{e.target===e.currentTarget&&this._onModalDismiss()},this._onBodyDragEnter=e=>{e.preventDefault(),this._bodyDragCounter++,this._bodyDragCounter===1&&(this._bodyDragOver=!0)},this._onBodyDragOver=e=>{e.preventDefault()},this._onBodyDragLeave=e=>{e.preventDefault(),this._bodyDragCounter--,this._bodyDragCounter<=0&&(this._bodyDragCounter=0,this._bodyDragOver=!1)},this._onBodyDrop=e=>{var o;e.preventDefault(),this._bodyDragCounter=0,this._bodyDragOver=!1;const t=Array.from(((o=e.dataTransfer)==null?void 0:o.files)??[]);t.length>0&&this._onFilesSelected(new CustomEvent("files-selected",{detail:{files:t}}))},this._onKeyDown=e=>{var t,o;if(e.key==="Escape"){if(this._fullscreenPreviewUrl||this._fullscreenVideoFile){this._onFsClose();return}this._isOpen&&((t=this.config)==null?void 0:t.mode)==="modal"&&(((o=this.config)==null?void 0:o.headerButton)??"close")!=="none"&&this._onModalDismiss()}},this._dimCache=new Map,this._onSplitPointerDown=e=>{var o;e.preventDefault(),this._isResizing=!0;const t=(o=this.shadowRoot)==null?void 0:o.querySelector(".preview-layout");t==null||t.classList.add("resizing"),e.target.setPointerCapture(e.pointerId)},this._onSplitPointerMove=e=>{if(!this._isResizing||this._splitRafId)return;const t=e.clientX;this._splitRafId=requestAnimationFrame(()=>{var a;this._splitRafId=0;const o=(a=this.shadowRoot)==null?void 0:a.querySelector(".preview-layout");if(!o)return;const r=o.getBoundingClientRect(),i=(t-r.left)/r.width*100;this._splitPct=Math.max(25,Math.min(75,i))})},this._onSplitPointerUp=()=>{var t;this._isResizing=!1,this._splitRafId&&(cancelAnimationFrame(this._splitRafId),this._splitRafId=0);const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".preview-layout");e==null||e.classList.remove("resizing")},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,o=e.clientY-this._fsDragStartY;(Math.abs(t)>3||Math.abs(o)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+t,this._fsPanY=this._fsPanStartY+o,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],o=t.clientX-this._fsDragStartX,r=t.clientY-this._fsDragStartY;(Math.abs(o)>3||Math.abs(r)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+o,this._fsPanY=this._fsPanStartY+r,this.requestUpdate(),e.preventDefault()},this._onFsClose=e=>{e==null||e.stopPropagation(),this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0},this._store=Ee(),this._storeCtrl=new je(this,this._store)}open(){var e,t,o;this._isMinimized&&(this._isMinimized=!1,this._isPillExpanded=!1),!this._isOpen&&(this._isOpen=!0,(o=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onOpen)==null||o.call(t),this._dispatchPublic(g.OPEN,{}),this.requestUpdate())}close(){var e,t,o,r;this._isOpen&&(this._isOpen=!1,this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),((e=this.config)==null?void 0:e.clearOnClose)!==!1&&this._onClearAll(),this._previewFileId=null,(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onClose)==null||r.call(o),this._dispatchPublic(g.CLOSE,{}),this.requestUpdate())}upload(){var r,i,a,l,d,p,h;if(this._ensureEngine(),!this._engine){console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");return}const e=[...this._store.getState().files.values()].filter(u=>u.status==="idle"||u.status==="queued");if((i=(r=this.config)==null?void 0:r.callbacks)!=null&&i.onBeforeUpload&&this.config.callbacks.onBeforeUpload(e)===!1)return;const t=new CustomEvent(g.BEFORE_UPLOAD,{bubbles:!0,composed:!0,cancelable:!0,detail:{files:e}});this.dispatchEvent(t)&&(this._dispatchPublic(g.UPLOAD_STARTED,{files:e}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onUploadStarted)==null||d.call(l,e),this._engine.uploadAll(),(p=this.config)!=null&&p.minimizeOnUpload&&((h=this.config)==null?void 0:h.mode)!=="inline"&&(this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()))}addFiles(e){this._processIncomingFiles(e)}resumeUpload(e){var t;if(e&&e.length>0){const o=this._store.getState().files,r=new Map(o);let i=!1;for(const a of e){const l=o.get(a.id);l&&(r.set(a.id,{...l,...a}),i=!0)}i&&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,o){const r=this._store.getState().files,i=r.get(e);if(!i||!$._MODIFIABLE_STATUSES.has(i.status))return;const a=new Map(r);a.set(e,{...i,meta:t!=null?{...i.meta,...t}:i.meta,tags:o??i.tags}),this._store.setState({files:a})}updateFilesMeta(e){const t=this._store.getState().files,o=new Map(t);let r=!1;for(const{fileId:i,meta:a,tags:l}of e){const d=t.get(i);!d||!$._MODIFIABLE_STATUSES.has(d.status)||(o.set(i,{...d,meta:a!=null?{...d.meta,...a}:d.meta,tags:l??d.tags}),r=!0)}r&&this._store.setState({files:o})}updated(e){if(e.has("config")&&this.config&&this._applyConfig(this.config),e.has("_previewFileId")&&this._previewFileId){const t=this._previewFileId,o=this._store.getState().files.get(t);o?this._getImageDimensions(o).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=`
2940
+ `];let R=me;G([c.state()],R.prototype,"_stream");G([c.state()],R.prototype,"_recording");G([c.state()],R.prototype,"_error");G([c.state()],R.prototype,"_recordedBlob");G([c.state()],R.prototype,"_previewUrl");var xt=Object.defineProperty,k=(n,e,t,o)=>{for(var r=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(r=a(e,t,r)||r);return r&&xt(e,t,r),r};const Ee=new Set(["unsplash"]);var $;const y=($=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._splitPct=68,this._isResizing=!1,this._splitRafId=0,this._fullscreenPreviewUrl=null,this._fullscreenVideoFile=null,this._fullscreenZoomed=!1,this._fsPanX=0,this._fsPanY=0,this._fsDragging=!1,this._fsDragStartX=0,this._fsDragStartY=0,this._fsPanStartX=0,this._fsPanStartY=0,this._bodyDragOver=!1,this._isMinimized=!1,this._isPillExpanded=!1,this._bodyDragCounter=0,this._videoBlobUrls=new Map,this._engine=null,this._cachedSources=A,this._cachedSourcesConfig=void 0,this._rejectedTimers=new Map,this._closeOnCompleteTimer=null,this._apiBase=null,this._authHeaders=null,this._authResolveId=0,this._prevStoreState=null,this._unsubStoreEvents=null,this._portalContainer=null,this._onFilesSelected=e=>{this._processIncomingFiles(e.detail.files)},this._onDropTileSourceClick=e=>{this._handleSourceActivation(e.detail.source.id)},this._onSourceClick=async e=>{this._handleSourceActivation(e.detail.source)},this._handleSourceActivation=async e=>{var r,i;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((((i=(r=this.config)==null?void 0:r.connectors)==null?void 0:i.providers)??[]).includes(e)){if(Ee.has(e)){if(!customElements.get("sfx-search-provider-browser")){const{SfxSearchProviderBrowser:l}=await Promise.resolve().then(()=>require("./search-provider-browser-CIRU1j5X.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-CXFOnoRc.cjs"));customElements.define("sfx-provider-browser",l)}this._activeConnector=e}},this._onUrlSubmit=e=>{var h,u,x;this._showUrlDialog=!1;const{url:t,name:o}=e.detail,r=(h=this.config)==null?void 0:h.callbacks,i=Ke(o),a=i.startsWith("image/"),l=this._store.getState(),d=ie({name:o,size:0,type:i},l.restrictions,l.files);if(d){const f={id:T(),status:"rejected",file:null,remoteUrl:t,name:o,size:0,type:i,previewUrl:null,duration:null,progress:0,speed:0,bytesUploaded:0,error:d,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};L(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:d}),(u=r==null?void 0:r.onFileRejected)==null||u.call(r,f,d);return}const p={id:T(),status:"idle",file:null,remoteUrl:t,name:o,size:0,type:i,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};L(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(x=r==null?void 0:r.onFileAdded)==null||x.call(r,p),this._store.getState().queueConfig.autoProceed&&this.upload()},this._onUrlCancel=()=>{this._showUrlDialog=!1},this._onCameraCapture=e=>{this._showCameraDialog=!1,this._processIncomingFiles([e.detail.file])},this._onCameraCancel=()=>{this._showCameraDialog=!1},this._onScreenCastCapture=e=>{this._showScreenCastDialog=!1,this._processIncomingFiles([e.detail.file])},this._onScreenCastCancel=()=>{this._showScreenCastDialog=!1},this._onFileRemove=e=>{this._removeFile(e.detail.fileId)},this._onFilePreview=e=>{var o,r,i;const t=this._store.getState().files.get(e.detail.fileId);t&&(this._previewFileId=t.id,this._dispatchPublic(g.FILE_PREVIEW,{file:t}),(i=(r=(o=this.config)==null?void 0:o.callbacks)==null?void 0:r.onFilePreview)==null||i.call(r,t))},this._onFillMetadata=()=>{var t,o,r;const e=[...this._store.getState().files.values()].filter(i=>$._MODIFIABLE_STATUSES.has(i.status));this._dispatchPublic(g.FILL_METADATA,{files:e}),(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onFillMetadata)==null||r.call(o,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 o,r,i;const e=(o=this.config)==null?void 0:o.callbacks;this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),(r=this._engine)==null||r.cancelAll();const t=[...this._store.getState().files.values()];for(const a of t)a.previewUrl&&URL.revokeObjectURL(a.previewUrl),this._dispatchPublic(g.FILE_REMOVED,{file:a}),(i=e==null?void 0:e.onFileRemoved)==null||i.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"),o=(r=t==null?void 0:t.shadowRoot)==null?void 0:r.querySelector('input[type="file"]');o==null||o.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 o,r,i;const t=(o=this.config)==null?void 0:o.callbacks;for(const a of e.detail.files){const l=this._store.getState(),d=ie({name:a.name,size:a.size,type:a.mimeType},l.restrictions,l.files);if(d){const h={id:T(),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};L(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:T(),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};L(this._store,p),this._dispatchPublic(g.FILE_ADDED,{file:p}),(i=t==null?void 0:t.onFileAdded)==null||i.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,o,r,i;this._dispatchPublic(g.COMPLETE_ACTION,{}),(o=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCompleteAction)==null||o.call(t),((r=this.config)==null?void 0:r.mode)==="modal"?this.close():((i=this.config)==null?void 0:i.clearOnComplete)!==!1&&this._onClearAll()},this._onInlineDismiss=()=>{var e,t,o;(o=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onCancel)==null||o.call(t),this._dispatchPublic(g.CANCEL,{})},this._onSuccessCardClose=()=>{var e,t,o,r;((e=this.config)==null?void 0:e.mode)==="inline"?(this._dispatchPublic(g.COMPLETE_ACTION,{}),(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onCompleteAction)==null||r.call(o),this._onClearAll()):this._onModalDismiss()},this._onModalDismiss=()=>{var e,t,o,r;this._phase==="uploading"&&((e=this._engine)==null||e.cancelAll()),(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onCancel)==null||r.call(o),this._dispatchPublic(g.CANCEL,{}),this.close()},this._onMinimize=()=>{this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()},this._onPillClick=()=>{this._isPillExpanded=!this._isPillExpanded,this.requestUpdate()},this._onPillExpand=()=>{this._isMinimized=!1,this._isPillExpanded=!1,this._isOpen=!0,this.requestUpdate()},this._onPillDismiss=()=>{var e,t,o,r;this._isMinimized=!1,this._isPillExpanded=!1,this._phase==="uploading"&&((e=this._engine)==null||e.cancelAll()),(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onCancel)==null||r.call(o),this._dispatchPublic(g.CANCEL,{}),this.close()},this._onModalBackdropClick=e=>{e.target===e.currentTarget&&this._onModalDismiss()},this._onBodyDragEnter=e=>{e.preventDefault(),this._bodyDragCounter++,this._bodyDragCounter===1&&(this._bodyDragOver=!0)},this._onBodyDragOver=e=>{e.preventDefault()},this._onBodyDragLeave=e=>{e.preventDefault(),this._bodyDragCounter--,this._bodyDragCounter<=0&&(this._bodyDragCounter=0,this._bodyDragOver=!1)},this._onBodyDrop=e=>{var o;e.preventDefault(),this._bodyDragCounter=0,this._bodyDragOver=!1;const t=Array.from(((o=e.dataTransfer)==null?void 0:o.files)??[]);t.length>0&&this._onFilesSelected(new CustomEvent("files-selected",{detail:{files:t}}))},this._onKeyDown=e=>{var t,o;if(e.key==="Escape"){if(this._fullscreenPreviewUrl||this._fullscreenVideoFile){this._onFsClose();return}this._isOpen&&((t=this.config)==null?void 0:t.mode)==="modal"&&(((o=this.config)==null?void 0:o.headerButton)??"close")!=="none"&&this._onModalDismiss()}},this._dimCache=new Map,this._onSplitPointerDown=e=>{var o;e.preventDefault(),this._isResizing=!0;const t=(o=this.shadowRoot)==null?void 0:o.querySelector(".preview-layout");t==null||t.classList.add("resizing"),e.target.setPointerCapture(e.pointerId)},this._onSplitPointerMove=e=>{if(!this._isResizing||this._splitRafId)return;const t=e.clientX;this._splitRafId=requestAnimationFrame(()=>{var a;this._splitRafId=0;const o=(a=this.shadowRoot)==null?void 0:a.querySelector(".preview-layout");if(!o)return;const r=o.getBoundingClientRect(),i=(t-r.left)/r.width*100;this._splitPct=Math.max(25,Math.min(75,i))})},this._onSplitPointerUp=()=>{var t;this._isResizing=!1,this._splitRafId&&(cancelAnimationFrame(this._splitRafId),this._splitRafId=0);const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".preview-layout");e==null||e.classList.remove("resizing")},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,o=e.clientY-this._fsDragStartY;(Math.abs(t)>3||Math.abs(o)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+t,this._fsPanY=this._fsPanStartY+o,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],o=t.clientX-this._fsDragStartX,r=t.clientY-this._fsDragStartY;(Math.abs(o)>3||Math.abs(r)>3)&&(this._fsDragDidMove=!0),this._fsPanX=this._fsPanStartX+o,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=Ue(),this._storeCtrl=new Me(this,this._store)}open(){var e,t,o;this._isMinimized&&(this._isMinimized=!1,this._isPillExpanded=!1),!this._isOpen&&(this._isOpen=!0,(o=(t=(e=this.config)==null?void 0:e.callbacks)==null?void 0:t.onOpen)==null||o.call(t),this._dispatchPublic(g.OPEN,{}),this.requestUpdate())}close(){var e,t,o,r;this._isOpen&&(this._isOpen=!1,this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null),((e=this.config)==null?void 0:e.clearOnClose)!==!1&&this._onClearAll(),this._previewFileId=null,(r=(o=(t=this.config)==null?void 0:t.callbacks)==null?void 0:o.onClose)==null||r.call(o),this._dispatchPublic(g.CLOSE,{}),this.requestUpdate())}upload(){var r,i,a,l,d,p,h;if(this._ensureEngine(),!this._engine){console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");return}const e=[...this._store.getState().files.values()].filter(u=>u.status==="idle"||u.status==="queued");if((i=(r=this.config)==null?void 0:r.callbacks)!=null&&i.onBeforeUpload&&this.config.callbacks.onBeforeUpload(e)===!1)return;const t=new CustomEvent(g.BEFORE_UPLOAD,{bubbles:!0,composed:!0,cancelable:!0,detail:{files:e}});this.dispatchEvent(t)&&(this._dispatchPublic(g.UPLOAD_STARTED,{files:e}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onUploadStarted)==null||d.call(l,e),this._engine.uploadAll(),(p=this.config)!=null&&p.minimizeOnUpload&&((h=this.config)==null?void 0:h.mode)!=="inline"&&(this._isMinimized=!0,this._isPillExpanded=!0,this.requestUpdate()))}addFiles(e){this._processIncomingFiles(e)}resumeUpload(e){var t;if(e&&e.length>0){const o=this._store.getState().files,r=new Map(o);let i=!1;for(const a of e){const l=o.get(a.id);l&&(r.set(a.id,{...l,...a}),i=!0)}i&&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,o){const r=this._store.getState().files,i=r.get(e);if(!i||!$._MODIFIABLE_STATUSES.has(i.status))return;const a=new Map(r);a.set(e,{...i,meta:t!=null?{...i.meta,...t}:i.meta,tags:o??i.tags}),this._store.setState({files:a})}updateFilesMeta(e){const t=this._store.getState().files,o=new Map(t);let r=!1;for(const{fileId:i,meta:a,tags:l}of e){const d=t.get(i);!d||!$._MODIFIABLE_STATUSES.has(d.status)||(o.set(i,{...d,meta:a!=null?{...d.meta,...a}:d.meta,tags:l??d.tags}),r=!0)}r&&this._store.setState({files:o})}updated(e){if(e.has("config")&&this.config&&this._applyConfig(this.config),e.has("_previewFileId")&&this._previewFileId){const t=this._previewFileId,o=this._store.getState().files.get(t);o?this._getImageDimensions(o).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=`
2939
2941
  [data-sfx-upload-float] .upload-float { position:fixed; bottom:24px; right:24px; z-index:10000; width:470px; border-radius:12px; background:#fff; box-shadow:0 8px 32px rgba(0,0,0,0.12),0 2px 8px rgba(0,0,0,0.06); overflow:hidden; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; animation:sfxFloatIn .3s ease both; }
2940
2942
  [data-sfx-upload-float] .float-header { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; border-bottom:1px solid #e8edf5; }
2941
2943
  [data-sfx-upload-float] .float-header-left { display:flex; align-items:center; gap:8px; }
@@ -2997,7 +2999,7 @@
2997
2999
  [data-sfx-upload-float] .float-collapsed-actions button svg { width:14px; height:14px; }
2998
3000
  @keyframes sfxFloatIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
2999
3001
  @keyframes sfxSpin { to{transform:rotate(360deg)} }
3000
- `,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,o,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]")||(o=document.querySelector("style[data-sfx-upload-float-styles]"))==null||o.remove(),this._revokeVideoBlobUrls();for(const i of this._rejectedTimers.values())clearTimeout(i);this._rejectedTimers.clear(),this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null);for(const i of this._store.getState().files.values())i.previewUrl&&URL.revokeObjectURL(i.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 o=this._store.getState().queueConfig;t.queueConfig={...o,concurrency:e.concurrency}}if(e.autoProceed!=null){const o=t.queueConfig??this._store.getState().queueConfig;t.queueConfig={...o,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,i;const t=e.auth;if(t.mode==="sass-key"){this._apiBase=te(t.container),this._authHeaders=K(t),this._ensureEngine(),(r=this._engine)==null||r.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders});return}const o=++this._authResolveId;try{const a=await ze(t);if(o!==this._authResolveId)return;this._apiBase=a.apiBase,this._authHeaders=a.headers,this._ensureEngine(),(i=this._engine)==null||i.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders})}catch(a){if(o!==this._authResolveId)return;console.error("[sfx-uploader] Auth resolution failed:",a)}}_ensureEngine(){!this._engine&&this._apiBase&&this._authHeaders&&(this._engine=new Pe(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,i,a,l,d,p,h,u;const e=this._store.getState(),t=this._prevStoreState;if(this._prevStoreState=e,!t)return;const o=(r=this.config)==null?void 0:r.callbacks;for(const[x,f]of e.files){const v=t.files.get(x);if(v){if(v.status!==f.status)switch(f.status){case"uploading":break;case"complete":f.response&&(this._dispatchPublic(g.UPLOAD_COMPLETE,{file:f,response:f.response}),(i=o==null?void 0:o.onUploadComplete)==null||i.call(o,f,f.response));break;case"error":case"failed":{const w=new Error(f.error??"Upload failed");this._dispatchPublic(g.UPLOAD_ERROR,{file:f,error:w}),(a=o==null?void 0:o.onUploadError)==null||a.call(o,f,w);break}case"retrying":this._dispatchPublic(g.UPLOAD_RETRY,{file:f,attempt:f.retryCount}),(l=o==null?void 0:o.onUploadRetry)==null||l.call(o,f,f.retryCount);break}f.status==="uploading"&&v.progress!==f.progress&&(this._dispatchPublic(g.UPLOAD_PROGRESS,{file:f,progress:f.progress,speed:f.speed}),(d=o==null?void 0:o.onUploadProgress)==null||d.call(o,f,f.progress,f.speed))}}if(e.totalProgress!==t.totalProgress||e.totalSpeed!==t.totalSpeed){const x=e.totalSpeed>0?(e.totalBytes-e.totalBytesUploaded)/e.totalSpeed:0;this._dispatchPublic(g.TOTAL_PROGRESS,{percentage:e.totalProgress,speed:e.totalSpeed,eta:x}),(p=o==null?void 0:o.onTotalProgress)==null||p.call(o,e.totalProgress,e.totalSpeed,x)}if(t.isUploading&&!e.isUploading){const x=[...e.files.values()];if(!x.some(v=>v.status==="cancelled")){const v=x.filter(m=>m.status==="complete"),w=x.filter(m=>m.status==="failed"||m.status==="error");this._dispatchPublic(g.ALL_COMPLETE,{successful:v,failed:w}),(h=o==null?void 0:o.onAllComplete)==null||h.call(o,v,w);const b=(u=this.config)==null?void 0:u.closeOnComplete;if(b){const m=typeof b=="number"?b:1500;this._closeOnCompleteTimer=setTimeout(()=>{var _,E,be;this._closeOnCompleteTimer=null,this._phase==="complete"&&(this._dispatchPublic(g.COMPLETE_ACTION,{}),(be=(E=(_=this.config)==null?void 0:_.callbacks)==null?void 0:E.onCompleteAction)==null||be.call(E),this.close())},m)}}}}get _mergedSources(){var d;const e=(d=this.config)==null?void 0:d.connectors;if(e===this._cachedSourcesConfig)return this._cachedSources;if(this._cachedSourcesConfig=e,!e)return this._cachedSources=A,this._cachedSources;const t=e.providers.length>0?De(e.providers):[],o=e.customSources??[],r=A.filter(p=>p.id==="device"||p.id==="url"),i=A.filter(p=>p.id!=="device"&&p.id!=="url"),a=new Set,l=[];for(const p of[...r,...t,...i,...o])if(!a.has(p.id)){if($._RESERVED_IDS.has(p.id)&&p.onActivate){console.warn(`[sfx-uploader] Custom source id "${p.id}" conflicts with a built-in source and was skipped.`);continue}a.add(p.id),l.push(p)}return this._cachedSources=l,this._cachedSources}get _phase(){const e=this._storeCtrl.state,t=[...e.files.values()];if(t.length===0)return"empty";if(e.isUploading)return"uploading";const o=new Set(["complete","rejected","cancelled","failed"]);return t.every(r=>o.has(r.status))&&t.some(r=>r.status==="complete"||r.status==="failed")?"complete":"ready"}_processIncomingFiles(e){var o,r,i,a;const t=(o=this.config)==null?void 0:o.callbacks;for(const l of e){const d=this._store.getState(),p=Ke(l,d.restrictions,d.files);if(p){const x=l.type.startsWith("image/")?URL.createObjectURL(l):null,f={id:T(),status:"rejected",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:x,duration:null,progress:0,speed:0,bytesUploaded:0,error:p,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};L(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:p}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,f,p);const v=(i=this.config)==null?void 0:i.rejectedFileAutoRemoveDelay,w=v===!1||v===0||v===void 0?0:v;if(w>0){const b=f.id,m=setTimeout(()=>{this._rejectedTimers.delete(b);const _=this._store.getState().files.get(b);_&&_.status==="rejected"&&me(this._store,b)},w);this._rejectedTimers.set(b,m)}continue}let h=null;l.type.startsWith("image/")&&(h=URL.createObjectURL(l));const u={id:T(),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(L(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/")){Ge(l).then(f=>{if(!f)return;const v=this._store.getState(),w=v.files.get(u.id);if(w){const b=new Map(v.files);b.set(u.id,{...w,previewUrl:f}),this._store.setState({files:b})}else URL.revokeObjectURL(f)});const x=document.createElement("video");x.preload="metadata",x.src=URL.createObjectURL(l),x.onerror=()=>{URL.revokeObjectURL(x.src)},x.onloadedmetadata=()=>{const f=x.duration;if(URL.revokeObjectURL(x.src),!isFinite(f))return;const v=this._store.getState(),w=v.files.get(u.id);if(w){const b=new Map(v.files);b.set(u.id,{...w,duration:f}),this._store.setState({files:b})}}}}this._store.getState().queueConfig.autoProceed&&this.upload()}_removeFile(e){var i,a,l,d;const t=this._store.getState().files.get(e);if(!t)return;const o={...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")&&((i=this._engine)==null||i.cancelFile(e)),me(this._store,e),this._dimCache.delete(e);const r=this._rejectedTimers.get(e);if(r&&(clearTimeout(r),this._rejectedTimers.delete(e)),this._previewFileId===e){const p=[...this._store.getState().files.values()];this._previewFileId=p.length>0?p[0].id:null}this._dispatchPublic(g.FILE_REMOVED,{file:o}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onFileRemoved)==null||d.call(l,o)}render(){var t;const e=((t=this.config)==null?void 0:t.mode)??"modal";return[...this._storeCtrl.state.files.values()],e==="modal"?s.html`
3002
+ `,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,o,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]")||(o=document.querySelector("style[data-sfx-upload-float-styles]"))==null||o.remove(),this._revokeVideoBlobUrls();for(const i of this._rejectedTimers.values())clearTimeout(i);this._rejectedTimers.clear(),this._closeOnCompleteTimer&&(clearTimeout(this._closeOnCompleteTimer),this._closeOnCompleteTimer=null);for(const i of this._store.getState().files.values())i.previewUrl&&URL.revokeObjectURL(i.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 o=this._store.getState().queueConfig;t.queueConfig={...o,concurrency:e.concurrency}}if(e.autoProceed!=null){const o=t.queueConfig??this._store.getState().queueConfig;t.queueConfig={...o,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,i;const t=e.auth;if(t.mode==="sass-key"){this._apiBase=te(t.container),this._authHeaders=K(t),this._ensureEngine(),(r=this._engine)==null||r.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders});return}const o=++this._authResolveId;try{const a=await Fe(t);if(o!==this._authResolveId)return;this._apiBase=a.apiBase,this._authHeaders=a.headers,this._ensureEngine(),(i=this._engine)==null||i.updateConfig({apiBase:this._apiBase,authHeaders:this._authHeaders})}catch(a){if(o!==this._authResolveId)return;console.error("[sfx-uploader] Auth resolution failed:",a)}}_ensureEngine(){!this._engine&&this._apiBase&&this._authHeaders&&(this._engine=new ze(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,i,a,l,d,p,h,u;const e=this._store.getState(),t=this._prevStoreState;if(this._prevStoreState=e,!t)return;const o=(r=this.config)==null?void 0:r.callbacks;for(const[x,f]of e.files){const v=t.files.get(x);if(v){if(v.status!==f.status)switch(f.status){case"uploading":break;case"complete":f.response&&(this._dispatchPublic(g.UPLOAD_COMPLETE,{file:f,response:f.response}),(i=o==null?void 0:o.onUploadComplete)==null||i.call(o,f,f.response));break;case"error":case"failed":{const w=new Error(f.error??"Upload failed");this._dispatchPublic(g.UPLOAD_ERROR,{file:f,error:w}),(a=o==null?void 0:o.onUploadError)==null||a.call(o,f,w);break}case"retrying":this._dispatchPublic(g.UPLOAD_RETRY,{file:f,attempt:f.retryCount}),(l=o==null?void 0:o.onUploadRetry)==null||l.call(o,f,f.retryCount);break}f.status==="uploading"&&v.progress!==f.progress&&(this._dispatchPublic(g.UPLOAD_PROGRESS,{file:f,progress:f.progress,speed:f.speed}),(d=o==null?void 0:o.onUploadProgress)==null||d.call(o,f,f.progress,f.speed))}}if(e.totalProgress!==t.totalProgress||e.totalSpeed!==t.totalSpeed){const x=e.totalSpeed>0?(e.totalBytes-e.totalBytesUploaded)/e.totalSpeed:0;this._dispatchPublic(g.TOTAL_PROGRESS,{percentage:e.totalProgress,speed:e.totalSpeed,eta:x}),(p=o==null?void 0:o.onTotalProgress)==null||p.call(o,e.totalProgress,e.totalSpeed,x)}if(t.isUploading&&!e.isUploading){const x=[...e.files.values()];if(!x.some(v=>v.status==="cancelled")){const v=x.filter(m=>m.status==="complete"),w=x.filter(m=>m.status==="failed"||m.status==="error");this._dispatchPublic(g.ALL_COMPLETE,{successful:v,failed:w}),(h=o==null?void 0:o.onAllComplete)==null||h.call(o,v,w);const b=(u=this.config)==null?void 0:u.closeOnComplete;if(b){const m=typeof b=="number"?b:1500;this._closeOnCompleteTimer=setTimeout(()=>{var _,E,we;this._closeOnCompleteTimer=null,this._phase==="complete"&&(this._dispatchPublic(g.COMPLETE_ACTION,{}),(we=(E=(_=this.config)==null?void 0:_.callbacks)==null?void 0:E.onCompleteAction)==null||we.call(E),this.close())},m)}}}}get _mergedSources(){var d;const e=(d=this.config)==null?void 0:d.connectors;if(e===this._cachedSourcesConfig)return this._cachedSources;if(this._cachedSourcesConfig=e,!e)return this._cachedSources=A,this._cachedSources;const t=e.providers.length>0?Re(e.providers):[],o=e.customSources??[],r=A.filter(p=>p.id==="device"||p.id==="url"),i=A.filter(p=>p.id!=="device"&&p.id!=="url"),a=new Set,l=[];for(const p of[...r,...t,...i,...o])if(!a.has(p.id)){if($._RESERVED_IDS.has(p.id)&&p.onActivate){console.warn(`[sfx-uploader] Custom source id "${p.id}" conflicts with a built-in source and was skipped.`);continue}a.add(p.id),l.push(p)}return this._cachedSources=l,this._cachedSources}get _phase(){const e=this._storeCtrl.state,t=[...e.files.values()];if(t.length===0)return"empty";if(e.isUploading)return"uploading";const o=new Set(["complete","rejected","cancelled","failed"]);return t.every(r=>o.has(r.status))&&t.some(r=>r.status==="complete"||r.status==="failed")?"complete":"ready"}_processIncomingFiles(e){var o,r,i,a;const t=(o=this.config)==null?void 0:o.callbacks;for(const l of e){const d=this._store.getState(),p=Je(l,d.restrictions,d.files);if(p){const x=l.type.startsWith("image/")?URL.createObjectURL(l):null,f={id:T(),status:"rejected",file:l,remoteUrl:null,name:l.name,size:l.size,type:l.type,previewUrl:x,duration:null,progress:0,speed:0,bytesUploaded:0,error:p,retryCount:0,response:null,addedAt:Date.now(),meta:{},tags:[],remoteInfo:null};L(this._store,f),this._dispatchPublic(g.FILE_REJECTED,{file:f,reason:p}),(r=t==null?void 0:t.onFileRejected)==null||r.call(t,f,p);const v=(i=this.config)==null?void 0:i.rejectedFileAutoRemoveDelay,w=v===!1||v===0||v===void 0?0:v;if(w>0){const b=f.id,m=setTimeout(()=>{this._rejectedTimers.delete(b);const _=this._store.getState().files.get(b);_&&_.status==="rejected"&&ye(this._store,b)},w);this._rejectedTimers.set(b,m)}continue}let h=null;l.type.startsWith("image/")&&(h=URL.createObjectURL(l));const u={id:T(),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(L(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/")){Ze(l).then(f=>{if(!f)return;const v=this._store.getState(),w=v.files.get(u.id);if(w){const b=new Map(v.files);b.set(u.id,{...w,previewUrl:f}),this._store.setState({files:b})}else URL.revokeObjectURL(f)});const x=document.createElement("video");x.preload="metadata",x.src=URL.createObjectURL(l),x.onerror=()=>{URL.revokeObjectURL(x.src)},x.onloadedmetadata=()=>{const f=x.duration;if(URL.revokeObjectURL(x.src),!isFinite(f))return;const v=this._store.getState(),w=v.files.get(u.id);if(w){const b=new Map(v.files);b.set(u.id,{...w,duration:f}),this._store.setState({files:b})}}}}this._store.getState().queueConfig.autoProceed&&this.upload()}_removeFile(e){var i,a,l,d;const t=this._store.getState().files.get(e);if(!t)return;const o={...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")&&((i=this._engine)==null||i.cancelFile(e)),ye(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:o}),(d=(l=(a=this.config)==null?void 0:a.callbacks)==null?void 0:l.onFileRemoved)==null||d.call(l,o)}render(){var t;const e=((t=this.config)==null?void 0:t.mode)??"modal";return[...this._storeCtrl.state.files.values()],e==="modal"?s.html`
3001
3003
  ${this._isOpen&&!this._isMinimized?s.html`
3002
3004
  <div class="modal-backdrop" @click=${this._onModalBackdropClick}>
3003
3005
  <div class="modal-card">
@@ -3142,7 +3144,7 @@
3142
3144
  .files=${e}
3143
3145
  .showDropTile=${!0}
3144
3146
  .sources=${this._mergedSources}
3145
- .accept=${ye(this._storeCtrl.state.restrictions)}
3147
+ .accept=${ke(this._storeCtrl.state.restrictions)}
3146
3148
  @source-click=${this._onDropTileSourceClick}
3147
3149
  ></sfx-file-list>
3148
3150
  </div>
@@ -3237,7 +3239,7 @@
3237
3239
  </div>
3238
3240
  </div>
3239
3241
  </div>
3240
- `}_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 i;const r=e.findIndex(a=>a.id===this._previewFileId)+t;if(r>=0&&r<e.length){const a=(i=this.shadowRoot)==null?void 0:i.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()],o=this._phase,r=ye(e.restrictions),i=t.length>0;return s.html`
3242
+ `}_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 i;const r=e.findIndex(a=>a.id===this._previewFileId)+t;if(r>=0&&r<e.length){const a=(i=this.shadowRoot)==null?void 0:i.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()],o=this._phase,r=ke(e.restrictions),i=t.length>0;return s.html`
3241
3243
  <div class="content"
3242
3244
  @files-selected=${this._onFilesSelected}
3243
3245
  @source-click=${this._onSourceClick}
@@ -3317,7 +3319,7 @@
3317
3319
  ${this._activeConnector&&((d=this.config)!=null&&d.connectors)?s.html`
3318
3320
  <div class="connector-modal-backdrop" @click=${this._onConnectorBackdropClick}>
3319
3321
  <div class="connector-modal">
3320
- ${$e.has(this._activeConnector)?s.html`
3322
+ ${Ee.has(this._activeConnector)?s.html`
3321
3323
  <sfx-search-provider-browser
3322
3324
  .provider=${this._activeConnector}
3323
3325
  .companionUrl=${this.config.connectors.companionUrl}
@@ -4644,4 +4646,4 @@
4644
4646
  .modal-card { min-height: auto; }
4645
4647
  .inline { min-height: auto; }
4646
4648
  }
4647
- `,$._MODIFIABLE_STATUSES=new Set(["idle","queued","rejected"]),$._RESERVED_IDS=new Set(["device","camera","url","screen-cast"]),$);k([c.property({attribute:!1})],y.prototype,"config");k([c.state()],y.prototype,"_isOpen");k([c.state()],y.prototype,"_activeConnector");k([c.state()],y.prototype,"_showUrlDialog");k([c.state()],y.prototype,"_showCameraDialog");k([c.state()],y.prototype,"_showScreenCastDialog");k([c.state()],y.prototype,"_previewFileId");k([c.state()],y.prototype,"_previewDims");k([c.state()],y.prototype,"_splitPct");k([c.state()],y.prototype,"_fullscreenPreviewUrl");k([c.state()],y.prototype,"_fullscreenVideoFile");k([c.state()],y.prototype,"_fullscreenZoomed");k([c.state()],y.prototype,"_bodyDragOver");k([c.state()],y.prototype,"_isMinimized");k([c.state()],y.prototype,"_isPillExpanded");let ut=y;exports.AuthExpiredError=ee;exports.CORE_SOURCES=A;exports.PublicEvents=g;exports.SfxActionsBar=P;exports.SfxCameraDialog=O;exports.SfxDropZone=C;exports.SfxFileItem=J;exports.SfxFileList=D;exports.SfxImportDivider=se;exports.SfxScreenCastDialog=j;exports.SfxSourcePills=Z;exports.SfxSuccessCard=F;exports.SfxUploader=ut;exports.SfxUrlDialog=I;exports.Store=Se;exports.UploadEngine=Pe;exports.buildAuthHeaders=K;exports.createStore=Ee;exports.exchangeSassKey=Ue;exports.getApiBase=te;exports.getAuthUrl=Le;exports.getProviderSources=De;exports.listFiles=Te;exports.listNextPage=Be;exports.logout=He;exports.resolveAuth=ze;exports.searchProvider=Ae;
4649
+ `,$._MODIFIABLE_STATUSES=new Set(["idle","queued","rejected"]),$._RESERVED_IDS=new Set(["device","camera","url","screen-cast"]),$);k([c.property({attribute:!1})],y.prototype,"config");k([c.state()],y.prototype,"_isOpen");k([c.state()],y.prototype,"_activeConnector");k([c.state()],y.prototype,"_showUrlDialog");k([c.state()],y.prototype,"_showCameraDialog");k([c.state()],y.prototype,"_showScreenCastDialog");k([c.state()],y.prototype,"_previewFileId");k([c.state()],y.prototype,"_previewDims");k([c.state()],y.prototype,"_splitPct");k([c.state()],y.prototype,"_fullscreenPreviewUrl");k([c.state()],y.prototype,"_fullscreenVideoFile");k([c.state()],y.prototype,"_fullscreenZoomed");k([c.state()],y.prototype,"_bodyDragOver");k([c.state()],y.prototype,"_isMinimized");k([c.state()],y.prototype,"_isPillExpanded");let gt=y;exports.AuthExpiredError=ee;exports.CORE_SOURCES=A;exports.PublicEvents=g;exports.SfxActionsBar=P;exports.SfxCameraDialog=M;exports.SfxDropZone=C;exports.SfxFileItem=J;exports.SfxFileList=D;exports.SfxImportDivider=ae;exports.SfxScreenCastDialog=R;exports.SfxSourcePills=Z;exports.SfxSuccessCard=F;exports.SfxUploader=gt;exports.SfxUrlDialog=I;exports.Store=Pe;exports.UploadEngine=ze;exports.buildAuthHeaders=K;exports.createStore=Ue;exports.exchangeSassKey=De;exports.getApiBase=te;exports.getAuthUrl=Be;exports.getProviderSources=Re;exports.listFiles=Ae;exports.listNextPage=Ie;exports.logout=Ye;exports.resolveAuth=Fe;exports.searchProvider=He;