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