@zuplo/editor 1.0.37322956476 → 1.0.37434747656
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.
- package/dist/client/index.html +2 -2
- package/dist/client/static/js/{GraphiQLConsole-Dd4ZMSHZ.js → GraphiQLConsole-B_vAqaM3.js} +4 -4
- package/dist/client/static/js/{McpCapabilityFilterDesigner-CykuRHLA.js → McpCapabilityFilterDesigner-DbZJmr7V.js} +1 -1
- package/dist/client/static/js/{SchemaReference-BPvOS4NL.js → SchemaReference-DvtWqAE2.js} +1 -1
- package/dist/client/static/js/de-B385F6TI.js +1 -0
- package/dist/client/static/js/{dist-CsanfiUI.js → dist-jezYfUfh.js} +1 -1
- package/dist/client/static/js/{esm-B-FnQs_L.js → esm-D_r8daG3.js} +1 -1
- package/dist/client/static/js/{hint-C6dVsPau.js → hint-CugJCkXC.js} +1 -1
- package/dist/client/static/js/{hint-BolSaewU.js → hint-DQlcOKXj.js} +1 -1
- package/dist/client/static/js/{info-B2w4GvSf.js → info-BcP46r7o.js} +1 -1
- package/dist/client/static/js/{jump-Bf-zBkJw.js → jump-CP5td36y.js} +1 -1
- package/dist/client/static/js/{lint-DWflU5Mw.js → lint-CN1HPdjx.js} +1 -1
- package/dist/client/static/js/{main-DBytgvkn.js → main-DtTRB9C-.js} +7 -7
- package/dist/client/static/js/{mode-BXzt9WHb.js → mode-CsTVdcAW.js} +1 -1
- package/dist/client/static/js/{mode-BmN9Ut9t.js → mode-UnJqj1nw.js} +1 -1
- package/dist/client/static/js/{mode-CmbuOty3.js → mode-bK1jTrae.js} +1 -1
- package/package.json +1 -1
- package/dist/client/static/js/de-DLRnnayL.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["static/js/editor.main-B7ZQNwu9.js","static/js/chunk-6hGRweTZ.js","static/js/preload-helper-DxkSl20Q.js","static/js/editor.api2-DJi3_-IJ.js","static/css/editor-DU9oqspw.css","static/js/workers-CfQPK2eg.js","static/js/monaco.contribution-CZRO3JpP.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{n as e,o as t,r as n,t as r}from"./chunk-6hGRweTZ.js";import{t as i}from"./preload-helper-DxkSl20Q.js";var a=r((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ee(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ne=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},re={map:ee,forEach:function(e,t,n){ee(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ee(e,function(){t++}),t},toArray:function(e){return ee(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=re,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:te}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,ne)}catch(e){ne(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),o=r(((e,t)=>{t.exports=a()})),s=r((e=>{var t=o();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=i.p;try{if(c.T=null,i.p=2,e)return e()}finally{c.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),c=r(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=r(((e,t)=>{(function(e,n){typeof define==`function`&&define.amd?define(n):typeof t==`object`&&t.exports?t.exports=n():e.log=n()})(e,function(){var e=function(){},t=`undefined`,n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=[`trace`,`debug`,`info`,`warn`,`error`],i={},a=null;function o(e,t){var n=e[t];if(typeof n.bind==`function`)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch{return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(r){return r===`debug`&&(r=`log`),typeof console===t?!1:r===`trace`&&n?s:console[r]===void 0?console.log===void 0?e:o(console,`log`):o(console,r)}function l(){for(var n=this.getLevel(),i=0;i<r.length;i++){var a=r[i];this[a]=i<n?e:this.methodFactory(a,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return`No console available for logging`}function u(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function d(e,t,n){return c(e)||u.apply(this,arguments)}function f(e,n){var o=this,s,c,u,f=`loglevel`;typeof e==`string`?f+=`:`+e:typeof e==`symbol`&&(f=void 0);function p(e){var n=(r[e]||`silent`).toUpperCase();if(!(typeof window===t||!f)){try{window.localStorage[f]=n;return}catch{}try{window.document.cookie=encodeURIComponent(f)+`=`+n+`;`}catch{}}}function m(){var e;if(!(typeof window===t||!f)){try{e=window.localStorage[f]}catch{}if(typeof e===t)try{var n=window.document.cookie,r=encodeURIComponent(f),i=n.indexOf(r+`=`);i!==-1&&(e=/^([^;]+)/.exec(n.slice(i+r.length+1))[1])}catch{}return o.levels[e]===void 0&&(e=void 0),e}}function h(){if(!(typeof window===t||!f)){try{window.localStorage.removeItem(f)}catch{}try{window.document.cookie=encodeURIComponent(f)+`=; expires=Thu, 01 Jan 1970 00:00:00 UTC`}catch{}}}function g(e){var t=e;if(typeof t==`string`&&o.levels[t.toUpperCase()]!==void 0&&(t=o.levels[t.toUpperCase()]),typeof t==`number`&&t>=0&&t<=o.levels.SILENT)return t;throw TypeError(`log.setLevel() called with invalid level: `+e)}o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=n||d,o.getLevel=function(){return u??c??s},o.setLevel=function(e,t){return u=g(e),t!==!1&&p(u),l.call(o)},o.setDefaultLevel=function(e){c=g(e),m()||o.setLevel(e,!1)},o.resetLevel=function(){u=null,h(),l.call(o)},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)},o.rebuild=function(){if(a!==o&&(s=g(a.getLevel())),l.call(o),a===o)for(var e in i)i[e].rebuild()},s=g(a?a.getLevel():`WARN`);var _=m();_!=null&&(u=g(_)),l.call(o)}a=new f,a.getLogger=function(e){if(typeof e!=`symbol`&&typeof e!=`string`||e===``)throw TypeError(`You must supply a name when creating a logger.`);var t=i[e];return t||=i[e]=new f(e,a.methodFactory),t};var p=typeof window===t?void 0:window.log;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=p),a},a.getLoggers=function(){return i},a.default=a,a})})),u;(function(e){e[e.CONTINUE=100]=`CONTINUE`,e[e.SWITCHING_PROTOCOLS=101]=`SWITCHING_PROTOCOLS`,e[e.PROCESSING=102]=`PROCESSING`,e[e.OK=200]=`OK`,e[e.CREATED=201]=`CREATED`,e[e.ACCEPTED=202]=`ACCEPTED`,e[e.NON_AUTHORITATIVE_INFORMATION=203]=`NON_AUTHORITATIVE_INFORMATION`,e[e.NO_CONTENT=204]=`NO_CONTENT`,e[e.RESET_CONTENT=205]=`RESET_CONTENT`,e[e.PARTIAL_CONTENT=206]=`PARTIAL_CONTENT`,e[e.MULTI_STATUS=207]=`MULTI_STATUS`,e[e.ALREADY_REPORTED=208]=`ALREADY_REPORTED`,e[e.IM_USED=226]=`IM_USED`,e[e.MULTIPLE_CHOICES=300]=`MULTIPLE_CHOICES`,e[e.MOVED_PERMANENTLY=301]=`MOVED_PERMANENTLY`,e[e.FOUND=302]=`FOUND`,e[e.SEE_OTHER=303]=`SEE_OTHER`,e[e.NOT_MODIFIED=304]=`NOT_MODIFIED`,e[e.USE_PROXY=305]=`USE_PROXY`,e[e.SWITCH_PROXY=306]=`SWITCH_PROXY`,e[e.TEMPORARY_REDIRECT=307]=`TEMPORARY_REDIRECT`,e[e.PERMANENT_REDIRECT=308]=`PERMANENT_REDIRECT`,e[e.BAD_REQUEST=400]=`BAD_REQUEST`,e[e.UNAUTHORIZED=401]=`UNAUTHORIZED`,e[e.PAYMENT_REQUIRED=402]=`PAYMENT_REQUIRED`,e[e.FORBIDDEN=403]=`FORBIDDEN`,e[e.NOT_FOUND=404]=`NOT_FOUND`,e[e.METHOD_NOT_ALLOWED=405]=`METHOD_NOT_ALLOWED`,e[e.NOT_ACCEPTABLE=406]=`NOT_ACCEPTABLE`,e[e.PROXY_AUTHENTICATION_REQUIRED=407]=`PROXY_AUTHENTICATION_REQUIRED`,e[e.REQUEST_TIMEOUT=408]=`REQUEST_TIMEOUT`,e[e.CONFLICT=409]=`CONFLICT`,e[e.GONE=410]=`GONE`,e[e.LENGTH_REQUIRED=411]=`LENGTH_REQUIRED`,e[e.PRECONDITION_FAILED=412]=`PRECONDITION_FAILED`,e[e.PAYLOAD_TOO_LARGE=413]=`PAYLOAD_TOO_LARGE`,e[e.URI_TOO_LONG=414]=`URI_TOO_LONG`,e[e.UNSUPPORTED_MEDIA_TYPE=415]=`UNSUPPORTED_MEDIA_TYPE`,e[e.RANGE_NOT_SATISFIABLE=416]=`RANGE_NOT_SATISFIABLE`,e[e.EXPECTATION_FAILED=417]=`EXPECTATION_FAILED`,e[e.I_AM_A_TEAPOT=418]=`I_AM_A_TEAPOT`,e[e.MISDIRECTED_REQUEST=421]=`MISDIRECTED_REQUEST`,e[e.UNPROCESSABLE_ENTITY=422]=`UNPROCESSABLE_ENTITY`,e[e.LOCKED=423]=`LOCKED`,e[e.FAILED_DEPENDENCY=424]=`FAILED_DEPENDENCY`,e[e.UPGRADE_REQUIRED=426]=`UPGRADE_REQUIRED`,e[e.PRECONDITION_REQUIRED=428]=`PRECONDITION_REQUIRED`,e[e.TOO_MANY_REQUESTS=429]=`TOO_MANY_REQUESTS`,e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]=`REQUEST_HEADER_FIELDS_TOO_LARGE`,e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]=`UNAVAILABLE_FOR_LEGAL_REASONS`,e[e.INTERNAL_SERVER_ERROR=500]=`INTERNAL_SERVER_ERROR`,e[e.NOT_IMPLEMENTED=501]=`NOT_IMPLEMENTED`,e[e.BAD_GATEWAY=502]=`BAD_GATEWAY`,e[e.SERVICE_UNAVAILABLE=503]=`SERVICE_UNAVAILABLE`,e[e.GATEWAY_TIMEOUT=504]=`GATEWAY_TIMEOUT`,e[e.HTTP_VERSION_NOT_SUPPORTED=505]=`HTTP_VERSION_NOT_SUPPORTED`,e[e.VARIANT_ALSO_NEGOTIATES=506]=`VARIANT_ALSO_NEGOTIATES`,e[e.INSUFFICIENT_STORAGE=507]=`INSUFFICIENT_STORAGE`,e[e.LOOP_DETECTED=508]=`LOOP_DETECTED`,e[e.NOT_EXTENDED=510]=`NOT_EXTENDED`,e[e.NETWORK_AUTHENTICATION_REQUIRED=511]=`NETWORK_AUTHENTICATION_REQUIRED`})(u||={}),u.INTERNAL_SERVER_ERROR,u.BAD_REQUEST,u.CONFLICT,u.NOT_FOUND,u.METHOD_NOT_ALLOWED,u.UNAUTHORIZED,u.FORBIDDEN,u.NOT_FOUND,u.CONFLICT,u.NOT_FOUND;var d={type:`https://zup.fail/user-has-no-access-to-account`,title:`Forbidden`,detail:`You are not authorized to access the account resource.`,status:u.FORBIDDEN};u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.BAD_REQUEST,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.BAD_REQUEST,u.NOT_FOUND,u.CONFLICT,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.NOT_FOUND,u.NOT_FOUND,u.BAD_REQUEST,u.INTERNAL_SERVER_ERROR,u.BAD_REQUEST,u.BAD_REQUEST,u.NOT_FOUND,u.NOT_FOUND,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.BAD_REQUEST,u.BAD_REQUEST,u.FORBIDDEN,u.NOT_FOUND,u.NOT_FOUND,u.BAD_REQUEST,u.BAD_REQUEST,u.INTERNAL_SERVER_ERROR,u.FORBIDDEN,u.BAD_REQUEST,u.NOT_FOUND,u.BAD_REQUEST,u.CONFLICT,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.FORBIDDEN,u.NOT_FOUND,u.BAD_REQUEST,u.NOT_FOUND,u.BAD_REQUEST,u.NOT_FOUND,u.BAD_REQUEST,u.BAD_REQUEST,u.NOT_FOUND,u.NOT_FOUND,u.BAD_REQUEST,u.FORBIDDEN,u.NOT_FOUND,u.NOT_FOUND,u.NOT_FOUND,u.FORBIDDEN,u.NOT_FOUND,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.NOT_FOUND,u.NOT_FOUND,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.NOT_FOUND,u.BAD_REQUEST,u.NOT_FOUND,u.BAD_REQUEST;var f={type:`https://zup.fail/user-has-no-access-to-project`,title:`Forbidden`,detail:`You are not a member of the project`,status:u.FORBIDDEN};u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.FORBIDDEN,u.NOT_FOUND,u.FORBIDDEN,u.INTERNAL_SERVER_ERROR,u.BAD_REQUEST,u.BAD_REQUEST;var p={type:`https://zup.fail/max-allowed-projects-limit-reached`,title:`Your account has reached the maximum number of projects allowed.`,status:u.BAD_REQUEST};u.INTERNAL_SERVER_ERROR,u.BAD_REQUEST,u.NOT_FOUND,u.BAD_REQUEST,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.NOT_FOUND,u.BAD_GATEWAY,u.BAD_GATEWAY,u.UNAUTHORIZED,u.FORBIDDEN,u.FORBIDDEN,u.INTERNAL_SERVER_ERROR,u.BAD_REQUEST,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN;var m={type:`https://zup.fail/gh-app-revoked-access`,title:`Current Source Control credentials are invalid. Re-authenticate to GitHub via Profile UI and try again.`,status:u.UNAUTHORIZED};u.FORBIDDEN,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.FORBIDDEN,u.INTERNAL_SERVER_ERROR,u.NOT_FOUND,u.NOT_FOUND,u.INTERNAL_SERVER_ERROR,u.FAILED_DEPENDENCY,u.FAILED_DEPENDENCY,u.FAILED_DEPENDENCY,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.NOT_FOUND,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.FORBIDDEN,u.NOT_FOUND,u.BAD_REQUEST,u.BAD_REQUEST,u.NOT_FOUND,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.CONFLICT,u.NOT_FOUND,u.INTERNAL_SERVER_ERROR,u.BAD_REQUEST,u.INTERNAL_SERVER_ERROR,u.FORBIDDEN,u.BAD_REQUEST,u.NOT_FOUND,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_GATEWAY,u.BAD_REQUEST,u.BAD_REQUEST,u.FORBIDDEN,u.FORBIDDEN,u.BAD_REQUEST,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.BAD_REQUEST,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.FORBIDDEN,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.BAD_REQUEST,u.FORBIDDEN;var h=typeof window<`u`?window:void 0,g=typeof globalThis<`u`?globalThis:h;typeof self>`u`&&(g.self=g),typeof File>`u`&&(g.File=function(){});var _=g?.navigator,v=g?.document,y=g?.location,b=g?.fetch,x=g!=null&&g.XMLHttpRequest&&`withCredentials`in new g.XMLHttpRequest?g.XMLHttpRequest:void 0,S=g?.AbortController,C=g?.CompressionStream,w=_?.userAgent,T=h??{},E=`1.383.0`,D={DEBUG:!1,LIB_VERSION:E,LIB_NAME:`web`,JS_SDK_VERSION:E};function O(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){O(a,r,i,o,s,`next`,e)}function s(e){O(a,r,i,o,s,`throw`,e)}o(void 0)}))}}function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(null,arguments)}function j(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var M,N=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),ee=[`$snapshot`,`$pageview`,`$pageleave`,`$set`,`survey dismissed`,`survey sent`,`survey shown`,`$identify`,`$groupidentify`,`$create_alias`,`$$client_ingestion_warning`,`$web_experiment_applied`,`$feature_enrollment_update`,`$feature_flag_called`],te=`NativeGzipValidationError`,ne=e=>e.length>=2&&e[0]===31&&e[1]===139,re=e=>!(!e||typeof e!=`object`)&&(`name`in e?String(e.name):``)===`NotReadableError`,ie=e=>{var t=Error(`Native gzip produced invalid output: `+e);throw t.name=te,t},ae=function(){var e=k((function*(e,t){18>e.size&&ie(`too-short`);var n=new Uint8Array(yield e.slice(0,10).arrayBuffer());ne(n)&&n[2]===8||ie(`invalid-header`);var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(M)return M;M=[];for(var e=0;256>e;e++){for(var t=e,n=0;8>n;n++)t=1&t?3988292384^t>>>1:t>>>1;M[e]=t>>>0}return M})(),n=4294967295,r=0;e.length>r;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0})(t)&&ie(`invalid-crc`);var i=t.length>>>0;r.getUint32(4,!0)!==i&&ie(`invalid-size`)}));return function(t,n){return e.apply(this,arguments)}}();function oe(){return oe=k((function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),i=new CompressionStream(`gzip`),a=i.writable.getWriter(),o=a.write(r).then((()=>a.close())).catch(function(){var e=k((function*(e){try{yield a.abort(e)}catch{}throw e}));return function(t){return e.apply(this,arguments)}}()),s=new Response(i.readable).blob(),[c]=yield Promise.all([s,o]);return yield ae(c,r),c}catch(e){if(n!=null&&n.rethrow)throw e;return t&&console.error(`Failed to gzip compress data`,e),null}})),oe.apply(this,arguments)}var se=`amazonbot,amazonproductbot,app.hypefactors.com,applebot,archive.org_bot,awariobot,backlinksextendedbot,baiduspider,bingbot,bingpreview,chrome-lighthouse,dataforseobot,deepscan,duckduckbot,facebookexternal,facebookcatalog,http://yandex.com/bots,hubspot,ia_archiver,leikibot,linkedinbot,meta-externalagent,mj12bot,msnbot,nessus,petalbot,pinterest,prerender,rogerbot,screaming frog,sebot-wa,sitebulb,slackbot,slurp,trendictionbot,turnitin,twitterbot,vercel-screenshot,vercelbot,yahoo! slurp,yandexbot,zoombot,bot.htm,bot.php,(bot;,bot/,crawler,ahrefsbot,ahrefssiteaudit,semrushbot,siteauditbot,splitsignalbot,gptbot,oai-searchbot,chatgpt-user,perplexitybot,better uptime bot,sentryuptimebot,uptimerobot,headlesschrome,cypress,google-hoteladsverifier,adsbot-google,apis-google,duplexweb-google,feedfetcher-google,google favicon,google web preview,google-read-aloud,googlebot,googleother,google-cloudvertexbot,googleweblight,mediapartners-google,storebot-google,google-inspectiontool,bytespider`.split(`,`),ce=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return se.concat(t).some((e=>{var t=e.toLowerCase();return n.indexOf(t)!==-1}))};function P(e,t){return e.indexOf(t)!==-1}var le=function(e){return e.trim()},ue=function(e){return e.replace(/^\$/,``)},de=Object.prototype,fe=de.hasOwnProperty,pe=de.toString,F=Array.isArray||function(e){return pe.call(e)===`[object Array]`},me=e=>typeof e==`function`,he=e=>e===Object(e)&&!F(e),ge=e=>{if(he(e)){for(var t in e)if(fe.call(e,t))return!1;return!0}return!1},I=e=>e===void 0,L=e=>pe.call(e)==`[object String]`,_e=e=>L(e)&&e.trim().length===0,ve=e=>e===null,R=e=>I(e)||ve(e),ye=e=>pe.call(e)==`[object Number]`&&e==e,be=e=>ye(e)&&e>0,xe=e=>pe.call(e)===`[object Boolean]`,Se=e=>e instanceof FormData,Ce=e=>P(ee,e);function we(e){return typeof e!=`object`||!e}function Te(e,t){return{}.toString.call(e)===`[object `+t+`]`}function Ee(e){return typeof Event<`u`&&function(e,t){try{return e instanceof t}catch{return!1}}(e,Event)}var De=[!0,`true`,1,`1`,`yes`],Oe=e=>P(De,e),ke=[!1,`false`,0,`0`,`no`];function Ae(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),ye(e)?e>n?(r.warn(` cannot be greater than max: `+n+`. Using max value instead.`),n):t>e?(r.warn(` cannot be less than min: `+t+`. Using min value instead.`),t):e:(r.warn(` must be a number. using max or fallback. max: `+n+`, fallback: `+i),Ae(i||n,t,n,r))}var je=class{constructor(e){this.$t={},this.zt=e.zt,this.Zt=Ae(e.bucketSize,0,100,e.Gt),this.Qt=Ae(e.refillRate,0,this.Zt,e.Gt),this.Jt=Ae(e.refillInterval,0,864e5,e.Gt)}Kt(e,t){var n=Math.floor((t-e.lastAccess)/this.Jt);n>0&&(e.tokens=Math.min(e.tokens+n*this.Qt,this.Zt),e.lastAccess+=n*this.Jt)}consumeRateLimit(e){var t,n=Date.now(),r=String(e),i=this.$t[r];return i?this.Kt(i,n):this.$t[r]=i={tokens:this.Zt,lastAccess:n},i.tokens===0||(i.tokens--,i.tokens===0&&((t=this.zt)==null||t.call(this,e)),i.tokens===0)}stop(){this.$t={}}},Me,Ne,Pe,Fe=`Mobile`,Ie=`iOS`,Le=`Android`,Re=`Tablet`,ze=Le+` `+Re,Be=`iPad`,Ve=`Apple`,He=Ve+` Watch`,Ue=`Safari`,We=`BlackBerry`,Ge=`Samsung`,Ke=Ge+`Browser`,qe=Ge+` Internet`,Je=`Chrome`,Ye=Je+` OS`,Xe=Je+` `+Ie,Ze=`Internet Explorer`,Qe=Ze+` `+Fe,$e=`Opera`,et=$e+` Mini`,tt=`Edge`,nt=`Microsoft `+tt,rt=`Firefox`,it=rt+` `+Ie,at=`Nintendo`,ot=`PlayStation`,st=`Xbox`,ct=Le+` `+Fe,lt=Fe+` `+Ue,ut=`Windows`,dt=ut+` Phone`,ft=`Nokia`,pt=`Ouya`,mt=`Generic`,ht=mt+` `+Fe.toLowerCase(),gt=mt+` `+Re.toLowerCase(),_t=`Konqueror`,vt=`Oculus Browser`,yt=`Vivaldi`,bt=`Yandex`,xt=`Whale`,St=`DuckDuckGo`,Ct=`Pale Moon`,wt=`Waterfox`,Tt=`Brave`,Et=`(\\d+(\\.\\d+)?)`,Dt=RegExp(`Version/`+Et),Ot=new RegExp(st,`i`),kt=RegExp(ot+` \\w+`,`i`),At=RegExp(at+` \\w+`,`i`),jt=RegExp(We+`|PlayBook|BB10`,`i`),Mt={"NT3.51":`NT 3.11`,"NT4.0":`NT 4.0`,"5.0":`2000`,5.1:`XP`,5.2:`XP`,"6.0":`Vista`,6.1:`7`,6.2:`8`,6.3:`8.1`,6.4:`10`,"10.0":`10`},Nt=function(e,t,n){return t||=``,function(e){return e!=null&&e.brave?Tt:null}(n)||(P(e,` OPR/`)&&P(e,`Mini`)?et:P(e,` OPR/`)?$e:jt.test(e)?We:P(e,`IE`+Fe)||P(e,`WPDesktop`)?Qe:P(e,`OculusBrowser`)?vt:P(e,Ke)?qe:P(e,tt)||P(e,`Edg/`)?nt:P(e,yt+`/`)?yt:P(e,`YaBrowser/`)?bt:P(e,xt+`/`)?xt:P(e,St+`/`)||P(e,`Ddg/`)?St:P(e,`FBIOS`)?`Facebook `+Fe:P(e,`UCWEB`)||P(e,`UCBrowser`)?`UC Browser`:P(e,`CriOS`)?Xe:P(e,`CrMo`)||P(e,Je)?Je:P(e,Le)&&P(e,Ue)?ct:P(e,`FxiOS`)?it:P(e.toLowerCase(),_t.toLowerCase())?_t:P(e,Tt+`/`)?Tt:((e,t)=>t&&P(t,Ve)||function(e){return P(e,Ue)&&!P(e,Je)&&!P(e,Le)}(e))(e,t)?P(e,Fe)?lt:Ue:P(e,`PaleMoon/`)?Ct:P(e,wt+`/`)?wt:P(e,rt)?rt:P(e,`MSIE`)||P(e,`Trident/`)?Ze:P(e,`Gecko`)?rt:``)},Pt={[Qe]:[RegExp(`rv:`+Et)],[nt]:[RegExp(tt+`?\\/`+Et)],[Je]:[RegExp(`(`+Je+`|CrMo)\\/`+Et)],[Xe]:[RegExp(`CriOS\\/`+Et)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/`+Et)],[Ue]:[Dt],[lt]:[Dt],[$e]:[RegExp(`(Opera|OPR)\\/`+Et)],[rt]:[RegExp(rt+`\\/`+Et)],[it]:[RegExp(`FxiOS\\/`+Et)],[_t]:[RegExp(`Konqueror[:/]?`+Et,`i`)],[We]:[RegExp(We+` `+Et),Dt],[ct]:[RegExp(`android\\s`+Et,`i`)],[qe]:[RegExp(Ke+`\\/`+Et)],[vt]:[RegExp(`OculusBrowser\\/`+Et)],[yt]:[RegExp(yt+`\\/`+Et)],[bt]:[RegExp(`YaBrowser\\/`+Et)],[xt]:[RegExp(xt+`\\/`+Et)],[Tt]:[RegExp(Tt+`\\/`+Et)],[St]:[RegExp(`(DuckDuckGo|Ddg)\\/`+Et)],[Ct]:[RegExp(`PaleMoon\\/`+Et)],[wt]:[RegExp(wt+`\\/`+Et)],[Ze]:[RegExp(`(rv:|MSIE )`+Et)],Mozilla:[RegExp(`rv:`+Et)]},Ft=function(e,t,n){var r=Pt[Nt(e,t,n)];if(I(r))return null;for(var i=0;r.length>i;i++){var a=e.match(r[i]);if(a)return parseFloat(a[a.length-2])}return null},It=[[RegExp(st+`; `+st+` (.*?)[);]`,`i`),e=>[st,e&&e[1]||``]],[new RegExp(at,`i`),[at,``]],[new RegExp(ot,`i`),[ot,``]],[jt,[We,``]],[new RegExp(ut,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[dt,``];if(new RegExp(Fe).test(t)&&!/IEMobile\b/.test(t))return[ut+` `+Fe,``];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=Mt[n[1]]||``;return/arm/i.test(t)&&(r=`RT`),[ut,r]}return[ut,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Ie,[e[3],e[4],e[5]||`0`].join(`.`)]:[Ie,``]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t=``;return e&&e.length>=3&&(t=I(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(`+Le+` (\\d+)\\.(\\d+)\\.?(\\d+)?|`+Le+`)`,`i`),e=>e&&e[2]?[Le,[e[2],e[3],e[4]||`0`].join(`.`)]:[Le,``]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=[`Mac OS X`,``];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||`0`].join(`.`)),t}],[/Mac/i,[`Mac OS X`,``]],[/CrOS/,[Ye,``]],[/Linux|debian/i,[`Linux`,``]]],Lt=function(e){return At.test(e)?at:kt.test(e)?ot:Ot.test(e)?st:new RegExp(pt,`i`).test(e)?pt:RegExp(`(`+dt+`|WPDesktop)`,`i`).test(e)?dt:/iPad/.test(e)?Be:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?He:jt.test(e)?We:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(ft,`i`).test(e)?ft:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?`Kindle Fire`:/(Android|ZTE)/i.test(e)?new RegExp(Fe).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Le:ze:RegExp(`(pda|`+Fe+`)`,`i`).test(e)?ht:new RegExp(Re,`i`).test(e)&&!RegExp(Re+` pc`,`i`).test(e)?gt:``},Rt=e=>e instanceof Error,zt={trace:{text:`TRACE`,number:1},debug:{text:`DEBUG`,number:5},info:{text:`INFO`,number:9},warn:{text:`WARN`,number:13},error:{text:`ERROR`,number:17},fatal:{text:`FATAL`,number:21}},Bt=zt.info;function Vt(e){if(xe(e))return{boolValue:e};if(typeof e==`number`)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e==`string`)return{stringValue:e};if(F(e))return{arrayValue:{values:e.map((e=>Vt(e)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Ht(e){var t=[];for(var n in e){var r=e[n];ve(r)||I(r)||t.push({key:n,value:Vt(r)})}return t}function Ut(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Pe&&n.length===Ne||(Ne=n.length,Pe=n.reduce(((n,r)=>{Me||={};var i=Me[r];if(i)n[i[0]]=i[1];else for(var a=e(r),o=a.length-1;o>=0;o--){var s=a[o]?.filename,c=t[r];if(s&&c){n[s]=c,Me[r]=[s,c];break}}return n}),{})),Pe}}var Wt=class{constructor(e,t,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){t===void 0&&(t={});var n=t&&t.mechanism||{handled:!0,type:`generic`},r=this.buildCoercingContext(n,t,0).apply(e),i=this.buildParsingContext(t),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:`error`}}modifyFrames(e){var t=this;return k((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&F(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){return{type:`Error`,value:`Unknown error`,stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){var n,r;return e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=``&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),A({},e,{cause:n,stack:r})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return k((function*(){var n=e;for(var r of t.modifiers)n=yield r(n);return n}))()}convertToExceptionList(e,t){var n,r,i={type:e.type,value:e.value,mechanism:{type:t.type??`generic`,handled:(n=t.handled)==null||n,synthetic:(r=e.synthetic)!=null&&r}};e.stack&&(i.stacktrace={type:`raw`,frames:e.stack});var a=[i];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,A({},t,{handled:!0}))),a}buildParsingContext(e){return{chunkIdMap:Ut(this.stackParser),skipFirstLines:e.skipFirstLines??1}}buildCoercingContext(e,t,n){n===void 0&&(n=0);var r=(n,r)=>{if(4>=r){var i=this.buildCoercingContext(e,t,r);return this.applyCoercers(n,i)}};return A({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,n),next:e=>r(e,n+1)})}},Gt=`?`;function Kt(e,t,n,r,i){var a={platform:e,filename:t,function:n===`<anonymous>`?Gt:n,in_app:!0};return I(r)||(a.lineno=r),I(i)||(a.colno=i),a}var qt=(e,t)=>{var n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?Gt:e.split(`@`)[0],n?`safari-extension:`+t:`safari-web-extension:`+t]:[e,t]},Jt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Yt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Xt=/\((\S*)(?::(\d+))(?::(\d+))\)/,Zt=(e,t)=>{var n=Jt.exec(e);if(n){var[,r,i,a]=n;return Kt(t,r,Gt,+i,+a)}var o=Yt.exec(e);if(o){if(o[2]&&o[2].indexOf(`eval`)===0){var s=Xt.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}var[c,l]=qt(o[1]||Gt,o[2]);return Kt(t,l,c,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Qt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,$t=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,en=(e,t)=>{var n=Qt.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){var r=$t.exec(n[3]);r&&(n[1]=n[1]||`eval`,n[3]=r[1],n[4]=r[2],n[5]=``)}var i=n[3],a=n[1]||Gt;return[a,i]=qt(a,i),Kt(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},tn=/\(error: (.*)\)/,nn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=L(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?`DOMError`:`DOMException`}getValue(e){var t=e.name||(this.isDOMError(e)?`DOMError`:`DOMException`);return e.message?t+`: `+e.message:t}isDOMException(e){return Te(e,`DOMException`)}isDOMError(e){return Te(e,`DOMError`)}},rn=class{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var n=e.message;return String(n.error&&typeof n.error.message==`string`?n.error.message:n)}getStack(e){return e.stacktrace||e.stack||void 0}},an=class{constructor(){}match(e){return Te(e,`ErrorEvent`)&&e.error!=null}coerce(e,t){return t.apply(e.error)||{type:`ErrorEvent`,value:e.message,stack:t.syntheticException?.stack,synthetic:!0}}},on=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,sn=class{match(e){return typeof e==`string`}coerce(e,t){var[n,r]=this.getInfos(e);return{type:n??`Error`,value:r??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){var t=`Error`,n=e,r=e.match(on);return r&&(t=r[1],n=r[2]),[t,n]}},cn=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function ln(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return`[object has no keys]`;for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(`, `);if(t>=i.length)return r===n.length?i:i.length>t?i.slice(0,t)+`...`:i}return``}var un=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){var n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){return Ee(e)?e.constructor.name:`Error`}getValue(e){if(`name`in e&&typeof e.name==`string`){var t=`'`+e.name+`' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message: '`+e.message+`'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;var n=this.getObjectClassName(e);return(n&&n!==`Object`?`'`+n+`'`:`Object`)+` captured as exception with keys: `+ln(e)}isSeverityLevel(e){return L(e)&&!_e(e)&&cn.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var n=e[t];if(Rt(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},dn=class{match(e){return Ee(e)}coerce(e,t){var n=e.constructor.name;return{type:n,value:n+` captured as exception with keys: `+ln(e),stack:t.syntheticException?.stack,synthetic:!0}}},fn=class{match(e){return we(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: `+String(e),stack:t.syntheticException?.stack,synthetic:!0}}},pn=class{match(e){return Te(e,`PromiseRejectionEvent`)||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ee(e))return!1;try{var t=e.detail;return typeof t==`object`&&!!t&&`reason`in t}catch{return!1}}coerce(e,t){var n=this.getUnhandledRejectionReason(e);return we(n)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: `+String(n),stack:t.syntheticException?.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){try{if(`reason`in e)return e.reason;if(`detail`in e&&e.detail!=null&&typeof e.detail==`object`&&`reason`in e.detail)return e.detail.reason}catch{}return e}},mn=`$message`,hn=`$timestamp`,gn=new Set([mn,hn]),_n={enabled:!0,max_bytes:32768};function vn(e){return e?{enabled:e.enabled??_n.enabled,max_bytes:bn(e.max_bytes,_n.max_bytes)}:A({},_n)}var yn=class{constructor(e){this.Yt=[],this.Xt=0,this.qt=vn(e)}setConfig(e){this.qt=vn(e),this.er()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,((e,n)=>{if(typeof n==`bigint`)return n.toString();if(typeof n!=`function`&&typeof n!=`symbol`){if(n instanceof Date)return n.toISOString();if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n==`object`){if(t.has(n))return`[Circular]`;t.add(n)}return n}}))}catch{return}}(e);if(t)try{var n=JSON.parse(t);if(!he(n))return;var r=n,i=r[mn],a=r[hn];return!L(i)||i.trim().length===0||!L(a)&&!ye(a)?void 0:{step:r,json:t}}catch{return}}(e);if(t){var n=function(e){if(typeof TextEncoder<`u`)return new TextEncoder().encode(e).length;for(var t=encodeURIComponent(e),n=0,r=0;t.length>r;r++)t[r]===`%`?(n+=1,r+=2):n+=1;return n}(t.json);n>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:n}),this.Xt+=n,this.er())}}getAttachable(){return this.Yt.map((e=>e.step))}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}};function bn(e,t){if(!ye(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var xn=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,r={k(t){if(h&&(D.DEBUG||T.POSTHOG_DEBUG||n)&&!I(h.console)&&h.console){for(var r=(`__rrweb_original__`in h.console[t])?h.console[t].__rrweb_original__:h.console[t],i=arguments.length,a=Array(i>1?i-1:0),o=1;i>o;o++)a[o-1]=arguments[o];r(e,...a)}},debug(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.k(`debug`,...t)},info(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.k(`log`,...t)},warn(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.k(`warn`,...t)},error(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.k(`error`,...t)},critical(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];console.error(e,...n)},uninitializedWarning(e){r.error(`You must initialize PostHog before calling `+e)},createLogger:(t,n)=>xn(e+` `+t,n)};return r},z=xn(`[PostHog.js]`),B=z.createLogger,Sn=B(`[ExternalScriptsLoader]`),Cn=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return Sn.warn(t+` was requested but loading of external scripts is disabled.`),n(`Loading of external scripts is disabled`);var r=v?.querySelectorAll(`script`);if(r){for(var i,a=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener(`load`,(t=>{e.__posthog_loading_callback_fired=!0,n(void 0,t)})),e.onerror=e=>n(e),{v:void 0})}},o=0;r.length>o;o++)if(i=a())return i.v}var s=()=>{if(!v)return n(`document not found`);var r=v.createElement(`script`);if(r.type=`text/javascript`,r.crossOrigin=`anonymous`,r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>n(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n(`prepare_external_dependency_script returned null`);if(e.config.external_scripts_inject_target===`head`)v.head.appendChild(r);else{var i,a=v.querySelectorAll(`body > script`);a.length>0?(i=a[0].parentNode)==null||i.insertBefore(r,a[0]):v.body.appendChild(r)}};v!=null&&v.body?s():v?.addEventListener(`DOMContentLoaded`,s)};T.__PosthogExtensions__=T.__PosthogExtensions__||{},T.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!==`remote-config`){var r;if(e.config.__preview_external_dependency_versioned_paths)r=e.requestRouter.endpointFor(`assets`,`/static/`+e.version+`/`+t+`.js`);else{var i=`/static/`+t+`.js?v=`+e.version;if(t===`toolbar`){var a=3e5;i=i+`&t=`+Math.floor(Date.now()/a)*a}r=e.requestRouter.endpointFor(`assets`,i)}Cn(e,r,n)}else Cn(e,e.requestRouter.endpointFor(`assets`,`/array/`+e.config.token+`/config.js`),n)},T.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{Cn(e,e.requestRouter.endpointFor(`api`,t),n)};var wn=`$people_distinct_id`,Tn=`$device_id`,En=`__alias`,Dn=`__timers`,On=`$autocapture_disabled_server_side`,kn=`$heatmaps_enabled_server_side`,An=`$exception_capture_enabled_server_side`,jn=`$error_tracking_suppression_rules`,Mn=`$error_tracking_capture_extension_exceptions`,Nn=`$web_vitals_enabled_server_side`,Pn=`$dead_clicks_enabled_server_side`,Fn=`$product_tours_enabled_server_side`,In=`$web_vitals_allowed_metrics`,Ln=`$session_recording_remote_config`,Rn=`$replay_override_sampling`,zn=`$replay_override_linked_flag`,Bn=`$replay_override_url_trigger`,Vn=`$replay_override_event_trigger`,Hn=`$sesid`,Un=`$session_is_sampled`,Wn=`$enabled_feature_flags`,Gn=`$active_feature_flags`,Kn=`$early_access_features`,qn=`$feature_flag_details`,Jn=`$feature_flag_payloads`,Yn=`$feature_flag_request_id`,Xn=`$override_feature_flags`,Zn=`$override_feature_flag_payloads`,Qn=`$stored_person_properties`,$n=`$stored_group_properties`,er=`$surveys`,tr=`$surveys_loaded_at`,nr=`$surveys_activated`,rr=`ph_product_tours`,ir=`$flag_call_reported`,ar=`$flag_call_reported_session_id`,or=`$feature_flag_errors`,sr=`$feature_flag_evaluated_at`,cr=`$user_state`,lr=`$client_session_props`,ur=`$capture_rate_limit`,dr=`$initial_campaign_params`,fr=`$initial_referrer_info`,pr=`$initial_person_info`,mr=`$epp`,hr=`__POSTHOG_TOOLBAR__`,gr=`$posthog_cookieless`,_r=`$sdk_debug_extensions_init_method`,vr=`$sdk_debug_extensions_init_time_ms`,yr=`$sdk_debug_recording_script_not_loaded`,br=`PostHog loadExternalDependency extension not found.`,xr=`on_reject`,Sr=`always`,Cr=`anonymous`,wr=`identified`,Tr=`identified_only`,Er=`visibilitychange`,Dr=`beforeunload`,Or=`$pageview`,kr=`$pageleave`,Ar=`$identify`,jr=`$groupidentify`;function Mr(e,t){F(e)&&e.forEach(t)}function V(e,t){if(!R(e))if(F(e))e.forEach(t);else if(Se(e))e.forEach(((e,n)=>t(e,n)));else for(var n in e)fe.call(e,n)&&t(e[n],n)}var H=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var i of n)for(var a in i)i[a]!==void 0&&(e[a]=i[a]);return e};function Nr(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Pr=function(e){try{return e()}catch{return}},Fr=function(e){return function(){try{for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(e){z.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),z.critical(e)}}},Ir=function(e){var t={};return V(e,(function(e,n){(L(e)&&e.length>0||ye(e))&&(t[n]=e)})),t},Lr=[`herokuapp.com`,`vercel.app`,`netlify.app`];function Rr(e){var t=e?.hostname;if(!L(t))return!1;var n=t.split(`.`).slice(-2).join(`.`);for(var r of Lr)if(n===r)return!1;return!0}function zr(e,t,n,r){var{capture:i=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:a})}function Br(e){return e.name===`ph_toolbar_internal`}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return ye(e)&&isFinite(e)&&Math.floor(e)===e});var Vr=class e{constructor(e){if(this.bytes=e,e.length!==16)throw TypeError(`not 128-bit length`)}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>t||0>n||0>r||0>i||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);var a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}toString(){for(var e=``,t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}clone(){return new e(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},Hr=class{constructor(){this.S=0,this.C=0,this.I=new Gr}generate(){var e=this.generateOrAbort();if(I(e)){this.S=0;var t=this.generateOrAbort();if(I(t))throw Error(`Could not generate UUID after timestamp reset`);return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return Vr.fromFieldsV7(this.S,Math.trunc(this.C/2**30),this.C&2**30-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}},Ur,Wr=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<`u`&&UUIDV7_DENY_WEAK_RNG)throw Error(`no cryptographically strong RNG available`);for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};h&&!I(h.crypto)&&crypto.getRandomValues&&(Wr=e=>crypto.getRandomValues(e));var Gr=class{constructor(){this.M=new Uint32Array(8),this.R=1/0}nextUint32(){return this.M.length>this.R||(Wr(this.M),this.R=0),this.M[this.R++]}},Kr=()=>qr().toString(),qr=()=>(Ur||=new Hr).generate(),Jr=``,Yr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Xr={O:()=>!!v,D(e){z.error(`cookieStore error: `+e)},A(e){if(v){try{for(var t=e+`=`,n=v.cookie.split(`;`).filter((e=>e.length)),r=0;n.length>r;r++){for(var i=n[r];i.charAt(0)==` `;)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},F(e){var t;try{t=JSON.parse(Xr.A(e))||{}}catch{}return t},N(e,t,n,r,i){if(!v)return!1;try{var a=``,o=``,s=function(e,t){if(t){var n=function(e,t){if(t===void 0&&(t=v),Jr)return Jr;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;for(var n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+Kr();!Jr&&r--;){var a=n.slice(r).join(`.`),o=i+`=1;domain=.`+a+`;path=/`;t.cookie=o+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=o+`;max-age=0`,Jr=a)}return Jr}(e);if(!n){var r=(e=>{var t=e.match(Yr);return t?t[0]:``})(e);r!==n&&z.info(`Warning: cookie subdomain discovery mismatch`,r,n),n=r}return n?`; domain=.`+n:``}return``}(v.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+864e5*n),a=`; expires=`+c.toUTCString()}i&&(o=`; secure`);var l=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+s+o;return l.length>3686.4&&z.warn(`cookieStore warning: large cookie, len=`+l.length),v.cookie=l,!0}catch{return!1}},q(e,t){if(v!=null&&v.cookie)try{Xr.N(e,``,-1,t)}catch{return}}},Zr=null,U={O(){if(!ve(Zr))return Zr;var e=!0;if(I(h))e=!1;else try{var t=`__mplssupport__`;U.N(t,`xyz`),U.A(t)!==`"xyz"`&&(e=!1),U.q(t)}catch{e=!1}return e||z.error(`localStorage unsupported; falling back to cookie store`),Zr=e,e},D(e){z.error(`localStorage error: `+e)},A(e){try{return h?.localStorage.getItem(e)}catch(e){U.D(e)}return null},F(e){try{return JSON.parse(U.A(e))||{}}catch{}return null},N(e,t){try{return h?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){U.D(e)}return!1},q(e){try{h?.localStorage.removeItem(e)}catch(e){U.D(e)}}},Qr=[Tn,`distinct_id`,Hn,Un,mr,pr,cr],$r={},ei={O:()=>!0,D(e){z.error(`memoryStorage error: `+e)},A:e=>$r[e]||null,F:e=>$r[e]||null,N:(e,t)=>($r[e]=t,!0),q(e){delete $r[e]}},ti=null,ni={O(){if(!ve(ti))return ti;if(ti=!0,I(h))ti=!1;else try{var e=`__support__`;ni.N(e,`xyz`),ni.A(e)!==`"xyz"`&&(ti=!1),ni.q(e)}catch{ti=!1}return ti},D(e){z.error(`sessionStorage error: `,e)},A(e){try{return h?.sessionStorage.getItem(e)}catch(e){ni.D(e)}return null},F(e){try{return JSON.parse(ni.A(e))||null}catch{}return null},N(e,t){try{return h?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){ni.D(e)}return!1},q(e){try{h?.sessionStorage.removeItem(e)}catch(e){ni.D(e)}}},ri=class{constructor(e){this._instance=e}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===Sr||this.isRejected()||this.consent===-1&&this.qt.cookieless_mode===xr}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qt.opt_out_capturing_by_default}optInOut(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:`__ph_opt_in_out_`+e)}get ir(){var e=this.nr.A(this.sr);return Oe(e)?1:P(ke,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t=e===`localStorage`?U:Xr;if(!this.ar||this.ar!==t){this.ar=t;var n=e===`localStorage`?Xr:U;n.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(Oe(n.A(this.sr))),n.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[_?.doNotTrack,_?.msDoNotTrack,T.doNotTrack].some((e=>Oe(e)))}},ii=1,ai=3,oi=11;function si(e){return e instanceof Element&&(e.id===hr||!(e.closest==null||!e.closest(`.toolbar-global-fade-container`)))}function ci(e){return!!e&&e.nodeType===ii}function li(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ui(e){return!!e&&e.nodeType===ai}function di(e){return!!e&&e.nodeType===oi&&ci(e.host)}function fi(e){return e?le(e).split(/\s+/):[]}function pi(e){var t=h?.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function mi(e){var t=``;switch(typeof e.className){case`string`:t=e.className;break;case`object`:t=(e.className&&`baseVal`in e.className?e.className.baseVal:null)||e.getAttribute(`class`)||``;break;default:t=``}return fi(t)}function hi(e){return R(e)?null:le(e).split(/(\s+)/).filter((e=>Li(e))).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function gi(e){var t=``;return ki(e)&&!Ai(e)&&e.childNodes&&e.childNodes.length&&V(e.childNodes,(function(e){ui(e)&&e.textContent&&(t+=hi(e.textContent)??``)})),le(t)}function _i(e){return I(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var vi=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function yi(e,t){if(I(t))return!0;var n,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var i of e)if(n=r(i))return n.v;return!1}function bi(e){var t=e.parentNode;return!(!t||!ci(t))&&t}var xi=[`next`,`previous`,`prev`,`>`,`<`],Si=[...xi,`+`,`-`,`−`,`–`],Ci=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,wi=[`.ph-no-rageclick`,`.ph-no-capture`],Ti=[``,`text`,`search`,`email`,`password`,`url`,`tel`,`number`];function Ei(e,t){if(!h||Di(e))return!1;var n,r,i,a;if(xe(t)?(n=!!t&&wi,r=void 0,i=!1):(n=t?.css_selector_ignorelist??wi,r=t?.content_ignorelist,i=(a=t?.ignore_text_selection)!=null&&a),!1===n||i&&function(e){return!(!e||!ci(e))&&(!!li(e,`textarea`)||(li(e,`input`)?P(Ti,(e.getAttribute(`type`)||``).toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=e.getAttribute==null?void 0:e.getAttribute(`contenteditable`);return t===`true`||t===``}(e)))}(e))return!1;var{targetElementList:o}=Oi(e,!1);return!function(e,t){if(!1===e||I(e))return!1;var n;if(!0===e)n=xi;else{if(!F(e))return!1;if(e.length>10)return z.error(`[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:r}=e;return n.some((e=>Ci(t,e)||Ci(r,e)))}))}(r,o.map((e=>({safeText:gi(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``}))))&&!yi(o,n)}var Di=e=>!e||li(e,`html`)||!ci(e),Oi=(e,t)=>{if(!h||Di(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],i=e;i.parentNode&&!li(i,`body`);)if(di(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var a=bi(i);if(!a)break;if(t||vi.indexOf(a.tagName.toLowerCase())>-1)n=!0;else{var o=h.getComputedStyle(a);o&&o.getPropertyValue(`cursor`)===`pointer`&&(n=!0)}r.push(a),i=a}return{parentIsUsefulElement:n,targetElementList:r}};function ki(e){for(var t=e;t.parentNode&&!li(t,`body`);t=t.parentNode){var n=mi(t);if(P(n,`ph-sensitive`)||P(n,`ph-no-capture`))return!1}if(P(mi(e),`ph-include`))return!0;var r=e.type||``;if(L(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}var i=e.name||e.id||``;return!L(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``))}function Ai(e){return!!(li(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||li(e,`select`)||li(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var ji=`(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})`,Mi=RegExp(`^(?:`+ji+`)$`),Ni=new RegExp(ji),Pi=`\\d{3}-?\\d{2}-?\\d{4}`,Fi=RegExp(`^(`+Pi+`)$`),Ii=RegExp(`(`+Pi+`)`);function Li(e,t){return t===void 0&&(t=!0),!(R(e)||L(e)&&(e=le(e),(t?Mi:Ni).test((e||``).replace(/[- ]/g,``))||(t?Fi:Ii).test(e)))}function Ri(e){var t=gi(e);return Li(t=(t+` `+zi(e)).trim())?t:``}function zi(e){var t=``;return e&&e.childNodes&&e.childNodes.length&&V(e.childNodes,(function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{var n=gi(e);t=(t+` `+n).trim(),e.childNodes&&e.childNodes.length&&(t=(t+` `+zi(e)).trim())}catch(e){z.error(`[AutoCapture]`,e)}})),t}function Bi(e){return e.replace(/"|\\"/g,`\\"`)}function Vi(e){var t=e.attr__class;return t?F(t)?t:fi(t):void 0}var Hi=B(`[Dead Clicks]`),Ui=()=>!0,Wi=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Pn)),r=e.instance.config.capture_dead_clicks;return xe(r)?r:!!he(r)||n},Gi=class{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){`captureDeadClicks`in e&&(this.instance.persistence&&this.instance.persistence.register({[Pn]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr((()=>{this.hr()})):this.stop()}lr(e){var t,n;(t=T.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=T.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,`dead-clicks-autocapture`,(t=>{t?Hi.error(`failed to load script`,t):e()}))}hr(){var e;if(v){if(!this.ur&&(e=T.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=he(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=T.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(v),Hi.info(`starting...`)}}else Hi.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,Hi.info(`stopping...`))}},Ki=B(`[SegmentIntegration]`),qi=`posthog-js`;function Ji(e,t){var{organization:n,projectId:r,prefix:i,severityAllowList:a=[`error`],sendExceptionsToPostHog:o=!0}=t===void 0?{}:t;return t=>{if(a!==`*`&&!a.includes(t.level)||!e.__loaded)return t;t.tags||={};var s=e.requestRouter.endpointFor(`ui`,`/project/`+e.config.token+`/person/`+e.get_distinct_id());t.tags[`PostHog Person URL`]=s,e.sessionRecordingStarted()&&(t.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));var c,l=t.exception?.values||[],u=l.map((e=>A({},e,{stacktrace:e.stacktrace?A({},e.stacktrace,{type:`raw`,frames:(e.stacktrace.frames||[]).map((e=>A({},e,{platform:`web:javascript`})))}):void 0}))),d={$exception_message:l[0]?.value||t.message,$exception_type:l[0]?.type,$exception_level:t.level,$exception_list:u,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:l[0]?.value||t.message,$sentry_exception_type:l[0]?.type,$sentry_tags:t.tags};return n&&r&&(d.$sentry_url=(i||`https://sentry.io/organizations/`)+n+`/issues/?project=`+r+`&query=`+t.event_id),o&&((c=e.exceptions)==null||c.sendExceptionEvent(d)),t}}var Yi=class{constructor(e,t,n,r,i,a){this.name=qi,this.setupOnce=function(o){o(Ji(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},Xi=class{constructor(e){this.cr=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength)&&(z.info(`[PageViewManager] Session rotated, clearing pageview state`,{sessionId:e,changeReason:n}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){this.pr=this._instance.sessionManager?.onSessionId(this.cr)}destroy(){var e;(e=this.pr)==null||e.call(this),this.pr=void 0}doPageView(e,t){var n=this.gr(e,t);return this.dr={pathname:h?.location.pathname??``,pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){return this.gr(e,this.dr?.pageViewId)}doEvent(){return{$pageview_id:this.dr?.pageViewId}}gr(e,t){var n=this.dr;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:s,maxContentHeight:c,lastContentY:l,maxContentY:u}=i;if(!(I(a)||I(o)||I(s)||I(c)||I(l)||I(u))){a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);var d=a>1?Ae(o/a,0,1,z):1,f=a>1?Ae(s/a,0,1,z):1,p=c>1?Ae(l/c,0,1,z):1,m=c>1?Ae(u/c,0,1,z):1;r=H(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:m})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}},Zi=[`flags`,`surveys`],Qi={[wn]:{exposure:`hidden`},[En]:{exposure:`hidden`},__cmpns:{exposure:`hidden`},[Dn]:{exposure:`hidden`},[On]:{exposure:`event`},[kn]:{exposure:`hidden`},[An]:{exposure:`event`},[jn]:{exposure:`hidden`},[Mn]:{exposure:`event`},[Nn]:{exposure:`event`},[Pn]:{exposure:`event`},[Fn]:{exposure:`hidden`},[In]:{exposure:`event`},[Ln]:{exposure:`hidden`},$session_recording_enabled_server_side:{exposure:`hidden`},[Hn]:{exposure:`hidden`},[Un]:{exposure:`event`},$session_past_minimum_duration:{exposure:`event`},$session_recording_url_trigger_activated_session:{exposure:`event`},$session_recording_event_trigger_activated_session:{exposure:`event`},$debug_first_full_snapshot_timestamp:{exposure:`event`},[Wn]:{exposure:`derived`,storageGroup:`flags`,shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!he(e))return{};for(var t={},n=Object.keys(e),r=0;n.length>r;r++)t[`$feature/`+n[r]]=e[n[r]];return t}},[Gn]:{exposure:`event`,storageGroup:`flags`},[Kn]:{exposure:`hidden`},[qn]:{exposure:`hidden`,storageGroup:`flags`},[Jn]:{exposure:`event`,storageGroup:`flags`},[Yn]:{exposure:`event`,storageGroup:`flags`},[Xn]:{exposure:`event`},[Zn]:{exposure:`hidden`},[Qn]:{exposure:`hidden`},[$n]:{exposure:`hidden`},[er]:{exposure:`hidden`,storageGroup:`surveys`},[tr]:{exposure:`hidden`,storageGroup:`surveys`},[nr]:{exposure:`event`},[rr]:{exposure:`hidden`},$product_tours_activated:{exposure:`hidden`},$conversations_widget_session_id:{exposure:`event`},$conversations_ticket_id:{exposure:`event`},$conversations_widget_state:{exposure:`event`},$conversations_user_traits:{exposure:`event`},[ir]:{exposure:`hidden`},[ar]:{exposure:`hidden`},[or]:{exposure:`hidden`},[sr]:{exposure:`hidden`,storageGroup:`flags`},[cr]:{exposure:`hidden`},[lr]:{exposure:`hidden`},[ur]:{exposure:`hidden`},[dr]:{exposure:`hidden`},[fr]:{exposure:`hidden`},[pr]:{exposure:`hidden`},[mr]:{exposure:`hidden`},[Rn]:{exposure:`event`},[zn]:{exposure:`event`},[Bn]:{exposure:`event`},[Vn]:{exposure:`event`},[_r]:{exposure:`event`},[vr]:{exposure:`event`},[yr]:{exposure:`event`},$sdk_debug_replay_event_trigger_status:{exposure:`event`},$sdk_debug_replay_linked_flag_trigger_status:{exposure:`event`},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:`event`},$sdk_debug_replay_remote_trigger_matching_config:{exposure:`event`},$sdk_debug_replay_trigger_groups_count:{exposure:`event`},$sdk_debug_replay_url_trigger_status:{exposure:`event`},$session_recording_start_reason:{exposure:`event`}},$i=[[`$posthog_sr_group_event_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_url_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_sampling_`,{exposure:`hidden`}]],ea=e=>{var t=Qi[e];if(t)return t;for(var[n,r]of $i)if(e.indexOf(n)===0)return r},ta=e=>{var t=v?.createElement(`a`);return I(t)?null:(t.href=e,t)},na=function(e,t){for(var n,r=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),i=0;r.length>i;i++){var a=r[i].split(`=`);if(a[0]===t){n=a;break}}if(!F(n)||2>n.length)return``;var o=n[1];try{o=decodeURIComponent(o)}catch{z.error(`Skipping decoding for malformed query param: `+o)}return o.replace(/\+/g,` `)},ra=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split(`#`),i=r[1],a=(r[0]||``).split(`?`),o=a[1],s=a[0],c=(o||``).split(`&`),l=[],u=0;c.length>u;u++){var d=c[u].split(`=`);F(d)&&(t.includes(d[0])?l.push(d[0]+`=`+n):l.push(c[u]))}var f=s;return o!=null&&(f+=`?`+l.join(`&`)),i!=null&&(f+=`#`+i),f},ia=function(e,t){var n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},aa=`https?://(.*)`,oa=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],sa=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,...oa],ca=`<masked>`,la=[`li_fat_id`];function ua(e,t,n){if(!v)return{};var r,i=t?[...oa,...n||[]]:[],a=da(ra(v.URL,i,ca),e);return H((r={},V(la,(function(e){var t=Xr.A(e);r[e]=t||null})),r),a)}function da(e,t){var n=sa.concat(t||[]),r={};return V(n,(function(t){r[t]=na(e,t)||null})),r}function fa(e){var t=function(e){return e?e.search(aa+`google.([^/?]*)`)===0?`google`:e.search(aa+`bing.com`)===0?`bing`:e.search(aa+`yahoo.com`)===0?`yahoo`:e.search(aa+`duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!ve(t)){r.$search_engine=t;var i=v?na(v.referrer,n):``;i.length&&(r.ph_keyword=i)}return r}function pa(){return navigator.language||navigator.userLanguage}var ma=`$direct`;function ha(){return v?.referrer||ma}function ga(e,t){var n=e?[...oa,...t||[]]:[],r=y?.href.substring(0,1e3);return{r:ha().substring(0,1e3),u:r?ra(r,n,ca):void 0}}function _a(e){var{r:t,u:n}=e,r={$referrer:t,$referring_domain:t==null?void 0:t==ma?ma:ta(t)?.host};if(n){r.$current_url=n;var i=ta(n);r.$host=i?.host,r.$pathname=i?.pathname,H(r,da(n))}return t&&H(r,fa(t)),r}function va(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ya(){try{return new Date().getTimezoneOffset()}catch{return}}var ba={flags:sr,surveys:tr},xa=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],Sa=`main`,Ca=class{constructor(e,t,n){if(n===void 0&&(n=!0),this.mr={},this.yr=!1,this.br=!1,this.qt=e,this._r=n,this.props={},this.wr=!1,this.Sr=(e=>{var t=``;return e.token&&(t=e.token.replace(/\+/g,`PL`).replace(/\//g,`SL`).replace(/=/g,`EQ`)),e.persistence_name?`ph_`+e.persistence_name:`ph_`+t+`_posthog`})(e),this.nr=this.kr(e),this.br=this.Cr(e),this.load(),e.debug&&z.info(`Persistence loaded`,e.persistence,A({},this.props)),this.update_config(e,e,t),this.save(),h){var r=()=>this.flush();zr(h,`beforeunload`,r,{capture:!1}),zr(h,`pagehide`,r,{capture:!1})}}Ir(){var e=this.qt?.persistence_save_debounce_ms;return ye(e)&&e>0?e:0}isDisabled(){return!!this.Tr}kr(e){xa.indexOf(e.persistence.toLowerCase())===-1&&(z.critical(`Unknown persistence type `+e.persistence+`; falling back to localStorage+cookie`),e.persistence=`localStorage+cookie`);var t,n=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=!1);var n=[...Qr,...e];return A({},U,{F(e){try{var n={};try{n=Xr.F(e)||{}}catch{}var r,i=JSON.parse(U.A(e)||`{}`);if(t){var a={};for(var o in n){var s=n[o];ve(s)||s===``||(a[o]=s)}r=H(i,a)}else r=H(n,i);return U.N(e,r),r}catch{}return null},N(e,t,r,i,a,o){var s=U.N(e,t,void 0,void 0,o);try{var c={};n.forEach((e=>{t[e]&&(c[e]=t[e])})),Object.keys(c).length&&Xr.N(e,c,r,i,a,o)}catch(e){U.D(e)}return s},q(e,t){try{h?.localStorage.removeItem(e),Xr.q(e,t)}catch(e){U.D(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,i=e.persistence.toLowerCase();return i===`localstorage`&&U.O()?(t=U,r=!0):i===`localstorage+cookie`&&n.O()?(t=n,r=!0):i===`sessionstorage`&&ni.O()?t=ni:i===`memory`?t=ei:i===`cookie`?t=Xr:n.O()?(t=n,r=!0):t=Xr,this.yr=r,t}Er(e){return this.Sr+`__`+e}Cr(e){return this.yr&&!!e.split_storage}Mr(e){var t=e??this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var n=this.props[sr];return!n||typeof n!=`number`||Date.now()-n>t}properties(){var e={};return V(this.props,((t,n)=>{var r=ea(n);if(r?.exposure===`derived`){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,n===Wn?()=>this.Mr():()=>!1))return;r.transformToEventProperties&&H(e,r.transformToEventProperties(t))}else r&&r.exposure!==`event`||(e[n]=t)})),e}load(){if(!this.Tr){var e=this.nr.F(this.Sr);e&&(this.props=H({},e)),this.br&&this.Rr()}}Rr(){for(var e of Zi){var t=U.F(this.Er(e));if(t&&!ge(t)){var n=this.Pr(e);n.persisted=!0,this.Or(e)||(n.fingerprint=this.Lr(t,e)),this.Fr(e,t)||H(this.props,t)}}}Or(e){return Object.keys(this.props).some((t=>ea(t)?.storageGroup===e))}Fr(e,t){var n=ba[e];if(!n)return!1;var r=t[n],i=this.props[n];return ye(r)&&ye(i)&&i>r}refreshKey(e){if(!this.Tr){var t=this.br?ea(e)?.storageGroup:void 0,n=t?U.F(this.Er(t)):this.nr.F(this.Sr);if(n&&e in n)this.Ar(e,n[e]);else{if(t){var r=this.nr.F(this.Sr);if(r&&e in r)return void this.Ar(e,r[e])}this.Nr(e)}}}save(){if(!this.Tr){var e=this.Ir();e>0?I(this.Dr)&&(this.Dr=setTimeout((()=>{this.Dr=void 0,this.$r()}),e)):this.$r()}}flush(){I(this.Dr)||(clearTimeout(this.Dr),this.Dr=void 0,this.$r())}$r(){this.Tr||(this.br?this.qr():this.jr(this.nr,this.Sr,this.props,Sa))}qr(){var{main:e,groups:t}=this.Hr();for(var n of(this.jr(this.nr,this.Sr,e,Sa),Zi)){var r,i=t[n];(!ge(i)||(r=this.mr[n])!=null&&r.persisted)&&this.jr(U,this.Er(n),i,n)}}Hr(){var e={},t={};for(var n of Zi)t[n]={};return V(this.props,((n,r)=>{var i=ea(r)?.storageGroup;i?t[i][r]=n:e[r]=n})),{main:e,groups:t}}Lr(e,t){var n=JSON.stringify(e);return t===Sa?n+`|`+this.Ur+`|`+this.Br+`|`+this.zr:n}jr(e,t,n,r){var i=this.Pr(r);if(r===Sa||i.dirty||I(i.fingerprint)){var a;try{if((a=this.Lr(n,r))===i.fingerprint)return void(i.dirty=!1)}catch{a=void 0}e.N(t,n,this.Ur,this.Br,this.zr,this.qt.debug)?(i.dirty=!1,r!==Sa&&(i.persisted=!0),I(a)||(i.fingerprint=a)):this.qt.debug&&z.warn(`failed to persist storage entry "`+t+`"; will retry on next save`)}}remove(e){var{keepGroupEntries:t=!1}=e===void 0?{}:e;if(I(this.Dr)||(clearTimeout(this.Dr),this.Dr=void 0),this.nr.q(this.Sr,!1),this.nr.q(this.Sr,!0),!t&&this._r)for(var n of Zi)U.q(this.Er(n));t?delete this.mr[Sa]:this.mr={}}clear(){this.remove(),this.props={}}register_once(e,t,n){if(he(e)){I(t)&&(t=`None`),this.Ur=I(n)?this.Vr:n;var r=!1;if(V(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.Ar(n,e),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(he(e)){this.Ur=I(t)?this.Vr:t;var n=!1;if(V(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.Ar(r,t),n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Nr(e),this.save())}update_campaign_params(){if(!this.wr){var e=ua(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);ge(Ir(e))||this.register(e),this.wr=!0}}update_search_keyword(){var e;this.register((e=v?.referrer)?fa(e):{})}update_referrer_info(){this.register_once({$referrer:ha(),$referring_domain:v!=null&&v.referrer&&ta(v.referrer)?.host||ma},void 0)}set_initial_person_info(){this.props[dr]||this.props[fr]||this.register_once({[pr]:ga(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};V([fr,dr],(t=>{var n=this.props[t];n&&V(n,(function(t,n){e[`$initial_`+ue(n)]=t}))}));var t,n,r=this.props[pr];return r&&H(e,(t=_a(r),n={},V(t,(function(e,t){n[`$initial_`+ue(t)]=e})),n)),e}safe_merge(e){return V(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){this.Vr=this.Ur=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var r=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var n=[...e].sort(),r=[...t].sort();return n.every(((e,t)=>e===r[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),i=r?this.kr(e):this.nr,a=this.Cr(e);if(r||a!==this.br){var o=this.props;this.clear(),this.nr=i,this.br=a,this.props=o,this.save()}}set_disabled(e){this.Tr=e,this.Tr?this.remove():this.save()}set_cross_subdomain(e){e!==this.Br&&(this.Br=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.zr&&(this.zr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var n=this.props[Dn]||{};n[e]=t,this.Ar(Dn,n),this.save()}remove_event_timer(e){var t=this.props[Dn]||{},n=t[e];return I(n)||(delete t[e],this.Ar(Dn,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.Ar(e,t),this.save()}Ar(e,t){this.props[e]=t,this.Wr(e)}Nr(e){delete this.props[e],this.Wr(e)}Wr(e){var t=ea(e)?.storageGroup;t&&(this.Pr(t).dirty=!0)}Pr(e){return this.mr[e]||(this.mr[e]={})}},wa={Activation:`events`,Cancellation:`cancelEvents`},Ta={Popover:`popover`,API:`api`,Widget:`widget`,ExternalSurvey:`external_survey`},Ea={SHOWN:`survey shown`,DISMISSED:`survey dismissed`,SENT:`survey sent`,ABANDONED:`survey abandoned`},Da={SURVEY_ID:`$survey_id`,SURVEY_NAME:`$survey_name`,SURVEY_RESPONSE:`$survey_response`,SURVEY_ITERATION:`$survey_iteration`,SURVEY_ITERATION_START_DATE:`$survey_iteration_start_date`,SURVEY_PARTIALLY_COMPLETED:`$survey_partially_completed`,SURVEY_SUBMISSION_ID:`$survey_submission_id`,SURVEY_QUESTIONS:`$survey_questions`,SURVEY_COMPLETED:`$survey_completed`,PRODUCT_TOUR_ID:`$product_tour_id`,SURVEY_LAST_SEEN_DATE:`$survey_last_seen_date`,SURVEY_LANGUAGE:`$survey_language`},Oa={Popover:`popover`,Inline:`inline`},ka={SHOWN:`product tour shown`,DISMISSED:`product tour dismissed`,COMPLETED:`product tour completed`,STEP_SHOWN:`product tour step shown`,STEP_COMPLETED:`product tour step completed`,BUTTON_CLICKED:`product tour button clicked`,STEP_SELECTOR_FAILED:`product tour step selector failed`,BANNER_CONTAINER_SELECTOR_FAILED:`product tour banner container selector failed`,BANNER_ACTION_CLICKED:`product tour banner action clicked`},Aa={TOUR_ID:`$product_tour_id`,TOUR_NAME:`$product_tour_name`,TOUR_ITERATION:`$product_tour_iteration`,TOUR_RENDER_REASON:`$product_tour_render_reason`,TOUR_STEP_ID:`$product_tour_step_id`,TOUR_STEP_ORDER:`$product_tour_step_order`,TOUR_STEP_TYPE:`$product_tour_step_type`,TOUR_DISMISS_REASON:`$product_tour_dismiss_reason`,TOUR_BUTTON_TEXT:`$product_tour_button_text`,TOUR_BUTTON_ACTION:`$product_tour_button_action`,TOUR_BUTTON_LINK:`$product_tour_button_link`,TOUR_BUTTON_TOUR_ID:`$product_tour_button_tour_id`,TOUR_STEPS_COUNT:`$product_tour_steps_count`,TOUR_STEP_SELECTOR:`$product_tour_step_selector`,TOUR_STEP_SELECTOR_FOUND:`$product_tour_step_selector_found`,TOUR_STEP_ELEMENT_TAG:`$product_tour_step_element_tag`,TOUR_STEP_ELEMENT_ID:`$product_tour_step_element_id`,TOUR_STEP_ELEMENT_CLASSES:`$product_tour_step_element_classes`,TOUR_STEP_ELEMENT_TEXT:`$product_tour_step_element_text`,TOUR_ERROR:`$product_tour_error`,TOUR_MATCHES_COUNT:`$product_tour_matches_count`,TOUR_FAILURE_PHASE:`$product_tour_failure_phase`,TOUR_WAITED_FOR_ELEMENT:`$product_tour_waited_for_element`,TOUR_WAIT_DURATION_MS:`$product_tour_wait_duration_ms`,TOUR_BANNER_SELECTOR:`$product_tour_banner_selector`,TOUR_LINKED_SURVEY_ID:`$product_tour_linked_survey_id`,USE_MANUAL_SELECTOR:`$use_manual_selector`,INFERENCE_DATA_PRESENT:`$inference_data_present`,TOUR_LAST_SEEN_DATE:`$product_tour_last_seen_date`,TOUR_TYPE:`$product_tour_type`},ja=B(`[RateLimiter]`),Ma=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{ja.info((e||`events`)+` is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4}))}catch(e){ja.warn(`could not rate limit - continuing. Error: "`+e?.message+`"`,{text:t});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){return this.instance.config.rate_limiting?.events_per_second||10}get captureEventsBurstLimit(){return Math.max(this.instance.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=new Date().getTime(),a=this.instance.persistence?.get_property(ur)??{tokens:n,last:i};a.tokens+=(i-a.last)/1e3*r,a.last=i,a.tokens>n&&(a.tokens=n);var o=1>a.tokens;return o||e||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited. Config is set to `+r+` events per second and `+n+` events burst limit.`},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(t=this.instance.persistence)==null||t.set_property(ur,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}},Na=B(`[RemoteConfig]`),Pa=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=T._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Zr(e){var t,n;(t=T.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=T.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`remote-config`,(()=>e(this.remoteConfig))):e()}Gr(e){this._instance._send_request({method:`GET`,url:this._instance.requestRouter.endpointFor(`assets`,`/array/`+this._instance.config.token+`/config`),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return Na.info(`Using preloaded remote config`,this.remoteConfig),this.Qr(this.remoteConfig),void this.Jr();if(this._instance.Kr())return void Na.warn(`Remote config is disabled. Falling back to local config.`);this.Zr((e=>{if(!e)return Na.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.Gr((e=>{this.Qr(e),this.Jr()}));this.Qr(e),this.Jr()}))}catch(e){Na.error(`Error loading remote config`,e)}}stop(){this.Yr&&=(clearInterval(this.Yr),void 0)}refresh(){!this._instance.Kr()&&v&&v.visibilityState!==`hidden`&&this._instance.reloadFeatureFlags()}Jr(){if(!this.Yr){var e=this._instance.config.remote_config_refresh_interval_ms??3e5;e!==0&&(this.Yr=setInterval((()=>{this.refresh()}),e))}}Qr(e){var t;e||Na.error(`Failed to fetch remote config from PostHog.`),this._instance.Qr(e??{}),!1!==e?.hasFeatureFlags&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}},Fa={GZipJS:`gzip-js`,Base64:`base64`},Ia=Uint8Array,La=Uint16Array,Ra=Uint32Array,za=new Ia([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ba=new Ia([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Va=new Ia([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ha=function(e,t){for(var n=new La(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var i=new Ra(n[30]);for(r=1;30>r;++r)for(var a=n[r];n[r+1]>a;++a)i[a]=a-n[r]<<5|r;return[n,i]},Ua=Ha(za,2),Wa=Ua[1];Ua[0][28]=258,Wa[258]=28;for(var Ga=Ha(Ba,0)[1],Ka=new La(32768),W=0;32768>W;++W){var qa=(43690&W)>>>1|(21845&W)<<1;Ka[W]=((65280&(qa=(61680&(qa=(52428&qa)>>>2|(13107&qa)<<2))>>>4|(3855&qa)<<4))>>>8|(255&qa)<<8)>>>1}var Ja=function(e,t,n){for(var r=e.length,i=0,a=new La(t);r>i;++i)++a[e[i]-1];var o,s=new La(t);for(i=0;t>i;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new La(1<<t);var c=15-t;for(i=0;r>i;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;f>=d;++d)o[Ka[d]>>>c]=l}else for(o=new La(r),i=0;r>i;++i)o[i]=Ka[s[e[i]-1]++]>>>15-e[i];return o},Ya=new Ia(288);for(W=0;144>W;++W)Ya[W]=8;for(W=144;256>W;++W)Ya[W]=9;for(W=256;280>W;++W)Ya[W]=7;for(W=280;288>W;++W)Ya[W]=8;var Xa=new Ia(32);for(W=0;32>W;++W)Xa[W]=5;var Za=Ja(Ya,9,0),Qa=Ja(Xa,5,0),$a=function(e){return(e/8>>0)+(7&e&&1)},eo=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof La?La:e instanceof Ra?Ra:Ia)(n-t);return r.set(e.subarray(t,n)),r},to=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},no=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},ro=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new Ia(0),0];if(i==1){var o=new Ia(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[d].f>n[l].f?l++:d++],c=n[l!=u&&n[d].f>n[l].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;i>r;++r)a[r].s>f&&(f=a[r].s);var p=new La(f+1),m=io(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i>r;++r){var v=a[r].s;if(t>=p[v])break;h+=_-(1<<m-p[v]),p[v]=t}for(h>>>=g;h>0;){var y=a[r].s;t>p[y]?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return[new Ia(p),m]},io=function(e,t,n){return e.s==-1?Math.max(io(e.l,t,n+1),io(e.r,t,n+1)):t[e.s]=n},ao=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new La(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;t>=s;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},oo=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},so=function(e,t,n){var r=n.length,i=$a(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;r>a;++a)e[i+a+4]=n[a];return 8*(i+4+r)},co=function(e,t,n,r,i,a,o,s,c,l,u){to(t,u++,n),++i[256];for(var d=ro(i,15),f=d[0],p=d[1],m=ro(a,15),h=m[0],g=m[1],_=ao(f),v=_[0],y=_[1],b=ao(h),x=b[0],S=b[1],C=new La(19),w=0;v.length>w;++w)C[31&v[w]]++;for(w=0;x.length>w;++w)C[31&x[w]]++;for(var T=ro(C,7),E=T[0],D=T[1],O=19;O>4&&!E[Va[O-1]];--O);var k,A,j,M,N=l+5<<3,ee=oo(i,Ya)+oo(a,Xa)+o,te=oo(i,f)+oo(a,h)+o+14+3*O+oo(C,E)+(2*C[16]+3*C[17]+7*C[18]);if(ee>=N&&te>=N)return so(t,u,e.subarray(c,c+l));if(to(t,u,1+(ee>te)),u+=2,ee>te){k=Ja(f,p,0),A=f,j=Ja(h,g,0),M=h;var ne=Ja(E,D,0);for(to(t,u,y-257),to(t,u+5,S-1),to(t,u+10,O-4),u+=14,w=0;O>w;++w)to(t,u+3*w,E[Va[w]]);u+=3*O;for(var re=[v,x],ie=0;2>ie;++ie){var ae=re[ie];for(w=0;ae.length>w;++w)to(t,u,ne[oe=31&ae[w]]),u+=E[oe],oe>15&&(to(t,u,ae[w]>>>5&127),u+=ae[w]>>>12)}}else k=Za,A=Ya,j=Qa,M=Xa;for(w=0;s>w;++w)if(r[w]>255){var oe;no(t,u,k[257+(oe=r[w]>>>18&31)]),u+=A[oe+257],oe>7&&(to(t,u,r[w]>>>23&31),u+=za[oe]);var se=31&r[w];no(t,u,j[se]),u+=M[se],se>3&&(no(t,u,r[w]>>>5&8191),u+=Ba[se])}else no(t,u,k[r[w]]),u+=A[r[w]];return no(t,u,k[256]),u+A[256]},lo=new Ra([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),uo=function(){for(var e=new Ra(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),fo=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function po(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p(t){for(var n=e,r=0;t.length>r;++r)n=uo[255&n^t[r]]^n>>>8;e=n},d(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a,o,s,c,l=(s=10+((i=t).filename&&i.filename.length+1||0),c=8,function(e,t,n,r,i,a){var o=e.length,s=new Ia(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=so(c,l,e.subarray(u,d)):(c[u]=!0,l=so(c,l,e.subarray(u,o)))}else{for(var f=lo[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new La(32768),_=new La(h+1),v=Math.ceil(n/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&h},x=new Ra(25e3),S=new La(288),C=new La(32),w=0,T=0,E=(u=0,0),D=0,O=0;o>u;++u){var k=b(u),A=32767&u,j=_[k];if(g[A]=j,_[k]=A,u>=D){var M=o-u;if((w>7e3||E>24576)&&M>423){l=co(e,c,0,x,S,C,T,E,O,u-O,l),E=w=T=0,O=u;for(var N=0;286>N;++N)S[N]=0;for(N=0;30>N;++N)C[N]=0}var ee=2,te=0,ne=m,re=A-j&32767;if(M>2&&k==b(u-re))for(var ie=Math.min(p,M)-1,ae=Math.min(32767,u),oe=Math.min(258,M);ae>=re&&--ne&&A!=j;){if(e[u+ee]==e[u+ee-re]){for(var se=0;oe>se&&e[u+se]==e[u+se-re];++se);if(se>ee){if(ee=se,te=re,se>ie)break;var ce=Math.min(re,se-2),P=0;for(N=0;ce>N;++N){var le=u-re+N+32768&32767,ue=le-g[le]+32768&32767;ue>P&&(P=ue,j=le)}}}re+=(A=j)-(j=g[A])+32768&32767}if(te){x[E++]=268435456|Wa[ee]<<18|Ga[te];var de=31&Wa[ee],fe=31&Ga[te];T+=za[de]+Ba[fe],++S[257+de],++C[fe],D=u+ee,++w}else x[E++]=e[u],++S[e[u]]}}l=co(e,c,!0,x,S,C,T,E,O,u-O,l)}return eo(s,0,r+$a(l)+i)}(a=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+o.mem,s,c)),u=l.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&fo(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;n.length>=r;++r)e[r+10]=n.charCodeAt(r)}}(l,t),fo(l,u-8,n.d()),fo(l,u-4,r),l}var mo=!!x||!!b,ho=`text/plain`,go=!1,_o=(e,t)=>{var[n,r]=e.split(`#`),[i,a]=n.split(`?`);if(!a)return e;var o=a.split(`&`).filter((e=>e.split(`=`)[0]!==t)).join(`&`);return i+(o?`?`+o:``)+(r?`#`+r:``)},vo=function(e,t,n){n===void 0&&(n=!0);var[r,i]=e.split(`?`),a=A({},t),o=i?.split(`&`).map((e=>{var t,[r,i]=e.split(`=`),o=n&&(t=a[r])!=null?t:i;return delete a[r],r+`=`+o}))??[],s=function(e,t){var n,r;t===void 0&&(t=`&`);var i=[];return V(e,(function(e,t){I(e)||I(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)})),i.join(t)}(a);return s&&o.push(s),r+`?`+o.join(`&`)},yo=(e,t)=>JSON.stringify(e,((e,t)=>typeof t==`bigint`?t.toString():t),t),bo=e=>{if(e.tr)return e.tr;var{data:t,compression:n}=e;if(t){if(n===Fa.GZipJS){var r=po(function(e,t){var n=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new Ia(e.length+(e.length>>>1)),i=0,a=function(e){r[i++]=e},o=0;n>o;++o){if(i+5>r.length){var s=new Ia(i+8+(n-o<<1));s.set(r),r=s}var c=e.charCodeAt(o);128>c?a(c):2048>c?(a(192|c>>>6),a(128|63&c)):c>55295&&57344>c?(a(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|63&c)):(a(224|c>>>12),a(128|c>>>6&63),a(128|63&c))}return eo(r,0,i)}(yo(t)),{mtime:0});return{contentType:ho,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Fa.Base64){var i=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:yo(e)))(function(e){return e&&btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16)))))}(yo(t)));return{contentType:`application/x-www-form-urlencoded`,body:i,estimatedSize:new Blob([i]).size}}var a=yo(t);return{contentType:`application/json`,body:a,estimatedSize:new Blob([a]).size}}},xo=e=>{var t,n,r,i=bo(e);return!i||(n=e.compression,r=na(e.url,`compression`),n!==N.GZipJS&&r!==N.GZipJS&&r!==`gzip`)||((t=i.body)instanceof ArrayBuffer?ne(new Uint8Array(t)):ArrayBuffer.isView(t)&&ne(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:i}:(go=!0,{url:_o(e.url,`compression`),encodedBody:bo(A({},e,{compression:void 0,tr:void 0}))})},So=function(){var e=k((function*(e){var t=yield function(e,t,n){return oe.apply(this,arguments)}(yo(e.data),D.DEBUG,{rethrow:!0});if(!t)return e;var n=yield t.arrayBuffer();return A({},e,{tr:{contentType:ho,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Co=(e,t)=>vo(e,{_:new Date().getTime().toString(),ver:D.JS_SDK_VERSION,compression:t}),wo=[];b&&wo.push({transport:`fetch`,method(e){var{url:t,encodedBody:n}=xo(e),{contentType:r,body:i,estimatedSize:a}=n??{},o=new Headers;V(e.headers,(function(e,t){o.append(t,e)})),r&&o.append(`Content-Type`,r);var s=null;if(S){var c=new S;s={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}b(t,A({method:e?.method||`GET`,headers:o,keepalive:e.method===`POST`&&52428.8>(a||0),body:i,signal:s?.signal},e.fetchOptions)).then((t=>t.text().then((n=>{var r={statusCode:t.status,text:n};if(t.status===200)try{r.json=JSON.parse(n)}catch(e){z.error(e)}e.callback==null||e.callback(r)})))).catch((t=>{z.error(t),e.callback==null||e.callback({statusCode:0,error:t})})).finally((()=>s?clearTimeout(s.timeout):null))}}),x&&wo.push({transport:`XHR`,method(e){var t=new x,{url:n,encodedBody:r}=xo(e);t.open(e.method||`GET`,n,!0);var{contentType:i,body:a}=r??{};V(e.headers,(function(e,n){t.setRequestHeader(n,e)})),i&&t.setRequestHeader(`Content-Type`,i),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}e.callback==null||e.callback(n)}},t.send(a)}}),_!=null&&_.sendBeacon&&wo.push({transport:`sendBeacon`,method(e){try{var{url:t,encodedBody:n}=xo(e),r=vo(t,{beacon:`1`}),{contentType:i,body:a}=n??{};if(!a)return;var o=a instanceof Blob?a:new Blob([a],{type:i});_.sendBeacon(r,o)}catch{}}});var To=3e3,Eo=class{constructor(e,t){this.Xr=!0,this.ei=[],this.ti=Ae(t?.flush_interval_ms||To,250,5e3,z.createLogger(`flush interval`),To),this.ri=e}enqueue(e){this.ei.push(e),this.ii||this.ni()}unload(){this.si();var e=this.ei.length>0?this.oi():{},t=Object.values(e);[...t.filter((e=>e.url.indexOf(`/e`)===0)),...t.filter((e=>e.url.indexOf(`/e`)!==0))].map((e=>{this.ri(A({},e,{transport:`sendBeacon`}))}))}enable(){this.Xr=!1,this.ni()}ni(){var e=this;this.Xr||(this.ii=setTimeout((()=>{if(this.si(),this.ei.length>0){var t=this.oi(),n=function(){var n=t[r],i=new Date().getTime();n.data&&F(n.data)&&V(n.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.ri(n)};for(var r in t)n()}}),this.ti))}si(){clearTimeout(this.ii),this.ii=void 0}oi(){var e={};return V(this.ei,(t=>{var n,r=t,i=(r?r.batchKey:null)||r.url;I(e[i])&&(e[i]=A({},r,{data:[]})),(n=e[i].data)==null||n.push(r.data)})),this.ei=[],e}},Do=[`retriesPerformedSoFar`],Oo=class{constructor(e){this.ai=!1,this.ui=3e3,this.ei=[],this._instance=e,this.ei=[],this.li=!0,!I(h)&&`onLine`in h.navigator&&(this.li=h.navigator.onLine,this.hi=()=>{this.li=!0,this.ci()},this.di=()=>{this.li=!1},zr(h,`online`,this.hi),zr(h,`offline`,this.di))}get length(){return this.ei.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=j(e,Do);be(t)&&(n.url=vo(n.url,{retry_count:t})),this._instance._send_request(A({},n,{callback:e=>{e.statusCode===200||e.statusCode>=400&&500>e.statusCode||(t??0)>=10?n.callback==null||n.callback(e):this.vi(A({retriesPerformedSoFar:t},n))}}))}vi(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=Math.random()-.5;return Math.ceil(r+i*(r-n))}(t),r=Date.now()+n;this.ei.push({retryAt:r,requestOptions:e});var i=`Enqueued failed request for retry in `+n;navigator.onLine||(i+=` (Browser is offline)`),z.warn(i),this.ai||(this.ai=!0,this.fi())}fi(){if(this.pi&&clearTimeout(this.pi),this.ei.length===0)return this.ai=!1,void(this.pi=void 0);this.pi=setTimeout((()=>{this.li&&this.ei.length>0&&this.ci(),this.fi()}),this.ui)}ci(){var e=Date.now(),t=[],n=this.ei.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.ei=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.pi&&=(clearTimeout(this.pi),void 0),this.ai=!1,I(h)||(this.hi&&=(h.removeEventListener(`online`,this.hi),void 0),this.di&&=(h.removeEventListener(`offline`,this.di),void 0)),this.ei))try{this._instance._send_request(A({},e,{transport:`sendBeacon`}))}catch(e){z.error(e)}this.ei=[]}},ko=class{constructor(e){this.gi=()=>{this.mi||={};var e=this.scrollElement(),t=this.scrollY(),n=e?Math.max(0,e.scrollHeight-e.clientHeight):0,r=t+(e?.clientHeight||0),i=e?.scrollHeight||0;this.mi.lastScrollY=Math.ceil(t),this.mi.maxScrollY=Math.max(t,this.mi.maxScrollY??0),this.mi.maxScrollHeight=Math.max(n,this.mi.maxScrollHeight??0),this.mi.lastContentY=r,this.mi.maxContentY=Math.max(r,this.mi.maxContentY??0),this.mi.maxContentHeight=Math.max(i,this.mi.maxContentHeight??0)},this._instance=e}get yi(){return this._instance.config.scroll_root_selector}getContext(){return this.mi}resetContext(){var e=this.mi;return setTimeout(this.gi,0),e}startMeasuringScrollPosition(){zr(h,`scroll`,this.gi,{capture:!0}),zr(h,`scrollend`,this.gi,{capture:!0}),zr(h,`resize`,this.gi)}scrollElement(){if(!this.yi)return h?.document.documentElement;for(var e of F(this.yi)?this.yi:[this.yi]){var t=h?.document.querySelector(e);if(t)return t}}scrollY(){if(this.yi){var e=this.scrollElement();return e&&e.scrollTop||0}return h&&(h.scrollY||h.pageYOffset||h.document.documentElement.scrollTop)||0}scrollX(){if(this.yi){var e=this.scrollElement();return e&&e.scrollLeft||0}return h&&(h.scrollX||h.pageXOffset||h.document.documentElement.scrollLeft)||0}},Ao=e=>ga(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties),jo=class{constructor(e,t,n,r){this.bi=e=>{var t=this.wi();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.xi(this._instance)};this.Si.register({[lr]:n})}},this._instance=e,this.ki=t,this.Si=n,this.xi=r||Ao,this.ki.onSessionId(this.bi)}wi(){return this.Si.props[lr]}getSetOnceProps(){var e=this.wi()?.props;return e?`r`in e?_a(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var e={};return V(Ir(this.getSetOnceProps()),((t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_`+ue(n)]=t})),e}},Mo=class{constructor(){this.Ci={}}on(e,t){return this.Ci[e]||(this.Ci[e]=[]),this.Ci[e].push(t),()=>{this.Ci[e]=this.Ci[e].filter((e=>e!==t))}}emit(e,t){for(var n of this.Ci[e]||[])n(t);for(var r of this.Ci[`*`]||[])r(e,t)}},No=B(`[SessionId]`),Po=class{on(e,t){return this.Ii.on(e,t)}constructor(e,t,n){var r;if(this.Ti=null,this.Ei=[],this.Mi=void 0,this.Ii=new Mo,this.Ri=(e,t)=>!(!be(e)||!be(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===Sr)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.qt=e.config,this.Si=e.persistence,this.Pi=void 0,this.Oi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Li=t||Kr,this.Fi=n||Kr;var i=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*Ae(this.qt.session_idle_timeout_seconds||1800,60,36e3,No.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ai(),this.Ni=`ph_`+i+`_window_id`,this.Di=`ph_`+i+`_primary_window_exists`,this.$i()){var a=ni.F(this.Ni),o=ni.F(this.Di);a&&!o?this.Pi=a:ni.q(this.Ni),ni.N(this.Di,!0)}if((r=this.qt.bootstrap)!=null&&r.sessionID)try{var s=(e=>{var t=this.qt.bootstrap.sessionID.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)})();this.qi(this.qt.bootstrap.sessionID,new Date().getTime(),s)}catch(e){No.error(`Invalid sessionID in bootstrap`,e)}this.ji()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return I(this.Ei)&&(this.Ei=[]),this.Ei.push(e),this.Oi&&e(this.Oi,this.Pi),()=>{this.Ei=this.Ei.filter((t=>t!==e))}}$i(){return this.qt.persistence!==`memory`&&!this.Si.Tr&&ni.O()}Hi(e){e!==this.Pi&&(this.Pi=e,this.$i()&&ni.N(this.Ni,e))}Ui(){return this.Pi?this.Pi:this.$i()?ni.F(this.Ni):null}Bi(e){var t=this.Ti;return!ve(t)&&!ve(e)&&5e3>Math.abs(e-t)}qi(e,t,n){var r=t!==this._sessionActivityTimestamp,i=!(e!==this.Oi||n!==this._sessionStartTimestamp);this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Oi=e,i&&!r||i&&this.Bi(t)||(this.Ti=t,this.Si.register({[Hn]:[t,e,n]}))}zi(){var e=this.qt?.persistence_save_debounce_ms;return be(e)&&e>0}Vi(){if(!ve(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ti){this.zi()?this.Si.refreshKey(Hn):(this.Si.flush(),this.Si.load());var[,e,t]=this.Wi();e===this.Oi&&t===this._sessionStartTimestamp&&(this.Ti=this._sessionActivityTimestamp,this.Si.register({[Hn]:[this._sessionActivityTimestamp,this.Oi??null,this._sessionStartTimestamp]}),this.Si.flush())}}Zi(){var[e]=this.Wi(),t=be(e)?e:0,n=be(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}Wi(){var e=this.Si.props[Hn];return F(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ti=null,clearTimeout(this.Gi),this.Gi=void 0,this.qi(null,null,null)}destroy(){this.Vi(),clearTimeout(this.Gi),this.Gi=void 0,this.Mi&&h&&(h.removeEventListener(Dr,this.Mi,{capture:!1}),this.Mi=void 0),this.Ei=[]}ji(){this.Mi=()=>{this.Vi(),this.$i()&&ni.q(this.Di)},zr(h,Dr,this.Mi,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.qt.cookieless_mode===Sr)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);var n=t||new Date().getTime(),[,r,i]=this.Wi(),a=this.Zi(),o=this.Ui(),s=be(i)&&Math.abs(n-i)>864e5,c=!1,l=!r,u=!l&&!e&&this.Ri(n,a);l||u||s?(r=this.Li(),o=this.Fi(),No.info(`new session ID generated`,{sessionId:r,windowId:o,changeReason:{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}}),i=n,c=!0):o||(o=this.Fi(),c=!0);var d=be(a)&&e&&!s?a:n,f=be(i)?i:new Date().getTime();return this.Hi(o),this.qi(r,d,f),e||this.Ai(),c&&this.Ei.forEach((e=>e(r,o,c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0))),{sessionId:r,windowId:o,sessionStartTimestamp:f,changeReason:c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0,lastActivityTimestamp:a}}Ai(){clearTimeout(this.Gi),this.Gi=setTimeout((()=>{var e=this.Zi();if(this.Ri(new Date().getTime(),e)){var t=this.Oi;this.resetSessionId(),this.Ii.emit(`forcedIdleReset`,{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},Fo=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&ce(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((e=>ce(e?.brand,t))))return!0}catch{}return!!e.webdriver},Io=function(e,t){if(!function(e){try{new RegExp(e)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function Lo(e,t,n){return yo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var Ro={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>Io(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Io(t,e))))),icontains:(e,t)=>t.map(zo).some((t=>e.map(zo).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(zo).every((t=>e.map(zo).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n<parseFloat(e)))}))},zo=e=>e.toLowerCase();function Bo(e,t){return!e||Object.entries(e).every((e=>{var[n,r]=e,i=t?.[n];if(I(i)||ve(i))return!1;var a=[String(i)],o=Ro[r.operator];return!!o&&o(r.values,a)}))}var Vo=`custom`,Ho=`i.posthog.com`,Uo=/^\/static\//,Wo=class{constructor(e){this.Qi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,``);return e===`https://app.posthog.com`?`https://us.i.posthog.com`:e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,``):this.apiHost}get uiHost(){var e=this.instance.config.ui_host?.replace(/\/$/,``);return e||=this.apiHost.replace(`.`+Ho,`.posthog.com`),e===`https://app.posthog.com`?`https://us.posthog.com`:e}get region(){return this.Qi[this.apiHost]||(this.Qi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?`us`:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?`eu`:Vo),this.Qi[this.apiHost]}Ji(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof t==`string`&&Uo.test(e))return t.trim().replace(/\/$/,``)||void 0}endpointFor(e,t){if(t===void 0&&(t=``),t&&=t[0]===`/`?t:`/`+t,e===`ui`)return this.uiHost+t;if(e===`flags`)return this.flagsApiHost+t;if(e===`assets`){var n=this.Ji(t);if(n)return``+n+t}if(this.region===Vo)return this.apiHost+t;var r=Ho+t;switch(e){case`assets`:return`https://`+this.region+`-assets.`+r;case`api`:return`https://`+this.region+`.`+r}}},G=B(`[Surveys]`),Go=`seenSurvey_`,Ko=[Ta.Popover,Ta.Widget,Ta.API],qo={ignoreConditions:!1,ignoreDelay:!1,displayType:Oa.Popover},Jo=B(`[PostHog ExternalIntegrations]`),Yo={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},Xo=class{constructor(e){this._instance=e}lr(e,t){var n;(n=T.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(e=>{if(e)return Jo.error(`failed to load script`,e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var n,i,a;!r||(n=T.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[t]||e.lr(Yo[t],(()=>{var n;(n=T.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[t])==null||n.start(e._instance)})),!r&&(i=T.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[t]&&((a=T.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[t])==null||a.stop())};for(var[n,r]of Object.entries((i=this._instance.config.integrations)??{})){var i;t(n)}}},Zo,Qo={},$o=0,es=()=>{},ts=`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`,ns=`Surveys module not available`,rs=`sanitize_properties is deprecated. Use before_send instead`,is=`Invalid value for property_denylist config: `,as=`posthog`,os=!mo&&w?.indexOf(`MSIE`)===-1&&w?.indexOf(`Mozilla`)===-1,ss=e=>{var t;return A({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,token:``,autocapture:!0,cross_subdomain_cookie:Rr(v?.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:es,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:`if_capture_pageview`,defaults:e??`unset`,__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:y&&L(y?.search)&&y.search.indexOf(`__posthog_debug=true`)!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(h==null||(t=h.location)==null?void 0:t.protocol)===`https:`,ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:`localStorage`,consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){z.error(`Bad HTTP status: `+e.statusCode+` `+e.text)},get_device_id:e=>e,capture_performance:void 0,name:`posthog`,bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Tr,before_send:void 0,request_queue_config:{flush_interval_ms:To},error_tracking:{},_onCapture:es,__preview_eager_load_replay:!1},(e=>({rageclick:e&&e>=`2026-05-30`?{content_ignorelist:Si,ignore_text_selection:!0}:!e||`2025-11-30`>e||{content_ignorelist:!0},capture_pageview:!e||`2025-05-24`>e||`history_change`,session_recording:e&&e>=`2025-11-30`?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>=`2026-01-30`?`head`:`body`,internal_or_test_user_hostname:e&&e>=`2026-01-30`?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>=`2026-05-30`?250:0,split_storage:!(!e||`2026-05-30`>e)}))(e))},cs=[[`process_person`,`person_profiles`],[`xhr_headers`,`request_headers`],[`cookie_name`,`persistence_name`],[`disable_cookie`,`disable_persistence`],[`store_google`,`save_campaign_params`],[`verbose`,`debug`]],ls=e=>{var t={};for(var[n,r]of cs)I(e[n])||(t[r]=e[n]);var i=H({},t,e);return F(e.property_blacklist)&&(I(e.property_denylist)?i.property_denylist=e.property_blacklist:F(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:z.error(is+e.property_denylist)),i},us=class{constructor(){this.__forceAllowLocalhost=!1}get Ki(){return this.__forceAllowLocalhost}set Ki(e){z.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},ds=class e{Yi(e,t){if(e){var n=this.Xi.indexOf(e);n!==-1&&this.Xi.splice(n,1)}return this.Xi.push(t),t.initialize==null||t.initialize(),t}en(){return this.config.cookieless_mode===Sr||this.config.cookieless_mode===xr&&this.consent.isRejected()}get decideEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}constructor(){this.webPerformance=new us,this.tn=!1,this.version=D.LIB_VERSION,this.rn=new Mo,this.Xi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ss(),this.SentryIntegration=Yi,this.sentryIntegration=e=>function(e,t){var n=Ji(e,t);return{name:qi,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.nn=!1,this.sn=null,this.an=null,this.un=null,this.scrollManager=new ko(this),this.pageViewManager=new Xi(this),this.rateLimiter=new Ma(this),this.requestRouter=new Wo(this),this.consent=new ri(this),this.externalIntegrations=new Xo(this);var t=e.__defaultExtensionClasses??{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,n)=>{var r=L(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{var r=L(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n?.({})}},this.on(`eventCaptured`,(e=>z.info(`send "`+e?.event+`"`,e)))}init(t,n,r){if(r&&r!==as){var i=Qo[r]??new e;return i._init(t,n,r),Qo[r]=i,Qo[as][r]=i,i}return this._init(t,n,r)}_init(e,t,n){var r;t===void 0&&(t={});var i=L(e)?e.trim():``;if(!i)return z.critical(`PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()`),this;if(this.__loaded)return console.warn(`[PostHog.js]`,`You have already initialized PostHog! Re-initializing is a no-op`),this;this.__loaded=!0,this.config={},t.debug=this.ln(t.debug),this.hn=t,this.cn=[],t.person_profiles?this.an=t.person_profiles:t.process_person&&(this.an=t.process_person);var a=ss(t.defaults),o=ls(t),s=H({},a,o,{name:n,token:i});he(a.rageclick)&&he(o.rageclick)&&(s.rageclick=H({},a.rageclick,o.rageclick)),this.set_config(s),this.config.on_xhr_error&&z.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=t.disable_compression?void 0:Fa.GZipJS;var c=this.dn();this.persistence=new Ca(this.config,c),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Ca(A({},this.config,{persistence:`sessionStorage`}),c,!1);var l=A({},this.persistence.props),u=A({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.vn=new Eo((e=>this.fn(e)),this.config.request_queue_config),this.pn=new Oo(this),this.__request_queue=[];var d=this.en();if(d||(this.sessionManager=new Po(this),this.sessionPropsManager=new jo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(z.info(`Deferring extension initialization to improve startup performance`),setTimeout((()=>{this.gn(d)}),0)):(z.info(`Initializing extensions synchronously`),this.gn(d)),D.DEBUG=D.DEBUG||this.config.debug,D.DEBUG&&z.info(`Starting in debug mode`,{this:this,config:t,thisC:A({},this.config),p:l,s:u}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=A({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),t.bootstrap?.distinctID!==void 0){var f=t.bootstrap.distinctID,p=this.get_distinct_id(),m=this.persistence.get_property(cr);if(t.bootstrap.isIdentifiedID&&p!=null&&p!==f&&m===Cr)this.identify(f);else if(t.bootstrap.isIdentifiedID&&p!=null&&p!==f&&m===wr)z.warn(`Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.`);else{var g=this.config.get_device_id(Kr()),_=t.bootstrap.isIdentifiedID?g:f;this.persistence.set_property(cr,t.bootstrap.isIdentifiedID?wr:Cr),this.register({distinct_id:f,$device_id:_})}}if(d)this.register_once({distinct_id:gr,$device_id:null},``);else if(!this.get_distinct_id()){var v=this.config.get_device_id(Kr());this.register_once({distinct_id:v,$device_id:v},``),this.persistence.set_property(cr,Cr)}return zr(h,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var n=e.config.segment;if(!n)return t();(function(e,t){var n=e.config.segment;if(!n)return t();var r=n=>{var r=()=>n.anonymousId()||Kr();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(cr,wr)),t()},i=n.user();`then`in i&&me(i.then)?i.then(r):r(i)})(e,(()=>{n.register((e=>{Promise&&Promise.resolve||Ki.warn(`This browser does not have Promise support, and can not use the segment integration`);var t=(t,n)=>{if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Ki.info(`No userId set, resetting PostHog`),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Ki.info(`UserId set, identifying with PostHog`),e.identify(t.event.userId));var r=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,Or),identify:e=>t(e,Ar),screen:e=>t(e,`$screen`)}})(e)).then((()=>{t()}))}))}(this,(()=>this.mn())):this.mn(),me(this.config._onCapture)&&this.config._onCapture!==es&&(z.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,(e=>this.config._onCapture(e.event,e)))),this.config.ip&&z.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}gn(t){var n=performance.now(),r=A({},e.__defaultExtensionClasses,this.config.__extensionClasses),i=[];r.featureFlags&&this.Xi.push(this.featureFlags=this.featureFlags??new r.featureFlags(this)),r.exceptions&&this.Xi.push(this.exceptions=this.exceptions??new r.exceptions(this)),r.historyAutocapture&&this.Xi.push(this.historyAutocapture=new r.historyAutocapture(this)),r.tracingHeaders&&this.Xi.push(this.tracingHeaders=new r.tracingHeaders(this)),r.siteApps&&this.Xi.push(this.siteApps=new r.siteApps(this)),r.sessionRecording&&!t&&this.Xi.push(this.sessionRecording=new r.sessionRecording(this)),this.config.disable_scroll_properties||i.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.autocapture&&this.Xi.push(this.autocapture=new r.autocapture(this)),r.surveys&&this.Xi.push(this.surveys=this.surveys??new r.surveys(this)),r.logs&&this.Xi.push(this.logs=this.logs??new r.logs(this)),r.conversations&&this.Xi.push(this.conversations=this.conversations??new r.conversations(this)),r.productTours&&this.Xi.push(this.productTours=new r.productTours(this)),r.heatmaps&&this.Xi.push(this.heatmaps=new r.heatmaps(this)),r.webVitalsAutocapture&&this.Xi.push(this.webVitalsAutocapture=new r.webVitalsAutocapture(this)),r.exceptionObserver&&this.Xi.push(this.exceptionObserver=new r.exceptionObserver(this)),r.deadClicksAutocapture&&this.Xi.push(this.deadClicksAutocapture=new r.deadClicksAutocapture(this,Wi)),r.toolbar&&this.Xi.push(this.toolbar=this.toolbar??new r.toolbar(this)),r.experiments&&this.Xi.push(this.experiments=this.experiments??new r.experiments(this)),this.Xi.forEach((e=>{e.initialize&&i.push((()=>{e.initialize==null||e.initialize()}))})),i.push((()=>{if(this.yn){var e=this.yn;this.yn=void 0,this.Qr(e)}})),this.bn(i,n)}bn(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.bn(e,t)}),0);var n=e.shift();if(n)try{n()}catch(e){z.error(`Error initializing extension:`,e)}}var r=Math.round(performance.now()-t);this.register_for_session({[_r]:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,[vr]:r}),this.config.__preview_deferred_init_extensions&&z.info(`PostHog extensions initialized (`+r+`ms)`)}Qr(e){var t;if(!v||!v.body)return z.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout((()=>{this.Qr(e)}),500);this.config.__preview_deferred_init_extensions&&(this.yn=e),this._n=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=P(e.supportedCompression,Fa.GZipJS)?Fa.GZipJS:P(e.supportedCompression,Fa.Base64)?Fa.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.an?this.an:Tr}),this.Xi.forEach((t=>t.onRemoteConfig==null?void 0:t.onRemoteConfig(e)))}mn(){try{this.config.loaded(this)}catch(e){z.critical("`loaded` function failed",e)}if(this.wn(),this.config.internal_or_test_user_hostname&&y!=null&&y.hostname){var e=y.hostname,t=this.config.internal_or_test_user_hostname;(typeof t==`string`?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.en())&&this.xn()}),1),this.Sn=new Pa(this),this.Sn.load()}wn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.vn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Mr(this.__request_queue,(e=>this.fn(e))),this.__request_queue=[],this.wn()}_handle_unload(){var e,t,n,r;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.kn()&&this.capture(kr),(t=this.logs)==null||t.flushLogs(`sendBeacon`),(n=this.vn)==null||n.unload(),(r=this.pn)==null||r.unload()):this.kn()&&this.capture(kr,null,{transport:`sendBeacon`})}_send_request(e){this.__loaded&&(os?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=vo(e.url,{ip:this.config.ip?1:0}),e.headers=A({},this.config.request_headers,e.headers),e.compression=e.compression===`best-available`?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=[`sendBeacon`]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t=A({},e);t.timeout=t.timeout||6e4,t.url=Co(t.url,t.compression);var n=t.transport??`fetch`,r=wo.filter((e=>!t.disableTransport||!e.transport||!t.disableTransport.includes(e.transport))),i=function(e,t){for(var r=0;e.length>r;r++)if(e[r].transport===n)return e[r]}(r)?.method??r[0].method;if(!i)throw Error(`No available transport method`);n!==`sendBeacon`&&t.data&&t.compression===Fa.GZipJS&&C&&!go?So(t).then((e=>{i(e)})).catch((n=>{if(re(n))return go=!0,void i(A({},t,{compression:void 0,url:Co(e.url,void 0)}));(e=>{if(!e||typeof e!=`object`)return!1;var t=`name`in e?String(e.name):``;return re(e)||t===te})(n)&&(go=!0),i(t)})):i(t)})(A({},e,{callback:t=>{var n,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(n=(r=this.config).on_request_error)==null||n.call(r,t),e.callback==null||e.callback(t)}}))))}fn(e){this.pn?this.pn.retriableRequest(e):this._send_request(e)}_execute_array(e){$o++;try{var t,n=[],r=[],i=[];Mr(e,(e=>{if(e)if(F(t=e[0]))i.push(e);else if(me(e))try{e.call(this)}catch(t){z.error(`Error executing queued PostHog call`,e,t)}else F(e)&&t===`alias`?n.push(e):F(e)&&t.indexOf(`capture`)!==-1&&me(this[t])?i.push(e):r.push(e)}));var a=function(e,t){Mr(e,(function(e){try{if(F(e[0])){var n=t;V(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){z.error(`Error executing queued PostHog call`,e,t)}}))};a(n,this),a(r,this),a(i,this)}finally{$o--}}push(t){if($o>0&&F(t)&&L(t[0])){var n=e.prototype[t[0]];me(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(e,t,n){var r,i,a,o;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.vn){if(this.is_capturing())if(!I(e)&&L(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!s||this.config.__preview_capture_bot_pageviews){var c=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){t!=null&&t.$current_url&&!L(t?.$current_url)&&(z.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!==`$exception`||n!=null&&n.Cn||z.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var l=new Date,u=n?.timestamp||l,d=n?.uuid||Kr(),f={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},u,d)};e===Or&&this.config.__preview_capture_bot_pageviews&&s&&(f.event=`$bot_pageview`,f.properties.$browser_type=`bot`),c&&(f.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),n!=null&&n.$set&&(f.$set=n?.$set);var p,m,h,g=this.In(n?.$set_once,e!==jr,e===Ar);if(g&&(f.$set_once=g),n!=null&&n._noTruncate||(r=this.config.properties_string_max_length,i=f,a=e=>L(e)?e.slice(0,r):e,o=new Set,f=function e(t,n){return t===Object(t)?o.has(t)?void 0:(o.add(t),F(t)?(r=[],Mr(t,(t=>{r.push(e(t))}))):(r={},V(t,((t,n)=>{o.has(t)||(r[n]=e(t,n))}))),r):a?a(t):t;var r}(i)),f.timestamp=u,I(n?.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=l),e===Ea.DISMISSED||e===Ea.SENT){var _=t?.[Da.SURVEY_ID],v=t?.[Da.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>{var n=``+Go+t.id;return t.current_iteration&&t.current_iteration>0&&(n=``+Go+t.id+`_`+t.current_iteration),n})(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,`true`)}catch(e){G.error(`Failed to persist survey seen state`,e)}})({id:_,current_iteration:v}),f.$set=A({},f.$set,{[(p={id:_,current_iteration:v},m=e===Ea.SENT?`responded`:`dismissed`,h=`$survey_`+m+`/`+p.id,p.current_iteration&&p.current_iteration>0&&(h=`$survey_`+m+`/`+p.id+`/`+p.current_iteration),h)]:!0})}else e===Ea.SHOWN&&(f.$set=A({},f.$set,{[Da.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===ka.SHOWN){var y=t?.[Aa.TOUR_TYPE];y&&(f.$set=A({},f.$set,{[Aa.TOUR_LAST_SEEN_DATE+`/`+y]:new Date().toISOString()}))}var b=A({},f.properties.$set,f.$set);if(ge(b)||this.setPersonPropertiesForFlags(b),!R(this.config.before_send)){var x=this.Tn(f);if(!x)return;f=x}this.rn.emit(`eventCaptured`,f);var S={method:`POST`,url:n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),data:f,compression:`best-available`,batchKey:n?._batchKey,transport:n?.transport};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.fn(S):this.vn.enqueue(S),f}z.critical(`This capture call is ignored due to client rate limiting.`)}}else z.error(`No event name provided to posthog.capture`)}else z.uninitializedWarning(`posthog.capture`)}_addCaptureHook(e){return this.on(`eventCaptured`,(t=>e(t.event,t)))}calculateEventProperties(e,t,n,r,i){if(n||=new Date,!this.persistence||!this.sessionPersistence)return t;var a=i?void 0:this.persistence.remove_event_timer(e),o=A({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.en()&&(o.$cookieless_mode=!0),e===`$snapshot`){var s=A({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=s.distinct_id,(!L(o.distinct_id)&&!ye(o.distinct_id)||_e(o.distinct_id))&&z.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),o}var c,l=function(e,t){var n,r,i;if(!w)return{};var a,o,s,c,l,u=e?[...oa,...t||[]]:[],[d,f]=function(e){for(var t=0;It.length>t;t++){var[n,r]=It[t],i=n.exec(e),a=i&&(me(r)?r(i,e):r);if(a)return a}return[``,``]}(w),p=(a=typeof navigator<`u`?navigator:void 0)!=null&&a.brave?{brave:!0}:{},m=H(Ir({$os:d,$os_version:f,$browser:Nt(w,navigator.vendor,p),$device:Lt(w),$device_type:(s=w,c={userAgentDataPlatform:(n=navigator)==null||(n=n.userAgentData)==null?void 0:n.platform,maxTouchPoints:navigator?.maxTouchPoints,screenWidth:h==null||(r=h.screen)==null?void 0:r.width,screenHeight:h==null||(i=h.screen)==null?void 0:i.height,devicePixelRatio:h?.devicePixelRatio},l=Lt(s),l===Be||l===ze||l===`Kobo`||l===`Kindle Fire`||l===gt?Re:l===at||l===st||l===ot||l===pt?`Console`:l===He?`Wearable`:l?Fe:c?.userAgentDataPlatform===`Android`&&(c?.maxTouchPoints??0)>0?600>Math.min(c?.screenWidth??0,c?.screenHeight??0)/(c?.devicePixelRatio??1)?Fe:Re:`Desktop`),$timezone:va(),$timezone_offset:ya()}),{$current_url:ra(y?.href,u,ca),$host:y?.host,$pathname:y?.pathname,$raw_user_agent:w.length>1e3?w.substring(0,997)+`...`:w,$browser_version:Ft(w,navigator.vendor,p),$browser_language:pa(),$browser_language_prefix:(o=pa(),typeof o==`string`?o.split(`-`)[0]:void 0),$screen_height:h?.screen.height,$screen_width:h?.screen.width,$viewport_height:h?.innerHeight,$viewport_width:h?.innerWidth,$lib:D.LIB_NAME,$lib_version:D.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return D.SDK_DIST_CHANNEL&&(m.$sdk_dist_channel=D.SDK_DIST_CHANNEL),m}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:u,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime());o.$session_id=u,o.$window_id=d}this.sessionPropsManager&&H(o,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&H(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=this.pn?.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Vo&&(o.$lib_custom_api_host=this.config.api_host),c=e!==Or||i?e!==kr||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),o=H(o,c),e===Or&&v&&(o.title=v.title),!I(a)){var f=n.getTime()-a;o.$duration=parseFloat((f/1e3).toFixed(3))}w&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?`bot`:`browser`),(o=H({},l,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),F(this.config.property_denylist)?V(this.config.property_denylist,(function(e){delete o[e]})):z.error(is+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&(z.error(rs),o=p(o,e));var m=this.En();return o.$process_person_profile=m,m&&!i&&this.Mn(`_calculate_event_properties`),o}In(e,t,n){if(t===void 0&&(t=!0),n===void 0&&(n=!1),!this.persistence||!this.En()||this.tn&&!n)return e;var r=H({},this.persistence.get_initial_props(),this.sessionPropsManager?.getSetOnceProps()||{},e||{}),i=this.config.sanitize_properties;return i&&(z.error(rs),r=i(r,`$set_once`)),t&&(this.tn=!0),ge(r)?void 0:r}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Rn(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags?.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags?.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags?.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags?.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,n){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,n)}updateEarlyAccessFeatureEnrollment(e,t,n){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags?.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.rn.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:ns}),()=>{})}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:ns})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:ns})}renderSurvey(e,t){var n;(n=this.surveys)==null||n.renderSurvey(e,t)}displaySurvey(e,t){var n;t===void 0&&(t=qo),(n=this.surveys)==null||n.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys?.canRenderSurvey(e)??{visible:!1,disabledReason:ns}}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys?.canRenderSurveyAsync(e,t)??Promise.resolve({visible:!1,disabledReason:ns})}Pn(e){return!e||_e(e)?(z.critical(`Unique user id has not been set in posthog.identify`),!1):e===gr?(z.critical(`The string "`+e+`" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):![`distinct_id`,`distinctid`].includes(e.toLowerCase())&&![`undefined`,`null`].includes(e.toLowerCase())||(z.critical(`The string "`+e+`" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,t,n){if(!this.__loaded||!this.persistence)return z.uninitializedWarning(`posthog.identify`);if(ye(e)&&(e=e.toString(),z.warn(`The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.`)),this.Pn(e)&&this.Mn(`posthog.identify`)){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Tn)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},``),e!==r&&e!==this.get_property(En)&&(this.unregister(En),this.register({distinct_id:e}));var i,a=(this.persistence.get_property(cr)||Cr)===Cr;e!==r&&a?(this.persistence.set_property(cr,wr),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.capture(Ar,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.un=Lo(e,t,n),(i=this.featureFlags)==null||i.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(ir))}}setPersonProperties(e,t){if((e||t)&&this.Mn(`posthog.setPersonProperties`)){var n=Lo(this.get_distinct_id(),e,t);this.un===n?z.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture(`$set`,{$set:e||{},$set_once:t||{}}),this.un=n)}}group(e,t,n){if(e&&t){var r=this.getGroups(),i=r[e]!==t;if(i&&this.resetGroupPropertiesForFlags(e),this.register({$groups:A({},r,{[e]:t})}),i||n){var a={$group_type:e,$group_key:t};n&&(a.$group_set=n),this.capture(jr,a)}n&&this.setGroupPropertiesForFlags({[e]:n}),i&&!n&&this.reloadFeatureFlags()}else z.error(`posthog.group requires a group type and group key`)}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var n;t===void 0&&(t=!0),this.Mn(`posthog.setGroupPropertiesForFlags`)&&((n=this.featureFlags)==null||n.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,i,a,o,s,c;if(z.info(`reset`),!this.__loaded)return z.uninitializedWarning(`posthog.reset`);var l,u=this.get_property(Tn),d=this.get_property(Ln);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),I(d)||(l=this.persistence)==null||l.register({[Ln]:d}),(r=this.surveys)==null||r.reset(),(i=this.Sn)==null||i.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(s=this.persistence)==null||s.set_property(cr,Cr),(c=this.sessionManager)==null||c.resetSessionId(),this.un=null,this.config.cookieless_mode===Sr)this.register_once({distinct_id:gr,$device_id:null},``);else{var f=this.config.get_device_id(Kr());this.register_once({distinct_id:f,$device_id:e?f:u},``)}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var n;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(n=this.conversations)==null||n.On()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Ln()}get_distinct_id(){return this.get_property(`distinct_id`)}getGroups(){return this.get_property(`$groups`)||{}}get_session_id(){return this.sessionManager?.checkAndGetSessionAndWindowId(!0).sessionId??``}get_session_replay_url(e){if(!this.sessionManager)return``;var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor(`ui`,`/project/`+this.config.token+`/replay/`+t);if(e!=null&&e.withTimestamp&&n){var i=e.timestampLookBack??10;if(!n)return r;r+=`?t=`+Math.max(Math.floor((new Date().getTime()-n)/1e3)-i,0)}return r}alias(e,t){return e===this.get_property(wn)?(z.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.Mn(`posthog.alias`)?(I(t)&&(t=this.get_distinct_id()),e===t?(z.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.Rn(En,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){var t=A({},this.config);if(he(e)){var n,r,i,a,o,s,c,l,u,d,f;H(this.config,ls(e));var p=this.dn();(n=this.persistence)==null||n.update_config(this.config,t,p),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Ca(A({},this.config,{persistence:`sessionStorage`}),p,!1);var m=this.ln(this.config.debug);xe(m)&&(this.config.debug=m),xe(this.config.debug)&&(this.config.debug?(D.DEBUG=!0,U.O()&&U.N(`ph_debug`,!0),z.info(`set_config`,{config:e,oldConfig:t,newConfig:A({},this.config)})):(D.DEBUG=!1,U.O()&&U.q(`ph_debug`))),(r=this.exceptionObserver)==null||r.onConfigChange(),(i=this.exceptions)==null||i.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.tracingHeaders)==null||o.startIfEnabledOrStop(),(s=this.autocapture)==null||s.startIfEnabled(),(c=this.heatmaps)==null||c.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(u=this.deadClicksAutocapture)==null||u.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.Fn(),(f=this.externalIntegrations)==null||f.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){D.LIB_NAME=e,D.LIB_VERSION=t}startSessionRecording(e){var t,n,r,i,a,o=!0===e,s={sampling:o||!(e==null||!e.sampling),linked_flag:o||!(e==null||!e.linked_flag),url_trigger:o||!(e==null||!e.url_trigger),event_trigger:o||!(e==null||!e.event_trigger)};Object.values(s).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),s.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),s.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),s.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger(`url`)),s.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger(`event`))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var n=Error(`PostHog syntheticException`),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(A({},r,t))}}addExceptionStep(e,t){var n;(n=this.exceptions)==null||n.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){return this.logs?.logger??e.An}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t;return(t=this.toolbar?.loadToolbar(e))!=null&&t}get_property(e){return this.persistence?.props[e]}getSessionProperty(e){return this.sessionPersistence?.props[e]}toString(){var e=this.config.name??as;return e!==as&&(e=as+`.`+e),e}_isIdentified(){return this.persistence?.get_property(cr)===wr||this.sessionPersistence?.get_property(cr)===wr}En(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===Tr&&!this._isIdentified()&&ge(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[En])&&((t=this.persistence)==null||(t=t.props)==null||!t[mr]))}kn(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&(!0===this.config.capture_pageview||this.config.capture_pageview===`history_change`)}createPersonProfile(){this.En()||this.Mn(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Mn(`posthog.setInternalOrTestUser`)&&this.setPersonProperties({$internal_or_test_user:!0})}Mn(e){return this.config.person_profiles===`never`?(z.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this.Rn(mr,!0),!0)}dn(){if(this.config.cookieless_mode===`always`)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==xr)}Fn(){var e,t,n=this.dn();return this.persistence?.Tr!==n&&((e=this.persistence)==null||e.set_disabled(n)),this.sessionPersistence?.Tr!==n&&((t=this.sessionPersistence)==null||t.set_disabled(n)),n}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Sr){if(this.en()){var r,i;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new Po(this),this.pageViewManager=new Xi(this),this.persistence&&(this.sessionPropsManager=new jo(this,this.sessionManager,this.persistence));var a,o=this.config.__extensionClasses?.sessionRecording??e.__defaultExtensionClasses?.sessionRecording;o&&(this.sessionRecording=this.Yi(this.sessionRecording,new o(this)),this._n&&((a=this.sessionRecording)==null||a.onRemoteConfig==null||a.onRemoteConfig(this._n)))}var s;this.consent.optInOut(!0),this.Fn(),this.wn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==xr&&((s=this.surveys)==null||s.loadIfEnabled()),(I(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture(t?.captureEventName??`$opt_in`,t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.xn()}else z.warn(ts)}opt_out_capturing(){var e,t,n;this.config.cookieless_mode===Sr?z.warn(ts):(this.config.cookieless_mode===xr&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Fn(),this.config.cookieless_mode===xr&&(this.register({distinct_id:gr,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.xn(),this.wn()))}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?`granted`:e===0?`denied`:`pending`}is_capturing(){return this.config.cookieless_mode===Sr||(this.config.cookieless_mode===xr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Fn()}_is_bot(){return _?Fo(_,this.config.custom_blocked_useragents):void 0}xn(){v&&(v.visibilityState===`visible`?this.nn||(this.nn=!0,this.capture(Or,{title:v.title},{send_instantly:!0}),this.sn&&=(v.removeEventListener(Er,this.sn),null)):this.sn||(this.sn=this.xn.bind(this),zr(v,Er,this.sn)))}debug(e){!1===e?(h?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(h?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Kr(){var e,t,n,r,i,a,o=this.hn||{};return`advanced_disable_flags`in o?!!o.advanced_disable_flags:!1===this.config.advanced_disable_flags?!0===this.config.advanced_disable_decide?(z.warn(`Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version.`),!0):(n=`advanced_disable_decide`,r=z,i=(t=`advanced_disable_flags`)in(e=o)&&!R(e[t]),a=n in e&&!R(e[n]),i?e[t]:!!a&&(r&&r.warn(`Config field '`+n+`' is deprecated. Please use '`+t+`' instead. The old field will be removed in a future major version.`),e[n])):!!this.config.advanced_disable_flags}Tn(e){if(R(this.config.before_send))return e;var t=F(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),R(n)){var i=`Event '`+e.event+`' was rejected in beforeSend function`;return Ce(e.event)?z.warn(i+`. This can cause unexpected behavior.`):z.info(i),null}n.properties&&!ge(n.properties)||z.warn(`Event '`+e.event+`' has no properties after beforeSend function, this is likely an error.`)}return n}getPageViewId(){return this.pageViewManager.dr?.pageViewId}captureTraceFeedback(e,t){this.capture(`$ai_feedback`,{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture(`$ai_metric`,{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}ln(e){var t=xe(e)&&!e,n=U.O()&&U.A(`ph_debug`)===`true`;return!t&&(!!n||e)}};ds.__defaultExtensionClasses={},ds.An={trace:Zo=()=>{},debug:Zo,info:Zo,warn:Zo,error:Zo,fatal:Zo},function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=Fr(e.prototype[t[n]])}(ds,[`identify`]);var fs=class{constructor(e){this.disabled=!1===e;var t=he(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>n-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},ps=`$copy_autocapture`,ms=B(`[AutoCapture]`);function hs(e,t){return t.length>e?t.slice(0,e)+`...`:t}function gs(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!ci(t));return t}function _s(e,t){var n,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:s}=t;if(!ci(e))return{props:{}};for(var c=[e],l=e;l.parentNode&&!li(l,`body`);)if(di(l.parentNode))c.push(l.parentNode.host),l=l.parentNode.host;else{if(!ci(l.parentNode))break;c.push(l.parentNode),l=l.parentNode}var u,d,f=[],p={},m=!1,g=!1;if(V(c,(e=>{var t=ki(e);if(li(e,`a`)){var n=e.getAttribute(`href`);m=t&&!!n&&Li(n)&&n}P(mi(e),`ph-no-capture`)&&(g=!0),f.push(function(e,t,n,r){var i=e.tagName.toLowerCase(),a={tag_name:i};vi.indexOf(i)>-1&&!n&&(a.$el_text=i.toLowerCase()===`a`||i.toLowerCase()===`button`?hs(1024,Ri(e)):hs(1024,gi(e)));var o=mi(e);o.length>0&&(a.classes=o.filter((function(e){return e!==``}))),V(e.attributes,(function(n){var i;if((!Ai(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&(r==null||!r.includes(n.name))&&!t&&Li(n.value)&&(!L(i=n.name)||i.substring(0,10)!==`_ngcontent`&&i.substring(0,7)!==`_nghost`)){var o=n.value;n.name===`class`&&(o=fi(o).join(` `)),a[`attr__`+n.name]=hs(1024,o)}}));for(var s=1,c=1,l=e;l=gs(l);)s++,l.tagName===e.tagName&&c++;return a.nth_child=s,a.nth_of_type=c,a}(e,i,a,o)),H(p,function(e){if(!ki(e))return{};var t={};return V(e.attributes,(function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){var n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&Li(r)&&(t[n]=r)}})),t}(e))})),g)return{props:{},explicitNoCapture:g};if(a||(f[0].$el_text=li(e,`a`)||li(e,`button`)?Ri(e):gi(e)),m){var _;f[0].attr__href=m;var v=ta(m)?.host,y=h==null||(_=h.location)==null?void 0:_.host;v&&y&&v!==y&&(u=m)}return{props:H({$event_type:r.type,$ce_version:1},s?{}:{$elements:f},{$elements_chain:(d=f,function(e){return e.map((e=>{var t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))t+=`.`+n.replace(/"/g,``);var r=A({},e.text?{text:e.text}:{},{"nth-child":e.nth_child??0,"nth-of-type":e.nth_of_type??0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),i={};return Nr(r).sort(((e,t)=>{var[n]=e,[r]=t;return n.localeCompare(r)})).forEach((e=>{var[t,n]=e;return i[Bi(t.toString())]=Bi(n.toString())})),(t+=`:`)+Nr(i).map((e=>{var[t,n]=e;return t+`="`+n+`"`})).join(``)})).join(`;`)}(function(e){return e.map((e=>{var t={text:e.$el_text?.slice(0,400),tag_name:e.tag_name,href:e.attr__href?.slice(0,2048),attr_class:Vi(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Nr(e).filter((e=>{var[t]=e;return t.indexOf(`attr__`)===0})).forEach((e=>{var[n,r]=e;return t.attributes[n]=r})),t}))}(d)))},(n=f[0])!=null&&n.$el_text?{$el_text:f[0]?.$el_text}:{},u&&r.type===`click`?{$external_click_url:u}:{},p)}}var vs=B(`[ExceptionAutocapture]`);function ys(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],i=n(r);return me(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]===i&&(e[t]=r)}}catch{return()=>{}}}var bs=B(`[TracingHeaders]`),xs=B(`[Web Vitals]`),Ss=9e5,Cs=`disabled`,ws=`lazy_loading`,Ts=`awaiting_config`,Es=`missing_config`;B(`[SessionRecording]`),B(`[SessionRecording]`);var Ds=`[SessionRecording]`,Os=B(Ds),ks=B(`[Heatmaps]`);function As(e){return he(e)&&`clientX`in e&&`clientY`in e&&ye(e.clientX)&&ye(e.clientY)}var js=B(`[Product Tours]`),Ms=[`$set_once`,`$set`],Ns=B(`[SiteApps]`),Ps=`Error while initializing PostHog app with config id `;function Fs(e,t,n){if(R(e))return!1;switch(n){case`exact`:return e===t;case`contains`:var r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(r,`i`).test(e);case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var Is=class{constructor(e){this.Nn=new Mo,this.Dn=(e,t)=>this.$n(e,t)&&this.qn(e,t)&&this.jn(e,t)&&this.Hn(e,t),this.$n=(e,t)=>t==null||!t.event||e?.event===t?.event,this._instance=e,this.Un=new Set,this.Bn=new Set}init(){var e;I(this._instance?._addCaptureHook)||(e=this._instance)==null||e._addCaptureHook(((e,t)=>{this.on(e,t)}))}register(e){var t;if(!I(this._instance?._addCaptureHook)&&(e.forEach((e=>{var t,n;(t=this.Bn)==null||t.add(e),(n=e.steps)==null||n.forEach((e=>{var t;(t=this.Un)==null||t.add(e?.event||``)}))})),(t=this._instance)!=null&&t.autocapture)){var n,r=new Set;e.forEach((e=>{var t;(t=e.steps)==null||t.forEach((e=>{e!=null&&e.selector&&r.add(e?.selector)}))})),(n=this._instance)==null||n.autocapture.setElementSelectors(r)}}on(e,t){t!=null&&e.length!=0&&(this.Un.has(e)||this.Un.has(t?.event))&&this.Bn&&this.Bn?.size>0&&this.Bn.forEach((e=>{this.zn(t,e)&&this.Nn.emit(`actionCaptured`,e.name)}))}Vn(e){this.onAction(`actionCaptured`,(t=>e(t)))}zn(e,t){if(t?.steps==null)return!1;for(var n of t.steps)if(this.Dn(e,n))return!0;return!1}onAction(e,t){return this.Nn.on(e,t)}qn(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!=`string`||!Fs(r,t.url,t.url_matching||`contains`))return!1}return!0}jn(e,t){return!!this.Wn(e,t)&&!!this.Zn(e,t)&&!!this.Gn(e,t)}Wn(e,t){var n;if(t==null||!t.href)return!0;var r=this.Qn(e);if(r.length>0)return r.some((e=>Fs(e.href,t.href,t.href_matching||`exact`)));var i,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!a&&Fs((i=a.match(/(?::|")href="(.*?)"/))?i[1]:``,t.href,t.href_matching||`exact`)}Zn(e,t){var n;if(t==null||!t.text)return!0;var r=this.Qn(e);if(r.length>0)return r.some((e=>Fs(e.text,t.text,t.text_matching||`exact`)||Fs(e.$el_text,t.text,t.text_matching||`exact`)));var i,a,o,s=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!s&&(i=function(e){for(var t,n=[],r=/(?::|")text="(.*?)"/g;!R(t=r.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(s),a=t.text,o=t.text_matching||`exact`,i.some((e=>Fs(e,a,o))))}Gn(e,t){var n,r;if(t==null||!t.selector)return!0;var i=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(i!=null&&i.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||``;if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Qn(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Hn(e,t){return t==null||!t.properties||t.properties.length===0||Bo(t.properties.reduce(((e,t)=>{var n=F(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e}),{}),e?.properties)}},Ls=class{constructor(e){this._instance=e,this.Jn=new Map,this.Kn=new Map,this.Yn=new Map}Xn(e,t){return!!e&&Bo(e.propertyFilters,t?.properties)}es(e,t){var n=new Map;return e.forEach((e=>{var r;(r=e.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach((t=>{if(t!=null&&t.name){var r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}}))})),n}ts(e,t,n){var r=(n===wa.Activation?this.Jn:this.Kn).get(e),i=[];return this.rs((e=>{i=e.filter((e=>r?.includes(e.id)))})),i.filter((r=>{var i,a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find((t=>t.name===e));return this.Xn(a,t)}))}register(e){I(this._instance?._addCaptureHook)||(this.ns(e),this.ss(e))}ss(e){var t=e.filter((e=>{var t;return e.conditions?.actions&&((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null?void 0:t.length)>0}));t.length!==0&&(this.os??(this.os=new Is(this._instance),this.os.init(),this.os.Vn((e=>{this.onAction(e)}))),t.forEach((e=>{var t,n,r,i,a;e.conditions&&(t=e.conditions)!=null&&t.actions&&(n=e.conditions)!=null&&(n=n.actions)!=null&&n.values&&((r=e.conditions)==null||(r=r.actions)==null||(r=r.values)==null?void 0:r.length)>0&&((i=this.os)==null||i.register(e.conditions.actions.values),(a=e.conditions)==null||(a=a.actions)==null||(a=a.values)==null||a.forEach((t=>{if(t&&t.name){var n=this.Yn.get(t.name);n&&n.push(e.id),this.Yn.set(t.name,n||[e.id])}})))})))}ns(e){var t,n=e.filter((e=>{var t;return e.conditions?.events&&((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null?void 0:t.length)>0})),r=e.filter((e=>{var t;return e.conditions?.cancelEvents&&((t=e.conditions)==null||(t=t.cancelEvents)==null||(t=t.values)==null?void 0:t.length)>0}));n.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this.Jn=this.es(e,wa.Activation),this.Kn=this.es(e,wa.Cancellation))}onEvent(e,t){var n,r=this.le(),i=this.us(),a=this.ls(),o=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[i])||[];if(a===e&&t&&o.length>0){var s,c;r.info(`event matched, removing item from activated items`,{event:e,eventPayload:t,existingActivatedItems:o});var l=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(l){var u=o.indexOf(l);0>u||(o.splice(u,1),this.hs(o))}}else{if(this.Kn.has(e)){var d=this.ts(e,t,wa.Cancellation);d.length>0&&(r.info(`cancel event matched, cancelling items`,{event:e,itemsToCancel:d.map((e=>e.id))}),d.forEach((e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.cs(e.id)})),this.hs(o))}if(this.Jn.has(e)){r.info(`event name matched`,{event:e,eventPayload:t,items:this.Jn.get(e)});var f=this.ts(e,t,wa.Activation);this.hs(o.concat(f.map((e=>e.id))||[]))}}}onAction(e){var t,n=this.us(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[];this.Yn.has(e)&&this.hs(r.concat(this.Yn.get(e)||[]))}hs(e){var t=this.le(),n=[...new Set(e)].filter((e=>!this.ds(e)));t.info(`updating activated items`,{activatedItems:n}),this.vs(n)}getActivatedIds(){var e,t=this.us();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Jn}fs(){return this.os}},Rs=class extends Ls{constructor(e){super(e)}us(){return nr}ls(){return Ea.SHOWN}rs(e){var t;(t=this._instance)==null||t.getSurveys(e)}cs(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}le(){return G}vs(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[nr]:e})}ds(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},zs=`SDK is not enabled or survey functionality is not yet loaded`,Bs=`Disabled. Not loading surveys.`,Vs=h!=null&&h.location?ia(h.location.hash,`__posthog`)||ia(location.hash,`state`):null,Hs=`_postHogToolbarParams`,Us=B(`[Toolbar]`),Ws=B(`[FeatureFlags]`),Gs=B(`[FeatureFlags]`,{debugEnabled:!0}),Ks=`" failed. Feature flags didn't load in time.`,qs=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},Js=e=>{var t={};for(var[n,r]of Nr(e||{}))r&&(t[n]=r);return t},Ys=B(`[Error tracking]`),Xs=`Refusing to render web experiment since the viewer is a likely bot`,Zs={icontains:(e,t)=>!!h&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!h&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!h&&Io(t.href,e),not_regex:(e,t)=>!!h&&!Io(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},Qs=class e{get qt(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){t===void 0&&(t=!1),n.getWebExperiments((t=>{e.ps(`retrieved web experiments from the server`),n.gs=new Map,t.forEach((t=>{if(t.feature_flag_key){var r;n.gs&&(e.ps(`setting flag key `,t.feature_flag_key,` to web experiment `,t),(r=n.gs)==null||r.set(t.feature_flag_key,t));var i=n._instance.getFeatureFlag(t.feature_flag_key);L(i)&&t.variants[i]&&n.ys(t.name,i,t.variants[i].transforms)}else if(t.variants)for(var a in t.variants){var o=t.variants[a];e.bs(o)&&n.ys(t.name,a,o.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())e.ps(Xs);else if(!this.qt.disable_web_experiments){if(R(this.gs))return this.gs=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.ps(`applying feature flags`,t),t.forEach((e=>{var t;if(this.gs&&(t=this.gs)!=null&&t.has(e)){var n=this._instance.getFeatureFlag(e),r=this.gs?.get(e);n&&r!=null&&r.variants[n]&&this.ys(r.name,n,r.variants[n].transforms)}}))}}previewWebExperiment(){var t=e.getWindowLocation();if(t!=null&&t.search){var n=na(t?.search,`__experiment_id`),r=na(t?.search,`__experiment_variant`);n&&r&&(e.ps(`previewing web experiments `+n+` && `+r),this.getWebExperiments((e=>{this._s(parseInt(n),r,e)}),!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this.qt.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=`+this.qt.token),method:`GET`,callback:t=>e(t.statusCode===200&&t.json&&t.json.experiments||[])})}_s(t,n,r){var i=r.filter((e=>e.id===t));i&&i.length>0&&(e.ps(`Previewing web experiment [`+i[0].name+`] with variant [`+n+`]`),this.ys(i[0].name,n,i[0].variants[n].transforms))}static bs(t){return!R(t.conditions)&&e.ws(t)&&e.xs(t)}static ws(t){if(R(t.conditions)||R(t.conditions?.url))return!0;var n,r=e.getWindowLocation();return!!r&&((n=t.conditions)==null||!n.url||Zs[t.conditions?.urlMatchType??`icontains`](t.conditions.url,r))}static getWindowLocation(){return h?.location}static xs(e){if(R(e.conditions)||R(e.conditions?.utm))return!0;var t=ua();if(t.utm_source){var n,r,i,a,o,s,c,l,u=(n=e.conditions)==null||(n=n.utm)==null||!n.utm_campaign||((r=e.conditions)==null||(r=r.utm)==null?void 0:r.utm_campaign)==t.utm_campaign,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==t.utm_source,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_medium||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_medium)==t.utm_medium,p=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_term)==t.utm_term;return u&&f&&p&&d}return!1}static ps(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];z.info(`[WebExperiments] `+e,n)}ys(t,n,r){this._is_bot()?e.ps(Xs):n===`control`?e.ps(`Control variants leave the page unmodified.`):r.forEach((r=>{r.selector&&(e.ps(`applying transform of variant `+n+` for experiment `+t+` `,r),(document?.querySelectorAll(r.selector))?.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)})))}))}_is_bot(){return _&&this._instance?Fo(_,this.qt.custom_blocked_useragents):void 0}},$s=B(`[Conversations]`),ec=`Conversations not available yet.`,tc={featureFlags:class{constructor(e){this.Ss=!1,this.ks=!1,this.Cs=!1,this.Is=!1,this.Ts=!1,this.Es=!1,this.Ms=!1,this.Rs=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get Si(){return this._instance.persistence}Ps(e){return this._instance.get_property(e)}Os(){var e;return(e=this.Si?.Mr(this.qt.feature_flag_cache_ttl_ms))!=null&&e}Ls(){return!!this.Os()&&(this.Rs||this.Cs||(this.Rs=!0,Ws.warn(`Feature flag cache is stale, triggering refresh...`),this.reloadFeatureFlags()),!0)}Fs(){var e=this.qt.evaluation_contexts??this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.Ms||(Ws.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.Ms=!0),e!=null&&e.length?e.filter((e=>{var t=e&&typeof e==`string`&&e.trim().length>0;return t||Ws.error(`Invalid evaluation context found:`,e,`Expected non-empty string`),t})):[]}As(){return this.Fs().length>0}Ns(){var e=this.qt.flag_keys;if(!I(e)){if(F(e))return e.filter((e=>{var t=e&&typeof e==`string`&&e.trim().length>0;return t||Ws.error(`Invalid flag key found:`,e,`Expected non-empty string`),t}));Ws.error(`Invalid flag_keys found:`,e,`Expected array of non-empty strings`)}}initialize(){var{config:e}=this._instance,t=e.bootstrap?.featureFlags??{};if(Object.keys(t).length){var n=e.bootstrap?.featureFlagPayloads??{},r=Object.keys(t).filter((e=>!!t[e])).reduce(((e,n)=>(e[n]=t[n]||!1,e)),{}),i=Object.keys(n).filter((e=>r[e])).reduce(((e,t)=>(n[t]&&(e[t]=n[t]),e)),{});this.receivedFeatureFlags({featureFlags:r,featureFlagPayloads:i})}}updateFlags(e,t,n){var r=n!=null&&n.merge?this.getFlagVariants():{},i=n!=null&&n.merge?this.getFlagPayloads():{},a=A({},r,e),o=A({},i,t),s={};for(var[c,l]of Object.entries(a)){var u=typeof l==`string`;s[c]={key:c,enabled:!!u||!!l,variant:u?l:void 0,reason:void 0,metadata:I(o?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:o[c]}}}this.receivedFeatureFlags({flags:s})}get hasLoadedFlags(){return this.ks}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Ps(qn),t=this.Ps(Xn),n=this.Ps(Zn);if(!n&&!t)return e||{};var r=H({},e||{});for(var i of[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])]){var a,o,s=r[i],c=t?.[i],l=I(c)?(a=s?.enabled)!=null&&a:!!c,u=I(c)?s.variant:typeof c==`string`?c:void 0,d=n?.[i],f=A({},s,{enabled:l,variant:l?u??s?.variant:void 0});l!==s?.enabled&&(f.original_enabled=s?.enabled),u!==s?.variant&&(f.original_variant=s?.variant),d&&(f.metadata=A({},s?.metadata,{payload:d,original_payload:s==null||(o=s.metadata)==null?void 0:o.payload})),r[i]=f}return this.Ss||=(Ws.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),!0),r}getFlagVariants(){var e=this.Ps(Wn),t=this.Ps(Xn);if(!t)return e||{};for(var n=H({},e),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.Ss||=(Ws.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}getFlagPayloads(){var e=this.Ps(Jn),t=this.Ps(Zn);if(!t)return e||{};for(var n=H({},e||{}),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.Ss||=(Ws.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),!0),n}reloadFeatureFlags(){this.Is||this.qt.advanced_disable_feature_flags||this.Ds||(this._instance.rn.emit(`featureFlagsReloading`,!0),this.Ds=setTimeout((()=>{this.$s()}),5))}qs(){clearTimeout(this.Ds),this.Ds=void 0}ensureFlagsLoaded(){this.ks||this.Cs||this.Ds||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Is=e}$s(e){if(this.qs(),!this._instance.Kr())if(this.Cs)this.Ts=!0;else{var t=this.qt.token,n=this.Ps(Tn),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:A({},this.Si?.get_initial_props()||{},this.Ps(Qn)||{}),group_properties:this.Ps($n),timezone:va()};ve(n)||I(n)||(r.$device_id=n),(e!=null&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.As()&&(r.evaluation_contexts=this.Fs());var i=this.Ns();I(i)||(r.flag_keys=i);var a=!!this.qt.advanced_only_evaluate_survey_feature_flags,o=this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`+(this.qt.advanced_only_evaluate_survey_feature_flags?`&only_evaluate_survey_feature_flags=true`:``));this.Cs=!0,this._instance._send_request({method:`POST`,url:o,data:r,compression:this.qt.disable_compression?void 0:Fa.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback:e=>{var t,n,i,o=!0;if(e.statusCode===200&&(this.Ts||(this.$anon_distinct_id=void 0),o=!1),this.Cs=!1,!r.disable_flags||this.Ts){this.Es=!o;var s=[];e.error?e.error instanceof Error?s.push(e.error.name===`AbortError`?`timeout`:`connection_error`):s.push(`unknown_error`):e.statusCode!==200&&s.push(`api_error_`+e.statusCode),(t=e.json)!=null&&t.errorsWhileComputingFlags&&s.push(`errors_while_computing_flags`);var c=!((n=e.json)==null||(n=n.quotaLimited)==null||!n.includes(`feature_flags`));c&&s.push(`quota_limited`),(i=this.Si)==null||i.register({[or]:s}),c?Ws.warn(`You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.`):(r.disable_flags||this.receivedFeatureFlags(e.json??{},o,{partialResponse:a}),this.Ts&&(this.Ts=!1,this.$s()))}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),!t.fresh||this.Es)if(this.ks||this.getFlags()&&this.getFlags().length>0){if(!this.Ls()){var n=this.getFeatureFlagResult(e,t);return n?.variant??n?.enabled}}else Ws.warn(`getFeatureFlag for key "`+e+Ks)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFeatureFlagResult(e,{send_event:!1})?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.Es)if(this.ks||this.getFlags()&&this.getFlags().length>0){if(!this.Ls()){var n=this.getFlagVariants(),r=e in n,i=n[e],a=this.getFlagPayloads()[e],o=String(i),s=this.Ps(Yn)||void 0,c=this.Ps(sr)||void 0,l=this.Ps(ir)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var u,d=this._instance.get_session_id(),f=this.Ps(ar);d&&d!==f&&(l={},(u=this.Si)==null||u.register({[ir]:l,[ar]:d}))}if((t.send_event||!(`send_event`in t))&&(!(e in l)||!l[e].includes(o))){var p,m,h,g,_,v,y,b;F(l[e])?l[e].push(o):l[e]=[o],(p=this.Si)==null||p.register({[ir]:l});var x=this.getFeatureFlagDetails(e),S=[...this.Ps(or)??[]];I(i)&&S.push(`flag_missing`);var C={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:a||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((m=this.qt.bootstrap)==null||(m=m.featureFlags)==null?void 0:m[e])||null,$feature_flag_bootstrapped_payload:((h=this.qt.bootstrap)==null||(h=h.featureFlagPayloads)==null?void 0:h[e])||null,$used_bootstrap_value:!this.Es};I(x==null||(g=x.metadata)==null?void 0:g.version)||(C.$feature_flag_version=x.metadata.version);var w,T=(x==null||(_=x.reason)==null?void 0:_.description)??(x==null||(v=x.reason)==null?void 0:v.code);T&&(C.$feature_flag_reason=T),x!=null&&(y=x.metadata)!=null&&y.id&&(C.$feature_flag_id=x.metadata.id),I(x?.original_variant)&&I(x?.original_enabled)||(C.$feature_flag_original_response=I(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&(b=x.metadata)!=null&&b.original_payload&&(C.$feature_flag_original_payload=x==null||(w=x.metadata)==null?void 0:w.original_payload),S.length&&(C.$feature_flag_error=S.join(`,`)),this._instance.capture(`$feature_flag_called`,C)}if(r){var E=a;if(!I(a))try{E=JSON.parse(a)}catch{}return{key:e,enabled:!!i,variant:typeof i==`string`?i:void 0,payload:E}}}}else Ws.warn(`getFeatureFlagResult for key "`+e+Ks)}getRemoteConfigPayload(e,t){var n=this.qt.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.As()&&(r.evaluation_contexts=this.Fs());var i=this.Ns();I(i)||(r.flag_keys=i),this._instance._send_request({method:`POST`,url:this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`),data:r,compression:this.qt.disable_compression?void 0:Fa.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback(n){var r=n.json?.featureFlagPayloads;t(r?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.Es){if(this.ks||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return I(n)?void 0:!!n}Ws.warn(`isFeatureEnabled for key "`+e+Ks)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.Si){this.ks=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(e,t,n,r,i,a){n===void 0&&(n={}),r===void 0&&(r={}),i===void 0&&(i={});var o=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>[e,t[e].variant??t[e].enabled]))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>t[e].metadata?.payload)).map((e=>[e,t[e].metadata?.payload])))):Ws.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e})(e),s=o.flags,c=o.featureFlags,l=o.featureFlagPayloads;if(c){var u=e.requestId,d=e.evaluatedAt;if(F(c)){Ws.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);var f={};if(c)for(var p=0;c.length>p;p++)f[c[p]]=!0;t&&t.register({[Gn]:c,[Wn]:f})}else{var m=c,h=l,g=s;if(a!=null&&a.partialResponse)m=A({},n,m),h=A({},r,h),g=A({},i,g);else if(e.errorsWhileComputingFlags)if(s){var _=new Set(Object.keys(s).filter((e=>{var t;return!((t=s[e])!=null&&t.failed)})));m=A({},n,Object.fromEntries(Object.entries(m).filter((e=>{var[t]=e;return _.has(t)})))),h=A({},r,Object.fromEntries(Object.entries(h||{}).filter((e=>{var[t]=e;return _.has(t)})))),g=A({},i,Object.fromEntries(Object.entries(g||{}).filter((e=>{var[t]=e;return _.has(t)}))))}else m=A({},n,m),h=A({},r,h),g=A({},i,g);t&&t.register(A({[Gn]:Object.keys(Js(m)),[Wn]:m||{},[Jn]:h||{},[qn]:g||{}},u?{[Yn]:u}:{},d?{[sr]:d}:{}))}}})(e,this.Si,r,i,a,n),t||(this.Rs=!1),this.js(t)}}override(e,t){t===void 0&&(t=!1),Ws.warn(`override is deprecated. Please use overrideFeatureFlags instead.`),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Si)return Ws.uninitializedWarning(`posthog.featureFlags.overrideFeatureFlags`);if(!1===e)return this.Si.unregister(Xn),this.Si.unregister(Zn),this.js(),Gs.info(`All overrides cleared`);if(F(e)){var t=qs(e);return this.Si.register({[Xn]:t}),this.js(),Gs.info(`Flag overrides set`,{flags:e})}if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var n,r=e;if(this.Ss=!!((n=r.suppressWarning)!=null&&n),`flags`in r){if(!1===r.flags)this.Si.unregister(Xn),Gs.info(`Flag overrides cleared`);else if(r.flags){if(F(r.flags)){var i=qs(r.flags);this.Si.register({[Xn]:i})}else this.Si.register({[Xn]:r.flags});Gs.info(`Flag overrides set`,{flags:r.flags})}}`payloads`in r&&(!1===r.payloads?(this.Si.unregister(Zn),Gs.info(`Payload overrides cleared`)):r.payloads&&(this.Si.register({[Zn]:r.payloads}),Gs.info(`Payload overrides set`,{payloads:r.payloads}))),this.js();return}if(e&&typeof e==`object`)return this.Si.register({[Xn]:e}),this.js(),Gs.info(`Flag overrides set`,{flags:e});Ws.warn(`Invalid overrideOptions provided to overrideFeatureFlags`,{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ks){var{flags:t,flagVariants:n}=this.Hs();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,i=(this.Ps(Kn)||[]).find((t=>t.flagKey===e)),a={[`$feature_enrollment/`+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture(`$feature_enrollment_update`,o),this.setPersonPropertiesForFlags(a,!1);var s=A({},this.getFlagVariants(),{[e]:t});(r=this.Si)==null||r.register({[Gn]:Object.keys(Js(s)),[Wn]:s}),this.js()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.Ps(Kn),i=n?`&`+n.map((e=>`stage=`+e)).join(`&`):``;if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/early_access_features/?token=`+this.qt.token+i),method:`GET`,callback:t=>{var n,r;if(t.json){var i=t.json.earlyAccessFeatures;return(n=this.Si)==null||n.unregister(Kn),(r=this.Si)==null||r.register({[Kn]:i}),e(i)}}})}Hs(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,n)=>(e[n]=t[n],e)),{})}}js(e){var{flags:t,flagVariants:n}=this.Hs();this.featureFlagEventHandlers.forEach((r=>r(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Ps(Qn)||{},r=e?.$set||(e!=null&&e.$set_once?{}:e),i=e?.$set_once,a={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in n||(a[o]=i[o]));this._instance.register({[Qn]:A({},n,a,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Qn)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Ps($n)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((t=>{n[t]=A({},n[t],e[t]),delete e[t]})),this._instance.register({[$n]:A({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Ps($n)||{};this._instance.register({[$n]:A({},t,{[e]:{}})})}else this._instance.unregister($n)}reset(){this.ks=!1,this.Cs=!1,this.Is=!1,this.Ts=!1,this.Es=!1,this.$anon_distinct_id=void 0,this.qs(),this.Ss=!1}}},nc={sessionRecording:class{get qt(){return this._instance.config}get Si(){return this._instance.persistence}get started(){var e;return!((e=this.Us)==null||!e.isStarted)}get status(){return this.Bs===Ts||this.Bs===Es?this.Bs:this.Us?.status??this.Bs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Bs=Cs,this.zs=void 0,this._instance=e,!this._instance.sessionManager)throw Os.error(`started without valid sessionManager`),Error(Ds+` started without valid sessionManager. This is a bug.`);if(this.qt.cookieless_mode===Sr)throw Error(Ds+` cannot be used with cookieless_mode="always"`)}initialize(){this.startIfEnabledOrStop()}get Vs(){var e,t=!((e=this._instance.get_property(Ln))==null||!e.enabled),n=!this.qt.disable_session_recording,r=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return h&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.Vs||(t=this.Us)==null||!t.isStarted){var n=!I(Object.assign)&&!I(Array.from);this.Vs&&n?(this.Ws(e),Os.info(`starting`)):(this.Bs=Cs,this.stopRecording())}}Ws(e){var t,n,r;this.Vs&&(this.Bs!==Ts&&this.Bs!==Es&&(this.Bs=ws),T!=null&&(t=T.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=T.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Zs(e):(r=T.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Gs,(t=>{if(t)return Os.error(`could not load recorder`,t);this.Zs(e)})))}stopRecording(){var e,t;(e=this.zs)==null||e.call(this),this.zs=void 0,(t=this.Us)==null||t.stop()}Qs(){var e,t;(e=this.zs)==null||e.call(this),this.zs=void 0,(t=this.Us)==null||t.discard()}Js(){var e;(e=this.Si)==null||e.unregister(Un)}Ks(e,t){if(R(e))return null;var n,r=ye(e)?e:parseFloat(e);return typeof(n=r)!=`number`||!Number.isFinite(n)||0>n||n>1?(Os.warn(t+` must be between 0 and 1. Ignoring invalid value:`,e),null):r}Ys(e){if(this.Si){var t,n=this.Si,r=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.Ks(this.qt.session_recording?.sampleRate,`session_recording.sampleRate`),i=this.Ks(t?.sampleRate,`remote config sampleRate`),a=r??i;R(a)&&this.Js();var o=t?.minimumDurationMilliseconds;n.register({[Ln]:A({cache_timestamp:Date.now(),enabled:!!t},t,{networkPayloadCapture:A({capturePerformance:e.capturePerformance},t?.networkPayloadCapture),canvasRecording:{enabled:t?.recordCanvas,fps:t?.canvasFps,quality:t?.canvasQuality},sampleRate:a,minimumDurationMilliseconds:I(o)?null:o,endpoint:t?.endpoint,triggerMatchType:t?.triggerMatchType,masking:t?.masking,urlTriggers:t?.urlTriggers,version:t?.version,triggerGroups:t?.triggerGroups})})};r(),(t=this.zs)==null||t.call(this),this.zs=this._instance.sessionManager?.onSessionId(r)}}onRemoteConfig(e){`sessionRecording`in e?!1===e.sessionRecording?(this.Ys(e),this.Qs()):(this.Ys(e),this.startIfEnabledOrStop()):(this.Bs===Ts&&(this.Bs=Es,Os.warn(`config refresh failed, recording will not start until page reload`)),this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t=`log`),(n=this.Us)!=null&&n.log?this.Us.log(e,t):Os.warn(`log called before recorder was ready`)}get Gs(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Ln);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}Xs(){var e,t=this._instance.get_property(Ln);if(!t)return!1;try{e=typeof t==`object`?t:JSON.parse(t)}catch(e){return Os.warn(`persisted remote config for session recording is invalid and will be ignored`,e),!1}var n=e.cache_timestamp??Date.now();return 36e5>=Date.now()-n}Zs(e){var t;if((t=T.__PosthogExtensions__)==null||!t.initSessionRecording)return Os.warn(`Called on script loaded before session recording is available. This can be caused by adblockers.`),void this._instance.register_for_session({[yr]:!0});if(this.Us||(this.Us=T.__PosthogExtensions__?.initSessionRecording(this._instance),this.Us._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Xs()){if(this.Bs===Es||this.Bs===Ts)return;this.Bs=Ts,Os.info(`persisted remote config is stale, requesting fresh config before starting`),new Pa(this._instance).load();return}this.Bs=ws,this.Us.start(e)}onRRwebEmit(e){var t;(t=this.Us)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Us||(t=this.Si)==null||t.register({[zn]:!0}),(e=this.Us)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Us||(t=this.Si)==null||t.register({[Rn]:!0}),(e=this.Us)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Us||(n=this.Si)==null||n.register({[e===`url`?Bn:Vn]:!0}),(t=this.Us)==null||t.overrideTrigger(e)}get sdkDebugProperties(){return this.Us?.sdkDebugProperties||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.Us)==null||!n.tryAddCustomEvent(e,t))}}},rc={autocapture:class{constructor(e){this.eo=!1,this.ro=null,this.io=!1,this.instance=e,this.rageclicks=new fs(e.config.rageclick),this.no=null}initialize(){this.startIfEnabled()}get qt(){var e=he(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=e.url_allowlist?.map((e=>new RegExp(e))),e.url_ignorelist=e.url_ignorelist?.map((e=>new RegExp(e))),e}so(){if(this.isBrowserSupported()){if(h&&v){var e=e=>{e||=h?.event;try{this.oo(e)}catch(e){ms.error(`Failed to capture event`,e)}};if(zr(v,`submit`,e,{capture:!0}),zr(v,`change`,e,{capture:!0}),zr(v,`click`,e,{capture:!0}),this.qt.capture_copied_text){var t=e=>{e||=h?.event;try{this.oo(e,ps)}catch(e){ms.error(`Failed to capture copy/cut event`,e)}};zr(v,`copy`,t,{capture:!0}),zr(v,`cut`,t,{capture:!0})}}}else ms.info(`Disabling Automatic Event Collection because this browser is not supported`)}startIfEnabled(){this.isEnabled&&!this.eo&&(this.so(),this.eo=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.io=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[On]:!!e.autocapture_opt_out}),this.ro=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.no=e}getElementSelectors(e){var t,n=[];return(t=this.no)==null||t.forEach((t=>{(v?.querySelectorAll(t))?.forEach((r=>{e===r&&n.push(t)}))})),n}get isEnabled(){var e=this.instance.persistence?.props[On];if(ve(this.ro)&&!xe(e)&&!this.instance.Kr())return!1;var t=this.ro??!!e;return!!this.instance.config.autocapture&&!t}oo(e,t){if(t===void 0&&(t=`$autocapture`),this.isEnabled){var n,r=_i(e);ui(r)&&(r=r.parentNode||null),t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Ei(r,this.instance.config.rageclick)&&this.oo(e,`$rageclick`);var i=t===ps;if(r&&function(e,t,n,r,i){var a,o,s;if(n===void 0&&(n=void 0),!h||Di(e)||(a=n)!=null&&a.url_allowlist&&!pi(n.url_allowlist)||(o=n)!=null&&o.url_ignorelist&&pi(n.url_ignorelist))return!1;if((s=n)!=null&&s.dom_event_allowlist){var c=n.dom_event_allowlist;if(c&&!c.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:l,targetElementList:u}=Oi(e,r);if(!function(e,t){var n=t?.element_allowlist;if(I(n))return!0;var r,i=function(e){if(n.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var a of e)if(r=i(a))return r.v;return!1}(u,n)||!yi(u,n?.css_selector_allowlist))return!1;var d=h.getComputedStyle(e);if(d&&d.getPropertyValue(`cursor`)===`pointer`&&t.type===`click`)return!0;var f=e.tagName.toLowerCase();switch(f){case`html`:return!1;case`form`:return(i||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(i||[`change`,`click`]).indexOf(t.type)>=0;default:return l?(i||[`click`]).indexOf(t.type)>=0:(i||[`click`]).indexOf(t.type)>=0&&(vi.indexOf(f)>-1||e.getAttribute(`contenteditable`)===`true`)}}(r,e,this.qt,i,i?[`copy`,`cut`]:void 0)){var{props:a,explicitNoCapture:o}=_s(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.io});if(o)return!1;var s=this.getElementSelectors(r);if(s&&s.length>0&&(a.$element_selectors=s),t===ps){var c,l=hi(h==null||(c=h.getSelection())==null?void 0:c.toString()),u=e.type||`clipboard`;if(!l)return!1;a.$selected_content=l,a.$copy_type=u}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return me(v?.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ao=(h==null||(t=h.location)==null?void 0:t.pathname)||``}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview===`history_change`}startIfEnabled(){this.isEnabled&&(z.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}stop(){this.uo&&this.uo(),this.uo=void 0,z.info(`History API monitoring stopped`)}monitorHistoryChanges(){var e,t;if(h&&h.history){var n=this;(e=h.history.pushState)!=null&&e.__posthog_wrapped__||ys(h.history,`pushState`,(e=>function(t,r,i){e.call(this,t,r,i),n.lo(`pushState`)})),(t=h.history.replaceState)!=null&&t.__posthog_wrapped__||ys(h.history,`replaceState`,(e=>function(t,r,i){e.call(this,t,r,i),n.lo(`replaceState`)})),this.ho()}}lo(e){try{var t,n=h==null||(t=h.location)==null?void 0:t.pathname;if(!n)return;n!==this.ao&&this.isEnabled&&this._instance.capture(Or,{navigation_type:e}),this.ao=n}catch(t){z.error(`Error capturing `+e+` pageview`,t)}}ho(){if(!this.uo){var e=()=>{this.lo(`popstate`)};zr(h,`popstate`,e),this.uo=()=>{h&&h.removeEventListener(`popstate`,e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.co=!1,this.eo=!1,this.do=null,this.instance=e,this.co=!((t=this.instance.persistence)==null||!t.props[kn]),this.rageclicks=new fs(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return he(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return R(this.qt.capture_heatmaps)?R(this.qt.enable_heatmaps)?this.co:this.qt.enable_heatmaps:!1!==this.qt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.eo)return;ks.info(`starting...`),this.vo(),this.At()}else clearInterval(this.do??void 0),this.fo(),this.getAndClearBuffer()}onRemoteConfig(e){if(`heatmaps`in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[kn]:t}),this.co=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}po(e){this.Mt(e.originalEvent,`deadclick`)}At(){this.do&&clearInterval(this.do),this.do=v?.visibilityState===`visible`?setInterval(this.ci.bind(this),this.flushIntervalMilliseconds):null}vo(){h&&v&&(this.mo=this.ci.bind(this),zr(h,Dr,this.mo),this.yo=e=>this.Mt(e||h?.event),zr(v,`click`,this.yo,{capture:!0}),this.bo=e=>this._o(e||h?.event),zr(v,`mousemove`,this.bo,{capture:!0}),this.wo=new Gi(this.instance,Ui,this.po.bind(this)),this.wo.startIfEnabledOrStop(),this.xo=this.At.bind(this),zr(v,Er,this.xo),this.eo=!0)}fo(){var e;h&&v&&(this.mo&&h.removeEventListener(Dr,this.mo),this.yo&&v.removeEventListener(`click`,this.yo,{capture:!0}),this.bo&&v.removeEventListener(`mousemove`,this.bo,{capture:!0}),this.xo&&v.removeEventListener(Er,this.xo),clearTimeout(this.So),(e=this.wo)==null||e.stop(),this.eo=!1)}ko(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),a=function(e,t,n){for(var r=e;r&&ci(r)&&!li(r,`body`);){if(r===n)return!1;if(P(t,h?.getComputedStyle(r).position))return!0;r=bi(r)}return!1}(_i(e),[`fixed`,`sticky`],i);return{x:e.clientX+(a?0:r),y:e.clientY+(a?0:n),target_fixed:a,type:t}}Mt(e,t){var n;if(t===void 0&&(t=`click`),!si(e.target)&&As(e)){var r=this.ko(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Ei(_i(e),this.instance.config.rageclick)&&this.Co(A({},r,{type:`rageclick`})),this.Co(r)}}_o(e){!si(e.target)&&As(e)&&(clearTimeout(this.So),this.So=setTimeout((()=>{this.Co(this.ko(e,`mousemove`))}),500))}Co(e){if(h){var t=h.location.href,n=this.qt.custom_personal_data_properties,r=ra(t,this.qt.mask_personal_data_properties?[...oa,...n||[]]:[],ca);this.M=this.M||{},this.M[r]||(this.M[r]=[]),this.M[r].push(e)}}ci(){this.M&&!ge(this.M)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Gi,webVitalsAutocapture:class{constructor(e){var t;this.co=!1,this.eo=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Io=()=>{clearTimeout(this.To),this.M.metrics.length!==0&&(this._instance.capture(`$web_vitals`,this.M.metrics.reduce(((e,t)=>A({},e,{[`$web_vitals_`+t.name+`_event`]:A({},t),[`$web_vitals_`+t.name+`_value`]:t.value})),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dt=e=>{this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var t=this.Eo();if(!I(t))if(R(e?.name)||R(e?.value))xs.error(`Invalid metric received`,e);else if(!this.Mo||this.Mo>e.value){this.M.url!==t&&(this.Io(),this.To=setTimeout(this.Io,this.flushToCaptureTimeoutMs)),I(this.M.url)&&(this.M.url=t),this.M.firstMetricTimestamp=I(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var n=this._instance.sessionManager?.checkAndGetSessionAndWindowId(!0),r=A({},e,{$current_url:t,timestamp:Date.now()});I(n)||(r.$session_id=n.sessionId,r.$window_id=n.windowId),this.M.metrics.push(r),this.M.metrics.length===this.allowedMetrics.length&&this.Io()}else xs.error(`Ignoring metric with value >= `+this.Mo,e)},this.Ro=()=>{if(!this.eo){var e,t,n,r,i=T.__PosthogExtensions__;I(i)||I(i.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:r}=i.postHogWebVitalsCallbacks),e&&t&&n&&r?(this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.dt.bind(this)),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.dt.bind(this)),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.dt.bind(this)),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.dt.bind(this)),this.eo=!0):xs.error(`web vitals callbacks not loaded - not starting`)}},this._instance=e,this.co=!((t=this._instance.persistence)==null||!t.props[Nn]),this.startIfEnabled()}get Po(){return this._instance.config.capture_performance}get allowedMetrics(){var e=he(this.Po)?this.Po?.web_vitals_allowed_metrics:void 0;return R(e)?this._instance.persistence?.props[In]||[`CLS`,`FCP`,`INP`,`LCP`]:e}get flushToCaptureTimeoutMs(){return(he(this.Po)?this.Po.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=he(this.Po)?this.Po.web_vitals_attribution:void 0;return e!=null&&e}get Mo(){var e=he(this.Po)&&ye(this.Po.__web_vitals_max_value)?this.Po.__web_vitals_max_value:Ss;return e>0&&6e4>=e?Ss:e}get isEnabled(){var e=y?.protocol;if(e!==`http:`&&e!==`https:`)return xs.info(`Web Vitals are disabled on non-http/https protocols`),!1;var t=he(this.Po)?this.Po.web_vitals:xe(this.Po)?this.Po:void 0;return xe(t)?t:this.co}startIfEnabled(){this.isEnabled&&!this.eo&&(xs.info(`enabled, starting...`),this.lr(this.Ro))}onRemoteConfig(e){if(`capturePerformance`in e){var t=he(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=he(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Nn]:t}),this._instance.persistence.register({[In]:n})),this.co=t,this.startIfEnabled()}}lr(e){var t,n;(t=T.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=T.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?`web-vitals-with-attribution`:`web-vitals`,(t=>{t?xs.error(`failed to load script`,t):e()}))}Eo(){var e=h?h.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return ra(e,this._instance.config.mask_personal_data_properties?[...oa,...t||[]]:[],ca)}xs.error(`Could not determine current URL`)}}},ic={exceptionObserver:class{constructor(e){var t;this.Ro=()=>{var e;if(h&&this.isEnabled&&(e=T.__PosthogExtensions__)!=null&&e.errorWrappingFunctions){var t=T.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=T.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=T.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Oo&&this.qt.capture_unhandled_errors&&(this.Oo=t(this.captureException.bind(this))),!this.Lo&&this.qt.capture_unhandled_rejections&&(this.Lo=n(this.captureException.bind(this))),!this.Fo&&this.qt.capture_console_errors&&(this.Fo=r(this.captureException.bind(this)))}catch(e){vs.error(`failed to start`,e),this.Ao()}}},this._instance=e,this.No=!((t=this._instance.persistence)==null||!t.props[An]),this.Do=new je({refillRate:this._instance.config.error_tracking.__exceptionRateLimiterRefillRate??1,bucketSize:this._instance.config.error_tracking.__exceptionRateLimiterBucketSize??10,refillInterval:1e4,Gt:vs}),this.qt=this.$o(),this.startIfEnabledOrStop()}$o(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return he(e)?t=A({},t,e):(I(e)?this.No:e)&&(t=A({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(vs.info(`enabled`),this.Ao(),this.lr(this.Ro)):this.Ao()}lr(e){var t,n;(t=T.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=T.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`exception-autocapture`,(t=>{if(t)return vs.error(`failed to load script`,t);e()}))}Ao(){var e,t,n;(e=this.Oo)==null||e.call(this),this.Oo=void 0,(t=this.Lo)==null||t.call(this),this.Lo=void 0,(n=this.Fo)==null||n.call(this),this.Fo=void 0}onRemoteConfig(e){`autocaptureExceptions`in e&&(this.No=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[An]:this.No}),this.qt=this.$o(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.$o()}captureException(e){var t,n,r=(e==null||(t=e.$exception_list)==null||(t=t[0])==null?void 0:t.type)??`Exception`;this.Do.consumeRateLimit(r)?vs.info(`Skipping exception capture because of client rate limiting.`,{exception:r}):(n=this._instance.exceptions)==null||n.sendExceptionEvent(e)}},exceptions:class{constructor(e){this.qo=[],this.jo=new Wt([new nn,new pn,new an,new rn,new dn,new un,new sn,new fn],function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];return function(t,r){r===void 0&&(r=0);for(var i=[],a=t.split(`
|
|
3
3
|
`),o=r;a.length>o;o++){var s=a[o];if(1024>=s.length){var c=tn.test(s)?s.replace(tn,`$1`):s;if(!c.match(/\S*Error: /)){for(var l of n){var u=l(c,e);if(u){i.push(u);break}}if(i.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map((e=>{return A({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||Gt});var n}))}(i)}}(`web:javascript`,Zt,en)),this._instance=e,this.qo=this._instance.persistence?.get_property(jn)??[],this.Ho=vn(this.Uo()),this.Bo=new yn(this.Ho)}onConfigChange(){this.Ho=vn(this.Uo()),this.Bo.setConfig(this.Ho)}onRemoteConfig(e){if(`errorTracking`in e){var t=e.errorTracking?.suppressionRules??[],n=e.errorTracking?.captureExtensionExceptions;this.qo=t,this._instance.persistence&&this._instance.persistence.register({[jn]:this.qo,[Mn]:n})}}get zo(){var e,t=!!this._instance.get_property(Mn);return(e=this._instance.config.error_tracking.captureExtensionExceptions??t)!=null&&e}buildProperties(e,t){return this.jo.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.Ho.enabled)try{if(!L(e)||e.trim().length===0)return void Ys.warn(`Ignoring exception step because message must be a non-empty string`);var{sanitizedProperties:n,droppedKeys:r}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((n,r)=>gn.has(r)?(t.push(r),n):(n[r]=e[r],n)),{}),droppedKeys:t}}(this.Vo(t));r.length>0&&Ys.warn(`Ignoring reserved exception step fields`,{droppedKeys:r}),this.Bo.add(A({[mn]:e,[hn]:new Date().toISOString()},n))}catch(e){Ys.error(`Failed to add exception step. Ignoring breadcrumb.`,e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Wo(t)){if(this.Zo(t))return this.Go(`Exception dropped: matched a suppression rule`),void Ys.info(`Skipping exception capture because a suppression rule matched`);if(!this.zo&&this.Qo(t))return this.Go(`Exception dropped: thrown by a browser extension`),void Ys.info(`Skipping exception capture because it was thrown by an extension`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jo(t))return this.Go(`Exception dropped: thrown by the PostHog SDK`),void Ys.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}var n=this.Ho.enabled&&R(e.$exception_steps)?this.Ko(e):e;try{var r=this._instance.capture(`$exception`,n,{_noTruncate:!0,_batchKey:`exceptionEvent`,Cn:!0});return r&&this.Bo.clear(),r}catch(e){Ys.error(`Failed to capture exception event. Dropping this exception.`,e),this.Bo.clear();return}}catch(e){Ys.error(`Failed to process exception event. Ignoring this exception.`,e);return}}Ko(e){try{var t=this.Bo.getAttachable();return t.length===0?e:A({},e,{$exception_steps:t})}catch(t){return Ys.error(`Failed to read buffered exception steps. Capturing exception without steps.`,t),e}}Go(e){this.Ho.enabled&&this.Bo.add({[mn]:e,[hn]:new Date().toISOString()})}Vo(e){return he(e)?A({},e):{}}Uo(){return this._instance.config.error_tracking?.exception_steps??{}}Zo(e){if(e.length===0)return!1;var t=e.reduce(((e,t)=>{var{type:n,value:r}=t;return L(n)&&n.length>0&&e.$exception_types.push(n),L(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this.qo.some((e=>{var n=e.values.map((e=>{var n=Ro[e.operator],r=F(e.value)?e.value:[e.value],i=t[e.key]??[];return r.length>0&&n(r,i)}));return e.type===`OR`?n.some(Boolean):n.every(Boolean)}))}Qo(e){return e.flatMap((e=>e.stacktrace?.frames??[])).some((e=>e.filename&&e.filename.startsWith(`chrome-extension://`)))}Jo(e){if(e.length>0){var t,n,r=e[0].stacktrace?.frames??[],i=r[r.length-1];return(t=i==null||(n=i.filename)==null?void 0:n.includes(`posthog.com/static`))!=null&&t}return!1}Wo(e){return!R(e)&&F(e)}}},ac=A({productTours:class{get Si(){return this._instance.persistence}constructor(e){this.Yo=null,this.Xo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){`productTours`in e&&(this.Si&&this.Si.register({[Fn]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Yo||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(Fn)||this.lr((()=>this.ea()))}lr(e){var t,n;(t=T.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=T.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`product-tours`,(t=>{t?js.error(`Could not load product tours script`,t):e()}))}ea(){var e;!this.Yo&&(e=T.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Yo=T.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!F(this.Xo)||t){var n=this.Si;if(n){var r=n.props[rr];if(F(r)&&!t)return this.Xo=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/product_tours/?token=`+this._instance.config.token),method:`GET`,callback:t=>{var r=t.statusCode;if(r!==200||!t.json){var i=`Product Tours API could not be loaded, status: `+r;js.error(i),e([],{isLoaded:!1,error:i});return}var a=F(t.json.product_tours)?t.json.product_tours:[];this.Xo=a,n&&n.register({[rr]:a}),e(a,{isLoaded:!0})}})}else e(this.Xo,{isLoaded:!0})}getActiveProductTours(e){R(this.Yo)?e([],{isLoaded:!1,error:`Product tours not loaded`}):this.Yo.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Yo)==null||t.showTourById(e)}previewTour(e){this.Yo?this.Yo.previewTour(e):this.lr((()=>{var t;this.ea(),(t=this.Yo)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Yo)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.Yo)==null||e.nextStep()}previousStep(){var e;(e=this.Yo)==null||e.previousStep()}clearCache(){var e;this.Xo=null,(e=this.Si)==null||e.unregister(rr)}resetTour(e){var t;(t=this.Yo)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Yo)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Yo)==null||t.cancelPendingTour(e)}}},tc),oc={siteApps:class{constructor(e){this._instance=e,this.ta=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ra(e,t){if(t){var n=this.globalsForEvent(t);this.ta.push(n),this.ta.length>1e3&&(this.ta=this.ta.slice(10))}}get siteAppLoaders(){var e;return(e=T._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.ra.bind(this));this.ia=()=>{e(),this.ta=[],this.ia=void 0}}}globalsForEvent(e){if(!e)throw Error(`Event payload is required`);var t={},n=this._instance.get_property(`$groups`)||[],r=this._instance.get_property(`$stored_group_properties`)||{};for(var[i,a]of Object.entries(r))t[i]={id:n[i],type:i,properties:a};var{$set_once:o,$set:s}=e;return{event:A({},j(e,Ms),{properties:A({},e.properties,s?{$set:A({},e.properties?.$set??{},s)}:{},o?{$set_once:A({},e.properties?.$set_once??{},o)}:{}),elements_chain:e.properties?.$elements_chain??``,distinct_id:e.properties?.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:t}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var n;!t.errored&&this.ta.length&&(Ns.info(`Processing `+this.ta.length+` events for site app with id `+e.id),this.ta.forEach((e=>t.processEvent==null?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&((n=this.ia)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,Ns.info(`Site app with id `+e.id+` `+(i?`loaded`:`errored`)),r&&n()};try{var{processEvent:a}=e.init({posthog:this._instance,callback(e){i(e)}});a&&(t.processEvent=a),r=!0}catch(t){Ns.error(Ps+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){Ns.error(`Error while processing buffered events PostHog app with config id `+e.id,n),t.errored=!0}}na(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}sa(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(t){Ns.error(`Error while processing event `+e.event+` for site app `+n.id,t)}}}onRemoteConfig(e){var t,n,r,i=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.na(),void this._instance.on(`eventCaptured`,(e=>this.sa(e)))):void Ns.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((n=this.ia)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var a=function(e){var t;T[`__$$ph_site_app_`+e]=i._instance,(t=T.__PosthogExtensions__)==null||t.loadSiteApp==null||t.loadSiteApp(i._instance,s,(t=>{if(t)return Ns.error(Ps+e,t)}))};for(var{id:o,url:s}of e.siteApps)a(o)}else Ns.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}},sc={tracingHeaders:class{constructor(e){this.oa=void 0,this.aa=void 0,this.ua=void 0,this.Ro=()=>{var e,t,n=this.la();n?(I(this.oa)&&(this.oa=(e=T.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),I(this.aa)&&(this.aa=(t=T.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ao()},this._instance=e}initialize(){this.startIfEnabledOrStop()}lr(e){var t,n;(t=T.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=T.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`tracing-headers`,(t=>{if(t)return bs.error(`failed to load script`,t);e()}))}ha(){return this._instance.config.tracing_headers??this._instance.config.addTracingHeaders??this._instance.config.__add_tracing_headers}la(){var e=this.ha();return F(e)?(F(this.ua)?this.ua.splice(0,this.ua.length,...e):this.ua=[...e],e.length>0?this.ua:void 0):(F(this.ua)&&this.ua.splice(0),this.ua=e||void 0,this.ua)}Ao(){var e,t;(e=this.oa)==null||e.call(this),(t=this.aa)==null||t.call(this),this.oa=void 0,this.aa=void 0}startIfEnabledOrStop(){this.la()?this.lr(this.Ro):this.Ao()}}},cc=A({surveys:class{get qt(){return this._instance.config}constructor(e){this.ca=void 0,this._surveyManager=null,this.da=!1,this.va=[],this.fa=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qt.disable_surveys){var t=e.surveys;if(R(t))return G.warn(`Flags not loaded yet. Not loading surveys.`);this.ca=F(t)?t.length>0:t,G.info(`flags response received, isSurveysEnabled: `+this.ca),this.loadIfEnabled()}}reset(){localStorage.removeItem(`lastSeenSurveyDate`);for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(Go)||n!=null&&n.startsWith(`inProgressSurvey_`))&&e.push(n)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this.da)G.info(`Already initializing surveys, skipping...`);else if(this.qt.disable_surveys)G.info(Bs);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())G.info(`Not loading surveys in cookieless mode without consent.`);else{var e=T?.__PosthogExtensions__;if(e){if(!I(this.ca)||this.qt.advanced_enable_surveys){var t=this.ca||this.qt.advanced_enable_surveys;this.da=!0;try{var n=e.generateSurveys;if(n)return void this.pa(n,t);var r=e.loadExternalDependency;if(!r)return void this.ga(br);r(this._instance,`surveys`,(n=>{n||!e.generateSurveys?this.ga(`Could not load surveys script`,n):this.pa(e.generateSurveys,t)}))}catch(e){throw this.ga(`Error initializing surveys`,e),e}finally{this.da=!1}}}else G.error(`PostHog Extensions not found.`)}}pa(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Rs(this._instance),G.info(`Surveys loaded successfully`),this.ma({isLoaded:!0})}ga(e,t){G.error(e,t),this.ma({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.va.push(e),this._surveyManager&&this.ma({isLoaded:!0}),()=>{this.va=this.va.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.qt.disable_surveys)return G.info(Bs),e([]);var n,r=this._instance.get_property(er);if(r&&!t)return e(r,{isLoaded:!0});typeof Promise<`u`&&this.fa?this.fa.then((t=>{var{surveys:n,context:r}=t;return e(n,r)})):(typeof Promise<`u`&&(this.fa=new Promise((e=>{n=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/surveys/?token=`+this.qt.token),method:`GET`,timeout:this.qt.surveys_request_timeout_ms,callback:t=>{var r;this.fa=null;var i=t.statusCode;if(i!==200||!t.json){var a=`Surveys API could not be loaded, status: `+i;G.error(a);var o={isLoaded:!1,error:a};e([],o),n?.({surveys:[],context:o});return}var s,c=t.json.surveys||[],l=c.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}(e)||function(e){var t;return!((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null||!t.length)}(e))));l.length>0&&((s=this._surveyEventReceiver)==null||s.register(l)),(r=this._instance.persistence)==null||r.register({[er]:c,[tr]:Date.now()});var u={isLoaded:!0};e(c,u),n?.({surveys:c,context:u})}}))}ma(e){for(var t of this.va)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){G.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!R(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);G.warn(`init was not called`)}ya(e){var t=null;return this.getSurveys((n=>{t=n.find((t=>t.id===e))??null})),t}ba(e){if(R(this._surveyManager))return{eligible:!1,reason:zs};var t=typeof e==`string`?this.ya(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(R(this._surveyManager))return G.warn(`init was not called`),{visible:!1,disabledReason:zs};var t=this.ba(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return R(this._surveyManager)?(G.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:zs})):new Promise((n=>{this.getSurveys((t=>{var r=t.find((t=>t.id===e))??null;if(r){var i=this.ba(r);n({visible:i.eligible,disabledReason:i.reason})}else n({visible:!1,disabledReason:`Survey not found`})}),t)}))}renderSurvey(e,t,n){var r;if(R(this._surveyManager))G.warn(`init was not called`);else{var i=typeof e==`string`?this.ya(e):e;if(i!=null&&i.id)if(Ko.includes(i.type)){var a=v?.querySelector(t);if(a)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(G.info(`Rendering survey `+i.id+` with delay of `+i.appearance.surveyPopupDelaySeconds+` seconds`),void setTimeout((()=>{var e;G.info(`Rendering survey `+i.id+` with delay of `+i.appearance?.surveyPopupDelaySeconds+` seconds`),(e=this._surveyManager)==null||e.renderSurvey(i,a,n),G.info(`Survey `+i.id+` rendered`)}),1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,a,n);G.warn(`Survey element not found`)}else G.warn(`Surveys of type `+i.type+` cannot be rendered in the app`);else G.warn(`Survey not found`)}}displaySurvey(e,t){var n;if(R(this._surveyManager))G.warn(`init was not called`);else{var r=this.ya(e);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=A({},r,{appearance:A({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Oa.Popover&&t.initialResponses&&G.warn(`initialResponses is only supported for popover surveys. prefill will not be applied.`),!1===t.ignoreConditions){var a=this.canRenderSurvey(r);if(!a.visible)return void G.warn(`Survey is not eligible to be displayed: `,a.disabledReason)}t.displayType===Oa.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}else G.warn(`Survey not found`)}}cancelPendingSurvey(e){R(this._surveyManager)?G.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},tc),lc={toolbar:class{constructor(e){this.instance=e}_a(e){T.ph_toolbar_state=e}wa(){return T.ph_toolbar_state??0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),Br(this.instance.config)||!h||!v)return!1;e??=h.location,n??=h.history;try{if(!t){try{h.localStorage.setItem(`test`,`test`),h.localStorage.removeItem(`test`)}catch{return!1}t=h?.localStorage}var r,i=Vs||ia(e.hash,`__posthog`)||ia(e.hash,`state`),a=i?Pr((()=>JSON.parse(atob(decodeURIComponent(i)))))||Pr((()=>JSON.parse(decodeURIComponent(i)))):null;return a&&a.action===`ph_authorize`?((r=a).source=`url`,r&&Object.keys(r).length>0&&(a.desiredHash?e.hash=a.desiredHash:n?n.replaceState(n.state,``,e.pathname+e.search):e.hash=``)):((r=JSON.parse(t.getItem(Hs)||`{}`)).source=`localstorage`,delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}xa(e){var t=T.ph_load_toolbar||T.ph_load_editor;!R(t)&&me(t)?t(e,this.instance):Us.warn(`No toolbar load function found`)}loadToolbar(e){var t=!(v==null||!v.getElementById(hr));if(!h||t)return!1;var n=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,r=A({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor(`ui`)},n?{instrument:!1}:{});if(h.localStorage.setItem(Hs,JSON.stringify(A({},r,{source:void 0}))),this.wa()===2)this.xa(r);else if(this.wa()===0){var i;this._a(1),(i=T.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,`toolbar`,(e=>{if(e)return Us.error(`[Toolbar] Failed to load`,e),void this._a(0);this._a(2),this.xa(r)})),zr(h,`turbolinks:load`,(()=>{this._a(0),this.loadToolbar(r)}))}return!0}Sa(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},uc=A({experiments:Qs},tc),dc=A({},tc,nc,rc,ic,ac,oc,cc,sc,lc,uc,{conversations:class{constructor(e){this.ka=void 0,this._conversationsManager=null,this.Ca=!1,this.Ia=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;R(t)||(xe(t)?this.ka=t:(this.ka=t.enabled,this.Ia=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.ka=void 0,this.Ia=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ca||this._instance.config.disable_conversations||Br(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=T?.__PosthogExtensions__;if(e&&!I(this.ka)&&this.ka)if(this.Ia&&this.Ia.token){this.Ca=!0;try{var t=e.initConversations;if(t)return this.Ta(t),void(this.Ca=!1);var n=e.loadExternalDependency;if(!n)return void this.Ea(br);n(this._instance,`conversations`,(t=>{t||!e.initConversations?this.Ea(`Could not load conversations script`,t):this.Ta(e.initConversations),this.Ca=!1}))}catch(e){this.Ea(`Error initializing conversations`,e),this.Ca=!1}}else $s.error(`Conversations enabled but missing token in remote config.`)}}Ta(e){if(this.Ia)try{this._conversationsManager=e(this.Ia,this._instance),$s.info(`Conversations loaded successfully`)}catch(e){this.Ea(`Error completing conversations initialization`,e)}else $s.error(`Cannot complete initialization: remote config is null`)}Ea(e,t){$s.error(e,t),this._conversationsManager=null,this.Ca=!1}show(){this._conversationsManager?this._conversationsManager.show():$s.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.ka&&!ve(this._conversationsManager)}isVisible(){var e;return(e=this._conversationsManager?.isVisible())!=null&&e}sendMessage(e,t,n){var r=this;return k((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):($s.warn(ec),null)}))()}getMessages(e,t){var n=this;return k((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):($s.warn(ec),null)}))()}markAsRead(e){var t=this;return k((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):($s.warn(ec),null)}))()}getTickets(e){var t=this;return k((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):($s.warn(ec),null)}))()}requestRestoreLink(e){var t=this;return k((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):($s.warn(ec),null)}))()}restoreFromToken(e){var t=this;return k((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):($s.warn(ec),null)}))()}restoreFromUrlToken(){var e=this;return k((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():($s.warn(ec),null)}))()}getCurrentTicketId(){return this._conversationsManager?.getCurrentTicketId()??null}getWidgetSessionId(){return this._conversationsManager?.getWidgetSessionId()??null}On(){var e;(e=this._conversationsManager)==null||e.setIdentity()}Ln(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.Ma=!1,this.Ra=!1,this.Gt=B(`[logs]`),this.Pa=[],this.Oa=0,this.La=0,this.Fa=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Ma=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t=e.logs?.captureConsoleLogs;!R(t)&&t&&(this.Ma=!0,this.loadIfEnabled())}reset(){this.Pa=[],this.ii&&=(clearTimeout(this.ii),void 0),this.Oa=0,this.La=0,this.Fa=!1}loadIfEnabled(){if(this.Ma&&!this.Ra){var e=T?.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,`logs`,(t=>{var n;t||(n=e.logs)==null||!n.initializeLogs?this.Gt.error(`Could not load logs script`,t):(e.logs.initializeLogs(this._instance),this.Ra=!0)})):this.Gt.error(br)}else this.Gt.error(`PostHog Extensions not found.`)}}captureLog(e){if(this._instance.is_capturing())if(e&&e.body){var t=this._instance.config.logs?.flushIntervalMs??3e3,n=this._instance.config.logs?.maxLogsPerInterval??1e3,r=Date.now();if(t>r-this.La||(this.La=r,this.Oa=0,this.Fa=!1),n>this.Oa){this.Oa++;var i=function(e,t){var{text:n,number:r}=zt[e.level||`info`]||Bt,i=String(Date.now())+`000000`,a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.currentUrl&&(a[`url.full`]=t.currentUrl),t.screenName&&(a[`screen.name`]=t.screenName),t.appState&&(a[`app.state`]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var o=A({},a,e.attributes||{}),s={timeUnixNano:i,observedTimeUnixNano:i,severityNumber:r,severityText:n,body:{stringValue:e.body},attributes:Ht(o)};return e.trace_id&&(s.traceId=e.trace_id),e.span_id&&(s.spanId=e.span_id),I(e.trace_flags)||(s.flags=e.trace_flags),s}(e,this.Aa());this.Pa.push({record:i}),(this._instance.config.logs?.maxBufferSize??100)>this.Pa.length?this.Na():this.flushLogs()}else this.Fa||=(this.Gt.warn(`captureLog dropping logs: exceeded `+n+` logs per `+t+`ms`),!0)}else this.Gt.warn(`captureLog requires a body`)}get logger(){return this.Da||={trace:(e,t)=>this.captureLog({body:e,level:`trace`,attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:`debug`,attributes:t}),info:(e,t)=>this.captureLog({body:e,level:`info`,attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:`warn`,attributes:t}),error:(e,t)=>this.captureLog({body:e,level:`error`,attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:`fatal`,attributes:t})},this.Da}flushLogs(e){if(this.ii&&=(clearTimeout(this.ii),void 0),this.Pa.length!==0){var t=this.Pa;this.Pa=[];var n=this._instance.config.logs,r=A({"service.name":n?.serviceName||`unknown_service`},n?.environment&&{"deployment.environment":n.environment},n?.serviceVersion&&{"service.version":n.serviceVersion},n?.resourceAttributes),i=function(e,t,n,r){return{resourceLogs:[{resource:{attributes:Ht(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}(t.map((e=>e.record)),r,D.LIB_NAME,D.LIB_VERSION),a=this._instance.requestRouter.endpointFor(`api`,`/i/v1/logs`)+`?token=`+encodeURIComponent(this._instance.config.token);this._instance.fn({method:`POST`,url:a,data:i,compression:`best-available`,batchKey:`logs`,transport:e})}}Na(){this.ii||=setTimeout((()=>{this.ii=void 0,this.flushLogs()}),this._instance.config.logs?.flushIntervalMs??3e3)}Aa(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n}if(T!=null&&(e=T.location)!=null&&e.href&&(t.currentUrl=T.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}});ds.__defaultExtensionClasses=A({},dc);var fc=function(){D.SDK_DIST_CHANNEL=`npm`;var e=Qo[as]=new ds;return function(){function e(){e.done||(e.done=!0,os=!1,V(Qo,(function(e){e._dom_loaded()})))}v!=null&&v.addEventListener?v.readyState===`complete`?e():zr(v,`DOMContentLoaded`,e,{capture:!1}):h&&z.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}(),pc=t(l()),mc={trace:null,debug:null,info:`info`,warn:`warn`,error:`error`},hc=e=>{let t={};for(let[n,r]of Object.entries(e))t[n]=r instanceof Error?{name:r.name,message:r.message,stack:r.stack}:r;return t},gc=(e,t,n)=>{let r=mc[e];if(!r)return;let i=fc.logger?.[r];if(i)try{i(t,n?hc(n):void 0)}catch{}},_c=e=>(t,n)=>{n===void 0?pc.default[e](t):pc.default[e](t,n),gc(e,t,n)},vc={trace:_c(`trace`),debug:_c(`debug`),info:_c(`info`),warn:_c(`warn`),error:_c(`error`)},yc=[d.type,f.type,p.type,`https://zup.fail/account-not-found`,`https://zup.fail/project-not-found`,`https://zup.fail/environment-not-found`],bc=`https://zup.fail/api-request-failed`,xc=[`failed to fetch`,`networkerror`,`network request failed`,`load failed`,`the network connection was lost`,`the internet connection appears to be offline`];function Sc(e){let t=e.toLowerCase();return xc.some(e=>t.includes(e))}function Cc(e){return e instanceof wc?e.type===bc:e instanceof TypeError?Sc(e.message):!1}var wc=class extends Error{type;status;detail;instance;traceId;constructor({title:e,type:t,status:n,detail:r,instance:i,traceId:a},o){super(e,o),this.name=`ZuploError`,this.type=t,this.status=n,this.detail=r,this.instance=i,this.traceId=a}},Tc=class extends Error{code;type;status;detail;instance;traceId;title;body;constructor(e,t){super(e,t),this.traceId=t?.traceId,this.name=`ZuploApiError`}async tryReadResponse(e){try{this.status=e.status;let t=await e.clone().text();if(t){let e=JSON.parse(t);this.body=e,`code`in e&&typeof e.code==`number`?this.code=e.code:`code`in e&&typeof e.code==`string`&&(this.code=Number(e.code)),`type`in e&&typeof e.type==`string`&&(this.type=e.type),`detail`in e&&typeof e.detail==`string`&&(this.detail=e.detail),`instance`in e&&typeof e.instance==`string`&&(this.instance=e.instance),`title`in e&&typeof e.title==`string`&&(this.title=e.title),`title`in e&&typeof e.title==`string`?this.message=e.title:`message`in e&&typeof e.message==`string`&&(this.message=e.message)}}catch(e){vc.debug(`Failed to parse error response body`,{error:e})}}setTraceId(e){this.traceId=e}};function Ec(e,t){if(e===void 0)throw Error(`Environment variable ${t} was undefined`);return e}var Dc=!1;Ec(`unused`,`VITE_AUTH0_DOMAIN`),Ec(`unused`,`VITE_AUTH0_CLIENT_ID`),Ec(`unused`,`VITE_GITHUB_CLIENT_ID`);var Oc=`/api`,kc=`openid profile email`,Ac=`https://api.zuplo.com/`,K=`/api`,jc=Ec(`https://cdn.zuplo.com`,`VITE_CDN_URL`),Mc=(void 0)?.trim()||`https://mcp-proxy.zuplo.io`,Nc=(void 0)?.trim()||`https://agent-z.zuplo-exp.workers.dev/agent-z/chat`,Pc=`agent-z-api-url-override`,Fc=`_assistantApiUrl`;function Ic(){if(typeof window>`u`)return!1;let{hostname:e}=window.location;return e===`localhost`||e===`127.0.0.1`||e.startsWith(`portal-`)&&e.endsWith(`.zuplosite.com`)||e.endsWith(`.vercel.app`)}function Lc(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`&&t.protocol!==`http:`)return null;let{hostname:n}=t;return n===`localhost`||n===`127.0.0.1`||n===`agent-z.zuplo-exp.workers.dev`||n.endsWith(`-agent-z.zuplo-exp.workers.dev`)?t.href:null}function Rc(){if(!Ic())return null;try{let e=new URLSearchParams(window.location.search);if(e.has(Fc)){let t=e.get(Fc)?.trim()??``;if(!t)return window.sessionStorage.removeItem(Pc),null;let n=Lc(t);if(n)return window.sessionStorage.setItem(Pc,n),n}let t=window.sessionStorage.getItem(Pc);return t?Lc(t):null}catch{return null}}var zc=Rc()??Nc;Ic()&&(window.setAssistantUrl=e=>{let t=e?.trim();if(!t){window.sessionStorage.removeItem(Pc),window.location.reload();return}let n=Lc(t);if(!n)throw Error(`setAssistantUrl: URL must be http(s) and point at the agent-z worker (…agent-z.zuplo-exp.workers.dev) or localhost`);window.sessionStorage.setItem(Pc,n),window.location.reload()});var Bc=[];for(let e=0;e<256;++e)Bc.push((e+256).toString(16).slice(1));function Vc(e,t=0){return(Bc[e[t+0]]+Bc[e[t+1]]+Bc[e[t+2]]+Bc[e[t+3]]+`-`+Bc[e[t+4]]+Bc[e[t+5]]+`-`+Bc[e[t+6]]+Bc[e[t+7]]+`-`+Bc[e[t+8]]+Bc[e[t+9]]+`-`+Bc[e[t+10]]+Bc[e[t+11]]+Bc[e[t+12]]+Bc[e[t+13]]+Bc[e[t+14]]+Bc[e[t+15]]).toLowerCase()}var Hc,Uc=new Uint8Array(16);function Wc(){if(!Hc){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Hc=crypto.getRandomValues.bind(crypto)}return Hc(Uc)}var Gc={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Kc(e,t,n){if(Gc.randomUUID&&!t&&!e)return Gc.randomUUID();e||={};let r=e.random??e.rng?.()??Wc();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Vc(r)}var qc,Jc=new Promise(e=>{qc=e});function Yc(e){qc(e)}function Xc(){return Jc}var Zc=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Qc=e=>e?Zc(e):Zc,q=t(o(),1),$c=e=>e;function el(e,t=$c){let n=q.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return q.useDebugValue(n),n}var tl=e=>{let t=Qc(e),n=e=>el(t,e);return Object.assign(n,t),n},nl=e=>e?tl(e):tl;function rl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function il(...e){return t=>{let n=!1,r=e.map(e=>{let r=rl(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():rl(e[t],null)}}}}function al(...e){return q.useCallback(il(...e),e)}var ol=r((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),sl=r(((e,t)=>{t.exports=ol()})),J=sl();function cl(e,t){let n=q.createContext(t),r=e=>{let{children:t,...r}=e,i=q.useMemo(()=>r,Object.values(r));return(0,J.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=q.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function ll(e,t=[]){let n=[];function r(t,r){let i=q.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=q.useMemo(()=>o,Object.values(o));return(0,J.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=q.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>q.createContext(e));return function(n){let r=n?.[e]||t;return q.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ul(i,...t)]}function ul(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return q.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function dl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function fl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function pl(...e){return t=>{let n=!1,r=e.map(e=>{let r=fl(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():fl(e[t],null)}}}}function ml(...e){return q.useCallback(pl(...e),e)}function hl(e){let t=q.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Sl(r)&&typeof El==`function`&&(r=El(r._payload)),q.Children.forEach(r,e=>{if(bl(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Sl(n)&&typeof El==`function`&&(n=El(n._payload)),a=_l(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=q.cloneElement(a,void 0,s):!o&&q.Children.count(r)===1&&q.isValidElement(r)&&(a=r);let c=a?yl(a):void 0,l=ml(n,c);if(!a){if(r||r===0)throw Error(o?Tl(e):wl(e));return r}let u=vl(i,a.props??{});return a.type!==q.Fragment&&(u.ref=n?l:c),q.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var gl=Symbol.for(`radix.slottable`),_l=(e,t)=>{if(`child`in e.props){let t=e.props.child;return q.isValidElement(t)?q.cloneElement(t,void 0,e.props.children(t.props.children)):null}return q.isValidElement(t)?t:null};function vl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function yl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function bl(e){return q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===gl}var xl=Symbol.for(`react.lazy`);function Sl(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===xl&&`_payload`in e&&Cl(e._payload)}function Cl(e){return typeof e==`object`&&!!e&&`then`in e}var wl=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Tl=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,El=q.use,Dl=t(c(),1),Ol=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=hl(`Primitive.${t}`),r=q.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,J.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function kl(e,t){e&&Dl.flushSync(()=>e.dispatchEvent(t))}function Al(e){let t=q.useRef(e);return q.useEffect(()=>{t.current=e}),q.useMemo(()=>((...e)=>t.current?.(...e)),[])}function jl(e,t=globalThis?.document){let n=Al(e);q.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Ml=`DismissableLayer`,Nl=`dismissableLayer.update`,Pl=`dismissableLayer.pointerDownOutside`,Fl=`dismissableLayer.focusOutside`,Il,Ll=q.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Rl=q.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=q.useContext(Ll),[u,d]=q.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=q.useState({}),m=ml(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Vl(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Hl(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return jl(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),q.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Il=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Ul(),()=>{n&&(l.layersWithOutsidePointerEventsDisabled.delete(u),l.layersWithOutsidePointerEventsDisabled.size===0&&(f.body.style.pointerEvents=Il))}},[u,f,n,l]),q.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Ul())},[u,l]),q.useEffect(()=>{let e=()=>p({});return document.addEventListener(Nl,e),()=>document.removeEventListener(Nl,e)},[]),(0,J.jsx)(Ol.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:dl(e.onFocusCapture,S.onFocusCapture),onBlurCapture:dl(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:dl(e.onPointerDownCapture,x.onPointerDownCapture)})});Rl.displayName=Ml;var zl=`DismissableLayerBranch`,Bl=q.forwardRef((e,t)=>{let n=q.useContext(Ll),r=q.useRef(null),i=ml(t,r);return q.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,J.jsx)(Ol.div,{...e,ref:i})});Bl.displayName=zl;function Vl(e,t=globalThis?.document){let n=Al(e),r=q.useRef(!1),i=q.useRef(()=>{});return q.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Wl(Pl,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Hl(e,t=globalThis?.document){let n=Al(e),r=q.useRef(!1);return q.useEffect(()=>{let e=e=>{e.target&&!r.current&&Wl(Fl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ul(){let e=new CustomEvent(Nl);document.dispatchEvent(e)}function Wl(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?kl(i,a):i.dispatchEvent(a)}var Gl=Rl,Kl=Bl,ql=globalThis?.document?q.useLayoutEffect:()=>{};function Jl(e){let t=q.useRef(e);return q.useEffect(()=>{t.current=e}),q.useMemo(()=>(...e)=>t.current?.(...e),[])}var Yl=q.useInsertionEffect||ql;function Xl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Zl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=q.useRef(e!==void 0);q.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,q.useCallback(t=>{if(s){let n=Ql(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Zl({defaultProp:e,onChange:t}){let[n,r]=q.useState(e),i=q.useRef(n),a=q.useRef(t);return Yl(()=>{a.current=t},[t]),q.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ql(e){return typeof e==`function`}var $l=function(e,t){return $l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},$l(e,t)};function eu(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);$l(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var tu=function(){return tu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},tu.apply(this,arguments)};function nu(e,t){this.v=e,this.k=t}function ru(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Y(e,t,n){return(t=function(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}(e,`string`);return typeof t==`symbol`?t:t+``}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function au(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?iu(Object(n),!0).forEach(function(t){Y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ou(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if(typeof e==`string`)return ru(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ru(e,t):void 0}}(e,t)||function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function su(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof nu;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}su.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},su.prototype.next=function(e){return this._invoke(`next`,e)},su.prototype.throw=function(e){return this._invoke(`throw`,e)},su.prototype.return=function(e){return this._invoke(`return`,e)};var cu=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},lu={},uu={};Object.defineProperty(uu,`__esModule`,{value:!0});var du=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);r===void 0?n===void 0?e.locked.set(t,[]):e.locked.set(t,[n]):n!==void 0&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(n!==void 0&&n.length!==0){var r=n.pop();e.locked.set(t,n),r!==void 0&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return e.instance===void 0&&(e.instance=new e),e.instance},e}();uu.default=function(){return du.getInstance()};var fu=cu&&cu.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,s)}c((r=r.apply(e,t||[])).next())})},pu=cu&&cu.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},mu=cu;Object.defineProperty(lu,`__esModule`,{value:!0});var hu=uu,gu=`browser-tabs-lock-key`,_u={key:function(e){return fu(mu,void 0,void 0,function(){return pu(this,function(e){throw Error(`Unsupported`)})})},getItem:function(e){return fu(mu,void 0,void 0,function(){return pu(this,function(e){throw Error(`Unsupported`)})})},clear:function(){return fu(mu,void 0,void 0,function(){return pu(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return fu(mu,void 0,void 0,function(){return pu(this,function(e){throw Error(`Unsupported`)})})},setItem:function(e,t){return fu(mu,void 0,void 0,function(){return pu(this,function(e){throw Error(`Unsupported`)})})},keySync:function(e){return window.localStorage.key(e)},getItemSync:function(e){return window.localStorage.getItem(e)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(e){return window.localStorage.removeItem(e)},setItemSync:function(e,t){return window.localStorage.setItem(e,t)}};function vu(e){return new Promise(function(t){return setTimeout(t,e)})}function yu(e){for(var t=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz`,n=``,r=0;r<e;r++)n+=t[Math.floor(61*Math.random())];return n}lu.default=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+yu(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,e.waiters===void 0&&(e.waiters=[])}return e.prototype.acquireLock=function(t,n){return n===void 0&&(n=5e3),fu(this,void 0,void 0,function(){var r,i,a,o,s,c,l;return pu(this,function(u){switch(u.label){case 0:r=Date.now()+yu(4),i=Date.now()+n,a=gu+`-`+t,o=this.storageHandler===void 0?_u:this.storageHandler,u.label=1;case 1:return Date.now()<i?[4,vu(30)]:[3,8];case 2:return u.sent(),o.getItemSync(a)===null?(s=this.id+`-`+t+`-`+r,[4,vu(Math.floor(25*Math.random()))]):[3,5];case 3:return u.sent(),o.setItemSync(a,JSON.stringify({id:this.id,iat:r,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,vu(30)];case 4:return u.sent(),(c=o.getItemSync(a))!==null&&(l=JSON.parse(c)).id===this.id&&l.iat===r?(this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(a,r),[2,!0]):[3,7];case 5:return e.lockCorrector(this.storageHandler===void 0?_u:this.storageHandler),[4,this.waitForSomethingToChange(i)];case 6:u.sent(),u.label=7;case 7:return r=Date.now()+yu(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return fu(this,void 0,void 0,function(){var n=this;return pu(this,function(r){return setTimeout(function(){return fu(n,void 0,void 0,function(){var n,r,i;return pu(this,function(a){switch(a.label){case 0:return[4,hu.default().lock(t)];case 1:return a.sent(),this.acquiredIatSet.has(t)?(n=this.storageHandler===void 0?_u:this.storageHandler,(r=n.getItemSync(e))===null?(hu.default().unlock(t),[2]):((i=JSON.parse(r)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(i)),hu.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(hu.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return fu(this,void 0,void 0,function(){return pu(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var r=!1,i=Date.now(),a=!1;function o(){if(a||=(window.removeEventListener(`storage`,o),e.removeFromWaiting(o),clearTimeout(s),!0),!r){r=!0;var t=50-(Date.now()-i);t>0?setTimeout(n,t):n(null)}}window.addEventListener(`storage`,o),e.addToWaiting(o);var s=setTimeout(o,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),e.waiters!==void 0&&e.waiters.push(t)},e.removeFromWaiting=function(t){e.waiters!==void 0&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){e.waiters!==void 0&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return fu(this,void 0,void 0,function(){return pu(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return fu(this,void 0,void 0,function(){var n,r,i,a;return pu(this,function(o){switch(o.label){case 0:return n=this.storageHandler===void 0?_u:this.storageHandler,r=gu+`-`+t,(i=n.getItemSync(r))===null?[2]:(a=JSON.parse(i)).id===this.id?[4,hu.default().lock(a.iat)]:[3,2];case 1:o.sent(),this.acquiredIatSet.delete(a.iat),n.removeItemSync(r),hu.default().unlock(a.iat),e.notifyWaiters(),o.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,i=[],a=0;;){var o=r.keySync(a);if(o===null)break;i.push(o),a++}for(var s=!1,c=0;c<i.length;c++){var l=i[c];if(l.includes(gu)){var u=r.getItemSync(l);if(u!==null){var d=JSON.parse(u);(d.timeRefreshed===void 0&&d.timeAcquired<n||d.timeRefreshed!==void 0&&d.timeRefreshed<n)&&(r.removeItemSync(l),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}(),new TextEncoder,new TextDecoder,Uint8Array.prototype.toBase64;var bu=cu&&cu.__assign||function(){return bu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},bu.apply(this,arguments)},xu;(function(e){e.Code=`code`,e.ConnectCode=`connect_code`})(xu||={});var Su;(function(e){e.Bearer=`Bearer`,e.DPoP=`DPoP`})(Su||={});var Cu,wu,Tu;(typeof navigator>`u`||(Cu=navigator.userAgent)==null||(wu=Cu.startsWith)==null||!wu.call(Cu,`Mozilla/5.0 `))&&(Tu=`oauth4webapi/v3.8.6`);function Eu(e,t){if(e==null)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch{return!1}}var Du=`ERR_INVALID_ARG_VALUE`,Ou=`ERR_INVALID_ARG_TYPE`;function ku(e,t,n){let r=TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}var Au=Symbol(),ju=Symbol(),Mu=Symbol(),Nu=Symbol(),Pu=Symbol(),Fu=new TextEncoder,Iu=new TextDecoder;function Lu(e){return typeof e==`string`?Fu.encode(e):Iu.decode(e)}var Ru,zu;if(Uint8Array.prototype.toBase64)Ru=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:`base64url`,omitPadding:!0}));else{let e=32768;Ru=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));let n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join(``)).replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`)}}function Bu(e){return typeof e==`string`?zu(e):Ru(e)}zu=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:`base64url`})}catch(e){throw ku(`The input to be decoded is not correctly encoded.`,Du,e)}}:e=>{try{let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`).replace(/\s/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw ku(`The input to be decoded is not correctly encoded.`,Du,e)}};var Vu=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`code`,void 0),this.name=this.constructor.name,this.code=Fd,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}},Hu=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`code`,void 0),this.name=this.constructor.name,t!=null&&t.code&&(this.code=t?.code),(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}};function X(e,t,n){return new Hu(e,{code:t,cause:n})}function Uu(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wu(e){Eu(e,Headers)&&(e=Object.fromEntries(e.entries()));let t=new Headers(e??{});if(Tu&&!t.has(`user-agent`)&&t.set(`user-agent`,Tu),t.has(`authorization`))throw ku(`"options.headers" must not include the "authorization" header name`,Du);return t}function Gu(e,t){if(t!==void 0){if(typeof t==`function`&&(t=t(e.href)),!(t instanceof AbortSignal))throw ku(`"options.signal" must return or be an instance of AbortSignal`,Ou);return t}}function Ku(e,t,n,r,i){try{if(typeof e!=`number`||!Number.isFinite(e))throw ku(`${n} must be a number`,Ou,i);if(e>0)return;if(t){if(e!==0)throw ku(`${n} must be a non-negative number`,Du,i);return}throw ku(`${n} must be a positive number`,Du,i)}catch(e){throw r?X(e.message,r,i):e}}function qu(e,t,n,r){try{if(typeof e!=`string`)throw ku(`${t} must be a string`,Ou,r);if(e.length===0)throw ku(`${t} must not be empty`,Du,r)}catch(e){throw n?X(e.message,n,r):e}}function Ju(e){(function(e,t){if(_d(e)!==t)throw function(e){let t=`"response" content-type must be `;var n=[...arguments].slice(1);if(n.length>2){let e=n.pop();t+=`${n.join(`, `)}, or ${e}`}else n.length===2?t+=`${n[0]} or ${n[1]}`:t+=n[0];return X(t,Rd,e)}(e,t)})(e,`application/json`)}function Yu(e){let t=e?.[ju];return typeof t==`number`&&Number.isFinite(t)?t:0}function Xu(e){let t=e?.[Mu];return typeof t==`number`&&Number.isFinite(t)&&Math.sign(t)!==-1?t:30}function Zu(){return Math.floor(Date.now()/1e3)}function Qu(e){if(typeof e!=`object`||!e)throw ku(`"as" must be an object`,Ou);qu(e.issuer,`"as.issuer"`)}function $u(e){if(typeof e!=`object`||!e)throw ku(`"client" must be an object`,Ou);qu(e.client_id,`"client.client_id"`)}function ed(e){return qu(e,`"clientSecret"`),(t,n,r,i)=>{r.set(`client_id`,n.client_id),r.set(`client_secret`,e)}}var td=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch{return null}};function nd(e,t){if(t&&e.protocol!==`https:`)throw X(`only requests to HTTPS are allowed`,Bd,e);if(e.protocol!==`https:`&&e.protocol!==`http:`)throw X(`only HTTP and HTTPS requests are allowed`,Vd,e)}function rd(e,t,n,r){let i;if(typeof e!=`string`||!(i=td(e)))throw X(`authorization server metadata does not contain a valid ${n?`"as.mtls_endpoint_aliases.${t}"`:`"as.${t}"`}`,e===void 0?Gd:Kd,{attribute:n?`mtls_endpoint_aliases.${t}`:t});return nd(i,r),i}function id(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?rd(e.mtls_endpoint_aliases[t],t,n,r):rd(e[t],t,n,r)}var ad=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`cause`,void 0),Y(this,`code`,void 0),Y(this,`error`,void 0),Y(this,`status`,void 0),Y(this,`error_description`,void 0),Y(this,`response`,void 0),this.name=this.constructor.name,this.code=Pd,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,`response`,{enumerable:!1,value:t.response}),(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}},od=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`cause`,void 0),Y(this,`code`,void 0),Y(this,`error`,void 0),Y(this,`error_description`,void 0),this.name=this.constructor.name,this.code=Id,this.cause=t.cause,this.error=t.cause.get(`error`),this.error_description=t.cause.get(`error_description`)??void 0,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}},sd=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`cause`,void 0),Y(this,`code`,void 0),Y(this,`response`,void 0),Y(this,`status`,void 0),this.name=this.constructor.name,this.code=Nd,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,`response`,{enumerable:!1}),(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}},cd="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",ld=`(`+cd+`)\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"`,ud=`(`+cd+")\\s*=\\s*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)",dd=RegExp(`^[,\\s]*(`+cd+`)`),fd=RegExp(`^[,\\s]*`+ld+`[,\\s]*(.*)`),pd=RegExp(`^[,\\s]*`+ud+`[,\\s]*(.*)`),md=RegExp(`^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)`);async function hd(e,t,n){if(e.status!==t){let t;throw function(e){let t;if(t=function(e){if(!Eu(e,Response))throw ku(`"response" must be an instance of Response`,Ou);let t=e.headers.get(`www-authenticate`);if(t===null)return;let n=[],r=t;for(;r;){let e=r.match(dd),t=e?.[1].toLowerCase();if(!t)return;let s=r.substring(e[0].length);if(s&&!s.match(/^[\s,]/))return;let c=s.match(/^\s+(.*)$/),l=!!c;r=c?c[1]:void 0;let u={},d;if(l)for(;r;){let t,n;if(e=r.match(fd)){var i=ou(e,4);if(t=i[1],n=i[2],r=i[3],n.includes(`\\`))try{n=JSON.parse(`"${n}"`)}catch{}u[t.toLowerCase()]=n}else{if(!(e=r.match(pd))){if(e=r.match(md)){if(Object.keys(u).length)break;var a=ou(e,3);d=a[1],r=a[2];break}return}var o=ou(e,4);t=o[1],n=o[2],r=o[3],u[t.toLowerCase()]=n}}else r=s||void 0;let f={scheme:t,parameters:u};d&&(f.token68=d),n.push(f)}return n.length?n:void 0}(e))throw new sd(`server responded with a challenge in the WWW-Authenticate HTTP Header`,{cause:t,response:e})}(e),(t=await async function(e){if(e.status>399&&e.status<500){qd(e),Ju(e);try{let t=await e.clone().json();if(Uu(t)&&typeof t.error==`string`&&t.error.length)return t}catch{}}}(e))?(await e.body?.cancel(),new ad(`server responded with an error in the response body`,{cause:t,response:e})):X(`"response" is not a conform ${n} response (unexpected HTTP status code)`,zd,e)}}function gd(e){if(!Ed.has(e))throw ku(`"options.DPoP" is not a valid DPoPHandle`,Du)}function _d(e){return e.headers.get(`content-type`)?.split(`;`)[0]}async function vd(e,t,n,r,i,a,o){return await n(e,t,i,a),a.set(`content-type`,`application/x-www-form-urlencoded;charset=UTF-8`),(o?.[Nu]||fetch)(r.href,{body:i,headers:Object.fromEntries(a.entries()),method:`POST`,redirect:`manual`,signal:Gu(r,o?.signal)})}async function yd(e,t,n,r,i,a){var o;let s=id(e,`token_endpoint`,t.use_mtls_endpoint_aliases,!0!==a?.[Au]);i.set(`grant_type`,r);let c=Wu(a?.headers);c.set(`accept`,`application/json`),a?.DPoP!==void 0&&(gd(a.DPoP),await a.DPoP.addProof(s,c,`POST`));let l=await vd(e,t,n,s,i,c,a);return a==null||(o=a.DPoP)==null||o.cacheNonce(l,s),l}var bd=new WeakMap,xd=new WeakMap;function Sd(e){if(!e.id_token)return;let t=bd.get(e);if(!t)throw ku(`"ref" was already garbage collected or did not resolve from the proper sources`,Du);return t}async function Cd(e,t,n,r,i,a){if(Qu(e),$u(t),!Eu(n,Response))throw ku(`"response" must be an instance of Response`,Ou);await hd(n,200,`Token Endpoint`),qd(n);let o=await ef(n);if(qu(o.access_token,`"response" body "access_token" property`,Z,{body:o}),qu(o.token_type,`"response" body "token_type" property`,Z,{body:o}),o.token_type=o.token_type.toLowerCase(),o.expires_in!==void 0){let e=typeof o.expires_in==`number`?o.expires_in:parseFloat(o.expires_in);Ku(e,!0,`"response" body "expires_in" property`,Z,{body:o}),o.expires_in=e}if(o.refresh_token!==void 0&&qu(o.refresh_token,`"response" body "refresh_token" property`,Z,{body:o}),o.scope!==void 0&&typeof o.scope!=`string`)throw X(`"response" body "scope" property must be a string`,Z,{body:o});if(o.id_token!==void 0){qu(o.id_token,`"response" body "id_token" property`,Z,{body:o});let a=[`aud`,`exp`,`iat`,`iss`,`sub`];!0===t.require_auth_time&&a.push(`auth_time`),t.default_max_age!==void 0&&(Ku(t.default_max_age,!0,`"client.default_max_age"`),a.push(`auth_time`)),r!=null&&r.length&&a.push(...r);let s=await async function(e,t,n,r,i){let a,o,s=e.split(`.`),c=s[0],l=s[1],u=s.length;if(u===5){if(i===void 0)throw new Vu(`JWE decryption is not configured`,{cause:e});var d=(e=await i(e)).split(`.`);c=d[0],l=d[1],u=d.length}if(u!==3)throw X(`Invalid JWT`,Z,e);try{a=JSON.parse(Lu(Bu(c)))}catch(e){throw X(`failed to parse JWT Header body as base64url encoded JSON`,Ld,e)}if(!Uu(a))throw X(`JWT Header must be a top level object`,Z,e);if(t(a),a.crit!==void 0)throw new Vu(`no JWT "crit" header parameter extensions are supported`,{cause:{header:a}});try{o=JSON.parse(Lu(Bu(l)))}catch(e){throw X(`failed to parse JWT Payload body as base64url encoded JSON`,Ld,e)}if(!Uu(o))throw X(`JWT Payload must be a top level object`,Z,e);let f=Zu()+n;if(o.exp!==void 0){if(typeof o.exp!=`number`)throw X(`unexpected JWT "exp" (expiration time) claim type`,Z,{claims:o});if(o.exp<=f-r)throw X(`unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp`,Hd,{claims:o,now:f,tolerance:r,claim:`exp`})}if(o.iat!==void 0&&typeof o.iat!=`number`)throw X(`unexpected JWT "iat" (issued at) claim type`,Z,{claims:o});if(o.iss!==void 0&&typeof o.iss!=`string`)throw X(`unexpected JWT "iss" (issuer) claim type`,Z,{claims:o});if(o.nbf!==void 0){if(typeof o.nbf!=`number`)throw X(`unexpected JWT "nbf" (not before) claim type`,Z,{claims:o});if(o.nbf>f+r)throw X(`unexpected JWT "nbf" (not before) claim value`,Hd,{claims:o,now:f,tolerance:r,claim:`nbf`})}if(o.aud!==void 0&&typeof o.aud!=`string`&&!Array.isArray(o.aud))throw X(`unexpected JWT "aud" (audience) claim type`,Z,{claims:o});return{header:a,claims:o,jwt:e}}(o.id_token,Yd.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,`RS256`),Yu(t),Xu(t),i).then(kd.bind(void 0,a)).then(Td.bind(void 0,e)).then(wd.bind(void 0,t.client_id)),c=s.claims,l=s.jwt;if(Array.isArray(c.aud)&&c.aud.length!==1){if(c.azp===void 0)throw X(`ID Token "aud" (audience) claim includes additional untrusted audiences`,Ud,{claims:c,claim:`aud`});if(c.azp!==t.client_id)throw X(`unexpected ID Token "azp" (authorized party) claim value`,Ud,{expected:t.client_id,claims:c,claim:`azp`})}c.auth_time!==void 0&&Ku(c.auth_time,!0,`ID Token "auth_time" (authentication time)`,Z,{claims:c}),xd.set(n,l),bd.set(o,c)}if(a?.[o.token_type]!==void 0)a[o.token_type](n,o);else if(o.token_type!==`dpop`&&o.token_type!==`bearer`)throw new Vu("unsupported `token_type` value",{cause:{body:o}});return o}function wd(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw X(`unexpected JWT "aud" (audience) claim value`,Ud,{expected:e,claims:t.claims,claim:`aud`})}else if(t.claims.aud!==e)throw X(`unexpected JWT "aud" (audience) claim value`,Ud,{expected:e,claims:t.claims,claim:`aud`});return t}function Td(e,t){let n=e[tf]?.call(e,t)??e.issuer;if(t.claims.iss!==n)throw X(`unexpected JWT "iss" (issuer) claim value`,Ud,{expected:n,claims:t.claims,claim:`iss`});return t}var Ed=new WeakSet,Dd=Symbol(),Od={aud:`audience`,c_hash:`code hash`,client_id:`client id`,exp:`expiration time`,iat:`issued at`,iss:`issuer`,jti:`jwt id`,nonce:`nonce`,s_hash:`state hash`,sub:`subject`,ath:`access token hash`,htm:`http method`,htu:`http uri`,cnf:`confirmation`,auth_time:`authentication time`};function kd(e,t){for(let n of e)if(t.claims[n]===void 0)throw X(`JWT "${n}" (${Od[n]}) claim missing`,Z,{claims:t.claims});return t}var Ad=Symbol(),jd=Symbol();async function Md(e,t,n,r){return typeof r?.expectedNonce==`string`||typeof r?.maxAge==`number`||r!=null&&r.requireIdToken?async function(e,t,n,r,i,a,o){let s=[];switch(r){case void 0:r=Ad;break;case Ad:break;default:qu(r,`"expectedNonce" argument`),s.push(`nonce`)}switch(i??=t.default_max_age,i){case void 0:i=jd;break;case jd:break;default:Ku(i,!0,`"maxAge" argument`),s.push(`auth_time`)}let c=await Cd(e,t,n,s,a,o);qu(c.id_token,`"response" body "id_token" property`,Z,{body:c});let l=Sd(c);if(i!==jd){let e=Zu()+Yu(t),n=Xu(t);if(l.auth_time+i<e-n)throw X(`too much time has elapsed since the last End-User authentication`,Hd,{claims:l,now:e,tolerance:n,claim:`auth_time`})}if(r===Ad){if(l.nonce!==void 0)throw X(`unexpected ID Token "nonce" claim value`,Ud,{expected:void 0,claims:l,claim:`nonce`})}else if(l.nonce!==r)throw X(`unexpected ID Token "nonce" claim value`,Ud,{expected:r,claims:l,claim:`nonce`});return c}(e,t,n,r.expectedNonce,r.maxAge,r[Pu],r.recognizedTokenTypes):async function(e,t,n,r,i){let a=await Cd(e,t,n,void 0,r,i),o=Sd(a);if(o){if(t.default_max_age!==void 0){Ku(t.default_max_age,!0,`"client.default_max_age"`);let e=Zu()+Yu(t),n=Xu(t);if(o.auth_time+t.default_max_age<e-n)throw X(`too much time has elapsed since the last End-User authentication`,Hd,{claims:o,now:e,tolerance:n,claim:`auth_time`})}if(o.nonce!==void 0)throw X(`unexpected ID Token "nonce" claim value`,Ud,{expected:void 0,claims:o,claim:`nonce`})}return a}(e,t,n,r?.[Pu],r?.recognizedTokenTypes)}var Nd=`OAUTH_WWW_AUTHENTICATE_CHALLENGE`,Pd=`OAUTH_RESPONSE_BODY_ERROR`,Fd=`OAUTH_UNSUPPORTED_OPERATION`,Id=`OAUTH_AUTHORIZATION_RESPONSE_ERROR`,Ld=`OAUTH_PARSE_ERROR`,Z=`OAUTH_INVALID_RESPONSE`,Rd=`OAUTH_RESPONSE_IS_NOT_JSON`,zd=`OAUTH_RESPONSE_IS_NOT_CONFORM`,Bd=`OAUTH_HTTP_REQUEST_FORBIDDEN`,Vd=`OAUTH_REQUEST_PROTOCOL_FORBIDDEN`,Hd=`OAUTH_JWT_TIMESTAMP_CHECK_FAILED`,Ud=`OAUTH_JWT_CLAIM_COMPARISON_FAILED`,Wd=`OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED`,Gd=`OAUTH_MISSING_SERVER_METADATA`,Kd=`OAUTH_INVALID_SERVER_METADATA`;function qd(e){if(e.bodyUsed)throw ku(`"response" body has been used already`,Du)}async function Jd(e){if(e.method!==`POST`)throw ku(`form_post responses are expected to use the POST method`,Du,{cause:e});if(_d(e)!==`application/x-www-form-urlencoded`)throw ku(`form_post responses are expected to use the application/x-www-form-urlencoded content-type`,Du,{cause:e});return async function(e){if(e.bodyUsed)throw ku(`form_post Request instances must contain a readable body`,Du,{cause:e});return e.text()}(e)}function Yd(e,t,n,r){if(e===void 0)if(Array.isArray(t)){if(!t.includes(r.alg))throw X(`unexpected JWT "alg" header parameter`,Z,{header:r,expected:t,reason:`authorization server metadata`})}else{if(n===void 0)throw X(`missing client or server configuration to verify used JWT "alg" header parameter`,void 0,{client:e,issuer:t,fallback:n});if(typeof n==`string`?r.alg!==n:typeof n==`function`?!n(r.alg):!n.includes(r.alg))throw X(`unexpected JWT "alg" header parameter`,Z,{header:r,expected:n,reason:`default value`})}else if(typeof e==`string`?r.alg!==e:!e.includes(r.alg))throw X(`unexpected JWT "alg" header parameter`,Z,{header:r,expected:e,reason:`client configuration`})}function Xd(e,t){let n=e.getAll(t),r=n[0];if(n.length>1)throw X(`"${t}" parameter must be provided only once`,Z);return r}var Zd=Symbol(),Qd=Symbol();function $d(e,t,n,r){if(Qu(e),$u(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw ku(`"parameters" must be an instance of URLSearchParams, or URL`,Ou);if(Xd(n,`response`))throw X(`"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()`,Z,{parameters:n});let i=Xd(n,`iss`),a=Xd(n,`state`);if(!i&&e.authorization_response_iss_parameter_supported)throw X(`response parameter "iss" (issuer) missing`,Z,{parameters:n});if(i&&i!==e.issuer)throw X(`unexpected "iss" (issuer) response parameter value`,Z,{expected:e.issuer,parameters:n});switch(r){case void 0:case Qd:if(a!==void 0)throw X(`unexpected "state" response parameter encountered`,Z,{expected:void 0,parameters:n});break;case Zd:break;default:if(qu(r,`"expectedState" argument`),a!==r)throw X(a===void 0?`response parameter "state" missing`:`unexpected "state" response parameter value`,Z,{expected:r,parameters:n})}if(Xd(n,`error`))throw new od(`authorization response from the server is an error`,{cause:n});let o=Xd(n,`id_token`),s=Xd(n,`token`);if(o!==void 0||s!==void 0)throw new Vu(`implicit and hybrid flows are not supported`);return c=new URLSearchParams(n),Ed.add(c),c;var c}async function ef(e){let t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ju;try{t=await e.json()}catch(t){throw n(e),X(`failed to parse "response" body as JSON`,Ld,t)}if(!Uu(t))throw X(`"response" body must be a top level object`,Z,{body:t});return t}var tf=Symbol();new TextEncoder,new TextDecoder;var nf=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`code`,`ERR_JOSE_GENERIC`),this.name=this.constructor.name,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}};Y(nf,`code`,`ERR_JOSE_GENERIC`),Y(class extends nf{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`unspecified`,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`unspecified`;super(e,{cause:{claim:n,reason:r,payload:t}}),Y(this,`code`,`ERR_JWT_CLAIM_VALIDATION_FAILED`),Y(this,`claim`,void 0),Y(this,`reason`,void 0),Y(this,`payload`,void 0),this.claim=n,this.reason=r,this.payload=t}},`code`,`ERR_JWT_CLAIM_VALIDATION_FAILED`),Y(class extends nf{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`unspecified`,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`unspecified`;super(e,{cause:{claim:n,reason:r,payload:t}}),Y(this,`code`,`ERR_JWT_EXPIRED`),Y(this,`claim`,void 0),Y(this,`reason`,void 0),Y(this,`payload`,void 0),this.claim=n,this.reason=r,this.payload=t}},`code`,`ERR_JWT_EXPIRED`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JOSE_ALG_NOT_ALLOWED`)}},`code`,`ERR_JOSE_ALG_NOT_ALLOWED`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JOSE_NOT_SUPPORTED`)}},`code`,`ERR_JOSE_NOT_SUPPORTED`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`decryption operation failed`,arguments.length>1?arguments[1]:void 0),Y(this,`code`,`ERR_JWE_DECRYPTION_FAILED`)}},`code`,`ERR_JWE_DECRYPTION_FAILED`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWE_INVALID`)}},`code`,`ERR_JWE_INVALID`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWS_INVALID`)}},`code`,`ERR_JWS_INVALID`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWT_INVALID`)}},`code`,`ERR_JWT_INVALID`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWK_INVALID`)}},`code`,`ERR_JWK_INVALID`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWKS_INVALID`)}},`code`,`ERR_JWKS_INVALID`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`no applicable key found in the JSON Web Key Set`,arguments.length>1?arguments[1]:void 0),Y(this,`code`,`ERR_JWKS_NO_MATCHING_KEY`)}},`code`,`ERR_JWKS_NO_MATCHING_KEY`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`multiple matching keys found in the JSON Web Key Set`,arguments.length>1?arguments[1]:void 0),Y(this,Symbol.asyncIterator,void 0),Y(this,`code`,`ERR_JWKS_MULTIPLE_MATCHING_KEYS`)}},`code`,`ERR_JWKS_MULTIPLE_MATCHING_KEYS`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`request timed out`,arguments.length>1?arguments[1]:void 0),Y(this,`code`,`ERR_JWKS_TIMEOUT`)}},`code`,`ERR_JWKS_TIMEOUT`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`signature verification failed`,arguments.length>1?arguments[1]:void 0),Y(this,`code`,`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`)}},`code`,`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`);var rf,af,of,sf;(typeof navigator>`u`||(rf=navigator.userAgent)==null||(af=rf.startsWith)==null||!af.call(rf,`Mozilla/5.0 `))&&(sf=`openid-client/v6.8.4`,of={"user-agent":sf});var cf=e=>lf.get(e),lf,uf;function df(e){return e===void 0?(uf||=new WeakMap,(e,t,n,r)=>{let i;return(i=uf.get(t))||(function(e,t){if(typeof e!=`string`)throw hf(`${t} must be a string`,mf);if(e.length===0)throw hf(`${t} must not be empty`,pf)}(t.client_secret,`"metadata.client_secret"`),i=ed(t.client_secret),uf.set(t,i)),i(e,t,n,r)}):ed(e)}var ff=Nu,pf=`ERR_INVALID_ARG_VALUE`,mf=`ERR_INVALID_ARG_TYPE`;function hf(e,t,n){let r=TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}var gf=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`code`,void 0),this.name=this.constructor.name,this.code=t?.code,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}};function _f(e,t,n){return new gf(e,{cause:t,code:n})}function vf(e){if(e instanceof TypeError||e instanceof gf||e instanceof ad||e instanceof od||e instanceof sd)throw e;if(e instanceof Hu)switch(e.code){case Bd:throw _f(`only requests to HTTPS are allowed`,e,e.code);case Vd:throw _f(`only requests to HTTP or HTTPS are allowed`,e,e.code);case zd:throw _f(`unexpected HTTP response status code`,e.cause,e.code);case Rd:throw _f(`unexpected response content-type`,e.cause,e.code);case Ld:throw _f(`parsing error occured`,e,e.code);case Z:throw _f(`invalid response encountered`,e,e.code);case Ud:throw _f(`unexpected JWT claim value encountered`,e,e.code);case Wd:throw _f(`unexpected JSON attribute value encountered`,e,e.code);case Hd:throw _f(`JWT timestamp claim value failed validation`,e,e.code);default:throw _f(e.message,e,e.code)}if(e instanceof Vu)throw _f(`unsupported operation`,e,e.code);if(e instanceof DOMException)switch(e.name){case`OperationError`:throw _f(`runtime operation error`,e,Fd);case`NotSupportedError`:throw _f(`runtime unsupported operation`,e,Fd);case`TimeoutError`:throw _f(`operation timed out`,e,`OAUTH_TIMEOUT`);case`AbortError`:throw _f(`operation aborted`,e,`OAUTH_ABORT`)}throw new gf(`something went wrong`,{cause:e})}new TextDecoder;var yf=Symbol(),bf=class{constructor(e,t,n,r){if(typeof t!=`string`||!t.length)throw hf(`"clientId" must be a non-empty string`,mf);if(typeof n==`string`&&(n={client_secret:n}),n?.client_id!==void 0&&t!==n.client_id)throw hf(`"clientId" and "metadata.client_id" must be the same`,pf);let i=au(au({},structuredClone(n)),{},{client_id:t}),a;i[ju]=n?.[ju]??0,i[Mu]=n?.[Mu]??30,a=r||(typeof i.client_secret==`string`&&i.client_secret.length?df(i.client_secret):(e,t,n,r)=>{n.set(`client_id`,t.client_id)});let o=Object.freeze(i),s=structuredClone(e);yf in e&&(s[tf]=t=>{let n=t.claims.tid;return e.issuer.replace(`{tenantid}`,n)});let c=Object.freeze(s);lf||=new WeakMap,lf.set(this,{__proto__:null,as:c,c:o,auth:a,tlsOnly:!0,jwksCache:{}})}serverMetadata(){let e=structuredClone(cf(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`S256`;return!0===e.code_challenge_methods_supported?.includes(t)}}}}(e))}(e),e}clientMetadata(){return structuredClone(cf(this).c)}get timeout(){return cf(this).timeout}set timeout(e){cf(this).timeout=e}get[ff](){return cf(this).fetch}set[ff](e){cf(this).fetch=e}};function xf(e){Object.defineProperties(e,function(e){let t;if(e.expires_in!==void 0){let n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){let e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return Sd(this)}catch{return}}}}}(e))}async function Sf(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0&&arguments[3],i=e.headers.get(`retry-after`)?.trim();if(i===void 0)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{let e=new Date(i);if(Number.isFinite(e.getTime())){let t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(r&&!Number.isFinite(a))throw new Hu(`invalid Retry-After header value`,{cause:e});a>t&&await Cf(a-t,n)}function Cf(e,t){return new Promise((n,r)=>{let i=e=>{try{t.throwIfAborted()}catch(e){r(e);return}if(e<=0)return void n();let a=Math.min(e,5);setTimeout(()=>i(e-a),1e3*a)};i(e)})}async function wf(e,t,n,r){Af(e),n=new URLSearchParams(n);let i=t.interval??5,a=r?.signal??AbortSignal.timeout(1e3*t.expires_in);try{await Cf(i,a)}catch(e){vf(e)}let o=cf(e),s=o.as,c=o.c,l=o.auth,u=o.fetch,d=o.tlsOnly,f=o.nonRepudiation,p=o.timeout,m=o.decrypt,h=(i,o)=>wf(e,au(au({},t),{},{interval:i}),n,au(au({},r),{},{signal:a,flag:o})),g=function(e,t){let n=jf(t);if(!n)return{signal:e,cleanup(){}};let r=new AbortController,i=e=>{let t=e.target;r.abort(t.reason)};return e.aborted?r.abort(e.reason):n.aborted?r.abort(n.reason):(e.addEventListener(`abort`,i,{once:!0}),n.addEventListener(`abort`,i,{once:!0})),{signal:r.signal,cleanup(){e.removeEventListener(`abort`,i),n.removeEventListener(`abort`,i)}}}(a,p),_=await async function(e,t,n,r,i){Qu(e),$u(t),qu(r,`"authReqId"`);let a=new URLSearchParams(i?.additionalParameters);return a.set(`auth_req_id`,r),yd(e,t,n,`urn:openid:params:grant-type:ciba`,a,i)}(s,c,l,t.auth_req_id,{[Nu]:u,[Au]:!d,additionalParameters:n,DPoP:r?.DPoP,headers:new Headers(of),signal:g.signal}).catch(vf).finally(g.cleanup);if(_.status===503&&_.headers.has(`retry-after`))return await Sf(_,i,a,!0),await _.body?.cancel(),h(i);let v=async function(e,t,n,r){return Cd(e,t,n,void 0,r?.[Pu],r?.recognizedTokenTypes)}(s,c,_,{[Pu]:m}),y;try{y=await v}catch(e){if(Mf(e,r))return h(i,Nf);if(e instanceof ad)switch(e.error){case`slow_down`:i+=5;case`authorization_pending`:return await Sf(e.response,i,a),h(i)}vf(e)}return y.id_token&&await f?.(_),xf(y),y}async function Tf(e,t,n,r,i){if(Af(e),!(i?.flag===Nf||t instanceof URL||function(e,t){try{return Object.getPrototypeOf(e)[Symbol.toStringTag]===t}catch{return!1}}(t,`Request`)))throw hf(`"currentUrl" must be an instance of URL, or Request`,mf);let a,o,s=cf(e),c=s.as,l=s.c,u=s.auth,d=s.fetch,f=s.tlsOnly,p=s.jarm,m=s.hybrid,h=s.nonRepudiation,g=s.timeout,_=s.decrypt,v=s.implicit;if(i?.flag===Nf)a=i.authResponse,o=i.redirectUri;else{if(!(t instanceof URL)){let e=t;switch(t=new URL(t.url),e.method){case`GET`:break;case`POST`:let n=new URLSearchParams(await Jd(e));if(m)t.hash=n.toString();else for(let e of n.entries()){var y=ou(e,2);let n=y[0],r=y[1];t.searchParams.append(n,r)}break;default:throw hf(`unexpected Request HTTP method`,pf)}}switch(o=function(e){return(e=new URL(e)).search=``,e.hash=``,e.href}(t),!0){case!!p:a=await p(t,n?.expectedState);break;case!!m:a=await m(t,n?.expectedNonce,n?.expectedState,n?.maxAge);break;case!!v:throw TypeError(`authorizationCodeGrant() cannot be used by response_type=id_token clients`);default:try{a=$d(c,l,t.searchParams,n?.expectedState)}catch(e){vf(e)}}}let b=await async function(e,t,n,r,i,a,o){if(Qu(e),$u(t),!Ed.has(r))throw ku(`"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()`,Du);qu(i,`"redirectUri"`);let s=Xd(r,`code`);if(!s)throw X(`no authorization code in "callbackParameters"`,Z);let c=new URLSearchParams(o?.additionalParameters);return c.set(`redirect_uri`,i),c.set(`code`,s),a!==Dd&&(qu(a,`"codeVerifier"`),c.set(`code_verifier`,a)),yd(e,t,n,`authorization_code`,c,o)}(c,l,u,a,o,n?.pkceCodeVerifier||Dd,{additionalParameters:r,[Nu]:d,[Au]:!f,DPoP:i?.DPoP,headers:new Headers(of),signal:jf(g)}).catch(vf);typeof n?.expectedNonce!=`string`&&typeof n?.maxAge!=`number`||(n.idTokenExpected=!0);let x=Md(c,l,b,{expectedNonce:n?.expectedNonce,maxAge:n?.maxAge,requireIdToken:n?.idTokenExpected,[Pu]:_}),S;try{S=await x}catch(t){if(Mf(t,i))return Tf(e,void 0,n,r,au(au({},i),{},{flag:Nf,authResponse:a,redirectUri:o}));vf(t)}return S.id_token&&await h?.(b),xf(S),S}async function Ef(e,t,n,r){Af(e),n=new URLSearchParams(n);let i=cf(e),a=i.as,o=i.c,s=i.auth,c=i.fetch,l=i.tlsOnly,u=i.nonRepudiation,d=i.timeout,f=i.decrypt,p=await async function(e,t,n,r,i){Qu(e),$u(t),qu(r,`"refreshToken"`);let a=new URLSearchParams(i?.additionalParameters);return a.set(`refresh_token`,r),yd(e,t,n,`refresh_token`,a,i)}(a,o,s,t,{[Nu]:c,[Au]:!l,additionalParameters:n,DPoP:r?.DPoP,headers:new Headers(of),signal:jf(d)}).catch(vf),m=async function(e,t,n,r){return Cd(e,t,n,void 0,r?.[Pu],r?.recognizedTokenTypes)}(a,o,p,{[Pu]:f}),h;try{h=await m}catch(i){if(Mf(i,r))return Ef(e,t,n,au(au({},r),{},{flag:Nf}));vf(i)}return h.id_token&&await u?.(p),xf(h),h}async function Df(e,t,n){Af(e),t=new URLSearchParams(t);let r=cf(e),i=r.as,a=r.c,o=r.auth,s=r.fetch,c=r.tlsOnly,l=r.timeout,u=async function(e,t,n,r){return Cd(e,t,n,void 0,r?.[Pu],r?.recognizedTokenTypes)}(i,a,await async function(e,t,n,r,i){return Qu(e),$u(t),yd(e,t,n,`client_credentials`,new URLSearchParams(r),i)}(i,a,o,t,{[Nu]:s,[Au]:!c,DPoP:n?.DPoP,headers:new Headers(of),signal:jf(l)}).catch(vf)),d;try{d=await u}catch(r){if(Mf(r,n))return Df(e,t,au(au({},n),{},{flag:Nf}));vf(r)}return xf(d),d}function Of(e,t){Af(e);let n=cf(e),r=n.as,i=n.c,a=n.tlsOnly,o=n.hybrid,s=n.jarm,c=n.implicit,l=id(r,`authorization_endpoint`,!1,a);if((t=new URLSearchParams(t)).has(`client_id`)||t.set(`client_id`,i.client_id),!t.has(`request_uri`)&&!t.has(`request`)){if(t.has(`response_type`)||t.set(`response_type`,o?`code id_token`:c?`id_token`:`code`),c&&!t.has(`nonce`))throw hf(`response_type=id_token clients must provide a nonce parameter in their authorization request parameters`,pf);s&&t.set(`response_mode`,`jwt`)}for(let e of t.entries()){var u=ou(e,2);let t=u[0],n=u[1];l.searchParams.append(t,n)}return l}async function kf(e,t,n){Af(e);let r=Of(e,t),i=cf(e),a=i.as,o=i.c,s=i.auth,c=i.fetch,l=i.tlsOnly,u=i.timeout,d=async function(e,t,n){if(Qu(e),$u(t),!Eu(n,Response))throw ku(`"response" must be an instance of Response`,Ou);await hd(n,201,`Pushed Authorization Request Endpoint`),qd(n);let r=await ef(n);qu(r.request_uri,`"response" body "request_uri" property`,Z,{body:r});let i=typeof r.expires_in==`number`?r.expires_in:parseFloat(r.expires_in);return Ku(i,!0,`"response" body "expires_in" property`,Z,{body:r}),r.expires_in=i,r}(a,o,await async function(e,t,n,r,i){var a;Qu(e),$u(t);let o=id(e,`pushed_authorization_request_endpoint`,t.use_mtls_endpoint_aliases,!0!==i?.[Au]),s=new URLSearchParams(r);s.set(`client_id`,t.client_id);let c=Wu(i?.headers);c.set(`accept`,`application/json`),i?.DPoP!==void 0&&(gd(i.DPoP),await i.DPoP.addProof(o,c,`POST`));let l=await vd(e,t,n,o,s,c,i);return i==null||(a=i.DPoP)==null||a.cacheNonce(l,o),l}(a,o,s,r.searchParams,{[Nu]:c,[Au]:!l,DPoP:n?.DPoP,headers:new Headers(of),signal:jf(u)}).catch(vf)),f;try{f=await d}catch(r){if(Mf(r,n))return kf(e,t,au(au({},n),{},{flag:Nf}));vf(r)}return Of(e,{request_uri:f.request_uri})}function Af(e){if(!(e instanceof bf))throw hf(`"config" must be an instance of Configuration`,mf);if(Object.getPrototypeOf(e)!==bf.prototype)throw hf(`subclassing Configuration is not allowed`,pf)}function jf(e){return e?AbortSignal.timeout(1e3*e):void 0}function Mf(e,t){return!(t==null||!t.DPoP||t.flag===Nf)&&function(e){if(e instanceof sd){let t=e.cause,n=t[0];return t.length===1&&n.scheme===`dpop`&&n.parameters.error===`use_dpop_nonce`}return e instanceof ad&&e.error===`use_dpop_nonce`}(e)}Object.freeze(bf.prototype);var Nf=Symbol();async function Pf(e,t,n,r){Af(e);let i=cf(e),a=i.as,o=i.c,s=i.auth,c=i.fetch,l=i.tlsOnly,u=i.timeout,d=i.decrypt,f=i.nonRepudiation,p=await async function(e,t,n,r,i,a){return Qu(e),$u(t),qu(r,`"grantType"`),yd(e,t,n,r,new URLSearchParams(i),a)}(a,o,s,t,new URLSearchParams(n),{[Nu]:c,[Au]:!l,DPoP:r?.DPoP,headers:new Headers(of),signal:jf(u)}).catch(vf),m;t===`urn:ietf:params:oauth:grant-type:token-exchange`&&(m={n_a:()=>{}});let h=async function(e,t,n,r){return Cd(e,t,n,void 0,r?.[Pu],r?.recognizedTokenTypes)}(a,o,p,{[Pu]:d,recognizedTokenTypes:m}),g;try{g=await h}catch(i){if(Mf(i,r))return Pf(e,t,n,au(au({},r),{},{flag:Nf}));vf(i)}return g.id_token&&await f?.(p),xf(g),g}var Ff,If;typeof navigator>`u`||(Ff=navigator.userAgent)==null||(If=Ff.startsWith)==null||If.call(Ff,`Mozilla/5.0 `),Object.freeze(new Set([`grant_type`,`client_id`,`client_secret`,`client_assertion`,`client_assertion_type`,`subject_token`,`subject_token_type`,`requested_token_type`,`actor_token`,`actor_token_type`,`audience`,`aud`,`resource`,`resources`,`resource_indicator`,`scope`,`connection`,`login_hint`,`organization`,`assertion`]));var Lf={isAuthenticated:!1,isLoading:!0,error:void 0,user:void 0},Q=function(){throw Error(`You forgot to wrap your component in <Auth0Provider>.`)},Rf=tu(tu({},Lf),{buildAuthorizeUrl:Q,buildLogoutUrl:Q,getAccessTokenSilently:Q,getAccessTokenWithPopup:Q,getIdTokenClaims:Q,loginWithCustomTokenExchange:Q,customTokenExchange:Q,exchangeToken:Q,loginWithRedirect:Q,loginWithPopup:Q,connectAccountWithRedirect:Q,logout:Q,handleRedirectCallback:Q,getDpopNonce:Q,setDpopNonce:Q,generateDpopProof:Q,createFetcher:Q,getConfiguration:Q,mfa:{getAuthenticators:Q,enroll:Q,challenge:Q,verify:Q,getEnrollmentFactors:Q},passkey:{signup:Q,login:Q},myAccount:{getFactors:Q,getAuthenticationMethods:Q,getAuthenticationMethod:Q,updateAuthenticationMethod:Q,deleteAuthenticationMethod:Q,enrollmentChallenge:Q,enrollmentVerify:Q}}),zf=(0,q.createContext)(Rf);(function(e){eu(t,e);function t(n,r){var i=e.call(this,r??n)||this;return i.error=n,i.error_description=r,Object.setPrototypeOf(i,t.prototype),i}return t})(Error);var Bf=function(e){return e===void 0&&(e=zf),(0,q.useContext)(e)};function Vf(e){if(e!==void 0)return e>=500?`5xx`:e>=400?`4xx`:`other`}var Hf=new Set([`blastRadius`,`errorClass`,`errorType`,`errorStatus`,`errorStatusClass`,`errorTraceId`,`errorDetail`,`errorInstance`,`errorExpected`]);function Uf(e){if(e)return Object.fromEntries(Object.entries(e).filter(([e])=>!Hf.has(e)))}function Wf(e){return e instanceof Error?e.name:e===null?`null`:typeof e}function Gf(e,t,n){let r={blastRadius:t,errorClass:Wf(e)};(e instanceof wc||e instanceof Tc)&&(r.errorType=e.type,r.errorStatus=e.status,r.errorStatusClass=Vf(e.status),r.errorTraceId=e.traceId,r.errorDetail=e.detail,r.errorInstance=e.instance,r.errorExpected=e.type!==void 0&&yc.includes(e.type));let i=Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0));return{...Uf(n),...i}}var Kf;function qf(e){Kf=e}function Jf(){return Kf}var Yf=(0,q.createContext)({get client(){return Jf()},bootstrap:void 0}),Xf=function(e){return typeof e==`function`},Zf=function(){return(0,q.useContext)(Yf).client},Qf=function(e,t){return Qf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Qf(e,t)};function $f(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Qf(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var ep={componentStack:null,exceptionEvent:null,error:null},tp={INVALID_FALLBACK:`[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element.`};(function(e){$f(t,e);function t(t){var n=e.call(this,t)||this;return n.state=ep,n}return t.prototype.componentDidCatch=function(e,t){var n=this.props.additionalProperties,r;Xf(n)?r=n(e):typeof n==`object`&&(r=n);var i=this.context.client.captureException(e,r),a=t.componentStack;this.setState({error:e,componentStack:a??null,exceptionEvent:i})},t.prototype.render=function(){var e=this.props,t=e.children,n=e.fallback,r=this.state;if(r.componentStack==null)return Xf(t)?t():t;var i=Xf(n)?q.createElement(n,{error:r.error,componentStack:r.componentStack,exceptionEvent:r.exceptionEvent}):n;return q.isValidElement(i)?i:(console.warn(tp.INVALID_FALLBACK),q.createElement(q.Fragment,null))},t.contextType=Yf,t})(q.Component),qf(fc);var np=(e=>{let t=Object.create(e);return t.capture=function(t,...n){let[r,i]=n;return e.capture(t,r,i)},t.captureRaw=function(t,n,r){return e.capture(t,n,r)},new Proxy(t,{get(t,n){return n in t?t[n]:e[n]},set(t,n,r){return e[n]=r,!0}})})(fc),rp=()=>(Zf(),np),ip=()=>{let e=rp();return{logEvent:(0,q.useCallback)(((t,n,r)=>{let i=e.capture;i(t,n,r)}),[e]),captureRaw:(0,q.useCallback)((t,n)=>{e.captureRaw(t,n)},[e]),captureException:(t,n,r=`action-failed`)=>{e.captureException(t,Gf(t,r,n))}}},ap=`acts_as`,op=`https://zuplo.com/claims/acts_as`,sp=`as_user`,cp=e=>{let t=e?.[ap];if(typeof t==`string`)return t;let n=e?.[op];return typeof n==`string`?n:void 0},lp=new Set([`login_required`,`interaction_required`,`invalid_grant`,`missing_refresh_token`,`mfa_required`,`MfaRequiredError`,`MissingRefreshTokenError`]),up=`timeout when executing 'fetch'`,dp=`no_cached_access_token`,fp=`no cached access token`,pp=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.error==`string`)return t.error;if(typeof t.name==`string`)return t.name}},mp=e=>{if(typeof e==`object`&&e){let{message:t}=e;if(typeof t==`string`)return t}},hp=e=>{let t=pp(e);if(t===`timeout`||t===`TimeoutError`)return!0;let n=(mp(e)??``).toLowerCase();return n.includes(up)||Sc(n)},gp=e=>pp(e)===dp?!0:(mp(e)??``).toLowerCase().includes(fp),_p=e=>{let t=pp(e);return t!==void 0&&lp.has(t)?`session-ended`:gp(e)?`deferred`:hp(e)?`offline`:`unknown`},vp=e=>{if(typeof e==`object`&&e){let t=e;return{code:typeof t.error==`string`?t.error:typeof t.name==`string`?t.name:`unknown`,description:typeof t.error_description==`string`?t.error_description:void 0}}return{code:`unknown`}},yp=!1,bp=new Set,xp=()=>{if(!yp){yp=!0;try{`${window.location.pathname}${window.location.search}${window.location.hash}`}catch{}for(let e of bp)e()}},Sp=()=>typeof document>`u`||document.visibilityState!==`hidden`?Promise.resolve():new Promise(e=>{let t=()=>{document.visibilityState!==`hidden`&&(document.removeEventListener(`visibilitychange`,t),e())};document.addEventListener(`visibilitychange`,t)}),Cp=(0,q.createContext)(void 0),wp=()=>{let e=(0,q.useContext)(Cp),{user:t}=Bf();if(e)return e;if(!t)throw Error(`This hook should never be used outside of a protected route.`);if(!t.sub)throw Error(`The user returned from Auth0 does not contain a 'sub'. Invalid state.`);return{email:t.email??`unknown@example.com`,name:t.name??``,givenName:t.given_name,nickname:t.nickname,userId:t.sub,asUser:cp(t)}},Tp=(e,t)=>{let{code:n,description:r}=vp(e);return{auth0_error_code:n,...r?{auth0_error_description:r}:{},error_name:e instanceof Error?e.name:typeof e,failure_kind:t.kind,force_refresh:t.cacheMode===`off`,is_impersonating:t.isImpersonating,cache_mode:t.cacheMode,is_authenticated:t.isAuthenticated,cache_location:`memory`,online:typeof navigator>`u`?void 0:navigator.onLine,cookies_enabled:typeof navigator>`u`?void 0:navigator.cookieEnabled,visibility_state:typeof document>`u`?void 0:document.visibilityState,page_age_ms:typeof performance>`u`?void 0:Math.round(performance.now())}},Ep=()=>{let e=(0,q.useContext)(Cp),t=Bf(),{captureException:n}=ip();return(0,q.useCallback)(async r=>{if(e)return`local-access-token`;let i=!!cp(t.user),a=typeof document<`u`&&document.visibilityState===`hidden`,o=i?`cache-only`:r?.forceRefresh?`off`:a?`cache-only`:`on`,s=()=>t.getAccessTokenSilently({cacheMode:o,authorizationParams:{audience:Ac,...i?{scope:`${kc} ${ap} ${sp}`}:{}}});try{let e=await s();if(!e&&o===`cache-only`&&!i&&(await Sp(),o=`on`,e=await s()),!e){let e=Error(`No cached access token available`);throw e.error=`no_cached_access_token`,e}return e}catch(e){let r=_p(e),a=Tp(e,{isImpersonating:i,cacheMode:o,isAuthenticated:t.isAuthenticated,kind:r});if(r===`session-ended`&&!i)vc.info(`Access-token renewal failed; session ended`,a),xp();else if(r===`offline`)throw vc.info(`Access-token renewal failed; offline, awaiting reconnect`,a),new wc({type:bc,title:`Error retrieving access token`,detail:`Could not reach the authentication service. Retrying when the connection is back.`},{cause:e instanceof Error?e:Error(String(e))});else r===`deferred`?vc.info(`Access-token renewal deferred; not surfaced`,a):(vc.error(`Access-token renewal failed`,{error:e,...a}),n(e,a));let s=new Tc(`Error retrieving access token`,{cause:e instanceof Error?e:Error(String(e))});throw s.status=500,s}},[e,t,n])},Dp=/\{[^{}]+\}/g,Op=()=>typeof process==`object`&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici;function kp(){return Math.random().toString(36).slice(2,11)}function Ap(e){let{baseUrl:t=``,Request:n=globalThis.Request,fetch:r=globalThis.fetch,querySerializer:i,bodySerializer:a,headers:o,requestInitExt:s=void 0,...c}={...e};s=Op()?s:void 0,t=zp(t);let l=[];async function u(e,u){let{baseUrl:d,fetch:f=r,Request:p=n,headers:m,params:h={},parseAs:g=`json`,querySerializer:_,bodySerializer:v=a??Ip,body:y,middleware:b=[],...x}=u||{},S=t;d&&(S=zp(d)??t);let C=typeof i==`function`?i:Pp(i);_&&(C=typeof _==`function`?_:Pp({...typeof i==`object`?i:{},..._}));let w=y===void 0?void 0:v(y,Rp(o,m,h.header)),T=Rp(w===void 0||w instanceof FormData?{}:{"Content-Type":`application/json`},o,m,h.header),E=[...l,...b],D={redirect:`follow`,...c,...x,body:w,headers:T},O,k,A=new p(Lp(e,{baseUrl:S,params:h,querySerializer:C}),D),j;for(let e in x)e in A||(A[e]=x[e]);if(E.length){O=kp(),k=Object.freeze({baseUrl:S,fetch:f,parseAs:g,querySerializer:C,bodySerializer:v});for(let t of E)if(t&&typeof t==`object`&&typeof t.onRequest==`function`){let n=await t.onRequest({request:A,schemaPath:e,params:h,options:k,id:O});if(n)if(n instanceof p)A=n;else if(n instanceof Response){j=n;break}else throw Error(`onRequest: must return new Request() or Response() when modifying the request`)}}if(!j){try{j=await f(A,s)}catch(t){let n=t;if(E.length)for(let t=E.length-1;t>=0;t--){let r=E[t];if(r&&typeof r==`object`&&typeof r.onError==`function`){let t=await r.onError({request:A,error:n,schemaPath:e,params:h,options:k,id:O});if(t){if(t instanceof Response){n=void 0,j=t;break}if(t instanceof Error){n=t;continue}throw Error(`onError: must return new Response() or instance of Error`)}}}if(n)throw n}if(E.length)for(let t=E.length-1;t>=0;t--){let n=E[t];if(n&&typeof n==`object`&&typeof n.onResponse==`function`){let t=await n.onResponse({request:A,response:j,schemaPath:e,params:h,options:k,id:O});if(t){if(!(t instanceof Response))throw Error(`onResponse: must return new Response() when modifying the response`);j=t}}}}if(j.status===204||A.method===`HEAD`||j.headers.get(`Content-Length`)===`0`)return j.ok?{data:void 0,response:j}:{error:void 0,response:j};if(j.ok)return g===`stream`?{data:j.body,response:j}:{data:await j[g](),response:j};let M=await j.text();try{M=JSON.parse(M)}catch{}return{error:M,response:j}}return{request(e,t,n){return u(t,{...n,method:e.toUpperCase()})},GET(e,t){return u(e,{...t,method:`GET`})},PUT(e,t){return u(e,{...t,method:`PUT`})},POST(e,t){return u(e,{...t,method:`POST`})},DELETE(e,t){return u(e,{...t,method:`DELETE`})},OPTIONS(e,t){return u(e,{...t,method:`OPTIONS`})},HEAD(e,t){return u(e,{...t,method:`HEAD`})},PATCH(e,t){return u(e,{...t,method:`PATCH`})},TRACE(e,t){return u(e,{...t,method:`TRACE`})},use(...e){for(let t of e)if(t){if(typeof t!=`object`||!(`onRequest`in t||`onResponse`in t||`onError`in t))throw Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");l.push(t)}},eject(...e){for(let t of e){let e=l.indexOf(t);e!==-1&&l.splice(e,1)}}}}function jp(e,t,n){if(t==null)return``;if(typeof t==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${n?.allowReserved===!0?t:encodeURIComponent(t)}`}function Mp(e,t,n){if(!t||typeof t!=`object`)return``;let r=[],i={simple:`,`,label:`.`,matrix:`;`}[n.style]||`&`;if(n.style!==`deepObject`&&n.explode===!1){for(let e in t)r.push(e,n.allowReserved===!0?t[e]:encodeURIComponent(t[e]));let i=r.join(`,`);switch(n.style){case`form`:return`${e}=${i}`;case`label`:return`.${i}`;case`matrix`:return`;${e}=${i}`;default:return i}}for(let i in t){let a=n.style===`deepObject`?`${e}[${i}]`:i;r.push(jp(a,t[i],n))}let a=r.join(i);return n.style===`label`||n.style===`matrix`?`${i}${a}`:a}function Np(e,t,n){if(!Array.isArray(t))return``;if(n.explode===!1){let r={form:`,`,spaceDelimited:`%20`,pipeDelimited:`|`}[n.style]||`,`,i=(n.allowReserved===!0?t:t.map(e=>encodeURIComponent(e))).join(r);switch(n.style){case`simple`:return i;case`label`:return`.${i}`;case`matrix`:return`;${e}=${i}`;default:return`${e}=${i}`}}let r={simple:`,`,label:`.`,matrix:`;`}[n.style]||`&`,i=[];for(let r of t)n.style===`simple`||n.style===`label`?i.push(n.allowReserved===!0?r:encodeURIComponent(r)):i.push(jp(e,r,n));return n.style===`label`||n.style===`matrix`?`${r}${i.join(r)}`:i.join(r)}function Pp(e){return function(t){let n=[];if(t&&typeof t==`object`)for(let r in t){let i=t[r];if(i!=null){if(Array.isArray(i)){if(i.length===0)continue;n.push(Np(r,i,{style:`form`,explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}));continue}if(typeof i==`object`){n.push(Mp(r,i,{style:`deepObject`,explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}));continue}n.push(jp(r,i,e))}}return n.join(`&`)}}function Fp(e,t){let n=e;for(let r of e.match(Dp)??[]){let e=r.substring(1,r.length-1),i=!1,a=`simple`;if(e.endsWith(`*`)&&(i=!0,e=e.substring(0,e.length-1)),e.startsWith(`.`)?(a=`label`,e=e.substring(1)):e.startsWith(`;`)&&(a=`matrix`,e=e.substring(1)),!t||t[e]===void 0||t[e]===null)continue;let o=t[e];if(Array.isArray(o)){n=n.replace(r,Np(e,o,{style:a,explode:i}));continue}if(typeof o==`object`){n=n.replace(r,Mp(e,o,{style:a,explode:i}));continue}if(a===`matrix`){n=n.replace(r,`;${jp(e,o)}`);continue}n=n.replace(r,a===`label`?`.${encodeURIComponent(o)}`:encodeURIComponent(o))}return n}function Ip(e,t){return e instanceof FormData?e:t&&(t.get instanceof Function?t.get(`Content-Type`)??t.get(`content-type`):t[`Content-Type`]??t[`content-type`])===`application/x-www-form-urlencoded`?new URLSearchParams(e).toString():JSON.stringify(e)}function Lp(e,t){let n=`${t.baseUrl}${e}`;t.params?.path&&(n=Fp(n,t.params.path));let r=t.querySerializer(t.params.query??{});return r.startsWith(`?`)&&(r=r.substring(1)),r&&(n+=`?${r}`),n}function Rp(...e){let t=new Headers;for(let n of e){if(!n||typeof n!=`object`)continue;let e=n instanceof Headers?n.entries():Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,r)}return t}function zp(e){return e.endsWith(`/`)?e.substring(0,e.length-1):e}var Bp=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Vp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Hp=new class{#e=Vp;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Up(e){setTimeout(e,0)}var Wp=typeof window>`u`||`Deno`in globalThis;function Gp(){}function Kp(e,t){return typeof e==`function`?e(t):e}function qp(e){return typeof e==`number`&&e>=0&&e!==1/0}function Jp(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Yp(e,t){return typeof e==`function`?e(t):e}function Xp(e,t){return typeof e==`function`?e(t):e}function Zp(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==$p(o,t.options))return!1}else if(!tm(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Qp(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(em(t.options.mutationKey)!==em(a))return!1}else if(!tm(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function $p(e,t){return(t?.queryKeyHashFn||em)(e)}function em(e){return JSON.stringify(e,(e,t)=>om(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function tm(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>tm(e[n],t[n])):!1}var nm=Object.prototype.hasOwnProperty;function rm(e,t){if(e===t)return e;let n=am(e)&&am(t);if(!n&&!(om(e)&&om(t)))return t;let r=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),a=i.length,o=n?Array(a):{},s=0;for(let c=0;c<a;c++){let a=n?c:i[c],l=e[a],u=t[a];if(l===u){o[a]=l,(n?c<r:nm.call(e,a))&&s++;continue}if(l===null||u===null||typeof l!=`object`||typeof u!=`object`){o[a]=u;continue}let d=rm(l,u);o[a]=d,d===l&&s++}return r===a&&s===r?e:o}function im(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function am(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function om(e){if(!sm(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!sm(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function sm(e){return Object.prototype.toString.call(e)===`[object Object]`}function cm(e){return new Promise(t=>{Hp.setTimeout(t,e)})}function lm(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:rm(e,t)}function um(e){return e}function dm(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function fm(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var pm=Symbol();function mm(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===pm?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function hm(e,t){return typeof e==`function`?e(...t):!!e}var gm=new class extends Bp{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Wp&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}};function _m(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var vm=Up;function ym(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=vm,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var bm=ym(),xm=new class extends Bp{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Wp&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Sm(e){return Math.min(1e3*2**e,3e4)}function Cm(e){return(e??`online`)===`online`?xm.isOnline():!0}var wm=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Tm(e){let t=!1,n=0,r,i=_m(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new wm(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>gm.isFocused()&&(e.networkMode===`always`||xm.isOnline())&&e.canRun(),u=()=>Cm(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Wp?0:3),o=e.retryDelay??Sm,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),cm(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Em=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qp(this.gcTime)&&(this.#e=Hp.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wp?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(Hp.clearTimeout(this.#e),void 0)}},Dm=class extends Em{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Am(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Am(this.options);e.data!==void 0&&(this.setState(km(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=lm(this.state.data,e,this.options);return this.#s({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(Gp).catch(Gp):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Xp(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pm||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Yp(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Jp(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=mm(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=Tm({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof wm&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#s({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#s({type:`pause`})},onContinue:()=>{this.#s({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof wm){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#s({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#s(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Om(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...km(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),bm.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Om(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Cm(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function km(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Am(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var jm=class extends Bp{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=_m(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Nm(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Xp(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!im(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Fm(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Xp(this.options.enabled,this.#t)!==Xp(t.enabled,this.#t)||Yp(this.options.staleTime,this.#t)!==Yp(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Xp(this.options.enabled,this.#t)!==Xp(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Lm(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Gp)),t}#g(){this.#b();let e=Yp(this.options.staleTime,this.#t);if(Wp||this.#r.isStale||!qp(e))return;let t=Jp(this.#r.dataUpdatedAt,e)+1;this.#d=Hp.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(Wp||Xp(this.options.enabled,this.#t)===!1||!qp(this.#p)||this.#p===0)&&(this.#f=Hp.setInterval(()=>{(this.options.refetchIntervalInBackground||gm.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(Hp.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(Hp.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Nm(e,t),o=i&&Fm(e,n,t,r);(a||o)&&(l={...l,...Om(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=lm(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=lm(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Im(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Xp(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=e=>{x.status===`error`?e.reject(x.error):x.data!==void 0&&e.resolve(x.data)},r=()=>{t(this.#o=x.promise=_m())},i=this.#o;switch(i.status){case`pending`:e.queryHash===n.queryHash&&t(i);break;case`fulfilled`:(x.status===`error`||x.data!==i.value)&&r();break;case`rejected`:(x.status!==`error`||x.error!==i.reason)&&r();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!im(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){bm.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Mm(e,t){return Xp(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function Nm(e,t){return Mm(e,t)||e.state.data!==void 0&&Pm(e,t,t.refetchOnMount)}function Pm(e,t,n){if(Xp(t.enabled,e)!==!1&&Yp(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Im(e,t)}return!1}function Fm(e,t,n,r){return(e!==t||Xp(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Im(e,n)}function Im(e,t){return Xp(t.enabled,e)!==!1&&e.isStaleByTime(Yp(t.staleTime,e))}function Lm(e,t){return!im(e.getCurrentResult(),t)}function Rm(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener(`abort`,()=>{n=!0}),t.signal)})},u=mm(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?fm:dm;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Bm:zm,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:zm(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function zm(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Bm(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Vm(e,t){return t?zm(e,t)!=null:!1}function Hm(e,t){return!t||!e.getPreviousPageParam?!1:Bm(e,t)!=null}var Um=class extends jm{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Rm()})}getOptimisticResult(e){return e.behavior=Rm(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Vm(t,n.data),hasPreviousPage:Hm(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Wm=class extends Em{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Gm(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Tm({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{throw await this.#n.config.onError?.(t,e,this.state.context,this,n),await this.options.onError?.(t,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,t,e,this.state.context,n),t}finally{this.#i({type:`error`,error:t})}}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),bm.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Gm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Km=class extends Bp{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),im(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&em(t.mutationKey)!==em(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Gm();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){bm.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type===`success`?(this.#r.onSuccess?.(e.data,t,n,r),this.#r.onSettled?.(e.data,null,t,n,r)):e?.type===`error`&&(this.#r.onError?.(e.error,t,n,r),this.#r.onSettled?.(void 0,e.error,t,n,r))}this.listeners.forEach(e=>{e(this.#t)})})}},qm=q.createContext(void 0),Jm=e=>{let t=q.useContext(qm);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ym=({client:e,children:t})=>(q.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,J.jsx)(qm.Provider,{value:e,children:t})),Xm=q.createContext(!1),Zm=()=>q.useContext(Xm);Xm.Provider;function Qm(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $m=q.createContext(Qm()),eh=()=>q.useContext($m),th=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},nh=e=>{q.useEffect(()=>{e.clearReset()},[e])},rh=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||hm(n,[e.error,r])),ih=(e,t)=>t.state.data===void 0,ah=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},oh=(e,t)=>e.isLoading&&e.isFetching&&!t,sh=(e,t)=>e?.suspense&&t.isPending,ch=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function lh(e,t,n){let r=Zm(),i=eh(),a=Jm(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?`isRestoring`:`optimistic`,ah(o),th(o,i),nh(i);let s=!a.getQueryCache().get(o.queryHash),[c]=q.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!r&&e.subscribed!==!1;if(q.useSyncExternalStore(q.useCallback(e=>{let t=u?c.subscribe(bm.batchCalls(e)):Gp;return c.updateResult(),t},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),q.useEffect(()=>{c.setOptions(o)},[o,c]),sh(o,l))throw ch(o,c,i);if(rh({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!Wp&&oh(l,r)&&(s?ch(o,c,i):a.getQueryCache().get(o.queryHash)?.promise)?.catch(Gp).finally(()=>{c.updateResult()}),o.notifyOnChangeProps?l:c.trackResult(l)}function uh(e,t){return lh(e,jm,t)}function dh(e,t){return lh({...e,enabled:!0,suspense:!0,throwOnError:ih,placeholderData:void 0},jm,t)}function fh(e,t){let n=Jm(t),[r]=q.useState(()=>new Km(n,e));q.useEffect(()=>{r.setOptions(e)},[r,e]);let i=q.useSyncExternalStore(q.useCallback(e=>r.subscribe(bm.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=q.useCallback((e,t)=>{r.mutate(e,t).catch(Gp)},[r]);if(i.error&&hm(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function ph(e,t){return lh(e,Um,t)}function mh(e){let t=async({queryKey:[t,n,r],signal:i})=>{let a=e[t.toUpperCase()],{data:o,error:s,response:c}=await a(n,{signal:i,...r});if(s)throw s;return c.status===204||c.headers.get(`Content-Length`)===`0`?o??null:o},n=(t,n)=>async r=>{let i=e[t.toUpperCase()],{data:a,error:o}=await i(n,r);if(o)throw o;return a},r=(e,n,...[r,i])=>({queryKey:r===void 0?[e,n]:[e,n,r],queryFn:t,...i});return{queryOptions:r,mutationOptions:(e,t,r)=>({mutationKey:[e,t],mutationFn:n(e,t),...r}),useQuery:(e,t,...[n,i,a])=>uh(r(e,t,n,i),a),useSuspenseQuery:(e,t,...[n,i,a])=>dh(r(e,t,n,i),a),useInfiniteQuery:(t,n,i,a,o)=>{let{pageParamName:s=`cursor`,...c}=a,{queryKey:l}=r(t,n,i);return ph({queryKey:l,queryFn:async({queryKey:[t,n,r],pageParam:i=0,signal:a})=>{let o=e[t.toUpperCase()],{data:c,error:l}=await o(n,{...r,signal:a,params:{...r?.params||{},query:{...r?.params?.query,[s]:i}}});if(l)throw l;return c},...c},o)},useMutation:(e,t,r,i)=>fh({mutationKey:[e,t],mutationFn:n(e,t),...r},i)}}async function hh(e,t,n){let r=await e(await t());if(r.status!==401)return r;let i=await e(await t({forceRefresh:!0}));return i.status===401&&n(),i}function gh(){let e=new Map;return{async onRequest({request:t,id:n}){let{getAccessToken:r}=await Xc(),i=await r(),a=Kc();return t.headers.set(`authorization`,`Bearer ${i}`),t.headers.set(`zuplo-request-id`,a),t.headers.set(`x-trace-id`,a),e.set(n,t.clone()),t},onError({id:t}){e.delete(t)},async onResponse({request:t,response:n,id:r}){let i=e.get(r);e.delete(r);let a=t.headers.get(`x-trace-id`)||`unknown`,{getAccessToken:o}=await Xc(),s=n;if(n.status===401&&i){let e=await o({forceRefresh:!0});i.headers.set(`authorization`,`Bearer ${e}`),s=await fetch(i)}if(s.status===401){xp();let e=new Tc(`Your session has expired. Please log in again.`,{traceId:a});throw e.status=401,e}if(!s.ok){let e=new Tc(`Error while making request. Please try again or contact support if the problem persists.`,{traceId:a});throw await e.tryReadResponse(s.clone()),e}return s}}}var _h=Ap({baseUrl:K});_h.use(gh());var vh=mh(_h),yh=e=>{let t=Object.entries(e).flatMap(([e,t])=>t?[[e,t]]:[]);return new URLSearchParams(t).toString()},bh=`roots`,$={user:{preferences:()=>({url:`${K}/v1/users/me/preferences`})},authApiKey:e=>({url:`${K}/v1/auth/api-keys/${e}`}),authAccountApiKeys:e=>({url:`${K}/v1/auth/api-keys?accountName=${e}`}),authCurrentUserAccountRoles:e=>({url:`${K}/v1/auth/users/me?accountName=${e}`}),authUserAccountRoles:(e,t)=>({url:`${K}/v1/auth/users/${t}?accountName=${e}`}),authProjectUsersRoles:(e,t,{includeInheritedRoles:n}={includeInheritedRoles:!1})=>({url:`${K}/v1/auth/users?accountName=${e}&projectName=${t}&includeInheritedRoles=${n}`}),authAccountUsersRoles:e=>({url:`${K}/v1/auth/users?accountName=${e}`}),mfaFactors:()=>({url:`${K}/v1/mfa/factors`}),accountMemberInviteDetails:e=>({url:`${K}/v1/account-member-invites/${e}`}),accountMemberInvites:e=>({url:`${K}/v1/accounts/${e}/account-member-invites`}),accountAuditLogs:(e,t)=>{let n=new URLSearchParams;t?.limit&&n.append(`limit`,t.limit.toString()),t?.offset&&n.append(`offset`,t.offset.toString()),t?.action&&n.append(`action`,t.action),t?.startDate&&n.append(`startDate`,t.startDate),t?.endDate&&n.append(`endDate`,t.endDate),t?.actor&&n.append(`actor`,t.actor),t?.success!==void 0&&n.append(`success`,t.success.toString());let r=n.toString();return{url:`${K}/v1/accounts/${e}/audit-logs${r?`?${r}`:``}`}},account:e=>({url:`${K}/v1/accounts/${e}`}),bucketAuditLogsEvents:(e,t)=>{let n=new URLSearchParams;t?.limit!==void 0&&n.append(`limit`,String(t.limit)),t?.cursor&&n.append(`cursor`,t.cursor),t?.type&&n.append(`type`,t.type),t?.actorSub&&n.append(`actorSub`,t.actorSub),t?.subject&&n.append(`subject`,t.subject),t?.startDate&&n.append(`startDate`,t.startDate),t?.endDate&&n.append(`endDate`,t.endDate);let r=n.toString();return{url:`${K}/v1/audit-logs/${e}/events${r?`?${r}`:``}`}},bucketAuditLogsStats:(e,t)=>{let n=new URLSearchParams;return n.append(`groupBy`,t.groupBy),t.limit!==void 0&&n.append(`limit`,String(t.limit)),t.startDate&&n.append(`startDate`,t.startDate),t.endDate&&n.append(`endDate`,t.endDate),{url:`${K}/v1/audit-logs/${e}/stats?${n.toString()}`}},accounts:()=>({url:`${K}/v1/accounts`}),accountSourceControlRepoList:e=>({url:`${K}/v1/accounts/${e}/$repo-list`}),accountSourceControlAzureProjects:(e,t)=>({url:`${K}/v1/accounts/${e}/source-control/$azure-projects?organization=${t}`}),accountSourceControlNamespaces:e=>({url:`${K}/v1/accounts/${e}/$namespaces`}),accountSourceControlRepos:(e,t,n)=>({url:`${K}/v1/accounts/${e}/$repos?${new URLSearchParams({namespace:t,query:n??``})}`}),accountsSourceControlConfigurations:()=>({url:`${K}/v1/user/me/source-control-configs`}),billing:e=>({url:`${K}/v1/accounts/${e}/billings`}),buildLogs:(e,t)=>({url:`${K}/v2/deployments/${e}/build-logs/${t}`}),cdnContent:e=>({url:`${jc}${e}`}),knockIdentity:()=>({url:`${K}/v1/knock-identity`}),posthogIdentity:()=>({url:`${K}/v1/posthog-identity`}),bucketConfigurations:e=>({url:`${K}/v1/buckets/${e}/configurations`}),bucketConfigurationPools:e=>({url:`${K}/v1/buckets/${e}/configurations/teams`}),bucketConfigurationApps:e=>({url:`${K}/v1/buckets/${e}/configurations/apps`}),bucketConfigurationUserApps:e=>({url:`${K}/v1/buckets/${e}/configurations/user-apps`}),bucketConfiguration:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations/${t}`}),bucketConfigurationUsage:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/usage`}),bucketConfigurationMembers:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members`}),bucketConfigurationMember:(e,t,n)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`}),supportedAiProviders:e=>({url:`${K}/v1/buckets/${e}/providers`}),aiProviderAssignments:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/ai-provider-assignments`}),hierarchicalQuota:e=>({url:`${K}/v1/hierarchical-quota/${e}`}),consumer:(e,t)=>({url:`${K}/v1/api-keys/${e}/consumers/${t}`}),consumersForBucket:(e,t)=>{let n=yh({limit:t?.limit?.toString(),offset:t?.offset?.toString(),name:t?.name,email:t?.email});return{url:`${K}/v1/api-keys/${e}/consumers${n?`?${n}`:``}`}},customDomains:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/custom-domains`}),accountCustomDomains:e=>({url:`${K}/v1/accounts/${e}/custom-domains`}),deploymentVersions:e=>({url:`${K}/v1/deployments/${e}/versions`}),environments:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/deployments`}),environmentVariables:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/environment-variables`}),file:(e,t)=>({url:`${K}/v1/deployments/${e}/fs/file?path=${t}`}),fsStats:e=>({url:`${K}/v1/deployments/${e}/fs/stats`}),gitBranches:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$branches`}),projectSyncStatus:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/sync-status`}),meteringBucket:(e,t)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/`}),meteringPlans:(e,t)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/plans`}),meteringSubscriptions:(e,t)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/subscriptions`}),meteringSubscriptionQuotas:(e,t,n)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/subscriptions/${n}/quotas`}),project:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}`}),projects:e=>({url:`${K}/v1/accounts/${e}/projects`}),permissions:(e,t)=>({url:`${K}/v1/permissions/${e}/${t}`}),permissionsProject:(e,t)=>({url:`${K}/v1/permissions/project/${e}|${t}`}),permissionsAiPool:e=>({url:`${K}/v1/permissions/ai_pool/${e}`}),logViewerRequests:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.cursor&&n.append(`cursor`,t.cursor),t.since&&n.append(`since`,t.since),t.sinceId&&n.append(`sinceId`,t.sinceId),t.limit&&n.append(`limit`,t.limit.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/deployments/${e}/logs/requests?${n}`}},logViewerRequestDetail:(e,t,n)=>{let r=new URLSearchParams;n&&r.append(`timestamp`,n);let i=r.toString();return{url:`${K}/v2/deployments/${e}/logs/requests/${t}${i?`?${i}`:``}`}},logViewerHistogram:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/deployments/${e}/logs/histogram?${n}`}},logViewerFacets:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.facets&&n.append(`facets`,t.facets),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/deployments/${e}/logs/facets?${n}`}},logViewerRequestsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.cursor&&n.append(`cursor`,t.cursor),t.since&&n.append(`since`,t.since),t.sinceId&&n.append(`sinceId`,t.sinceId),t.limit&&n.append(`limit`,t.limit.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/logs/requests?${n}`}},logViewerRequestDetailScoped:(e,t,n)=>{let r=new URLSearchParams;return r.append(`account`,e.accountName),e.projectName&&r.append(`project`,e.projectName),e.deploymentName&&r.append(`deploymentName`,e.deploymentName),n&&r.append(`timestamp`,n),{url:`${K}/v2/logs/requests/${t}?${r}`}},logViewerHistogramScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/logs/histogram?${n}`}},logViewerFacetsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.facets&&n.append(`facets`,t.facets),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/logs/facets?${n}`}},tracesListScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),t.limit&&n.append(`limit`,String(t.limit)),t.cursor&&n.append(`cursor`,t.cursor),n.append(`mode`,bh),{url:`${K}/v2/traces?${n}`}},traceDetailScoped:(e,t,n)=>{let r=new URLSearchParams;return r.append(`account`,e.accountName),e.projectName&&r.append(`project`,e.projectName),e.deploymentName&&r.append(`deploymentName`,e.deploymentName),n&&r.append(`ts`,n),{url:`${K}/v2/traces/${encodeURIComponent(t)}?${r}`}},traceStatsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),n.append(`mode`,bh),{url:`${K}/v2/trace-stats?${n}`}},traceFacetsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.facets&&n.append(`facets`,t.facets),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),n.append(`mode`,bh),{url:`${K}/v2/trace-facets?${n}`}},serviceMapScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),{url:`${K}/v2/service-map?${n}`}},usersMe:()=>({url:`${K}/v1/users/me`}),identityConnections:e=>({url:`${K}/v1/accounts/${e}/identity-connections`}),identityConnectionTicket:e=>({url:`${K}/v1/accounts/${e}/identity-connections/ticket`}),analyticsRequests:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return e.compare&&t.append(`compare`,`previous`),{url:`${K}/v2/analytics/requests?${t}`}},analyticsRequestsField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/requests/fields/${encodeURIComponent(e)}?${n}`}},analyticsConsumers:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/consumers?${t}`}},analyticsAgents:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.includeOther===!0&&t.append(`includeOther`,`true`),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/agents?${t}`}},analyticsAgentsTimeSeries:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.includeOther===!0&&t.append(`includeOther`,`true`),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/agents/timeseries?${t}`}},analyticsBackend:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/backend?${t}`}},analyticsEdge:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/edge?${t}`}},analyticsAiGateway:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/ai-gateway?${t}`}},analyticsAiGatewayMe:e=>{let t=new URLSearchParams;return t.append(`account`,e.accountName),t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),{url:`${K}/v2/analytics/ai-gateway/users/me?${t}`}},analyticsAiGatewayField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/ai-gateway/fields/${encodeURIComponent(e)}?${n}`}},analyticsCache:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/cache?${t}`}},analyticsCacheField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/cache/fields/${encodeURIComponent(e)}?${n}`}},analyticsMcp:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/mcp?${t}`}},analyticsGraphql:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/graphql?${t}`}},analyticsMcpField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/mcp/fields/${encodeURIComponent(e)}?${n}`}},analyticsMcpCapabilities:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.view&&t.append(`view`,e.view),e.capabilityType&&t.append(`capabilityType`,e.capabilityType),e.limit&&t.append(`limit`,e.limit.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/mcp/capabilities?${t}`}},analyticsMcpEvents:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.limit!=null&&t.append(`limit`,e.limit.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/mcp/events?${t}`}},analyticsMcpBreakdown:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/mcp/breakdowns/${e}?${n}`}},analyticsUsage:e=>{let t=new URLSearchParams;return t.append(`account`,e.accountName),t.append(`from`,e.from),t.append(`to`,e.to),{url:`${K}/v2/analytics/usage?${t}`}}};function xh(e){let t=new Date;switch(e){case`7d`:t.setUTCDate(t.getUTCDate()-7);break;case`30d`:t.setUTCDate(t.getUTCDate()-30);break;case`3m`:t.setUTCMonth(t.getUTCMonth()-3);break}return t.toISOString()}async function Sh(e,t){let n=t.pageSize??30,{page:r,pageSize:i,order:a=`DESC`,orderBy:o=`periodStart`,...s}=t,{data:c,error:l}=await _h.GET(`/v3/metering/{bucketId}/billing/invoices`,{params:{path:{bucketId:e},query:{page:r,pageSize:n,expand:[`lines`],order:a,orderBy:o,...s}}});if(l||!c)throw l??Error(`Failed to load invoices`);return c}var Ch=15;async function wh(e,t,n=6){let r=await Sh(e,{page:1,pageSize:n,createdAfter:xh(`3m`),order:`DESC`,orderBy:`periodStart`,customers:[t]}),i=r.items??[];if(i.length===0||i.every(e=>e.customer?.id===t))return r;let a=[],o=1;for(;a.length<n&&o<=Ch;){let r=await Sh(e,{page:o,pageSize:30,createdAfter:xh(`3m`),order:`DESC`,orderBy:`periodStart`}),i=r.items??[];if(i.length===0)break;for(let e of i)if(e.customer?.id===t&&(a.push(e),a.length>=n))break;let s=r.pageSize??30,c=Math.max(1,Math.ceil((r.totalCount??0)/s));if(o>=c)break;o++}let s=a.slice(0,n);return{...r,items:s,totalCount:s.length,page:1,pageSize:n}}var Th={orderBy:`createdAt`,order:`DESC`},Eh=`/v3/metering/{bucketId}/plans`,Dh=`/v3/metering/{bucketId}/customers`;function Oh(e){if(!e)return;let t={};return e.page!=null&&(t.page=e.page,t.pageSize=e.pageSize??30),e.status?.length&&(t.status=e.status),Object.keys(t).length>0?t:void 0}function kh(e,t){let n=Oh(t);return n?{params:{path:{bucketId:e},query:n}}:{params:{path:{bucketId:e}}}}function Ah(e){if(!e)return;let t={orderBy:e.orderBy??Th.orderBy,order:e.order??Th.order};return e.page!=null&&(t.page=e.page,t.pageSize=e.pageSize??30),e.planKey&&(t.planKey=e.planKey),e.name&&(t.name=e.name),e.key&&(t.key=e.key),e.primaryEmail&&(t.primaryEmail=e.primaryEmail),Object.keys(t).length>0?t:void 0}function jh(e,t){let n=Ah(t);return n?{params:{path:{bucketId:e},query:n}}:{params:{path:{bucketId:e}}}}function Mh(e){let t={page:e.page??1,pageSize:e.pageSize??30};return e.includeArchived!=null&&(t.includeArchived=e.includeArchived),t}function Nh(e,t,n){return Array.isArray(e)?{items:e,totalCount:e.length,page:t,pageSize:n}:e}var Ph={ai:{providerAssignments:{list:(e,t)=>vh.queryOptions(`get`,`/v1/accounts/{accountName}/projects/{projectName}/ai-provider-assignments`,{params:{path:{accountName:e,projectName:t}}},{select:e=>e.data})}},deployments:{list:(e,t)=>vh.queryOptions(`get`,`/v1/accounts/{accountName}/projects/{projectName}/deployments`,{params:{path:{accountName:e,projectName:t}}}),versions:{list:e=>vh.queryOptions(`get`,`/v1/deployments/{deploymentName}/versions`,{params:{path:{deploymentName:e}}})}},metering:{customers:{list:(e,t)=>vh.queryOptions(`get`,Dh,jh(e,t),t?.page==null?void 0:{placeholderData:um}),get:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/customers/{customerIdOrKey}`,{params:{path:{bucketId:e,customerIdOrKey:t}}}),subscriptions:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/customers/{customerIdOrKey}/subscriptions`,{params:{path:{bucketId:e,customerIdOrKey:t}}})},plans:{list:(e,t)=>vh.queryOptions(`get`,Eh,kh(e,t),t?.page==null?void 0:{placeholderData:um}),get:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/plans/{planId}`,{params:{path:{bucketId:e,planId:t}}}),listByKey:(e,t)=>vh.queryOptions(`get`,Eh,{params:{path:{bucketId:e},query:{key:[t]}}})},meters:{list:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/meters`,{params:{path:{bucketId:e}}})},configuration:{get:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/monetization-configuration`,{params:{path:{bucketId:e}}})},features:{list:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/features`,{params:{path:{bucketId:e},query:t?{includeArchived:t}:void 0}},{select:e=>Array.isArray(e)?e:e.items}),listPaginated:(e,t)=>{let n=t.page??1,r=t.pageSize??30;return vh.queryOptions(`get`,`/v3/metering/{bucketId}/features`,{params:{path:{bucketId:e},query:Mh(t)}},{select:e=>Nh(e,n,r),placeholderData:um})}},planInvites:{list:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/plan-invites`,{params:{path:{bucketId:e}}})},billingReadiness:{get:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/billing-readiness`,{params:{path:{bucketId:e}}})},stripe:{setup:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/setup/stripe`,{params:{path:{bucketId:e}}})},subscriptions:{get:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}`,{params:{path:{bucketId:e,subscriptionId:t}}}),access:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}/access`,{params:{path:{bucketId:e,subscriptionId:t}}}),usage:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}/usage`,{params:{path:{bucketId:e,subscriptionId:t}}})},invoices:{list:(e,t,n,r,i,a)=>({queryKey:[`metering`,e,`invoices`,t,n,r??`all`,a,i],queryFn:()=>Sh(e,{page:n,pageSize:30,createdAfter:xh(t),order:i,orderBy:a,...r?.statuses?.length?{statuses:r.statuses}:{},...r?.extendedStatuses?.length?{extendedStatuses:r.extendedStatuses}:{}}),placeholderData:um}),forCustomer:(e,t)=>({queryKey:[`metering`,e,`invoices`,`customer`,t],queryFn:()=>wh(e,t)})}}},Fh=[`ai-pool`,`ai-app`,`ai-user-app`],Ih=e=>e.metadata?.type==null,Lh=e=>{let t=e.metadata?.type;return typeof t==`string`&&Fh.includes(t)?t:void 0},Rh=e=>{if(Ih(e))return!0;let t=Lh(e);return t===`ai-pool`||t===`ai-app`};function zh(e){return e.some(e=>!Rh(e))?e.filter(Rh):e}var Bh=e=>e?.find(e=>e.parentId?!1:Ih(e)?!0:Lh(e)===`ai-pool`),Vh=e=>{let{type:t,...n}=e;return n},Hh=async e=>Uh(e,await i(()=>import(`./editor.main-B7ZQNwu9.js`),__vite__mapDeps([0,1,2,3,4,5,6]))),Uh=(e,t)=>{let n=e.split(`.`).pop();if(n)return t.languages.getLanguages().find(e=>e.extensions?.includes(`.${n}`))},Wh=`x-test-proxy-error`,Gh=`The gateway URL isn't ready yet — this environment is still being provisioned for its first deploy. Wait for the build to finish, then try again.`,Kh=class extends Error{constructor(e=Gh){super(e),this.name=`GatewayUrlUnavailableError`}},qh=[200,400,413,502],Jh=({pathname:e,overrideUrl:t})=>{if(!t)throw new Kh;return new URL(e??``,t).toString()},Yh=`zp-build-id`,Xh=({testRequest:e,overrideUrl:t,environmentName:n,buildId:r})=>({url:Jh({pathname:e.pathname,overrideUrl:t}),method:e.method,deployment:n,headers:r&&!Zh(e.headers)?{[Yh]:r,...e.headers}:e.headers,body:e.body}),Zh=e=>Object.keys(e??{}).some(e=>e.toLowerCase()===Yh),Qh=e=>{if(typeof e!=`object`||!e)return!1;let{status:t,body:n}=e;if(t!==404||typeof n!=`string`)return!1;try{return JSON.parse(n)?.title===`Build Not Found`}catch{return!1}},$h={invalid_request:`The Zuplo test proxy rejected the request as invalid.`,get_or_head_with_body:`The Zuplo test proxy rejected the request because GET and HEAD requests can't include a body.`,invalid_request_body:`The Zuplo test proxy couldn't read the request body.`,request_too_large:`The Zuplo test proxy rejected the request because it exceeds the 250 KB limit.`,upstream_request_failed:`The Zuplo test proxy couldn't reach your API — it was unreachable, timed out, or refused the connection.`},eg=e=>{let t=(e.code?$h[e.code]:void 0)??e.detail??e.title??`The Zuplo test proxy couldn't run this request.`;return`${t}${e.detail&&e.detail!==t?` ${e.detail}`:``} This is an error from the Zuplo test proxy, not a response from your API.`},tg=class extends Error{code;status;detail;title;constructor(e){super(eg(e)),this.name=`TestProxyError`,this.code=e.code,this.status=e.status,this.detail=e.detail,this.title=e.title}},ng=async e=>{let t=e.headers.get(Wh),n;try{let t=await e.clone().json();t&&typeof t==`object`&&(n=t)}catch{}return new tg({code:n?.code??t??void 0,detail:typeof n?.detail==`string`?n.detail:void 0,title:typeof n?.title==`string`?n.title:void 0,status:typeof n?.status==`number`?n.status:e.status})},rg={createApiKey:e=>({url:`${K}/v1/auth/api-keys`,method:`POST`,json:!0,body:JSON.stringify(e),invalidateKeys:[$.authAccountApiKeys(e.accountName)],acceptableStatuses:[200]}),deleteApiKey:(e,t)=>({url:`${K}/v1/auth/api-keys/${e}`,method:`DELETE`,invalidateKeys:[$.authApiKey(e),$.authAccountApiKeys(t)],acceptableStatuses:[204]}),updateUsersRole:({userId:e,accountName:t,projectName:n,role:r})=>({url:`${K}/v1/auth/users/${e}`,method:`PATCH`,json:!0,body:JSON.stringify({accountName:t,projectName:n,role:r}),parseResponse:!1,invalidateKeys:n?[$.authProjectUsersRoles(t,n,{includeInheritedRoles:!1}),$.authProjectUsersRoles(t,n,{includeInheritedRoles:!0}),$.authAccountUsersRoles(t),$.authCurrentUserAccountRoles(t)]:[$.authAccountUsersRoles(t),$.authCurrentUserAccountRoles(t)],acceptableStatuses:[201,200]})},ig={createAccount:e=>({url:`${K}/v1/accounts`,method:`POST`,json:!0,body:JSON.stringify(e),invalidateKeys:[$.accounts()],acceptableStatuses:[201]}),deleteAccount:e=>({url:`${K}/v1/accounts/${e.name}`,method:`DELETE`,invalidateKeys:[$.accounts()],acceptableStatuses:[200]}),createCustomDomain:({accountName:e,projectName:t,isAlias:n,hostname:r,deploymentName:i,stage:a})=>({url:`${K}/v1/accounts/${e}/custom-domains`,method:`POST`,body:JSON.stringify({hostname:r,isAlias:n,deploymentName:i,stage:a}),invalidateKeys:[$.accounts(),$.projects(e),$.environments(e,t),$.customDomains(e,t),$.accountCustomDomains(e),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[200]}),deleteAccountMemberInvite:({accountName:e,inviteId:t})=>({url:`${K}/v1/accounts/${e}/account-member-invites/${t}`,method:`DELETE`,invalidateKeys:[$.accountMemberInvites(e)],acceptableStatuses:[204]}),deleteCustomDomain:({accountName:e,projectName:t,hostname:n,deploymentName:r})=>({url:`${K}/v1/accounts/${e}/custom-domains?hostname=${n}&deploymentName=${r}`,method:`DELETE`,invalidateKeys:[$.accounts(),$.projects(e),$.environments(e,t),$.customDomains(e,t),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[204]}),editCustomDomain:({accountName:e,projectName:t,hostname:n,deploymentName:r})=>({url:`${K}/v1/accounts/${e}/custom-domains`,method:`PATCH`,body:JSON.stringify({hostname:n,deploymentName:r}),invalidateKeys:[$.accounts(),$.projects(e),$.environments(e,t),$.customDomains(e,t),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[200]}),resendAccountMemberInvite:({accountName:e,inviteId:t})=>({url:`${K}/v1/accounts/${e}/account-member-invites/${t}/$resend`,method:`PATCH`,body:JSON.stringify({}),invalidateKeys:[$.accountMemberInvites(e)],acceptableStatuses:[201]}),billingUpgrade:(e,t,n,r)=>({method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({successUrl:n,cancelUrl:r}),url:`${K}/v1/accounts/${e}/upgrade/${t}`}),updateAccount:({accountName:e,...t})=>({url:`${K}/v1/accounts/${e}`,method:`PATCH`,body:JSON.stringify(t),json:!0,invalidateKeys:[$.accounts()],acceptableStatuses:[200]})},ag={createProject:(e,t,{productType:n,...r}={})=>({url:`${K}/v1/accounts/${e}/projects`,method:`POST`,body:JSON.stringify({name:t,productType:n,options:r}),removeKeys:[$.projects(e),$.authCurrentUserAccountRoles(e)],acceptableStatuses:[201]}),createProjectWithRepo:(e,t,n,r,i)=>({url:`${K}/v1/accounts/${e}/projects/$create-with-repo`,method:`POST`,body:JSON.stringify({projectName:t,orgName:n,repositoryName:r,defaultBranch:i}),removeKeys:[$.projects(e),$.authCurrentUserAccountRoles(e)],acceptableStatuses:[201]}),createProjectFromRepo:(e,t,n,r)=>({url:`${K}/v1/accounts/${e}/projects/$create-from-repo`,method:`POST`,body:JSON.stringify({projectName:t,sourceRepoUrl:n,defaultBranch:r}),removeKeys:[$.projects(e),$.authCurrentUserAccountRoles(e)],acceptableStatuses:[201]}),createRepoFromProject:(e,t,n,r,i,a)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$create-repo`,method:`POST`,body:JSON.stringify({orgName:n,repositoryName:r,defaultBranch:i,otherParams:a}),invalidateKeys:[$.projects(e),$.environments(e,t),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[201]}),connectProjectToRepo:(e,t,n,r,i,a)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$connect`,method:`PATCH`,body:JSON.stringify({orgName:n,repositoryURL:r,defaultBranch:i,forceConnect:a}),invalidateKeys:[$.projects(e),$.environments(e,t),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[201]}),disconnectProjectFromRepo:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$disconnect`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[$.projects(e)],acceptableStatuses:[201]}),initProject:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$init`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[$.projects(e)],acceptableStatuses:[201]}),deleteProject:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}`,method:`DELETE`,invalidateKeys:[$.projects(e),Ph.deployments.list(e,t).queryKey],removeKeys:[$.environments(e,t),$.authCurrentUserAccountRoles(e)],acceptableStatuses:[204]}),archiveProject:e=>({url:`${K}/v1/deployments/${e}/archive`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[200]}),updateDefaultBranch:({accountName:e,projectName:t,defaultBranch:n,sourceRepoUrl:r})=>({url:`${K}/v1/accounts/${e}/projects/${t}/$update-default-branch`,method:`PATCH`,body:JSON.stringify({defaultBranch:n,sourceRepoUrl:r}),headers:{"content-type":`application/json`},invalidateKeys:[$.projects(e),Ph.deployments.list(e,t).queryKey],removeKeys:[$.environments(e,t)],acceptableStatuses:[200]})},og={createConsumer:e=>{let t={...e.consumer,accountName:e.accountName,projectName:e.projectName,environmentType:e.environmentType};return{url:`${K}/v1/api-keys/${e.bucketId}/consumers`,method:`POST`,body:JSON.stringify(t),headers:{"content-type":`application/json`},invalidateKeys:[$.consumersForBucket(e.bucketId)],acceptableStatuses:[201]}},updateConsumer:e=>({url:`${K}/v1/api-keys/${e.bucketId}/consumers/${e.consumer.id}`,method:`PATCH`,body:JSON.stringify({...e.consumer}),headers:{"content-type":`application/json`},invalidateKeys:[$.consumersForBucket(e.bucketId)],acceptableStatuses:[200]}),removeConsumer:e=>({url:`${K}/v1/api-keys/${e.bucketId}/consumers/${e.consumer.id}`,method:`DELETE`,invalidateKeys:[$.consumersForBucket(e.bucketId)]})},sg={updateEnvironmentVariable:e=>({url:`${K}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables/${e.variableData.id}`,method:`PATCH`,body:JSON.stringify(e.variableData),invalidateKeys:[$.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[200]}),createEnvironmentVariable:e=>({url:`${K}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables`,method:`POST`,body:JSON.stringify(e.variableData),json:!0,invalidateKeys:[$.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[201]}),deleteEnvironmentVariable:e=>({url:`${K}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables/${e.id}`,method:`DELETE`,invalidateKeys:[$.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[204]})},cg={updatePreferences:e=>({url:`${K}/v1/users/me/preferences`,method:`PUT`,invalidateKeys:[$.user.preferences()],body:JSON.stringify({data:e}),headers:{"content-type":`application/json`},acceptableStatuses:[200]}),requestVerificationEmail:()=>({url:`${K}/v1/users/me/$send-verification-email`,method:`POST`,invalidateKeys:[],acceptableStatuses:[201]}),enrollMfaFactor:e=>({url:`${K}/v1/mfa/factors/enroll`,method:`POST`,body:JSON.stringify({factor:e}),invalidateKeys:[$.mfaFactors()],acceptableStatuses:[200],json:!0}),deleteMfaEnrollment:e=>({url:`${K}/v1/mfa/factors/enrollments/${e}`,method:`DELETE`,invalidateKeys:[$.mfaFactors()],acceptableStatuses:[200]})},lg={tokenExchangeSourceControlCredentials:(e,t,n)=>({url:`${K}/v1/accounts/${e}/source-control-configs/${t}/$token-exchange`,method:`POST`,body:JSON.stringify({code:n}),invalidateKeys:[$.accountsSourceControlConfigurations()],acceptableStatuses:[201]}),revokeSourceControlCredentials:(e,t)=>({url:`${K}/v1/accounts/${e}/source-control-configs/${t}/$revoke-token`,method:`DELETE`,invalidateKeys:[$.accountsSourceControlConfigurations()],acceptableStatuses:[204]})},ug={commitPush:(e,t,n,r)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$commit-push`,method:`POST`,body:JSON.stringify({branchName:r,commitMessage:n}),acceptableStatuses:[201]}),sync:(e,t,n)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$sync`,method:`POST`,body:JSON.stringify({branchName:n}),acceptableStatuses:[201,200],invalidateKeys:[]})},dg={makeTestRequest:({environmentName:e,testRequest:t,overrideUrl:n,buildId:r})=>({url:`${Oc}/v1/test`,method:`POST`,body:JSON.stringify(Xh({testRequest:t,overrideUrl:n,environmentName:e,buildId:r})),acceptableStatuses:qh,headers:{"content-type":`application/json`}})},fg={requestFeature:({email:e,featureName:t,information:n})=>{let r={featureName:t,information:{email:e,...n}};return{url:`${K}/v1/feature-access-request`,method:`POST`,body:JSON.stringify(r),acceptableStatuses:[200],headers:{"content-type":`application/json`}}}},pg={saveFile:({environmentName:e,file:t})=>{let n={"content-type":`text/plain`};return t.lastModified&&(n[`if-unmodified-since`]=new Date(t.lastModified).toUTCString()),{url:`${K}/v1/deployments/${e}/fs/file?path=${t.path}`,method:`POST`,body:t.content,headers:n,acceptableStatuses:[204,200],invalidateKeys:[$.file(e,t.path),$.deploymentVersions(e),Ph.deployments.versions.list(e).queryKey]}},renameFile:({environmentName:e,path:t,newPath:n})=>({url:`${K}/v1/deployments/${e}/fs/file?path=${t}`,method:`PATCH`,body:JSON.stringify({newPath:n}),acceptableStatuses:[204,200],headers:{"content-type":`application/json`},invalidateKeys:[]}),saveMultipleFiles:async({environmentName:e,files:t})=>{let n=new FormData,r={};for(let e of t)if(e.lastModified){let t=`x-if-unmodified-since-${encodeURIComponent(e.path)}`;r[t]=new Date(e.lastModified).toUTCString()}for(let{content:e,path:r}of t){let t=(await Hh(r))?.id;n.append(`files[]`,new File([e??``],r,{type:t===`text/typescript`?`text/javascript`:t}),r)}let i=t.map(({path:t})=>$.file(e,t));return{url:`${K}/v1/deployments/${e}/fs/files`,method:`POST`,body:n,headers:r,acceptableStatuses:[204,200],invalidateKeys:[...i,$.deploymentVersions(e),Ph.deployments.versions.list(e).queryKey]}},deleteFile:({environmentName:e,filePath:t})=>({url:`${K}/v1/deployments/${e}/fs/delete?path=${t}`,method:`DELETE`,acceptableStatuses:[204,200]})},mg={createDirectory:({environmentName:e,path:t})=>({url:`${K}/v1/deployments/${e}/fs/dir?path=${t}`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[201]})},hg={redeploy:({environmentName:e,isWorkingCopy:t,version:n})=>({url:t?`${K}/v1/deployments/${e}/$redeploy`:`${K}/v1/deployments/${e}/versions/${n}/$redeploy`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[200],invalidateKeys:[$.deploymentVersions(e),Ph.deployments.versions.list(e).queryKey]}),delete:({environmentName:e})=>({url:`${K}/v1/deployments/${e}`,method:`DELETE`,body:JSON.stringify({}),acceptableStatuses:[200]})},gg={acceptAccountInvite:(e,t)=>({url:`${K}/v1/account-member-invites/${e}`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[$.accounts()],removeKeys:t?[$.authCurrentUserAccountRoles(t)]:[],acceptableStatuses:[201]}),createAccountInvite:(e,t,n)=>{let r=n?.project?.name?[$.authProjectUsersRoles(e,n.project.name),n.team?.id?$.bucketConfigurationMembers(n.team?.bucketId,n.team?.id):[],$.authProjectUsersRoles(e,n.project.name,{includeInheritedRoles:!1}),$.authProjectUsersRoles(e,n.project.name,{includeInheritedRoles:!0})].flat():[];return{url:`${K}/v1/accounts/${e}/account-member-invites`,method:`POST`,body:JSON.stringify({userEmail:t,metadata:n}),invalidateKeys:[$.accountMemberInvites(e),$.authAccountUsersRoles(e),$.authCurrentUserAccountRoles(e),...r],acceptableStatuses:[201]}}},_g={createMeteringPlan:(e,t,n)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/plans`,method:`POST`,headers:{"Content-Type":`application/json`},invalidateKeys:[$.meteringPlans(e,t),$.meteringBucket(e,t)],body:JSON.stringify(n)}),deleteMeteringPlan:(e,t,n)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/plans/${n}`,invalidateKeys:[$.meteringPlans(e,t),$.meteringBucket(e,t)],method:`DELETE`}),updateMeteringPlan:(e,t,{id:n,...r})=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/plans/${n}`,invalidateKeys:[$.meteringPlans(e,t),$.meteringBucket(e,t)],method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})},vg=e=>({urlPrefix:`${K}/v1/buckets/${e}/configurations`}),yg={auth:rg,accounts:ig,ai:{createBucketConfiguration:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations`,method:`POST`,json:!0,body:JSON.stringify(t),acceptableStatuses:[201,200],invalidateKeys:[$.bucketConfigurations(e),$.bucketConfigurationPools(e),$.bucketConfigurationApps(e),$.bucketConfigurationUserApps(e)]}),updateBucketConfiguration:(e,t,n)=>{let r=n.metadata===void 0?n:{...n,metadata:Vh(n.metadata)};return{url:`${K}/v1/buckets/${e}/configurations/${t}`,method:`PATCH`,json:!0,body:JSON.stringify(r),acceptableStatuses:[200,201],invalidateKeys:[vg(e)]}},deleteBucketConfiguration:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations/${t}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[$.bucketConfigurations(e),$.bucketConfigurationPools(e),$.bucketConfigurationApps(e),$.bucketConfigurationUserApps(e)]}),createBucketConfigurationMember:(e,t,n,r)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members`,method:`POST`,json:!0,body:JSON.stringify({sub:n,role:r}),acceptableStatuses:[201,200],invalidateKeys:[$.bucketConfiguration(e,t),$.bucketConfigurationMembers(e,t)]}),putBucketConfigurationMemberRole:(e,t,n,r)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`PUT`,json:!0,body:JSON.stringify({role:r}),acceptableStatuses:[204,200],invalidateKeys:[$.bucketConfiguration(e,t),$.bucketConfigurationMembers(e,t),$.bucketConfigurationPools(e)]}),deleteBucketConfigurationMember:(e,t,n)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[$.bucketConfigurationMembers(e,t)]}),updateBucketConfigurationMember:(e,t,n,r)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`PATCH`,json:!0,body:JSON.stringify({role:r}),acceptableStatuses:[200],invalidateKeys:[$.bucketConfigurationMembers(e,t)]}),createBucketAiProvider:(e,{name:t,baseURL:n,description:r})=>({url:`${K}/v1/buckets/${e}/providers`,method:`POST`,json:!0,body:JSON.stringify({baseURL:n,name:t,description:r})}),deleteBucketAiProvider:(e,t)=>({url:`${K}/v1/buckets/${e}/providers/${t}`,method:`DELETE`,invalidateKeys:[$.supportedAiProviders(e)],acceptableStatuses:[204,200,404]}),createAiProviderModel:(e,t,{model:n,kind:r,inputCostPerToken:i,outputCostPerToken:a,cachedInputCostPerToken:o,cacheWriteCostPerToken:s,status:c})=>({url:`${K}/v1/buckets/${e}/providers/${t}/models`,method:`POST`,json:!0,body:JSON.stringify({model:n,kind:r,inputCostPerToken:i,outputCostPerToken:a,cachedInputCostPerToken:o,cacheWriteCostPerToken:s,status:c}),invalidateKeys:[$.supportedAiProviders(e)],acceptableStatuses:[200]}),updateAiProviderModel:(e,t,n,{inputCostPerToken:r,outputCostPerToken:i,cachedInputCostPerToken:a,cacheWriteCostPerToken:o,status:s})=>({url:`${K}/v1/buckets/${e}/providers/${t}/models/${n}`,method:`PATCH`,json:!0,body:JSON.stringify({inputCostPerToken:r,outputCostPerToken:i,cachedInputCostPerToken:a,cacheWriteCostPerToken:o,status:s}),invalidateKeys:[$.supportedAiProviders(e)],acceptableStatuses:[200]}),deleteAiProviderModel:(e,t,n)=>({url:`${K}/v1/buckets/${e}/providers/${t}/models/${n}`,method:`DELETE`,invalidateKeys:[$.supportedAiProviders(e)],acceptableStatuses:[204]}),createAiProviderAssignment:(e,t,n)=>({url:`${K}/v1/accounts/${e}/projects/${t}/ai-provider-assignments`,method:`POST`,body:JSON.stringify({...n,metadata:JSON.stringify(n.metadata)}),headers:{"content-type":`application/json`},invalidateKeys:[$.aiProviderAssignments(e,t)],acceptableStatuses:[201]}),updateAiProviderAssignment:(e,t,n,r)=>({url:`${K}/v1/accounts/${e}/projects/${t}/ai-provider-assignments/${n}`,method:`PATCH`,body:JSON.stringify({...r,...r.metadata?{metadata:JSON.stringify(r.metadata)}:{}}),headers:{"content-type":`application/json`},invalidateKeys:[$.aiProviderAssignments(e,t)],acceptableStatuses:[200]}),deleteAiProviderAssignment:(e,t,n)=>({url:`${K}/v1/accounts/${e}/projects/${t}/ai-provider-assignments/${n}`,method:`DELETE`,invalidateKeys:[$.aiProviderAssignments(e,t)],acceptableStatuses:[204]})},projects:ag,consumers:og,environmentVariables:sg,users:cg,sourceControlCredentials:lg,sourceControlOperations:ug,testDesigner:dg,featureRequest:fg,fileTransactions:pg,directories:mg,environments:hg,accountInvite:gg,metering:_g,logs:{sourcemap:e=>({url:`${K}/v1/logs/sourcemap`,method:`POST`,json:!0,body:JSON.stringify(e),acceptableStatuses:[200]})},identityConnections:{createTicket:e=>({url:`${K}/v1/accounts/${e}/identity-connections/ticket`,method:`POST`,json:!0,body:JSON.stringify({}),invalidateKeys:[$.identityConnections(e)],acceptableStatuses:[200]})},migration:{migrateDevPortal:e=>({url:`${K}/v1/migrate/dev-portal`,method:`POST`,json:!1,body:JSON.stringify({deploymentName:e}),headers:{"content-type":`application/json`},acceptableStatuses:[200]})}},bg=e=>{let t=Jm(),n=Ep();return{fetch:async r=>{let i=Kc(),a;try{a=await hh(t=>{let n=new Headers(r.headers);return r.json&&r.method!==`DELETE`&&n.set(`content-type`,`application/json`),n.set(`authorization`,`Bearer ${t}`),n.set(`zuplo-request-id`,i),fetch(r.url,{...e,method:r.method,headers:n,body:r.body})},n,xp)}catch(e){throw e instanceof Tc&&e.setTraceId(i),e instanceof TypeError?new wc({type:`https://zup.fail/api-request-failed`,title:`API request failed`,status:500,instance:r.url,traceId:i}):e}if(!(r.acceptableStatuses??[200]).includes(a.status)){let e=new Tc(`Unexpected response: ${a.status} calling ${r.method}: ${r.url}`,{traceId:i});throw await e.tryReadResponse(a),e}let o=e=>e.split(`?`)[0];return r.invalidateKeys?.forEach(e=>{if(Array.isArray(e))t.invalidateQueries({queryKey:e,exact:!1});else if(`urlPrefix`in e&&e.urlPrefix){let n=o(e.urlPrefix);t.invalidateQueries({predicate:e=>{let t=e.queryKey[0];if(typeof t!=`string`)return!1;let r=o(t);return r===n||r.startsWith(`${n}/`)}})}else if(`url`in e&&e.url){let n=o(e.url);t.invalidateQueries({predicate:e=>{let t=e.queryKey[0];return typeof t==`string`&&o(t)===n}})}}),r.removeKeys?.forEach(e=>{t.removeQueries({queryKey:[e.url]})}),r.parseResponse===!1?a:r.json?await a.json():a}}};typeof window<`u`&&window.document&&window.document.createElement;function xg(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var Sg=q.useId||(()=>void 0),Cg=0;function wg(e){let[t,n]=q.useState(Sg());return ql(()=>{e||n(e=>e??String(Cg++))},[e]),e||(t?`radix-${t}`:``)}var Tg=`focusScope.autoFocusOnMount`,Eg=`focusScope.autoFocusOnUnmount`,Dg={bubbles:!1,cancelable:!0},Og=`FocusScope`,kg=q.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=q.useState(null),l=Al(i),u=Al(a),d=q.useRef(null),f=ml(t,e=>c(e)),p=q.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;q.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Ig(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Ig(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Ig(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),q.useEffect(()=>{if(s){Lg.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Tg,Dg);s.addEventListener(Tg,l),s.dispatchEvent(t),t.defaultPrevented||(Ag(Bg(Mg(s)),{select:!0}),document.activeElement===e&&Ig(s))}return()=>{s.removeEventListener(Tg,l),setTimeout(()=>{let t=new CustomEvent(Eg,Dg);s.addEventListener(Eg,u),s.dispatchEvent(t),t.defaultPrevented||Ig(e??document.body,{select:!0}),s.removeEventListener(Eg,u),Lg.remove(p)},0)}}},[s,l,u,p]);let m=q.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=jg(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Ig(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Ig(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,J.jsx)(Ol.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});kg.displayName=Og;function Ag(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Ig(r,{select:t}),document.activeElement!==n)return}function jg(e){let t=Mg(e);return[Ng(t,e),Ng(t.reverse(),e)]}function Mg(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ng(e,t){for(let n of e)if(!Pg(n,{upTo:t}))return n}function Pg(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Fg(e){return e instanceof HTMLInputElement&&`select`in e}function Ig(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Fg(e)&&t&&e.select()}}var Lg=Rg();function Rg(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=zg(e,t),e.unshift(t)},remove(t){e=zg(e,t),e[0]?.resume()}}}function zg(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Bg(e){return e.filter(e=>e.tagName!==`A`)}function Vg(e){let t=Hg(e),n=q.forwardRef((e,n)=>{let{children:r,...i}=e,a=q.Children.toArray(r),o=a.find(Gg);if(o){let e=o.props.children,r=a.map(t=>t===o?q.Children.count(e)>1?q.Children.only(null):q.isValidElement(e)?e.props.children:null:t);return(0,J.jsx)(t,{...i,ref:n,children:q.isValidElement(e)?q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Hg(e){let t=q.forwardRef((e,t)=>{let{children:n,...r}=e;if(q.isValidElement(n)){let e=qg(n),i=Kg(r,n.props);return n.type!==q.Fragment&&(i.ref=t?il(t,e):e),q.cloneElement(n,i)}return q.Children.count(n)>1?q.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ug=Symbol(`radix.slottable`);function Wg(e){let t=({children:e})=>(0,J.jsx)(J.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=Ug,t}function Gg(e){return q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ug}function Kg(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function qg(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Jg=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Vg(`Primitive.${t}`),r=q.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,J.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Yg(e,t){e&&Dl.flushSync(()=>e.dispatchEvent(t))}var Xg=`Portal`,Zg=q.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=q.useState(!1);ql(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Dl.createPortal((0,J.jsx)(Jg.div,{...r,ref:t}),o):null});Zg.displayName=Xg;function Qg(e,t){return q.useReducer((e,n)=>t[e][n]??e,e)}var $g=e=>{let{present:t,children:n}=e,r=e_(t),i=typeof n==`function`?n({present:r.isPresent}):q.Children.only(n),a=al(r.ref,n_(i));return typeof n==`function`||r.isPresent?q.cloneElement(i,{ref:a}):null};$g.displayName=`Presence`;function e_(e){let[t,n]=q.useState(),r=q.useRef(null),i=q.useRef(e),a=q.useRef(`none`),[o,s]=Qg(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return q.useEffect(()=>{let e=t_(r.current);a.current=o===`mounted`?e:`none`},[o]),ql(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=t_(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),ql(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=t_(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=t_(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:q.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function t_(e){return e?.animationName||`none`}function n_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var r_=0;function i_(){q.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??a_()),document.body.insertAdjacentElement(`beforeend`,e[1]??a_()),r_++,()=>{r_===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),r_--}},[])}function a_(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var o_=function(){return o_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o_.apply(this,arguments)};function s_(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function c_(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var l_=`right-scroll-bar-position`,u_=`width-before-scroll-bar`,d_=`with-scroll-bars-hidden`,f_=`--removed-body-scroll-bar-size`;function p_(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function m_(e,t){var n=(0,q.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var h_=typeof window<`u`?q.useLayoutEffect:q.useEffect,g_=new WeakMap;function __(e,t){var n=m_(t||null,function(t){return e.forEach(function(e){return p_(e,t)})});return h_(function(){var t=g_.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||p_(e,null)}),i.forEach(function(e){r.has(e)||p_(e,a)})}g_.set(n,e)},[e]),n}function v_(e){return e}function y_(e,t){t===void 0&&(t=v_);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function b_(e){e===void 0&&(e={});var t=y_(null);return t.options=o_({async:!0,ssr:!1},e),t}var x_=function(e){var t=e.sideCar,n=s_(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return q.createElement(r,o_({},n))};x_.isSideCarExport=!0;function S_(e,t){return e.useMedium(t),x_}var C_=b_(),w_=function(){},T_=q.forwardRef(function(e,t){var n=q.useRef(null),r=q.useState({onScrollCapture:w_,onWheelCapture:w_,onTouchMoveCapture:w_}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=s_(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=__([n,t]),C=o_(o_({},b),i);return q.createElement(q.Fragment,null,u&&q.createElement(x,{sideCar:C_,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?q.cloneElement(q.Children.only(s),o_(o_({},C),{ref:S})):q.createElement(v,o_({},C,{className:c,ref:S}),s))});T_.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},T_.classNames={fullWidth:u_,zeroRight:l_};var E_,D_=function(){if(E_)return E_;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function O_(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=D_();return t&&e.setAttribute(`nonce`,t),e}function k_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function A_(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var j_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=O_())&&(k_(t,n),A_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},M_=function(){var e=j_();return function(t,n){q.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},N_=function(){var e=M_();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},P_={left:0,top:0,right:0,gap:0},F_=function(e){return parseInt(e||``,10)||0},I_=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[F_(n),F_(r),F_(i)]},L_=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return P_;var t=I_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},R_=N_(),z_=`data-scroll-locked`,B_=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function su(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof nu;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}su.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},su.prototype.next=function(e){return this._invoke(`next`,e)},su.prototype.throw=function(e){return this._invoke(`throw`,e)},su.prototype.return=function(e){return this._invoke(`return`,e)};var cu=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},lu={},uu={};Object.defineProperty(uu,`__esModule`,{value:!0});var du=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);r===void 0?n===void 0?e.locked.set(t,[]):e.locked.set(t,[n]):n!==void 0&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(n!==void 0&&n.length!==0){var r=n.pop();e.locked.set(t,n),r!==void 0&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return e.instance===void 0&&(e.instance=new e),e.instance},e}();uu.default=function(){return du.getInstance()};var fu=cu&&cu.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,s)}c((r=r.apply(e,t||[])).next())})},pu=cu&&cu.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},mu=cu;Object.defineProperty(lu,`__esModule`,{value:!0});var hu=uu,gu=`browser-tabs-lock-key`,_u={key:function(e){return fu(mu,void 0,void 0,function(){return pu(this,function(e){throw Error(`Unsupported`)})})},getItem:function(e){return fu(mu,void 0,void 0,function(){return pu(this,function(e){throw Error(`Unsupported`)})})},clear:function(){return fu(mu,void 0,void 0,function(){return pu(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return fu(mu,void 0,void 0,function(){return pu(this,function(e){throw Error(`Unsupported`)})})},setItem:function(e,t){return fu(mu,void 0,void 0,function(){return pu(this,function(e){throw Error(`Unsupported`)})})},keySync:function(e){return window.localStorage.key(e)},getItemSync:function(e){return window.localStorage.getItem(e)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(e){return window.localStorage.removeItem(e)},setItemSync:function(e,t){return window.localStorage.setItem(e,t)}};function vu(e){return new Promise(function(t){return setTimeout(t,e)})}function yu(e){for(var t=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz`,n=``,r=0;r<e;r++)n+=t[Math.floor(61*Math.random())];return n}lu.default=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+yu(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,e.waiters===void 0&&(e.waiters=[])}return e.prototype.acquireLock=function(t,n){return n===void 0&&(n=5e3),fu(this,void 0,void 0,function(){var r,i,a,o,s,c,l;return pu(this,function(u){switch(u.label){case 0:r=Date.now()+yu(4),i=Date.now()+n,a=gu+`-`+t,o=this.storageHandler===void 0?_u:this.storageHandler,u.label=1;case 1:return Date.now()<i?[4,vu(30)]:[3,8];case 2:return u.sent(),o.getItemSync(a)===null?(s=this.id+`-`+t+`-`+r,[4,vu(Math.floor(25*Math.random()))]):[3,5];case 3:return u.sent(),o.setItemSync(a,JSON.stringify({id:this.id,iat:r,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,vu(30)];case 4:return u.sent(),(c=o.getItemSync(a))!==null&&(l=JSON.parse(c)).id===this.id&&l.iat===r?(this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(a,r),[2,!0]):[3,7];case 5:return e.lockCorrector(this.storageHandler===void 0?_u:this.storageHandler),[4,this.waitForSomethingToChange(i)];case 6:u.sent(),u.label=7;case 7:return r=Date.now()+yu(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return fu(this,void 0,void 0,function(){var n=this;return pu(this,function(r){return setTimeout(function(){return fu(n,void 0,void 0,function(){var n,r,i;return pu(this,function(a){switch(a.label){case 0:return[4,hu.default().lock(t)];case 1:return a.sent(),this.acquiredIatSet.has(t)?(n=this.storageHandler===void 0?_u:this.storageHandler,(r=n.getItemSync(e))===null?(hu.default().unlock(t),[2]):((i=JSON.parse(r)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(i)),hu.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(hu.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return fu(this,void 0,void 0,function(){return pu(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var r=!1,i=Date.now(),a=!1;function o(){if(a||=(window.removeEventListener(`storage`,o),e.removeFromWaiting(o),clearTimeout(s),!0),!r){r=!0;var t=50-(Date.now()-i);t>0?setTimeout(n,t):n(null)}}window.addEventListener(`storage`,o),e.addToWaiting(o);var s=setTimeout(o,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),e.waiters!==void 0&&e.waiters.push(t)},e.removeFromWaiting=function(t){e.waiters!==void 0&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){e.waiters!==void 0&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return fu(this,void 0,void 0,function(){return pu(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return fu(this,void 0,void 0,function(){var n,r,i,a;return pu(this,function(o){switch(o.label){case 0:return n=this.storageHandler===void 0?_u:this.storageHandler,r=gu+`-`+t,(i=n.getItemSync(r))===null?[2]:(a=JSON.parse(i)).id===this.id?[4,hu.default().lock(a.iat)]:[3,2];case 1:o.sent(),this.acquiredIatSet.delete(a.iat),n.removeItemSync(r),hu.default().unlock(a.iat),e.notifyWaiters(),o.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,i=[],a=0;;){var o=r.keySync(a);if(o===null)break;i.push(o),a++}for(var s=!1,c=0;c<i.length;c++){var l=i[c];if(l.includes(gu)){var u=r.getItemSync(l);if(u!==null){var d=JSON.parse(u);(d.timeRefreshed===void 0&&d.timeAcquired<n||d.timeRefreshed!==void 0&&d.timeRefreshed<n)&&(r.removeItemSync(l),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}(),new TextEncoder,new TextDecoder,Uint8Array.prototype.toBase64;var bu=cu&&cu.__assign||function(){return bu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},bu.apply(this,arguments)},xu;(function(e){e.Code=`code`,e.ConnectCode=`connect_code`})(xu||={});var Su;(function(e){e.Bearer=`Bearer`,e.DPoP=`DPoP`})(Su||={});var Cu,wu,Tu;(typeof navigator>`u`||(Cu=navigator.userAgent)==null||(wu=Cu.startsWith)==null||!wu.call(Cu,`Mozilla/5.0 `))&&(Tu=`oauth4webapi/v3.8.6`);function Eu(e,t){if(e==null)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch{return!1}}var Du=`ERR_INVALID_ARG_VALUE`,Ou=`ERR_INVALID_ARG_TYPE`;function ku(e,t,n){let r=TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}var Au=Symbol(),ju=Symbol(),Mu=Symbol(),Nu=Symbol(),Pu=Symbol(),Fu=new TextEncoder,Iu=new TextDecoder;function Lu(e){return typeof e==`string`?Fu.encode(e):Iu.decode(e)}var Ru,zu;if(Uint8Array.prototype.toBase64)Ru=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:`base64url`,omitPadding:!0}));else{let e=32768;Ru=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));let n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join(``)).replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`)}}function Bu(e){return typeof e==`string`?zu(e):Ru(e)}zu=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:`base64url`})}catch(e){throw ku(`The input to be decoded is not correctly encoded.`,Du,e)}}:e=>{try{let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`).replace(/\s/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw ku(`The input to be decoded is not correctly encoded.`,Du,e)}};var Vu=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`code`,void 0),this.name=this.constructor.name,this.code=Fd,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}},Hu=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`code`,void 0),this.name=this.constructor.name,t!=null&&t.code&&(this.code=t?.code),(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}};function X(e,t,n){return new Hu(e,{code:t,cause:n})}function Uu(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wu(e){Eu(e,Headers)&&(e=Object.fromEntries(e.entries()));let t=new Headers(e??{});if(Tu&&!t.has(`user-agent`)&&t.set(`user-agent`,Tu),t.has(`authorization`))throw ku(`"options.headers" must not include the "authorization" header name`,Du);return t}function Gu(e,t){if(t!==void 0){if(typeof t==`function`&&(t=t(e.href)),!(t instanceof AbortSignal))throw ku(`"options.signal" must return or be an instance of AbortSignal`,Ou);return t}}function Ku(e,t,n,r,i){try{if(typeof e!=`number`||!Number.isFinite(e))throw ku(`${n} must be a number`,Ou,i);if(e>0)return;if(t){if(e!==0)throw ku(`${n} must be a non-negative number`,Du,i);return}throw ku(`${n} must be a positive number`,Du,i)}catch(e){throw r?X(e.message,r,i):e}}function qu(e,t,n,r){try{if(typeof e!=`string`)throw ku(`${t} must be a string`,Ou,r);if(e.length===0)throw ku(`${t} must not be empty`,Du,r)}catch(e){throw n?X(e.message,n,r):e}}function Ju(e){(function(e,t){if(_d(e)!==t)throw function(e){let t=`"response" content-type must be `;var n=[...arguments].slice(1);if(n.length>2){let e=n.pop();t+=`${n.join(`, `)}, or ${e}`}else n.length===2?t+=`${n[0]} or ${n[1]}`:t+=n[0];return X(t,Rd,e)}(e,t)})(e,`application/json`)}function Yu(e){let t=e?.[ju];return typeof t==`number`&&Number.isFinite(t)?t:0}function Xu(e){let t=e?.[Mu];return typeof t==`number`&&Number.isFinite(t)&&Math.sign(t)!==-1?t:30}function Zu(){return Math.floor(Date.now()/1e3)}function Qu(e){if(typeof e!=`object`||!e)throw ku(`"as" must be an object`,Ou);qu(e.issuer,`"as.issuer"`)}function $u(e){if(typeof e!=`object`||!e)throw ku(`"client" must be an object`,Ou);qu(e.client_id,`"client.client_id"`)}function ed(e){return qu(e,`"clientSecret"`),(t,n,r,i)=>{r.set(`client_id`,n.client_id),r.set(`client_secret`,e)}}var td=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch{return null}};function nd(e,t){if(t&&e.protocol!==`https:`)throw X(`only requests to HTTPS are allowed`,Bd,e);if(e.protocol!==`https:`&&e.protocol!==`http:`)throw X(`only HTTP and HTTPS requests are allowed`,Vd,e)}function rd(e,t,n,r){let i;if(typeof e!=`string`||!(i=td(e)))throw X(`authorization server metadata does not contain a valid ${n?`"as.mtls_endpoint_aliases.${t}"`:`"as.${t}"`}`,e===void 0?Gd:Kd,{attribute:n?`mtls_endpoint_aliases.${t}`:t});return nd(i,r),i}function id(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?rd(e.mtls_endpoint_aliases[t],t,n,r):rd(e[t],t,n,r)}var ad=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`cause`,void 0),Y(this,`code`,void 0),Y(this,`error`,void 0),Y(this,`status`,void 0),Y(this,`error_description`,void 0),Y(this,`response`,void 0),this.name=this.constructor.name,this.code=Pd,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,`response`,{enumerable:!1,value:t.response}),(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}},od=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`cause`,void 0),Y(this,`code`,void 0),Y(this,`error`,void 0),Y(this,`error_description`,void 0),this.name=this.constructor.name,this.code=Id,this.cause=t.cause,this.error=t.cause.get(`error`),this.error_description=t.cause.get(`error_description`)??void 0,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}},sd=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`cause`,void 0),Y(this,`code`,void 0),Y(this,`response`,void 0),Y(this,`status`,void 0),this.name=this.constructor.name,this.code=Nd,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,`response`,{enumerable:!1}),(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}},cd="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",ld=`(`+cd+`)\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"`,ud=`(`+cd+")\\s*=\\s*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)",dd=RegExp(`^[,\\s]*(`+cd+`)`),fd=RegExp(`^[,\\s]*`+ld+`[,\\s]*(.*)`),pd=RegExp(`^[,\\s]*`+ud+`[,\\s]*(.*)`),md=RegExp(`^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)`);async function hd(e,t,n){if(e.status!==t){let t;throw function(e){let t;if(t=function(e){if(!Eu(e,Response))throw ku(`"response" must be an instance of Response`,Ou);let t=e.headers.get(`www-authenticate`);if(t===null)return;let n=[],r=t;for(;r;){let e=r.match(dd),t=e?.[1].toLowerCase();if(!t)return;let s=r.substring(e[0].length);if(s&&!s.match(/^[\s,]/))return;let c=s.match(/^\s+(.*)$/),l=!!c;r=c?c[1]:void 0;let u={},d;if(l)for(;r;){let t,n;if(e=r.match(fd)){var i=ou(e,4);if(t=i[1],n=i[2],r=i[3],n.includes(`\\`))try{n=JSON.parse(`"${n}"`)}catch{}u[t.toLowerCase()]=n}else{if(!(e=r.match(pd))){if(e=r.match(md)){if(Object.keys(u).length)break;var a=ou(e,3);d=a[1],r=a[2];break}return}var o=ou(e,4);t=o[1],n=o[2],r=o[3],u[t.toLowerCase()]=n}}else r=s||void 0;let f={scheme:t,parameters:u};d&&(f.token68=d),n.push(f)}return n.length?n:void 0}(e))throw new sd(`server responded with a challenge in the WWW-Authenticate HTTP Header`,{cause:t,response:e})}(e),(t=await async function(e){if(e.status>399&&e.status<500){qd(e),Ju(e);try{let t=await e.clone().json();if(Uu(t)&&typeof t.error==`string`&&t.error.length)return t}catch{}}}(e))?(await e.body?.cancel(),new ad(`server responded with an error in the response body`,{cause:t,response:e})):X(`"response" is not a conform ${n} response (unexpected HTTP status code)`,zd,e)}}function gd(e){if(!Ed.has(e))throw ku(`"options.DPoP" is not a valid DPoPHandle`,Du)}function _d(e){return e.headers.get(`content-type`)?.split(`;`)[0]}async function vd(e,t,n,r,i,a,o){return await n(e,t,i,a),a.set(`content-type`,`application/x-www-form-urlencoded;charset=UTF-8`),(o?.[Nu]||fetch)(r.href,{body:i,headers:Object.fromEntries(a.entries()),method:`POST`,redirect:`manual`,signal:Gu(r,o?.signal)})}async function yd(e,t,n,r,i,a){var o;let s=id(e,`token_endpoint`,t.use_mtls_endpoint_aliases,!0!==a?.[Au]);i.set(`grant_type`,r);let c=Wu(a?.headers);c.set(`accept`,`application/json`),a?.DPoP!==void 0&&(gd(a.DPoP),await a.DPoP.addProof(s,c,`POST`));let l=await vd(e,t,n,s,i,c,a);return a==null||(o=a.DPoP)==null||o.cacheNonce(l,s),l}var bd=new WeakMap,xd=new WeakMap;function Sd(e){if(!e.id_token)return;let t=bd.get(e);if(!t)throw ku(`"ref" was already garbage collected or did not resolve from the proper sources`,Du);return t}async function Cd(e,t,n,r,i,a){if(Qu(e),$u(t),!Eu(n,Response))throw ku(`"response" must be an instance of Response`,Ou);await hd(n,200,`Token Endpoint`),qd(n);let o=await ef(n);if(qu(o.access_token,`"response" body "access_token" property`,Z,{body:o}),qu(o.token_type,`"response" body "token_type" property`,Z,{body:o}),o.token_type=o.token_type.toLowerCase(),o.expires_in!==void 0){let e=typeof o.expires_in==`number`?o.expires_in:parseFloat(o.expires_in);Ku(e,!0,`"response" body "expires_in" property`,Z,{body:o}),o.expires_in=e}if(o.refresh_token!==void 0&&qu(o.refresh_token,`"response" body "refresh_token" property`,Z,{body:o}),o.scope!==void 0&&typeof o.scope!=`string`)throw X(`"response" body "scope" property must be a string`,Z,{body:o});if(o.id_token!==void 0){qu(o.id_token,`"response" body "id_token" property`,Z,{body:o});let a=[`aud`,`exp`,`iat`,`iss`,`sub`];!0===t.require_auth_time&&a.push(`auth_time`),t.default_max_age!==void 0&&(Ku(t.default_max_age,!0,`"client.default_max_age"`),a.push(`auth_time`)),r!=null&&r.length&&a.push(...r);let s=await async function(e,t,n,r,i){let a,o,s=e.split(`.`),c=s[0],l=s[1],u=s.length;if(u===5){if(i===void 0)throw new Vu(`JWE decryption is not configured`,{cause:e});var d=(e=await i(e)).split(`.`);c=d[0],l=d[1],u=d.length}if(u!==3)throw X(`Invalid JWT`,Z,e);try{a=JSON.parse(Lu(Bu(c)))}catch(e){throw X(`failed to parse JWT Header body as base64url encoded JSON`,Ld,e)}if(!Uu(a))throw X(`JWT Header must be a top level object`,Z,e);if(t(a),a.crit!==void 0)throw new Vu(`no JWT "crit" header parameter extensions are supported`,{cause:{header:a}});try{o=JSON.parse(Lu(Bu(l)))}catch(e){throw X(`failed to parse JWT Payload body as base64url encoded JSON`,Ld,e)}if(!Uu(o))throw X(`JWT Payload must be a top level object`,Z,e);let f=Zu()+n;if(o.exp!==void 0){if(typeof o.exp!=`number`)throw X(`unexpected JWT "exp" (expiration time) claim type`,Z,{claims:o});if(o.exp<=f-r)throw X(`unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp`,Hd,{claims:o,now:f,tolerance:r,claim:`exp`})}if(o.iat!==void 0&&typeof o.iat!=`number`)throw X(`unexpected JWT "iat" (issued at) claim type`,Z,{claims:o});if(o.iss!==void 0&&typeof o.iss!=`string`)throw X(`unexpected JWT "iss" (issuer) claim type`,Z,{claims:o});if(o.nbf!==void 0){if(typeof o.nbf!=`number`)throw X(`unexpected JWT "nbf" (not before) claim type`,Z,{claims:o});if(o.nbf>f+r)throw X(`unexpected JWT "nbf" (not before) claim value`,Hd,{claims:o,now:f,tolerance:r,claim:`nbf`})}if(o.aud!==void 0&&typeof o.aud!=`string`&&!Array.isArray(o.aud))throw X(`unexpected JWT "aud" (audience) claim type`,Z,{claims:o});return{header:a,claims:o,jwt:e}}(o.id_token,Yd.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,`RS256`),Yu(t),Xu(t),i).then(kd.bind(void 0,a)).then(Td.bind(void 0,e)).then(wd.bind(void 0,t.client_id)),c=s.claims,l=s.jwt;if(Array.isArray(c.aud)&&c.aud.length!==1){if(c.azp===void 0)throw X(`ID Token "aud" (audience) claim includes additional untrusted audiences`,Ud,{claims:c,claim:`aud`});if(c.azp!==t.client_id)throw X(`unexpected ID Token "azp" (authorized party) claim value`,Ud,{expected:t.client_id,claims:c,claim:`azp`})}c.auth_time!==void 0&&Ku(c.auth_time,!0,`ID Token "auth_time" (authentication time)`,Z,{claims:c}),xd.set(n,l),bd.set(o,c)}if(a?.[o.token_type]!==void 0)a[o.token_type](n,o);else if(o.token_type!==`dpop`&&o.token_type!==`bearer`)throw new Vu("unsupported `token_type` value",{cause:{body:o}});return o}function wd(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw X(`unexpected JWT "aud" (audience) claim value`,Ud,{expected:e,claims:t.claims,claim:`aud`})}else if(t.claims.aud!==e)throw X(`unexpected JWT "aud" (audience) claim value`,Ud,{expected:e,claims:t.claims,claim:`aud`});return t}function Td(e,t){let n=e[tf]?.call(e,t)??e.issuer;if(t.claims.iss!==n)throw X(`unexpected JWT "iss" (issuer) claim value`,Ud,{expected:n,claims:t.claims,claim:`iss`});return t}var Ed=new WeakSet,Dd=Symbol(),Od={aud:`audience`,c_hash:`code hash`,client_id:`client id`,exp:`expiration time`,iat:`issued at`,iss:`issuer`,jti:`jwt id`,nonce:`nonce`,s_hash:`state hash`,sub:`subject`,ath:`access token hash`,htm:`http method`,htu:`http uri`,cnf:`confirmation`,auth_time:`authentication time`};function kd(e,t){for(let n of e)if(t.claims[n]===void 0)throw X(`JWT "${n}" (${Od[n]}) claim missing`,Z,{claims:t.claims});return t}var Ad=Symbol(),jd=Symbol();async function Md(e,t,n,r){return typeof r?.expectedNonce==`string`||typeof r?.maxAge==`number`||r!=null&&r.requireIdToken?async function(e,t,n,r,i,a,o){let s=[];switch(r){case void 0:r=Ad;break;case Ad:break;default:qu(r,`"expectedNonce" argument`),s.push(`nonce`)}switch(i??=t.default_max_age,i){case void 0:i=jd;break;case jd:break;default:Ku(i,!0,`"maxAge" argument`),s.push(`auth_time`)}let c=await Cd(e,t,n,s,a,o);qu(c.id_token,`"response" body "id_token" property`,Z,{body:c});let l=Sd(c);if(i!==jd){let e=Zu()+Yu(t),n=Xu(t);if(l.auth_time+i<e-n)throw X(`too much time has elapsed since the last End-User authentication`,Hd,{claims:l,now:e,tolerance:n,claim:`auth_time`})}if(r===Ad){if(l.nonce!==void 0)throw X(`unexpected ID Token "nonce" claim value`,Ud,{expected:void 0,claims:l,claim:`nonce`})}else if(l.nonce!==r)throw X(`unexpected ID Token "nonce" claim value`,Ud,{expected:r,claims:l,claim:`nonce`});return c}(e,t,n,r.expectedNonce,r.maxAge,r[Pu],r.recognizedTokenTypes):async function(e,t,n,r,i){let a=await Cd(e,t,n,void 0,r,i),o=Sd(a);if(o){if(t.default_max_age!==void 0){Ku(t.default_max_age,!0,`"client.default_max_age"`);let e=Zu()+Yu(t),n=Xu(t);if(o.auth_time+t.default_max_age<e-n)throw X(`too much time has elapsed since the last End-User authentication`,Hd,{claims:o,now:e,tolerance:n,claim:`auth_time`})}if(o.nonce!==void 0)throw X(`unexpected ID Token "nonce" claim value`,Ud,{expected:void 0,claims:o,claim:`nonce`})}return a}(e,t,n,r?.[Pu],r?.recognizedTokenTypes)}var Nd=`OAUTH_WWW_AUTHENTICATE_CHALLENGE`,Pd=`OAUTH_RESPONSE_BODY_ERROR`,Fd=`OAUTH_UNSUPPORTED_OPERATION`,Id=`OAUTH_AUTHORIZATION_RESPONSE_ERROR`,Ld=`OAUTH_PARSE_ERROR`,Z=`OAUTH_INVALID_RESPONSE`,Rd=`OAUTH_RESPONSE_IS_NOT_JSON`,zd=`OAUTH_RESPONSE_IS_NOT_CONFORM`,Bd=`OAUTH_HTTP_REQUEST_FORBIDDEN`,Vd=`OAUTH_REQUEST_PROTOCOL_FORBIDDEN`,Hd=`OAUTH_JWT_TIMESTAMP_CHECK_FAILED`,Ud=`OAUTH_JWT_CLAIM_COMPARISON_FAILED`,Wd=`OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED`,Gd=`OAUTH_MISSING_SERVER_METADATA`,Kd=`OAUTH_INVALID_SERVER_METADATA`;function qd(e){if(e.bodyUsed)throw ku(`"response" body has been used already`,Du)}async function Jd(e){if(e.method!==`POST`)throw ku(`form_post responses are expected to use the POST method`,Du,{cause:e});if(_d(e)!==`application/x-www-form-urlencoded`)throw ku(`form_post responses are expected to use the application/x-www-form-urlencoded content-type`,Du,{cause:e});return async function(e){if(e.bodyUsed)throw ku(`form_post Request instances must contain a readable body`,Du,{cause:e});return e.text()}(e)}function Yd(e,t,n,r){if(e===void 0)if(Array.isArray(t)){if(!t.includes(r.alg))throw X(`unexpected JWT "alg" header parameter`,Z,{header:r,expected:t,reason:`authorization server metadata`})}else{if(n===void 0)throw X(`missing client or server configuration to verify used JWT "alg" header parameter`,void 0,{client:e,issuer:t,fallback:n});if(typeof n==`string`?r.alg!==n:typeof n==`function`?!n(r.alg):!n.includes(r.alg))throw X(`unexpected JWT "alg" header parameter`,Z,{header:r,expected:n,reason:`default value`})}else if(typeof e==`string`?r.alg!==e:!e.includes(r.alg))throw X(`unexpected JWT "alg" header parameter`,Z,{header:r,expected:e,reason:`client configuration`})}function Xd(e,t){let n=e.getAll(t),r=n[0];if(n.length>1)throw X(`"${t}" parameter must be provided only once`,Z);return r}var Zd=Symbol(),Qd=Symbol();function $d(e,t,n,r){if(Qu(e),$u(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw ku(`"parameters" must be an instance of URLSearchParams, or URL`,Ou);if(Xd(n,`response`))throw X(`"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()`,Z,{parameters:n});let i=Xd(n,`iss`),a=Xd(n,`state`);if(!i&&e.authorization_response_iss_parameter_supported)throw X(`response parameter "iss" (issuer) missing`,Z,{parameters:n});if(i&&i!==e.issuer)throw X(`unexpected "iss" (issuer) response parameter value`,Z,{expected:e.issuer,parameters:n});switch(r){case void 0:case Qd:if(a!==void 0)throw X(`unexpected "state" response parameter encountered`,Z,{expected:void 0,parameters:n});break;case Zd:break;default:if(qu(r,`"expectedState" argument`),a!==r)throw X(a===void 0?`response parameter "state" missing`:`unexpected "state" response parameter value`,Z,{expected:r,parameters:n})}if(Xd(n,`error`))throw new od(`authorization response from the server is an error`,{cause:n});let o=Xd(n,`id_token`),s=Xd(n,`token`);if(o!==void 0||s!==void 0)throw new Vu(`implicit and hybrid flows are not supported`);return c=new URLSearchParams(n),Ed.add(c),c;var c}async function ef(e){let t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ju;try{t=await e.json()}catch(t){throw n(e),X(`failed to parse "response" body as JSON`,Ld,t)}if(!Uu(t))throw X(`"response" body must be a top level object`,Z,{body:t});return t}var tf=Symbol();new TextEncoder,new TextDecoder;var nf=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`code`,`ERR_JOSE_GENERIC`),this.name=this.constructor.name,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}};Y(nf,`code`,`ERR_JOSE_GENERIC`),Y(class extends nf{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`unspecified`,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`unspecified`;super(e,{cause:{claim:n,reason:r,payload:t}}),Y(this,`code`,`ERR_JWT_CLAIM_VALIDATION_FAILED`),Y(this,`claim`,void 0),Y(this,`reason`,void 0),Y(this,`payload`,void 0),this.claim=n,this.reason=r,this.payload=t}},`code`,`ERR_JWT_CLAIM_VALIDATION_FAILED`),Y(class extends nf{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`unspecified`,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`unspecified`;super(e,{cause:{claim:n,reason:r,payload:t}}),Y(this,`code`,`ERR_JWT_EXPIRED`),Y(this,`claim`,void 0),Y(this,`reason`,void 0),Y(this,`payload`,void 0),this.claim=n,this.reason=r,this.payload=t}},`code`,`ERR_JWT_EXPIRED`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JOSE_ALG_NOT_ALLOWED`)}},`code`,`ERR_JOSE_ALG_NOT_ALLOWED`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JOSE_NOT_SUPPORTED`)}},`code`,`ERR_JOSE_NOT_SUPPORTED`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`decryption operation failed`,arguments.length>1?arguments[1]:void 0),Y(this,`code`,`ERR_JWE_DECRYPTION_FAILED`)}},`code`,`ERR_JWE_DECRYPTION_FAILED`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWE_INVALID`)}},`code`,`ERR_JWE_INVALID`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWS_INVALID`)}},`code`,`ERR_JWS_INVALID`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWT_INVALID`)}},`code`,`ERR_JWT_INVALID`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWK_INVALID`)}},`code`,`ERR_JWK_INVALID`),Y(class extends nf{constructor(){super(...arguments),Y(this,`code`,`ERR_JWKS_INVALID`)}},`code`,`ERR_JWKS_INVALID`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`no applicable key found in the JSON Web Key Set`,arguments.length>1?arguments[1]:void 0),Y(this,`code`,`ERR_JWKS_NO_MATCHING_KEY`)}},`code`,`ERR_JWKS_NO_MATCHING_KEY`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`multiple matching keys found in the JSON Web Key Set`,arguments.length>1?arguments[1]:void 0),Y(this,Symbol.asyncIterator,void 0),Y(this,`code`,`ERR_JWKS_MULTIPLE_MATCHING_KEYS`)}},`code`,`ERR_JWKS_MULTIPLE_MATCHING_KEYS`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`request timed out`,arguments.length>1?arguments[1]:void 0),Y(this,`code`,`ERR_JWKS_TIMEOUT`)}},`code`,`ERR_JWKS_TIMEOUT`),Y(class extends nf{constructor(){super(arguments.length>0&&arguments[0]!==void 0?arguments[0]:`signature verification failed`,arguments.length>1?arguments[1]:void 0),Y(this,`code`,`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`)}},`code`,`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`);var rf,af,of,sf;(typeof navigator>`u`||(rf=navigator.userAgent)==null||(af=rf.startsWith)==null||!af.call(rf,`Mozilla/5.0 `))&&(sf=`openid-client/v6.8.4`,of={"user-agent":sf});var cf=e=>lf.get(e),lf,uf;function df(e){return e===void 0?(uf||=new WeakMap,(e,t,n,r)=>{let i;return(i=uf.get(t))||(function(e,t){if(typeof e!=`string`)throw hf(`${t} must be a string`,mf);if(e.length===0)throw hf(`${t} must not be empty`,pf)}(t.client_secret,`"metadata.client_secret"`),i=ed(t.client_secret),uf.set(t,i)),i(e,t,n,r)}):ed(e)}var ff=Nu,pf=`ERR_INVALID_ARG_VALUE`,mf=`ERR_INVALID_ARG_TYPE`;function hf(e,t,n){let r=TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}var gf=class extends Error{constructor(e,t){var n;super(e,t),Y(this,`code`,void 0),this.name=this.constructor.name,this.code=t?.code,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}};function _f(e,t,n){return new gf(e,{cause:t,code:n})}function vf(e){if(e instanceof TypeError||e instanceof gf||e instanceof ad||e instanceof od||e instanceof sd)throw e;if(e instanceof Hu)switch(e.code){case Bd:throw _f(`only requests to HTTPS are allowed`,e,e.code);case Vd:throw _f(`only requests to HTTP or HTTPS are allowed`,e,e.code);case zd:throw _f(`unexpected HTTP response status code`,e.cause,e.code);case Rd:throw _f(`unexpected response content-type`,e.cause,e.code);case Ld:throw _f(`parsing error occured`,e,e.code);case Z:throw _f(`invalid response encountered`,e,e.code);case Ud:throw _f(`unexpected JWT claim value encountered`,e,e.code);case Wd:throw _f(`unexpected JSON attribute value encountered`,e,e.code);case Hd:throw _f(`JWT timestamp claim value failed validation`,e,e.code);default:throw _f(e.message,e,e.code)}if(e instanceof Vu)throw _f(`unsupported operation`,e,e.code);if(e instanceof DOMException)switch(e.name){case`OperationError`:throw _f(`runtime operation error`,e,Fd);case`NotSupportedError`:throw _f(`runtime unsupported operation`,e,Fd);case`TimeoutError`:throw _f(`operation timed out`,e,`OAUTH_TIMEOUT`);case`AbortError`:throw _f(`operation aborted`,e,`OAUTH_ABORT`)}throw new gf(`something went wrong`,{cause:e})}new TextDecoder;var yf=Symbol(),bf=class{constructor(e,t,n,r){if(typeof t!=`string`||!t.length)throw hf(`"clientId" must be a non-empty string`,mf);if(typeof n==`string`&&(n={client_secret:n}),n?.client_id!==void 0&&t!==n.client_id)throw hf(`"clientId" and "metadata.client_id" must be the same`,pf);let i=au(au({},structuredClone(n)),{},{client_id:t}),a;i[ju]=n?.[ju]??0,i[Mu]=n?.[Mu]??30,a=r||(typeof i.client_secret==`string`&&i.client_secret.length?df(i.client_secret):(e,t,n,r)=>{n.set(`client_id`,t.client_id)});let o=Object.freeze(i),s=structuredClone(e);yf in e&&(s[tf]=t=>{let n=t.claims.tid;return e.issuer.replace(`{tenantid}`,n)});let c=Object.freeze(s);lf||=new WeakMap,lf.set(this,{__proto__:null,as:c,c:o,auth:a,tlsOnly:!0,jwksCache:{}})}serverMetadata(){let e=structuredClone(cf(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`S256`;return!0===e.code_challenge_methods_supported?.includes(t)}}}}(e))}(e),e}clientMetadata(){return structuredClone(cf(this).c)}get timeout(){return cf(this).timeout}set timeout(e){cf(this).timeout=e}get[ff](){return cf(this).fetch}set[ff](e){cf(this).fetch=e}};function xf(e){Object.defineProperties(e,function(e){let t;if(e.expires_in!==void 0){let n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){let e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return Sd(this)}catch{return}}}}}(e))}async function Sf(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0&&arguments[3],i=e.headers.get(`retry-after`)?.trim();if(i===void 0)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{let e=new Date(i);if(Number.isFinite(e.getTime())){let t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(r&&!Number.isFinite(a))throw new Hu(`invalid Retry-After header value`,{cause:e});a>t&&await Cf(a-t,n)}function Cf(e,t){return new Promise((n,r)=>{let i=e=>{try{t.throwIfAborted()}catch(e){r(e);return}if(e<=0)return void n();let a=Math.min(e,5);setTimeout(()=>i(e-a),1e3*a)};i(e)})}async function wf(e,t,n,r){Af(e),n=new URLSearchParams(n);let i=t.interval??5,a=r?.signal??AbortSignal.timeout(1e3*t.expires_in);try{await Cf(i,a)}catch(e){vf(e)}let o=cf(e),s=o.as,c=o.c,l=o.auth,u=o.fetch,d=o.tlsOnly,f=o.nonRepudiation,p=o.timeout,m=o.decrypt,h=(i,o)=>wf(e,au(au({},t),{},{interval:i}),n,au(au({},r),{},{signal:a,flag:o})),g=function(e,t){let n=jf(t);if(!n)return{signal:e,cleanup(){}};let r=new AbortController,i=e=>{let t=e.target;r.abort(t.reason)};return e.aborted?r.abort(e.reason):n.aborted?r.abort(n.reason):(e.addEventListener(`abort`,i,{once:!0}),n.addEventListener(`abort`,i,{once:!0})),{signal:r.signal,cleanup(){e.removeEventListener(`abort`,i),n.removeEventListener(`abort`,i)}}}(a,p),_=await async function(e,t,n,r,i){Qu(e),$u(t),qu(r,`"authReqId"`);let a=new URLSearchParams(i?.additionalParameters);return a.set(`auth_req_id`,r),yd(e,t,n,`urn:openid:params:grant-type:ciba`,a,i)}(s,c,l,t.auth_req_id,{[Nu]:u,[Au]:!d,additionalParameters:n,DPoP:r?.DPoP,headers:new Headers(of),signal:g.signal}).catch(vf).finally(g.cleanup);if(_.status===503&&_.headers.has(`retry-after`))return await Sf(_,i,a,!0),await _.body?.cancel(),h(i);let v=async function(e,t,n,r){return Cd(e,t,n,void 0,r?.[Pu],r?.recognizedTokenTypes)}(s,c,_,{[Pu]:m}),y;try{y=await v}catch(e){if(Mf(e,r))return h(i,Nf);if(e instanceof ad)switch(e.error){case`slow_down`:i+=5;case`authorization_pending`:return await Sf(e.response,i,a),h(i)}vf(e)}return y.id_token&&await f?.(_),xf(y),y}async function Tf(e,t,n,r,i){if(Af(e),!(i?.flag===Nf||t instanceof URL||function(e,t){try{return Object.getPrototypeOf(e)[Symbol.toStringTag]===t}catch{return!1}}(t,`Request`)))throw hf(`"currentUrl" must be an instance of URL, or Request`,mf);let a,o,s=cf(e),c=s.as,l=s.c,u=s.auth,d=s.fetch,f=s.tlsOnly,p=s.jarm,m=s.hybrid,h=s.nonRepudiation,g=s.timeout,_=s.decrypt,v=s.implicit;if(i?.flag===Nf)a=i.authResponse,o=i.redirectUri;else{if(!(t instanceof URL)){let e=t;switch(t=new URL(t.url),e.method){case`GET`:break;case`POST`:let n=new URLSearchParams(await Jd(e));if(m)t.hash=n.toString();else for(let e of n.entries()){var y=ou(e,2);let n=y[0],r=y[1];t.searchParams.append(n,r)}break;default:throw hf(`unexpected Request HTTP method`,pf)}}switch(o=function(e){return(e=new URL(e)).search=``,e.hash=``,e.href}(t),!0){case!!p:a=await p(t,n?.expectedState);break;case!!m:a=await m(t,n?.expectedNonce,n?.expectedState,n?.maxAge);break;case!!v:throw TypeError(`authorizationCodeGrant() cannot be used by response_type=id_token clients`);default:try{a=$d(c,l,t.searchParams,n?.expectedState)}catch(e){vf(e)}}}let b=await async function(e,t,n,r,i,a,o){if(Qu(e),$u(t),!Ed.has(r))throw ku(`"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()`,Du);qu(i,`"redirectUri"`);let s=Xd(r,`code`);if(!s)throw X(`no authorization code in "callbackParameters"`,Z);let c=new URLSearchParams(o?.additionalParameters);return c.set(`redirect_uri`,i),c.set(`code`,s),a!==Dd&&(qu(a,`"codeVerifier"`),c.set(`code_verifier`,a)),yd(e,t,n,`authorization_code`,c,o)}(c,l,u,a,o,n?.pkceCodeVerifier||Dd,{additionalParameters:r,[Nu]:d,[Au]:!f,DPoP:i?.DPoP,headers:new Headers(of),signal:jf(g)}).catch(vf);typeof n?.expectedNonce!=`string`&&typeof n?.maxAge!=`number`||(n.idTokenExpected=!0);let x=Md(c,l,b,{expectedNonce:n?.expectedNonce,maxAge:n?.maxAge,requireIdToken:n?.idTokenExpected,[Pu]:_}),S;try{S=await x}catch(t){if(Mf(t,i))return Tf(e,void 0,n,r,au(au({},i),{},{flag:Nf,authResponse:a,redirectUri:o}));vf(t)}return S.id_token&&await h?.(b),xf(S),S}async function Ef(e,t,n,r){Af(e),n=new URLSearchParams(n);let i=cf(e),a=i.as,o=i.c,s=i.auth,c=i.fetch,l=i.tlsOnly,u=i.nonRepudiation,d=i.timeout,f=i.decrypt,p=await async function(e,t,n,r,i){Qu(e),$u(t),qu(r,`"refreshToken"`);let a=new URLSearchParams(i?.additionalParameters);return a.set(`refresh_token`,r),yd(e,t,n,`refresh_token`,a,i)}(a,o,s,t,{[Nu]:c,[Au]:!l,additionalParameters:n,DPoP:r?.DPoP,headers:new Headers(of),signal:jf(d)}).catch(vf),m=async function(e,t,n,r){return Cd(e,t,n,void 0,r?.[Pu],r?.recognizedTokenTypes)}(a,o,p,{[Pu]:f}),h;try{h=await m}catch(i){if(Mf(i,r))return Ef(e,t,n,au(au({},r),{},{flag:Nf}));vf(i)}return h.id_token&&await u?.(p),xf(h),h}async function Df(e,t,n){Af(e),t=new URLSearchParams(t);let r=cf(e),i=r.as,a=r.c,o=r.auth,s=r.fetch,c=r.tlsOnly,l=r.timeout,u=async function(e,t,n,r){return Cd(e,t,n,void 0,r?.[Pu],r?.recognizedTokenTypes)}(i,a,await async function(e,t,n,r,i){return Qu(e),$u(t),yd(e,t,n,`client_credentials`,new URLSearchParams(r),i)}(i,a,o,t,{[Nu]:s,[Au]:!c,DPoP:n?.DPoP,headers:new Headers(of),signal:jf(l)}).catch(vf)),d;try{d=await u}catch(r){if(Mf(r,n))return Df(e,t,au(au({},n),{},{flag:Nf}));vf(r)}return xf(d),d}function Of(e,t){Af(e);let n=cf(e),r=n.as,i=n.c,a=n.tlsOnly,o=n.hybrid,s=n.jarm,c=n.implicit,l=id(r,`authorization_endpoint`,!1,a);if((t=new URLSearchParams(t)).has(`client_id`)||t.set(`client_id`,i.client_id),!t.has(`request_uri`)&&!t.has(`request`)){if(t.has(`response_type`)||t.set(`response_type`,o?`code id_token`:c?`id_token`:`code`),c&&!t.has(`nonce`))throw hf(`response_type=id_token clients must provide a nonce parameter in their authorization request parameters`,pf);s&&t.set(`response_mode`,`jwt`)}for(let e of t.entries()){var u=ou(e,2);let t=u[0],n=u[1];l.searchParams.append(t,n)}return l}async function kf(e,t,n){Af(e);let r=Of(e,t),i=cf(e),a=i.as,o=i.c,s=i.auth,c=i.fetch,l=i.tlsOnly,u=i.timeout,d=async function(e,t,n){if(Qu(e),$u(t),!Eu(n,Response))throw ku(`"response" must be an instance of Response`,Ou);await hd(n,201,`Pushed Authorization Request Endpoint`),qd(n);let r=await ef(n);qu(r.request_uri,`"response" body "request_uri" property`,Z,{body:r});let i=typeof r.expires_in==`number`?r.expires_in:parseFloat(r.expires_in);return Ku(i,!0,`"response" body "expires_in" property`,Z,{body:r}),r.expires_in=i,r}(a,o,await async function(e,t,n,r,i){var a;Qu(e),$u(t);let o=id(e,`pushed_authorization_request_endpoint`,t.use_mtls_endpoint_aliases,!0!==i?.[Au]),s=new URLSearchParams(r);s.set(`client_id`,t.client_id);let c=Wu(i?.headers);c.set(`accept`,`application/json`),i?.DPoP!==void 0&&(gd(i.DPoP),await i.DPoP.addProof(o,c,`POST`));let l=await vd(e,t,n,o,s,c,i);return i==null||(a=i.DPoP)==null||a.cacheNonce(l,o),l}(a,o,s,r.searchParams,{[Nu]:c,[Au]:!l,DPoP:n?.DPoP,headers:new Headers(of),signal:jf(u)}).catch(vf)),f;try{f=await d}catch(r){if(Mf(r,n))return kf(e,t,au(au({},n),{},{flag:Nf}));vf(r)}return Of(e,{request_uri:f.request_uri})}function Af(e){if(!(e instanceof bf))throw hf(`"config" must be an instance of Configuration`,mf);if(Object.getPrototypeOf(e)!==bf.prototype)throw hf(`subclassing Configuration is not allowed`,pf)}function jf(e){return e?AbortSignal.timeout(1e3*e):void 0}function Mf(e,t){return!(t==null||!t.DPoP||t.flag===Nf)&&function(e){if(e instanceof sd){let t=e.cause,n=t[0];return t.length===1&&n.scheme===`dpop`&&n.parameters.error===`use_dpop_nonce`}return e instanceof ad&&e.error===`use_dpop_nonce`}(e)}Object.freeze(bf.prototype);var Nf=Symbol();async function Pf(e,t,n,r){Af(e);let i=cf(e),a=i.as,o=i.c,s=i.auth,c=i.fetch,l=i.tlsOnly,u=i.timeout,d=i.decrypt,f=i.nonRepudiation,p=await async function(e,t,n,r,i,a){return Qu(e),$u(t),qu(r,`"grantType"`),yd(e,t,n,r,new URLSearchParams(i),a)}(a,o,s,t,new URLSearchParams(n),{[Nu]:c,[Au]:!l,DPoP:r?.DPoP,headers:new Headers(of),signal:jf(u)}).catch(vf),m;t===`urn:ietf:params:oauth:grant-type:token-exchange`&&(m={n_a:()=>{}});let h=async function(e,t,n,r){return Cd(e,t,n,void 0,r?.[Pu],r?.recognizedTokenTypes)}(a,o,p,{[Pu]:d,recognizedTokenTypes:m}),g;try{g=await h}catch(i){if(Mf(i,r))return Pf(e,t,n,au(au({},r),{},{flag:Nf}));vf(i)}return g.id_token&&await f?.(p),xf(g),g}var Ff,If;typeof navigator>`u`||(Ff=navigator.userAgent)==null||(If=Ff.startsWith)==null||If.call(Ff,`Mozilla/5.0 `),Object.freeze(new Set([`grant_type`,`client_id`,`client_secret`,`client_assertion`,`client_assertion_type`,`subject_token`,`subject_token_type`,`requested_token_type`,`actor_token`,`actor_token_type`,`audience`,`aud`,`resource`,`resources`,`resource_indicator`,`scope`,`connection`,`login_hint`,`organization`,`assertion`]));var Lf={isAuthenticated:!1,isLoading:!0,error:void 0,user:void 0},Q=function(){throw Error(`You forgot to wrap your component in <Auth0Provider>.`)},Rf=tu(tu({},Lf),{buildAuthorizeUrl:Q,buildLogoutUrl:Q,getAccessTokenSilently:Q,getAccessTokenWithPopup:Q,getIdTokenClaims:Q,loginWithCustomTokenExchange:Q,customTokenExchange:Q,exchangeToken:Q,loginWithRedirect:Q,loginWithPopup:Q,connectAccountWithRedirect:Q,logout:Q,handleRedirectCallback:Q,getDpopNonce:Q,setDpopNonce:Q,generateDpopProof:Q,createFetcher:Q,getConfiguration:Q,mfa:{getAuthenticators:Q,enroll:Q,challenge:Q,verify:Q,getEnrollmentFactors:Q},passkey:{signup:Q,login:Q},myAccount:{getFactors:Q,getAuthenticationMethods:Q,getAuthenticationMethod:Q,updateAuthenticationMethod:Q,deleteAuthenticationMethod:Q,enrollmentChallenge:Q,enrollmentVerify:Q}}),zf=(0,q.createContext)(Rf);(function(e){eu(t,e);function t(n,r){var i=e.call(this,r??n)||this;return i.error=n,i.error_description=r,Object.setPrototypeOf(i,t.prototype),i}return t})(Error);var Bf=function(e){return e===void 0&&(e=zf),(0,q.useContext)(e)};function Vf(e){if(e!==void 0)return e>=500?`5xx`:e>=400?`4xx`:`other`}var Hf=new Set([`blastRadius`,`errorClass`,`errorType`,`errorStatus`,`errorStatusClass`,`errorTraceId`,`errorDetail`,`errorInstance`,`errorExpected`]);function Uf(e){if(e)return Object.fromEntries(Object.entries(e).filter(([e])=>!Hf.has(e)))}function Wf(e){return e instanceof Error?e.name:e===null?`null`:typeof e}function Gf(e,t,n){let r={blastRadius:t,errorClass:Wf(e)};(e instanceof wc||e instanceof Tc)&&(r.errorType=e.type,r.errorStatus=e.status,r.errorStatusClass=Vf(e.status),r.errorTraceId=e.traceId,r.errorDetail=e.detail,r.errorInstance=e.instance,r.errorExpected=e.type!==void 0&&yc.includes(e.type));let i=Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0));return{...Uf(n),...i}}var Kf;function qf(e){Kf=e}function Jf(){return Kf}var Yf=(0,q.createContext)({get client(){return Jf()},bootstrap:void 0}),Xf=function(e){return typeof e==`function`},Zf=function(){return(0,q.useContext)(Yf).client},Qf=function(e,t){return Qf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Qf(e,t)};function $f(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Qf(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var ep={componentStack:null,exceptionEvent:null,error:null},tp={INVALID_FALLBACK:`[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element.`};(function(e){$f(t,e);function t(t){var n=e.call(this,t)||this;return n.state=ep,n}return t.prototype.componentDidCatch=function(e,t){var n=this.props.additionalProperties,r;Xf(n)?r=n(e):typeof n==`object`&&(r=n);var i=this.context.client.captureException(e,r),a=t.componentStack;this.setState({error:e,componentStack:a??null,exceptionEvent:i})},t.prototype.render=function(){var e=this.props,t=e.children,n=e.fallback,r=this.state;if(r.componentStack==null)return Xf(t)?t():t;var i=Xf(n)?q.createElement(n,{error:r.error,componentStack:r.componentStack,exceptionEvent:r.exceptionEvent}):n;return q.isValidElement(i)?i:(console.warn(tp.INVALID_FALLBACK),q.createElement(q.Fragment,null))},t.contextType=Yf,t})(q.Component),qf(fc);var np=(e=>{let t=Object.create(e);return t.capture=function(t,...n){let[r,i]=n;return e.capture(t,r,i)},t.captureRaw=function(t,n,r){return e.capture(t,n,r)},new Proxy(t,{get(t,n){return n in t?t[n]:e[n]},set(t,n,r){return e[n]=r,!0}})})(fc),rp=()=>(Zf(),np),ip=()=>{let e=rp();return{logEvent:(0,q.useCallback)(((t,n,r)=>{let i=e.capture;i(t,n,r)}),[e]),captureRaw:(0,q.useCallback)((t,n)=>{e.captureRaw(t,n)},[e]),captureException:(t,n,r=`action-failed`)=>{e.captureException(t,Gf(t,r,n))}}},ap=`acts_as`,op=`https://zuplo.com/claims/acts_as`,sp=`as_user`,cp=e=>{let t=e?.[ap];if(typeof t==`string`)return t;let n=e?.[op];return typeof n==`string`?n:void 0},lp=new Set([`login_required`,`interaction_required`,`invalid_grant`,`missing_refresh_token`,`mfa_required`,`MfaRequiredError`,`MissingRefreshTokenError`]),up=`timeout when executing 'fetch'`,dp=`no_cached_access_token`,fp=`no cached access token`,pp=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.error==`string`)return t.error;if(typeof t.name==`string`)return t.name}},mp=e=>{if(typeof e==`object`&&e){let{message:t}=e;if(typeof t==`string`)return t}},hp=e=>{let t=pp(e);if(t===`timeout`||t===`TimeoutError`)return!0;let n=(mp(e)??``).toLowerCase();return n.includes(up)||Sc(n)},gp=e=>pp(e)===dp?!0:(mp(e)??``).toLowerCase().includes(fp),_p=e=>{let t=pp(e);return t!==void 0&&lp.has(t)?`session-ended`:gp(e)?`deferred`:hp(e)?`offline`:`unknown`},vp=e=>{if(typeof e==`object`&&e){let t=e;return{code:typeof t.error==`string`?t.error:typeof t.name==`string`?t.name:`unknown`,description:typeof t.error_description==`string`?t.error_description:void 0}}return{code:`unknown`}},yp=!1,bp=new Set,xp=()=>{if(!yp){yp=!0;try{`${window.location.pathname}${window.location.search}${window.location.hash}`}catch{}for(let e of bp)e()}},Sp=()=>typeof document>`u`||document.visibilityState!==`hidden`?Promise.resolve():new Promise(e=>{let t=()=>{document.visibilityState!==`hidden`&&(document.removeEventListener(`visibilitychange`,t),e())};document.addEventListener(`visibilitychange`,t)}),Cp=(0,q.createContext)(void 0),wp=()=>{let e=(0,q.useContext)(Cp),{user:t}=Bf();if(e)return e;if(!t)throw Error(`This hook should never be used outside of a protected route.`);if(!t.sub)throw Error(`The user returned from Auth0 does not contain a 'sub'. Invalid state.`);return{email:t.email??`unknown@example.com`,name:t.name??``,givenName:t.given_name,nickname:t.nickname,userId:t.sub,asUser:cp(t)}},Tp=(e,t)=>{let{code:n,description:r}=vp(e);return{auth0_error_code:n,...r?{auth0_error_description:r}:{},error_name:e instanceof Error?e.name:typeof e,failure_kind:t.kind,force_refresh:t.cacheMode===`off`,is_impersonating:t.isImpersonating,cache_mode:t.cacheMode,is_authenticated:t.isAuthenticated,cache_location:`memory`,online:typeof navigator>`u`?void 0:navigator.onLine,cookies_enabled:typeof navigator>`u`?void 0:navigator.cookieEnabled,visibility_state:typeof document>`u`?void 0:document.visibilityState,page_age_ms:typeof performance>`u`?void 0:Math.round(performance.now())}},Ep=()=>{let e=(0,q.useContext)(Cp),t=Bf(),{captureException:n}=ip();return(0,q.useCallback)(async r=>{if(e)return`local-access-token`;let i=!!cp(t.user),a=typeof document<`u`&&document.visibilityState===`hidden`,o=i?`cache-only`:r?.forceRefresh?`off`:a?`cache-only`:`on`,s=()=>t.getAccessTokenSilently({cacheMode:o,authorizationParams:{audience:Ac,...i?{scope:`${kc} ${ap} ${sp}`}:{}}});try{let e=await s();if(!e&&o===`cache-only`&&!i&&(await Sp(),o=`on`,e=await s()),!e){let e=Error(`No cached access token available`);throw e.error=`no_cached_access_token`,e}return e}catch(e){let r=_p(e),a=Tp(e,{isImpersonating:i,cacheMode:o,isAuthenticated:t.isAuthenticated,kind:r});if(r===`session-ended`&&!i)vc.info(`Access-token renewal failed; session ended`,a),xp();else if(r===`offline`)throw vc.info(`Access-token renewal failed; offline, awaiting reconnect`,a),new wc({type:bc,title:`Error retrieving access token`,detail:`Could not reach the authentication service. Retrying when the connection is back.`},{cause:e instanceof Error?e:Error(String(e))});else r===`deferred`?vc.info(`Access-token renewal deferred; not surfaced`,a):(vc.error(`Access-token renewal failed`,{error:e,...a}),n(e,a));let s=new Tc(`Error retrieving access token`,{cause:e instanceof Error?e:Error(String(e))});throw s.status=500,s}},[e,t,n])},Dp=/\{[^{}]+\}/g,Op=()=>typeof process==`object`&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici;function kp(){return Math.random().toString(36).slice(2,11)}function Ap(e){let{baseUrl:t=``,Request:n=globalThis.Request,fetch:r=globalThis.fetch,querySerializer:i,bodySerializer:a,headers:o,requestInitExt:s=void 0,...c}={...e};s=Op()?s:void 0,t=zp(t);let l=[];async function u(e,u){let{baseUrl:d,fetch:f=r,Request:p=n,headers:m,params:h={},parseAs:g=`json`,querySerializer:_,bodySerializer:v=a??Ip,body:y,middleware:b=[],...x}=u||{},S=t;d&&(S=zp(d)??t);let C=typeof i==`function`?i:Pp(i);_&&(C=typeof _==`function`?_:Pp({...typeof i==`object`?i:{},..._}));let w=y===void 0?void 0:v(y,Rp(o,m,h.header)),T=Rp(w===void 0||w instanceof FormData?{}:{"Content-Type":`application/json`},o,m,h.header),E=[...l,...b],D={redirect:`follow`,...c,...x,body:w,headers:T},O,k,A=new p(Lp(e,{baseUrl:S,params:h,querySerializer:C}),D),j;for(let e in x)e in A||(A[e]=x[e]);if(E.length){O=kp(),k=Object.freeze({baseUrl:S,fetch:f,parseAs:g,querySerializer:C,bodySerializer:v});for(let t of E)if(t&&typeof t==`object`&&typeof t.onRequest==`function`){let n=await t.onRequest({request:A,schemaPath:e,params:h,options:k,id:O});if(n)if(n instanceof p)A=n;else if(n instanceof Response){j=n;break}else throw Error(`onRequest: must return new Request() or Response() when modifying the request`)}}if(!j){try{j=await f(A,s)}catch(t){let n=t;if(E.length)for(let t=E.length-1;t>=0;t--){let r=E[t];if(r&&typeof r==`object`&&typeof r.onError==`function`){let t=await r.onError({request:A,error:n,schemaPath:e,params:h,options:k,id:O});if(t){if(t instanceof Response){n=void 0,j=t;break}if(t instanceof Error){n=t;continue}throw Error(`onError: must return new Response() or instance of Error`)}}}if(n)throw n}if(E.length)for(let t=E.length-1;t>=0;t--){let n=E[t];if(n&&typeof n==`object`&&typeof n.onResponse==`function`){let t=await n.onResponse({request:A,response:j,schemaPath:e,params:h,options:k,id:O});if(t){if(!(t instanceof Response))throw Error(`onResponse: must return new Response() when modifying the response`);j=t}}}}if(j.status===204||A.method===`HEAD`||j.headers.get(`Content-Length`)===`0`)return j.ok?{data:void 0,response:j}:{error:void 0,response:j};if(j.ok)return g===`stream`?{data:j.body,response:j}:{data:await j[g](),response:j};let M=await j.text();try{M=JSON.parse(M)}catch{}return{error:M,response:j}}return{request(e,t,n){return u(t,{...n,method:e.toUpperCase()})},GET(e,t){return u(e,{...t,method:`GET`})},PUT(e,t){return u(e,{...t,method:`PUT`})},POST(e,t){return u(e,{...t,method:`POST`})},DELETE(e,t){return u(e,{...t,method:`DELETE`})},OPTIONS(e,t){return u(e,{...t,method:`OPTIONS`})},HEAD(e,t){return u(e,{...t,method:`HEAD`})},PATCH(e,t){return u(e,{...t,method:`PATCH`})},TRACE(e,t){return u(e,{...t,method:`TRACE`})},use(...e){for(let t of e)if(t){if(typeof t!=`object`||!(`onRequest`in t||`onResponse`in t||`onError`in t))throw Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");l.push(t)}},eject(...e){for(let t of e){let e=l.indexOf(t);e!==-1&&l.splice(e,1)}}}}function jp(e,t,n){if(t==null)return``;if(typeof t==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${n?.allowReserved===!0?t:encodeURIComponent(t)}`}function Mp(e,t,n){if(!t||typeof t!=`object`)return``;let r=[],i={simple:`,`,label:`.`,matrix:`;`}[n.style]||`&`;if(n.style!==`deepObject`&&n.explode===!1){for(let e in t)r.push(e,n.allowReserved===!0?t[e]:encodeURIComponent(t[e]));let i=r.join(`,`);switch(n.style){case`form`:return`${e}=${i}`;case`label`:return`.${i}`;case`matrix`:return`;${e}=${i}`;default:return i}}for(let i in t){let a=n.style===`deepObject`?`${e}[${i}]`:i;r.push(jp(a,t[i],n))}let a=r.join(i);return n.style===`label`||n.style===`matrix`?`${i}${a}`:a}function Np(e,t,n){if(!Array.isArray(t))return``;if(n.explode===!1){let r={form:`,`,spaceDelimited:`%20`,pipeDelimited:`|`}[n.style]||`,`,i=(n.allowReserved===!0?t:t.map(e=>encodeURIComponent(e))).join(r);switch(n.style){case`simple`:return i;case`label`:return`.${i}`;case`matrix`:return`;${e}=${i}`;default:return`${e}=${i}`}}let r={simple:`,`,label:`.`,matrix:`;`}[n.style]||`&`,i=[];for(let r of t)n.style===`simple`||n.style===`label`?i.push(n.allowReserved===!0?r:encodeURIComponent(r)):i.push(jp(e,r,n));return n.style===`label`||n.style===`matrix`?`${r}${i.join(r)}`:i.join(r)}function Pp(e){return function(t){let n=[];if(t&&typeof t==`object`)for(let r in t){let i=t[r];if(i!=null){if(Array.isArray(i)){if(i.length===0)continue;n.push(Np(r,i,{style:`form`,explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}));continue}if(typeof i==`object`){n.push(Mp(r,i,{style:`deepObject`,explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}));continue}n.push(jp(r,i,e))}}return n.join(`&`)}}function Fp(e,t){let n=e;for(let r of e.match(Dp)??[]){let e=r.substring(1,r.length-1),i=!1,a=`simple`;if(e.endsWith(`*`)&&(i=!0,e=e.substring(0,e.length-1)),e.startsWith(`.`)?(a=`label`,e=e.substring(1)):e.startsWith(`;`)&&(a=`matrix`,e=e.substring(1)),!t||t[e]===void 0||t[e]===null)continue;let o=t[e];if(Array.isArray(o)){n=n.replace(r,Np(e,o,{style:a,explode:i}));continue}if(typeof o==`object`){n=n.replace(r,Mp(e,o,{style:a,explode:i}));continue}if(a===`matrix`){n=n.replace(r,`;${jp(e,o)}`);continue}n=n.replace(r,a===`label`?`.${encodeURIComponent(o)}`:encodeURIComponent(o))}return n}function Ip(e,t){return e instanceof FormData?e:t&&(t.get instanceof Function?t.get(`Content-Type`)??t.get(`content-type`):t[`Content-Type`]??t[`content-type`])===`application/x-www-form-urlencoded`?new URLSearchParams(e).toString():JSON.stringify(e)}function Lp(e,t){let n=`${t.baseUrl}${e}`;t.params?.path&&(n=Fp(n,t.params.path));let r=t.querySerializer(t.params.query??{});return r.startsWith(`?`)&&(r=r.substring(1)),r&&(n+=`?${r}`),n}function Rp(...e){let t=new Headers;for(let n of e){if(!n||typeof n!=`object`)continue;let e=n instanceof Headers?n.entries():Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,r)}return t}function zp(e){return e.endsWith(`/`)?e.substring(0,e.length-1):e}var Bp=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Vp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Hp=new class{#e=Vp;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Up(e){setTimeout(e,0)}var Wp=typeof window>`u`||`Deno`in globalThis;function Gp(){}function Kp(e,t){return typeof e==`function`?e(t):e}function qp(e){return typeof e==`number`&&e>=0&&e!==1/0}function Jp(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Yp(e,t){return typeof e==`function`?e(t):e}function Xp(e,t){return typeof e==`function`?e(t):e}function Zp(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==$p(o,t.options))return!1}else if(!tm(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Qp(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(em(t.options.mutationKey)!==em(a))return!1}else if(!tm(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function $p(e,t){return(t?.queryKeyHashFn||em)(e)}function em(e){return JSON.stringify(e,(e,t)=>om(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function tm(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>tm(e[n],t[n])):!1}var nm=Object.prototype.hasOwnProperty;function rm(e,t){if(e===t)return e;let n=am(e)&&am(t);if(!n&&!(om(e)&&om(t)))return t;let r=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),a=i.length,o=n?Array(a):{},s=0;for(let c=0;c<a;c++){let a=n?c:i[c],l=e[a],u=t[a];if(l===u){o[a]=l,(n?c<r:nm.call(e,a))&&s++;continue}if(l===null||u===null||typeof l!=`object`||typeof u!=`object`){o[a]=u;continue}let d=rm(l,u);o[a]=d,d===l&&s++}return r===a&&s===r?e:o}function im(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function am(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function om(e){if(!sm(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!sm(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function sm(e){return Object.prototype.toString.call(e)===`[object Object]`}function cm(e){return new Promise(t=>{Hp.setTimeout(t,e)})}function lm(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:rm(e,t)}function um(e){return e}function dm(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function fm(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var pm=Symbol();function mm(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===pm?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function hm(e,t){return typeof e==`function`?e(...t):!!e}var gm=new class extends Bp{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Wp&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}};function _m(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var vm=Up;function ym(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=vm,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var bm=ym(),xm=new class extends Bp{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Wp&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Sm(e){return Math.min(1e3*2**e,3e4)}function Cm(e){return(e??`online`)===`online`?xm.isOnline():!0}var wm=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Tm(e){let t=!1,n=0,r,i=_m(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new wm(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>gm.isFocused()&&(e.networkMode===`always`||xm.isOnline())&&e.canRun(),u=()=>Cm(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Wp?0:3),o=e.retryDelay??Sm,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),cm(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Em=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qp(this.gcTime)&&(this.#e=Hp.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wp?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(Hp.clearTimeout(this.#e),void 0)}},Dm=class extends Em{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Am(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Am(this.options);e.data!==void 0&&(this.setState(km(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=lm(this.state.data,e,this.options);return this.#s({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(Gp).catch(Gp):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Xp(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pm||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Yp(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Jp(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=mm(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=Tm({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof wm&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#s({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#s({type:`pause`})},onContinue:()=>{this.#s({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof wm){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#s({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#s(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Om(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...km(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),bm.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Om(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Cm(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function km(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Am(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var jm=class extends Bp{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=_m(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Nm(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Xp(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!im(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Fm(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Xp(this.options.enabled,this.#t)!==Xp(t.enabled,this.#t)||Yp(this.options.staleTime,this.#t)!==Yp(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Xp(this.options.enabled,this.#t)!==Xp(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Lm(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Gp)),t}#g(){this.#b();let e=Yp(this.options.staleTime,this.#t);if(Wp||this.#r.isStale||!qp(e))return;let t=Jp(this.#r.dataUpdatedAt,e)+1;this.#d=Hp.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(Wp||Xp(this.options.enabled,this.#t)===!1||!qp(this.#p)||this.#p===0)&&(this.#f=Hp.setInterval(()=>{(this.options.refetchIntervalInBackground||gm.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(Hp.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(Hp.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Nm(e,t),o=i&&Fm(e,n,t,r);(a||o)&&(l={...l,...Om(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=lm(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=lm(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Im(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Xp(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=e=>{x.status===`error`?e.reject(x.error):x.data!==void 0&&e.resolve(x.data)},r=()=>{t(this.#o=x.promise=_m())},i=this.#o;switch(i.status){case`pending`:e.queryHash===n.queryHash&&t(i);break;case`fulfilled`:(x.status===`error`||x.data!==i.value)&&r();break;case`rejected`:(x.status!==`error`||x.error!==i.reason)&&r();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!im(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){bm.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Mm(e,t){return Xp(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function Nm(e,t){return Mm(e,t)||e.state.data!==void 0&&Pm(e,t,t.refetchOnMount)}function Pm(e,t,n){if(Xp(t.enabled,e)!==!1&&Yp(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Im(e,t)}return!1}function Fm(e,t,n,r){return(e!==t||Xp(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Im(e,n)}function Im(e,t){return Xp(t.enabled,e)!==!1&&e.isStaleByTime(Yp(t.staleTime,e))}function Lm(e,t){return!im(e.getCurrentResult(),t)}function Rm(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener(`abort`,()=>{n=!0}),t.signal)})},u=mm(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?fm:dm;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Bm:zm,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:zm(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function zm(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Bm(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Vm(e,t){return t?zm(e,t)!=null:!1}function Hm(e,t){return!t||!e.getPreviousPageParam?!1:Bm(e,t)!=null}var Um=class extends jm{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Rm()})}getOptimisticResult(e){return e.behavior=Rm(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Vm(t,n.data),hasPreviousPage:Hm(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Wm=class extends Em{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Gm(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Tm({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{throw await this.#n.config.onError?.(t,e,this.state.context,this,n),await this.options.onError?.(t,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,t,e,this.state.context,n),t}finally{this.#i({type:`error`,error:t})}}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),bm.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Gm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Km=class extends Bp{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),im(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&em(t.mutationKey)!==em(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Gm();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){bm.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type===`success`?(this.#r.onSuccess?.(e.data,t,n,r),this.#r.onSettled?.(e.data,null,t,n,r)):e?.type===`error`&&(this.#r.onError?.(e.error,t,n,r),this.#r.onSettled?.(void 0,e.error,t,n,r))}this.listeners.forEach(e=>{e(this.#t)})})}},qm=q.createContext(void 0),Jm=e=>{let t=q.useContext(qm);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ym=({client:e,children:t})=>(q.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,J.jsx)(qm.Provider,{value:e,children:t})),Xm=q.createContext(!1),Zm=()=>q.useContext(Xm);Xm.Provider;function Qm(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $m=q.createContext(Qm()),eh=()=>q.useContext($m),th=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},nh=e=>{q.useEffect(()=>{e.clearReset()},[e])},rh=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||hm(n,[e.error,r])),ih=(e,t)=>t.state.data===void 0,ah=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},oh=(e,t)=>e.isLoading&&e.isFetching&&!t,sh=(e,t)=>e?.suspense&&t.isPending,ch=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function lh(e,t,n){let r=Zm(),i=eh(),a=Jm(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?`isRestoring`:`optimistic`,ah(o),th(o,i),nh(i);let s=!a.getQueryCache().get(o.queryHash),[c]=q.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!r&&e.subscribed!==!1;if(q.useSyncExternalStore(q.useCallback(e=>{let t=u?c.subscribe(bm.batchCalls(e)):Gp;return c.updateResult(),t},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),q.useEffect(()=>{c.setOptions(o)},[o,c]),sh(o,l))throw ch(o,c,i);if(rh({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!Wp&&oh(l,r)&&(s?ch(o,c,i):a.getQueryCache().get(o.queryHash)?.promise)?.catch(Gp).finally(()=>{c.updateResult()}),o.notifyOnChangeProps?l:c.trackResult(l)}function uh(e,t){return lh(e,jm,t)}function dh(e,t){return lh({...e,enabled:!0,suspense:!0,throwOnError:ih,placeholderData:void 0},jm,t)}function fh(e,t){let n=Jm(t),[r]=q.useState(()=>new Km(n,e));q.useEffect(()=>{r.setOptions(e)},[r,e]);let i=q.useSyncExternalStore(q.useCallback(e=>r.subscribe(bm.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=q.useCallback((e,t)=>{r.mutate(e,t).catch(Gp)},[r]);if(i.error&&hm(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function ph(e,t){return lh(e,Um,t)}function mh(e){let t=async({queryKey:[t,n,r],signal:i})=>{let a=e[t.toUpperCase()],{data:o,error:s,response:c}=await a(n,{signal:i,...r});if(s)throw s;return c.status===204||c.headers.get(`Content-Length`)===`0`?o??null:o},n=(t,n)=>async r=>{let i=e[t.toUpperCase()],{data:a,error:o}=await i(n,r);if(o)throw o;return a},r=(e,n,...[r,i])=>({queryKey:r===void 0?[e,n]:[e,n,r],queryFn:t,...i});return{queryOptions:r,mutationOptions:(e,t,r)=>({mutationKey:[e,t],mutationFn:n(e,t),...r}),useQuery:(e,t,...[n,i,a])=>uh(r(e,t,n,i),a),useSuspenseQuery:(e,t,...[n,i,a])=>dh(r(e,t,n,i),a),useInfiniteQuery:(t,n,i,a,o)=>{let{pageParamName:s=`cursor`,...c}=a,{queryKey:l}=r(t,n,i);return ph({queryKey:l,queryFn:async({queryKey:[t,n,r],pageParam:i=0,signal:a})=>{let o=e[t.toUpperCase()],{data:c,error:l}=await o(n,{...r,signal:a,params:{...r?.params||{},query:{...r?.params?.query,[s]:i}}});if(l)throw l;return c},...c},o)},useMutation:(e,t,r,i)=>fh({mutationKey:[e,t],mutationFn:n(e,t),...r},i)}}async function hh(e,t,n){let r=await e(await t());if(r.status!==401)return r;let i=await e(await t({forceRefresh:!0}));return i.status===401&&n(),i}function gh(){let e=new Map;return{async onRequest({request:t,id:n}){let{getAccessToken:r}=await Xc(),i=await r(),a=Kc();return t.headers.set(`authorization`,`Bearer ${i}`),t.headers.set(`zuplo-request-id`,a),t.headers.set(`x-trace-id`,a),e.set(n,t.clone()),t},onError({id:t}){e.delete(t)},async onResponse({request:t,response:n,id:r}){let i=e.get(r);e.delete(r);let a=t.headers.get(`x-trace-id`)||`unknown`,{getAccessToken:o}=await Xc(),s=n;if(n.status===401&&i){let e=await o({forceRefresh:!0});i.headers.set(`authorization`,`Bearer ${e}`),s=await fetch(i)}if(s.status===401){xp();let e=new Tc(`Your session has expired. Please log in again.`,{traceId:a});throw e.status=401,e}if(!s.ok){let e=new Tc(`Error while making request. Please try again or contact support if the problem persists.`,{traceId:a});throw await e.tryReadResponse(s.clone()),e}return s}}}var _h=Ap({baseUrl:K});_h.use(gh());var vh=mh(_h),yh=e=>{let t=Object.entries(e).flatMap(([e,t])=>t?[[e,t]]:[]);return new URLSearchParams(t).toString()},bh=`roots`,$={user:{preferences:()=>({url:`${K}/v1/users/me/preferences`})},authApiKey:e=>({url:`${K}/v1/auth/api-keys/${e}`}),authAccountApiKeys:e=>({url:`${K}/v1/auth/api-keys?accountName=${e}`}),authCurrentUserAccountRoles:e=>({url:`${K}/v1/auth/users/me?accountName=${e}`}),authUserAccountRoles:(e,t)=>({url:`${K}/v1/auth/users/${t}?accountName=${e}`}),authProjectUsersRoles:(e,t,{includeInheritedRoles:n}={includeInheritedRoles:!1})=>({url:`${K}/v1/auth/users?accountName=${e}&projectName=${t}&includeInheritedRoles=${n}`}),authAccountUsersRoles:e=>({url:`${K}/v1/auth/users?accountName=${e}`}),mfaFactors:()=>({url:`${K}/v1/mfa/factors`}),accountMemberInviteDetails:e=>({url:`${K}/v1/account-member-invites/${e}`}),accountMemberInvites:e=>({url:`${K}/v1/accounts/${e}/account-member-invites`}),accountAuditLogs:(e,t)=>{let n=new URLSearchParams;t?.limit&&n.append(`limit`,t.limit.toString()),t?.offset&&n.append(`offset`,t.offset.toString()),t?.action&&n.append(`action`,t.action),t?.startDate&&n.append(`startDate`,t.startDate),t?.endDate&&n.append(`endDate`,t.endDate),t?.actor&&n.append(`actor`,t.actor),t?.success!==void 0&&n.append(`success`,t.success.toString());let r=n.toString();return{url:`${K}/v1/accounts/${e}/audit-logs${r?`?${r}`:``}`}},account:e=>({url:`${K}/v1/accounts/${e}`}),bucketAuditLogsEvents:(e,t)=>{let n=new URLSearchParams;t?.limit!==void 0&&n.append(`limit`,String(t.limit)),t?.cursor&&n.append(`cursor`,t.cursor),t?.type&&n.append(`type`,t.type),t?.actorSub&&n.append(`actorSub`,t.actorSub),t?.subject&&n.append(`subject`,t.subject),t?.startDate&&n.append(`startDate`,t.startDate),t?.endDate&&n.append(`endDate`,t.endDate);let r=n.toString();return{url:`${K}/v1/audit-logs/${e}/events${r?`?${r}`:``}`}},bucketAuditLogsStats:(e,t)=>{let n=new URLSearchParams;return n.append(`groupBy`,t.groupBy),t.limit!==void 0&&n.append(`limit`,String(t.limit)),t.startDate&&n.append(`startDate`,t.startDate),t.endDate&&n.append(`endDate`,t.endDate),{url:`${K}/v1/audit-logs/${e}/stats?${n.toString()}`}},accounts:()=>({url:`${K}/v1/accounts`}),accountSourceControlRepoList:e=>({url:`${K}/v1/accounts/${e}/$repo-list`}),accountSourceControlAzureProjects:(e,t)=>({url:`${K}/v1/accounts/${e}/source-control/$azure-projects?organization=${t}`}),accountSourceControlNamespaces:e=>({url:`${K}/v1/accounts/${e}/$namespaces`}),accountSourceControlRepos:(e,t,n)=>({url:`${K}/v1/accounts/${e}/$repos?${new URLSearchParams({namespace:t,query:n??``})}`}),accountsSourceControlConfigurations:()=>({url:`${K}/v1/user/me/source-control-configs`}),billing:e=>({url:`${K}/v1/accounts/${e}/billings`}),buildLogs:(e,t)=>({url:`${K}/v2/deployments/${e}/build-logs/${t}`}),cdnContent:e=>({url:`${jc}${e}`}),knockIdentity:()=>({url:`${K}/v1/knock-identity`}),posthogIdentity:()=>({url:`${K}/v1/posthog-identity`}),bucketConfigurations:e=>({url:`${K}/v1/buckets/${e}/configurations`}),bucketConfigurationPools:e=>({url:`${K}/v1/buckets/${e}/configurations/teams`}),bucketConfigurationApps:e=>({url:`${K}/v1/buckets/${e}/configurations/apps`}),bucketConfigurationUserApps:e=>({url:`${K}/v1/buckets/${e}/configurations/user-apps`}),bucketConfiguration:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations/${t}`}),bucketConfigurationUsage:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/usage`}),bucketConfigurationMembers:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members`}),bucketConfigurationMember:(e,t,n)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`}),supportedAiProviders:e=>({url:`${K}/v1/buckets/${e}/providers`}),aiProviderAssignments:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/ai-provider-assignments`}),hierarchicalQuota:e=>({url:`${K}/v1/hierarchical-quota/${e}`}),consumer:(e,t)=>({url:`${K}/v1/api-keys/${e}/consumers/${t}`}),consumersForBucket:(e,t)=>{let n=yh({limit:t?.limit?.toString(),offset:t?.offset?.toString(),name:t?.name,email:t?.email});return{url:`${K}/v1/api-keys/${e}/consumers${n?`?${n}`:``}`}},customDomains:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/custom-domains`}),accountCustomDomains:e=>({url:`${K}/v1/accounts/${e}/custom-domains`}),deploymentVersions:e=>({url:`${K}/v1/deployments/${e}/versions`}),environments:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/deployments`}),environmentVariables:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/environment-variables`}),file:(e,t)=>({url:`${K}/v1/deployments/${e}/fs/file?path=${t}`}),fsStats:e=>({url:`${K}/v1/deployments/${e}/fs/stats`}),gitBranches:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$branches`}),projectSyncStatus:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/sync-status`}),meteringBucket:(e,t)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/`}),meteringPlans:(e,t)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/plans`}),meteringSubscriptions:(e,t)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/subscriptions`}),meteringSubscriptionQuotas:(e,t,n)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/subscriptions/${n}/quotas`}),project:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}`}),projects:e=>({url:`${K}/v1/accounts/${e}/projects`}),permissions:(e,t)=>({url:`${K}/v1/permissions/${e}/${t}`}),permissionsProject:(e,t)=>({url:`${K}/v1/permissions/project/${e}|${t}`}),permissionsAiPool:e=>({url:`${K}/v1/permissions/ai_team/${e}`}),logViewerRequests:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.cursor&&n.append(`cursor`,t.cursor),t.since&&n.append(`since`,t.since),t.sinceId&&n.append(`sinceId`,t.sinceId),t.limit&&n.append(`limit`,t.limit.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/deployments/${e}/logs/requests?${n}`}},logViewerRequestDetail:(e,t,n)=>{let r=new URLSearchParams;n&&r.append(`timestamp`,n);let i=r.toString();return{url:`${K}/v2/deployments/${e}/logs/requests/${t}${i?`?${i}`:``}`}},logViewerHistogram:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/deployments/${e}/logs/histogram?${n}`}},logViewerFacets:(e,t)=>{let n=new URLSearchParams;return n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.facets&&n.append(`facets`,t.facets),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/deployments/${e}/logs/facets?${n}`}},logViewerRequestsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.cursor&&n.append(`cursor`,t.cursor),t.since&&n.append(`since`,t.since),t.sinceId&&n.append(`sinceId`,t.sinceId),t.limit&&n.append(`limit`,t.limit.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/logs/requests?${n}`}},logViewerRequestDetailScoped:(e,t,n)=>{let r=new URLSearchParams;return r.append(`account`,e.accountName),e.projectName&&r.append(`project`,e.projectName),e.deploymentName&&r.append(`deploymentName`,e.deploymentName),n&&r.append(`timestamp`,n),{url:`${K}/v2/logs/requests/${t}?${r}`}},logViewerHistogramScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/logs/histogram?${n}`}},logViewerFacetsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.facets&&n.append(`facets`,t.facets),t.httpMethod&&n.append(`httpMethod`,t.httpMethod),t.httpStatus&&n.append(`httpStatus`,t.httpStatus),t.routePath&&n.append(`routePath`,t.routePath),t.search&&n.append(`search`,t.search),t.severity&&n.append(`severity`,t.severity),{url:`${K}/v2/logs/facets?${n}`}},tracesListScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),t.limit&&n.append(`limit`,String(t.limit)),t.cursor&&n.append(`cursor`,t.cursor),n.append(`mode`,bh),{url:`${K}/v2/traces?${n}`}},traceDetailScoped:(e,t,n)=>{let r=new URLSearchParams;return r.append(`account`,e.accountName),e.projectName&&r.append(`project`,e.projectName),e.deploymentName&&r.append(`deploymentName`,e.deploymentName),n&&r.append(`ts`,n),{url:`${K}/v2/traces/${encodeURIComponent(t)}?${r}`}},traceStatsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.intervalSeconds&&n.append(`intervalSeconds`,t.intervalSeconds.toString()),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),n.append(`mode`,bh),{url:`${K}/v2/trace-stats?${n}`}},traceFacetsScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.facets&&n.append(`facets`,t.facets),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),t.service&&n.append(`service`,t.service),t.hasError!==void 0&&n.append(`hasError`,String(t.hasError)),t.search&&n.append(`search`,t.search),n.append(`mode`,bh),{url:`${K}/v2/trace-facets?${n}`}},serviceMapScoped:(e,t)=>{let n=new URLSearchParams;return n.append(`account`,e.accountName),e.projectName&&n.append(`project`,e.projectName),e.deploymentName&&n.append(`deploymentName`,e.deploymentName),n.append(`start`,t.start),n.append(`end`,t.end),t.statusCode&&n.append(`statusCode`,t.statusCode),t.method&&n.append(`method`,t.method),t.route&&n.append(`route`,t.route),{url:`${K}/v2/service-map?${n}`}},usersMe:()=>({url:`${K}/v1/users/me`}),identityConnections:e=>({url:`${K}/v1/accounts/${e}/identity-connections`}),identityConnectionTicket:e=>({url:`${K}/v1/accounts/${e}/identity-connections/ticket`}),analyticsRequests:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return e.compare&&t.append(`compare`,`previous`),{url:`${K}/v2/analytics/requests?${t}`}},analyticsRequestsField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/requests/fields/${encodeURIComponent(e)}?${n}`}},analyticsConsumers:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/consumers?${t}`}},analyticsAgents:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.includeOther===!0&&t.append(`includeOther`,`true`),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/agents?${t}`}},analyticsAgentsTimeSeries:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.includeOther===!0&&t.append(`includeOther`,`true`),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/agents/timeseries?${t}`}},analyticsBackend:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/backend?${t}`}},analyticsEdge:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/edge?${t}`}},analyticsAiGateway:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/ai-gateway?${t}`}},analyticsAiGatewayMe:e=>{let t=new URLSearchParams;return t.append(`account`,e.accountName),t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),{url:`${K}/v2/analytics/ai-gateway/users/me?${t}`}},analyticsAiGatewayField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/ai-gateway/fields/${encodeURIComponent(e)}?${n}`}},analyticsCache:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/cache?${t}`}},analyticsCacheField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/cache/fields/${encodeURIComponent(e)}?${n}`}},analyticsMcp:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/mcp?${t}`}},analyticsGraphql:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.intervalSeconds&&t.append(`intervalSeconds`,e.intervalSeconds.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/graphql?${t}`}},analyticsMcpField:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/mcp/fields/${encodeURIComponent(e)}?${n}`}},analyticsMcpCapabilities:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.view&&t.append(`view`,e.view),e.capabilityType&&t.append(`capabilityType`,e.capabilityType),e.limit&&t.append(`limit`,e.limit.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/mcp/capabilities?${t}`}},analyticsMcpEvents:e=>{let t=new URLSearchParams;if(t.append(`account`,e.accountName),e.projectName&&t.append(`project`,e.projectName),t.append(`startTime`,e.startTime),t.append(`endTime`,e.endTime),e.offset!=null&&t.append(`offset`,e.offset.toString()),e.limit!=null&&t.append(`limit`,e.limit.toString()),e.filters)for(let n of e.filters)t.append(`filter`,n);return{url:`${K}/v2/analytics/mcp/events?${t}`}},analyticsMcpBreakdown:(e,t)=>{let n=new URLSearchParams;if(n.append(`account`,t.accountName),t.projectName&&n.append(`project`,t.projectName),n.append(`startTime`,t.startTime),n.append(`endTime`,t.endTime),t.offset!=null&&n.append(`offset`,t.offset.toString()),t.limit!=null&&n.append(`limit`,t.limit.toString()),t.filters)for(let e of t.filters)n.append(`filter`,e);return{url:`${K}/v2/analytics/mcp/breakdowns/${e}?${n}`}},analyticsUsage:e=>{let t=new URLSearchParams;return t.append(`account`,e.accountName),t.append(`from`,e.from),t.append(`to`,e.to),{url:`${K}/v2/analytics/usage?${t}`}}};function xh(e){let t=new Date;switch(e){case`7d`:t.setUTCDate(t.getUTCDate()-7);break;case`30d`:t.setUTCDate(t.getUTCDate()-30);break;case`3m`:t.setUTCMonth(t.getUTCMonth()-3);break}return t.toISOString()}async function Sh(e,t){let n=t.pageSize??30,{page:r,pageSize:i,order:a=`DESC`,orderBy:o=`periodStart`,...s}=t,{data:c,error:l}=await _h.GET(`/v3/metering/{bucketId}/billing/invoices`,{params:{path:{bucketId:e},query:{page:r,pageSize:n,expand:[`lines`],order:a,orderBy:o,...s}}});if(l||!c)throw l??Error(`Failed to load invoices`);return c}var Ch=15;async function wh(e,t,n=6){let r=await Sh(e,{page:1,pageSize:n,createdAfter:xh(`3m`),order:`DESC`,orderBy:`periodStart`,customers:[t]}),i=r.items??[];if(i.length===0||i.every(e=>e.customer?.id===t))return r;let a=[],o=1;for(;a.length<n&&o<=Ch;){let r=await Sh(e,{page:o,pageSize:30,createdAfter:xh(`3m`),order:`DESC`,orderBy:`periodStart`}),i=r.items??[];if(i.length===0)break;for(let e of i)if(e.customer?.id===t&&(a.push(e),a.length>=n))break;let s=r.pageSize??30,c=Math.max(1,Math.ceil((r.totalCount??0)/s));if(o>=c)break;o++}let s=a.slice(0,n);return{...r,items:s,totalCount:s.length,page:1,pageSize:n}}var Th={orderBy:`createdAt`,order:`DESC`},Eh=`/v3/metering/{bucketId}/plans`,Dh=`/v3/metering/{bucketId}/customers`;function Oh(e){if(!e)return;let t={};return e.page!=null&&(t.page=e.page,t.pageSize=e.pageSize??30),e.status?.length&&(t.status=e.status),Object.keys(t).length>0?t:void 0}function kh(e,t){let n=Oh(t);return n?{params:{path:{bucketId:e},query:n}}:{params:{path:{bucketId:e}}}}function Ah(e){if(!e)return;let t={orderBy:e.orderBy??Th.orderBy,order:e.order??Th.order};return e.page!=null&&(t.page=e.page,t.pageSize=e.pageSize??30),e.planKey&&(t.planKey=e.planKey),e.name&&(t.name=e.name),e.key&&(t.key=e.key),e.primaryEmail&&(t.primaryEmail=e.primaryEmail),Object.keys(t).length>0?t:void 0}function jh(e,t){let n=Ah(t);return n?{params:{path:{bucketId:e},query:n}}:{params:{path:{bucketId:e}}}}function Mh(e){let t={page:e.page??1,pageSize:e.pageSize??30};return e.includeArchived!=null&&(t.includeArchived=e.includeArchived),t}function Nh(e,t,n){return Array.isArray(e)?{items:e,totalCount:e.length,page:t,pageSize:n}:e}var Ph={ai:{providerAssignments:{list:(e,t)=>vh.queryOptions(`get`,`/v1/accounts/{accountName}/projects/{projectName}/ai-provider-assignments`,{params:{path:{accountName:e,projectName:t}}},{select:e=>e.data})}},deployments:{list:(e,t)=>vh.queryOptions(`get`,`/v1/accounts/{accountName}/projects/{projectName}/deployments`,{params:{path:{accountName:e,projectName:t}}}),versions:{list:e=>vh.queryOptions(`get`,`/v1/deployments/{deploymentName}/versions`,{params:{path:{deploymentName:e}}})}},metering:{customers:{list:(e,t)=>vh.queryOptions(`get`,Dh,jh(e,t),t?.page==null?void 0:{placeholderData:um}),get:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/customers/{customerIdOrKey}`,{params:{path:{bucketId:e,customerIdOrKey:t}}}),subscriptions:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/customers/{customerIdOrKey}/subscriptions`,{params:{path:{bucketId:e,customerIdOrKey:t}}})},plans:{list:(e,t)=>vh.queryOptions(`get`,Eh,kh(e,t),t?.page==null?void 0:{placeholderData:um}),get:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/plans/{planId}`,{params:{path:{bucketId:e,planId:t}}}),listByKey:(e,t)=>vh.queryOptions(`get`,Eh,{params:{path:{bucketId:e},query:{key:[t]}}})},meters:{list:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/meters`,{params:{path:{bucketId:e}}})},configuration:{get:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/monetization-configuration`,{params:{path:{bucketId:e}}})},features:{list:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/features`,{params:{path:{bucketId:e},query:t?{includeArchived:t}:void 0}},{select:e=>Array.isArray(e)?e:e.items}),listPaginated:(e,t)=>{let n=t.page??1,r=t.pageSize??30;return vh.queryOptions(`get`,`/v3/metering/{bucketId}/features`,{params:{path:{bucketId:e},query:Mh(t)}},{select:e=>Nh(e,n,r),placeholderData:um})}},planInvites:{list:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/plan-invites`,{params:{path:{bucketId:e}}})},billingReadiness:{get:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/billing-readiness`,{params:{path:{bucketId:e}}})},stripe:{setup:e=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/setup/stripe`,{params:{path:{bucketId:e}}})},subscriptions:{get:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}`,{params:{path:{bucketId:e,subscriptionId:t}}}),access:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}/access`,{params:{path:{bucketId:e,subscriptionId:t}}}),usage:(e,t)=>vh.queryOptions(`get`,`/v3/metering/{bucketId}/subscriptions/{subscriptionId}/usage`,{params:{path:{bucketId:e,subscriptionId:t}}})},invoices:{list:(e,t,n,r,i,a)=>({queryKey:[`metering`,e,`invoices`,t,n,r??`all`,a,i],queryFn:()=>Sh(e,{page:n,pageSize:30,createdAfter:xh(t),order:i,orderBy:a,...r?.statuses?.length?{statuses:r.statuses}:{},...r?.extendedStatuses?.length?{extendedStatuses:r.extendedStatuses}:{}}),placeholderData:um}),forCustomer:(e,t)=>({queryKey:[`metering`,e,`invoices`,`customer`,t],queryFn:()=>wh(e,t)})}}},Fh=[`ai-pool`,`ai-app`,`ai-user-app`],Ih=e=>e.metadata?.type==null,Lh=e=>{let t=e.metadata?.type;return typeof t==`string`&&Fh.includes(t)?t:void 0},Rh=e=>{if(Ih(e))return!0;let t=Lh(e);return t===`ai-pool`||t===`ai-app`};function zh(e){return e.some(e=>!Rh(e))?e.filter(Rh):e}var Bh=e=>e?.find(e=>e.parentId?!1:Ih(e)?!0:Lh(e)===`ai-pool`),Vh=e=>{let{type:t,...n}=e;return n},Hh=async e=>Uh(e,await i(()=>import(`./editor.main-B7ZQNwu9.js`),__vite__mapDeps([0,1,2,3,4,5,6]))),Uh=(e,t)=>{let n=e.split(`.`).pop();if(n)return t.languages.getLanguages().find(e=>e.extensions?.includes(`.${n}`))},Wh=`x-test-proxy-error`,Gh=`The gateway URL isn't ready yet — this environment is still being provisioned for its first deploy. Wait for the build to finish, then try again.`,Kh=class extends Error{constructor(e=Gh){super(e),this.name=`GatewayUrlUnavailableError`}},qh=[200,400,413,502],Jh=({pathname:e,overrideUrl:t})=>{if(!t)throw new Kh;return new URL(e??``,t).toString()},Yh=`zp-build-id`,Xh=({testRequest:e,overrideUrl:t,environmentName:n,buildId:r})=>({url:Jh({pathname:e.pathname,overrideUrl:t}),method:e.method,deployment:n,headers:r&&!Zh(e.headers)?{[Yh]:r,...e.headers}:e.headers,body:e.body}),Zh=e=>Object.keys(e??{}).some(e=>e.toLowerCase()===Yh),Qh=e=>{if(typeof e!=`object`||!e)return!1;let{status:t,body:n}=e;if(t!==404||typeof n!=`string`)return!1;try{return JSON.parse(n)?.title===`Build Not Found`}catch{return!1}},$h={invalid_request:`The Zuplo test proxy rejected the request as invalid.`,get_or_head_with_body:`The Zuplo test proxy rejected the request because GET and HEAD requests can't include a body.`,invalid_request_body:`The Zuplo test proxy couldn't read the request body.`,request_too_large:`The Zuplo test proxy rejected the request because it exceeds the 250 KB limit.`,upstream_request_failed:`The Zuplo test proxy couldn't reach your API — it was unreachable, timed out, or refused the connection.`},eg=e=>{let t=(e.code?$h[e.code]:void 0)??e.detail??e.title??`The Zuplo test proxy couldn't run this request.`;return`${t}${e.detail&&e.detail!==t?` ${e.detail}`:``} This is an error from the Zuplo test proxy, not a response from your API.`},tg=class extends Error{code;status;detail;title;constructor(e){super(eg(e)),this.name=`TestProxyError`,this.code=e.code,this.status=e.status,this.detail=e.detail,this.title=e.title}},ng=async e=>{let t=e.headers.get(Wh),n;try{let t=await e.clone().json();t&&typeof t==`object`&&(n=t)}catch{}return new tg({code:n?.code??t??void 0,detail:typeof n?.detail==`string`?n.detail:void 0,title:typeof n?.title==`string`?n.title:void 0,status:typeof n?.status==`number`?n.status:e.status})},rg={createApiKey:e=>({url:`${K}/v1/auth/api-keys`,method:`POST`,json:!0,body:JSON.stringify(e),invalidateKeys:[$.authAccountApiKeys(e.accountName)],acceptableStatuses:[200]}),deleteApiKey:(e,t)=>({url:`${K}/v1/auth/api-keys/${e}`,method:`DELETE`,invalidateKeys:[$.authApiKey(e),$.authAccountApiKeys(t)],acceptableStatuses:[204]}),updateUsersRole:({userId:e,accountName:t,projectName:n,role:r})=>({url:`${K}/v1/auth/users/${e}`,method:`PATCH`,json:!0,body:JSON.stringify({accountName:t,projectName:n,role:r}),parseResponse:!1,invalidateKeys:n?[$.authProjectUsersRoles(t,n,{includeInheritedRoles:!1}),$.authProjectUsersRoles(t,n,{includeInheritedRoles:!0}),$.authAccountUsersRoles(t),$.authCurrentUserAccountRoles(t)]:[$.authAccountUsersRoles(t),$.authCurrentUserAccountRoles(t)],acceptableStatuses:[201,200]})},ig={createAccount:e=>({url:`${K}/v1/accounts`,method:`POST`,json:!0,body:JSON.stringify(e),invalidateKeys:[$.accounts()],acceptableStatuses:[201]}),deleteAccount:e=>({url:`${K}/v1/accounts/${e.name}`,method:`DELETE`,invalidateKeys:[$.accounts()],acceptableStatuses:[200]}),createCustomDomain:({accountName:e,projectName:t,isAlias:n,hostname:r,deploymentName:i,stage:a})=>({url:`${K}/v1/accounts/${e}/custom-domains`,method:`POST`,body:JSON.stringify({hostname:r,isAlias:n,deploymentName:i,stage:a}),invalidateKeys:[$.accounts(),$.projects(e),$.environments(e,t),$.customDomains(e,t),$.accountCustomDomains(e),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[200]}),deleteAccountMemberInvite:({accountName:e,inviteId:t})=>({url:`${K}/v1/accounts/${e}/account-member-invites/${t}`,method:`DELETE`,invalidateKeys:[$.accountMemberInvites(e)],acceptableStatuses:[204]}),deleteCustomDomain:({accountName:e,projectName:t,hostname:n,deploymentName:r})=>({url:`${K}/v1/accounts/${e}/custom-domains?hostname=${n}&deploymentName=${r}`,method:`DELETE`,invalidateKeys:[$.accounts(),$.projects(e),$.environments(e,t),$.customDomains(e,t),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[204]}),editCustomDomain:({accountName:e,projectName:t,hostname:n,deploymentName:r})=>({url:`${K}/v1/accounts/${e}/custom-domains`,method:`PATCH`,body:JSON.stringify({hostname:n,deploymentName:r}),invalidateKeys:[$.accounts(),$.projects(e),$.environments(e,t),$.customDomains(e,t),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[200]}),resendAccountMemberInvite:({accountName:e,inviteId:t})=>({url:`${K}/v1/accounts/${e}/account-member-invites/${t}/$resend`,method:`PATCH`,body:JSON.stringify({}),invalidateKeys:[$.accountMemberInvites(e)],acceptableStatuses:[201]}),billingUpgrade:(e,t,n,r)=>({method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({successUrl:n,cancelUrl:r}),url:`${K}/v1/accounts/${e}/upgrade/${t}`}),updateAccount:({accountName:e,...t})=>({url:`${K}/v1/accounts/${e}`,method:`PATCH`,body:JSON.stringify(t),json:!0,invalidateKeys:[$.accounts()],acceptableStatuses:[200]})},ag={createProject:(e,t,{productType:n,...r}={})=>({url:`${K}/v1/accounts/${e}/projects`,method:`POST`,body:JSON.stringify({name:t,productType:n,options:r}),removeKeys:[$.projects(e),$.authCurrentUserAccountRoles(e)],acceptableStatuses:[201]}),createProjectWithRepo:(e,t,n,r,i)=>({url:`${K}/v1/accounts/${e}/projects/$create-with-repo`,method:`POST`,body:JSON.stringify({projectName:t,orgName:n,repositoryName:r,defaultBranch:i}),removeKeys:[$.projects(e),$.authCurrentUserAccountRoles(e)],acceptableStatuses:[201]}),createProjectFromRepo:(e,t,n,r)=>({url:`${K}/v1/accounts/${e}/projects/$create-from-repo`,method:`POST`,body:JSON.stringify({projectName:t,sourceRepoUrl:n,defaultBranch:r}),removeKeys:[$.projects(e),$.authCurrentUserAccountRoles(e)],acceptableStatuses:[201]}),createRepoFromProject:(e,t,n,r,i,a)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$create-repo`,method:`POST`,body:JSON.stringify({orgName:n,repositoryName:r,defaultBranch:i,otherParams:a}),invalidateKeys:[$.projects(e),$.environments(e,t),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[201]}),connectProjectToRepo:(e,t,n,r,i,a)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$connect`,method:`PATCH`,body:JSON.stringify({orgName:n,repositoryURL:r,defaultBranch:i,forceConnect:a}),invalidateKeys:[$.projects(e),$.environments(e,t),Ph.deployments.list(e,t).queryKey],acceptableStatuses:[201]}),disconnectProjectFromRepo:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$disconnect`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[$.projects(e)],acceptableStatuses:[201]}),initProject:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$init`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[$.projects(e)],acceptableStatuses:[201]}),deleteProject:(e,t)=>({url:`${K}/v1/accounts/${e}/projects/${t}`,method:`DELETE`,invalidateKeys:[$.projects(e),Ph.deployments.list(e,t).queryKey],removeKeys:[$.environments(e,t),$.authCurrentUserAccountRoles(e)],acceptableStatuses:[204]}),archiveProject:e=>({url:`${K}/v1/deployments/${e}/archive`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[200]}),updateDefaultBranch:({accountName:e,projectName:t,defaultBranch:n,sourceRepoUrl:r})=>({url:`${K}/v1/accounts/${e}/projects/${t}/$update-default-branch`,method:`PATCH`,body:JSON.stringify({defaultBranch:n,sourceRepoUrl:r}),headers:{"content-type":`application/json`},invalidateKeys:[$.projects(e),Ph.deployments.list(e,t).queryKey],removeKeys:[$.environments(e,t)],acceptableStatuses:[200]})},og={createConsumer:e=>{let t={...e.consumer,accountName:e.accountName,projectName:e.projectName,environmentType:e.environmentType};return{url:`${K}/v1/api-keys/${e.bucketId}/consumers`,method:`POST`,body:JSON.stringify(t),headers:{"content-type":`application/json`},invalidateKeys:[$.consumersForBucket(e.bucketId)],acceptableStatuses:[201]}},updateConsumer:e=>({url:`${K}/v1/api-keys/${e.bucketId}/consumers/${e.consumer.id}`,method:`PATCH`,body:JSON.stringify({...e.consumer}),headers:{"content-type":`application/json`},invalidateKeys:[$.consumersForBucket(e.bucketId)],acceptableStatuses:[200]}),removeConsumer:e=>({url:`${K}/v1/api-keys/${e.bucketId}/consumers/${e.consumer.id}`,method:`DELETE`,invalidateKeys:[$.consumersForBucket(e.bucketId)]})},sg={updateEnvironmentVariable:e=>({url:`${K}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables/${e.variableData.id}`,method:`PATCH`,body:JSON.stringify(e.variableData),invalidateKeys:[$.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[200]}),createEnvironmentVariable:e=>({url:`${K}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables`,method:`POST`,body:JSON.stringify(e.variableData),json:!0,invalidateKeys:[$.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[201]}),deleteEnvironmentVariable:e=>({url:`${K}/v1/accounts/${e.accountName}/projects/${e.projectName}/environment-variables/${e.id}`,method:`DELETE`,invalidateKeys:[$.environmentVariables(e.accountName,e.projectName)],acceptableStatuses:[204]})},cg={updatePreferences:e=>({url:`${K}/v1/users/me/preferences`,method:`PUT`,invalidateKeys:[$.user.preferences()],body:JSON.stringify({data:e}),headers:{"content-type":`application/json`},acceptableStatuses:[200]}),requestVerificationEmail:()=>({url:`${K}/v1/users/me/$send-verification-email`,method:`POST`,invalidateKeys:[],acceptableStatuses:[201]}),enrollMfaFactor:e=>({url:`${K}/v1/mfa/factors/enroll`,method:`POST`,body:JSON.stringify({factor:e}),invalidateKeys:[$.mfaFactors()],acceptableStatuses:[200],json:!0}),deleteMfaEnrollment:e=>({url:`${K}/v1/mfa/factors/enrollments/${e}`,method:`DELETE`,invalidateKeys:[$.mfaFactors()],acceptableStatuses:[200]})},lg={tokenExchangeSourceControlCredentials:(e,t,n)=>({url:`${K}/v1/accounts/${e}/source-control-configs/${t}/$token-exchange`,method:`POST`,body:JSON.stringify({code:n}),invalidateKeys:[$.accountsSourceControlConfigurations()],acceptableStatuses:[201]}),revokeSourceControlCredentials:(e,t)=>({url:`${K}/v1/accounts/${e}/source-control-configs/${t}/$revoke-token`,method:`DELETE`,invalidateKeys:[$.accountsSourceControlConfigurations()],acceptableStatuses:[204]})},ug={commitPush:(e,t,n,r)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$commit-push`,method:`POST`,body:JSON.stringify({branchName:r,commitMessage:n}),acceptableStatuses:[201]}),sync:(e,t,n)=>({url:`${K}/v1/accounts/${e}/projects/${t}/$sync`,method:`POST`,body:JSON.stringify({branchName:n}),acceptableStatuses:[201,200],invalidateKeys:[]})},dg={makeTestRequest:({environmentName:e,testRequest:t,overrideUrl:n,buildId:r})=>({url:`${Oc}/v1/test`,method:`POST`,body:JSON.stringify(Xh({testRequest:t,overrideUrl:n,environmentName:e,buildId:r})),acceptableStatuses:qh,headers:{"content-type":`application/json`}})},fg={requestFeature:({email:e,featureName:t,information:n})=>{let r={featureName:t,information:{email:e,...n}};return{url:`${K}/v1/feature-access-request`,method:`POST`,body:JSON.stringify(r),acceptableStatuses:[200],headers:{"content-type":`application/json`}}}},pg={saveFile:({environmentName:e,file:t})=>{let n={"content-type":`text/plain`};return t.lastModified&&(n[`if-unmodified-since`]=new Date(t.lastModified).toUTCString()),{url:`${K}/v1/deployments/${e}/fs/file?path=${t.path}`,method:`POST`,body:t.content,headers:n,acceptableStatuses:[204,200],invalidateKeys:[$.file(e,t.path),$.deploymentVersions(e),Ph.deployments.versions.list(e).queryKey]}},renameFile:({environmentName:e,path:t,newPath:n})=>({url:`${K}/v1/deployments/${e}/fs/file?path=${t}`,method:`PATCH`,body:JSON.stringify({newPath:n}),acceptableStatuses:[204,200],headers:{"content-type":`application/json`},invalidateKeys:[]}),saveMultipleFiles:async({environmentName:e,files:t})=>{let n=new FormData,r={};for(let e of t)if(e.lastModified){let t=`x-if-unmodified-since-${encodeURIComponent(e.path)}`;r[t]=new Date(e.lastModified).toUTCString()}for(let{content:e,path:r}of t){let t=(await Hh(r))?.id;n.append(`files[]`,new File([e??``],r,{type:t===`text/typescript`?`text/javascript`:t}),r)}let i=t.map(({path:t})=>$.file(e,t));return{url:`${K}/v1/deployments/${e}/fs/files`,method:`POST`,body:n,headers:r,acceptableStatuses:[204,200],invalidateKeys:[...i,$.deploymentVersions(e),Ph.deployments.versions.list(e).queryKey]}},deleteFile:({environmentName:e,filePath:t})=>({url:`${K}/v1/deployments/${e}/fs/delete?path=${t}`,method:`DELETE`,acceptableStatuses:[204,200]})},mg={createDirectory:({environmentName:e,path:t})=>({url:`${K}/v1/deployments/${e}/fs/dir?path=${t}`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[201]})},hg={redeploy:({environmentName:e,isWorkingCopy:t,version:n})=>({url:t?`${K}/v1/deployments/${e}/$redeploy`:`${K}/v1/deployments/${e}/versions/${n}/$redeploy`,method:`POST`,body:JSON.stringify({}),acceptableStatuses:[200],invalidateKeys:[$.deploymentVersions(e),Ph.deployments.versions.list(e).queryKey]}),delete:({environmentName:e})=>({url:`${K}/v1/deployments/${e}`,method:`DELETE`,body:JSON.stringify({}),acceptableStatuses:[200]})},gg={acceptAccountInvite:(e,t)=>({url:`${K}/v1/account-member-invites/${e}`,method:`POST`,body:JSON.stringify({}),invalidateKeys:[$.accounts()],removeKeys:t?[$.authCurrentUserAccountRoles(t)]:[],acceptableStatuses:[201]}),createAccountInvite:(e,t,n)=>{let r=n?.project?.name?[$.authProjectUsersRoles(e,n.project.name),n.team?.id?$.bucketConfigurationMembers(n.team?.bucketId,n.team?.id):[],$.authProjectUsersRoles(e,n.project.name,{includeInheritedRoles:!1}),$.authProjectUsersRoles(e,n.project.name,{includeInheritedRoles:!0})].flat():[];return{url:`${K}/v1/accounts/${e}/account-member-invites`,method:`POST`,body:JSON.stringify({userEmail:t,metadata:n}),invalidateKeys:[$.accountMemberInvites(e),$.authAccountUsersRoles(e),$.authCurrentUserAccountRoles(e),...r],acceptableStatuses:[201]}}},_g={createMeteringPlan:(e,t,n)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/plans`,method:`POST`,headers:{"Content-Type":`application/json`},invalidateKeys:[$.meteringPlans(e,t),$.meteringBucket(e,t)],body:JSON.stringify(n)}),deleteMeteringPlan:(e,t,n)=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/plans/${n}`,invalidateKeys:[$.meteringPlans(e,t),$.meteringBucket(e,t)],method:`DELETE`}),updateMeteringPlan:(e,t,{id:n,...r})=>({url:`${K}/v1/metering/accounts/${e}/buckets/${t}/plans/${n}`,invalidateKeys:[$.meteringPlans(e,t),$.meteringBucket(e,t)],method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})},vg=e=>({urlPrefix:`${K}/v1/buckets/${e}/configurations`}),yg={auth:rg,accounts:ig,ai:{createBucketConfiguration:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations`,method:`POST`,json:!0,body:JSON.stringify(t),acceptableStatuses:[201,200],invalidateKeys:[$.bucketConfigurations(e),$.bucketConfigurationPools(e),$.bucketConfigurationApps(e),$.bucketConfigurationUserApps(e)]}),updateBucketConfiguration:(e,t,n)=>{let r=n.metadata===void 0?n:{...n,metadata:Vh(n.metadata)};return{url:`${K}/v1/buckets/${e}/configurations/${t}`,method:`PATCH`,json:!0,body:JSON.stringify(r),acceptableStatuses:[200,201],invalidateKeys:[vg(e)]}},deleteBucketConfiguration:(e,t)=>({url:`${K}/v1/buckets/${e}/configurations/${t}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[$.bucketConfigurations(e),$.bucketConfigurationPools(e),$.bucketConfigurationApps(e),$.bucketConfigurationUserApps(e)]}),createBucketConfigurationMember:(e,t,n,r)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members`,method:`POST`,json:!0,body:JSON.stringify({sub:n,role:r}),acceptableStatuses:[201,200],invalidateKeys:[$.bucketConfiguration(e,t),$.bucketConfigurationMembers(e,t)]}),putBucketConfigurationMemberRole:(e,t,n,r)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`PUT`,json:!0,body:JSON.stringify({role:r}),acceptableStatuses:[204,200],invalidateKeys:[$.bucketConfiguration(e,t),$.bucketConfigurationMembers(e,t),$.bucketConfigurationPools(e)]}),deleteBucketConfigurationMember:(e,t,n)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`DELETE`,acceptableStatuses:[204],invalidateKeys:[$.bucketConfigurationMembers(e,t)]}),updateBucketConfigurationMember:(e,t,n,r)=>({url:`${K}/v1/buckets/${e}/configurations/${t}/members/${encodeURIComponent(n)}`,method:`PATCH`,json:!0,body:JSON.stringify({role:r}),acceptableStatuses:[200],invalidateKeys:[$.bucketConfigurationMembers(e,t)]}),createBucketAiProvider:(e,{name:t,baseURL:n,description:r})=>({url:`${K}/v1/buckets/${e}/providers`,method:`POST`,json:!0,body:JSON.stringify({baseURL:n,name:t,description:r})}),deleteBucketAiProvider:(e,t)=>({url:`${K}/v1/buckets/${e}/providers/${t}`,method:`DELETE`,invalidateKeys:[$.supportedAiProviders(e)],acceptableStatuses:[204,200,404]}),createAiProviderModel:(e,t,{model:n,kind:r,inputCostPerToken:i,outputCostPerToken:a,cachedInputCostPerToken:o,cacheWriteCostPerToken:s,status:c})=>({url:`${K}/v1/buckets/${e}/providers/${t}/models`,method:`POST`,json:!0,body:JSON.stringify({model:n,kind:r,inputCostPerToken:i,outputCostPerToken:a,cachedInputCostPerToken:o,cacheWriteCostPerToken:s,status:c}),invalidateKeys:[$.supportedAiProviders(e)],acceptableStatuses:[200]}),updateAiProviderModel:(e,t,n,{inputCostPerToken:r,outputCostPerToken:i,cachedInputCostPerToken:a,cacheWriteCostPerToken:o,status:s})=>({url:`${K}/v1/buckets/${e}/providers/${t}/models/${n}`,method:`PATCH`,json:!0,body:JSON.stringify({inputCostPerToken:r,outputCostPerToken:i,cachedInputCostPerToken:a,cacheWriteCostPerToken:o,status:s}),invalidateKeys:[$.supportedAiProviders(e)],acceptableStatuses:[200]}),deleteAiProviderModel:(e,t,n)=>({url:`${K}/v1/buckets/${e}/providers/${t}/models/${n}`,method:`DELETE`,invalidateKeys:[$.supportedAiProviders(e)],acceptableStatuses:[204]}),createAiProviderAssignment:(e,t,n)=>({url:`${K}/v1/accounts/${e}/projects/${t}/ai-provider-assignments`,method:`POST`,body:JSON.stringify({...n,metadata:JSON.stringify(n.metadata)}),headers:{"content-type":`application/json`},invalidateKeys:[$.aiProviderAssignments(e,t)],acceptableStatuses:[201]}),updateAiProviderAssignment:(e,t,n,r)=>({url:`${K}/v1/accounts/${e}/projects/${t}/ai-provider-assignments/${n}`,method:`PATCH`,body:JSON.stringify({...r,...r.metadata?{metadata:JSON.stringify(r.metadata)}:{}}),headers:{"content-type":`application/json`},invalidateKeys:[$.aiProviderAssignments(e,t)],acceptableStatuses:[200]}),deleteAiProviderAssignment:(e,t,n)=>({url:`${K}/v1/accounts/${e}/projects/${t}/ai-provider-assignments/${n}`,method:`DELETE`,invalidateKeys:[$.aiProviderAssignments(e,t)],acceptableStatuses:[204]})},projects:ag,consumers:og,environmentVariables:sg,users:cg,sourceControlCredentials:lg,sourceControlOperations:ug,testDesigner:dg,featureRequest:fg,fileTransactions:pg,directories:mg,environments:hg,accountInvite:gg,metering:_g,logs:{sourcemap:e=>({url:`${K}/v1/logs/sourcemap`,method:`POST`,json:!0,body:JSON.stringify(e),acceptableStatuses:[200]})},identityConnections:{createTicket:e=>({url:`${K}/v1/accounts/${e}/identity-connections/ticket`,method:`POST`,json:!0,body:JSON.stringify({}),invalidateKeys:[$.identityConnections(e)],acceptableStatuses:[200]})},migration:{migrateDevPortal:e=>({url:`${K}/v1/migrate/dev-portal`,method:`POST`,json:!1,body:JSON.stringify({deploymentName:e}),headers:{"content-type":`application/json`},acceptableStatuses:[200]})}},bg=e=>{let t=Jm(),n=Ep();return{fetch:async r=>{let i=Kc(),a;try{a=await hh(t=>{let n=new Headers(r.headers);return r.json&&r.method!==`DELETE`&&n.set(`content-type`,`application/json`),n.set(`authorization`,`Bearer ${t}`),n.set(`zuplo-request-id`,i),fetch(r.url,{...e,method:r.method,headers:n,body:r.body})},n,xp)}catch(e){throw e instanceof Tc&&e.setTraceId(i),e instanceof TypeError?new wc({type:`https://zup.fail/api-request-failed`,title:`API request failed`,status:500,instance:r.url,traceId:i}):e}if(!(r.acceptableStatuses??[200]).includes(a.status)){let e=new Tc(`Unexpected response: ${a.status} calling ${r.method}: ${r.url}`,{traceId:i});throw await e.tryReadResponse(a),e}let o=e=>e.split(`?`)[0];return r.invalidateKeys?.forEach(e=>{if(Array.isArray(e))t.invalidateQueries({queryKey:e,exact:!1});else if(`urlPrefix`in e&&e.urlPrefix){let n=o(e.urlPrefix);t.invalidateQueries({predicate:e=>{let t=e.queryKey[0];if(typeof t!=`string`)return!1;let r=o(t);return r===n||r.startsWith(`${n}/`)}})}else if(`url`in e&&e.url){let n=o(e.url);t.invalidateQueries({predicate:e=>{let t=e.queryKey[0];return typeof t==`string`&&o(t)===n}})}}),r.removeKeys?.forEach(e=>{t.removeQueries({queryKey:[e.url]})}),r.parseResponse===!1?a:r.json?await a.json():a}}};typeof window<`u`&&window.document&&window.document.createElement;function xg(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var Sg=q.useId||(()=>void 0),Cg=0;function wg(e){let[t,n]=q.useState(Sg());return ql(()=>{e||n(e=>e??String(Cg++))},[e]),e||(t?`radix-${t}`:``)}var Tg=`focusScope.autoFocusOnMount`,Eg=`focusScope.autoFocusOnUnmount`,Dg={bubbles:!1,cancelable:!0},Og=`FocusScope`,kg=q.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=q.useState(null),l=Al(i),u=Al(a),d=q.useRef(null),f=ml(t,e=>c(e)),p=q.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;q.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Ig(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Ig(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Ig(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),q.useEffect(()=>{if(s){Lg.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Tg,Dg);s.addEventListener(Tg,l),s.dispatchEvent(t),t.defaultPrevented||(Ag(Bg(Mg(s)),{select:!0}),document.activeElement===e&&Ig(s))}return()=>{s.removeEventListener(Tg,l),setTimeout(()=>{let t=new CustomEvent(Eg,Dg);s.addEventListener(Eg,u),s.dispatchEvent(t),t.defaultPrevented||Ig(e??document.body,{select:!0}),s.removeEventListener(Eg,u),Lg.remove(p)},0)}}},[s,l,u,p]);let m=q.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=jg(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Ig(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Ig(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,J.jsx)(Ol.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});kg.displayName=Og;function Ag(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Ig(r,{select:t}),document.activeElement!==n)return}function jg(e){let t=Mg(e);return[Ng(t,e),Ng(t.reverse(),e)]}function Mg(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ng(e,t){for(let n of e)if(!Pg(n,{upTo:t}))return n}function Pg(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Fg(e){return e instanceof HTMLInputElement&&`select`in e}function Ig(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Fg(e)&&t&&e.select()}}var Lg=Rg();function Rg(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=zg(e,t),e.unshift(t)},remove(t){e=zg(e,t),e[0]?.resume()}}}function zg(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Bg(e){return e.filter(e=>e.tagName!==`A`)}function Vg(e){let t=Hg(e),n=q.forwardRef((e,n)=>{let{children:r,...i}=e,a=q.Children.toArray(r),o=a.find(Gg);if(o){let e=o.props.children,r=a.map(t=>t===o?q.Children.count(e)>1?q.Children.only(null):q.isValidElement(e)?e.props.children:null:t);return(0,J.jsx)(t,{...i,ref:n,children:q.isValidElement(e)?q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Hg(e){let t=q.forwardRef((e,t)=>{let{children:n,...r}=e;if(q.isValidElement(n)){let e=qg(n),i=Kg(r,n.props);return n.type!==q.Fragment&&(i.ref=t?il(t,e):e),q.cloneElement(n,i)}return q.Children.count(n)>1?q.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ug=Symbol(`radix.slottable`);function Wg(e){let t=({children:e})=>(0,J.jsx)(J.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=Ug,t}function Gg(e){return q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ug}function Kg(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function qg(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Jg=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Vg(`Primitive.${t}`),r=q.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,J.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Yg(e,t){e&&Dl.flushSync(()=>e.dispatchEvent(t))}var Xg=`Portal`,Zg=q.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=q.useState(!1);ql(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Dl.createPortal((0,J.jsx)(Jg.div,{...r,ref:t}),o):null});Zg.displayName=Xg;function Qg(e,t){return q.useReducer((e,n)=>t[e][n]??e,e)}var $g=e=>{let{present:t,children:n}=e,r=e_(t),i=typeof n==`function`?n({present:r.isPresent}):q.Children.only(n),a=al(r.ref,n_(i));return typeof n==`function`||r.isPresent?q.cloneElement(i,{ref:a}):null};$g.displayName=`Presence`;function e_(e){let[t,n]=q.useState(),r=q.useRef(null),i=q.useRef(e),a=q.useRef(`none`),[o,s]=Qg(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return q.useEffect(()=>{let e=t_(r.current);a.current=o===`mounted`?e:`none`},[o]),ql(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=t_(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),ql(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=t_(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=t_(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:q.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function t_(e){return e?.animationName||`none`}function n_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var r_=0;function i_(){q.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??a_()),document.body.insertAdjacentElement(`beforeend`,e[1]??a_()),r_++,()=>{r_===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),r_--}},[])}function a_(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var o_=function(){return o_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o_.apply(this,arguments)};function s_(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function c_(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var l_=`right-scroll-bar-position`,u_=`width-before-scroll-bar`,d_=`with-scroll-bars-hidden`,f_=`--removed-body-scroll-bar-size`;function p_(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function m_(e,t){var n=(0,q.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var h_=typeof window<`u`?q.useLayoutEffect:q.useEffect,g_=new WeakMap;function __(e,t){var n=m_(t||null,function(t){return e.forEach(function(e){return p_(e,t)})});return h_(function(){var t=g_.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||p_(e,null)}),i.forEach(function(e){r.has(e)||p_(e,a)})}g_.set(n,e)},[e]),n}function v_(e){return e}function y_(e,t){t===void 0&&(t=v_);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function b_(e){e===void 0&&(e={});var t=y_(null);return t.options=o_({async:!0,ssr:!1},e),t}var x_=function(e){var t=e.sideCar,n=s_(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return q.createElement(r,o_({},n))};x_.isSideCarExport=!0;function S_(e,t){return e.useMedium(t),x_}var C_=b_(),w_=function(){},T_=q.forwardRef(function(e,t){var n=q.useRef(null),r=q.useState({onScrollCapture:w_,onWheelCapture:w_,onTouchMoveCapture:w_}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=s_(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=__([n,t]),C=o_(o_({},b),i);return q.createElement(q.Fragment,null,u&&q.createElement(x,{sideCar:C_,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?q.cloneElement(q.Children.only(s),o_(o_({},C),{ref:S})):q.createElement(v,o_({},C,{className:c,ref:S}),s))});T_.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},T_.classNames={fullWidth:u_,zeroRight:l_};var E_,D_=function(){if(E_)return E_;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function O_(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=D_();return t&&e.setAttribute(`nonce`,t),e}function k_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function A_(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var j_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=O_())&&(k_(t,n),A_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},M_=function(){var e=j_();return function(t,n){q.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},N_=function(){var e=M_();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},P_={left:0,top:0,right:0,gap:0},F_=function(e){return parseInt(e||``,10)||0},I_=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[F_(n),F_(r),F_(i)]},L_=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return P_;var t=I_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},R_=N_(),z_=`data-scroll-locked`,B_=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
5
5
|
.${d_} {
|
|
6
6
|
overflow: hidden ${r};
|
|
7
7
|
padding-right: ${s}px ${r};
|