import{_t as r,it as a}from"./vendor-all-1-BfXMvJfI.js";function s(r,a){return Object.keys(a).reduce(function(s,t){t.startsWith(r)&&(s[t.substr(r.length)]=a[t]);return s},{})}function t(t,e){var i=document.createElement("a");i.href=e;var n=i.search.slice(1).split("&").reduce(function(r,s){var t=s.split("="),e=t[0],i=t[1];return r[e]=a(i),r},{}),u=[],o=n.ajs_uid,d=n.ajs_event,_=n.ajs_aid,j=r(t.options.useQueryString)?t.options.useQueryString:{},v=j.aid,c=void 0===v?/.+/:v,f=j.uid,y=void 0===f?/.+/:f;if(_){var p=Array.isArray(n.ajs_aid)?n.ajs_aid[0]:n.ajs_aid;c.test(p)&&t.setAnonymousId(p)}if(o){var l=Array.isArray(n.ajs_uid)?n.ajs_uid[0]:n.ajs_uid;if(y.test(l)){var A=s("ajs_trait_",n);u.push(t.identify(l,A))}}if(d){var h=Array.isArray(n.ajs_event)?n.ajs_event[0]:n.ajs_event,m=s("ajs_prop_",n);u.push(t.track(h,m))}return Promise.all(u)}export{t as queryString};