/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../chunks/_rollupPluginBabelHelpers","../request","../core/Error","../core/maybe","./messages"],(function(e,n,t,r,o,i){"use strict";function s(e,n,t,r){return l.apply(this,arguments)}function l(){return(l=n._asyncToGenerator((function*(e,n,t,o){const s=n.exec(t);if(!s)throw new r("esri-intl:invalid-bundle",`Bundle id "${t}" is not compatible with the pattern "${n}"`);const l=s[1]?`${s[1]}/`:"",u=s[2],c=i.normalizeMessageBundleLocale(o),d=`${l}${u}.json`,h=c?`${l}${u}_${c}.json`:d;let f;try{f=yield a(e(h))}catch(p){if(h===d)throw new r("intl:unknown-bundle",`Bundle "${t}" cannot be loaded`,{error:p});try{f=yield a(e(d))}catch(p){throw new r("intl:unknown-bundle",`Bundle "${t}" cannot be loaded`,{error:p})}}return f}))).apply(this,arguments)}function a(e){return u.apply(this,arguments)}function u(){return(u=n._asyncToGenerator((function*(e){if(o.isSome(h.fetchBundleAsset))return h.fetchBundleAsset(e);const n=yield t(e,{responseType:"text"});return JSON.parse(n.data)}))).apply(this,arguments)}let c=function(){function e({base:e="",pattern:n,location:t=new URL(window.location.href)}){let r;r="string"==typeof t?e=>new URL(e,new URL(t,window.location.href)).href:t instanceof URL?e=>new URL(e,t).href:t,this.pattern="string"==typeof n?new RegExp(`^${n}`):n,this.getAssetUrl=r,e=e?e.endsWith("/")?e:e+"/":"",this.matcher=new RegExp(`^${e}(?:(.*)/)?(.*)$`)}return e.prototype.fetchMessageBundle=function(e,n){return s(this.getAssetUrl,this.matcher,e,n)},e}();function d(e){return new c(e)}const h={};e.JSONLoader=c,e.createJSONLoader=d,e.test=h,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
