PageSourceSearch

https://survivalbrasil.org/assets/@uppy--utils-406ebaa5.js

js survivalbrasil.org collected 2026-09-25 18:52:46 UTC 18,837 bytes, 15 lines download raw bytes

1// @uppy/[email protected] downloaded from https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js
2
3import{jsx as e}from"preact/jsx-runtime";import{useRef as t,useState as n,useEffect as r,useCallback as i}from"preact/hooks";function a(e,t){return Object.hasOwn(e,t)}const{AbortController:o}=globalThis,{AbortSignal:s}=globalThis,c=(e=`Aborted`,t)=>{let n=new DOMException(e,`AbortError`);return t!=null&&a(t,`cause`)&&Object.defineProperty(n,`cause`,{__proto__:null,configurable:!0,writable:!0,value:t.cause}),n};function l(e,t,n){return new Promise(r=>{e.toBlob(r,t,n)})}const u=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function d(e,t,n){let r=u.exec(e),i=t.mimeType??r?.[1]??`plain/text`,a;if(r?.[2]!=null){let e=atob(decodeURIComponent(r[3])),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);a=[t]}else r?.[3]!=null&&(a=[decodeURIComponent(r[3])]);return n?new File(a,t.name||``,{type:i}):new Blob(a,{type:i})}function f(e,t){return d(e,t,!0)}function p(e,t){return new Promise((n,r)=>{if(t?.signal?.aborted)return r(c());let i=setTimeout(()=>{o(),n()},e);function a(){clearTimeout(i),o(),r(c())}t?.signal?.addEventListener(`abort`,a);function o(){t?.signal?.removeEventListener(`abort`,a)}})}class ErrorWithCause extends Error{isNetworkError;cause;constructor(e,t){super(e),this.cause=t?.cause,this.cause&&a(this.cause,`isNetworkError`)?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}function m(e,t,n,r){return n===0||e===t?e:r===0?t:e+(t-e)*2**(-r/n)}var h=[`a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])`,`area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])`,`input:not([disabled]):not([inert]):not([aria-hidden])`,`select:not([disabled]):not([inert]):not([aria-hidden])`,`textarea:not([disabled]):not([inert]):not([aria-hidden])`,`button:not([disabled]):not([inert]):not([aria-hidden])`,`iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])`,`object:not([tabindex^="-"]):not([inert]):not([aria-hidden])`,`embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])`,`[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])`,`[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])`];class NetworkError extends Error{cause;isNetworkError;request;constructor(e,t=null){super(`This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.`),this.cause=e,this.isNetworkError=!0,this.request=t}}class ProgressTimeout{#aliveTimer;#isDone=!1;#onTimedOut;#timeout;constructor(e,t){this.#timeout=e,this.#onTimedOut=()=>t(e)}progress(){this.#isDone||this.#timeout>0&&(clearTimeout(this.#aliveTimer),this.#aliveTimer=setTimeout(this.#onTimedOut,this.#timeout))}done(){this.#isDone||=(clearTimeout(this.#aliveTimer),this.#aliveTimer=void 0,!0)}}const g=()=>{};function _(e,t={}){let{body:n=null,headers:r={},method:i=`GET`,onBeforeRequest:a=g,onUploadProgress:o=g,shouldRetry:s=()=>!0,onAfterResponse:c=g,onTimeout:l=g,responseType:u,retries:d=3,signal:f=null,timeout:p=3e4,withCredentials:m=!1}=t,h=e=>.3*2**(e-1)*1e3,_=new ProgressTimeout(p,l);function v(t=0){return new Promise(async(l,p)=>{let g=new XMLHttpRequest,y=e=>{s(g)&&t<d?setTimeout(()=>{v(t+1).then(l,p)},h(t)):(_.done(),p(e))};g.open(i,e,!0),g.withCredentials=m,u&&(g.responseType=u),g.onload=async()=>{try{await c(g,t)}catch(e){e.request=g,y(e);return}g.status>=200&&g.status<300?(_.done(),l(g)):s(g)&&t<d?setTimeout(()=>{v(t+1).then(l,p)},h(t)):(_.done(),p(new NetworkError(g.statusText,g)))},g.onerror=()=>y(new NetworkError(g.statusText,g)),g.upload.onprogress=e=>{_.progress(),o(e)},r&&Object.keys(r).forEach(e=>{g.setRequestHeader(e,r[e])});function b(){g.abort(),p(new DOMException(`Aborted`,`AbortError`))}if(f?.addEventListener(`abort`,b),f?.aborted){b();return}await a(g,t),g.send(n)})}return v()}function v(...e){return fetch(...e).catch(e=>{throw e.name===`AbortError`?e:new NetworkError(e)})}const y=e=>`error`in e&&!!e.error,b=e=>e.progress.uploadComplete;function x(e){return e.filter(e=>!y(e)&&!b(e))}function S(e){return e.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}function C(e){return typeof e!=`object`||!e||!(`nodeType`in e)?!1:e.nodeType===Node.ELEMENT_NODE}function w(e){if(typeof e==`string`){let t=document.querySelectorAll(e);return t.length===0?null:Array.from(t)}return typeof e==`object`&&C(e)?[e]:null}function ee(e,t=document){return typeof e==`string`?t.querySelector(e):C(e)?e:null}function T(e){let t=e.lastIndexOf(`.`);return t===-1||t===e.length-1?{name:e,extension:void 0}:{name:e.slice(0,t),extension:e.slice(t+1)}}var E={__proto__:null,md:`text/markdown`,markdown:`text/markdown`,mp4:`video/mp4`,mp3:`audio/mp3`,svg:`image/svg+xml`,jpg:`image/jpeg`,png:`image/png`,webp:`image/webp`,gif:`image/gif`,heic:`image/heic`,heif:`image/heif`,yaml:`text/yaml`,yml:`text/yaml`,csv:`text/csv`,tsv:`text/tab-separated-values`,tab:`text/tab-separated-values`,avi:`video/x-msvideo`,mks:`video/x-matroska`,mkv:`video/x-matroska`,mov:`video/quicktime`,dicom:`application/dicom`,doc:`application/msword`,msg:`application/vnd.ms-outlook`,docm:`application/vnd.ms-word.document.macroenabled.12`,docx:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,dot:`application/msword`,dotm:`application/vnd.ms-word.template.macroenabled.12`,dotx:`application/vnd.openxmlformats-officedocument.wordprocessingml.template`,xla:`application/vnd.ms-excel`,xlam:`application/vnd.ms-excel.addin.macroenabled.12`,xlc:`application/vnd.ms-excel`,xlf:`application/x-xliff+xml`,xlm:`application/vnd.ms-excel`,xls:`application/vnd.ms-excel`,xlsb:`application/vnd.ms-excel.sheet.binary.macroenabled.12`,xlsm:`application/vnd.ms-excel.sheet.macroenabled.12`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,xlt:`application/vnd.ms-excel`,xltm:`application/vnd.ms-excel.template.macroenabled.12`,xltx:`application/vnd.openxmlformats-officedocument.spreadsheetml.template`,xlw:`application/vnd.ms-excel`,txt:`text/plain`,text:`text/plain`,conf:`text/plain`,log:`text/plain`,pdf:`application/pdf`,zip:`a
3pplication/zip`,"7z":`application/x-7z-compressed`,rar:`application/x-rar-compressed`,tar:`application/x-tar`,gz:`application/gzip`,dmg:`application/x-apple-diskimage`};function D(e){if(e.type)return e.type;let t=e.name?T(e.name).extension?.toLowerCase():null;return t&&t in E?E[t]:`application/octet-stream`}function O(e){return e.charCodeAt(0).toString(32)}function k(e){let t=``;return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${O(e)}`,`/`))+t}function A(e,t){let n=t||`uppy`;return typeof e.name==`string`&&(n+=`-${k(e.name.toLowerCase())}`),e.type!==void 0&&(n+=`-${e.type}`),e.meta&&typeof e.meta.relativePath==`string`&&(n+=`-${k(e.meta.relativePath.toLowerCase())}`),e.data?.size!==void 0&&(n+=`-${e.data.size}`),e.data.lastModified!==void 0&&(n+=`-${e.data.lastModified}`),n}function j(e){return!e.isRemote||!e.remote?!1:new Set([`box`,`dropbox`,`drive`,`facebook`,`unsplash`]).has(e.remote.provider)}function te(e,t){if(j(e))return e.id;let n=D(e);return A({...e,type:n},t)}function ne(e,t){return e===!0?Object.keys(t):Array.isArray(e)?e:[]}function M(e){return e.bytesTotal==null?0:e.bytesTotal-e.bytesUploaded}var N=Array.from;function re(e){let t=N(e.files);return Promise.resolve(t)}function P(e,t,n,{onSuccess:r}){e.readEntries(i=>{let a=[...t,...i];i.length?queueMicrotask(()=>{P(e,a,n,{onSuccess:r})}):r(a)},e=>{n(e),r(t)})}function F(e,t){return e==null?e:{kind:e.isFile?`file`:e.isDirectory?`directory`:void 0,name:e.name,getFile(){return new Promise((t,n)=>e.file(t,n))},async*values(){let n=e.createReader();yield*await new Promise(e=>{P(n,[],t,{onSuccess:n=>e(n.map(e=>F(e,t)))})})},isSameEntry:void 0}}async function*I(e,t,n=void 0){let r=()=>`${t}/${e.name}`;if(e.kind===`file`){let i=await e.getFile();i==null?n!=null&&(yield n):(i.relativePath=t?r():null,yield i)}else if(e.kind===`directory`)for await(let n of e.values())yield*I(n,t?r():e.name);else n!=null&&(yield n)}async function*L(e,t){let n=await Promise.all(Array.from(e.items,async e=>{let n,r=()=>typeof e.getAsEntry==`function`?e.getAsEntry():e.webkitGetAsEntry();return n??=F(r(),t),{fileSystemHandle:n,lastResortFile:e.getAsFile()}}));for(let{lastResortFile:e,fileSystemHandle:r}of n)if(r!=null)try{yield*I(r,``,e)}catch(n){e==null?t(n):yield e}else e!=null&&(yield e)}async function R(e,t){let n=t?.logDropError??Function.prototype;try{let t=[];for await(let r of L(e,n))t.push(r);return t}catch{return re(e)}}function z(e){if(!e.bytesUploaded)return 0;let t=Date.now()-e.uploadStarted;return e.bytesUploaded/(t/1e3)}function B(e){if(!e.bytesUploaded)return 0;let t=z(e),n=M(e);return Math.round(n/t*10)/10}const V={__proto__:null,"audio/mp3":`mp3`,"audio/mp4":`mp4`,"audio/ogg":`ogg`,"audio/webm":`webm`,"image/gif":`gif`,"image/heic":`heic`,"image/heif":`heif`,"image/jpeg":`jpg`,"image/webp":`webp`,"image/png":`png`,"image/svg+xml":`svg`,"video/mp4":`mp4`,"video/ogg":`ogv`,"video/quicktime":`mov`,"video/webm":`webm`,"video/x-matroska":`mkv`,"video/x-msvideo":`avi`};function H(e){return[e]=e.split(`;`,1),V[e]||null}function U(e){let t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?([^\n]+)/i.exec(e)?.[1];return`${/^http:\/\//i.test(e)?`ws`:`wss`}://${t}`}function W(e){for(;e&&!e.dir;)e=e.parentNode;return e?.dir}function G(e){return e<10?`0${e}`:e.toString()}function K(){let e=/* @__PURE__ */ new Date;return`${G(e.getHours())}:${G(e.getMinutes())}:${G(e.getSeconds())}`}function q(){if(typeof window>`u`)return!1;let e=document.body;return!(e==null||window==null||!(`draggable`in e)||!(`ondragstart`in e)||!(`ondrop`in e)||!(`FormData`in window)||!(`FileReader`in window))}function J(e){return e?e.readyState===4&&e.status===0:!1}function Y(e){return e.startsWith(`blob:`)}function ie(e){return e?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(e):!1}function ae(){return`ontouchstart`in window||`maxTouchPoints`in navigator}function X(e){return{hours:Math.floor(e/3600)%24,minutes:Math.floor(e/60)%60,seconds:Math.floor(e%60)}}function oe(e){let t=X(e);return`${t.hours===0?``:`${t.hours}h`}${t.minutes===0?``:`${t.hours===0?t.minutes:` ${t.minutes.toString(10).padStart(2,`0`)}`}m`}${t.hours===0?`${t.minutes===0?t.seconds:` ${t.seconds.toString(10).padStart(2,`0`)}`}s`:``}`}function se(e){return Error(`Cancelled`,{cause:e})}function Z(e){if(e!=null){let t=()=>this.abort(e.reason);e.addEventListener(`abort`,t,{once:!0});let n=()=>{e.removeEventListener(`abort`,t)};this.then?.(n,n)}return this}class RateLimitedQueue{#activeRequests=0;
3#queuedHandlers=[];#paused=!1;#pauseTimer;#downLimit=1;#upperLimit;#rateLimitingTimer;limit;constructor(e){typeof e!=`number`||e===0?this.limit=1/0:this.limit=e}#call(e){this.#activeRequests+=1;let t=!1,n;try{n=e()}catch(e){throw--this.#activeRequests,e}return{abort:e=>{t||(t=!0,--this.#activeRequests,n?.(e),this.#queueNext())},done:()=>{t||(t=!0,--this.#activeRequests,this.#queueNext())}}}#queueNext(){queueMicrotask(()=>this.#next())}#next(){if(this.#paused||this.#activeRequests>=this.limit||this.#queuedHandlers.length===0)return;let e=this.#queuedHandlers.shift();if(e==null)throw Error(`Invariant violation: next is null`);let t=this.#call(e.fn);e.abort=t.abort,e.done=t.done}#queue(e,t){let n={fn:e,priority:t?.priority||0,abort:()=>{this.#dequeue(n)},done:()=>{throw Error(`Cannot mark a queued request as done: this indicates a bug`)}},r=this.#queuedHandlers.findIndex(e=>n.priority>e.priority);return r===-1?this.#queuedHandlers.push(n):this.#queuedHandlers.splice(r,0,n),n}#dequeue(e){let t=this.#queuedHandlers.indexOf(e);t!==-1&&this.#queuedHandlers.splice(t,1)}run(e,t){return!this.#paused&&this.#activeRequests<this.limit?this.#call(e):this.#queue(e,t)}wrapSyncFunction(e,t){return(...n)=>{let r=this.run(()=>(e(...n),queueMicrotask(()=>r.done()),()=>{}),t);return{abortOn:Z,abort(){r.abort()}}}}wrapPromiseFunction(e,t){return(...n)=>{let r,i=new Promise((i,a)=>{r=this.run(()=>{let t,o;try{o=Promise.resolve(e(...n))}catch(e){o=Promise.reject(e)}return o.then(e=>{t?a(t):(r.done(),i(e))},e=>{t?a(t):(r.done(),a(e))}),e=>{t=se(e)}},t)});return i.abort=e=>{r.abort(e)},i.abortOn=Z,i}}resume(){this.#paused=!1,clearTimeout(this.#pauseTimer);for(let e=0;e<this.limit;e++)this.#queueNext()}#resume=()=>this.resume();pause(e=null){this.#paused=!0,clearTimeout(this.#pauseTimer),e!=null&&(this.#pauseTimer=setTimeout(this.#resume,e))}rateLimit(e){clearTimeout(this.#rateLimitingTimer),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#upperLimit=this.limit-1,this.limit=this.#downLimit,this.#rateLimitingTimer=setTimeout(this.#increaseLimit,e))}#increaseLimit=()=>{if(this.#paused){this.#rateLimitingTimer=setTimeout(this.#increaseLimit,0);return}this.#downLimit=this.limit,this.limit=Math.ceil((this.#upperLimit+this.#downLimit)/2);for(let e=this.#downLimit;e<=this.limit;e++)this.#queueNext();this.#upperLimit-this.#downLimit>3?this.#rateLimitingTimer=setTimeout(this.#increaseLimit,2e3):this.#downLimit=Math.floor(this.#downLimit/2)};get isPaused(){return this.#paused}}const ce=Symbol(`__queue`);function Q(e){return{...e,type:e.mimeType,extension:e.name?T(e.name).extension:null}}class TaskQueue{#queue=[];#running=0;#concurrency;#paused=!1;constructor(e){let t=e?.concurrency;this.#concurrency=typeof t!=`number`||t===0?1/0:t}add(e){let t=new AbortController,n,r,i=new Promise((e,t)=>{n=e,r=t}),a={run:()=>e(t.signal),resolve:n,reject:r,controller:t};return t.signal.addEventListener(`abort`,()=>{let e=this.#queue.indexOf(a);e!==-1&&(this.#queue.splice(e,1),r(t.signal.reason??new DOMException(`Aborted`,`AbortError`)))},{once:!0}),i.abort=e=>{t.abort(e??new DOMException(`Aborted`,`AbortError`))},i.abortOn=e=>{if(e){let t=()=>i.abort(e.reason);e.addEventListener(`abort`,t,{once:!0}),i.then(()=>e.removeEventListener(`abort`,t),()=>e.removeEventListener(`abort`,t))}return i},!this.#paused&&this.#running<this.#concurrency?this.#execute(a):this.#queue.push(a),i}#execute(e){if(this.#running++,e.controller.signal.aborted){this.#running--,e.reject(e.controller.signal.reason??new DOMException(`Aborted`,`AbortError`)),this.#advance();return}let t;try{t=e.run()}catch(e){t=Promise.reject(e)}t.then(t=>{e.controller.signal.aborted?e.reject(e.controller.signal.reason??new DOMException(`Aborted`,`AbortError`)):e.resolve(t)},t=>{e.reject(t)}).finally(()=>{this.#running--,this.#advance()})}#advance(){queueMicrotask(()=>{if(!(this.#paused||this.#running>=this.#concurrency))for(;this.#queue.length>0;){let e=this.#queue.shift();if(!e.controller.signal.aborted){this.#execute(e);return}}})}pause(){this.#paused=!0}resume(){this.#paused=!1;let e=this.#concurrency-this.#running;for(let t=0;t<e;t++)this.#advance()}clear(e){let t=this.#queue.splice(0),n=e??new DOMException(`Cleared`,`AbortError`);for(let e of t)e.controller.abort(n),e.reject(n)}get concurrency(){return this.#concurrency}set concurrency(e){if(this.#concurrency=typeof e!=`number`||e===0?1/0:e,!this.#paused){let e=this.#concurrency-this.#running;for(let t=0;t<e;t++)this.#advance()}}get pending(){return this.#queue.length}get running(){return this.#running}get isPaused(){return this.#paused}wrapPromiseFunction(e){return(...t)=>this.add(n=>e(...t))}}function le(e,t,n){let r=[];
3return e.forEach(e=>typeof e==`string`?t[Symbol.split](e).forEach((e,t,i)=>{e!==``&&r.push(e),t<i.length-1&&r.push(n)}):r.push(e)),r}
4/**
5* Takes a string with placeholder variables like `%{smart_count} file selected`
6* and replaces it with values from options `{smart_count: 5}`
7*
8* @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
9* taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
10*
11* @param phrase that needs interpolation, with placeholders
12* @param options with values that will be used to replace placeholders
13*/
14function $(e,t){let n=/\$/g,r=`$$$$`,i=[e];if(t==null)return i;for(let e of Object.keys(t))if(e!==`_`){let r=t[e];typeof r==`string`&&(r=n[Symbol.replace](r,`$$$$`)),i=le(i,RegExp(`%\\{${e}\\}`,`g`),r)}return i}const ue=e=>{throw Error(`missing string: ${e}`)};class Translator{locale;constructor(e,{onMissingKey:t=ue}={}){this.locale={strings:{},pluralize(e){return e===1?0:1}},Array.isArray(e)?e.forEach(this.#apply,this):this.#apply(e),this.#onMissingKey=t}#onMissingKey;#apply(e){if(!e?.strings)return;let t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join(``)}translateArray(e,t){let n=this.locale.strings[e];if(n??=(this.#onMissingKey(e),e),typeof n==`object`){if(t&&t.smart_count!==void 0){let e=this.locale.pluralize(t.smart_count);return $(n[e],t)}throw Error(`Attempted to use a string with plural forms, but no value was given for %{smart_count}`)}if(typeof n!=`string`)throw Error(`string was not a string`);return $(n,t)}}const de=`...`;function fe(e,t){if(t===0)return``;if(e.length<=t)return e;if(t<=4)return`${e.slice(0,t-1)}…`;let n=t-3,r=Math.ceil(n/2),i=Math.floor(n/2);return e.slice(0,r)+`...`+e.slice(-i)}class UserFacingApiError extends Error{name=`UserFacingApiError`}const pe={position:`relative`,width:`100%`,minHeight:`100%`},me={position:`absolute`,top:0,left:0,width:`100%`,overflow:`visible`};function he({data:a,rowHeight:o,renderRow:s,overscanCount:c=10,padding:l=4,...u}){let d=t(null),[f,p]=n(0),[m,h]=n(0);r(()=>{function e(){d.current!=null&&m!==d.current.offsetHeight&&h(d.current.offsetHeight)}return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[m]);let g=i(()=>{d.current&&p(d.current.scrollTop)},[]),_=Math.floor(f/o),v=Math.floor(m/o);c&&(_=Math.max(0,_-_%c),v+=c);let y=_+v+l,b=a.slice(_,y),x={...pe,height:a.length*o},S={...me,top:_*o};return e(`div`,{onScroll:g,ref:d,...u,children:e(`div`,{role:`presentation`,style:x,children:e(`div`,{role:`presentation`,style:S,children:b.map(s)})})})}export{o as AbortController,s as AbortSignal,ErrorWithCause,h as FOCUSABLE_ELEMENTS,NetworkError,ProgressTimeout,RateLimitedQueue,TaskQueue,Translator,UserFacingApiError,he as VirtualList,l as canvasToBlob,c as createAbortError,d as dataURItoBlob,f as dataURItoFile,p as delay,m as emaFilter,v as fetchWithNetworkError,_ as fetcher,S as filterFilesToEmitUploadStarted,x as filterFilesToUpload,w as findAllDOMElements,ee as findDOMElement,A as generateFileID,ne as getAllowedMetaFields,M as getBytesRemaining,R as getDroppedFiles,B as getETA,T as getFileNameAndExtension,D as getFileType,H as getFileTypeExtension,te as getSafeFileId,U as getSocketHost,z as getSpeed,W as getTextDirection,K as getTimeStamp,a as hasProperty,ce as internalRateLimitedQueue,C as isDOMElement,q as isDragDropSupported,J as isNetworkError,Y as isObjectURL,ie as isPreviewSupported,ae as isTouchDevice,E as mimeTypes,oe as prettyETA,Q as remoteFileObjToLocal,X as secondsToTime,N as toArray,fe as truncateString};
15

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.