@apollosproject/canvas-embeds 2.1.2037 → 2.1.2039

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/widget/index.js +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apollosproject/canvas-embeds",
3
3
  "description": "Apollos React embed widgets",
4
- "version": "2.1.2037",
4
+ "version": "2.1.2039",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/widget/index.js CHANGED
@@ -240,7 +240,7 @@ Check the top-level render call using <`+Q0+">.")}return w0}}function d8(h0,w0){
240
240
  <%s {...props} />
241
241
  React keys must be passed directly to JSX without using spread:
242
242
  let props = %s;
243
- <%s key={someKey} {...props} />`,le,me,wt,me),Nt[me+le]=!0}}return h0===l?fa(Ze):xa(Ze),Ze}}function V0(h0,w0,Q0){return v0(h0,w0,Q0,!0)}function T0(h0,w0,Q0){return v0(h0,w0,Q0,!1)}var a1=T0,o1=V0;Qm.Fragment=l,Qm.jsx=a1,Qm.jsxs=o1})(),Qm}var Y70;function PO0(){if(Y70)return Av.exports;Y70=1;var a={};return a.NODE_ENV==="production"?Av.exports=IO0():Av.exports=xO0(),Av.exports}var T=PO0();const Q70=e.createContext(),X70=e.createContext(),FS={initialized:!1,authenticated:!1,identity:null,step:jt.Welcome,token:null,refreshToken:null,type:null,userExists:!1,onSuccess:()=>!1,userProfile:[],sharedProfiles:[],anonymousId:null},LS={update:"update",logout:"logout",reset:"reset"},ua=a=>({type:"update",payload:a}),J70=()=>({type:"logout"});function OO0(a,t){switch(t.type){case LS.update:return{...a,...t.payload};case LS.logout:return window.localStorage.removeItem(Pl),{...FS,initialized:!0};case LS.reset:return FS;default:throw new Error(`Unhandled action type: ${t.type}`)}}function ec0(a={}){const t=uv(),[n,r]=e.useReducer(OO0,FS),{initialized:l,authenticated:i,token:o,refreshToken:s,anonymousId:c}=n;return e.useEffect(()=>{function m(){const h=window.localStorage.getItem(Pl),p=window.localStorage.getItem(gv),f=window.localStorage.getItem(vv);r(ua(h?{initialized:!0,authenticated:!0,token:h,refreshToken:p,anonymousId:f}:{initialized:!0,authenticated:!1}))}l||m()},[l]),e.useEffect(()=>{function m(){if(o&&o!==window.localStorage.getItem(Pl)&&(window.localStorage.setItem(Pl,o),t.refetchQueries({include:"active"}),i||r(ua({authenticated:!0}))),s&&window.localStorage.setItem(gv,s),!c){const h=window.localStorage.getItem(vv);r(ua({anonymousId:h}))}}m()},[o,s,i,c]),e.useEffect(()=>{function m(){const h=window.localStorage.getItem(vv);if(h)r(ua({anonymousId:h}));else{const p=CO0();window.localStorage.setItem(vv,p),r(ua({anonymousId:p}))}}m()},[]),T.jsx(Q70.Provider,{value:n,children:T.jsx(X70.Provider,{value:r,children:a.children})})}function RO0(){const a=e.useContext(Q70);if(a===void 0)throw new Error("useAuthState must be used within a AuthProvider");return a}function $O0(){const a=e.useContext(X70);if(a===void 0)throw new Error("useAuthDispatch must be used within a AuthProvider");return a}function Ol(){const a=[RO0(),$O0()];if(a===void 0)throw new Error("useAuth must be used within a AuthProvider");return a}ec0.propTypes={children:N1.oneOfType([N1.element,N1.node])};var DO0=" daum[ /]| deusu/|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|24x7|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\bperl\\b|\\btime/|\\||^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\W|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^azure|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|agent\\b|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node\\b|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",jO0=/bot|crawl|http|lighthouse|scan|search|spider/i,Xm;function BO0(){if(Xm instanceof RegExp)return Xm;try{Xm=new RegExp(DO0,"i")}catch{Xm=jO0}return Xm}function tc0(a){return!!a&&BO0().test(a)}function bS(a,t,n){t.split&&(t=t.split("."));for(var r=0,l=t.length,i=a,o,s;r<l&&(s=""+t[r++],!(s==="__proto__"||s==="constructor"||s==="prototype"));)i=i[s]=r===l?n:typeof(o=i[s])==typeof t?o:t[r]*0!==0||~(""+t[r]).indexOf(".")?{}:[]}var zO0=function(a,t){return Object.keys(a).filter(function(n){return t(n,a[n])}).reduce(function(n,r){return n[r]=a[r],n},{})},yr=(function(a){kt(t,a);function t(n,r){var l=a.call(this,"".concat(n," ").concat(r))||this;return l.field=n,l}return t})(Error);function Rl(a){return typeof a=="string"}function _S(a){return typeof a=="number"}function X7(a){return typeof a=="function"}function ac0(a){return a!=null}function $6(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()==="object"}var Zv="is not a string",NS="is not an object",nc0="is nil";function UO0(a){var t=".userId/anonymousId/previousId/groupId",n=function(l){var i,o,s;return(s=(o=(i=l.userId)!==null&&i!==void 0?i:l.anonymousId)!==null&&o!==void 0?o:l.groupId)!==null&&s!==void 0?s:l.previousId},r=n(a);if(ac0(r)){if(!Rl(r))throw new yr(t,Zv)}else throw new yr(t,nc0)}function qO0(a){if(!ac0(a))throw new yr("Event",nc0);if(typeof a!="object")throw new yr("Event",NS)}function GO0(a){if(!Rl(a.type))throw new yr(".type",Zv)}function WO0(a){if(!Rl(a.event))throw new yr(".event",Zv)}function KO0(a){if(!$6(a.properties))throw new yr(".properties",NS)}function YO0(a){if(!$6(a.traits))throw new yr(".traits",NS)}function QO0(a){if(!Rl(a.messageId))throw new yr(".messageId",Zv)}function XO0(a){qO0(a),GO0(a),QO0(a),a.type==="track"&&(WO0(a),KO0(a)),["group","identify"].includes(a.type)&&YO0(a)}var JO0=(function(){function a(t){var n,r;this.settings=t,this.createMessageId=t.createMessageId,this.onEventMethodCall=(n=t.onEventMethodCall)!==null&&n!==void 0?n:(function(){}),this.onFinishedEvent=(r=t.onFinishedEvent)!==null&&r!==void 0?r:(function(){})}return a})(),rc0=(function(){function a(t){this.settings=new JO0(t)}return a.prototype.track=function(t,n,r,l){return this.settings.onEventMethodCall({type:"track",options:r}),this.normalize(u0(u0({},this.baseEvent()),{event:t,type:"track",properties:n??{},options:u0({},r),integrations:u0({},l)}))},a.prototype.page=function(t,n,r,l,i){var o;this.settings.onEventMethodCall({type:"page",options:l});var s={type:"page",properties:u0({},r),options:u0({},l),integrations:u0({},i)};return t!==null&&(s.category=t,s.properties=(o=s.properties)!==null&&o!==void 0?o:{},s.properties.category=t),n!==null&&(s.name=n),this.normalize(u0(u0({},this.baseEvent()),s))},a.prototype.screen=function(t,n,r,l,i){this.settings.onEventMethodCall({type:"screen",options:l});var o={type:"screen",properties:u0({},r),options:u0({},l),integrations:u0({},i)};return t!==null&&(o.category=t),n!==null&&(o.name=n),this.normalize(u0(u0({},this.baseEvent()),o))},a.prototype.identify=function(t,n,r,l){return this.settings.onEventMethodCall({type:"identify",options:r}),this.normalize(u0(u0({},this.baseEvent()),{type:"identify",userId:t,traits:n??{},options:u0({},r),integrations:l}))},a.prototype.group=function(t,n,r,l){return this.settings.onEventMethodCall({type:"group",options:r}),this.normalize(u0(u0({},this.baseEvent()),{type:"group",traits:n??{},options:u0({},r),integrations:u0({},l),groupId:t}))},a.prototype.alias=function(t,n,r,l){this.settings.onEventMethodCall({type:"alias",options:r});var i={userId:t,type:"alias",options:u0({},r),integrations:u0({},l)};return n!==null&&(i.previousId=n),t===void 0?this.normalize(u0(u0({},i),this.baseEvent())):this.normalize(u0(u0({},this.baseEvent()),i))},a.prototype.baseEvent=function(){return{integrations:{},options:{}}},a.prototype.context=function(t){var n,r=["userId","anonymousId","timestamp","messageId"];delete t.integrations;var l=Object.keys(t),i=(n=t.context)!==null&&n!==void 0?n:{},o={};return l.forEach(function(s){s!=="context"&&(r.includes(s)?bS(o,s,t[s]):bS(i,s,t[s]))}),[i,o]},a.prototype.normalize=function(t){var n,r,l=Object.keys((n=t.integrations)!==null&&n!==void 0?n:{}).reduce(function(f,v){var Z,E;return u0(u0({},f),(Z={},Z[v]=!!(!((E=t.integrations)===null||E===void 0)&&E[v]),Z))},{});t.options=zO0(t.options||{},function(f,v){return v!==void 0});var i=u0(u0({},l),(r=t.options)===null||r===void 0?void 0:r.integrations),o=t.options?this.context(t.options):[],s=o[0],c=o[1],m=t.options,h=R6(t,["options"]),p=u0(u0(u0(u0({timestamp:new Date},h),{context:s,integrations:i}),c),{messageId:m.messageId||this.settings.createMessageId()});return this.settings.onFinishedEvent(p),XO0(p),p},a})();function Hv(a,t){return new Promise(function(n,r){var l=setTimeout(function(){r(Error("Promise timed out"))},t);a.then(function(i){return clearTimeout(l),n(i)}).catch(r)})}function lc0(a){return new Promise(function(t){return setTimeout(t,a)})}function eR0(a,t,n){var r=function(){try{return Promise.resolve(t(a))}catch(l){return Promise.reject(l)}};return lc0(n).then(function(){return Hv(r(),1e3)}).catch(function(l){a?.log("warn","Callback Error",{error:l}),a?.stats.increment("callback_error")}).then(function(){return a})}var Ev=function(){var a,t,n=!1,r=new Promise(function(l,i){a=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];n=!0,l.apply(void 0,o)},t=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];n=!0,i.apply(void 0,o)}});return{resolve:a,reject:t,promise:r,isSettled:function(){return n}}},J7=(function(){function a(t){var n;this.callbacks={},this.warned=!1,this.maxListeners=(n=t?.maxListeners)!==null&&n!==void 0?n:10}return a.prototype.warnIfPossibleMemoryLeak=function(t){this.warned||this.maxListeners&&this.callbacks[t].length>this.maxListeners&&(console.warn("Event Emitter: Possible memory leak detected; ".concat(String(t)," has exceeded ").concat(this.maxListeners," listeners.")),this.warned=!0)},a.prototype.on=function(t,n){return this.callbacks[t]?(this.callbacks[t].push(n),this.warnIfPossibleMemoryLeak(t)):this.callbacks[t]=[n],this},a.prototype.once=function(t,n){var r=this,l=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];r.off(t,l),n.apply(r,i)};return this.on(t,l),this},a.prototype.off=function(t,n){var r,l=(r=this.callbacks[t])!==null&&r!==void 0?r:[],i=l.filter(function(o){return o!==n});return this.callbacks[t]=i,this},a.prototype.emit=function(t){for(var n=this,r,l=[],i=1;i<arguments.length;i++)l[i-1]=arguments[i];var o=(r=this.callbacks[t])!==null&&r!==void 0?r:[];return o.forEach(function(s){s.apply(n,l)}),this},a})();function wS(a){var t=Math.random()+1,n=a.minTimeout,r=n===void 0?500:n,l=a.factor,i=l===void 0?2:l,o=a.attempt,s=a.maxTimeout,c=s===void 0?1/0:s;return Math.min(t*r*Math.pow(i,o),c)}for(var ic0="onRemoveFromFuture",Jm=(function(a){kt(t,a);function t(n,r,l){var i=a.call(this)||this;return i.future=[],i.maxAttempts=n,i.queue=r,i.seen=l??{},i}return t.prototype.push=function(){for(var n=this,r=[],l=0;l<arguments.length;l++)r[l]=arguments[l];var i=r.map(function(o){var s=n.updateAttempts(o);return s>n.maxAttempts||n.includes(o)?!1:(n.queue.push(o),!0)});return this.queue=this.queue.sort(function(o,s){return n.getAttempts(o)-n.getAttempts(s)}),i},t.prototype.pushWithBackoff=function(n,r){var l=this;if(r===void 0&&(r=0),r==0&&this.getAttempts(n)===0)return this.push(n)[0];var i=this.updateAttempts(n);if(i>this.maxAttempts||this.includes(n))return!1;var o=wS({attempt:i-1});return r>0&&o<r&&(o=r),setTimeout(function(){l.queue.push(n),l.future=l.future.filter(function(s){return s.id!==n.id}),l.emit(ic0)},o),this.future.push(n),!0},t.prototype.getAttempts=function(n){var r;return(r=this.seen[n.id])!==null&&r!==void 0?r:0},t.prototype.updateAttempts=function(n){return this.seen[n.id]=this.getAttempts(n)+1,this.getAttempts(n)},t.prototype.includes=function(n){return this.queue.includes(n)||this.future.includes(n)||!!this.queue.find(function(r){return r.id===n.id})||!!this.future.find(function(r){return r.id===n.id})},t.prototype.pop=function(){return this.queue.shift()},Object.defineProperty(t.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"todo",{get:function(){return this.queue.length+this.future.length},enumerable:!1,configurable:!0}),t})(J7),Jo=256,Mv=[],yv;Jo--;)Mv[Jo]=(Jo+256).toString(16).substring(1);function ec(){var a=0,t,n="";if(!yv||Jo+16>256){for(yv=Array(a=256);a--;)yv[a]=256*Math.random()|0;a=Jo=0}for(;a<16;a++)t=yv[Jo+a],a==6?n+=Mv[t&15|64]:a==8?n+=Mv[t&63|128]:n+=Mv[t],a&1&&a>1&&a<11&&(n+="-");return Jo++,n}var tR0=(function(){function a(){this._logs=[]}return a.prototype.log=function(t,n,r){var l=new Date;this._logs.push({level:t,message:n,time:l,extras:r})},Object.defineProperty(a.prototype,"logs",{get:function(){return this._logs},enumerable:!1,configurable:!0}),a.prototype.flush=function(){if(this.logs.length>1){var t=this._logs.reduce(function(n,r){var l,i,o,s=u0(u0({},r),{json:JSON.stringify(r.extras,null," "),extras:r.extras});delete s.time;var c=(o=(i=r.time)===null||i===void 0?void 0:i.toISOString())!==null&&o!==void 0?o:"";return n[c]&&(c="".concat(c,"-").concat(Math.random())),u0(u0({},n),(l={},l[c]=s,l))},{});console.table?console.table(t):console.log(t)}else this.logs.forEach(function(n){var r=n.level,l=n.message,i=n.extras;r==="info"||r==="debug"?console.log(l,i??""):console[r](l,i??"")});this._logs=[]},a})(),aR0=function(a){var t={gauge:"g",counter:"c"};return t[a]},oc0=(function(){function a(){this.metrics=[]}return a.prototype.increment=function(t,n,r){n===void 0&&(n=1),this.metrics.push({metric:t,value:n,tags:r??[],type:"counter",timestamp:Date.now()})},a.prototype.gauge=function(t,n,r){this.metrics.push({metric:t,value:n,tags:r??[],type:"gauge",timestamp:Date.now()})},a.prototype.flush=function(){var t=this.metrics.map(function(n){return u0(u0({},n),{tags:n.tags.join(",")})});console.table?console.table(t):console.log(t),this.metrics=[]},a.prototype.serialize=function(){return this.metrics.map(function(t){return{m:t.metric,v:t.value,t:t.tags,k:aR0(t.type),e:t.timestamp}})},a})(),nR0=(function(a){kt(t,a);function t(){return a!==null&&a.apply(this,arguments)||this}return t.prototype.gauge=function(){},t.prototype.increment=function(){},t.prototype.flush=function(){},t.prototype.serialize=function(){return[]},t})(oc0),o3=(function(){function a(t){var n,r,l;this.retry=(n=t.retry)!==null&&n!==void 0?n:!0,this.type=(r=t.type)!==null&&r!==void 0?r:"plugin Error",this.reason=(l=t.reason)!==null&&l!==void 0?l:""}return a})(),eu=(function(){function a(t,n,r,l){n===void 0&&(n=ec()),r===void 0&&(r=new nR0),l===void 0&&(l=new tR0),this.attempts=0,this.event=t,this._id=n,this.logger=l,this.stats=r}return a.system=function(){},a.prototype.isSame=function(t){return t.id===this.id},a.prototype.cancel=function(t){throw t||new o3({reason:"Context Cancel"})},a.prototype.log=function(t,n,r){this.logger.log(t,n,r)},Object.defineProperty(a.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),a.prototype.updateEvent=function(t,n){var r;if(t.split(".")[0]==="integrations"){var l=t.split(".")[1];if(((r=this.event.integrations)===null||r===void 0?void 0:r[l])===!1)return this.event}return bS(this.event,t,n),this.event},a.prototype.failedDelivery=function(){return this._failedDelivery},a.prototype.setFailedDelivery=function(t){this._failedDelivery=t},a.prototype.logs=function(){return this.logger.logs},a.prototype.flush=function(){this.logger.flush(),this.stats.flush()},a.prototype.toJSON=function(){return{id:this._id,event:this.event,logs:this.logger.logs,metrics:this.stats.metrics}},a})();function rR0(a,t){var n={};return a.forEach(function(r){var l,i=void 0;{var o=r[t];i=typeof o!="string"?JSON.stringify(o):o}i!==void 0&&(n[i]=Qe(Qe([],(l=n[i])!==null&&l!==void 0?l:[],!0),[r],!1))}),n}var lR0=function(a){return typeof a=="object"&&a!==null&&"then"in a&&typeof a.then=="function"},iR0=function(){var a,t,n=0;return{done:function(){return a},run:function(r){var l=r();return lR0(l)&&(++n===1&&(a=new Promise(function(i){return t=i})),l.finally(function(){return--n===0&&t()})),l}}};function oR0(a){return b1(this,void 0,void 0,function(){var t;return _1(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,a()];case 1:return[2,n.sent()];case 2:return t=n.sent(),[2,Promise.reject(t)];case 3:return[2]}})})}function tc(a,t){a.log("debug","plugin",{plugin:t.name});var n=new Date().getTime(),r=t[a.event.type];if(r===void 0)return Promise.resolve(a);var l=oR0(function(){return r.apply(t,[a])}).then(function(i){var o=new Date().getTime()-n;return i.stats.gauge("plugin_time",o,["plugin:".concat(t.name)]),i}).catch(function(i){if(i instanceof o3&&i.type==="middleware_cancellation")throw i;return i instanceof o3?(a.log("warn",i.type,{plugin:t.name,error:i}),i):(a.log("error","plugin Error",{plugin:t.name,error:i}),a.stats.increment("plugin_error",1,["plugin:".concat(t.name)]),i)});return l}function sR0(a,t){return tc(a,t).then(function(n){if(n instanceof eu)return n;a.log("debug","Context canceled"),a.stats.increment("context_canceled"),a.cancel(n)})}var sc0=(function(a){kt(t,a);function t(n){var r=a.call(this)||this;return r.criticalTasks=iR0(),r.plugins=[],r.failedInitializations=[],r.flushing=!1,r.queue=n,r.queue.on(ic0,function(){r.scheduleFlush(0)}),r}return t.prototype.register=function(n,r,l){return b1(this,void 0,void 0,function(){var i,o,s=this;return _1(this,function(c){switch(c.label){case 0:return this.plugins.push(r),i=function(m){s.failedInitializations.push(r.name),s.emit("initialization_failure",r),console.warn(r.name,m),n.log("warn","Failed to load destination",{plugin:r.name,error:m}),s.plugins=s.plugins.filter(function(h){return h!==r})},r.type==="destination"&&r.name!=="Segment.io"?(r.load(n,l).catch(i),[3,4]):[3,1];case 1:return c.trys.push([1,3,,4]),[4,r.load(n,l)];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),i(o),[3,4];case 4:return[2]}})})},t.prototype.deregister=function(n,r,l){return b1(this,void 0,void 0,function(){var i;return _1(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),r.unload?[4,Promise.resolve(r.unload(n,l))]:[3,2];case 1:o.sent(),o.label=2;case 2:return this.plugins=this.plugins.filter(function(s){return s.name!==r.name}),[3,4];case 3:return i=o.sent(),n.log("warn","Failed to unload destination",{plugin:r.name,error:i}),[3,4];case 4:return[2]}})})},t.prototype.dispatch=function(n){return b1(this,void 0,void 0,function(){var r;return _1(this,function(l){return n.log("debug","Dispatching"),n.stats.increment("message_dispatched"),this.queue.push(n),r=this.subscribeToDelivery(n),this.scheduleFlush(0),[2,r]})})},t.prototype.subscribeToDelivery=function(n){return b1(this,void 0,void 0,function(){var r=this;return _1(this,function(l){return[2,new Promise(function(i){var o=function(s,c){s.isSame(n)&&(r.off("flush",o),i(s))};r.on("flush",o)})]})})},t.prototype.dispatchSingle=function(n){return b1(this,void 0,void 0,function(){var r=this;return _1(this,function(l){return n.log("debug","Dispatching"),n.stats.increment("message_dispatched"),this.queue.updateAttempts(n),n.attempts=1,[2,this.deliver(n).catch(function(i){var o=r.enqueuRetry(i,n);return o?r.subscribeToDelivery(n):(n.setFailedDelivery({reason:i}),n)})]})})},t.prototype.isEmpty=function(){return this.queue.length===0},t.prototype.scheduleFlush=function(n){var r=this;n===void 0&&(n=500),!this.flushing&&(this.flushing=!0,setTimeout(function(){r.flush().then(function(){setTimeout(function(){r.flushing=!1,r.queue.length&&r.scheduleFlush(0)},0)})},n))},t.prototype.deliver=function(n){return b1(this,void 0,void 0,function(){var r,l,i,o;return _1(this,function(s){switch(s.label){case 0:return[4,this.criticalTasks.done()];case 1:s.sent(),r=Date.now(),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.flushOne(n)];case 3:return n=s.sent(),l=Date.now()-r,this.emit("delivery_success",n),n.stats.gauge("delivered",l),n.log("debug","Delivered",n.event),[2,n];case 4:throw i=s.sent(),o=i,n.log("error","Failed to deliver",o),this.emit("delivery_failure",n,o),n.stats.increment("delivery_failed"),i;case 5:return[2]}})})},t.prototype.enqueuRetry=function(n,r){var l=!(n instanceof o3)||n.retry;return l?this.queue.pushWithBackoff(r):!1},t.prototype.flush=function(){return b1(this,void 0,void 0,function(){var n,r,l;return _1(this,function(i){switch(i.label){case 0:if(this.queue.length===0)return[2,[]];if(n=this.queue.pop(),!n)return[2,[]];n.attempts=this.queue.getAttempts(n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.deliver(n)];case 2:return n=i.sent(),this.emit("flush",n,!0),[3,4];case 3:return r=i.sent(),l=this.enqueuRetry(r,n),l||(n.setFailedDelivery({reason:r}),this.emit("flush",n,!1)),[2,[]];case 4:return[2,[n]]}})})},t.prototype.isReady=function(){return!0},t.prototype.availableExtensions=function(n){var r=this.plugins.filter(function(v){var Z,E,M;if(v.type!=="destination"&&v.name!=="Segment.io")return!0;var V=void 0;return(Z=v.alternativeNames)===null||Z===void 0||Z.forEach(function(L){n[L]!==void 0&&(V=n[L])}),(M=(E=n[v.name])!==null&&E!==void 0?E:V)!==null&&M!==void 0?M:(v.name==="Segment.io"?!0:n.All)!==!1}),l=rR0(r,"type"),i=l.before,o=i===void 0?[]:i,s=l.enrichment,c=s===void 0?[]:s,m=l.destination,h=m===void 0?[]:m,p=l.after,f=p===void 0?[]:p;return{before:o,enrichment:c,destinations:h,after:f}},t.prototype.flushOne=function(n){var r,l;return b1(this,void 0,void 0,function(){var i,o,s,c,m,h,Z,p,f,v,Z,E,M,V,L;return _1(this,function(b){switch(b.label){case 0:if(!this.isReady())throw new Error("Not ready");n.attempts>1&&this.emit("delivery_retry",n),i=this.availableExtensions((r=n.event.integrations)!==null&&r!==void 0?r:{}),o=i.before,s=i.enrichment,c=0,m=o,b.label=1;case 1:return c<m.length?(h=m[c],[4,sR0(n,h)]):[3,4];case 2:Z=b.sent(),Z instanceof eu&&(n=Z),this.emit("message_enriched",n,h),b.label=3;case 3:return c++,[3,1];case 4:p=0,f=s,b.label=5;case 5:return p<f.length?(v=f[p],[4,tc(n,v)]):[3,8];case 6:Z=b.sent(),Z instanceof eu&&(n=Z),this.emit("message_enriched",n,v),b.label=7;case 7:return p++,[3,5];case 8:return E=this.availableExtensions((l=n.event.integrations)!==null&&l!==void 0?l:{}),M=E.destinations,V=E.after,[4,new Promise(function(N,F){setTimeout(function(){var w=M.map(function(x){return tc(n,x)});Promise.all(w).then(N).catch(F)},0)})];case 9:return b.sent(),n.stats.increment("message_delivered"),this.emit("message_delivered",n),L=V.map(function(N){return tc(n,N)}),[4,Promise.all(L)];case 10:return b.sent(),[2,n]}})})},t})(J7),cR0=function(a,t){var n=Date.now()-a;return Math.max((t??300)-n,0)};function cc0(a,t,n,r){return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return n.emit("dispatch_start",a),l=Date.now(),t.isEmpty()?[4,t.dispatchSingle(a)]:[3,2];case 1:return i=o.sent(),[3,4];case 2:return[4,t.dispatch(a)];case 3:i=o.sent(),o.label=4;case 4:return r?.callback?[4,eR0(i,r.callback,cR0(l,r.timeout))]:[3,6];case 5:i=o.sent(),o.label=6;case 6:return r?.debug&&i.flush(),[2,i]}})})}function dR0(a){for(var t=a.constructor.prototype,n=0,r=Object.getOwnPropertyNames(t);n<r.length;n++){var l=r[n];if(l!=="constructor"){var i=Object.getOwnPropertyDescriptor(a.constructor.prototype,l);i&&typeof i.value=="function"&&(a[l]=a[l].bind(a))}}return a}function mR0(a,t,n,r){var l,i=[a,t,n,r],o=$6(a)?a.event:a;if(!o||!Rl(o))throw new Error("Event missing");var s=$6(a)?(l=a.properties)!==null&&l!==void 0?l:{}:$6(t)?t:{},c={};X7(n)||(c=n??{}),$6(a)&&!X7(t)&&(c=t??{});var m=i.find(X7);return[o,s,c,m]}function dc0(a,t,n,r,l){var i,o,s=null,c=null,m=[a,t,n,r,l],h=m.filter(Rl);h.length===1?Rl(m[1])?(c=m[1],s=null):(c=h[0],s=null):h.length===2&&(typeof m[0]=="string"&&(s=m[0]),typeof m[1]=="string"&&(c=m[1]));var p=m.find(X7),f=m.filter($6);return f.length===1?$6(m[2])?(o={},i=m[2]):$6(m[3])?(i={},o=m[3]):(i=f[0],o={}):f.length===2&&(i=f[0],o=f[1]),[s,c,i??(i={}),o??(o={}),p]}var mc0=function(a){return function(){for(var t,n,r,l=[],i=0;i<arguments.length;i++)l[i]=arguments[i];for(var o={},s=["callback","options","traits","id"],c=0,m=l;c<m.length;c++){var h=m[c],p=s.pop();if(p==="id"){if(Rl(h)||_S(h)){o.id=h.toString();continue}if(h==null)continue;p=s.pop()}if((p==="traits"||p==="options")&&(h==null||$6(h))&&(o[p]=h),X7(h)){o.callback=h;break}}return[(t=o.id)!==null&&t!==void 0?t:a.id(),(n=o.traits)!==null&&n!==void 0?n:{},(r=o.options)!==null&&r!==void 0?r:{},o.callback]}};function uR0(a,t,n,r){_S(a)&&(a=a.toString()),_S(t)&&(t=t.toString());var l=[a,t,n,r],i=l.filter(Rl),o=i[0],s=o===void 0?a:o,c=i[1],m=c===void 0?null:c,h=l.filter($6)[0],p=h===void 0?{}:h,f=l.find(X7);return[s,m,p,f]}function CS(){return typeof window<"u"}function uc0(){return!CS()}function hc0(){return CS()?window.navigator.onLine:!0}function s3(){return!hc0()}function hR0(a,t){return t=t||{},new Promise(function(n,r){var l=new XMLHttpRequest,i=[],o=[],s={},c=function(){return{ok:(l.status/100|0)==2,statusText:l.statusText,status:l.status,url:l.responseURL,text:function(){return Promise.resolve(l.responseText)},json:function(){return Promise.resolve(l.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([l.response]))},clone:c,headers:{keys:function(){return i},entries:function(){return o},get:function(h){return s[h.toLowerCase()]},has:function(h){return h.toLowerCase()in s}}}};for(var m in l.open(t.method||"get",a,!0),l.onload=function(){l.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(h,p,f){i.push(p=p.toLowerCase()),o.push([p,f]),s[p]=s[p]?s[p]+","+f:f}),n(c())},l.onerror=r,l.withCredentials=t.credentials=="include",t.headers)l.setRequestHeader(m,t.headers[m]);l.send(t.body||null)})}var TS=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:null},Vv=function(){for(var a=[],t=0;t<arguments.length;t++)a[t]=arguments[t];var n=TS();return(n&&n.fetch||hR0).apply(void 0,a)},kv="1.81.1",pc0="api.segment.io/v1",pR0=function(a,t,n){var r=t.reduce(function(l,i){var o=i.split(":"),s=o[0],c=o[1];return l[s]=c,l},{});return{type:"Counter",metric:a,value:1,tags:u0(u0({},r),{library:"analytics.js",library_version:"npm:next-".concat(kv)})}};function IS(a){console.error("Error sending segment performance metrics",a)}var fR0=(function(){function a(t){var n=this,r,l,i,o,s;if(this.host=(r=t?.host)!==null&&r!==void 0?r:pc0,this.sampleRate=(l=t?.sampleRate)!==null&&l!==void 0?l:1,this.flushTimer=(i=t?.flushTimer)!==null&&i!==void 0?i:30*1e3,this.maxQueueSize=(o=t?.maxQueueSize)!==null&&o!==void 0?o:20,this.protocol=(s=t?.protocol)!==null&&s!==void 0?s:"https",this.queue=[],this.sampleRate>0){var c=!1,m=function(){c||(c=!0,n.flush().catch(IS),c=!1,setTimeout(m,n.flushTimer))};m()}}return a.prototype.increment=function(t,n){if(t.includes("analytics_js.")&&n.length!==0&&!(Math.random()>this.sampleRate)&&!(this.queue.length>=this.maxQueueSize)){var r=pR0(t,n);this.queue.push(r),t.includes("error")&&this.flush().catch(IS)}},a.prototype.flush=function(){return b1(this,void 0,void 0,function(){var t=this;return _1(this,function(n){switch(n.label){case 0:return this.queue.length<=0?[2]:[4,this.send().catch(function(r){IS(r),t.sampleRate=0})];case 1:return n.sent(),[2]}})})},a.prototype.send=function(){return b1(this,void 0,void 0,function(){var t,n,r;return _1(this,function(l){return t={series:this.queue},this.queue=[],n={"Content-Type":"text/plain"},r="".concat(this.protocol,"://").concat(this.host,"/m"),[2,Vv(r,{headers:n,body:JSON.stringify(t),method:"POST"})]})})},a})(),Sv,fc0=(function(a){kt(t,a);function t(){return a!==null&&a.apply(this,arguments)||this}return t.initRemoteMetrics=function(n){Sv=new fR0(n)},t.prototype.increment=function(n,r,l){a.prototype.increment.call(this,n,r,l),Sv?.increment(n,l??[])},t})(oc0),Vr=(function(a){kt(t,a);function t(n,r){return a.call(this,n,r,new fc0)||this}return t.system=function(){return new this({type:"track",event:"system"})},t})(eu);function gR0(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()==="object"}var gc0="bpc",vc0=function(a,t,n,r,l,i){return{__t:gc0,c:t,p:r,u:a,s:n,t:l,r:i}},vR0=Object.keys(vc0("","","","","",""));function AR0(a){if(!gR0(a)||a.__t!==gc0)return!1;for(var t in a)if(!vR0.includes(t))return!1;return!0}var ZR0=function(a,t){return a.indexOf("?")>-1?a:a+t},HR0=function(a){var t=a.indexOf("#");return t===-1?a:a.slice(0,t)},ER0=function(a){try{return new URL(a).pathname}catch{return a[0]==="/"?a:"/"+a}},Ac0=function(a){var t=a.c,n=a.p,r=a.s,l=a.u,i=a.r,o=a.t,s=t?ER0(t):n,c=t?ZR0(t,r):HR0(l);return{path:s,referrer:i,search:r,title:o,url:c}},Zc0=function(){var a=document.querySelector("link[rel='canonical']");return vc0(location.href,a&&a.getAttribute("href")||void 0,location.search,location.pathname,document.title,document.referrer)},MR0=function(){return Ac0(Zc0())};function yR0(a,t){return Object.assign.apply(Object,Qe([{}],t.map(function(n){var r;if(a&&Object.prototype.hasOwnProperty.call(a,n))return r={},r[n]=a[n],r}),!1))}var ac=function(a,t){t===void 0&&(t=MR0());var n=a.context,r;a.type==="page"&&(r=a.properties&&yR0(a.properties,Object.keys(t)),a.properties=u0(u0(u0({},t),a.properties),a.name?{name:a.name}:{})),n.page=u0(u0(u0({},t),r),n.page)},VR0=(function(a){kt(t,a);function t(n){var r=a.call(this,{createMessageId:function(){return"ajs-next-".concat(Date.now(),"-").concat(ec())},onEventMethodCall:function(l){var i=l.options;r.maybeUpdateAnonId(i)},onFinishedEvent:function(l){return r.addIdentity(l),l}})||this;return r.user=n,r}return t.prototype.maybeUpdateAnonId=function(n){n?.anonymousId&&this.user.anonymousId(n.anonymousId)},t.prototype.addIdentity=function(n){this.user.id()&&(n.userId=this.user.id()),this.user.anonymousId()&&(n.anonymousId=this.user.anonymousId())},t.prototype.track=function(n,r,l,i,o){var s=a.prototype.track.call(this,n,r,l,i);return ac(s,o),s},t.prototype.page=function(n,r,l,i,o,s){var c=a.prototype.page.call(this,n,r,l,i,o);return ac(c,s),c},t.prototype.screen=function(n,r,l,i,o,s){var c=a.prototype.screen.call(this,n,r,l,i,o);return ac(c,s),c},t.prototype.identify=function(n,r,l,i,o){var s=a.prototype.identify.call(this,n,r,l,i);return ac(s,o),s},t.prototype.group=function(n,r,l,i,o){var s=a.prototype.group.call(this,n,r,l,i);return ac(s,o),s},t.prototype.alias=function(n,r,l,i,o){var s=a.prototype.alias.call(this,n,r,l,i);return ac(s,o),s},t})(rc0),kR0=function(a){return"addMiddleware"in a&&a.type==="destination"},kr={getItem:function(){},setItem:function(){},removeItem:function(){}};try{kr=CS()&&window.localStorage?window.localStorage:kr}catch(a){console.warn("Unable to access localStorage",a)}function Hc0(a){var t=kr.getItem(a);return(t?JSON.parse(t):[]).map(function(n){return new Vr(n.event,n.id)})}function SR0(a,t){var n=Hc0(a),r=Qe(Qe([],t,!0),n,!0),l=r.reduce(function(i,o){var s;return u0(u0({},i),(s={},s[o.id]=o,s))},{});kr.setItem(a,JSON.stringify(Object.values(l)))}function Ec0(a){var t=kr.getItem(a);return t?JSON.parse(t):{}}function FR0(a,t){var n=Ec0(a);kr.setItem(a,JSON.stringify(u0(u0({},n),t)))}function Mc0(a){kr.removeItem(a)}var LR0=function(){return new Date().getTime()};function xS(a,t,n){n===void 0&&(n=0);var r=50,l="persisted-queue:v1:".concat(a,":lock"),i=function(m){return new Date().getTime()>m},o=kr.getItem(l),s=o?JSON.parse(o):null,c=s===null||i(s);if(c){kr.setItem(l,JSON.stringify(LR0()+r)),t(),kr.removeItem(l);return}!c&&n<3?setTimeout(function(){xS(a,t,n+1)},r):console.error("Unable to retrieve lock")}var Fv=(function(a){kt(t,a);function t(n,r){var l=a.call(this,n,[])||this,i="persisted-queue:v1:".concat(r,":items"),o="persisted-queue:v1:".concat(r,":seen"),s=[],c={};return xS(r,function(){try{s=Hc0(i),c=Ec0(o),Mc0(i),Mc0(o),l.queue=Qe(Qe([],s,!0),l.queue,!0),l.seen=u0(u0({},c),l.seen)}catch(m){console.error(m)}}),window.addEventListener("pagehide",function(){if(l.todo>0){var m=Qe(Qe([],l.queue,!0),l.future,!0);try{xS(r,function(){SR0(i,m),FR0(o,l.seen)})}catch(h){console.error(h)}}}),l}return t})(Jm),bR0=(function(a){kt(t,a);function t(n){return a.call(this,typeof n=="string"?new Fv(4,n):n)||this}return t.prototype.flush=function(){return b1(this,void 0,void 0,function(){return _1(this,function(n){return s3()?[2,[]]:[2,a.prototype.flush.call(this)]})})},t})(sc0);function PS(a){for(var t=a.constructor.prototype,n=0,r=Object.getOwnPropertyNames(t);n<r.length;n++){var l=r[n];if(l!=="constructor"){var i=Object.getOwnPropertyDescriptor(a.constructor.prototype,l);i&&typeof i.value=="function"&&(a[l]=a[l].bind(a))}}return a}function Lv(a){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)a[r]=n[r]}return a}var _R0={read:function(a){return a[0]==='"'&&(a=a.slice(1,-1)),a.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(a){return encodeURIComponent(a).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function OS(a,t){function n(l,i,o){if(!(typeof document>"u")){o=Lv({},t,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),l=encodeURIComponent(l).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var c in o)o[c]&&(s+="; "+c,o[c]!==!0&&(s+="="+o[c].split(";")[0]));return document.cookie=l+"="+a.write(i,l)+s}}function r(l){if(!(typeof document>"u"||arguments.length&&!l)){for(var i=document.cookie?document.cookie.split("; "):[],o={},s=0;s<i.length;s++){var c=i[s].split("="),m=c.slice(1).join("=");try{var h=decodeURIComponent(c[0]);if(o[h]=a.read(m,h),l===h)break}catch{}}return l?o[l]:o}}return Object.create({set:n,get:r,remove:function(l,i){n(l,"",Lv({},i,{expires:-1}))},withAttributes:function(l){return OS(this.converter,Lv({},this.attributes,l))},withConverter:function(l){return OS(Lv({},this.converter,l),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(a)}})}var $l=OS(_R0,{path:"/"});function NR0(a){var t=a.hostname,n=t.split("."),r=n[n.length-1],l=[];if(n.length===4&&parseInt(r,10)>0||n.length<=1)return l;for(var i=n.length-2;i>=0;--i)l.push(n.slice(i).join("."));return l}function wR0(a){try{return new URL(a)}catch{return}}function yc0(a){var t=wR0(a);if(t)for(var n=NR0(t),r=0;r<n.length;++r){var l="__tld__",i=n[r],o={domain:"."+i};try{if($l.set(l,"1",o),$l.get(l))return $l.remove(l,o),i}catch{return}}}var CR0=365,Vc0=(function(){function a(t){t===void 0&&(t=a.defaults),this.options=u0(u0({},a.defaults),t)}return Object.defineProperty(a,"defaults",{get:function(){return{maxage:CR0,domain:yc0(window.location.href),path:"/",sameSite:"Lax"}},enumerable:!1,configurable:!0}),a.prototype.opts=function(){return{sameSite:this.options.sameSite,expires:this.options.maxage,domain:this.options.domain,path:this.options.path,secure:this.options.secure}},a.prototype.get=function(t){var n;try{var r=$l.get(t);if(r==null)return null;try{return(n=JSON.parse(r))!==null&&n!==void 0?n:null}catch{return r??null}}catch{return null}},a.prototype.set=function(t,n){typeof n=="string"?$l.set(t,n,this.opts()):n===null?$l.remove(t,this.opts()):$l.set(t,JSON.stringify(n),this.opts())},a.prototype.remove=function(t){return $l.remove(t,this.opts())},a})(),TR0=(function(){function a(){}return a.prototype.localStorageWarning=function(t,n){console.warn("Unable to access ".concat(t,", localStorage may be ").concat(n))},a.prototype.get=function(t){var n;try{var r=localStorage.getItem(t);if(r===null)return null;try{return(n=JSON.parse(r))!==null&&n!==void 0?n:null}catch{return r??null}}catch{return this.localStorageWarning(t,"unavailable"),null}},a.prototype.set=function(t,n){try{localStorage.setItem(t,JSON.stringify(n))}catch{this.localStorageWarning(t,"full")}},a.prototype.remove=function(t){try{return localStorage.removeItem(t)}catch{this.localStorageWarning(t,"unavailable")}},a})(),RS=(function(){function a(){this.cache={}}return a.prototype.get=function(t){var n;return(n=this.cache[t])!==null&&n!==void 0?n:null},a.prototype.set=function(t,n){this.cache[t]=n},a.prototype.remove=function(t){delete this.cache[t]},a})(),D6={Cookie:"cookie",LocalStorage:"localStorage",Memory:"memory"};function kc0(a){return a&&a.stores&&Array.isArray(a.stores)&&a.stores.every(function(t){return Object.values(D6).includes(t)})}function IR0(a){return typeof a=="object"&&a.name!==void 0}var $S=function(a,t,n,r){console.warn("".concat(a.constructor.name,": Can't ").concat(t,' key "').concat(n,'" | Err: ').concat(r))},e5=(function(){function a(t){this.stores=t}return a.prototype.get=function(t){for(var n=null,r=0,l=this.stores;r<l.length;r++){var i=l[r];try{if(n=i.get(t),n!=null)return n}catch(o){$S(i,"get",t,o)}}return null},a.prototype.set=function(t,n){this.stores.forEach(function(r){try{r.set(t,n)}catch(l){$S(r,"set",t,l)}})},a.prototype.clear=function(t){this.stores.forEach(function(n){try{n.remove(t)}catch(r){$S(n,"remove",t,r)}})},a.prototype.getAndSync=function(t){var n=this.get(t),r=typeof n=="number"?n.toString():n;return this.set(t,r),r},a})();function DS(a){var t=a.map(function(n){var r,l;switch(IR0(n)?(r=n.name,l=n.settings):r=n,r){case D6.Cookie:return new Vc0(l);case D6.LocalStorage:return new TR0;case D6.Memory:return new RS;default:throw new Error("Unknown Store Type: ".concat(n))}});return t}function Sc0(a,t){return a.map(function(n){return t&&n===D6.Cookie?{name:n,settings:t}:n})}var t5={persist:!0,cookie:{key:"ajs_user_id",oldKey:"ajs_user"},localStorage:{key:"ajs_user_traits"}},Fc0=(function(){function a(t,n){t===void 0&&(t=t5);var r=this,l,i,o,s;this.options={},this.id=function(m){if(r.options.disable)return null;var h=r.identityStore.getAndSync(r.idKey);if(m!==void 0){r.identityStore.set(r.idKey,m);var p=m!==h&&h!==null&&m!==null;p&&r.anonymousId(null)}var f=r.identityStore.getAndSync(r.idKey);if(f)return f;var v=r.legacyUserStore.get(t5.cookie.oldKey);return v?typeof v=="object"?v.id:v:null},this.anonymousId=function(m){var h,p;if(r.options.disable)return null;if(m===void 0){var f=(h=r.identityStore.getAndSync(r.anonKey))!==null&&h!==void 0?h:(p=r.legacySIO())===null||p===void 0?void 0:p[0];if(f)return f}return m===null?(r.identityStore.set(r.anonKey,null),r.identityStore.getAndSync(r.anonKey)):(r.identityStore.set(r.anonKey,m??ec()),r.identityStore.getAndSync(r.anonKey))},this.traits=function(m){var h;if(!r.options.disable)return m===null&&(m={}),m&&r.traitsStore.set(r.traitsKey,m??{}),(h=r.traitsStore.get(r.traitsKey))!==null&&h!==void 0?h:{}},this.options=u0(u0({},t5),t),this.cookieOptions=n,this.idKey=(i=(l=t.cookie)===null||l===void 0?void 0:l.key)!==null&&i!==void 0?i:t5.cookie.key,this.traitsKey=(s=(o=t.localStorage)===null||o===void 0?void 0:o.key)!==null&&s!==void 0?s:t5.localStorage.key,this.anonKey="ajs_anonymous_id",this.identityStore=this.createStorage(this.options,n),this.legacyUserStore=this.createStorage(this.options,n,function(m){return m===D6.Cookie}),this.traitsStore=this.createStorage(this.options,n,function(m){return m!==D6.Cookie});var c=this.legacyUserStore.get(t5.cookie.oldKey);c&&typeof c=="object"&&(c.id&&this.id(c.id),c.traits&&this.traits(c.traits)),PS(this)}return a.prototype.legacySIO=function(){var t=this.legacyUserStore.get("_sio");if(!t)return null;var n=t.split("----"),r=n[0],l=n[1];return[r,l]},a.prototype.identify=function(t,n){if(!this.options.disable){n=n??{};var r=this.id();(r===null||r===t)&&(n=u0(u0({},this.traits()),n)),t&&this.id(t),this.traits(n)}},a.prototype.logout=function(){this.anonymousId(null),this.id(null),this.traits({})},a.prototype.reset=function(){this.logout(),this.identityStore.clear(this.idKey),this.identityStore.clear(this.anonKey),this.traitsStore.clear(this.traitsKey)},a.prototype.load=function(){return new a(this.options,this.cookieOptions)},a.prototype.save=function(){return!0},a.prototype.createStorage=function(t,n,r){var l=[D6.LocalStorage,D6.Cookie,D6.Memory];return t.disable?new e5([]):t.persist?(t.storage!==void 0&&t.storage!==null&&kc0(t.storage)&&(l=t.storage.stores),t.localStorageFallbackDisabled&&(l=l.filter(function(i){return i!==D6.LocalStorage})),r&&(l=l.filter(r)),new e5(DS(Sc0(l,n)))):new e5([new RS])},a.defaults=t5,a})(),Lc0={persist:!0,cookie:{key:"ajs_group_id"},localStorage:{key:"ajs_group_properties"}},xR0=(function(a){kt(t,a);function t(n,r){n===void 0&&(n=Lc0);var l=a.call(this,u0(u0({},Lc0),n),r)||this;return l.anonymousId=function(i){},PS(l),l}return t})(Fc0),jS="analytics";function bc0(){return window[jS]}function PR0(a){jS=a}function OR0(a){window[jS]=a}var RR0=function(a){return typeof a=="object"&&a!==null&&"then"in a&&typeof a.then=="function"},_c0=function(a,t,n){n.getAndRemove(a).forEach(function(r){bv(t,r).catch(console.error)})},$R0=function(a,t){return b1(void 0,void 0,void 0,function(){var n,r,l;return _1(this,function(i){switch(i.label){case 0:n=0,r=t.getAndRemove("addSourceMiddleware"),i.label=1;case 1:return n<r.length?(l=r[n],[4,bv(a,l).catch(console.error)]):[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},DR0=function(a,t){return b1(void 0,void 0,void 0,function(){var n,r,l;return _1(this,function(i){switch(i.label){case 0:n=0,r=t.getAndRemove("register"),i.label=1;case 1:return n<r.length?(l=r[n],[4,bv(a,l).catch(console.error)]):[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},jR0=_c0.bind(void 0,"on"),BR0=_c0.bind(void 0,"setAnonymousId"),zR0=function(a,t){Object.keys(t.calls).forEach(function(n){t.getAndRemove(n).forEach(function(r){setTimeout(function(){bv(a,r).catch(console.error)},0)})})},nc=function(a){if(Nc0(a)){var t=a.pop();return Ac0(t)}},Nc0=function(a){var t=a[a.length-1];return AR0(t)},BS=(function(){function a(t,n,r,l){r===void 0&&(r=function(){}),l===void 0&&(l=console.error),this.method=t,this.resolve=r,this.reject=l,this.called=!1,this.args=n}return a})(),UR0=(function(){function a(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._callMap={},this.add.apply(this,t)}return Object.defineProperty(a.prototype,"calls",{get:function(){return this._pushSnippetWindowBuffer(),this._callMap},set:function(t){this._callMap=t},enumerable:!1,configurable:!0}),a.prototype.get=function(t){var n;return(n=this.calls[t])!==null&&n!==void 0?n:[]},a.prototype.getAndRemove=function(t){var n=this.get(t);return this.calls[t]=[],n},a.prototype.add=function(){for(var t=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];n.forEach(function(l){var i=["track","screen","alias","group","page","identify"];i.includes(l.method)&&!Nc0(l.args)&&(l.args=Qe(Qe([],l.args,!0),[Zc0()],!1)),t.calls[l.method]?t.calls[l.method].push(l):t.calls[l.method]=[l]})},a.prototype.clear=function(){this._pushSnippetWindowBuffer(),this.calls={}},a.prototype.toArray=function(){var t;return(t=[]).concat.apply(t,Object.values(this.calls))},a.prototype._pushSnippetWindowBuffer=function(){},a})();function bv(a,t){return b1(this,void 0,void 0,function(){var n,r;return _1(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),t.called?[2,void 0]:(t.called=!0,n=a[t.method].apply(a,t.args),RR0(n)?[4,n]:[3,2]);case 1:l.sent(),l.label=2;case 2:return t.resolve(n),[3,4];case 3:return r=l.sent(),t.reject(r),[3,4];case 4:return[2]}})})}var qR0=(function(){function a(t){var n=this;this.trackSubmit=this._createMethod("trackSubmit"),this.trackClick=this._createMethod("trackClick"),this.trackLink=this._createMethod("trackLink"),this.pageView=this._createMethod("pageview"),this.identify=this._createMethod("identify"),this.reset=this._createMethod("reset"),this.group=this._createMethod("group"),this.track=this._createMethod("track"),this.ready=this._createMethod("ready"),this.alias=this._createMethod("alias"),this.debug=this._createChainableMethod("debug"),this.page=this._createMethod("page"),this.once=this._createChainableMethod("once"),this.off=this._createChainableMethod("off"),this.on=this._createChainableMethod("on"),this.addSourceMiddleware=this._createMethod("addSourceMiddleware"),this.setAnonymousId=this._createMethod("setAnonymousId"),this.addDestinationMiddleware=this._createMethod("addDestinationMiddleware"),this.screen=this._createMethod("screen"),this.register=this._createMethod("register"),this.deregister=this._createMethod("deregister"),this.user=this._createMethod("user"),this.VERSION=kv,this._preInitBuffer=new UR0,this._promise=t(this._preInitBuffer),this._promise.then(function(r){var l=r[0],i=r[1];n.instance=l,n.ctx=i}).catch(function(){})}return a.prototype.then=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=this._promise).then.apply(t,n)},a.prototype.catch=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=this._promise).catch.apply(t,n)},a.prototype.finally=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=this._promise).finally.apply(t,n)},a.prototype._createMethod=function(t){var n=this;return function(){for(var r,l=[],i=0;i<arguments.length;i++)l[i]=arguments[i];if(n.instance){var o=(r=n.instance)[t].apply(r,l);return Promise.resolve(o)}return new Promise(function(s,c){n._preInitBuffer.add(new BS(t,l,s,c))})}},a.prototype._createChainableMethod=function(t){var n=this;return function(){for(var r,l=[],i=0;i<arguments.length;i++)l[i]=arguments[i];return n.instance?((r=n.instance)[t].apply(r,l),n):(n._preInitBuffer.add(new BS(t,l)),n)}},a})(),tu={},a5={},rc={},zS={exports:{}},wc0;function _v(){return wc0||(wc0=1,(function(a){a.exports=t(n),a.exports.find=a.exports,a.exports.replace=function(s,c,m,h){return t(l).call(this,s,c,m,h),s},a.exports.del=function(s,c,m){return t(r).call(this,s,c,null,m),s};function t(s){return function(c,m,h,p){var f=p&&o(p.normalizer)?p.normalizer:i;m=f(m);for(var v,Z=!1;!Z;)E();function E(){for(v in c){var M=f(v);if(m.indexOf(M)===0){var V=m.substr(M.length);if(V.charAt(0)==="."||V.length===0){m=V.substr(1);var L=c[v];if(L==null){Z=!0;return}if(!m.length){Z=!0;return}c=L;return}}}v=void 0,Z=!0}if(v)return c==null?c:s(c,v,h)}}function n(s,c){if(s.hasOwnProperty(c))return s[c]}function r(s,c){return s.hasOwnProperty(c)&&delete s[c],s}function l(s,c,m){return s.hasOwnProperty(c)&&(s[c]=m),s}function i(s){return s.replace(/[^a-zA-Z0-9\.]+/g,"").toLowerCase()}function o(s){return typeof s=="function"}})(zS)),zS.exports}var Cc0;function GR0(){if(Cc0)return rc;Cc0=1;var a=rc&&rc.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(rc,"__esModule",{value:!0});var t=a(_v());function n(l,i){return function(){var o=this.traits(),s=this.properties?this.properties():{};return t.default(o,"address."+l)||t.default(o,l)||(i?t.default(o,"address."+i):null)||(i?t.default(o,i):null)||t.default(s,"address."+l)||t.default(s,l)||(i?t.default(s,"address."+i):null)||(i?t.default(s,i):null)}}function r(l){l.zip=n("postalCode","zip"),l.country=n("country"),l.street=n("street"),l.state=n("state"),l.city=n("city"),l.region=n("region")}return rc.default=r,rc}var au={},Tc0;function WR0(){if(Tc0)return au;Tc0=1,Object.defineProperty(au,"__esModule",{value:!0}),au.clone=void 0;function a(t){if(typeof t!="object")return t;if(Object.prototype.toString.call(t)==="[object Object]"){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=a(t[r]));return n}else return Array.isArray(t)?t.map(a):t}return au.clone=a,au}var Nv={},Ic0;function KR0(){if(Ic0)return Nv;Ic0=1,Object.defineProperty(Nv,"__esModule",{value:!0});var a={Salesforce:!0};function t(n){return!a[n]}return Nv.default=t,Nv}var wv={},xc0;function Pc0(){if(xc0)return wv;xc0=1;var a=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;return wv.parse=function(t){var n=[1,5,6,7,11,12],r=a.exec(t),l=0;if(!r)return new Date(t);for(var i=0,o;o=n[i];i++)r[o]=parseInt(r[o],10)||0;r[2]=parseInt(r[2],10)||1,r[3]=parseInt(r[3],10)||1,r[2]--,r[8]=r[8]?(r[8]+"00").substring(0,3):0,r[4]===" "?l=new Date().getTimezoneOffset():r[9]!=="Z"&&r[10]&&(l=r[11]*60+r[12],r[10]==="+"&&(l=0-l));var s=Date.UTC(r[1],r[2],r[3],r[5],r[6]+l,r[7],r[8]);return new Date(s)},wv.is=function(t,n){return typeof t!="string"||n&&/^\d{4}-\d{2}-\d{2}/.test(t)===!1?!1:a.test(t)},wv}var Cv={},Oc0;function YR0(){if(Oc0)return Cv;Oc0=1;var a=/\d{13}/;return Cv.is=function(t){return a.test(t)},Cv.parse=function(t){return t=parseInt(t,10),new Date(t)},Cv}var Tv={},Rc0;function QR0(){if(Rc0)return Tv;Rc0=1;var a=/\d{10}/;return Tv.is=function(t){return a.test(t)},Tv.parse=function(t){var n=parseInt(t,10)*1e3;return new Date(n)},Tv}var US,$c0;function qS(){if($c0)return US;$c0=1;var a=Pc0(),t=YR0(),n=QR0(),r=Object.prototype,l=r.toString;function i(c){return l.call(c)==="[object Date]"}function o(c){return l.call(c)==="[object Number]"}US=function(m){return i(m)?m:o(m)?new Date(s(m)):a.is(m)?a.parse(m):t.is(m)?t.parse(m):n.is(m)?n.parse(m):new Date(m)};function s(c){return c<315576e5?c*1e3:c}return US}var GS,Dc0;function XR0(){if(Dc0)return GS;Dc0=1;var a=Pc0();GS=t;function t(l,i){return i===void 0&&(i=!0),l&&typeof l=="object"?n(l,i):Array.isArray(l)?r(l,i):a.is(l,i)?a.parse(l):l}function n(l,i){return Object.keys(l).forEach(function(o){l[o]=t(l[o],i)}),l}function r(l,i){return l.forEach(function(o,s){l[s]=t(o,i)}),l}return GS}var jc0;function n5(){if(jc0)return a5;jc0=1;var a=a5&&a5.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(a5,"__esModule",{value:!0}),a5.Facade=void 0;var t=a(GR0()),n=WR0(),r=a(KR0()),l=a(qS()),i=a(_v()),o=a(XR0());function s(h,p){p=p||{},this.raw=n.clone(h),"clone"in p||(p.clone=!0),p.clone&&(h=n.clone(h)),"traverse"in p||(p.traverse=!0),"timestamp"in h?h.timestamp=l.default(h.timestamp):h.timestamp=new Date,p.traverse&&o.default(h),this.opts=p,this.obj=h}a5.Facade=s;var c=s.prototype;c.proxy=function(h){var p=h.split(".");h=p.shift();var f=this[h]||this.obj[h];return f&&(typeof f=="function"&&(f=f.call(this)||{}),p.length===0?this.opts.clone?m(f):f:(f=i.default(f,p.join(".")),this.opts.clone?m(f):f))},c.field=function(h){var p=this.obj[h];return this.opts.clone?m(p):p},s.proxy=function(h){return function(){return this.proxy(h)}},s.field=function(h){return function(){return this.field(h)}},s.multi=function(h){return function(){var p=this.proxy(h+"s");if(Array.isArray(p))return p;var f=this.proxy(h);return f&&(f=[this.opts.clone?n.clone(f):f]),f||[]}},s.one=function(h){return function(){var p=this.proxy(h);if(p)return p;var f=this.proxy(h+"s");if(Array.isArray(f))return f[0]}},c.json=function(){var h=this.opts.clone?n.clone(this.obj):this.obj;return this.type&&(h.type=this.type()),h},c.rawEvent=function(){return this.raw},c.options=function(h){var p=this.obj.options||this.obj.context||{},f=this.opts.clone?n.clone(p):p;if(!h)return f;if(this.enabled(h)){var v=this.integrations(),Z=v[h]||i.default(v,h);return typeof Z!="object"&&(Z=i.default(this.options(),h)),typeof Z=="object"?Z:{}}},c.context=c.options,c.enabled=function(h){var p=this.proxy("options.providers.all");typeof p!="boolean"&&(p=this.proxy("options.all")),typeof p!="boolean"&&(p=this.proxy("integrations.all")),typeof p!="boolean"&&(p=!0);var f=p&&r.default(h),v=this.integrations();if(v.providers&&v.providers.hasOwnProperty(h)&&(f=v.providers[h]),v.hasOwnProperty(h)){var Z=v[h];typeof Z=="boolean"?f=Z:f=!0}return!!f},c.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()},c.active=function(){var h=this.proxy("options.active");return h==null&&(h=!0),h},c.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")},c.sessionId=c.anonymousId,c.groupId=s.proxy("options.groupId"),c.traits=function(h){var p=this.proxy("options.traits")||{},f=this.userId();h=h||{},f&&(p.id=f);for(var v in h)if(Object.prototype.hasOwnProperty.call(h,v)){var Z=this[v]==null?this.proxy("options.traits."+v):this[v]();if(Z==null)continue;p[h[v]]=Z,delete p[v]}return p},c.library=function(){var h=this.proxy("options.library");return h?typeof h=="string"?{name:h,version:null}:h:{name:"unknown",version:null}},c.device=function(){var h=this.proxy("context.device");(typeof h!="object"||h===null)&&(h={});var p=this.library().name;return h.type||(p.indexOf("ios")>-1&&(h.type="ios"),p.indexOf("android")>-1&&(h.type="android")),h},c.userAgent=s.proxy("context.userAgent"),c.timezone=s.proxy("context.timezone"),c.timestamp=s.field("timestamp"),c.channel=s.field("channel"),c.ip=s.proxy("context.ip"),c.userId=s.field("userId"),t.default(c);function m(h){return n.clone(h)}return a5}var r5={},Iv={exports:{}},Bc0;function l5(){return Bc0||(Bc0=1,typeof Object.create=="function"?Iv.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Iv.exports=function(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}),Iv.exports}var zc0;function JR0(){if(zc0)return r5;zc0=1;var a=r5&&r5.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(r5,"__esModule",{value:!0}),r5.Alias=void 0;var t=a(l5()),n=n5();function r(l,i){n.Facade.call(this,l,i)}return r5.Alias=r,t.default(r,n.Facade),r.prototype.action=function(){return"alias"},r.prototype.type=r.prototype.action,r.prototype.previousId=function(){return this.field("previousId")||this.field("from")},r.prototype.from=r.prototype.previousId,r.prototype.userId=function(){return this.field("userId")||this.field("to")},r.prototype.to=r.prototype.userId,r5}var i5={},xv={},Uc0;function Pv(){if(Uc0)return xv;Uc0=1,Object.defineProperty(xv,"__esModule",{value:!0});var a=/.+\@.+\..+/;function t(n){return a.test(n)}return xv.default=t,xv}var qc0;function e$0(){if(qc0)return i5;qc0=1;var a=i5&&i5.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(i5,"__esModule",{value:!0}),i5.Group=void 0;var t=a(l5()),n=a(Pv()),r=a(qS()),l=n5();function i(s,c){l.Facade.call(this,s,c)}i5.Group=i,t.default(i,l.Facade);var o=i.prototype;return o.action=function(){return"group"},o.type=o.action,o.groupId=l.Facade.field("groupId"),o.created=function(){var s=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");if(s)return r.default(s)},o.email=function(){var s=this.proxy("traits.email");if(s)return s;var c=this.groupId();if(n.default(c))return c},o.traits=function(s){var c=this.properties(),m=this.groupId();s=s||{},m&&(c.id=m);for(var h in s)if(Object.prototype.hasOwnProperty.call(s,h)){var p=this[h]==null?this.proxy("traits."+h):this[h]();if(p==null)continue;c[s[h]]=p,delete c[h]}return c},o.name=l.Facade.proxy("traits.name"),o.industry=l.Facade.proxy("traits.industry"),o.employees=l.Facade.proxy("traits.employees"),o.properties=function(){return this.field("traits")||this.field("properties")||{}},i5}var o5={},Gc0;function Wc0(){if(Gc0)return o5;Gc0=1;var a=o5&&o5.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(o5,"__esModule",{value:!0}),o5.Identify=void 0;var t=n5(),n=a(_v()),r=a(l5()),l=a(Pv()),i=a(qS()),o=function(m){return m.trim()};function s(m,h){t.Facade.call(this,m,h)}o5.Identify=s,r.default(s,t.Facade);var c=s.prototype;return c.action=function(){return"identify"},c.type=c.action,c.traits=function(m){var h=this.field("traits")||{},p=this.userId();m=m||{},p&&(h.id=p);for(var f in m){var v=this[f]==null?this.proxy("traits."+f):this[f]();v!=null&&(h[m[f]]=v,f!==m[f]&&delete h[f])}return h},c.email=function(){var m=this.proxy("traits.email");if(m)return m;var h=this.userId();if(l.default(h))return h},c.created=function(){var m=this.proxy("traits.created")||this.proxy("traits.createdAt");if(m)return i.default(m)},c.companyCreated=function(){var m=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(m)return i.default(m)},c.companyName=function(){return this.proxy("traits.company.name")},c.name=function(){var m=this.proxy("traits.name");if(typeof m=="string")return o(m);var h=this.firstName(),p=this.lastName();if(h&&p)return o(h+" "+p)},c.firstName=function(){var m=this.proxy("traits.firstName");if(typeof m=="string")return o(m);var h=this.proxy("traits.name");if(typeof h=="string")return o(h).split(" ")[0]},c.lastName=function(){var m=this.proxy("traits.lastName");if(typeof m=="string")return o(m);var h=this.proxy("traits.name");if(typeof h=="string"){var p=o(h).indexOf(" ");if(p!==-1)return o(h.substr(p+1))}},c.uid=function(){return this.userId()||this.username()||this.email()},c.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")},c.age=function(){var m=this.birthday(),h=n.default(this.traits(),"age");if(h!=null)return h;if(m instanceof Date){var p=new Date;return p.getFullYear()-m.getFullYear()}},c.avatar=function(){var m=this.traits();return n.default(m,"avatar")||n.default(m,"photoUrl")||n.default(m,"avatarUrl")},c.position=function(){var m=this.traits();return n.default(m,"position")||n.default(m,"jobTitle")},c.username=t.Facade.proxy("traits.username"),c.website=t.Facade.one("traits.website"),c.websites=t.Facade.multi("traits.website"),c.phone=t.Facade.one("traits.phone"),c.phones=t.Facade.multi("traits.phone"),c.address=t.Facade.proxy("traits.address"),c.gender=t.Facade.proxy("traits.gender"),c.birthday=t.Facade.proxy("traits.birthday"),o5}var s5={},Kc0;function WS(){if(Kc0)return s5;Kc0=1;var a=s5&&s5.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(s5,"__esModule",{value:!0}),s5.Track=void 0;var t=a(l5()),n=n5(),r=Wc0(),l=a(Pv()),i=a(_v());function o(m,h){n.Facade.call(this,m,h)}s5.Track=o,t.default(o,n.Facade);var s=o.prototype;s.action=function(){return"track"},s.type=s.action,s.event=n.Facade.field("event"),s.value=n.Facade.proxy("properties.value"),s.category=n.Facade.proxy("properties.category"),s.id=n.Facade.proxy("properties.id"),s.productId=function(){return this.proxy("properties.product_id")||this.proxy("properties.productId")},s.promotionId=function(){return this.proxy("properties.promotion_id")||this.proxy("properties.promotionId")},s.cartId=function(){return this.proxy("properties.cart_id")||this.proxy("properties.cartId")},s.checkoutId=function(){return this.proxy("properties.checkout_id")||this.proxy("properties.checkoutId")},s.paymentId=function(){return this.proxy("properties.payment_id")||this.proxy("properties.paymentId")},s.couponId=function(){return this.proxy("properties.coupon_id")||this.proxy("properties.couponId")},s.wishlistId=function(){return this.proxy("properties.wishlist_id")||this.proxy("properties.wishlistId")},s.reviewId=function(){return this.proxy("properties.review_id")||this.proxy("properties.reviewId")},s.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.order_id")||this.proxy("properties.orderId")},s.sku=n.Facade.proxy("properties.sku"),s.tax=n.Facade.proxy("properties.tax"),s.name=n.Facade.proxy("properties.name"),s.price=n.Facade.proxy("properties.price"),s.total=n.Facade.proxy("properties.total"),s.repeat=n.Facade.proxy("properties.repeat"),s.coupon=n.Facade.proxy("properties.coupon"),s.shipping=n.Facade.proxy("properties.shipping"),s.discount=n.Facade.proxy("properties.discount"),s.shippingMethod=function(){return this.proxy("properties.shipping_method")||this.proxy("properties.shippingMethod")},s.paymentMethod=function(){return this.proxy("properties.payment_method")||this.proxy("properties.paymentMethod")},s.description=n.Facade.proxy("properties.description"),s.plan=n.Facade.proxy("properties.plan"),s.subtotal=function(){var m=i.default(this.properties(),"subtotal"),h=this.total()||this.revenue();if(m)return m;if(!h)return 0;if(this.total()){var p=this.tax();p&&(h-=p),p=this.shipping(),p&&(h-=p),p=this.discount(),p&&(h+=p)}return h},s.products=function(){var m=this.properties(),h=i.default(m,"products");return Array.isArray(h)?h.filter(function(p){return p!==null}):[]},s.quantity=function(){var m=this.obj.properties||{};return m.quantity||1},s.currency=function(){var m=this.obj.properties||{};return m.currency||"USD"},s.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},s.query=n.Facade.proxy("options.query"),s.properties=function(m){var h=this.field("properties")||{};m=m||{};for(var p in m)if(Object.prototype.hasOwnProperty.call(m,p)){var f=this[p]==null?this.proxy("properties."+p):this[p]();if(f==null)continue;h[m[p]]=f,delete h[p]}return h},s.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()},s.email=function(){var m=this.proxy("traits.email")||this.proxy("properties.email")||this.proxy("options.traits.email");if(m)return m;var h=this.userId();if(l.default(h))return h},s.revenue=function(){var m=this.proxy("properties.revenue"),h=this.event(),p=/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;return!m&&h&&h.match(p)&&(m=this.proxy("properties.total")),c(m)},s.cents=function(){var m=this.revenue();return typeof m!="number"?this.value()||0:m*100},s.identify=function(){var m=this.json();return m.traits=this.traits(),new r.Identify(m,this.opts)};function c(m){if(m){if(typeof m=="number")return m;if(typeof m=="string"&&(m=m.replace(/\$/g,""),m=parseFloat(m),!isNaN(m)))return m}}return s5}var c5={},Yc0;function Qc0(){if(Yc0)return c5;Yc0=1;var a=c5&&c5.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(c5,"__esModule",{value:!0}),c5.Page=void 0;var t=a(l5()),n=n5(),r=WS(),l=a(Pv());function i(s,c){n.Facade.call(this,s,c)}c5.Page=i,t.default(i,n.Facade);var o=i.prototype;return o.action=function(){return"page"},o.type=o.action,o.category=n.Facade.field("category"),o.name=n.Facade.field("name"),o.title=n.Facade.proxy("properties.title"),o.path=n.Facade.proxy("properties.path"),o.url=n.Facade.proxy("properties.url"),o.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},o.properties=function(s){var c=this.field("properties")||{},m=this.category(),h=this.name();s=s||{},m&&(c.category=m),h&&(c.name=h);for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p)){var f=this[p]==null?this.proxy("properties."+p):this[p]();if(f==null)continue;c[s[p]]=f,p!==s[p]&&delete c[p]}return c},o.email=function(){var s=this.proxy("context.traits.email")||this.proxy("properties.email");if(s)return s;var c=this.userId();if(l.default(c))return c},o.fullName=function(){var s=this.category(),c=this.name();return c&&s?s+" "+c:c},o.event=function(s){return s?"Viewed "+s+" Page":"Loaded a Page"},o.track=function(s){var c=this.json();return c.event=this.event(s),c.timestamp=this.timestamp(),c.properties=this.properties(),new r.Track(c,this.opts)},c5}var d5={},Xc0;function t$0(){if(Xc0)return d5;Xc0=1;var a=d5&&d5.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(d5,"__esModule",{value:!0}),d5.Screen=void 0;var t=a(l5()),n=Qc0(),r=WS();function l(i,o){n.Page.call(this,i,o)}return d5.Screen=l,t.default(l,n.Page),l.prototype.action=function(){return"screen"},l.prototype.type=l.prototype.action,l.prototype.event=function(i){return i?"Viewed "+i+" Screen":"Loaded a Screen"},l.prototype.track=function(i){var o=this.json();return o.event=this.event(i),o.timestamp=this.timestamp(),o.properties=this.properties(),new r.Track(o,this.opts)},d5}var m5={},Jc0;function a$0(){if(Jc0)return m5;Jc0=1;var a=m5&&m5.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(m5,"__esModule",{value:!0}),m5.Delete=void 0;var t=a(l5()),n=n5();function r(l,i){n.Facade.call(this,l,i)}return m5.Delete=r,t.default(r,n.Facade),r.prototype.type=function(){return"delete"},m5}var ed0;function n$0(){return ed0||(ed0=1,(function(a){var t=tu&&tu.__assign||function(){return t=Object.assign||function(h){for(var p,f=1,v=arguments.length;f<v;f++){p=arguments[f];for(var Z in p)Object.prototype.hasOwnProperty.call(p,Z)&&(h[Z]=p[Z])}return h},t.apply(this,arguments)};Object.defineProperty(a,"__esModule",{value:!0}),a.Delete=a.Screen=a.Page=a.Track=a.Identify=a.Group=a.Alias=a.Facade=void 0;var n=n5();Object.defineProperty(a,"Facade",{enumerable:!0,get:function(){return n.Facade}});var r=JR0();Object.defineProperty(a,"Alias",{enumerable:!0,get:function(){return r.Alias}});var l=e$0();Object.defineProperty(a,"Group",{enumerable:!0,get:function(){return l.Group}});var i=Wc0();Object.defineProperty(a,"Identify",{enumerable:!0,get:function(){return i.Identify}});var o=WS();Object.defineProperty(a,"Track",{enumerable:!0,get:function(){return o.Track}});var s=Qc0();Object.defineProperty(a,"Page",{enumerable:!0,get:function(){return s.Page}});var c=t$0();Object.defineProperty(a,"Screen",{enumerable:!0,get:function(){return c.Screen}});var m=a$0();Object.defineProperty(a,"Delete",{enumerable:!0,get:function(){return m.Delete}}),a.default=t(t({},n.Facade),{Alias:r.Alias,Group:l.Group,Identify:i.Identify,Track:o.Track,Page:s.Page,Screen:c.Screen,Delete:m.Delete})})(tu)),tu}var j4=n$0();function Ov(a,t){var n=new j4.Facade(a,t);return a.type==="track"&&(n=new j4.Track(a,t)),a.type==="identify"&&(n=new j4.Identify(a,t)),a.type==="page"&&(n=new j4.Page(a,t)),a.type==="alias"&&(n=new j4.Alias(a,t)),a.type==="group"&&(n=new j4.Group(a,t)),a.type==="screen"&&(n=new j4.Screen(a,t)),Object.defineProperty(n,"obj",{value:a,writable:!0}),n}var r$0=function(a){var t=!1;window.addEventListener("pagehide",function(){t||(t=!0,a(t))}),document.addEventListener("visibilitychange",function(){if(document.visibilityState=="hidden"){if(t)return;t=!0}else t=!1;a(t)})},td0=(function(a){kt(t,a);function t(n,r){var l=a.call(this,n)||this;return l.retryTimeout=r,l.name="RateLimitError",l}return t})(Error),ad0=function(a){return u0({"Content-Type":"text/plain"},typeof a=="function"?a():a)},l$0=500,i$0=64;function KS(a){var t=encodeURI(JSON.stringify(a)).split(/%..|./).length-1;return t/1024}function o$0(a){return KS(a)>=l$0-50}function s$0(a){return KS(a)>=i$0-10}function c$0(a){var t=[],n=0;return a.forEach(function(r){var l=KS(t[n]);l>=64&&n++,t[n]?t[n].push(r):t[n]=[r]}),t}function d$0(a,t){var n,r,l=[],i=!1,o=(n=t?.size)!==null&&n!==void 0?n:10,s=(r=t?.timeout)!==null&&r!==void 0?r:5e3,c=0;function m(Z){var E;if(Z.length!==0){var M=(E=Z[0])===null||E===void 0?void 0:E.writeKey,V=Z.map(function(L){var b=L;b.sentAt;var N=R6(b,["sentAt"]);return N});return Vv("https://".concat(a,"/b"),{credentials:t?.credentials,keepalive:t?.keepalive||i,headers:ad0(t?.headers),method:"post",body:JSON.stringify({writeKey:M,batch:V,sentAt:new Date().toISOString()}),priority:t?.priority}).then(function(L){var b;if(L.status>=500)throw new Error("Bad response from server: ".concat(L.status));if(L.status===429){var N=(b=L.headers)===null||b===void 0?void 0:b.get("x-ratelimit-reset"),F=typeof N=="string"?parseInt(N)*1e3:s;throw new td0("Rate limit exceeded: ".concat(L.status),F)}})}}function h(Z){var E;return Z===void 0&&(Z=1),b1(this,void 0,void 0,function(){var M;return _1(this,function(V){return l.length?(M=l,l=[],[2,(E=m(M))===null||E===void 0?void 0:E.catch(function(L){var b,N=Vr.system();N.log("error","Error sending batch",L),Z<=((b=t?.maxRetries)!==null&&b!==void 0?b:10)&&(L.name==="RateLimitError"&&(c=L.retryTimeout),l.push.apply(l,M),l.map(function(F){if("_metadata"in F){var w=F;w._metadata=u0(u0({},w._metadata),{retryCount:Z})}}),f(Z+1))})]):[2]})})}var p;function f(Z){Z===void 0&&(Z=1),!p&&(p=setTimeout(function(){p=void 0,h(Z).catch(console.error)},c||s),c=0)}r$0(function(Z){if(i=Z,i&&l.length){var E=c$0(l).map(m);Promise.all(E).catch(console.error)}});function v(Z,E){return b1(this,void 0,void 0,function(){var M;return _1(this,function(V){return l.push(E),M=l.length>=o||o$0(l)||t?.keepalive&&s$0(l),[2,M||i?h():f()]})})}return{dispatch:v}}function m$0(a){function t(n,r){return Vv(n,{credentials:a?.credentials,keepalive:a?.keepalive,headers:ad0(a?.headers),method:"post",body:JSON.stringify(r),priority:a?.priority}).then(function(l){var i;if(l.status>=500)throw new Error("Bad response from server: ".concat(l.status));if(l.status===429){var o=(i=l.headers)===null||i===void 0?void 0:i.get("x-ratelimit-reset"),s=o?parseInt(o)*1e3:5e3;throw new td0("Rate limit exceeded: ".concat(l.status),s)}})}return{dispatch:t}}function u$0(a,t,n,r,l){var i,o=a.user();delete t.options,t.writeKey=n?.apiKey,t.userId=t.userId||o.id(),t.anonymousId=t.anonymousId||o.anonymousId(),t.sentAt=new Date;var s=a.queue.failedInitializations||[];s.length>0&&(t._metadata={failedInitializations:s}),l!=null&&(l.attempts>1&&(t._metadata=u0(u0({},t._metadata),{retryCount:l.attempts})),l.attempts++);var c=[],m=[];for(var h in r){var p=r[h];h==="Segment.io"&&c.push(h),p.bundlingStatus==="bundled"&&c.push(h),p.bundlingStatus==="unbundled"&&m.push(h)}for(var f=0,v=n?.unbundledIntegrations||[];f<v.length;f++){var Z=v[f];m.includes(Z)||m.push(Z)}var E=(i=n?.maybeBundledConfigIds)!==null&&i!==void 0?i:{},M=[];return c.sort().forEach(function(V){var L;((L=E[V])!==null&&L!==void 0?L:[]).forEach(function(b){M.push(b)})}),n?.addBundledMetadata!==!1&&(t._metadata=u0(u0({},t._metadata),{bundled:c.sort(),unbundled:m.sort(),bundledIds:M})),t}var nd0=function(a,t){return b1(void 0,void 0,void 0,function(){var n;return _1(this,function(r){return n=function(l){return b1(void 0,void 0,void 0,function(){var i;return _1(this,function(o){switch(o.label){case 0:return a(l)?(i=n,[4,t()]):[3,2];case 1:return[2,i.apply(void 0,[o.sent()])];case 2:return[2]}})})},[2,n(void 0)]})})};function h$0(a,t){return b1(this,void 0,void 0,function(){var n,r=this;return _1(this,function(l){switch(l.label){case 0:return n=[],s3()?[2,t]:[4,nd0(function(){return t.length>0&&!s3()},function(){return b1(r,void 0,void 0,function(){var i,o,s;return _1(this,function(c){switch(c.label){case 0:return i=t.pop(),i?[4,tc(i,a)]:[2];case 1:return o=c.sent(),s=o instanceof Vr,s||n.push(i),[2]}})})})];case 1:return l.sent(),n.map(function(i){return t.pushWithBackoff(i)}),[2,t]}})})}function lc(a,t,n,r){var l=this;a||setTimeout(function(){return b1(l,void 0,void 0,function(){var i,o;return _1(this,function(s){switch(s.label){case 0:return i=!0,[4,h$0(n,t)];case 1:return o=s.sent(),i=!1,t.todo>0&&r(i,o,n,r),[2]}})})},Math.random()*5e3)}function p$0(a,t){var n,r,l,i,o=a.user();return t.previousId=(l=(r=(n=t.previousId)!==null&&n!==void 0?n:t.from)!==null&&r!==void 0?r:o.id())!==null&&l!==void 0?l:o.anonymousId(),t.userId=(i=t.userId)!==null&&i!==void 0?i:t.to,delete t.from,delete t.to,t}var f$0=function(a){return a.name==="Segment.io"};function g$0(a,t,n){var r,l,i;window.addEventListener("pagehide",function(){s.push.apply(s,Array.from(c)),c.clear()});var o=(r=t?.apiKey)!==null&&r!==void 0?r:"",s=a.options.disableClientPersistence?new Jm(a.queue.queue.maxAttempts,[]):new Fv(a.queue.queue.maxAttempts,"".concat(o,":dest-Segment.io")),c=new Set,m=!1,h=(l=t?.apiHost)!==null&&l!==void 0?l:pc0,p=(i=t?.protocol)!==null&&i!==void 0?i:"https",f="".concat(p,"://").concat(h),v=t?.deliveryStrategy,Z=v&&"strategy"in v&&v.strategy==="batching"?d$0(h,v.config):m$0(v?.config);function E(V){return b1(this,void 0,void 0,function(){var L,b;return _1(this,function(N){return s3()?(s.push(V),lc(m,s,M,lc),[2,V]):(c.add(V),L=V.event.type.charAt(0),b=Ov(V.event).json(),V.event.type==="track"&&delete b.traits,V.event.type==="alias"&&(b=p$0(a,b)),s.getAttempts(V)>=s.maxAttempts?(c.delete(V),[2,V]):[2,Z.dispatch("".concat(f,"/").concat(L),u$0(a,b,t,n,V)).then(function(){return V}).catch(function(F){if(V.log("error","Error sending event",F),F.name==="RateLimitError"){var w=F.retryTimeout;s.pushWithBackoff(V,w)}else s.pushWithBackoff(V);return lc(m,s,M,lc),V}).finally(function(){c.delete(V)})])})})}var M={metadata:{writeKey:o,apiHost:h,protocol:p},name:"Segment.io",type:"destination",version:"0.1.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:E,identify:E,page:E,alias:E,group:E,screen:E};return s.todo&&lc(m,s,M,lc),M}var c3="This is being deprecated and will be not be available in future releases of Analytics JS",YS=TS(),QS=YS?.analytics;function v$0(a,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=t?10:1,l=n?new Jm(r,[]):new Fv(r,a);return new bR0(l)}var A$0=(function(){function a(t,n){var r;this.timeout=300,this._getSegmentPluginMetadata=function(){var i;return(i=n.plugins.find(f$0))===null||i===void 0?void 0:i.metadata},this.writeKey=t.writeKey;var l={integrations:{"Segment.io":{apiKey:""}}};this.cdnSettings=(r=t.cdnSettings)!==null&&r!==void 0?r:l,this.cdnURL=t.cdnURL}return Object.defineProperty(a.prototype,"apiHost",{get:function(){var t,n;return(n=(t=this._getSegmentPluginMetadata)===null||t===void 0?void 0:t.call(this))===null||n===void 0?void 0:n.apiHost},enumerable:!1,configurable:!0}),a})();function Sr(){console.warn(c3)}var rd0=(function(a){kt(t,a);function t(n,r,l,i,o){var s=this,c,m;s=a.call(this)||this,s._debug=!1,s.initialized=!1,s.user=function(){return s._user},s.init=s.initialize.bind(s),s.log=Sr,s.addIntegrationMiddleware=Sr,s.listeners=Sr,s.addEventListener=Sr,s.removeAllListeners=Sr,s.removeListener=Sr,s.removeEventListener=Sr,s.hasListeners=Sr,s.add=Sr,s.addIntegration=Sr;var h=r?.cookie,p=(c=r?.disableClientPersistence)!==null&&c!==void 0?c:!1;s.queue=l??v$0("".concat(n.writeKey,":event-queue"),r?.retryQueue,p),s.settings=new A$0(n,s.queue);var f=r?.storage;return s._universalStorage=s.createStore(p,f,h),s._user=i??new Fc0(u0({persist:!p,storage:r?.storage},r?.user),h).load(),s._group=o??new xR0(u0({persist:!p,storage:r?.storage},r?.group),h).load(),s.eventFactory=new VR0(s._user),s.integrations=(m=r?.integrations)!==null&&m!==void 0?m:{},s.options=r??{},PS(s),s}return t.prototype.createStore=function(n,r,l){return n?new e5([new RS]):r&&kc0(r)?new e5(DS(Sc0(r.stores,l))):new e5(DS([D6.LocalStorage,{name:D6.Cookie,settings:l},D6.Memory]))},Object.defineProperty(t.prototype,"storage",{get:function(){return this._universalStorage},enumerable:!1,configurable:!0}),t.prototype.track=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p=this;return _1(this,function(f){return l=nc(n),i=mR0.apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],h=this.eventFactory.track(o,s,c,this.integrations,l),[2,this._dispatch(h,m).then(function(v){return p.emit("track",o,v.event.properties,v.event.options),v})]})})},t.prototype.page=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p,f=this;return _1(this,function(v){return l=nc(n),i=dc0.apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],h=i[4],p=this.eventFactory.page(o,s,c,m,this.integrations,l),[2,this._dispatch(p,h).then(function(Z){return f.emit("page",o,s,Z.event.properties,Z.event.options),Z})]})})},t.prototype.identify=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p=this;return _1(this,function(f){return l=nc(n),i=mc0(this._user).apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],this._user.identify(o,s),h=this.eventFactory.identify(this._user.id(),this._user.traits(),c,this.integrations,l),[2,this._dispatch(h,m).then(function(v){return p.emit("identify",v.event.userId,v.event.traits,v.event.options),v})]})})},t.prototype.group=function(){for(var n=this,r=[],l=0;l<arguments.length;l++)r[l]=arguments[l];var i=nc(r);if(r.length===0)return this._group;var o=mc0(this._group).apply(void 0,r),s=o[0],c=o[1],m=o[2],h=o[3];this._group.identify(s,c);var p=this._group.id(),f=this._group.traits(),v=this.eventFactory.group(p,f,m,this.integrations,i);return this._dispatch(v,h).then(function(Z){return n.emit("group",Z.event.groupId,Z.event.traits,Z.event.options),Z})},t.prototype.alias=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p=this;return _1(this,function(f){return l=nc(n),i=uR0.apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],h=this.eventFactory.alias(o,s,c,this.integrations,l),[2,this._dispatch(h,m).then(function(v){return p.emit("alias",o,s,v.event.options),v})]})})},t.prototype.screen=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p,f=this;return _1(this,function(v){return l=nc(n),i=dc0.apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],h=i[4],p=this.eventFactory.screen(o,s,c,m,this.integrations,l),[2,this._dispatch(p,h).then(function(Z){return f.emit("screen",o,s,Z.event.properties,Z.event.options),Z})]})})},t.prototype.trackClick=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return[4,Promise.resolve().then(()=>LH)];case 1:return l=o.sent(),[2,(i=l.link).call.apply(i,Qe([this],n,!1))]}})})},t.prototype.trackLink=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return[4,Promise.resolve().then(()=>LH)];case 1:return l=o.sent(),[2,(i=l.link).call.apply(i,Qe([this],n,!1))]}})})},t.prototype.trackSubmit=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return[4,Promise.resolve().then(()=>LH)];case 1:return l=o.sent(),[2,(i=l.form).call.apply(i,Qe([this],n,!1))]}})})},t.prototype.trackForm=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return[4,Promise.resolve().then(()=>LH)];case 1:return l=o.sent(),[2,(i=l.form).call.apply(i,Qe([this],n,!1))]}})})},t.prototype.register=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o=this;return _1(this,function(s){switch(s.label){case 0:return l=Vr.system(),i=n.map(function(c){return o.queue.register(l,c,o)}),[4,Promise.all(i)];case 1:return s.sent(),[2,l]}})})},t.prototype.deregister=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o=this;return _1(this,function(s){switch(s.label){case 0:return l=Vr.system(),i=n.map(function(c){var m=o.queue.plugins.find(function(h){return h.name===c});if(m)return o.queue.deregister(l,m,o);l.log("warn","plugin ".concat(c," not found"))}),[4,Promise.all(i)];case 1:return s.sent(),[2,l]}})})},t.prototype.debug=function(n){return n===!1&&localStorage.getItem("debug")&&localStorage.removeItem("debug"),this._debug=n,this},t.prototype.reset=function(){this._user.reset(),this._group.reset(),this.emit("reset")},t.prototype.timeout=function(n){this.settings.timeout=n},t.prototype._dispatch=function(n,r){return b1(this,void 0,void 0,function(){var l;return _1(this,function(i){return l=new Vr(n),l.stats.increment("analytics_js.invoke",1,[n.type]),s3()&&!this.options.retryQueue?[2,l]:[2,cc0(l,this.queue,this,{callback:r,debug:this._debug,timeout:this.settings.timeout})]})})},t.prototype.addSourceMiddleware=function(n){return b1(this,void 0,void 0,function(){var r=this;return _1(this,function(l){switch(l.label){case 0:return[4,this.queue.criticalTasks.run(function(){return b1(r,void 0,void 0,function(){var i,o,s;return _1(this,function(c){switch(c.label){case 0:return[4,Promise.resolve().then(()=>T$0)];case 1:return i=c.sent().sourceMiddlewarePlugin,o={},this.queue.plugins.forEach(function(m){if(m.type==="destination")return o[m.name]=!0}),s=i(n,o),[4,this.register(s)];case 2:return c.sent(),[2]}})})})];case 1:return l.sent(),[2,this]}})})},t.prototype.addDestinationMiddleware=function(n){for(var r=[],l=1;l<arguments.length;l++)r[l-1]=arguments[l];return this.queue.plugins.filter(kR0).forEach(function(i){(n==="*"||i.name.toLowerCase()===n.toLowerCase())&&i.addMiddleware.apply(i,r)}),Promise.resolve(this)},t.prototype.setAnonymousId=function(n){return this._user.anonymousId(n)},t.prototype.queryString=function(n){return b1(this,void 0,void 0,function(){var r;return _1(this,function(l){switch(l.label){case 0:return this.options.useQueryString===!1?[2,[]]:[4,Promise.resolve().then(()=>dm1)];case 1:return r=l.sent().queryString,[2,r(this,n)]}})})},t.prototype.use=function(n){return n(this),this},t.prototype.ready=function(n){return n===void 0&&(n=function(r){return r}),b1(this,void 0,void 0,function(){return _1(this,function(r){return[2,Promise.all(this.queue.plugins.map(function(l){return l.ready?l.ready():Promise.resolve()})).then(function(l){return n(l),l})]})})},t.prototype.noConflict=function(){return console.warn(c3),OR0(QS??this),this},t.prototype.normalize=function(n){return console.warn(c3),this.eventFactory.normalize(n)},Object.defineProperty(t.prototype,"failedInitializations",{get:function(){return console.warn(c3),this.queue.failedInitializations},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"VERSION",{get:function(){return kv},enumerable:!1,configurable:!0}),t.prototype.initialize=function(n,r){return b1(this,void 0,void 0,function(){return _1(this,function(l){return console.warn(c3),[2,Promise.resolve(this)]})})},t.prototype.pageview=function(n){return b1(this,void 0,void 0,function(){return _1(this,function(r){switch(r.label){case 0:return console.warn(c3),[4,this.page({path:n})];case 1:return r.sent(),[2,this]}})})},Object.defineProperty(t.prototype,"plugins",{get:function(){var n;return console.warn(c3),(n=this._plugins)!==null&&n!==void 0?n:{}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Integrations",{get:function(){console.warn(c3);var n=this.queue.plugins.filter(function(r){return r.type==="destination"}).reduce(function(r,l){var i="".concat(l.name.toLowerCase().replace(".","").split(" ").join("-"),"Integration"),o=window[i];if(!o)return r;var s=o.Integration;return s?(r[l.name]=s,r):(r[l.name]=o,r)},{});return n},enumerable:!1,configurable:!0}),t.prototype.push=function(n){var r=this,l=n.shift();l&&!r[l]||r[l].apply(this,n)},t})(J7),ld0=(function(a){kt(t,a);function t(){var n=a.call(this,{writeKey:""},{disableClientPersistence:!0})||this;return n.initialized=!0,n}return t})(rd0),id0={};function od0(){return typeof process>"u"||!id0?{}:id0}var Z$0=/(https:\/\/.*)\/analytics\.js\/v1\/(?:.*?)\/(?:platform|analytics.*)?/,H$0=function(){var a,t=Array.prototype.slice.call(document.querySelectorAll("script"));return t.forEach(function(n){var r,l=(r=n.getAttribute("src"))!==null&&r!==void 0?r:"",i=Z$0.exec(l);i&&i[1]&&(a=i[1])}),a},Rv,E$0=function(){var a,t=Rv??((a=bc0())===null||a===void 0?void 0:a._cdn);return t},M$0=function(a){var t=bc0();t&&(t._cdn=a),Rv=a},XS=function(){var a=E$0();if(a)return a;var t=H$0();return t||"https://cdn.segment.com"},JS=function(){var a=XS();return"".concat(a,"/next-integrations")};function sd0(a,t){var n,r=Object.entries((n=t.integrations)!==null&&n!==void 0?n:{}).reduce(function(l,i){var o,s,c=i[0],m=i[1];return typeof m=="object"?u0(u0({},l),(o={},o[c]=m,o)):u0(u0({},l),(s={},s[c]={},s))},{});return Object.entries(a.integrations).reduce(function(l,i){var o,s=i[0],c=i[1];return u0(u0({},l),(o={},o[s]=u0(u0({},c),r[s]),o))},{})}function cd0(a){try{return decodeURIComponent(a.replace(/\+/g," "))}catch{return a}}function y$0(a){return b1(this,void 0,void 0,function(){var t;return _1(this,function(n){return t=navigator.userAgentData,t?a?[2,t.getHighEntropyValues(a).catch(function(){return t.toJSON()})]:[2,t.toJSON()]:[2,void 0]})})}var nu;function V$0(){if(nu)return nu;var a=yc0(window.location.href);return nu={expires:31536e6,secure:!1,path:"/"},a&&(nu.domain=a),nu}function k$0(a){var t={btid:"dataxu",urid:"millennial-media"};a.startsWith("?")&&(a=a.substring(1)),a=a.replace(/\?/g,"&");for(var n=a.split("&"),r=0,l=n;r<l.length;r++){var i=l[r],o=i.split("="),s=o[0],c=o[1];if(t[s])return{id:c,type:t[s]}}}function S$0(a){return a.startsWith("?")&&(a=a.substring(1)),a=a.replace(/\?/g,"&"),a.split("&").reduce(function(t,n){var r=n.split("="),l=r[0],i=r[1],o=i===void 0?"":i;if(l.includes("utm_")&&l.length>4){var s=l.slice(4);s==="campaign"&&(s="name"),t[s]=cd0(o)}return t},{})}function F$0(){var a=$l.get("_ga");if(a&&a.startsWith("amp"))return a}function L$0(a,t,n){var r,l=new e5(n?[]:[new Vc0(V$0())]),i=l.get("s:context.referrer"),o=(r=k$0(a))!==null&&r!==void 0?r:i;o&&(t&&(t.referrer=u0(u0({},t.referrer),o)),l.set("s:context.referrer",o))}var b$0=function(a){try{var t=new URLSearchParams;return Object.entries(a).forEach(function(n){var r=n[0],l=n[1];Array.isArray(l)?l.forEach(function(i){return t.append(r,i)}):t.append(r,l)}),t.toString()}catch{return""}},_$0=(function(){function a(){var t=this;this.name="Page Enrichment",this.type="before",this.version="0.1.0",this.isLoaded=function(){return!0},this.load=function(n,r){return b1(t,void 0,void 0,function(){var l;return _1(this,function(i){switch(i.label){case 0:this.instance=r,i.label=1;case 1:return i.trys.push([1,3,,4]),l=this,[4,y$0(this.instance.options.highEntropyValuesClientHints)];case 2:return l.userAgentData=i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return[2,Promise.resolve()]}})})},this.enrich=function(n){var r,l,i=n.event.context,o=i.page.search||"",s=typeof o=="object"?b$0(o):o;i.userAgent=navigator.userAgent,i.userAgentData=t.userAgentData;var c=navigator.userLanguage||navigator.language;typeof i.locale>"u"&&typeof c<"u"&&(i.locale=c),(r=i.library)!==null&&r!==void 0||(i.library={name:"analytics.js",version:"".concat("npm:next","-").concat(kv)}),s&&!i.campaign&&(i.campaign=S$0(s));var m=F$0();m&&(i.amp={id:m}),L$0(s,i,(l=t.instance.options.disableClientPersistence)!==null&&l!==void 0?l:!1);try{i.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}return n},this.track=this.enrich,this.identify=this.enrich,this.page=this.enrich,this.group=this.enrich,this.alias=this.enrich,this.screen=this.enrich}return a})(),N$0=new _$0;function dd0(a){var t=Array.prototype.slice.call(window.document.querySelectorAll("script"));return t.find(function(n){return n.src===a})}function ic(a,t){var n=dd0(a);if(n!==void 0){var r=n?.getAttribute("status");if(r==="loaded")return Promise.resolve(n);if(r==="loading")return new Promise(function(l,i){n.addEventListener("load",function(){return l(n)}),n.addEventListener("error",function(o){return i(o)})})}return new Promise(function(l,i){var o,s=window.document.createElement("script");s.type="text/javascript",s.src=a,s.async=!0,s.setAttribute("status","loading");for(var c=0,m=Object.entries({});c<m.length;c++){var h=m[c],p=h[0],f=h[1];s.setAttribute(p,f)}s.onload=function(){s.onerror=s.onload=null,s.setAttribute("status","loaded"),l(s)},s.onerror=function(){s.onerror=s.onload=null,s.setAttribute("status","error"),i(new Error("Failed to load ".concat(a)))};var v=window.document.querySelector("script");v?(o=v.parentElement)===null||o===void 0||o.insertBefore(s,v):window.document.head.appendChild(s)})}function w$0(a){var t=dd0(a);return t!==void 0&&t.remove(),Promise.resolve()}function eF(a,t,n){return b1(this,void 0,void 0,function(){function r(m,h){return b1(this,void 0,void 0,function(){var p,f,v;return _1(this,function(Z){switch(Z.label){case 0:return p=!1,f=null,[4,h({payload:Ov(m,{clone:!0,traverse:!1}),integration:a,next:function(E){p=!0,E===null&&(f=null),E&&(f=E.obj)}})];case 1:return Z.sent(),!p&&f!==null&&(f=f,f.integrations=u0(u0({},m.integrations),(v={},v[a]=!1,v))),[2,f]}})})}var l,i,o,s,c;return _1(this,function(m){switch(m.label){case 0:l=Ov(t,{clone:!0,traverse:!1}).rawEvent(),i=0,o=n,m.label=1;case 1:return i<o.length?(s=o[i],[4,r(l,s)]):[3,4];case 2:if(c=m.sent(),c===null)return[2,null];l=c,m.label=3;case 3:return i++,[3,1];case 4:return[2,l]}})})}function C$0(a,t){function n(r){return b1(this,void 0,void 0,function(){var l;return _1(this,function(i){switch(i.label){case 0:return l=!1,[4,a({payload:Ov(r.event,{clone:!0,traverse:!1}),integrations:t??{},next:function(o){l=!0,o&&(r.event=o.obj)}})];case 1:if(i.sent(),!l)throw new o3({retry:!1,type:"middleware_cancellation",reason:"Middleware `next` function skipped"});return[2,r]}})})}return{name:"Source Middleware ".concat(a.name),type:"before",version:"0.1.0",isLoaded:function(){return!0},load:function(r){return Promise.resolve(r)},track:n,page:n,screen:n,identify:n,alias:n,group:n}}const T$0=Object.freeze(Object.defineProperty({__proto__:null,applyDestinationMiddleware:eF,sourceMiddlewarePlugin:C$0},Symbol.toStringTag,{value:"Module"}));function d3(a,t){var n=t.methodName,r=t.integrationName,l=t.type,i=t.didError,o=i===void 0?!1:i;a.stats.increment("analytics_js.integration.invoke".concat(o?".error":""),1,["method:".concat(n),"integration_name:".concat(r),"type:".concat(l)])}var I$0=(function(){function a(t,n){this.version="1.0.0",this.alternativeNames=[],this.loadPromise=Ev(),this.middleware=[],this.alias=this._createMethod("alias"),this.group=this._createMethod("group"),this.identify=this._createMethod("identify"),this.page=this._createMethod("page"),this.screen=this._createMethod("screen"),this.track=this._createMethod("track"),this.action=n,this.name=t,this.type=n.type,this.alternativeNames.push(n.name)}return a.prototype.addMiddleware=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];this.type==="destination"&&(t=this.middleware).push.apply(t,n)},a.prototype.transform=function(t){return b1(this,void 0,void 0,function(){var n;return _1(this,function(r){switch(r.label){case 0:return[4,eF(this.name,t.event,this.middleware)];case 1:return n=r.sent(),n===null&&t.cancel(new o3({retry:!1,reason:"dropped by destination middleware"})),[2,new Vr(n)]}})})},a.prototype._createMethod=function(t){var n=this;return function(r){return b1(n,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return this.action[t]?(l=r,this.type!=="destination"?[3,2]:[4,this.transform(r)]):[2,r];case 1:l=o.sent(),o.label=2;case 2:return o.trys.push([2,5,,6]),[4,this.ready()];case 3:if(!o.sent())throw new Error("Something prevented the destination from getting ready");return d3(r,{integrationName:this.action.name,methodName:t,type:"action"}),[4,this.action[t](l)];case 4:return o.sent(),[3,6];case 5:throw i=o.sent(),d3(r,{integrationName:this.action.name,methodName:t,type:"action",didError:!0}),i;case 6:return[2,r]}})})}},a.prototype.isLoaded=function(){return this.action.isLoaded()},a.prototype.ready=function(){return b1(this,void 0,void 0,function(){return _1(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.loadPromise.promise];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}})})},a.prototype.load=function(t,n){return b1(this,void 0,void 0,function(){var r,l,i,o;return _1(this,function(s){switch(s.label){case 0:if(this.loadPromise.isSettled())return[2,this.loadPromise.promise];s.label=1;case 1:return s.trys.push([1,3,,4]),d3(t,{integrationName:this.action.name,methodName:"load",type:"action"}),r=this.action.load(t,n),i=(l=this.loadPromise).resolve,[4,r];case 2:return i.apply(l,[s.sent()]),[2,r];case 3:throw o=s.sent(),d3(t,{integrationName:this.action.name,methodName:"load",type:"action",didError:!0}),this.loadPromise.reject(o),o;case 4:return[2]}})})},a.prototype.unload=function(t,n){var r,l;return(l=(r=this.action).unload)===null||l===void 0?void 0:l.call(r,t,n)},a})();function x$0(a){if(!Array.isArray(a))throw new Error("Not a valid list of plugins");var t=["load","isLoaded","name","version","type"];return a.forEach(function(n){t.forEach(function(r){var l;if(n[r]===void 0)throw new Error("Plugin: ".concat((l=n.name)!==null&&l!==void 0?l:"unknown"," missing required function ").concat(r))})}),!0}function P$0(a,t){var n=a[t.creationName],r=a[t.name];return a.All===!1&&!n&&!r||n===!1||r===!1}function O$0(a,t){return b1(this,void 0,void 0,function(){var n,r,l,i,o,s;return _1(this,function(c){switch(c.label){case 0:if(c.trys.push([0,9,,10]),n=new RegExp("https://cdn.segment.(com|build)"),r=XS(),!t)return[3,6];l=a.url.split("/"),i=l[l.length-2],o=a.url.replace(i,btoa(i).replace(/=/g,"")),c.label=1;case 1:return c.trys.push([1,3,,5]),[4,ic(o.replace(n,r))];case 2:return c.sent(),[3,5];case 3:return c.sent(),[4,ic(a.url.replace(n,r))];case 4:return c.sent(),[3,5];case 5:return[3,8];case 6:return[4,ic(a.url.replace(n,r))];case 7:c.sent(),c.label=8;case 8:return typeof window[a.libraryName]=="function"?[2,window[a.libraryName]]:[3,10];case 9:throw s=c.sent(),console.error("Failed to create PluginFactory",a),s;case 10:return[2]}})})}function R$0(a,t,n,r,l,i){var o,s,c;return b1(this,void 0,void 0,function(){var m,h,p,f=this;return _1(this,function(v){switch(v.label){case 0:return m=[],h=(s=(o=a.middlewareSettings)===null||o===void 0?void 0:o.routingRules)!==null&&s!==void 0?s:[],p=((c=a.remotePlugins)!==null&&c!==void 0?c:[]).map(function(Z){return b1(f,void 0,void 0,function(){var E,M,V,L,b,N,F;return _1(this,function(w){switch(w.label){case 0:if(P$0(t,Z))return[2];w.label=1;case 1:return w.trys.push([1,6,,7]),M=i?.find(function(x){var P=x.pluginName;return P===Z.name}),M?[3,3]:[4,O$0(Z,r?.obfuscate)];case 2:M=w.sent(),w.label=3;case 3:return E=M,E?(V=n[Z.name],[4,E(u0(u0({},Z.settings),V))]):[3,5];case 4:L=w.sent(),b=Array.isArray(L)?L:[L],x$0(b),N=h.filter(function(x){return x.destinationName===Z.creationName}),b.forEach(function(x){var P=new I$0(Z.creationName,x);N.length&&l&&P.addMiddleware(l),m.push(P)}),w.label=5;case 5:return[3,7];case 6:return F=w.sent(),console.warn("Failed to load Remote Plugin",F),[3,7];case 7:return[2]}})})}),[4,Promise.all(p)];case 1:return v.sent(),[2,m.filter(Boolean)]}})})}var tF,md0,$$0=TS(),ud0=(tF=(md0=$$0).__SEGMENT_INSPECTOR__)!==null&&tF!==void 0?tF:md0.__SEGMENT_INSPECTOR__={},D$0=function(a){var t;return(t=ud0.attach)===null||t===void 0?void 0:t.call(ud0,a)};function j$0(a,t){return Vv("".concat(t,"/v1/projects/").concat(a,"/settings")).then(function(n){return n.ok?n.json():n.text().then(function(r){throw new Error(r)})}).catch(function(n){throw console.error(n.message),n})}function B$0(a){return od0().NODE_ENV!=="test"&&Object.keys(a.integrations).length>1}function z$0(a){var t,n,r;return od0().NODE_ENV!=="test"&&((r=(n=(t=a.middlewareSettings)===null||t===void 0?void 0:t.routingRules)===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0)>0}function U$0(a,t){BR0(a,t),jR0(a,t)}function q$0(a,t,n){return b1(this,void 0,void 0,function(){return _1(this,function(r){switch(r.label){case 0:return[4,W$0(a,t)];case 1:return r.sent(),zR0(a,n),[2]}})})}var G$0=function(){var a,t,n=(a=window.location.hash)!==null&&a!==void 0?a:"",r=(t=window.location.search)!==null&&t!==void 0?t:"",l=r.length?r:n.replace(/(?=#).*(?=\?)/,"");return l},W$0=function(a,t){return b1(void 0,void 0,void 0,function(){return _1(this,function(n){switch(n.label){case 0:return t.includes("ajs_")?[4,a.queryString(t).catch(console.error)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})};function K$0(a,t,n,r,l,i,o){var s,c,m;return l===void 0&&(l=[]),b1(this,void 0,void 0,function(){var h,p,f,v,Z,E,M,V,L,b,N,F,w,x,P,j=this;return _1(this,function(R){switch(R.label){case 0:return U$0(n,o),h=l?.filter(function(G){return typeof G=="object"}),p=l?.filter(function(G){return typeof G=="function"&&typeof G.pluginName=="string"}),z$0(t)?[4,Promise.resolve().then(()=>hm1).then(function(G){return G.tsubMiddleware(t.middlewareSettings.routingRules)})]:[3,2];case 1:return v=R.sent(),[3,3];case 2:v=void 0,R.label=3;case 3:return f=v,B$0(t)||i.length>0?[4,Promise.resolve().then(()=>Vm1).then(function(G){return G.ajsDestinations(a,t,n.integrations,r,f,i)})]:[3,5];case 4:return E=R.sent(),[3,6];case 5:E=[],R.label=6;case 6:return Z=E,t.legacyVideoPluginsEnabled?[4,Promise.resolve().then(()=>Sm1).then(function(G){return G.loadLegacyVideoPlugins(n)})]:[3,8];case 7:R.sent(),R.label=8;case 8:return!((s=r.plan)===null||s===void 0)&&s.track?[4,Promise.resolve().then(()=>bm1).then(function(G){var t0;return G.schemaFilter((t0=r.plan)===null||t0===void 0?void 0:t0.track,t)})]:[3,10];case 9:return V=R.sent(),[3,11];case 10:V=void 0,R.label=11;case 11:return M=V,L=sd0(t,r),[4,R$0(t,n.integrations,L,r,f,p).catch(function(){return[]})];case 12:return b=R.sent(),N=Qe(Qe([N$0],Z,!0),b,!0),M&&N.push(M),F=((c=r.integrations)===null||c===void 0?void 0:c.All)===!1&&!r.integrations["Segment.io"]||r.integrations&&r.integrations["Segment.io"]===!1,F?[3,14]:(x=(w=N).push,[4,g$0(n,L["Segment.io"],t.integrations)]);case 13:x.apply(w,[R.sent()]),R.label=14;case 14:return[4,n.register.apply(n,Qe(Qe([],N,!1),h,!1))];case 15:return P=R.sent(),[4,DR0(n,o)];case 16:return R.sent(),Object.entries((m=t.enabledMiddleware)!==null&&m!==void 0?m:{}).some(function(G){var t0=G[1];return t0})?[4,Promise.resolve().then(()=>Nm1).then(function(G){var t0=G.remoteMiddlewares;return b1(j,void 0,void 0,function(){var J,W;return _1(this,function(q){switch(q.label){case 0:return[4,t0(P,t,r.obfuscate)];case 1:return J=q.sent(),W=J.map(function(d0){return n.addSourceMiddleware(d0)}),[2,Promise.all(W)]}})})})]:[3,18];case 17:R.sent(),R.label=18;case 18:return[4,$R0(n,o)];case 19:return R.sent(),[2,P]}})})}function Y$0(a,t,n){var r,l,i,o,s,c,m,h,p;return t===void 0&&(t={}),b1(this,void 0,void 0,function(){var f,v,Z,E,M,V,L,b,N,F,w;return _1(this,function(x){switch(x.label){case 0:return t.disable===!0?[2,[new ld0,Vr.system()]]:(t.globalAnalyticsKey&&PR0(t.globalAnalyticsKey),a.cdnURL&&M$0(a.cdnURL),t.initialPageview&&n.add(new BS("page",[])),f=G$0(),v=(r=a.cdnURL)!==null&&r!==void 0?r:XS(),(l=a.cdnSettings)!==null&&l!==void 0?(E=l,[3,3]):[3,1]);case 1:return[4,j$0(a.writeKey,v)];case 2:E=x.sent(),x.label=3;case 3:return Z=E,t.updateCDNSettings&&(Z=t.updateCDNSettings(Z)),typeof t.disable!="function"?[3,5]:[4,t.disable(Z)];case 4:if(M=x.sent(),M)return[2,[new ld0,Vr.system()]];x.label=5;case 5:return V=(o=(i=Z.integrations["Segment.io"])===null||i===void 0?void 0:i.retryQueue)!==null&&o!==void 0?o:!0,t=u0({retryQueue:V},t),L=new rd0(u0(u0({},a),{cdnSettings:Z,cdnURL:v}),t),D$0(L),b=(s=a.plugins)!==null&&s!==void 0?s:[],N=(c=a.classicIntegrations)!==null&&c!==void 0?c:[],F=(m=t.integrations)===null||m===void 0?void 0:m["Segment.io"],fc0.initRemoteMetrics(u0(u0({},Z.metrics),{host:(h=F?.apiHost)!==null&&h!==void 0?h:(p=Z.metrics)===null||p===void 0?void 0:p.host,protocol:F?.protocol})),[4,K$0(a.writeKey,Z,L,t,b,N,n)];case 6:return w=x.sent(),L.initialized=!0,L.emit("initialize",a,t),[4,q$0(L,f,n)];case 7:return x.sent(),[2,[L,w]]}})})}var Q$0=(function(a){kt(t,a);function t(){var n=this,r=Ev(),l=r.promise,i=r.resolve;return n=a.call(this,function(o){return l.then(function(s){var c=s[0],m=s[1];return Y$0(c,m,o)})})||this,n._resolveLoadStart=function(o,s){return i([o,s])},n}return t.prototype.load=function(n,r){return r===void 0&&(r={}),this._resolveLoadStart(n,r),this},t.load=function(n,r){return r===void 0&&(r={}),new t().load(n,r)},t.standalone=function(n,r){return t.load({writeKey:n},r).then(function(l){return l[0]})},t})(qR0);const X$0=a=>{if(!a.writeKey)throw new yr("writeKey","writeKey is missing.")},hd0="2.3.0",J$0=a=>a.replace(/\/$/,""),eD0=(a,t)=>J$0(new URL(t||"",a).href),pd0=32,fd0=480;class tD0{id=ec();items=[];sizeInBytes=0;maxEventCount;constructor(t){this.maxEventCount=Math.max(1,t)}tryAdd(t){if(this.length===this.maxEventCount)return{success:!1,message:`Event limit of ${this.maxEventCount} has been exceeded.`};const n=this.calculateSize(t.context);return n>pd0*1024?{success:!1,message:`Event exceeds maximum event size of ${pd0} KB`}:this.sizeInBytes+n>fd0*1024?{success:!1,message:`Event has caused batch size to exceed ${fd0} KB`}:(this.items.push(t),this.sizeInBytes+=n,{success:!0})}get length(){return this.items.length}calculateSize(t){return encodeURI(JSON.stringify(t.event)).split(/%..|i/).length}getEvents(){return this.items.map(({context:n})=>n.event)}getContexts(){return this.items.map(t=>t.context)}resolveEvents(){this.items.forEach(({resolver:t,context:n})=>t(n))}}const $v=crypto,gd0=a=>a instanceof CryptoKey,oc=new TextEncoder,aF=new TextDecoder;function aD0(...a){const t=a.reduce((l,{length:i})=>l+i,0),n=new Uint8Array(t);let r=0;for(const l of a)n.set(l,r),r+=l.length;return n}const nD0=a=>{let t=a;typeof t=="string"&&(t=oc.encode(t));const n=32768,r=[];for(let l=0;l<t.length;l+=n)r.push(String.fromCharCode.apply(null,t.subarray(l,l+n)));return btoa(r.join(""))},nF=a=>nD0(a).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),rD0=a=>{const t=atob(a),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n},rF=a=>{let t=a;t instanceof Uint8Array&&(t=aF.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return rD0(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class g6 extends Error{constructor(t,n){super(t,n),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}g6.code="ERR_JOSE_GENERIC";class lD0 extends g6{constructor(t,n,r="unspecified",l="unspecified"){super(t,{cause:{claim:r,reason:l,payload:n}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=r,this.reason=l,this.payload=n}}lD0.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class iD0 extends g6{constructor(t,n,r="unspecified",l="unspecified"){super(t,{cause:{claim:r,reason:l,payload:n}}),this.code="ERR_JWT_EXPIRED",this.claim=r,this.reason=l,this.payload=n}}iD0.code="ERR_JWT_EXPIRED";class oD0 extends g6{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}oD0.code="ERR_JOSE_ALG_NOT_ALLOWED";class Dl extends g6{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}Dl.code="ERR_JOSE_NOT_SUPPORTED";class sD0 extends g6{constructor(t="decryption operation failed",n){super(t,n),this.code="ERR_JWE_DECRYPTION_FAILED"}}sD0.code="ERR_JWE_DECRYPTION_FAILED";class cD0 extends g6{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}cD0.code="ERR_JWE_INVALID";class sc extends g6{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}sc.code="ERR_JWS_INVALID";class vd0 extends g6{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}vd0.code="ERR_JWT_INVALID";class dD0 extends g6{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}dD0.code="ERR_JWK_INVALID";class mD0 extends g6{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}mD0.code="ERR_JWKS_INVALID";class uD0 extends g6{constructor(t="no applicable key found in the JSON Web Key Set",n){super(t,n),this.code="ERR_JWKS_NO_MATCHING_KEY"}}uD0.code="ERR_JWKS_NO_MATCHING_KEY";class hD0 extends g6{constructor(t="multiple matching keys found in the JSON Web Key Set",n){super(t,n),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}hD0.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class pD0 extends g6{constructor(t="request timed out",n){super(t,n),this.code="ERR_JWKS_TIMEOUT"}}pD0.code="ERR_JWKS_TIMEOUT";class fD0 extends g6{constructor(t="signature verification failed",n){super(t,n),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}fD0.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function Fr(a,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${a}`)}function ru(a,t){return a.name===t}function lF(a){return parseInt(a.name.slice(4),10)}function gD0(a){switch(a){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function vD0(a,t){if(t.length&&!t.some(n=>a.usages.includes(n))){let n="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();n+=`one of ${t.join(", ")}, or ${r}.`}else t.length===2?n+=`one of ${t[0]} or ${t[1]}.`:n+=`${t[0]}.`;throw new TypeError(n)}}function AD0(a,t,...n){switch(t){case"HS256":case"HS384":case"HS512":{if(!ru(a.algorithm,"HMAC"))throw Fr("HMAC");const r=parseInt(t.slice(2),10);if(lF(a.algorithm.hash)!==r)throw Fr(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!ru(a.algorithm,"RSASSA-PKCS1-v1_5"))throw Fr("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(lF(a.algorithm.hash)!==r)throw Fr(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!ru(a.algorithm,"RSA-PSS"))throw Fr("RSA-PSS");const r=parseInt(t.slice(2),10);if(lF(a.algorithm.hash)!==r)throw Fr(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":{if(a.algorithm.name!=="Ed25519"&&a.algorithm.name!=="Ed448")throw Fr("Ed25519 or Ed448");break}case"Ed25519":{if(!ru(a.algorithm,"Ed25519"))throw Fr("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!ru(a.algorithm,"ECDSA"))throw Fr("ECDSA");const r=gD0(t);if(a.algorithm.namedCurve!==r)throw Fr(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}vD0(a,n)}function Ad0(a,t,...n){if(n=n.filter(Boolean),n.length>2){const r=n.pop();a+=`one of type ${n.join(", ")}, or ${r}.`}else n.length===2?a+=`one of type ${n[0]} or ${n[1]}.`:a+=`of type ${n[0]}.`;return t==null?a+=` Received ${t}`:typeof t=="function"&&t.name?a+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&t.constructor?.name&&(a+=` Received an instance of ${t.constructor.name}`),a}const Zd0=(a,...t)=>Ad0("Key must be ",a,...t);function Hd0(a,t,...n){return Ad0(`Key for the ${a} algorithm must be `,t,...n)}const Ed0=a=>gd0(a)?!0:a?.[Symbol.toStringTag]==="KeyObject",Dv=["CryptoKey"],ZD0=(...a)=>{const t=a.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const r of t){const l=Object.keys(r);if(!n||n.size===0){n=new Set(l);continue}for(const i of l){if(n.has(i))return!1;n.add(i)}}return!0};function HD0(a){return typeof a=="object"&&a!==null}function Md0(a){if(!HD0(a)||Object.prototype.toString.call(a)!=="[object Object]")return!1;if(Object.getPrototypeOf(a)===null)return!0;let t=a;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(a)===t}const ED0=(a,t)=>{if(a.startsWith("RS")||a.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${a} requires key modulusLength to be 2048 bits or larger`)}};function lu(a){return Md0(a)&&typeof a.kty=="string"}function MD0(a){return a.kty!=="oct"&&typeof a.d=="string"}function yD0(a){return a.kty!=="oct"&&typeof a.d>"u"}function VD0(a){return lu(a)&&a.kty==="oct"&&typeof a.k=="string"}function kD0(a){let t,n;switch(a.kty){case"RSA":{switch(a.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${a.alg.slice(-3)}`},n=a.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${a.alg.slice(-3)}`},n=a.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(a.alg.slice(-3),10)||1}`},n=a.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new Dl('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(a.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=a.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=a.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=a.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:a.crv},n=a.d?["deriveBits"]:[];break;default:throw new Dl('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(a.alg){case"Ed25519":t={name:"Ed25519"},n=a.d?["sign"]:["verify"];break;case"EdDSA":t={name:a.crv},n=a.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:a.crv},n=a.d?["deriveBits"]:[];break;default:throw new Dl('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new Dl('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const SD0=async a=>{if(!a.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:n}=kD0(a),r=[t,a.ext??!1,a.key_ops??n],l={...a};return delete l.alg,delete l.use,$v.subtle.importKey("jwk",l,...r)},yd0=a=>rF(a);let cc,dc;const Vd0=a=>a?.[Symbol.toStringTag]==="KeyObject",jv=async(a,t,n,r,l=!1)=>{let i=a.get(t);if(i?.[r])return i[r];const o=await SD0({...n,alg:r});return l&&Object.freeze(t),i?i[r]=o:a.set(t,{[r]:o}),o},FD0={normalizePublicKey:(a,t)=>{if(Vd0(a)){let n=a.export({format:"jwk"});return delete n.d,delete n.dp,delete n.dq,delete n.p,delete n.q,delete n.qi,n.k?yd0(n.k):(dc||(dc=new WeakMap),jv(dc,a,n,t))}return lu(a)?a.k?rF(a.k):(dc||(dc=new WeakMap),jv(dc,a,a,t,!0)):a},normalizePrivateKey:(a,t)=>{if(Vd0(a)){let n=a.export({format:"jwk"});return n.k?yd0(n.k):(cc||(cc=new WeakMap),jv(cc,a,n,t))}return lu(a)?a.k?rF(a.k):(cc||(cc=new WeakMap),jv(cc,a,a,t,!0)):a}},m3=(a,t,n=0)=>{n===0&&(t.unshift(t.length),t.unshift(6));const r=a.indexOf(t[0],n);if(r===-1)return!1;const l=a.subarray(r,r+t.length);return l.length!==t.length?!1:l.every((i,o)=>i===t[o])||m3(a,t,r+1)},kd0=a=>{switch(!0){case m3(a,[42,134,72,206,61,3,1,7]):return"P-256";case m3(a,[43,129,4,0,34]):return"P-384";case m3(a,[43,129,4,0,35]):return"P-521";case m3(a,[43,101,110]):return"X25519";case m3(a,[43,101,111]):return"X448";case m3(a,[43,101,112]):return"Ed25519";case m3(a,[43,101,113]):return"Ed448";default:throw new Dl("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},LD0=async(a,t,n,r,l)=>{let i,o;const s=new Uint8Array(atob(n.replace(a,"")).split("").map(c=>c.charCodeAt(0)));switch(r){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:`SHA-${r.slice(-3)}`},o=["sign"];break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${r.slice(-3)}`},o=["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:`SHA-${parseInt(r.slice(-3),10)||1}`},o=["decrypt","unwrapKey"];break;case"ES256":i={name:"ECDSA",namedCurve:"P-256"},o=["sign"];break;case"ES384":i={name:"ECDSA",namedCurve:"P-384"},o=["sign"];break;case"ES512":i={name:"ECDSA",namedCurve:"P-521"},o=["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const c=kd0(s);i=c.startsWith("P-")?{name:"ECDH",namedCurve:c}:{name:c},o=["deriveBits"];break}case"Ed25519":i={name:"Ed25519"},o=["sign"];break;case"EdDSA":i={name:kd0(s)},o=["sign"];break;default:throw new Dl('Invalid or unsupported "alg" (Algorithm) value')}return $v.subtle.importKey(t,s,i,!1,o)},bD0=(a,t,n)=>LD0(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"pkcs8",a,t);async function _D0(a,t,n){if(typeof a!="string"||a.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return bD0(a,t)}const mc=a=>a?.[Symbol.toStringTag],iF=(a,t,n)=>{if(t.use!==void 0&&t.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(t.key_ops!==void 0&&t.key_ops.includes?.(n)!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`);if(t.alg!==void 0&&t.alg!==a)throw new TypeError(`Invalid key for this operation, when present its alg must be ${a}`);return!0},ND0=(a,t,n,r)=>{if(!(t instanceof Uint8Array)){if(r&&lu(t)){if(VD0(t)&&iF(a,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Ed0(t))throw new TypeError(Hd0(a,t,...Dv,"Uint8Array",r?"JSON Web Key":null));if(t.type!=="secret")throw new TypeError(`${mc(t)} instances for symmetric algorithms must be of type "secret"`)}},wD0=(a,t,n,r)=>{if(r&&lu(t))switch(n){case"sign":if(MD0(t)&&iF(a,t,n))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(yD0(t)&&iF(a,t,n))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!Ed0(t))throw new TypeError(Hd0(a,t,...Dv,r?"JSON Web Key":null));if(t.type==="secret")throw new TypeError(`${mc(t)} instances for asymmetric algorithms must not be of type "secret"`);if(n==="sign"&&t.type==="public")throw new TypeError(`${mc(t)} instances for asymmetric algorithm signing must be of type "private"`);if(n==="decrypt"&&t.type==="public")throw new TypeError(`${mc(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&n==="verify"&&t.type==="private")throw new TypeError(`${mc(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&n==="encrypt"&&t.type==="private")throw new TypeError(`${mc(t)} instances for asymmetric algorithm encryption must be of type "public"`)};function Sd0(a,t,n,r){t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?ND0(t,n,r,a):wD0(t,n,r,a)}Sd0.bind(void 0,!1);const CD0=Sd0.bind(void 0,!0);function TD0(a,t,n,r,l){if(l.crit!==void 0&&r?.crit===void 0)throw new a('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(o=>typeof o!="string"||o.length===0))throw new a('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;n!==void 0?i=new Map([...Object.entries(n),...t.entries()]):i=t;for(const o of r.crit){if(!i.has(o))throw new Dl(`Extension Header Parameter "${o}" is not recognized`);if(l[o]===void 0)throw new a(`Extension Header Parameter "${o}" is missing`);if(i.get(o)&&r[o]===void 0)throw new a(`Extension Header Parameter "${o}" MUST be integrity protected`)}return new Set(r.crit)}function ID0(a,t){const n=`SHA-${a.slice(-3)}`;switch(a){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:a.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:t.name};default:throw new Dl(`alg ${a} is not supported either by JOSE or your javascript runtime`)}}async function xD0(a,t,n){if(t=await FD0.normalizePrivateKey(t,a),gd0(t))return AD0(t,a,n),t;if(t instanceof Uint8Array){if(!a.startsWith("HS"))throw new TypeError(Zd0(t,...Dv));return $v.subtle.importKey("raw",t,{hash:`SHA-${a.slice(-3)}`,name:"HMAC"},!1,[n])}throw new TypeError(Zd0(t,...Dv,"Uint8Array","JSON Web Key"))}const u5=a=>Math.floor(a.getTime()/1e3),Fd0=60,Ld0=Fd0*60,oF=Ld0*24,PD0=oF*7,OD0=oF*365.25,RD0=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,sF=a=>{const t=RD0.exec(a);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]),r=t[3].toLowerCase();let l;switch(r){case"sec":case"secs":case"second":case"seconds":case"s":l=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":l=Math.round(n*Fd0);break;case"hour":case"hours":case"hr":case"hrs":case"h":l=Math.round(n*Ld0);break;case"day":case"days":case"d":l=Math.round(n*oF);break;case"week":case"weeks":case"w":l=Math.round(n*PD0);break;default:l=Math.round(n*OD0);break}return t[1]==="-"||t[4]==="ago"?-l:l},$D0=async(a,t,n)=>{const r=await xD0(a,t,"sign");ED0(a,r);const l=await $v.subtle.sign(ID0(a,r.algorithm),r,n);return new Uint8Array(l)};class DD0{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=t}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}async sign(t,n){if(!this._protectedHeader&&!this._unprotectedHeader)throw new sc("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!ZD0(this._protectedHeader,this._unprotectedHeader))throw new sc("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader},l=TD0(sc,new Map([["b64",!0]]),n?.crit,this._protectedHeader,r);let i=!0;if(l.has("b64")&&(i=this._protectedHeader.b64,typeof i!="boolean"))throw new sc('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:o}=r;if(typeof o!="string"||!o)throw new sc('JWS "alg" (Algorithm) Header Parameter missing or invalid');CD0(o,t,"sign");let s=this._payload;i&&(s=oc.encode(nF(s)));let c;this._protectedHeader?c=oc.encode(nF(JSON.stringify(this._protectedHeader))):c=oc.encode("");const m=aD0(c,oc.encode("."),s),h=await $D0(o,t,m),p={signature:nF(h),payload:""};return i&&(p.payload=aF.decode(s)),this._unprotectedHeader&&(p.header=this._unprotectedHeader),this._protectedHeader&&(p.protected=aF.decode(c)),p}}class jD0{constructor(t){this._flattened=new DD0(t)}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}async sign(t,n){const r=await this._flattened.sign(t,n);if(r.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}function h5(a,t){if(!Number.isFinite(t))throw new TypeError(`Invalid ${a} input`);return t}class BD0{constructor(t={}){if(!Md0(t))throw new TypeError("JWT Claims Set MUST be an object");this._payload=t}setIssuer(t){return this._payload={...this._payload,iss:t},this}setSubject(t){return this._payload={...this._payload,sub:t},this}setAudience(t){return this._payload={...this._payload,aud:t},this}setJti(t){return this._payload={...this._payload,jti:t},this}setNotBefore(t){return typeof t=="number"?this._payload={...this._payload,nbf:h5("setNotBefore",t)}:t instanceof Date?this._payload={...this._payload,nbf:h5("setNotBefore",u5(t))}:this._payload={...this._payload,nbf:u5(new Date)+sF(t)},this}setExpirationTime(t){return typeof t=="number"?this._payload={...this._payload,exp:h5("setExpirationTime",t)}:t instanceof Date?this._payload={...this._payload,exp:h5("setExpirationTime",u5(t))}:this._payload={...this._payload,exp:u5(new Date)+sF(t)},this}setIssuedAt(t){return typeof t>"u"?this._payload={...this._payload,iat:u5(new Date)}:t instanceof Date?this._payload={...this._payload,iat:h5("setIssuedAt",u5(t))}:typeof t=="string"?this._payload={...this._payload,iat:h5("setIssuedAt",u5(new Date)+sF(t))}:this._payload={...this._payload,iat:h5("setIssuedAt",t)},this}}class zD0 extends BD0{setProtectedHeader(t){return this._protectedHeader=t,this}async sign(t,n){const r=new jD0(oc.encode(JSON.stringify(this._payload)));if(r.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new vd0("JWTs MUST NOT use unencoded payload");return r.sign(t,n)}}const UD0=a=>!!(a&&typeof a=="object"&&"access_token"in a&&"expires_in"in a&&typeof a.access_token=="string"&&typeof a.expires_in=="number"),qD0=a=>typeof a.text=="function";function GD0(a){const t={};if(!a)return{};if(WD0(a)){for(const[n,r]of a.entries())t[n.toLowerCase()]=r;return t}for(const[n,r]of Object.entries(a))t[n.toLowerCase()]=r;return t}function WD0(a){return typeof a=="object"&&a!==null&&"entries"in Object(a)&&typeof Object(a).entries=="function"}class KD0{alg="RS256";grantType="client_credentials";clientAssertionType="urn:ietf:params:oauth:client-assertion-type:jwt-bearer";clientId;clientKey;keyId;scope;authServer;httpClient;maxRetries;clockSkewInSeconds=0;accessToken;tokenEmitter=new J7;retryCount;pollerTimer;constructor(t){this.keyId=t.keyId,this.clientId=t.clientId,this.clientKey=t.clientKey,this.authServer=t.authServer??"https://oauth2.segment.io",this.scope=t.scope??"tracking_api:write",this.httpClient=t.httpClient,this.maxRetries=t.maxRetries,this.tokenEmitter.on("access_token",n=>{"token"in n&&(this.accessToken=n.token)}),this.retryCount=0}stopPoller(){clearTimeout(this.pollerTimer)}async pollerLoop(){let t=25,n;try{n=await this.requestAccessToken()}catch(l){return this.handleTransientError({error:l})}if(!qD0(n))return this.handleInvalidCustomResponse();const r=GD0(n.headers);if(r.date&&this.updateClockSkew(Date.parse(r.date)),n.status===200)try{const l=await n.text(),i=JSON.parse(l);if(!UD0(i))throw new Error("Response did not contain a valid access_token and expires_in");return i.expires_at=Math.round(Date.now()/1e3)+i.expires_in,this.tokenEmitter.emit("access_token",{token:i}),this.retryCount=0,t=i.expires_in/2*1e3,this.queueNextPoll(t)}catch(l){return this.handleTransientError({error:l,forceEmitError:!0})}else return n.status===429?await this.handleRateLimited(n,r,t):[400,401,415].includes(n.status)?this.handleUnrecoverableErrors(n):this.handleTransientError({error:new Error(`[${n.status}] ${n.statusText}`)})}handleTransientError({error:t,forceEmitError:n}){this.incrementRetries({error:t,forceEmitError:n});const r=wS({attempt:this.retryCount,minTimeout:25,maxTimeout:1e3});this.queueNextPoll(r)}handleInvalidCustomResponse(){this.tokenEmitter.emit("access_token",{error:new Error("HTTPClient does not implement response.text method")})}async handleRateLimited(t,n,r){if(this.incrementRetries({error:new Error(`[${t.status}] ${t.statusText}`)}),n["x-ratelimit-reset"]){const l=parseInt(n["x-ratelimit-reset"],10);isFinite(l)?r=l-Date.now()+this.clockSkewInSeconds*1e3:r=5*1e3,await lc0(r),r=0}this.queueNextPoll(r)}handleUnrecoverableErrors(t){this.retryCount=0,this.tokenEmitter.emit("access_token",{error:new Error(`[${t.status}] ${t.statusText}`)}),this.stopPoller()}updateClockSkew(t){this.clockSkewInSeconds=(Date.now()-t)/1e3}incrementRetries({error:t,forceEmitError:n}){this.retryCount++,(n||this.retryCount%this.maxRetries===0)&&(this.retryCount=0,this.tokenEmitter.emit("access_token",{error:t}))}queueNextPoll(t){this.pollerTimer=setTimeout(()=>this.pollerLoop(),t),this.pollerTimer.unref&&this.pollerTimer.unref()}async requestAccessToken(){const l=ec(),i=Math.round(Date.now()/1e3)-this.clockSkewInSeconds,o={iss:this.clientId,sub:this.clientId,aud:this.authServer,iat:i-5,exp:i+55,jti:l},s=await _D0(this.clientKey,"RS256"),c=await new zD0(o).setProtectedHeader({alg:this.alg,kid:this.keyId,typ:"JWT"}).sign(s),m=`grant_type=${this.grantType}&client_assertion_type=${this.clientAssertionType}&client_assertion=${c}&scope=${this.scope}`,p={method:"POST",url:`${this.authServer}/token`,body:m,headers:{"Content-Type":"application/x-www-form-urlencoded"},httpRequestTimeout:1e4};return this.httpClient.makeRequest(p)}async getAccessToken(){return this.isValidToken(this.accessToken)?this.accessToken:(this.stopPoller(),this.pollerLoop().catch(()=>{}),new Promise((t,n)=>{this.tokenEmitter.once("access_token",r=>{"token"in r?t(r.token):n(r.error)})}))}clearToken(){this.accessToken=void 0}isValidToken(t){return typeof t<"u"&&t!==null&&t.expires_in<Date.now()/1e3}}function YD0(a){return new Promise(t=>setTimeout(t,a))}function iu(){}class QD0{pendingFlushTimeout;_batch;_flushInterval;_flushAt;_maxRetries;_url;_flushPendingItemsCount;_httpRequestTimeout;_emitter;_disable;_httpClient;_writeKey;_tokenManager;constructor({host:t,path:n,maxRetries:r,flushAt:l,flushInterval:i,writeKey:o,httpRequestTimeout:s,httpClient:c,disable:m,oauthSettings:h},p){this._emitter=p,this._maxRetries=r,this._flushAt=Math.max(l,1),this._flushInterval=i,this._url=eD0(t??"https://api.segment.io",n??"/v1/batch"),this._httpRequestTimeout=s??1e4,this._disable=!!m,this._httpClient=c,this._writeKey=o,h&&(this._tokenManager=new KD0({...h,httpClient:h.httpClient??c,maxRetries:h.maxRetries??r}))}createBatch(){this.pendingFlushTimeout&&clearTimeout(this.pendingFlushTimeout);const t=new tD0(this._flushAt);return this._batch=t,this.pendingFlushTimeout=setTimeout(()=>{t===this._batch&&(this._batch=void 0),this.pendingFlushTimeout=void 0,t.length&&this.send(t).catch(iu)},this._flushInterval),t}clearBatch(){this.pendingFlushTimeout&&clearTimeout(this.pendingFlushTimeout),this._batch=void 0}flush(t){if(!t){this._tokenManager&&this._tokenManager.stopPoller();return}if(this._flushPendingItemsCount=t,!this._batch)return;this._batch.length===t&&(this.send(this._batch).catch(iu).finally(()=>{this._tokenManager&&this._tokenManager.stopPoller()}),this.clearBatch())}enqueue(t){const n=this._batch??this.createBatch(),{promise:r,resolve:l}=Ev(),i={context:t,resolver:l};if(n.tryAdd(i).success){const m=n.length===this._flushPendingItemsCount;return(n.length===this._flushAt||m)&&(this.send(n).catch(iu),this.clearBatch()),r}n.length&&(this.send(n).catch(iu),this.clearBatch());const s=this.createBatch(),c=s.tryAdd(i);return c.success?(s.length===this._flushPendingItemsCount&&(this.send(s).catch(iu),this.clearBatch()),r):(t.setFailedDelivery({reason:new Error(c.message)}),Promise.resolve(t))}async send(t){this._flushPendingItemsCount&&(this._flushPendingItemsCount-=t.length);const n=t.getEvents(),r=this._maxRetries+1;let l=0;for(;l<r;){l++;let i,o;try{if(this._disable)return t.resolveEvents();let s;if(this._tokenManager){const p=await this._tokenManager.getAccessToken();p&&p.access_token&&(s=`Bearer ${p.access_token}`)}const c={"Content-Type":"application/json","User-Agent":"analytics-node-next/latest",...s?{Authorization:s}:{}},m={url:this._url,method:"POST",headers:c,body:JSON.stringify({batch:n,writeKey:this._writeKey,sentAt:new Date}),httpRequestTimeout:this._httpRequestTimeout};this._emitter.emit("http_request",{body:m.body,method:m.method,url:m.url,headers:m.headers});const h=await this._httpClient.makeRequest(m);if(h.status>=200&&h.status<300){t.resolveEvents();return}else if(this._tokenManager&&(h.status===400||h.status===401||h.status===403))this._tokenManager.clearToken(),o=new Error(`[${h.status}] ${h.statusText}`);else if(h.status===400){bd0(t,new Error(`[${h.status}] ${h.statusText}`));return}else if(h.status===429){if(h.headers&&"x-ratelimit-reset"in h.headers){const p=parseInt(h.headers["x-ratelimit-reset"],10);isFinite(p)&&(i=p-Date.now())}o=new Error(`[${h.status}] ${h.statusText}`)}else o=new Error(`[${h.status}] ${h.statusText}`)}catch(s){o=s}if(l===r){bd0(t,o);return}await YD0(i||wS({attempt:l,minTimeout:25,maxTimeout:1e3}))}}}function bd0(a,t){a.getContexts().forEach(n=>n.setFailedDelivery({reason:t})),a.resolveEvents()}var _d0={};const Nd0=()=>typeof process=="object"&&process&&typeof _d0=="object"&&_d0&&typeof process.version=="string"?"node":typeof window=="object"?"browser":typeof WebSocketPair<"u"?"cloudflare-worker":typeof EdgeRuntime=="string"?"vercel-edge":typeof WorkerGlobalScope<"u"&&typeof importScripts=="function"?"web-worker":"unknown";function XD0(a){a.updateEvent("context.library.name","@segment/analytics-node"),a.updateEvent("context.library.version",hd0);const t=Nd0();t==="node"&&a.updateEvent("_metadata.nodeVersion",process.version),a.updateEvent("_metadata.jsRuntime",t)}function JD0(a){function t(n){return XD0(n),a.enqueue(n)}return{name:"Segment.io",type:"destination",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),alias:t,group:t,identify:t,page:t,screen:t,track:t}}const ej0=(a,t)=>{const n=new QD0(a,t);return{publisher:n,plugin:JD0(n)}},tj0=()=>`node-next-${Date.now()}-${ec()}`;class aj0 extends rc0{constructor(){super({createMessageId:tj0,onFinishedEvent:t=>{UO0(t)}})}}let cF=class extends eu{static system(){return new this({type:"track",event:"system"})}};const nj0=a=>t=>{const n=t.failedDelivery();return a(n?n.reason:void 0,t)},rj0=async(a,t,n,r)=>{try{const l=new cF(a),i=await cc0(l,t,n,{...r?{callback:nj0(r)}:{}}),o=i.failedDelivery();o?n.emit("error",{code:"delivery_failure",reason:o.reason,ctx:i}):n.emit(a.type,i)}catch(l){n.emit("error",{code:"unknown",reason:l})}};class lj0 extends J7{}class ij0 extends Jm{constructor(){super(1,[])}getAttempts(t){return t.attempts??0}updateAttempts(t){return t.attempts=this.getAttempts(t)+1,this.getAttempts(t)}}class oj0 extends sc0{constructor(){super(new ij0)}}class sj0{onabort=null;aborted=!1;eventEmitter=new J7;toString(){return"[object AbortSignal]"}get[Symbol.toStringTag](){return"AbortSignal"}removeEventListener(...t){this.eventEmitter.off(...t)}addEventListener(...t){this.eventEmitter.on(...t)}dispatchEvent(t){const n={type:t,target:this},r=`on${t}`;typeof this[r]=="function"&&this[r](n),this.eventEmitter.emit(t,n)}}let cj0=class{signal=new sj0;abort(){this.signal.aborted||(this.signal.aborted=!0,this.signal.dispatchEvent("abort"))}toString(){return"[object AbortController]"}get[Symbol.toStringTag](){return"AbortController"}};const dj0=a=>{if(Nd0()==="cloudflare-worker")return[];const t=new(globalThis.AbortController||cj0),n=setTimeout(()=>{t.abort()},a);return n?.unref?.(),[t.signal,n]},mj0=async(...a)=>{if(globalThis.fetch)return globalThis.fetch(...a);if(typeof EdgeRuntime!="string")return(await Promise.resolve().then(()=>cu1)).default(...a);throw new Error("Invariant: an edge runtime that does not support fetch should not exist")};class wd0{_fetch;constructor(t){this._fetch=t??mj0}async makeRequest(t){const[n,r]=dj0(t.httpRequestTimeout),l={url:t.url,method:t.method,headers:t.headers,body:t.body,signal:n};return this._fetch(t.url,l).finally(()=>clearTimeout(r))}}class uj0 extends lj0{_eventFactory;_isClosed=!1;_pendingEvents=0;_closeAndFlushDefaultTimeout;_publisher;_isFlushing=!1;_queue;ready;constructor(t){super(),X$0(t),this._eventFactory=new aj0,this._queue=new oj0;const n=t.flushInterval??1e4;this._closeAndFlushDefaultTimeout=n*1.25;const{plugin:r,publisher:l}=ej0({writeKey:t.writeKey,host:t.host,path:t.path,maxRetries:t.maxRetries??3,flushAt:t.flushAt??t.maxEventsInBatch??15,httpRequestTimeout:t.httpRequestTimeout,disable:t.disable,flushInterval:n,httpClient:typeof t.httpClient=="function"?new wd0(t.httpClient):t.httpClient??new wd0,oauthSettings:t.oauthSettings},this);this._publisher=l,this.ready=this.register(r).then(()=>{}),this.emit("initialize",t),dR0(this)}get VERSION(){return hd0}closeAndFlush({timeout:t=this._closeAndFlushDefaultTimeout}={}){return this.flush({timeout:t,close:!0})}async flush({timeout:t,close:n=!1}={}){if(this._isFlushing){console.warn("Overlapping flush calls detected. Please wait for the previous flush to finish before calling .flush again");return}else this._isFlushing=!0;n&&(this._isClosed=!0),this._publisher.flush(this._pendingEvents);const r=new Promise(l=>{this._pendingEvents?this.once("drained",()=>{l()}):l()}).finally(()=>{this._isFlushing=!1});return t?Hv(r,t).catch(()=>{}):r}_dispatch(t,n){if(this._isClosed){this.emit("call_after_close",t);return}this._pendingEvents++,rj0(t,this._queue,this,n).catch(r=>r).finally(()=>{this._pendingEvents--,this._pendingEvents||this.emit("drained")})}alias({userId:t,previousId:n,context:r,timestamp:l,integrations:i,messageId:o},s){const c=this._eventFactory.alias(t,n,{context:r,integrations:i,timestamp:l,messageId:o});this._dispatch(c,s)}group({timestamp:t,groupId:n,userId:r,anonymousId:l,traits:i={},context:o,integrations:s,messageId:c},m){const h=this._eventFactory.group(n,i,{context:o,anonymousId:l,userId:r,timestamp:t,integrations:s,messageId:c});this._dispatch(h,m)}identify({userId:t,anonymousId:n,traits:r={},context:l,timestamp:i,integrations:o,messageId:s},c){const m=this._eventFactory.identify(t,r,{context:l,anonymousId:n,userId:t,timestamp:i,integrations:o,messageId:s});this._dispatch(m,c)}page({userId:t,anonymousId:n,category:r,name:l,properties:i,context:o,timestamp:s,integrations:c,messageId:m},h){const p=this._eventFactory.page(r??null,l??null,i,{context:o,anonymousId:n,userId:t,timestamp:s,integrations:c,messageId:m});this._dispatch(p,h)}screen({userId:t,anonymousId:n,category:r,name:l,properties:i,context:o,timestamp:s,integrations:c,messageId:m},h){const p=this._eventFactory.screen(r??null,l??null,i,{context:o,anonymousId:n,userId:t,timestamp:s,integrations:c,messageId:m});this._dispatch(p,h)}track({userId:t,anonymousId:n,event:r,properties:l,context:i,timestamp:o,integrations:s,messageId:c},m){const h=this._eventFactory.track(r,l,{context:i,userId:t,anonymousId:n,timestamp:o,integrations:s,messageId:c});this._dispatch(h,m)}register(...t){return this._queue.criticalTasks.run(async()=>{const n=cF.system(),r=t.map(l=>this._queue.register(n,l,this));await Promise.all(r),this.emit("register",t.map(l=>l.name))})}async deregister(...t){const n=cF.system(),r=t.map(l=>{const i=this._queue.plugins.find(o=>o.name===l);if(i)return this._queue.deregister(n,i,this);n.log("warn",`plugin ${l} not found`)});await Promise.all(r),this.emit("deregister",t)}}function hj0(a,t){return{track:(n,r={})=>{a.track(n,r)},page:(n,r={})=>{n?a.page(n,r):a.page(r)},screen:(n,r={})=>{a.track(`Viewed ${n} Screen`,r)},identify:(n,r={})=>{if(!n)return;const l={campusName:r?.campus,church:r?.church,email:r?.email,firstName:r?.firstName,lastName:r?.lastName,nickName:r?.nickName,userId:r?.id,originId:r?.originId,originType:r?.originType,apollosId:n},i=t.clientManaged&&r?.originId?r.originId:n;a.identify(i,l)},group:(n,r={})=>{n&&a.group(n,r)},alias:n=>{a.alias(n)},reset:()=>{a.reset()},flush:()=>{}}}function pj0(a,t){let n;const r=`anon-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return{track:(l,i={})=>{a.track({event:l,properties:i,...n?{userId:n}:{anonymousId:r}})},page:(l,i={})=>{a.page({name:l,properties:i,...n?{userId:n}:{anonymousId:r}})},screen:(l,i={})=>{a.screen({name:l,properties:i,...n?{userId:n}:{anonymousId:r}})},identify:(l,i={})=>{if(!l)return;const o={campusName:i?.campus,church:i?.church,email:i?.email,firstName:i?.firstName,lastName:i?.lastName,nickName:i?.nickName,userId:i?.id,originId:i?.originId,originType:i?.originType,apollosId:l},s=t.clientManaged&&i?.originId?i.originId:l;n=s,a.identify({userId:s,traits:o})},group:(l,i={})=>{l&&n&&a.group({groupId:l,userId:n,traits:i})},alias:l=>{n&&a.alias({userId:l,previousId:n})},reset:()=>{n=void 0},flush:()=>{a.flush()}}}const Cd0=a=>{if(!a?.writeKey)return null;const t=typeof navigator<"u"?tc0(navigator.userAgent):!0;try{if(t){const n=new uj0({writeKey:a.writeKey});return pj0(n,a)}else{const n=Q$0.load({writeKey:a.writeKey});return hj0(n,a)}}catch(n){return console.error("Error initializing Segment client:",n),null}},fj0=(a,t)=>a?.apiKey?a.amplitudeBrowser?vj0(a,t):a.amplitudeJS?gj0(a,t):(console.error("No Amplitude library provided. Please pass either amplitudeJS or amplitudeBrowser."),null):null,gj0=(a,t)=>{if(!a.amplitudeJS)return console.error("amplitude-js library not provided. Please pass amplitudeJS to use legacy Amplitude tracking."),{track:()=>{},identify:()=>{}};const n=a.amplitudeJS.getInstance();if(n.init(a.apiKey),t?.profile?.id){const r={email:t.profile.email,firstName:t.profile.firstName,lastName:t.profile.lastName,userId:t.profile.id};n.setUserId(t.profile.id),n.setUserProperties(r)}return{track:(r,l={})=>{n.logEvent(r,l)},identify:(r,l={})=>{n.setUserId(r),n.setUserProperties(l)}}},vj0=(a,t)=>{if(!a.amplitudeBrowser)return console.error("@amplitude/analytics-browser library not provided. Please pass amplitudeBrowser to use browser Amplitude tracking."),{track:()=>{},identify:()=>{}};const n=a.amplitudeBrowser;if(n.init(a.apiKey),t?.profile?.id){const r=new n.Identify;t.profile.email&&r.set("email",t.profile.email),t.profile.firstName&&r.set("firstName",t.profile.firstName),t.profile.lastName&&r.set("lastName",t.profile.lastName),r.set("userId",t.profile.id),n.identify(r,{user_id:t.profile.id})}return{track:(r,l={})=>{n.track(r,l)},identify:(r,l={})=>{const i=new n.Identify;Object.entries(l).forEach(([o,s])=>{(typeof s=="string"||typeof s=="number"||typeof s=="boolean"||Array.isArray(s))&&i.set(o,s)}),n.identify(i,{user_id:r})}}},Aj0=(a,t,n,r)=>{if(a)if(r){if(t?.profile?.id){const l=new r.Identify;t.profile.email&&l.set("email",t.profile.email),t.profile.firstName&&l.set("firstName",t.profile.firstName),t.profile.lastName&&l.set("lastName",t.profile.lastName),l.set("userId",t.profile.id),r.identify(l,{user_id:t.profile.id})}}else if(n){const l=n.getInstance();if(t?.profile?.id){const i={email:t.profile.email,firstName:t.profile.firstName,lastName:t.profile.lastName,userId:t.profile.id};l.setUserId(t.profile.id),l.setUserProperties(i)}}else console.error("No Amplitude library provided for reinitialization. Please pass either amplitudeJS or amplitudeBrowser.")},Td0=e.createContext({track:(...a)=>(console.info("Uninitialized Analytics.track",...a),Promise.resolve()),page:(...a)=>(console.info("Uninitialized Analytics.page",...a),Promise.resolve()),screen:(...a)=>(console.info("Uninitialized Analytics.screen",...a),Promise.resolve()),identify:(...a)=>(console.info("Uninitialized Analytics.identify",...a),Promise.resolve()),group:(...a)=>(console.info("Uninitialized Analytics.group",...a),Promise.resolve()),alias:(...a)=>(console.info("Uninitialized Analytics.alias",...a),Promise.resolve()),reset:(...a)=>(console.info("Uninitialized Analytics.reset",...a),Promise.resolve()),flush:(...a)=>(console.info("Uninitialized Analytics.flush",...a),Promise.resolve())}),Zj0=({children:a,coreSegmentKey:t,churchSegmentKey:n,amplitudeKey:r,amplitudeJS:l,amplitudeBrowser:i,currentUser:o=null,currentChurch:s=null,standardProperties:c={},churchSegmentClientManaged:m=!0})=>{const h=typeof navigator<"u"?tc0(navigator.userAgent):!1,p=e.useMemo(()=>{if(h)return[];const E=[];if(t){const M=Cd0({writeKey:t,clientManaged:!1});M&&E.push(M)}if(n&&n!==t){const M=Cd0({writeKey:n,clientManaged:m});M&&E.push(M)}return E.filter(Boolean)},[t,n,m,h]),f=e.useMemo(()=>typeof window>"u"||typeof navigator>"u"||h||!r?null:fj0({apiKey:r,amplitudeJS:l,amplitudeBrowser:i},o),[r,l,i,o,h]);e.useEffect(()=>{!h&&r&&o&&Aj0(r,o,l,i)},[r,o,l,i,h]);const v=e.useMemo(()=>{const E=(M={})=>{const V={...M,...c};return o?.originId&&(V.userOriginId=o.originId,V.userOriginType=o.originType),s?.slug&&(V.church=s.slug),V};return{track:async(M,V={})=>{const L=E(V);p.forEach(b=>b.track(M,L)),f?.track(M,L)},page:async(M,V={})=>{const L=E(V);p.forEach(b=>b.page(M,L)),f&&f.track(M||"Page View",L)},screen:async(M,V={})=>{const L=E(V);p.forEach(b=>b.screen(M,L)),f?.track(M,L)},identify:async(M,V={})=>{p.forEach(L=>L.identify(M,V)),f?.identify(M,V)},group:async(M,V={})=>{p.forEach(L=>L.group(M,V))},alias:async M=>{p.forEach(V=>V.alias(M))},reset:async()=>{p.forEach(M=>M.reset())},flush:async()=>{p.forEach(M=>M.flush())}}},[p,f,o?.originId,o?.originType,s?.slug,c]);e.useEffect(()=>{o?.profile?.id&&v.identify(o.profile.id,{...o.profile,originId:o.originId,originType:o.originType,avatar:o.profile.photo?.uri,church:s?.slug})},[o?.profile]),e.useEffect(()=>{s?.slug&&v.group(s.slug,{name:s.name})},[s?.slug,s?.name]);const Z=e.useRef();return e.useEffect(()=>{const E=o?.profile?.id;E&&(Z.current&&Z.current!==E&&(v.reset(),s?.slug&&v.group(s.slug,{name:s.name})),Z.current=E)},[v,o?.profile?.id,s?.slug,s?.name]),T.jsx(Td0.Provider,{value:v,children:a})},Bv=()=>e.useContext(Td0);function Id0(a){var t,n,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var l=a.length;for(t=0;t<l;t++)a[t]&&(n=Id0(a[t]))&&(r&&(r+=" "),r+=n)}else for(n in a)a[n]&&(r&&(r+=" "),r+=n);return r}function ke(){for(var a,t,n=0,r="",l=arguments.length;n<l;n++)(a=arguments[n])&&(t=Id0(a))&&(r&&(r+=" "),r+=t);return r}var dF={exports:{}},mF,xd0;function Pd0(){return xd0||(xd0=1,mF={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),mF}var uF={exports:{}},hF,Od0;function Hj0(){return Od0||(Od0=1,hF=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")}),hF}var Rd0;function Ej0(){if(Rd0)return uF.exports;Rd0=1;var a=Hj0(),t=Array.prototype.concat,n=Array.prototype.slice,r=uF.exports=function(i){for(var o=[],s=0,c=i.length;s<c;s++){var m=i[s];a(m)?o=t.call(o,n.call(m)):o.push(m)}return o};return r.wrap=function(l){return function(){return l(r(arguments))}},uF.exports}var $d0;function Mj0(){if($d0)return dF.exports;$d0=1;var a=Pd0(),t=Ej0(),n=Object.hasOwnProperty,r=Object.create(null);for(var l in a)n.call(a,l)&&(r[a[l]]=l);var i=dF.exports={to:{},get:{}};i.get=function(c){var m=c.substring(0,3).toLowerCase(),h,p;switch(m){case"hsl":h=i.get.hsl(c),p="hsl";break;case"hwb":h=i.get.hwb(c),p="hwb";break;default:h=i.get.rgb(c),p="rgb";break}return h?{model:p,value:h}:null},i.get.rgb=function(c){if(!c)return null;var m=/^#([a-f0-9]{3,4})$/i,h=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,p=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,f=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,v=/^(\w+)$/,Z=[0,0,0,1],E,M,V;if(E=c.match(h)){for(V=E[2],E=E[1],M=0;M<3;M++){var L=M*2;Z[M]=parseInt(E.slice(L,L+2),16)}V&&(Z[3]=parseInt(V,16)/255)}else if(E=c.match(m)){for(E=E[1],V=E[3],M=0;M<3;M++)Z[M]=parseInt(E[M]+E[M],16);V&&(Z[3]=parseInt(V+V,16)/255)}else if(E=c.match(p)){for(M=0;M<3;M++)Z[M]=parseInt(E[M+1],0);E[4]&&(E[5]?Z[3]=parseFloat(E[4])*.01:Z[3]=parseFloat(E[4]))}else if(E=c.match(f)){for(M=0;M<3;M++)Z[M]=Math.round(parseFloat(E[M+1])*2.55);E[4]&&(E[5]?Z[3]=parseFloat(E[4])*.01:Z[3]=parseFloat(E[4]))}else return(E=c.match(v))?E[1]==="transparent"?[0,0,0,0]:n.call(a,E[1])?(Z=a[E[1]],Z[3]=1,Z):null:null;for(M=0;M<3;M++)Z[M]=o(Z[M],0,255);return Z[3]=o(Z[3],0,1),Z},i.get.hsl=function(c){if(!c)return null;var m=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,h=c.match(m);if(h){var p=parseFloat(h[4]),f=(parseFloat(h[1])%360+360)%360,v=o(parseFloat(h[2]),0,100),Z=o(parseFloat(h[3]),0,100),E=o(isNaN(p)?1:p,0,1);return[f,v,Z,E]}return null},i.get.hwb=function(c){if(!c)return null;var m=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,h=c.match(m);if(h){var p=parseFloat(h[4]),f=(parseFloat(h[1])%360+360)%360,v=o(parseFloat(h[2]),0,100),Z=o(parseFloat(h[3]),0,100),E=o(isNaN(p)?1:p,0,1);return[f,v,Z,E]}return null},i.to.hex=function(){var c=t(arguments);return"#"+s(c[0])+s(c[1])+s(c[2])+(c[3]<1?s(Math.round(c[3]*255)):"")},i.to.rgb=function(){var c=t(arguments);return c.length<4||c[3]===1?"rgb("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+")":"rgba("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+", "+c[3]+")"},i.to.rgb.percent=function(){var c=t(arguments),m=Math.round(c[0]/255*100),h=Math.round(c[1]/255*100),p=Math.round(c[2]/255*100);return c.length<4||c[3]===1?"rgb("+m+"%, "+h+"%, "+p+"%)":"rgba("+m+"%, "+h+"%, "+p+"%, "+c[3]+")"},i.to.hsl=function(){var c=t(arguments);return c.length<4||c[3]===1?"hsl("+c[0]+", "+c[1]+"%, "+c[2]+"%)":"hsla("+c[0]+", "+c[1]+"%, "+c[2]+"%, "+c[3]+")"},i.to.hwb=function(){var c=t(arguments),m="";return c.length>=4&&c[3]!==1&&(m=", "+c[3]),"hwb("+c[0]+", "+c[1]+"%, "+c[2]+"%"+m+")"},i.to.keyword=function(c){return r[c.slice(0,3)]};function o(c,m,h){return Math.min(Math.max(m,c),h)}function s(c){var m=Math.round(c).toString(16).toUpperCase();return m.length<2?"0"+m:m}return dF.exports}var pF,Dd0;function jd0(){if(Dd0)return pF;Dd0=1;const a=Pd0(),t={};for(const l of Object.keys(a))t[a[l]]=l;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};pF=n;for(const l of Object.keys(n)){if(!("channels"in n[l]))throw new Error("missing channels property: "+l);if(!("labels"in n[l]))throw new Error("missing channel labels property: "+l);if(n[l].labels.length!==n[l].channels)throw new Error("channel and label counts mismatch: "+l);const{channels:i,labels:o}=n[l];delete n[l].channels,delete n[l].labels,Object.defineProperty(n[l],"channels",{value:i}),Object.defineProperty(n[l],"labels",{value:o})}n.rgb.hsl=function(l){const i=l[0]/255,o=l[1]/255,s=l[2]/255,c=Math.min(i,o,s),m=Math.max(i,o,s),h=m-c;let p,f;m===c?p=0:i===m?p=(o-s)/h:o===m?p=2+(s-i)/h:s===m&&(p=4+(i-o)/h),p=Math.min(p*60,360),p<0&&(p+=360);const v=(c+m)/2;return m===c?f=0:v<=.5?f=h/(m+c):f=h/(2-m-c),[p,f*100,v*100]},n.rgb.hsv=function(l){let i,o,s,c,m;const h=l[0]/255,p=l[1]/255,f=l[2]/255,v=Math.max(h,p,f),Z=v-Math.min(h,p,f),E=function(M){return(v-M)/6/Z+1/2};return Z===0?(c=0,m=0):(m=Z/v,i=E(h),o=E(p),s=E(f),h===v?c=s-o:p===v?c=1/3+i-s:f===v&&(c=2/3+o-i),c<0?c+=1:c>1&&(c-=1)),[c*360,m*100,v*100]},n.rgb.hwb=function(l){const i=l[0],o=l[1];let s=l[2];const c=n.rgb.hsl(l)[0],m=1/255*Math.min(i,Math.min(o,s));return s=1-1/255*Math.max(i,Math.max(o,s)),[c,m*100,s*100]},n.rgb.cmyk=function(l){const i=l[0]/255,o=l[1]/255,s=l[2]/255,c=Math.min(1-i,1-o,1-s),m=(1-i-c)/(1-c)||0,h=(1-o-c)/(1-c)||0,p=(1-s-c)/(1-c)||0;return[m*100,h*100,p*100,c*100]};function r(l,i){return(l[0]-i[0])**2+(l[1]-i[1])**2+(l[2]-i[2])**2}return n.rgb.keyword=function(l){const i=t[l];if(i)return i;let o=1/0,s;for(const c of Object.keys(a)){const m=a[c],h=r(l,m);h<o&&(o=h,s=c)}return s},n.keyword.rgb=function(l){return a[l]},n.rgb.xyz=function(l){let i=l[0]/255,o=l[1]/255,s=l[2]/255;i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,o=o>.04045?((o+.055)/1.055)**2.4:o/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;const c=i*.4124+o*.3576+s*.1805,m=i*.2126+o*.7152+s*.0722,h=i*.0193+o*.1192+s*.9505;return[c*100,m*100,h*100]},n.rgb.lab=function(l){const i=n.rgb.xyz(l);let o=i[0],s=i[1],c=i[2];o/=95.047,s/=100,c/=108.883,o=o>.008856?o**(1/3):7.787*o+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,c=c>.008856?c**(1/3):7.787*c+16/116;const m=116*s-16,h=500*(o-s),p=200*(s-c);return[m,h,p]},n.hsl.rgb=function(l){const i=l[0]/360,o=l[1]/100,s=l[2]/100;let c,m,h;if(o===0)return h=s*255,[h,h,h];s<.5?c=s*(1+o):c=s+o-s*o;const p=2*s-c,f=[0,0,0];for(let v=0;v<3;v++)m=i+1/3*-(v-1),m<0&&m++,m>1&&m--,6*m<1?h=p+(c-p)*6*m:2*m<1?h=c:3*m<2?h=p+(c-p)*(2/3-m)*6:h=p,f[v]=h*255;return f},n.hsl.hsv=function(l){const i=l[0];let o=l[1]/100,s=l[2]/100,c=o;const m=Math.max(s,.01);s*=2,o*=s<=1?s:2-s,c*=m<=1?m:2-m;const h=(s+o)/2,p=s===0?2*c/(m+c):2*o/(s+o);return[i,p*100,h*100]},n.hsv.rgb=function(l){const i=l[0]/60,o=l[1]/100;let s=l[2]/100;const c=Math.floor(i)%6,m=i-Math.floor(i),h=255*s*(1-o),p=255*s*(1-o*m),f=255*s*(1-o*(1-m));switch(s*=255,c){case 0:return[s,f,h];case 1:return[p,s,h];case 2:return[h,s,f];case 3:return[h,p,s];case 4:return[f,h,s];case 5:return[s,h,p]}},n.hsv.hsl=function(l){const i=l[0],o=l[1]/100,s=l[2]/100,c=Math.max(s,.01);let m,h;h=(2-o)*s;const p=(2-o)*c;return m=o*c,m/=p<=1?p:2-p,m=m||0,h/=2,[i,m*100,h*100]},n.hwb.rgb=function(l){const i=l[0]/360;let o=l[1]/100,s=l[2]/100;const c=o+s;let m;c>1&&(o/=c,s/=c);const h=Math.floor(6*i),p=1-s;m=6*i-h,(h&1)!==0&&(m=1-m);const f=o+m*(p-o);let v,Z,E;switch(h){default:case 6:case 0:v=p,Z=f,E=o;break;case 1:v=f,Z=p,E=o;break;case 2:v=o,Z=p,E=f;break;case 3:v=o,Z=f,E=p;break;case 4:v=f,Z=o,E=p;break;case 5:v=p,Z=o,E=f;break}return[v*255,Z*255,E*255]},n.cmyk.rgb=function(l){const i=l[0]/100,o=l[1]/100,s=l[2]/100,c=l[3]/100,m=1-Math.min(1,i*(1-c)+c),h=1-Math.min(1,o*(1-c)+c),p=1-Math.min(1,s*(1-c)+c);return[m*255,h*255,p*255]},n.xyz.rgb=function(l){const i=l[0]/100,o=l[1]/100,s=l[2]/100;let c,m,h;return c=i*3.2406+o*-1.5372+s*-.4986,m=i*-.9689+o*1.8758+s*.0415,h=i*.0557+o*-.204+s*1.057,c=c>.0031308?1.055*c**(1/2.4)-.055:c*12.92,m=m>.0031308?1.055*m**(1/2.4)-.055:m*12.92,h=h>.0031308?1.055*h**(1/2.4)-.055:h*12.92,c=Math.min(Math.max(0,c),1),m=Math.min(Math.max(0,m),1),h=Math.min(Math.max(0,h),1),[c*255,m*255,h*255]},n.xyz.lab=function(l){let i=l[0],o=l[1],s=l[2];i/=95.047,o/=100,s/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const c=116*o-16,m=500*(i-o),h=200*(o-s);return[c,m,h]},n.lab.xyz=function(l){const i=l[0],o=l[1],s=l[2];let c,m,h;m=(i+16)/116,c=o/500+m,h=m-s/200;const p=m**3,f=c**3,v=h**3;return m=p>.008856?p:(m-16/116)/7.787,c=f>.008856?f:(c-16/116)/7.787,h=v>.008856?v:(h-16/116)/7.787,c*=95.047,m*=100,h*=108.883,[c,m,h]},n.lab.lch=function(l){const i=l[0],o=l[1],s=l[2];let c;c=Math.atan2(s,o)*360/2/Math.PI,c<0&&(c+=360);const h=Math.sqrt(o*o+s*s);return[i,h,c]},n.lch.lab=function(l){const i=l[0],o=l[1],c=l[2]/360*2*Math.PI,m=o*Math.cos(c),h=o*Math.sin(c);return[i,m,h]},n.rgb.ansi16=function(l,i=null){const[o,s,c]=l;let m=i===null?n.rgb.hsv(l)[2]:i;if(m=Math.round(m/50),m===0)return 30;let h=30+(Math.round(c/255)<<2|Math.round(s/255)<<1|Math.round(o/255));return m===2&&(h+=60),h},n.hsv.ansi16=function(l){return n.rgb.ansi16(n.hsv.rgb(l),l[2])},n.rgb.ansi256=function(l){const i=l[0],o=l[1],s=l[2];return i===o&&o===s?i<8?16:i>248?231:Math.round((i-8)/247*24)+232:16+36*Math.round(i/255*5)+6*Math.round(o/255*5)+Math.round(s/255*5)},n.ansi16.rgb=function(l){let i=l%10;if(i===0||i===7)return l>50&&(i+=3.5),i=i/10.5*255,[i,i,i];const o=(~~(l>50)+1)*.5,s=(i&1)*o*255,c=(i>>1&1)*o*255,m=(i>>2&1)*o*255;return[s,c,m]},n.ansi256.rgb=function(l){if(l>=232){const m=(l-232)*10+8;return[m,m,m]}l-=16;let i;const o=Math.floor(l/36)/5*255,s=Math.floor((i=l%36)/6)/5*255,c=i%6/5*255;return[o,s,c]},n.rgb.hex=function(l){const o=(((Math.round(l[0])&255)<<16)+((Math.round(l[1])&255)<<8)+(Math.round(l[2])&255)).toString(16).toUpperCase();return"000000".substring(o.length)+o},n.hex.rgb=function(l){const i=l.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!i)return[0,0,0];let o=i[0];i[0].length===3&&(o=o.split("").map(p=>p+p).join(""));const s=parseInt(o,16),c=s>>16&255,m=s>>8&255,h=s&255;return[c,m,h]},n.rgb.hcg=function(l){const i=l[0]/255,o=l[1]/255,s=l[2]/255,c=Math.max(Math.max(i,o),s),m=Math.min(Math.min(i,o),s),h=c-m;let p,f;return h<1?p=m/(1-h):p=0,h<=0?f=0:c===i?f=(o-s)/h%6:c===o?f=2+(s-i)/h:f=4+(i-o)/h,f/=6,f%=1,[f*360,h*100,p*100]},n.hsl.hcg=function(l){const i=l[1]/100,o=l[2]/100,s=o<.5?2*i*o:2*i*(1-o);let c=0;return s<1&&(c=(o-.5*s)/(1-s)),[l[0],s*100,c*100]},n.hsv.hcg=function(l){const i=l[1]/100,o=l[2]/100,s=i*o;let c=0;return s<1&&(c=(o-s)/(1-s)),[l[0],s*100,c*100]},n.hcg.rgb=function(l){const i=l[0]/360,o=l[1]/100,s=l[2]/100;if(o===0)return[s*255,s*255,s*255];const c=[0,0,0],m=i%1*6,h=m%1,p=1-h;let f=0;switch(Math.floor(m)){case 0:c[0]=1,c[1]=h,c[2]=0;break;case 1:c[0]=p,c[1]=1,c[2]=0;break;case 2:c[0]=0,c[1]=1,c[2]=h;break;case 3:c[0]=0,c[1]=p,c[2]=1;break;case 4:c[0]=h,c[1]=0,c[2]=1;break;default:c[0]=1,c[1]=0,c[2]=p}return f=(1-o)*s,[(o*c[0]+f)*255,(o*c[1]+f)*255,(o*c[2]+f)*255]},n.hcg.hsv=function(l){const i=l[1]/100,o=l[2]/100,s=i+o*(1-i);let c=0;return s>0&&(c=i/s),[l[0],c*100,s*100]},n.hcg.hsl=function(l){const i=l[1]/100,s=l[2]/100*(1-i)+.5*i;let c=0;return s>0&&s<.5?c=i/(2*s):s>=.5&&s<1&&(c=i/(2*(1-s))),[l[0],c*100,s*100]},n.hcg.hwb=function(l){const i=l[1]/100,o=l[2]/100,s=i+o*(1-i);return[l[0],(s-i)*100,(1-s)*100]},n.hwb.hcg=function(l){const i=l[1]/100,s=1-l[2]/100,c=s-i;let m=0;return c<1&&(m=(s-c)/(1-c)),[l[0],c*100,m*100]},n.apple.rgb=function(l){return[l[0]/65535*255,l[1]/65535*255,l[2]/65535*255]},n.rgb.apple=function(l){return[l[0]/255*65535,l[1]/255*65535,l[2]/255*65535]},n.gray.rgb=function(l){return[l[0]/100*255,l[0]/100*255,l[0]/100*255]},n.gray.hsl=function(l){return[0,0,l[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(l){return[0,100,l[0]]},n.gray.cmyk=function(l){return[0,0,0,l[0]]},n.gray.lab=function(l){return[l[0],0,0]},n.gray.hex=function(l){const i=Math.round(l[0]/100*255)&255,s=((i<<16)+(i<<8)+i).toString(16).toUpperCase();return"000000".substring(s.length)+s},n.rgb.gray=function(l){return[(l[0]+l[1]+l[2])/3/255*100]},pF}var fF,Bd0;function yj0(){if(Bd0)return fF;Bd0=1;const a=jd0();function t(){const i={},o=Object.keys(a);for(let s=o.length,c=0;c<s;c++)i[o[c]]={distance:-1,parent:null};return i}function n(i){const o=t(),s=[i];for(o[i].distance=0;s.length;){const c=s.pop(),m=Object.keys(a[c]);for(let h=m.length,p=0;p<h;p++){const f=m[p],v=o[f];v.distance===-1&&(v.distance=o[c].distance+1,v.parent=c,s.unshift(f))}}return o}function r(i,o){return function(s){return o(i(s))}}function l(i,o){const s=[o[i].parent,i];let c=a[o[i].parent][i],m=o[i].parent;for(;o[m].parent;)s.unshift(o[m].parent),c=r(a[o[m].parent][m],c),m=o[m].parent;return c.conversion=s,c}return fF=function(i){const o=n(i),s={},c=Object.keys(o);for(let m=c.length,h=0;h<m;h++){const p=c[h];o[p].parent!==null&&(s[p]=l(p,o))}return s},fF}var gF,zd0;function Vj0(){if(zd0)return gF;zd0=1;const a=jd0(),t=yj0(),n={},r=Object.keys(a);function l(o){const s=function(...c){const m=c[0];return m==null?m:(m.length>1&&(c=m),o(c))};return"conversion"in o&&(s.conversion=o.conversion),s}function i(o){const s=function(...c){const m=c[0];if(m==null)return m;m.length>1&&(c=m);const h=o(c);if(typeof h=="object")for(let p=h.length,f=0;f<p;f++)h[f]=Math.round(h[f]);return h};return"conversion"in o&&(s.conversion=o.conversion),s}return r.forEach(o=>{n[o]={},Object.defineProperty(n[o],"channels",{value:a[o].channels}),Object.defineProperty(n[o],"labels",{value:a[o].labels});const s=t(o);Object.keys(s).forEach(m=>{const h=s[m];n[o][m]=i(h),n[o][m].raw=l(h)})}),gF=n,gF}var vF,Ud0;function kj0(){if(Ud0)return vF;Ud0=1;const a=Mj0(),t=Vj0(),n=["keyword","gray","hex"],r={};for(const f of Object.keys(t))r[[...t[f].labels].sort().join("")]=f;const l={};function i(f,v){if(!(this instanceof i))return new i(f,v);if(v&&v in n&&(v=null),v&&!(v in t))throw new Error("Unknown model: "+v);let Z,E;if(f==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(f instanceof i)this.model=f.model,this.color=[...f.color],this.valpha=f.valpha;else if(typeof f=="string"){const M=a.get(f);if(M===null)throw new Error("Unable to parse color from string: "+f);this.model=M.model,E=t[this.model].channels,this.color=M.value.slice(0,E),this.valpha=typeof M.value[E]=="number"?M.value[E]:1}else if(f.length>0){this.model=v||"rgb",E=t[this.model].channels;const M=Array.prototype.slice.call(f,0,E);this.color=p(M,E),this.valpha=typeof f[E]=="number"?f[E]:1}else if(typeof f=="number")this.model="rgb",this.color=[f>>16&255,f>>8&255,f&255],this.valpha=1;else{this.valpha=1;const M=Object.keys(f);"alpha"in f&&(M.splice(M.indexOf("alpha"),1),this.valpha=typeof f.alpha=="number"?f.alpha:0);const V=M.sort().join("");if(!(V in r))throw new Error("Unable to parse color from object: "+JSON.stringify(f));this.model=r[V];const{labels:L}=t[this.model],b=[];for(Z=0;Z<L.length;Z++)b.push(f[L[Z]]);this.color=p(b)}if(l[this.model])for(E=t[this.model].channels,Z=0;Z<E;Z++){const M=l[this.model][Z];M&&(this.color[Z]=M(this.color[Z]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}i.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(f){let v=this.model in a.to?this:this.rgb();v=v.round(typeof f=="number"?f:1);const Z=v.valpha===1?v.color:[...v.color,this.valpha];return a.to[v.model](Z)},percentString(f){const v=this.rgb().round(typeof f=="number"?f:1),Z=v.valpha===1?v.color:[...v.color,this.valpha];return a.to.rgb.percent(Z)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const f={},{channels:v}=t[this.model],{labels:Z}=t[this.model];for(let E=0;E<v;E++)f[Z[E]]=this.color[E];return this.valpha!==1&&(f.alpha=this.valpha),f},unitArray(){const f=this.rgb().color;return f[0]/=255,f[1]/=255,f[2]/=255,this.valpha!==1&&f.push(this.valpha),f},unitObject(){const f=this.rgb().object();return f.r/=255,f.g/=255,f.b/=255,this.valpha!==1&&(f.alpha=this.valpha),f},round(f){return f=Math.max(f||0,0),new i([...this.color.map(s(f)),this.valpha],this.model)},alpha(f){return f!==void 0?new i([...this.color,Math.max(0,Math.min(1,f))],this.model):this.valpha},red:c("rgb",0,m(255)),green:c("rgb",1,m(255)),blue:c("rgb",2,m(255)),hue:c(["hsl","hsv","hsl","hwb","hcg"],0,f=>(f%360+360)%360),saturationl:c("hsl",1,m(100)),lightness:c("hsl",2,m(100)),saturationv:c("hsv",1,m(100)),value:c("hsv",2,m(100)),chroma:c("hcg",1,m(100)),gray:c("hcg",2,m(100)),white:c("hwb",1,m(100)),wblack:c("hwb",2,m(100)),cyan:c("cmyk",0,m(100)),magenta:c("cmyk",1,m(100)),yellow:c("cmyk",2,m(100)),black:c("cmyk",3,m(100)),x:c("xyz",0,m(95.047)),y:c("xyz",1,m(100)),z:c("xyz",2,m(108.833)),l:c("lab",0,m(100)),a:c("lab",1),b:c("lab",2),keyword(f){return f!==void 0?new i(f):t[this.model].keyword(this.color)},hex(f){return f!==void 0?new i(f):a.to.hex(this.rgb().round().color)},hexa(f){if(f!==void 0)return new i(f);const v=this.rgb().round().color;let Z=Math.round(this.valpha*255).toString(16).toUpperCase();return Z.length===1&&(Z="0"+Z),a.to.hex(v)+Z},rgbNumber(){const f=this.rgb().color;return(f[0]&255)<<16|(f[1]&255)<<8|f[2]&255},luminosity(){const f=this.rgb().color,v=[];for(const[Z,E]of f.entries()){const M=E/255;v[Z]=M<=.04045?M/12.92:((M+.055)/1.055)**2.4}return .2126*v[0]+.7152*v[1]+.0722*v[2]},contrast(f){const v=this.luminosity(),Z=f.luminosity();return v>Z?(v+.05)/(Z+.05):(Z+.05)/(v+.05)},level(f){const v=this.contrast(f);return v>=7?"AAA":v>=4.5?"AA":""},isDark(){const f=this.rgb().color;return(f[0]*2126+f[1]*7152+f[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const f=this.rgb();for(let v=0;v<3;v++)f.color[v]=255-f.color[v];return f},lighten(f){const v=this.hsl();return v.color[2]+=v.color[2]*f,v},darken(f){const v=this.hsl();return v.color[2]-=v.color[2]*f,v},saturate(f){const v=this.hsl();return v.color[1]+=v.color[1]*f,v},desaturate(f){const v=this.hsl();return v.color[1]-=v.color[1]*f,v},whiten(f){const v=this.hwb();return v.color[1]+=v.color[1]*f,v},blacken(f){const v=this.hwb();return v.color[2]+=v.color[2]*f,v},grayscale(){const f=this.rgb().color,v=f[0]*.3+f[1]*.59+f[2]*.11;return i.rgb(v,v,v)},fade(f){return this.alpha(this.valpha-this.valpha*f)},opaquer(f){return this.alpha(this.valpha+this.valpha*f)},rotate(f){const v=this.hsl();let Z=v.color[0];return Z=(Z+f)%360,Z=Z<0?360+Z:Z,v.color[0]=Z,v},mix(f,v){if(!f||!f.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof f);const Z=f.rgb(),E=this.rgb(),M=v===void 0?.5:v,V=2*M-1,L=Z.alpha()-E.alpha(),b=((V*L===-1?V:(V+L)/(1+V*L))+1)/2,N=1-b;return i.rgb(b*Z.red()+N*E.red(),b*Z.green()+N*E.green(),b*Z.blue()+N*E.blue(),Z.alpha()*M+E.alpha()*(1-M))}};for(const f of Object.keys(t)){if(n.includes(f))continue;const{channels:v}=t[f];i.prototype[f]=function(...Z){return this.model===f?new i(this):Z.length>0?new i(Z,f):new i([...h(t[this.model][f].raw(this.color)),this.valpha],f)},i[f]=function(...Z){let E=Z[0];return typeof E=="number"&&(E=p(Z,v)),new i(E,f)}}function o(f,v){return Number(f.toFixed(v))}function s(f){return function(v){return o(v,f)}}function c(f,v,Z){f=Array.isArray(f)?f:[f];for(const E of f)(l[E]||(l[E]=[]))[v]=Z;return f=f[0],function(E){let M;return E!==void 0?(Z&&(E=Z(E)),M=this[f](),M.color[v]=E,M):(M=this[f]().color[v],Z&&(M=Z(M)),M)}}function m(f){return function(v){return Math.max(0,Math.min(f,v))}}function h(f){return Array.isArray(f)?f:[f]}function p(f,v){for(let Z=0;Z<v;Z++)typeof f[Z]!="number"&&(f[Z]=0);return f}return vF=i,vF}var Sj0=kj0();const AF=A2(Sj0),qd0=typeof document<"u"?f1.useLayoutEffect:()=>{};var ZF;const Fj0=(ZF=f1.useInsertionEffect)!==null&&ZF!==void 0?ZF:qd0;function Lj0(a){const t=e.useRef(null);return Fj0(()=>{t.current=a},[a]),e.useCallback((...n)=>{const r=t.current;return r?.(...n)},[])}const u3=a=>{var t;return(t=a?.ownerDocument)!==null&&t!==void 0?t:document},p5=a=>a&&"window"in a&&a.window===a?a:u3(a).defaultView||window;function bj0(a){return a!==null&&typeof a=="object"&&"nodeType"in a&&typeof a.nodeType=="number"}function _j0(a){return bj0(a)&&a.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in a}let Nj0=!1;function HF(){return Nj0}function Gd0(a,t){if(!HF())return t&&a?a.contains(t):!1;if(!a||!t)return!1;let n=t;for(;n!==null;){if(n===a)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:_j0(n)?n=n.host:n=n.parentNode}return!1}const EF=(a=document)=>{var t;if(!HF())return a.activeElement;let n=a.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function Wd0(a){return HF()&&a.target.shadowRoot&&a.composedPath?a.composedPath()[0]:a.target}var wj0={};function Cj0(a){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>a.test(r.brand))||a.test(window.navigator.userAgent)}function Tj0(a){var t;return typeof window<"u"&&window.navigator!=null?a.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Kd0(a){if(wj0.NODE_ENV==="test")return a;let t=null;return()=>(t==null&&(t=a()),t)}const Ij0=Kd0(function(){return Tj0(/^Mac/i)}),xj0=Kd0(function(){return Cj0(/Android/i)});function Yd0(){let a=e.useRef(new Map),t=e.useCallback((l,i,o,s)=>{let c=s?.once?(...m)=>{a.current.delete(o),o(...m)}:o;a.current.set(o,{type:i,eventTarget:l,fn:c,options:s}),l.addEventListener(i,c,s)},[]),n=e.useCallback((l,i,o,s)=>{var c;let m=((c=a.current.get(o))===null||c===void 0?void 0:c.fn)||o;l.removeEventListener(i,m,s),a.current.delete(o)},[]),r=e.useCallback(()=>{a.current.forEach((l,i)=>{n(l.eventTarget,l.type,i,l.options)})},[n]);return e.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Pj0(a){return a.pointerType===""&&a.isTrusted?!0:xj0()&&a.pointerType?a.type==="click"&&a.buttons===1:a.detail===0&&!a.pointerType}function Qd0(a){let t=a;return t.nativeEvent=a,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Oj0(a,t){Object.defineProperty(a,"target",{value:t}),Object.defineProperty(a,"currentTarget",{value:t})}function Xd0(a){let t=e.useRef({isFocused:!1,observer:null});qd0(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Lj0(r=>{a?.(r)});return e.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let l=r.target,i=o=>{if(t.current.isFocused=!1,l.disabled){let s=Qd0(o);n(s)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};l.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&l.disabled){var o;(o=t.current.observer)===null||o===void 0||o.disconnect();let s=l===document.activeElement?null:document.activeElement;l.dispatchEvent(new FocusEvent("blur",{relatedTarget:s})),l.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:s}))}}),t.current.observer.observe(l,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let Rj0=!1;var Jd0={};let ou=null,MF=new Set,su=new Map,f5=!1,yF=!1;const $j0={Tab:!0,Escape:!0};function VF(a,t){for(let n of MF)n(a,t)}function Dj0(a){return!(a.metaKey||!Ij0()&&a.altKey||a.ctrlKey||a.key==="Control"||a.key==="Shift"||a.key==="Meta")}function zv(a){f5=!0,Dj0(a)&&(ou="keyboard",VF("keyboard",a))}function B4(a){ou="pointer",(a.type==="mousedown"||a.type==="pointerdown")&&(f5=!0,VF("pointer",a))}function e90(a){Pj0(a)&&(f5=!0,ou="virtual")}function t90(a){a.target===window||a.target===document||Rj0||!a.isTrusted||(!f5&&!yF&&(ou="virtual",VF("virtual",a)),f5=!1,yF=!1)}function a90(){f5=!1,yF=!0}function kF(a){if(typeof window>"u"||typeof document>"u"||su.get(p5(a)))return;const t=p5(a),n=u3(a);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){f5=!0,r.apply(this,arguments)},n.addEventListener("keydown",zv,!0),n.addEventListener("keyup",zv,!0),n.addEventListener("click",e90,!0),t.addEventListener("focus",t90,!0),t.addEventListener("blur",a90,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",B4,!0),n.addEventListener("pointermove",B4,!0),n.addEventListener("pointerup",B4,!0)):Jd0.NODE_ENV==="test"&&(n.addEventListener("mousedown",B4,!0),n.addEventListener("mousemove",B4,!0),n.addEventListener("mouseup",B4,!0)),t.addEventListener("beforeunload",()=>{n90(a)},{once:!0}),su.set(t,{focus:r})}const n90=(a,t)=>{const n=p5(a),r=u3(a);t&&r.removeEventListener("DOMContentLoaded",t),su.has(n)&&(n.HTMLElement.prototype.focus=su.get(n).focus,r.removeEventListener("keydown",zv,!0),r.removeEventListener("keyup",zv,!0),r.removeEventListener("click",e90,!0),n.removeEventListener("focus",t90,!0),n.removeEventListener("blur",a90,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",B4,!0),r.removeEventListener("pointermove",B4,!0),r.removeEventListener("pointerup",B4,!0)):Jd0.NODE_ENV==="test"&&(r.removeEventListener("mousedown",B4,!0),r.removeEventListener("mousemove",B4,!0),r.removeEventListener("mouseup",B4,!0)),su.delete(n))};function jj0(a){const t=u3(a);let n;return t.readyState!=="loading"?kF(a):(n=()=>{kF(a)},t.addEventListener("DOMContentLoaded",n)),()=>n90(a,n)}typeof document<"u"&&jj0();function r90(){return ou!=="pointer"}const Bj0=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function zj0(a,t,n){let r=u3(n?.target);const l=typeof window<"u"?p5(n?.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?p5(n?.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<"u"?p5(n?.target).HTMLElement:HTMLElement,s=typeof window<"u"?p5(n?.target).KeyboardEvent:KeyboardEvent;return a=a||r.activeElement instanceof l&&!Bj0.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof o&&r.activeElement.isContentEditable,!(a&&t==="keyboard"&&n instanceof s&&!$j0[n.key])}function Uj0(a,t,n){kF(),e.useEffect(()=>{let r=(l,i)=>{zj0(!!n?.isTextInput,l,i)&&a(r90())};return MF.add(r),()=>{MF.delete(r)}},t)}function qj0(a){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:l}=a;const i=e.useCallback(c=>{if(c.target===c.currentTarget)return r&&r(c),l&&l(!1),!0},[r,l]),o=Xd0(i),s=e.useCallback(c=>{const m=u3(c.target),h=m?EF(m):EF();c.target===c.currentTarget&&h===Wd0(c.nativeEvent)&&(n&&n(c),l&&l(!0),o(c))},[l,n,o]);return{focusProps:{onFocus:!t&&(n||l||r)?s:void 0,onBlur:!t&&(r||l)?i:void 0}}}function Gj0(a){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:l}=a,i=e.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:s}=Yd0(),c=e.useCallback(p=>{p.currentTarget.contains(p.target)&&i.current.isFocusWithin&&!p.currentTarget.contains(p.relatedTarget)&&(i.current.isFocusWithin=!1,s(),n&&n(p),l&&l(!1))},[n,l,i,s]),m=Xd0(c),h=e.useCallback(p=>{if(!p.currentTarget.contains(p.target))return;const f=u3(p.target),v=EF(f);if(!i.current.isFocusWithin&&v===Wd0(p.nativeEvent)){r&&r(p),l&&l(!0),i.current.isFocusWithin=!0,m(p);let Z=p.currentTarget;o(f,"focus",E=>{if(i.current.isFocusWithin&&!Gd0(Z,E.target)){let M=new f.defaultView.FocusEvent("blur",{relatedTarget:E.target});Oj0(M,Z);let V=Qd0(M);c(V)}},{capture:!0})}},[r,l,m,o,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:h,onBlur:c}}}var SF={};let Uv=!1,qv=0;function FF(){Uv=!0,setTimeout(()=>{Uv=!1},50)}function l90(a){a.pointerType==="touch"&&FF()}function Wj0(){if(!(typeof document>"u"))return qv===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",l90):SF.NODE_ENV==="test"&&document.addEventListener("touchend",FF)),qv++,()=>{qv--,!(qv>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",l90):SF.NODE_ENV==="test"&&document.removeEventListener("touchend",FF))}}function Gv(a){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:l}=a,[i,o]=e.useState(!1),s=e.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;e.useEffect(Wj0,[]);let{addGlobalListener:c,removeAllGlobalListeners:m}=Yd0(),{hoverProps:h,triggerHoverEnd:p}=e.useMemo(()=>{let f=(E,M)=>{if(s.pointerType=M,l||M==="touch"||s.isHovered||!E.currentTarget.contains(E.target))return;s.isHovered=!0;let V=E.currentTarget;s.target=V,c(u3(E.target),"pointerover",L=>{s.isHovered&&s.target&&!Gd0(s.target,L.target)&&v(L,L.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:V,pointerType:M}),n&&n(!0),o(!0)},v=(E,M)=>{let V=s.target;s.pointerType="",s.target=null,!(M==="touch"||!s.isHovered||!V)&&(s.isHovered=!1,m(),r&&r({type:"hoverend",target:V,pointerType:M}),n&&n(!1),o(!1))},Z={};return typeof PointerEvent<"u"?(Z.onPointerEnter=E=>{Uv&&E.pointerType==="mouse"||f(E,E.pointerType)},Z.onPointerLeave=E=>{!l&&E.currentTarget.contains(E.target)&&v(E,E.pointerType)}):SF.NODE_ENV==="test"&&(Z.onTouchStart=()=>{s.ignoreEmulatedMouseEvents=!0},Z.onMouseEnter=E=>{!s.ignoreEmulatedMouseEvents&&!Uv&&f(E,"mouse"),s.ignoreEmulatedMouseEvents=!1},Z.onMouseLeave=E=>{!l&&E.currentTarget.contains(E.target)&&v(E,"mouse")}),{hoverProps:Z,triggerHoverEnd:v}},[t,n,r,l,s,c,m]);return e.useEffect(()=>{l&&p({currentTarget:s.target},s.pointerType)},[l]),{hoverProps:h,isHovered:i}}function Wv(a={}){let{autoFocus:t=!1,isTextInput:n,within:r}=a,l=e.useRef({isFocused:!1,isFocusVisible:t||r90()}),[i,o]=e.useState(!1),[s,c]=e.useState(()=>l.current.isFocused&&l.current.isFocusVisible),m=e.useCallback(()=>c(l.current.isFocused&&l.current.isFocusVisible),[]),h=e.useCallback(v=>{l.current.isFocused=v,o(v),m()},[m]);Uj0(v=>{l.current.isFocusVisible=v,m()},[],{isTextInput:n});let{focusProps:p}=qj0({isDisabled:r,onFocusChange:h}),{focusWithinProps:f}=Gj0({isDisabled:!r,onFocusWithinChange:h});return{isFocused:i,isFocusVisible:s,focusProps:r?f:p}}var Kj0=Object.defineProperty,Yj0=(a,t,n)=>t in a?Kj0(a,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[t]=n,LF=(a,t,n)=>(Yj0(a,typeof t!="symbol"?t+"":t,n),n);let Qj0=class{constructor(){LF(this,"current",this.detect()),LF(this,"handoffState","pending"),LF(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Lr=new Qj0;function g5(a){var t;return Lr.isServer?null:a==null?document:(t=a?.ownerDocument)!=null?t:document}function Kv(a){var t,n;return Lr.isServer?null:a==null?document:(n=(t=a?.getRootNode)==null?void 0:t.call(a))!=null?n:document}function bF(a){var t,n;return(n=(t=Kv(a))==null?void 0:t.activeElement)!=null?n:null}function i90(a){return bF(a)===a}function Yv(a){typeof queueMicrotask=="function"?queueMicrotask(a):Promise.resolve().then(a).catch(t=>setTimeout(()=>{throw t}))}function j6(){let a=[],t={addEventListener(n,r,l,i){return n.addEventListener(r,l,i),t.add(()=>n.removeEventListener(r,l,i))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Yv(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,l){let i=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:l}),this.add(()=>{Object.assign(n.style,{[r]:i})})},group(n){let r=j6();return n(r),this.add(()=>r.dispose())},add(n){return a.includes(n)||a.push(n),()=>{let r=a.indexOf(n);if(r>=0)for(let l of a.splice(r,1))l()}},dispose(){for(let n of a.splice(0))n()}};return t}function v5(){let[a]=e.useState(j6);return e.useEffect(()=>()=>a.dispose(),[a]),a}let St=(a,t)=>{Lr.isServer?e.useEffect(a,t):e.useLayoutEffect(a,t)};function A5(a){let t=e.useRef(a);return St(()=>{t.current=a},[a]),t}let Se=function(a){let t=A5(a);return f1.useCallback((...n)=>t.current(...n),[t])};function Xj0(a){let t=a.width/2,n=a.height/2;return{top:a.clientY-n,right:a.clientX+t,bottom:a.clientY+n,left:a.clientX-t}}function Jj0(a,t){return!(!a||!t||a.right<t.left||a.left>t.right||a.bottom<t.top||a.top>t.bottom)}function _F({disabled:a=!1}={}){let t=e.useRef(null),[n,r]=e.useState(!1),l=v5(),i=Se(()=>{t.current=null,r(!1),l.dispose()}),o=Se(s=>{if(l.dispose(),t.current===null){t.current=s.currentTarget,r(!0);{let c=g5(s.currentTarget);l.addEventListener(c,"pointerup",i,!1),l.addEventListener(c,"pointermove",m=>{if(t.current){let h=Xj0(m);r(Jj0(h,t.current.getBoundingClientRect()))}},!1),l.addEventListener(c,"pointercancel",i,!1)}}});return{pressed:n,pressProps:a?{}:{onPointerDown:o,onPointerUp:i,onClick:i}}}function m4(a){return e.useMemo(()=>a,Object.values(a))}let eB0=e.createContext(void 0);function Qv(){return e.useContext(eB0)}function NF(...a){return Array.from(new Set(a.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function _n(a,t,...n){if(a in t){let l=t[a];return typeof l=="function"?l(...n):l}let r=new Error(`Tried to handle "${a}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(l=>`"${l}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,_n),r}var uc=(a=>(a[a.None=0]="None",a[a.RenderStrategy=1]="RenderStrategy",a[a.Static=2]="Static",a))(uc||{}),h3=(a=>(a[a.Unmount=0]="Unmount",a[a.Hidden=1]="Hidden",a))(h3||{});function Bt(){let a=aB0();return e.useCallback(t=>tB0({mergeRefs:a,...t}),[a])}function tB0({ourProps:a,theirProps:t,slot:n,defaultTag:r,features:l,visible:i=!0,name:o,mergeRefs:s}){s=s??nB0;let c=o90(t,a);if(i)return Xv(c,n,r,o,s);let m=l??0;if(m&2){let{static:h=!1,...p}=c;if(h)return Xv(p,n,r,o,s)}if(m&1){let{unmount:h=!0,...p}=c;return _n(h?0:1,{0(){return null},1(){return Xv({...p,hidden:!0,style:{display:"none"}},n,r,o,s)}})}return Xv(c,n,r,o,s)}function Xv(a,t={},n,r,l){let{as:i=n,children:o,refName:s="ref",...c}=wF(a,["unmount","static"]),m=a.ref!==void 0?{[s]:a.ref}:{},h=typeof o=="function"?o(t):o;"className"in c&&c.className&&typeof c.className=="function"&&(c.className=c.className(t)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let p={};if(t){let f=!1,v=[];for(let[Z,E]of Object.entries(t))typeof E=="boolean"&&(f=!0),E===!0&&v.push(Z.replace(/([A-Z])/g,M=>`-${M.toLowerCase()}`));if(f){p["data-headlessui-state"]=v.join(" ");for(let Z of v)p[`data-${Z}`]=""}}if(du(i)&&(Object.keys(Z5(c)).length>0||Object.keys(Z5(p)).length>0))if(!e.isValidElement(h)||Array.isArray(h)&&h.length>1||lB0(h)){if(Object.keys(Z5(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Z5(c)).concat(Object.keys(Z5(p))).map(f=>` - ${f}`).join(`
243
+ <%s key={someKey} {...props} />`,le,me,wt,me),Nt[me+le]=!0}}return h0===l?fa(Ze):xa(Ze),Ze}}function V0(h0,w0,Q0){return v0(h0,w0,Q0,!0)}function T0(h0,w0,Q0){return v0(h0,w0,Q0,!1)}var a1=T0,o1=V0;Qm.Fragment=l,Qm.jsx=a1,Qm.jsxs=o1})(),Qm}var Y70;function PO0(){if(Y70)return Av.exports;Y70=1;var a={};return a.NODE_ENV==="production"?Av.exports=IO0():Av.exports=xO0(),Av.exports}var T=PO0();const Q70=e.createContext(),X70=e.createContext(),FS={initialized:!1,authenticated:!1,identity:null,step:jt.Welcome,token:null,refreshToken:null,type:null,userExists:!1,onSuccess:()=>!1,userProfile:[],sharedProfiles:[],anonymousId:null},LS={update:"update",logout:"logout",reset:"reset"},ua=a=>({type:"update",payload:a}),J70=()=>({type:"logout"});function OO0(a,t){switch(t.type){case LS.update:return{...a,...t.payload};case LS.logout:return window.localStorage.removeItem(Pl),{...FS,initialized:!0};case LS.reset:return FS;default:throw new Error(`Unhandled action type: ${t.type}`)}}function ec0(a={}){const t=uv(),[n,r]=e.useReducer(OO0,FS),{initialized:l,authenticated:i,token:o,refreshToken:s,anonymousId:c}=n;return e.useEffect(()=>{function m(){const h=window.localStorage.getItem(Pl),p=window.localStorage.getItem(gv),f=window.localStorage.getItem(vv);r(ua(h?{initialized:!0,authenticated:!0,token:h,refreshToken:p,anonymousId:f}:{initialized:!0,authenticated:!1}))}l||m()},[l]),e.useEffect(()=>{function m(){if(o&&o!==window.localStorage.getItem(Pl)&&(window.localStorage.setItem(Pl,o),t.refetchQueries({include:"active"}),i||r(ua({authenticated:!0}))),s&&window.localStorage.setItem(gv,s),!c){const h=window.localStorage.getItem(vv);r(ua({anonymousId:h}))}}m()},[o,s,i,c]),e.useEffect(()=>{function m(){const h=window.localStorage.getItem(vv);if(h)r(ua({anonymousId:h}));else{const p=CO0();window.localStorage.setItem(vv,p),r(ua({anonymousId:p}))}}m()},[]),T.jsx(Q70.Provider,{value:n,children:T.jsx(X70.Provider,{value:r,children:a.children})})}function RO0(){const a=e.useContext(Q70);if(a===void 0)throw new Error("useAuthState must be used within a AuthProvider");return a}function $O0(){const a=e.useContext(X70);if(a===void 0)throw new Error("useAuthDispatch must be used within a AuthProvider");return a}function Ol(){const a=[RO0(),$O0()];if(a===void 0)throw new Error("useAuth must be used within a AuthProvider");return a}ec0.propTypes={children:N1.oneOfType([N1.element,N1.node])};var DO0=" daum[ /]| deusu/|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|24x7|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\bperl\\b|\\btime/|\\||^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\W|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^azure|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|agent\\b|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node\\b|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",jO0=/bot|crawl|http|lighthouse|scan|search|spider/i,Xm;function BO0(){if(Xm instanceof RegExp)return Xm;try{Xm=new RegExp(DO0,"i")}catch{Xm=jO0}return Xm}function tc0(a){return!!a&&BO0().test(a)}function bS(a,t,n){t.split&&(t=t.split("."));for(var r=0,l=t.length,i=a,o,s;r<l&&(s=""+t[r++],!(s==="__proto__"||s==="constructor"||s==="prototype"));)i=i[s]=r===l?n:typeof(o=i[s])==typeof t?o:t[r]*0!==0||~(""+t[r]).indexOf(".")?{}:[]}var zO0=function(a,t){return Object.keys(a).filter(function(n){return t(n,a[n])}).reduce(function(n,r){return n[r]=a[r],n},{})},yr=(function(a){kt(t,a);function t(n,r){var l=a.call(this,"".concat(n," ").concat(r))||this;return l.field=n,l}return t})(Error);function Rl(a){return typeof a=="string"}function _S(a){return typeof a=="number"}function X7(a){return typeof a=="function"}function ac0(a){return a!=null}function $6(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()==="object"}var Zv="is not a string",NS="is not an object",nc0="is nil";function UO0(a){var t=".userId/anonymousId/previousId/groupId",n=function(l){var i,o,s;return(s=(o=(i=l.userId)!==null&&i!==void 0?i:l.anonymousId)!==null&&o!==void 0?o:l.groupId)!==null&&s!==void 0?s:l.previousId},r=n(a);if(ac0(r)){if(!Rl(r))throw new yr(t,Zv)}else throw new yr(t,nc0)}function qO0(a){if(!ac0(a))throw new yr("Event",nc0);if(typeof a!="object")throw new yr("Event",NS)}function GO0(a){if(!Rl(a.type))throw new yr(".type",Zv)}function WO0(a){if(!Rl(a.event))throw new yr(".event",Zv)}function KO0(a){if(!$6(a.properties))throw new yr(".properties",NS)}function YO0(a){if(!$6(a.traits))throw new yr(".traits",NS)}function QO0(a){if(!Rl(a.messageId))throw new yr(".messageId",Zv)}function XO0(a){qO0(a),GO0(a),QO0(a),a.type==="track"&&(WO0(a),KO0(a)),["group","identify"].includes(a.type)&&YO0(a)}var JO0=(function(){function a(t){var n,r;this.settings=t,this.createMessageId=t.createMessageId,this.onEventMethodCall=(n=t.onEventMethodCall)!==null&&n!==void 0?n:(function(){}),this.onFinishedEvent=(r=t.onFinishedEvent)!==null&&r!==void 0?r:(function(){})}return a})(),rc0=(function(){function a(t){this.settings=new JO0(t)}return a.prototype.track=function(t,n,r,l){return this.settings.onEventMethodCall({type:"track",options:r}),this.normalize(u0(u0({},this.baseEvent()),{event:t,type:"track",properties:n??{},options:u0({},r),integrations:u0({},l)}))},a.prototype.page=function(t,n,r,l,i){var o;this.settings.onEventMethodCall({type:"page",options:l});var s={type:"page",properties:u0({},r),options:u0({},l),integrations:u0({},i)};return t!==null&&(s.category=t,s.properties=(o=s.properties)!==null&&o!==void 0?o:{},s.properties.category=t),n!==null&&(s.name=n),this.normalize(u0(u0({},this.baseEvent()),s))},a.prototype.screen=function(t,n,r,l,i){this.settings.onEventMethodCall({type:"screen",options:l});var o={type:"screen",properties:u0({},r),options:u0({},l),integrations:u0({},i)};return t!==null&&(o.category=t),n!==null&&(o.name=n),this.normalize(u0(u0({},this.baseEvent()),o))},a.prototype.identify=function(t,n,r,l){return this.settings.onEventMethodCall({type:"identify",options:r}),this.normalize(u0(u0({},this.baseEvent()),{type:"identify",userId:t,traits:n??{},options:u0({},r),integrations:l}))},a.prototype.group=function(t,n,r,l){return this.settings.onEventMethodCall({type:"group",options:r}),this.normalize(u0(u0({},this.baseEvent()),{type:"group",traits:n??{},options:u0({},r),integrations:u0({},l),groupId:t}))},a.prototype.alias=function(t,n,r,l){this.settings.onEventMethodCall({type:"alias",options:r});var i={userId:t,type:"alias",options:u0({},r),integrations:u0({},l)};return n!==null&&(i.previousId=n),t===void 0?this.normalize(u0(u0({},i),this.baseEvent())):this.normalize(u0(u0({},this.baseEvent()),i))},a.prototype.baseEvent=function(){return{integrations:{},options:{}}},a.prototype.context=function(t){var n,r=["userId","anonymousId","timestamp","messageId"];delete t.integrations;var l=Object.keys(t),i=(n=t.context)!==null&&n!==void 0?n:{},o={};return l.forEach(function(s){s!=="context"&&(r.includes(s)?bS(o,s,t[s]):bS(i,s,t[s]))}),[i,o]},a.prototype.normalize=function(t){var n,r,l=Object.keys((n=t.integrations)!==null&&n!==void 0?n:{}).reduce(function(f,v){var Z,E;return u0(u0({},f),(Z={},Z[v]=!!(!((E=t.integrations)===null||E===void 0)&&E[v]),Z))},{});t.options=zO0(t.options||{},function(f,v){return v!==void 0});var i=u0(u0({},l),(r=t.options)===null||r===void 0?void 0:r.integrations),o=t.options?this.context(t.options):[],s=o[0],c=o[1],m=t.options,h=R6(t,["options"]),p=u0(u0(u0(u0({timestamp:new Date},h),{context:s,integrations:i}),c),{messageId:m.messageId||this.settings.createMessageId()});return this.settings.onFinishedEvent(p),XO0(p),p},a})();function Hv(a,t){return new Promise(function(n,r){var l=setTimeout(function(){r(Error("Promise timed out"))},t);a.then(function(i){return clearTimeout(l),n(i)}).catch(r)})}function lc0(a){return new Promise(function(t){return setTimeout(t,a)})}function eR0(a,t,n){var r=function(){try{return Promise.resolve(t(a))}catch(l){return Promise.reject(l)}};return lc0(n).then(function(){return Hv(r(),1e3)}).catch(function(l){a?.log("warn","Callback Error",{error:l}),a?.stats.increment("callback_error")}).then(function(){return a})}var Ev=function(){var a,t,n=!1,r=new Promise(function(l,i){a=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];n=!0,l.apply(void 0,o)},t=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];n=!0,i.apply(void 0,o)}});return{resolve:a,reject:t,promise:r,isSettled:function(){return n}}},J7=(function(){function a(t){var n;this.callbacks={},this.warned=!1,this.maxListeners=(n=t?.maxListeners)!==null&&n!==void 0?n:10}return a.prototype.warnIfPossibleMemoryLeak=function(t){this.warned||this.maxListeners&&this.callbacks[t].length>this.maxListeners&&(console.warn("Event Emitter: Possible memory leak detected; ".concat(String(t)," has exceeded ").concat(this.maxListeners," listeners.")),this.warned=!0)},a.prototype.on=function(t,n){return this.callbacks[t]?(this.callbacks[t].push(n),this.warnIfPossibleMemoryLeak(t)):this.callbacks[t]=[n],this},a.prototype.once=function(t,n){var r=this,l=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];r.off(t,l),n.apply(r,i)};return this.on(t,l),this},a.prototype.off=function(t,n){var r,l=(r=this.callbacks[t])!==null&&r!==void 0?r:[],i=l.filter(function(o){return o!==n});return this.callbacks[t]=i,this},a.prototype.emit=function(t){for(var n=this,r,l=[],i=1;i<arguments.length;i++)l[i-1]=arguments[i];var o=(r=this.callbacks[t])!==null&&r!==void 0?r:[];return o.forEach(function(s){s.apply(n,l)}),this},a})();function wS(a){var t=Math.random()+1,n=a.minTimeout,r=n===void 0?500:n,l=a.factor,i=l===void 0?2:l,o=a.attempt,s=a.maxTimeout,c=s===void 0?1/0:s;return Math.min(t*r*Math.pow(i,o),c)}for(var ic0="onRemoveFromFuture",Jm=(function(a){kt(t,a);function t(n,r,l){var i=a.call(this)||this;return i.future=[],i.maxAttempts=n,i.queue=r,i.seen=l??{},i}return t.prototype.push=function(){for(var n=this,r=[],l=0;l<arguments.length;l++)r[l]=arguments[l];var i=r.map(function(o){var s=n.updateAttempts(o);return s>n.maxAttempts||n.includes(o)?!1:(n.queue.push(o),!0)});return this.queue=this.queue.sort(function(o,s){return n.getAttempts(o)-n.getAttempts(s)}),i},t.prototype.pushWithBackoff=function(n,r){var l=this;if(r===void 0&&(r=0),r==0&&this.getAttempts(n)===0)return this.push(n)[0];var i=this.updateAttempts(n);if(i>this.maxAttempts||this.includes(n))return!1;var o=wS({attempt:i-1});return r>0&&o<r&&(o=r),setTimeout(function(){l.queue.push(n),l.future=l.future.filter(function(s){return s.id!==n.id}),l.emit(ic0)},o),this.future.push(n),!0},t.prototype.getAttempts=function(n){var r;return(r=this.seen[n.id])!==null&&r!==void 0?r:0},t.prototype.updateAttempts=function(n){return this.seen[n.id]=this.getAttempts(n)+1,this.getAttempts(n)},t.prototype.includes=function(n){return this.queue.includes(n)||this.future.includes(n)||!!this.queue.find(function(r){return r.id===n.id})||!!this.future.find(function(r){return r.id===n.id})},t.prototype.pop=function(){return this.queue.shift()},Object.defineProperty(t.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"todo",{get:function(){return this.queue.length+this.future.length},enumerable:!1,configurable:!0}),t})(J7),Jo=256,Mv=[],yv;Jo--;)Mv[Jo]=(Jo+256).toString(16).substring(1);function ec(){var a=0,t,n="";if(!yv||Jo+16>256){for(yv=Array(a=256);a--;)yv[a]=256*Math.random()|0;a=Jo=0}for(;a<16;a++)t=yv[Jo+a],a==6?n+=Mv[t&15|64]:a==8?n+=Mv[t&63|128]:n+=Mv[t],a&1&&a>1&&a<11&&(n+="-");return Jo++,n}var tR0=(function(){function a(){this._logs=[]}return a.prototype.log=function(t,n,r){var l=new Date;this._logs.push({level:t,message:n,time:l,extras:r})},Object.defineProperty(a.prototype,"logs",{get:function(){return this._logs},enumerable:!1,configurable:!0}),a.prototype.flush=function(){if(this.logs.length>1){var t=this._logs.reduce(function(n,r){var l,i,o,s=u0(u0({},r),{json:JSON.stringify(r.extras,null," "),extras:r.extras});delete s.time;var c=(o=(i=r.time)===null||i===void 0?void 0:i.toISOString())!==null&&o!==void 0?o:"";return n[c]&&(c="".concat(c,"-").concat(Math.random())),u0(u0({},n),(l={},l[c]=s,l))},{});console.table?console.table(t):console.log(t)}else this.logs.forEach(function(n){var r=n.level,l=n.message,i=n.extras;r==="info"||r==="debug"?console.log(l,i??""):console[r](l,i??"")});this._logs=[]},a})(),aR0=function(a){var t={gauge:"g",counter:"c"};return t[a]},oc0=(function(){function a(){this.metrics=[]}return a.prototype.increment=function(t,n,r){n===void 0&&(n=1),this.metrics.push({metric:t,value:n,tags:r??[],type:"counter",timestamp:Date.now()})},a.prototype.gauge=function(t,n,r){this.metrics.push({metric:t,value:n,tags:r??[],type:"gauge",timestamp:Date.now()})},a.prototype.flush=function(){var t=this.metrics.map(function(n){return u0(u0({},n),{tags:n.tags.join(",")})});console.table?console.table(t):console.log(t),this.metrics=[]},a.prototype.serialize=function(){return this.metrics.map(function(t){return{m:t.metric,v:t.value,t:t.tags,k:aR0(t.type),e:t.timestamp}})},a})(),nR0=(function(a){kt(t,a);function t(){return a!==null&&a.apply(this,arguments)||this}return t.prototype.gauge=function(){},t.prototype.increment=function(){},t.prototype.flush=function(){},t.prototype.serialize=function(){return[]},t})(oc0),o3=(function(){function a(t){var n,r,l;this.retry=(n=t.retry)!==null&&n!==void 0?n:!0,this.type=(r=t.type)!==null&&r!==void 0?r:"plugin Error",this.reason=(l=t.reason)!==null&&l!==void 0?l:""}return a})(),eu=(function(){function a(t,n,r,l){n===void 0&&(n=ec()),r===void 0&&(r=new nR0),l===void 0&&(l=new tR0),this.attempts=0,this.event=t,this._id=n,this.logger=l,this.stats=r}return a.system=function(){},a.prototype.isSame=function(t){return t.id===this.id},a.prototype.cancel=function(t){throw t||new o3({reason:"Context Cancel"})},a.prototype.log=function(t,n,r){this.logger.log(t,n,r)},Object.defineProperty(a.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),a.prototype.updateEvent=function(t,n){var r;if(t.split(".")[0]==="integrations"){var l=t.split(".")[1];if(((r=this.event.integrations)===null||r===void 0?void 0:r[l])===!1)return this.event}return bS(this.event,t,n),this.event},a.prototype.failedDelivery=function(){return this._failedDelivery},a.prototype.setFailedDelivery=function(t){this._failedDelivery=t},a.prototype.logs=function(){return this.logger.logs},a.prototype.flush=function(){this.logger.flush(),this.stats.flush()},a.prototype.toJSON=function(){return{id:this._id,event:this.event,logs:this.logger.logs,metrics:this.stats.metrics}},a})();function rR0(a,t){var n={};return a.forEach(function(r){var l,i=void 0;{var o=r[t];i=typeof o!="string"?JSON.stringify(o):o}i!==void 0&&(n[i]=Qe(Qe([],(l=n[i])!==null&&l!==void 0?l:[],!0),[r],!1))}),n}var lR0=function(a){return typeof a=="object"&&a!==null&&"then"in a&&typeof a.then=="function"},iR0=function(){var a,t,n=0;return{done:function(){return a},run:function(r){var l=r();return lR0(l)&&(++n===1&&(a=new Promise(function(i){return t=i})),l.finally(function(){return--n===0&&t()})),l}}};function oR0(a){return b1(this,void 0,void 0,function(){var t;return _1(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,a()];case 1:return[2,n.sent()];case 2:return t=n.sent(),[2,Promise.reject(t)];case 3:return[2]}})})}function tc(a,t){a.log("debug","plugin",{plugin:t.name});var n=new Date().getTime(),r=t[a.event.type];if(r===void 0)return Promise.resolve(a);var l=oR0(function(){return r.apply(t,[a])}).then(function(i){var o=new Date().getTime()-n;return i.stats.gauge("plugin_time",o,["plugin:".concat(t.name)]),i}).catch(function(i){if(i instanceof o3&&i.type==="middleware_cancellation")throw i;return i instanceof o3?(a.log("warn",i.type,{plugin:t.name,error:i}),i):(a.log("error","plugin Error",{plugin:t.name,error:i}),a.stats.increment("plugin_error",1,["plugin:".concat(t.name)]),i)});return l}function sR0(a,t){return tc(a,t).then(function(n){if(n instanceof eu)return n;a.log("debug","Context canceled"),a.stats.increment("context_canceled"),a.cancel(n)})}var sc0=(function(a){kt(t,a);function t(n){var r=a.call(this)||this;return r.criticalTasks=iR0(),r.plugins=[],r.failedInitializations=[],r.flushing=!1,r.queue=n,r.queue.on(ic0,function(){r.scheduleFlush(0)}),r}return t.prototype.register=function(n,r,l){return b1(this,void 0,void 0,function(){var i,o,s=this;return _1(this,function(c){switch(c.label){case 0:return this.plugins.push(r),i=function(m){s.failedInitializations.push(r.name),s.emit("initialization_failure",r),console.warn(r.name,m),n.log("warn","Failed to load destination",{plugin:r.name,error:m}),s.plugins=s.plugins.filter(function(h){return h!==r})},r.type==="destination"&&r.name!=="Segment.io"?(r.load(n,l).catch(i),[3,4]):[3,1];case 1:return c.trys.push([1,3,,4]),[4,r.load(n,l)];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),i(o),[3,4];case 4:return[2]}})})},t.prototype.deregister=function(n,r,l){return b1(this,void 0,void 0,function(){var i;return _1(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),r.unload?[4,Promise.resolve(r.unload(n,l))]:[3,2];case 1:o.sent(),o.label=2;case 2:return this.plugins=this.plugins.filter(function(s){return s.name!==r.name}),[3,4];case 3:return i=o.sent(),n.log("warn","Failed to unload destination",{plugin:r.name,error:i}),[3,4];case 4:return[2]}})})},t.prototype.dispatch=function(n){return b1(this,void 0,void 0,function(){var r;return _1(this,function(l){return n.log("debug","Dispatching"),n.stats.increment("message_dispatched"),this.queue.push(n),r=this.subscribeToDelivery(n),this.scheduleFlush(0),[2,r]})})},t.prototype.subscribeToDelivery=function(n){return b1(this,void 0,void 0,function(){var r=this;return _1(this,function(l){return[2,new Promise(function(i){var o=function(s,c){s.isSame(n)&&(r.off("flush",o),i(s))};r.on("flush",o)})]})})},t.prototype.dispatchSingle=function(n){return b1(this,void 0,void 0,function(){var r=this;return _1(this,function(l){return n.log("debug","Dispatching"),n.stats.increment("message_dispatched"),this.queue.updateAttempts(n),n.attempts=1,[2,this.deliver(n).catch(function(i){var o=r.enqueuRetry(i,n);return o?r.subscribeToDelivery(n):(n.setFailedDelivery({reason:i}),n)})]})})},t.prototype.isEmpty=function(){return this.queue.length===0},t.prototype.scheduleFlush=function(n){var r=this;n===void 0&&(n=500),!this.flushing&&(this.flushing=!0,setTimeout(function(){r.flush().then(function(){setTimeout(function(){r.flushing=!1,r.queue.length&&r.scheduleFlush(0)},0)})},n))},t.prototype.deliver=function(n){return b1(this,void 0,void 0,function(){var r,l,i,o;return _1(this,function(s){switch(s.label){case 0:return[4,this.criticalTasks.done()];case 1:s.sent(),r=Date.now(),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.flushOne(n)];case 3:return n=s.sent(),l=Date.now()-r,this.emit("delivery_success",n),n.stats.gauge("delivered",l),n.log("debug","Delivered",n.event),[2,n];case 4:throw i=s.sent(),o=i,n.log("error","Failed to deliver",o),this.emit("delivery_failure",n,o),n.stats.increment("delivery_failed"),i;case 5:return[2]}})})},t.prototype.enqueuRetry=function(n,r){var l=!(n instanceof o3)||n.retry;return l?this.queue.pushWithBackoff(r):!1},t.prototype.flush=function(){return b1(this,void 0,void 0,function(){var n,r,l;return _1(this,function(i){switch(i.label){case 0:if(this.queue.length===0)return[2,[]];if(n=this.queue.pop(),!n)return[2,[]];n.attempts=this.queue.getAttempts(n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.deliver(n)];case 2:return n=i.sent(),this.emit("flush",n,!0),[3,4];case 3:return r=i.sent(),l=this.enqueuRetry(r,n),l||(n.setFailedDelivery({reason:r}),this.emit("flush",n,!1)),[2,[]];case 4:return[2,[n]]}})})},t.prototype.isReady=function(){return!0},t.prototype.availableExtensions=function(n){var r=this.plugins.filter(function(v){var Z,E,M;if(v.type!=="destination"&&v.name!=="Segment.io")return!0;var V=void 0;return(Z=v.alternativeNames)===null||Z===void 0||Z.forEach(function(L){n[L]!==void 0&&(V=n[L])}),(M=(E=n[v.name])!==null&&E!==void 0?E:V)!==null&&M!==void 0?M:(v.name==="Segment.io"?!0:n.All)!==!1}),l=rR0(r,"type"),i=l.before,o=i===void 0?[]:i,s=l.enrichment,c=s===void 0?[]:s,m=l.destination,h=m===void 0?[]:m,p=l.after,f=p===void 0?[]:p;return{before:o,enrichment:c,destinations:h,after:f}},t.prototype.flushOne=function(n){var r,l;return b1(this,void 0,void 0,function(){var i,o,s,c,m,h,Z,p,f,v,Z,E,M,V,L;return _1(this,function(b){switch(b.label){case 0:if(!this.isReady())throw new Error("Not ready");n.attempts>1&&this.emit("delivery_retry",n),i=this.availableExtensions((r=n.event.integrations)!==null&&r!==void 0?r:{}),o=i.before,s=i.enrichment,c=0,m=o,b.label=1;case 1:return c<m.length?(h=m[c],[4,sR0(n,h)]):[3,4];case 2:Z=b.sent(),Z instanceof eu&&(n=Z),this.emit("message_enriched",n,h),b.label=3;case 3:return c++,[3,1];case 4:p=0,f=s,b.label=5;case 5:return p<f.length?(v=f[p],[4,tc(n,v)]):[3,8];case 6:Z=b.sent(),Z instanceof eu&&(n=Z),this.emit("message_enriched",n,v),b.label=7;case 7:return p++,[3,5];case 8:return E=this.availableExtensions((l=n.event.integrations)!==null&&l!==void 0?l:{}),M=E.destinations,V=E.after,[4,new Promise(function(N,F){setTimeout(function(){var w=M.map(function(x){return tc(n,x)});Promise.all(w).then(N).catch(F)},0)})];case 9:return b.sent(),n.stats.increment("message_delivered"),this.emit("message_delivered",n),L=V.map(function(N){return tc(n,N)}),[4,Promise.all(L)];case 10:return b.sent(),[2,n]}})})},t})(J7),cR0=function(a,t){var n=Date.now()-a;return Math.max((t??300)-n,0)};function cc0(a,t,n,r){return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return n.emit("dispatch_start",a),l=Date.now(),t.isEmpty()?[4,t.dispatchSingle(a)]:[3,2];case 1:return i=o.sent(),[3,4];case 2:return[4,t.dispatch(a)];case 3:i=o.sent(),o.label=4;case 4:return r?.callback?[4,eR0(i,r.callback,cR0(l,r.timeout))]:[3,6];case 5:i=o.sent(),o.label=6;case 6:return r?.debug&&i.flush(),[2,i]}})})}function dR0(a){for(var t=a.constructor.prototype,n=0,r=Object.getOwnPropertyNames(t);n<r.length;n++){var l=r[n];if(l!=="constructor"){var i=Object.getOwnPropertyDescriptor(a.constructor.prototype,l);i&&typeof i.value=="function"&&(a[l]=a[l].bind(a))}}return a}function mR0(a,t,n,r){var l,i=[a,t,n,r],o=$6(a)?a.event:a;if(!o||!Rl(o))throw new Error("Event missing");var s=$6(a)?(l=a.properties)!==null&&l!==void 0?l:{}:$6(t)?t:{},c={};X7(n)||(c=n??{}),$6(a)&&!X7(t)&&(c=t??{});var m=i.find(X7);return[o,s,c,m]}function dc0(a,t,n,r,l){var i,o,s=null,c=null,m=[a,t,n,r,l],h=m.filter(Rl);h.length===1?Rl(m[1])?(c=m[1],s=null):(c=h[0],s=null):h.length===2&&(typeof m[0]=="string"&&(s=m[0]),typeof m[1]=="string"&&(c=m[1]));var p=m.find(X7),f=m.filter($6);return f.length===1?$6(m[2])?(o={},i=m[2]):$6(m[3])?(i={},o=m[3]):(i=f[0],o={}):f.length===2&&(i=f[0],o=f[1]),[s,c,i??(i={}),o??(o={}),p]}var mc0=function(a){return function(){for(var t,n,r,l=[],i=0;i<arguments.length;i++)l[i]=arguments[i];for(var o={},s=["callback","options","traits","id"],c=0,m=l;c<m.length;c++){var h=m[c],p=s.pop();if(p==="id"){if(Rl(h)||_S(h)){o.id=h.toString();continue}if(h==null)continue;p=s.pop()}if((p==="traits"||p==="options")&&(h==null||$6(h))&&(o[p]=h),X7(h)){o.callback=h;break}}return[(t=o.id)!==null&&t!==void 0?t:a.id(),(n=o.traits)!==null&&n!==void 0?n:{},(r=o.options)!==null&&r!==void 0?r:{},o.callback]}};function uR0(a,t,n,r){_S(a)&&(a=a.toString()),_S(t)&&(t=t.toString());var l=[a,t,n,r],i=l.filter(Rl),o=i[0],s=o===void 0?a:o,c=i[1],m=c===void 0?null:c,h=l.filter($6)[0],p=h===void 0?{}:h,f=l.find(X7);return[s,m,p,f]}function CS(){return typeof window<"u"}function uc0(){return!CS()}function hc0(){return CS()?window.navigator.onLine:!0}function s3(){return!hc0()}function hR0(a,t){return t=t||{},new Promise(function(n,r){var l=new XMLHttpRequest,i=[],o=[],s={},c=function(){return{ok:(l.status/100|0)==2,statusText:l.statusText,status:l.status,url:l.responseURL,text:function(){return Promise.resolve(l.responseText)},json:function(){return Promise.resolve(l.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([l.response]))},clone:c,headers:{keys:function(){return i},entries:function(){return o},get:function(h){return s[h.toLowerCase()]},has:function(h){return h.toLowerCase()in s}}}};for(var m in l.open(t.method||"get",a,!0),l.onload=function(){l.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(h,p,f){i.push(p=p.toLowerCase()),o.push([p,f]),s[p]=s[p]?s[p]+","+f:f}),n(c())},l.onerror=r,l.withCredentials=t.credentials=="include",t.headers)l.setRequestHeader(m,t.headers[m]);l.send(t.body||null)})}var TS=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:null},Vv=function(){for(var a=[],t=0;t<arguments.length;t++)a[t]=arguments[t];var n=TS();return(n&&n.fetch||hR0).apply(void 0,a)},kv="1.81.1",pc0="api.segment.io/v1",pR0=function(a,t,n){var r=t.reduce(function(l,i){var o=i.split(":"),s=o[0],c=o[1];return l[s]=c,l},{});return{type:"Counter",metric:a,value:1,tags:u0(u0({},r),{library:"analytics.js",library_version:"npm:next-".concat(kv)})}};function IS(a){console.error("Error sending segment performance metrics",a)}var fR0=(function(){function a(t){var n=this,r,l,i,o,s;if(this.host=(r=t?.host)!==null&&r!==void 0?r:pc0,this.sampleRate=(l=t?.sampleRate)!==null&&l!==void 0?l:1,this.flushTimer=(i=t?.flushTimer)!==null&&i!==void 0?i:30*1e3,this.maxQueueSize=(o=t?.maxQueueSize)!==null&&o!==void 0?o:20,this.protocol=(s=t?.protocol)!==null&&s!==void 0?s:"https",this.queue=[],this.sampleRate>0){var c=!1,m=function(){c||(c=!0,n.flush().catch(IS),c=!1,setTimeout(m,n.flushTimer))};m()}}return a.prototype.increment=function(t,n){if(t.includes("analytics_js.")&&n.length!==0&&!(Math.random()>this.sampleRate)&&!(this.queue.length>=this.maxQueueSize)){var r=pR0(t,n);this.queue.push(r),t.includes("error")&&this.flush().catch(IS)}},a.prototype.flush=function(){return b1(this,void 0,void 0,function(){var t=this;return _1(this,function(n){switch(n.label){case 0:return this.queue.length<=0?[2]:[4,this.send().catch(function(r){IS(r),t.sampleRate=0})];case 1:return n.sent(),[2]}})})},a.prototype.send=function(){return b1(this,void 0,void 0,function(){var t,n,r;return _1(this,function(l){return t={series:this.queue},this.queue=[],n={"Content-Type":"text/plain"},r="".concat(this.protocol,"://").concat(this.host,"/m"),[2,Vv(r,{headers:n,body:JSON.stringify(t),method:"POST"})]})})},a})(),Sv,fc0=(function(a){kt(t,a);function t(){return a!==null&&a.apply(this,arguments)||this}return t.initRemoteMetrics=function(n){Sv=new fR0(n)},t.prototype.increment=function(n,r,l){a.prototype.increment.call(this,n,r,l),Sv?.increment(n,l??[])},t})(oc0),Vr=(function(a){kt(t,a);function t(n,r){return a.call(this,n,r,new fc0)||this}return t.system=function(){return new this({type:"track",event:"system"})},t})(eu);function gR0(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()==="object"}var gc0="bpc",vc0=function(a,t,n,r,l,i){return{__t:gc0,c:t,p:r,u:a,s:n,t:l,r:i}},vR0=Object.keys(vc0("","","","","",""));function AR0(a){if(!gR0(a)||a.__t!==gc0)return!1;for(var t in a)if(!vR0.includes(t))return!1;return!0}var ZR0=function(a,t){return a.indexOf("?")>-1?a:a+t},HR0=function(a){var t=a.indexOf("#");return t===-1?a:a.slice(0,t)},ER0=function(a){try{return new URL(a).pathname}catch{return a[0]==="/"?a:"/"+a}},Ac0=function(a){var t=a.c,n=a.p,r=a.s,l=a.u,i=a.r,o=a.t,s=t?ER0(t):n,c=t?ZR0(t,r):HR0(l);return{path:s,referrer:i,search:r,title:o,url:c}},Zc0=function(){var a=document.querySelector("link[rel='canonical']");return vc0(location.href,a&&a.getAttribute("href")||void 0,location.search,location.pathname,document.title,document.referrer)},MR0=function(){return Ac0(Zc0())};function yR0(a,t){return Object.assign.apply(Object,Qe([{}],t.map(function(n){var r;if(a&&Object.prototype.hasOwnProperty.call(a,n))return r={},r[n]=a[n],r}),!1))}var ac=function(a,t){t===void 0&&(t=MR0());var n=a.context,r;a.type==="page"&&(r=a.properties&&yR0(a.properties,Object.keys(t)),a.properties=u0(u0(u0({},t),a.properties),a.name?{name:a.name}:{})),n.page=u0(u0(u0({},t),r),n.page)},VR0=(function(a){kt(t,a);function t(n){var r=a.call(this,{createMessageId:function(){return"ajs-next-".concat(Date.now(),"-").concat(ec())},onEventMethodCall:function(l){var i=l.options;r.maybeUpdateAnonId(i)},onFinishedEvent:function(l){return r.addIdentity(l),l}})||this;return r.user=n,r}return t.prototype.maybeUpdateAnonId=function(n){n?.anonymousId&&this.user.anonymousId(n.anonymousId)},t.prototype.addIdentity=function(n){this.user.id()&&(n.userId=this.user.id()),this.user.anonymousId()&&(n.anonymousId=this.user.anonymousId())},t.prototype.track=function(n,r,l,i,o){var s=a.prototype.track.call(this,n,r,l,i);return ac(s,o),s},t.prototype.page=function(n,r,l,i,o,s){var c=a.prototype.page.call(this,n,r,l,i,o);return ac(c,s),c},t.prototype.screen=function(n,r,l,i,o,s){var c=a.prototype.screen.call(this,n,r,l,i,o);return ac(c,s),c},t.prototype.identify=function(n,r,l,i,o){var s=a.prototype.identify.call(this,n,r,l,i);return ac(s,o),s},t.prototype.group=function(n,r,l,i,o){var s=a.prototype.group.call(this,n,r,l,i);return ac(s,o),s},t.prototype.alias=function(n,r,l,i,o){var s=a.prototype.alias.call(this,n,r,l,i);return ac(s,o),s},t})(rc0),kR0=function(a){return"addMiddleware"in a&&a.type==="destination"},kr={getItem:function(){},setItem:function(){},removeItem:function(){}};try{kr=CS()&&window.localStorage?window.localStorage:kr}catch(a){console.warn("Unable to access localStorage",a)}function Hc0(a){var t=kr.getItem(a);return(t?JSON.parse(t):[]).map(function(n){return new Vr(n.event,n.id)})}function SR0(a,t){var n=Hc0(a),r=Qe(Qe([],t,!0),n,!0),l=r.reduce(function(i,o){var s;return u0(u0({},i),(s={},s[o.id]=o,s))},{});kr.setItem(a,JSON.stringify(Object.values(l)))}function Ec0(a){var t=kr.getItem(a);return t?JSON.parse(t):{}}function FR0(a,t){var n=Ec0(a);kr.setItem(a,JSON.stringify(u0(u0({},n),t)))}function Mc0(a){kr.removeItem(a)}var LR0=function(){return new Date().getTime()};function xS(a,t,n){n===void 0&&(n=0);var r=50,l="persisted-queue:v1:".concat(a,":lock"),i=function(m){return new Date().getTime()>m},o=kr.getItem(l),s=o?JSON.parse(o):null,c=s===null||i(s);if(c){kr.setItem(l,JSON.stringify(LR0()+r)),t(),kr.removeItem(l);return}!c&&n<3?setTimeout(function(){xS(a,t,n+1)},r):console.error("Unable to retrieve lock")}var Fv=(function(a){kt(t,a);function t(n,r){var l=a.call(this,n,[])||this,i="persisted-queue:v1:".concat(r,":items"),o="persisted-queue:v1:".concat(r,":seen"),s=[],c={};return xS(r,function(){try{s=Hc0(i),c=Ec0(o),Mc0(i),Mc0(o),l.queue=Qe(Qe([],s,!0),l.queue,!0),l.seen=u0(u0({},c),l.seen)}catch(m){console.error(m)}}),window.addEventListener("pagehide",function(){if(l.todo>0){var m=Qe(Qe([],l.queue,!0),l.future,!0);try{xS(r,function(){SR0(i,m),FR0(o,l.seen)})}catch(h){console.error(h)}}}),l}return t})(Jm),bR0=(function(a){kt(t,a);function t(n){return a.call(this,typeof n=="string"?new Fv(4,n):n)||this}return t.prototype.flush=function(){return b1(this,void 0,void 0,function(){return _1(this,function(n){return s3()?[2,[]]:[2,a.prototype.flush.call(this)]})})},t})(sc0);function PS(a){for(var t=a.constructor.prototype,n=0,r=Object.getOwnPropertyNames(t);n<r.length;n++){var l=r[n];if(l!=="constructor"){var i=Object.getOwnPropertyDescriptor(a.constructor.prototype,l);i&&typeof i.value=="function"&&(a[l]=a[l].bind(a))}}return a}function Lv(a){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)a[r]=n[r]}return a}var _R0={read:function(a){return a[0]==='"'&&(a=a.slice(1,-1)),a.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(a){return encodeURIComponent(a).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function OS(a,t){function n(l,i,o){if(!(typeof document>"u")){o=Lv({},t,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),l=encodeURIComponent(l).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var c in o)o[c]&&(s+="; "+c,o[c]!==!0&&(s+="="+o[c].split(";")[0]));return document.cookie=l+"="+a.write(i,l)+s}}function r(l){if(!(typeof document>"u"||arguments.length&&!l)){for(var i=document.cookie?document.cookie.split("; "):[],o={},s=0;s<i.length;s++){var c=i[s].split("="),m=c.slice(1).join("=");try{var h=decodeURIComponent(c[0]);if(o[h]=a.read(m,h),l===h)break}catch{}}return l?o[l]:o}}return Object.create({set:n,get:r,remove:function(l,i){n(l,"",Lv({},i,{expires:-1}))},withAttributes:function(l){return OS(this.converter,Lv({},this.attributes,l))},withConverter:function(l){return OS(Lv({},this.converter,l),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(a)}})}var $l=OS(_R0,{path:"/"});function NR0(a){var t=a.hostname,n=t.split("."),r=n[n.length-1],l=[];if(n.length===4&&parseInt(r,10)>0||n.length<=1)return l;for(var i=n.length-2;i>=0;--i)l.push(n.slice(i).join("."));return l}function wR0(a){try{return new URL(a)}catch{return}}function yc0(a){var t=wR0(a);if(t)for(var n=NR0(t),r=0;r<n.length;++r){var l="__tld__",i=n[r],o={domain:"."+i};try{if($l.set(l,"1",o),$l.get(l))return $l.remove(l,o),i}catch{return}}}var CR0=365,Vc0=(function(){function a(t){t===void 0&&(t=a.defaults),this.options=u0(u0({},a.defaults),t)}return Object.defineProperty(a,"defaults",{get:function(){return{maxage:CR0,domain:yc0(window.location.href),path:"/",sameSite:"Lax"}},enumerable:!1,configurable:!0}),a.prototype.opts=function(){return{sameSite:this.options.sameSite,expires:this.options.maxage,domain:this.options.domain,path:this.options.path,secure:this.options.secure}},a.prototype.get=function(t){var n;try{var r=$l.get(t);if(r==null)return null;try{return(n=JSON.parse(r))!==null&&n!==void 0?n:null}catch{return r??null}}catch{return null}},a.prototype.set=function(t,n){typeof n=="string"?$l.set(t,n,this.opts()):n===null?$l.remove(t,this.opts()):$l.set(t,JSON.stringify(n),this.opts())},a.prototype.remove=function(t){return $l.remove(t,this.opts())},a})(),TR0=(function(){function a(){}return a.prototype.localStorageWarning=function(t,n){console.warn("Unable to access ".concat(t,", localStorage may be ").concat(n))},a.prototype.get=function(t){var n;try{var r=localStorage.getItem(t);if(r===null)return null;try{return(n=JSON.parse(r))!==null&&n!==void 0?n:null}catch{return r??null}}catch{return this.localStorageWarning(t,"unavailable"),null}},a.prototype.set=function(t,n){try{localStorage.setItem(t,JSON.stringify(n))}catch{this.localStorageWarning(t,"full")}},a.prototype.remove=function(t){try{return localStorage.removeItem(t)}catch{this.localStorageWarning(t,"unavailable")}},a})(),RS=(function(){function a(){this.cache={}}return a.prototype.get=function(t){var n;return(n=this.cache[t])!==null&&n!==void 0?n:null},a.prototype.set=function(t,n){this.cache[t]=n},a.prototype.remove=function(t){delete this.cache[t]},a})(),D6={Cookie:"cookie",LocalStorage:"localStorage",Memory:"memory"};function kc0(a){return a&&a.stores&&Array.isArray(a.stores)&&a.stores.every(function(t){return Object.values(D6).includes(t)})}function IR0(a){return typeof a=="object"&&a.name!==void 0}var $S=function(a,t,n,r){console.warn("".concat(a.constructor.name,": Can't ").concat(t,' key "').concat(n,'" | Err: ').concat(r))},e5=(function(){function a(t){this.stores=t}return a.prototype.get=function(t){for(var n=null,r=0,l=this.stores;r<l.length;r++){var i=l[r];try{if(n=i.get(t),n!=null)return n}catch(o){$S(i,"get",t,o)}}return null},a.prototype.set=function(t,n){this.stores.forEach(function(r){try{r.set(t,n)}catch(l){$S(r,"set",t,l)}})},a.prototype.clear=function(t){this.stores.forEach(function(n){try{n.remove(t)}catch(r){$S(n,"remove",t,r)}})},a.prototype.getAndSync=function(t){var n=this.get(t),r=typeof n=="number"?n.toString():n;return this.set(t,r),r},a})();function DS(a){var t=a.map(function(n){var r,l;switch(IR0(n)?(r=n.name,l=n.settings):r=n,r){case D6.Cookie:return new Vc0(l);case D6.LocalStorage:return new TR0;case D6.Memory:return new RS;default:throw new Error("Unknown Store Type: ".concat(n))}});return t}function Sc0(a,t){return a.map(function(n){return t&&n===D6.Cookie?{name:n,settings:t}:n})}var t5={persist:!0,cookie:{key:"ajs_user_id",oldKey:"ajs_user"},localStorage:{key:"ajs_user_traits"}},Fc0=(function(){function a(t,n){t===void 0&&(t=t5);var r=this,l,i,o,s;this.options={},this.id=function(m){if(r.options.disable)return null;var h=r.identityStore.getAndSync(r.idKey);if(m!==void 0){r.identityStore.set(r.idKey,m);var p=m!==h&&h!==null&&m!==null;p&&r.anonymousId(null)}var f=r.identityStore.getAndSync(r.idKey);if(f)return f;var v=r.legacyUserStore.get(t5.cookie.oldKey);return v?typeof v=="object"?v.id:v:null},this.anonymousId=function(m){var h,p;if(r.options.disable)return null;if(m===void 0){var f=(h=r.identityStore.getAndSync(r.anonKey))!==null&&h!==void 0?h:(p=r.legacySIO())===null||p===void 0?void 0:p[0];if(f)return f}return m===null?(r.identityStore.set(r.anonKey,null),r.identityStore.getAndSync(r.anonKey)):(r.identityStore.set(r.anonKey,m??ec()),r.identityStore.getAndSync(r.anonKey))},this.traits=function(m){var h;if(!r.options.disable)return m===null&&(m={}),m&&r.traitsStore.set(r.traitsKey,m??{}),(h=r.traitsStore.get(r.traitsKey))!==null&&h!==void 0?h:{}},this.options=u0(u0({},t5),t),this.cookieOptions=n,this.idKey=(i=(l=t.cookie)===null||l===void 0?void 0:l.key)!==null&&i!==void 0?i:t5.cookie.key,this.traitsKey=(s=(o=t.localStorage)===null||o===void 0?void 0:o.key)!==null&&s!==void 0?s:t5.localStorage.key,this.anonKey="ajs_anonymous_id",this.identityStore=this.createStorage(this.options,n),this.legacyUserStore=this.createStorage(this.options,n,function(m){return m===D6.Cookie}),this.traitsStore=this.createStorage(this.options,n,function(m){return m!==D6.Cookie});var c=this.legacyUserStore.get(t5.cookie.oldKey);c&&typeof c=="object"&&(c.id&&this.id(c.id),c.traits&&this.traits(c.traits)),PS(this)}return a.prototype.legacySIO=function(){var t=this.legacyUserStore.get("_sio");if(!t)return null;var n=t.split("----"),r=n[0],l=n[1];return[r,l]},a.prototype.identify=function(t,n){if(!this.options.disable){n=n??{};var r=this.id();(r===null||r===t)&&(n=u0(u0({},this.traits()),n)),t&&this.id(t),this.traits(n)}},a.prototype.logout=function(){this.anonymousId(null),this.id(null),this.traits({})},a.prototype.reset=function(){this.logout(),this.identityStore.clear(this.idKey),this.identityStore.clear(this.anonKey),this.traitsStore.clear(this.traitsKey)},a.prototype.load=function(){return new a(this.options,this.cookieOptions)},a.prototype.save=function(){return!0},a.prototype.createStorage=function(t,n,r){var l=[D6.LocalStorage,D6.Cookie,D6.Memory];return t.disable?new e5([]):t.persist?(t.storage!==void 0&&t.storage!==null&&kc0(t.storage)&&(l=t.storage.stores),t.localStorageFallbackDisabled&&(l=l.filter(function(i){return i!==D6.LocalStorage})),r&&(l=l.filter(r)),new e5(DS(Sc0(l,n)))):new e5([new RS])},a.defaults=t5,a})(),Lc0={persist:!0,cookie:{key:"ajs_group_id"},localStorage:{key:"ajs_group_properties"}},xR0=(function(a){kt(t,a);function t(n,r){n===void 0&&(n=Lc0);var l=a.call(this,u0(u0({},Lc0),n),r)||this;return l.anonymousId=function(i){},PS(l),l}return t})(Fc0),jS="analytics";function bc0(){return window[jS]}function PR0(a){jS=a}function OR0(a){window[jS]=a}var RR0=function(a){return typeof a=="object"&&a!==null&&"then"in a&&typeof a.then=="function"},_c0=function(a,t,n){n.getAndRemove(a).forEach(function(r){bv(t,r).catch(console.error)})},$R0=function(a,t){return b1(void 0,void 0,void 0,function(){var n,r,l;return _1(this,function(i){switch(i.label){case 0:n=0,r=t.getAndRemove("addSourceMiddleware"),i.label=1;case 1:return n<r.length?(l=r[n],[4,bv(a,l).catch(console.error)]):[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},DR0=function(a,t){return b1(void 0,void 0,void 0,function(){var n,r,l;return _1(this,function(i){switch(i.label){case 0:n=0,r=t.getAndRemove("register"),i.label=1;case 1:return n<r.length?(l=r[n],[4,bv(a,l).catch(console.error)]):[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},jR0=_c0.bind(void 0,"on"),BR0=_c0.bind(void 0,"setAnonymousId"),zR0=function(a,t){Object.keys(t.calls).forEach(function(n){t.getAndRemove(n).forEach(function(r){setTimeout(function(){bv(a,r).catch(console.error)},0)})})},nc=function(a){if(Nc0(a)){var t=a.pop();return Ac0(t)}},Nc0=function(a){var t=a[a.length-1];return AR0(t)},BS=(function(){function a(t,n,r,l){r===void 0&&(r=function(){}),l===void 0&&(l=console.error),this.method=t,this.resolve=r,this.reject=l,this.called=!1,this.args=n}return a})(),UR0=(function(){function a(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._callMap={},this.add.apply(this,t)}return Object.defineProperty(a.prototype,"calls",{get:function(){return this._pushSnippetWindowBuffer(),this._callMap},set:function(t){this._callMap=t},enumerable:!1,configurable:!0}),a.prototype.get=function(t){var n;return(n=this.calls[t])!==null&&n!==void 0?n:[]},a.prototype.getAndRemove=function(t){var n=this.get(t);return this.calls[t]=[],n},a.prototype.add=function(){for(var t=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];n.forEach(function(l){var i=["track","screen","alias","group","page","identify"];i.includes(l.method)&&!Nc0(l.args)&&(l.args=Qe(Qe([],l.args,!0),[Zc0()],!1)),t.calls[l.method]?t.calls[l.method].push(l):t.calls[l.method]=[l]})},a.prototype.clear=function(){this._pushSnippetWindowBuffer(),this.calls={}},a.prototype.toArray=function(){var t;return(t=[]).concat.apply(t,Object.values(this.calls))},a.prototype._pushSnippetWindowBuffer=function(){},a})();function bv(a,t){return b1(this,void 0,void 0,function(){var n,r;return _1(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),t.called?[2,void 0]:(t.called=!0,n=a[t.method].apply(a,t.args),RR0(n)?[4,n]:[3,2]);case 1:l.sent(),l.label=2;case 2:return t.resolve(n),[3,4];case 3:return r=l.sent(),t.reject(r),[3,4];case 4:return[2]}})})}var qR0=(function(){function a(t){var n=this;this.trackSubmit=this._createMethod("trackSubmit"),this.trackClick=this._createMethod("trackClick"),this.trackLink=this._createMethod("trackLink"),this.pageView=this._createMethod("pageview"),this.identify=this._createMethod("identify"),this.reset=this._createMethod("reset"),this.group=this._createMethod("group"),this.track=this._createMethod("track"),this.ready=this._createMethod("ready"),this.alias=this._createMethod("alias"),this.debug=this._createChainableMethod("debug"),this.page=this._createMethod("page"),this.once=this._createChainableMethod("once"),this.off=this._createChainableMethod("off"),this.on=this._createChainableMethod("on"),this.addSourceMiddleware=this._createMethod("addSourceMiddleware"),this.setAnonymousId=this._createMethod("setAnonymousId"),this.addDestinationMiddleware=this._createMethod("addDestinationMiddleware"),this.screen=this._createMethod("screen"),this.register=this._createMethod("register"),this.deregister=this._createMethod("deregister"),this.user=this._createMethod("user"),this.VERSION=kv,this._preInitBuffer=new UR0,this._promise=t(this._preInitBuffer),this._promise.then(function(r){var l=r[0],i=r[1];n.instance=l,n.ctx=i}).catch(function(){})}return a.prototype.then=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=this._promise).then.apply(t,n)},a.prototype.catch=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=this._promise).catch.apply(t,n)},a.prototype.finally=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=this._promise).finally.apply(t,n)},a.prototype._createMethod=function(t){var n=this;return function(){for(var r,l=[],i=0;i<arguments.length;i++)l[i]=arguments[i];if(n.instance){var o=(r=n.instance)[t].apply(r,l);return Promise.resolve(o)}return new Promise(function(s,c){n._preInitBuffer.add(new BS(t,l,s,c))})}},a.prototype._createChainableMethod=function(t){var n=this;return function(){for(var r,l=[],i=0;i<arguments.length;i++)l[i]=arguments[i];return n.instance?((r=n.instance)[t].apply(r,l),n):(n._preInitBuffer.add(new BS(t,l)),n)}},a})(),tu={},a5={},rc={},zS={exports:{}},wc0;function _v(){return wc0||(wc0=1,(function(a){a.exports=t(n),a.exports.find=a.exports,a.exports.replace=function(s,c,m,h){return t(l).call(this,s,c,m,h),s},a.exports.del=function(s,c,m){return t(r).call(this,s,c,null,m),s};function t(s){return function(c,m,h,p){var f=p&&o(p.normalizer)?p.normalizer:i;m=f(m);for(var v,Z=!1;!Z;)E();function E(){for(v in c){var M=f(v);if(m.indexOf(M)===0){var V=m.substr(M.length);if(V.charAt(0)==="."||V.length===0){m=V.substr(1);var L=c[v];if(L==null){Z=!0;return}if(!m.length){Z=!0;return}c=L;return}}}v=void 0,Z=!0}if(v)return c==null?c:s(c,v,h)}}function n(s,c){if(s.hasOwnProperty(c))return s[c]}function r(s,c){return s.hasOwnProperty(c)&&delete s[c],s}function l(s,c,m){return s.hasOwnProperty(c)&&(s[c]=m),s}function i(s){return s.replace(/[^a-zA-Z0-9\.]+/g,"").toLowerCase()}function o(s){return typeof s=="function"}})(zS)),zS.exports}var Cc0;function GR0(){if(Cc0)return rc;Cc0=1;var a=rc&&rc.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(rc,"__esModule",{value:!0});var t=a(_v());function n(l,i){return function(){var o=this.traits(),s=this.properties?this.properties():{};return t.default(o,"address."+l)||t.default(o,l)||(i?t.default(o,"address."+i):null)||(i?t.default(o,i):null)||t.default(s,"address."+l)||t.default(s,l)||(i?t.default(s,"address."+i):null)||(i?t.default(s,i):null)}}function r(l){l.zip=n("postalCode","zip"),l.country=n("country"),l.street=n("street"),l.state=n("state"),l.city=n("city"),l.region=n("region")}return rc.default=r,rc}var au={},Tc0;function WR0(){if(Tc0)return au;Tc0=1,Object.defineProperty(au,"__esModule",{value:!0}),au.clone=void 0;function a(t){if(typeof t!="object")return t;if(Object.prototype.toString.call(t)==="[object Object]"){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=a(t[r]));return n}else return Array.isArray(t)?t.map(a):t}return au.clone=a,au}var Nv={},Ic0;function KR0(){if(Ic0)return Nv;Ic0=1,Object.defineProperty(Nv,"__esModule",{value:!0});var a={Salesforce:!0};function t(n){return!a[n]}return Nv.default=t,Nv}var wv={},xc0;function Pc0(){if(xc0)return wv;xc0=1;var a=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;return wv.parse=function(t){var n=[1,5,6,7,11,12],r=a.exec(t),l=0;if(!r)return new Date(t);for(var i=0,o;o=n[i];i++)r[o]=parseInt(r[o],10)||0;r[2]=parseInt(r[2],10)||1,r[3]=parseInt(r[3],10)||1,r[2]--,r[8]=r[8]?(r[8]+"00").substring(0,3):0,r[4]===" "?l=new Date().getTimezoneOffset():r[9]!=="Z"&&r[10]&&(l=r[11]*60+r[12],r[10]==="+"&&(l=0-l));var s=Date.UTC(r[1],r[2],r[3],r[5],r[6]+l,r[7],r[8]);return new Date(s)},wv.is=function(t,n){return typeof t!="string"||n&&/^\d{4}-\d{2}-\d{2}/.test(t)===!1?!1:a.test(t)},wv}var Cv={},Oc0;function YR0(){if(Oc0)return Cv;Oc0=1;var a=/\d{13}/;return Cv.is=function(t){return a.test(t)},Cv.parse=function(t){return t=parseInt(t,10),new Date(t)},Cv}var Tv={},Rc0;function QR0(){if(Rc0)return Tv;Rc0=1;var a=/\d{10}/;return Tv.is=function(t){return a.test(t)},Tv.parse=function(t){var n=parseInt(t,10)*1e3;return new Date(n)},Tv}var US,$c0;function qS(){if($c0)return US;$c0=1;var a=Pc0(),t=YR0(),n=QR0(),r=Object.prototype,l=r.toString;function i(c){return l.call(c)==="[object Date]"}function o(c){return l.call(c)==="[object Number]"}US=function(m){return i(m)?m:o(m)?new Date(s(m)):a.is(m)?a.parse(m):t.is(m)?t.parse(m):n.is(m)?n.parse(m):new Date(m)};function s(c){return c<315576e5?c*1e3:c}return US}var GS,Dc0;function XR0(){if(Dc0)return GS;Dc0=1;var a=Pc0();GS=t;function t(l,i){return i===void 0&&(i=!0),l&&typeof l=="object"?n(l,i):Array.isArray(l)?r(l,i):a.is(l,i)?a.parse(l):l}function n(l,i){return Object.keys(l).forEach(function(o){l[o]=t(l[o],i)}),l}function r(l,i){return l.forEach(function(o,s){l[s]=t(o,i)}),l}return GS}var jc0;function n5(){if(jc0)return a5;jc0=1;var a=a5&&a5.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(a5,"__esModule",{value:!0}),a5.Facade=void 0;var t=a(GR0()),n=WR0(),r=a(KR0()),l=a(qS()),i=a(_v()),o=a(XR0());function s(h,p){p=p||{},this.raw=n.clone(h),"clone"in p||(p.clone=!0),p.clone&&(h=n.clone(h)),"traverse"in p||(p.traverse=!0),"timestamp"in h?h.timestamp=l.default(h.timestamp):h.timestamp=new Date,p.traverse&&o.default(h),this.opts=p,this.obj=h}a5.Facade=s;var c=s.prototype;c.proxy=function(h){var p=h.split(".");h=p.shift();var f=this[h]||this.obj[h];return f&&(typeof f=="function"&&(f=f.call(this)||{}),p.length===0?this.opts.clone?m(f):f:(f=i.default(f,p.join(".")),this.opts.clone?m(f):f))},c.field=function(h){var p=this.obj[h];return this.opts.clone?m(p):p},s.proxy=function(h){return function(){return this.proxy(h)}},s.field=function(h){return function(){return this.field(h)}},s.multi=function(h){return function(){var p=this.proxy(h+"s");if(Array.isArray(p))return p;var f=this.proxy(h);return f&&(f=[this.opts.clone?n.clone(f):f]),f||[]}},s.one=function(h){return function(){var p=this.proxy(h);if(p)return p;var f=this.proxy(h+"s");if(Array.isArray(f))return f[0]}},c.json=function(){var h=this.opts.clone?n.clone(this.obj):this.obj;return this.type&&(h.type=this.type()),h},c.rawEvent=function(){return this.raw},c.options=function(h){var p=this.obj.options||this.obj.context||{},f=this.opts.clone?n.clone(p):p;if(!h)return f;if(this.enabled(h)){var v=this.integrations(),Z=v[h]||i.default(v,h);return typeof Z!="object"&&(Z=i.default(this.options(),h)),typeof Z=="object"?Z:{}}},c.context=c.options,c.enabled=function(h){var p=this.proxy("options.providers.all");typeof p!="boolean"&&(p=this.proxy("options.all")),typeof p!="boolean"&&(p=this.proxy("integrations.all")),typeof p!="boolean"&&(p=!0);var f=p&&r.default(h),v=this.integrations();if(v.providers&&v.providers.hasOwnProperty(h)&&(f=v.providers[h]),v.hasOwnProperty(h)){var Z=v[h];typeof Z=="boolean"?f=Z:f=!0}return!!f},c.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()},c.active=function(){var h=this.proxy("options.active");return h==null&&(h=!0),h},c.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")},c.sessionId=c.anonymousId,c.groupId=s.proxy("options.groupId"),c.traits=function(h){var p=this.proxy("options.traits")||{},f=this.userId();h=h||{},f&&(p.id=f);for(var v in h)if(Object.prototype.hasOwnProperty.call(h,v)){var Z=this[v]==null?this.proxy("options.traits."+v):this[v]();if(Z==null)continue;p[h[v]]=Z,delete p[v]}return p},c.library=function(){var h=this.proxy("options.library");return h?typeof h=="string"?{name:h,version:null}:h:{name:"unknown",version:null}},c.device=function(){var h=this.proxy("context.device");(typeof h!="object"||h===null)&&(h={});var p=this.library().name;return h.type||(p.indexOf("ios")>-1&&(h.type="ios"),p.indexOf("android")>-1&&(h.type="android")),h},c.userAgent=s.proxy("context.userAgent"),c.timezone=s.proxy("context.timezone"),c.timestamp=s.field("timestamp"),c.channel=s.field("channel"),c.ip=s.proxy("context.ip"),c.userId=s.field("userId"),t.default(c);function m(h){return n.clone(h)}return a5}var r5={},Iv={exports:{}},Bc0;function l5(){return Bc0||(Bc0=1,typeof Object.create=="function"?Iv.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Iv.exports=function(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}),Iv.exports}var zc0;function JR0(){if(zc0)return r5;zc0=1;var a=r5&&r5.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(r5,"__esModule",{value:!0}),r5.Alias=void 0;var t=a(l5()),n=n5();function r(l,i){n.Facade.call(this,l,i)}return r5.Alias=r,t.default(r,n.Facade),r.prototype.action=function(){return"alias"},r.prototype.type=r.prototype.action,r.prototype.previousId=function(){return this.field("previousId")||this.field("from")},r.prototype.from=r.prototype.previousId,r.prototype.userId=function(){return this.field("userId")||this.field("to")},r.prototype.to=r.prototype.userId,r5}var i5={},xv={},Uc0;function Pv(){if(Uc0)return xv;Uc0=1,Object.defineProperty(xv,"__esModule",{value:!0});var a=/.+\@.+\..+/;function t(n){return a.test(n)}return xv.default=t,xv}var qc0;function e$0(){if(qc0)return i5;qc0=1;var a=i5&&i5.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(i5,"__esModule",{value:!0}),i5.Group=void 0;var t=a(l5()),n=a(Pv()),r=a(qS()),l=n5();function i(s,c){l.Facade.call(this,s,c)}i5.Group=i,t.default(i,l.Facade);var o=i.prototype;return o.action=function(){return"group"},o.type=o.action,o.groupId=l.Facade.field("groupId"),o.created=function(){var s=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");if(s)return r.default(s)},o.email=function(){var s=this.proxy("traits.email");if(s)return s;var c=this.groupId();if(n.default(c))return c},o.traits=function(s){var c=this.properties(),m=this.groupId();s=s||{},m&&(c.id=m);for(var h in s)if(Object.prototype.hasOwnProperty.call(s,h)){var p=this[h]==null?this.proxy("traits."+h):this[h]();if(p==null)continue;c[s[h]]=p,delete c[h]}return c},o.name=l.Facade.proxy("traits.name"),o.industry=l.Facade.proxy("traits.industry"),o.employees=l.Facade.proxy("traits.employees"),o.properties=function(){return this.field("traits")||this.field("properties")||{}},i5}var o5={},Gc0;function Wc0(){if(Gc0)return o5;Gc0=1;var a=o5&&o5.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(o5,"__esModule",{value:!0}),o5.Identify=void 0;var t=n5(),n=a(_v()),r=a(l5()),l=a(Pv()),i=a(qS()),o=function(m){return m.trim()};function s(m,h){t.Facade.call(this,m,h)}o5.Identify=s,r.default(s,t.Facade);var c=s.prototype;return c.action=function(){return"identify"},c.type=c.action,c.traits=function(m){var h=this.field("traits")||{},p=this.userId();m=m||{},p&&(h.id=p);for(var f in m){var v=this[f]==null?this.proxy("traits."+f):this[f]();v!=null&&(h[m[f]]=v,f!==m[f]&&delete h[f])}return h},c.email=function(){var m=this.proxy("traits.email");if(m)return m;var h=this.userId();if(l.default(h))return h},c.created=function(){var m=this.proxy("traits.created")||this.proxy("traits.createdAt");if(m)return i.default(m)},c.companyCreated=function(){var m=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(m)return i.default(m)},c.companyName=function(){return this.proxy("traits.company.name")},c.name=function(){var m=this.proxy("traits.name");if(typeof m=="string")return o(m);var h=this.firstName(),p=this.lastName();if(h&&p)return o(h+" "+p)},c.firstName=function(){var m=this.proxy("traits.firstName");if(typeof m=="string")return o(m);var h=this.proxy("traits.name");if(typeof h=="string")return o(h).split(" ")[0]},c.lastName=function(){var m=this.proxy("traits.lastName");if(typeof m=="string")return o(m);var h=this.proxy("traits.name");if(typeof h=="string"){var p=o(h).indexOf(" ");if(p!==-1)return o(h.substr(p+1))}},c.uid=function(){return this.userId()||this.username()||this.email()},c.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")},c.age=function(){var m=this.birthday(),h=n.default(this.traits(),"age");if(h!=null)return h;if(m instanceof Date){var p=new Date;return p.getFullYear()-m.getFullYear()}},c.avatar=function(){var m=this.traits();return n.default(m,"avatar")||n.default(m,"photoUrl")||n.default(m,"avatarUrl")},c.position=function(){var m=this.traits();return n.default(m,"position")||n.default(m,"jobTitle")},c.username=t.Facade.proxy("traits.username"),c.website=t.Facade.one("traits.website"),c.websites=t.Facade.multi("traits.website"),c.phone=t.Facade.one("traits.phone"),c.phones=t.Facade.multi("traits.phone"),c.address=t.Facade.proxy("traits.address"),c.gender=t.Facade.proxy("traits.gender"),c.birthday=t.Facade.proxy("traits.birthday"),o5}var s5={},Kc0;function WS(){if(Kc0)return s5;Kc0=1;var a=s5&&s5.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(s5,"__esModule",{value:!0}),s5.Track=void 0;var t=a(l5()),n=n5(),r=Wc0(),l=a(Pv()),i=a(_v());function o(m,h){n.Facade.call(this,m,h)}s5.Track=o,t.default(o,n.Facade);var s=o.prototype;s.action=function(){return"track"},s.type=s.action,s.event=n.Facade.field("event"),s.value=n.Facade.proxy("properties.value"),s.category=n.Facade.proxy("properties.category"),s.id=n.Facade.proxy("properties.id"),s.productId=function(){return this.proxy("properties.product_id")||this.proxy("properties.productId")},s.promotionId=function(){return this.proxy("properties.promotion_id")||this.proxy("properties.promotionId")},s.cartId=function(){return this.proxy("properties.cart_id")||this.proxy("properties.cartId")},s.checkoutId=function(){return this.proxy("properties.checkout_id")||this.proxy("properties.checkoutId")},s.paymentId=function(){return this.proxy("properties.payment_id")||this.proxy("properties.paymentId")},s.couponId=function(){return this.proxy("properties.coupon_id")||this.proxy("properties.couponId")},s.wishlistId=function(){return this.proxy("properties.wishlist_id")||this.proxy("properties.wishlistId")},s.reviewId=function(){return this.proxy("properties.review_id")||this.proxy("properties.reviewId")},s.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.order_id")||this.proxy("properties.orderId")},s.sku=n.Facade.proxy("properties.sku"),s.tax=n.Facade.proxy("properties.tax"),s.name=n.Facade.proxy("properties.name"),s.price=n.Facade.proxy("properties.price"),s.total=n.Facade.proxy("properties.total"),s.repeat=n.Facade.proxy("properties.repeat"),s.coupon=n.Facade.proxy("properties.coupon"),s.shipping=n.Facade.proxy("properties.shipping"),s.discount=n.Facade.proxy("properties.discount"),s.shippingMethod=function(){return this.proxy("properties.shipping_method")||this.proxy("properties.shippingMethod")},s.paymentMethod=function(){return this.proxy("properties.payment_method")||this.proxy("properties.paymentMethod")},s.description=n.Facade.proxy("properties.description"),s.plan=n.Facade.proxy("properties.plan"),s.subtotal=function(){var m=i.default(this.properties(),"subtotal"),h=this.total()||this.revenue();if(m)return m;if(!h)return 0;if(this.total()){var p=this.tax();p&&(h-=p),p=this.shipping(),p&&(h-=p),p=this.discount(),p&&(h+=p)}return h},s.products=function(){var m=this.properties(),h=i.default(m,"products");return Array.isArray(h)?h.filter(function(p){return p!==null}):[]},s.quantity=function(){var m=this.obj.properties||{};return m.quantity||1},s.currency=function(){var m=this.obj.properties||{};return m.currency||"USD"},s.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},s.query=n.Facade.proxy("options.query"),s.properties=function(m){var h=this.field("properties")||{};m=m||{};for(var p in m)if(Object.prototype.hasOwnProperty.call(m,p)){var f=this[p]==null?this.proxy("properties."+p):this[p]();if(f==null)continue;h[m[p]]=f,delete h[p]}return h},s.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()},s.email=function(){var m=this.proxy("traits.email")||this.proxy("properties.email")||this.proxy("options.traits.email");if(m)return m;var h=this.userId();if(l.default(h))return h},s.revenue=function(){var m=this.proxy("properties.revenue"),h=this.event(),p=/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;return!m&&h&&h.match(p)&&(m=this.proxy("properties.total")),c(m)},s.cents=function(){var m=this.revenue();return typeof m!="number"?this.value()||0:m*100},s.identify=function(){var m=this.json();return m.traits=this.traits(),new r.Identify(m,this.opts)};function c(m){if(m){if(typeof m=="number")return m;if(typeof m=="string"&&(m=m.replace(/\$/g,""),m=parseFloat(m),!isNaN(m)))return m}}return s5}var c5={},Yc0;function Qc0(){if(Yc0)return c5;Yc0=1;var a=c5&&c5.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(c5,"__esModule",{value:!0}),c5.Page=void 0;var t=a(l5()),n=n5(),r=WS(),l=a(Pv());function i(s,c){n.Facade.call(this,s,c)}c5.Page=i,t.default(i,n.Facade);var o=i.prototype;return o.action=function(){return"page"},o.type=o.action,o.category=n.Facade.field("category"),o.name=n.Facade.field("name"),o.title=n.Facade.proxy("properties.title"),o.path=n.Facade.proxy("properties.path"),o.url=n.Facade.proxy("properties.url"),o.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},o.properties=function(s){var c=this.field("properties")||{},m=this.category(),h=this.name();s=s||{},m&&(c.category=m),h&&(c.name=h);for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p)){var f=this[p]==null?this.proxy("properties."+p):this[p]();if(f==null)continue;c[s[p]]=f,p!==s[p]&&delete c[p]}return c},o.email=function(){var s=this.proxy("context.traits.email")||this.proxy("properties.email");if(s)return s;var c=this.userId();if(l.default(c))return c},o.fullName=function(){var s=this.category(),c=this.name();return c&&s?s+" "+c:c},o.event=function(s){return s?"Viewed "+s+" Page":"Loaded a Page"},o.track=function(s){var c=this.json();return c.event=this.event(s),c.timestamp=this.timestamp(),c.properties=this.properties(),new r.Track(c,this.opts)},c5}var d5={},Xc0;function t$0(){if(Xc0)return d5;Xc0=1;var a=d5&&d5.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(d5,"__esModule",{value:!0}),d5.Screen=void 0;var t=a(l5()),n=Qc0(),r=WS();function l(i,o){n.Page.call(this,i,o)}return d5.Screen=l,t.default(l,n.Page),l.prototype.action=function(){return"screen"},l.prototype.type=l.prototype.action,l.prototype.event=function(i){return i?"Viewed "+i+" Screen":"Loaded a Screen"},l.prototype.track=function(i){var o=this.json();return o.event=this.event(i),o.timestamp=this.timestamp(),o.properties=this.properties(),new r.Track(o,this.opts)},d5}var m5={},Jc0;function a$0(){if(Jc0)return m5;Jc0=1;var a=m5&&m5.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(m5,"__esModule",{value:!0}),m5.Delete=void 0;var t=a(l5()),n=n5();function r(l,i){n.Facade.call(this,l,i)}return m5.Delete=r,t.default(r,n.Facade),r.prototype.type=function(){return"delete"},m5}var ed0;function n$0(){return ed0||(ed0=1,(function(a){var t=tu&&tu.__assign||function(){return t=Object.assign||function(h){for(var p,f=1,v=arguments.length;f<v;f++){p=arguments[f];for(var Z in p)Object.prototype.hasOwnProperty.call(p,Z)&&(h[Z]=p[Z])}return h},t.apply(this,arguments)};Object.defineProperty(a,"__esModule",{value:!0}),a.Delete=a.Screen=a.Page=a.Track=a.Identify=a.Group=a.Alias=a.Facade=void 0;var n=n5();Object.defineProperty(a,"Facade",{enumerable:!0,get:function(){return n.Facade}});var r=JR0();Object.defineProperty(a,"Alias",{enumerable:!0,get:function(){return r.Alias}});var l=e$0();Object.defineProperty(a,"Group",{enumerable:!0,get:function(){return l.Group}});var i=Wc0();Object.defineProperty(a,"Identify",{enumerable:!0,get:function(){return i.Identify}});var o=WS();Object.defineProperty(a,"Track",{enumerable:!0,get:function(){return o.Track}});var s=Qc0();Object.defineProperty(a,"Page",{enumerable:!0,get:function(){return s.Page}});var c=t$0();Object.defineProperty(a,"Screen",{enumerable:!0,get:function(){return c.Screen}});var m=a$0();Object.defineProperty(a,"Delete",{enumerable:!0,get:function(){return m.Delete}}),a.default=t(t({},n.Facade),{Alias:r.Alias,Group:l.Group,Identify:i.Identify,Track:o.Track,Page:s.Page,Screen:c.Screen,Delete:m.Delete})})(tu)),tu}var j4=n$0();function Ov(a,t){var n=new j4.Facade(a,t);return a.type==="track"&&(n=new j4.Track(a,t)),a.type==="identify"&&(n=new j4.Identify(a,t)),a.type==="page"&&(n=new j4.Page(a,t)),a.type==="alias"&&(n=new j4.Alias(a,t)),a.type==="group"&&(n=new j4.Group(a,t)),a.type==="screen"&&(n=new j4.Screen(a,t)),Object.defineProperty(n,"obj",{value:a,writable:!0}),n}var r$0=function(a){var t=!1;window.addEventListener("pagehide",function(){t||(t=!0,a(t))}),document.addEventListener("visibilitychange",function(){if(document.visibilityState=="hidden"){if(t)return;t=!0}else t=!1;a(t)})},td0=(function(a){kt(t,a);function t(n,r){var l=a.call(this,n)||this;return l.retryTimeout=r,l.name="RateLimitError",l}return t})(Error),ad0=function(a){return u0({"Content-Type":"text/plain"},typeof a=="function"?a():a)},l$0=500,i$0=64;function KS(a){var t=encodeURI(JSON.stringify(a)).split(/%..|./).length-1;return t/1024}function o$0(a){return KS(a)>=l$0-50}function s$0(a){return KS(a)>=i$0-10}function c$0(a){var t=[],n=0;return a.forEach(function(r){var l=KS(t[n]);l>=64&&n++,t[n]?t[n].push(r):t[n]=[r]}),t}function d$0(a,t){var n,r,l=[],i=!1,o=(n=t?.size)!==null&&n!==void 0?n:10,s=(r=t?.timeout)!==null&&r!==void 0?r:5e3,c=0;function m(Z){var E;if(Z.length!==0){var M=(E=Z[0])===null||E===void 0?void 0:E.writeKey,V=Z.map(function(L){var b=L;b.sentAt;var N=R6(b,["sentAt"]);return N});return Vv("https://".concat(a,"/b"),{credentials:t?.credentials,keepalive:t?.keepalive||i,headers:ad0(t?.headers),method:"post",body:JSON.stringify({writeKey:M,batch:V,sentAt:new Date().toISOString()}),priority:t?.priority}).then(function(L){var b;if(L.status>=500)throw new Error("Bad response from server: ".concat(L.status));if(L.status===429){var N=(b=L.headers)===null||b===void 0?void 0:b.get("x-ratelimit-reset"),F=typeof N=="string"?parseInt(N)*1e3:s;throw new td0("Rate limit exceeded: ".concat(L.status),F)}})}}function h(Z){var E;return Z===void 0&&(Z=1),b1(this,void 0,void 0,function(){var M;return _1(this,function(V){return l.length?(M=l,l=[],[2,(E=m(M))===null||E===void 0?void 0:E.catch(function(L){var b,N=Vr.system();N.log("error","Error sending batch",L),Z<=((b=t?.maxRetries)!==null&&b!==void 0?b:10)&&(L.name==="RateLimitError"&&(c=L.retryTimeout),l.push.apply(l,M),l.map(function(F){if("_metadata"in F){var w=F;w._metadata=u0(u0({},w._metadata),{retryCount:Z})}}),f(Z+1))})]):[2]})})}var p;function f(Z){Z===void 0&&(Z=1),!p&&(p=setTimeout(function(){p=void 0,h(Z).catch(console.error)},c||s),c=0)}r$0(function(Z){if(i=Z,i&&l.length){var E=c$0(l).map(m);Promise.all(E).catch(console.error)}});function v(Z,E){return b1(this,void 0,void 0,function(){var M;return _1(this,function(V){return l.push(E),M=l.length>=o||o$0(l)||t?.keepalive&&s$0(l),[2,M||i?h():f()]})})}return{dispatch:v}}function m$0(a){function t(n,r){return Vv(n,{credentials:a?.credentials,keepalive:a?.keepalive,headers:ad0(a?.headers),method:"post",body:JSON.stringify(r),priority:a?.priority}).then(function(l){var i;if(l.status>=500)throw new Error("Bad response from server: ".concat(l.status));if(l.status===429){var o=(i=l.headers)===null||i===void 0?void 0:i.get("x-ratelimit-reset"),s=o?parseInt(o)*1e3:5e3;throw new td0("Rate limit exceeded: ".concat(l.status),s)}})}return{dispatch:t}}function u$0(a,t,n,r,l){var i,o=a.user();delete t.options,t.writeKey=n?.apiKey,t.userId=t.userId||o.id(),t.anonymousId=t.anonymousId||o.anonymousId(),t.sentAt=new Date;var s=a.queue.failedInitializations||[];s.length>0&&(t._metadata={failedInitializations:s}),l!=null&&(l.attempts>1&&(t._metadata=u0(u0({},t._metadata),{retryCount:l.attempts})),l.attempts++);var c=[],m=[];for(var h in r){var p=r[h];h==="Segment.io"&&c.push(h),p.bundlingStatus==="bundled"&&c.push(h),p.bundlingStatus==="unbundled"&&m.push(h)}for(var f=0,v=n?.unbundledIntegrations||[];f<v.length;f++){var Z=v[f];m.includes(Z)||m.push(Z)}var E=(i=n?.maybeBundledConfigIds)!==null&&i!==void 0?i:{},M=[];return c.sort().forEach(function(V){var L;((L=E[V])!==null&&L!==void 0?L:[]).forEach(function(b){M.push(b)})}),n?.addBundledMetadata!==!1&&(t._metadata=u0(u0({},t._metadata),{bundled:c.sort(),unbundled:m.sort(),bundledIds:M})),t}var nd0=function(a,t){return b1(void 0,void 0,void 0,function(){var n;return _1(this,function(r){return n=function(l){return b1(void 0,void 0,void 0,function(){var i;return _1(this,function(o){switch(o.label){case 0:return a(l)?(i=n,[4,t()]):[3,2];case 1:return[2,i.apply(void 0,[o.sent()])];case 2:return[2]}})})},[2,n(void 0)]})})};function h$0(a,t){return b1(this,void 0,void 0,function(){var n,r=this;return _1(this,function(l){switch(l.label){case 0:return n=[],s3()?[2,t]:[4,nd0(function(){return t.length>0&&!s3()},function(){return b1(r,void 0,void 0,function(){var i,o,s;return _1(this,function(c){switch(c.label){case 0:return i=t.pop(),i?[4,tc(i,a)]:[2];case 1:return o=c.sent(),s=o instanceof Vr,s||n.push(i),[2]}})})})];case 1:return l.sent(),n.map(function(i){return t.pushWithBackoff(i)}),[2,t]}})})}function lc(a,t,n,r){var l=this;a||setTimeout(function(){return b1(l,void 0,void 0,function(){var i,o;return _1(this,function(s){switch(s.label){case 0:return i=!0,[4,h$0(n,t)];case 1:return o=s.sent(),i=!1,t.todo>0&&r(i,o,n,r),[2]}})})},Math.random()*5e3)}function p$0(a,t){var n,r,l,i,o=a.user();return t.previousId=(l=(r=(n=t.previousId)!==null&&n!==void 0?n:t.from)!==null&&r!==void 0?r:o.id())!==null&&l!==void 0?l:o.anonymousId(),t.userId=(i=t.userId)!==null&&i!==void 0?i:t.to,delete t.from,delete t.to,t}var f$0=function(a){return a.name==="Segment.io"};function g$0(a,t,n){var r,l,i;window.addEventListener("pagehide",function(){s.push.apply(s,Array.from(c)),c.clear()});var o=(r=t?.apiKey)!==null&&r!==void 0?r:"",s=a.options.disableClientPersistence?new Jm(a.queue.queue.maxAttempts,[]):new Fv(a.queue.queue.maxAttempts,"".concat(o,":dest-Segment.io")),c=new Set,m=!1,h=(l=t?.apiHost)!==null&&l!==void 0?l:pc0,p=(i=t?.protocol)!==null&&i!==void 0?i:"https",f="".concat(p,"://").concat(h),v=t?.deliveryStrategy,Z=v&&"strategy"in v&&v.strategy==="batching"?d$0(h,v.config):m$0(v?.config);function E(V){return b1(this,void 0,void 0,function(){var L,b;return _1(this,function(N){return s3()?(s.push(V),lc(m,s,M,lc),[2,V]):(c.add(V),L=V.event.type.charAt(0),b=Ov(V.event).json(),V.event.type==="track"&&delete b.traits,V.event.type==="alias"&&(b=p$0(a,b)),s.getAttempts(V)>=s.maxAttempts?(c.delete(V),[2,V]):[2,Z.dispatch("".concat(f,"/").concat(L),u$0(a,b,t,n,V)).then(function(){return V}).catch(function(F){if(V.log("error","Error sending event",F),F.name==="RateLimitError"){var w=F.retryTimeout;s.pushWithBackoff(V,w)}else s.pushWithBackoff(V);return lc(m,s,M,lc),V}).finally(function(){c.delete(V)})])})})}var M={metadata:{writeKey:o,apiHost:h,protocol:p},name:"Segment.io",type:"destination",version:"0.1.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:E,identify:E,page:E,alias:E,group:E,screen:E};return s.todo&&lc(m,s,M,lc),M}var c3="This is being deprecated and will be not be available in future releases of Analytics JS",YS=TS(),QS=YS?.analytics;function v$0(a,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=t?10:1,l=n?new Jm(r,[]):new Fv(r,a);return new bR0(l)}var A$0=(function(){function a(t,n){var r;this.timeout=300,this._getSegmentPluginMetadata=function(){var i;return(i=n.plugins.find(f$0))===null||i===void 0?void 0:i.metadata},this.writeKey=t.writeKey;var l={integrations:{"Segment.io":{apiKey:""}}};this.cdnSettings=(r=t.cdnSettings)!==null&&r!==void 0?r:l,this.cdnURL=t.cdnURL}return Object.defineProperty(a.prototype,"apiHost",{get:function(){var t,n;return(n=(t=this._getSegmentPluginMetadata)===null||t===void 0?void 0:t.call(this))===null||n===void 0?void 0:n.apiHost},enumerable:!1,configurable:!0}),a})();function Sr(){console.warn(c3)}var rd0=(function(a){kt(t,a);function t(n,r,l,i,o){var s=this,c,m;s=a.call(this)||this,s._debug=!1,s.initialized=!1,s.user=function(){return s._user},s.init=s.initialize.bind(s),s.log=Sr,s.addIntegrationMiddleware=Sr,s.listeners=Sr,s.addEventListener=Sr,s.removeAllListeners=Sr,s.removeListener=Sr,s.removeEventListener=Sr,s.hasListeners=Sr,s.add=Sr,s.addIntegration=Sr;var h=r?.cookie,p=(c=r?.disableClientPersistence)!==null&&c!==void 0?c:!1;s.queue=l??v$0("".concat(n.writeKey,":event-queue"),r?.retryQueue,p),s.settings=new A$0(n,s.queue);var f=r?.storage;return s._universalStorage=s.createStore(p,f,h),s._user=i??new Fc0(u0({persist:!p,storage:r?.storage},r?.user),h).load(),s._group=o??new xR0(u0({persist:!p,storage:r?.storage},r?.group),h).load(),s.eventFactory=new VR0(s._user),s.integrations=(m=r?.integrations)!==null&&m!==void 0?m:{},s.options=r??{},PS(s),s}return t.prototype.createStore=function(n,r,l){return n?new e5([new RS]):r&&kc0(r)?new e5(DS(Sc0(r.stores,l))):new e5(DS([D6.LocalStorage,{name:D6.Cookie,settings:l},D6.Memory]))},Object.defineProperty(t.prototype,"storage",{get:function(){return this._universalStorage},enumerable:!1,configurable:!0}),t.prototype.track=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p=this;return _1(this,function(f){return l=nc(n),i=mR0.apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],h=this.eventFactory.track(o,s,c,this.integrations,l),[2,this._dispatch(h,m).then(function(v){return p.emit("track",o,v.event.properties,v.event.options),v})]})})},t.prototype.page=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p,f=this;return _1(this,function(v){return l=nc(n),i=dc0.apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],h=i[4],p=this.eventFactory.page(o,s,c,m,this.integrations,l),[2,this._dispatch(p,h).then(function(Z){return f.emit("page",o,s,Z.event.properties,Z.event.options),Z})]})})},t.prototype.identify=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p=this;return _1(this,function(f){return l=nc(n),i=mc0(this._user).apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],this._user.identify(o,s),h=this.eventFactory.identify(this._user.id(),this._user.traits(),c,this.integrations,l),[2,this._dispatch(h,m).then(function(v){return p.emit("identify",v.event.userId,v.event.traits,v.event.options),v})]})})},t.prototype.group=function(){for(var n=this,r=[],l=0;l<arguments.length;l++)r[l]=arguments[l];var i=nc(r);if(r.length===0)return this._group;var o=mc0(this._group).apply(void 0,r),s=o[0],c=o[1],m=o[2],h=o[3];this._group.identify(s,c);var p=this._group.id(),f=this._group.traits(),v=this.eventFactory.group(p,f,m,this.integrations,i);return this._dispatch(v,h).then(function(Z){return n.emit("group",Z.event.groupId,Z.event.traits,Z.event.options),Z})},t.prototype.alias=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p=this;return _1(this,function(f){return l=nc(n),i=uR0.apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],h=this.eventFactory.alias(o,s,c,this.integrations,l),[2,this._dispatch(h,m).then(function(v){return p.emit("alias",o,s,v.event.options),v})]})})},t.prototype.screen=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o,s,c,m,h,p,f=this;return _1(this,function(v){return l=nc(n),i=dc0.apply(void 0,n),o=i[0],s=i[1],c=i[2],m=i[3],h=i[4],p=this.eventFactory.screen(o,s,c,m,this.integrations,l),[2,this._dispatch(p,h).then(function(Z){return f.emit("screen",o,s,Z.event.properties,Z.event.options),Z})]})})},t.prototype.trackClick=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return[4,Promise.resolve().then(()=>LH)];case 1:return l=o.sent(),[2,(i=l.link).call.apply(i,Qe([this],n,!1))]}})})},t.prototype.trackLink=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return[4,Promise.resolve().then(()=>LH)];case 1:return l=o.sent(),[2,(i=l.link).call.apply(i,Qe([this],n,!1))]}})})},t.prototype.trackSubmit=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return[4,Promise.resolve().then(()=>LH)];case 1:return l=o.sent(),[2,(i=l.form).call.apply(i,Qe([this],n,!1))]}})})},t.prototype.trackForm=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return[4,Promise.resolve().then(()=>LH)];case 1:return l=o.sent(),[2,(i=l.form).call.apply(i,Qe([this],n,!1))]}})})},t.prototype.register=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o=this;return _1(this,function(s){switch(s.label){case 0:return l=Vr.system(),i=n.map(function(c){return o.queue.register(l,c,o)}),[4,Promise.all(i)];case 1:return s.sent(),[2,l]}})})},t.prototype.deregister=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return b1(this,void 0,void 0,function(){var l,i,o=this;return _1(this,function(s){switch(s.label){case 0:return l=Vr.system(),i=n.map(function(c){var m=o.queue.plugins.find(function(h){return h.name===c});if(m)return o.queue.deregister(l,m,o);l.log("warn","plugin ".concat(c," not found"))}),[4,Promise.all(i)];case 1:return s.sent(),[2,l]}})})},t.prototype.debug=function(n){return n===!1&&localStorage.getItem("debug")&&localStorage.removeItem("debug"),this._debug=n,this},t.prototype.reset=function(){this._user.reset(),this._group.reset(),this.emit("reset")},t.prototype.timeout=function(n){this.settings.timeout=n},t.prototype._dispatch=function(n,r){return b1(this,void 0,void 0,function(){var l;return _1(this,function(i){return l=new Vr(n),l.stats.increment("analytics_js.invoke",1,[n.type]),s3()&&!this.options.retryQueue?[2,l]:[2,cc0(l,this.queue,this,{callback:r,debug:this._debug,timeout:this.settings.timeout})]})})},t.prototype.addSourceMiddleware=function(n){return b1(this,void 0,void 0,function(){var r=this;return _1(this,function(l){switch(l.label){case 0:return[4,this.queue.criticalTasks.run(function(){return b1(r,void 0,void 0,function(){var i,o,s;return _1(this,function(c){switch(c.label){case 0:return[4,Promise.resolve().then(()=>T$0)];case 1:return i=c.sent().sourceMiddlewarePlugin,o={},this.queue.plugins.forEach(function(m){if(m.type==="destination")return o[m.name]=!0}),s=i(n,o),[4,this.register(s)];case 2:return c.sent(),[2]}})})})];case 1:return l.sent(),[2,this]}})})},t.prototype.addDestinationMiddleware=function(n){for(var r=[],l=1;l<arguments.length;l++)r[l-1]=arguments[l];return this.queue.plugins.filter(kR0).forEach(function(i){(n==="*"||i.name.toLowerCase()===n.toLowerCase())&&i.addMiddleware.apply(i,r)}),Promise.resolve(this)},t.prototype.setAnonymousId=function(n){return this._user.anonymousId(n)},t.prototype.queryString=function(n){return b1(this,void 0,void 0,function(){var r;return _1(this,function(l){switch(l.label){case 0:return this.options.useQueryString===!1?[2,[]]:[4,Promise.resolve().then(()=>dm1)];case 1:return r=l.sent().queryString,[2,r(this,n)]}})})},t.prototype.use=function(n){return n(this),this},t.prototype.ready=function(n){return n===void 0&&(n=function(r){return r}),b1(this,void 0,void 0,function(){return _1(this,function(r){return[2,Promise.all(this.queue.plugins.map(function(l){return l.ready?l.ready():Promise.resolve()})).then(function(l){return n(l),l})]})})},t.prototype.noConflict=function(){return console.warn(c3),OR0(QS??this),this},t.prototype.normalize=function(n){return console.warn(c3),this.eventFactory.normalize(n)},Object.defineProperty(t.prototype,"failedInitializations",{get:function(){return console.warn(c3),this.queue.failedInitializations},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"VERSION",{get:function(){return kv},enumerable:!1,configurable:!0}),t.prototype.initialize=function(n,r){return b1(this,void 0,void 0,function(){return _1(this,function(l){return console.warn(c3),[2,Promise.resolve(this)]})})},t.prototype.pageview=function(n){return b1(this,void 0,void 0,function(){return _1(this,function(r){switch(r.label){case 0:return console.warn(c3),[4,this.page({path:n})];case 1:return r.sent(),[2,this]}})})},Object.defineProperty(t.prototype,"plugins",{get:function(){var n;return console.warn(c3),(n=this._plugins)!==null&&n!==void 0?n:{}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Integrations",{get:function(){console.warn(c3);var n=this.queue.plugins.filter(function(r){return r.type==="destination"}).reduce(function(r,l){var i="".concat(l.name.toLowerCase().replace(".","").split(" ").join("-"),"Integration"),o=window[i];if(!o)return r;var s=o.Integration;return s?(r[l.name]=s,r):(r[l.name]=o,r)},{});return n},enumerable:!1,configurable:!0}),t.prototype.push=function(n){var r=this,l=n.shift();l&&!r[l]||r[l].apply(this,n)},t})(J7),ld0=(function(a){kt(t,a);function t(){var n=a.call(this,{writeKey:""},{disableClientPersistence:!0})||this;return n.initialized=!0,n}return t})(rd0),id0={};function od0(){return typeof process>"u"||!id0?{}:id0}var Z$0=/(https:\/\/.*)\/analytics\.js\/v1\/(?:.*?)\/(?:platform|analytics.*)?/,H$0=function(){var a,t=Array.prototype.slice.call(document.querySelectorAll("script"));return t.forEach(function(n){var r,l=(r=n.getAttribute("src"))!==null&&r!==void 0?r:"",i=Z$0.exec(l);i&&i[1]&&(a=i[1])}),a},Rv,E$0=function(){var a,t=Rv??((a=bc0())===null||a===void 0?void 0:a._cdn);return t},M$0=function(a){var t=bc0();t&&(t._cdn=a),Rv=a},XS=function(){var a=E$0();if(a)return a;var t=H$0();return t||"https://cdn.segment.com"},JS=function(){var a=XS();return"".concat(a,"/next-integrations")};function sd0(a,t){var n,r=Object.entries((n=t.integrations)!==null&&n!==void 0?n:{}).reduce(function(l,i){var o,s,c=i[0],m=i[1];return typeof m=="object"?u0(u0({},l),(o={},o[c]=m,o)):u0(u0({},l),(s={},s[c]={},s))},{});return Object.entries(a.integrations).reduce(function(l,i){var o,s=i[0],c=i[1];return u0(u0({},l),(o={},o[s]=u0(u0({},c),r[s]),o))},{})}function cd0(a){try{return decodeURIComponent(a.replace(/\+/g," "))}catch{return a}}function y$0(a){return b1(this,void 0,void 0,function(){var t;return _1(this,function(n){return t=navigator.userAgentData,t?a?[2,t.getHighEntropyValues(a).catch(function(){return t.toJSON()})]:[2,t.toJSON()]:[2,void 0]})})}var nu;function V$0(){if(nu)return nu;var a=yc0(window.location.href);return nu={expires:31536e6,secure:!1,path:"/"},a&&(nu.domain=a),nu}function k$0(a){var t={btid:"dataxu",urid:"millennial-media"};a.startsWith("?")&&(a=a.substring(1)),a=a.replace(/\?/g,"&");for(var n=a.split("&"),r=0,l=n;r<l.length;r++){var i=l[r],o=i.split("="),s=o[0],c=o[1];if(t[s])return{id:c,type:t[s]}}}function S$0(a){return a.startsWith("?")&&(a=a.substring(1)),a=a.replace(/\?/g,"&"),a.split("&").reduce(function(t,n){var r=n.split("="),l=r[0],i=r[1],o=i===void 0?"":i;if(l.includes("utm_")&&l.length>4){var s=l.slice(4);s==="campaign"&&(s="name"),t[s]=cd0(o)}return t},{})}function F$0(){var a=$l.get("_ga");if(a&&a.startsWith("amp"))return a}function L$0(a,t,n){var r,l=new e5(n?[]:[new Vc0(V$0())]),i=l.get("s:context.referrer"),o=(r=k$0(a))!==null&&r!==void 0?r:i;o&&(t&&(t.referrer=u0(u0({},t.referrer),o)),l.set("s:context.referrer",o))}var b$0=function(a){try{var t=new URLSearchParams;return Object.entries(a).forEach(function(n){var r=n[0],l=n[1];Array.isArray(l)?l.forEach(function(i){return t.append(r,i)}):t.append(r,l)}),t.toString()}catch{return""}},_$0=(function(){function a(){var t=this;this.name="Page Enrichment",this.type="before",this.version="0.1.0",this.isLoaded=function(){return!0},this.load=function(n,r){return b1(t,void 0,void 0,function(){var l;return _1(this,function(i){switch(i.label){case 0:this.instance=r,i.label=1;case 1:return i.trys.push([1,3,,4]),l=this,[4,y$0(this.instance.options.highEntropyValuesClientHints)];case 2:return l.userAgentData=i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return[2,Promise.resolve()]}})})},this.enrich=function(n){var r,l,i=n.event.context,o=i.page.search||"",s=typeof o=="object"?b$0(o):o;i.userAgent=navigator.userAgent,i.userAgentData=t.userAgentData;var c=navigator.userLanguage||navigator.language;typeof i.locale>"u"&&typeof c<"u"&&(i.locale=c),(r=i.library)!==null&&r!==void 0||(i.library={name:"analytics.js",version:"".concat("npm:next","-").concat(kv)}),s&&!i.campaign&&(i.campaign=S$0(s));var m=F$0();m&&(i.amp={id:m}),L$0(s,i,(l=t.instance.options.disableClientPersistence)!==null&&l!==void 0?l:!1);try{i.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}return n},this.track=this.enrich,this.identify=this.enrich,this.page=this.enrich,this.group=this.enrich,this.alias=this.enrich,this.screen=this.enrich}return a})(),N$0=new _$0;function dd0(a){var t=Array.prototype.slice.call(window.document.querySelectorAll("script"));return t.find(function(n){return n.src===a})}function ic(a,t){var n=dd0(a);if(n!==void 0){var r=n?.getAttribute("status");if(r==="loaded")return Promise.resolve(n);if(r==="loading")return new Promise(function(l,i){n.addEventListener("load",function(){return l(n)}),n.addEventListener("error",function(o){return i(o)})})}return new Promise(function(l,i){var o,s=window.document.createElement("script");s.type="text/javascript",s.src=a,s.async=!0,s.setAttribute("status","loading");for(var c=0,m=Object.entries({});c<m.length;c++){var h=m[c],p=h[0],f=h[1];s.setAttribute(p,f)}s.onload=function(){s.onerror=s.onload=null,s.setAttribute("status","loaded"),l(s)},s.onerror=function(){s.onerror=s.onload=null,s.setAttribute("status","error"),i(new Error("Failed to load ".concat(a)))};var v=window.document.querySelector("script");v?(o=v.parentElement)===null||o===void 0||o.insertBefore(s,v):window.document.head.appendChild(s)})}function w$0(a){var t=dd0(a);return t!==void 0&&t.remove(),Promise.resolve()}function eF(a,t,n){return b1(this,void 0,void 0,function(){function r(m,h){return b1(this,void 0,void 0,function(){var p,f,v;return _1(this,function(Z){switch(Z.label){case 0:return p=!1,f=null,[4,h({payload:Ov(m,{clone:!0,traverse:!1}),integration:a,next:function(E){p=!0,E===null&&(f=null),E&&(f=E.obj)}})];case 1:return Z.sent(),!p&&f!==null&&(f=f,f.integrations=u0(u0({},m.integrations),(v={},v[a]=!1,v))),[2,f]}})})}var l,i,o,s,c;return _1(this,function(m){switch(m.label){case 0:l=Ov(t,{clone:!0,traverse:!1}).rawEvent(),i=0,o=n,m.label=1;case 1:return i<o.length?(s=o[i],[4,r(l,s)]):[3,4];case 2:if(c=m.sent(),c===null)return[2,null];l=c,m.label=3;case 3:return i++,[3,1];case 4:return[2,l]}})})}function C$0(a,t){function n(r){return b1(this,void 0,void 0,function(){var l;return _1(this,function(i){switch(i.label){case 0:return l=!1,[4,a({payload:Ov(r.event,{clone:!0,traverse:!1}),integrations:t??{},next:function(o){l=!0,o&&(r.event=o.obj)}})];case 1:if(i.sent(),!l)throw new o3({retry:!1,type:"middleware_cancellation",reason:"Middleware `next` function skipped"});return[2,r]}})})}return{name:"Source Middleware ".concat(a.name),type:"before",version:"0.1.0",isLoaded:function(){return!0},load:function(r){return Promise.resolve(r)},track:n,page:n,screen:n,identify:n,alias:n,group:n}}const T$0=Object.freeze(Object.defineProperty({__proto__:null,applyDestinationMiddleware:eF,sourceMiddlewarePlugin:C$0},Symbol.toStringTag,{value:"Module"}));function d3(a,t){var n=t.methodName,r=t.integrationName,l=t.type,i=t.didError,o=i===void 0?!1:i;a.stats.increment("analytics_js.integration.invoke".concat(o?".error":""),1,["method:".concat(n),"integration_name:".concat(r),"type:".concat(l)])}var I$0=(function(){function a(t,n){this.version="1.0.0",this.alternativeNames=[],this.loadPromise=Ev(),this.middleware=[],this.alias=this._createMethod("alias"),this.group=this._createMethod("group"),this.identify=this._createMethod("identify"),this.page=this._createMethod("page"),this.screen=this._createMethod("screen"),this.track=this._createMethod("track"),this.action=n,this.name=t,this.type=n.type,this.alternativeNames.push(n.name)}return a.prototype.addMiddleware=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];this.type==="destination"&&(t=this.middleware).push.apply(t,n)},a.prototype.transform=function(t){return b1(this,void 0,void 0,function(){var n;return _1(this,function(r){switch(r.label){case 0:return[4,eF(this.name,t.event,this.middleware)];case 1:return n=r.sent(),n===null&&t.cancel(new o3({retry:!1,reason:"dropped by destination middleware"})),[2,new Vr(n)]}})})},a.prototype._createMethod=function(t){var n=this;return function(r){return b1(n,void 0,void 0,function(){var l,i;return _1(this,function(o){switch(o.label){case 0:return this.action[t]?(l=r,this.type!=="destination"?[3,2]:[4,this.transform(r)]):[2,r];case 1:l=o.sent(),o.label=2;case 2:return o.trys.push([2,5,,6]),[4,this.ready()];case 3:if(!o.sent())throw new Error("Something prevented the destination from getting ready");return d3(r,{integrationName:this.action.name,methodName:t,type:"action"}),[4,this.action[t](l)];case 4:return o.sent(),[3,6];case 5:throw i=o.sent(),d3(r,{integrationName:this.action.name,methodName:t,type:"action",didError:!0}),i;case 6:return[2,r]}})})}},a.prototype.isLoaded=function(){return this.action.isLoaded()},a.prototype.ready=function(){return b1(this,void 0,void 0,function(){return _1(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.loadPromise.promise];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}})})},a.prototype.load=function(t,n){return b1(this,void 0,void 0,function(){var r,l,i,o;return _1(this,function(s){switch(s.label){case 0:if(this.loadPromise.isSettled())return[2,this.loadPromise.promise];s.label=1;case 1:return s.trys.push([1,3,,4]),d3(t,{integrationName:this.action.name,methodName:"load",type:"action"}),r=this.action.load(t,n),i=(l=this.loadPromise).resolve,[4,r];case 2:return i.apply(l,[s.sent()]),[2,r];case 3:throw o=s.sent(),d3(t,{integrationName:this.action.name,methodName:"load",type:"action",didError:!0}),this.loadPromise.reject(o),o;case 4:return[2]}})})},a.prototype.unload=function(t,n){var r,l;return(l=(r=this.action).unload)===null||l===void 0?void 0:l.call(r,t,n)},a})();function x$0(a){if(!Array.isArray(a))throw new Error("Not a valid list of plugins");var t=["load","isLoaded","name","version","type"];return a.forEach(function(n){t.forEach(function(r){var l;if(n[r]===void 0)throw new Error("Plugin: ".concat((l=n.name)!==null&&l!==void 0?l:"unknown"," missing required function ").concat(r))})}),!0}function P$0(a,t){var n=a[t.creationName],r=a[t.name];return a.All===!1&&!n&&!r||n===!1||r===!1}function O$0(a,t){return b1(this,void 0,void 0,function(){var n,r,l,i,o,s;return _1(this,function(c){switch(c.label){case 0:if(c.trys.push([0,9,,10]),n=new RegExp("https://cdn.segment.(com|build)"),r=XS(),!t)return[3,6];l=a.url.split("/"),i=l[l.length-2],o=a.url.replace(i,btoa(i).replace(/=/g,"")),c.label=1;case 1:return c.trys.push([1,3,,5]),[4,ic(o.replace(n,r))];case 2:return c.sent(),[3,5];case 3:return c.sent(),[4,ic(a.url.replace(n,r))];case 4:return c.sent(),[3,5];case 5:return[3,8];case 6:return[4,ic(a.url.replace(n,r))];case 7:c.sent(),c.label=8;case 8:return typeof window[a.libraryName]=="function"?[2,window[a.libraryName]]:[3,10];case 9:throw s=c.sent(),console.error("Failed to create PluginFactory",a),s;case 10:return[2]}})})}function R$0(a,t,n,r,l,i){var o,s,c;return b1(this,void 0,void 0,function(){var m,h,p,f=this;return _1(this,function(v){switch(v.label){case 0:return m=[],h=(s=(o=a.middlewareSettings)===null||o===void 0?void 0:o.routingRules)!==null&&s!==void 0?s:[],p=((c=a.remotePlugins)!==null&&c!==void 0?c:[]).map(function(Z){return b1(f,void 0,void 0,function(){var E,M,V,L,b,N,F;return _1(this,function(w){switch(w.label){case 0:if(P$0(t,Z))return[2];w.label=1;case 1:return w.trys.push([1,6,,7]),M=i?.find(function(x){var P=x.pluginName;return P===Z.name}),M?[3,3]:[4,O$0(Z,r?.obfuscate)];case 2:M=w.sent(),w.label=3;case 3:return E=M,E?(V=n[Z.name],[4,E(u0(u0({},Z.settings),V))]):[3,5];case 4:L=w.sent(),b=Array.isArray(L)?L:[L],x$0(b),N=h.filter(function(x){return x.destinationName===Z.creationName}),b.forEach(function(x){var P=new I$0(Z.creationName,x);N.length&&l&&P.addMiddleware(l),m.push(P)}),w.label=5;case 5:return[3,7];case 6:return F=w.sent(),console.warn("Failed to load Remote Plugin",F),[3,7];case 7:return[2]}})})}),[4,Promise.all(p)];case 1:return v.sent(),[2,m.filter(Boolean)]}})})}var tF,md0,$$0=TS(),ud0=(tF=(md0=$$0).__SEGMENT_INSPECTOR__)!==null&&tF!==void 0?tF:md0.__SEGMENT_INSPECTOR__={},D$0=function(a){var t;return(t=ud0.attach)===null||t===void 0?void 0:t.call(ud0,a)};function j$0(a,t){return Vv("".concat(t,"/v1/projects/").concat(a,"/settings")).then(function(n){return n.ok?n.json():n.text().then(function(r){throw new Error(r)})}).catch(function(n){throw console.error(n.message),n})}function B$0(a){return od0().NODE_ENV!=="test"&&Object.keys(a.integrations).length>1}function z$0(a){var t,n,r;return od0().NODE_ENV!=="test"&&((r=(n=(t=a.middlewareSettings)===null||t===void 0?void 0:t.routingRules)===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0)>0}function U$0(a,t){BR0(a,t),jR0(a,t)}function q$0(a,t,n){return b1(this,void 0,void 0,function(){return _1(this,function(r){switch(r.label){case 0:return[4,W$0(a,t)];case 1:return r.sent(),zR0(a,n),[2]}})})}var G$0=function(){var a,t,n=(a=window.location.hash)!==null&&a!==void 0?a:"",r=(t=window.location.search)!==null&&t!==void 0?t:"",l=r.length?r:n.replace(/(?=#).*(?=\?)/,"");return l},W$0=function(a,t){return b1(void 0,void 0,void 0,function(){return _1(this,function(n){switch(n.label){case 0:return t.includes("ajs_")?[4,a.queryString(t).catch(console.error)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})};function K$0(a,t,n,r,l,i,o){var s,c,m;return l===void 0&&(l=[]),b1(this,void 0,void 0,function(){var h,p,f,v,Z,E,M,V,L,b,N,F,w,x,P,j=this;return _1(this,function(R){switch(R.label){case 0:return U$0(n,o),h=l?.filter(function(G){return typeof G=="object"}),p=l?.filter(function(G){return typeof G=="function"&&typeof G.pluginName=="string"}),z$0(t)?[4,Promise.resolve().then(()=>hm1).then(function(G){return G.tsubMiddleware(t.middlewareSettings.routingRules)})]:[3,2];case 1:return v=R.sent(),[3,3];case 2:v=void 0,R.label=3;case 3:return f=v,B$0(t)||i.length>0?[4,Promise.resolve().then(()=>Vm1).then(function(G){return G.ajsDestinations(a,t,n.integrations,r,f,i)})]:[3,5];case 4:return E=R.sent(),[3,6];case 5:E=[],R.label=6;case 6:return Z=E,t.legacyVideoPluginsEnabled?[4,Promise.resolve().then(()=>Sm1).then(function(G){return G.loadLegacyVideoPlugins(n)})]:[3,8];case 7:R.sent(),R.label=8;case 8:return!((s=r.plan)===null||s===void 0)&&s.track?[4,Promise.resolve().then(()=>bm1).then(function(G){var t0;return G.schemaFilter((t0=r.plan)===null||t0===void 0?void 0:t0.track,t)})]:[3,10];case 9:return V=R.sent(),[3,11];case 10:V=void 0,R.label=11;case 11:return M=V,L=sd0(t,r),[4,R$0(t,n.integrations,L,r,f,p).catch(function(){return[]})];case 12:return b=R.sent(),N=Qe(Qe([N$0],Z,!0),b,!0),M&&N.push(M),F=((c=r.integrations)===null||c===void 0?void 0:c.All)===!1&&!r.integrations["Segment.io"]||r.integrations&&r.integrations["Segment.io"]===!1,F?[3,14]:(x=(w=N).push,[4,g$0(n,L["Segment.io"],t.integrations)]);case 13:x.apply(w,[R.sent()]),R.label=14;case 14:return[4,n.register.apply(n,Qe(Qe([],N,!1),h,!1))];case 15:return P=R.sent(),[4,DR0(n,o)];case 16:return R.sent(),Object.entries((m=t.enabledMiddleware)!==null&&m!==void 0?m:{}).some(function(G){var t0=G[1];return t0})?[4,Promise.resolve().then(()=>Nm1).then(function(G){var t0=G.remoteMiddlewares;return b1(j,void 0,void 0,function(){var J,W;return _1(this,function(q){switch(q.label){case 0:return[4,t0(P,t,r.obfuscate)];case 1:return J=q.sent(),W=J.map(function(d0){return n.addSourceMiddleware(d0)}),[2,Promise.all(W)]}})})})]:[3,18];case 17:R.sent(),R.label=18;case 18:return[4,$R0(n,o)];case 19:return R.sent(),[2,P]}})})}function Y$0(a,t,n){var r,l,i,o,s,c,m,h,p;return t===void 0&&(t={}),b1(this,void 0,void 0,function(){var f,v,Z,E,M,V,L,b,N,F,w;return _1(this,function(x){switch(x.label){case 0:return t.disable===!0?[2,[new ld0,Vr.system()]]:(t.globalAnalyticsKey&&PR0(t.globalAnalyticsKey),a.cdnURL&&M$0(a.cdnURL),t.initialPageview&&n.add(new BS("page",[])),f=G$0(),v=(r=a.cdnURL)!==null&&r!==void 0?r:XS(),(l=a.cdnSettings)!==null&&l!==void 0?(E=l,[3,3]):[3,1]);case 1:return[4,j$0(a.writeKey,v)];case 2:E=x.sent(),x.label=3;case 3:return Z=E,t.updateCDNSettings&&(Z=t.updateCDNSettings(Z)),typeof t.disable!="function"?[3,5]:[4,t.disable(Z)];case 4:if(M=x.sent(),M)return[2,[new ld0,Vr.system()]];x.label=5;case 5:return V=(o=(i=Z.integrations["Segment.io"])===null||i===void 0?void 0:i.retryQueue)!==null&&o!==void 0?o:!0,t=u0({retryQueue:V},t),L=new rd0(u0(u0({},a),{cdnSettings:Z,cdnURL:v}),t),D$0(L),b=(s=a.plugins)!==null&&s!==void 0?s:[],N=(c=a.classicIntegrations)!==null&&c!==void 0?c:[],F=(m=t.integrations)===null||m===void 0?void 0:m["Segment.io"],fc0.initRemoteMetrics(u0(u0({},Z.metrics),{host:(h=F?.apiHost)!==null&&h!==void 0?h:(p=Z.metrics)===null||p===void 0?void 0:p.host,protocol:F?.protocol})),[4,K$0(a.writeKey,Z,L,t,b,N,n)];case 6:return w=x.sent(),L.initialized=!0,L.emit("initialize",a,t),[4,q$0(L,f,n)];case 7:return x.sent(),[2,[L,w]]}})})}var Q$0=(function(a){kt(t,a);function t(){var n=this,r=Ev(),l=r.promise,i=r.resolve;return n=a.call(this,function(o){return l.then(function(s){var c=s[0],m=s[1];return Y$0(c,m,o)})})||this,n._resolveLoadStart=function(o,s){return i([o,s])},n}return t.prototype.load=function(n,r){return r===void 0&&(r={}),this._resolveLoadStart(n,r),this},t.load=function(n,r){return r===void 0&&(r={}),new t().load(n,r)},t.standalone=function(n,r){return t.load({writeKey:n},r).then(function(l){return l[0]})},t})(qR0);const X$0=a=>{if(!a.writeKey)throw new yr("writeKey","writeKey is missing.")},hd0="2.3.0",J$0=a=>a.replace(/\/$/,""),eD0=(a,t)=>J$0(new URL(t||"",a).href),pd0=32,fd0=480;class tD0{id=ec();items=[];sizeInBytes=0;maxEventCount;constructor(t){this.maxEventCount=Math.max(1,t)}tryAdd(t){if(this.length===this.maxEventCount)return{success:!1,message:`Event limit of ${this.maxEventCount} has been exceeded.`};const n=this.calculateSize(t.context);return n>pd0*1024?{success:!1,message:`Event exceeds maximum event size of ${pd0} KB`}:this.sizeInBytes+n>fd0*1024?{success:!1,message:`Event has caused batch size to exceed ${fd0} KB`}:(this.items.push(t),this.sizeInBytes+=n,{success:!0})}get length(){return this.items.length}calculateSize(t){return encodeURI(JSON.stringify(t.event)).split(/%..|i/).length}getEvents(){return this.items.map(({context:n})=>n.event)}getContexts(){return this.items.map(t=>t.context)}resolveEvents(){this.items.forEach(({resolver:t,context:n})=>t(n))}}const $v=crypto,gd0=a=>a instanceof CryptoKey,oc=new TextEncoder,aF=new TextDecoder;function aD0(...a){const t=a.reduce((l,{length:i})=>l+i,0),n=new Uint8Array(t);let r=0;for(const l of a)n.set(l,r),r+=l.length;return n}const nD0=a=>{let t=a;typeof t=="string"&&(t=oc.encode(t));const n=32768,r=[];for(let l=0;l<t.length;l+=n)r.push(String.fromCharCode.apply(null,t.subarray(l,l+n)));return btoa(r.join(""))},nF=a=>nD0(a).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),rD0=a=>{const t=atob(a),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n},rF=a=>{let t=a;t instanceof Uint8Array&&(t=aF.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return rD0(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class g6 extends Error{constructor(t,n){super(t,n),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}g6.code="ERR_JOSE_GENERIC";class lD0 extends g6{constructor(t,n,r="unspecified",l="unspecified"){super(t,{cause:{claim:r,reason:l,payload:n}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=r,this.reason=l,this.payload=n}}lD0.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class iD0 extends g6{constructor(t,n,r="unspecified",l="unspecified"){super(t,{cause:{claim:r,reason:l,payload:n}}),this.code="ERR_JWT_EXPIRED",this.claim=r,this.reason=l,this.payload=n}}iD0.code="ERR_JWT_EXPIRED";class oD0 extends g6{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}oD0.code="ERR_JOSE_ALG_NOT_ALLOWED";class Dl extends g6{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}Dl.code="ERR_JOSE_NOT_SUPPORTED";class sD0 extends g6{constructor(t="decryption operation failed",n){super(t,n),this.code="ERR_JWE_DECRYPTION_FAILED"}}sD0.code="ERR_JWE_DECRYPTION_FAILED";class cD0 extends g6{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}cD0.code="ERR_JWE_INVALID";class sc extends g6{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}sc.code="ERR_JWS_INVALID";class vd0 extends g6{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}vd0.code="ERR_JWT_INVALID";class dD0 extends g6{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}dD0.code="ERR_JWK_INVALID";class mD0 extends g6{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}mD0.code="ERR_JWKS_INVALID";class uD0 extends g6{constructor(t="no applicable key found in the JSON Web Key Set",n){super(t,n),this.code="ERR_JWKS_NO_MATCHING_KEY"}}uD0.code="ERR_JWKS_NO_MATCHING_KEY";class hD0 extends g6{constructor(t="multiple matching keys found in the JSON Web Key Set",n){super(t,n),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}hD0.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class pD0 extends g6{constructor(t="request timed out",n){super(t,n),this.code="ERR_JWKS_TIMEOUT"}}pD0.code="ERR_JWKS_TIMEOUT";class fD0 extends g6{constructor(t="signature verification failed",n){super(t,n),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}fD0.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function Fr(a,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${a}`)}function ru(a,t){return a.name===t}function lF(a){return parseInt(a.name.slice(4),10)}function gD0(a){switch(a){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function vD0(a,t){if(t.length&&!t.some(n=>a.usages.includes(n))){let n="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();n+=`one of ${t.join(", ")}, or ${r}.`}else t.length===2?n+=`one of ${t[0]} or ${t[1]}.`:n+=`${t[0]}.`;throw new TypeError(n)}}function AD0(a,t,...n){switch(t){case"HS256":case"HS384":case"HS512":{if(!ru(a.algorithm,"HMAC"))throw Fr("HMAC");const r=parseInt(t.slice(2),10);if(lF(a.algorithm.hash)!==r)throw Fr(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!ru(a.algorithm,"RSASSA-PKCS1-v1_5"))throw Fr("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(lF(a.algorithm.hash)!==r)throw Fr(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!ru(a.algorithm,"RSA-PSS"))throw Fr("RSA-PSS");const r=parseInt(t.slice(2),10);if(lF(a.algorithm.hash)!==r)throw Fr(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":{if(a.algorithm.name!=="Ed25519"&&a.algorithm.name!=="Ed448")throw Fr("Ed25519 or Ed448");break}case"Ed25519":{if(!ru(a.algorithm,"Ed25519"))throw Fr("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!ru(a.algorithm,"ECDSA"))throw Fr("ECDSA");const r=gD0(t);if(a.algorithm.namedCurve!==r)throw Fr(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}vD0(a,n)}function Ad0(a,t,...n){if(n=n.filter(Boolean),n.length>2){const r=n.pop();a+=`one of type ${n.join(", ")}, or ${r}.`}else n.length===2?a+=`one of type ${n[0]} or ${n[1]}.`:a+=`of type ${n[0]}.`;return t==null?a+=` Received ${t}`:typeof t=="function"&&t.name?a+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&t.constructor?.name&&(a+=` Received an instance of ${t.constructor.name}`),a}const Zd0=(a,...t)=>Ad0("Key must be ",a,...t);function Hd0(a,t,...n){return Ad0(`Key for the ${a} algorithm must be `,t,...n)}const Ed0=a=>gd0(a)?!0:a?.[Symbol.toStringTag]==="KeyObject",Dv=["CryptoKey"],ZD0=(...a)=>{const t=a.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const r of t){const l=Object.keys(r);if(!n||n.size===0){n=new Set(l);continue}for(const i of l){if(n.has(i))return!1;n.add(i)}}return!0};function HD0(a){return typeof a=="object"&&a!==null}function Md0(a){if(!HD0(a)||Object.prototype.toString.call(a)!=="[object Object]")return!1;if(Object.getPrototypeOf(a)===null)return!0;let t=a;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(a)===t}const ED0=(a,t)=>{if(a.startsWith("RS")||a.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${a} requires key modulusLength to be 2048 bits or larger`)}};function lu(a){return Md0(a)&&typeof a.kty=="string"}function MD0(a){return a.kty!=="oct"&&typeof a.d=="string"}function yD0(a){return a.kty!=="oct"&&typeof a.d>"u"}function VD0(a){return lu(a)&&a.kty==="oct"&&typeof a.k=="string"}function kD0(a){let t,n;switch(a.kty){case"RSA":{switch(a.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${a.alg.slice(-3)}`},n=a.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${a.alg.slice(-3)}`},n=a.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(a.alg.slice(-3),10)||1}`},n=a.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new Dl('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(a.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=a.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=a.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=a.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:a.crv},n=a.d?["deriveBits"]:[];break;default:throw new Dl('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(a.alg){case"Ed25519":t={name:"Ed25519"},n=a.d?["sign"]:["verify"];break;case"EdDSA":t={name:a.crv},n=a.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:a.crv},n=a.d?["deriveBits"]:[];break;default:throw new Dl('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new Dl('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const SD0=async a=>{if(!a.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:n}=kD0(a),r=[t,a.ext??!1,a.key_ops??n],l={...a};return delete l.alg,delete l.use,$v.subtle.importKey("jwk",l,...r)},yd0=a=>rF(a);let cc,dc;const Vd0=a=>a?.[Symbol.toStringTag]==="KeyObject",jv=async(a,t,n,r,l=!1)=>{let i=a.get(t);if(i?.[r])return i[r];const o=await SD0({...n,alg:r});return l&&Object.freeze(t),i?i[r]=o:a.set(t,{[r]:o}),o},FD0={normalizePublicKey:(a,t)=>{if(Vd0(a)){let n=a.export({format:"jwk"});return delete n.d,delete n.dp,delete n.dq,delete n.p,delete n.q,delete n.qi,n.k?yd0(n.k):(dc||(dc=new WeakMap),jv(dc,a,n,t))}return lu(a)?a.k?rF(a.k):(dc||(dc=new WeakMap),jv(dc,a,a,t,!0)):a},normalizePrivateKey:(a,t)=>{if(Vd0(a)){let n=a.export({format:"jwk"});return n.k?yd0(n.k):(cc||(cc=new WeakMap),jv(cc,a,n,t))}return lu(a)?a.k?rF(a.k):(cc||(cc=new WeakMap),jv(cc,a,a,t,!0)):a}},m3=(a,t,n=0)=>{n===0&&(t.unshift(t.length),t.unshift(6));const r=a.indexOf(t[0],n);if(r===-1)return!1;const l=a.subarray(r,r+t.length);return l.length!==t.length?!1:l.every((i,o)=>i===t[o])||m3(a,t,r+1)},kd0=a=>{switch(!0){case m3(a,[42,134,72,206,61,3,1,7]):return"P-256";case m3(a,[43,129,4,0,34]):return"P-384";case m3(a,[43,129,4,0,35]):return"P-521";case m3(a,[43,101,110]):return"X25519";case m3(a,[43,101,111]):return"X448";case m3(a,[43,101,112]):return"Ed25519";case m3(a,[43,101,113]):return"Ed448";default:throw new Dl("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},LD0=async(a,t,n,r,l)=>{let i,o;const s=new Uint8Array(atob(n.replace(a,"")).split("").map(c=>c.charCodeAt(0)));switch(r){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:`SHA-${r.slice(-3)}`},o=["sign"];break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${r.slice(-3)}`},o=["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:`SHA-${parseInt(r.slice(-3),10)||1}`},o=["decrypt","unwrapKey"];break;case"ES256":i={name:"ECDSA",namedCurve:"P-256"},o=["sign"];break;case"ES384":i={name:"ECDSA",namedCurve:"P-384"},o=["sign"];break;case"ES512":i={name:"ECDSA",namedCurve:"P-521"},o=["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const c=kd0(s);i=c.startsWith("P-")?{name:"ECDH",namedCurve:c}:{name:c},o=["deriveBits"];break}case"Ed25519":i={name:"Ed25519"},o=["sign"];break;case"EdDSA":i={name:kd0(s)},o=["sign"];break;default:throw new Dl('Invalid or unsupported "alg" (Algorithm) value')}return $v.subtle.importKey(t,s,i,!1,o)},bD0=(a,t,n)=>LD0(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"pkcs8",a,t);async function _D0(a,t,n){if(typeof a!="string"||a.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return bD0(a,t)}const mc=a=>a?.[Symbol.toStringTag],iF=(a,t,n)=>{if(t.use!==void 0&&t.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(t.key_ops!==void 0&&t.key_ops.includes?.(n)!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`);if(t.alg!==void 0&&t.alg!==a)throw new TypeError(`Invalid key for this operation, when present its alg must be ${a}`);return!0},ND0=(a,t,n,r)=>{if(!(t instanceof Uint8Array)){if(r&&lu(t)){if(VD0(t)&&iF(a,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Ed0(t))throw new TypeError(Hd0(a,t,...Dv,"Uint8Array",r?"JSON Web Key":null));if(t.type!=="secret")throw new TypeError(`${mc(t)} instances for symmetric algorithms must be of type "secret"`)}},wD0=(a,t,n,r)=>{if(r&&lu(t))switch(n){case"sign":if(MD0(t)&&iF(a,t,n))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(yD0(t)&&iF(a,t,n))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!Ed0(t))throw new TypeError(Hd0(a,t,...Dv,r?"JSON Web Key":null));if(t.type==="secret")throw new TypeError(`${mc(t)} instances for asymmetric algorithms must not be of type "secret"`);if(n==="sign"&&t.type==="public")throw new TypeError(`${mc(t)} instances for asymmetric algorithm signing must be of type "private"`);if(n==="decrypt"&&t.type==="public")throw new TypeError(`${mc(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&n==="verify"&&t.type==="private")throw new TypeError(`${mc(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&n==="encrypt"&&t.type==="private")throw new TypeError(`${mc(t)} instances for asymmetric algorithm encryption must be of type "public"`)};function Sd0(a,t,n,r){t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?ND0(t,n,r,a):wD0(t,n,r,a)}Sd0.bind(void 0,!1);const CD0=Sd0.bind(void 0,!0);function TD0(a,t,n,r,l){if(l.crit!==void 0&&r?.crit===void 0)throw new a('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(o=>typeof o!="string"||o.length===0))throw new a('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;n!==void 0?i=new Map([...Object.entries(n),...t.entries()]):i=t;for(const o of r.crit){if(!i.has(o))throw new Dl(`Extension Header Parameter "${o}" is not recognized`);if(l[o]===void 0)throw new a(`Extension Header Parameter "${o}" is missing`);if(i.get(o)&&r[o]===void 0)throw new a(`Extension Header Parameter "${o}" MUST be integrity protected`)}return new Set(r.crit)}function ID0(a,t){const n=`SHA-${a.slice(-3)}`;switch(a){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:a.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:t.name};default:throw new Dl(`alg ${a} is not supported either by JOSE or your javascript runtime`)}}async function xD0(a,t,n){if(t=await FD0.normalizePrivateKey(t,a),gd0(t))return AD0(t,a,n),t;if(t instanceof Uint8Array){if(!a.startsWith("HS"))throw new TypeError(Zd0(t,...Dv));return $v.subtle.importKey("raw",t,{hash:`SHA-${a.slice(-3)}`,name:"HMAC"},!1,[n])}throw new TypeError(Zd0(t,...Dv,"Uint8Array","JSON Web Key"))}const u5=a=>Math.floor(a.getTime()/1e3),Fd0=60,Ld0=Fd0*60,oF=Ld0*24,PD0=oF*7,OD0=oF*365.25,RD0=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,sF=a=>{const t=RD0.exec(a);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]),r=t[3].toLowerCase();let l;switch(r){case"sec":case"secs":case"second":case"seconds":case"s":l=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":l=Math.round(n*Fd0);break;case"hour":case"hours":case"hr":case"hrs":case"h":l=Math.round(n*Ld0);break;case"day":case"days":case"d":l=Math.round(n*oF);break;case"week":case"weeks":case"w":l=Math.round(n*PD0);break;default:l=Math.round(n*OD0);break}return t[1]==="-"||t[4]==="ago"?-l:l},$D0=async(a,t,n)=>{const r=await xD0(a,t,"sign");ED0(a,r);const l=await $v.subtle.sign(ID0(a,r.algorithm),r,n);return new Uint8Array(l)};class DD0{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=t}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}async sign(t,n){if(!this._protectedHeader&&!this._unprotectedHeader)throw new sc("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!ZD0(this._protectedHeader,this._unprotectedHeader))throw new sc("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader},l=TD0(sc,new Map([["b64",!0]]),n?.crit,this._protectedHeader,r);let i=!0;if(l.has("b64")&&(i=this._protectedHeader.b64,typeof i!="boolean"))throw new sc('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:o}=r;if(typeof o!="string"||!o)throw new sc('JWS "alg" (Algorithm) Header Parameter missing or invalid');CD0(o,t,"sign");let s=this._payload;i&&(s=oc.encode(nF(s)));let c;this._protectedHeader?c=oc.encode(nF(JSON.stringify(this._protectedHeader))):c=oc.encode("");const m=aD0(c,oc.encode("."),s),h=await $D0(o,t,m),p={signature:nF(h),payload:""};return i&&(p.payload=aF.decode(s)),this._unprotectedHeader&&(p.header=this._unprotectedHeader),this._protectedHeader&&(p.protected=aF.decode(c)),p}}class jD0{constructor(t){this._flattened=new DD0(t)}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}async sign(t,n){const r=await this._flattened.sign(t,n);if(r.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}function h5(a,t){if(!Number.isFinite(t))throw new TypeError(`Invalid ${a} input`);return t}class BD0{constructor(t={}){if(!Md0(t))throw new TypeError("JWT Claims Set MUST be an object");this._payload=t}setIssuer(t){return this._payload={...this._payload,iss:t},this}setSubject(t){return this._payload={...this._payload,sub:t},this}setAudience(t){return this._payload={...this._payload,aud:t},this}setJti(t){return this._payload={...this._payload,jti:t},this}setNotBefore(t){return typeof t=="number"?this._payload={...this._payload,nbf:h5("setNotBefore",t)}:t instanceof Date?this._payload={...this._payload,nbf:h5("setNotBefore",u5(t))}:this._payload={...this._payload,nbf:u5(new Date)+sF(t)},this}setExpirationTime(t){return typeof t=="number"?this._payload={...this._payload,exp:h5("setExpirationTime",t)}:t instanceof Date?this._payload={...this._payload,exp:h5("setExpirationTime",u5(t))}:this._payload={...this._payload,exp:u5(new Date)+sF(t)},this}setIssuedAt(t){return typeof t>"u"?this._payload={...this._payload,iat:u5(new Date)}:t instanceof Date?this._payload={...this._payload,iat:h5("setIssuedAt",u5(t))}:typeof t=="string"?this._payload={...this._payload,iat:h5("setIssuedAt",u5(new Date)+sF(t))}:this._payload={...this._payload,iat:h5("setIssuedAt",t)},this}}class zD0 extends BD0{setProtectedHeader(t){return this._protectedHeader=t,this}async sign(t,n){const r=new jD0(oc.encode(JSON.stringify(this._payload)));if(r.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new vd0("JWTs MUST NOT use unencoded payload");return r.sign(t,n)}}const UD0=a=>!!(a&&typeof a=="object"&&"access_token"in a&&"expires_in"in a&&typeof a.access_token=="string"&&typeof a.expires_in=="number"),qD0=a=>typeof a.text=="function";function GD0(a){const t={};if(!a)return{};if(WD0(a)){for(const[n,r]of a.entries())t[n.toLowerCase()]=r;return t}for(const[n,r]of Object.entries(a))t[n.toLowerCase()]=r;return t}function WD0(a){return typeof a=="object"&&a!==null&&"entries"in Object(a)&&typeof Object(a).entries=="function"}class KD0{alg="RS256";grantType="client_credentials";clientAssertionType="urn:ietf:params:oauth:client-assertion-type:jwt-bearer";clientId;clientKey;keyId;scope;authServer;httpClient;maxRetries;clockSkewInSeconds=0;accessToken;tokenEmitter=new J7;retryCount;pollerTimer;constructor(t){this.keyId=t.keyId,this.clientId=t.clientId,this.clientKey=t.clientKey,this.authServer=t.authServer??"https://oauth2.segment.io",this.scope=t.scope??"tracking_api:write",this.httpClient=t.httpClient,this.maxRetries=t.maxRetries,this.tokenEmitter.on("access_token",n=>{"token"in n&&(this.accessToken=n.token)}),this.retryCount=0}stopPoller(){clearTimeout(this.pollerTimer)}async pollerLoop(){let t=25,n;try{n=await this.requestAccessToken()}catch(l){return this.handleTransientError({error:l})}if(!qD0(n))return this.handleInvalidCustomResponse();const r=GD0(n.headers);if(r.date&&this.updateClockSkew(Date.parse(r.date)),n.status===200)try{const l=await n.text(),i=JSON.parse(l);if(!UD0(i))throw new Error("Response did not contain a valid access_token and expires_in");return i.expires_at=Math.round(Date.now()/1e3)+i.expires_in,this.tokenEmitter.emit("access_token",{token:i}),this.retryCount=0,t=i.expires_in/2*1e3,this.queueNextPoll(t)}catch(l){return this.handleTransientError({error:l,forceEmitError:!0})}else return n.status===429?await this.handleRateLimited(n,r,t):[400,401,415].includes(n.status)?this.handleUnrecoverableErrors(n):this.handleTransientError({error:new Error(`[${n.status}] ${n.statusText}`)})}handleTransientError({error:t,forceEmitError:n}){this.incrementRetries({error:t,forceEmitError:n});const r=wS({attempt:this.retryCount,minTimeout:25,maxTimeout:1e3});this.queueNextPoll(r)}handleInvalidCustomResponse(){this.tokenEmitter.emit("access_token",{error:new Error("HTTPClient does not implement response.text method")})}async handleRateLimited(t,n,r){if(this.incrementRetries({error:new Error(`[${t.status}] ${t.statusText}`)}),n["x-ratelimit-reset"]){const l=parseInt(n["x-ratelimit-reset"],10);isFinite(l)?r=l-Date.now()+this.clockSkewInSeconds*1e3:r=5*1e3,await lc0(r),r=0}this.queueNextPoll(r)}handleUnrecoverableErrors(t){this.retryCount=0,this.tokenEmitter.emit("access_token",{error:new Error(`[${t.status}] ${t.statusText}`)}),this.stopPoller()}updateClockSkew(t){this.clockSkewInSeconds=(Date.now()-t)/1e3}incrementRetries({error:t,forceEmitError:n}){this.retryCount++,(n||this.retryCount%this.maxRetries===0)&&(this.retryCount=0,this.tokenEmitter.emit("access_token",{error:t}))}queueNextPoll(t){this.pollerTimer=setTimeout(()=>this.pollerLoop(),t),this.pollerTimer.unref&&this.pollerTimer.unref()}async requestAccessToken(){const l=ec(),i=Math.round(Date.now()/1e3)-this.clockSkewInSeconds,o={iss:this.clientId,sub:this.clientId,aud:this.authServer,iat:i-5,exp:i+55,jti:l},s=await _D0(this.clientKey,"RS256"),c=await new zD0(o).setProtectedHeader({alg:this.alg,kid:this.keyId,typ:"JWT"}).sign(s),m=`grant_type=${this.grantType}&client_assertion_type=${this.clientAssertionType}&client_assertion=${c}&scope=${this.scope}`,p={method:"POST",url:`${this.authServer}/token`,body:m,headers:{"Content-Type":"application/x-www-form-urlencoded"},httpRequestTimeout:1e4};return this.httpClient.makeRequest(p)}async getAccessToken(){return this.isValidToken(this.accessToken)?this.accessToken:(this.stopPoller(),this.pollerLoop().catch(()=>{}),new Promise((t,n)=>{this.tokenEmitter.once("access_token",r=>{"token"in r?t(r.token):n(r.error)})}))}clearToken(){this.accessToken=void 0}isValidToken(t){return typeof t<"u"&&t!==null&&t.expires_in<Date.now()/1e3}}function YD0(a){return new Promise(t=>setTimeout(t,a))}function iu(){}class QD0{pendingFlushTimeout;_batch;_flushInterval;_flushAt;_maxRetries;_url;_flushPendingItemsCount;_httpRequestTimeout;_emitter;_disable;_httpClient;_writeKey;_tokenManager;constructor({host:t,path:n,maxRetries:r,flushAt:l,flushInterval:i,writeKey:o,httpRequestTimeout:s,httpClient:c,disable:m,oauthSettings:h},p){this._emitter=p,this._maxRetries=r,this._flushAt=Math.max(l,1),this._flushInterval=i,this._url=eD0(t??"https://api.segment.io",n??"/v1/batch"),this._httpRequestTimeout=s??1e4,this._disable=!!m,this._httpClient=c,this._writeKey=o,h&&(this._tokenManager=new KD0({...h,httpClient:h.httpClient??c,maxRetries:h.maxRetries??r}))}createBatch(){this.pendingFlushTimeout&&clearTimeout(this.pendingFlushTimeout);const t=new tD0(this._flushAt);return this._batch=t,this.pendingFlushTimeout=setTimeout(()=>{t===this._batch&&(this._batch=void 0),this.pendingFlushTimeout=void 0,t.length&&this.send(t).catch(iu)},this._flushInterval),t}clearBatch(){this.pendingFlushTimeout&&clearTimeout(this.pendingFlushTimeout),this._batch=void 0}flush(t){if(!t){this._tokenManager&&this._tokenManager.stopPoller();return}if(this._flushPendingItemsCount=t,!this._batch)return;this._batch.length===t&&(this.send(this._batch).catch(iu).finally(()=>{this._tokenManager&&this._tokenManager.stopPoller()}),this.clearBatch())}enqueue(t){const n=this._batch??this.createBatch(),{promise:r,resolve:l}=Ev(),i={context:t,resolver:l};if(n.tryAdd(i).success){const m=n.length===this._flushPendingItemsCount;return(n.length===this._flushAt||m)&&(this.send(n).catch(iu),this.clearBatch()),r}n.length&&(this.send(n).catch(iu),this.clearBatch());const s=this.createBatch(),c=s.tryAdd(i);return c.success?(s.length===this._flushPendingItemsCount&&(this.send(s).catch(iu),this.clearBatch()),r):(t.setFailedDelivery({reason:new Error(c.message)}),Promise.resolve(t))}async send(t){this._flushPendingItemsCount&&(this._flushPendingItemsCount-=t.length);const n=t.getEvents(),r=this._maxRetries+1;let l=0;for(;l<r;){l++;let i,o;try{if(this._disable)return t.resolveEvents();let s;if(this._tokenManager){const p=await this._tokenManager.getAccessToken();p&&p.access_token&&(s=`Bearer ${p.access_token}`)}const c={"Content-Type":"application/json","User-Agent":"analytics-node-next/latest",...s?{Authorization:s}:{}},m={url:this._url,method:"POST",headers:c,body:JSON.stringify({batch:n,writeKey:this._writeKey,sentAt:new Date}),httpRequestTimeout:this._httpRequestTimeout};this._emitter.emit("http_request",{body:m.body,method:m.method,url:m.url,headers:m.headers});const h=await this._httpClient.makeRequest(m);if(h.status>=200&&h.status<300){t.resolveEvents();return}else if(this._tokenManager&&(h.status===400||h.status===401||h.status===403))this._tokenManager.clearToken(),o=new Error(`[${h.status}] ${h.statusText}`);else if(h.status===400){bd0(t,new Error(`[${h.status}] ${h.statusText}`));return}else if(h.status===429){if(h.headers&&"x-ratelimit-reset"in h.headers){const p=parseInt(h.headers["x-ratelimit-reset"],10);isFinite(p)&&(i=p-Date.now())}o=new Error(`[${h.status}] ${h.statusText}`)}else o=new Error(`[${h.status}] ${h.statusText}`)}catch(s){o=s}if(l===r){bd0(t,o);return}await YD0(i||wS({attempt:l,minTimeout:25,maxTimeout:1e3}))}}}function bd0(a,t){a.getContexts().forEach(n=>n.setFailedDelivery({reason:t})),a.resolveEvents()}var _d0={};const Nd0=()=>typeof process=="object"&&process&&typeof _d0=="object"&&_d0&&typeof process.version=="string"?"node":typeof window=="object"?"browser":typeof WebSocketPair<"u"?"cloudflare-worker":typeof EdgeRuntime=="string"?"vercel-edge":typeof WorkerGlobalScope<"u"&&typeof importScripts=="function"?"web-worker":"unknown";function XD0(a){a.updateEvent("context.library.name","@segment/analytics-node"),a.updateEvent("context.library.version",hd0);const t=Nd0();t==="node"&&a.updateEvent("_metadata.nodeVersion",process.version),a.updateEvent("_metadata.jsRuntime",t)}function JD0(a){function t(n){return XD0(n),a.enqueue(n)}return{name:"Segment.io",type:"destination",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),alias:t,group:t,identify:t,page:t,screen:t,track:t}}const ej0=(a,t)=>{const n=new QD0(a,t);return{publisher:n,plugin:JD0(n)}},tj0=()=>`node-next-${Date.now()}-${ec()}`;class aj0 extends rc0{constructor(){super({createMessageId:tj0,onFinishedEvent:t=>{UO0(t)}})}}let cF=class extends eu{static system(){return new this({type:"track",event:"system"})}};const nj0=a=>t=>{const n=t.failedDelivery();return a(n?n.reason:void 0,t)},rj0=async(a,t,n,r)=>{try{const l=new cF(a),i=await cc0(l,t,n,{...r?{callback:nj0(r)}:{}}),o=i.failedDelivery();o?n.emit("error",{code:"delivery_failure",reason:o.reason,ctx:i}):n.emit(a.type,i)}catch(l){n.emit("error",{code:"unknown",reason:l})}};class lj0 extends J7{}class ij0 extends Jm{constructor(){super(1,[])}getAttempts(t){return t.attempts??0}updateAttempts(t){return t.attempts=this.getAttempts(t)+1,this.getAttempts(t)}}class oj0 extends sc0{constructor(){super(new ij0)}}class sj0{onabort=null;aborted=!1;eventEmitter=new J7;toString(){return"[object AbortSignal]"}get[Symbol.toStringTag](){return"AbortSignal"}removeEventListener(...t){this.eventEmitter.off(...t)}addEventListener(...t){this.eventEmitter.on(...t)}dispatchEvent(t){const n={type:t,target:this},r=`on${t}`;typeof this[r]=="function"&&this[r](n),this.eventEmitter.emit(t,n)}}let cj0=class{signal=new sj0;abort(){this.signal.aborted||(this.signal.aborted=!0,this.signal.dispatchEvent("abort"))}toString(){return"[object AbortController]"}get[Symbol.toStringTag](){return"AbortController"}};const dj0=a=>{if(Nd0()==="cloudflare-worker")return[];const t=new(globalThis.AbortController||cj0),n=setTimeout(()=>{t.abort()},a);return n?.unref?.(),[t.signal,n]},mj0=async(...a)=>{if(globalThis.fetch)return globalThis.fetch(...a);if(typeof EdgeRuntime!="string")return(await Promise.resolve().then(()=>cu1)).default(...a);throw new Error("Invariant: an edge runtime that does not support fetch should not exist")};class wd0{_fetch;constructor(t){this._fetch=t??mj0}async makeRequest(t){const[n,r]=dj0(t.httpRequestTimeout),l={url:t.url,method:t.method,headers:t.headers,body:t.body,signal:n};return this._fetch(t.url,l).finally(()=>clearTimeout(r))}}class uj0 extends lj0{_eventFactory;_isClosed=!1;_pendingEvents=0;_closeAndFlushDefaultTimeout;_publisher;_isFlushing=!1;_queue;ready;constructor(t){super(),X$0(t),this._eventFactory=new aj0,this._queue=new oj0;const n=t.flushInterval??1e4;this._closeAndFlushDefaultTimeout=n*1.25;const{plugin:r,publisher:l}=ej0({writeKey:t.writeKey,host:t.host,path:t.path,maxRetries:t.maxRetries??3,flushAt:t.flushAt??t.maxEventsInBatch??15,httpRequestTimeout:t.httpRequestTimeout,disable:t.disable,flushInterval:n,httpClient:typeof t.httpClient=="function"?new wd0(t.httpClient):t.httpClient??new wd0,oauthSettings:t.oauthSettings},this);this._publisher=l,this.ready=this.register(r).then(()=>{}),this.emit("initialize",t),dR0(this)}get VERSION(){return hd0}closeAndFlush({timeout:t=this._closeAndFlushDefaultTimeout}={}){return this.flush({timeout:t,close:!0})}async flush({timeout:t,close:n=!1}={}){if(this._isFlushing){console.warn("Overlapping flush calls detected. Please wait for the previous flush to finish before calling .flush again");return}else this._isFlushing=!0;n&&(this._isClosed=!0),this._publisher.flush(this._pendingEvents);const r=new Promise(l=>{this._pendingEvents?this.once("drained",()=>{l()}):l()}).finally(()=>{this._isFlushing=!1});return t?Hv(r,t).catch(()=>{}):r}_dispatch(t,n){if(this._isClosed){this.emit("call_after_close",t);return}this._pendingEvents++,rj0(t,this._queue,this,n).catch(r=>r).finally(()=>{this._pendingEvents--,this._pendingEvents||this.emit("drained")})}alias({userId:t,previousId:n,context:r,timestamp:l,integrations:i,messageId:o},s){const c=this._eventFactory.alias(t,n,{context:r,integrations:i,timestamp:l,messageId:o});this._dispatch(c,s)}group({timestamp:t,groupId:n,userId:r,anonymousId:l,traits:i={},context:o,integrations:s,messageId:c},m){const h=this._eventFactory.group(n,i,{context:o,anonymousId:l,userId:r,timestamp:t,integrations:s,messageId:c});this._dispatch(h,m)}identify({userId:t,anonymousId:n,traits:r={},context:l,timestamp:i,integrations:o,messageId:s},c){const m=this._eventFactory.identify(t,r,{context:l,anonymousId:n,userId:t,timestamp:i,integrations:o,messageId:s});this._dispatch(m,c)}page({userId:t,anonymousId:n,category:r,name:l,properties:i,context:o,timestamp:s,integrations:c,messageId:m},h){const p=this._eventFactory.page(r??null,l??null,i,{context:o,anonymousId:n,userId:t,timestamp:s,integrations:c,messageId:m});this._dispatch(p,h)}screen({userId:t,anonymousId:n,category:r,name:l,properties:i,context:o,timestamp:s,integrations:c,messageId:m},h){const p=this._eventFactory.screen(r??null,l??null,i,{context:o,anonymousId:n,userId:t,timestamp:s,integrations:c,messageId:m});this._dispatch(p,h)}track({userId:t,anonymousId:n,event:r,properties:l,context:i,timestamp:o,integrations:s,messageId:c},m){const h=this._eventFactory.track(r,l,{context:i,userId:t,anonymousId:n,timestamp:o,integrations:s,messageId:c});this._dispatch(h,m)}register(...t){return this._queue.criticalTasks.run(async()=>{const n=cF.system(),r=t.map(l=>this._queue.register(n,l,this));await Promise.all(r),this.emit("register",t.map(l=>l.name))})}async deregister(...t){const n=cF.system(),r=t.map(l=>{const i=this._queue.plugins.find(o=>o.name===l);if(i)return this._queue.deregister(n,i,this);n.log("warn",`plugin ${l} not found`)});await Promise.all(r),this.emit("deregister",t)}}function hj0(a,t){return{track:(n,r={})=>{a.track(n,r)},page:(n,r={})=>{n?a.page(n,r):a.page(r)},screen:(n,r={})=>{a.track(`Viewed ${n} Screen`,r)},identify:(n,r={})=>{if(!n)return;const l={campusName:r?.campus,church:r?.church,email:r?.email,firstName:r?.firstName,lastName:r?.lastName,nickName:r?.nickName,userId:r?.id,originId:r?.originId,originType:r?.originType,apollosId:n},i=t.clientManaged&&r?.originId?r.originId:n;a.identify(i,l)},group:(n,r={})=>{n&&a.group(n,r)},alias:n=>{a.alias(n)},reset:()=>{a.reset()},flush:()=>{}}}function pj0(a,t){let n;const r=`anon-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return{track:(l,i={})=>{a.track({event:l,properties:i,...n?{userId:n}:{anonymousId:r}})},page:(l,i={})=>{a.page({name:l,properties:i,...n?{userId:n}:{anonymousId:r}})},screen:(l,i={})=>{a.screen({name:l,properties:i,...n?{userId:n}:{anonymousId:r}})},identify:(l,i={})=>{if(!l)return;const o={campusName:i?.campus,church:i?.church,email:i?.email,firstName:i?.firstName,lastName:i?.lastName,nickName:i?.nickName,userId:i?.id,originId:i?.originId,originType:i?.originType,apollosId:l},s=t.clientManaged&&i?.originId?i.originId:l;n=s,a.identify({userId:s,traits:o})},group:(l,i={})=>{l&&n&&a.group({groupId:l,userId:n,traits:i})},alias:l=>{n&&a.alias({userId:l,previousId:n})},reset:()=>{n=void 0},flush:()=>{a.flush()}}}const Cd0=a=>{if(!a?.writeKey)return null;const t=typeof navigator<"u"?tc0(navigator.userAgent):!0;try{if(t){const n=new uj0({writeKey:a.writeKey});return pj0(n,a)}else{const n=Q$0.load({writeKey:a.writeKey});return hj0(n,a)}}catch(n){return console.error("Error initializing Segment client:",n),null}},fj0=(a,t)=>a?.apiKey?a.amplitudeBrowser?vj0(a,t):a.amplitudeJS?gj0(a,t):(console.error("No Amplitude library provided. Please pass either amplitudeJS or amplitudeBrowser."),null):null,gj0=(a,t)=>{if(!a.amplitudeJS)return console.error("amplitude-js library not provided. Please pass amplitudeJS to use legacy Amplitude tracking."),{track:()=>{},identify:()=>{}};const n=a.amplitudeJS.getInstance();if(n.init(a.apiKey),t?.profile?.id){const r={email:t.profile.email,firstName:t.profile.firstName,lastName:t.profile.lastName,userId:t.profile.id};n.setUserId(t.profile.id),n.setUserProperties(r)}return{track:(r,l={})=>{n.logEvent(r,l)},identify:(r,l={})=>{n.setUserId(r),n.setUserProperties(l)}}},vj0=(a,t)=>{if(!a.amplitudeBrowser)return console.error("@amplitude/analytics-browser library not provided. Please pass amplitudeBrowser to use browser Amplitude tracking."),{track:()=>{},identify:()=>{}};const n=a.amplitudeBrowser;if(n.init(a.apiKey),t?.profile?.id){const r=new n.Identify;t.profile.email&&r.set("email",t.profile.email),t.profile.firstName&&r.set("firstName",t.profile.firstName),t.profile.lastName&&r.set("lastName",t.profile.lastName),r.set("userId",t.profile.id),n.identify(r,{user_id:t.profile.id})}return{track:(r,l={})=>{n.track(r,l)},identify:(r,l={})=>{const i=new n.Identify;Object.entries(l).forEach(([o,s])=>{(typeof s=="string"||typeof s=="number"||typeof s=="boolean"||Array.isArray(s))&&i.set(o,s)}),n.identify(i,{user_id:r})}}},Aj0=(a,t,n,r)=>{if(a)if(r){if(t?.profile?.id){const l=new r.Identify;t.profile.email&&l.set("email",t.profile.email),t.profile.firstName&&l.set("firstName",t.profile.firstName),t.profile.lastName&&l.set("lastName",t.profile.lastName),l.set("userId",t.profile.id),r.identify(l,{user_id:t.profile.id})}}else if(n){const l=n.getInstance();if(t?.profile?.id){const i={email:t.profile.email,firstName:t.profile.firstName,lastName:t.profile.lastName,userId:t.profile.id};l.setUserId(t.profile.id),l.setUserProperties(i)}}else console.error("No Amplitude library provided for reinitialization. Please pass either amplitudeJS or amplitudeBrowser.")},Td0=e.createContext({track:(...a)=>(console.info("Uninitialized Analytics.track",...a),Promise.resolve()),page:(...a)=>(console.info("Uninitialized Analytics.page",...a),Promise.resolve()),screen:(...a)=>(console.info("Uninitialized Analytics.screen",...a),Promise.resolve()),identify:(...a)=>(console.info("Uninitialized Analytics.identify",...a),Promise.resolve()),group:(...a)=>(console.info("Uninitialized Analytics.group",...a),Promise.resolve()),alias:(...a)=>(console.info("Uninitialized Analytics.alias",...a),Promise.resolve()),reset:(...a)=>(console.info("Uninitialized Analytics.reset",...a),Promise.resolve()),flush:(...a)=>(console.info("Uninitialized Analytics.flush",...a),Promise.resolve())}),Zj0=({children:a,coreSegmentKey:t,churchSegmentKey:n,amplitudeKey:r,amplitudeJS:l,amplitudeBrowser:i,currentUser:o=null,currentChurch:s=null,standardProperties:c={},churchSegmentClientManaged:m=!0})=>{const h=typeof navigator<"u"?tc0(navigator.userAgent):!1,p=e.useMemo(()=>{if(h)return[];const E=[];if(t){const M=Cd0({writeKey:t,clientManaged:!1});M&&E.push(M)}if(n&&n!==t){const M=Cd0({writeKey:n,clientManaged:m});M&&E.push(M)}return E.filter(Boolean)},[t,n,m,h]),f=e.useMemo(()=>typeof window>"u"||typeof navigator>"u"||h||!r?null:fj0({apiKey:r,amplitudeJS:l,amplitudeBrowser:i},o),[r,l,i,o,h]);e.useEffect(()=>{!h&&r&&o&&Aj0(r,o,l,i)},[r,o,l,i,h]);const v=e.useMemo(()=>{const E=(M={})=>{const V={...M,...c};return o?.originId&&(V.userOriginId=o.originId,V.userOriginType=o.originType),s?.slug&&(V.church=s.slug),V};return{track:async(M,V={})=>{const L=E(V);p.forEach(b=>b.track(M,L)),f?.track(M,L)},page:async(M,V={})=>{const L=E(V);p.forEach(b=>b.page(M,L)),f&&f.track(M||"Page View",L)},screen:async(M,V={})=>{const L=E(V);p.forEach(b=>b.screen(M,L)),f?.track(M,L)},identify:async(M,V={})=>{p.forEach(L=>L.identify(M,V)),f?.identify(M,V)},group:async(M,V={})=>{p.forEach(L=>L.group(M,V))},alias:async M=>{p.forEach(V=>V.alias(M))},reset:async()=>{p.forEach(M=>M.reset())},flush:async()=>{p.forEach(M=>M.flush())}}},[p,f,o?.originId,o?.originType,s?.slug,c]);e.useEffect(()=>{o?.profile?.id&&v.identify(o.profile.id,{...o.profile,originId:o.originId,originType:o.originType,avatar:o.profile.photo?.uri,church:s?.slug})},[o?.profile]),e.useEffect(()=>{s?.slug&&v.group(s.slug,{name:s.name})},[s?.slug,s?.name]);const Z=e.useRef(void 0);return e.useEffect(()=>{const E=o?.profile?.id;E&&(Z.current&&Z.current!==E&&(v.reset(),s?.slug&&v.group(s.slug,{name:s.name})),Z.current=E)},[v,o?.profile?.id,s?.slug,s?.name]),T.jsx(Td0.Provider,{value:v,children:a})},Bv=()=>e.useContext(Td0);function Id0(a){var t,n,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var l=a.length;for(t=0;t<l;t++)a[t]&&(n=Id0(a[t]))&&(r&&(r+=" "),r+=n)}else for(n in a)a[n]&&(r&&(r+=" "),r+=n);return r}function ke(){for(var a,t,n=0,r="",l=arguments.length;n<l;n++)(a=arguments[n])&&(t=Id0(a))&&(r&&(r+=" "),r+=t);return r}var dF={exports:{}},mF,xd0;function Pd0(){return xd0||(xd0=1,mF={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),mF}var uF={exports:{}},hF,Od0;function Hj0(){return Od0||(Od0=1,hF=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")}),hF}var Rd0;function Ej0(){if(Rd0)return uF.exports;Rd0=1;var a=Hj0(),t=Array.prototype.concat,n=Array.prototype.slice,r=uF.exports=function(i){for(var o=[],s=0,c=i.length;s<c;s++){var m=i[s];a(m)?o=t.call(o,n.call(m)):o.push(m)}return o};return r.wrap=function(l){return function(){return l(r(arguments))}},uF.exports}var $d0;function Mj0(){if($d0)return dF.exports;$d0=1;var a=Pd0(),t=Ej0(),n=Object.hasOwnProperty,r=Object.create(null);for(var l in a)n.call(a,l)&&(r[a[l]]=l);var i=dF.exports={to:{},get:{}};i.get=function(c){var m=c.substring(0,3).toLowerCase(),h,p;switch(m){case"hsl":h=i.get.hsl(c),p="hsl";break;case"hwb":h=i.get.hwb(c),p="hwb";break;default:h=i.get.rgb(c),p="rgb";break}return h?{model:p,value:h}:null},i.get.rgb=function(c){if(!c)return null;var m=/^#([a-f0-9]{3,4})$/i,h=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,p=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,f=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,v=/^(\w+)$/,Z=[0,0,0,1],E,M,V;if(E=c.match(h)){for(V=E[2],E=E[1],M=0;M<3;M++){var L=M*2;Z[M]=parseInt(E.slice(L,L+2),16)}V&&(Z[3]=parseInt(V,16)/255)}else if(E=c.match(m)){for(E=E[1],V=E[3],M=0;M<3;M++)Z[M]=parseInt(E[M]+E[M],16);V&&(Z[3]=parseInt(V+V,16)/255)}else if(E=c.match(p)){for(M=0;M<3;M++)Z[M]=parseInt(E[M+1],0);E[4]&&(E[5]?Z[3]=parseFloat(E[4])*.01:Z[3]=parseFloat(E[4]))}else if(E=c.match(f)){for(M=0;M<3;M++)Z[M]=Math.round(parseFloat(E[M+1])*2.55);E[4]&&(E[5]?Z[3]=parseFloat(E[4])*.01:Z[3]=parseFloat(E[4]))}else return(E=c.match(v))?E[1]==="transparent"?[0,0,0,0]:n.call(a,E[1])?(Z=a[E[1]],Z[3]=1,Z):null:null;for(M=0;M<3;M++)Z[M]=o(Z[M],0,255);return Z[3]=o(Z[3],0,1),Z},i.get.hsl=function(c){if(!c)return null;var m=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,h=c.match(m);if(h){var p=parseFloat(h[4]),f=(parseFloat(h[1])%360+360)%360,v=o(parseFloat(h[2]),0,100),Z=o(parseFloat(h[3]),0,100),E=o(isNaN(p)?1:p,0,1);return[f,v,Z,E]}return null},i.get.hwb=function(c){if(!c)return null;var m=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,h=c.match(m);if(h){var p=parseFloat(h[4]),f=(parseFloat(h[1])%360+360)%360,v=o(parseFloat(h[2]),0,100),Z=o(parseFloat(h[3]),0,100),E=o(isNaN(p)?1:p,0,1);return[f,v,Z,E]}return null},i.to.hex=function(){var c=t(arguments);return"#"+s(c[0])+s(c[1])+s(c[2])+(c[3]<1?s(Math.round(c[3]*255)):"")},i.to.rgb=function(){var c=t(arguments);return c.length<4||c[3]===1?"rgb("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+")":"rgba("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+", "+c[3]+")"},i.to.rgb.percent=function(){var c=t(arguments),m=Math.round(c[0]/255*100),h=Math.round(c[1]/255*100),p=Math.round(c[2]/255*100);return c.length<4||c[3]===1?"rgb("+m+"%, "+h+"%, "+p+"%)":"rgba("+m+"%, "+h+"%, "+p+"%, "+c[3]+")"},i.to.hsl=function(){var c=t(arguments);return c.length<4||c[3]===1?"hsl("+c[0]+", "+c[1]+"%, "+c[2]+"%)":"hsla("+c[0]+", "+c[1]+"%, "+c[2]+"%, "+c[3]+")"},i.to.hwb=function(){var c=t(arguments),m="";return c.length>=4&&c[3]!==1&&(m=", "+c[3]),"hwb("+c[0]+", "+c[1]+"%, "+c[2]+"%"+m+")"},i.to.keyword=function(c){return r[c.slice(0,3)]};function o(c,m,h){return Math.min(Math.max(m,c),h)}function s(c){var m=Math.round(c).toString(16).toUpperCase();return m.length<2?"0"+m:m}return dF.exports}var pF,Dd0;function jd0(){if(Dd0)return pF;Dd0=1;const a=Pd0(),t={};for(const l of Object.keys(a))t[a[l]]=l;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};pF=n;for(const l of Object.keys(n)){if(!("channels"in n[l]))throw new Error("missing channels property: "+l);if(!("labels"in n[l]))throw new Error("missing channel labels property: "+l);if(n[l].labels.length!==n[l].channels)throw new Error("channel and label counts mismatch: "+l);const{channels:i,labels:o}=n[l];delete n[l].channels,delete n[l].labels,Object.defineProperty(n[l],"channels",{value:i}),Object.defineProperty(n[l],"labels",{value:o})}n.rgb.hsl=function(l){const i=l[0]/255,o=l[1]/255,s=l[2]/255,c=Math.min(i,o,s),m=Math.max(i,o,s),h=m-c;let p,f;m===c?p=0:i===m?p=(o-s)/h:o===m?p=2+(s-i)/h:s===m&&(p=4+(i-o)/h),p=Math.min(p*60,360),p<0&&(p+=360);const v=(c+m)/2;return m===c?f=0:v<=.5?f=h/(m+c):f=h/(2-m-c),[p,f*100,v*100]},n.rgb.hsv=function(l){let i,o,s,c,m;const h=l[0]/255,p=l[1]/255,f=l[2]/255,v=Math.max(h,p,f),Z=v-Math.min(h,p,f),E=function(M){return(v-M)/6/Z+1/2};return Z===0?(c=0,m=0):(m=Z/v,i=E(h),o=E(p),s=E(f),h===v?c=s-o:p===v?c=1/3+i-s:f===v&&(c=2/3+o-i),c<0?c+=1:c>1&&(c-=1)),[c*360,m*100,v*100]},n.rgb.hwb=function(l){const i=l[0],o=l[1];let s=l[2];const c=n.rgb.hsl(l)[0],m=1/255*Math.min(i,Math.min(o,s));return s=1-1/255*Math.max(i,Math.max(o,s)),[c,m*100,s*100]},n.rgb.cmyk=function(l){const i=l[0]/255,o=l[1]/255,s=l[2]/255,c=Math.min(1-i,1-o,1-s),m=(1-i-c)/(1-c)||0,h=(1-o-c)/(1-c)||0,p=(1-s-c)/(1-c)||0;return[m*100,h*100,p*100,c*100]};function r(l,i){return(l[0]-i[0])**2+(l[1]-i[1])**2+(l[2]-i[2])**2}return n.rgb.keyword=function(l){const i=t[l];if(i)return i;let o=1/0,s;for(const c of Object.keys(a)){const m=a[c],h=r(l,m);h<o&&(o=h,s=c)}return s},n.keyword.rgb=function(l){return a[l]},n.rgb.xyz=function(l){let i=l[0]/255,o=l[1]/255,s=l[2]/255;i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,o=o>.04045?((o+.055)/1.055)**2.4:o/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;const c=i*.4124+o*.3576+s*.1805,m=i*.2126+o*.7152+s*.0722,h=i*.0193+o*.1192+s*.9505;return[c*100,m*100,h*100]},n.rgb.lab=function(l){const i=n.rgb.xyz(l);let o=i[0],s=i[1],c=i[2];o/=95.047,s/=100,c/=108.883,o=o>.008856?o**(1/3):7.787*o+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,c=c>.008856?c**(1/3):7.787*c+16/116;const m=116*s-16,h=500*(o-s),p=200*(s-c);return[m,h,p]},n.hsl.rgb=function(l){const i=l[0]/360,o=l[1]/100,s=l[2]/100;let c,m,h;if(o===0)return h=s*255,[h,h,h];s<.5?c=s*(1+o):c=s+o-s*o;const p=2*s-c,f=[0,0,0];for(let v=0;v<3;v++)m=i+1/3*-(v-1),m<0&&m++,m>1&&m--,6*m<1?h=p+(c-p)*6*m:2*m<1?h=c:3*m<2?h=p+(c-p)*(2/3-m)*6:h=p,f[v]=h*255;return f},n.hsl.hsv=function(l){const i=l[0];let o=l[1]/100,s=l[2]/100,c=o;const m=Math.max(s,.01);s*=2,o*=s<=1?s:2-s,c*=m<=1?m:2-m;const h=(s+o)/2,p=s===0?2*c/(m+c):2*o/(s+o);return[i,p*100,h*100]},n.hsv.rgb=function(l){const i=l[0]/60,o=l[1]/100;let s=l[2]/100;const c=Math.floor(i)%6,m=i-Math.floor(i),h=255*s*(1-o),p=255*s*(1-o*m),f=255*s*(1-o*(1-m));switch(s*=255,c){case 0:return[s,f,h];case 1:return[p,s,h];case 2:return[h,s,f];case 3:return[h,p,s];case 4:return[f,h,s];case 5:return[s,h,p]}},n.hsv.hsl=function(l){const i=l[0],o=l[1]/100,s=l[2]/100,c=Math.max(s,.01);let m,h;h=(2-o)*s;const p=(2-o)*c;return m=o*c,m/=p<=1?p:2-p,m=m||0,h/=2,[i,m*100,h*100]},n.hwb.rgb=function(l){const i=l[0]/360;let o=l[1]/100,s=l[2]/100;const c=o+s;let m;c>1&&(o/=c,s/=c);const h=Math.floor(6*i),p=1-s;m=6*i-h,(h&1)!==0&&(m=1-m);const f=o+m*(p-o);let v,Z,E;switch(h){default:case 6:case 0:v=p,Z=f,E=o;break;case 1:v=f,Z=p,E=o;break;case 2:v=o,Z=p,E=f;break;case 3:v=o,Z=f,E=p;break;case 4:v=f,Z=o,E=p;break;case 5:v=p,Z=o,E=f;break}return[v*255,Z*255,E*255]},n.cmyk.rgb=function(l){const i=l[0]/100,o=l[1]/100,s=l[2]/100,c=l[3]/100,m=1-Math.min(1,i*(1-c)+c),h=1-Math.min(1,o*(1-c)+c),p=1-Math.min(1,s*(1-c)+c);return[m*255,h*255,p*255]},n.xyz.rgb=function(l){const i=l[0]/100,o=l[1]/100,s=l[2]/100;let c,m,h;return c=i*3.2406+o*-1.5372+s*-.4986,m=i*-.9689+o*1.8758+s*.0415,h=i*.0557+o*-.204+s*1.057,c=c>.0031308?1.055*c**(1/2.4)-.055:c*12.92,m=m>.0031308?1.055*m**(1/2.4)-.055:m*12.92,h=h>.0031308?1.055*h**(1/2.4)-.055:h*12.92,c=Math.min(Math.max(0,c),1),m=Math.min(Math.max(0,m),1),h=Math.min(Math.max(0,h),1),[c*255,m*255,h*255]},n.xyz.lab=function(l){let i=l[0],o=l[1],s=l[2];i/=95.047,o/=100,s/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const c=116*o-16,m=500*(i-o),h=200*(o-s);return[c,m,h]},n.lab.xyz=function(l){const i=l[0],o=l[1],s=l[2];let c,m,h;m=(i+16)/116,c=o/500+m,h=m-s/200;const p=m**3,f=c**3,v=h**3;return m=p>.008856?p:(m-16/116)/7.787,c=f>.008856?f:(c-16/116)/7.787,h=v>.008856?v:(h-16/116)/7.787,c*=95.047,m*=100,h*=108.883,[c,m,h]},n.lab.lch=function(l){const i=l[0],o=l[1],s=l[2];let c;c=Math.atan2(s,o)*360/2/Math.PI,c<0&&(c+=360);const h=Math.sqrt(o*o+s*s);return[i,h,c]},n.lch.lab=function(l){const i=l[0],o=l[1],c=l[2]/360*2*Math.PI,m=o*Math.cos(c),h=o*Math.sin(c);return[i,m,h]},n.rgb.ansi16=function(l,i=null){const[o,s,c]=l;let m=i===null?n.rgb.hsv(l)[2]:i;if(m=Math.round(m/50),m===0)return 30;let h=30+(Math.round(c/255)<<2|Math.round(s/255)<<1|Math.round(o/255));return m===2&&(h+=60),h},n.hsv.ansi16=function(l){return n.rgb.ansi16(n.hsv.rgb(l),l[2])},n.rgb.ansi256=function(l){const i=l[0],o=l[1],s=l[2];return i===o&&o===s?i<8?16:i>248?231:Math.round((i-8)/247*24)+232:16+36*Math.round(i/255*5)+6*Math.round(o/255*5)+Math.round(s/255*5)},n.ansi16.rgb=function(l){let i=l%10;if(i===0||i===7)return l>50&&(i+=3.5),i=i/10.5*255,[i,i,i];const o=(~~(l>50)+1)*.5,s=(i&1)*o*255,c=(i>>1&1)*o*255,m=(i>>2&1)*o*255;return[s,c,m]},n.ansi256.rgb=function(l){if(l>=232){const m=(l-232)*10+8;return[m,m,m]}l-=16;let i;const o=Math.floor(l/36)/5*255,s=Math.floor((i=l%36)/6)/5*255,c=i%6/5*255;return[o,s,c]},n.rgb.hex=function(l){const o=(((Math.round(l[0])&255)<<16)+((Math.round(l[1])&255)<<8)+(Math.round(l[2])&255)).toString(16).toUpperCase();return"000000".substring(o.length)+o},n.hex.rgb=function(l){const i=l.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!i)return[0,0,0];let o=i[0];i[0].length===3&&(o=o.split("").map(p=>p+p).join(""));const s=parseInt(o,16),c=s>>16&255,m=s>>8&255,h=s&255;return[c,m,h]},n.rgb.hcg=function(l){const i=l[0]/255,o=l[1]/255,s=l[2]/255,c=Math.max(Math.max(i,o),s),m=Math.min(Math.min(i,o),s),h=c-m;let p,f;return h<1?p=m/(1-h):p=0,h<=0?f=0:c===i?f=(o-s)/h%6:c===o?f=2+(s-i)/h:f=4+(i-o)/h,f/=6,f%=1,[f*360,h*100,p*100]},n.hsl.hcg=function(l){const i=l[1]/100,o=l[2]/100,s=o<.5?2*i*o:2*i*(1-o);let c=0;return s<1&&(c=(o-.5*s)/(1-s)),[l[0],s*100,c*100]},n.hsv.hcg=function(l){const i=l[1]/100,o=l[2]/100,s=i*o;let c=0;return s<1&&(c=(o-s)/(1-s)),[l[0],s*100,c*100]},n.hcg.rgb=function(l){const i=l[0]/360,o=l[1]/100,s=l[2]/100;if(o===0)return[s*255,s*255,s*255];const c=[0,0,0],m=i%1*6,h=m%1,p=1-h;let f=0;switch(Math.floor(m)){case 0:c[0]=1,c[1]=h,c[2]=0;break;case 1:c[0]=p,c[1]=1,c[2]=0;break;case 2:c[0]=0,c[1]=1,c[2]=h;break;case 3:c[0]=0,c[1]=p,c[2]=1;break;case 4:c[0]=h,c[1]=0,c[2]=1;break;default:c[0]=1,c[1]=0,c[2]=p}return f=(1-o)*s,[(o*c[0]+f)*255,(o*c[1]+f)*255,(o*c[2]+f)*255]},n.hcg.hsv=function(l){const i=l[1]/100,o=l[2]/100,s=i+o*(1-i);let c=0;return s>0&&(c=i/s),[l[0],c*100,s*100]},n.hcg.hsl=function(l){const i=l[1]/100,s=l[2]/100*(1-i)+.5*i;let c=0;return s>0&&s<.5?c=i/(2*s):s>=.5&&s<1&&(c=i/(2*(1-s))),[l[0],c*100,s*100]},n.hcg.hwb=function(l){const i=l[1]/100,o=l[2]/100,s=i+o*(1-i);return[l[0],(s-i)*100,(1-s)*100]},n.hwb.hcg=function(l){const i=l[1]/100,s=1-l[2]/100,c=s-i;let m=0;return c<1&&(m=(s-c)/(1-c)),[l[0],c*100,m*100]},n.apple.rgb=function(l){return[l[0]/65535*255,l[1]/65535*255,l[2]/65535*255]},n.rgb.apple=function(l){return[l[0]/255*65535,l[1]/255*65535,l[2]/255*65535]},n.gray.rgb=function(l){return[l[0]/100*255,l[0]/100*255,l[0]/100*255]},n.gray.hsl=function(l){return[0,0,l[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(l){return[0,100,l[0]]},n.gray.cmyk=function(l){return[0,0,0,l[0]]},n.gray.lab=function(l){return[l[0],0,0]},n.gray.hex=function(l){const i=Math.round(l[0]/100*255)&255,s=((i<<16)+(i<<8)+i).toString(16).toUpperCase();return"000000".substring(s.length)+s},n.rgb.gray=function(l){return[(l[0]+l[1]+l[2])/3/255*100]},pF}var fF,Bd0;function yj0(){if(Bd0)return fF;Bd0=1;const a=jd0();function t(){const i={},o=Object.keys(a);for(let s=o.length,c=0;c<s;c++)i[o[c]]={distance:-1,parent:null};return i}function n(i){const o=t(),s=[i];for(o[i].distance=0;s.length;){const c=s.pop(),m=Object.keys(a[c]);for(let h=m.length,p=0;p<h;p++){const f=m[p],v=o[f];v.distance===-1&&(v.distance=o[c].distance+1,v.parent=c,s.unshift(f))}}return o}function r(i,o){return function(s){return o(i(s))}}function l(i,o){const s=[o[i].parent,i];let c=a[o[i].parent][i],m=o[i].parent;for(;o[m].parent;)s.unshift(o[m].parent),c=r(a[o[m].parent][m],c),m=o[m].parent;return c.conversion=s,c}return fF=function(i){const o=n(i),s={},c=Object.keys(o);for(let m=c.length,h=0;h<m;h++){const p=c[h];o[p].parent!==null&&(s[p]=l(p,o))}return s},fF}var gF,zd0;function Vj0(){if(zd0)return gF;zd0=1;const a=jd0(),t=yj0(),n={},r=Object.keys(a);function l(o){const s=function(...c){const m=c[0];return m==null?m:(m.length>1&&(c=m),o(c))};return"conversion"in o&&(s.conversion=o.conversion),s}function i(o){const s=function(...c){const m=c[0];if(m==null)return m;m.length>1&&(c=m);const h=o(c);if(typeof h=="object")for(let p=h.length,f=0;f<p;f++)h[f]=Math.round(h[f]);return h};return"conversion"in o&&(s.conversion=o.conversion),s}return r.forEach(o=>{n[o]={},Object.defineProperty(n[o],"channels",{value:a[o].channels}),Object.defineProperty(n[o],"labels",{value:a[o].labels});const s=t(o);Object.keys(s).forEach(m=>{const h=s[m];n[o][m]=i(h),n[o][m].raw=l(h)})}),gF=n,gF}var vF,Ud0;function kj0(){if(Ud0)return vF;Ud0=1;const a=Mj0(),t=Vj0(),n=["keyword","gray","hex"],r={};for(const f of Object.keys(t))r[[...t[f].labels].sort().join("")]=f;const l={};function i(f,v){if(!(this instanceof i))return new i(f,v);if(v&&v in n&&(v=null),v&&!(v in t))throw new Error("Unknown model: "+v);let Z,E;if(f==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(f instanceof i)this.model=f.model,this.color=[...f.color],this.valpha=f.valpha;else if(typeof f=="string"){const M=a.get(f);if(M===null)throw new Error("Unable to parse color from string: "+f);this.model=M.model,E=t[this.model].channels,this.color=M.value.slice(0,E),this.valpha=typeof M.value[E]=="number"?M.value[E]:1}else if(f.length>0){this.model=v||"rgb",E=t[this.model].channels;const M=Array.prototype.slice.call(f,0,E);this.color=p(M,E),this.valpha=typeof f[E]=="number"?f[E]:1}else if(typeof f=="number")this.model="rgb",this.color=[f>>16&255,f>>8&255,f&255],this.valpha=1;else{this.valpha=1;const M=Object.keys(f);"alpha"in f&&(M.splice(M.indexOf("alpha"),1),this.valpha=typeof f.alpha=="number"?f.alpha:0);const V=M.sort().join("");if(!(V in r))throw new Error("Unable to parse color from object: "+JSON.stringify(f));this.model=r[V];const{labels:L}=t[this.model],b=[];for(Z=0;Z<L.length;Z++)b.push(f[L[Z]]);this.color=p(b)}if(l[this.model])for(E=t[this.model].channels,Z=0;Z<E;Z++){const M=l[this.model][Z];M&&(this.color[Z]=M(this.color[Z]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}i.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(f){let v=this.model in a.to?this:this.rgb();v=v.round(typeof f=="number"?f:1);const Z=v.valpha===1?v.color:[...v.color,this.valpha];return a.to[v.model](Z)},percentString(f){const v=this.rgb().round(typeof f=="number"?f:1),Z=v.valpha===1?v.color:[...v.color,this.valpha];return a.to.rgb.percent(Z)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const f={},{channels:v}=t[this.model],{labels:Z}=t[this.model];for(let E=0;E<v;E++)f[Z[E]]=this.color[E];return this.valpha!==1&&(f.alpha=this.valpha),f},unitArray(){const f=this.rgb().color;return f[0]/=255,f[1]/=255,f[2]/=255,this.valpha!==1&&f.push(this.valpha),f},unitObject(){const f=this.rgb().object();return f.r/=255,f.g/=255,f.b/=255,this.valpha!==1&&(f.alpha=this.valpha),f},round(f){return f=Math.max(f||0,0),new i([...this.color.map(s(f)),this.valpha],this.model)},alpha(f){return f!==void 0?new i([...this.color,Math.max(0,Math.min(1,f))],this.model):this.valpha},red:c("rgb",0,m(255)),green:c("rgb",1,m(255)),blue:c("rgb",2,m(255)),hue:c(["hsl","hsv","hsl","hwb","hcg"],0,f=>(f%360+360)%360),saturationl:c("hsl",1,m(100)),lightness:c("hsl",2,m(100)),saturationv:c("hsv",1,m(100)),value:c("hsv",2,m(100)),chroma:c("hcg",1,m(100)),gray:c("hcg",2,m(100)),white:c("hwb",1,m(100)),wblack:c("hwb",2,m(100)),cyan:c("cmyk",0,m(100)),magenta:c("cmyk",1,m(100)),yellow:c("cmyk",2,m(100)),black:c("cmyk",3,m(100)),x:c("xyz",0,m(95.047)),y:c("xyz",1,m(100)),z:c("xyz",2,m(108.833)),l:c("lab",0,m(100)),a:c("lab",1),b:c("lab",2),keyword(f){return f!==void 0?new i(f):t[this.model].keyword(this.color)},hex(f){return f!==void 0?new i(f):a.to.hex(this.rgb().round().color)},hexa(f){if(f!==void 0)return new i(f);const v=this.rgb().round().color;let Z=Math.round(this.valpha*255).toString(16).toUpperCase();return Z.length===1&&(Z="0"+Z),a.to.hex(v)+Z},rgbNumber(){const f=this.rgb().color;return(f[0]&255)<<16|(f[1]&255)<<8|f[2]&255},luminosity(){const f=this.rgb().color,v=[];for(const[Z,E]of f.entries()){const M=E/255;v[Z]=M<=.04045?M/12.92:((M+.055)/1.055)**2.4}return .2126*v[0]+.7152*v[1]+.0722*v[2]},contrast(f){const v=this.luminosity(),Z=f.luminosity();return v>Z?(v+.05)/(Z+.05):(Z+.05)/(v+.05)},level(f){const v=this.contrast(f);return v>=7?"AAA":v>=4.5?"AA":""},isDark(){const f=this.rgb().color;return(f[0]*2126+f[1]*7152+f[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const f=this.rgb();for(let v=0;v<3;v++)f.color[v]=255-f.color[v];return f},lighten(f){const v=this.hsl();return v.color[2]+=v.color[2]*f,v},darken(f){const v=this.hsl();return v.color[2]-=v.color[2]*f,v},saturate(f){const v=this.hsl();return v.color[1]+=v.color[1]*f,v},desaturate(f){const v=this.hsl();return v.color[1]-=v.color[1]*f,v},whiten(f){const v=this.hwb();return v.color[1]+=v.color[1]*f,v},blacken(f){const v=this.hwb();return v.color[2]+=v.color[2]*f,v},grayscale(){const f=this.rgb().color,v=f[0]*.3+f[1]*.59+f[2]*.11;return i.rgb(v,v,v)},fade(f){return this.alpha(this.valpha-this.valpha*f)},opaquer(f){return this.alpha(this.valpha+this.valpha*f)},rotate(f){const v=this.hsl();let Z=v.color[0];return Z=(Z+f)%360,Z=Z<0?360+Z:Z,v.color[0]=Z,v},mix(f,v){if(!f||!f.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof f);const Z=f.rgb(),E=this.rgb(),M=v===void 0?.5:v,V=2*M-1,L=Z.alpha()-E.alpha(),b=((V*L===-1?V:(V+L)/(1+V*L))+1)/2,N=1-b;return i.rgb(b*Z.red()+N*E.red(),b*Z.green()+N*E.green(),b*Z.blue()+N*E.blue(),Z.alpha()*M+E.alpha()*(1-M))}};for(const f of Object.keys(t)){if(n.includes(f))continue;const{channels:v}=t[f];i.prototype[f]=function(...Z){return this.model===f?new i(this):Z.length>0?new i(Z,f):new i([...h(t[this.model][f].raw(this.color)),this.valpha],f)},i[f]=function(...Z){let E=Z[0];return typeof E=="number"&&(E=p(Z,v)),new i(E,f)}}function o(f,v){return Number(f.toFixed(v))}function s(f){return function(v){return o(v,f)}}function c(f,v,Z){f=Array.isArray(f)?f:[f];for(const E of f)(l[E]||(l[E]=[]))[v]=Z;return f=f[0],function(E){let M;return E!==void 0?(Z&&(E=Z(E)),M=this[f](),M.color[v]=E,M):(M=this[f]().color[v],Z&&(M=Z(M)),M)}}function m(f){return function(v){return Math.max(0,Math.min(f,v))}}function h(f){return Array.isArray(f)?f:[f]}function p(f,v){for(let Z=0;Z<v;Z++)typeof f[Z]!="number"&&(f[Z]=0);return f}return vF=i,vF}var Sj0=kj0();const AF=A2(Sj0),qd0=typeof document<"u"?f1.useLayoutEffect:()=>{};var ZF;const Fj0=(ZF=f1.useInsertionEffect)!==null&&ZF!==void 0?ZF:qd0;function Lj0(a){const t=e.useRef(null);return Fj0(()=>{t.current=a},[a]),e.useCallback((...n)=>{const r=t.current;return r?.(...n)},[])}const u3=a=>{var t;return(t=a?.ownerDocument)!==null&&t!==void 0?t:document},p5=a=>a&&"window"in a&&a.window===a?a:u3(a).defaultView||window;function bj0(a){return a!==null&&typeof a=="object"&&"nodeType"in a&&typeof a.nodeType=="number"}function _j0(a){return bj0(a)&&a.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in a}let Nj0=!1;function HF(){return Nj0}function Gd0(a,t){if(!HF())return t&&a?a.contains(t):!1;if(!a||!t)return!1;let n=t;for(;n!==null;){if(n===a)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:_j0(n)?n=n.host:n=n.parentNode}return!1}const EF=(a=document)=>{var t;if(!HF())return a.activeElement;let n=a.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function Wd0(a){return HF()&&a.target.shadowRoot&&a.composedPath?a.composedPath()[0]:a.target}var wj0={};function Cj0(a){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>a.test(r.brand))||a.test(window.navigator.userAgent)}function Tj0(a){var t;return typeof window<"u"&&window.navigator!=null?a.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Kd0(a){if(wj0.NODE_ENV==="test")return a;let t=null;return()=>(t==null&&(t=a()),t)}const Ij0=Kd0(function(){return Tj0(/^Mac/i)}),xj0=Kd0(function(){return Cj0(/Android/i)});function Yd0(){let a=e.useRef(new Map),t=e.useCallback((l,i,o,s)=>{let c=s?.once?(...m)=>{a.current.delete(o),o(...m)}:o;a.current.set(o,{type:i,eventTarget:l,fn:c,options:s}),l.addEventListener(i,c,s)},[]),n=e.useCallback((l,i,o,s)=>{var c;let m=((c=a.current.get(o))===null||c===void 0?void 0:c.fn)||o;l.removeEventListener(i,m,s),a.current.delete(o)},[]),r=e.useCallback(()=>{a.current.forEach((l,i)=>{n(l.eventTarget,l.type,i,l.options)})},[n]);return e.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Pj0(a){return a.pointerType===""&&a.isTrusted?!0:xj0()&&a.pointerType?a.type==="click"&&a.buttons===1:a.detail===0&&!a.pointerType}function Qd0(a){let t=a;return t.nativeEvent=a,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Oj0(a,t){Object.defineProperty(a,"target",{value:t}),Object.defineProperty(a,"currentTarget",{value:t})}function Xd0(a){let t=e.useRef({isFocused:!1,observer:null});qd0(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Lj0(r=>{a?.(r)});return e.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let l=r.target,i=o=>{if(t.current.isFocused=!1,l.disabled){let s=Qd0(o);n(s)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};l.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&l.disabled){var o;(o=t.current.observer)===null||o===void 0||o.disconnect();let s=l===document.activeElement?null:document.activeElement;l.dispatchEvent(new FocusEvent("blur",{relatedTarget:s})),l.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:s}))}}),t.current.observer.observe(l,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let Rj0=!1;var Jd0={};let ou=null,MF=new Set,su=new Map,f5=!1,yF=!1;const $j0={Tab:!0,Escape:!0};function VF(a,t){for(let n of MF)n(a,t)}function Dj0(a){return!(a.metaKey||!Ij0()&&a.altKey||a.ctrlKey||a.key==="Control"||a.key==="Shift"||a.key==="Meta")}function zv(a){f5=!0,Dj0(a)&&(ou="keyboard",VF("keyboard",a))}function B4(a){ou="pointer",(a.type==="mousedown"||a.type==="pointerdown")&&(f5=!0,VF("pointer",a))}function e90(a){Pj0(a)&&(f5=!0,ou="virtual")}function t90(a){a.target===window||a.target===document||Rj0||!a.isTrusted||(!f5&&!yF&&(ou="virtual",VF("virtual",a)),f5=!1,yF=!1)}function a90(){f5=!1,yF=!0}function kF(a){if(typeof window>"u"||typeof document>"u"||su.get(p5(a)))return;const t=p5(a),n=u3(a);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){f5=!0,r.apply(this,arguments)},n.addEventListener("keydown",zv,!0),n.addEventListener("keyup",zv,!0),n.addEventListener("click",e90,!0),t.addEventListener("focus",t90,!0),t.addEventListener("blur",a90,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",B4,!0),n.addEventListener("pointermove",B4,!0),n.addEventListener("pointerup",B4,!0)):Jd0.NODE_ENV==="test"&&(n.addEventListener("mousedown",B4,!0),n.addEventListener("mousemove",B4,!0),n.addEventListener("mouseup",B4,!0)),t.addEventListener("beforeunload",()=>{n90(a)},{once:!0}),su.set(t,{focus:r})}const n90=(a,t)=>{const n=p5(a),r=u3(a);t&&r.removeEventListener("DOMContentLoaded",t),su.has(n)&&(n.HTMLElement.prototype.focus=su.get(n).focus,r.removeEventListener("keydown",zv,!0),r.removeEventListener("keyup",zv,!0),r.removeEventListener("click",e90,!0),n.removeEventListener("focus",t90,!0),n.removeEventListener("blur",a90,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",B4,!0),r.removeEventListener("pointermove",B4,!0),r.removeEventListener("pointerup",B4,!0)):Jd0.NODE_ENV==="test"&&(r.removeEventListener("mousedown",B4,!0),r.removeEventListener("mousemove",B4,!0),r.removeEventListener("mouseup",B4,!0)),su.delete(n))};function jj0(a){const t=u3(a);let n;return t.readyState!=="loading"?kF(a):(n=()=>{kF(a)},t.addEventListener("DOMContentLoaded",n)),()=>n90(a,n)}typeof document<"u"&&jj0();function r90(){return ou!=="pointer"}const Bj0=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function zj0(a,t,n){let r=u3(n?.target);const l=typeof window<"u"?p5(n?.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?p5(n?.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<"u"?p5(n?.target).HTMLElement:HTMLElement,s=typeof window<"u"?p5(n?.target).KeyboardEvent:KeyboardEvent;return a=a||r.activeElement instanceof l&&!Bj0.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof o&&r.activeElement.isContentEditable,!(a&&t==="keyboard"&&n instanceof s&&!$j0[n.key])}function Uj0(a,t,n){kF(),e.useEffect(()=>{let r=(l,i)=>{zj0(!!n?.isTextInput,l,i)&&a(r90())};return MF.add(r),()=>{MF.delete(r)}},t)}function qj0(a){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:l}=a;const i=e.useCallback(c=>{if(c.target===c.currentTarget)return r&&r(c),l&&l(!1),!0},[r,l]),o=Xd0(i),s=e.useCallback(c=>{const m=u3(c.target),h=m?EF(m):EF();c.target===c.currentTarget&&h===Wd0(c.nativeEvent)&&(n&&n(c),l&&l(!0),o(c))},[l,n,o]);return{focusProps:{onFocus:!t&&(n||l||r)?s:void 0,onBlur:!t&&(r||l)?i:void 0}}}function Gj0(a){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:l}=a,i=e.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:s}=Yd0(),c=e.useCallback(p=>{p.currentTarget.contains(p.target)&&i.current.isFocusWithin&&!p.currentTarget.contains(p.relatedTarget)&&(i.current.isFocusWithin=!1,s(),n&&n(p),l&&l(!1))},[n,l,i,s]),m=Xd0(c),h=e.useCallback(p=>{if(!p.currentTarget.contains(p.target))return;const f=u3(p.target),v=EF(f);if(!i.current.isFocusWithin&&v===Wd0(p.nativeEvent)){r&&r(p),l&&l(!0),i.current.isFocusWithin=!0,m(p);let Z=p.currentTarget;o(f,"focus",E=>{if(i.current.isFocusWithin&&!Gd0(Z,E.target)){let M=new f.defaultView.FocusEvent("blur",{relatedTarget:E.target});Oj0(M,Z);let V=Qd0(M);c(V)}},{capture:!0})}},[r,l,m,o,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:h,onBlur:c}}}var SF={};let Uv=!1,qv=0;function FF(){Uv=!0,setTimeout(()=>{Uv=!1},50)}function l90(a){a.pointerType==="touch"&&FF()}function Wj0(){if(!(typeof document>"u"))return qv===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",l90):SF.NODE_ENV==="test"&&document.addEventListener("touchend",FF)),qv++,()=>{qv--,!(qv>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",l90):SF.NODE_ENV==="test"&&document.removeEventListener("touchend",FF))}}function Gv(a){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:l}=a,[i,o]=e.useState(!1),s=e.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;e.useEffect(Wj0,[]);let{addGlobalListener:c,removeAllGlobalListeners:m}=Yd0(),{hoverProps:h,triggerHoverEnd:p}=e.useMemo(()=>{let f=(E,M)=>{if(s.pointerType=M,l||M==="touch"||s.isHovered||!E.currentTarget.contains(E.target))return;s.isHovered=!0;let V=E.currentTarget;s.target=V,c(u3(E.target),"pointerover",L=>{s.isHovered&&s.target&&!Gd0(s.target,L.target)&&v(L,L.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:V,pointerType:M}),n&&n(!0),o(!0)},v=(E,M)=>{let V=s.target;s.pointerType="",s.target=null,!(M==="touch"||!s.isHovered||!V)&&(s.isHovered=!1,m(),r&&r({type:"hoverend",target:V,pointerType:M}),n&&n(!1),o(!1))},Z={};return typeof PointerEvent<"u"?(Z.onPointerEnter=E=>{Uv&&E.pointerType==="mouse"||f(E,E.pointerType)},Z.onPointerLeave=E=>{!l&&E.currentTarget.contains(E.target)&&v(E,E.pointerType)}):SF.NODE_ENV==="test"&&(Z.onTouchStart=()=>{s.ignoreEmulatedMouseEvents=!0},Z.onMouseEnter=E=>{!s.ignoreEmulatedMouseEvents&&!Uv&&f(E,"mouse"),s.ignoreEmulatedMouseEvents=!1},Z.onMouseLeave=E=>{!l&&E.currentTarget.contains(E.target)&&v(E,"mouse")}),{hoverProps:Z,triggerHoverEnd:v}},[t,n,r,l,s,c,m]);return e.useEffect(()=>{l&&p({currentTarget:s.target},s.pointerType)},[l]),{hoverProps:h,isHovered:i}}function Wv(a={}){let{autoFocus:t=!1,isTextInput:n,within:r}=a,l=e.useRef({isFocused:!1,isFocusVisible:t||r90()}),[i,o]=e.useState(!1),[s,c]=e.useState(()=>l.current.isFocused&&l.current.isFocusVisible),m=e.useCallback(()=>c(l.current.isFocused&&l.current.isFocusVisible),[]),h=e.useCallback(v=>{l.current.isFocused=v,o(v),m()},[m]);Uj0(v=>{l.current.isFocusVisible=v,m()},[],{isTextInput:n});let{focusProps:p}=qj0({isDisabled:r,onFocusChange:h}),{focusWithinProps:f}=Gj0({isDisabled:!r,onFocusWithinChange:h});return{isFocused:i,isFocusVisible:s,focusProps:r?f:p}}var Kj0=Object.defineProperty,Yj0=(a,t,n)=>t in a?Kj0(a,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[t]=n,LF=(a,t,n)=>(Yj0(a,typeof t!="symbol"?t+"":t,n),n);let Qj0=class{constructor(){LF(this,"current",this.detect()),LF(this,"handoffState","pending"),LF(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Lr=new Qj0;function g5(a){var t;return Lr.isServer?null:a==null?document:(t=a?.ownerDocument)!=null?t:document}function Kv(a){var t,n;return Lr.isServer?null:a==null?document:(n=(t=a?.getRootNode)==null?void 0:t.call(a))!=null?n:document}function bF(a){var t,n;return(n=(t=Kv(a))==null?void 0:t.activeElement)!=null?n:null}function i90(a){return bF(a)===a}function Yv(a){typeof queueMicrotask=="function"?queueMicrotask(a):Promise.resolve().then(a).catch(t=>setTimeout(()=>{throw t}))}function j6(){let a=[],t={addEventListener(n,r,l,i){return n.addEventListener(r,l,i),t.add(()=>n.removeEventListener(r,l,i))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Yv(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,l){let i=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:l}),this.add(()=>{Object.assign(n.style,{[r]:i})})},group(n){let r=j6();return n(r),this.add(()=>r.dispose())},add(n){return a.includes(n)||a.push(n),()=>{let r=a.indexOf(n);if(r>=0)for(let l of a.splice(r,1))l()}},dispose(){for(let n of a.splice(0))n()}};return t}function v5(){let[a]=e.useState(j6);return e.useEffect(()=>()=>a.dispose(),[a]),a}let St=(a,t)=>{Lr.isServer?e.useEffect(a,t):e.useLayoutEffect(a,t)};function A5(a){let t=e.useRef(a);return St(()=>{t.current=a},[a]),t}let Se=function(a){let t=A5(a);return f1.useCallback((...n)=>t.current(...n),[t])};function Xj0(a){let t=a.width/2,n=a.height/2;return{top:a.clientY-n,right:a.clientX+t,bottom:a.clientY+n,left:a.clientX-t}}function Jj0(a,t){return!(!a||!t||a.right<t.left||a.left>t.right||a.bottom<t.top||a.top>t.bottom)}function _F({disabled:a=!1}={}){let t=e.useRef(null),[n,r]=e.useState(!1),l=v5(),i=Se(()=>{t.current=null,r(!1),l.dispose()}),o=Se(s=>{if(l.dispose(),t.current===null){t.current=s.currentTarget,r(!0);{let c=g5(s.currentTarget);l.addEventListener(c,"pointerup",i,!1),l.addEventListener(c,"pointermove",m=>{if(t.current){let h=Xj0(m);r(Jj0(h,t.current.getBoundingClientRect()))}},!1),l.addEventListener(c,"pointercancel",i,!1)}}});return{pressed:n,pressProps:a?{}:{onPointerDown:o,onPointerUp:i,onClick:i}}}function m4(a){return e.useMemo(()=>a,Object.values(a))}let eB0=e.createContext(void 0);function Qv(){return e.useContext(eB0)}function NF(...a){return Array.from(new Set(a.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function _n(a,t,...n){if(a in t){let l=t[a];return typeof l=="function"?l(...n):l}let r=new Error(`Tried to handle "${a}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(l=>`"${l}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,_n),r}var uc=(a=>(a[a.None=0]="None",a[a.RenderStrategy=1]="RenderStrategy",a[a.Static=2]="Static",a))(uc||{}),h3=(a=>(a[a.Unmount=0]="Unmount",a[a.Hidden=1]="Hidden",a))(h3||{});function Bt(){let a=aB0();return e.useCallback(t=>tB0({mergeRefs:a,...t}),[a])}function tB0({ourProps:a,theirProps:t,slot:n,defaultTag:r,features:l,visible:i=!0,name:o,mergeRefs:s}){s=s??nB0;let c=o90(t,a);if(i)return Xv(c,n,r,o,s);let m=l??0;if(m&2){let{static:h=!1,...p}=c;if(h)return Xv(p,n,r,o,s)}if(m&1){let{unmount:h=!0,...p}=c;return _n(h?0:1,{0(){return null},1(){return Xv({...p,hidden:!0,style:{display:"none"}},n,r,o,s)}})}return Xv(c,n,r,o,s)}function Xv(a,t={},n,r,l){let{as:i=n,children:o,refName:s="ref",...c}=wF(a,["unmount","static"]),m=a.ref!==void 0?{[s]:a.ref}:{},h=typeof o=="function"?o(t):o;"className"in c&&c.className&&typeof c.className=="function"&&(c.className=c.className(t)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let p={};if(t){let f=!1,v=[];for(let[Z,E]of Object.entries(t))typeof E=="boolean"&&(f=!0),E===!0&&v.push(Z.replace(/([A-Z])/g,M=>`-${M.toLowerCase()}`));if(f){p["data-headlessui-state"]=v.join(" ");for(let Z of v)p[`data-${Z}`]=""}}if(du(i)&&(Object.keys(Z5(c)).length>0||Object.keys(Z5(p)).length>0))if(!e.isValidElement(h)||Array.isArray(h)&&h.length>1||lB0(h)){if(Object.keys(Z5(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Z5(c)).concat(Object.keys(Z5(p))).map(f=>` - ${f}`).join(`
244
244
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(f=>` - ${f}`).join(`
245
245
  `)].join(`
246
246
  `))}else{let f=h.props,v=f?.className,Z=typeof v=="function"?(...V)=>NF(v(...V),c.className):NF(v,c.className),E=Z?{className:Z}:{},M=o90(h.props,Z5(wF(c,["ref"])));for(let V in p)V in M&&delete p[V];return e.cloneElement(h,Object.assign({},M,p,m,{ref:l(rB0(h),m.ref)},E))}return e.createElement(i,Object.assign({},wF(c,["ref"]),!du(i)&&m,!du(i)&&p),h)}function aB0(){let a=e.useRef([]),t=e.useCallback(n=>{for(let r of a.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return a.current=n,t}}function nB0(...a){return a.every(t=>t==null)?void 0:t=>{for(let n of a)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function o90(...a){if(a.length===0)return{};if(a.length===1)return a[0];let t={},n={};for(let r of a)for(let l in r)l.startsWith("on")&&typeof r[l]=="function"?(n[l]!=null||(n[l]=[]),n[l].push(r[l])):t[l]=r[l];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[l=>{var i;return(i=l?.preventDefault)==null?void 0:i.call(l)}]);for(let r in n)Object.assign(t,{[r](l,...i){let o=n[r];for(let s of o){if((l instanceof Event||l?.nativeEvent instanceof Event)&&l.defaultPrevented)return;s(l,...i)}}});return t}function cu(...a){if(a.length===0)return{};if(a.length===1)return a[0];let t={},n={};for(let r of a)for(let l in r)l.startsWith("on")&&typeof r[l]=="function"?(n[l]!=null||(n[l]=[]),n[l].push(r[l])):t[l]=r[l];for(let r in n)Object.assign(t,{[r](...l){let i=n[r];for(let o of i)o?.(...l)}});return t}function Ft(a){var t;return Object.assign(e.forwardRef(a),{displayName:(t=a.displayName)!=null?t:a.name})}function Z5(a){let t=Object.assign({},a);for(let n in t)t[n]===void 0&&delete t[n];return t}function wF(a,t=[]){let n=Object.assign({},a);for(let r of t)r in n&&delete n[r];return n}function rB0(a){return f1.version.split(".")[0]>="19"?a.props.ref:a.ref}function du(a){return a===e.Fragment||a===Symbol.for("react.fragment")}function lB0(a){return du(a.type)}let iB0="button";function oB0(a,t){var n;let r=Qv(),{disabled:l=r||!1,autoFocus:i=!1,...o}=a,{isFocusVisible:s,focusProps:c}=Wv({autoFocus:i}),{isHovered:m,hoverProps:h}=Gv({isDisabled:l}),{pressed:p,pressProps:f}=_F({disabled:l}),v=cu({ref:t,type:(n=o.type)!=null?n:"button",disabled:l||void 0,autoFocus:i},c,h,f),Z=m4({disabled:l,hover:m,focus:s,active:p,autofocus:i});return Bt()({ourProps:v,theirProps:o,slot:Z,defaultTag:iB0,name:"Button"})}let sB0=Ft(oB0),cB0="span";var Jv=(a=>(a[a.None=1]="None",a[a.Focusable=2]="Focusable",a[a.Hidden=4]="Hidden",a))(Jv||{});function dB0(a,t){var n;let{features:r=1,...l}=a,i={ref:t,"aria-hidden":(r&2)===2?!0:(n=l["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Bt()({ourProps:i,theirProps:l,slot:{},defaultTag:cB0,name:"Hidden"})}let CF=Ft(dB0),mB0=e.createContext(void 0);function s90(){return e.useContext(mB0)}function c90(a){return typeof a!="object"||a===null?!1:"nodeType"in a}function jl(a){return c90(a)&&"tagName"in a}function u4(a){return jl(a)&&"accessKey"in a}function br(a){return jl(a)&&"tabIndex"in a}function uB0(a){return jl(a)&&"style"in a}function hB0(a){return u4(a)&&a.nodeName==="IFRAME"}function d90(a){return u4(a)&&a.nodeName==="INPUT"}function m90(a){return u4(a)&&a.nodeName==="LABEL"}function pB0(a){return u4(a)&&a.nodeName==="FIELDSET"}function u90(a){return u4(a)&&a.nodeName==="LEGEND"}function fB0(a){return jl(a)?a.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function h90(a){let t=a.parentElement,n=null;for(;t&&!pB0(t);)u90(t)&&(n=t),t=t.parentElement;let r=t?.getAttribute("disabled")==="";return r&&gB0(n)?!1:r}function gB0(a){if(!a)return!1;let t=a.previousElementSibling;for(;t!==null;){if(u90(t))return!1;t=t.previousElementSibling}return!0}let p90=Symbol();function vB0(a,t=!0){return Object.assign(a,{[p90]:t})}function v6(...a){let t=e.useRef(a);e.useEffect(()=>{t.current=a},[a]);let n=Se(r=>{for(let l of t.current)l!=null&&(typeof l=="function"?l(r):l.current=r)});return a.every(r=>r==null||r?.[p90])?void 0:n}let eA=e.createContext(null);eA.displayName="DescriptionContext";function f90(){let a=e.useContext(eA);if(a===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,f90),t}return a}function AB0(){var a,t;return(t=(a=e.useContext(eA))==null?void 0:a.value)!=null?t:void 0}function g90(){let[a,t]=e.useState([]);return[a.length>0?a.join(" "):void 0,e.useMemo(()=>function(n){let r=Se(i=>(t(o=>[...o,i]),()=>t(o=>{let s=o.slice(),c=s.indexOf(i);return c!==-1&&s.splice(c,1),s}))),l=e.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props,value:n.value}),[r,n.slot,n.name,n.props,n.value]);return f1.createElement(eA.Provider,{value:l},n.children)},[t])]}let ZB0="p";function HB0(a,t){let n=e.useId(),r=Qv(),{id:l=`headlessui-description-${n}`,...i}=a,o=f90(),s=v6(t);St(()=>o.register(l),[l,o.register]);let c=m4({...o.slot,disabled:r||!1}),m={ref:s,...o.props,id:l};return Bt()({ourProps:m,theirProps:i,slot:c,defaultTag:ZB0,name:o.name||"Description"})}let EB0=Ft(HB0),MB0=Object.assign(EB0,{});var l8=(a=>(a.Space=" ",a.Enter="Enter",a.Escape="Escape",a.Backspace="Backspace",a.Delete="Delete",a.ArrowLeft="ArrowLeft",a.ArrowUp="ArrowUp",a.ArrowRight="ArrowRight",a.ArrowDown="ArrowDown",a.Home="Home",a.End="End",a.PageUp="PageUp",a.PageDown="PageDown",a.Tab="Tab",a))(l8||{});let tA=e.createContext(null);tA.displayName="LabelContext";function TF(){let a=e.useContext(tA);if(a===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,TF),t}return a}function v90(a){var t,n,r;let l=(n=(t=e.useContext(tA))==null?void 0:t.value)!=null?n:void 0;return((r=void 0)!=null?r:0)>0?[l,...a].filter(Boolean).join(" "):l}function A90({inherit:a=!1}={}){let t=v90(),[n,r]=e.useState([]),l=a?[t,...n].filter(Boolean):n;return[l.length>0?l.join(" "):void 0,e.useMemo(()=>function(i){let o=Se(c=>(r(m=>[...m,c]),()=>r(m=>{let h=m.slice(),p=h.indexOf(c);return p!==-1&&h.splice(p,1),h}))),s=e.useMemo(()=>({register:o,slot:i.slot,name:i.name,props:i.props,value:i.value}),[o,i.slot,i.name,i.props,i.value]);return f1.createElement(tA.Provider,{value:s},i.children)},[r])]}let yB0="label";function VB0(a,t){var n;let r=e.useId(),l=TF(),i=s90(),o=Qv(),{id:s=`headlessui-label-${r}`,htmlFor:c=i??((n=l.props)==null?void 0:n.htmlFor),passive:m=!1,...h}=a,p=v6(t);St(()=>l.register(s),[s,l.register]);let f=Se(E=>{let M=E.currentTarget;if(!(E.target!==E.currentTarget&&fB0(E.target))&&(m90(M)&&E.preventDefault(),l.props&&"onClick"in l.props&&typeof l.props.onClick=="function"&&l.props.onClick(E),m90(M))){let V=document.getElementById(M.htmlFor);if(V){let L=V.getAttribute("disabled");if(L==="true"||L==="")return;let b=V.getAttribute("aria-disabled");if(b==="true"||b==="")return;(d90(V)&&(V.type==="file"||V.type==="radio"||V.type==="checkbox")||V.role==="radio"||V.role==="checkbox"||V.role==="switch")&&V.click(),V.focus({preventScroll:!0})}}}),v=m4({...l.slot,disabled:o||!1}),Z={ref:p,...l.props,id:s,htmlFor:c,onClick:f};return m&&("onClick"in Z&&(delete Z.htmlFor,delete Z.onClick),"onClick"in h&&delete h.onClick),Bt()({ourProps:Z,theirProps:h,slot:v,defaultTag:c?yB0:"div",name:l.name||"Label"})}let kB0=Ft(VB0),SB0=Object.assign(kB0,{}),FB0=e.createContext(()=>{});function LB0({value:a,children:t}){return f1.createElement(FB0.Provider,{value:a},t)}function Z90(a){if(a===null)return{width:0,height:0};let{width:t,height:n}=a.getBoundingClientRect();return{width:t,height:n}}function bB0(a,t,n=!1){let[r,l]=e.useState(()=>Z90(t));return St(()=>{if(!t||!a)return;let i=j6();return i.requestAnimationFrame(function o(){i.requestAnimationFrame(o),l(s=>{let c=Z90(t);return c.width===s.width&&c.height===s.height?s:c})}),()=>{i.dispose()}},[t,a]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var H90=(a=>(a[a.Left=0]="Left",a[a.Right=2]="Right",a))(H90||{});function _B0(a){let t=e.useRef(null),n=Se(l=>{t.current=l.pointerType,!h90(l.currentTarget)&&l.pointerType==="mouse"&&l.button===H90.Left&&(l.preventDefault(),a(l))}),r=Se(l=>{t.current!=="mouse"&&(h90(l.currentTarget)||a(l))});return{onPointerDown:n,onClick:r}}let E90=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var NB0=Object.defineProperty,wB0=(a,t,n)=>t in a?NB0(a,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[t]=n,CB0=(a,t,n)=>(wB0(a,t+"",n),n),M90=(a,t,n)=>{if(!t.has(a))throw TypeError("Cannot "+n)},z4=(a,t,n)=>(M90(a,t,"read from private field"),n?n.call(a):t.get(a)),IF=(a,t,n)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,n)},y90=(a,t,n,r)=>(M90(a,t,"write to private field"),t.set(a,n),n),_r,mu,uu;let V90=class{constructor(t){IF(this,_r,{}),IF(this,mu,new E90(()=>new Set)),IF(this,uu,new Set),CB0(this,"disposables",j6()),y90(this,_r,t),Lr.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return z4(this,_r)}subscribe(t,n){if(Lr.isServer)return()=>{};let r={selector:t,callback:n,current:t(z4(this,_r))};return z4(this,uu).add(r),this.disposables.add(()=>{z4(this,uu).delete(r)})}on(t,n){return Lr.isServer?()=>{}:(z4(this,mu).get(t).add(n),this.disposables.add(()=>{z4(this,mu).get(t).delete(n)}))}send(t){let n=this.reduce(z4(this,_r),t);if(n!==z4(this,_r)){y90(this,_r,n);for(let r of z4(this,uu)){let l=r.selector(z4(this,_r));k90(r.current,l)||(r.current=l,r.callback(l))}for(let r of z4(this,mu).get(t.type))r(z4(this,_r),t)}}};_r=new WeakMap,mu=new WeakMap,uu=new WeakMap;function k90(a,t){return Object.is(a,t)?!0:typeof a!="object"||a===null||typeof t!="object"||t===null?!1:Array.isArray(a)&&Array.isArray(t)?a.length!==t.length?!1:xF(a[Symbol.iterator](),t[Symbol.iterator]()):a instanceof Map&&t instanceof Map||a instanceof Set&&t instanceof Set?a.size!==t.size?!1:xF(a.entries(),t.entries()):S90(a)&&S90(t)?xF(Object.entries(a)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function xF(a,t){do{let n=a.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function S90(a){if(Object.prototype.toString.call(a)!=="[object Object]")return!1;let t=Object.getPrototypeOf(a);return t===null||Object.getPrototypeOf(t)===null}function F90(a){let[t,n]=a(),r=j6();return(...l)=>{t(...l),r.dispose(),r.microTask(n)}}var TB0=Object.defineProperty,IB0=(a,t,n)=>t in a?TB0(a,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[t]=n,L90=(a,t,n)=>(IB0(a,typeof t!="symbol"?t+"":t,n),n),b90=(a=>(a[a.Push=0]="Push",a[a.Pop=1]="Pop",a))(b90||{});let xB0={0(a,t){let n=t.id,r=a.stack,l=a.stack.indexOf(n);if(l!==-1){let i=a.stack.slice();return i.splice(l,1),i.push(n),r=i,{...a,stack:r}}return{...a,stack:[...a.stack,n]}},1(a,t){let n=t.id,r=a.stack.indexOf(n);if(r===-1)return a;let l=a.stack.slice();return l.splice(r,1),{...a,stack:l}}},PB0=class YF0 extends V90{constructor(){super(...arguments),L90(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),L90(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new YF0({stack:[]})}reduce(t,n){return _n(n.type,xB0,t,n)}};const aA=new E90(()=>PB0.new());var nA={exports:{}},PF={};var _90;function OB0(){if(_90)return PF;_90=1;var a=k2();function t(c,m){return c===m&&(c!==0||1/c===1/m)||c!==c&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=a.useSyncExternalStore,l=a.useRef,i=a.useEffect,o=a.useMemo,s=a.useDebugValue;return PF.useSyncExternalStoreWithSelector=function(c,m,h,p,f){var v=l(null);if(v.current===null){var Z={hasValue:!1,value:null};v.current=Z}else Z=v.current;v=o(function(){function M(F){if(!V){if(V=!0,L=F,F=p(F),f!==void 0&&Z.hasValue){var w=Z.value;if(f(w,F))return b=w}return b=F}if(w=b,n(L,F))return w;var x=p(F);return f!==void 0&&f(w,x)?(L=F,w):(L=F,b=x)}var V=!1,L,b,N=h===void 0?null:h;return[function(){return M(m())},N===null?void 0:function(){return M(N())}]},[m,h,p,f]);var E=r(c,v[0],v[1]);return i(function(){Z.hasValue=!0,Z.value=E},[E]),s(E),E},PF}var OF={},N90;function RB0(){if(N90)return OF;N90=1;var a={};return a.NODE_ENV!=="production"&&(function(){function t(m,h){return m===h&&(m!==0||1/m===1/h)||m!==m&&h!==h}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=k2(),r=typeof Object.is=="function"?Object.is:t,l=n.useSyncExternalStore,i=n.useRef,o=n.useEffect,s=n.useMemo,c=n.useDebugValue;OF.useSyncExternalStoreWithSelector=function(m,h,p,f,v){var Z=i(null);if(Z.current===null){var E={hasValue:!1,value:null};Z.current=E}else E=Z.current;Z=s(function(){function V(w){if(!L){if(L=!0,b=w,w=f(w),v!==void 0&&E.hasValue){var x=E.value;if(v(x,w))return N=x}return N=w}if(x=N,r(b,w))return x;var P=f(w);return v!==void 0&&v(x,P)?(b=w,x):(b=w,N=P)}var L=!1,b,N,F=p===void 0?null:p;return[function(){return V(h())},F===null?void 0:function(){return V(F())}]},[h,p,f,v]);var M=l(m,Z[0],Z[1]);return o(function(){E.hasValue=!0,E.value=M},[M]),c(M),M},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),OF}var w90;function $B0(){if(w90)return nA.exports;w90=1;var a={};return a.NODE_ENV==="production"?nA.exports=OB0():nA.exports=RB0(),nA.exports}var DB0=$B0();function U4(a,t,n=k90){return DB0.useSyncExternalStoreWithSelector(Se(r=>a.subscribe(jB0,r)),Se(()=>a.state),Se(()=>a.state),Se(t),n)}function jB0(a){return a}function hu(a,t){let n=e.useId(),r=aA.get(t),[l,i]=U4(r,e.useCallback(o=>[r.selectors.isTop(o,n),r.selectors.inStack(o,n)],[r,n]));return St(()=>{if(a)return r.actions.push(n),()=>r.actions.pop(n)},[r,a,n]),a?i?l:!0:!1}let RF=new Map,pu=new Map;function C90(a){var t;let n=(t=pu.get(a))!=null?t:0;return pu.set(a,n+1),n!==0?()=>T90(a):(RF.set(a,{"aria-hidden":a.getAttribute("aria-hidden"),inert:a.inert}),a.setAttribute("aria-hidden","true"),a.inert=!0,()=>T90(a))}function T90(a){var t;let n=(t=pu.get(a))!=null?t:1;if(n===1?pu.delete(a):pu.set(a,n-1),n!==1)return;let r=RF.get(a);r&&(r["aria-hidden"]===null?a.removeAttribute("aria-hidden"):a.setAttribute("aria-hidden",r["aria-hidden"]),a.inert=r.inert,RF.delete(a))}function I90(a,{allowed:t,disallowed:n}={}){let r=hu(a,"inert-others");St(()=>{var l,i;if(!r)return;let o=j6();for(let c of(l=n?.())!=null?l:[])c&&o.add(C90(c));let s=(i=t?.())!=null?i:[];for(let c of s){if(!c)continue;let m=g5(c);if(!m)continue;let h=c.parentElement;for(;h&&h!==m.body;){for(let p of h.children)s.some(f=>p.contains(f))||o.add(C90(p));h=h.parentElement}}return o.dispose},[r,t,n])}function x90(a,t,n){let r=A5(l=>{let i=l.getBoundingClientRect();i.x===0&&i.y===0&&i.width===0&&i.height===0&&n()});e.useEffect(()=>{if(!a)return;let l=t===null?null:u4(t)?t:t.current;if(!l)return;let i=j6();if(typeof ResizeObserver<"u"){let o=new ResizeObserver(()=>r.current(l));o.observe(l),i.add(()=>o.disconnect())}if(typeof IntersectionObserver<"u"){let o=new IntersectionObserver(()=>r.current(l));o.observe(l),i.add(()=>o.disconnect())}return()=>i.dispose()},[t,r,a])}let rA=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(a=>`${a}:not([tabindex='-1'])`).join(","),BB0=["[data-autofocus]"].map(a=>`${a}:not([tabindex='-1'])`).join(",");var Nn=(a=>(a[a.First=1]="First",a[a.Previous=2]="Previous",a[a.Next=4]="Next",a[a.Last=8]="Last",a[a.WrapAround=16]="WrapAround",a[a.NoScroll=32]="NoScroll",a[a.AutoFocus=64]="AutoFocus",a))(Nn||{}),$F=(a=>(a[a.Error=0]="Error",a[a.Overflow=1]="Overflow",a[a.Success=2]="Success",a[a.Underflow=3]="Underflow",a))($F||{}),zB0=(a=>(a[a.Previous=-1]="Previous",a[a.Next=1]="Next",a))(zB0||{});function P90(a=document.body){return a==null?[]:Array.from(a.querySelectorAll(rA)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function UB0(a=document.body){return a==null?[]:Array.from(a.querySelectorAll(BB0)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var DF=(a=>(a[a.Strict=0]="Strict",a[a.Loose=1]="Loose",a))(DF||{});function jF(a,t=0){var n;return a===((n=g5(a))==null?void 0:n.body)?!1:_n(t,{0(){return a.matches(rA)},1(){let r=a;for(;r!==null;){if(r.matches(rA))return!0;r=r.parentElement}return!1}})}function O90(a){j6().nextFrame(()=>{let t=bF(a);t&&br(t)&&!jF(t,0)&&Nr(a)})}var qB0=(a=>(a[a.Keyboard=0]="Keyboard",a[a.Mouse=1]="Mouse",a))(qB0||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",a=>{a.metaKey||a.altKey||a.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",a=>{a.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:a.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Nr(a){a?.focus({preventScroll:!0})}let GB0=["textarea","input"].join(",");function WB0(a){var t,n;return(n=(t=a?.matches)==null?void 0:t.call(a,GB0))!=null?n:!1}function R90(a,t=n=>n){return a.slice().sort((n,r)=>{let l=t(n),i=t(r);if(l===null||i===null)return 0;let o=l.compareDocumentPosition(i);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function KB0(a,t,n=a===null?document.body:Kv(a)){return hc(P90(n),t,{relativeTo:a})}function hc(a,t,{sorted:n=!0,relativeTo:r=null,skipElements:l=[]}={}){let i=Array.isArray(a)?a.length>0?Kv(a[0]):document:Kv(a),o=Array.isArray(a)?n?R90(a):a:t&64?UB0(a):P90(a);l.length>0&&o.length>1&&(o=o.filter(v=>!l.some(Z=>Z!=null&&"current"in Z?Z?.current===v:Z===v))),r=r??i?.activeElement;let s=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,o.indexOf(r))-1;if(t&4)return Math.max(0,o.indexOf(r))+1;if(t&8)return o.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),m=t&32?{preventScroll:!0}:{},h=0,p=o.length,f;do{if(h>=p||h+p<=0)return 0;let v=c+h;if(t&16)v=(v+p)%p;else{if(v<0)return 3;if(v>=p)return 1}f=o[v],f?.focus(m),h+=s}while(f!==bF(f));return t&6&&WB0(f)&&f.select(),2}function $90(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function YB0(){return/Android/gi.test(window.navigator.userAgent)}function D90(){return $90()||YB0()}function pc(a,t,n,r){let l=A5(n);e.useEffect(()=>{if(!a)return;function i(o){l.current(o)}return document.addEventListener(t,i,r),()=>document.removeEventListener(t,i,r)},[a,t,r])}function j90(a,t,n,r){let l=A5(n);e.useEffect(()=>{if(!a)return;function i(o){l.current(o)}return window.addEventListener(t,i,r),()=>window.removeEventListener(t,i,r)},[a,t,r])}const B90=30;function z90(a,t,n){let r=A5(n),l=e.useCallback(function(s,c){if(s.defaultPrevented)return;let m=c(s);if(m===null||!m.getRootNode().contains(m)||!m.isConnected)return;let h=(function p(f){return typeof f=="function"?p(f()):Array.isArray(f)||f instanceof Set?f:[f]})(t);for(let p of h)if(p!==null&&(p.contains(m)||s.composed&&s.composedPath().includes(p)))return;return!jF(m,DF.Loose)&&m.tabIndex!==-1&&s.preventDefault(),r.current(s,m)},[r,t]),i=e.useRef(null);pc(a,"pointerdown",s=>{var c,m;D90()||(i.current=((m=(c=s.composedPath)==null?void 0:c.call(s))==null?void 0:m[0])||s.target)},!0),pc(a,"pointerup",s=>{if(D90()||!i.current)return;let c=i.current;return i.current=null,l(s,()=>c)},!0);let o=e.useRef({x:0,y:0});pc(a,"touchstart",s=>{o.current.x=s.touches[0].clientX,o.current.y=s.touches[0].clientY},!0),pc(a,"touchend",s=>{let c={x:s.changedTouches[0].clientX,y:s.changedTouches[0].clientY};if(!(Math.abs(c.x-o.current.x)>=B90||Math.abs(c.y-o.current.y)>=B90))return l(s,()=>br(s.target)?s.target:null)},!0),j90(a,"blur",s=>l(s,()=>hB0(window.document.activeElement)?window.document.activeElement:null),!0)}function fu(...a){return e.useMemo(()=>g5(...a),[...a])}var QB0=(a=>(a[a.Ignore=0]="Ignore",a[a.Select=1]="Select",a[a.Close=2]="Close",a))(QB0||{});const lA={Ignore:{kind:0},Select:a=>({kind:1,target:a}),Close:{kind:2}},XB0=200,U90=5;function JB0(a,{trigger:t,action:n,close:r,select:l}){let i=e.useRef(null),o=e.useRef(null),s=e.useRef(null);pc(a&&t!==null,"pointerdown",c=>{c90(c?.target)&&t!=null&&t.contains(c.target)&&(o.current=c.x,s.current=c.y,i.current=c.timeStamp)}),pc(a&&t!==null,"pointerup",c=>{var m,h;let p=i.current;if(p===null||(i.current=null,!br(c.target))||Math.abs(c.x-((m=o.current)!=null?m:c.x))<U90&&Math.abs(c.y-((h=s.current)!=null?h:c.y))<U90)return;let f=n(c);switch(f.kind){case 0:return;case 1:{c.timeStamp-p>XB0&&(l(f.target),r());break}case 2:{r();break}}},{capture:!0})}function q90(a,t,n,r){let l=A5(n);e.useEffect(()=>{a=a??window;function i(o){l.current(o)}return a.addEventListener(t,i,r),()=>a.removeEventListener(t,i,r)},[a,t,r])}function ez0(a,t){return e.useMemo(()=>{var n;if(a.type)return a.type;let r=(n=a.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||t?.tagName==="BUTTON"&&!t.hasAttribute("type"))return"button"},[a.type,a.as,t])}function tz0(a){return e.useSyncExternalStore(a.subscribe,a.getSnapshot,a.getSnapshot)}function az0(a,t){let n=a(),r=new Set;return{getSnapshot(){return n},subscribe(l){return r.add(l),()=>r.delete(l)},dispatch(l,...i){let o=t[l].call(n,...i);o&&(n=o,r.forEach(s=>s()))}}}function nz0(){let a;return{before({doc:t}){var n;let r=t.documentElement,l=(n=t.defaultView)!=null?n:window;a=Math.max(0,l.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,l=Math.max(0,r.clientWidth-r.offsetWidth),i=Math.max(0,a-l);n.style(r,"paddingRight",`${i}px`)}}}function rz0(){return $90()?{before({doc:a,d:t,meta:n}){function r(l){for(let i of n().containers)for(let o of i())if(o.contains(l))return!0;return!1}t.microTask(()=>{var l;if(window.getComputedStyle(a.documentElement).scrollBehavior!=="auto"){let s=j6();s.style(a.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>s.dispose()))}let i=(l=window.scrollY)!=null?l:window.pageYOffset,o=null;t.addEventListener(a,"click",s=>{if(br(s.target))try{let c=s.target.closest("a");if(!c)return;let{hash:m}=new URL(c.href),h=a.querySelector(m);br(h)&&!r(h)&&(o=h)}catch{}},!0),t.group(s=>{t.addEventListener(a,"touchstart",c=>{if(s.dispose(),br(c.target)&&uB0(c.target))if(r(c.target)){let m=c.target;for(;m.parentElement&&r(m.parentElement);)m=m.parentElement;s.style(m,"overscrollBehavior","contain")}else s.style(c.target,"touchAction","none")})}),t.addEventListener(a,"touchmove",s=>{if(br(s.target)){if(d90(s.target))return;if(r(s.target)){let c=s.target;for(;c.parentElement&&c.dataset.headlessuiPortal!==""&&!(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth);)c=c.parentElement;c.dataset.headlessuiPortal===""&&s.preventDefault()}else s.preventDefault()}},{passive:!1}),t.add(()=>{var s;let c=(s=window.scrollY)!=null?s:window.pageYOffset;i!==c&&window.scrollTo(0,i),o&&o.isConnected&&(o.scrollIntoView({block:"nearest"}),o=null)})})}}:{}}function lz0(){return{before({doc:a,d:t}){t.style(a.documentElement,"overflow","hidden")}}}function G90(a){let t={};for(let n of a)Object.assign(t,n(t));return t}let H5=az0(()=>new Map,{PUSH(a,t){var n;let r=(n=this.get(a))!=null?n:{doc:a,count:0,d:j6(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=G90(r.meta),this.set(a,r),this},POP(a,t){let n=this.get(a);return n&&(n.count--,n.meta.delete(t),n.computedMeta=G90(n.meta)),this},SCROLL_PREVENT(a){let t={doc:a.doc,d:a.d,meta(){return a.computedMeta}},n=[rz0(),nz0(),lz0()];n.forEach(({before:r})=>r?.(t)),n.forEach(({after:r})=>r?.(t))},SCROLL_ALLOW({d:a}){a.dispose()},TEARDOWN({doc:a}){this.delete(a)}});H5.subscribe(()=>{let a=H5.getSnapshot(),t=new Map;for(let[n]of a)t.set(n,n.documentElement.style.overflow);for(let n of a.values()){let r=t.get(n.doc)==="hidden",l=n.count!==0;(l&&!r||!l&&r)&&H5.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&H5.dispatch("TEARDOWN",n)}});function iz0(a,t,n=()=>({containers:[]})){let r=tz0(H5),l=t?r.get(t):void 0,i=l?l.count>0:!1;return St(()=>{if(!(!t||!a))return H5.dispatch("PUSH",t,n),()=>H5.dispatch("POP",t,n)},[a,t]),i}function W90(a,t,n=()=>[document.body]){let r=hu(a,"scroll-lock");iz0(r,t,l=>{var i;return{containers:[...(i=l.containers)!=null?i:[],n]}})}function K90(a){return[a.screenX,a.screenY]}function oz0(){let a=e.useRef([-1,-1]);return{wasMoved(t){let n=K90(t);return a.current[0]===n[0]&&a.current[1]===n[1]?!1:(a.current=n,!0)},update(t){a.current=K90(t)}}}function sz0(a=0){let[t,n]=e.useState(a),r=e.useCallback(c=>n(c),[]),l=e.useCallback(c=>n(m=>m|c),[]),i=e.useCallback(c=>(t&c)===c,[t]),o=e.useCallback(c=>n(m=>m&~c),[]),s=e.useCallback(c=>n(m=>m^c),[]);return{flags:t,setFlag:r,addFlag:l,hasFlag:i,removeFlag:o,toggleFlag:s}}var cz0={},Y90,Q90;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Y90=process==null?void 0:cz0)==null?void 0:Y90.NODE_ENV)==="test"&&typeof((Q90=Element?.prototype)==null?void 0:Q90.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`