/*! * filepondpluginfilevalidatetype 1.2.4 * licensed under mit, https://opensource.org/licenses/mit/ * please visit https://pqina.nl/filepond/ for details. */ /* eslint-disable */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).filepondpluginfilevalidatetype=t()}(this,function(){"use strict";var e=function(e){var t=e.addfilter,n=e.utils,i=n.type,t=n.isstring,e=n.replaceinstring,l=n.guesstimatemimetype,o=n.getextensionfromfilename,a=n.getfilenamefromurl,r=function(e,t){return e.some(function(e){return/\*$/.test(e)?(n=e,(/^[^\/]+/.exec(t)||[]).pop()===n.slice(0,-2)):e===t;var n})},u=function(e,t,n){if(0===t.length)return!0;var i=function(e){var t="";if(t(e)){var n=a(e),i=o(n);i&&(t=l(i))}else t=e.type;return t}(e);return n?new promise(function(t,e){n(e,i).then(function(e){r(t,e)?t():e()}).catch(e)}):r(t,i)};return t("set_attribute_to_option_map",function(e){return object.assign(e,{accept:"acceptedfiletypes"})}),t("allow_hopper_item",function(e,t){var n=t.query;return!n("get_allow_file_type_validation")||u(e,n("get_accepted_file_types"))}),t("load_file",function(e,t){var n=t.query;return new promise(function(t,i){if(n("get_allow_file_type_validation")){var t=n("get_accepted_file_types"),l=n("get_file_validate_type_detect_type"),o=u(e,t,l),a=function(){var e,t=t.map((e=n("get_file_validate_type_label_expected_types_map"),function(t){return null!==e[t]&&(e[t]||t)})).filter(function(e){return!1!==e});i({status:{main:n("get_label_file_type_not_allowed"),sub:e(n("get_file_validate_type_label_expected_types"),{alltypes:t.join(", "),allbutlasttype:t.slice(0,-1).join(", "),lasttype:t[t.length-1]})}})};if("boolean"==typeof o)return o?t(e):a();o.then(function(){t(e)}).catch(a)}else t(e)})}),{options:{allowfiletypevalidation:[!0,i.boolean],acceptedfiletypes:[[],i.array],labelfiletypenotallowed:["file is of invalid type",i.string],filevalidatetypelabelexpectedtypes:["expects {allbutlasttype} or {lasttype}",i.string],filevalidatetypelabelexpectedtypesmap:[{},i.object],filevalidatetypedetecttype:[null,i.function]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchevent(new customevent("filepond:pluginloaded",{detail:e})),e});