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