plutonium 0.53.1 → 0.54.0

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.
@@ -15,7 +15,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
15
15
  opacity ${i.animationDuration/2}ms ${i.animationDuration/2}ms ease-in;
16
16
  transform: translate3d(0, 0, 0);
17
17
  }
18
- `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=i.defaultCSS;let t=Dh();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},cl=class extends Nr{detailsByOuterHTML=this.children.filter(e=>!Kb(e)).map(e=>Zb(e)).reduce((e,t)=>{let{outerHTML:r}=t,s=r in e?e[r]:{type:Vb(t),tracked:Wb(t),elements:[]};return{...e,[r]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:s,elements:n}=this.detailsByOuterHTML[t];return r==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[s]}=this.detailsByOuterHTML[r];return Yb(s,e)?s:t},void 0|void 0)}};function Vb(i){if(Gb(i))return"script";if(Xb(i))return"stylesheet"}function Wb(i){return i.getAttribute("data-turbo-track")=="reload"}function Gb(i){return i.localName=="script"}function Kb(i){return i.localName=="noscript"}function Xb(i){let e=i.localName;return e=="style"||e=="link"&&i.getAttribute("rel")=="stylesheet"}function Yb(i,e){return i.localName=="meta"&&i.getAttribute("name")==e}function Zb(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var Qt=class i extends Nr{static fromHTMLString(e=""){return this.fromDocument(Lh(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new cl(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=r[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";for(let s of e.querySelectorAll("noscript"))s.remove();return new i(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get dir(){return this.documentElement.getAttribute("dir")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return Qe(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return(this.getSetting("view-transition")==="true"||this.headSnapshot.getMetaValue("view-transition")==="same-origin")&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}get refreshMethod(){return this.getSetting("refresh-method")}get refreshScroll(){return this.getSetting("refresh-scroll")}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},ul=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},Qb={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},qn={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},wi={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},Dr={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Jb={advance:"forward",restore:"back",replace:"none"},hl=class{identifier=Bi();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=wi.initialized;viewTransitioner=new ul;constructor(e,t,r,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||Bi();let{action:n,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:h,response:f,visitCachedSnapshot:m,willRender:w,updateHistory:y,shouldCacheSnapshot:k,acceptsStreamResponse:C,direction:O,refresh:R}={...Qb,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=h,this.response=f,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=m,this.willRender=w,this.updateHistory=y,this.scrolled=!w,this.shouldCacheSnapshot=k,this.acceptsStreamResponse=C,this.direction=O||Jb[n],this.refresh=R}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}start(){this.state==wi.initialized&&(this.recordTimingMetric(qn.visitStart),this.state=wi.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==wi.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=wi.canceled)}complete(){this.state==wi.started&&(this.recordTimingMetric(qn.visitEnd),this.adapter.visitCompleted(this),this.state=wi.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==wi.started&&(this.state=wi.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=Ih(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new nr(this,jt.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(qn.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Ch(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(qn.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Ch(e)&&t!=null){let r=Qt.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(Qt.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!Es(this.location)||e.hasAnchor(Es(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return Qt.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(Ui.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Dr.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:s}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Dr.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:r,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:Dr.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=Es(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Ch(i){return i>=200&&i<300}var dl=class{progressBar=new ll;constructor(e){this.session=e}visitProposedToLocation(e,t){Ni(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||Bi(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,this.redirectedToLocation=null,e.loadCachedSnapshot(),e.issueRequest()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse(),e.response.redirected&&(this.redirectedToLocation=e.redirectedToLocation)}visitRequestFailedWithStatusCode(e,t){switch(t){case Dr.networkFailure:case Dr.timeoutFailure:case Dr.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){ve("turbo:reload",{detail:e}),window.location.href=(this.redirectedToLocation||this.location)?.toString()||window.location.href}get navigator(){return this.session.navigator}},pl=class{selector="[data-turbo-temporary]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector)]}},fl=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new Qn(this,t),this.formSubmitObserver=new ks(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let s=this.#i(e);s&&s.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#i(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=Ml(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=Qe(s?.content??"/");return this.#t(e,t)&&Ni(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#i(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#i(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let s=this.element.querySelector(`#${r}:not([disabled])`);if(s instanceof qt)return s}}},ml=class{location;restorationIdentifier=Bi();restorationData={};started=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=Bi()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{let{turbo:t}=e.state||{};if(this.location=new URL(window.location.href),t){let{restorationIdentifier:r,restorationIndex:s}=t;this.restorationIdentifier=r;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=s}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}},gl=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!0};#i=e=>{if(Kn("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#l(t)){let s=t,n=zh(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new nr(this,jt.get,n,new URLSearchParams,t);o.fetchOptions.priority="low",Mr.putLater(n,o,this.#n)}}};#r=e=>{e.target===this.#e&&this.#s()};#s=()=>{Mr.clear(),this.#e=null};#o=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=Mr.get(e.detail.url);t&&(e.detail.fetchRequest=t),Mr.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#n(){return Number(Kn("turbo-prefetch-cache-time"))||Vh}#l(e){return!(!e.getAttribute("href")||ey(e)||ty(e)||iy(e)||ry(e)||ny(e))}},ey=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),ty=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),iy=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let e=Ir(i,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},ry=i=>{let e=i.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||sy(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},sy=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),ny=i=>ve("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,bl=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new hl(this,Qe(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new Yn(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let s=Qt.fromHTMLString(r);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.refreshScroll!=="preserve"&&this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:s}=e;return sr(r,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},ir={initial:0,loading:1,interactive:2,complete:3},yl=class{stage=ir.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==ir.initial&&(this.stage=ir.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==ir.loading&&(this.stage=ir.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==ir.interactive&&(this.stage=ir.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},vl=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},wl=class{render({fragment:e}){to.preservingPermanentElements(this,oy(e),()=>{ay(e,()=>{ly(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function oy(i){let e=Gh(document.documentElement),t={};for(let r of e){let{id:s}=r;for(let n of i.querySelectorAll("turbo-stream")){let o=Wh(n.templateElement.content,s);o&&(t[s]=[r,o])}}return t}async function ay(i,e){let t=`turbo-stream-autofocus-${Bi()}`,r=i.querySelectorAll("turbo-stream"),s=cy(r),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await Ss(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);Ll(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function ly(i){let[e,t]=await bb(i,()=>document.activeElement),r=e&&e.id;if(r){let s=document.getElementById(r);Ll(s)&&s!=t&&s.focus()}}function cy(i){for(let e of i){let t=Nh(e.templateElement.content);if(t)return t}return null}var Sl=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=uy(e);t&&hy(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(Ui.wrap(e))}};function uy(i){let e=i.detail?.fetchResponse;if(e instanceof xs)return e}function hy(i){return(i.contentType??"").startsWith(Ui.contentType)}var El=class extends _s{static renderElement(e,t){let{documentElement:r,body:s}=document;r.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=Ts(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},Cs=class extends _s{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{dir:t,lang:r}=this.newSnapshot;r?e.setAttribute("lang",r):e.removeAttribute("lang"),t?e.setAttribute("dir",t):e.removeAttribute("dir")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(fb(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(Ts(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(r,1),!0}if(s.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let e of this.newElement.querySelectorAll("noscript"))e.remove()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=Ts(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},ro=class extends Cs{static renderElement(e,t){so(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>Kh(r,s)&&!Xh(r)?(r.reload(),!1):!0}}),ve("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}},Tl=class extends Xn{constructor(e){super(e,$n)}get snapshots(){return this.entries}},xl=class extends Zn{snapshotCache=new Tl(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,s){let o=this.isPageRefresh(s)&&(s?.refresh?.method||this.snapshot.refreshMethod)==="morph"?ro:Cs,a=new o(this.snapshot,e,t,r);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new El(this.snapshot,e,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await Rh();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&(e?.refresh?.scroll||this.snapshot.refreshScroll)==="preserve"}get snapshot(){return Qt.fromElement(this.element)}},kl=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new nr(this,jt.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,s=Qt.fromHTMLString(r);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},_l=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){gb("turbo-cache-control",e)}},Al=class{navigator=new bl(this);history=new ml(this);view=new xl(this,document.documentElement);adapter=new dl(this);pageObserver=new yl(this);cacheObserver=new pl;linkPrefetchObserver=new gl(this,document);linkClickObserver=new Jn(this,window);formSubmitObserver=new ks(this,document);scrollObserver=new vl(this);streamObserver=new Sl(this);formLinkClickObserver=new eo(this,document.documentElement);frameRedirector=new fl(this,document.documentElement);streamMessageRenderer=new wl;cache=new _l(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new kl(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof qt){let s=t.action||sr(r);r.delegate.proposeVisitIfNavigatedWithAction(r,s),r.src=e.toString()}else this.navigator.proposeVisit(Qe(e),t)}refresh(e,t={}){t=typeof t=="string"?{requestId:t}:t;let{method:r,requestId:s,scroll:n}=t,o=s&&this.recentRequests.has(s),a=e===document.baseURI;!o&&!this.navigator.currentVisit&&a&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1,refresh:{method:r,scroll:n}})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(Ui.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){We.drive.progressBarDelay=e}get progressBarDelay(){return We.drive.progressBarDelay}set drive(e){We.drive.enabled=e}get drive(){return We.drive.enabled}set formMode(e){We.forms.mode=e}get formMode(){return We.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=yb(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||Ir(e,"turbo-frame:not([disabled])");if(t||r||n instanceof qt)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&Ni(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}historyPoppedWithEmptyState(e){this.history.replace(e),this.view.lastRenderedLocation=e,this.view.cacheSnapshot()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&Ni(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&Ni(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&Ni(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Fh(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Wn(document.documentElement),this.view.markVisitDirection(e.direction)),Fh(e.location),this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Gn(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}willSubmitForm(e,t){let r=Ml(e,t);return this.submissionIsNavigatable(e,t)&&Ni(Qe(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return ve("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return ve("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return ve("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return ve("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return ve("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return ve("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return ve("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterFrameLoad(e){return ve("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return ve("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(We.forms.mode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return We.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=Ir(e,"[data-turbo]"),r=Ir(e,"turbo-frame");return We.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return sr(e)||"advance"}get snapshot(){return this.view.snapshot}};function Fh(i){Object.defineProperties(i,dy)}var dy={absoluteURL:{get(){return this.toString()}}},Me=new Al(jh),{cache:py,navigator:fy}=Me;function Yh(){Me.start()}function my(i){Me.registerAdapter(i)}function gy(i,e){Me.visit(i,e)}function Zh(i){Me.connectStreamSource(i)}function Qh(i){Me.disconnectStreamSource(i)}function by(i){Me.renderStreamMessage(i)}function yy(i){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),We.drive.progressBarDelay=i}function vy(i){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),We.forms.confirm=i}function wy(i){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),We.forms.mode=i}function Sy(i,e){ro.renderElement(i,e)}function Ey(i,e){io.renderElement(i,e)}var Ty=Object.freeze({__proto__:null,navigator:fy,session:Me,cache:py,PageRenderer:Cs,PageSnapshot:Qt,FrameRenderer:As,fetch:qh,config:We,start:Yh,registerAdapter:my,visit:gy,connectStreamSource:Zh,disconnectStreamSource:Qh,renderStreamMessage:by,setProgressBarDelay:yy,setConfirmMethod:vy,setFormMode:wy,morphBodyElements:Sy,morphTurboFrameElements:Ey,morphChildren:Nl,morphElements:so}),Cl=class extends Error{},Fl=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#i=!1;#r=!1;#s=new Set;#o=!1;action=null;constructor(e){this.element=e,this.view=new ol(this,this.element),this.appearanceObserver=new sl(this,this.element),this.formLinkClickObserver=new eo(this,this.element),this.linkInterceptor=new Qn(this,this.element),this.restorationIdentifier=Bi(),this.formSubmitObserver=new ks(this,this.element)}connect(){this.#i||(this.#i=!0,this.loadingStyle==Lr.lazy?this.appearanceObserver.start():this.#n(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#i&&(this.#i=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),this.element.hasAttribute("recurse")||this.#e?.cancel())}disabledChanged(){this.disabled?this.#e?.cancel():this.loadingStyle==Lr.eager&&this.#n()}sourceURLChanged(){this.#y("src")||(this.sourceURL||this.#e?.cancel(),this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Lr.eager||this.#r)&&this.#n())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#o=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==Lr.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#n())}async#n(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#a(Qe(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#r=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=Lh(t);Qt.fromDocument(r).isVisitable?await this.#l(e,r):await this.#c(e)}}finally{this.#o=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,sr(e)),this.#n()}willSubmitFormLinkToLocation(e){return this.#b(e)}submittedFormLinkToLocation(e,t,r){let s=this.#p(e);s&&r.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,r){return this.#b(e)}linkClickIntercepted(e,t){this.#h(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#b(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Yn(this,e,t);let{fetchRequest:r}=this.formSubmission,s=this.#p(e,t);this.prepareRequest(r,s),this.formSubmission.start()}prepareRequest(e,t=this){e.headers["Turbo-Frame"]=t.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(Ui.contentType)}requestStarted(e){Wn(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){Gn(this.element)}formSubmissionStarted({formElement:e}){Wn(e,this.#p(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#p(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,sr(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||Me.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Me.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Gn(e,this.#p(e))}allowsImmediateRender({element:e},t){let r=ve("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){Me.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#l(e,t){let r=await this.extractForeignFrameElement(t.body),s=this.#o?io:As;if(r){let n=new Nr(r),o=new s(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,Me.frameRendered(e,this.element),Me.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#d(e)&&this.#u(e)}async#a(e){let t=new nr(this,jt.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#h(e,t,r){let s=this.#p(e,r);s.delegate.proposeVisitIfNavigatedWithAction(s,sr(r,e,s)),this.#S(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=Qt.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,l=await n.responseHTML,f={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(f.action=this.action),Me.visit(e.src,f)}}}}changeHistory(){if(this.action){let e=Ih(this.action);Me.history.update(e,Qe(this.element.src||""),this.restorationIdentifier)}}async#c(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#g(e.response)}#d(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,o)=>{n instanceof Response?this.#g(n):Me.visit(n,o)};return!ve("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#u(e){this.view.missing(),this.#f(e)}#f(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new Cl(t)}async#g(e){let t=new xs(e),r=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return Me.visit(s,{response:{redirected:n,statusCode:o,responseHTML:r}})}#p(e,t){let r=Vn("data-turbo-frame",t,e)||this.element.getAttribute("target"),s=this.#m(r);return s instanceof qt?s:this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=Ph(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=Ph(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new qt}return null}#w(e,t){let r=Ml(e,t);return Ni(Qe(r),this.rootLocation)}#b(e,t){let r=Vn("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#w(e,t)||!this.enabled||r=="_top")return!1;if(r){let s=this.#m(r);if(s)return!s.disabled;if(r=="_parent")return!1}return!(!Me.elementIsNavigatable(e)||t&&!Me.elementIsNavigatable(t))}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#T("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#i}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return Qe(t)}#y(e){return this.#s.has(e)}#T(e,t){this.#s.add(e),t(),this.#s.delete(e)}#S(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}#m(e){if(e!=null){let t=e==="_parent"?this.element.parentElement.closest("turbo-frame"):document.getElementById(e);if(t instanceof qt)return t}}};function Ph(i,e){if(i){let t=i.getAttribute("src");if(t!=null&&e!=null&&Hh(t,e))throw new Error(`Matching <turbo-frame id="${i.id}"> element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof qt)return i.connectedCallback(),i.disconnectedCallback(),i}}var Jh={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?so(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?Nl(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){let i=this.getAttribute("method"),e=this.requestId,t=this.getAttribute("scroll");Me.refresh(this.baseURI,{method:i,requestId:e,scroll:t})}},Pl=class i extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await Ss(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.getAttribute("id")),t=[...this.templateContent?.children||[]].filter(r=>!!r.getAttribute("id")).map(r=>r.getAttribute("id"));return e.filter(r=>t.includes(r.getAttribute("id")))}removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach(e=>e.remove())}get duplicateSiblings(){let e=this.targetElements.flatMap(r=>[...r.parentElement.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=Jh[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:i.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},Ol=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Zh(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Qh(this.streamSource))}get src(){return this.getAttribute("src")||""}};qt.delegateConstructor=Fl;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",qt);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Pl);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",Ol);(()=>{let i=document.currentScript;if(!i||i.hasAttribute("data-turbo-suppress-warning"))return;let e=i.parentElement;for(;e;){if(e==document.body)return console.warn(Mh`
18
+ `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=i.defaultCSS;let t=Dh();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},cl=class extends Nr{detailsByOuterHTML=this.children.filter(e=>!Kb(e)).map(e=>Zb(e)).reduce((e,t)=>{let{outerHTML:r}=t,s=r in e?e[r]:{type:Vb(t),tracked:Wb(t),elements:[]};return{...e,[r]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:s,elements:n}=this.detailsByOuterHTML[t];return r==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[s]}=this.detailsByOuterHTML[r];return Yb(s,e)?s:t},void 0|void 0)}};function Vb(i){if(Gb(i))return"script";if(Xb(i))return"stylesheet"}function Wb(i){return i.getAttribute("data-turbo-track")=="reload"}function Gb(i){return i.localName=="script"}function Kb(i){return i.localName=="noscript"}function Xb(i){let e=i.localName;return e=="style"||e=="link"&&i.getAttribute("rel")=="stylesheet"}function Yb(i,e){return i.localName=="meta"&&i.getAttribute("name")==e}function Zb(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var Qt=class i extends Nr{static fromHTMLString(e=""){return this.fromDocument(Lh(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new cl(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=r[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";for(let s of e.querySelectorAll("noscript"))s.remove();return new i(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get dir(){return this.documentElement.getAttribute("dir")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return Qe(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return(this.getSetting("view-transition")==="true"||this.headSnapshot.getMetaValue("view-transition")==="same-origin")&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}get refreshMethod(){return this.getSetting("refresh-method")}get refreshScroll(){return this.getSetting("refresh-scroll")}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},ul=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},Qb={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},qn={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},wi={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},Dr={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Jb={advance:"forward",restore:"back",replace:"none"},hl=class{identifier=Bi();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=wi.initialized;viewTransitioner=new ul;constructor(e,t,r,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||Bi();let{action:n,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:h,response:f,visitCachedSnapshot:m,willRender:w,updateHistory:y,shouldCacheSnapshot:k,acceptsStreamResponse:C,direction:O,refresh:R}={...Qb,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=h,this.response=f,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=m,this.willRender=w,this.updateHistory=y,this.scrolled=!w,this.shouldCacheSnapshot=k,this.acceptsStreamResponse=C,this.direction=O||Jb[n],this.refresh=R}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}start(){this.state==wi.initialized&&(this.recordTimingMetric(qn.visitStart),this.state=wi.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==wi.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=wi.canceled)}complete(){this.state==wi.started&&(this.recordTimingMetric(qn.visitEnd),this.adapter.visitCompleted(this),this.state=wi.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==wi.started&&(this.state=wi.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=Ih(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new nr(this,jt.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(qn.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Ch(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(qn.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Ch(e)&&t!=null){let r=Qt.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(Qt.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!Es(this.location)||e.hasAnchor(Es(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return Qt.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(Ui.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Dr.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:s}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Dr.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:r,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:Dr.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=Es(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Ch(i){return i>=200&&i<300}var dl=class{progressBar=new ll;constructor(e){this.session=e}visitProposedToLocation(e,t){Ni(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||Bi(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,this.redirectedToLocation=null,e.loadCachedSnapshot(),e.issueRequest()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse(),e.response.redirected&&(this.redirectedToLocation=e.redirectedToLocation)}visitRequestFailedWithStatusCode(e,t){switch(t){case Dr.networkFailure:case Dr.timeoutFailure:case Dr.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){ve("turbo:reload",{detail:e}),window.location.href=(this.redirectedToLocation||this.location)?.toString()||window.location.href}get navigator(){return this.session.navigator}},pl=class{selector="[data-turbo-temporary]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector)]}},fl=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new Qn(this,t),this.formSubmitObserver=new ks(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let s=this.#i(e);s&&s.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#i(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=Ml(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=Qe(s?.content??"/");return this.#t(e,t)&&Ni(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#i(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#i(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let s=this.element.querySelector(`#${r}:not([disabled])`);if(s instanceof qt)return s}}},ml=class{location;restorationIdentifier=Bi();restorationData={};started=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=Bi()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{let{turbo:t}=e.state||{};if(this.location=new URL(window.location.href),t){let{restorationIdentifier:r,restorationIndex:s}=t;this.restorationIdentifier=r;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=s}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}},gl=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!0};#i=e=>{if(Kn("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#l(t)){let s=t,n=zh(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new nr(this,jt.get,n,new URLSearchParams,t);o.fetchOptions.priority="low",Mr.putLater(n,o,this.#n)}}};#r=e=>{e.target===this.#e&&this.#s()};#s=()=>{Mr.clear(),this.#e=null};#o=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=Mr.get(e.detail.url);t&&(e.detail.fetchRequest=t),Mr.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#n(){return Number(Kn("turbo-prefetch-cache-time"))||Vh}#l(e){return!(!e.getAttribute("href")||ey(e)||ty(e)||iy(e)||ry(e)||ny(e))}},ey=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),ty=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),iy=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let e=Ir(i,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},ry=i=>{let e=i.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||sy(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},sy=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),ny=i=>ve("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,bl=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new hl(this,Qe(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new Yn(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let s=Qt.fromHTMLString(r);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.refreshScroll!=="preserve"&&this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:s}=e;return sr(r,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},ir={initial:0,loading:1,interactive:2,complete:3},yl=class{stage=ir.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==ir.initial&&(this.stage=ir.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==ir.loading&&(this.stage=ir.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==ir.interactive&&(this.stage=ir.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},vl=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},wl=class{render({fragment:e}){to.preservingPermanentElements(this,oy(e),()=>{ay(e,()=>{ly(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function oy(i){let e=Gh(document.documentElement),t={};for(let r of e){let{id:s}=r;for(let n of i.querySelectorAll("turbo-stream")){let o=Wh(n.templateElement.content,s);o&&(t[s]=[r,o])}}return t}async function ay(i,e){let t=`turbo-stream-autofocus-${Bi()}`,r=i.querySelectorAll("turbo-stream"),s=cy(r),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await Ss(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);Ll(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function ly(i){let[e,t]=await bb(i,()=>document.activeElement),r=e&&e.id;if(r){let s=document.getElementById(r);Ll(s)&&s!=t&&s.focus()}}function cy(i){for(let e of i){let t=Nh(e.templateElement.content);if(t)return t}return null}var Sl=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=uy(e);t&&hy(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(Ui.wrap(e))}};function uy(i){let e=i.detail?.fetchResponse;if(e instanceof xs)return e}function hy(i){return(i.contentType??"").startsWith(Ui.contentType)}var El=class extends _s{static renderElement(e,t){let{documentElement:r,body:s}=document;r.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=Ts(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},Cs=class extends _s{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{dir:t,lang:r}=this.newSnapshot;r?e.setAttribute("lang",r):e.removeAttribute("lang"),t?e.setAttribute("dir",t):e.removeAttribute("dir")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(fb(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(Ts(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(r,1),!0}if(s.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let e of this.newElement.querySelectorAll("noscript"))e.remove()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=Ts(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},ro=class extends Cs{static renderElement(e,t){so(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>Kh(r,s)&&!Xh(r)?(r.reload(),!1):!0}}),ve("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}},Tl=class extends Xn{constructor(e){super(e,$n)}get snapshots(){return this.entries}},xl=class extends Zn{snapshotCache=new Tl(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,s){let o=this.isPageRefresh(s)&&(s?.refresh?.method||this.snapshot.refreshMethod)==="morph"?ro:Cs,a=new o(this.snapshot,e,t,r);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new El(this.snapshot,e,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await Rh();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&(e?.refresh?.scroll||this.snapshot.refreshScroll)==="preserve"}get snapshot(){return Qt.fromElement(this.element)}},kl=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new nr(this,jt.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,s=Qt.fromHTMLString(r);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},_l=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){gb("turbo-cache-control",e)}},Al=class{navigator=new bl(this);history=new ml(this);view=new xl(this,document.documentElement);adapter=new dl(this);pageObserver=new yl(this);cacheObserver=new pl;linkPrefetchObserver=new gl(this,document);linkClickObserver=new Jn(this,window);formSubmitObserver=new ks(this,document);scrollObserver=new vl(this);streamObserver=new Sl(this);formLinkClickObserver=new eo(this,document.documentElement);frameRedirector=new fl(this,document.documentElement);streamMessageRenderer=new wl;cache=new _l(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new kl(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof qt){let s=t.action||sr(r);r.delegate.proposeVisitIfNavigatedWithAction(r,s),r.src=e.toString()}else this.navigator.proposeVisit(Qe(e),t)}refresh(e,t={}){t=typeof t=="string"?{requestId:t}:t;let{method:r,requestId:s,scroll:n}=t,o=s&&this.recentRequests.has(s),a=e===document.baseURI;!o&&!this.navigator.currentVisit&&a&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1,refresh:{method:r,scroll:n}})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(Ui.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){We.drive.progressBarDelay=e}get progressBarDelay(){return We.drive.progressBarDelay}set drive(e){We.drive.enabled=e}get drive(){return We.drive.enabled}set formMode(e){We.forms.mode=e}get formMode(){return We.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=yb(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||Ir(e,"turbo-frame:not([disabled])");if(t||r||n instanceof qt)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&Ni(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}historyPoppedWithEmptyState(e){this.history.replace(e),this.view.lastRenderedLocation=e,this.view.cacheSnapshot()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&Ni(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&Ni(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&Ni(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Fh(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Wn(document.documentElement),this.view.markVisitDirection(e.direction)),Fh(e.location),this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Gn(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}willSubmitForm(e,t){let r=Ml(e,t);return this.submissionIsNavigatable(e,t)&&Ni(Qe(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return ve("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return ve("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return ve("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return ve("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return ve("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return ve("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return ve("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterFrameLoad(e){return ve("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return ve("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(We.forms.mode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return We.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=Ir(e,"[data-turbo]"),r=Ir(e,"turbo-frame");return We.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return sr(e)||"advance"}get snapshot(){return this.view.snapshot}};function Fh(i){Object.defineProperties(i,dy)}var dy={absoluteURL:{get(){return this.toString()}}},Me=new Al(jh),{cache:py,navigator:fy}=Me;function Yh(){Me.start()}function my(i){Me.registerAdapter(i)}function gy(i,e){Me.visit(i,e)}function Zh(i){Me.connectStreamSource(i)}function Qh(i){Me.disconnectStreamSource(i)}function by(i){Me.renderStreamMessage(i)}function yy(i){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),We.drive.progressBarDelay=i}function vy(i){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),We.forms.confirm=i}function wy(i){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),We.forms.mode=i}function Sy(i,e){ro.renderElement(i,e)}function Ey(i,e){io.renderElement(i,e)}var Ty=Object.freeze({__proto__:null,navigator:fy,session:Me,cache:py,PageRenderer:Cs,PageSnapshot:Qt,FrameRenderer:As,fetch:qh,config:We,start:Yh,registerAdapter:my,visit:gy,connectStreamSource:Zh,disconnectStreamSource:Qh,renderStreamMessage:by,setProgressBarDelay:yy,setConfirmMethod:vy,setFormMode:wy,morphBodyElements:Sy,morphTurboFrameElements:Ey,morphChildren:Nl,morphElements:so}),Cl=class extends Error{},Fl=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#i=!1;#r=!1;#s=new Set;#o=!1;action=null;constructor(e){this.element=e,this.view=new ol(this,this.element),this.appearanceObserver=new sl(this,this.element),this.formLinkClickObserver=new eo(this,this.element),this.linkInterceptor=new Qn(this,this.element),this.restorationIdentifier=Bi(),this.formSubmitObserver=new ks(this,this.element)}connect(){this.#i||(this.#i=!0,this.loadingStyle==Lr.lazy?this.appearanceObserver.start():this.#n(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#i&&(this.#i=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),this.element.hasAttribute("recurse")||this.#e?.cancel())}disabledChanged(){this.disabled?this.#e?.cancel():this.loadingStyle==Lr.eager&&this.#n()}sourceURLChanged(){this.#y("src")||(this.sourceURL||this.#e?.cancel(),this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Lr.eager||this.#r)&&this.#n())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#o=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==Lr.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#n())}async#n(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#a(Qe(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#r=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=Lh(t);Qt.fromDocument(r).isVisitable?await this.#l(e,r):await this.#c(e)}}finally{this.#o=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,sr(e)),this.#n()}willSubmitFormLinkToLocation(e){return this.#b(e)}submittedFormLinkToLocation(e,t,r){let s=this.#p(e);s&&r.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,r){return this.#b(e)}linkClickIntercepted(e,t){this.#d(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#b(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Yn(this,e,t);let{fetchRequest:r}=this.formSubmission,s=this.#p(e,t);this.prepareRequest(r,s),this.formSubmission.start()}prepareRequest(e,t=this){e.headers["Turbo-Frame"]=t.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(Ui.contentType)}requestStarted(e){Wn(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){Gn(this.element)}formSubmissionStarted({formElement:e}){Wn(e,this.#p(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#p(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,sr(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||Me.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Me.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Gn(e,this.#p(e))}allowsImmediateRender({element:e},t){let r=ve("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){Me.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#l(e,t){let r=await this.extractForeignFrameElement(t.body),s=this.#o?io:As;if(r){let n=new Nr(r),o=new s(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,Me.frameRendered(e,this.element),Me.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#h(e)&&this.#u(e)}async#a(e){let t=new nr(this,jt.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#d(e,t,r){let s=this.#p(e,r);s.delegate.proposeVisitIfNavigatedWithAction(s,sr(r,e,s)),this.#S(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=Qt.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,l=await n.responseHTML,f={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(f.action=this.action),Me.visit(e.src,f)}}}}changeHistory(){if(this.action){let e=Ih(this.action);Me.history.update(e,Qe(this.element.src||""),this.restorationIdentifier)}}async#c(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#g(e.response)}#h(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,o)=>{n instanceof Response?this.#g(n):Me.visit(n,o)};return!ve("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#u(e){this.view.missing(),this.#f(e)}#f(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new Cl(t)}async#g(e){let t=new xs(e),r=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return Me.visit(s,{response:{redirected:n,statusCode:o,responseHTML:r}})}#p(e,t){let r=Vn("data-turbo-frame",t,e)||this.element.getAttribute("target"),s=this.#m(r);return s instanceof qt?s:this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=Ph(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=Ph(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new qt}return null}#w(e,t){let r=Ml(e,t);return Ni(Qe(r),this.rootLocation)}#b(e,t){let r=Vn("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#w(e,t)||!this.enabled||r=="_top")return!1;if(r){let s=this.#m(r);if(s)return!s.disabled;if(r=="_parent")return!1}return!(!Me.elementIsNavigatable(e)||t&&!Me.elementIsNavigatable(t))}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#T("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#i}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return Qe(t)}#y(e){return this.#s.has(e)}#T(e,t){this.#s.add(e),t(),this.#s.delete(e)}#S(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}#m(e){if(e!=null){let t=e==="_parent"?this.element.parentElement.closest("turbo-frame"):document.getElementById(e);if(t instanceof qt)return t}}};function Ph(i,e){if(i){let t=i.getAttribute("src");if(t!=null&&e!=null&&Hh(t,e))throw new Error(`Matching <turbo-frame id="${i.id}"> element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof qt)return i.connectedCallback(),i.disconnectedCallback(),i}}var Jh={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?so(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?Nl(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){let i=this.getAttribute("method"),e=this.requestId,t=this.getAttribute("scroll");Me.refresh(this.baseURI,{method:i,requestId:e,scroll:t})}},Pl=class i extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await Ss(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.getAttribute("id")),t=[...this.templateContent?.children||[]].filter(r=>!!r.getAttribute("id")).map(r=>r.getAttribute("id"));return e.filter(r=>t.includes(r.getAttribute("id")))}removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach(e=>e.remove())}get duplicateSiblings(){let e=this.targetElements.flatMap(r=>[...r.parentElement.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=Jh[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:i.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},Ol=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Zh(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Qh(this.streamSource))}get src(){return this.getAttribute("src")||""}};qt.delegateConstructor=Fl;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",qt);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Pl);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",Ol);(()=>{let i=document.currentScript;if(!i||i.hasAttribute("data-turbo-suppress-warning"))return;let e=i.parentElement;for(;e;){if(e==document.body)return console.warn(Mh`
19
19
  You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
20
20
 
21
21
  Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
@@ -85,24 +85,24 @@ ${e}</tr>
85
85
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
86
86
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${di(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),n=Qd(e);if(n===null)return s;e=n;let o='<a href="'+e+'"';return t&&(o+=' title="'+di(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r}){let s=Qd(e);if(s===null)return di(r);e=s;let n=`<img src="${e}" alt="${r}"`;return t&&(n+=` title="${di(t)}"`),n+=">",n}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:di(e.text)}},qs=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},ri=class i{options;renderer;textRenderer;constructor(e){this.options=e||mr,this.options.renderer=this.options.renderer||new Qr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new qs}static parse(e,t){return new i(t).parse(e)}static parseInline(e,t){return new i(t).parseInline(e)}parse(e,t=!0){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){r+=l||"";continue}}let o=n;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let a=o,l=this.renderer.text(a);for(;s+1<e.length&&e[s+1].type==="text";)a=e[++s],l+=`
87
87
  `+this.renderer.text(a);t?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,t=this.renderer){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=a||"";continue}}let o=n;switch(o.type){case"escape":{r+=t.text(o);break}case"html":{r+=t.html(o);break}case"link":{r+=t.link(o);break}case"image":{r+=t.image(o);break}case"strong":{r+=t.strong(o);break}case"em":{r+=t.em(o);break}case"codespan":{r+=t.codespan(o);break}case"br":{r+=t.br(o);break}case"del":{r+=t.del(o);break}case"text":{r+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Yr=class{options;block;constructor(e){this.options=e||mr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ii.lex:ii.lexInline}provideParser(){return this.block?ri.parse:ri.parseInline}},Pc=class{defaults=Oc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ri;Renderer=Qr;TextRenderer=qs;Lexer=ii;Tokenizer=Zr;Hooks=Yr;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let s of e)switch(r=r.concat(t.call(this,s)),s.type){case"table":{let n=s;for(let o of n.header)r=r.concat(this.walkTokens(o.tokens,t));for(let o of n.rows)for(let a of o)r=r.concat(this.walkTokens(a.tokens,t));break}case"list":{let n=s;r=r.concat(this.walkTokens(n.items,t));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{let a=n[o].flat(1/0);r=r.concat(this.walkTokens(a,t))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let o=t.renderers[n.name];o?t.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[n.level];o?o.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),s.extensions=t),r.renderer){let n=this.defaults.renderer||new Qr(this.defaults);for(let o in r.renderer){if(!(o in n))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],h=n[a];n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=h.apply(n,f)),m||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new Zr(this.defaults);for(let o in r.tokenizer){if(!(o in n))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],h=n[a];n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=h.apply(n,f)),m}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new Yr;for(let o in r.hooks){if(!(o in n))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],h=n[a];Yr.passThroughHooks.has(o)?n[a]=f=>{if(this.defaults.async)return Promise.resolve(l.call(n,f)).then(w=>h.call(n,w));let m=l.call(n,f);return h.call(n,m)}:n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=h.apply(n,f)),m}}s.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ii.lex(e,t??this.defaults)}parser(e,t){return ri.parse(e,t??this.defaults)}parseMarkdown(e){return(r,s)=>{let n={...s},o={...this.defaults,...n},a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=e);let l=o.hooks?o.hooks.provideLexer():e?ii.lex:ii.lexInline,h=o.hooks?o.hooks.provideParser():e?ri.parse:ri.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(f=>l(f,o)).then(f=>o.hooks?o.hooks.processAllTokens(f):f).then(f=>o.walkTokens?Promise.all(this.walkTokens(f,o.walkTokens)).then(()=>f):f).then(f=>h(f,o)).then(f=>o.hooks?o.hooks.postprocess(f):f).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let f=l(r,o);o.hooks&&(f=o.hooks.processAllTokens(f)),o.walkTokens&&this.walkTokens(f,o.walkTokens);let m=h(f,o);return o.hooks&&(m=o.hooks.postprocess(m)),m}catch(f){return a(f)}}}onError(e,t){return r=>{if(r.message+=`
88
- Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+di(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},fr=new Pc;function le(i,e){return fr.parse(i,e)}le.options=le.setOptions=function(i){return fr.setOptions(i),le.defaults=fr.defaults,tp(le.defaults),le};le.getDefaults=Oc;le.defaults=mr;le.use=function(...i){return fr.use(...i),le.defaults=fr.defaults,tp(le.defaults),le};le.walkTokens=function(i,e){return fr.walkTokens(i,e)};le.parseInline=fr.parseInline;le.Parser=ri;le.parser=ri.parse;le.Renderer=Qr;le.TextRenderer=qs;le.Lexer=ii;le.lexer=ii.lex;le.Tokenizer=Zr;le.Hooks=Yr;le.parse=le;var bA=le.options,yA=le.setOptions,vA=le.use,wA=le.walkTokens,SA=le.parseInline;var EA=ri.parse,TA=ii.lex;var Mo=class extends V{static targets=["textarea"];connect(){this.easyMDE||(this.originalValue=this.element.value,this.easyMDE=new EasyMDE(this.#t()),this.element.addEventListener("turbo:before-morph-element",i=>{i.target===this.element&&this.easyMDE&&(this.storedValue=this.easyMDE.value())}),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&requestAnimationFrame(()=>this.#e())}))}disconnect(){if(this.easyMDE){try{this.element.isConnected&&this.element.parentNode&&this.easyMDE.toTextArea()}catch(i){console.warn("EasyMDE cleanup error:",i)}this.easyMDE=null}}#e(){this.element.isConnected&&(this.easyMDE&&(this.easyMDE=null),this.easyMDE=new EasyMDE(this.#t()),this.storedValue!==void 0&&(this.easyMDE.value(this.storedValue),this.storedValue=void 0))}#t(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Xr.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=le(t);return Xr.sanitize(r,{USE_PROFILES:{html:!0}})}};return this.element.attributes.id.value&&(i.autosave={enabled:!0,uniqueId:this.element.attributes.id.value,delay:1e3}),i}};var Io=class extends V{static values={typeaheadUrl:String,typeaheadDebounceMs:{type:Number,default:200}};connect(){this.slimSelect||(this.#e(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#r(),this.morphing=!1}))}))}#e(){let i={};if(document.querySelector('[data-controller="remote-modal"]')){this.dropdownContainer=document.createElement("div"),this.dropdownContainer.className="ss-dropdown-container";let r=this.element.parentNode;getComputedStyle(r).position==="static"&&(r.style.position="relative",this.modifiedSelectWrapper=r),this.element.parentNode.insertBefore(this.dropdownContainer,this.element.nextSibling),i.contentLocation=this.dropdownContainer,i.contentPosition="absolute",i.openPosition="auto"}let t={};this.hasTypeaheadUrlValue&&this.typeaheadUrlValue&&(t.search=(r,s)=>this.#t(r,s)),this.slimSelect=new SlimSelect({select:this.element,settings:i,events:t}),this.handleDropdownPosition(),this.boundHandleDropdownOpen=this.handleDropdownOpen.bind(this),this.boundHandleDropdownClose=this.handleDropdownClose.bind(this),this.element.addEventListener("ss:open",this.boundHandleDropdownOpen),this.element.addEventListener("ss:close",this.boundHandleDropdownClose),this.setupAriaObserver()}handleDropdownPosition(){if(this.dropdownContainer){let i=()=>{let e=this.element.getBoundingClientRect(),t=window.innerHeight-e.bottom,r=e.top;t<200&&r>t?(this.dropdownContainer.style.top="auto",this.dropdownContainer.style.bottom="100%",this.dropdownContainer.style.borderRadius="0.375rem 0.375rem 0 0"):(this.dropdownContainer.style.bottom="auto",this.dropdownContainer.style.borderRadius="0 0 0.375rem 0.375rem")};setTimeout(i,0),window.addEventListener("resize",i),window.addEventListener("scroll",i),this.repositionDropdown=i}}handleDropdownOpen(){this.dropdownContainer&&(this.dropdownContainer.style.height="auto",this.dropdownContainer.style.overflow="visible",this.dropdownContainer.classList.add("ss-active"),document.querySelectorAll(".ss-dropdown-container").forEach(e=>{e!==this.dropdownContainer&&(e.style.zIndex="9999")}),this.dropdownContainer.style.zIndex="10000")}handleDropdownClose(){this.dropdownContainer&&this.dropdownContainer.classList.remove("ss-active")}setupAriaObserver(){if(this.element){this.ariaObserver=new MutationObserver(t=>{t.forEach(r=>{r.attributeName==="aria-expanded"&&(r.target.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())})});let e=[this.element,this.element.parentNode.querySelector(".ss-main"),this.element.parentNode.querySelector("[aria-expanded]")].find(t=>t&&t.hasAttribute&&t.hasAttribute("aria-expanded"));e&&(this.ariaObserver.observe(e,{attributes:!0,attributeFilter:["aria-expanded"]}),e.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())}}disconnect(){this.#s()}#t(i,e){return this._typeaheadDebounce&&clearTimeout(this._typeaheadDebounce),this._typeaheadAbort&&this._typeaheadAbort.abort(),new Promise(t=>{this._typeaheadDebounce=setTimeout(()=>{this._typeaheadAbort=new AbortController,this.#i(i,this._typeaheadAbort.signal).then(t)},this.typeaheadDebounceMsValue)})}async#i(i,e){let t=new URL(this.typeaheadUrlValue,window.location.origin);t.searchParams.set("q",i||"");try{let r=await fetch(t.toString(),{headers:{Accept:"application/json"},signal:e});if(!r.ok)return"Search failed";let s=await r.json();return(Array.isArray(s.results)?s.results:[]).map(o=>({value:String(o.value??""),text:String(o.label??"")}))}catch(r){return r.name==="AbortError"?[]:(console.warn("[slim-select] typeahead error",r),"Search failed")}}#r(){this.element.isConnected&&(this.#s(),this.#e())}#s(){this.element&&(this.boundHandleDropdownOpen&&this.element.removeEventListener("ss:open",this.boundHandleDropdownOpen),this.boundHandleDropdownClose&&this.element.removeEventListener("ss:close",this.boundHandleDropdownClose)),this.ariaObserver&&(this.ariaObserver.disconnect(),this.ariaObserver=null),this.slimSelect&&(this.slimSelect.destroy(),this.slimSelect=null),this.repositionDropdown&&(window.removeEventListener("resize",this.repositionDropdown),window.removeEventListener("scroll",this.repositionDropdown),this.repositionDropdown=null),this.dropdownContainer&&this.dropdownContainer.parentNode&&(this.dropdownContainer.parentNode.removeChild(this.dropdownContainer),this.dropdownContainer=null),this.modifiedSelectWrapper&&(this.modifiedSelectWrapper.style.position="",this.modifiedSelectWrapper=null)}};var Do=class extends V{connect(){this.picker||(this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.picker&&(this.picker.destroy(),this.picker=null)}#e(){this.element.isConnected&&(this.picker&&(this.picker.destroy(),this.picker=null),this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()))}#t(){let i={altInput:!0};return this.element.attributes.type.value=="datetime-local"?i.enableTime=!0:this.element.attributes.type.value=="time"&&(i.enableTime=!0,i.noCalendar=!0),this.modal&&(i.appendTo=this.modal,i.position=e=>{let r=(e.altInput||e.input).getBoundingClientRect(),s=this.modal.getBoundingClientRect(),n=e.calendarContainer,o=n.offsetHeight,l=window.innerHeight-r.bottom<o&&r.top>o,h=l?r.top-s.top-o-2:r.bottom-s.top+2;n.style.top=`${h}px`,n.style.left=`${r.left-s.left}px`,n.style.right="auto",n.classList.toggle("arrowTop",!l),n.classList.toggle("arrowBottom",l)}),i}};var No=class extends V{static targets=["input"];connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){!this.hasInputTarget||this.iti||(this.iti=window.intlTelInput(this.inputTarget,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}inputTargetDisconnected(){this.iti&&(this.iti.destroy(),this.iti=null)}#e(){!this.inputTarget||!this.inputTarget.isConnected||(this.iti&&(this.iti.destroy(),this.iti=null),this.iti=window.intlTelInput(this.inputTarget,this.#t()))}#t(){return{strictMode:!0,hiddenInput:()=>({phone:this.inputTarget.attributes.name.value}),loadUtilsOnInit:"https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/utils.js"}}};var Bo=class extends V{static targets=["select"];navigate(i){let e=this.selectTarget.value,t=document.createElement("a");t.href=e,this.element.appendChild(t),t.click(),t.remove()}};var Uo=class extends V{static targets=["btn","tab"];static values={defaultTab:String,activeClasses:String,inActiveClasses:String};connect(){this.activeClasses=this.hasActiveClassesValue?this.activeClassesValue.split(" "):[],this.inActiveClasses=this.hasInActiveClassesValue?this.inActiveClassesValue.split(" "):[];let e=this.#t()||this.defaultTabValue||this.btnTargets[0]?.id;this.#e(e,{skipFocus:!0,skipHashUpdate:!0}),this._syncFromHash=this._syncFromHash.bind(this),window.addEventListener("hashchange",this._syncFromHash),document.addEventListener("turbo:load",this._syncFromHash)}disconnect(){this._syncFromHash&&(window.removeEventListener("hashchange",this._syncFromHash),document.removeEventListener("turbo:load",this._syncFromHash))}_syncFromHash(){let i=this.#t();i&&this.#e(i,{skipFocus:!0,skipHashUpdate:!0})}select(i){this.#e(i.currentTarget.id)}#e(i,e={}){let t=this.btnTargets.find(s=>s.id===i);if(!t){console.error(`Tab Button with id "${i}" not found`);return}let r=this.tabTargets.find(s=>s.id===t.dataset.target);if(!r){console.error(`Tab Panel with id "${t.dataset.target}" not found`);return}this.tabTargets.forEach(s=>{s.hidden=!0,s.setAttribute("aria-hidden","true")}),this.btnTargets.forEach(s=>{s.setAttribute("aria-selected","false"),s.setAttribute("tabindex","-1"),s.classList.remove(...this.activeClasses),s.classList.add(...this.inActiveClasses)}),t.setAttribute("aria-selected","true"),t.setAttribute("tabindex","0"),t.classList.remove(...this.inActiveClasses),t.classList.add(...this.activeClasses),r.hidden=!1,r.setAttribute("aria-hidden","false"),e.skipHashUpdate||this.#i(i),!e.skipFocus&&t!==document.activeElement&&t.focus()}#t(){let i=window.location.hash.replace(/^#/,"");if(!i)return null;let e=`${i}-tab`;return this.btnTargets.some(r=>r.id===e)?e:null}#i(i){let t=`#${i.replace(/-tab$/,"")}`;window.location.hash!==t&&history.replaceState(null,"",t)}};function rw(i,e,t){let r=[];return i.forEach(s=>typeof s!="string"?r.push(s):e[Symbol.split](s).forEach((n,o,a)=>{n!==""&&r.push(n),o<a.length-1&&r.push(t)})),r}function dp(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let o=e[n];typeof o=="string"&&(o=t[Symbol.replace](o,r)),s=rw(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var sw=i=>{throw new Error(`missing string: ${i}`)},gr=class{locale;constructor(e,{onMissingKey:t=sw}={}){this.locale={strings:{},pluralize(r){return r===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(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 r=this.locale.strings[e];if(r==null&&(this.#e(e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return dp(r[n],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return dp(r,t)}};var ji=class{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){let{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){let{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){let e=new gr([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}};function Uc(i){return i<10?`0${i}`:i.toString()}function Jr(){let i=new Date,e=Uc(i.getHours()),t=Uc(i.getMinutes()),r=Uc(i.getSeconds());return`${e}:${t}:${r}`}var pp={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Jr()}]`,...i)},fp={debug:(...i)=>console.debug(`[Uppy] [${Jr()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Jr()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Jr()}]`,...i)};function Vs(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function nw(i,e=document){return typeof i=="string"?e.querySelector(i):Vs(i)?i:null}var mp=nw;function ow(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}var zo=ow;var Ks,X,wp,aw,br,gp,Sp,Ep,Tp,qc,zc,Hc,lw,Gs={},xp=[],cw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Xs=Array.isArray;function pi(i,e){for(var t in e)i[t]=e[t];return i}function $c(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function ki(i,e,t){var r,s,n,o={};for(n in e)n=="key"?r=e[n]:n=="ref"?s=e[n]:o[n]=e[n];if(arguments.length>2&&(o.children=arguments.length>3?Ks.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(n in i.defaultProps)o[n]===void 0&&(o[n]=i.defaultProps[n]);return Ws(i,o,r,s,null)}function Ws(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++wp,__i:-1,__u:0};return s==null&&X.vnode!=null&&X.vnode(n),n}function qo(){return{current:null}}function _e(i){return i.children}function we(i,e){this.props=i,this.context=e}function es(i,e){if(e==null)return i.__?es(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?es(i):null}function kp(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return kp(i)}}function bp(i){(!i.__d&&(i.__d=!0)&&br.push(i)&&!jo.__r++||gp!=X.debounceRendering)&&((gp=X.debounceRendering)||Sp)(jo)}function jo(){for(var i,e,t,r,s,n,o,a=1;br.length;)br.length>a&&br.sort(Ep),i=br.shift(),a=br.length,i.__d&&(t=void 0,r=void 0,s=(r=(e=i).__v).__e,n=[],o=[],e.__P&&((t=pi({},r)).__v=r.__v+1,X.vnode&&X.vnode(t),Vc(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??es(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,Cp(n,t,o),r.__e=r.__=null,t.__e!=s&&kp(t)));jo.__r=0}function _p(i,e,t,r,s,n,o,a,l,h,f){var m,w,y,k,C,O,R,_=r&&r.__k||xp,F=e.length;for(l=uw(t,e,_,l,F),m=0;m<F;m++)(y=t.__k[m])!=null&&(w=y.__i==-1?Gs:_[y.__i]||Gs,y.__i=m,O=Vc(i,y,w,s,n,o,a,l,h,f),k=y.__e,y.ref&&w.ref!=y.ref&&(w.ref&&Wc(w.ref,null,y),f.push(y.ref,y.__c||k,y)),C==null&&k!=null&&(C=k),(R=!!(4&y.__u))||w.__k===y.__k?l=Ap(y,l,i,R):typeof y.type=="function"&&O!==void 0?l=O:k&&(l=k.nextSibling),y.__u&=-7);return t.__e=C,l}function uw(i,e,t,r,s){var n,o,a,l,h,f=t.length,m=f,w=0;for(i.__k=new Array(s),n=0;n<s;n++)(o=e[n])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[n]=Ws(null,o,null,null,null):Xs(o)?o=i.__k[n]=Ws(_e,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[n]=Ws(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[n]=o,l=n+w,o.__=i,o.__b=i.__b+1,a=null,(h=o.__i=hw(o,t,l,m))!=-1&&(m--,(a=t[h])&&(a.__u|=2)),a==null||a.__v==null?(h==-1&&(s>f?w--:s<f&&w++),typeof o.type!="function"&&(o.__u|=4)):h!=l&&(h==l-1?w--:h==l+1?w++:(h>l?w--:w++,o.__u|=4))):i.__k[n]=null;if(m)for(n=0;n<f;n++)(a=t[n])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=es(a)),Pp(a,a));return r}function Ap(i,e,t,r){var s,n;if(typeof i.type=="function"){for(s=i.__k,n=0;s&&n<s.length;n++)s[n]&&(s[n].__=i,e=Ap(s[n],e,t,r));return e}i.__e!=e&&(r&&(e&&i.type&&!e.parentNode&&(e=es(i)),t.insertBefore(i.__e,e||null)),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function wt(i,e){return e=e||[],i==null||typeof i=="boolean"||(Xs(i)?i.some(function(t){wt(t,e)}):e.push(i)),e}function hw(i,e,t,r){var s,n,o,a=i.key,l=i.type,h=e[t],f=h!=null&&(2&h.__u)==0;if(h===null&&a==null||f&&a==h.key&&l==h.type)return t;if(r>(f?1:0)){for(s=t-1,n=t+1;s>=0||n<e.length;)if((h=e[o=s>=0?s--:n++])!=null&&(2&h.__u)==0&&a==h.key&&l==h.type)return o}return-1}function yp(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||cw.test(e)?t:t+"px"}function Ho(i,e,t,r,s){var n,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||yp(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||yp(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(Tp,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.u=r.u:(t.u=qc,i.addEventListener(e,n?Hc:zc,n)):i.removeEventListener(e,n?Hc:zc,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function vp(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=qc++;else if(e.t<t.u)return;return t(X.event?X.event(e):e)}}}function Vc(i,e,t,r,s,n,o,a,l,h){var f,m,w,y,k,C,O,R,_,F,x,S,A,P,N,z,q,$=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),n=[a=e.__e=t.__e]),(f=X.__b)&&f(e);e:if(typeof $=="function")try{if(R=e.props,_="prototype"in $&&$.prototype.render,F=(f=$.contextType)&&r[f.__c],x=f?F?F.props.value:f.__:r,t.__c?O=(m=e.__c=t.__c).__=m.__E:(_?e.__c=m=new $(R,x):(e.__c=m=new we(R,x),m.constructor=$,m.render=pw),F&&F.sub(m),m.state||(m.state={}),m.__n=r,w=m.__d=!0,m.__h=[],m._sb=[]),_&&m.__s==null&&(m.__s=m.state),_&&$.getDerivedStateFromProps!=null&&(m.__s==m.state&&(m.__s=pi({},m.__s)),pi(m.__s,$.getDerivedStateFromProps(R,m.__s))),y=m.props,k=m.state,m.__v=e,w)_&&$.getDerivedStateFromProps==null&&m.componentWillMount!=null&&m.componentWillMount(),_&&m.componentDidMount!=null&&m.__h.push(m.componentDidMount);else{if(_&&$.getDerivedStateFromProps==null&&R!==y&&m.componentWillReceiveProps!=null&&m.componentWillReceiveProps(R,x),e.__v==t.__v||!m.__e&&m.shouldComponentUpdate!=null&&m.shouldComponentUpdate(R,m.__s,x)===!1){for(e.__v!=t.__v&&(m.props=R,m.state=m.__s,m.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(Z){Z&&(Z.__=e)}),S=0;S<m._sb.length;S++)m.__h.push(m._sb[S]);m._sb=[],m.__h.length&&o.push(m);break e}m.componentWillUpdate!=null&&m.componentWillUpdate(R,m.__s,x),_&&m.componentDidUpdate!=null&&m.__h.push(function(){m.componentDidUpdate(y,k,C)})}if(m.context=x,m.props=R,m.__P=i,m.__e=!1,A=X.__r,P=0,_){for(m.state=m.__s,m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),N=0;N<m._sb.length;N++)m.__h.push(m._sb[N]);m._sb=[]}else do m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),m.state=m.__s;while(m.__d&&++P<25);m.state=m.__s,m.getChildContext!=null&&(r=pi(pi({},r),m.getChildContext())),_&&!w&&m.getSnapshotBeforeUpdate!=null&&(C=m.getSnapshotBeforeUpdate(y,k)),z=f,f!=null&&f.type===_e&&f.key==null&&(z=Fp(f.props.children)),a=_p(i,Xs(z)?z:[z],e,t,r,s,n,o,a,l,h),m.base=e.__e,e.__u&=-161,m.__h.length&&o.push(m),O&&(m.__E=m.__=null)}catch(Z){if(e.__v=null,l||n!=null)if(Z.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;n[n.indexOf(a)]=null,e.__e=a}else{for(q=n.length;q--;)$c(n[q]);jc(e)}else e.__e=t.__e,e.__k=t.__k,Z.then||jc(e);X.__e(Z,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=dw(t.__e,e,t,r,s,n,o,l,h);return(f=X.diffed)&&f(e),128&e.__u?void 0:a}function jc(i){i&&i.__c&&(i.__c.__e=!0),i&&i.__k&&i.__k.forEach(jc)}function Cp(i,e,t){for(var r=0;r<t.length;r++)Wc(t[r],t[++r],t[++r]);X.__c&&X.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){X.__e(n,s.__v)}})}function Fp(i){return typeof i!="object"||i==null||i.__b&&i.__b>0?i:Xs(i)?i.map(Fp):pi({},i)}function dw(i,e,t,r,s,n,o,a,l){var h,f,m,w,y,k,C,O=t.props||Gs,R=e.props,_=e.type;if(_=="svg"?s="http://www.w3.org/2000/svg":_=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(h=0;h<n.length;h++)if((y=n[h])&&"setAttribute"in y==!!_&&(_?y.localName==_:y.nodeType==3)){i=y,n[h]=null;break}}if(i==null){if(_==null)return document.createTextNode(R);i=document.createElementNS(s,_,R.is&&R),a&&(X.__m&&X.__m(e,n),a=!1),n=null}if(_==null)O===R||a&&i.data==R||(i.data=R);else{if(n=n&&Ks.call(i.childNodes),!a&&n!=null)for(O={},h=0;h<i.attributes.length;h++)O[(y=i.attributes[h]).name]=y.value;for(h in O)if(y=O[h],h!="children"){if(h=="dangerouslySetInnerHTML")m=y;else if(!(h in R)){if(h=="value"&&"defaultValue"in R||h=="checked"&&"defaultChecked"in R)continue;Ho(i,h,null,y,s)}}for(h in R)y=R[h],h=="children"?w=y:h=="dangerouslySetInnerHTML"?f=y:h=="value"?k=y:h=="checked"?C=y:a&&typeof y!="function"||O[h]===y||Ho(i,h,y,O[h],s);if(f)a||m&&(f.__html==m.__html||f.__html==i.innerHTML)||(i.innerHTML=f.__html),e.__k=[];else if(m&&(i.innerHTML=""),_p(e.type=="template"?i.content:i,Xs(w)?w:[w],e,t,r,_=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:t.__k&&es(t,0),a,l),n!=null)for(h=n.length;h--;)$c(n[h]);a||(h="value",_=="progress"&&k==null?i.removeAttribute("value"):k!=null&&(k!==i[h]||_=="progress"&&!k||_=="option"&&k!=O[h])&&Ho(i,h,k,O[h],s),h="checked",C!=null&&C!=i[h]&&Ho(i,h,C,O[h],s))}return i}function Wc(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){X.__e(s,t)}}function Pp(i,e,t){var r,s;if(X.unmount&&X.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||Wc(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){X.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&Pp(r[s],e,t||typeof i.type!="function");t||$c(i.__e),i.__c=i.__=i.__e=void 0}function pw(i,e,t){return this.constructor(i,t)}function Op(i,e,t){var r,s,n,o;e==document&&(e=document.documentElement),X.__&&X.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],o=[],Vc(e,i=(!r&&t||e).__k=ki(_e,null,[i]),s||Gs,Gs,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Ks.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,o),Cp(n,i,o)}function Ys(i,e,t){var r,s,n,o,a=pi({},i.props);for(n in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n]===void 0&&o!=null?o[n]:e[n];return arguments.length>2&&(a.children=arguments.length>3?Ks.call(arguments,2):t),Ws(i.type,a,r||i.key,s||i.ref,null)}Ks=xp.slice,X={__e:function(i,e,t,r){for(var s,n,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(i)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(i,r||{}),o=s.__d),o)return s.__E=s}catch(a){i=a}throw i}},wp=0,aw=function(i){return i!=null&&i.constructor===void 0},we.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=pi({},this.state),typeof i=="function"&&(i=i(pi({},t),this.props)),i&&pi(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),bp(this))},we.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),bp(this))},we.prototype.render=_e,br=[],Sp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ep=function(i,e){return i.__v.__b-e.__v.__b},jo.__r=0,Tp=/(PointerCapture)$|Capture$/i,qc=0,zc=vp(!1),Hc=vp(!0),lw=0;var Zs,Pe,Gc,Rp,Qs=0,zp=[],Ne=X,Lp=Ne.__b,Mp=Ne.__r,Ip=Ne.diffed,Dp=Ne.__c,Np=Ne.unmount,Bp=Ne.__;function Xc(i,e){Ne.__h&&Ne.__h(Pe,i,Qs||e),Qs=0;var t=Pe.__H||(Pe.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function Kt(i){return Qs=1,Hp(qp,i)}function Hp(i,e,t){var r=Xc(Zs++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):qp(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],h=r.t(l,a);l!==h&&(r.__N=[h,r.__[1]],r.__c.setState({}))}],r.__c=Pe,!Pe.__f)){var s=function(a,l,h){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(w){return!!w.__c});if(f.every(function(w){return!w.__N}))return!n||n.call(this,a,l,h);var m=r.__c.props!==a;return f.forEach(function(w){if(w.__N){var y=w.__[0];w.__=w.__N,w.__N=void 0,y!==w.__[0]&&(m=!0)}}),n&&n.call(this,a,l,h)||m};Pe.__f=!0;var n=Pe.shouldComponentUpdate,o=Pe.componentWillUpdate;Pe.componentWillUpdate=function(a,l,h){if(this.__e){var f=n;n=void 0,s(a,l,h),n=f}o&&o.call(this,a,l,h)},Pe.shouldComponentUpdate=s}return r.__N||r.__}function si(i,e){var t=Xc(Zs++,3);!Ne.__s&&jp(t.__H,e)&&(t.__=i,t.u=e,Pe.__H.__h.push(t))}function qi(i){return Qs=5,$i(function(){return{current:i}},[])}function $i(i,e){var t=Xc(Zs++,7);return jp(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function Vi(i,e){return Qs=8,$i(function(){return i},e)}function fw(){for(var i;i=zp.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach($o),i.__H.__h.forEach(Kc),i.__H.__h=[]}catch(e){i.__H.__h=[],Ne.__e(e,i.__v)}}Ne.__b=function(i){Pe=null,Lp&&Lp(i)},Ne.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Bp&&Bp(i,e)},Ne.__r=function(i){Mp&&Mp(i),Zs=0;var e=(Pe=i.__c).__H;e&&(Gc===Pe?(e.__h=[],Pe.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach($o),e.__h.forEach(Kc),e.__h=[],Zs=0)),Gc=Pe},Ne.diffed=function(i){Ip&&Ip(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(zp.push(e)!==1&&Rp===Ne.requestAnimationFrame||((Rp=Ne.requestAnimationFrame)||mw)(fw)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Gc=Pe=null},Ne.__c=function(i,e){e.some(function(t){try{t.__h.forEach($o),t.__h=t.__h.filter(function(r){return!r.__||Kc(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Ne.__e(r,t.__v)}}),Dp&&Dp(i,e)},Ne.unmount=function(i){Np&&Np(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{$o(r)}catch(s){e=s}}),t.__H=void 0,e&&Ne.__e(e,t.__v))};var Up=typeof requestAnimationFrame=="function";function mw(i){var e,t=function(){clearTimeout(r),Up&&cancelAnimationFrame(e),setTimeout(i)},r=setTimeout(t,35);Up&&(e=requestAnimationFrame(t))}function $o(i){var e=Pe,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Pe=e}function Kc(i){var e=Pe;i.__c=i.__(),Pe=e}function jp(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}function qp(i,e){return typeof e=="function"?e(i):e}function bw(i,e){for(var t in e)i[t]=e[t];return i}function $p(i,e){for(var t in i)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&i[r]!==e[r])return!0;return!1}function Vp(i,e){this.props=i,this.context=e}(Vp.prototype=new we).isPureReactComponent=!0,Vp.prototype.shouldComponentUpdate=function(i,e){return $p(this.props,i)||$p(this.state,e)};var Wp=X.__b;X.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),Wp&&Wp(i)};var dC=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var yw=X.__e;X.__e=function(i,e,t,r){if(i.then){for(var s,n=e;n=n.__;)if((s=n.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(i,e)}yw(i,e,t,r)};var Gp=X.unmount;function Jp(i,e,t){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),i.__c.__H=null),(i=bw({},i)).__c!=null&&(i.__c.__P===t&&(i.__c.__P=e),i.__c.__e=!0,i.__c=null),i.__k=i.__k&&i.__k.map(function(r){return Jp(r,e,t)})),i}function ef(i,e,t){return i&&t&&(i.__v=null,i.__k=i.__k&&i.__k.map(function(r){return ef(r,e,t)}),i.__c&&i.__c.__P===e&&(i.__e&&t.appendChild(i.__e),i.__c.__e=!0,i.__c.__P=t)),i}function Yc(){this.__u=0,this.o=null,this.__b=null}function tf(i){var e=i.__.__c;return e&&e.__a&&e.__a(i)}function Vo(){this.i=null,this.l=null}X.unmount=function(i){var e=i.__c;e&&e.__R&&e.__R(),e&&32&i.__u&&(i.type=null),Gp&&Gp(i)},(Yc.prototype=new we).__c=function(i,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=tf(r.__v),n=!1,o=function(){n||(n=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=ef(l,l.__c.__P,l.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),i.then(o,o)},Yc.prototype.componentWillUnmount=function(){this.o=[]},Yc.prototype.render=function(i,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Jp(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&ki(_e,null,i.fallback);return s&&(s.__u&=-33),[ki(_e,null,e.__a?null:i.children),s]};var Kp=function(i,e,t){if(++t[1]===t[0]&&i.l.delete(e),i.props.revealOrder&&(i.props.revealOrder[0]!=="t"||!i.l.size))for(t=i.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;i.i=t=t[2]}};(Vo.prototype=new we).__a=function(i){var e=this,t=tf(e.__v),r=e.l.get(i);return r[0]++,function(s){var n=function(){e.props.revealOrder?(r.push(s),Kp(e,i,r)):s()};t?t(n):n()}},Vo.prototype.render=function(i){this.i=null,this.l=new Map;var e=wt(i.children);i.revealOrder&&i.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return i.children},Vo.prototype.componentDidUpdate=Vo.prototype.componentDidMount=function(){var i=this;this.l.forEach(function(e,t){Kp(i,t,e)})};var vw=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ww=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Sw=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ew=/[A-Z0-9]/g,Tw=typeof document<"u",xw=function(i){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(i)};function Zc(i,e,t){return e.__k==null&&(e.textContent=""),Op(i,e),typeof t=="function"&&t(),i?i.__c:null}we.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(we.prototype,i,{configurable:!0,get:function(){return this["UNSAFE_"+i]},set:function(e){Object.defineProperty(this,i,{configurable:!0,writable:!0,value:e})}})});var Xp=X.event;function kw(){}function _w(){return this.cancelBubble}function Aw(){return this.defaultPrevented}X.event=function(i){return Xp&&(i=Xp(i)),i.persist=kw,i.isPropagationStopped=_w,i.isDefaultPrevented=Aw,i.nativeEvent=i};var rf,Cw={enumerable:!1,configurable:!0,get:function(){return this.class}},Yp=X.vnode;X.vnode=function(i){typeof i.type=="string"&&(function(e){var t=e.props,r=e.type,s={},n=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||Tw&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||xw(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Sw.test(o)&&(o=l):l=o="oninput":n&&ww.test(o)?o=o.replace(Ew,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=wt(t.children).forEach(function(h){h.props.selected=s.value.indexOf(h.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=wt(t.children).forEach(function(h){h.props.selected=s.multiple?s.defaultValue.indexOf(h.props.value)!=-1:s.defaultValue==h.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",Cw)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s})(i),i.$$typeof=vw,Yp&&Yp(i)};var Zp=X.__r;X.__r=function(i){Zp&&Zp(i),rf=i.__c};var Qp=X.diffed;X.diffed=function(i){Qp&&Qp(i);var e=i.props,t=i.__e;t!=null&&i.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),rf=null};function Fw(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}var Qc=class i extends ji{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof i||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:i}}));else if(typeof e=="function"){let r=e;this.uppy.iteratePlugins(s=>{s instanceof r&&(t=s)})}return t}mount(e,t){let r=t.id,s=mp(e);if(s){this.isTargetDOMEl=!0;let a=document.createElement("div");return a.classList.add("uppy-Root"),this.#e=Fw(l=>{this.uppy.getPlugin(this.id)&&(Zc(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),Zc(this.render(this.uppy.getState(),a),a),this.el=a,s.appendChild(a),a.dir=this.opts.direction||zo(a)||"ltr",this.onMount(),this.el}let n=this.getTargetPlugin(e);if(n)return this.uppy.log(`Installing ${r} to ${n.id}`),this.parent=n,this.el=n.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let o=`Invalid target option given to ${r}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){this.el!=null&&this.#e?.(e)}unmount(){this.isTargetDOMEl&&this.el?.remove(),this.onUnmount()}onMount(){}onUnmount(){}},ni=Qc;var sf={name:"@uppy/store-default",description:"The default simple object-based store for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-store"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"]};var Jc=class{static VERSION=sf.version;state={};#e=new Set;getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,this.#t(t,r,e)}subscribe(e){return this.#e.add(e),()=>{this.#e.delete(e)}}#t(...e){this.#e.forEach(t=>{t(...e)})}},nf=Jc;function yr(i){let e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}var eu={__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:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Js(i){if(i.type)return i.type;let e=i.name?yr(i.name).extension?.toLowerCase():null;return e&&e in eu?eu[e]:"application/octet-stream"}function Ow(i){return i.charCodeAt(0).toString(32)}function of(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Ow(t)}`,"/"))+e}function af(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${of(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${of(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function Rw(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Wo(i,e){if(Rw(i))return i.id;let t=Js(i);return af({...i,type:t},e)}var Jf=ye(zf(),1),em=ye(jf(),1);var k1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Wi=(i=21)=>{let e="",t=i|0;for(;t--;)e+=k1[Math.random()*64|0];return e};var qf={name:"@uppy/core",description:"Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/store-default":"^4.3.2","@uppy/utils":"^6.2.2",lodash:"^4.17.21","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.0.9",preact:"^10.5.13"},devDependencies:{"@types/deep-freeze":"^0",cssnano:"^7.0.7","deep-freeze":"^0.0.1",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};function nu(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}var $f={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var tn=ye(Ko(),1),Zf=ye(Yf(),1),Qf={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},St=class extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0},Xo=class{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{let r=e();if(r.restrictions?.allowedFileTypes!=null&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(o=>!o.isGhost).length+t.length>s)throw new St(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((o,a)=>o+(a.size??0),0);if(n>r)throw new St(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,tn.default)(r),size:(0,tn.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(o=>o.includes("/")?e.type?(0,Zf.default)(e.type.replace(/;.*?$/,""),o):!1:o[0]==="."&&e.extension?e.extension.toLowerCase()===o.slice(1).toLowerCase():!1)){let o=s.join(", ");throw new St(this.getI18n()("youCanOnlyUploadFileTypes",{types:o}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new St(this.getI18n()("exceedsSize",{size:(0,tn.default)(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new St(this.getI18n()("inferiorSize",{size:(0,tn.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new St(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new St(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:r}=this.getOpts().restrictions,s=[];for(let n of r)(!Object.hasOwn(e.meta,n)||e.meta[n]==="")&&s.push(n);return{missingFields:s,error:t}}};function ou(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;let e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;let r=e[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||s===15&&n<15063||s>18||s===18&&n>=18218}var Yo={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},au=class i{static VERSION=qf.version;#e=Object.create(null);#t;#i;#r=(0,em.default)();#s=new Set;#o=new Set;#n=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=$f;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Qf,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new nf,logger:pp,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e?.restrictions}},e?.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e?.debug&&(this.opts.logger=fp),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Yo,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:ou(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new Xo(()=>this.opts,()=>this.i18n),this.#i=this.store.subscribe((s,n,o)=>{this.emit("state-update",s,n,o),this.updateAll(n)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),this.#S()}emit(e,...t){this.#r.emit(e,...t)}on(e,t){return this.#r.on(e,t),this}once(e,t){return this.#r.once(e,t),this}off(e,t){return this.#r.off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){let t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(([r,s])=>[r,{...t[r],...s}]))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can\u2019t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){let e=r=>this.log(`Missing i18n string: ${r}`,"error"),t=new gr([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){let e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...Yo})}clear(){let{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Yo,files:{}})}addPreProcessor(e){this.#s.add(e)}removePreProcessor(e){return this.#s.delete(e)}addPostProcessor(e){this.#n.add(e)}removePostProcessor(e){return this.#n.delete(e)}addUploader(e){this.#o.add(e)}removeUploader(e){return this.#o.delete(e)}setMeta(e){let t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(s=>{r[s]={...r[s],meta:{...r[s].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){let r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}let s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){let{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){let{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],o=[],a=[],l=[],h=[],f=[],m=[],w=[],y=[];for(let k of s){let{progress:C}=k;!C.uploadComplete&&C.uploadStarted&&(n.push(k),k.isPaused||w.push(k)),C.uploadStarted||o.push(k),(C.uploadStarted||C.preprocess||C.postprocess)&&a.push(k),C.uploadStarted&&l.push(k),k.isPaused&&h.push(k),C.uploadComplete&&f.push(k),k.error&&m.push(k),(C.preprocess||C.postprocess)&&y.push(k)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:h,completeFiles:f,erroredFiles:m,inProgressFiles:n,inProgressNotPausedFiles:w,processingFiles:y,isUploadStarted:l.length>0,isAllComplete:t===100&&f.length===s.length&&y.length===0,isAllErrored:!!r&&m.length===s.length,isAllPaused:n.length!==0&&h.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(k=>k.isGhost)}}#l(e){for(let o of e)o.isRestriction?this.emit("restriction-failed",o.file,o):this.emit("error",o,o.file),this.log(o,"warning");let t=e.filter(o=>o.isUserFacing),r=4,s=t.slice(0,r),n=t.slice(r);s.forEach(({message:o,details:a=""})=>{this.info({message:o,details:a},"error",this.opts.infoTimeout)}),n.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:n.length})})}validateRestrictions(e,t=this.getFiles()){try{this.#t.validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{this.#t.validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{this.#t.validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}#a(e){let{missingFields:t,error:r}=this.#t.getMissingRequiredMetaFields(e);return t.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:t,error:r.message}),this.log(r.message),this.emit("restriction-failed",e,r),!1):(t.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)}#h(e){let t=!0;for(let r of Object.values(e))this.#a(r)||(t=!1);return t}#c(e){let{allowNewUpload:t}=this.getState();if(t===!1){let r=new St(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#l([r]),r}}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}#d(e){let t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,r=Js(t),s=nu(r,t),n=yr(s).extension,o=Wo(t,this.getID()),a=t.meta||{};a.name=s,a.type=r;let l=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:o,name:s,extension:n||"",meta:{...this.getState().meta,...a},type:r,data:t.data,progress:{percentage:0,bytesUploaded:!1,bytesTotal:l,uploadComplete:!1,uploadStarted:null},size:l,isGhost:!1,isRemote:t.isRemote||!1,remote:t.remote,preview:t.preview}}#u(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}#f(e){let{files:t}=this.getState(),r={...t},s=[],n=[];for(let o of e)try{let a=this.#d(o),l=t[a.id]?.isGhost;l&&(a={...t[a.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${a.name}, ${a.id}`));let h=this.opts.onBeforeFileAdded(a,r);if(t=this.getState().files,r={...t,...r},!h&&this.checkIfFileAlreadyExists(a.id))throw new St(this.i18n("noDuplicates",{fileName:a.name??this.i18n("unnamed")}),{file:o});if(h===!1&&!l)throw new St("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});typeof h=="object"&&h!==null&&(a=h),this.#t.validateSingleFile(a),r[a.id]=a,s.push(a)}catch(a){n.push(a)}try{this.#t.validateAggregateRestrictions(Object.values(t),s)}catch(o){return n.push(o),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}addFile(e){this.#c(e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#f([e]),n=s.filter(a=>a.isRestriction);if(this.#l(n),s.length>0)throw s[0];this.setState({files:t});let[o]=r;return this.emit("file-added",o),this.emit("files-added",r),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),this.#u(),o.id}addFiles(e){this.#c();let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#f(e),n=s.filter(a=>a.isRestriction);this.#l(n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
88
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+di(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},fr=new Pc;function le(i,e){return fr.parse(i,e)}le.options=le.setOptions=function(i){return fr.setOptions(i),le.defaults=fr.defaults,tp(le.defaults),le};le.getDefaults=Oc;le.defaults=mr;le.use=function(...i){return fr.use(...i),le.defaults=fr.defaults,tp(le.defaults),le};le.walkTokens=function(i,e){return fr.walkTokens(i,e)};le.parseInline=fr.parseInline;le.Parser=ri;le.parser=ri.parse;le.Renderer=Qr;le.TextRenderer=qs;le.Lexer=ii;le.lexer=ii.lex;le.Tokenizer=Zr;le.Hooks=Yr;le.parse=le;var bA=le.options,yA=le.setOptions,vA=le.use,wA=le.walkTokens,SA=le.parseInline;var EA=ri.parse,TA=ii.lex;var Mo=class extends V{static targets=["textarea"];connect(){this.easyMDE||(this.originalValue=this.element.value,this.easyMDE=new EasyMDE(this.#t()),this.element.addEventListener("turbo:before-morph-element",i=>{i.target===this.element&&this.easyMDE&&(this.storedValue=this.easyMDE.value())}),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&requestAnimationFrame(()=>this.#e())}))}disconnect(){if(this.easyMDE){try{this.element.isConnected&&this.element.parentNode&&this.easyMDE.toTextArea()}catch(i){console.warn("EasyMDE cleanup error:",i)}this.easyMDE=null}}#e(){this.element.isConnected&&(this.easyMDE&&(this.easyMDE=null),this.easyMDE=new EasyMDE(this.#t()),this.storedValue!==void 0&&(this.easyMDE.value(this.storedValue),this.storedValue=void 0))}#t(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Xr.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=le(t);return Xr.sanitize(r,{USE_PROFILES:{html:!0}})}};return this.element.attributes.id.value&&(i.autosave={enabled:!0,uniqueId:this.element.attributes.id.value,delay:1e3}),i}};var Io=class extends V{static values={typeaheadUrl:String,typeaheadDebounceMs:{type:Number,default:200}};connect(){this.slimSelect||(this.#e(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#r(),this.morphing=!1}))}))}#e(){let i={};if(document.querySelector('[data-controller="remote-modal"]')){this.dropdownContainer=document.createElement("div"),this.dropdownContainer.className="ss-dropdown-container";let r=this.element.parentNode;getComputedStyle(r).position==="static"&&(r.style.position="relative",this.modifiedSelectWrapper=r),this.element.parentNode.insertBefore(this.dropdownContainer,this.element.nextSibling),i.contentLocation=this.dropdownContainer,i.contentPosition="absolute",i.openPosition="auto"}let t={};this.hasTypeaheadUrlValue&&this.typeaheadUrlValue&&(t.search=(r,s)=>this.#t(r,s)),this.slimSelect=new SlimSelect({select:this.element,settings:i,events:t}),this.handleDropdownPosition(),this.boundHandleDropdownOpen=this.handleDropdownOpen.bind(this),this.boundHandleDropdownClose=this.handleDropdownClose.bind(this),this.element.addEventListener("ss:open",this.boundHandleDropdownOpen),this.element.addEventListener("ss:close",this.boundHandleDropdownClose),this.setupAriaObserver()}handleDropdownPosition(){if(this.dropdownContainer){let i=()=>{let e=this.element.getBoundingClientRect(),t=window.innerHeight-e.bottom,r=e.top;t<200&&r>t?(this.dropdownContainer.style.top="auto",this.dropdownContainer.style.bottom="100%",this.dropdownContainer.style.borderRadius="0.375rem 0.375rem 0 0"):(this.dropdownContainer.style.bottom="auto",this.dropdownContainer.style.borderRadius="0 0 0.375rem 0.375rem")};setTimeout(i,0),window.addEventListener("resize",i),window.addEventListener("scroll",i),this.repositionDropdown=i}}handleDropdownOpen(){this.dropdownContainer&&(this.dropdownContainer.style.height="auto",this.dropdownContainer.style.overflow="visible",this.dropdownContainer.classList.add("ss-active"),document.querySelectorAll(".ss-dropdown-container").forEach(e=>{e!==this.dropdownContainer&&(e.style.zIndex="9999")}),this.dropdownContainer.style.zIndex="10000")}handleDropdownClose(){this.dropdownContainer&&this.dropdownContainer.classList.remove("ss-active")}setupAriaObserver(){if(this.element){this.ariaObserver=new MutationObserver(t=>{t.forEach(r=>{r.attributeName==="aria-expanded"&&(r.target.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())})});let e=[this.element,this.element.parentNode.querySelector(".ss-main"),this.element.parentNode.querySelector("[aria-expanded]")].find(t=>t&&t.hasAttribute&&t.hasAttribute("aria-expanded"));e&&(this.ariaObserver.observe(e,{attributes:!0,attributeFilter:["aria-expanded"]}),e.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())}}disconnect(){this.#s()}#t(i,e){return this._typeaheadDebounce&&clearTimeout(this._typeaheadDebounce),this._typeaheadAbort&&this._typeaheadAbort.abort(),new Promise(t=>{this._typeaheadDebounce=setTimeout(()=>{this._typeaheadAbort=new AbortController,this.#i(i,this._typeaheadAbort.signal).then(t)},this.typeaheadDebounceMsValue)})}async#i(i,e){let t=new URL(this.typeaheadUrlValue,window.location.origin);t.searchParams.set("q",i||"");try{let r=await fetch(t.toString(),{headers:{Accept:"application/json"},signal:e});if(!r.ok)return"Search failed";let s=await r.json();return(Array.isArray(s.results)?s.results:[]).map(o=>({value:String(o.value??""),text:String(o.label??"")}))}catch(r){return r.name==="AbortError"?[]:(console.warn("[slim-select] typeahead error",r),"Search failed")}}#r(){this.element.isConnected&&(this.#s(),this.#e())}#s(){this.element&&(this.boundHandleDropdownOpen&&this.element.removeEventListener("ss:open",this.boundHandleDropdownOpen),this.boundHandleDropdownClose&&this.element.removeEventListener("ss:close",this.boundHandleDropdownClose)),this.ariaObserver&&(this.ariaObserver.disconnect(),this.ariaObserver=null),this.slimSelect&&(this.slimSelect.destroy(),this.slimSelect=null),this.repositionDropdown&&(window.removeEventListener("resize",this.repositionDropdown),window.removeEventListener("scroll",this.repositionDropdown),this.repositionDropdown=null),this.dropdownContainer&&this.dropdownContainer.parentNode&&(this.dropdownContainer.parentNode.removeChild(this.dropdownContainer),this.dropdownContainer=null),this.modifiedSelectWrapper&&(this.modifiedSelectWrapper.style.position="",this.modifiedSelectWrapper=null)}};var Do=class extends V{connect(){this.picker||(this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.picker&&(this.picker.destroy(),this.picker=null)}#e(){this.element.isConnected&&(this.picker&&(this.picker.destroy(),this.picker=null),this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()))}#t(){let i={altInput:!0};return this.element.attributes.type.value=="datetime-local"?i.enableTime=!0:this.element.attributes.type.value=="time"&&(i.enableTime=!0,i.noCalendar=!0),this.modal&&(i.appendTo=this.modal,i.position=e=>{let r=(e.altInput||e.input).getBoundingClientRect(),s=this.modal.getBoundingClientRect(),n=e.calendarContainer,o=n.offsetHeight,l=window.innerHeight-r.bottom<o&&r.top>o,h=l?r.top-s.top-o-2:r.bottom-s.top+2;n.style.top=`${h}px`,n.style.left=`${r.left-s.left}px`,n.style.right="auto",n.classList.toggle("arrowTop",!l),n.classList.toggle("arrowBottom",l)}),i}};var No=class extends V{static targets=["input"];connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){!this.hasInputTarget||this.iti||(this.iti=window.intlTelInput(this.inputTarget,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}inputTargetDisconnected(){this.iti&&(this.iti.destroy(),this.iti=null)}#e(){!this.inputTarget||!this.inputTarget.isConnected||(this.iti&&(this.iti.destroy(),this.iti=null),this.iti=window.intlTelInput(this.inputTarget,this.#t()))}#t(){return{strictMode:!0,hiddenInput:()=>({phone:this.inputTarget.attributes.name.value}),loadUtilsOnInit:"https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/utils.js"}}};var Bo=class extends V{static targets=["select"];navigate(i){let e=this.selectTarget.value,t=document.createElement("a");t.href=e,this.element.appendChild(t),t.click(),t.remove()}};var Uo=class extends V{static targets=["btn","tab"];static values={defaultTab:String,activeClasses:String,inActiveClasses:String};connect(){this.activeClasses=this.hasActiveClassesValue?this.activeClassesValue.split(" "):[],this.inActiveClasses=this.hasInActiveClassesValue?this.inActiveClassesValue.split(" "):[];let e=this.#t()||this.defaultTabValue||this.btnTargets[0]?.id;this.#e(e,{skipFocus:!0,skipHashUpdate:!0}),this._syncFromHash=this._syncFromHash.bind(this),window.addEventListener("hashchange",this._syncFromHash),document.addEventListener("turbo:load",this._syncFromHash)}disconnect(){this._syncFromHash&&(window.removeEventListener("hashchange",this._syncFromHash),document.removeEventListener("turbo:load",this._syncFromHash))}_syncFromHash(){let i=this.#t();i&&this.#e(i,{skipFocus:!0,skipHashUpdate:!0})}select(i){this.#e(i.currentTarget.id)}#e(i,e={}){let t=this.btnTargets.find(s=>s.id===i);if(!t){console.error(`Tab Button with id "${i}" not found`);return}let r=this.tabTargets.find(s=>s.id===t.dataset.target);if(!r){console.error(`Tab Panel with id "${t.dataset.target}" not found`);return}this.tabTargets.forEach(s=>{s.hidden=!0,s.setAttribute("aria-hidden","true")}),this.btnTargets.forEach(s=>{s.setAttribute("aria-selected","false"),s.setAttribute("tabindex","-1"),s.classList.remove(...this.activeClasses),s.classList.add(...this.inActiveClasses)}),t.setAttribute("aria-selected","true"),t.setAttribute("tabindex","0"),t.classList.remove(...this.inActiveClasses),t.classList.add(...this.activeClasses),r.hidden=!1,r.setAttribute("aria-hidden","false"),e.skipHashUpdate||this.#i(i),!e.skipFocus&&t!==document.activeElement&&t.focus()}#t(){let i=window.location.hash.replace(/^#/,"");if(!i)return null;let e=`${i}-tab`;return this.btnTargets.some(r=>r.id===e)?e:null}#i(i){let t=`#${i.replace(/-tab$/,"")}`;window.location.hash!==t&&history.replaceState(null,"",t)}};function rw(i,e,t){let r=[];return i.forEach(s=>typeof s!="string"?r.push(s):e[Symbol.split](s).forEach((n,o,a)=>{n!==""&&r.push(n),o<a.length-1&&r.push(t)})),r}function dp(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let o=e[n];typeof o=="string"&&(o=t[Symbol.replace](o,r)),s=rw(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var sw=i=>{throw new Error(`missing string: ${i}`)},gr=class{locale;constructor(e,{onMissingKey:t=sw}={}){this.locale={strings:{},pluralize(r){return r===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(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 r=this.locale.strings[e];if(r==null&&(this.#e(e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return dp(r[n],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return dp(r,t)}};var ji=class{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){let{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){let{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){let e=new gr([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}};function Uc(i){return i<10?`0${i}`:i.toString()}function Jr(){let i=new Date,e=Uc(i.getHours()),t=Uc(i.getMinutes()),r=Uc(i.getSeconds());return`${e}:${t}:${r}`}var pp={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Jr()}]`,...i)},fp={debug:(...i)=>console.debug(`[Uppy] [${Jr()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Jr()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Jr()}]`,...i)};function Vs(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function nw(i,e=document){return typeof i=="string"?e.querySelector(i):Vs(i)?i:null}var mp=nw;function ow(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}var zo=ow;var Ks,X,wp,aw,br,gp,Sp,Ep,Tp,qc,zc,Hc,lw,Gs={},xp=[],cw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Xs=Array.isArray;function pi(i,e){for(var t in e)i[t]=e[t];return i}function $c(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function ki(i,e,t){var r,s,n,o={};for(n in e)n=="key"?r=e[n]:n=="ref"?s=e[n]:o[n]=e[n];if(arguments.length>2&&(o.children=arguments.length>3?Ks.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(n in i.defaultProps)o[n]===void 0&&(o[n]=i.defaultProps[n]);return Ws(i,o,r,s,null)}function Ws(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++wp,__i:-1,__u:0};return s==null&&X.vnode!=null&&X.vnode(n),n}function qo(){return{current:null}}function _e(i){return i.children}function we(i,e){this.props=i,this.context=e}function es(i,e){if(e==null)return i.__?es(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?es(i):null}function kp(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return kp(i)}}function bp(i){(!i.__d&&(i.__d=!0)&&br.push(i)&&!jo.__r++||gp!=X.debounceRendering)&&((gp=X.debounceRendering)||Sp)(jo)}function jo(){for(var i,e,t,r,s,n,o,a=1;br.length;)br.length>a&&br.sort(Ep),i=br.shift(),a=br.length,i.__d&&(t=void 0,r=void 0,s=(r=(e=i).__v).__e,n=[],o=[],e.__P&&((t=pi({},r)).__v=r.__v+1,X.vnode&&X.vnode(t),Vc(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??es(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,Cp(n,t,o),r.__e=r.__=null,t.__e!=s&&kp(t)));jo.__r=0}function _p(i,e,t,r,s,n,o,a,l,h,f){var m,w,y,k,C,O,R,_=r&&r.__k||xp,F=e.length;for(l=uw(t,e,_,l,F),m=0;m<F;m++)(y=t.__k[m])!=null&&(w=y.__i==-1?Gs:_[y.__i]||Gs,y.__i=m,O=Vc(i,y,w,s,n,o,a,l,h,f),k=y.__e,y.ref&&w.ref!=y.ref&&(w.ref&&Wc(w.ref,null,y),f.push(y.ref,y.__c||k,y)),C==null&&k!=null&&(C=k),(R=!!(4&y.__u))||w.__k===y.__k?l=Ap(y,l,i,R):typeof y.type=="function"&&O!==void 0?l=O:k&&(l=k.nextSibling),y.__u&=-7);return t.__e=C,l}function uw(i,e,t,r,s){var n,o,a,l,h,f=t.length,m=f,w=0;for(i.__k=new Array(s),n=0;n<s;n++)(o=e[n])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[n]=Ws(null,o,null,null,null):Xs(o)?o=i.__k[n]=Ws(_e,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[n]=Ws(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[n]=o,l=n+w,o.__=i,o.__b=i.__b+1,a=null,(h=o.__i=hw(o,t,l,m))!=-1&&(m--,(a=t[h])&&(a.__u|=2)),a==null||a.__v==null?(h==-1&&(s>f?w--:s<f&&w++),typeof o.type!="function"&&(o.__u|=4)):h!=l&&(h==l-1?w--:h==l+1?w++:(h>l?w--:w++,o.__u|=4))):i.__k[n]=null;if(m)for(n=0;n<f;n++)(a=t[n])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=es(a)),Pp(a,a));return r}function Ap(i,e,t,r){var s,n;if(typeof i.type=="function"){for(s=i.__k,n=0;s&&n<s.length;n++)s[n]&&(s[n].__=i,e=Ap(s[n],e,t,r));return e}i.__e!=e&&(r&&(e&&i.type&&!e.parentNode&&(e=es(i)),t.insertBefore(i.__e,e||null)),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function wt(i,e){return e=e||[],i==null||typeof i=="boolean"||(Xs(i)?i.some(function(t){wt(t,e)}):e.push(i)),e}function hw(i,e,t,r){var s,n,o,a=i.key,l=i.type,h=e[t],f=h!=null&&(2&h.__u)==0;if(h===null&&a==null||f&&a==h.key&&l==h.type)return t;if(r>(f?1:0)){for(s=t-1,n=t+1;s>=0||n<e.length;)if((h=e[o=s>=0?s--:n++])!=null&&(2&h.__u)==0&&a==h.key&&l==h.type)return o}return-1}function yp(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||cw.test(e)?t:t+"px"}function Ho(i,e,t,r,s){var n,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||yp(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||yp(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(Tp,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.u=r.u:(t.u=qc,i.addEventListener(e,n?Hc:zc,n)):i.removeEventListener(e,n?Hc:zc,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function vp(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=qc++;else if(e.t<t.u)return;return t(X.event?X.event(e):e)}}}function Vc(i,e,t,r,s,n,o,a,l,h){var f,m,w,y,k,C,O,R,_,F,x,S,A,P,N,z,q,$=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),n=[a=e.__e=t.__e]),(f=X.__b)&&f(e);e:if(typeof $=="function")try{if(R=e.props,_="prototype"in $&&$.prototype.render,F=(f=$.contextType)&&r[f.__c],x=f?F?F.props.value:f.__:r,t.__c?O=(m=e.__c=t.__c).__=m.__E:(_?e.__c=m=new $(R,x):(e.__c=m=new we(R,x),m.constructor=$,m.render=pw),F&&F.sub(m),m.state||(m.state={}),m.__n=r,w=m.__d=!0,m.__h=[],m._sb=[]),_&&m.__s==null&&(m.__s=m.state),_&&$.getDerivedStateFromProps!=null&&(m.__s==m.state&&(m.__s=pi({},m.__s)),pi(m.__s,$.getDerivedStateFromProps(R,m.__s))),y=m.props,k=m.state,m.__v=e,w)_&&$.getDerivedStateFromProps==null&&m.componentWillMount!=null&&m.componentWillMount(),_&&m.componentDidMount!=null&&m.__h.push(m.componentDidMount);else{if(_&&$.getDerivedStateFromProps==null&&R!==y&&m.componentWillReceiveProps!=null&&m.componentWillReceiveProps(R,x),e.__v==t.__v||!m.__e&&m.shouldComponentUpdate!=null&&m.shouldComponentUpdate(R,m.__s,x)===!1){for(e.__v!=t.__v&&(m.props=R,m.state=m.__s,m.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(Z){Z&&(Z.__=e)}),S=0;S<m._sb.length;S++)m.__h.push(m._sb[S]);m._sb=[],m.__h.length&&o.push(m);break e}m.componentWillUpdate!=null&&m.componentWillUpdate(R,m.__s,x),_&&m.componentDidUpdate!=null&&m.__h.push(function(){m.componentDidUpdate(y,k,C)})}if(m.context=x,m.props=R,m.__P=i,m.__e=!1,A=X.__r,P=0,_){for(m.state=m.__s,m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),N=0;N<m._sb.length;N++)m.__h.push(m._sb[N]);m._sb=[]}else do m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),m.state=m.__s;while(m.__d&&++P<25);m.state=m.__s,m.getChildContext!=null&&(r=pi(pi({},r),m.getChildContext())),_&&!w&&m.getSnapshotBeforeUpdate!=null&&(C=m.getSnapshotBeforeUpdate(y,k)),z=f,f!=null&&f.type===_e&&f.key==null&&(z=Fp(f.props.children)),a=_p(i,Xs(z)?z:[z],e,t,r,s,n,o,a,l,h),m.base=e.__e,e.__u&=-161,m.__h.length&&o.push(m),O&&(m.__E=m.__=null)}catch(Z){if(e.__v=null,l||n!=null)if(Z.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;n[n.indexOf(a)]=null,e.__e=a}else{for(q=n.length;q--;)$c(n[q]);jc(e)}else e.__e=t.__e,e.__k=t.__k,Z.then||jc(e);X.__e(Z,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=dw(t.__e,e,t,r,s,n,o,l,h);return(f=X.diffed)&&f(e),128&e.__u?void 0:a}function jc(i){i&&i.__c&&(i.__c.__e=!0),i&&i.__k&&i.__k.forEach(jc)}function Cp(i,e,t){for(var r=0;r<t.length;r++)Wc(t[r],t[++r],t[++r]);X.__c&&X.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){X.__e(n,s.__v)}})}function Fp(i){return typeof i!="object"||i==null||i.__b&&i.__b>0?i:Xs(i)?i.map(Fp):pi({},i)}function dw(i,e,t,r,s,n,o,a,l){var h,f,m,w,y,k,C,O=t.props||Gs,R=e.props,_=e.type;if(_=="svg"?s="http://www.w3.org/2000/svg":_=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(h=0;h<n.length;h++)if((y=n[h])&&"setAttribute"in y==!!_&&(_?y.localName==_:y.nodeType==3)){i=y,n[h]=null;break}}if(i==null){if(_==null)return document.createTextNode(R);i=document.createElementNS(s,_,R.is&&R),a&&(X.__m&&X.__m(e,n),a=!1),n=null}if(_==null)O===R||a&&i.data==R||(i.data=R);else{if(n=n&&Ks.call(i.childNodes),!a&&n!=null)for(O={},h=0;h<i.attributes.length;h++)O[(y=i.attributes[h]).name]=y.value;for(h in O)if(y=O[h],h!="children"){if(h=="dangerouslySetInnerHTML")m=y;else if(!(h in R)){if(h=="value"&&"defaultValue"in R||h=="checked"&&"defaultChecked"in R)continue;Ho(i,h,null,y,s)}}for(h in R)y=R[h],h=="children"?w=y:h=="dangerouslySetInnerHTML"?f=y:h=="value"?k=y:h=="checked"?C=y:a&&typeof y!="function"||O[h]===y||Ho(i,h,y,O[h],s);if(f)a||m&&(f.__html==m.__html||f.__html==i.innerHTML)||(i.innerHTML=f.__html),e.__k=[];else if(m&&(i.innerHTML=""),_p(e.type=="template"?i.content:i,Xs(w)?w:[w],e,t,r,_=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:t.__k&&es(t,0),a,l),n!=null)for(h=n.length;h--;)$c(n[h]);a||(h="value",_=="progress"&&k==null?i.removeAttribute("value"):k!=null&&(k!==i[h]||_=="progress"&&!k||_=="option"&&k!=O[h])&&Ho(i,h,k,O[h],s),h="checked",C!=null&&C!=i[h]&&Ho(i,h,C,O[h],s))}return i}function Wc(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){X.__e(s,t)}}function Pp(i,e,t){var r,s;if(X.unmount&&X.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||Wc(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){X.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&Pp(r[s],e,t||typeof i.type!="function");t||$c(i.__e),i.__c=i.__=i.__e=void 0}function pw(i,e,t){return this.constructor(i,t)}function Op(i,e,t){var r,s,n,o;e==document&&(e=document.documentElement),X.__&&X.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],o=[],Vc(e,i=(!r&&t||e).__k=ki(_e,null,[i]),s||Gs,Gs,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Ks.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,o),Cp(n,i,o)}function Ys(i,e,t){var r,s,n,o,a=pi({},i.props);for(n in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n]===void 0&&o!=null?o[n]:e[n];return arguments.length>2&&(a.children=arguments.length>3?Ks.call(arguments,2):t),Ws(i.type,a,r||i.key,s||i.ref,null)}Ks=xp.slice,X={__e:function(i,e,t,r){for(var s,n,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(i)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(i,r||{}),o=s.__d),o)return s.__E=s}catch(a){i=a}throw i}},wp=0,aw=function(i){return i!=null&&i.constructor===void 0},we.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=pi({},this.state),typeof i=="function"&&(i=i(pi({},t),this.props)),i&&pi(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),bp(this))},we.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),bp(this))},we.prototype.render=_e,br=[],Sp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ep=function(i,e){return i.__v.__b-e.__v.__b},jo.__r=0,Tp=/(PointerCapture)$|Capture$/i,qc=0,zc=vp(!1),Hc=vp(!0),lw=0;var Zs,Pe,Gc,Rp,Qs=0,zp=[],Ne=X,Lp=Ne.__b,Mp=Ne.__r,Ip=Ne.diffed,Dp=Ne.__c,Np=Ne.unmount,Bp=Ne.__;function Xc(i,e){Ne.__h&&Ne.__h(Pe,i,Qs||e),Qs=0;var t=Pe.__H||(Pe.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function Kt(i){return Qs=1,Hp(qp,i)}function Hp(i,e,t){var r=Xc(Zs++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):qp(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],h=r.t(l,a);l!==h&&(r.__N=[h,r.__[1]],r.__c.setState({}))}],r.__c=Pe,!Pe.__f)){var s=function(a,l,h){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(w){return!!w.__c});if(f.every(function(w){return!w.__N}))return!n||n.call(this,a,l,h);var m=r.__c.props!==a;return f.forEach(function(w){if(w.__N){var y=w.__[0];w.__=w.__N,w.__N=void 0,y!==w.__[0]&&(m=!0)}}),n&&n.call(this,a,l,h)||m};Pe.__f=!0;var n=Pe.shouldComponentUpdate,o=Pe.componentWillUpdate;Pe.componentWillUpdate=function(a,l,h){if(this.__e){var f=n;n=void 0,s(a,l,h),n=f}o&&o.call(this,a,l,h)},Pe.shouldComponentUpdate=s}return r.__N||r.__}function si(i,e){var t=Xc(Zs++,3);!Ne.__s&&jp(t.__H,e)&&(t.__=i,t.u=e,Pe.__H.__h.push(t))}function qi(i){return Qs=5,$i(function(){return{current:i}},[])}function $i(i,e){var t=Xc(Zs++,7);return jp(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function Vi(i,e){return Qs=8,$i(function(){return i},e)}function fw(){for(var i;i=zp.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach($o),i.__H.__h.forEach(Kc),i.__H.__h=[]}catch(e){i.__H.__h=[],Ne.__e(e,i.__v)}}Ne.__b=function(i){Pe=null,Lp&&Lp(i)},Ne.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Bp&&Bp(i,e)},Ne.__r=function(i){Mp&&Mp(i),Zs=0;var e=(Pe=i.__c).__H;e&&(Gc===Pe?(e.__h=[],Pe.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach($o),e.__h.forEach(Kc),e.__h=[],Zs=0)),Gc=Pe},Ne.diffed=function(i){Ip&&Ip(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(zp.push(e)!==1&&Rp===Ne.requestAnimationFrame||((Rp=Ne.requestAnimationFrame)||mw)(fw)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Gc=Pe=null},Ne.__c=function(i,e){e.some(function(t){try{t.__h.forEach($o),t.__h=t.__h.filter(function(r){return!r.__||Kc(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Ne.__e(r,t.__v)}}),Dp&&Dp(i,e)},Ne.unmount=function(i){Np&&Np(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{$o(r)}catch(s){e=s}}),t.__H=void 0,e&&Ne.__e(e,t.__v))};var Up=typeof requestAnimationFrame=="function";function mw(i){var e,t=function(){clearTimeout(r),Up&&cancelAnimationFrame(e),setTimeout(i)},r=setTimeout(t,35);Up&&(e=requestAnimationFrame(t))}function $o(i){var e=Pe,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Pe=e}function Kc(i){var e=Pe;i.__c=i.__(),Pe=e}function jp(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}function qp(i,e){return typeof e=="function"?e(i):e}function bw(i,e){for(var t in e)i[t]=e[t];return i}function $p(i,e){for(var t in i)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&i[r]!==e[r])return!0;return!1}function Vp(i,e){this.props=i,this.context=e}(Vp.prototype=new we).isPureReactComponent=!0,Vp.prototype.shouldComponentUpdate=function(i,e){return $p(this.props,i)||$p(this.state,e)};var Wp=X.__b;X.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),Wp&&Wp(i)};var dC=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var yw=X.__e;X.__e=function(i,e,t,r){if(i.then){for(var s,n=e;n=n.__;)if((s=n.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(i,e)}yw(i,e,t,r)};var Gp=X.unmount;function Jp(i,e,t){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),i.__c.__H=null),(i=bw({},i)).__c!=null&&(i.__c.__P===t&&(i.__c.__P=e),i.__c.__e=!0,i.__c=null),i.__k=i.__k&&i.__k.map(function(r){return Jp(r,e,t)})),i}function ef(i,e,t){return i&&t&&(i.__v=null,i.__k=i.__k&&i.__k.map(function(r){return ef(r,e,t)}),i.__c&&i.__c.__P===e&&(i.__e&&t.appendChild(i.__e),i.__c.__e=!0,i.__c.__P=t)),i}function Yc(){this.__u=0,this.o=null,this.__b=null}function tf(i){var e=i.__.__c;return e&&e.__a&&e.__a(i)}function Vo(){this.i=null,this.l=null}X.unmount=function(i){var e=i.__c;e&&e.__R&&e.__R(),e&&32&i.__u&&(i.type=null),Gp&&Gp(i)},(Yc.prototype=new we).__c=function(i,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=tf(r.__v),n=!1,o=function(){n||(n=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=ef(l,l.__c.__P,l.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),i.then(o,o)},Yc.prototype.componentWillUnmount=function(){this.o=[]},Yc.prototype.render=function(i,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Jp(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&ki(_e,null,i.fallback);return s&&(s.__u&=-33),[ki(_e,null,e.__a?null:i.children),s]};var Kp=function(i,e,t){if(++t[1]===t[0]&&i.l.delete(e),i.props.revealOrder&&(i.props.revealOrder[0]!=="t"||!i.l.size))for(t=i.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;i.i=t=t[2]}};(Vo.prototype=new we).__a=function(i){var e=this,t=tf(e.__v),r=e.l.get(i);return r[0]++,function(s){var n=function(){e.props.revealOrder?(r.push(s),Kp(e,i,r)):s()};t?t(n):n()}},Vo.prototype.render=function(i){this.i=null,this.l=new Map;var e=wt(i.children);i.revealOrder&&i.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return i.children},Vo.prototype.componentDidUpdate=Vo.prototype.componentDidMount=function(){var i=this;this.l.forEach(function(e,t){Kp(i,t,e)})};var vw=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ww=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Sw=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ew=/[A-Z0-9]/g,Tw=typeof document<"u",xw=function(i){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(i)};function Zc(i,e,t){return e.__k==null&&(e.textContent=""),Op(i,e),typeof t=="function"&&t(),i?i.__c:null}we.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(we.prototype,i,{configurable:!0,get:function(){return this["UNSAFE_"+i]},set:function(e){Object.defineProperty(this,i,{configurable:!0,writable:!0,value:e})}})});var Xp=X.event;function kw(){}function _w(){return this.cancelBubble}function Aw(){return this.defaultPrevented}X.event=function(i){return Xp&&(i=Xp(i)),i.persist=kw,i.isPropagationStopped=_w,i.isDefaultPrevented=Aw,i.nativeEvent=i};var rf,Cw={enumerable:!1,configurable:!0,get:function(){return this.class}},Yp=X.vnode;X.vnode=function(i){typeof i.type=="string"&&(function(e){var t=e.props,r=e.type,s={},n=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||Tw&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||xw(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Sw.test(o)&&(o=l):l=o="oninput":n&&ww.test(o)?o=o.replace(Ew,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=wt(t.children).forEach(function(h){h.props.selected=s.value.indexOf(h.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=wt(t.children).forEach(function(h){h.props.selected=s.multiple?s.defaultValue.indexOf(h.props.value)!=-1:s.defaultValue==h.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",Cw)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s})(i),i.$$typeof=vw,Yp&&Yp(i)};var Zp=X.__r;X.__r=function(i){Zp&&Zp(i),rf=i.__c};var Qp=X.diffed;X.diffed=function(i){Qp&&Qp(i);var e=i.props,t=i.__e;t!=null&&i.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),rf=null};function Fw(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}var Qc=class i extends ji{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof i||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:i}}));else if(typeof e=="function"){let r=e;this.uppy.iteratePlugins(s=>{s instanceof r&&(t=s)})}return t}mount(e,t){let r=t.id,s=mp(e);if(s){this.isTargetDOMEl=!0;let a=document.createElement("div");return a.classList.add("uppy-Root"),this.#e=Fw(l=>{this.uppy.getPlugin(this.id)&&(Zc(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),Zc(this.render(this.uppy.getState(),a),a),this.el=a,s.appendChild(a),a.dir=this.opts.direction||zo(a)||"ltr",this.onMount(),this.el}let n=this.getTargetPlugin(e);if(n)return this.uppy.log(`Installing ${r} to ${n.id}`),this.parent=n,this.el=n.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let o=`Invalid target option given to ${r}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){this.el!=null&&this.#e?.(e)}unmount(){this.isTargetDOMEl&&this.el?.remove(),this.onUnmount()}onMount(){}onUnmount(){}},ni=Qc;var sf={name:"@uppy/store-default",description:"The default simple object-based store for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-store"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"]};var Jc=class{static VERSION=sf.version;state={};#e=new Set;getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,this.#t(t,r,e)}subscribe(e){return this.#e.add(e),()=>{this.#e.delete(e)}}#t(...e){this.#e.forEach(t=>{t(...e)})}},nf=Jc;function yr(i){let e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}var eu={__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:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Js(i){if(i.type)return i.type;let e=i.name?yr(i.name).extension?.toLowerCase():null;return e&&e in eu?eu[e]:"application/octet-stream"}function Ow(i){return i.charCodeAt(0).toString(32)}function of(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Ow(t)}`,"/"))+e}function af(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${of(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${of(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function Rw(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Wo(i,e){if(Rw(i))return i.id;let t=Js(i);return af({...i,type:t},e)}var Jf=ye(zf(),1),em=ye(jf(),1);var k1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Wi=(i=21)=>{let e="",t=i|0;for(;t--;)e+=k1[Math.random()*64|0];return e};var qf={name:"@uppy/core",description:"Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/store-default":"^4.3.2","@uppy/utils":"^6.2.2",lodash:"^4.17.21","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.0.9",preact:"^10.5.13"},devDependencies:{"@types/deep-freeze":"^0",cssnano:"^7.0.7","deep-freeze":"^0.0.1",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};function nu(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}var $f={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var tn=ye(Ko(),1),Zf=ye(Yf(),1),Qf={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},St=class extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0},Xo=class{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{let r=e();if(r.restrictions?.allowedFileTypes!=null&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(o=>!o.isGhost).length+t.length>s)throw new St(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((o,a)=>o+(a.size??0),0);if(n>r)throw new St(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,tn.default)(r),size:(0,tn.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(o=>o.includes("/")?e.type?(0,Zf.default)(e.type.replace(/;.*?$/,""),o):!1:o[0]==="."&&e.extension?e.extension.toLowerCase()===o.slice(1).toLowerCase():!1)){let o=s.join(", ");throw new St(this.getI18n()("youCanOnlyUploadFileTypes",{types:o}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new St(this.getI18n()("exceedsSize",{size:(0,tn.default)(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new St(this.getI18n()("inferiorSize",{size:(0,tn.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new St(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new St(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:r}=this.getOpts().restrictions,s=[];for(let n of r)(!Object.hasOwn(e.meta,n)||e.meta[n]==="")&&s.push(n);return{missingFields:s,error:t}}};function ou(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;let e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;let r=e[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||s===15&&n<15063||s>18||s===18&&n>=18218}var Yo={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},au=class i{static VERSION=qf.version;#e=Object.create(null);#t;#i;#r=(0,em.default)();#s=new Set;#o=new Set;#n=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=$f;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Qf,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new nf,logger:pp,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e?.restrictions}},e?.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e?.debug&&(this.opts.logger=fp),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Yo,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:ou(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new Xo(()=>this.opts,()=>this.i18n),this.#i=this.store.subscribe((s,n,o)=>{this.emit("state-update",s,n,o),this.updateAll(n)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),this.#S()}emit(e,...t){this.#r.emit(e,...t)}on(e,t){return this.#r.on(e,t),this}once(e,t){return this.#r.once(e,t),this}off(e,t){return this.#r.off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){let t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(([r,s])=>[r,{...t[r],...s}]))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can\u2019t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){let e=r=>this.log(`Missing i18n string: ${r}`,"error"),t=new gr([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){let e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...Yo})}clear(){let{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Yo,files:{}})}addPreProcessor(e){this.#s.add(e)}removePreProcessor(e){return this.#s.delete(e)}addPostProcessor(e){this.#n.add(e)}removePostProcessor(e){return this.#n.delete(e)}addUploader(e){this.#o.add(e)}removeUploader(e){return this.#o.delete(e)}setMeta(e){let t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(s=>{r[s]={...r[s],meta:{...r[s].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){let r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}let s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){let{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){let{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],o=[],a=[],l=[],h=[],f=[],m=[],w=[],y=[];for(let k of s){let{progress:C}=k;!C.uploadComplete&&C.uploadStarted&&(n.push(k),k.isPaused||w.push(k)),C.uploadStarted||o.push(k),(C.uploadStarted||C.preprocess||C.postprocess)&&a.push(k),C.uploadStarted&&l.push(k),k.isPaused&&h.push(k),C.uploadComplete&&f.push(k),k.error&&m.push(k),(C.preprocess||C.postprocess)&&y.push(k)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:h,completeFiles:f,erroredFiles:m,inProgressFiles:n,inProgressNotPausedFiles:w,processingFiles:y,isUploadStarted:l.length>0,isAllComplete:t===100&&f.length===s.length&&y.length===0,isAllErrored:!!r&&m.length===s.length,isAllPaused:n.length!==0&&h.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(k=>k.isGhost)}}#l(e){for(let o of e)o.isRestriction?this.emit("restriction-failed",o.file,o):this.emit("error",o,o.file),this.log(o,"warning");let t=e.filter(o=>o.isUserFacing),r=4,s=t.slice(0,r),n=t.slice(r);s.forEach(({message:o,details:a=""})=>{this.info({message:o,details:a},"error",this.opts.infoTimeout)}),n.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:n.length})})}validateRestrictions(e,t=this.getFiles()){try{this.#t.validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{this.#t.validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{this.#t.validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}#a(e){let{missingFields:t,error:r}=this.#t.getMissingRequiredMetaFields(e);return t.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:t,error:r.message}),this.log(r.message),this.emit("restriction-failed",e,r),!1):(t.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)}#d(e){let t=!0;for(let r of Object.values(e))this.#a(r)||(t=!1);return t}#c(e){let{allowNewUpload:t}=this.getState();if(t===!1){let r=new St(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#l([r]),r}}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}#h(e){let t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,r=Js(t),s=nu(r,t),n=yr(s).extension,o=Wo(t,this.getID()),a=t.meta||{};a.name=s,a.type=r;let l=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:o,name:s,extension:n||"",meta:{...this.getState().meta,...a},type:r,data:t.data,progress:{percentage:0,bytesUploaded:!1,bytesTotal:l,uploadComplete:!1,uploadStarted:null},size:l,isGhost:!1,isRemote:t.isRemote||!1,remote:t.remote,preview:t.preview}}#u(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}#f(e){let{files:t}=this.getState(),r={...t},s=[],n=[];for(let o of e)try{let a=this.#h(o),l=t[a.id]?.isGhost;l&&(a={...t[a.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${a.name}, ${a.id}`));let h=this.opts.onBeforeFileAdded(a,r);if(t=this.getState().files,r={...t,...r},!h&&this.checkIfFileAlreadyExists(a.id))throw new St(this.i18n("noDuplicates",{fileName:a.name??this.i18n("unnamed")}),{file:o});if(h===!1&&!l)throw new St("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});typeof h=="object"&&h!==null&&(a=h),this.#t.validateSingleFile(a),r[a.id]=a,s.push(a)}catch(a){n.push(a)}try{this.#t.validateAggregateRestrictions(Object.values(t),s)}catch(o){return n.push(o),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}addFile(e){this.#c(e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#f([e]),n=s.filter(a=>a.isRestriction);if(this.#l(n),s.length>0)throw s[0];this.setState({files:t});let[o]=r;return this.emit("file-added",o),this.emit("files-added",r),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),this.#u(),o.id}addFiles(e){this.#c();let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#f(e),n=s.filter(a=>a.isRestriction);this.#l(n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
89
89
  `;if(o.forEach(l=>{a+=`
90
90
  * ${l.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:o.length}),details:a},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(o,a);{let l=new Error(a);throw l.errors=o,l}}this.setState({files:t}),r.forEach(a=>{this.emit("file-added",a)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(a=>{this.log(`Added file: ${a.name}
91
91
  id: ${a.id}
92
92
  type: ${a.type}`)}),r.length>0&&this.#u()}removeFiles(e){let{files:t,currentUploads:r}=this.getState(),s={...t},n={...r},o=Object.create(null);e.forEach(f=>{t[f]&&(o[f]=t[f],delete s[f])});function a(f){return o[f]===void 0}Object.keys(n).forEach(f=>{let m=r[f].fileIDs.filter(a);if(m.length===0){delete n[f];return}let{capabilities:w}=this.getState();if(m.length!==r[f].fileIDs.length&&!w.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");n[f]={...r[f],fileIDs:m}});let l={currentUploads:n,files:s};Object.keys(s).length===0&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.#y();let h=Object.keys(o);h.forEach(f=>{this.emit("file-removed",o[f])}),h.length>5?this.log(`Removed ${h.length} files`):this.log(`Removed files: ${h.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;let t=this.getFile(e),s=!(t.isPaused||!1);return this.setFileState(e,{isPaused:s}),this.emit("upload-pause",t,s),s}pauseAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!0};e[r]=s}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!1,error:null};e[r]=s}),this.setState({files:e}),this.emit("resume-all")}#g(){let{files:e}=this.getState();return Object.keys(e).filter(t=>{let r=e[t];return r.error&&(!r.missingRequiredMetaFields||r.missingRequiredMetaFields.length===0)})}async#p(){let e=this.#g(),t={...this.getState().files};if(e.forEach(s=>{t[s]={...t[s],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};let r=this.#v(e,{forceAllowNewUpload:!0});return this.#k(r)}async retryAll(){let e=await this.#p();return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");let{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(Yo)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=this.#v([e],{forceAllowNewUpload:!0});return this.#k(t)}logout(){this.iteratePlugins(e=>{e.provider?.logout?.()})}#w=(e,t)=>{let r=e?this.getFile(e.id):void 0;if(e==null||!r){this.log(`Not setting progress for a file that has been removed: ${e?.id}`);return}if(r.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);return}let s={bytesTotal:t.bytesTotal,percentage:t.bytesTotal!=null&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};r.progress.uploadStarted!=null?this.setFileState(e.id,{progress:{...r.progress,...s,bytesUploaded:t.bytesUploaded}}):this.setFileState(e.id,{progress:{...r.progress,...s}}),this.#y()};#b(){let e=this.#T(),t=null;e!=null&&(t=Math.round(e*100),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})}#y=(0,Jf.default)(()=>this.#b(),500,{leading:!0,trailing:!0});[Symbol.for("uppy test: updateTotalProgress")](){return this.#b()}#T(){let t=this.getFiles().filter(l=>l.progress.uploadStarted||l.progress.preprocess||l.progress.postprocess);if(t.length===0)return 0;if(t.every(l=>l.progress.uploadComplete))return 1;let r=l=>l.progress.bytesTotal!=null&&l.progress.bytesTotal!==0,s=t.filter(r),n=t.filter(l=>!r(l));if(s.every(l=>l.progress.uploadComplete)&&n.length>0&&!n.every(l=>l.progress.uploadComplete))return null;let o=s.reduce((l,h)=>l+(h.progress.bytesTotal??0),0),a=s.reduce((l,h)=>l+(h.progress.bytesUploaded||0),0);return o===0?0:a/o}#S(){let e=(s,n,o)=>{let a=s.message||"Unknown error";s.details&&(a+=` ${s.details}`),this.setState({error:a}),n!=null&&n.id in this.getState().files&&this.setFileState(n.id,{error:a,response:o})};this.on("error",e),this.on("upload-error",(s,n,o)=>{if(e(n,s,o),typeof n=="object"&&n.message){this.log(n.message,"error");let a=new Error(this.i18n("failedToUpload",{file:s?.name??""}));a.isUserFacing=!0,a.details=n.message,n.details&&(a.details+=` ${n.details}`),this.#l([a])}else this.#l([n])});let t=null;this.on("upload-stalled",(s,n)=>{let{message:o}=s,a=n.map(l=>l.meta.name).join(", ");t||(this.info({message:o,details:a},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${o} ${a}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});let r=s=>{let n=s.filter(a=>{let l=a!=null&&this.getFile(a.id);return l||this.log(`Not setting progress for a file that has been removed: ${a?.id}`),l}),o=Object.fromEntries(n.map(a=>[a.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:a.size}}]));this.patchFilesState(o)};this.on("upload-start",r),this.on("upload-progress",this.#w),this.on("upload-success",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let o=this.getFile(s.id).progress;this.setFileState(s.id,{progress:{...o,postprocess:this.#n.size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:o.bytesTotal},response:n,uploadURL:n.uploadURL,isPaused:!1}),s.size==null&&this.setFileState(s.id,{size:n.bytesUploaded||o.bytesTotal}),this.#y()}),this.on("preprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getFile(s.id).progress,preprocess:n}})}),this.on("preprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.preprocess,this.setState({files:n})}),this.on("postprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getState().files[s.id].progress,postprocess:n}})}),this.on("postprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.postprocess,this.setState({files:n})}),this.on("restored",()=>{this.#y()}),this.on("dashboard:file-edit-complete",s=>{s&&this.#a(s)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",this.#m),window.addEventListener("offline",this.#m),setTimeout(this.#m,3e3))}updateOnlineStatus(){window.navigator.onLine??!0?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}#m=this.updateOnlineStatus.bind(this);getID(){return this.opts.id}use(e,...t){if(typeof e!="function"){let o=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(o)}let r=new e(this,...t),s=r.id;if(!s)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");let n=this.getPlugin(s);if(n){let o=`Already found a plugin named '${n.id}'. Tried to use: '${s}'.
93
- Uppy plugins must have unique \`id\` options.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),r.type in this.#e?this.#e[r.type].push(r):this.#e[r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(let t of Object.values(this.#e)){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return this.#e[e]}iteratePlugins(e){Object.values(this.#e).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=this.#e[e.type],r=t.findIndex(o=>o.id===e.id);r!==-1&&t.splice(r,1);let n={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(n)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),this.#i(),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",this.#m),window.removeEventListener("offline",this.#m))}hideInfo(){let{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t="info",r=3e3){let s=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){let{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}#x=new Map;registerRequestClient(e,t){this.#x.set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=this.#x.get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?this.#k(e):(this.#E(e),Promise.reject(new Error("Nonexistent upload")))}#v(e,t={}){let{forceAllowNewUpload:r=!1}=t,{allowNewUpload:s,currentUploads:n}=this.getState();if(!s&&!r)throw new Error("Cannot create a new upload: already uploading.");let o=Wi();return this.emit("upload",o,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...n,[o]:{fileIDs:e,step:0,result:{}}}}),o}[Symbol.for("uppy test: createUpload")](...e){return this.#v(...e)}#_(e){let{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#_(e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}let{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}#E(e){let t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async#k(e){let t=()=>{let{currentUploads:o}=this.getState();return o[e]},r=t(),s=[...this.#s,...this.#o,...this.#n];try{for(let o=r.step||0;o<s.length&&r;o++){let a=s[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:o}}});let{fileIDs:l}=r;await a(l,e),r=t()}}catch(o){throw this.#E(e),o}if(r){r.fileIDs.forEach(h=>{let f=this.getFile(h);f?.progress.postprocess&&this.emit("postprocess-complete",f)});let o=r.fileIDs.map(h=>this.getFile(h)),a=o.filter(h=>!h.error),l=o.filter(h=>h.error);this.addResultData(e,{successful:a,failed:l,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.#E(e)),n==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),n={successful:[],failed:[],uploadID:e}),n}async upload(){this.#e.uploader?.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(this.#g().length>0){let s=await this.#p();if(!(this.getFiles().filter(o=>o.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}let r=this.opts.onBeforeUpload(e);return r===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&typeof r=="object"&&(e=r,this.setState({files:e})),Promise.resolve().then(()=>this.#t.validateMinNumberOfFiles(e)).catch(s=>{throw this.#l([s]),s}).then(()=>{if(!this.#h(e))throw new St(this.i18n("missingRequiredMetaField"))}).catch(s=>{throw s}).then(async()=>{let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(h=>h.fileIDs),o=[];Object.keys(e).forEach(h=>{let f=this.getFile(h);!f.progress.uploadStarted&&n.indexOf(h)===-1&&o.push(f.id)});let a=this.#v(o),l=await this.#k(a);return this.emit("complete",l),l}).catch(s=>{throw this.emit("error",s),this.log(s,"error"),s}))}},Zo=au;var F1=0;function c(i,e,t,r,s,n){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var h={type:i,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--F1,__i:-1,__u:0,__source:s,__self:n};if(typeof i=="function"&&(o=i.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return X.vnode&&X.vnode(h),h}var tm={name:"@uppy/informer",description:"A notification and error pop-up bar for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","notification","bar","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var im=300,rn=class extends we{ref=qo();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,im)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,im)}render(){let{children:e}=this.props;return c("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function O1(i,e){return Object.assign(i,e)}function R1(i,e){return i?.key??e}function L1(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}function sn(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=R1(i[t],t.toString(36));e[r]=i[t]}return e}function M1(i,e){i=i||{},e=e||{};let t=o=>Object.hasOwn(e,o)?e[o]:i[o],r={},s=[];for(let o in i)Object.hasOwn(e,o)?s.length&&(r[o]=s,s=[]):s.push(o);let n={};for(let o in e){if(Object.hasOwn(r,o))for(let a=0;a<r[o].length;a++){let l=r[o][a];n[r[o][a]]=t(l)}n[o]=t(o)}for(let o=0;o<s.length;o++)n[s[o]]=t(s[o]);return n}var I1=i=>i,Qo=class extends we{constructor(e,t){super(e,t),this.refs={},this.state={children:sn(wt(wt(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=sn(wt(e.children)||[]),r=this.state.children;this.setState(n=>({children:M1(n.children,t)}));let s;for(s in t)if(Object.hasOwn(t,s)){let n=r&&Object.hasOwn(r,s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(Object.hasOwn(r,s)){let n=t&&Object.hasOwn(t,s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t?.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=sn(wt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t?.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=sn(wt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r?.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r?.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=sn(wt(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=O1({},this.state.children);delete n[e],this.setState({children:n})}}render({childFactory:e,transitionLeave:t,transitionName:r,transitionAppear:s,transitionEnter:n,transitionLeaveTimeout:o,transitionEnterTimeout:a,transitionAppearTimeout:l,component:h,...f},{children:m}){let w=Object.entries(m).map(([y,k])=>{if(!k)return;let C=L1(this,y);return Ys(e(k),{ref:C,key:y})}).filter(Boolean);return ki(h,f,w)}};Qo.defaultProps={component:"span",childFactory:I1};var rm=Qo;var ts=class extends ni{static VERSION=tm.version;constructor(e,t){super(e,t),this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}render=e=>c("div",{className:"uppy uppy-Informer",children:c(rm,{children:e.info.map(t=>c(rn,{children:c("p",{role:"alert",children:[t.message," ",t.details&&c("span",{"aria-label":t.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${t.message}
93
+ Uppy plugins must have unique \`id\` options.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),r.type in this.#e?this.#e[r.type].push(r):this.#e[r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(let t of Object.values(this.#e)){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return this.#e[e]}iteratePlugins(e){Object.values(this.#e).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=this.#e[e.type],r=t.findIndex(o=>o.id===e.id);r!==-1&&t.splice(r,1);let n={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(n)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),this.#i(),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",this.#m),window.removeEventListener("offline",this.#m))}hideInfo(){let{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t="info",r=3e3){let s=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){let{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}#x=new Map;registerRequestClient(e,t){this.#x.set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=this.#x.get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?this.#k(e):(this.#E(e),Promise.reject(new Error("Nonexistent upload")))}#v(e,t={}){let{forceAllowNewUpload:r=!1}=t,{allowNewUpload:s,currentUploads:n}=this.getState();if(!s&&!r)throw new Error("Cannot create a new upload: already uploading.");let o=Wi();return this.emit("upload",o,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...n,[o]:{fileIDs:e,step:0,result:{}}}}),o}[Symbol.for("uppy test: createUpload")](...e){return this.#v(...e)}#_(e){let{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#_(e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}let{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}#E(e){let t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async#k(e){let t=()=>{let{currentUploads:o}=this.getState();return o[e]},r=t(),s=[...this.#s,...this.#o,...this.#n];try{for(let o=r.step||0;o<s.length&&r;o++){let a=s[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:o}}});let{fileIDs:l}=r;await a(l,e),r=t()}}catch(o){throw this.#E(e),o}if(r){r.fileIDs.forEach(h=>{let f=this.getFile(h);f?.progress.postprocess&&this.emit("postprocess-complete",f)});let o=r.fileIDs.map(h=>this.getFile(h)),a=o.filter(h=>!h.error),l=o.filter(h=>h.error);this.addResultData(e,{successful:a,failed:l,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.#E(e)),n==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),n={successful:[],failed:[],uploadID:e}),n}async upload(){this.#e.uploader?.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(this.#g().length>0){let s=await this.#p();if(!(this.getFiles().filter(o=>o.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}let r=this.opts.onBeforeUpload(e);return r===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&typeof r=="object"&&(e=r,this.setState({files:e})),Promise.resolve().then(()=>this.#t.validateMinNumberOfFiles(e)).catch(s=>{throw this.#l([s]),s}).then(()=>{if(!this.#d(e))throw new St(this.i18n("missingRequiredMetaField"))}).catch(s=>{throw s}).then(async()=>{let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(h=>h.fileIDs),o=[];Object.keys(e).forEach(h=>{let f=this.getFile(h);!f.progress.uploadStarted&&n.indexOf(h)===-1&&o.push(f.id)});let a=this.#v(o),l=await this.#k(a);return this.emit("complete",l),l}).catch(s=>{throw this.emit("error",s),this.log(s,"error"),s}))}},Zo=au;var F1=0;function c(i,e,t,r,s,n){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var h={type:i,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--F1,__i:-1,__u:0,__source:s,__self:n};if(typeof i=="function"&&(o=i.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return X.vnode&&X.vnode(h),h}var tm={name:"@uppy/informer",description:"A notification and error pop-up bar for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","notification","bar","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var im=300,rn=class extends we{ref=qo();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,im)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,im)}render(){let{children:e}=this.props;return c("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function O1(i,e){return Object.assign(i,e)}function R1(i,e){return i?.key??e}function L1(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}function sn(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=R1(i[t],t.toString(36));e[r]=i[t]}return e}function M1(i,e){i=i||{},e=e||{};let t=o=>Object.hasOwn(e,o)?e[o]:i[o],r={},s=[];for(let o in i)Object.hasOwn(e,o)?s.length&&(r[o]=s,s=[]):s.push(o);let n={};for(let o in e){if(Object.hasOwn(r,o))for(let a=0;a<r[o].length;a++){let l=r[o][a];n[r[o][a]]=t(l)}n[o]=t(o)}for(let o=0;o<s.length;o++)n[s[o]]=t(s[o]);return n}var I1=i=>i,Qo=class extends we{constructor(e,t){super(e,t),this.refs={},this.state={children:sn(wt(wt(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=sn(wt(e.children)||[]),r=this.state.children;this.setState(n=>({children:M1(n.children,t)}));let s;for(s in t)if(Object.hasOwn(t,s)){let n=r&&Object.hasOwn(r,s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(Object.hasOwn(r,s)){let n=t&&Object.hasOwn(t,s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t?.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=sn(wt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t?.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=sn(wt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r?.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r?.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=sn(wt(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=O1({},this.state.children);delete n[e],this.setState({children:n})}}render({childFactory:e,transitionLeave:t,transitionName:r,transitionAppear:s,transitionEnter:n,transitionLeaveTimeout:o,transitionEnterTimeout:a,transitionAppearTimeout:l,component:h,...f},{children:m}){let w=Object.entries(m).map(([y,k])=>{if(!k)return;let C=L1(this,y);return Ys(e(k),{ref:C,key:y})}).filter(Boolean);return ki(h,f,w)}};Qo.defaultProps={component:"span",childFactory:I1};var rm=Qo;var ts=class extends ni{static VERSION=tm.version;constructor(e,t){super(e,t),this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}render=e=>c("div",{className:"uppy uppy-Informer",children:c(rm,{children:e.info.map(t=>c(rn,{children:c("p",{role:"alert",children:[t.message," ",t.details&&c("span",{"aria-label":t.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${t.message}
94
94
 
95
- ${t.details}`),children:"?"})]})},t.message))})});install(){let{target:e}=this.opts;e&&this.mount(e,this)}};function D1(){return c("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",children:c("g",{fill:"none","fill-rule":"evenodd",children:[c("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),c("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),c("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),c("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),c("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),c("path",{d:"M4 4h18v18H4z"})]})})}function N1({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=Vi(n=>{n.preventDefault(),t()},[t]);return c("form",{onSubmit:s,children:r?c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0,children:[c(D1,{}),e("signInWithGoogle")]}):c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0,children:e("authenticateWith",{pluginName:i})})})}var B1=({pluginName:i,i18n:e,onAuth:t})=>c(N1,{pluginName:i,i18n:e,onAuth:t});function Jo({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=B1}){return c("div",{className:"uppy-Provider-auth",children:[c("div",{className:"uppy-Provider-authIcon",children:t()}),c("div",{className:"uppy-Provider-authTitle",children:r("authenticateWithTitle",{pluginName:e})}),n({pluginName:e,i18n:r,loading:i,onAuth:s})]})}function nn(i){return{...i,type:i.mimeType,extension:i.name?yr(i.name).extension:null}}var wm=ye(ht(),1);var ta={name:"@uppy/provider-views",description:"View library for Uppy remote provider plugins.",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",classnames:"^2.2.6",nanoid:"^5.0.9","p-queue":"^8.0.0",preact:"^10.5.13"},devDependencies:{"@types/gapi":"^0.0.47","@types/google.accounts":"^0.0.14","@types/google.picker":"^0.0.42",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var z1={position:"relative",width:"100%",minHeight:"100%"},H1={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"},lu=class extends we{constructor(e){super(e),this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement?.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleScroll=()=>{this.setState({offset:this.base.scrollTop})};handleResize=()=>{this.resize()};resize(){let{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render({data:e,rowHeight:t,renderRow:r,overscanCount:s=10,...n}){let{offset:o,height:a}=this.state,l=Math.floor(o/t),h=Math.floor(a/t);s&&(l=Math.max(0,l-l%s),h+=s);let f=l+h+4,m=e.slice(l,f),w={...z1,height:e.length*t},y={...H1,top:l*t};return c("div",{onScroll:this.handleScroll,...n,children:c("div",{role:"presentation",style:w,children:c("div",{role:"presentation",style:y,children:m.map(r)})})})}},ia=lu;var sm=ye(ht(),1);function j1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58",children:c("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"})})}function q1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157",children:c("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"})})}function $1(){return c("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58",children:[c("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),c("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"})]})}function is({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return c(j1,{});case"folder":return c(q1,{});case"video":return c($1,{});default:return c("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}function V1({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:o=null,i18n:a}){return c("li",{className:t,title:r&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:e,name:"listitem",id:i.id,checked:i.status==="checked",disabled:r,"data-uppy-super-focusable":!0}),c("label",{htmlFor:i.id,"aria-label":i.data.name??a("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c(is,{itemIconString:i.data.thumbnail||i.data.icon}),n&&(i.data.name??a("unnamed")),o]})]})}var cu=V1;function uu({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:o,i18n:a}){return c("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:n,name:"listitem",id:i.id,checked:i.status==="checked","aria-label":i.data.isFolder?a("allFilesFromFolderNamed",{name:i.data.name??a("unnamed")}):null,disabled:r,"data-uppy-super-focusable":!0}),i.data.isFolder?c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:()=>e(i.id),"aria-label":a("openFolderNamed",{name:i.data.name??a("unnamed")}),children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(is,{itemIconString:i.data.icon})}),o&&i.data.name?c("span",{children:i.data.name}):a("unnamed")]}):c("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(is,{itemIconString:i.data.icon})}),o&&(i.data.name??a("unnamed"))]})]})}function hu(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:o,utmSource:a}=i,l=o.type==="folder"?null:o.restrictionError,h=!!l&&o.status!=="checked",f={file:o,openFolder:n,toggleCheckbox:t,utmSource:a,i18n:s,viewType:e,showTitles:r,className:(0,sm.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":h},{"uppy-ProviderBrowserItem--noPreview":o.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":o.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":o.status==="partial"}),isDisabled:h,restrictionError:l};switch(e){case"grid":return c(cu,{...f});case"list":return c(uu,{...f});case"unsplash":return c(cu,{...f,children:c("a",{href:`${o.data.author.url}?utm_source=${a}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1,children:o.data.author.name})});default:throw new Error(`There is no such type ${e}`)}}function W1(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:o,isLoading:a,openFolder:l,noResultsLabel:h,virtualList:f,utmSource:m}=i,[w,y]=Kt(!1);if(si(()=>{let C=R=>{R.key==="Shift"&&y(!1)},O=R=>{R.key==="Shift"&&y(!0)};return document.addEventListener("keyup",C),document.addEventListener("keydown",O),()=>{document.removeEventListener("keyup",C),document.removeEventListener("keydown",O)}},[]),a)return c("div",{className:"uppy-Provider-loading",children:typeof a=="string"?a:o("loading")});if(e.length===0)return c("div",{className:"uppy-Provider-empty",children:h});let k=C=>c(hu,{viewType:t,toggleCheckbox:O=>{O.stopPropagation(),O.preventDefault(),document.getSelection()?.removeAllRanges(),r(C,w)},showTitles:n,i18n:o,openFolder:l,file:C,utmSource:m},C.id);return f?c("div",{className:"uppy-ProviderBrowser-body",children:c(ia,{className:"uppy-ProviderBrowser-list",data:e,renderRow:k,rowHeight:35.5})}):c("div",{className:"uppy-ProviderBrowser-body",children:c("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(k)})})}var ra=W1;var nm=ye(ht(),1);var G1=i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,sa=G1;function on({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=$i(()=>s(r),[r,s]),o=$i(()=>sa(r),[r]);return o===0?null:c("div",{className:"uppy-ProviderBrowser-footer",children:[c("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[c("button",{className:(0,nm.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":n}),disabled:!!n,onClick:e,type:"button",children:t("selectX",{smart_count:o})}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:i,type:"button",children:t("cancel")})]}),n&&c("div",{className:"uppy-ProviderBrowser-footer-error",children:n})]})}function K1({searchString:i,setSearchString:e,submitSearchString:t,wrapperClassName:r,inputClassName:s,inputLabel:n,clearSearchLabel:o="",showButton:a=!1,buttonLabel:l="",buttonCSSClassName:h=""}){let f=y=>{e(y.target.value)},m=Vi(y=>{y.preventDefault(),t()},[t]),[w]=Kt(()=>{let y=document.createElement("form");return y.setAttribute("tabindex","-1"),y.id=Wi(),y});return si(()=>(document.body.appendChild(w),w.addEventListener("submit",m),()=>{w.removeEventListener("submit",m),document.body.removeChild(w)}),[w,m]),c("section",{className:r,children:[c("input",{className:`uppy-u-reset ${s}`,type:"search","aria-label":n,placeholder:n,value:i,onInput:f,form:w.id,"data-uppy-super-focusable":!0}),!a&&c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12",children:c("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})}),!a&&i&&c("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":o,title:o,onClick:()=>e(""),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19",children:c("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})})}),a&&c("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${h}`,type:"submit",form:w.id,children:l})]})}var rs=K1;var X1=(i,e,t)=>({id:i.id,source:e.id,name:i.name||i.id,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:i.author?.name,authorUrl:i.author?.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}),om=X1;var Y1=(i,e,t)=>{let r=i.map(o=>om(o,e,t)),s=[],n=[];r.forEach(o=>{e.uppy.checkIfFileAlreadyExists(Wo(o,e.uppy.getID()))?n.push(o):s.push(o)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},na=Y1;var Z1=(i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(a=>a.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.id)}return[i]},oa=Z1;var Q1=i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},_i=Q1;var J1=(i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},am=J1;var lm=(i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(o=>o.id===e);if(s.type==="root")return[];let n=[...lm(i,s.parentId,t),s];return t[r]=n,n},eS=i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=lm(i,s.id,e),o=n.findIndex(f=>f.type==="folder"&&f.status==="checked"),a=n.slice(o),l=`/${n.map(f=>f.data.name).join("/")}`,h=a.length===1?void 0:a.map(f=>f.data.name).join("/");return{...s.data,absDirPath:l,relDirPath:h}})},aa=eS;var pu=ye(um(),1);var ln=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},fu=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},hm=i=>globalThis.DOMException===void 0?new fu(i):new DOMException(i),dm=i=>{let e=i.reason===void 0?hm("This operation was aborted."):i.reason;return e instanceof Error?e:hm(e)};function mu(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,o,a,h=new Promise((f,m)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:y}=e;y.aborted&&m(dm(y)),a=()=>{m(dm(y))},y.addEventListener("abort",a,{once:!0})}if(t===Number.POSITIVE_INFINITY){i.then(f,m);return}let w=new ln;o=n.setTimeout.call(void 0,()=>{if(r){try{f(r())}catch(y){m(y)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?f():s instanceof Error?m(s):(w.message=s??`Promise timed out after ${t} milliseconds`,m(w))},t),(async()=>{try{f(await i)}catch(y){m(y)}})()}).finally(()=>{h.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return h.clear=()=>{n.clearTimeout.call(void 0,o),o=void 0},h}function gu(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),o=r+n;t(i[o],e)<=0?(r=++o,s-=n+1):s=n}return r}var cn=class{#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=gu(this.#e,r,(n,o)=>o.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var un=class extends pu.default{#e;#t;#i=0;#r;#s;#o=0;#n;#l;#a;#h;#c=0;#d;#u;#f;#g=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:cn,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#r=e.intervalCap,this.#s=e.interval,this.#a=new e.queueClass,this.#h=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#f=e.throwOnTimeout===!0,this.#u=e.autoStart===!1}get#p(){return this.#t||this.#i<this.#r}get#w(){return this.#c<this.#d}#b(){this.#c--,this.#S(),this.emit("next")}#y(){this.#x(),this.#m(),this.#l=void 0}get#T(){let e=Date.now();if(this.#n===void 0){let t=this.#o-e;if(t<0)this.#i=this.#e?this.#c:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#y()},t)),!0}return!1}#S(){if(this.#a.size===0)return this.#n&&clearInterval(this.#n),this.#n=void 0,this.emit("empty"),this.#c===0&&this.emit("idle"),!1;if(!this.#u){let e=!this.#T;if(this.#p&&this.#w){let t=this.#a.dequeue();return t?(this.emit("active"),t(),e&&this.#m(),!0):!1}}return!1}#m(){this.#t||this.#n!==void 0||(this.#n=setInterval(()=>{this.#x()},this.#s),this.#o=Date.now()+this.#s)}#x(){this.#i===0&&this.#c===0&&this.#n&&(clearInterval(this.#n),this.#n=void 0),this.#i=this.#e?this.#c:0,this.#v()}#v(){for(;this.#S(););}get concurrency(){return this.#d}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#d=e,this.#v()}async#_(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#a.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#g++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#f,...t},new Promise((r,s)=>{this.#a.enqueue(async()=>{this.#c++,this.#i++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=mu(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#_(t.signal)]));let o=await n;r(o),this.emit("completed",o)}catch(n){if(n instanceof ln&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#b()}},t),this.emit("add"),this.#S()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#u?(this.#u=!1,this.#v(),this):this}pause(){this.#u=!0}clear(){this.#a=new this.#h}async onEmpty(){this.#a.size!==0&&await this.#E("empty")}async onSizeLessThan(e){this.#a.size<e||await this.#E("next",()=>this.#a.size<e)}async onIdle(){this.#c===0&&this.#a.size===0||await this.#E("idle")}async#E(e,t){return new Promise(r=>{let s=()=>{t&&!t()||(this.off(e,s),r())};this.on(e,s)})}get size(){return this.#a.size}sizeBy(e){return this.#a.filter(e).length}get pending(){return this.#c}get isPaused(){return this.#u}};var rS=i=>i.map(e=>({...e})),ca=rS;var pm=async(i,e,t,r,s)=>{let n=[],o=t.cached?t.nextPagePath:t.id;for(;o;){let m=await r(o);n=n.concat(m.items),o=m.nextPagePath}let a=n.filter(m=>m.isFolder===!0),l=n.filter(m=>m.isFolder===!1),h=a.map(m=>({type:"folder",id:m.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:m})),f=l.map(m=>{let w=s(m);return{type:"file",id:m.requestPath,restrictionError:w,status:w?"unchecked":"checked",parentId:t.id,data:m}});t.cached=!0,t.nextPagePath=null,e.push(...f,...h),h.forEach(async m=>{i.add(()=>pm(i,e,m,r,s))})},sS=async(i,e,t,r)=>{let s=new un({concurrency:6}),n=ca(i);return n.filter(a=>a.type==="folder"&&a.status==="checked"&&(a.cached===!1||a.nextPagePath)).forEach(a=>{s.add(()=>pm(s,n,a,e,t))}),s.on("completed",()=>{let a=n.filter(l=>l.type==="file"&&l.status==="checked").length;r(a)}),await s.onIdle(),n},fm=sS;var nS=(i,e,t,r,s)=>{let n=e.filter(y=>y.isFolder===!0),o=e.filter(y=>y.isFolder===!1),a=t.type==="folder"&&t.status==="checked",l=n.map(y=>({type:"folder",id:y.requestPath,cached:!1,nextPagePath:null,status:a?"checked":"unchecked",parentId:t.id,data:y})),h=o.map(y=>{let k=s(y);return{type:"file",id:y.requestPath,restrictionError:k,status:a&&!k?"checked":"unchecked",parentId:t.id,data:y}}),f={...t,cached:!0,nextPagePath:r};return[...i.map(y=>y.id===f.id?f:y),...l,...h]},mm=nS;var oS=(i,e,t,r,s)=>{let n=i.find(k=>k.id===e),o=t.filter(k=>k.isFolder===!0),a=t.filter(k=>k.isFolder===!1),l={...n,nextPagePath:r},h=i.map(k=>k.id===l.id?l:k),f=l.type==="folder"&&l.status==="checked",m=o.map(k=>({type:"folder",id:k.requestPath,cached:!1,nextPagePath:null,status:f?"checked":"unchecked",parentId:l.id,data:k})),w=a.map(k=>{let C=s(k);return{type:"file",id:k.requestPath,restrictionError:C,status:f&&!C?"checked":"unchecked",parentId:l.id,data:k}});return[...h,...m,...w]},gm=oS;var bu=(i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",bu(i,s.id,t)})},yu=(i,e)=>{let t=i.find(o=>o.id===e);if(t.type==="root")return;let r=i.filter(o=>o.type!=="root"&&o.parentId===t.id&&!(o.type==="file"&&o.restrictionError)),s=r.every(o=>o.status==="checked"),n=r.every(o=>o.status==="unchecked");s?t.status="checked":n?t.status="unchecked":t.status="partial",yu(i,t.parentId)},aS=(i,e)=>{let t=ca(i);if(e.length>=2){let r=t.filter(s=>s.type!=="root"&&e.includes(s.id));r.forEach(s=>{s.type==="file"?s.status=s.restrictionError?"unchecked":"checked":s.status="checked"}),r.forEach(s=>{bu(t,s.id,!0)}),yu(t,r[0].parentId)}else{let r=t.find(s=>s.id===e[0]);r.status=r.status==="checked"?"unchecked":"checked",bu(t,r.id,r.status==="checked"),yu(t,r.parentId)}return t},bm=aS;var vr={afterOpenFolder:mm,afterScrollFolder:gm,afterToggleCheckbox:bm,afterFill:fm};var lS=i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},ua=lS;var ym=ye(ht(),1);function vu(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return c("div",{className:"uppy-Provider-breadcrumbs",children:[c("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((o,a)=>c(_e,{children:[c("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>e(o.id),children:o.type==="root"?t:o.data.name??n("unnamed")},o.id),s.length===a+1?"":" / "]}))]})}function wu({i18n:i,logout:e,username:t}){return c(_e,{children:[t&&c("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),c("button",{type:"button",onClick:e,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}function Su(i){return c("div",{className:"uppy-ProviderBrowser-header",children:c("div",{className:(0,ym.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&c(vu,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n}),c(wu,{logout:i.logout,username:i.username,i18n:i.i18n})]})})}function dn(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:c("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}var vm=i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),hn=class{static VERSION=ta.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}resetPluginState(){this.plugin.setPluginState(vm(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}#e;async#t(e){this.#e?.abort();let t=new AbortController;this.#e=t;let r=()=>{t.abort()};try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await e(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),this.#e=void 0}}async openFolder(e){this.lastCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await this.#t(async s=>{let n=e,o=[];do{let{username:l,nextPagePath:h,items:f}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:l}),n=h,o=o.concat(f),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length}))}while(this.opts.loadAllFiles&&n);let a=vr.afterOpenFolder(t,o,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:a,currentFolderId:e,searchString:""})}).catch(_i(this.plugin.uppy)),this.setLoading(!1)}async logout(){await this.#t(async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...vm(this.plugin.rootFolderId),authenticated:!1})}}).catch(_i(this.plugin.uppy))}async handleAuth(e){await this.#t(async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(_i(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);ua(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await this.#t(async n=>{let{nextPagePath:o,items:a}=await this.provider.list(s.nextPagePath,{signal:n}),l=vr.afterScrollFolder(t,r,a,o,this.validateSingleFile);this.plugin.setPluginState({partialTree:l})}).catch(_i(this.plugin.uppy)),this.isHandlingScroll=!1)}validateSingleFile=e=>{let t=nn(e);return this.plugin.uppy.validateSingleFile(t)};async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.setLoading(!0),await this.#t(async t=>{let r=await vr.afterFill(e,o=>this.provider.list(o,{signal:t}),this.validateSingleFile,o=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:o}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=aa(r);na(n,this.plugin,this.provider),this.resetPluginState()}).catch(_i(this.plugin.uppy)),this.setLoading(!1)}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=oa(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=vr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}getDisplayedPartialTree=()=>{let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.filter(o=>o.type!=="root"&&o.parentId===t);return r===""?s:s.filter(o=>(o.data.name??this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(r.toLowerCase())!==-1)};getBreadcrumbs=()=>{let{partialTree:e,currentFolderId:t}=this.plugin.getPluginState();return am(e,t)};getSelectedAmount=()=>{let{partialTree:e}=this.plugin.getPluginState();return sa(e)};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:o,loading:a}=this.plugin.getPluginState(),l=this.plugin.icon||dn;if(o===!1)return c(Jo,{pluginName:this.plugin.title,pluginIcon:l,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:a});let{partialTree:h,username:f,searchString:m}=this.plugin.getPluginState(),w=this.getBreadcrumbs();return c("div",{className:(0,wm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[c(Su,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:w,pluginIcon:l,title:this.plugin.title,logout:this.logout,username:f,i18n:s}),n.showFilter&&c(rs,{searchString:m,setSearchString:y=>{this.plugin.setPluginState({searchString:y})},submitSearchString:()=>{},inputLabel:s("filter"),clearSearchLabel:s("resetFilter"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(ra,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:a,utmSource:"Companion"}),c(on,{partialTree:h,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var Sm=ye(ht(),1);var cS={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},uS={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},pn=class{static VERSION=ta.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={...uS,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState(cS)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){_i(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if(ua(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),o={...s,nextPagePath:n.nextPageQuery},a=t.filter(h=>h.type!=="root"),l=[o,...a,...n.items.map(h=>({type:"file",id:h.requestPath,status:"unchecked",parentId:null,data:h}))];this.plugin.setPluginState({partialTree:l})}catch(n){_i(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=aa(e);na(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=oa(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=vr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=e=>{let t=nn(e);return this.plugin.uppy.validateSingleFile(t)};getDisplayedPartialTree=()=>{let{partialTree:e}=this.plugin.getPluginState();return e.filter(t=>t.type!=="root")};setSearchString=e=>{this.plugin.setPluginState({searchString:e}),e===""&&this.plugin.setPluginState({partialTree:[]})};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{isInputMode:r,searchString:s,loading:n,partialTree:o}=this.plugin.getPluginState(),{i18n:a}=this.plugin.uppy,l={...this.opts,...t};return r?c(rs,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("enterTextToSearch"),buttonLabel:a("searchImages"),wrapperClassName:"uppy-SearchProvider",inputClassName:"uppy-c-textInput uppy-SearchProvider-input",showButton:!0,buttonCSSClassName:"uppy-SearchProvider-searchButton"}):c("div",{className:(0,Sm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${l.viewType}`),children:[l.showFilter&&c(rs,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("search"),clearSearchLabel:a("resetSearch"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(ra,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:async()=>{},noResultsLabel:a("noSearchResults"),viewType:l.viewType,showTitles:l.showTitles,isLoading:n,i18n:a,virtualList:!1,utmSource:this.opts.utmSource}),c(on,{partialTree:o,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:a,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};function ha(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}var Em={name:"@uppy/status-bar",description:"A progress bar for Uppy, with many bells and whistles.",version:"4.2.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","progress bar","status bar","progress","upload","eta","speed"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/utils":"^6.2.2",classnames:"^2.2.6",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Tm={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};var Ft={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var Cu=ye(ht(),1);var xu=ye(Ko(),1);function Eu(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}function Tu(i){let e=Eu(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}var ku=ye(ht(),1);var dS="\xB7",xm=()=>` ${dS} `;function km(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:o,startUpload:a}=i,l=(0,ku.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===Ft.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),h=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return c("button",{type:"button",className:l,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:a,disabled:o,"data-uppy-super-focusable":!0,children:h})}function _m(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:c("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}function Am(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}function Cm(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,o=t(e?"resume":"pause");function a(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return c("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:a,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}function Fm(i){let{i18n:e,doneButtonHandler:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}function Pm(){return c("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:c("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}function Om(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return c("div",{className:"uppy-StatusBar-content",children:[c(Pm,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}function pS(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:o}=i,a=e>1,l=(0,xu.default)(r);return c("div",{className:"uppy-StatusBar-statusSecondary",children:[a&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),c("span",{className:"uppy-StatusBar-additionalInfo",children:[a&&xm(),s!=null?o("dataUploadedOfTotal",{complete:l,total:(0,xu.default)(s)}):o("dataUploadedOfUnknown",{complete:l}),xm(),n!=null&&o("xTimeLeft",{time:Tu(n)})]})]})}function Rm(i){let{i18n:e,complete:t,numUploads:r}=i;return c("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}function fS(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,ku.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return c("div",{className:"uppy-StatusBar-statusSecondary",children:[c("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),c("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}function Lm(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:o,isAllPaused:a,newFiles:l,numUploads:h,complete:f,totalUploadedSize:m,totalSize:w,totalETA:y,startUpload:k}=i,C=l&&n;if(!n||o)return null;let O=e(a?"paused":"uploading");function R(){return!a&&!C&&s?t?c(pS,{numUploads:h,complete:f,totalUploadedSize:m,totalSize:w,totalETA:y,i18n:e}):c(Rm,{i18n:e,complete:f,numUploads:h}):null}return c("div",{className:"uppy-StatusBar-content",title:O,children:[a?null:c(Pm,{}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${O}: ${r}%`:O}),R(),C?c(fS,{i18n:e,newFiles:l,startUpload:k}):null]})]})}function Mm(i){let{i18n:e}=i;return c("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:c("div",{className:"uppy-StatusBar-status",children:c("div",{className:"uppy-StatusBar-statusPrimary",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:c("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}function Im(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let o=`${t("uploadFailed")}
95
+ ${t.details}`),children:"?"})]})},t.message))})});install(){let{target:e}=this.opts;e&&this.mount(e,this)}};function D1(){return c("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",children:c("g",{fill:"none","fill-rule":"evenodd",children:[c("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),c("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),c("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),c("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),c("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),c("path",{d:"M4 4h18v18H4z"})]})})}function N1({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=Vi(n=>{n.preventDefault(),t()},[t]);return c("form",{onSubmit:s,children:r?c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0,children:[c(D1,{}),e("signInWithGoogle")]}):c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0,children:e("authenticateWith",{pluginName:i})})})}var B1=({pluginName:i,i18n:e,onAuth:t})=>c(N1,{pluginName:i,i18n:e,onAuth:t});function Jo({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=B1}){return c("div",{className:"uppy-Provider-auth",children:[c("div",{className:"uppy-Provider-authIcon",children:t()}),c("div",{className:"uppy-Provider-authTitle",children:r("authenticateWithTitle",{pluginName:e})}),n({pluginName:e,i18n:r,loading:i,onAuth:s})]})}function nn(i){return{...i,type:i.mimeType,extension:i.name?yr(i.name).extension:null}}var wm=ye(ht(),1);var ta={name:"@uppy/provider-views",description:"View library for Uppy remote provider plugins.",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",classnames:"^2.2.6",nanoid:"^5.0.9","p-queue":"^8.0.0",preact:"^10.5.13"},devDependencies:{"@types/gapi":"^0.0.47","@types/google.accounts":"^0.0.14","@types/google.picker":"^0.0.42",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var z1={position:"relative",width:"100%",minHeight:"100%"},H1={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"},lu=class extends we{constructor(e){super(e),this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement?.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleScroll=()=>{this.setState({offset:this.base.scrollTop})};handleResize=()=>{this.resize()};resize(){let{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render({data:e,rowHeight:t,renderRow:r,overscanCount:s=10,...n}){let{offset:o,height:a}=this.state,l=Math.floor(o/t),h=Math.floor(a/t);s&&(l=Math.max(0,l-l%s),h+=s);let f=l+h+4,m=e.slice(l,f),w={...z1,height:e.length*t},y={...H1,top:l*t};return c("div",{onScroll:this.handleScroll,...n,children:c("div",{role:"presentation",style:w,children:c("div",{role:"presentation",style:y,children:m.map(r)})})})}},ia=lu;var sm=ye(ht(),1);function j1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58",children:c("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"})})}function q1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157",children:c("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"})})}function $1(){return c("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58",children:[c("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),c("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"})]})}function is({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return c(j1,{});case"folder":return c(q1,{});case"video":return c($1,{});default:return c("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}function V1({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:o=null,i18n:a}){return c("li",{className:t,title:r&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:e,name:"listitem",id:i.id,checked:i.status==="checked",disabled:r,"data-uppy-super-focusable":!0}),c("label",{htmlFor:i.id,"aria-label":i.data.name??a("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c(is,{itemIconString:i.data.thumbnail||i.data.icon}),n&&(i.data.name??a("unnamed")),o]})]})}var cu=V1;function uu({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:o,i18n:a}){return c("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:n,name:"listitem",id:i.id,checked:i.status==="checked","aria-label":i.data.isFolder?a("allFilesFromFolderNamed",{name:i.data.name??a("unnamed")}):null,disabled:r,"data-uppy-super-focusable":!0}),i.data.isFolder?c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:()=>e(i.id),"aria-label":a("openFolderNamed",{name:i.data.name??a("unnamed")}),children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(is,{itemIconString:i.data.icon})}),o&&i.data.name?c("span",{children:i.data.name}):a("unnamed")]}):c("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(is,{itemIconString:i.data.icon})}),o&&(i.data.name??a("unnamed"))]})]})}function hu(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:o,utmSource:a}=i,l=o.type==="folder"?null:o.restrictionError,h=!!l&&o.status!=="checked",f={file:o,openFolder:n,toggleCheckbox:t,utmSource:a,i18n:s,viewType:e,showTitles:r,className:(0,sm.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":h},{"uppy-ProviderBrowserItem--noPreview":o.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":o.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":o.status==="partial"}),isDisabled:h,restrictionError:l};switch(e){case"grid":return c(cu,{...f});case"list":return c(uu,{...f});case"unsplash":return c(cu,{...f,children:c("a",{href:`${o.data.author.url}?utm_source=${a}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1,children:o.data.author.name})});default:throw new Error(`There is no such type ${e}`)}}function W1(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:o,isLoading:a,openFolder:l,noResultsLabel:h,virtualList:f,utmSource:m}=i,[w,y]=Kt(!1);if(si(()=>{let C=R=>{R.key==="Shift"&&y(!1)},O=R=>{R.key==="Shift"&&y(!0)};return document.addEventListener("keyup",C),document.addEventListener("keydown",O),()=>{document.removeEventListener("keyup",C),document.removeEventListener("keydown",O)}},[]),a)return c("div",{className:"uppy-Provider-loading",children:typeof a=="string"?a:o("loading")});if(e.length===0)return c("div",{className:"uppy-Provider-empty",children:h});let k=C=>c(hu,{viewType:t,toggleCheckbox:O=>{O.stopPropagation(),O.preventDefault(),document.getSelection()?.removeAllRanges(),r(C,w)},showTitles:n,i18n:o,openFolder:l,file:C,utmSource:m},C.id);return f?c("div",{className:"uppy-ProviderBrowser-body",children:c(ia,{className:"uppy-ProviderBrowser-list",data:e,renderRow:k,rowHeight:35.5})}):c("div",{className:"uppy-ProviderBrowser-body",children:c("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(k)})})}var ra=W1;var nm=ye(ht(),1);var G1=i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,sa=G1;function on({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=$i(()=>s(r),[r,s]),o=$i(()=>sa(r),[r]);return o===0?null:c("div",{className:"uppy-ProviderBrowser-footer",children:[c("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[c("button",{className:(0,nm.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":n}),disabled:!!n,onClick:e,type:"button",children:t("selectX",{smart_count:o})}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:i,type:"button",children:t("cancel")})]}),n&&c("div",{className:"uppy-ProviderBrowser-footer-error",children:n})]})}function K1({searchString:i,setSearchString:e,submitSearchString:t,wrapperClassName:r,inputClassName:s,inputLabel:n,clearSearchLabel:o="",showButton:a=!1,buttonLabel:l="",buttonCSSClassName:h=""}){let f=y=>{e(y.target.value)},m=Vi(y=>{y.preventDefault(),t()},[t]),[w]=Kt(()=>{let y=document.createElement("form");return y.setAttribute("tabindex","-1"),y.id=Wi(),y});return si(()=>(document.body.appendChild(w),w.addEventListener("submit",m),()=>{w.removeEventListener("submit",m),document.body.removeChild(w)}),[w,m]),c("section",{className:r,children:[c("input",{className:`uppy-u-reset ${s}`,type:"search","aria-label":n,placeholder:n,value:i,onInput:f,form:w.id,"data-uppy-super-focusable":!0}),!a&&c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12",children:c("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})}),!a&&i&&c("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":o,title:o,onClick:()=>e(""),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19",children:c("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})})}),a&&c("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${h}`,type:"submit",form:w.id,children:l})]})}var rs=K1;var X1=(i,e,t)=>({id:i.id,source:e.id,name:i.name||i.id,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:i.author?.name,authorUrl:i.author?.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}),om=X1;var Y1=(i,e,t)=>{let r=i.map(o=>om(o,e,t)),s=[],n=[];r.forEach(o=>{e.uppy.checkIfFileAlreadyExists(Wo(o,e.uppy.getID()))?n.push(o):s.push(o)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},na=Y1;var Z1=(i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(a=>a.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.id)}return[i]},oa=Z1;var Q1=i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},_i=Q1;var J1=(i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},am=J1;var lm=(i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(o=>o.id===e);if(s.type==="root")return[];let n=[...lm(i,s.parentId,t),s];return t[r]=n,n},eS=i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=lm(i,s.id,e),o=n.findIndex(f=>f.type==="folder"&&f.status==="checked"),a=n.slice(o),l=`/${n.map(f=>f.data.name).join("/")}`,h=a.length===1?void 0:a.map(f=>f.data.name).join("/");return{...s.data,absDirPath:l,relDirPath:h}})},aa=eS;var pu=ye(um(),1);var ln=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},fu=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},hm=i=>globalThis.DOMException===void 0?new fu(i):new DOMException(i),dm=i=>{let e=i.reason===void 0?hm("This operation was aborted."):i.reason;return e instanceof Error?e:hm(e)};function mu(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,o,a,h=new Promise((f,m)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:y}=e;y.aborted&&m(dm(y)),a=()=>{m(dm(y))},y.addEventListener("abort",a,{once:!0})}if(t===Number.POSITIVE_INFINITY){i.then(f,m);return}let w=new ln;o=n.setTimeout.call(void 0,()=>{if(r){try{f(r())}catch(y){m(y)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?f():s instanceof Error?m(s):(w.message=s??`Promise timed out after ${t} milliseconds`,m(w))},t),(async()=>{try{f(await i)}catch(y){m(y)}})()}).finally(()=>{h.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return h.clear=()=>{n.clearTimeout.call(void 0,o),o=void 0},h}function gu(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),o=r+n;t(i[o],e)<=0?(r=++o,s-=n+1):s=n}return r}var cn=class{#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=gu(this.#e,r,(n,o)=>o.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var un=class extends pu.default{#e;#t;#i=0;#r;#s;#o=0;#n;#l;#a;#d;#c=0;#h;#u;#f;#g=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:cn,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#r=e.intervalCap,this.#s=e.interval,this.#a=new e.queueClass,this.#d=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#f=e.throwOnTimeout===!0,this.#u=e.autoStart===!1}get#p(){return this.#t||this.#i<this.#r}get#w(){return this.#c<this.#h}#b(){this.#c--,this.#S(),this.emit("next")}#y(){this.#x(),this.#m(),this.#l=void 0}get#T(){let e=Date.now();if(this.#n===void 0){let t=this.#o-e;if(t<0)this.#i=this.#e?this.#c:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#y()},t)),!0}return!1}#S(){if(this.#a.size===0)return this.#n&&clearInterval(this.#n),this.#n=void 0,this.emit("empty"),this.#c===0&&this.emit("idle"),!1;if(!this.#u){let e=!this.#T;if(this.#p&&this.#w){let t=this.#a.dequeue();return t?(this.emit("active"),t(),e&&this.#m(),!0):!1}}return!1}#m(){this.#t||this.#n!==void 0||(this.#n=setInterval(()=>{this.#x()},this.#s),this.#o=Date.now()+this.#s)}#x(){this.#i===0&&this.#c===0&&this.#n&&(clearInterval(this.#n),this.#n=void 0),this.#i=this.#e?this.#c:0,this.#v()}#v(){for(;this.#S(););}get concurrency(){return this.#h}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#h=e,this.#v()}async#_(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#a.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#g++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#f,...t},new Promise((r,s)=>{this.#a.enqueue(async()=>{this.#c++,this.#i++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=mu(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#_(t.signal)]));let o=await n;r(o),this.emit("completed",o)}catch(n){if(n instanceof ln&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#b()}},t),this.emit("add"),this.#S()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#u?(this.#u=!1,this.#v(),this):this}pause(){this.#u=!0}clear(){this.#a=new this.#d}async onEmpty(){this.#a.size!==0&&await this.#E("empty")}async onSizeLessThan(e){this.#a.size<e||await this.#E("next",()=>this.#a.size<e)}async onIdle(){this.#c===0&&this.#a.size===0||await this.#E("idle")}async#E(e,t){return new Promise(r=>{let s=()=>{t&&!t()||(this.off(e,s),r())};this.on(e,s)})}get size(){return this.#a.size}sizeBy(e){return this.#a.filter(e).length}get pending(){return this.#c}get isPaused(){return this.#u}};var rS=i=>i.map(e=>({...e})),ca=rS;var pm=async(i,e,t,r,s)=>{let n=[],o=t.cached?t.nextPagePath:t.id;for(;o;){let m=await r(o);n=n.concat(m.items),o=m.nextPagePath}let a=n.filter(m=>m.isFolder===!0),l=n.filter(m=>m.isFolder===!1),h=a.map(m=>({type:"folder",id:m.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:m})),f=l.map(m=>{let w=s(m);return{type:"file",id:m.requestPath,restrictionError:w,status:w?"unchecked":"checked",parentId:t.id,data:m}});t.cached=!0,t.nextPagePath=null,e.push(...f,...h),h.forEach(async m=>{i.add(()=>pm(i,e,m,r,s))})},sS=async(i,e,t,r)=>{let s=new un({concurrency:6}),n=ca(i);return n.filter(a=>a.type==="folder"&&a.status==="checked"&&(a.cached===!1||a.nextPagePath)).forEach(a=>{s.add(()=>pm(s,n,a,e,t))}),s.on("completed",()=>{let a=n.filter(l=>l.type==="file"&&l.status==="checked").length;r(a)}),await s.onIdle(),n},fm=sS;var nS=(i,e,t,r,s)=>{let n=e.filter(y=>y.isFolder===!0),o=e.filter(y=>y.isFolder===!1),a=t.type==="folder"&&t.status==="checked",l=n.map(y=>({type:"folder",id:y.requestPath,cached:!1,nextPagePath:null,status:a?"checked":"unchecked",parentId:t.id,data:y})),h=o.map(y=>{let k=s(y);return{type:"file",id:y.requestPath,restrictionError:k,status:a&&!k?"checked":"unchecked",parentId:t.id,data:y}}),f={...t,cached:!0,nextPagePath:r};return[...i.map(y=>y.id===f.id?f:y),...l,...h]},mm=nS;var oS=(i,e,t,r,s)=>{let n=i.find(k=>k.id===e),o=t.filter(k=>k.isFolder===!0),a=t.filter(k=>k.isFolder===!1),l={...n,nextPagePath:r},h=i.map(k=>k.id===l.id?l:k),f=l.type==="folder"&&l.status==="checked",m=o.map(k=>({type:"folder",id:k.requestPath,cached:!1,nextPagePath:null,status:f?"checked":"unchecked",parentId:l.id,data:k})),w=a.map(k=>{let C=s(k);return{type:"file",id:k.requestPath,restrictionError:C,status:f&&!C?"checked":"unchecked",parentId:l.id,data:k}});return[...h,...m,...w]},gm=oS;var bu=(i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",bu(i,s.id,t)})},yu=(i,e)=>{let t=i.find(o=>o.id===e);if(t.type==="root")return;let r=i.filter(o=>o.type!=="root"&&o.parentId===t.id&&!(o.type==="file"&&o.restrictionError)),s=r.every(o=>o.status==="checked"),n=r.every(o=>o.status==="unchecked");s?t.status="checked":n?t.status="unchecked":t.status="partial",yu(i,t.parentId)},aS=(i,e)=>{let t=ca(i);if(e.length>=2){let r=t.filter(s=>s.type!=="root"&&e.includes(s.id));r.forEach(s=>{s.type==="file"?s.status=s.restrictionError?"unchecked":"checked":s.status="checked"}),r.forEach(s=>{bu(t,s.id,!0)}),yu(t,r[0].parentId)}else{let r=t.find(s=>s.id===e[0]);r.status=r.status==="checked"?"unchecked":"checked",bu(t,r.id,r.status==="checked"),yu(t,r.parentId)}return t},bm=aS;var vr={afterOpenFolder:mm,afterScrollFolder:gm,afterToggleCheckbox:bm,afterFill:fm};var lS=i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},ua=lS;var ym=ye(ht(),1);function vu(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return c("div",{className:"uppy-Provider-breadcrumbs",children:[c("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((o,a)=>c(_e,{children:[c("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>e(o.id),children:o.type==="root"?t:o.data.name??n("unnamed")},o.id),s.length===a+1?"":" / "]}))]})}function wu({i18n:i,logout:e,username:t}){return c(_e,{children:[t&&c("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),c("button",{type:"button",onClick:e,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}function Su(i){return c("div",{className:"uppy-ProviderBrowser-header",children:c("div",{className:(0,ym.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&c(vu,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n}),c(wu,{logout:i.logout,username:i.username,i18n:i.i18n})]})})}function dn(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:c("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}var vm=i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),hn=class{static VERSION=ta.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}resetPluginState(){this.plugin.setPluginState(vm(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}#e;async#t(e){this.#e?.abort();let t=new AbortController;this.#e=t;let r=()=>{t.abort()};try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await e(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),this.#e=void 0}}async openFolder(e){this.lastCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await this.#t(async s=>{let n=e,o=[];do{let{username:l,nextPagePath:h,items:f}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:l}),n=h,o=o.concat(f),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length}))}while(this.opts.loadAllFiles&&n);let a=vr.afterOpenFolder(t,o,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:a,currentFolderId:e,searchString:""})}).catch(_i(this.plugin.uppy)),this.setLoading(!1)}async logout(){await this.#t(async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...vm(this.plugin.rootFolderId),authenticated:!1})}}).catch(_i(this.plugin.uppy))}async handleAuth(e){await this.#t(async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(_i(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);ua(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await this.#t(async n=>{let{nextPagePath:o,items:a}=await this.provider.list(s.nextPagePath,{signal:n}),l=vr.afterScrollFolder(t,r,a,o,this.validateSingleFile);this.plugin.setPluginState({partialTree:l})}).catch(_i(this.plugin.uppy)),this.isHandlingScroll=!1)}validateSingleFile=e=>{let t=nn(e);return this.plugin.uppy.validateSingleFile(t)};async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.setLoading(!0),await this.#t(async t=>{let r=await vr.afterFill(e,o=>this.provider.list(o,{signal:t}),this.validateSingleFile,o=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:o}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=aa(r);na(n,this.plugin,this.provider),this.resetPluginState()}).catch(_i(this.plugin.uppy)),this.setLoading(!1)}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=oa(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=vr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}getDisplayedPartialTree=()=>{let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.filter(o=>o.type!=="root"&&o.parentId===t);return r===""?s:s.filter(o=>(o.data.name??this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(r.toLowerCase())!==-1)};getBreadcrumbs=()=>{let{partialTree:e,currentFolderId:t}=this.plugin.getPluginState();return am(e,t)};getSelectedAmount=()=>{let{partialTree:e}=this.plugin.getPluginState();return sa(e)};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:o,loading:a}=this.plugin.getPluginState(),l=this.plugin.icon||dn;if(o===!1)return c(Jo,{pluginName:this.plugin.title,pluginIcon:l,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:a});let{partialTree:h,username:f,searchString:m}=this.plugin.getPluginState(),w=this.getBreadcrumbs();return c("div",{className:(0,wm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[c(Su,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:w,pluginIcon:l,title:this.plugin.title,logout:this.logout,username:f,i18n:s}),n.showFilter&&c(rs,{searchString:m,setSearchString:y=>{this.plugin.setPluginState({searchString:y})},submitSearchString:()=>{},inputLabel:s("filter"),clearSearchLabel:s("resetFilter"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(ra,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:a,utmSource:"Companion"}),c(on,{partialTree:h,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var Sm=ye(ht(),1);var cS={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},uS={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},pn=class{static VERSION=ta.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={...uS,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState(cS)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){_i(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if(ua(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),o={...s,nextPagePath:n.nextPageQuery},a=t.filter(h=>h.type!=="root"),l=[o,...a,...n.items.map(h=>({type:"file",id:h.requestPath,status:"unchecked",parentId:null,data:h}))];this.plugin.setPluginState({partialTree:l})}catch(n){_i(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=aa(e);na(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=oa(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=vr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=e=>{let t=nn(e);return this.plugin.uppy.validateSingleFile(t)};getDisplayedPartialTree=()=>{let{partialTree:e}=this.plugin.getPluginState();return e.filter(t=>t.type!=="root")};setSearchString=e=>{this.plugin.setPluginState({searchString:e}),e===""&&this.plugin.setPluginState({partialTree:[]})};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{isInputMode:r,searchString:s,loading:n,partialTree:o}=this.plugin.getPluginState(),{i18n:a}=this.plugin.uppy,l={...this.opts,...t};return r?c(rs,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("enterTextToSearch"),buttonLabel:a("searchImages"),wrapperClassName:"uppy-SearchProvider",inputClassName:"uppy-c-textInput uppy-SearchProvider-input",showButton:!0,buttonCSSClassName:"uppy-SearchProvider-searchButton"}):c("div",{className:(0,Sm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${l.viewType}`),children:[l.showFilter&&c(rs,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("search"),clearSearchLabel:a("resetSearch"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(ra,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:async()=>{},noResultsLabel:a("noSearchResults"),viewType:l.viewType,showTitles:l.showTitles,isLoading:n,i18n:a,virtualList:!1,utmSource:this.opts.utmSource}),c(on,{partialTree:o,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:a,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};function ha(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}var Em={name:"@uppy/status-bar",description:"A progress bar for Uppy, with many bells and whistles.",version:"4.2.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","progress bar","status bar","progress","upload","eta","speed"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/utils":"^6.2.2",classnames:"^2.2.6",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Tm={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};var Ft={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var Cu=ye(ht(),1);var xu=ye(Ko(),1);function Eu(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}function Tu(i){let e=Eu(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}var ku=ye(ht(),1);var dS="\xB7",xm=()=>` ${dS} `;function km(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:o,startUpload:a}=i,l=(0,ku.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===Ft.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),h=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return c("button",{type:"button",className:l,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:a,disabled:o,"data-uppy-super-focusable":!0,children:h})}function _m(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:c("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}function Am(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}function Cm(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,o=t(e?"resume":"pause");function a(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return c("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:a,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}function Fm(i){let{i18n:e,doneButtonHandler:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}function Pm(){return c("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:c("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}function Om(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return c("div",{className:"uppy-StatusBar-content",children:[c(Pm,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}function pS(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:o}=i,a=e>1,l=(0,xu.default)(r);return c("div",{className:"uppy-StatusBar-statusSecondary",children:[a&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),c("span",{className:"uppy-StatusBar-additionalInfo",children:[a&&xm(),s!=null?o("dataUploadedOfTotal",{complete:l,total:(0,xu.default)(s)}):o("dataUploadedOfUnknown",{complete:l}),xm(),n!=null&&o("xTimeLeft",{time:Tu(n)})]})]})}function Rm(i){let{i18n:e,complete:t,numUploads:r}=i;return c("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}function fS(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,ku.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return c("div",{className:"uppy-StatusBar-statusSecondary",children:[c("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),c("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}function Lm(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:o,isAllPaused:a,newFiles:l,numUploads:h,complete:f,totalUploadedSize:m,totalSize:w,totalETA:y,startUpload:k}=i,C=l&&n;if(!n||o)return null;let O=e(a?"paused":"uploading");function R(){return!a&&!C&&s?t?c(pS,{numUploads:h,complete:f,totalUploadedSize:m,totalSize:w,totalETA:y,i18n:e}):c(Rm,{i18n:e,complete:f,numUploads:h}):null}return c("div",{className:"uppy-StatusBar-content",title:O,children:[a?null:c(Pm,{}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${O}: ${r}%`:O}),R(),C?c(fS,{i18n:e,newFiles:l,startUpload:k}):null]})]})}function Mm(i){let{i18n:e}=i;return c("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:c("div",{className:"uppy-StatusBar-status",children:c("div",{className:"uppy-StatusBar-statusPrimary",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:c("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}function Im(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let o=`${t("uploadFailed")}
96
96
 
97
97
  ${e}`;alert(o)}return c("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),c("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button",children:"?"})]}),c(Rm,{i18n:t,complete:r,numUploads:s})]})]})}function fn(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:o,postprocess:a}=n;r==null&&(o||a)&&({mode:t,message:r}=o||a),o?.mode==="determinate"&&e.push(o.value),a?.mode==="determinate"&&e.push(a.value)}let s=e.reduce((n,o)=>n+o/e.length,0);return{mode:t,message:r,value:s}}var{STATE_ERROR:Dm,STATE_WAITING:mS,STATE_PREPROCESSING:_u,STATE_UPLOADING:da,STATE_POSTPROCESSING:Au,STATE_COMPLETE:pa}=Ft;function Fu({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:o=void 0,hidePauseResumeButton:a=!1,hideCancelButton:l=!1,hideRetryButton:h=!1,recoveredState:f,uploadState:m,totalProgress:w,files:y,supportsUploadProgress:k,hideAfterFinish:C=!1,isSomeGhost:O,doneButtonHandler:R=void 0,isUploadStarted:_,i18n:F,startUpload:x,uppy:S,isAllComplete:A,showProgressDetails:P=void 0,numUploads:N,complete:z,totalSize:q,totalETA:$,totalUploadedSize:Z}){function K(){switch(m){case Au:case _u:{let Se=fn(y);return Se.mode==="determinate"?Se.value*100:w}case Dm:return null;case da:return k?w:null;default:return w}}function ie(){switch(m){case Au:case _u:{let{mode:Se}=fn(y);return Se==="indeterminate"}case da:return!k;default:return!1}}let Ae=K(),de=Ae??100,Ue=!n&&i&&(!t&&!r||f)&&e&&!o,fe=!l&&m!==mS&&m!==pa,ot=s&&!a&&m===da,Ot=n&&!A&&!h,Et=R&&m===pa,ft=(0,Cu.default)("uppy-StatusBar-progress",{"is-indeterminate":ie()}),re=(0,Cu.default)("uppy-StatusBar",`is-${m}`,{"has-ghosts":O}),Ye=(()=>{switch(m){case _u:case Au:return c(Om,{progress:fn(y)});case pa:return c(Mm,{i18n:F});case Dm:return c(Im,{error:n,i18n:F,numUploads:N,complete:z});case da:return c(Lm,{i18n:F,supportsUploadProgress:k,totalProgress:w,showProgressDetails:P,isUploadStarted:_,isAllComplete:A,isAllPaused:r,newFiles:i,numUploads:N,complete:z,totalUploadedSize:Z,totalSize:q,totalETA:$,startUpload:x});default:return null}})();return!(Ue||Ot||ot||fe||Et)&&!Ye||m===pa&&C?null:c("div",{className:re,children:[c("div",{className:ft,style:{width:`${de}%`},role:"progressbar","aria-label":`${de}%`,"aria-valuetext":`${de}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Ae}),Ye,c("div",{className:"uppy-StatusBar-actions",children:[Ue?c(km,{newFiles:i,isUploadStarted:_,recoveredState:f,i18n:F,isSomeGhost:O,startUpload:x,uploadState:m}):null,Ot?c(_m,{i18n:F,uppy:S}):null,ot?c(Cm,{isAllPaused:r,i18n:F,isAllComplete:A,resumableUploads:s,uppy:S}):null,fe?c(Am,{i18n:F,uppy:S}):null,Et?c(Fm,{i18n:F,doneButtonHandler:R}):null]})]})}var gS=2e3,bS=2e3;function yS(i,e,t,r){if(i)return Ft.STATE_ERROR;if(e)return Ft.STATE_COMPLETE;if(t)return Ft.STATE_WAITING;let s=Ft.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return Ft.STATE_UPLOADING;a.preprocess&&(s=Ft.STATE_PREPROCESSING),a.postprocess&&s!==Ft.STATE_PREPROCESSING&&(s=Ft.STATE_POSTPROCESSING)}return s}var vS={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},ss=class extends ni{static VERSION=Em.version;#e;#t;#i;#r;constructor(e,t){super(e,{...vS,...t}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=Tm,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}#s(e){if(e.total==null||e.total===0)return null;let t=e.total-e.uploaded;if(t<=0)return null;this.#e??=performance.now();let r=performance.now()-this.#e;if(r===0)return Math.round((this.#r??0)/100)/10;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#r??0)/100)/10;let n=s/r,o=this.#i==null?n:ha(n,this.#i,gS,r);this.#i=o;let a=t/o,l=Math.max(this.#r-r,0),h=this.#r==null?a:ha(a,l,bS,r);return this.#r=h,this.#e=performance.now(),Math.round(h/100)/10}startUpload=()=>this.uppy.upload().catch((()=>{}));render(e){let{capabilities:t,files:r,allowNewUpload:s,totalProgress:n,error:o,recoveredState:a}=e,{newFiles:l,startedFiles:h,completeFiles:f,isUploadStarted:m,isAllComplete:w,isAllPaused:y,isUploadInProgress:k,isSomeGhost:C}=this.uppy.getObjectOfFilesPerState(),O=a?Object.values(r):l,R=!!t.resumableUploads,_=t.uploadProgress!==!1,F=null,x=0;h.every(A=>A.progress.bytesTotal!=null&&A.progress.bytesTotal!==0)?(F=0,h.forEach(A=>{F+=A.progress.bytesTotal||0,x+=A.progress.bytesUploaded||0})):h.forEach(A=>{x+=A.progress.bytesUploaded||0});let S=this.#s({uploaded:x,total:F});return Fu({error:o,uploadState:yS(o,w,a,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:F,totalUploadedSize:x,isAllComplete:!1,isAllPaused:y,isUploadStarted:m,isUploadInProgress:k,isSomeGhost:C,recoveredState:a,complete:f.length,newFiles:O.length,numUploads:h.length,totalETA:S,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:R,supportsUploadProgress:_,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){let e=this.el;zo(e)||(e.dir="ltr")}#o=()=>{let{recoveredState:e}=this.uppy.getState();if(this.#i=null,this.#r=null,e){this.#t=Object.values(e.files).reduce((t,{progress:r})=>t+r.bytesUploaded,0),this.uppy.emit("restore-confirmed");return}this.#e=performance.now(),this.#t=0};install(){let{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",this.#o),this.#e=performance.now(),this.#t=this.uppy.getFiles().reduce((t,r)=>t+r.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",this.#o)}};var wS=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function SS(i,e,t){let r=wS.exec(i),s=e.mimeType??r?.[1]??"plain/text",n;if(r?.[2]!=null){let o=atob(decodeURIComponent(r[3])),a=new Uint8Array(o.length);for(let l=0;l<o.length;l++)a[l]=o.charCodeAt(l);n=[a]}else r?.[3]!=null&&(n=[decodeURIComponent(r[3])]);return t?new File(n,e.name||"",{type:s}):new Blob(n,{type:s})}var Nm=SS;function fa(i){return i.startsWith("blob:")}function ma(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function ue(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}var Wm=typeof self<"u"?self:global,yn=typeof navigator<"u",ES=yn&&typeof HTMLImageElement>"u",Bm=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),Gm=Wm.Buffer,Km=!!Gm,TS=i=>i!==void 0;function Xm(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(TS).length===0)}function Xe(i){let e=new Error(i);throw delete e.stack,e}function Um(i){let e=(function(t){let r=0;return t.ifd0.enabled&&(r+=1024),t.exif.enabled&&(r+=2048),t.makerNote&&(r+=2048),t.userComment&&(r+=1024),t.gps.enabled&&(r+=512),t.interop.enabled&&(r+=100),t.ifd1.enabled&&(r+=1024),r+2048})(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}var Pu=i=>String.fromCharCode.apply(null,i),zm=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,Sr=class i{static from(e,t){return e instanceof this&&e.le===t?e:new i(e,void 0,void 0,t)}constructor(e,t=0,r,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){r===void 0&&(r=e.byteLength-t);let n=new DataView(e,t,r);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof i){r===void 0&&(r=e.byteLength-t),(t+=e.byteOffset)+r>e.byteOffset+e.byteLength&&Xe("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,r);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else Xe("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,r=i){return e instanceof DataView||e instanceof i?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||Xe("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new r(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new i(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return s=this.getUint8Array(e,t),zm?zm.decode(s):Km?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(Pu(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return Pu(r)}getUnicodeString(e=0,t=this.byteLength){let r=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)r.push(this.getUint16(e+s));return Pu(r)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}getUint(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function Ru(i,e){Xe(`${i} '${e}' was not loaded, try using full build of exifr.`)}var vn=class extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||Ru(this.kind,e),t&&(e in t||(function(r,s){Xe(`Unknown ${r} '${s}'.`)})(this.kind,e),t[e].enabled||Ru(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},wa=new vn("file parser"),Pt=new vn("segment parser"),En=new vn("file reader"),xS=Wm.fetch;function Hm(i,e){return(t=i).startsWith("data:")||t.length>1e4?Mu(i,e,"base64"):Bm&&i.includes("://")?Lu(i,e,"url",ga):Bm?Mu(i,e,"fs"):yn?Lu(i,e,"url",ga):void Xe("Invalid input argument");var t}async function Lu(i,e,t,r){return En.has(t)?Mu(i,e,t):r?(async function(s,n){let o=await n(s);return new Sr(o)})(i,r):void Xe(`Parser ${t} is not loaded`)}async function Mu(i,e,t){let r=new(En.get(t))(i,e);return await r.read(),r}var ga=i=>xS(i).then((e=>e.arrayBuffer())),wn=i=>new Promise(((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)})),Iu=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function Ym(i,e,t){let r=new Iu;for(let[s,n]of t)r.set(s,n);if(Array.isArray(e))for(let s of e)i.set(s,r);else i.set(e,r);return r}function Zm(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}var Tn=new Map,zu=new Map,Hu=new Map,ns=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],Sa=["jfif","xmp","icc","iptc","ihdr"],Sn=["tiff",...Sa],Be=["ifd0","ifd1","exif","gps","interop"],os=[...Sn,...Be],as=["makerNote","userComment"],Ea=["translateKeys","translateValues","reviveValues","multiSegment"],ls=[...Ea,"sanitize","mergeOutput","silentErrors"],ba=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},wr=class extends ba{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),ue(this,"enabled",!1),ue(this,"skip",new Set),ue(this,"pick",new Set),ue(this,"deps",new Set),ue(this,"translateKeys",!1),ue(this,"translateValues",!1),ue(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=Be.includes(e),this.canBeFiltered&&(this.dict=Tn.get(e)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:n,skip:o}=r;n&&n.length>0&&this.translateTagSet(n,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:Xe(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of Ea)r=e[t],r!==void 0&&(this[t]=r)}translateTagSet(e,t){if(this.dict){let r,s,{tagKeys:n,tagValues:o}=this.dict;for(r of e)typeof r=="string"?(s=o.indexOf(r),s===-1&&(s=n.indexOf(Number(r))),s!==-1&&t.add(Number(n[s]))):t.add(r)}else for(let r of e)t.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,ya(this.pick,this.deps)):this.enabled&&this.pick.size>0&&ya(this.pick,this.deps)}},pt={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},jm=new Map,Er=class extends ba{static useCached(e){let t=jm.get(e);return t!==void 0||(t=new this(e),jm.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):Xe(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=yn?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of ns)this[e]=pt[e];for(e of ls)this[e]=pt[e];for(e of as)this[e]=pt[e];for(e of os)this[e]=new wr(e,pt[e],void 0,this)}setupFromTrue(){let e;for(e of ns)this[e]=pt[e];for(e of ls)this[e]=pt[e];for(e of as)this[e]=!0;for(e of os)this[e]=new wr(e,!0,void 0,this)}setupFromArray(e){let t;for(t of ns)this[t]=pt[t];for(t of ls)this[t]=pt[t];for(t of as)this[t]=pt[t];for(t of os)this[t]=new wr(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,Be)}setupFromObject(e){let t;for(t of(Be.ifd0=Be.ifd0||Be.image,Be.ifd1=Be.ifd1||Be.thumbnail,Object.assign(this,e),ns))this[t]=Ou(e[t],pt[t]);for(t of ls)this[t]=Ou(e[t],pt[t]);for(t of as)this[t]=Ou(e[t],pt[t]);for(t of Sn)this[t]=new wr(t,pt[t],e[t],this);for(t of Be)this[t]=new wr(t,pt[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Be,os),e.tiff===!0?this.batchEnableWithBool(Be,!0):e.tiff===!1?this.batchEnableWithUserValue(Be,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Be):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Be)}batchEnableWithBool(e,t){for(let r of e)this[r].enabled=t}batchEnableWithUserValue(e,t){for(let r of e){let s=t[r];this[r].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,r,s=r){if(e&&e.length){for(let o of s)this[o].enabled=!1;let n=qm(e,r);for(let[o,a]of n)ya(this[o].pick,a),this[o].enabled=!0}else if(t&&t.length){let n=qm(t,r);for(let[o,a]of n)ya(this[o].skip,a)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:r,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),r.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:r,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),r.needed&&e.deps.add(34853),this.tiff.enabled=Be.some((n=>this[n].enabled===!0))||this.makerNote||this.userComment;for(let n of Be)this[n].finalizeFilters()}get onlyTiff(){return!Sa.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of Sn)this[e].enabled&&!Pt.has(e)&&Ru("segment parser",e)}};function qm(i,e){let t,r,s,n,o=[];for(s of e){for(n of(t=Tn.get(s),r=[],t))(i.includes(n[0])||i.includes(n[1]))&&r.push(n[0]);r.length&&o.push([s,r])}return o}function Ou(i,e){return i!==void 0?i:e!==void 0?e:void 0}function ya(i,e){for(let t of e)i.add(t)}ue(Er,"default",pt);var cs=class{constructor(e){ue(this,"parsers",{}),ue(this,"output",{}),ue(this,"errors",[]),ue(this,"pushToErrors",(t=>this.errors.push(t))),this.options=Er.useCached(e)}async read(e){this.file=await(function(t,r){return typeof t=="string"?Hm(t,r):yn&&!ES&&t instanceof HTMLImageElement?Hm(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new Sr(t):yn&&t instanceof Blob?Lu(t,r,"blob",wn):void Xe("Invalid input argument")})(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of wa)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[r]=!0;this.file.close&&this.file.close(),Xe("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),Xm(r=e)?void 0:r;var r}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map((async r=>{let s=await r.parse();r.assignToOutput(e,s)}));this.options.silentErrors&&(t=t.map((r=>r.catch(this.pushToErrors)))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,r=Pt.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),o=this.parsers.tiff=new r(n,e,t),a=await o.extractThumbnail();return t.close&&t.close(),a}};async function Qm(i,e){let t=new cs(e);return await t.read(i),t.parse()}var kS=Object.freeze({__proto__:null,parse:Qm,Exifr:cs,fileParsers:wa,segmentParsers:Pt,fileReaders:En,tagKeys:Tn,tagValues:zu,tagRevivers:Hu,createDictionary:Ym,extendDictionary:Zm,fetchUrlAsArrayBuffer:ga,readBlobAsArrayBuffer:wn,chunkedProps:ns,otherSegments:Sa,segments:Sn,tiffBlocks:Be,segmentsAndBlocks:os,tiffExtractables:as,inheritables:Ea,allFormatters:ls,Options:Er}),Gi=class{static findPosition(e,t){let r=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,r):this.headerLength,n=t+s,o=r-s;return{offset:t,length:r,headerLength:s,start:n,size:o,end:n+o}}static parse(e,t={}){return new this(e,new Er({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof Sr?e:new Sr(e)}constructor(e,t={},r){ue(this,"errors",[]),ue(this,"raw",new Map),ue(this,"handleError",(s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)})),this.chunk=this.normalizeInput(e),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let r=Hu.get(t),s=zu.get(t),n=Tn.get(t),o=this.options[t],a=o.reviveValues&&!!r,l=o.translateValues&&!!s,h=o.translateKeys&&!!n,f={};for(let[m,w]of e)a&&r.has(m)?w=r.get(m)(w):l&&s.has(m)&&(w=this.translateValue(w,s.get(m))),h&&n.has(m)&&(m=n.get(m)||m),f[m]=w;return f}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,r){if(this.globalOptions.mergeOutput)return Object.assign(e,r);e[t]?Object.assign(e[t],r):e[t]=r}};ue(Gi,"headerLength",4),ue(Gi,"type",void 0),ue(Gi,"multiSegment",!1),ue(Gi,"canHandle",(()=>!1));function _S(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function AS(i){return i>=224&&i<=239}function CS(i,e,t){for(let[r,s]of Pt)if(s.canHandle(i,e,t))return r}var va=class extends class{constructor(e,t,r){ue(this,"errors",[]),ue(this,"ensureSegmentChunk",(async s=>{let n=s.start,o=s.size||65536;if(this.file.chunked)if(this.file.available(n,o))s.chunk=this.file.subarray(n,o);else try{s.chunk=await this.file.readChunk(n,o)}catch(a){Xe(`Couldn't read segment: ${JSON.stringify(s)}. ${a.message}`)}else this.file.byteLength>n+o?s.chunk=this.file.subarray(n,o):s.size===void 0?s.chunk=this.file.subarray(n):Xe("Segment unreachable: "+JSON.stringify(s));return s.chunk})),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=r}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let r=new(Pt.get(e))(t,this.options,this.file);return this.parsers[e]=r}createParsers(e){for(let t of e){let{type:r,chunk:s}=t,n=this.options[r];if(n&&n.enabled){let o=this.parsers[r];o&&o.append||o||this.createParser(r,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{constructor(...e){super(...e),ue(this,"appSegments",[]),ue(this,"jpegSegments",[]),ue(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(Pt.keyList())):(e=e===void 0?Pt.keyList().filter((t=>this.options[t].enabled)):e.filter((t=>this.options[t].enabled&&Pt.has(t))),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:r,findAll:s,wanted:n,remaining:o}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some((a=>{let l=Pt.get(a),h=this.options[a];return l.multiSegment&&h.multiSegment})),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let a=!1;for(;o.size>0&&!a&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=r,h=this.appSegments.some((f=>!this.file.available(f.offset||f.start,f.length||f.size)));if(a=e>l&&!h?!await r.readNextChunk(e):!await r.readNextChunk(l),(e=this.findAppSegmentsInRange(e,r.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let r,s,n,o,a,l,{file:h,findAll:f,wanted:m,remaining:w,options:y}=this;for(;e<t;e++)if(h.getUint8(e)===255){if(r=h.getUint8(e+1),AS(r)){if(s=h.getUint16(e+2),n=CS(h,e,s),n&&m.has(n)&&(o=Pt.get(n),a=o.findPosition(h,e),l=y[n],a.type=n,this.appSegments.push(a),!f&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=a.chunkNumber<a.chunkCount,this.unfinishedMultiSegment||w.delete(n)):w.delete(n),w.size===0)))break;y.recordUnknownSegments&&(a=Gi.findPosition(h,e),a.marker=r,this.unknownSegments.push(a)),e+=s+1}else if(_S(r)){if(s=h.getUint16(e+2),r===218&&y.stopAfterSos!==!1)return;y.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:r}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some((t=>t.multiSegment)))return;let e=(function(t,r){let s,n,o,a=new Map;for(let l=0;l<t.length;l++)s=t[l],n=s[r],a.has(n)?o=a.get(n):a.set(n,o=[]),o.push(s);return Array.from(a)})(this.appSegments,"type");this.mergedAppSegments=e.map((([t,r])=>{let s=Pt.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(r)}:r[0]}))}getSegment(e){return this.appSegments.find((t=>t.type===e))}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};ue(va,"type","jpeg"),wa.set("jpeg",va);var FS=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],Du=class extends Gi{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,r=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let o=s.size>0,a=n.size===0,l=this.chunk.getUint16(e);e+=2;for(let h=0;h<l;h++){let f=this.chunk.getUint16(e);if(o){if(s.has(f)&&(r.set(f,this.parseTag(e,f,t)),s.delete(f),s.size===0))break}else!a&&n.has(f)||r.set(f,this.parseTag(e,f,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),o=s.getUint32(e+4),a=FS[n];if(a*o<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&Xe(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&Xe(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,o);if(n===2)return(l=(function(h){for(;h.endsWith("\0");)h=h.slice(0,-1);return h})(l=s.getString(e,o)).trim())===""?void 0:l;var l;if(n===7)return s.getUint8Array(e,o);if(o===1)return this.parseTagValue(n,e);{let h=new((function(m){switch(m){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}})(n))(o),f=a;for(let m=0;m<o;m++)h[m]=this.parseTagValue(n,e),e+=f;return h}}parseTagValue(e,t){let{chunk:r}=this;switch(e){case 1:return r.getUint8(t);case 3:return r.getUint16(t);case 4:return r.getUint32(t);case 5:return r.getUint32(t)/r.getUint32(t+4);case 6:return r.getInt8(t);case 8:return r.getInt16(t);case 9:return r.getInt32(t);case 10:return r.getInt32(t)/r.getInt32(t+4);case 11:return r.getFloat(t);case 12:return r.getDouble(t);case 13:return r.getUint32(t);default:Xe(`Invalid tiff type ${e}`)}}},bn=class extends Du{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let r=new Map;return this[t]=r,this.parseTags(e,t,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&Xe("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Xe(`IFD0 offset points to outside of file.
98
- this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,Um(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,Um(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",$m(...e.get(2),e.get(1))),e.set("longitude",$m(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Be)if(e=this[t],!Xm(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function $m(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}ue(bn,"type","tiff"),ue(bn,"headerLength",10),Pt.set("tiff",bn);var YP=Object.freeze({__proto__:null,default:kS,Exifr:cs,fileParsers:wa,segmentParsers:Pt,fileReaders:En,tagKeys:Tn,tagValues:zu,tagRevivers:Hu,createDictionary:Ym,extendDictionary:Zm,fetchUrlAsArrayBuffer:ga,readBlobAsArrayBuffer:wn,chunkedProps:ns,otherSegments:Sa,segments:Sn,tiffBlocks:Be,segmentsAndBlocks:os,tiffExtractables:as,inheritables:Ea,allFormatters:ls,Options:Er,parse:Qm}),ju={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},ZP=Object.assign({},ju,{firstChunkSize:4e4,gps:[1,2,3,4]});var QP=Object.assign({},ju,{tiff:!1,ifd1:!0,mergeOutput:!1});var PS=Object.assign({},ju,{firstChunkSize:4e4,ifd0:[274]});async function OS(i){let e=new cs(PS);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}var RS=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),mn=!0,gn=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;mn=Number(t)+.1*Number(r)<13.4,gn=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);mn=gn=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);mn=gn=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);mn=gn=Number(e)<77}}async function Jm(i){let e=await OS(i);return Object.assign({canvas:mn,css:gn},RS[e])}var Nu=class extends Sr{constructor(...e){super(...e),ue(this,"ranges",new Bu),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=Km?Gm.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},Bu=class{constructor(){ue(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter((o=>Vm(e,o.offset,s)||Vm(e,o.end,s)));if(n.length>0){e=Math.min(e,...n.map((a=>a.offset))),s=Math.max(s,...n.map((a=>a.end))),t=s-e;let o=n.shift();o.offset=e,o.length=t,o.end=s,this.list=this.list.filter((a=>!n.includes(a)))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some((s=>s.offset<=e&&r<=s.end))}};function Vm(i,e,t){return i<=e&&e<=t}var Uu=class extends Nu{constructor(e,t){super(0),ue(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};En.set("blob",class extends Uu{async readWhole(){this.chunked=!1;let i=await wn(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await wn(r);return this.set(s,i,!0)}});var eg={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"4.2.3",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","thumbnail","preview","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",exifr:"^7.0.0"},devDependencies:{jsdom:"^26.1.0","namespace-emitter":"2.0.1",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var tg={strings:{generatingThumbnails:"Generating thumbnails..."}};function MS(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>Nm(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}function IS(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}function DS(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let o=document.createElement("canvas");return o.width=s,o.height=n,o.getContext("2d").drawImage(i,0,0,s,n),o}return i}var NS={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},xn=class extends ni{static VERSION=eg.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...NS,...t}),this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=tg,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){let s=URL.createObjectURL(e.data),n=new Promise((a,l)=>{let h=new Image;h.src=s,h.addEventListener("load",()=>{URL.revokeObjectURL(s),a(h)}),h.addEventListener("error",f=>{URL.revokeObjectURL(s),l(f.error||new Error("Could not create thumbnail"))})}),o=Jm(e.data).catch(()=>1);return Promise.all([n,o]).then(([a,l])=>{let h=this.getProportionalDimensions(a,t,r,l.deg),f=IS(a,l),m=this.resizeImage(f,h.width,h.height);return MS(m,this.thumbnailType,80)}).then(a=>URL.createObjectURL(a))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;if((s===90||s===270)&&(n=e.height/e.width),t!=null){let o=t;return e.width<t&&(o=e.width),{width:o,height:Math.round(o/n)}}if(r!=null){let o=r;return e.height<r&&(o=e.height),{width:Math.round(o*n),height:o}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=DS(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let o=t*2**(n-1),a=r*2**(n-1),l=2;for(;n--;){let h=document.createElement("canvas");h.width=o,h.height=a,h.getContext("2d").drawImage(s,0,0,o,a),s=h,o=Math.round(o/l),a=Math.round(a/l)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return ma(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}onFileAdded=e=>{!e.preview&&e.data&&ma(e.type)&&!e.isRemote&&this.addToQueue(e.id)};onCancelRequest=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1)};onFileRemoved=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1),e.preview&&fa(e.preview)&&URL.revokeObjectURL(e.preview)};onRestored=()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||fa(t.preview))&&this.addToQueue(t.id)})};onAllFilesRemoved=()=>{this.queue=[]};waitUntilAllProcessed=e=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let t=()=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-complete",s)})};return new Promise(r=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{t(),r()}):(t(),r())})};install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};function BS(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&Vs(i)?[i]:null}var qu=BS;var Ki=Array.from;function $u(i){let e=Ki(i.files);return Promise.resolve(e)}function Ta(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{Ta(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}function ig(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{Ta(t,[],e,{onSuccess:n=>s(n.map(o=>ig(o,e)))})})},isSameEntry:void 0}}async function*rg(i,e,t=void 0){let r=()=>`${e}/${i.name}`;if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*rg(s,e?r():i.name);else t!=null&&(yield t)}async function*Vu(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=ig(typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),e),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*rg(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}async function Wu(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of Vu(i,t))r.push(s);return r}catch{return $u(i)}}var sg={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",version:"4.4.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest watch --project browser --browser.headless false"},keywords:["file uploader","uppy","uppy-plugin","dashboard","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/informer":"^4.3.2","@uppy/provider-views":"^4.5.2","@uppy/status-bar":"^4.2.3","@uppy/thumbnail-generator":"^4.2.2","@uppy/utils":"^6.2.2",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9",preact:"^10.5.13","shallow-equal":"^3.0.0"},devDependencies:{"@uppy/core":"^4.5.2","@uppy/google-drive":"^4.4.2","@uppy/status-bar":"^4.2.3","@uppy/url":"^4.3.2","@uppy/webcam":"^4.3.2","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1","resize-observer-polyfill":"^1.5.0",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.2"}};function Gu(){let i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var Eg=ye(ht(),1);var Ku=class extends we{fileInput=null;folderInput=null;mobilePhotoFileInput=null;mobileVideoFileInput=null;triggerFileInputClick=()=>{this.fileInput?.click()};triggerFolderInputClick=()=>{this.folderInput?.click()};triggerVideoCameraInputClick=()=>{this.mobileVideoFileInput?.click()};triggerPhotoCameraInputClick=()=>{this.mobilePhotoFileInput?.click()};onFileInputChange=e=>{this.props.handleInputChange(e),e.currentTarget.value=""};renderHiddenInput=(e,t)=>c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes?.join(", "),ref:t});renderHiddenCameraInput=(e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t===""?"environment":t,accept:n,ref:r})};renderMyDeviceAcquirer=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})});renderPhotoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})});renderVideoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})});renderBrowseButton=(e,t)=>{let r=this.props.acquirers.length;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0,children:e})};renderDropPasteBrowseTagline=e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return c("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t})})};[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderAcquirer=e=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id,children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":this.props.activePickerPanel?.id===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id),children:[c("div",{className:"uppy-DashboardTab-inner",children:e.icon()}),c("div",{className:"uppy-DashboardTab-name",children:e.name})]})});renderAcquirers=e=>{let t=[...e],r=t.splice(e.length-2,e.length);return c(_e,{children:[t.map(s=>this.renderAcquirer(s)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:r.map(s=>this.renderAcquirer(s))})]})};renderSourcesList=(e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],o="myDevice";t||n.push({key:o,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(f=>({key:f.id,elements:this.renderAcquirer(f)}))),n.length===1&&n[0].key===o&&(n=[]);let l=[...n],h=l.splice(n.length-2,n.length);return c(_e,{children:[this.renderDropPasteBrowseTagline(n.length),c("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[l.map(({key:f,elements:m})=>c(_e,{children:m},f)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:h.map(({key:f,elements:m})=>c(_e,{children:m},f))})]})]})};renderPoweredByUppy(){let{i18nArray:e}=this.props,t=c("span",{children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),c("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),r=e("poweredBy",{uppy:t});return c("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:r})}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return c("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),c("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&c("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}},xa=Ku;var ng=ye(ht(),1);var zS=i=>c("div",{className:(0,ng.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18n("addingMoreFiles")}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1),children:i.i18n("back")})]}),c(xa,{...i})]}),og=zS;var ag=ye(ht(),1);function HS(i){let e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return c("div",{className:(0,ag.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18nArray("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:i.i18n("cancel")}),c("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor,children:i.i18n("save")})]}),c("div",{className:"uppy-DashboardContent-panelBody",children:i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))})]})}var lg=HS;var cg=ye(ht(),1);function jS(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#686DE0",fillRule:"evenodd",children:[c("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),c("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),c("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}function qS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}function $S(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}function VS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}function WS(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}function GS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[c("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),c("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}function KS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}function Tr(i){let e={color:"#838999",icon:GS()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:KS()}:t==="image"?{color:"#686de0",icon:jS()}:t==="audio"?{color:"#068dbb",icon:qS()}:t==="video"?{color:"#19af67",icon:$S()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:VS()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:WS()}:e}function XS(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}var fi=XS;function kn(i){let{file:e}=i;if(e.preview)return c("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=Tr(e.type);return c("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[c("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t},children:r}),c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:c("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}function Xu(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(a=>{let l=`uppy-Dashboard-FileCard-input-${a.id}`,h=t.includes(a.id);return c("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[c("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l,children:a.name}),a.render!==void 0?a.render({value:n[a.id],onChange:f=>r(f,a.id),fieldCSSClasses:o,required:h,form:s.id},ki):c("input",{className:o.text,id:l,form:s.id,type:a.type||"text",required:h,value:n[a.id],placeholder:a.placeholder,onInput:f=>r(f.target.value,a.id),"data-uppy-super-focusable":!0})]},a.id)})}function Yu(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:o,openFileEditor:a,i18n:l,i18nArray:h,className:f,canEditFile:m}=i,w=()=>typeof n=="function"?n(e[t]):n,y=e[t],k=w()??[],C=m(y),O={};k.forEach(P=>{O[P.id]=y.meta[P.id]??""});let[R,_]=Kt(O),F=Vi(P=>{P.preventDefault(),s(R,t)},[s,R,t]),x=(P,N)=>{_({...R,[N]:P})},S=()=>{r(!1)},[A]=Kt(()=>{let P=document.createElement("form");return P.setAttribute("tabindex","-1"),P.id=Wi(),P});return si(()=>(document.body.appendChild(A),A.addEventListener("submit",F),()=>{A.removeEventListener("submit",F),document.body.removeChild(A)}),[A,F]),c("div",{className:(0,cg.default)("uppy-Dashboard-FileCard",f),"data-uppy-panelType":"FileCard",onDragOver:fi,onDragLeave:fi,onDrop:fi,onPaste:fi,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:h("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:y.meta?y.meta.name:y.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",form:A.id,title:l("finishEditingFile"),onClick:S,children:l("cancel")})]}),c("div",{className:"uppy-Dashboard-FileCard-inner",children:[c("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:Tr(y.type).color},children:[c(kn,{file:y}),C&&c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:P=>{F(P),a(y)},children:l("editImage")})]}),c("div",{className:"uppy-Dashboard-FileCard-info",children:c(Xu,{computedMetaFields:k,requiredMetaFields:o,updateMeta:x,form:A,formState:R})}),c("div",{className:"uppy-Dashboard-FileCard-actions",children:[c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:A.id,children:l("saveChanges")}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:S,form:A.id,children:l("cancel")})]})]})]})}var pg=ye(ht(),1);function ug(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let o=t[n];if(i[o]!==e[o]||!Object.prototype.hasOwnProperty.call(e,o))return!1}return!0}function Zu(i,e="Copy the URL below"){return new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=()=>{document.body.removeChild(r),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}function YS({file:i,uploadInProgressOrComplete:e,metaFields:t,canEditFile:r,i18n:s,onClick:n}){return!e&&t&&t.length>0||!e&&r(i)?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:i.meta.name}),title:s("editFileWithFilename",{file:i.meta.name}),onClick:()=>n(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:c("g",{fillRule:"evenodd",children:[c("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),c("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),c("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}function ZS({i18n:i,onClick:e,file:t}){return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":i("removeFile",{file:t.meta.name}),title:i("removeFile",{file:t.meta.name}),onClick:()=>e(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[c("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),c("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}function QS({file:i,uppy:e,i18n:t}){let r=s=>{Zu(i.uploadURL,t("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(t("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>s.target.focus({preventScroll:!0}))};return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":t("copyLink"),title:t("copyLink"),onClick:s=>r(s),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:c("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}function Qu(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:o,showRemoveButton:a,i18n:l,toggleFileCard:h,openFileEditor:f}=i;return c("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[c(YS,{i18n:l,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:()=>{n&&n.length>0?h(!0,t.id):f(t)}}),o&&t.uploadURL?c(QS,{file:t,uppy:e,i18n:l}):null,a?c(ZS,{i18n:l,file:t,onClick:()=>e.removeFile(t.id)}):null]})}var hg=ye(Ko(),1);function ka(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=4)return`${i.slice(0,e-1)}\u2026`;let t=e-3,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+"..."+i.slice(-s)}var JS=(i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name;function _n(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!n?.length)return null;let o=n.map(a=>JS(a,s)).join(", ");return c("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:n.length,fields:o})," ",c("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id),children:r("editFile")})]})}var eE=i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return c("div",{className:"uppy-Dashboard-Item-name",title:t,children:ka(t,r())})},tE=i=>{let{author:e}=i.file.meta,t=i.file.remote?.providerName,r="\xB7";return e?c("div",{className:"uppy-Dashboard-Item-author",children:[c("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:ka(e.name,13)}),t?c(_e,{children:[` ${r} `,t,` ${r} `]}):null]}):null},iE=i=>i.file.size&&c("div",{className:"uppy-Dashboard-Item-statusSize",children:(0,hg.default)(i.file.size)}),rE=i=>i.file.isGhost&&c("span",{children:[" \u2022 ",c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>i.toggleAddFilesPanel(!0),children:i.i18n("reSelect")})]}),sE=({file:i,onClick:e})=>i.error?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":i.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:e,type:"button",children:"?"}):null;function Ju(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:o,containerHeight:a,containerWidth:l}=i;return c("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[c("div",{className:"uppy-Dashboard-Item-fileName",children:[eE({file:e,isSingleFile:o,containerHeight:a,containerWidth:l}),c(sE,{file:e,onClick:()=>alert(e.error)})]}),c("div",{className:"uppy-Dashboard-Item-status",children:[tE({file:e}),iE({file:e}),rE({file:e,toggleAddFilesPanel:n,i18n:t})]}),c(_n,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function eh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,a=e.preview?"rgba(255, 255, 255, 0.5)":Tr(e.type).color;return c("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:a},children:[n&&e.uploadURL&&c("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:c("span",{hidden:!0,children:e.meta.name})}),c(kn,{file:e}),c(_n,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function nE(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function dg(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function th(i){return c("div",{className:"uppy-Dashboard-Item-progress",children:c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":dg(i),title:dg(i),onClick:()=>nE(i),children:i.children})})}function _a({children:i}){return c("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:i})}function ih({progress:i}){let e=2*Math.PI*15;return c("g",{children:[c("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),c("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":e,"stroke-dashoffset":e-e/100*i})]})}function rh(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(_a,{children:[c("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),c("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):i.recoveredState?null:i.error&&!i.hideRetryButton?c(th,{...i,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[c("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),c("path",{d:"M7.9 3H10v2H7.9z"}),c("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),c("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):i.resumableUploads&&!i.hidePauseResumeButton?c(th,{...i,children:c(_a,{children:[c(ih,{progress:i.file.progress.percentage}),i.file.isPaused?c("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):c("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[c("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),c("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?c(th,{...i,children:c(_a,{children:[c(ih,{progress:i.file.progress.percentage}),c("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(_a,{children:c(ih,{progress:i.file.progress.percentage})})})})}var An=class extends we{componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!ug(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:a}=e,l=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(l=!0);let h=(0,pg.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":a});return c("div",{className:h,id:`uppy_${e.id}`,role:this.props.role,children:[c("div",{className:"uppy-Dashboard-Item-preview",children:[c(eh,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),c(rh,{uppy:this.props.uppy,file:e,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),c("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[c(Ju,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),c(Qu,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}};function oE(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}function sh({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:f,isSingleFile:m,toggleFileCard:w,handleRequestThumbnail:y,handleCancelThumbnail:k,recoveredState:C,individualCancellation:O,itemsPerRow:R,openFileEditor:_,canEditFile:F,toggleAddFilesPanel:x,containerWidth:S,containerHeight:A}){let P=R===1?71:200,N=$i(()=>{let q=(Z,K)=>Number(r[K].isGhost)-Number(r[Z].isGhost),$=Object.keys(r);return C&&$.sort(q),oE($,R)},[r,R,C]),z=q=>c("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:q.map($=>c(An,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:O,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:f,recoveredState:C,isSingleFile:m,containerWidth:S,containerHeight:A,toggleFileCard:w,handleRequestThumbnail:y,handleCancelThumbnail:k,role:"listitem",openFileEditor:_,canEditFile:F,toggleAddFilesPanel:x,file:r[$]},$))},q[0]);return m?c("div",{class:"uppy-Dashboard-files",children:z(N[0])}):c(ia,{class:"uppy-Dashboard-files",role:"list",data:N,renderRow:z,rowHeight:P})}var fg=ye(ht(),1);function aE({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let o=qi(null);return c("div",{className:(0,fg.default)("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${i.id}`,onDragOver:fi,onDragLeave:fi,onDrop:fi,onPaste:fi,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:i.name})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:r("cancel")})]}),c("div",{ref:o,className:"uppy-DashboardContent-panelBody",children:n.getPlugin(i.id).render(s,o.current)})]})}var mg=aE;var mi={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function lE(i,e,t,r={}){if(i)return mi.STATE_ERROR;if(e)return mi.STATE_COMPLETE;if(t)return mi.STATE_PAUSED;let s=mi.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return mi.STATE_UPLOADING;a.preprocess&&s!==mi.STATE_UPLOADING&&(s=mi.STATE_PREPROCESSING),a.postprocess&&s!==mi.STATE_UPLOADING&&s!==mi.STATE_PREPROCESSING&&(s=mi.STATE_POSTPROCESSING)}return s}function cE({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:o,processingFiles:a}){switch(lE(r,t,s,i)){case"uploading":return e("uploadingXFiles",{smart_count:n.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:a.length});case"paused":return e("uploadPaused");case"waiting":return e("xFilesSelected",{smart_count:o.length});case"complete":return e("uploadComplete");case"error":return e("error");default:}}function uE(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:o}=i,{allowNewUpload:a}=i;return a&&s&&(a=i.totalFileCount<i.maxNumberOfFiles),c("div",{className:"uppy-DashboardContent-bar",children:[!t&&!r?c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll(),children:e("cancel")}):c("div",{}),c("div",{className:"uppy-DashboardContent-title",children:c(cE,{...i})}),a?c("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>n(!0),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:c("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),c("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):c("div",{})]})}var gg=uE;var yg=ye(ht(),1);var us="uppy-transition-slideDownUp",bg=250;function hE({children:i}){let[e,t]=Kt(null),[r,s]=Kt(""),n=qi(),o=qi(),a=qi(),l=()=>{s(`${us}-enter`),cancelAnimationFrame(a.current),clearTimeout(o.current),o.current=void 0,a.current=requestAnimationFrame(()=>{s(`${us}-enter ${us}-enter-active`),n.current=setTimeout(()=>{s("")},bg)})},h=()=>{s(`${us}-leave`),cancelAnimationFrame(a.current),clearTimeout(n.current),n.current=void 0,a.current=requestAnimationFrame(()=>{s(`${us}-leave ${us}-leave-active`),o.current=setTimeout(()=>{t(null),s("")},bg)})};return si(()=>{let f=wt(i)[0];e!==f&&(f&&!e?l():e&&!f&&!o.current&&h(),t(f))},[i,e]),si(()=>()=>{clearTimeout(n.current),clearTimeout(o.current),cancelAnimationFrame(a.current)},[]),e?Ys(e,{className:(0,yg.default)(r,e.props.className)}):null}var Cn=hE;var vg=900,wg=700,nh=576,Sg=330;function oh(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>nh,s=i.containerHeight>Sg,n=(0,Eg.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>nh,"uppy-size--lg":i.containerWidth>wg,"uppy-size--xl":i.containerWidth>vg,"uppy-size--height-md":i.containerHeight>Sg,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),o=1;i.containerWidth>vg?o=5:i.containerWidth>wg?o=4:i.containerWidth>nh&&(o=3);let a=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,h=i.files?Object.keys(i.files).filter(w=>i.files[w].isGhost).length:0,f=()=>h>0?i.i18n("recoveredXFiles",{smart_count:h}):i.i18n("recoveredAllFiles");return c("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&Gu(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop,children:[c("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),c("div",{className:"uppy-Dashboard-inner",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""},children:[i.inline?null:c("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal,children:c("span",{"aria-hidden":"true",children:"\xD7"})}),c("div",{className:"uppy-Dashboard-innerWrap",children:[c("div",{className:"uppy-Dashboard-dropFilesHereHint",children:i.i18n("dropHint")}),a&&c(gg,{...i}),l&&c("div",{className:"uppy-Dashboard-serviceMsg",children:[c("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:c("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[c("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),c("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),c("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),c("strong",{className:"uppy-Dashboard-serviceMsg-title",children:i.i18n("sessionRestored")}),c("div",{className:"uppy-Dashboard-serviceMsg-text",children:f()})]}),a?c(sh,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):c(xa,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),c(Cn,{children:i.showAddFilesPanel?c(og,{...i,isSizeMD:r},"AddFiles"):null}),c(Cn,{children:i.fileCardFor?c(Yu,{...i},"FileCard"):null}),c(Cn,{children:i.activePickerPanel?c(mg,{...i},"Picker"):null}),c(Cn,{children:i.showFileEditor?c(lg,{...i},"Editor"):null}),c("div",{className:"uppy-Dashboard-progressindicators",children:i.progressindicators.map(w=>i.uppy.getPlugin(w.id).render(i.state))})]})]})]})}var Tg={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};var Aa=['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])'];var xg=ye(su(),1);function Fn(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function ah(){let i=!1;return(0,xg.default)((t,r)=>{let s=Fn(t,r),n=s.contains(document.activeElement);if(n&&i)return;let o=s.querySelector("[data-uppy-super-focusable]");n&&!o||(o?(o.focus({preventScroll:!0}),i=!0):(s.querySelector(Aa)?.focus({preventScroll:!0}),i=!1))},260)}function kg(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}function dE(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function pE(i){return i.contains(document.activeElement)}function lh(i,e,t){let r=Fn(t,e),s=Ki(r.querySelectorAll(Aa)),n=s.indexOf(document.activeElement);pE(r)?i.shiftKey&&n===0?dE(i,s):!i.shiftKey&&n===s.length-1&&kg(i,s):kg(i,s)}function _g(i,e,t){e===null||lh(i,e,t)}var Ag=9,mE=27;function Cg(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}var gE={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:dn,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},xr=class extends ni{static VERSION=sg.version;#e;modalName=`uppy-Dashboard-${Wi()}`;superFocus=ah();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedScrollPosition;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{...gE,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=Tg,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),this.opts.onRequestCloseModal??=()=>this.closeModal(),this.i18nInit()}removeTarget=e=>{let r=this.getPluginState().targets.filter(s=>s.id!==e.id);this.setPluginState({targets:r})};addTarget=e=>{let t=e.id||e.constructor.name,r=e.title||t,s=e.type;if(s!=="acquirer"&&s!=="progressindicator"&&s!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let n={id:t,name:r,type:s},a=this.getPluginState().targets.slice();return a.push(n),this.setPluginState({targets:a}),this.el};hideAllPanels=()=>{let e=this.getPluginState(),t={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};e.activePickerPanel===t.activePickerPanel&&e.showAddFilesPanel===t.showAddFilesPanel&&e.showFileEditor===t.showFileEditor&&e.activeOverlayType===t.activeOverlayType||(this.setPluginState(t),this.uppy.emit("dashboard:close-panel",e.activePickerPanel?.id))};showPanel=e=>{let{targets:t}=this.getPluginState(),r=t.find(s=>s.type==="acquirer"&&s.id===e);this.setPluginState({activePickerPanel:r,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",e)};canEditFile=e=>{let{targets:t}=this.getPluginState();return this.#l(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))};openFileEditor=e=>{let{targets:t}=this.getPluginState(),r=this.#l(t);this.setPluginState({showFileEditor:!0,fileCardFor:e.id||null,activeOverlayType:"FileEditor"}),r.forEach(s=>{this.uppy.getPlugin(s.id).selectFile(e)})};closeFileEditor=()=>{let{metaFields:e}=this.getPluginState();e&&e.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})};saveFileEditor=()=>{let{targets:e}=this.getPluginState();this.#l(e).forEach(r=>{this.uppy.getPlugin(r.id).save()}),this.closeFileEditor()};openModal=()=>{let{promise:e,resolve:t}=Cg();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let r=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",r,!1),t()};this.el.addEventListener("animationend",r,!1)}else this.setPluginState({isHidden:!1}),t();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),e};closeModal=e=>{let t=e?.manualClose??!0,{isHidden:r,isClosing:s}=this.getPluginState();if(r||s)return;let{promise:n,resolve:o}=Cg();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let a=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",a,!1),o()};this.el.addEventListener("animationend",a,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),o();return document.removeEventListener("keydown",this.handleKeyDownInModal),t&&this.opts.browserBackButtonClose&&history.state?.[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),n};isModalOpen=()=>!this.getPluginState().isHidden||!1;requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal();setDarkModeCapability=e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,darkMode:e}})};handleSystemDarkModeChange=e=>{let t=e.matches;this.uppy.log(`[Dashboard] Dark mode is ${t?"on":"off"}`),this.setDarkModeCapability(t)};toggleFileCard=(e,t)=>{let r=this.uppy.getFile(t);e?this.uppy.emit("dashboard:file-edit-start",r):this.uppy.emit("dashboard:file-edit-complete",r),this.setPluginState({fileCardFor:e?t:null,activeOverlayType:e?"FileCard":null})};toggleAddFilesPanel=e=>{this.setPluginState({showAddFilesPanel:e,activeOverlayType:e?"AddFiles":null})};addFiles=e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||r.webkitRelativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}};startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(e=>{let t=e[0],{width:r,height:s}=t.contentRect;this.setPluginState({containerWidth:r,containerHeight:s,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let e=this.getPluginState(),t=!this.opts.inline&&e.isHidden;!e.areInsidesReadyToBeVisible&&!t&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)};stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)};recordIfFocusedOnUppyRecently=e=>{this.el.contains(e.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())};disableInteractiveElements=e=>{let t=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],r=this.#e??Ki(this.el.querySelectorAll(t)).filter(s=>!s.classList.contains("uppy-Dashboard-close"));for(let s of r)s.tagName==="A"?s.setAttribute("aria-disabled",e):s.disabled=e;e?this.#e=r:this.#e=null,this.dashboardIsDisabled=e};updateBrowserHistory=()=>{history.state?.[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)};handlePopState=e=>{this.isModalOpen()&&(!e.state||!e.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&e.state?.[this.modalName]&&history.back()};handleKeyDownInModal=e=>{e.keyCode===mE&&this.requestCloseModal(),e.keyCode===Ag&&lh(e,this.getPluginState().activeOverlayType,this.el)};handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()};handlePaste=e=>{this.uppy.iteratePlugins(r=>{r.type==="acquirer"&&r.handleRootPaste?.(e)});let t=Ki(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))};handleInputChange=e=>{e.preventDefault();let t=Ki(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(t))};handleDragOver=e=>{e.preventDefault(),e.stopPropagation();let t=()=>{let o=!0;return this.uppy.iteratePlugins(a=>{a.canHandleRootDrop?.(e)&&(o=!0)}),o},r=()=>{let{types:o}=e.dataTransfer;return o.some(a=>a==="Files")},s=t(),n=r();if(!s&&!n||this.opts.disabled||this.opts.disableLocalFiles&&(n||!s)||!this.uppy.getState().allowNewUpload){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(e)};handleDragLeave=e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(e)};handleDrop=async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)};this.uppy.log("[Dashboard] Processing dropped files");let s=await Wu(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(s)),this.opts.onDrop(e)};handleRequestThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",e)};handleCancelThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",e)};handleKeyDownInInline=e=>{e.keyCode===Ag&&_g(e,this.getPluginState().activeOverlayType,this.el)};handlePasteOnBody=e=>{this.el.contains(document.activeElement)&&this.handlePaste(e)};handleComplete=({failed:e})=>{this.opts.closeAfterFinish&&!e?.length&&this.requestCloseModal()};handleCancelRestore=()=>{this.uppy.emit("restore-canceled")};#t=()=>{if(this.opts.disableThumbnailGenerator)return;let e=600,t=this.uppy.getFiles();if(t.length===1){let r=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);r?.setOptions({thumbnailWidth:e});let s={...t[0],preview:void 0};r?.requestThumbnail(s).then(()=>{r?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}};#i=e=>{let t=e[0],{metaFields:r}=this.getPluginState(),s=r&&r.length>0,n=this.canEditFile(t);s&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,t.id):n&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(t)};initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){let e=qu(this.opts.trigger);e?e.forEach(t=>t.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",this.#c),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",this.#t),this.uppy.on("file-removed",this.#t),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",this.#i)};removeEvents=()=>{let e=qu(this.opts.trigger);!this.opts.inline&&e&&e.forEach(t=>t.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",this.#c),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",this.#t),this.uppy.off("file-removed",this.#t),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",this.#i)};superFocusOnEachUpdate=()=>{let e=this.el.contains(document.activeElement),t=document.activeElement===document.body||document.activeElement===null,r=this.uppy.getState().info.length===0,s=!this.opts.inline;r&&(s||e||t&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()};afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()};saveFileCard=(e,t)=>{this.uppy.setFileMeta(t,e),this.toggleFileCard(!1,t)};#r=e=>{let t=this.uppy.getPlugin(e.id);return{...e,icon:t.icon||this.opts.defaultPickerIcon,render:t.render}};#s=e=>{let t=this.uppy.getPlugin(e.id);return typeof t.isSupported!="function"?!0:t.isSupported()};#o=e=>e.filter(t=>t.type==="acquirer"&&this.#s(t)).map(this.#r);#n=e=>e.filter(t=>t.type==="progressindicator").map(this.#r);#l=e=>e.filter(t=>t.type==="editor").map(this.#r);render=e=>{let t=this.getPluginState(),{files:r,capabilities:s,allowNewUpload:n}=e,{newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:w,isUploadStarted:y,isAllComplete:k,isAllPaused:C}=this.uppy.getObjectOfFilesPerState(),O=this.#o(t.targets),R=this.#n(t.targets),_=this.#l(t.targets),F;return this.opts.theme==="auto"?F=s.darkMode?"dark":"light":F=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),oh({state:e,isHidden:t.isHidden,files:r,newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:w,isUploadStarted:y,isAllComplete:k,isAllPaused:C,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:O,theme:F,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:t.activePickerPanel,showFileEditor:t.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:t.isClosing,progressindicators:R,editors:_,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:e.recoveredState,metaFields:t.metaFields,resumableUploads:s.resumableUploads||!1,individualCancellation:s.individualCancellation,isMobileDevice:s.isMobileDevice,fileCardFor:t.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:t.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:t.containerWidth,containerHeight:t.containerHeight,areInsidesReadyToBeVisible:t.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:t.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})};#a=()=>{let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r?r.mount(this,r):this.uppy.log(`[Uppy] Dashboard could not find plugin '${t}', make sure to uppy.use() the plugins you are specifying`,"warning")})};#h=()=>{this.uppy.iteratePlugins(this.#c)};#c=e=>{let t=["acquirer","editor"];e&&!e.opts?.target&&t.includes(e.type)&&(this.getPluginState().targets.some(s=>e.id===s.id)||e.mount(this,e))};#d(){let{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideProgressAfterFinish:o,locale:a,doneButtonHandler:l}=this.opts;return{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideAfterFinish:o,locale:a,doneButtonHandler:l}}#u(){let{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s}=this.opts;return{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s,lazy:!s}}#f(){return{}}setOptions(e){super.setOptions(e),this.uppy.getPlugin(this.#g())?.setOptions(this.#d()),this.uppy.getPlugin(this.#p())?.setOptions(this.#u())}#g(){return`${this.id}:StatusBar`}#p(){return`${this.id}:ThumbnailGenerator`}#w(){return`${this.id}:Informer`}install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:e,closeAfterFinish:t}=this.opts;if(e&&t)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:r,allowMultipleUploadBatches:s}=this.uppy.opts;(r||s)&&t&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:n}=this.opts;n&&this.mount(n,this),this.opts.disableStatusBar||this.uppy.use(ss,{id:this.#g(),target:this,...this.#d()}),this.opts.disableInformer||this.uppy.use(ts,{id:this.#w(),target:this,...this.#f()}),this.opts.disableThumbnailGenerator||this.uppy.use(xn,{id:this.#p(),...this.#u()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let o=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${o?"on":"off"}`),this.setDarkModeCapability(o),this.opts.theme==="auto"&&this.darkModeMediaQuery?.addListener(this.handleSystemDarkModeChange),this.#a(),this.#h(),this.initEvents()};uninstall=()=>{if(!this.opts.disableInformer){let t=this.uppy.getPlugin(`${this.id}:Informer`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableStatusBar){let t=this.uppy.getPlugin(`${this.id}:StatusBar`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableThumbnailGenerator){let t=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);t&&this.uppy.removePlugin(t)}let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r&&r.unmount()}),this.opts.theme==="auto"&&this.darkModeMediaQuery?.removeListener(this.handleSystemDarkModeChange),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()}};var Fg={name:"@uppy/image-editor",description:"Image editor and cropping UI",version:"3.4.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","upload","uppy","uppy-plugin","image editor","cropper","crop","rotate","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",cropperjs:"^1.6.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Ig=ye(Pg(),1);function yE(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,o=e.height*s,a=(i.width-n)/2,l=(i.height-o)/2;return{width:n,height:o,left:a,top:l}}var Og=yE;function vE(i){return i*(Math.PI/180)}function wE(i,e,t){let r=Math.abs(vE(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}var Rg=wE;function SE(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}var Lg=SE;function EE(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}var Mg=EE;var Pn=class extends we{imgElement;cropper;constructor(e){super(e),this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new Ig.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=Lg(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=Mg(t,r,s);n&&this.cropper.setCropBoxData(n)}}onRotate90Deg=()=>{let{angle90Deg:e}=this.state,t=e-90;this.setState({angle90Deg:t,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(t);let r=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),n=Og(s,r);this.cropper.setCanvasData(n),this.cropper.setCropBoxData(n)};onRotateGranular=e=>{let t=Number(e.target.value);this.setState({angleGranular:t});let{angle90Deg:r}=this.state,s=r+t;this.cropper.rotateTo(s);let n=this.cropper.getImageData(),o=Rg(n.naturalWidth,n.naturalHeight,t),a=this.cropper.getImageData().scaleX<0?-o:o;this.cropper.scale(a,o)};renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return c("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:c("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")})})}renderRevert(){let{i18n:e,opts:t}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})]})})}renderRotate(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg,children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})]})})}renderFlip(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})]})})}renderZoomIn(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:()=>this.cropper.zoom(.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),c("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:()=>this.cropper.zoom(-.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})]})})}renderCropSquare(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})})}renderCropWidescreen(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),c("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),c("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t,s=URL.createObjectURL(e.data);return c("div",{className:"uppy-ImageCropper",children:[c("div",{className:"uppy-ImageCropper-container",children:c("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:n=>{this.imgElement=n}})}),c("div",{className:"uppy-ImageCropper-controls",children:[r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}};var Dg={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var Ng={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},Bg={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},TE={quality:.8,actions:Bg,cropperOptions:Ng},hs=class extends ni{static VERSION=Fg.version;cropper;constructor(e,t){super(e,{...TE,...t,actions:{...Bg,...t?.actions},cropperOptions:{...Ng,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=Dg,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}save=()=>{let e=s=>{let{currentImage:n}=this.getPluginState();this.uppy.setFileState(n.id,{data:new File([s],n.name??this.i18n("unnamed"),{type:s.type}),size:s.size,preview:void 0});let o=this.uppy.getFile(n.id);this.uppy.emit("thumbnail:request",o),this.setPluginState({currentImage:o}),this.uppy.emit("file-editor:complete",o)},{currentImage:t}=this.getPluginState(),r=this.cropper.getCroppedCanvas({});r.width%2!==0&&this.cropper.setData({width:r.width-1}),r.height%2!==0&&this.cropper.setData({height:r.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(e,t.type,this.opts.quality)};storeCropperInstance=e=>{this.cropper=e};selectFile=e=>{this.uppy.emit("file-editor:start",e),this.setPluginState({currentImage:e})};install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:c(Pn,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};var On=class{#e;#t=[];constructor(e){this.#e=e}on(e,t){return this.#t.push([e,t]),this.#e.on(e,t)}remove(){for(let[e,t]of this.#t.splice(0))this.#e.off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{this.#e.getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{this.#e.getFile(e)&&t()})}onCancelAll(e,t){this.on("cancel-all",(...r)=>{this.#e.getFile(e)&&t(...r)})}onResumeAll(e,t){this.on("resume-all",()=>{this.#e.getFile(e)&&t()})}};function xE(i){return new Error("Cancelled",{cause:i})}function Ug(i){if(i!=null){let e=()=>this.abort(i.reason);i.addEventListener("abort",e,{once:!0});let t=()=>{i.removeEventListener("abort",e)};this.then?.(t,t)}return this}var Ca=class{#e=0;#t=[];#i=!1;#r;#s=1;#o;#n;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#l(e){this.#e+=1;let t=!1,r;try{r=e()}catch(s){throw this.#e-=1,s}return{abort:s=>{t||(t=!0,this.#e-=1,r?.(s),this.#a())},done:()=>{t||(t=!0,this.#e-=1,this.#a())}}}#a(){queueMicrotask(()=>this.#h())}#h(){if(this.#i||this.#e>=this.limit||this.#t.length===0)return;let e=this.#t.shift();if(e==null)throw new Error("Invariant violation: next is null");let t=this.#l(e.fn);e.abort=t.abort,e.done=t.done}#c(e,t){let r={fn:e,priority:t?.priority||0,abort:()=>{this.#d(r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},s=this.#t.findIndex(n=>r.priority>n.priority);return s===-1?this.#t.push(r):this.#t.splice(s,0,r),r}#d(e){let t=this.#t.indexOf(e);t!==-1&&this.#t.splice(t,1)}run(e,t){return!this.#i&&this.#e<this.limit?this.#l(e):this.#c(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:Ug,abort(){s.abort()}}}}wrapPromiseFunction(e,t){return(...r)=>{let s,n=new Promise((o,a)=>{s=this.run(()=>{let l,h;try{h=Promise.resolve(e(...r))}catch(f){h=Promise.reject(f)}return h.then(f=>{l?a(l):(s.done(),o(f))},f=>{l?a(l):(s.done(),a(f))}),f=>{l=xE(f)}},t)});return n.abort=o=>{s.abort(o)},n.abortOn=Ug,n}}resume(){this.#i=!1,clearTimeout(this.#r);for(let e=0;e<this.limit;e++)this.#a()}#u=()=>this.resume();pause(e=null){this.#i=!0,clearTimeout(this.#r),e!=null&&(this.#r=setTimeout(this.#u,e))}rateLimit(e){clearTimeout(this.#n),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#o=this.limit-1,this.limit=this.#s,this.#n=setTimeout(this.#f,e))}#f=()=>{if(this.#i){this.#n=setTimeout(this.#f,0);return}this.#s=this.limit,this.limit=Math.ceil((this.#o+this.#s)/2);for(let e=this.#s;e<=this.limit;e++)this.#a();this.#o-this.#s>3?this.#n=setTimeout(this.#f,2e3):this.#s=Math.floor(this.#s/2)};get isPaused(){return this.#i}},Fa=Symbol("__queue");var hh=class 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}},Rn=hh;function kE(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}var zg=kE;var dh=class{#e;#t=!1;#i;#r;constructor(e,t){this.#r=e,this.#i=()=>t(e)}progress(){this.#t||this.#r>0&&(clearTimeout(this.#e),this.#e=setTimeout(this.#i,this.#r))}done(){this.#t||(clearTimeout(this.#e),this.#e=void 0,this.#t=!0)}},Hg=dh;var Pa=()=>{};function jg(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=Pa,onUploadProgress:o=Pa,shouldRetry:a=()=>!0,onAfterResponse:l=Pa,onTimeout:h=Pa,responseType:f,retries:m=3,signal:w=null,timeout:y=3e4,withCredentials:k=!1}=e,C=_=>.3*2**(_-1)*1e3,O=new Hg(y,h);function R(_=0){return new Promise(async(F,x)=>{let S=new XMLHttpRequest,A=P=>{a(S)&&_<m?setTimeout(()=>{R(_+1).then(F,x)},C(_)):(O.done(),x(P))};S.open(s,i,!0),S.withCredentials=k,f&&(S.responseType=f),w?.addEventListener("abort",()=>{S.abort(),x(new DOMException("Aborted","AbortError"))}),S.onload=async()=>{try{await l(S,_)}catch(P){P.request=S,A(P);return}S.status>=200&&S.status<300?(O.done(),F(S)):a(S)&&_<m?setTimeout(()=>{R(_+1).then(F,x)},C(_)):(O.done(),x(new Rn(S.statusText,S)))},S.onerror=()=>A(new Rn(S.statusText,S)),S.upload.onprogress=P=>{O.progress(),o(P)},r&&Object.keys(r).forEach(P=>{S.setRequestHeader(P,r[P])}),await n(S,_),S.send(t)})}return R()}function qg(i){let e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function $g(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}function Oa(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}var Vg={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function Ai(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var _E=0;function ps(i){return"__private_"+_E+++"_"+i}var AE={version:"4.3.3"};function CE(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),zg(i)?(t=new Rn(t,i),t):(t.request=i,t)}function Wg(i){return i.data.slice(0,i.data.size,i.meta.type)}var FE={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},kr=ps("getFetcher"),mh=ps("uploadLocalFile"),ph=ps("uploadBundle"),gh=ps("getCompanionClientArgs"),fh=ps("uploadFiles"),Ln=ps("handleUpload"),ds=class extends ji{constructor(e,t){if(super(e,{...FE,fieldName:t.bundle?"files[]":"file",...t}),Object.defineProperty(this,fh,{value:LE}),Object.defineProperty(this,gh,{value:RE}),Object.defineProperty(this,ph,{value:OE}),Object.defineProperty(this,mh,{value:PE}),Object.defineProperty(this,kr,{writable:!0,value:void 0}),Object.defineProperty(this,Ln,{writable:!0,value:async r=>{if(r.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[Fa]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let s=this.uppy.getFilesByIds(r),n=qg(s),o=$g(n);if(this.uppy.emit("upload-start",o),this.opts.bundle){if(n.some(l=>l.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await Ai(this,ph)[ph](n)}else await Ai(this,fh)[fh](n)}}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=Vg,this.i18nInit(),Fa in this.opts?this.requests=this.opts[Fa]:this.requests=new Ca(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),Ai(this,kr)[kr]=r=>async(s,n)=>{try{var o,a,l;let m=await jg(s,{...n,onBeforeRequest:(k,C)=>{var O,R;return(O=(R=this.opts).onBeforeRequest)==null?void 0:O.call(R,k,C,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:k=>{let C=Math.ceil(k/1e3),O=new Error(this.i18n("uploadStalled",{seconds:C}));this.uppy.emit("upload-stalled",O,r)},onUploadProgress:k=>{if(k.lengthComputable)for(let{id:O}of r){var C;let R=this.uppy.getFile(O);this.uppy.emit("upload-progress",R,{uploadStarted:(C=R.progress.uploadStarted)!=null?C:0,bytesUploaded:k.loaded/k.total*R.size,bytesTotal:R.size})}}}),w=await((o=(a=this.opts).getResponseData)==null?void 0:o.call(a,m));if(m.responseType==="json"){var h;(h=w)!=null||(w=m.response)}else try{var f;(f=w)!=null||(w=JSON.parse(m.responseText))}catch(k){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:k})}let y=typeof((l=w)==null?void 0:l.url)=="string"?w.url:void 0;for(let{id:k}of r)this.uppy.emit("upload-success",this.uppy.getFile(k),{status:m.status,body:w,uploadURL:y});return m}catch(m){if(m.name==="AbortError")return;let w=m.request;for(let y of r)this.uppy.emit("upload-error",this.uppy.getFile(y.id),CE(w,m),w);throw m}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){Oa(r.allowedMetaFields,t).forEach(n=>{let o=t[n];Array.isArray(o)?o.forEach(a=>e.append(n,a)):e.append(n,o)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=Wg(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let o=this.getOptions(n),a=Wg(n);n.name?r.append(o.fieldName,a,n.name):r.append(o.fieldName,a)}),r}install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(Ai(this,Ln)[Ln])}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(Ai(this,Ln)[Ln])}};async function PE(i){let e=new On(this.uppy),t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let s=this.getOptions(i),n=Ai(this,kr)[kr]([i]),o=s.formData?this.createFormDataUpload(i,s):i.data;return n(s.endpoint,{...s,body:o,signal:t.signal})});e.onFileRemove(i.id,()=>t.abort()),e.onCancelAll(i.id,()=>{t.abort()});try{await r().abortOn(t.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{e.remove()}}async function OE(i){let e=new AbortController,t=this.requests.wrapPromiseFunction(async()=>{var s;let n=(s=this.uppy.getState().xhrUpload)!=null?s:{},o=Ai(this,kr)[kr](i),a=this.createBundledUpload(i,{...this.opts,...n});return o(this.opts.endpoint,{...this.opts,body:a,signal:e.signal})});function r(){e.abort()}this.uppy.once("cancel-all",r);try{await t().abortOn(e.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{this.uppy.off("cancel-all",r)}}function RE(i){var e;let t=this.getOptions(i),r=Oa(t.allowedMetaFields,i.meta);return{...(e=i.remote)==null?void 0:e.body,protocol:"multipart",endpoint:t.endpoint,size:i.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,i.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async function LE(i){await Promise.allSettled(i.map(e=>{if(e.isRemote){let t=()=>this.requests,r=new AbortController,s=o=>{o.id===e.id&&r.abort()};this.uppy.on("file-removed",s);let n=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,Ai(this,gh)[gh](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return Ai(this,mh)[mh](e)}))}ds.VERSION=AE.version;var tt=class{static fromTemplate(i){if(Xr.isSupported)return Xr.sanitize(i,{USE_PROFILES:{html:!0,svg:!0},RETURN_DOM:!0}).children[0];{let e=new DOMParser().parseFromString(i,"text/html").body.children[0];return ME(e)}}};function ME(i){return IE(i),Gg(i),i}function IE(i){let e=i.querySelectorAll("script");for(let t of e)t.remove()}function DE(i,e){let t=e.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(i)&&(t.includes("javascript:")||t.includes("data:"))||i.startsWith("on"))return!0}function NE(i){let e=i.attributes;for(let{name:t,value:r}of e)DE(t,r)&&i.removeAttribute(t)}function Gg(i){let e=i.children;for(let t of e)NE(t),Gg(t)}var Ra=class extends V{static values={identifier:String,endpoint:String,maxFileSize:{type:Number,default:null},minFileSize:{type:Number,default:null},maxTotalSize:{type:Number,default:null},maxFileNum:{type:Number,default:null},minFileNum:{type:Number,default:null},allowedFileTypes:{type:Array,default:null},requiredMetaFields:{type:Array,default:[]}};static outlets=["attachment-preview","attachment-preview-container"];connect(){this.uppy||(this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#n(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.#t()}#e(){this.element.isConnected&&(this.#t(),this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#n())}#t(){this.uppy&&(this.uppy.destroy(),this.uppy=null),this.triggerContainer&&this.triggerContainer.parentNode&&(this.triggerContainer.parentNode.removeChild(this.triggerContainer),this.triggerContainer=null)}attachmentPreviewOutletConnected(i,e){this.#n()}attachmentPreviewOutletDisconnected(i,e){this.#n()}configureUppy(){this.uppy=new Zo({restrictions:{maxFileSize:this.maxFileSizeValue,minFileSize:this.minFileSizeValue,maxTotalFileSize:this.maxTotalSizeValue,maxNumberOfFiles:this.maxFileNumValue,minNumberOfFiles:this.minFileNumValue,allowedFileTypes:this.allowedFileTypesValue,requiredMetaFields:this.requiredMetaFieldsValue}}).use(xr,{inline:!1,closeAfterFinish:!0}).use(hs,{target:xr}),this.#i(),this.#r()}#i(){this.uppy.use(ds,{endpoint:this.endpointValue})}#r(){this.uppy.on("upload-success",this.#o.bind(this))}#s(){let i=document.documentElement.getAttribute("data-bs-theme")||"auto";this.#u.setOptions({theme:i});let e=null;for(;e=this.uploadedFiles.pop();)this.uppy.removeFile(e.id);this.#u.openModal()}#o(i,e){this.uploadedFiles.push(i),this.multiple||this.attachmentPreviewOutlets.forEach(s=>s.remove());let t=e.body.data,r=e.body.url;this.attachmentPreviewContainerOutlet.element.appendChild(this.#c(t,r))}#n(){if(!this.deleteAllTrigger)return;this.attachmentPreviewOutlets.length>1?(this.deleteAllTrigger.style.display="initial",this.deleteAllTrigger.textContent=`Delete ${this.attachmentPreviewOutlets.length}`):this.deleteAllTrigger.style.display="none"}#l(){this.triggerContainer=document.createElement("div"),this.triggerContainer.className="flex items-center gap-2",this.element.insertAdjacentElement("afterend",this.triggerContainer),this.#a(),this.uploadTrigger&&this.triggerContainer.append(this.uploadTrigger),this.deleteAllTrigger&&this.triggerContainer.append(this.deleteAllTrigger)}#a(){let i=this.multiple?"Choose files":"Choose file";this.uploadTrigger=tt.fromTemplate(`<button type="button" class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700 inline-flex items-center">
98
+ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,Um(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,Um(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",$m(...e.get(2),e.get(1))),e.set("longitude",$m(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Be)if(e=this[t],!Xm(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function $m(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}ue(bn,"type","tiff"),ue(bn,"headerLength",10),Pt.set("tiff",bn);var YP=Object.freeze({__proto__:null,default:kS,Exifr:cs,fileParsers:wa,segmentParsers:Pt,fileReaders:En,tagKeys:Tn,tagValues:zu,tagRevivers:Hu,createDictionary:Ym,extendDictionary:Zm,fetchUrlAsArrayBuffer:ga,readBlobAsArrayBuffer:wn,chunkedProps:ns,otherSegments:Sa,segments:Sn,tiffBlocks:Be,segmentsAndBlocks:os,tiffExtractables:as,inheritables:Ea,allFormatters:ls,Options:Er,parse:Qm}),ju={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},ZP=Object.assign({},ju,{firstChunkSize:4e4,gps:[1,2,3,4]});var QP=Object.assign({},ju,{tiff:!1,ifd1:!0,mergeOutput:!1});var PS=Object.assign({},ju,{firstChunkSize:4e4,ifd0:[274]});async function OS(i){let e=new cs(PS);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}var RS=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),mn=!0,gn=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;mn=Number(t)+.1*Number(r)<13.4,gn=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);mn=gn=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);mn=gn=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);mn=gn=Number(e)<77}}async function Jm(i){let e=await OS(i);return Object.assign({canvas:mn,css:gn},RS[e])}var Nu=class extends Sr{constructor(...e){super(...e),ue(this,"ranges",new Bu),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=Km?Gm.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},Bu=class{constructor(){ue(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter((o=>Vm(e,o.offset,s)||Vm(e,o.end,s)));if(n.length>0){e=Math.min(e,...n.map((a=>a.offset))),s=Math.max(s,...n.map((a=>a.end))),t=s-e;let o=n.shift();o.offset=e,o.length=t,o.end=s,this.list=this.list.filter((a=>!n.includes(a)))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some((s=>s.offset<=e&&r<=s.end))}};function Vm(i,e,t){return i<=e&&e<=t}var Uu=class extends Nu{constructor(e,t){super(0),ue(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};En.set("blob",class extends Uu{async readWhole(){this.chunked=!1;let i=await wn(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await wn(r);return this.set(s,i,!0)}});var eg={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"4.2.3",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","thumbnail","preview","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",exifr:"^7.0.0"},devDependencies:{jsdom:"^26.1.0","namespace-emitter":"2.0.1",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var tg={strings:{generatingThumbnails:"Generating thumbnails..."}};function MS(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>Nm(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}function IS(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}function DS(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let o=document.createElement("canvas");return o.width=s,o.height=n,o.getContext("2d").drawImage(i,0,0,s,n),o}return i}var NS={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},xn=class extends ni{static VERSION=eg.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...NS,...t}),this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=tg,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){let s=URL.createObjectURL(e.data),n=new Promise((a,l)=>{let h=new Image;h.src=s,h.addEventListener("load",()=>{URL.revokeObjectURL(s),a(h)}),h.addEventListener("error",f=>{URL.revokeObjectURL(s),l(f.error||new Error("Could not create thumbnail"))})}),o=Jm(e.data).catch(()=>1);return Promise.all([n,o]).then(([a,l])=>{let h=this.getProportionalDimensions(a,t,r,l.deg),f=IS(a,l),m=this.resizeImage(f,h.width,h.height);return MS(m,this.thumbnailType,80)}).then(a=>URL.createObjectURL(a))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;if((s===90||s===270)&&(n=e.height/e.width),t!=null){let o=t;return e.width<t&&(o=e.width),{width:o,height:Math.round(o/n)}}if(r!=null){let o=r;return e.height<r&&(o=e.height),{width:Math.round(o*n),height:o}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=DS(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let o=t*2**(n-1),a=r*2**(n-1),l=2;for(;n--;){let h=document.createElement("canvas");h.width=o,h.height=a,h.getContext("2d").drawImage(s,0,0,o,a),s=h,o=Math.round(o/l),a=Math.round(a/l)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return ma(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}onFileAdded=e=>{!e.preview&&e.data&&ma(e.type)&&!e.isRemote&&this.addToQueue(e.id)};onCancelRequest=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1)};onFileRemoved=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1),e.preview&&fa(e.preview)&&URL.revokeObjectURL(e.preview)};onRestored=()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||fa(t.preview))&&this.addToQueue(t.id)})};onAllFilesRemoved=()=>{this.queue=[]};waitUntilAllProcessed=e=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let t=()=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-complete",s)})};return new Promise(r=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{t(),r()}):(t(),r())})};install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};function BS(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&Vs(i)?[i]:null}var qu=BS;var Ki=Array.from;function $u(i){let e=Ki(i.files);return Promise.resolve(e)}function Ta(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{Ta(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}function ig(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{Ta(t,[],e,{onSuccess:n=>s(n.map(o=>ig(o,e)))})})},isSameEntry:void 0}}async function*rg(i,e,t=void 0){let r=()=>`${e}/${i.name}`;if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*rg(s,e?r():i.name);else t!=null&&(yield t)}async function*Vu(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=ig(typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),e),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*rg(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}async function Wu(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of Vu(i,t))r.push(s);return r}catch{return $u(i)}}var sg={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",version:"4.4.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest watch --project browser --browser.headless false"},keywords:["file uploader","uppy","uppy-plugin","dashboard","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/informer":"^4.3.2","@uppy/provider-views":"^4.5.2","@uppy/status-bar":"^4.2.3","@uppy/thumbnail-generator":"^4.2.2","@uppy/utils":"^6.2.2",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9",preact:"^10.5.13","shallow-equal":"^3.0.0"},devDependencies:{"@uppy/core":"^4.5.2","@uppy/google-drive":"^4.4.2","@uppy/status-bar":"^4.2.3","@uppy/url":"^4.3.2","@uppy/webcam":"^4.3.2","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1","resize-observer-polyfill":"^1.5.0",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.2"}};function Gu(){let i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var Eg=ye(ht(),1);var Ku=class extends we{fileInput=null;folderInput=null;mobilePhotoFileInput=null;mobileVideoFileInput=null;triggerFileInputClick=()=>{this.fileInput?.click()};triggerFolderInputClick=()=>{this.folderInput?.click()};triggerVideoCameraInputClick=()=>{this.mobileVideoFileInput?.click()};triggerPhotoCameraInputClick=()=>{this.mobilePhotoFileInput?.click()};onFileInputChange=e=>{this.props.handleInputChange(e),e.currentTarget.value=""};renderHiddenInput=(e,t)=>c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes?.join(", "),ref:t});renderHiddenCameraInput=(e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t===""?"environment":t,accept:n,ref:r})};renderMyDeviceAcquirer=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})});renderPhotoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})});renderVideoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})});renderBrowseButton=(e,t)=>{let r=this.props.acquirers.length;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0,children:e})};renderDropPasteBrowseTagline=e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return c("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t})})};[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderAcquirer=e=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id,children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":this.props.activePickerPanel?.id===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id),children:[c("div",{className:"uppy-DashboardTab-inner",children:e.icon()}),c("div",{className:"uppy-DashboardTab-name",children:e.name})]})});renderAcquirers=e=>{let t=[...e],r=t.splice(e.length-2,e.length);return c(_e,{children:[t.map(s=>this.renderAcquirer(s)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:r.map(s=>this.renderAcquirer(s))})]})};renderSourcesList=(e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],o="myDevice";t||n.push({key:o,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(f=>({key:f.id,elements:this.renderAcquirer(f)}))),n.length===1&&n[0].key===o&&(n=[]);let l=[...n],h=l.splice(n.length-2,n.length);return c(_e,{children:[this.renderDropPasteBrowseTagline(n.length),c("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[l.map(({key:f,elements:m})=>c(_e,{children:m},f)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:h.map(({key:f,elements:m})=>c(_e,{children:m},f))})]})]})};renderPoweredByUppy(){let{i18nArray:e}=this.props,t=c("span",{children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),c("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),r=e("poweredBy",{uppy:t});return c("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:r})}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return c("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),c("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&c("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}},xa=Ku;var ng=ye(ht(),1);var zS=i=>c("div",{className:(0,ng.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18n("addingMoreFiles")}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1),children:i.i18n("back")})]}),c(xa,{...i})]}),og=zS;var ag=ye(ht(),1);function HS(i){let e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return c("div",{className:(0,ag.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18nArray("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:i.i18n("cancel")}),c("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor,children:i.i18n("save")})]}),c("div",{className:"uppy-DashboardContent-panelBody",children:i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))})]})}var lg=HS;var cg=ye(ht(),1);function jS(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#686DE0",fillRule:"evenodd",children:[c("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),c("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),c("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}function qS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}function $S(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}function VS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}function WS(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}function GS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[c("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),c("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}function KS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}function Tr(i){let e={color:"#838999",icon:GS()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:KS()}:t==="image"?{color:"#686de0",icon:jS()}:t==="audio"?{color:"#068dbb",icon:qS()}:t==="video"?{color:"#19af67",icon:$S()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:VS()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:WS()}:e}function XS(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}var fi=XS;function kn(i){let{file:e}=i;if(e.preview)return c("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=Tr(e.type);return c("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[c("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t},children:r}),c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:c("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}function Xu(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(a=>{let l=`uppy-Dashboard-FileCard-input-${a.id}`,h=t.includes(a.id);return c("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[c("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l,children:a.name}),a.render!==void 0?a.render({value:n[a.id],onChange:f=>r(f,a.id),fieldCSSClasses:o,required:h,form:s.id},ki):c("input",{className:o.text,id:l,form:s.id,type:a.type||"text",required:h,value:n[a.id],placeholder:a.placeholder,onInput:f=>r(f.target.value,a.id),"data-uppy-super-focusable":!0})]},a.id)})}function Yu(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:o,openFileEditor:a,i18n:l,i18nArray:h,className:f,canEditFile:m}=i,w=()=>typeof n=="function"?n(e[t]):n,y=e[t],k=w()??[],C=m(y),O={};k.forEach(P=>{O[P.id]=y.meta[P.id]??""});let[R,_]=Kt(O),F=Vi(P=>{P.preventDefault(),s(R,t)},[s,R,t]),x=(P,N)=>{_({...R,[N]:P})},S=()=>{r(!1)},[A]=Kt(()=>{let P=document.createElement("form");return P.setAttribute("tabindex","-1"),P.id=Wi(),P});return si(()=>(document.body.appendChild(A),A.addEventListener("submit",F),()=>{A.removeEventListener("submit",F),document.body.removeChild(A)}),[A,F]),c("div",{className:(0,cg.default)("uppy-Dashboard-FileCard",f),"data-uppy-panelType":"FileCard",onDragOver:fi,onDragLeave:fi,onDrop:fi,onPaste:fi,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:h("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:y.meta?y.meta.name:y.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",form:A.id,title:l("finishEditingFile"),onClick:S,children:l("cancel")})]}),c("div",{className:"uppy-Dashboard-FileCard-inner",children:[c("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:Tr(y.type).color},children:[c(kn,{file:y}),C&&c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:P=>{F(P),a(y)},children:l("editImage")})]}),c("div",{className:"uppy-Dashboard-FileCard-info",children:c(Xu,{computedMetaFields:k,requiredMetaFields:o,updateMeta:x,form:A,formState:R})}),c("div",{className:"uppy-Dashboard-FileCard-actions",children:[c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:A.id,children:l("saveChanges")}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:S,form:A.id,children:l("cancel")})]})]})]})}var pg=ye(ht(),1);function ug(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let o=t[n];if(i[o]!==e[o]||!Object.prototype.hasOwnProperty.call(e,o))return!1}return!0}function Zu(i,e="Copy the URL below"){return new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=()=>{document.body.removeChild(r),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}function YS({file:i,uploadInProgressOrComplete:e,metaFields:t,canEditFile:r,i18n:s,onClick:n}){return!e&&t&&t.length>0||!e&&r(i)?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:i.meta.name}),title:s("editFileWithFilename",{file:i.meta.name}),onClick:()=>n(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:c("g",{fillRule:"evenodd",children:[c("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),c("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),c("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}function ZS({i18n:i,onClick:e,file:t}){return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":i("removeFile",{file:t.meta.name}),title:i("removeFile",{file:t.meta.name}),onClick:()=>e(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[c("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),c("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}function QS({file:i,uppy:e,i18n:t}){let r=s=>{Zu(i.uploadURL,t("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(t("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>s.target.focus({preventScroll:!0}))};return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":t("copyLink"),title:t("copyLink"),onClick:s=>r(s),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:c("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}function Qu(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:o,showRemoveButton:a,i18n:l,toggleFileCard:h,openFileEditor:f}=i;return c("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[c(YS,{i18n:l,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:()=>{n&&n.length>0?h(!0,t.id):f(t)}}),o&&t.uploadURL?c(QS,{file:t,uppy:e,i18n:l}):null,a?c(ZS,{i18n:l,file:t,onClick:()=>e.removeFile(t.id)}):null]})}var hg=ye(Ko(),1);function ka(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=4)return`${i.slice(0,e-1)}\u2026`;let t=e-3,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+"..."+i.slice(-s)}var JS=(i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name;function _n(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!n?.length)return null;let o=n.map(a=>JS(a,s)).join(", ");return c("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:n.length,fields:o})," ",c("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id),children:r("editFile")})]})}var eE=i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return c("div",{className:"uppy-Dashboard-Item-name",title:t,children:ka(t,r())})},tE=i=>{let{author:e}=i.file.meta,t=i.file.remote?.providerName,r="\xB7";return e?c("div",{className:"uppy-Dashboard-Item-author",children:[c("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:ka(e.name,13)}),t?c(_e,{children:[` ${r} `,t,` ${r} `]}):null]}):null},iE=i=>i.file.size&&c("div",{className:"uppy-Dashboard-Item-statusSize",children:(0,hg.default)(i.file.size)}),rE=i=>i.file.isGhost&&c("span",{children:[" \u2022 ",c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>i.toggleAddFilesPanel(!0),children:i.i18n("reSelect")})]}),sE=({file:i,onClick:e})=>i.error?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":i.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:e,type:"button",children:"?"}):null;function Ju(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:o,containerHeight:a,containerWidth:l}=i;return c("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[c("div",{className:"uppy-Dashboard-Item-fileName",children:[eE({file:e,isSingleFile:o,containerHeight:a,containerWidth:l}),c(sE,{file:e,onClick:()=>alert(e.error)})]}),c("div",{className:"uppy-Dashboard-Item-status",children:[tE({file:e}),iE({file:e}),rE({file:e,toggleAddFilesPanel:n,i18n:t})]}),c(_n,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function eh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,a=e.preview?"rgba(255, 255, 255, 0.5)":Tr(e.type).color;return c("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:a},children:[n&&e.uploadURL&&c("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:c("span",{hidden:!0,children:e.meta.name})}),c(kn,{file:e}),c(_n,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function nE(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function dg(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function th(i){return c("div",{className:"uppy-Dashboard-Item-progress",children:c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":dg(i),title:dg(i),onClick:()=>nE(i),children:i.children})})}function _a({children:i}){return c("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:i})}function ih({progress:i}){let e=2*Math.PI*15;return c("g",{children:[c("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),c("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":e,"stroke-dashoffset":e-e/100*i})]})}function rh(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(_a,{children:[c("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),c("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):i.recoveredState?null:i.error&&!i.hideRetryButton?c(th,{...i,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[c("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),c("path",{d:"M7.9 3H10v2H7.9z"}),c("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),c("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):i.resumableUploads&&!i.hidePauseResumeButton?c(th,{...i,children:c(_a,{children:[c(ih,{progress:i.file.progress.percentage}),i.file.isPaused?c("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):c("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[c("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),c("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?c(th,{...i,children:c(_a,{children:[c(ih,{progress:i.file.progress.percentage}),c("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(_a,{children:c(ih,{progress:i.file.progress.percentage})})})})}var An=class extends we{componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!ug(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:a}=e,l=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(l=!0);let h=(0,pg.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":a});return c("div",{className:h,id:`uppy_${e.id}`,role:this.props.role,children:[c("div",{className:"uppy-Dashboard-Item-preview",children:[c(eh,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),c(rh,{uppy:this.props.uppy,file:e,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),c("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[c(Ju,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),c(Qu,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}};function oE(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}function sh({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:f,isSingleFile:m,toggleFileCard:w,handleRequestThumbnail:y,handleCancelThumbnail:k,recoveredState:C,individualCancellation:O,itemsPerRow:R,openFileEditor:_,canEditFile:F,toggleAddFilesPanel:x,containerWidth:S,containerHeight:A}){let P=R===1?71:200,N=$i(()=>{let q=(Z,K)=>Number(r[K].isGhost)-Number(r[Z].isGhost),$=Object.keys(r);return C&&$.sort(q),oE($,R)},[r,R,C]),z=q=>c("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:q.map($=>c(An,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:O,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:f,recoveredState:C,isSingleFile:m,containerWidth:S,containerHeight:A,toggleFileCard:w,handleRequestThumbnail:y,handleCancelThumbnail:k,role:"listitem",openFileEditor:_,canEditFile:F,toggleAddFilesPanel:x,file:r[$]},$))},q[0]);return m?c("div",{class:"uppy-Dashboard-files",children:z(N[0])}):c(ia,{class:"uppy-Dashboard-files",role:"list",data:N,renderRow:z,rowHeight:P})}var fg=ye(ht(),1);function aE({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let o=qi(null);return c("div",{className:(0,fg.default)("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${i.id}`,onDragOver:fi,onDragLeave:fi,onDrop:fi,onPaste:fi,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:i.name})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:r("cancel")})]}),c("div",{ref:o,className:"uppy-DashboardContent-panelBody",children:n.getPlugin(i.id).render(s,o.current)})]})}var mg=aE;var mi={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function lE(i,e,t,r={}){if(i)return mi.STATE_ERROR;if(e)return mi.STATE_COMPLETE;if(t)return mi.STATE_PAUSED;let s=mi.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return mi.STATE_UPLOADING;a.preprocess&&s!==mi.STATE_UPLOADING&&(s=mi.STATE_PREPROCESSING),a.postprocess&&s!==mi.STATE_UPLOADING&&s!==mi.STATE_PREPROCESSING&&(s=mi.STATE_POSTPROCESSING)}return s}function cE({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:o,processingFiles:a}){switch(lE(r,t,s,i)){case"uploading":return e("uploadingXFiles",{smart_count:n.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:a.length});case"paused":return e("uploadPaused");case"waiting":return e("xFilesSelected",{smart_count:o.length});case"complete":return e("uploadComplete");case"error":return e("error");default:}}function uE(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:o}=i,{allowNewUpload:a}=i;return a&&s&&(a=i.totalFileCount<i.maxNumberOfFiles),c("div",{className:"uppy-DashboardContent-bar",children:[!t&&!r?c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll(),children:e("cancel")}):c("div",{}),c("div",{className:"uppy-DashboardContent-title",children:c(cE,{...i})}),a?c("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>n(!0),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:c("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),c("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):c("div",{})]})}var gg=uE;var yg=ye(ht(),1);var us="uppy-transition-slideDownUp",bg=250;function hE({children:i}){let[e,t]=Kt(null),[r,s]=Kt(""),n=qi(),o=qi(),a=qi(),l=()=>{s(`${us}-enter`),cancelAnimationFrame(a.current),clearTimeout(o.current),o.current=void 0,a.current=requestAnimationFrame(()=>{s(`${us}-enter ${us}-enter-active`),n.current=setTimeout(()=>{s("")},bg)})},h=()=>{s(`${us}-leave`),cancelAnimationFrame(a.current),clearTimeout(n.current),n.current=void 0,a.current=requestAnimationFrame(()=>{s(`${us}-leave ${us}-leave-active`),o.current=setTimeout(()=>{t(null),s("")},bg)})};return si(()=>{let f=wt(i)[0];e!==f&&(f&&!e?l():e&&!f&&!o.current&&h(),t(f))},[i,e]),si(()=>()=>{clearTimeout(n.current),clearTimeout(o.current),cancelAnimationFrame(a.current)},[]),e?Ys(e,{className:(0,yg.default)(r,e.props.className)}):null}var Cn=hE;var vg=900,wg=700,nh=576,Sg=330;function oh(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>nh,s=i.containerHeight>Sg,n=(0,Eg.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>nh,"uppy-size--lg":i.containerWidth>wg,"uppy-size--xl":i.containerWidth>vg,"uppy-size--height-md":i.containerHeight>Sg,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),o=1;i.containerWidth>vg?o=5:i.containerWidth>wg?o=4:i.containerWidth>nh&&(o=3);let a=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,h=i.files?Object.keys(i.files).filter(w=>i.files[w].isGhost).length:0,f=()=>h>0?i.i18n("recoveredXFiles",{smart_count:h}):i.i18n("recoveredAllFiles");return c("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&Gu(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop,children:[c("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),c("div",{className:"uppy-Dashboard-inner",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""},children:[i.inline?null:c("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal,children:c("span",{"aria-hidden":"true",children:"\xD7"})}),c("div",{className:"uppy-Dashboard-innerWrap",children:[c("div",{className:"uppy-Dashboard-dropFilesHereHint",children:i.i18n("dropHint")}),a&&c(gg,{...i}),l&&c("div",{className:"uppy-Dashboard-serviceMsg",children:[c("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:c("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[c("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),c("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),c("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),c("strong",{className:"uppy-Dashboard-serviceMsg-title",children:i.i18n("sessionRestored")}),c("div",{className:"uppy-Dashboard-serviceMsg-text",children:f()})]}),a?c(sh,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):c(xa,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),c(Cn,{children:i.showAddFilesPanel?c(og,{...i,isSizeMD:r},"AddFiles"):null}),c(Cn,{children:i.fileCardFor?c(Yu,{...i},"FileCard"):null}),c(Cn,{children:i.activePickerPanel?c(mg,{...i},"Picker"):null}),c(Cn,{children:i.showFileEditor?c(lg,{...i},"Editor"):null}),c("div",{className:"uppy-Dashboard-progressindicators",children:i.progressindicators.map(w=>i.uppy.getPlugin(w.id).render(i.state))})]})]})]})}var Tg={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};var Aa=['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])'];var xg=ye(su(),1);function Fn(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function ah(){let i=!1;return(0,xg.default)((t,r)=>{let s=Fn(t,r),n=s.contains(document.activeElement);if(n&&i)return;let o=s.querySelector("[data-uppy-super-focusable]");n&&!o||(o?(o.focus({preventScroll:!0}),i=!0):(s.querySelector(Aa)?.focus({preventScroll:!0}),i=!1))},260)}function kg(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}function dE(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function pE(i){return i.contains(document.activeElement)}function lh(i,e,t){let r=Fn(t,e),s=Ki(r.querySelectorAll(Aa)),n=s.indexOf(document.activeElement);pE(r)?i.shiftKey&&n===0?dE(i,s):!i.shiftKey&&n===s.length-1&&kg(i,s):kg(i,s)}function _g(i,e,t){e===null||lh(i,e,t)}var Ag=9,mE=27;function Cg(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}var gE={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:dn,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},xr=class extends ni{static VERSION=sg.version;#e;modalName=`uppy-Dashboard-${Wi()}`;superFocus=ah();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedScrollPosition;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{...gE,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=Tg,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),this.opts.onRequestCloseModal??=()=>this.closeModal(),this.i18nInit()}removeTarget=e=>{let r=this.getPluginState().targets.filter(s=>s.id!==e.id);this.setPluginState({targets:r})};addTarget=e=>{let t=e.id||e.constructor.name,r=e.title||t,s=e.type;if(s!=="acquirer"&&s!=="progressindicator"&&s!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let n={id:t,name:r,type:s},a=this.getPluginState().targets.slice();return a.push(n),this.setPluginState({targets:a}),this.el};hideAllPanels=()=>{let e=this.getPluginState(),t={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};e.activePickerPanel===t.activePickerPanel&&e.showAddFilesPanel===t.showAddFilesPanel&&e.showFileEditor===t.showFileEditor&&e.activeOverlayType===t.activeOverlayType||(this.setPluginState(t),this.uppy.emit("dashboard:close-panel",e.activePickerPanel?.id))};showPanel=e=>{let{targets:t}=this.getPluginState(),r=t.find(s=>s.type==="acquirer"&&s.id===e);this.setPluginState({activePickerPanel:r,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",e)};canEditFile=e=>{let{targets:t}=this.getPluginState();return this.#l(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))};openFileEditor=e=>{let{targets:t}=this.getPluginState(),r=this.#l(t);this.setPluginState({showFileEditor:!0,fileCardFor:e.id||null,activeOverlayType:"FileEditor"}),r.forEach(s=>{this.uppy.getPlugin(s.id).selectFile(e)})};closeFileEditor=()=>{let{metaFields:e}=this.getPluginState();e&&e.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})};saveFileEditor=()=>{let{targets:e}=this.getPluginState();this.#l(e).forEach(r=>{this.uppy.getPlugin(r.id).save()}),this.closeFileEditor()};openModal=()=>{let{promise:e,resolve:t}=Cg();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let r=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",r,!1),t()};this.el.addEventListener("animationend",r,!1)}else this.setPluginState({isHidden:!1}),t();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),e};closeModal=e=>{let t=e?.manualClose??!0,{isHidden:r,isClosing:s}=this.getPluginState();if(r||s)return;let{promise:n,resolve:o}=Cg();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let a=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",a,!1),o()};this.el.addEventListener("animationend",a,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),o();return document.removeEventListener("keydown",this.handleKeyDownInModal),t&&this.opts.browserBackButtonClose&&history.state?.[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),n};isModalOpen=()=>!this.getPluginState().isHidden||!1;requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal();setDarkModeCapability=e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,darkMode:e}})};handleSystemDarkModeChange=e=>{let t=e.matches;this.uppy.log(`[Dashboard] Dark mode is ${t?"on":"off"}`),this.setDarkModeCapability(t)};toggleFileCard=(e,t)=>{let r=this.uppy.getFile(t);e?this.uppy.emit("dashboard:file-edit-start",r):this.uppy.emit("dashboard:file-edit-complete",r),this.setPluginState({fileCardFor:e?t:null,activeOverlayType:e?"FileCard":null})};toggleAddFilesPanel=e=>{this.setPluginState({showAddFilesPanel:e,activeOverlayType:e?"AddFiles":null})};addFiles=e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||r.webkitRelativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}};startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(e=>{let t=e[0],{width:r,height:s}=t.contentRect;this.setPluginState({containerWidth:r,containerHeight:s,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let e=this.getPluginState(),t=!this.opts.inline&&e.isHidden;!e.areInsidesReadyToBeVisible&&!t&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)};stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)};recordIfFocusedOnUppyRecently=e=>{this.el.contains(e.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())};disableInteractiveElements=e=>{let t=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],r=this.#e??Ki(this.el.querySelectorAll(t)).filter(s=>!s.classList.contains("uppy-Dashboard-close"));for(let s of r)s.tagName==="A"?s.setAttribute("aria-disabled",e):s.disabled=e;e?this.#e=r:this.#e=null,this.dashboardIsDisabled=e};updateBrowserHistory=()=>{history.state?.[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)};handlePopState=e=>{this.isModalOpen()&&(!e.state||!e.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&e.state?.[this.modalName]&&history.back()};handleKeyDownInModal=e=>{e.keyCode===mE&&this.requestCloseModal(),e.keyCode===Ag&&lh(e,this.getPluginState().activeOverlayType,this.el)};handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()};handlePaste=e=>{this.uppy.iteratePlugins(r=>{r.type==="acquirer"&&r.handleRootPaste?.(e)});let t=Ki(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))};handleInputChange=e=>{e.preventDefault();let t=Ki(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(t))};handleDragOver=e=>{e.preventDefault(),e.stopPropagation();let t=()=>{let o=!0;return this.uppy.iteratePlugins(a=>{a.canHandleRootDrop?.(e)&&(o=!0)}),o},r=()=>{let{types:o}=e.dataTransfer;return o.some(a=>a==="Files")},s=t(),n=r();if(!s&&!n||this.opts.disabled||this.opts.disableLocalFiles&&(n||!s)||!this.uppy.getState().allowNewUpload){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(e)};handleDragLeave=e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(e)};handleDrop=async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)};this.uppy.log("[Dashboard] Processing dropped files");let s=await Wu(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(s)),this.opts.onDrop(e)};handleRequestThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",e)};handleCancelThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",e)};handleKeyDownInInline=e=>{e.keyCode===Ag&&_g(e,this.getPluginState().activeOverlayType,this.el)};handlePasteOnBody=e=>{this.el.contains(document.activeElement)&&this.handlePaste(e)};handleComplete=({failed:e})=>{this.opts.closeAfterFinish&&!e?.length&&this.requestCloseModal()};handleCancelRestore=()=>{this.uppy.emit("restore-canceled")};#t=()=>{if(this.opts.disableThumbnailGenerator)return;let e=600,t=this.uppy.getFiles();if(t.length===1){let r=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);r?.setOptions({thumbnailWidth:e});let s={...t[0],preview:void 0};r?.requestThumbnail(s).then(()=>{r?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}};#i=e=>{let t=e[0],{metaFields:r}=this.getPluginState(),s=r&&r.length>0,n=this.canEditFile(t);s&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,t.id):n&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(t)};initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){let e=qu(this.opts.trigger);e?e.forEach(t=>t.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",this.#c),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",this.#t),this.uppy.on("file-removed",this.#t),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",this.#i)};removeEvents=()=>{let e=qu(this.opts.trigger);!this.opts.inline&&e&&e.forEach(t=>t.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",this.#c),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",this.#t),this.uppy.off("file-removed",this.#t),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",this.#i)};superFocusOnEachUpdate=()=>{let e=this.el.contains(document.activeElement),t=document.activeElement===document.body||document.activeElement===null,r=this.uppy.getState().info.length===0,s=!this.opts.inline;r&&(s||e||t&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()};afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()};saveFileCard=(e,t)=>{this.uppy.setFileMeta(t,e),this.toggleFileCard(!1,t)};#r=e=>{let t=this.uppy.getPlugin(e.id);return{...e,icon:t.icon||this.opts.defaultPickerIcon,render:t.render}};#s=e=>{let t=this.uppy.getPlugin(e.id);return typeof t.isSupported!="function"?!0:t.isSupported()};#o=e=>e.filter(t=>t.type==="acquirer"&&this.#s(t)).map(this.#r);#n=e=>e.filter(t=>t.type==="progressindicator").map(this.#r);#l=e=>e.filter(t=>t.type==="editor").map(this.#r);render=e=>{let t=this.getPluginState(),{files:r,capabilities:s,allowNewUpload:n}=e,{newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:w,isUploadStarted:y,isAllComplete:k,isAllPaused:C}=this.uppy.getObjectOfFilesPerState(),O=this.#o(t.targets),R=this.#n(t.targets),_=this.#l(t.targets),F;return this.opts.theme==="auto"?F=s.darkMode?"dark":"light":F=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),oh({state:e,isHidden:t.isHidden,files:r,newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:w,isUploadStarted:y,isAllComplete:k,isAllPaused:C,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:O,theme:F,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:t.activePickerPanel,showFileEditor:t.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:t.isClosing,progressindicators:R,editors:_,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:e.recoveredState,metaFields:t.metaFields,resumableUploads:s.resumableUploads||!1,individualCancellation:s.individualCancellation,isMobileDevice:s.isMobileDevice,fileCardFor:t.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:t.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:t.containerWidth,containerHeight:t.containerHeight,areInsidesReadyToBeVisible:t.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:t.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})};#a=()=>{let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r?r.mount(this,r):this.uppy.log(`[Uppy] Dashboard could not find plugin '${t}', make sure to uppy.use() the plugins you are specifying`,"warning")})};#d=()=>{this.uppy.iteratePlugins(this.#c)};#c=e=>{let t=["acquirer","editor"];e&&!e.opts?.target&&t.includes(e.type)&&(this.getPluginState().targets.some(s=>e.id===s.id)||e.mount(this,e))};#h(){let{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideProgressAfterFinish:o,locale:a,doneButtonHandler:l}=this.opts;return{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideAfterFinish:o,locale:a,doneButtonHandler:l}}#u(){let{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s}=this.opts;return{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s,lazy:!s}}#f(){return{}}setOptions(e){super.setOptions(e),this.uppy.getPlugin(this.#g())?.setOptions(this.#h()),this.uppy.getPlugin(this.#p())?.setOptions(this.#u())}#g(){return`${this.id}:StatusBar`}#p(){return`${this.id}:ThumbnailGenerator`}#w(){return`${this.id}:Informer`}install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:e,closeAfterFinish:t}=this.opts;if(e&&t)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:r,allowMultipleUploadBatches:s}=this.uppy.opts;(r||s)&&t&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:n}=this.opts;n&&this.mount(n,this),this.opts.disableStatusBar||this.uppy.use(ss,{id:this.#g(),target:this,...this.#h()}),this.opts.disableInformer||this.uppy.use(ts,{id:this.#w(),target:this,...this.#f()}),this.opts.disableThumbnailGenerator||this.uppy.use(xn,{id:this.#p(),...this.#u()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let o=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${o?"on":"off"}`),this.setDarkModeCapability(o),this.opts.theme==="auto"&&this.darkModeMediaQuery?.addListener(this.handleSystemDarkModeChange),this.#a(),this.#d(),this.initEvents()};uninstall=()=>{if(!this.opts.disableInformer){let t=this.uppy.getPlugin(`${this.id}:Informer`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableStatusBar){let t=this.uppy.getPlugin(`${this.id}:StatusBar`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableThumbnailGenerator){let t=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);t&&this.uppy.removePlugin(t)}let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r&&r.unmount()}),this.opts.theme==="auto"&&this.darkModeMediaQuery?.removeListener(this.handleSystemDarkModeChange),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()}};var Fg={name:"@uppy/image-editor",description:"Image editor and cropping UI",version:"3.4.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","upload","uppy","uppy-plugin","image editor","cropper","crop","rotate","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",cropperjs:"^1.6.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Ig=ye(Pg(),1);function yE(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,o=e.height*s,a=(i.width-n)/2,l=(i.height-o)/2;return{width:n,height:o,left:a,top:l}}var Og=yE;function vE(i){return i*(Math.PI/180)}function wE(i,e,t){let r=Math.abs(vE(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}var Rg=wE;function SE(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}var Lg=SE;function EE(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}var Mg=EE;var Pn=class extends we{imgElement;cropper;constructor(e){super(e),this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new Ig.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=Lg(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=Mg(t,r,s);n&&this.cropper.setCropBoxData(n)}}onRotate90Deg=()=>{let{angle90Deg:e}=this.state,t=e-90;this.setState({angle90Deg:t,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(t);let r=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),n=Og(s,r);this.cropper.setCanvasData(n),this.cropper.setCropBoxData(n)};onRotateGranular=e=>{let t=Number(e.target.value);this.setState({angleGranular:t});let{angle90Deg:r}=this.state,s=r+t;this.cropper.rotateTo(s);let n=this.cropper.getImageData(),o=Rg(n.naturalWidth,n.naturalHeight,t),a=this.cropper.getImageData().scaleX<0?-o:o;this.cropper.scale(a,o)};renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return c("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:c("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")})})}renderRevert(){let{i18n:e,opts:t}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})]})})}renderRotate(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg,children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})]})})}renderFlip(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})]})})}renderZoomIn(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:()=>this.cropper.zoom(.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),c("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:()=>this.cropper.zoom(-.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})]})})}renderCropSquare(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})})}renderCropWidescreen(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),c("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),c("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t,s=URL.createObjectURL(e.data);return c("div",{className:"uppy-ImageCropper",children:[c("div",{className:"uppy-ImageCropper-container",children:c("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:n=>{this.imgElement=n}})}),c("div",{className:"uppy-ImageCropper-controls",children:[r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}};var Dg={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var Ng={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},Bg={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},TE={quality:.8,actions:Bg,cropperOptions:Ng},hs=class extends ni{static VERSION=Fg.version;cropper;constructor(e,t){super(e,{...TE,...t,actions:{...Bg,...t?.actions},cropperOptions:{...Ng,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=Dg,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}save=()=>{let e=s=>{let{currentImage:n}=this.getPluginState();this.uppy.setFileState(n.id,{data:new File([s],n.name??this.i18n("unnamed"),{type:s.type}),size:s.size,preview:void 0});let o=this.uppy.getFile(n.id);this.uppy.emit("thumbnail:request",o),this.setPluginState({currentImage:o}),this.uppy.emit("file-editor:complete",o)},{currentImage:t}=this.getPluginState(),r=this.cropper.getCroppedCanvas({});r.width%2!==0&&this.cropper.setData({width:r.width-1}),r.height%2!==0&&this.cropper.setData({height:r.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(e,t.type,this.opts.quality)};storeCropperInstance=e=>{this.cropper=e};selectFile=e=>{this.uppy.emit("file-editor:start",e),this.setPluginState({currentImage:e})};install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:c(Pn,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};var On=class{#e;#t=[];constructor(e){this.#e=e}on(e,t){return this.#t.push([e,t]),this.#e.on(e,t)}remove(){for(let[e,t]of this.#t.splice(0))this.#e.off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{this.#e.getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{this.#e.getFile(e)&&t()})}onCancelAll(e,t){this.on("cancel-all",(...r)=>{this.#e.getFile(e)&&t(...r)})}onResumeAll(e,t){this.on("resume-all",()=>{this.#e.getFile(e)&&t()})}};function xE(i){return new Error("Cancelled",{cause:i})}function Ug(i){if(i!=null){let e=()=>this.abort(i.reason);i.addEventListener("abort",e,{once:!0});let t=()=>{i.removeEventListener("abort",e)};this.then?.(t,t)}return this}var Ca=class{#e=0;#t=[];#i=!1;#r;#s=1;#o;#n;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#l(e){this.#e+=1;let t=!1,r;try{r=e()}catch(s){throw this.#e-=1,s}return{abort:s=>{t||(t=!0,this.#e-=1,r?.(s),this.#a())},done:()=>{t||(t=!0,this.#e-=1,this.#a())}}}#a(){queueMicrotask(()=>this.#d())}#d(){if(this.#i||this.#e>=this.limit||this.#t.length===0)return;let e=this.#t.shift();if(e==null)throw new Error("Invariant violation: next is null");let t=this.#l(e.fn);e.abort=t.abort,e.done=t.done}#c(e,t){let r={fn:e,priority:t?.priority||0,abort:()=>{this.#h(r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},s=this.#t.findIndex(n=>r.priority>n.priority);return s===-1?this.#t.push(r):this.#t.splice(s,0,r),r}#h(e){let t=this.#t.indexOf(e);t!==-1&&this.#t.splice(t,1)}run(e,t){return!this.#i&&this.#e<this.limit?this.#l(e):this.#c(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:Ug,abort(){s.abort()}}}}wrapPromiseFunction(e,t){return(...r)=>{let s,n=new Promise((o,a)=>{s=this.run(()=>{let l,h;try{h=Promise.resolve(e(...r))}catch(f){h=Promise.reject(f)}return h.then(f=>{l?a(l):(s.done(),o(f))},f=>{l?a(l):(s.done(),a(f))}),f=>{l=xE(f)}},t)});return n.abort=o=>{s.abort(o)},n.abortOn=Ug,n}}resume(){this.#i=!1,clearTimeout(this.#r);for(let e=0;e<this.limit;e++)this.#a()}#u=()=>this.resume();pause(e=null){this.#i=!0,clearTimeout(this.#r),e!=null&&(this.#r=setTimeout(this.#u,e))}rateLimit(e){clearTimeout(this.#n),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#o=this.limit-1,this.limit=this.#s,this.#n=setTimeout(this.#f,e))}#f=()=>{if(this.#i){this.#n=setTimeout(this.#f,0);return}this.#s=this.limit,this.limit=Math.ceil((this.#o+this.#s)/2);for(let e=this.#s;e<=this.limit;e++)this.#a();this.#o-this.#s>3?this.#n=setTimeout(this.#f,2e3):this.#s=Math.floor(this.#s/2)};get isPaused(){return this.#i}},Fa=Symbol("__queue");var hh=class 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}},Rn=hh;function kE(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}var zg=kE;var dh=class{#e;#t=!1;#i;#r;constructor(e,t){this.#r=e,this.#i=()=>t(e)}progress(){this.#t||this.#r>0&&(clearTimeout(this.#e),this.#e=setTimeout(this.#i,this.#r))}done(){this.#t||(clearTimeout(this.#e),this.#e=void 0,this.#t=!0)}},Hg=dh;var Pa=()=>{};function jg(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=Pa,onUploadProgress:o=Pa,shouldRetry:a=()=>!0,onAfterResponse:l=Pa,onTimeout:h=Pa,responseType:f,retries:m=3,signal:w=null,timeout:y=3e4,withCredentials:k=!1}=e,C=_=>.3*2**(_-1)*1e3,O=new Hg(y,h);function R(_=0){return new Promise(async(F,x)=>{let S=new XMLHttpRequest,A=P=>{a(S)&&_<m?setTimeout(()=>{R(_+1).then(F,x)},C(_)):(O.done(),x(P))};S.open(s,i,!0),S.withCredentials=k,f&&(S.responseType=f),w?.addEventListener("abort",()=>{S.abort(),x(new DOMException("Aborted","AbortError"))}),S.onload=async()=>{try{await l(S,_)}catch(P){P.request=S,A(P);return}S.status>=200&&S.status<300?(O.done(),F(S)):a(S)&&_<m?setTimeout(()=>{R(_+1).then(F,x)},C(_)):(O.done(),x(new Rn(S.statusText,S)))},S.onerror=()=>A(new Rn(S.statusText,S)),S.upload.onprogress=P=>{O.progress(),o(P)},r&&Object.keys(r).forEach(P=>{S.setRequestHeader(P,r[P])}),await n(S,_),S.send(t)})}return R()}function qg(i){let e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function $g(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}function Oa(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}var Vg={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function Ai(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var _E=0;function ps(i){return"__private_"+_E+++"_"+i}var AE={version:"4.3.3"};function CE(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),zg(i)?(t=new Rn(t,i),t):(t.request=i,t)}function Wg(i){return i.data.slice(0,i.data.size,i.meta.type)}var FE={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},kr=ps("getFetcher"),mh=ps("uploadLocalFile"),ph=ps("uploadBundle"),gh=ps("getCompanionClientArgs"),fh=ps("uploadFiles"),Ln=ps("handleUpload"),ds=class extends ji{constructor(e,t){if(super(e,{...FE,fieldName:t.bundle?"files[]":"file",...t}),Object.defineProperty(this,fh,{value:LE}),Object.defineProperty(this,gh,{value:RE}),Object.defineProperty(this,ph,{value:OE}),Object.defineProperty(this,mh,{value:PE}),Object.defineProperty(this,kr,{writable:!0,value:void 0}),Object.defineProperty(this,Ln,{writable:!0,value:async r=>{if(r.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[Fa]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let s=this.uppy.getFilesByIds(r),n=qg(s),o=$g(n);if(this.uppy.emit("upload-start",o),this.opts.bundle){if(n.some(l=>l.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await Ai(this,ph)[ph](n)}else await Ai(this,fh)[fh](n)}}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=Vg,this.i18nInit(),Fa in this.opts?this.requests=this.opts[Fa]:this.requests=new Ca(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),Ai(this,kr)[kr]=r=>async(s,n)=>{try{var o,a,l;let m=await jg(s,{...n,onBeforeRequest:(k,C)=>{var O,R;return(O=(R=this.opts).onBeforeRequest)==null?void 0:O.call(R,k,C,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:k=>{let C=Math.ceil(k/1e3),O=new Error(this.i18n("uploadStalled",{seconds:C}));this.uppy.emit("upload-stalled",O,r)},onUploadProgress:k=>{if(k.lengthComputable)for(let{id:O}of r){var C;let R=this.uppy.getFile(O);this.uppy.emit("upload-progress",R,{uploadStarted:(C=R.progress.uploadStarted)!=null?C:0,bytesUploaded:k.loaded/k.total*R.size,bytesTotal:R.size})}}}),w=await((o=(a=this.opts).getResponseData)==null?void 0:o.call(a,m));if(m.responseType==="json"){var h;(h=w)!=null||(w=m.response)}else try{var f;(f=w)!=null||(w=JSON.parse(m.responseText))}catch(k){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:k})}let y=typeof((l=w)==null?void 0:l.url)=="string"?w.url:void 0;for(let{id:k}of r)this.uppy.emit("upload-success",this.uppy.getFile(k),{status:m.status,body:w,uploadURL:y});return m}catch(m){if(m.name==="AbortError")return;let w=m.request;for(let y of r)this.uppy.emit("upload-error",this.uppy.getFile(y.id),CE(w,m),w);throw m}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){Oa(r.allowedMetaFields,t).forEach(n=>{let o=t[n];Array.isArray(o)?o.forEach(a=>e.append(n,a)):e.append(n,o)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=Wg(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let o=this.getOptions(n),a=Wg(n);n.name?r.append(o.fieldName,a,n.name):r.append(o.fieldName,a)}),r}install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(Ai(this,Ln)[Ln])}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(Ai(this,Ln)[Ln])}};async function PE(i){let e=new On(this.uppy),t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let s=this.getOptions(i),n=Ai(this,kr)[kr]([i]),o=s.formData?this.createFormDataUpload(i,s):i.data;return n(s.endpoint,{...s,body:o,signal:t.signal})});e.onFileRemove(i.id,()=>t.abort()),e.onCancelAll(i.id,()=>{t.abort()});try{await r().abortOn(t.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{e.remove()}}async function OE(i){let e=new AbortController,t=this.requests.wrapPromiseFunction(async()=>{var s;let n=(s=this.uppy.getState().xhrUpload)!=null?s:{},o=Ai(this,kr)[kr](i),a=this.createBundledUpload(i,{...this.opts,...n});return o(this.opts.endpoint,{...this.opts,body:a,signal:e.signal})});function r(){e.abort()}this.uppy.once("cancel-all",r);try{await t().abortOn(e.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{this.uppy.off("cancel-all",r)}}function RE(i){var e;let t=this.getOptions(i),r=Oa(t.allowedMetaFields,i.meta);return{...(e=i.remote)==null?void 0:e.body,protocol:"multipart",endpoint:t.endpoint,size:i.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,i.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async function LE(i){await Promise.allSettled(i.map(e=>{if(e.isRemote){let t=()=>this.requests,r=new AbortController,s=o=>{o.id===e.id&&r.abort()};this.uppy.on("file-removed",s);let n=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,Ai(this,gh)[gh](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return Ai(this,mh)[mh](e)}))}ds.VERSION=AE.version;var tt=class{static fromTemplate(i){if(Xr.isSupported)return Xr.sanitize(i,{USE_PROFILES:{html:!0,svg:!0},RETURN_DOM:!0}).children[0];{let e=new DOMParser().parseFromString(i,"text/html").body.children[0];return ME(e)}}};function ME(i){return IE(i),Gg(i),i}function IE(i){let e=i.querySelectorAll("script");for(let t of e)t.remove()}function DE(i,e){let t=e.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(i)&&(t.includes("javascript:")||t.includes("data:"))||i.startsWith("on"))return!0}function NE(i){let e=i.attributes;for(let{name:t,value:r}of e)DE(t,r)&&i.removeAttribute(t)}function Gg(i){let e=i.children;for(let t of e)NE(t),Gg(t)}var Ra=class extends V{static values={identifier:String,endpoint:String,maxFileSize:{type:Number,default:null},minFileSize:{type:Number,default:null},maxTotalSize:{type:Number,default:null},maxFileNum:{type:Number,default:null},minFileNum:{type:Number,default:null},allowedFileTypes:{type:Array,default:null},requiredMetaFields:{type:Array,default:[]}};static outlets=["attachment-preview","attachment-preview-container"];connect(){this.uppy||(this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#n(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.#t()}#e(){this.element.isConnected&&(this.#t(),this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#n())}#t(){this.uppy&&(this.uppy.destroy(),this.uppy=null),this.triggerContainer&&this.triggerContainer.parentNode&&(this.triggerContainer.parentNode.removeChild(this.triggerContainer),this.triggerContainer=null)}attachmentPreviewOutletConnected(i,e){this.#n()}attachmentPreviewOutletDisconnected(i,e){this.#n()}configureUppy(){this.uppy=new Zo({restrictions:{maxFileSize:this.maxFileSizeValue,minFileSize:this.minFileSizeValue,maxTotalFileSize:this.maxTotalSizeValue,maxNumberOfFiles:this.maxFileNumValue,minNumberOfFiles:this.minFileNumValue,allowedFileTypes:this.allowedFileTypesValue,requiredMetaFields:this.requiredMetaFieldsValue}}).use(xr,{inline:!1,closeAfterFinish:!0}).use(hs,{target:xr}),this.#i(),this.#r()}#i(){this.uppy.use(ds,{endpoint:this.endpointValue})}#r(){this.uppy.on("upload-success",this.#o.bind(this))}#s(){let i=document.documentElement.getAttribute("data-bs-theme")||"auto";this.#u.setOptions({theme:i});let e=null;for(;e=this.uploadedFiles.pop();)this.uppy.removeFile(e.id);this.#u.openModal()}#o(i,e){this.uploadedFiles.push(i),this.multiple||this.attachmentPreviewOutlets.forEach(s=>s.remove());let t=e.body.data,r=e.body.url;this.attachmentPreviewContainerOutlet.element.appendChild(this.#c(t,r))}#n(){if(!this.deleteAllTrigger)return;this.attachmentPreviewOutlets.length>1?(this.deleteAllTrigger.style.display="initial",this.deleteAllTrigger.textContent=`Delete ${this.attachmentPreviewOutlets.length}`):this.deleteAllTrigger.style.display="none"}#l(){this.triggerContainer=document.createElement("div"),this.triggerContainer.className="flex items-center gap-2",this.element.insertAdjacentElement("afterend",this.triggerContainer),this.#a(),this.uploadTrigger&&this.triggerContainer.append(this.uploadTrigger),this.deleteAllTrigger&&this.triggerContainer.append(this.deleteAllTrigger)}#a(){let i=this.multiple?"Choose files":"Choose file";this.uploadTrigger=tt.fromTemplate(`<button type="button" class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700 inline-flex items-center">
99
99
  <svg class="w-4 h-4 mr-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 16">
100
100
  <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"/>
101
101
  </svg>
102
102
  ${i}
103
- </button>`,!1),this.uploadTrigger.addEventListener("click",this.#s.bind(this))}#h(){this.deleteAllTrigger=tt.fromTemplate(`<button type="button" class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-red-600 dark:hover:bg-red-700 focus:outline-none dark:focus:ring-red-800 inline-flex items-center">
103
+ </button>`,!1),this.uploadTrigger.addEventListener("click",this.#s.bind(this))}#d(){this.deleteAllTrigger=tt.fromTemplate(`<button type="button" class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-red-600 dark:hover:bg-red-700 focus:outline-none dark:focus:ring-red-800 inline-flex items-center">
104
104
  Delete ${this.attachmentPreviewOutlets.length}
105
- </button>`,!1),this.deleteAllTrigger.addEventListener("click",()=>{confirm("Are you sure?")&&this.attachmentPreviewContainerOutlet.clear()})}#c(i,e){let t=i.metadata.filename,r=t.substring(t.lastIndexOf(".")+1,t.length)||t,s=this.multiple?"multiple":"",n=i.metadata.mime_type,a=["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"].includes(n.toLowerCase()),l=tt.fromTemplate(this.#d(t,r,n,e,a)),h=tt.fromTemplate(`<input name="${this.element.name}" ${s} type="hidden" autocomplete="off" hidden />`);return h.value=JSON.stringify(i),l.appendChild(h),l}#d(i,e,t,r,s){return`
105
+ </button>`,!1),this.deleteAllTrigger.addEventListener("click",()=>{confirm("Are you sure?")&&this.attachmentPreviewContainerOutlet.clear()})}#c(i,e){let t=i.metadata.filename,r=t.substring(t.lastIndexOf(".")+1,t.length)||t,s=this.multiple?"multiple":"",n=i.metadata.mime_type,a=["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"].includes(n.toLowerCase()),l=tt.fromTemplate(this.#h(t,r,n,e,a)),h=tt.fromTemplate(`<input name="${this.element.name}" ${s} type="hidden" autocomplete="off" hidden />`);return h.value=JSON.stringify(i),l.appendChild(h),l}#h(i,e,t,r,s){return`
106
106
  <div class="${this.identifierValue} attachment-preview group relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md transition-all duration-300"
107
107
  data-controller="attachment-preview"
108
108
  data-attachment-preview-mime-type-value="${t}"
@@ -161,7 +161,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&
161
161
  </svg>
162
162
  `)}function bh(i){let e={color:"#838999",icon:qE()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:$E()}:t==="image"?{color:"#686de0",icon:BE()}:t==="audio"?{color:"#068dbb",icon:UE()}:t==="video"?{color:"#19af67",icon:zE()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:HE()}:t==="application"&&["zip","x-7z-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:jE()}:e}var La=class extends V{static targets=["thumbnail","thumbnailLink"];static values={mimeType:String,thumbnailUrl:String};connect(){this.hasThumbnailTarget&&(this.thumbnailUrlValue?this.useThumbnailPreview():this.useMimeIconPreview())}remove(){this.element.remove()}useThumbnailPreview(){let i=tt.fromTemplate(`
163
163
  <img src="${this.thumbnailUrlValue}" class="w-full h-full object-cover" />
164
- `);this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i)}useMimeIconPreview(){let i=bh(this.mimeTypeValue);i.icon.classList.add("w-3/5","h-4/5","rounded-lg","shadow-lg","bg-white","p-2"),this.thumbnailLinkTarget.classList.add("flex","items-center","justify-center"),this.thumbnailLinkTarget.style.backgroundColor=i.color,this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i.icon)}};var Ma=class extends V{connect(){}append(i){this.element.appendChild(i)}clear(){this.element.innerHTML=null}};var Kg=0,Ia=class extends V{static targets=["scroll"];connect(){this.beforeRender=this.beforeRender.bind(this),this.afterRender=this.afterRender.bind(this),document.addEventListener("turbo:before-render",this.beforeRender),document.addEventListener("turbo:render",this.afterRender)}disconnect(){document.removeEventListener("turbo:before-render",this.beforeRender),document.removeEventListener("turbo:render",this.afterRender)}beforeRender(){this.hasScrollTarget&&(Kg=this.scrollTarget.scrollTop)}afterRender(){this.hasScrollTarget&&(this.scrollTarget.scrollTop=Kg)}};var Da=class extends V{static targets=["password","checkbox"];connect(){this.checkboxTarget.checked=!1}toggle(){this.passwordTarget.type=="password"?this.passwordTargets.forEach(i=>i.type="text"):this.passwordTargets.forEach(i=>i.type="password")}};var Na=class extends V{connect(){this.originalScrollPosition=window.scrollY,this.originalOverflow=document.body.style.overflow,this.bodyStateRestored=!1,this._closing=!1,document.body.style.overflow="hidden",this.element.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.element.setAttribute("data-open","")})}),this.onCancel=this.#e.bind(this),this.onClose=this.#t.bind(this),this.onRequestClose=()=>this.#i(),this.element.addEventListener("cancel",this.onCancel),this.element.addEventListener("close",this.onClose),this.element.addEventListener("modal:request-close",this.onRequestClose)}disconnect(){this.element.removeEventListener("cancel",this.onCancel),this.element.removeEventListener("close",this.onClose),this.element.removeEventListener("modal:request-close",this.onRequestClose),this.#r()}close(){this.#i()}#e(i){i.defaultPrevented||(i.preventDefault(),this.#i())}#t(){this.#r()}async#i(){if(this._closing)return;this._closing=!0,this.element.removeAttribute("data-open");let i=this.element.getAnimations({subtree:!0});await Promise.allSettled(i.map(e=>e.finished)),this.element.close()}#r(){this.bodyStateRestored||(this.bodyStateRestored=!0,document.body.style.overflow=this.originalOverflow||"",window.scrollTo(0,this.originalScrollPosition))}};var Ba=class extends V{static targets=["container","pair","template","addButton","keyInput","valueInput"];static values={limit:Number};connect(){this.updateIndices(),this.updateAddButtonState()}addPair(i){if(i.preventDefault(),this.pairTargets.length>=this.limitValue)return;let t=this.templateTarget.content.cloneNode(!0),r=this.pairTargets.length;this.updatePairIndices(t,r),this.containerTarget.appendChild(t),this.updateIndices(),this.updateAddButtonState();let s=this.containerTarget.lastElementChild.querySelector('[data-key-value-store-target="keyInput"]');s&&s.focus()}removePair(i){i.preventDefault();let e=i.target.closest('[data-key-value-store-target="pair"]');e&&(e.remove(),this.updateIndices(),this.updateAddButtonState())}updateIndices(){this.pairTargets.forEach((i,e)=>{let t=i.querySelector('[data-key-value-store-target="keyInput"]'),r=i.querySelector('[data-key-value-store-target="valueInput"]');t&&(t.name=t.name.replace(/\[\d+\]/,`[${e}]`),t.id=t.id.replace(/_\d+_/,`_${e}_`)),r&&(r.name=r.name.replace(/\[\d+\]/,`[${e}]`),r.id=r.id.replace(/_\d+_/,`_${e}_`))})}updatePairIndices(i,e){i.querySelectorAll("input").forEach(r=>{r.name&&(r.name=r.name.replace("__INDEX__",e)),r.id&&(r.id=r.id.replace("___INDEX___",`_${e}_`))})}updateAddButtonState(){let i=this.addButtonTarget;this.pairTargets.length>=this.limitValue?(i.disabled=!0,i.classList.add("opacity-50","cursor-not-allowed")):(i.disabled=!1,i.classList.remove("opacity-50","cursor-not-allowed"))}toJSON(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),JSON.stringify(i)}toObject(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),i}};var Ua=class extends V{static targets=["checkbox","checkboxAll","toolbar","selectedCount","actionButton","filterPills"];toggle(){this.updateUI()}toggleAll(i){let e=i.target.checked;this.checkboxTargets.forEach(t=>t.checked=e),this.updateUI()}updateUI(){let i=this.checked,e=this.checkboxTargets.length;this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=i.length===e&&e>0,this.checkboxAllTarget.indeterminate=i.length>0&&i.length<e),this.hasToolbarTarget&&this.toolbarTarget.classList.toggle("hidden",i.length===0),this.hasFilterPillsTarget&&this.filterPillsTarget.classList.toggle("hidden",i.length>0),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=i.length),this.updateActionButtons()}updateActionButtons(){let i=this.checked,t=i.map(s=>s.value).map(s=>`ids[]=${encodeURIComponent(s)}`).join("&"),r=this.computeAllowedActions(i);this.actionButtonTargets.forEach(s=>{let n=s.dataset.bulkActionUrl,o=s.dataset.bulkActionName;n&&(s.href=t?`${n}?${t}`:n),s.style.display=r.has(o)?"":"none"})}computeAllowedActions(i){if(i.length===0)return new Set;let e=new Set(this.getAllowedActionsForCheckbox(i[0]));for(let t=1;t<i.length;t++){let r=this.getAllowedActionsForCheckbox(i[t]);e=new Set([...e].filter(s=>r.includes(s)))}return e}getAllowedActionsForCheckbox(i){let e=i.dataset.allowedActions;return e?e.split(",").filter(t=>t):[]}clearSelection(){this.checkboxTargets.forEach(i=>i.checked=!1),this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=!1,this.checkboxAllTarget.indeterminate=!1),this.updateUI()}get checked(){return this.checkboxTargets.filter(i=>i.checked)}get unchecked(){return this.checkboxTargets.filter(i=>!i.checked)}};var za=class extends V{static targets=["panel","backdrop"];connect(){this._onKeydown=this._onKeydown.bind(this)}disconnect(){this.isOpen&&(document.removeEventListener("keydown",this._onKeydown),this._unlockBodyScroll())}toggle(){this.isOpen?this.close():this.open()}open(){this.hasPanelTarget&&(this.panelTarget.setAttribute("data-open",""),this.panelTarget.setAttribute("aria-hidden","false")),this.hasBackdropTarget&&this.backdropTarget.setAttribute("data-open",""),this._lockBodyScroll(),document.addEventListener("keydown",this._onKeydown)}close(){this.hasPanelTarget&&(this.panelTarget.removeAttribute("data-open"),this.panelTarget.setAttribute("aria-hidden","true")),this.hasBackdropTarget&&this.backdropTarget.removeAttribute("data-open"),this._unlockBodyScroll(),document.removeEventListener("keydown",this._onKeydown)}_lockBodyScroll(){this._previousBodyOverflow==null&&(this._previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden")}_unlockBodyScroll(){this._previousBodyOverflow!=null&&(document.body.style.overflow=this._previousBodyOverflow,this._previousBodyOverflow=null)}clear(){this.element.querySelectorAll("input, select, textarea").forEach(e=>{e.type==="checkbox"||e.type==="radio"?e.checked=!1:e.tagName==="SELECT"?e.selectedIndex=0:e.type==="hidden"?e.dataset.controller==="flatpickr"&&(e.value=""):e.value=""}),this.element.querySelectorAll('[data-controller="flatpickr"]').forEach(e=>{let t=this.application.getControllerForElementAndIdentifier(e,"flatpickr");t?.picker&&t.picker.clear()});let i=this.element.querySelector("form");i&&i.requestSubmit()}get isOpen(){return this.hasPanelTarget&&this.panelTarget.hasAttribute("data-open")}_onKeydown(i){i.key==="Escape"&&this.close()}};var Ha=class extends V{static values={maxHeight:{type:Number,default:0}};connect(){this.resize(),this.element.addEventListener("input",this.resize),window.addEventListener("resize",this.resize)}disconnect(){this.element.removeEventListener("input",this.resize),window.removeEventListener("resize",this.resize)}resize=()=>{let i=this.element,e=this.#e();i.style.height="auto",i.style.overflow="hidden";let t=i.scrollHeight;e>0&&t>e?(i.style.height=`${e}px`,i.style.overflow="auto"):i.style.height=`${t}px`};#e(){if(this.maxHeightValue>0)return this.maxHeightValue;let e=window.getComputedStyle(this.element).maxHeight;if(e&&e!=="none"){let t=parseFloat(e);if(!isNaN(t)&&t>0)return t}return 300}};var ja=class extends V{static targets=["source"];copy(i){let e=this.sourceTarget.value||this.sourceTarget.textContent,t=i.currentTarget,r=t.textContent;navigator.clipboard.writeText(e).then(()=>{t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)}).catch(s=>{console.warn("Clipboard API failed, using fallback:",s),this.fallbackCopy(e),t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)})}fallbackCopy(i){let e=document.createElement("textarea");e.value=i,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}};var qa=class extends V{static values={storageKey:{type:String,default:"pu_rail_pinned"}};connect(){localStorage.getItem(this.storageKeyValue)==="true"&&document.body.classList.add("pu-rail-pinned")}togglePin(){let i=document.body.classList.toggle("pu-rail-pinned");localStorage.setItem(this.storageKeyValue,i)}};var $a=class extends V{static targets=["trigger","panel"];static values={closeDelay:{type:Number,default:150}};connect(){this._closeTimer=null,this._open=!1,this._panel=null,this._panelHome=null,this._onPanelEnter=()=>{this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null)},this._onPanelLeave=()=>this.scheduleClose()}disconnect(){this._returnPanel()}open(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),!this._open&&(!this._panel&&!this.hasPanelTarget||(this._open=!0,this.element.dataset.flyoutOpen="true",this._portalPanel(),this._position()))}scheduleClose(){this._closeTimer&&clearTimeout(this._closeTimer),this._closeTimer=setTimeout(()=>this.close(),this.closeDelayValue)}close(){this._open&&(this._open=!1,delete this.element.dataset.flyoutOpen,this._returnPanel())}toggle(i){i.preventDefault(),this._open?this.close():this.open()}closeOnEsc(i){i.key==="Escape"&&this.close()}_portalPanel(){if(this._panel)return;let i=this.panelTarget;i&&(this._panel=i,this._panelHome=i.parentElement,i.addEventListener("mouseenter",this._onPanelEnter),i.addEventListener("mouseleave",this._onPanelLeave),document.body.appendChild(i),i.style.display="block")}_returnPanel(){if(!this._panel)return;let i=this._panel;i.removeEventListener("mouseenter",this._onPanelEnter),i.removeEventListener("mouseleave",this._onPanelLeave),i.style.position="",i.style.left="",i.style.top="",i.style.display="",this._panelHome&&document.contains(this._panelHome)?this._panelHome.appendChild(i):i.remove(),this._panel=null,this._panelHome=null}_position(){if(!this._panel||!this.hasTriggerTarget)return;let i=this._panel,e=this.triggerTarget.getBoundingClientRect();i.style.position="fixed",i.style.left=`${e.right+4}px`,i.style.top=`${e.top}px`,requestAnimationFrame(()=>{let t=i.getBoundingClientRect(),r=window.innerHeight;if(t.bottom>r-8){let s=t.bottom-(r-8);i.style.top=`${parseFloat(i.style.top)-s}px`}})}};var Va=class extends V{headerClick(i){if(!i.shiftKey)return;let t=i.currentTarget.dataset.tableHeaderMultiHref;t&&(i.preventDefault(),Turbo.visit(t))}};var Wa=class extends V{static targets=["panel"];connect(){this._onDocClick=this._onDocClick.bind(this)}toggle(i){i.preventDefault(),i.stopPropagation(),this.hasPanelTarget&&(!this.panelTarget.classList.toggle("hidden")?(document.addEventListener("click",this._onDocClick),this._onKey=t=>{t.key==="Escape"&&this._close()},document.addEventListener("keydown",this._onKey)):this._unbind())}_close(){this.hasPanelTarget&&this.panelTarget.classList.add("hidden"),this._unbind()}_unbind(){document.removeEventListener("click",this._onDocClick),this._onKey&&(document.removeEventListener("keydown",this._onKey),this._onKey=null)}_onDocClick(i){this.element.contains(i.target)||this._close()}};var Ga=class extends V{connect(){"value"in this.element&&(this.element.value=window.location.href)}};var Ka=class extends V{click(i){i.target.closest("a, button, input, label, select, textarea, [data-row-click-ignore]")||this.element.querySelector('[data-row-click-target="show"]')?.click()}};var Xa=class extends V{static values={cookieName:String,cookiePath:{type:String,default:"/"}};select(i){let e=i.params.view;if(!e||!this.cookieNameValue)return;let t=3600*24*365,r=this.cookiePathValue||"/";document.cookie=`${this.cookieNameValue}=${encodeURIComponent(e)}; Path=${r}; Max-Age=${t}; SameSite=Lax`;let s=new URL(window.location.href);s.searchParams.delete("view"),window.location.href=s.toString()}};var Ya=class extends V{static values={delay:{type:Number,default:300}};connect(){this._timer=null}disconnect(){this._timer&&clearTimeout(this._timer)}submit(){this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>{this.element.closest("form")?.requestSubmit()},this.delayValue)}};var Za=class extends V{static targets=["confirmDialog"];static IGNORED_KEYS=new Set(["authenticity_token","return_to","pre_submit"]);connect(){this.dialog=this.element.closest("dialog"),this.dialog&&(this.snapshot=this.#t(),this.forceClose=!1,this.submitting=!1,this.onCancel=this.#n.bind(this),this.onSubmit=this.#r.bind(this),this.onCloseButtonClick=this.#l.bind(this),this.onConfirmCancel=this.#a.bind(this),this.onKeydown=this.#o.bind(this),document.addEventListener("keydown",this.onKeydown,!0),this.dialog.addEventListener("cancel",this.onCancel,!0),this.element.addEventListener("submit",this.onSubmit),this.#e().forEach(i=>i.addEventListener("click",this.onCloseButtonClick,!0)),this.hasConfirmDialogTarget&&this.confirmDialogTarget.addEventListener("cancel",this.onConfirmCancel))}disconnect(){this.dialog&&(document.removeEventListener("keydown",this.onKeydown,!0),this.dialog.removeEventListener("cancel",this.onCancel,!0),this.element.removeEventListener("submit",this.onSubmit),this.#e().forEach(i=>i.removeEventListener("click",this.onCloseButtonClick,!0)),this.hasConfirmDialogTarget&&this.confirmDialogTarget.removeEventListener("cancel",this.onConfirmCancel))}async discard(){this.forceClose=!0,await this.#c(),this.dialog.dispatchEvent(new CustomEvent("modal:request-close"))}keepEditing(){this.#c()}#e(){return this.dialog?this.dialog.querySelectorAll('[data-action~="remote-modal#close"]'):[]}#t(){let i=new FormData(this.element),e=encodeURIComponent;return[...i.entries()].filter(([t])=>!this.constructor.IGNORED_KEYS.has(t)).map(([t,r])=>{let s=r instanceof File?r.name:r;return`${e(t)}=${e(s)}`}).sort().join("&")}#i(){return this.#t()!==this.snapshot}#r(){this.submitting=!0}#s(){return this.hasConfirmDialogTarget&&this.confirmDialogTarget.open}#o(i){if(i.key==="Escape"&&this.dialog.open){if(this.#s()){i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();return}this.forceClose||this.submitting||this.#i()&&(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),this.#h())}}#n(i){this.forceClose||this.submitting||this.#i()&&(i.preventDefault(),this.#h())}#l(i){this.forceClose||this.submitting||this.#i()&&(i.preventDefault(),i.stopPropagation(),this.#h())}#a(i){i.preventDefault()}#h(){if(this.hasConfirmDialogTarget){let i=this.confirmDialogTarget;i.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>i.setAttribute("data-open",""))})}else window.confirm("Discard your changes?")&&(this.forceClose=!0,this.dialog.dispatchEvent(new CustomEvent("modal:request-close")))}async#c(){if(!this.hasConfirmDialogTarget)return;let i=this.confirmDialogTarget;if(!i.open)return;i.removeAttribute("data-open");let e=i.getAnimations({subtree:!0});await Promise.allSettled(e.map(t=>t.finished)),i.close()}};function yh(i){i.register("password-visibility",Da),i.register("sidebar",Ia),i.register("resource-header",po),i.register("nested-resource-form-fields",fo),i.register("form",mo),i.register("resource-drop-down",Eo),i.register("resource-collapse",To),i.register("resource-dismiss",xo),i.register("frame-navigator",ko),i.register("color-mode",Ao),i.register("easymde",Mo),i.register("slim-select",Io),i.register("flatpickr",Do),i.register("intl-tel-input",No),i.register("select-navigator",Bo),i.register("resource-tab-list",Uo),i.register("attachment-input",Ra),i.register("attachment-preview",La),i.register("attachment-preview-container",Ma),i.register("remote-modal",Na),i.register("key-value-store",Ba),i.register("bulk-actions",Ua),i.register("filter-panel",za),i.register("textarea-autogrow",Ha),i.register("clipboard",ja),i.register("icon-rail",qa),i.register("icon-rail-flyout",$a),i.register("table-header",Va),i.register("table-column-menu",Wa),i.register("capture-url",Ga),i.register("row-click",Ka),i.register("view-switcher",Xa),i.register("autosubmit",Ya),i.register("dirty-form-guard",Za)}Turbo.StreamActions.redirect=function(){Turbo.cache.clear();let i=this.getAttribute("url");Turbo.visit(i)};Turbo.StreamActions.close_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);if(!e)return;let t=e.querySelector("dialog");t&&typeof t.close=="function"&&t.close(),e.innerHTML="",e.removeAttribute("src")};Turbo.StreamActions.reload_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);!e||typeof e.reload!="function"||e.reload()};var it,Mn,Xi,_r;function VE(){if(it){it.isConnected||document.body.appendChild(it);return}it=document.createElement("dialog"),it.className=["pu-dialog","top-1/2","-translate-y-1/2","left-1/2","-translate-x-1/2","w-full","max-w-md","p-0","open:flex","flex-col","opacity-0","scale-95","data-[open]:opacity-100","data-[open]:scale-100","transition-[opacity,transform]","duration-200","ease-out"].join(" "),it.setAttribute("aria-labelledby","pu-turbo-confirm-message");let i=document.createElement("div");i.className="px-6 pt-5 pb-4 border-b border-[var(--pu-border)]",Mn=document.createElement("h2"),Mn.id="pu-turbo-confirm-message",Mn.className="text-lg font-semibold text-[var(--pu-text)]",i.appendChild(Mn);let e=document.createElement("div");e.className="flex items-center justify-end gap-2 px-6 py-4",_r=document.createElement("button"),_r.type="button",_r.className="pu-btn pu-btn-md pu-btn-outline",_r.textContent="Cancel",Xi=document.createElement("button"),Xi.type="button",Xi.className="pu-btn pu-btn-md pu-btn-primary",Xi.textContent="Confirm",e.appendChild(_r),e.appendChild(Xi),it.appendChild(i),it.appendChild(e),document.body.appendChild(it)}async function WE(){it.removeAttribute("data-open");let i=it.getAnimations({subtree:!0});await Promise.allSettled(i.map(e=>e.finished)),it.open&&it.close()}function Xg(i){return VE(),Mn.textContent=i||"Are you sure?",new Promise(e=>{let t=!1,r=l=>{t||(t=!0,a(),e(l),WE())},s=()=>r(!0),n=()=>r(!1),o=()=>r(!1),a=()=>{Xi.removeEventListener("click",s),_r.removeEventListener("click",n),it.removeEventListener("close",o)};Xi.addEventListener("click",s),_r.addEventListener("click",n),it.addEventListener("close",o),it.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>it.setAttribute("data-open",""))}),Xi.focus()})}typeof window<"u"&&window.Turbo&&(window.Turbo.config?.forms?window.Turbo.config.forms.confirm=Xg:window.Turbo.setConfirmMethod&&window.Turbo.setConfirmMethod(Xg));var GE=uo.start();yh(GE);})();
164
+ `);this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i)}useMimeIconPreview(){let i=bh(this.mimeTypeValue);i.icon.classList.add("w-3/5","h-4/5","rounded-lg","shadow-lg","bg-white","p-2"),this.thumbnailLinkTarget.classList.add("flex","items-center","justify-center"),this.thumbnailLinkTarget.style.backgroundColor=i.color,this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i.icon)}};var Ma=class extends V{connect(){}append(i){this.element.appendChild(i)}clear(){this.element.innerHTML=null}};var Kg=0,Ia=class extends V{static targets=["scroll"];connect(){this.beforeRender=this.beforeRender.bind(this),this.afterRender=this.afterRender.bind(this),document.addEventListener("turbo:before-render",this.beforeRender),document.addEventListener("turbo:render",this.afterRender)}disconnect(){document.removeEventListener("turbo:before-render",this.beforeRender),document.removeEventListener("turbo:render",this.afterRender)}beforeRender(){this.hasScrollTarget&&(Kg=this.scrollTarget.scrollTop)}afterRender(){this.hasScrollTarget&&(this.scrollTarget.scrollTop=Kg)}};var Da=class extends V{static targets=["password","checkbox"];connect(){this.checkboxTarget.checked=!1}toggle(){this.passwordTarget.type=="password"?this.passwordTargets.forEach(i=>i.type="text"):this.passwordTargets.forEach(i=>i.type="password")}};var Na=class extends V{connect(){this.originalScrollPosition=window.scrollY,this.originalOverflow=document.body.style.overflow,this.bodyStateRestored=!1,this._closing=!1,document.body.style.overflow="hidden",this.element.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.element.setAttribute("data-open","")})}),this.onCancel=this.#e.bind(this),this.onClose=this.#t.bind(this),this.onRequestClose=()=>this.#i(),this.element.addEventListener("cancel",this.onCancel),this.element.addEventListener("close",this.onClose),this.element.addEventListener("modal:request-close",this.onRequestClose)}disconnect(){this.element.removeEventListener("cancel",this.onCancel),this.element.removeEventListener("close",this.onClose),this.element.removeEventListener("modal:request-close",this.onRequestClose),this.#r()}close(){this.#i()}#e(i){i.target===this.element&&(i.defaultPrevented||(i.preventDefault(),this.#i()))}#t(){this.#r()}async#i(){if(this._closing)return;this._closing=!0,this.element.removeAttribute("data-open");let i=this.element.getAnimations({subtree:!0});await Promise.allSettled(i.map(e=>e.finished)),this.element.close()}#r(){this.bodyStateRestored||(this.bodyStateRestored=!0,document.body.style.overflow=this.originalOverflow||"",window.scrollTo(0,this.originalScrollPosition))}};var Ba=class extends V{static targets=["container","pair","template","addButton","keyInput","valueInput"];static values={limit:Number};connect(){this.updateIndices(),this.updateAddButtonState()}addPair(i){if(i.preventDefault(),this.pairTargets.length>=this.limitValue)return;let t=this.templateTarget.content.cloneNode(!0),r=this.pairTargets.length;this.updatePairIndices(t,r),this.containerTarget.appendChild(t),this.updateIndices(),this.updateAddButtonState();let s=this.containerTarget.lastElementChild.querySelector('[data-key-value-store-target="keyInput"]');s&&s.focus()}removePair(i){i.preventDefault();let e=i.target.closest('[data-key-value-store-target="pair"]');e&&(e.remove(),this.updateIndices(),this.updateAddButtonState())}updateIndices(){this.pairTargets.forEach((i,e)=>{let t=i.querySelector('[data-key-value-store-target="keyInput"]'),r=i.querySelector('[data-key-value-store-target="valueInput"]');t&&(t.name=t.name.replace(/\[\d+\]/,`[${e}]`),t.id=t.id.replace(/_\d+_/,`_${e}_`)),r&&(r.name=r.name.replace(/\[\d+\]/,`[${e}]`),r.id=r.id.replace(/_\d+_/,`_${e}_`))})}updatePairIndices(i,e){i.querySelectorAll("input").forEach(r=>{r.name&&(r.name=r.name.replace("__INDEX__",e)),r.id&&(r.id=r.id.replace("___INDEX___",`_${e}_`))})}updateAddButtonState(){let i=this.addButtonTarget;this.pairTargets.length>=this.limitValue?(i.disabled=!0,i.classList.add("opacity-50","cursor-not-allowed")):(i.disabled=!1,i.classList.remove("opacity-50","cursor-not-allowed"))}toJSON(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),JSON.stringify(i)}toObject(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),i}};var Ua=class extends V{static targets=["checkbox","checkboxAll","toolbar","selectedCount","actionButton","filterPills"];toggle(){this.updateUI()}toggleAll(i){let e=i.target.checked;this.checkboxTargets.forEach(t=>t.checked=e),this.updateUI()}updateUI(){let i=this.checked,e=this.checkboxTargets.length;this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=i.length===e&&e>0,this.checkboxAllTarget.indeterminate=i.length>0&&i.length<e),this.hasToolbarTarget&&this.toolbarTarget.classList.toggle("hidden",i.length===0),this.hasFilterPillsTarget&&this.filterPillsTarget.classList.toggle("hidden",i.length>0),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=i.length),this.updateActionButtons()}updateActionButtons(){let i=this.checked,t=i.map(s=>s.value).map(s=>`ids[]=${encodeURIComponent(s)}`).join("&"),r=this.computeAllowedActions(i);this.actionButtonTargets.forEach(s=>{let n=s.dataset.bulkActionUrl,o=s.dataset.bulkActionName;n&&(s.href=t?`${n}?${t}`:n),s.style.display=r.has(o)?"":"none"})}computeAllowedActions(i){if(i.length===0)return new Set;let e=new Set(this.getAllowedActionsForCheckbox(i[0]));for(let t=1;t<i.length;t++){let r=this.getAllowedActionsForCheckbox(i[t]);e=new Set([...e].filter(s=>r.includes(s)))}return e}getAllowedActionsForCheckbox(i){let e=i.dataset.allowedActions;return e?e.split(",").filter(t=>t):[]}clearSelection(){this.checkboxTargets.forEach(i=>i.checked=!1),this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=!1,this.checkboxAllTarget.indeterminate=!1),this.updateUI()}get checked(){return this.checkboxTargets.filter(i=>i.checked)}get unchecked(){return this.checkboxTargets.filter(i=>!i.checked)}};var za=class extends V{static targets=["panel","backdrop"];connect(){this._onKeydown=this._onKeydown.bind(this)}disconnect(){this.isOpen&&(document.removeEventListener("keydown",this._onKeydown),this._unlockBodyScroll())}toggle(){this.isOpen?this.close():this.open()}open(){this.hasPanelTarget&&(this.panelTarget.setAttribute("data-open",""),this.panelTarget.setAttribute("aria-hidden","false")),this.hasBackdropTarget&&this.backdropTarget.setAttribute("data-open",""),this._lockBodyScroll(),document.addEventListener("keydown",this._onKeydown)}close(){this.hasPanelTarget&&(this.panelTarget.removeAttribute("data-open"),this.panelTarget.setAttribute("aria-hidden","true")),this.hasBackdropTarget&&this.backdropTarget.removeAttribute("data-open"),this._unlockBodyScroll(),document.removeEventListener("keydown",this._onKeydown)}_lockBodyScroll(){this._previousBodyOverflow==null&&(this._previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden")}_unlockBodyScroll(){this._previousBodyOverflow!=null&&(document.body.style.overflow=this._previousBodyOverflow,this._previousBodyOverflow=null)}clear(){this.element.querySelectorAll("input, select, textarea").forEach(e=>{e.type==="checkbox"||e.type==="radio"?e.checked=!1:e.tagName==="SELECT"?e.selectedIndex=0:e.type==="hidden"?e.dataset.controller==="flatpickr"&&(e.value=""):e.value=""}),this.element.querySelectorAll('[data-controller="flatpickr"]').forEach(e=>{let t=this.application.getControllerForElementAndIdentifier(e,"flatpickr");t?.picker&&t.picker.clear()});let i=this.element.querySelector("form");i&&i.requestSubmit()}get isOpen(){return this.hasPanelTarget&&this.panelTarget.hasAttribute("data-open")}_onKeydown(i){i.key==="Escape"&&this.close()}};var Ha=class extends V{static values={maxHeight:{type:Number,default:0}};connect(){this.resize(),this.element.addEventListener("input",this.resize),window.addEventListener("resize",this.resize)}disconnect(){this.element.removeEventListener("input",this.resize),window.removeEventListener("resize",this.resize)}resize=()=>{let i=this.element,e=this.#e();i.style.height="auto",i.style.overflow="hidden";let t=i.scrollHeight;e>0&&t>e?(i.style.height=`${e}px`,i.style.overflow="auto"):i.style.height=`${t}px`};#e(){if(this.maxHeightValue>0)return this.maxHeightValue;let e=window.getComputedStyle(this.element).maxHeight;if(e&&e!=="none"){let t=parseFloat(e);if(!isNaN(t)&&t>0)return t}return 300}};var ja=class extends V{static targets=["source"];copy(i){let e=this.sourceTarget.value||this.sourceTarget.textContent,t=i.currentTarget,r=t.textContent;navigator.clipboard.writeText(e).then(()=>{t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)}).catch(s=>{console.warn("Clipboard API failed, using fallback:",s),this.fallbackCopy(e),t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)})}fallbackCopy(i){let e=document.createElement("textarea");e.value=i,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}};var qa=class extends V{static values={storageKey:{type:String,default:"pu_rail_pinned"}};connect(){localStorage.getItem(this.storageKeyValue)==="true"&&document.body.classList.add("pu-rail-pinned")}togglePin(){let i=document.body.classList.toggle("pu-rail-pinned");localStorage.setItem(this.storageKeyValue,i)}};var $a=class extends V{static targets=["trigger","panel"];static values={closeDelay:{type:Number,default:150}};connect(){this._closeTimer=null,this._open=!1,this._panel=null,this._panelHome=null,this._onPanelEnter=()=>{this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null)},this._onPanelLeave=()=>this.scheduleClose()}disconnect(){this._returnPanel()}open(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),!this._open&&(!this._panel&&!this.hasPanelTarget||(this._open=!0,this.element.dataset.flyoutOpen="true",this._portalPanel(),this._position()))}scheduleClose(){this._closeTimer&&clearTimeout(this._closeTimer),this._closeTimer=setTimeout(()=>this.close(),this.closeDelayValue)}close(){this._open&&(this._open=!1,delete this.element.dataset.flyoutOpen,this._returnPanel())}toggle(i){i.preventDefault(),this._open?this.close():this.open()}closeOnEsc(i){i.key==="Escape"&&this.close()}_portalPanel(){if(this._panel)return;let i=this.panelTarget;i&&(this._panel=i,this._panelHome=i.parentElement,i.addEventListener("mouseenter",this._onPanelEnter),i.addEventListener("mouseleave",this._onPanelLeave),document.body.appendChild(i),i.style.display="block")}_returnPanel(){if(!this._panel)return;let i=this._panel;i.removeEventListener("mouseenter",this._onPanelEnter),i.removeEventListener("mouseleave",this._onPanelLeave),i.style.position="",i.style.left="",i.style.top="",i.style.display="",this._panelHome&&document.contains(this._panelHome)?this._panelHome.appendChild(i):i.remove(),this._panel=null,this._panelHome=null}_position(){if(!this._panel||!this.hasTriggerTarget)return;let i=this._panel,e=this.triggerTarget.getBoundingClientRect();i.style.position="fixed",i.style.left=`${e.right+4}px`,i.style.top=`${e.top}px`,requestAnimationFrame(()=>{let t=i.getBoundingClientRect(),r=window.innerHeight;if(t.bottom>r-8){let s=t.bottom-(r-8),n=Math.max(8,parseFloat(i.style.top)-s);i.style.top=`${n}px`}})}};var Va=class extends V{headerClick(i){if(!i.shiftKey)return;let t=i.currentTarget.dataset.tableHeaderMultiHref;t&&(i.preventDefault(),Turbo.visit(t))}};var Wa=class extends V{static targets=["panel"];connect(){this._onDocClick=this._onDocClick.bind(this)}toggle(i){i.preventDefault(),i.stopPropagation(),this.hasPanelTarget&&(!this.panelTarget.classList.toggle("hidden")?(document.addEventListener("click",this._onDocClick),this._onKey=t=>{t.key==="Escape"&&this._close()},document.addEventListener("keydown",this._onKey)):this._unbind())}_close(){this.hasPanelTarget&&this.panelTarget.classList.add("hidden"),this._unbind()}_unbind(){document.removeEventListener("click",this._onDocClick),this._onKey&&(document.removeEventListener("keydown",this._onKey),this._onKey=null)}_onDocClick(i){this.element.contains(i.target)||this._close()}};var Ga=class extends V{connect(){if(!("value"in this.element))return;let i=this.element.value;if(!i)return;let{hash:e}=window.location;e&&(this.element.value=i.split("#")[0]+e)}};var Ka=class extends V{click(i){i.target.closest("a, button, input, label, select, textarea, [data-row-click-ignore]")||this.element.querySelector('[data-row-click-target="show"]')?.click()}};var Xa=class extends V{static values={cookieName:String,cookiePath:{type:String,default:"/"}};select(i){let e=i.params.view;if(!e||!this.cookieNameValue)return;let t=3600*24*365,r=this.cookiePathValue||"/";document.cookie=`${this.cookieNameValue}=${encodeURIComponent(e)}; Path=${r}; Max-Age=${t}; SameSite=Lax`;let s=new URL(window.location.href);s.searchParams.delete("view"),window.location.href=s.toString()}};var Ya=class extends V{static values={delay:{type:Number,default:300}};connect(){this._timer=null}disconnect(){this._timer&&clearTimeout(this._timer)}submit(){this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>{this.element.closest("form")?.requestSubmit()},this.delayValue)}};var Za=class extends V{static targets=["confirmDialog"];static IGNORED_KEYS=new Set(["authenticity_token","return_to","pre_submit"]);connect(){this.dialog=this.element.closest("dialog"),this.dialog&&(this.snapshot=this.#t(),this.forceClose=!1,this.submitting=!1,this.onCancel=this.#n.bind(this),this.onSubmit=this.#r.bind(this),this.onCloseButtonClick=this.#l.bind(this),this.onConfirmCancel=this.#a.bind(this),this.onKeydown=this.#o.bind(this),document.addEventListener("keydown",this.onKeydown,!0),this.dialog.addEventListener("cancel",this.onCancel,!0),this.element.addEventListener("submit",this.onSubmit),this.#e().forEach(i=>i.addEventListener("click",this.onCloseButtonClick,!0)),this.hasConfirmDialogTarget&&this.confirmDialogTarget.addEventListener("cancel",this.onConfirmCancel))}disconnect(){this.dialog&&(document.removeEventListener("keydown",this.onKeydown,!0),this.dialog.removeEventListener("cancel",this.onCancel,!0),this.element.removeEventListener("submit",this.onSubmit),this.#e().forEach(i=>i.removeEventListener("click",this.onCloseButtonClick,!0)),this.hasConfirmDialogTarget&&this.confirmDialogTarget.removeEventListener("cancel",this.onConfirmCancel))}discard(){this.forceClose=!0,this.#c(),this.dialog.dispatchEvent(new CustomEvent("modal:request-close"))}keepEditing(){this.#h()}#e(){return this.dialog?this.dialog.querySelectorAll('[data-action~="remote-modal#close"]'):[]}#t(){let i=new FormData(this.element),e=encodeURIComponent;return[...i.entries()].filter(([t])=>!this.constructor.IGNORED_KEYS.has(t)).map(([t,r])=>{let s=r instanceof File?r.name:r;return`${e(t)}=${e(s)}`}).sort().join("&")}#i(){return this.#t()!==this.snapshot}#r(){this.submitting=!0}#s(){return this.hasConfirmDialogTarget&&this.confirmDialogTarget.open}#o(i){if(i.key==="Escape"&&this.dialog.open){if(this.#s()){i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();return}this.forceClose||this.submitting||this.#i()&&(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),this.#d())}}#n(i){i.target===this.dialog&&(this.forceClose||this.submitting||this.#i()&&(i.preventDefault(),this.#d()))}#l(i){this.forceClose||this.submitting||this.#i()&&(i.preventDefault(),i.stopPropagation(),this.#d())}#a(i){i.preventDefault()}#d(){if(this.hasConfirmDialogTarget){let i=this.confirmDialogTarget;i.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>i.setAttribute("data-open",""))})}else window.confirm("Discard your changes?")&&(this.forceClose=!0,this.dialog.dispatchEvent(new CustomEvent("modal:request-close")))}#c(){if(!this.hasConfirmDialogTarget)return;let i=this.confirmDialogTarget;i.removeAttribute("data-open"),i.open&&i.close()}async#h(){if(!this.hasConfirmDialogTarget)return;let i=this.confirmDialogTarget;if(!i.open)return;i.removeAttribute("data-open");let e=i.getAnimations({subtree:!0});await Promise.allSettled(e.map(t=>t.finished)),i.close()}};function yh(i){i.register("password-visibility",Da),i.register("sidebar",Ia),i.register("resource-header",po),i.register("nested-resource-form-fields",fo),i.register("form",mo),i.register("resource-drop-down",Eo),i.register("resource-collapse",To),i.register("resource-dismiss",xo),i.register("frame-navigator",ko),i.register("color-mode",Ao),i.register("easymde",Mo),i.register("slim-select",Io),i.register("flatpickr",Do),i.register("intl-tel-input",No),i.register("select-navigator",Bo),i.register("resource-tab-list",Uo),i.register("attachment-input",Ra),i.register("attachment-preview",La),i.register("attachment-preview-container",Ma),i.register("remote-modal",Na),i.register("key-value-store",Ba),i.register("bulk-actions",Ua),i.register("filter-panel",za),i.register("textarea-autogrow",Ha),i.register("clipboard",ja),i.register("icon-rail",qa),i.register("icon-rail-flyout",$a),i.register("table-header",Va),i.register("table-column-menu",Wa),i.register("capture-url",Ga),i.register("row-click",Ka),i.register("view-switcher",Xa),i.register("autosubmit",Ya),i.register("dirty-form-guard",Za)}Turbo.StreamActions.redirect=function(){Turbo.cache.clear();let i=this.getAttribute("url");Turbo.visit(i)};Turbo.StreamActions.close_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);if(!e)return;let t=e.querySelector("dialog");t&&typeof t.close=="function"&&t.close(),e.innerHTML="",e.removeAttribute("src")};Turbo.StreamActions.reload_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);!e||typeof e.reload!="function"||e.reload()};var it,Mn,Xi,_r;function VE(){if(it){it.isConnected||document.body.appendChild(it);return}it=document.createElement("dialog"),it.className=["pu-dialog","top-1/2","-translate-y-1/2","left-1/2","-translate-x-1/2","w-full","max-w-md","p-0","open:flex","flex-col","opacity-0","scale-95","data-[open]:opacity-100","data-[open]:scale-100","transition-[opacity,transform]","duration-200","ease-out"].join(" "),it.setAttribute("aria-labelledby","pu-turbo-confirm-message");let i=document.createElement("div");i.className="px-6 pt-5 pb-4 border-b border-[var(--pu-border)]",Mn=document.createElement("h2"),Mn.id="pu-turbo-confirm-message",Mn.className="text-lg font-semibold text-[var(--pu-text)]",i.appendChild(Mn);let e=document.createElement("div");e.className="flex items-center justify-end gap-2 px-6 py-4",_r=document.createElement("button"),_r.type="button",_r.className="pu-btn pu-btn-md pu-btn-outline",_r.textContent="Cancel",Xi=document.createElement("button"),Xi.type="button",Xi.className="pu-btn pu-btn-md pu-btn-primary",Xi.textContent="Confirm",e.appendChild(_r),e.appendChild(Xi),it.appendChild(i),it.appendChild(e),document.body.appendChild(it)}async function WE(){it.removeAttribute("data-open");let i=it.getAnimations({subtree:!0});await Promise.allSettled(i.map(e=>e.finished)),it.open&&it.close()}function Xg(i){return VE(),Mn.textContent=i||"Are you sure?",new Promise(e=>{let t=!1,r=l=>{t||(t=!0,a(),e(l),WE())},s=()=>r(!0),n=()=>r(!1),o=()=>r(!1),a=()=>{Xi.removeEventListener("click",s),_r.removeEventListener("click",n),it.removeEventListener("close",o)};Xi.addEventListener("click",s),_r.addEventListener("click",n),it.addEventListener("close",o),it.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>it.setAttribute("data-open",""))}),Xi.focus()})}typeof window<"u"&&window.Turbo&&(window.Turbo.config?.forms?window.Turbo.config.forms.confirm=Xg:window.Turbo.setConfirmMethod&&window.Turbo.setConfirmMethod(Xg));var GE=uo.start();yh(GE);})();
165
165
  /*!
166
166
  * Sanitize an HTML node
167
167
  */