plutonium 0.18.5 → 0.18.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/plutonium.js +1 -1
- data/app/assets/plutonium.js.map +2 -2
- data/app/assets/plutonium.min.js +1 -1
- data/app/assets/plutonium.min.js.map +2 -2
- data/app/views/resource/interactive_bulk_action.html.erb +1 -1
- data/app/views/resource/interactive_resource_action.html.erb +1 -1
- data/lib/generators/pu/eject/layout/layout_generator.rb +1 -2
- data/lib/generators/pu/eject/shell/shell_generator.rb +1 -3
- data/lib/generators/pu/lib/plutonium_generators/concerns/logger.rb +4 -0
- data/lib/generators/pu/lib/plutonium_generators/concerns/package_selector.rb +80 -0
- data/lib/generators/pu/lib/plutonium_generators/concerns/resource_selector.rb +48 -0
- data/lib/generators/pu/lib/plutonium_generators/generator.rb +2 -42
- data/lib/generators/pu/lib/plutonium_generators/model_generator_base.rb +1 -4
- data/lib/generators/pu/res/conn/conn_generator.rb +9 -21
- data/lib/generators/pu/res/scaffold/scaffold_generator.rb +10 -5
- data/lib/plutonium/resource/controller.rb +3 -3
- data/lib/plutonium/resource/controllers/authorizable.rb +1 -1
- data/lib/plutonium/resource/controllers/crud_actions.rb +17 -17
- data/lib/plutonium/resource/controllers/interactive_actions.rb +3 -3
- data/lib/plutonium/resource/controllers/presentable.rb +2 -2
- data/lib/plutonium/resource/record/associated_with.rb +83 -0
- data/lib/plutonium/resource/record/associations.rb +92 -0
- data/lib/plutonium/resource/record/field_names.rb +83 -0
- data/lib/plutonium/resource/record/labeling.rb +19 -0
- data/lib/plutonium/resource/record/routes.rb +66 -0
- data/lib/plutonium/resource/record.rb +6 -258
- data/lib/plutonium/ui/breadcrumbs.rb +4 -4
- data/lib/plutonium/ui/component/methods.rb +4 -12
- data/lib/plutonium/ui/form/base.rb +22 -10
- data/lib/plutonium/ui/form/components/secure_association.rb +112 -0
- data/lib/plutonium/ui/form/components/secure_polymorphic_association.rb +54 -0
- data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +0 -1
- data/lib/plutonium/ui/form/theme.rb +12 -1
- data/lib/plutonium/ui/page/show.rb +1 -1
- data/lib/plutonium/ui/page_header.rb +1 -1
- data/lib/plutonium/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- data/src/js/controllers/slim_select_controller.js +3 -1
- metadata +11 -4
- data/lib/plutonium/ui/form/components/belongs_to.rb +0 -66
- data/lib/plutonium/ui/form/components/has_many.rb +0 -66
data/app/assets/plutonium.min.js
CHANGED
@@ -59,7 +59,7 @@ ${e}</tr>
|
|
59
59
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
|
60
60
|
`}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>${wi(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=Sp(e);if(n===null)return s;e=n;let o='<a href="'+e+'"';return t&&(o+=' title="'+wi(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r}){let s=Sp(e);if(s===null)return wi(r);e=s;let n=`<img src="${e}" alt="${r}"`;return t&&(n+=` title="${wi(t)}"`),n+=">",n}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:wi(e.text)}},Tn=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""}},ai=class i{options;renderer;textRenderer;constructor(e){this.options=e||Lr,this.options.renderer=this.options.renderer||new ks,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Tn}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+=`
|
61
61
|
`+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}},xs=class{options;block;constructor(e){this.options=e||Lr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?oi.lex:oi.lexInline}provideParser(){return this.block?ai.parse:ai.parseInline}},Cc=class{defaults=Fc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ai;Renderer=ks;TextRenderer=Tn;Lexer=oi;Tokenizer=As;Hooks=xs;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 ks(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],c=n[a];n[a]=(...d)=>{let f=l.apply(n,d);return f===!1&&(f=c.apply(n,d)),f||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new As(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],c=n[a];n[a]=(...d)=>{let f=l.apply(n,d);return f===!1&&(f=c.apply(n,d)),f}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new xs;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],c=n[a];xs.passThroughHooks.has(o)?n[a]=d=>{if(this.defaults.async)return Promise.resolve(l.call(n,d)).then(y=>c.call(n,y));let f=l.call(n,d);return c.call(n,f)}:n[a]=(...d)=>{let f=l.apply(n,d);return f===!1&&(f=c.apply(n,d)),f}}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 oi.lex(e,t??this.defaults)}parser(e,t){return ai.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?oi.lex:oi.lexInline,c=o.hooks?o.hooks.provideParser():e?ai.parse:ai.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(d=>l(d,o)).then(d=>o.hooks?o.hooks.processAllTokens(d):d).then(d=>o.walkTokens?Promise.all(this.walkTokens(d,o.walkTokens)).then(()=>d):d).then(d=>c(d,o)).then(d=>o.hooks?o.hooks.postprocess(d):d).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let d=l(r,o);o.hooks&&(d=o.hooks.processAllTokens(d)),o.walkTokens&&this.walkTokens(d,o.walkTokens);let f=c(d,o);return o.hooks&&(f=o.hooks.postprocess(f)),f}catch(d){return a(d)}}}onError(e,t){return r=>{if(r.message+=`
|
62
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+wi(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},Rr=new Cc;function me(i,e){return Rr.parse(i,e)}me.options=me.setOptions=function(i){return Rr.setOptions(i),me.defaults=Rr.defaults,xp(me.defaults),me};me.getDefaults=Fc;me.defaults=Lr;me.use=function(...i){return Rr.use(...i),me.defaults=Rr.defaults,xp(me.defaults),me};me.walkTokens=function(i,e){return Rr.walkTokens(i,e)};me.parseInline=Rr.parseInline;me.Parser=ai;me.parser=ai.parse;me.Renderer=ks;me.TextRenderer=Tn;me.Lexer=oi;me.lexer=oi.lex;me.Tokenizer=As;me.Hooks=xs;me.parse=me;var RP=me.options,LP=me.setOptions,MP=me.use,IP=me.walkTokens,DP=me.parseInline;var NP=ai.parse,BP=oi.lex;var fa=class extends ne{connect(){this.easyMDE=new EasyMDE(this.#e()),this.element.setAttribute("data-action","turbo:morph-element->easymde#reconnect")}disconnect(){this.easyMDE.toTextArea(),this.easyMDE=null}reconnect(){this.disconnect(),this.connect()}#e(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Ts.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=me(t);return Ts.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 ma=class extends ne{connect(){this.slimSelect=new SlimSelect({select:this.element}),this.element.setAttribute("data-action","turbo:morph-element->slim-select#reconnect")}disconnect(){this.slimSelect.destroy(),this.slimSelect=null}reconnect(){this.disconnect(),this.connect()}};var ga=class extends ne{connect(){this.picker=new flatpickr(this.element,this.#e()),this.element.setAttribute("data-action","turbo:morph-element->flatpickr#reconnect")}disconnect(){this.picker.destroy(),this.picker=null}reconnect(){this.disconnect(),this.connect()}#e(){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),i}};var va=class extends ne{static targets=["input"];connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){this.hasInputTarget&&(this.iti=window.intlTelInput(this.inputTarget,this.#e()),this.inputTarget.setAttribute("data-action","turbo:morph-element->intl-tel-input#reconnect"))}inputTargetDisconnected(){this.iti&&this.iti.destroy(),this.iti=null}reconnect(){this.inputTargetDisconnected(),this.inputTargetConnected()}#e(){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 ba=class extends ne{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 ya=class extends ne{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(" "):[],this.#e(this.defaultTabValue||this.btnTargets[0].id)}select(i){this.#e(i.currentTarget.id)}#e(i){let e=this.btnTargets.find(r=>r.id===i);if(!e){console.error(`Tab Button with id "${i}" not found`);return}let t=this.tabTargets.find(r=>r.id===e.dataset.target);if(!t){console.error(`Tab Panel with id "${e.dataset.target}" not found`);return}this.tabTargets.forEach(r=>{r.hidden=!0,r.setAttribute("aria-hidden","true")}),this.btnTargets.forEach(r=>{r.setAttribute("aria-selected","false"),r.setAttribute("tabindex","-1"),r.classList.remove(...this.activeClasses),r.classList.add(...this.inActiveClasses)}),e.setAttribute("aria-selected","true"),e.setAttribute("tabindex","0"),e.classList.remove(...this.inActiveClasses),e.classList.add(...this.activeClasses),t.hidden=!1,t.setAttribute("aria-hidden","false"),e!==document.activeElement&&e.focus()}};function wa(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var S0=0;function Mp(i){return"__private_"+S0+++"_"+i}function E0(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 Lp(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=E0(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var T0=i=>{throw new Error(`missing string: ${i}`)},An=Mp("onMissingKey"),kn=Mp("apply"),Mr=class{constructor(e,t){let{onMissingKey:r=T0}=t===void 0?{}:t;Object.defineProperty(this,kn,{value:x0}),Object.defineProperty(this,An,{writable:!0,value:void 0}),this.locale={strings:{},pluralize(s){return s===1?0:1}},Array.isArray(e)?e.forEach(wa(this,kn)[kn],this):wa(this,kn)[kn](e),wa(this,An)[An]=r}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(wa(this,An)[An](e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return Lp(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 Lp(r,t)}};function x0(i){if(!(i!=null&&i.strings))return;let e=this.locale;Object.assign(this.locale,{strings:{...e.strings,...i.strings},pluralize:i.pluralize||e.pluralize})}var Lf=Ce(Dp(),1);var A0="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Np=(i=21)=>{let e="",t=i|0;for(;t--;)e+=A0[Math.random()*64|0];return e};var Mf=Ce(vf(),1);function Ea(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var bw=0;function bf(i){return"__private_"+bw+++"_"+i}var yw={version:"4.1.2"},Ir=bf("callbacks"),zc=bf("publish"),Ta=class{constructor(){Object.defineProperty(this,zc,{value:ww}),this.state={},Object.defineProperty(this,Ir,{writable:!0,value:new Set})}getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,Ea(this,zc)[zc](t,r,e)}subscribe(e){return Ea(this,Ir)[Ir].add(e),()=>{Ea(this,Ir)[Ir].delete(e)}}};function ww(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];Ea(this,Ir)[Ir].forEach(r=>{r(...e)})}Ta.VERSION=yw.version;var yf=Ta;function Dr(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 Hc={__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",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 Cn(i){var e;if(i.type)return i.type;let t=i.name?(e=Dr(i.name).extension)==null?void 0:e.toLowerCase():null;return t&&t in Hc?Hc[t]:"application/octet-stream"}function Sw(i){return i.charCodeAt(0).toString(32)}function wf(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Sw(t)}`,"/"))+e}function Sf(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${wf(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${wf(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function Ew(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function xa(i,e){if(Ew(i))return i.id;let t=Cn(i);return Sf({...i,type:t},e)}function $c(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}function qc(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}function Vc(i){return i<10?`0${i}`:i.toString()}function Ps(){let i=new Date,e=Vc(i.getHours()),t=Vc(i.getMinutes()),r=Vc(i.getSeconds());return`${e}:${t}:${r}`}var Ef={debug:()=>{},warn:()=>{},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Ps()}]`,...e)}},Tf={debug:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.debug(`[Uppy] [${Ps()}]`,...e)},warn:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.warn(`[Uppy] [${Ps()}]`,...e)},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Ps()}]`,...e)}};var Fn=Ce(Aa(),1),_f=Ce(Ff(),1),Of={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},kt=class extends Error{constructor(e,t){var r;super(e),this.isRestriction=!0,this.isUserFacing=(r=t?.isUserFacing)!=null?r:!0,t!=null&&t.file&&(this.file=t.file)}},ka=class{constructor(e,t){this.getI18n=t,this.getOpts=()=>{var r;let s=e();if(((r=s.restrictions)==null?void 0:r.allowedFileTypes)!=null&&!Array.isArray(s.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return s}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(o=>!o.isGhost).length+t.length>s)throw new kt(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((o,a)=>{var l;return o+((l=a.size)!=null?l:0)},0);if(n>r)throw new kt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,Fn.default)(r),size:(0,Fn.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(a=>a.includes("/")?e.type?(0,_f.default)(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){let a=s.join(", ");throw new kt(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t){var n;throw new kt(this.getI18n()("exceedsSize",{size:(0,Fn.default)(t),file:(n=e.name)!=null?n:this.getI18n()("unnamed")}),{file:e})}if(r&&e.size!=null&&e.size<r)throw new kt(this.getI18n()("inferiorSize",{size:(0,Fn.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 kt(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){var t;let r=new kt(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:(t=e.name)!=null?t:this.getI18n()("unnamed")})),{requiredMetaFields:s}=this.getOpts().restrictions,n=[];for(let o of s)(!Object.hasOwn(e.meta,o)||e.meta[o]==="")&&n.push(o);return{missingFields:n,error:r}}};var Rf={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"}};function W(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Aw=0;function xe(i){return"__private_"+Aw+++"_"+i}var kw={version:"4.3.1"},Pa={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},ot=xe("plugins"),at=xe("restricter"),_n=xe("storeUnsubscribe"),Bi=xe("emitter"),Nr=xe("preProcessors"),Br=xe("uploaders"),Hi=xe("postProcessors"),Rt=xe("informAndEmit"),Dn=xe("checkRequiredMetaFieldsOnFile"),jc=xe("checkRequiredMetaFields"),On=xe("assertNewUploadAllowed"),Kc=xe("transformFile"),Rn=xe("startIfAutoProceed"),Ln=xe("checkAndUpdateFileState"),Xc=xe("handleUploadProgress"),Mn=xe("updateTotalProgress"),$i=xe("updateTotalProgressThrottled"),Yc=xe("calculateTotalProgress"),Wc=xe("addListeners"),li=xe("updateOnlineStatus"),In=xe("requestClientById"),Ui=xe("createUpload"),Gc=xe("getUpload"),Ur=xe("removeUpload"),zi=xe("runUpload"),Ca=class i{constructor(e){Object.defineProperty(this,zi,{value:zw}),Object.defineProperty(this,Ur,{value:Uw}),Object.defineProperty(this,Gc,{value:Bw}),Object.defineProperty(this,Ui,{value:Nw}),Object.defineProperty(this,Wc,{value:Dw}),Object.defineProperty(this,Yc,{value:Iw}),Object.defineProperty(this,Mn,{value:Mw}),Object.defineProperty(this,Ln,{value:Lw}),Object.defineProperty(this,Rn,{value:Rw}),Object.defineProperty(this,Kc,{value:Ow}),Object.defineProperty(this,On,{value:_w}),Object.defineProperty(this,jc,{value:Fw}),Object.defineProperty(this,Dn,{value:Cw}),Object.defineProperty(this,Rt,{value:Pw}),Object.defineProperty(this,ot,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,at,{writable:!0,value:void 0}),Object.defineProperty(this,_n,{writable:!0,value:void 0}),Object.defineProperty(this,Bi,{writable:!0,value:(0,Lf.default)()}),Object.defineProperty(this,Nr,{writable:!0,value:new Set}),Object.defineProperty(this,Br,{writable:!0,value:new Set}),Object.defineProperty(this,Hi,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,Object.defineProperty(this,Xc,{writable:!0,value:(s,n)=>{let o=s?this.getFile(s.id):void 0;if(s==null||!o){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}if(o.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${s.id}`);return}let a={bytesTotal:n.bytesTotal,percentage:n.bytesTotal!=null&&Number.isFinite(n.bytesTotal)&&n.bytesTotal>0?Math.round(n.bytesUploaded/n.bytesTotal*100):void 0};o.progress.uploadStarted!=null?this.setFileState(s.id,{progress:{...o.progress,...a,bytesUploaded:n.bytesUploaded}}):this.setFileState(s.id,{progress:{...o.progress,...a}}),W(this,$i)[$i]()}}),Object.defineProperty(this,$i,{writable:!0,value:(0,Mf.default)(()=>W(this,Mn)[Mn](),500,{leading:!0,trailing:!0})}),Object.defineProperty(this,li,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,In,{writable:!0,value:new Map}),this.defaultLocale=Rf;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Of,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new yf,logger:Ef,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e&&e.restrictions}},e&&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&&e.debug&&(this.opts.logger=Tf),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Pa,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:$c(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),W(this,at)[at]=new ka(()=>this.opts,()=>this.i18n),W(this,_n)[_n]=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),W(this,Wc)[Wc]()}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];W(this,Bi)[Bi].emit(e,...r)}on(e,t){return W(this,Bi)[Bi].on(e,t),this}once(e,t){return W(this,Bi)[Bi].once(e,t),this}off(e,t){return W(this,Bi)[Bi].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=>{let[s,n]=r;return[s,{...t[s],...n}]}))}})}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 Mr([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,...Pa})}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({...Pa,files:{}})}addPreProcessor(e){W(this,Nr)[Nr].add(e)}removePreProcessor(e){return W(this,Nr)[Nr].delete(e)}addPostProcessor(e){W(this,Hi)[Hi].add(e)}removePostProcessor(e){return W(this,Hi)[Hi].delete(e)}addUploader(e){W(this,Br)[Br].add(e)}removeUploader(e){return W(this,Br)[Br].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=[],c=[],d=[],f=[],y=[],v=[];for(let x of s){let{progress:P}=x;!P.uploadComplete&&P.uploadStarted&&(n.push(x),x.isPaused||y.push(x)),P.uploadStarted||o.push(x),(P.uploadStarted||P.preprocess||P.postprocess)&&a.push(x),P.uploadStarted&&l.push(x),x.isPaused&&c.push(x),P.uploadComplete&&d.push(x),x.error&&f.push(x),(P.preprocess||P.postprocess)&&v.push(x)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:c,completeFiles:d,erroredFiles:f,inProgressFiles:n,inProgressNotPausedFiles:y,processingFiles:v,isUploadStarted:l.length>0,isAllComplete:t===100&&d.length===s.length&&v.length===0,isAllErrored:!!r&&f.length===s.length,isAllPaused:n.length!==0&&c.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(x=>x.isGhost)}}validateRestrictions(e,t){t===void 0&&(t=this.getFiles());try{W(this,at)[at].validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{W(this,at)[at].validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{W(this,at)[at].validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}addFile(e){W(this,On)[On](e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=W(this,Ln)[Ln]([e]),n=s.filter(a=>a.isRestriction);if(W(this,Rt)[Rt](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}`),W(this,Rn)[Rn](),o.id}addFiles(e){W(this,On)[On]();let{nextFilesState:t,validFilesToAdd:r,errors:s}=W(this,Ln)[Ln](e),n=s.filter(a=>a.isRestriction);W(this,Rt)[Rt](n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
|
62
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+wi(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},Rr=new Cc;function me(i,e){return Rr.parse(i,e)}me.options=me.setOptions=function(i){return Rr.setOptions(i),me.defaults=Rr.defaults,xp(me.defaults),me};me.getDefaults=Fc;me.defaults=Lr;me.use=function(...i){return Rr.use(...i),me.defaults=Rr.defaults,xp(me.defaults),me};me.walkTokens=function(i,e){return Rr.walkTokens(i,e)};me.parseInline=Rr.parseInline;me.Parser=ai;me.parser=ai.parse;me.Renderer=ks;me.TextRenderer=Tn;me.Lexer=oi;me.lexer=oi.lex;me.Tokenizer=As;me.Hooks=xs;me.parse=me;var RP=me.options,LP=me.setOptions,MP=me.use,IP=me.walkTokens,DP=me.parseInline;var NP=ai.parse,BP=oi.lex;var fa=class extends ne{connect(){this.easyMDE=new EasyMDE(this.#e()),this.element.setAttribute("data-action","turbo:morph-element->easymde#reconnect")}disconnect(){this.easyMDE.toTextArea(),this.easyMDE=null}reconnect(){this.disconnect(),this.connect()}#e(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Ts.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=me(t);return Ts.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 ma=class extends ne{connect(){this.slimSelect=new SlimSelect({select:this.element}),this.element.setAttribute("data-action","turbo:morph-element->slim-select#reconnect")}disconnect(){this.slimSelect.destroy(),this.slimSelect=null}reconnect(){this.disconnect(),setTimeout(()=>this.connect(),10)}};var ga=class extends ne{connect(){this.picker=new flatpickr(this.element,this.#e()),this.element.setAttribute("data-action","turbo:morph-element->flatpickr#reconnect")}disconnect(){this.picker.destroy(),this.picker=null}reconnect(){this.disconnect(),this.connect()}#e(){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),i}};var va=class extends ne{static targets=["input"];connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){this.hasInputTarget&&(this.iti=window.intlTelInput(this.inputTarget,this.#e()),this.inputTarget.setAttribute("data-action","turbo:morph-element->intl-tel-input#reconnect"))}inputTargetDisconnected(){this.iti&&this.iti.destroy(),this.iti=null}reconnect(){this.inputTargetDisconnected(),this.inputTargetConnected()}#e(){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 ba=class extends ne{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 ya=class extends ne{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(" "):[],this.#e(this.defaultTabValue||this.btnTargets[0].id)}select(i){this.#e(i.currentTarget.id)}#e(i){let e=this.btnTargets.find(r=>r.id===i);if(!e){console.error(`Tab Button with id "${i}" not found`);return}let t=this.tabTargets.find(r=>r.id===e.dataset.target);if(!t){console.error(`Tab Panel with id "${e.dataset.target}" not found`);return}this.tabTargets.forEach(r=>{r.hidden=!0,r.setAttribute("aria-hidden","true")}),this.btnTargets.forEach(r=>{r.setAttribute("aria-selected","false"),r.setAttribute("tabindex","-1"),r.classList.remove(...this.activeClasses),r.classList.add(...this.inActiveClasses)}),e.setAttribute("aria-selected","true"),e.setAttribute("tabindex","0"),e.classList.remove(...this.inActiveClasses),e.classList.add(...this.activeClasses),t.hidden=!1,t.setAttribute("aria-hidden","false"),e!==document.activeElement&&e.focus()}};function wa(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var S0=0;function Mp(i){return"__private_"+S0+++"_"+i}function E0(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 Lp(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=E0(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var T0=i=>{throw new Error(`missing string: ${i}`)},An=Mp("onMissingKey"),kn=Mp("apply"),Mr=class{constructor(e,t){let{onMissingKey:r=T0}=t===void 0?{}:t;Object.defineProperty(this,kn,{value:x0}),Object.defineProperty(this,An,{writable:!0,value:void 0}),this.locale={strings:{},pluralize(s){return s===1?0:1}},Array.isArray(e)?e.forEach(wa(this,kn)[kn],this):wa(this,kn)[kn](e),wa(this,An)[An]=r}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(wa(this,An)[An](e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return Lp(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 Lp(r,t)}};function x0(i){if(!(i!=null&&i.strings))return;let e=this.locale;Object.assign(this.locale,{strings:{...e.strings,...i.strings},pluralize:i.pluralize||e.pluralize})}var Lf=Ce(Dp(),1);var A0="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Np=(i=21)=>{let e="",t=i|0;for(;t--;)e+=A0[Math.random()*64|0];return e};var Mf=Ce(vf(),1);function Ea(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var bw=0;function bf(i){return"__private_"+bw+++"_"+i}var yw={version:"4.1.2"},Ir=bf("callbacks"),zc=bf("publish"),Ta=class{constructor(){Object.defineProperty(this,zc,{value:ww}),this.state={},Object.defineProperty(this,Ir,{writable:!0,value:new Set})}getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,Ea(this,zc)[zc](t,r,e)}subscribe(e){return Ea(this,Ir)[Ir].add(e),()=>{Ea(this,Ir)[Ir].delete(e)}}};function ww(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];Ea(this,Ir)[Ir].forEach(r=>{r(...e)})}Ta.VERSION=yw.version;var yf=Ta;function Dr(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 Hc={__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",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 Cn(i){var e;if(i.type)return i.type;let t=i.name?(e=Dr(i.name).extension)==null?void 0:e.toLowerCase():null;return t&&t in Hc?Hc[t]:"application/octet-stream"}function Sw(i){return i.charCodeAt(0).toString(32)}function wf(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Sw(t)}`,"/"))+e}function Sf(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${wf(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${wf(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function Ew(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function xa(i,e){if(Ew(i))return i.id;let t=Cn(i);return Sf({...i,type:t},e)}function $c(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}function qc(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}function Vc(i){return i<10?`0${i}`:i.toString()}function Ps(){let i=new Date,e=Vc(i.getHours()),t=Vc(i.getMinutes()),r=Vc(i.getSeconds());return`${e}:${t}:${r}`}var Ef={debug:()=>{},warn:()=>{},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Ps()}]`,...e)}},Tf={debug:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.debug(`[Uppy] [${Ps()}]`,...e)},warn:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.warn(`[Uppy] [${Ps()}]`,...e)},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Ps()}]`,...e)}};var Fn=Ce(Aa(),1),_f=Ce(Ff(),1),Of={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},kt=class extends Error{constructor(e,t){var r;super(e),this.isRestriction=!0,this.isUserFacing=(r=t?.isUserFacing)!=null?r:!0,t!=null&&t.file&&(this.file=t.file)}},ka=class{constructor(e,t){this.getI18n=t,this.getOpts=()=>{var r;let s=e();if(((r=s.restrictions)==null?void 0:r.allowedFileTypes)!=null&&!Array.isArray(s.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return s}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(o=>!o.isGhost).length+t.length>s)throw new kt(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((o,a)=>{var l;return o+((l=a.size)!=null?l:0)},0);if(n>r)throw new kt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,Fn.default)(r),size:(0,Fn.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(a=>a.includes("/")?e.type?(0,_f.default)(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){let a=s.join(", ");throw new kt(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t){var n;throw new kt(this.getI18n()("exceedsSize",{size:(0,Fn.default)(t),file:(n=e.name)!=null?n:this.getI18n()("unnamed")}),{file:e})}if(r&&e.size!=null&&e.size<r)throw new kt(this.getI18n()("inferiorSize",{size:(0,Fn.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 kt(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){var t;let r=new kt(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:(t=e.name)!=null?t:this.getI18n()("unnamed")})),{requiredMetaFields:s}=this.getOpts().restrictions,n=[];for(let o of s)(!Object.hasOwn(e.meta,o)||e.meta[o]==="")&&n.push(o);return{missingFields:n,error:r}}};var Rf={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"}};function W(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Aw=0;function xe(i){return"__private_"+Aw+++"_"+i}var kw={version:"4.3.1"},Pa={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},ot=xe("plugins"),at=xe("restricter"),_n=xe("storeUnsubscribe"),Bi=xe("emitter"),Nr=xe("preProcessors"),Br=xe("uploaders"),Hi=xe("postProcessors"),Rt=xe("informAndEmit"),Dn=xe("checkRequiredMetaFieldsOnFile"),jc=xe("checkRequiredMetaFields"),On=xe("assertNewUploadAllowed"),Kc=xe("transformFile"),Rn=xe("startIfAutoProceed"),Ln=xe("checkAndUpdateFileState"),Xc=xe("handleUploadProgress"),Mn=xe("updateTotalProgress"),$i=xe("updateTotalProgressThrottled"),Yc=xe("calculateTotalProgress"),Wc=xe("addListeners"),li=xe("updateOnlineStatus"),In=xe("requestClientById"),Ui=xe("createUpload"),Gc=xe("getUpload"),Ur=xe("removeUpload"),zi=xe("runUpload"),Ca=class i{constructor(e){Object.defineProperty(this,zi,{value:zw}),Object.defineProperty(this,Ur,{value:Uw}),Object.defineProperty(this,Gc,{value:Bw}),Object.defineProperty(this,Ui,{value:Nw}),Object.defineProperty(this,Wc,{value:Dw}),Object.defineProperty(this,Yc,{value:Iw}),Object.defineProperty(this,Mn,{value:Mw}),Object.defineProperty(this,Ln,{value:Lw}),Object.defineProperty(this,Rn,{value:Rw}),Object.defineProperty(this,Kc,{value:Ow}),Object.defineProperty(this,On,{value:_w}),Object.defineProperty(this,jc,{value:Fw}),Object.defineProperty(this,Dn,{value:Cw}),Object.defineProperty(this,Rt,{value:Pw}),Object.defineProperty(this,ot,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,at,{writable:!0,value:void 0}),Object.defineProperty(this,_n,{writable:!0,value:void 0}),Object.defineProperty(this,Bi,{writable:!0,value:(0,Lf.default)()}),Object.defineProperty(this,Nr,{writable:!0,value:new Set}),Object.defineProperty(this,Br,{writable:!0,value:new Set}),Object.defineProperty(this,Hi,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,Object.defineProperty(this,Xc,{writable:!0,value:(s,n)=>{let o=s?this.getFile(s.id):void 0;if(s==null||!o){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}if(o.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${s.id}`);return}let a={bytesTotal:n.bytesTotal,percentage:n.bytesTotal!=null&&Number.isFinite(n.bytesTotal)&&n.bytesTotal>0?Math.round(n.bytesUploaded/n.bytesTotal*100):void 0};o.progress.uploadStarted!=null?this.setFileState(s.id,{progress:{...o.progress,...a,bytesUploaded:n.bytesUploaded}}):this.setFileState(s.id,{progress:{...o.progress,...a}}),W(this,$i)[$i]()}}),Object.defineProperty(this,$i,{writable:!0,value:(0,Mf.default)(()=>W(this,Mn)[Mn](),500,{leading:!0,trailing:!0})}),Object.defineProperty(this,li,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,In,{writable:!0,value:new Map}),this.defaultLocale=Rf;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Of,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new yf,logger:Ef,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e&&e.restrictions}},e&&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&&e.debug&&(this.opts.logger=Tf),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Pa,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:$c(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),W(this,at)[at]=new ka(()=>this.opts,()=>this.i18n),W(this,_n)[_n]=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),W(this,Wc)[Wc]()}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];W(this,Bi)[Bi].emit(e,...r)}on(e,t){return W(this,Bi)[Bi].on(e,t),this}once(e,t){return W(this,Bi)[Bi].once(e,t),this}off(e,t){return W(this,Bi)[Bi].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=>{let[s,n]=r;return[s,{...t[s],...n}]}))}})}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 Mr([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,...Pa})}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({...Pa,files:{}})}addPreProcessor(e){W(this,Nr)[Nr].add(e)}removePreProcessor(e){return W(this,Nr)[Nr].delete(e)}addPostProcessor(e){W(this,Hi)[Hi].add(e)}removePostProcessor(e){return W(this,Hi)[Hi].delete(e)}addUploader(e){W(this,Br)[Br].add(e)}removeUploader(e){return W(this,Br)[Br].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=[],c=[],d=[],f=[],y=[],v=[];for(let x of s){let{progress:P}=x;!P.uploadComplete&&P.uploadStarted&&(n.push(x),x.isPaused||y.push(x)),P.uploadStarted||o.push(x),(P.uploadStarted||P.preprocess||P.postprocess)&&a.push(x),P.uploadStarted&&l.push(x),x.isPaused&&c.push(x),P.uploadComplete&&d.push(x),x.error&&f.push(x),(P.preprocess||P.postprocess)&&v.push(x)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:c,completeFiles:d,erroredFiles:f,inProgressFiles:n,inProgressNotPausedFiles:y,processingFiles:v,isUploadStarted:l.length>0,isAllComplete:t===100&&d.length===s.length&&v.length===0,isAllErrored:!!r&&f.length===s.length,isAllPaused:n.length!==0&&c.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(x=>x.isGhost)}}validateRestrictions(e,t){t===void 0&&(t=this.getFiles());try{W(this,at)[at].validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{W(this,at)[at].validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{W(this,at)[at].validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}addFile(e){W(this,On)[On](e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=W(this,Ln)[Ln]([e]),n=s.filter(a=>a.isRestriction);if(W(this,Rt)[Rt](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}`),W(this,Rn)[Rn](),o.id}addFiles(e){W(this,On)[On]();let{nextFilesState:t,validFilesToAdd:r,errors:s}=W(this,Ln)[Ln](e),n=s.filter(a=>a.isRestriction);W(this,Rt)[Rt](n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
|
63
63
|
`;if(o.forEach(l=>{a+=`
|
64
64
|
* ${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}
|
65
65
|
id: ${a.id}
|