PageSourceSearch

https://pressmegpt.com/assets/index-BmBSkb2s.js

js pressmegpt.com collected 2026-10-03 20:15:19 UTC 1,638,902 bytes, 1,924 lines download raw bytes

vendor: 6,238 bytes, lines 1-9
1var V1=t=>{throw TypeError(t)};var Vv=(t,e,r)=>e.has(t)||V1("Cannot "+r);var ye=(t,e,r)=>(Vv(t,e,"read from private field"),r?r.call(t):e.get(t)),kt=(t,e,r)=>e.has(t)?V1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ot=(t,e,r,n)=>(Vv(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),cn=(t,e,r)=>(Vv(t,e,"access private method"),r);var Sf=(t,e,r,n)=>({set _(s){ot(t,e,s,r)},get _(){return ye(t,e,n)}});function Y3(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in t)){const o=Object.getOwnPropertyDescriptor(n,s);o&&Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();var Nf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function t0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var q2={exports:{}},gg={},V2={exports:{}},vt={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Fh=Symbol.for("react.element"),Q3=Symbol.for("react.portal"),J3=Symbol.for("react.fragment"),X3=Symbol.for("react.strict_mode"),Z3=Symbol.for("react.profiler"),e$=Symbol.for("react.provider"),t$=Symbol.for("react.context"),r$=Symbol.for("react.forward_ref"),n$=Symbol.for("react.suspense"),s$=Symbol.for("react.memo"),i$=Symbol.for("react.lazy"),K1=Symbol.iterator;function o$(t){return t===null||typeof t!="object"?null:(t=K1&&t[K1]||t["@@iterator"],typeof t=="function"?t:null)}var K2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Y2=Object.assign,Q2={};function ou(t,e,r){this.props=t,this.context=e,this.refs=Q2,this.updater=r||K2}ou.prototype.isReactComponent={};ou.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};ou.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function J2(){}J2.prototype=ou.prototype;function r0(t,e,r){this.props=t,this.context=e,this.refs=Q2,this.updater=r||K2}var n0=r0.prototype=new J2;n0.constructor=r0;Y2(n0,ou.prototype);n0.isPureReactComponent=!0;var Y1=Array.isArray,X2=Object.prototype.hasOwnProperty,s0={current:null},Z2={key:!0,ref:!0,__self:!0,__source:!0};function eC(t,e,r){var n,s={},o=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(o=""+e.key),e)X2.call(e,n)&&!Z2.hasOwnProperty(n)&&(s[n]=e[n]);var l=arguments.length-2;if(l===1)s.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(t&&t.defaultProps)for(n in l=t.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return{$$typeof:Fh,type:t,key:o,ref:a,props:s,_owner:s0.current}}function a$(t,e){return{$$typeof:Fh,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function i0(t){return typeof t=="object"&&t!==null&&t.$$typeof===Fh}function l$(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var Q1=/\/+/g;function Kv(t,e){return typeof t=="object"&&t!==null&&t.key!=null?l$(""+t.key):e.toString(36)}function bm(t,e,r,n,s){var o=typeof t;(o==="undefined"||o==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case Fh:case Q3:a=!0}}if(a)return a=t,s=s(a),t=n===""?"."+Kv(a,0):n,Y1(s)?(r="",t!=null&&(r=t.replace(Q1,"$&/")+"/"),bm(s,e,r,"",function(u){return u})):s!=null&&(i0(s)&&(s=a$(s,r+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(Q1,"$&/")+"/")+t)),e.push(s)),1;if(a=0,n=n===""?".":n+":",Y1(t))for(var l=0;l<t.length;l++){o=t[l];var c=n+Kv(o,l);a+=bm(o,e,r,c,s)}else if(c=o$(t),typeof c=="function")for(t=c.call(t),l=0;!(o=t.next()).done;)o=o.value,c=n+Kv(o,l++),a+=bm(o,e,r,c,s);else if(o==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function Cf(t,e,r){if(t==null)return t;var n=[],s=0;return bm(t,n,"","",function(o){return e.call(r,o,s++)}),n}function c$(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var kn={current:null},wm={transition:null},u$={ReactCurrentDispatcher:kn,ReactCurrentBatchConfig:wm,ReactCurrentOwner:s0};function tC(){throw Error("act(...) is not supported in production builds of React.")}vt.Children={map:Cf,forEach:function(t,e,r){Cf(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return Cf(t,function(){e++}),e},toArray:function(t){return Cf(t,function(e){return e})||[]},only:function(t){if(!i0(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};vt.Component=ou;vt.Fragment=J3;vt.Profiler=Z3;vt.PureComponent=r0;vt.StrictMode=X3;vt.Suspense=n$;
vendor: 3,931 bytes, lines 9-25
9vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=u$;vt.act=tC;vt.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=Y2({},t.props),s=t.key,o=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(o=e.ref,a=s0.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(c in e)X2.call(e,c)&&!Z2.hasOwnProperty(c)&&(n[c]=e[c]===void 0&&l!==void 0?l[c]:e[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:Fh,type:t.type,key:s,ref:o,props:n,_owner:a}};vt.createContext=function(t){return t={$$typeof:t$,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:e$,_context:t},t.Consumer=t};vt.createElement=eC;vt.createFactory=function(t){var e=eC.bind(null,t);return e.type=t,e};vt.createRef=function(){return{current:null}};vt.forwardRef=function(t){return{$$typeof:r$,render:t}};vt.isValidElement=i0;vt.lazy=function(t){return{$$typeof:i$,_payload:{_status:-1,_result:t},_init:c$}};vt.memo=function(t,e){return{$$typeof:s$,type:t,compare:e===void 0?null:e}};vt.startTransition=function(t){var e=wm.transition;wm.transition={};try{t()}finally{wm.transition=e}};vt.unstable_act=tC;vt.useCallback=function(t,e){return kn.current.useCallback(t,e)};vt.useContext=function(t){return kn.current.useContext(t)};vt.useDebugValue=function(){};vt.useDeferredValue=function(t){return kn.current.useDeferredValue(t)};vt.useEffect=function(t,e){return kn.current.useEffect(t,e)};vt.useId=function(){return kn.current.useId()};vt.useImperativeHandle=function(t,e,r){return kn.current.useImperativeHandle(t,e,r)};vt.useInsertionEffect=function(t,e){return kn.current.useInsertionEffect(t,e)};vt.useLayoutEffect=function(t,e){return kn.current.useLayoutEffect(t,e)};vt.useMemo=function(t,e){return kn.current.useMemo(t,e)};vt.useReducer=function(t,e,r){return kn.current.useReducer(t,e,r)};vt.useRef=function(t){return kn.current.useRef(t)};vt.useState=function(t){return kn.current.useState(t)};vt.useSyncExternalStore=function(t,e,r){return kn.current.useSyncExternalStore(t,e,r)};vt.useTransition=function(){return kn.current.useTransition()};vt.version="18.3.1";V2.exports=vt;var g=V2.exports;const ke=t0(g),o0=Y3({__proto__:null,default:ke},[g]);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var d$=g,h$=Symbol.for("react.element"),f$=Symbol.for("react.fragment"),m$=Object.prototype.hasOwnProperty,p$=d$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g$={key:!0,ref:!0,__self:!0,__source:!0};function rC(t,e,r){var n,s={},o=null,a=null;r!==void 0&&(o=""+r),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(a=e.ref);for(n in e)m$.call(e,n)&&!g$.hasOwnProperty(n)&&(s[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)s[n]===void 0&&(s[n]=e[n]);return{$$typeof:h$,type:t,key:o,ref:a,props:s,_owner:p$.current}}gg.Fragment=f$;gg.jsx=rC;gg.jsxs=rC;q2.exports=gg;var i=q2.exports,nC={exports:{}},ns={},sC={exports:{}},iC={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(t){function e(W,R){var G=W.length;W.push(R);e:for(;0<G;){var U=G-1>>>1,z=W[U];if(0<s(z,R))W[U]=R,W[G]=z,G=U;else break e}}function r(W){return W.length===0?null:W[0]}function n(W){if(W.length===0)return null;var R=W[0],G=W.pop();if(G!==R){W[0]=G;e:for(var U=0,z=W.length,oe=z>>>1;U<oe;){var L=2*(U+1)-1,q=W[L],he=L+1,X=W[he];if(0>s(q,G))he<z&&0>
vendor: 10,277 bytes, lines 25-34
25s(X,q)?(W[U]=X,W[he]=G,U=he):(W[U]=q,W[L]=G,U=L);else if(he<z&&0>s(X,G))W[U]=X,W[he]=G,U=he;else break e}}return R}function s(W,R){var G=W.sortIndex-R.sortIndex;return G!==0?G:W.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,h=null,m=3,f=!1,v=!1,p=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(W){for(var R=r(u);R!==null;){if(R.callback===null)n(u);else if(R.startTime<=W)n(u),R.sortIndex=R.expirationTime,e(c,R);else break;R=r(u)}}function j(W){if(p=!1,w(W),!v)if(r(c)!==null)v=!0,K(_);else{var R=r(u);R!==null&&H(j,R.startTime-W)}}function _(W,R){v=!1,p&&(p=!1,x(P),P=-1),f=!0;var G=m;try{for(w(R),h=r(c);h!==null&&(!(h.expirationTime>R)||W&&!F());){var U=h.callback;if(typeof U=="function"){h.callback=null,m=h.priorityLevel;var z=U(h.expirationTime<=R);R=t.unstable_now(),typeof z=="function"?h.callback=z:h===r(c)&&n(c),w(R)}else n(c);h=r(c)}if(h!==null)var oe=!0;else{var L=r(u);L!==null&&H(j,L.startTime-R),oe=!1}return oe}finally{h=null,m=G,f=!1}}var S=!1,N=null,P=-1,C=5,O=-1;function F(){return!(t.unstable_now()-O<C)}function T(){if(N!==null){var W=t.unstable_now();O=W;var R=!0;try{R=N(!0,W)}finally{R?A():(S=!1,N=null)}}else S=!1}var A;if(typeof y=="function")A=function(){y(T)};else if(typeof MessageChannel<"u"){var k=new MessageChannel,$=k.port2;k.port1.onmessage=T,A=function(){$.postMessage(null)}}else A=function(){b(T,0)};function K(W){N=W,S||(S=!0,A())}function H(W,R){P=b(function(){W(t.unstable_now())},R)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(W){W.callback=null},t.unstable_continueExecution=function(){v||f||(v=!0,K(_))},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(W){switch(m){case 1:case 2:case 3:var R=3;break;default:R=m}var G=m;m=R;try{return W()}finally{m=G}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(W,R){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var G=m;m=W;try{return R()}finally{m=G}},t.unstable_scheduleCallback=function(W,R,G){var U=t.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?U+G:U):G=U,W){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=G+z,W={id:d++,callback:R,priorityLevel:W,startTime:G,expirationTime:z,sortIndex:-1},G>U?(W.sortIndex=G,e(u,W),r(c)===null&&W===r(u)&&(p?(x(P),P=-1):p=!0,H(j,G-U))):(W.sortIndex=z,e(c,W),v||f||(v=!0,K(_))),W},t.unstable_shouldYield=F,t.unstable_wrapCallback=function(W){var R=m;return function(){var G=m;m=R;try{return W.apply(this,arguments)}finally{m=G}}}})(iC);sC.exports=iC;var v$=sC.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var x$=g,rs=v$;function Ne(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var oC=new Set,Fd={};function hl(t,e){Lc(t,e),Lc(t+"Capture",e)}function Lc(t,e){for(Fd[t]=e,t=0;t<e.length;t++)oC.add(e[t])}var Wi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ry=Object.prototype.hasOwnProperty,y$=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,J1={},X1={};function b$(t){return Ry.call(X1,t)?!0:Ry.call(J1,t)?!1:y$.test(t)?X1[t]=!0:(J1[t]=!0,!1)}function w$(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function _$(t,e,r,n){if(e===null||typeof e>"u"||w$(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Sn(t,e,r,n,s,o,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=a}var tn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){tn[t]=new Sn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];tn[e]=new Sn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){tn[t]=new Sn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){tn[t]=new Sn(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){tn[t]=new Sn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){tn[t]=new Sn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){tn[t]=new Sn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){tn[t]=new Sn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){tn[t]=new Sn(t,5,!1,t.toLowerCase(),null,!1,!1)});var a0=/[\-:]([a-z])/g;function l0(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(a0,l0);tn[e]=new Sn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(a0,l0);tn[e]=new Sn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(a0,l0);tn[e]=new Sn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){tn[t]=new Sn(t,1,!1,t.toLowerCase(),null,!1,!1)});tn.xlinkHref=new Sn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){tn[t]=new Sn(t,1,!1,t.toLowerCase(),null,!0,!0)});function c0(t,e,r,n){var s=tn.hasOwnProperty(e)?tn[e]:null;(s!==null?s.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(_$(e,r,s,n)&&(r=null),n||s===null?b$(e)&&(r===null?t.removeAttribute(e):t.setAttribute(e,""+r)):s.mustUseProperty?t[s.propertyName]=r===null?s.type===3?!1:"":r:(e=s.attributeName,n=s.attributeNamespace,r===null?t.removeAttribute(e):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?t.setAttributeNS(n,e,r):t.setAttribute(e,r))))}var Ji=x$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ef=Symbol.for("react.element"),Ql=Symbol.for("react.portal"),Jl=Symbol.for("react.fragment"),u0=Symbol.for("react.strict_mode"),Iy=Symbol.for("react.profiler"),aC=Symbol.for("react.provider"),lC=Symbol.for("react.context"),d0=Symbol.for("react.forward_ref"),Oy=Symbol.for("react.suspense"),My=Symbol.for("react.suspense_list"),h0=Symbol.for("react.memo"),wo=Symbol.for("react.lazy"),cC=Symbol.for("react.offscreen"),Z1=Symbol.iterator;function Mu(t){return t===null||typeof t!="object"?null:(t=Z1&&t[Z1]||t["@@iterator"],typeof t=="function"?t:null)}var ar=Object.assign,Yv;function od(t){if(Yv===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);Yv=e&&e[1]||""}return`
34`+Yv+t}var Qv=!1;function Jv(t,e){if(!t||Qv)return"";Qv=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var n=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){n=u}t.call(e.prototype)}else{try{throw Error()}catch(u){n=u}t()}}
vendor: 16,768 bytes, lines 34-37
34catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
35`),o=n.stack.split(`
36`),a=s.length-1,l=o.length-1;1<=a&&0<=l&&s[a]!==o[l];)l--;for(;1<=a&&0<=l;a--,l--)if(s[a]!==o[l]){if(a!==1||l!==1)do if(a--,l--,0>l||s[a]!==o[l]){var c=`
37`+s[a].replace(" at new "," at ");return t.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",t.displayName)),c}while(1<=a&&0<=l);break}}}finally{Qv=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?od(t):""}function j$(t){switch(t.tag){case 5:return od(t.type);case 16:return od("Lazy");case 13:return od("Suspense");case 19:return od("SuspenseList");case 0:case 2:case 15:return t=Jv(t.type,!1),t;case 11:return t=Jv(t.type.render,!1),t;case 1:return t=Jv(t.type,!0),t;default:return""}}function $y(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Jl:return"Fragment";case Ql:return"Portal";case Iy:return"Profiler";case u0:return"StrictMode";case Oy:return"Suspense";case My:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case lC:return(t.displayName||"Context")+".Consumer";case aC:return(t._context.displayName||"Context")+".Provider";case d0:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case h0:return e=t.displayName||null,e!==null?e:$y(t.type)||"Memo";case wo:e=t._payload,t=t._init;try{return $y(t(e))}catch{}}return null}function k$(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return $y(e);case 8:return e===u0?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Xo(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function uC(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function S$(t){var e=uC(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,o=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(a){n=""+a,o.call(this,a)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Pf(t){t._valueTracker||(t._valueTracker=S$(t))}function dC(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=uC(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Vm(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Dy(t,e){var r=e.checked;return ar({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function ej(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Xo(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function hC(t,e){e=e.checked,e!=null&&c0(t,"checked",e,!1)}function Fy(t,e){hC(t,e);var r=Xo(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Ly(t,e.type,r):e.hasOwnProperty("defaultValue")&&Ly(t,e.type,Xo(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function tj(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function Ly(t,e,r){(e!=="number"||Vm(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ad=Array.isArray;function hc(t,e,r,n){if(t=t.options,e){e={};for(var s=0;s<r.length;s++)e["$"+r[s]]=!0;for(r=0;r<t.length;r++)s=e.hasOwnProperty("$"+t[r].value),t[r].selected!==s&&(t[r].selected=s),s&&n&&(t[r].defaultSelected=!0)}else{for(r=""+Xo(r),e=null,s=0;s<t.length;s++){if(t[s].value===r){t[s].selected=!0,n&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function By(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Ne(91));return ar({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function rj(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(Ne(92));if(ad(r)){if(1<r.length)throw Error(Ne(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:Xo(r)}}function fC(t,e){var r=Xo(e.value),n=Xo(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),n!=null&&(t.defaultValue=""+n)}function nj(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function mC(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function zy(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?mC(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Tf,pC=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,n,s){MSApp.execUnsafeLocalFunction(function(){return t(e,r,n,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Tf=Tf||document.createElement("div"),Tf.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Tf.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ld(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var _d={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},N$=["Webkit","ms","Moz","O"];Object.keys(_d).forEach(function(t){N$.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),_d[e]=_d[t]})});function gC(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||_d.hasOwnProperty(t)&&_d[t]?(""+e).trim():e+"px"}function vC(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=gC(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,s):t[r]=s}}var C$=ar({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Uy(t,e){if(e){if(C$[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ne(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ne(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ne(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ne(62))}}function Wy(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Hy=null;function f0(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Gy=null,fc=null,mc=null;function sj(t){if(t=zh(t)){if(typeof Gy!="function")throw Error(Ne(280));var e=t.stateNode;e&&(e=wg(e),Gy(t.stateNode,t.type,e))}}function xC(t){fc?mc?mc.push(t):mc=[t]:fc=t}function yC(){if(fc){var t=fc,e=mc;if(mc=fc=null,sj(t),e)for(t=0;t<e.length;t++)sj(e[t])}}function bC(t,e){return t(e)}function wC(){}var Xv=!1;function _C(t,e,r){if(Xv)return t(e,r);Xv=!0;try{return bC(t,e,r)}finally{Xv=!1,(fc!==null||mc!==null)&&(wC(),yC())}}function Bd(t,e){var r=t.stateNode;if(r===null)return null;var n=wg(r);if(n===null)return null;r=n[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(Ne(231,e,typeof r));return r}var qy=!1;if(Wi)try{var $u={};Object.defineProperty($u,"passive",{get:function(){qy=!0}}),window.addEventListener("test",$u,$u),window.removeEventListener("test",$u,$u)}catch{qy=!1}function E$(t,e,r,n,s,o,a,l,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(r,u)}catch(d){this.onError(d)}}var jd=!1,Km=null,Ym=!1,Vy=null,P$={onError:function(t){jd=!0,Km=t}};function T$(t,e,r,n,s,o,a,l,c){jd=!1,Km=null,E$.apply(P$,arguments)}function A$(t,e,r,n,s,o,a,l,c){if(T$.apply(this,arguments),jd){if(jd){var u=Km;jd=!1,Km=null}else throw Error(Ne(198));Ym||(Ym=!0,Vy=u)}}function fl(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function jC(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function ij(t){if(fl(t)!==t)throw Error(Ne(188))}function R$(t){var e=t.alternate;if(!e){if(e=fl(t),e===null)throw Error(Ne(188));return e!==t?null:t}for(var r=t,n=e;;){var s=r.return;if(s===null)break;var o=s.alternate;if(o===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===r)return ij(s),t;if(o===n)return ij(s),e;o=o.sibling}throw Error(Ne(188))}if(r.return!==n.return)r=s,n=o;else{for(var a=!1,l=s.child;l;){if(l===r){a=!0,r=s,n=o;break}if(l===n){a=!0,n=s,r=o;break}l=l.sibling}if(!a){for(l=o.child;l;){if(l===r){a=!0,r=o,n=s;break}if(l===n){a=!0,n=o,r=s;break}l=l.sibling}if(!a)throw Error(Ne(189))}}if(r.alternate!==n)throw Error(Ne(190))}if(r.tag!==3)throw Error(Ne(188));return r.stateNode.current===r?t:e}function kC(t){return t=R$(t),t!==null?SC(t):null}function SC(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=SC(t);if(e!==null)return e;t=t.sibling}return null}var NC=rs.unstable_scheduleCallback,oj=rs.unstable_cancelCallback,I$=rs.unstable_shouldYield,O$=rs.unstable_requestPaint,xr=rs.unstable_now,M$=rs.unstable_getCurrentPriorityLevel,m0=rs.unstable_ImmediatePriority,CC=rs.unstable_UserBlockingPriority,Qm=rs.unstable_NormalPriority,$$=rs.unstable_LowPriority,EC=rs.unstable_IdlePriority,vg=null,hi=null;function D$(t){if(hi&&typeof hi.onCommitFiberRoot=="function")try{hi.onCommitFiberRoot(vg,t,void 0,(t.current.flags&128)===128)}catch{}}var Bs=Math.clz32?Math.clz32:B$,F$=Math.log,L$=Math.LN2;function B$(t){return t>>>=0,t===0?32:31-(F$(t)/L$|0)|0}var Af=64,Rf=4194304;function ld(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Jm(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,s=t.suspendedLanes,o=t.pingedLanes,a=r&268435455;if(a!==0){var l=a&~s;l!==0?n=ld(l):(o&=a,o!==0&&(n=ld(o)))}else a=r&~s,a!==0?n=ld(a):o!==0&&(n=ld(o));if(n===0)return 0;if(e!==0&&e!==n&&!(e&s)&&(s=n&-n,o=e&-e,s>=o||s===16&&(o&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)r=31-Bs(e),s=1<<r,n|=t[r],e&=~s;return n}function z$(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function U$(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,s=t.expirationTimes,o=t.pendingLanes;0<o;){var a=31-Bs(o),l=1<<a,c=s[a];c===-1?(!(l&r)||l&n)&&(s[a]=z$(l,e)):c<=e&&(t.expiredLanes|=l),o&=~l}}function Ky(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function PC(){var t=Af;return Af<<=1,!(Af&4194240)&&(Af=64),t}function Zv(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function Lh(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Bs(e),t[e]=r}function W$(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0<r;){var s=31-Bs(r),o=1<<s;e[s]=0,n[s]=-1,t[s]=-1,r&=~o}}function p0(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-Bs(r),s=1<<n;s&e|t[n]&e&&(t[n]|=e),r&=~s}}var Mt=0;function TC(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var AC,g0,RC,IC,OC,Yy=!1,If=[],Do=null,Fo=null,Lo=null,zd=new Map,Ud=new Map,ko=[],H$="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function aj(t,e){switch(t){case"focusin":case"focusout":Do=null;break;case"dragenter":case"dragleave":Fo=null;break;case"mouseover":case"mouseout":Lo=null;break;case"pointerover":case"pointerout":zd.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ud.delete(e.pointerId)}}function Du(t,e,r,n,s,o){return t===null||t.nativeEvent!==o?(t={blockedOn:e,domEventName:r,eventSystemFlags:n,nativeEvent:o,targetContainers:[s]},e!==null&&(e=zh(e),e!==null&&g0(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function G$(t,e,r,n,s){switch(e){case"focusin":return Do=Du(Do,t,e,r,n,s),!0;case"dragenter":return Fo=Du(Fo,t,e,r,n,s),!0;case"mouseover":return Lo=Du(Lo,t,e,r,n,s),!0;case"pointerover":var o=s.pointerId;return zd.set(o,Du(zd.get(o)||null,t,e,r,n,s)),!0;case"gotpointercapture":return o=s.pointerId,Ud.set(o,Du(Ud.get(o)||null,t,e,r,n,s)),!0}return!1}function MC(t){var e=Ia(t.target);if(e!==null){var r=fl(e);if(r!==null){if(e=r.tag,e===13){if(e=jC(r),e!==null){t.blockedOn=e,OC(t.priority,function(){RC(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function _m(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=Qy(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);Hy=n,r.target.dispatchEvent(n),Hy=null}else return e=zh(r),e!==null&&g0(e),t.blockedOn=r,!1;e.shift()}return!0}function lj(t,e,r){_m(t)&&r.delete(e)}function q$(){Yy=!1,Do!==null&&_m(Do)&&(Do=null),Fo!==null&&_m(Fo)&&(Fo=null),Lo!==null&&_m(Lo)&&(Lo=null),zd.forEach(lj),Ud.forEac
vendor: 9,276 bytes, line 37
37h(lj)}function Fu(t,e){t.blockedOn===e&&(t.blockedOn=null,Yy||(Yy=!0,rs.unstable_scheduleCallback(rs.unstable_NormalPriority,q$)))}function Wd(t){function e(s){return Fu(s,t)}if(0<If.length){Fu(If[0],t);for(var r=1;r<If.length;r++){var n=If[r];n.blockedOn===t&&(n.blockedOn=null)}}for(Do!==null&&Fu(Do,t),Fo!==null&&Fu(Fo,t),Lo!==null&&Fu(Lo,t),zd.forEach(e),Ud.forEach(e),r=0;r<ko.length;r++)n=ko[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<ko.length&&(r=ko[0],r.blockedOn===null);)MC(r),r.blockedOn===null&&ko.shift()}var pc=Ji.ReactCurrentBatchConfig,Xm=!0;function V$(t,e,r,n){var s=Mt,o=pc.transition;pc.transition=null;try{Mt=1,v0(t,e,r,n)}finally{Mt=s,pc.transition=o}}function K$(t,e,r,n){var s=Mt,o=pc.transition;pc.transition=null;try{Mt=4,v0(t,e,r,n)}finally{Mt=s,pc.transition=o}}function v0(t,e,r,n){if(Xm){var s=Qy(t,e,r,n);if(s===null)cx(t,e,n,Zm,r),aj(t,n);else if(G$(s,t,e,r,n))n.stopPropagation();else if(aj(t,n),e&4&&-1<H$.indexOf(t)){for(;s!==null;){var o=zh(s);if(o!==null&&AC(o),o=Qy(t,e,r,n),o===null&&cx(t,e,n,Zm,r),o===s)break;s=o}s!==null&&n.stopPropagation()}else cx(t,e,n,null,r)}}var Zm=null;function Qy(t,e,r,n){if(Zm=null,t=f0(n),t=Ia(t),t!==null)if(e=fl(t),e===null)t=null;else if(r=e.tag,r===13){if(t=jC(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Zm=t,null}function $C(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(M$()){case m0:return 1;case CC:return 4;case Qm:case $$:return 16;case EC:return 536870912;default:return 16}default:return 16}}var Io=null,x0=null,jm=null;function DC(){if(jm)return jm;var t,e=x0,r=e.length,n,s="value"in Io?Io.value:Io.textContent,o=s.length;for(t=0;t<r&&e[t]===s[t];t++);var a=r-t;for(n=1;n<=a&&e[r-n]===s[o-n];n++);return jm=s.slice(t,1<n?1-n:void 0)}function km(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Of(){return!0}function cj(){return!1}function ss(t){function e(r,n,s,o,a){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(r=t[l],this[l]=r?r(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Of:cj,this.isPropagationStopped=cj,this}return ar(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Of)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Of)},persist:function(){},isPersistent:Of}),e}var au={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},y0=ss(au),Bh=ar({},au,{view:0,detail:0}),Y$=ss(Bh),ex,tx,Lu,xg=ar({},Bh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:b0,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Lu&&(Lu&&t.type==="mousemove"?(ex=t.screenX-Lu.screenX,tx=t.screenY-Lu.screenY):tx=ex=0,Lu=t),ex)},movementY:function(t){return"movementY"in t?t.movementY:tx}}),uj=ss(xg),Q$=ar({},xg,{dataTransfer:0}),J$=ss(Q$),X$=ar({},Bh,{relatedTarget:0}),rx=ss(X$),Z$=ar({},au,{animationName:0,elapsedTime:0,pseudoElement:0}),eD=ss(Z$),tD=ar({},au,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),rD=ss(tD),nD=ar({},au,{data:0}),dj=ss(nD),sD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},iD={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},oD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function aD(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=oD[t])?!!e[t]:!1}function b0(){return aD}var lD=ar({},Bh,{key:function(t){if(t.key){var e=sD[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=km(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?iD[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:b0,charCode:function(t){return t.type==="keypress"?km(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?km(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),cD=ss(lD),uD=ar({},xg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hj=ss(uD),dD=ar({},Bh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:b0}),hD=ss(dD),fD=ar({},au,{propertyName:0,elapsedTime:0,pseudoElement:0}),mD=ss(fD),pD=ar({},xg,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),gD=ss(pD),vD=[9,13,27,32],w0=Wi&&"CompositionEvent"in window,kd=null;Wi&&"documentMode"in document&&(kd=document.documentMode);var xD=Wi&&"TextEvent"in window&&!kd,FC=Wi&&(!w0||kd&&8<kd&&11>=kd),fj=" ",mj=!1;function LC(t,e){switch(t){case"keyup":return vD.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function BC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xl=!1;function yD(t,e){switch(t){case"compositionend":return BC(e);case"keypress":return e.which!==32?null:(mj=!0,fj);case"textInput":return t=e.data,t===fj&&mj?null:t;default:return null}}function bD(t,e){if(Xl)return t==="compositionend"||!w0&&LC(t,e)?(t=DC(),jm=x0=Io=null,Xl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return FC&&e.locale!=="ko"?null:e.data;default:return null}}var wD={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function pj(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!wD[t.type]:e==="textarea"}function zC(t,e,r,n){xC(n),e=ep(e,"onChange"),0<e.length&&(r=new y0("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var Sd=null,Hd=null;function _D(t){XC(t,0)}function yg(t){var e=tc(t);if(dC(e))return t}function jD(t,e){if(t==="change")return e}var UC=!1;if(Wi){var nx;if(Wi){var sx="oninput"in document;if(!sx){var gj=document.createElement("div");gj.setAttribute("oninput","return;"),sx=typeof gj.oninput=="function"}nx=sx}else nx=!1;UC=nx&&(!document.documentMode||9<document.documentMode)}function vj(){Sd&&(Sd.detachEvent("onpropertychange",WC),Hd=Sd=null)}function WC(t){if(t.propertyName==="value"&&yg(Hd)){var e=[];zC(e,Hd,t,f0(t)),_C(_D,e)}}function kD(t,e,r){t==="focusin"?(vj(),Sd=e,Hd=r,Sd.attachEvent("onpropertychange",WC)):t==="focusout"&&vj()}function SD(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return yg(Hd)}function ND(t,e){if(t==="click")return yg(e)}function CD(t,e){if(t==="input"||t==="change")return yg(e)}function ED(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ws=typeof Object.is=="function"?Object.is:ED;function Gd(t,e){if(Ws(t,e))return!0;
vendor: 4,808 bytes, line 37
37if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!Ry.call(e,s)||!Ws(t[s],e[s]))return!1}return!0}function xj(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function yj(t,e){var r=xj(t);t=0;for(var n;r;){if(r.nodeType===3){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=xj(r)}}function HC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?HC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function GC(){for(var t=window,e=Vm();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Vm(t.document)}return e}function _0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function PD(t){var e=GC(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&HC(r.ownerDocument.documentElement,r)){if(n!==null&&_0(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=r.textContent.length,o=Math.min(n.start,s);n=n.end===void 0?o:Math.min(n.end,s),!t.extend&&o>n&&(s=n,n=o,o=s),s=yj(r,o);var a=yj(r,n);s&&a&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),o>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var TD=Wi&&"documentMode"in document&&11>=document.documentMode,Zl=null,Jy=null,Nd=null,Xy=!1;function bj(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Xy||Zl==null||Zl!==Vm(n)||(n=Zl,"selectionStart"in n&&_0(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Nd&&Gd(Nd,n)||(Nd=n,n=ep(Jy,"onSelect"),0<n.length&&(e=new y0("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=Zl)))}function Mf(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var ec={animationend:Mf("Animation","AnimationEnd"),animationiteration:Mf("Animation","AnimationIteration"),animationstart:Mf("Animation","AnimationStart"),transitionend:Mf("Transition","TransitionEnd")},ix={},qC={};Wi&&(qC=document.createElement("div").style,"AnimationEvent"in window||(delete ec.animationend.animation,delete ec.animationiteration.animation,delete ec.animationstart.animation),"TransitionEvent"in window||delete ec.transitionend.transition);function bg(t){if(ix[t])return ix[t];if(!ec[t])return t;var e=ec[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in qC)return ix[t]=e[r];return t}var VC=bg("animationend"),KC=bg("animationiteration"),YC=bg("animationstart"),QC=bg("transitionend"),JC=new Map,wj="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function aa(t,e){JC.set(t,e),hl(e,[t])}for(var ox=0;ox<wj.length;ox++){var ax=wj[ox],AD=ax.toLowerCase(),RD=ax[0].toUpperCase()+ax.slice(1);aa(AD,"on"+RD)}aa(VC,"onAnimationEnd");aa(KC,"onAnimationIteration");aa(YC,"onAnimationStart");aa("dblclick","onDoubleClick");aa("focusin","onFocus");aa("focusout","onBlur");aa(QC,"onTransitionEnd");Lc("onMouseEnter",["mouseout","mouseover"]);Lc("onMouseLeave",["mouseout","mouseover"]);Lc("onPointerEnter",["pointerout","pointerover"]);Lc("onPointerLeave",["pointerout","pointerover"]);hl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));
vendor: 4,770 bytes, line 37
37hl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));hl("onBeforeInput",["compositionend","keypress","textInput","paste"]);hl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));hl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));hl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cd="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),ID=new Set("cancel close invalid load scroll toggle".split(" ").concat(cd));function _j(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,A$(n,e,void 0,t),t.currentTarget=null}function XC(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var n=t[r],s=n.event;n=n.listeners;e:{var o=void 0;if(e)for(var a=n.length-1;0<=a;a--){var l=n[a],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==o&&s.isPropagationStopped())break e;_j(s,l,u),o=c}else for(a=0;a<n.length;a++){if(l=n[a],c=l.instance,u=l.currentTarget,l=l.listener,c!==o&&s.isPropagationStopped())break e;_j(s,l,u),o=c}}}if(Ym)throw t=Vy,Ym=!1,Vy=null,t}function qt(t,e){var r=e[nb];r===void 0&&(r=e[nb]=new Set);var n=t+"__bubble";r.has(n)||(ZC(e,t,2,!1),r.add(n))}function lx(t,e,r){var n=0;e&&(n|=4),ZC(r,t,n,e)}var $f="_reactListening"+Math.random().toString(36).slice(2);function qd(t){if(!t[$f]){t[$f]=!0,oC.forEach(function(r){r!=="selectionchange"&&(ID.has(r)||lx(r,!1,t),lx(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[$f]||(e[$f]=!0,lx("selectionchange",!1,e))}}function ZC(t,e,r,n){switch($C(e)){case 1:var s=V$;break;case 4:s=K$;break;default:s=v0}r=s.bind(null,e,r,t),s=void 0,!qy||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),n?s!==void 0?t.addEventListener(e,r,{capture:!0,passive:s}):t.addEventListener(e,r,!0):s!==void 0?t.addEventListener(e,r,{passive:s}):t.addEventListener(e,r,!1)}function cx(t,e,r,n,s){var o=n;if(!(e&1)&&!(e&2)&&n!==null)e:for(;;){if(n===null)return;var a=n.tag;if(a===3||a===4){var l=n.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(a===4)for(a=n.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;l!==null;){if(a=Ia(l),a===null)return;if(c=a.tag,c===5||c===6){n=o=a;continue e}l=l.parentNode}}n=n.return}_C(function(){var u=o,d=f0(r),h=[];e:{var m=JC.get(t);if(m!==void 0){var f=y0,v=t;switch(t){case"keypress":if(km(r)===0)break e;case"keydown":case"keyup":f=cD;break;case"focusin":v="focus",f=rx;break;case"focusout":v="blur",f=rx;break;case"beforeblur":case"afterblur":f=rx;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=uj;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=J$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=hD;break;case VC:case KC:case YC:f=eD;break;case QC:f=mD;break;case"scroll":f=Y$;break;case"wheel":f=gD;break;case"copy":case"cut":case"paste":f=rD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=hj}var p=(e&4)!==0,b=!p&&t==="scroll",x=p?m!==null?m+"Capture":null:m;p=[];for(var y=u,w;y!==null;){w=y;var j=w.stateNode;if(w.tag===5&&j!==null&&(w=j,x!==null&&(j=Bd(y,x),j!=null&&p.push(Vd(y,j,w)))),b)break;y=y.return}0<p.length&&(m=new f(m,v,null,r,d),h.push({event:m,listeners:p}))}}if(!(e&7)){e:{if(m=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",m&&r!==Hy&&(v=r.relatedTarget||r.fromElement)&&(Ia(v)||v[Hi]))break e;if((f||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,f?(v=r.relatedTarget||r.toElement,f=u,v=v?Ia(v):null,v!==null&&(b=fl(v),v!==b||v.tag!==5&&v.tag!==6)&&(v=null)):(f=null,v=u),f!==v)){if(p=uj,j="onMouseLeave",x="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(p=hj,j="onPointerLeave",x="onPointerEnter",y="pointer"),b=f==null?m:tc(f),w=v==null?m:tc(v),m=new p(j,y+"leave",f,r,d),m.target=b,m.relatedTarget=w,j=null,Ia(d)===u&&(p=new p(x,y+"enter",v,r,d),p.target=w,p.relatedTarget=b,j=p),b=j,f&&v)t:{for(p=f,x=v,y=0,w=p;w;w=Pl(w))y++;for(w=0,j=x;j;j=Pl(j))w++;for(;0<y-w;)p=Pl(p),y--;for(;0<w-y;)x=Pl(x),w--;for(;y--;){if(p===x||x!==null&&p===x.alternate)break t;p=Pl(p),x=Pl(x)}p=null}else p=null;f!==null&&jj(h,m,f,p,!1),v!==null&&b!==null&&jj(h,b,v,p,!0)}}
vendor: 7,622 bytes, lines 37-38
37e:{if(m=u?tc(u):window,f=m.nodeName&&m.nodeName.toLowerCase(),f==="select"||f==="input"&&m.type==="file")var _=jD;else if(pj(m))if(UC)_=CD;else{_=SD;var S=kD}else(f=m.nodeName)&&f.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(_=ND);if(_&&(_=_(t,u))){zC(h,_,r,d);break e}S&&S(t,m,u),t==="focusout"&&(S=m._wrapperState)&&S.controlled&&m.type==="number"&&Ly(m,"number",m.value)}switch(S=u?tc(u):window,t){case"focusin":(pj(S)||S.contentEditable==="true")&&(Zl=S,Jy=u,Nd=null);break;case"focusout":Nd=Jy=Zl=null;break;case"mousedown":Xy=!0;break;case"contextmenu":case"mouseup":case"dragend":Xy=!1,bj(h,r,d);break;case"selectionchange":if(TD)break;case"keydown":case"keyup":bj(h,r,d)}var N;if(w0)e:{switch(t){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Xl?LC(t,r)&&(P="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(P="onCompositionStart");P&&(FC&&r.locale!=="ko"&&(Xl||P!=="onCompositionStart"?P==="onCompositionEnd"&&Xl&&(N=DC()):(Io=d,x0="value"in Io?Io.value:Io.textContent,Xl=!0)),S=ep(u,P),0<S.length&&(P=new dj(P,t,null,r,d),h.push({event:P,listeners:S}),N?P.data=N:(N=BC(r),N!==null&&(P.data=N)))),(N=xD?yD(t,r):bD(t,r))&&(u=ep(u,"onBeforeInput"),0<u.length&&(d=new dj("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:u}),d.data=N))}XC(h,e)})}function Vd(t,e,r){return{instance:t,listener:e,currentTarget:r}}function ep(t,e){for(var r=e+"Capture",n=[];t!==null;){var s=t,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=Bd(t,r),o!=null&&n.unshift(Vd(t,o,s)),o=Bd(t,e),o!=null&&n.push(Vd(t,o,s))),t=t.return}return n}function Pl(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function jj(t,e,r,n,s){for(var o=e._reactName,a=[];r!==null&&r!==n;){var l=r,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,s?(c=Bd(r,o),c!=null&&a.unshift(Vd(r,c,l))):s||(c=Bd(r,o),c!=null&&a.push(Vd(r,c,l)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var OD=/\r\n?/g,MD=/\u0000|\uFFFD/g;function kj(t){return(typeof t=="string"?t:""+t).replace(OD,`
38`).replace(MD,"")}function Df(t,e,r){if(e=kj(e),kj(t)!==e&&r)throw Error(Ne(425))}function tp(){}var Zy=null,eb=null;function tb(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var rb=typeof setTimeout=="function"?setTimeout:void 0,$D=typeof clearTimeout=="function"?clearTimeout:void 0,Sj=typeof Promise=="function"?Promise:void 0,DD=typeof queueMicrotask=="function"?queueMicrotask:typeof Sj<"u"?function(t){return Sj.resolve(null).then(t).catch(FD)}:rb;function FD(t){setTimeout(function(){throw t})}function ux(t,e){var r=e,n=0;do{var s=r.nextSibling;if(t.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){t.removeChild(s),Wd(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Wd(e)}function Bo(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Nj(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var lu=Math.random().toString(36).slice(2),ai="__reactFiber$"+lu,Kd="__reactProps$"+lu,Hi="__reactContainer$"+lu,nb="__reactEvents$"+lu,LD="__reactListeners$"+lu,BD="__reactHandles$"+lu;function Ia(t){var e=t[ai];if(e)return e;for(var r=t.parentNode;r;){if(e=r[Hi]||r[ai]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=Nj(t);t!==null;){if(r=t[ai])return r;t=Nj(t)}return e}t=r,r=t.parentNode}return null}function zh(t){return t=t[ai]||t[Hi],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function tc(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Ne(33))}function wg(t){return t[Kd]||null}var sb=[],rc=-1;function la(t){return{current:t}}function Yt(t){0>rc||(t.current=sb[rc],sb[rc]=null,rc--)}function Ut(t,e){rc++,sb[rc]=t.current,t.current=e}var Zo={},pn=la(Zo),Dn=la(!1),Qa=Zo;function Bc(t,e){var r=t.type.contextTypes;if(!r)return Zo;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in r)s[o]=e[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Fn(t){return t=t.childContextTypes,t!=null}function rp(){Yt(Dn),Yt(pn)}function Cj(t,e,r){if(pn.current!==Zo)throw Error(Ne(168));Ut(pn,e),Ut(Dn,r)}function eE(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in e))throw Error(Ne(108,k$(t)||"Unknown",s));return ar({},r,n)}function np(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Zo,Qa=pn.current,Ut(pn,t),Ut(Dn,Dn.current),!0}function Ej(t,e,r){var n=t.stateNode;if(!n)throw Error(Ne(169));r?(t=eE(t,e,Qa),n.__reactInternalMemoizedMergedChildContext=t,Yt(Dn),Yt(pn),Ut(pn,t)):Yt(Dn),Ut(Dn,r)}var Ri=null,_g=!1,dx=!1;function tE(t){Ri===null?Ri=[t]:Ri.push(t)}function zD(t){_g=!0,tE(t)}function ca(){if(!dx&&Ri!==null){dx=!0;var t=0,e=Mt;try{var r=Ri;for(Mt=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}Ri=null,_g=!1}catch(s){throw Ri!==null&&(Ri=Ri.slice(t+1)),NC(m0,ca),s}finally{Mt=e,dx=!1}}return null}var nc=[],sc=0,sp=null,ip=0,ls=[],cs=0,Ja=null,$i=1,Di="";function ka(t,e){nc[sc++]=ip,nc[sc++]=sp,sp=t,ip=e}function rE(t,e,r){ls[cs++]=$i,ls[cs++]=Di,ls[cs++]=Ja,Ja=t;var n=$i;t=Di;var s=32-Bs(n)-1;n&=~(1<<s),r+=1;var o=32-Bs(e)+s;if(30<o){var a=s-s%5;o=(n&(1<<a)-1).toString(32),n>>=a,s-=a,$i=1<<32-Bs(e)+s|r<<s|n,Di=o+t}else $i=1<<o|r<<s|n,Di=t}function j0(t){t.return!==null&&(ka(t,1),rE(t,1,0))}function k0(t){for(;t===sp;)sp=nc[--sc],nc[sc]=null,ip=nc[--sc],nc[sc]=null;for(;t===Ja;)Ja=ls[--cs],ls[cs]=null,Di=ls[--cs],ls[cs]=null,$i=ls[--cs],ls[cs]=null}var es=null,Xn=null,Jt=!1,Fs=null;function nE(t,e){var r=ds(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function Pj(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,es=t,Xn=Bo(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,es=t,Xn=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=Ja!==null?{id:$i,overflow:Di}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=ds(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,es=t,Xn=null,!0):!1;default:return!1}}function ib(t){return(t.mode&1)!==0&&(t.flags&128)===0}function ob(t){if(Jt){var e=Xn;if(e){var r=e;if(!Pj(t,e)){if(ib(t))throw Error(Ne(418));e=Bo(r.nextSibling);var n=es;e&&Pj(t,e)?nE(n,r):(t.flags=t.flags&-4097|2,Jt=!1,es=t)}}else{if(ib(t))throw Error(Ne(418));t.flags=t.flags&-4097|2,Jt=!1,es=t}}}function Tj(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;es=t}function Ff(t){if(t!==es)return!1;if(!Jt)return Tj(t),Jt=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!tb(t.type,t.memoizedProps)),e&&(e=Xn)){if(ib(t))throw sE(),Error(Ne(418));for(;e;)nE(t,e),e=Bo(e.nextSibling)}if(Tj(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Ne(317));e:{for(t=t.nextSibling,e=0;t;
vendor: 15,599 bytes, line 38
38){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Xn=Bo(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Xn=null}}else Xn=es?Bo(t.stateNode.nextSibling):null;return!0}function sE(){for(var t=Xn;t;)t=Bo(t.nextSibling)}function zc(){Xn=es=null,Jt=!1}function S0(t){Fs===null?Fs=[t]:Fs.push(t)}var UD=Ji.ReactCurrentBatchConfig;function Bu(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(Ne(309));var n=r.stateNode}if(!n)throw Error(Ne(147,t));var s=n,o=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===o?e.ref:(e=function(a){var l=s.refs;a===null?delete l[o]:l[o]=a},e._stringRef=o,e)}if(typeof t!="string")throw Error(Ne(284));if(!r._owner)throw Error(Ne(290,t))}return t}function Lf(t,e){throw t=Object.prototype.toString.call(e),Error(Ne(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Aj(t){var e=t._init;return e(t._payload)}function iE(t){function e(x,y){if(t){var w=x.deletions;w===null?(x.deletions=[y],x.flags|=16):w.push(y)}}function r(x,y){if(!t)return null;for(;y!==null;)e(x,y),y=y.sibling;return null}function n(x,y){for(x=new Map;y!==null;)y.key!==null?x.set(y.key,y):x.set(y.index,y),y=y.sibling;return x}function s(x,y){return x=Ho(x,y),x.index=0,x.sibling=null,x}function o(x,y,w){return x.index=w,t?(w=x.alternate,w!==null?(w=w.index,w<y?(x.flags|=2,y):w):(x.flags|=2,y)):(x.flags|=1048576,y)}function a(x){return t&&x.alternate===null&&(x.flags|=2),x}function l(x,y,w,j){return y===null||y.tag!==6?(y=xx(w,x.mode,j),y.return=x,y):(y=s(y,w),y.return=x,y)}function c(x,y,w,j){var _=w.type;return _===Jl?d(x,y,w.props.children,j,w.key):y!==null&&(y.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===wo&&Aj(_)===y.type)?(j=s(y,w.props),j.ref=Bu(x,y,w),j.return=x,j):(j=Am(w.type,w.key,w.props,null,x.mode,j),j.ref=Bu(x,y,w),j.return=x,j)}function u(x,y,w,j){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=yx(w,x.mode,j),y.return=x,y):(y=s(y,w.children||[]),y.return=x,y)}function d(x,y,w,j,_){return y===null||y.tag!==7?(y=Ha(w,x.mode,j,_),y.return=x,y):(y=s(y,w),y.return=x,y)}function h(x,y,w){if(typeof y=="string"&&y!==""||typeof y=="number")return y=xx(""+y,x.mode,w),y.return=x,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Ef:return w=Am(y.type,y.key,y.props,null,x.mode,w),w.ref=Bu(x,null,y),w.return=x,w;case Ql:return y=yx(y,x.mode,w),y.return=x,y;case wo:var j=y._init;return h(x,j(y._payload),w)}if(ad(y)||Mu(y))return y=Ha(y,x.mode,w,null),y.return=x,y;Lf(x,y)}return null}function m(x,y,w,j){var _=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return _!==null?null:l(x,y,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ef:return w.key===_?c(x,y,w,j):null;case Ql:return w.key===_?u(x,y,w,j):null;case wo:return _=w._init,m(x,y,_(w._payload),j)}if(ad(w)||Mu(w))return _!==null?null:d(x,y,w,j,null);Lf(x,w)}return null}function f(x,y,w,j,_){if(typeof j=="string"&&j!==""||typeof j=="number")return x=x.get(w)||null,l(y,x,""+j,_);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Ef:return x=x.get(j.key===null?w:j.key)||null,c(y,x,j,_);case Ql:return x=x.get(j.key===null?w:j.key)||null,u(y,x,j,_);case wo:var S=j._init;return f(x,y,w,S(j._payload),_)}if(ad(j)||Mu(j))return x=x.get(w)||null,d(y,x,j,_,null);Lf(y,j)}return null}function v(x,y,w,j){for(var _=null,S=null,N=y,P=y=0,C=null;N!==null&&P<w.length;P++){N.index>P?(C=N,N=null):C=N.sibling;var O=m(x,N,w[P],j);if(O===null){N===null&&(N=C);break}t&&N&&O.alternate===null&&e(x,N),y=o(O,y,P),S===null?_=O:S.sibling=O,S=O,N=C}if(P===w.length)return r(x,N),Jt&&ka(x,P),_;if(N===null){for(;P<w.length;P++)N=h(x,w[P],j),N!==null&&(y=o(N,y,P),S===null?_=N:S.sibling=N,S=N);return Jt&&ka(x,P),_}for(N=n(x,N);P<w.length;P++)C=f(N,x,P,w[P],j),C!==null&&(t&&C.alternate!==null&&N.delete(C.key===null?P:C.key),y=o(C,y,P),S===null?_=C:S.sibling=C,S=C);return t&&N.forEach(function(F){return e(x,F)}),Jt&&ka(x,P),_}function p(x,y,w,j){var _=Mu(w);if(typeof _!="function")throw Error(Ne(150));if(w=_.call(w),w==null)throw Error(Ne(151));for(var S=_=null,N=y,P=y=0,C=null,O=w.next();N!==null&&!O.done;P++,O=w.next()){N.index>P?(C=N,N=null):C=N.sibling;var F=m(x,N,O.value,j);if(F===null){N===null&&(N=C);break}t&&N&&F.alternate===null&&e(x,N),y=o(F,y,P),S===null?_=F:S.sibling=F,S=F,N=C}if(O.done)return r(x,N),Jt&&ka(x,P),_;if(N===null){for(;!O.done;P++,O=w.next())O=h(x,O.value,j),O!==null&&(y=o(O,y,P),S===null?_=O:S.sibling=O,S=O);return Jt&&ka(x,P),_}for(N=n(x,N);!O.done;P++,O=w.next())O=f(N,x,P,O.value,j),O!==null&&(t&&O.alternate!==null&&N.delete(O.key===null?P:O.key),y=o(O,y,P),S===null?_=O:S.sibling=O,S=O);return t&&N.forEach(function(T){return e(x,T)}),Jt&&ka(x,P),_}function b(x,y,w,j){if(typeof w=="object"&&w!==null&&w.type===Jl&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Ef:e:{for(var _=w.key,S=y;S!==null;){if(S.key===_){if(_=w.type,_===Jl){if(S.tag===7){r(x,S.sibling),y=s(S,w.props.children),y.return=x,x=y;break e}}else if(S.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===wo&&Aj(_)===S.type){r(x,S.sibling),y=s(S,w.props),y.ref=Bu(x,S,w),y.return=x,x=y;break e}r(x,S);break}else e(x,S);S=S.sibling}w.type===Jl?(y=Ha(w.props.children,x.mode,j,w.key),y.return=x,x=y):(j=Am(w.type,w.key,w.props,null,x.mode,j),j.ref=Bu(x,y,w),j.return=x,x=j)}return a(x);case Ql:e:{for(S=w.key;y!==null;){if(y.key===S)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){r(x,y.sibling),y=s(y,w.children||[]),y.return=x,x=y;break e}else{r(x,y);break}else e(x,y);y=y.sibling}y=yx(w,x.mode,j),y.return=x,x=y}return a(x);case wo:return S=w._init,b(x,y,S(w._payload),j)}if(ad(w))return v(x,y,w,j);if(Mu(w))return p(x,y,w,j);Lf(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(r(x,y.sibling),y=s(y,w),y.return=x,x=y):(r(x,y),y=xx(w,x.mode,j),y.return=x,x=y),a(x)):r(x,y)}return b}var Uc=iE(!0),oE=iE(!1),op=la(null),ap=null,ic=null,N0=null;function C0(){N0=ic=ap=null}function E0(t){var e=op.current;Yt(op),t._currentValue=e}function ab(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function gc(t,e){ap=t,N0=ic=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Mn=!0),t.firstContext=null)}function vs(t){var e=t._currentValue;if(N0!==t)if(t={context:t,memoizedValue:e,next:null},ic===null){if(ap===null)throw Error(Ne(308));ic=t,ap.dependencies={lanes:0,firstContext:t}}else ic=ic.next=t;return e}var Oa=null;function P0(t){Oa===null?Oa=[t]:Oa.push(t)}function aE(t,e,r,n){var s=e.interleaved;return s===null?(r.next=r,P0(e)):(r.next=s.next,s.next=r),e.interleaved=r,Gi(t,n)}function Gi(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var _o=!1;function T0(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lE(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Li(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function zo(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,wt&2){var s=n.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),n.pending=e,Gi(t,r)}return s=n.interleaved,s===null?(e.next=e,P0(n)):(e.next=s.next,s.next=e),n.interleaved=e,Gi(t,r)}function Sm(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,p0(t,r)}}function Rj(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,o=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};o===null?s=o=a:o=o.next=a,r=r.next}while(r!==null);o===null?s=o=e:o=o.next=e}else s=o=e;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function lp(t,e,r,n){var s=t.updateQueue;_o=!1;var o=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?o=u:a.next=u,a=c;var d=t.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(o!==null){var h=s.baseState;a=0,d=u=c=null,l=o;do{var m=l.lane,f=l.eventTime;if((n&m)===m){d!==null&&(d=d.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var v=t,p=l;switch(m=e,f=r,p.tag){case 1:if(v=p.payload,typeof v=="function"){h=v.call(f,h,m);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=p.payload,m=typeof v=="function"?v.call(f,h,m):v,m==null)break e;h=ar({},h,m);break e;case 2:_o=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,m=s.effects,m===null?s.effects=[l]:m.push(l))}else f={eventTime:f,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=f,c=h):d=d.next=f,a|=m;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;m=l,l=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(d===null&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do a|=s.lane,s=s.next;while(s!==e)}else o===null&&(s.shared.lanes=0);Za|=a,t.lanes=a,t.memoizedState=h}}function Ij(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(Ne(191,s));s.call(n)}}}var Uh={},fi=la(Uh),Yd=la(Uh),Qd=la(Uh);function Ma(t){if(t===Uh)throw Error(Ne(174));return t}function A0(t,e){switch(Ut(Qd,e),Ut(Yd,t),Ut(fi,Uh),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:zy(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=zy(e,t)}Yt(fi),Ut(fi,e)}function Wc(){Yt(fi),Yt(Yd),Yt(Qd)}function cE(t){Ma(Qd.current);var e=Ma(fi.current),r=zy(e,t.type);e!==r&&(Ut(Yd,t),Ut(fi,r))}function R0(t){Yd.current===t&&(Yt(fi),Yt(Yd))}var rr=la(0);function cp(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var hx=[];function I0(){for(var t=0;t<hx.length;t++)hx[t]._workInProgressVersionPrimary=null;hx.length=0}var Nm=Ji.ReactCurrentDispatcher,fx=Ji.ReactCurrentBatchConfig,Xa=0,or=null,Or=null,Wr=null,up=!1,Cd=!1,Jd=0,WD=0;function un(){throw Error(Ne(321))}function O0(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!Ws(t[r],e[r]))return!1;return!0}function M0(t,e,r,n,s,o){if(Xa=o,or=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Nm.current=t===null||t.memoizedState===null?VD:KD,t=r(n,s),Cd){o=0;do{if(Cd=!1,Jd=0,25<=o)throw Error(Ne(301));o+=1,Wr=Or=null,e.updateQueue=null,Nm.current=YD,t=r(n,s)}while(Cd)}if(Nm.current=dp,e=Or!==null&&Or.next!==null,Xa=0,Wr=Or=or=null,up=!1,e)throw Error(Ne(300));return t}function $0(){var t=Jd!==0;return Jd=0,t}function ni(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wr===null?or.memoizedState=Wr=t:Wr=Wr.next=t,Wr}function xs(){if(Or===null){var t=or.alternate;t=t!==null?t.memoizedState:null}else t=Or.next;var e=Wr===null?or.memoizedState:Wr.next;if(e!==null)Wr=e,Or=t;else{if(t===null)throw Error(Ne(310));Or=t,t={memoizedState:Or.memoizedState,baseState:Or.baseState,baseQueue:Or.baseQueue,queue:Or.queue,next:null},Wr===null?or.memoizedState=Wr=t:Wr=Wr.next=t}return Wr}function Xd(t,e){return typeof e=="function"?e(t):e}function mx(t){var e=xs(),r=e.queue;if(r===null)throw Error(Ne(311));r.lastRenderedReducer=t;var n=Or,s=n.baseQueue,o=r.pending;if(o!==null){if(s!==null){var a=s.next;s.next=o.next,o.next=a}n.baseQueue=s=o,r.pending=null}if(s!==null){o=s.next,n=n.baseState;var l=a=null,c=null,u=o;do{var d=u.lane;if((Xa&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:t(n,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=h,a=n):c=c.next=h,or.lanes|=d,Za|=d}u=u.next}while(u!==null&&u!==o);c===null?a=n:c.next=l,Ws(n,e.memoizedState)||(Mn=!0),e.memoizedState=n,e.baseState=a,e.baseQueue=c,r.lastRenderedState=n}if(t=r.interleaved,t!==null){s=t;do o=s.lane,or.lanes|=o,Za|=o,s=s.next;while(s!==t)}else s===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function px(t){var e=xs(),r=e.queue;if(r===null)throw Error(Ne(311));r.lastRenderedReducer=t;var n=r.dispatch,s=r.pending,o=e.memoizedState;if(s!==null){r.pending=null;var a=s=s.next;do o=t(o,a.action),a=a.next;while(a!==s);Ws(o,e.memoizedState)||(Mn=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),r.lastRenderedState=o}return[o,n]}function uE(){}function dE(t,e){var r=or,n=xs(),s=e(),o=!Ws(n.memoizedState,s);if(o&&(n.memoizedState=s,Mn=!0),n=n.queue,D0(mE.bind(null,r,n,t),[t]),n.getSnapshot!==e||o||Wr!==null&&Wr.memoizedState.tag&1){if(r.flags|=2048,Zd(9,fE.bind(null,r,n,s,e),void 0,null),qr===null)throw Error(Ne(349));Xa&30||hE(r,e,s)}return s}function hE(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=or.updateQueue,e===null?(e={lastEffect:null,stores:null},or.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function fE(t,e,r,n){e.value=r,e.getSnapshot=n,pE(e)&&gE(t)}function mE(t,e,r){return r(function(){pE(e)&&gE(t)})}function pE(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Ws(t,r)}catch{return!0}}function gE(t){var e=Gi(t,1);e!==null&&zs(e,t,1,-1)}function Oj(t){var e=ni();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xd,lastRenderedState:t},e.queue=t,t=t.dispatch=qD.bind(null,or,t),[e.memoizedState,t]}function Zd(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=or.updateQueue,e===null?(e={lastEffect:null,stores:null},or.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(n=r.next,r.next=t,t.next=n,e.lastEffect=t)),t}function vE(){return xs().memoizedState}function Cm(t,e,r,n){var s=ni();or.flags|=t,s.memoizedState=Zd(1|e,r,void 0,n===void 0?null:n)}function jg(t,e,r,n){var s=xs();n=n===void 0?null:n;var o=void 0;if(Or!==null){var a=Or.memoizedState;if(o=a.destroy,n!==null&&O0(n,a.deps)){s.memoizedState=Zd(e,r,o,n);return}}or.flags|=t,s.memoizedState=Zd(1|e,r,o,n)}function Mj(t,e){return Cm(8390656,8,t,e)}function D0(t,e){return jg(2048,8,t,e)}function xE(t,e){return jg(4,2,t,e)}function yE(t,e){return jg(4,4,t,e)}function bE(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}
vendor: 4,203 bytes, line 38
38function wE(t,e,r){return r=r!=null?r.concat([t]):null,jg(4,4,bE.bind(null,e,t),r)}function F0(){}function _E(t,e){var r=xs();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&O0(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function jE(t,e){var r=xs();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&O0(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function kE(t,e,r){return Xa&21?(Ws(r,e)||(r=PC(),or.lanes|=r,Za|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Mn=!0),t.memoizedState=r)}function HD(t,e){var r=Mt;Mt=r!==0&&4>r?r:4,t(!0);var n=fx.transition;fx.transition={};try{t(!1),e()}finally{Mt=r,fx.transition=n}}function SE(){return xs().memoizedState}function GD(t,e,r){var n=Wo(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},NE(t))CE(e,r);else if(r=aE(t,e,r,n),r!==null){var s=_n();zs(r,t,n,s),EE(r,e,n)}}function qD(t,e,r){var n=Wo(t),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(NE(t))CE(e,s);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var a=e.lastRenderedState,l=o(a,r);if(s.hasEagerState=!0,s.eagerState=l,Ws(l,a)){var c=e.interleaved;c===null?(s.next=s,P0(e)):(s.next=c.next,c.next=s),e.interleaved=s;return}}catch{}finally{}r=aE(t,e,s,n),r!==null&&(s=_n(),zs(r,t,n,s),EE(r,e,n))}}function NE(t){var e=t.alternate;return t===or||e!==null&&e===or}function CE(t,e){Cd=up=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function EE(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,p0(t,r)}}var dp={readContext:vs,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},VD={readContext:vs,useCallback:function(t,e){return ni().memoizedState=[t,e===void 0?null:e],t},useContext:vs,useEffect:Mj,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Cm(4194308,4,bE.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Cm(4194308,4,t,e)},useInsertionEffect:function(t,e){return Cm(4,2,t,e)},useMemo:function(t,e){var r=ni();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=ni();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=GD.bind(null,or,t),[n.memoizedState,t]},useRef:function(t){var e=ni();return t={current:t},e.memoizedState=t},useState:Oj,useDebugValue:F0,useDeferredValue:function(t){return ni().memoizedState=t},useTransition:function(){var t=Oj(!1),e=t[0];return t=HD.bind(null,t[1]),ni().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=or,s=ni();if(Jt){if(r===void 0)throw Error(Ne(407));r=r()}else{if(r=e(),qr===null)throw Error(Ne(349));Xa&30||hE(n,e,r)}s.memoizedState=r;var o={value:r,getSnapshot:e};return s.queue=o,Mj(mE.bind(null,n,o,t),[t]),n.flags|=2048,Zd(9,fE.bind(null,n,o,r,e),void 0,null),r},useId:function(){var t=ni(),e=qr.identifierPrefix;if(Jt){var r=Di,n=$i;r=(n&~(1<<32-Bs(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Jd++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=WD++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},KD={readContext:vs,useCallback:_E,useContext:vs,useEffect:D0,useImperativeHandle:wE,useInsertionEffect:xE,useLayoutEffect:yE,useMemo:jE,useReducer:mx,useRef:vE,useState:function(){return mx(Xd)},useDebugValue:F0,useDeferredValue:function(t){var e=xs();return kE(e,Or.memoizedState,t)},useTransition:function(){var t=mx(Xd)[0],e=xs().memoizedState;return[t,e]},useMutableSource:uE,useSyncExternalStore:dE,useId:SE,unstable_isNewReconciler:!1},YD={readContext:vs,useCallback:_E,useContext:vs,useEffect:D0,useImperativeHandle:wE,useInsertionEffect:xE,useLayoutEffect:yE,useMemo:jE,useReducer:px,useRef:vE,useState:function(){return px(Xd)},useDebugValue:F0,useDeferredValue:function(t){var e=xs();return Or===null?e.memoizedState=t:kE(e,Or.memoizedState,t)}
vendor: 4,304 bytes, lines 38-40
38,useTransition:function(){var t=px(Xd)[0],e=xs().memoizedState;return[t,e]},useMutableSource:uE,useSyncExternalStore:dE,useId:SE,unstable_isNewReconciler:!1};function As(t,e){if(t&&t.defaultProps){e=ar({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}function lb(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:ar({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var kg={isMounted:function(t){return(t=t._reactInternals)?fl(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=_n(),s=Wo(t),o=Li(n,s);o.payload=e,r!=null&&(o.callback=r),e=zo(t,o,s),e!==null&&(zs(e,t,s,n),Sm(e,t,s))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=_n(),s=Wo(t),o=Li(n,s);o.tag=1,o.payload=e,r!=null&&(o.callback=r),e=zo(t,o,s),e!==null&&(zs(e,t,s,n),Sm(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=_n(),n=Wo(t),s=Li(r,n);s.tag=2,e!=null&&(s.callback=e),e=zo(t,s,n),e!==null&&(zs(e,t,n,r),Sm(e,t,n))}};function $j(t,e,r,n,s,o,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,o,a):e.prototype&&e.prototype.isPureReactComponent?!Gd(r,n)||!Gd(s,o):!0}function PE(t,e,r){var n=!1,s=Zo,o=e.contextType;return typeof o=="object"&&o!==null?o=vs(o):(s=Fn(e)?Qa:pn.current,n=e.contextTypes,o=(n=n!=null)?Bc(t,s):Zo),e=new e(r,o),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=kg,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=o),e}function Dj(t,e,r,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,n),e.state!==t&&kg.enqueueReplaceState(e,e.state,null)}function cb(t,e,r,n){var s=t.stateNode;s.props=r,s.state=t.memoizedState,s.refs={},T0(t);var o=e.contextType;typeof o=="object"&&o!==null?s.context=vs(o):(o=Fn(e)?Qa:pn.current,s.context=Bc(t,o)),s.state=t.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&(lb(t,e,o,r),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&kg.enqueueReplaceState(s,s.state,null),lp(t,r,s,n),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function Hc(t,e){try{var r="",n=e;do r+=j$(n),n=n.return;while(n);var s=r}catch(o){s=`
39Error generating stack: `+o.message+`
40`+o.stack}return{value:t,source:e,stack:s,digest:null}}function gx(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function ub(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var QD=typeof WeakMap=="function"?WeakMap:Map;function TE(t,e,r){r=Li(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){fp||(fp=!0,bb=n),ub(t,e)},r}function AE(t,e,r){r=Li(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var s=e.value;r.payload=function(){return n(s)},r.callback=function(){ub(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(r.callback=function(){ub(t,e),typeof n!="function"&&(Uo===null?Uo=new Set([this]):Uo.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function Fj(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new QD;var s=new Set;n.set(e,s)}else s=n.get(e),s===void 0&&(s=new Set,n.set(e,s));s.has(r)||(s.add(r),t=uF.bind(null,t,e,r),e.then(t,t))}function Lj(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Bj(t,e,r,n,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=Li(-1,1),e.tag=2,zo(r,e,1))),r.lanes|=1),t)}var JD=Ji.ReactCurrentOwner,Mn=!1;function yn(t,e,r,n){e.child=t===null?oE(e,null,r,n):Uc(e,t.child,r,n)}function zj(t,e,r,n,s){r=r.render;var o=e.ref;
vendor: 9,533 bytes, line 40
40return gc(e,s),n=M0(t,e,r,n,o,s),r=$0(),t!==null&&!Mn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,qi(t,e,s)):(Jt&&r&&j0(e),e.flags|=1,yn(t,e,n,s),e.child)}function Uj(t,e,r,n,s){if(t===null){var o=r.type;return typeof o=="function"&&!q0(o)&&o.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=o,RE(t,e,o,n,s)):(t=Am(r.type,null,n,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&s)){var a=o.memoizedProps;if(r=r.compare,r=r!==null?r:Gd,r(a,n)&&t.ref===e.ref)return qi(t,e,s)}return e.flags|=1,t=Ho(o,n),t.ref=e.ref,t.return=e,e.child=t}function RE(t,e,r,n,s){if(t!==null){var o=t.memoizedProps;if(Gd(o,n)&&t.ref===e.ref)if(Mn=!1,e.pendingProps=n=o,(t.lanes&s)!==0)t.flags&131072&&(Mn=!0);else return e.lanes=t.lanes,qi(t,e,s)}return db(t,e,r,n,s)}function IE(t,e,r){var n=e.pendingProps,s=n.children,o=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ut(ac,qn),qn|=r;else{if(!(r&1073741824))return t=o!==null?o.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Ut(ac,qn),qn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=o!==null?o.baseLanes:r,Ut(ac,qn),qn|=n}else o!==null?(n=o.baseLanes|r,e.memoizedState=null):n=r,Ut(ac,qn),qn|=n;return yn(t,e,s,r),e.child}function OE(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function db(t,e,r,n,s){var o=Fn(r)?Qa:pn.current;return o=Bc(e,o),gc(e,s),r=M0(t,e,r,n,o,s),n=$0(),t!==null&&!Mn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,qi(t,e,s)):(Jt&&n&&j0(e),e.flags|=1,yn(t,e,r,s),e.child)}function Wj(t,e,r,n,s){if(Fn(r)){var o=!0;np(e)}else o=!1;if(gc(e,s),e.stateNode===null)Em(t,e),PE(e,r,n),cb(e,r,n,s),n=!0;else if(t===null){var a=e.stateNode,l=e.memoizedProps;a.props=l;var c=a.context,u=r.contextType;typeof u=="object"&&u!==null?u=vs(u):(u=Fn(r)?Qa:pn.current,u=Bc(e,u));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==n||c!==u)&&Dj(e,a,n,u),_o=!1;var m=e.memoizedState;a.state=m,lp(e,n,a,s),c=e.memoizedState,l!==n||m!==c||Dn.current||_o?(typeof d=="function"&&(lb(e,r,d,n),c=e.memoizedState),(l=_o||$j(e,r,l,n,m,c,u))?(h||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=c),a.props=n,a.state=c,a.context=u,n=l):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{a=e.stateNode,lE(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:As(e.type,l),a.props=u,h=e.pendingProps,m=a.context,c=r.contextType,typeof c=="object"&&c!==null?c=vs(c):(c=Fn(r)?Qa:pn.current,c=Bc(e,c));var f=r.getDerivedStateFromProps;(d=typeof f=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==h||m!==c)&&Dj(e,a,n,c),_o=!1,m=e.memoizedState,a.state=m,lp(e,n,a,s);var v=e.memoizedState;l!==h||m!==v||Dn.current||_o?(typeof f=="function"&&(lb(e,r,f,n),v=e.memoizedState),(u=_o||$j(e,r,u,n,m,v,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,v,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,v,c)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===t.memoizedProps&&m===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&m===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=v),a.props=n,a.state=v,a.context=c,n=u):(typeof a.componentDidUpdate!="function"||l===t.memoizedProps&&m===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&m===t.memoizedState||(e.flags|=1024),n=!1)}return hb(t,e,r,n,o,s)}function hb(t,e,r,n,s,o){OE(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return s&&Ej(e,r,!1),qi(t,e,o);n=e.stateNode,JD.current=e;var l=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=Uc(e,t.child,null,o),e.child=Uc(e,null,l,o)):yn(t,e,l,o),e.memoizedState=n.state,s&&Ej(e,r,!0),e.child}function ME(t){var e=t.stateNode;e.pendingContext?Cj(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Cj(t,e.context,!1),A0(t,e.containerInfo)}function Hj(t,e,r,n,s){return zc(),S0(s),e.flags|=256,yn(t,e,r,n),e.child}var fb={dehydrated:null,treeContext:null,retryLane:0};function mb(t){return{baseLanes:t,cachePool:null,transitions:null}}function $E(t,e,r){var n=e.pendingProps,s=rr.current,o=!1,a=(e.flags&128)!==0,l;if((l=a)||(l=t!==null&&t.memoizedState===null?!1:(s&2)!==0),l?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),Ut(rr,s&1),t===null)return ob(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=n.children,t=n.fallback,o?(n=e.mode,o=e.child,a={mode:"hidden",children:a},!(n&1)&&o!==null?(o.childLanes=0,o.pendingProps=a):o=Cg(a,n,0,null),t=Ha(t,n,r,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=mb(r),e.memoizedState=fb,t):L0(e,a));if(s=t.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return XD(t,e,a,n,l,s,r);if(o){o=n.fallback,a=e.mode,s=t.child,l=s.sibling;var c={mode:"hidden",children:n.children};return!(a&1)&&e.child!==s?(n=e.child,n.childLanes=0,n.pendingProps=c,e.deletions=null):(n=Ho(s,c),n.subtreeFlags=s.subtreeFlags&14680064),l!==null?o=Ho(l,o):(o=Ha(o,a,r,null),o.flags|=2),o.return=e,n.return=e,n.sibling=o,e.child=n,n=o,o=e.child,a=t.child.memoizedState,a=a===null?mb(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=t.childLanes&~r,e.memoizedState=fb,n}return o=t.child,t=o.sibling,n=Ho(o,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function L0(t,e){return e=Cg({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Bf(t,e,r,n){return n!==null&&S0(n),Uc(e,t.child,null,r),t=L0(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function XD(t,e,r,n,s,o,a){if(r)return e.flags&256?(e.flags&=-257,n=gx(Error(Ne(422))),Bf(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=n.fallback,s=e.mode,n=Cg({mode:"visible",children:n.children},s,0,null),o=Ha(o,s,a,null),o.flags|=2,n.return=e,o.return=e,n.sibling=o,e.child=n,e.mode&1&&Uc(e,t.child,null,a),e.child.memoizedState=mb(a),e.memoizedState=fb,o);if(!(e.mode&1))return Bf(t,e,a,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var l=n.dgst;return n=l,o=Error(Ne(419)),n=gx(o,n,void 0),Bf(t,e,a,n)}if(l=(a&t.childLanes)!==0,Mn||l){if(n=qr,n!==null){switch(a&-a){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|a)?0:s,s!==0&&s!==o.retryLane&&(o.retryLane=s,Gi(t,s),zs(n,t,s,-1))}return G0(),n=gx(Error(Ne(421))),Bf(t,e,a,n)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=dF.bind(null,t),s._reactRetry=e,null):(t=o.treeContext,Xn=Bo(s.nextSibling),es=e,Jt=!0,Fs=null,t!==null&&(ls[cs++]=$i,ls[cs++]=Di,ls[cs++]=Ja,$i=t.id,Di=t.overflow,Ja=e),e=L0(e,n.children),e.flags|=4096,e)}function Gj(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),ab(t.return,e,r)}function vx(t,e,r,n,s){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=r,o.tailMode=s)}function DE(t,e,r){var n=e.pendingProps,s=n.revealOrder,o=n.tail;if(yn(t,e,n.children,r),n=rr.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Gj(t,r,e);else if(t.tag===19)Gj(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(Ut(rr,n),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(r=e.child,s=null;r!==null;)t=r.alternate,t!==null&&cp(t)===null&&(s=r),r=r.sibling;r=s,r===null?(s=e.child,e.child=null):(s=r.sibling,r.sibling=null),vx(e,!1,s,r,o);break;case"backwards":for(r=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&cp(t)===null){e.child=s;break}t=s.sibling,s.sibling=r,r=s,s=t}vx(e,!0,r,null,o);break;case"together":vx(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Em(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}
vendor: 5,610 bytes, line 40
40function qi(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Za|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Ne(153));if(e.child!==null){for(t=e.child,r=Ho(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=Ho(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function ZD(t,e,r){switch(e.tag){case 3:ME(e),zc();break;case 5:cE(e);break;case 1:Fn(e.type)&&np(e);break;case 4:A0(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,s=e.memoizedProps.value;Ut(op,n._currentValue),n._currentValue=s;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Ut(rr,rr.current&1),e.flags|=128,null):r&e.child.childLanes?$E(t,e,r):(Ut(rr,rr.current&1),t=qi(t,e,r),t!==null?t.sibling:null);Ut(rr,rr.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return DE(t,e,r);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ut(rr,rr.current),n)break;return null;case 22:case 23:return e.lanes=0,IE(t,e,r)}return qi(t,e,r)}var FE,pb,LE,BE;FE=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};pb=function(){};LE=function(t,e,r,n){var s=t.memoizedProps;if(s!==n){t=e.stateNode,Ma(fi.current);var o=null;switch(r){case"input":s=Dy(t,s),n=Dy(t,n),o=[];break;case"select":s=ar({},s,{value:void 0}),n=ar({},n,{value:void 0}),o=[];break;case"textarea":s=By(t,s),n=By(t,n),o=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=tp)}Uy(r,n);var a;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(a in l)l.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Fd.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in n){var c=n[u];if(l=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(r||(r={}),r[a]=c[a])}else r||(o||(o=[]),o.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Fd.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&qt("scroll",t),o||l===c||(o=[])):(o=o||[]).push(u,c))}r&&(o=o||[]).push("style",r);var u=o;(e.updateQueue=u)&&(e.flags|=4)}};BE=function(t,e,r,n){r!==n&&(e.flags|=4)};function zu(t,e){if(!Jt)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function dn(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var s=t.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function eF(t,e,r){var n=e.pendingProps;switch(k0(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(e),null;case 1:return Fn(e.type)&&rp(),dn(e),null;case 3:return n=e.stateNode,Wc(),Yt(Dn),Yt(pn),I0(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Ff(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Fs!==null&&(jb(Fs),Fs=null))),pb(t,e),dn(e),null;case 5:R0(e);var s=Ma(Qd.current);if(r=e.type,t!==null&&e.stateNode!=null)LE(t,e,r,n,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(Ne(166));return dn(e),null}if(t=Ma(fi.current),Ff(e)){n=e.stateNode,r=e.type;var o=e.memoizedProps;switch(n[ai]=e,n[Kd]=o,t=(e.mode&1)!==0,r){case"dialog":qt("cancel",n),qt("close",n);break;case"iframe":case"object":case"embed":qt("load",n);break;case"video":case"audio":for(s=0;s<cd.length;s++)qt(cd[s],n);break;case"source":qt("error",n);break;case"img":case"image":case"link":qt("error",n),qt("load",n);break;case"details":qt("toggle",n);break;case"input":ej(n,o),qt("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!o.multiple},qt("invalid",n);break;case"textarea":rj(n,o),qt("invalid",n)}Uy(r,o),s=null;for(var a in o)if(o.hasOwnProperty(a)){var l=o[a];a==="children"?typeof l=="string"?n.textContent!==l&&(o.suppressHydrationWarning!==!0&&Df(n.textContent,l,t),s=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Df(n.textContent,l,t),s=["children",""+l]):Fd.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&qt("scroll",n)}switch(r){case"input":Pf(n),tj(n,o,!0);break;case"textarea":Pf(n),nj(n);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(n.onclick=tp)}n=s,e.updateQueue=n,n!==null&&(e.flags|=4)}else{a=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=mC(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>
40",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[ai]=e,t[Kd]=n,FE(t,e,!1,!1),e.stateNode=t;e:{switch(a=Wy(r,n),r){case"dialog":qt("cancel",t),qt("close",t),s=n;break;case"iframe":case"object":case"embed":qt("load",t),s=n;break;case"video":case"audio":for(s=0;s<cd.length;s++)qt(cd[s],t);s=n;break;case"source":qt("error",t),s=n;break;case"img":case"image":case"link":qt("error",t),qt("load",t),s=n;break;case"details":qt("toggle",t),s=n;break;case"input":ej(t,n),s=Dy(t,n),qt("invalid",t);break;case"option":s=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},s=ar({},n,{value:void 0}),qt("invalid",t);break;case"textarea":rj(t,n),s=By(t,n),qt("invalid",t);break;default:s=n}Uy(r,s),l=s;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?vC(t,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&pC(t,c)):o==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Ld(t,c):typeof c=="number"&&Ld(t,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Fd.hasOwnProperty(o)?c!=null&&o==="onScroll"&&qt("scroll",t):c!=null&&c0(t,o,c,a))}switch(r){case"input":Pf(t),tj(t,n,!1);break;case"textarea":Pf(t),nj(t);break;case"option":n.value!=null&&t.setAttribute("value",""+Xo(n.value));break;case"select":t.multiple=!!n.multiple,o=n.value,o!=null?hc(t,!!n.multiple,o,!1):n.defaultValue!=null&&hc(t,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=tp)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return dn(e),null;case 6:if(t&&e.stateNode!=null)BE(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(Ne(166));if(r=Ma(Qd.current),Ma(fi.current),Ff(e)){if(n=e.stateNode,r=e.memoizedProps,n[ai]=e,(o=n.nodeValue!==r)&&(t=es,t!==null))switch(t.tag){case 3:Df(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Df(n.nodeValue,r,(t.mode&1)!==0)}o&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[ai]=e,e.stateNode=n}return dn(e),null;case 13:if(Yt(rr),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Jt&&Xn!==null&&e.mode&1&&!(e.flags&128))sE(),zc(),e.flags|=98560,o=!1;else if(o=Ff(e),n!==null&&n.dehydrated!==null){if(t===null){if(!o)throw Error(Ne(318));if(o=e.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(Ne(317));o[ai]=e}else zc(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;dn(e),o=!1}else Fs!==null&&(jb(Fs),Fs=null),o=!0;if(!o)return e.flags&65536?e:null}return e.flags&128?(e.lanes=r,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,e.mode&1&&(t===null||rr.current&1?Fr===0&&(Fr=3):G0())),e.updateQueue!==null&&(e.flags|=4),dn(e),null);case 4:return Wc(),pb(t,e),t===null&&qd(e.stateNode.containerInfo),dn(e),null;case 10:return E0(e.type._context),dn(e),null;case 17:return Fn(e.type)&&rp(),dn(e),null;case 19:if(Yt(rr),o=e.memoizedState,o===null)return dn(e),null;if(n=(e.flags&128)!==0,a=o.rendering,a===null)if(n)zu(o,!1);else{if(Fr!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(a=cp(t),a!==null){for(e.flags|=128,zu(o,!1),n=a.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=r,r=e.child;r!==null;)o=r,t=n,o.flags&=14680066,a=o.alternate,a===null?(o.childLanes=0,o.lanes=t,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,t=a.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return Ut(rr,rr.current&1|2),e.child}t=t.sibling}o.tail!==null&&xr()>Gc&&(e.flags|=128,n=!0,zu(o,!1),e.lanes=4194304)}else{if(!n)if(t=cp(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),zu(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!Jt)return dn(e),null}else 2*xr()-o.renderingStartTime>Gc&&r!==1073741824&&(e.flags|=128,n=!0,zu(o,!1),e.lanes=4194304);o.isBackwards?(a.sibling=e.child,e.child=a):(r=o.last,r!==null?r.sibling=a:e.child=a,o.last=a)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=xr(),e.sibling=null,r=rr.current,Ut(rr,n?r&1|2:r&1),e):(dn(e),null);case 22:case 23:return H0(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?qn&1073741824&&(dn(e),e.subtreeFlags&6&&(e.flags|=8192)):dn(e),null;case 24:return null;case 25:return null}throw Error(Ne(156,e.tag))}function tF(t,e){switch(k0(e),e.tag){case 1:return Fn(e.type)&&rp(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;
vendor: 27,343 bytes, line 40
40case 3:return Wc(),Yt(Dn),Yt(pn),I0(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return R0(e),null;case 13:if(Yt(rr),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Ne(340));zc()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Yt(rr),null;case 4:return Wc(),null;case 10:return E0(e.type._context),null;case 22:case 23:return H0(),null;case 24:return null;default:return null}}var zf=!1,mn=!1,rF=typeof WeakSet=="function"?WeakSet:Set,Be=null;function oc(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){hr(t,e,n)}else r.current=null}function gb(t,e,r){try{r()}catch(n){hr(t,e,n)}}var qj=!1;function nF(t,e){if(Zy=Xm,t=GC(),_0(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var a=0,l=-1,c=-1,u=0,d=0,h=t,m=null;t:for(;;){for(var f;h!==r||s!==0&&h.nodeType!==3||(l=a+s),h!==o||n!==0&&h.nodeType!==3||(c=a+n),h.nodeType===3&&(a+=h.nodeValue.length),(f=h.firstChild)!==null;)m=h,h=f;for(;;){if(h===t)break t;if(m===r&&++u===s&&(l=a),m===o&&++d===n&&(c=a),(f=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=f}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(eb={focusedElem:t,selectionRange:r},Xm=!1,Be=e;Be!==null;)if(e=Be,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Be=t;else for(;Be!==null;){e=Be;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var p=v.memoizedProps,b=v.memoizedState,x=e.stateNode,y=x.getSnapshotBeforeUpdate(e.elementType===e.type?p:As(e.type,p),b);x.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ne(163))}}catch(j){hr(e,e.return,j)}if(t=e.sibling,t!==null){t.return=e.return,Be=t;break}Be=e.return}return v=qj,qj=!1,v}function Ed(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&t)===t){var o=s.destroy;s.destroy=void 0,o!==void 0&&gb(e,r,o)}s=s.next}while(s!==n)}}function Sg(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function vb(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function zE(t){var e=t.alternate;e!==null&&(t.alternate=null,zE(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ai],delete e[Kd],delete e[nb],delete e[LD],delete e[BD])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function UE(t){return t.tag===5||t.tag===3||t.tag===4}function Vj(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||UE(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function xb(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=tp));else if(n!==4&&(t=t.child,t!==null))for(xb(t,e,r),t=t.sibling;t!==null;)xb(t,e,r),t=t.sibling}function yb(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(yb(t,e,r),t=t.sibling;t!==null;)yb(t,e,r),t=t.sibling}var Jr=null,$s=!1;function uo(t,e,r){for(r=r.child;r!==null;)WE(t,e,r),r=r.sibling}function WE(t,e,r){if(hi&&typeof hi.onCommitFiberUnmount=="function")try{hi.onCommitFiberUnmount(vg,r)}catch{}switch(r.tag){case 5:mn||oc(r,e);case 6:var n=Jr,s=$s;Jr=null,uo(t,e,r),Jr=n,$s=s,Jr!==null&&($s?(t=Jr,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Jr.removeChild(r.stateNode));break;case 18:Jr!==null&&($s?(t=Jr,r=r.stateNode,t.nodeType===8?ux(t.parentNode,r):t.nodeType===1&&ux(t,r),Wd(t)):ux(Jr,r.stateNode));break;case 4:n=Jr,s=$s,Jr=r.stateNode.containerInfo,$s=!0,uo(t,e,r),Jr=n,$s=s;break;case 0:case 11:case 14:case 15:if(!mn&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var o=s,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&gb(r,e,a),s=s.next}while(s!==n)}uo(t,e,r);break;case 1:if(!mn&&(oc(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){hr(r,e,l)}uo(t,e,r);break;case 21:uo(t,e,r);break;case 22:r.mode&1?(mn=(n=mn)||r.memoizedState!==null,uo(t,e,r),mn=n):uo(t,e,r);break;default:uo(t,e,r)}}function Kj(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new rF),e.forEach(function(n){var s=hF.bind(null,t,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Ns(t,e){var r=e.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var o=t,a=e,l=a;e:for(;l!==null;){switch(l.tag){case 5:Jr=l.stateNode,$s=!1;break e;case 3:Jr=l.stateNode.containerInfo,$s=!0;break e;case 4:Jr=l.stateNode.containerInfo,$s=!0;break e}l=l.return}if(Jr===null)throw Error(Ne(160));WE(o,a,s),Jr=null,$s=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){hr(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)HE(e,t),e=e.sibling}function HE(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Ns(e,t),ri(t),n&4){try{Ed(3,t,t.return),Sg(3,t)}catch(p){hr(t,t.return,p)}try{Ed(5,t,t.return)}catch(p){hr(t,t.return,p)}}break;case 1:Ns(e,t),ri(t),n&512&&r!==null&&oc(r,r.return);break;case 5:if(Ns(e,t),ri(t),n&512&&r!==null&&oc(r,r.return),t.flags&32){var s=t.stateNode;try{Ld(s,"")}catch(p){hr(t,t.return,p)}}if(n&4&&(s=t.stateNode,s!=null)){var o=t.memoizedProps,a=r!==null?r.memoizedProps:o,l=t.type,c=t.updateQueue;if(t.updateQueue=null,c!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&hC(s,o),Wy(l,a);var u=Wy(l,o);for(a=0;a<c.length;a+=2){var d=c[a],h=c[a+1];d==="style"?vC(s,h):d==="dangerouslySetInnerHTML"?pC(s,h):d==="children"?Ld(s,h):c0(s,d,h,u)}switch(l){case"input":Fy(s,o);break;case"textarea":fC(s,o);break;case"select":var m=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var f=o.value;f!=null?hc(s,!!o.multiple,f,!1):m!==!!o.multiple&&(o.defaultValue!=null?hc(s,!!o.multiple,o.defaultValue,!0):hc(s,!!o.multiple,o.multiple?[]:"",!1))}s[Kd]=o}catch(p){hr(t,t.return,p)}}break;case 6:if(Ns(e,t),ri(t),n&4){if(t.stateNode===null)throw Error(Ne(162));s=t.stateNode,o=t.memoizedProps;try{s.nodeValue=o}catch(p){hr(t,t.return,p)}}break;case 3:if(Ns(e,t),ri(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Wd(e.containerInfo)}catch(p){hr(t,t.return,p)}break;case 4:Ns(e,t),ri(t);break;case 13:Ns(e,t),ri(t),s=t.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(U0=xr())),n&4&&Kj(t);break;case 22:if(d=r!==null&&r.memoizedState!==null,t.mode&1?(mn=(u=mn)||d,Ns(e,t),mn=u):Ns(e,t),ri(t),n&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(Be=t,d=t.child;d!==null;){for(h=Be=d;Be!==null;){switch(m=Be,f=m.child,m.tag){case 0:case 11:case 14:case 15:Ed(4,m,m.return);break;case 1:oc(m,m.return);var v=m.stateNode;if(typeof v.componentWillUnmount=="function"){n=m,r=m.return;try{e=n,v.props=e.memoizedProps,v.state=e.memoizedState,v.componentWillUnmount()}catch(p){hr(n,r,p)}}break;case 5:oc(m,m.return);break;case 22:if(m.memoizedState!==null){Qj(h);continue}}f!==null?(f.return=m,Be=f):Qj(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=h.stateNode,c=h.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=gC("display",a))}catch(p){hr(t,t.return,p)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(p){hr(t,t.return,p)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Ns(e,t),ri(t),n&4&&Kj(t);break;case 21:break;default:Ns(e,t),ri(t)}}function ri(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(UE(r)){var n=r;break e}r=r.return}throw Error(Ne(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Ld(s,""),n.flags&=-33);var o=Vj(t);yb(t,o,s);break;case 3:case 4:var a=n.stateNode.containerInfo,l=Vj(t);xb(t,l,a);break;default:throw Error(Ne(161))}}catch(c){hr(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function sF(t,e,r){Be=t,GE(t)}function GE(t,e,r){for(var n=(t.mode&1)!==0;Be!==null;){var s=Be,o=s.child;if(s.tag===22&&n){var a=s.memoizedState!==null||zf;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||mn;l=zf;var u=mn;if(zf=a,(mn=c)&&!u)for(Be=s;Be!==null;)a=Be,c=a.child,a.tag===22&&a.memoizedState!==null?Jj(s):c!==null?(c.return=a,Be=c):Jj(s);for(;o!==null;)Be=o,GE(o),o=o.sibling;Be=s,zf=l,mn=u}Yj(t)}else s.subtreeFlags&8772&&o!==null?(o.return=s,Be=o):Yj(t)}}function Yj(t){for(;Be!==null;){var e=Be;if(e.flags&8772){var r=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:mn||Sg(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!mn)if(r===null)n.componentDidMount();else{var s=e.elementType===e.type?r.memoizedProps:As(e.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var o=e.updateQueue;o!==null&&Ij(e,o,n);break;case 3:var a=e.updateQueue;if(a!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}Ij(e,a,r)}break;case 5:var l=e.stateNode;if(r===null&&e.flags&4){r=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Wd(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ne(163))}mn||e.flags&512&&vb(e)}catch(m){hr(e,e.return,m)}}if(e===t){Be=null;break}if(r=e.sibling,r!==null){r.return=e.return,Be=r;break}Be=e.return}}function Qj(t){for(;Be!==null;){var e=Be;if(e===t){Be=null;break}var r=e.sibling;if(r!==null){r.return=e.return,Be=r;break}Be=e.return}}function Jj(t){for(;Be!==null;){var e=Be;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{Sg(4,e)}catch(c){hr(e,r,c)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var s=e.return;try{n.componentDidMount()}catch(c){hr(e,s,c)}}var o=e.return;try{vb(e)}catch(c){hr(e,o,c)}break;case 5:var a=e.return;try{vb(e)}catch(c){hr(e,a,c)}}}catch(c){hr(e,e.return,c)}if(e===t){Be=null;break}var l=e.sibling;if(l!==null){l.return=e.return,Be=l;break}Be=e.return}}var iF=Math.ceil,hp=Ji.ReactCurrentDispatcher,B0=Ji.ReactCurrentOwner,fs=Ji.ReactCurrentBatchConfig,wt=0,qr=null,Er=null,en=0,qn=0,ac=la(0),Fr=0,eh=null,Za=0,Ng=0,z0=0,Pd=null,Rn=null,U0=0,Gc=1/0,Ci=null,fp=!1,bb=null,Uo=null,Uf=!1,Oo=null,mp=0,Td=0,wb=null,Pm=-1,Tm=0;function _n(){return wt&6?xr():Pm!==-1?Pm:Pm=xr()}function Wo(t){return t.mode&1?wt&2&&en!==0?en&-en:UD.transition!==null?(Tm===0&&(Tm=PC()),Tm):(t=Mt,t!==0||(t=window.event,t=t===void 0?16:$C(t.type)),t):1}function zs(t,e,r,n){if(50<Td)throw Td=0,wb=null,Error(Ne(185));Lh(t,r,n),(!(wt&2)||t!==qr)&&(t===qr&&(!(wt&2)&&(Ng|=r),Fr===4&&So(t,en)),Ln(t,n),r===1&&wt===0&&!(e.mode&1)&&(Gc=xr()+500,_g&&ca()))}function Ln(t,e){var r=t.callbackNode;U$(t,e);var n=Jm(t,t===qr?en:0);if(n===0)r!==null&&oj(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&oj(r),e===1)t.tag===0?zD(Xj.bind(null,t)):tE(Xj.bind(null,t)),DD(function(){!(wt&6)&&ca()}),r=null;else{switch(TC(n)){case 1:r=m0;break;case 4:r=CC;break;case 16:r=Qm;break;case 536870912:r=EC;break;default:r=Qm}r=ZE(r,qE.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function qE(t,e){if(Pm=-1,Tm=0,wt&6)throw Error(Ne(327));var r=t.callbackNode;if(vc()&&t.callbackNode!==r)return null;var n=Jm(t,t===qr?en:0);if(n===0)return null;if(n&30||n&t.expiredLanes||e)e=pp(t,n);else{e=n;var s=wt;wt|=2;var o=KE();(qr!==t||en!==e)&&(Ci=null,Gc=xr()+500,Wa(t,e));do try{lF();break}catch(l){VE(t,l)}while(!0);C0(),hp.current=o,wt=s,Er!==null?e=0:(qr=null,en=0,e=Fr)}if(e!==0){if(e===2&&(s=Ky(t),s!==0&&(n=s,e=_b(t,s))),e===1)throw r=eh,Wa(t,0),So(t,n),Ln(t,xr()),r;if(e===6)So(t,n);else{if(s=t.current.alternate,!(n&30)&&!oF(s)&&(e=pp(t,n),e===2&&(o=Ky(t),o!==0&&(n=o,e=_b(t,o))),e===1))throw r=eh,Wa(t,0),So(t,n),Ln(t,xr()),r;switch(t.finishedWork=s,t.finishedLanes=n,e){case 0:case 1:throw Error(Ne(345));case 2:Sa(t,Rn,Ci);break;case 3:if(So(t,n),(n&130023424)===n&&(e=U0+500-xr(),10<e)){if(Jm(t,0)!==0)break;if(s=t.suspendedLanes,(s&n)!==n){_n(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=rb(Sa.bind(null,t,Rn,Ci),e);break}Sa(t,Rn,Ci);break;case 4:if(So(t,n),(n&4194240)===n)break;for(e=t.eventTimes,s=-1;0<n;){var a=31-Bs(n);o=1<<a,a=e[a],a>s&&(s=a),n&=~o}if(n=s,n=xr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*iF(n/1960))-n,10<n){t.timeoutHandle=rb(Sa.bind(null,t,Rn,Ci),n);break}Sa(t,Rn,Ci);break;case 5:Sa(t,Rn,Ci);break;default:throw Error(Ne(329))}}}return Ln(t,xr()),t.callbackNode===r?qE.bind(null,t):null}function _b(t,e){var r=Pd;return t.current.memoizedState.isDehydrated&&(Wa(t,e).flags|=256),t=pp(t,e),t!==2&&(e=Rn,Rn=r,e!==null&&jb(e)),t}function jb(t){Rn===null?Rn=t:Rn.push.apply(Rn,t)}function oF(t){for(var e=t;;){if(e.flags&16384){var r=e.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],o=s.getSnapshot;s=s.value;try{if(!Ws(o(),s))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function So(t,e){for(e&=~z0,e&=~Ng,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-Bs(e),n=1<<r;t[r]=-1,e&=~n}}function Xj(t){if(wt&6)throw Error(Ne(327));vc();var e=Jm(t,0);if(!(e&1))return Ln(t,xr()),null;var r=pp(t,e);if(t.tag!==0&&r===2){var n=Ky(t);n!==0&&(e=n,r=_b(t,n))}if(r===1)throw r=eh,Wa(t,0),So(t,e),Ln(t,xr()),r;if(r===6)throw Error(Ne(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Sa(t,Rn,Ci),Ln(t,xr()),null}function W0(t,e){var r=wt;wt|=1;try{return t(e)}finally{wt=r,wt===0&&(Gc=xr()+500,_g&&ca())}}function el(t){Oo!==null&&Oo.tag===0&&!(wt&6)&&vc();var e=wt;wt|=1;var r=fs.transition,n=Mt;try{if(fs.transition=null,Mt=1,t)return t()}finally{Mt=n,fs.transition=r,wt=e,!(wt&6)&&ca()}}function H0(){qn=ac.current,Yt(ac)}function Wa(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,$D(r)),Er!==null)for(r=Er.return;r!==null;){var n=r;switch(k0(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&rp();break;case 3:Wc(),Yt(Dn),Yt(pn),I0();break;case 5:R0(n);break;case 4:Wc();break;case 13:Yt(rr);break;case 19:Yt(rr);break;case 10:E0(n.type._context);break;case 22:case 23:H0()}r=r.return}if(qr=t,Er=t=Ho(t.current,null),en=qn=e,Fr=0,eh=null,z0=Ng=Za=0,Rn=Pd=null,Oa!==null){for(e=0;e<Oa.length;e++)if(r=Oa[e],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,o=r.pending;if(o!==null){var a=o.next;o.next=s,n.next=a}r.pending=n}Oa=null}return t}function VE(t,e){do{var r=Er;try{if(C0(),Nm.current=dp,up){for(var n=or.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}up=!1}if(Xa=0,Wr=Or=or=null,Cd=!1,Jd=0,B0.current=null,r===null||r.return===null){Fr=1,eh=e,Er=null;break}e:{var o=t,a=r.return,l=r,c=e;if(e=en,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var m=d.alternate;m?(d.updateQueue=m.updateQueue,d.memoizedState=m.memoizedState,d.lanes=m.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=Lj(a);if(f!==null){f.flags&=-257,Bj(f,a,l,o,e),f.mode&1&&Fj(o,u,e),e=f,c=u;var v=e.updateQueue;if(v===null){var p=new Set;p.add(c),e.updateQueue=p}else v.add(c);break e}else{if(!(e&1)){Fj(o,u,e),G0();break e}c=Error(Ne(426))}}else if(Jt&&l.mode&1){var b=Lj(a);if(b!==null){!(b.flags&65536)&&(b.flags|=256),Bj(b,a,l,o,e),S0(Hc(c,l));break e}}o=c=Hc(c,l),Fr!==4&&(Fr=2),Pd===null?Pd=[o]:Pd.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,e&=-e,o.lanes|=e;var x=TE(o,c,e);Rj(o,x);break e;case 1:l=c;var y=o.type,w=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Uo===null||!Uo.has(w)))){o.flags|=65536,e&=-e,o.lanes|=e;var j=AE(o,l,e);Rj(o,j);break e}}o=o.return}while(o!==null)}QE(r)}catch(_){e=_,Er===r&&r!==null&&(Er=r=r.return);continue}break}while(!0)}function KE(){var t=hp.current;return hp.current=dp,t===null?dp:t}function G0(){(Fr===0||Fr===3||Fr===2)&&(Fr=4),qr===null||!(Za&268435455)&&!(Ng&268435455)||So(qr,en)}function pp(t,e){var r=wt;wt|=2;var n=KE();(qr!==t||en!==e)&&(Ci=null,Wa(t,e));do try{aF();break}catch(s){VE(t,s)}while(!0);if(C0(),wt=r,hp.current=n,Er!==null)throw Error(Ne(261));return qr=null,en=0,Fr}function aF(){for(;Er!==null;)YE(Er)}function lF(){for(;Er!==null&&!I$();)YE(Er)}function YE(t){var e=XE(t.alternate,t,qn);t.memoizedProps=t.pendingProps,e===null?QE(t):Er=e,B0.current=null}function QE(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=tF(r,e),r!==null){r.flags&=32767,Er=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Fr=6,Er=null;return}}else if(r=eF(r,e,qn),r!==null){Er=r;return}if(e=e.sibling,e!==null){Er=e;return}Er=e=t}while(e!==null);Fr===0&&(Fr=5)}function Sa(t,e,r){var n=Mt,s=fs.transition;try{fs.transition=null,Mt=1,cF(t,e,r,n)}finally{fs.transition=s,Mt=n}return null}function cF(t,e,r,n){do vc();while(Oo!==null);if(wt&6)throw Error(Ne(327));r=t.finishedWork;var s=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(Ne(177));t.callbackNode=null,t.callbackPriority=0;var o=r.lanes|r.childLanes;if(W$(t,o),t===qr&&(Er=qr=null,en=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Uf||(Uf=!0,ZE(Qm,function(){return vc(),null})),o=(r.flags&15990)!==0,r.subtreeFlags&15990||o){o=fs.transition,fs.transition=null;var a=Mt;Mt=1;var l=wt;wt|=4,B0.current=null,nF(t,r),HE(r,t),PD(eb),Xm=!!Zy,eb=Zy=null,t.current=r,sF(r),O$(),wt=l,Mt=a,fs.transition=o}else t.current=r;if(Uf&&(Uf=!1,Oo=t,mp=s),o=t.pendingLanes,o===0&&(Uo=null),D$(r.stateNode),Ln(t,xr()),e!==null)for(n=t.onRecoverableError,r=0;r<e.length;r++)s=e[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(fp)throw fp=!1,t=bb,bb=null,t;return mp&1&&t.tag!==0&&vc(),o=t.pendingLanes,o&1?t===wb?Td++:(Td=0,wb=t):Td=0,ca(),null}function vc(){if(Oo!==null){var t=TC(mp),e=fs.transition,r=Mt;try{if(fs.transition=null,Mt=16>t?16:t,Oo===null)var n=!1;else{if(t=Oo,Oo=null,mp=0,wt&6)throw Error(Ne(331));var s=wt;for(wt|=4,Be=t.current;Be!==null;){var o=Be,a=o.child;if(Be.flags&16){var l=o.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Be=u;Be!==null;){var d=Be;switch(d.tag){case 0:case 11:case 15:Ed(8,d,o)}var h=d.child;if(h!==null)h.return=d,Be=h;else for(;Be!==null;){d=Be;var m=d.sibling,f=d.return;if(zE(d),d===u){Be=null;break}if(m!==null){m.return=f,Be=m;break}Be=f}}}var v=o.alternate;if(v!==null){var p=v.child;if(p!==null){v.child=null;do{var b=p.sibling;p.sibling=null,p=b}while(p!==null)}}Be=o}}if(o.subtreeFlags&2064&&a!==null)a.return=o,Be=a;else e:for(;Be!==null;){if(o=Be,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Ed(9,o,o.return)}var x=o.sibling;if(x!==null){x.return=o.return,Be=x;break e}Be=o.return}}var y=t.current;for(Be=y;Be!==null;){a=Be;var w=a.child;if(a.subtreeFlags&2064&&w!==null)w.return=a,Be=w;else e:for(a=y;Be!==null;){if(l=Be,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Sg(9,l)}}catch(_){hr(l,l.return,_)}if(l===a){Be=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,Be=j;break e}Be=l.return}}if(wt=s,ca(),hi&&typeof hi.onPostCommitFiberRoot=="function")try{hi.onPostCommitFiberRoot(vg,t)}catch{}n=!0}return n}finally{Mt=r,fs.transition=e}}return!1}function Zj(t,e,r){e=Hc(r,e),e=TE(t,e,1),t=zo(t,e,1),e=_n(),t!==null&&(Lh(t,1,e),Ln(t,e))}function hr(t,e,r){if(t.tag===3)Zj(t,t,r);else for(;e!==null;){if(e.tag===3){Zj(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Uo===null||!Uo.has(n))){t=Hc(r,t),t=AE(e,t,1),e=zo(e,t,1),t=_n(),e!==null&&(Lh(e,1,t),Ln(e,t));break}}e=e.return}}function uF(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=_n(),t.pingedLanes|=t.suspendedLanes&r,qr===t&&(en&r)===r&&(Fr===4||Fr===3&&(en&130023424)===en&&500>xr()-U0?Wa(t,0):z0|=r),Ln(t,e)}function JE(t,e){e===0&&(t.mode&1?(e=Rf,Rf<<=1,!(Rf&130023424)&&(Rf=4194304)):e=1);var r=_n();t=Gi(t,e),t!==null&&(Lh(t,e,r),Ln(t,r))}function dF(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),JE(t,r)}function hF(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,s=t.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(Ne(314))}n!==null&&n.delete(e),JE(t,r)}var XE;XE=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Dn.current)Mn=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Mn=!1,ZD(t,e,r);Mn=!!(t.flags&131072)}else Mn=!1,Jt&&e.flags&1048576&&rE(e,ip,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Em(t,e),t=e.pendingProps;var s=Bc(e,pn.current);gc(e,r),s=M0(null,e,n,t,s,r);var o=$0();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Fn(n)?(o=!0,np(e)):o=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,T0(e),s.updater=kg,e.stateNode=s,s._reactInternals=e,cb(e,n,t,r),e=hb(null,e,n,!0,o,r)):(e.tag=0,Jt&&o&&j0(e),yn(null,e,s,r),e=e.child),e;case 16:n=e.elementType;e:{switch(Em(t,e),t=e.pendingProps,s=n._init,n=s(n._payload),e.type=n,s=e.tag=mF(n),t=As(n,t),s){case 0:e=db(null,e,n,t,r);break e;case 1:e=Wj(null,e,n,t,r);break e;case 11:e=zj(null,e,n,t,r);break e;case 14:e=Uj(null,e,n,As(n.type,t),r);break e}throw Error(Ne(306,n,""))}return e;case 0:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:As(n,s),db(t,e,n,s,r);case 1:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:As(n,s),Wj(t,e,n,s,r);case 3:e:{if(ME(e),t===null)throw Error(Ne(387));n=e.pendingProps,o=e.memoizedState,s=o.element,lE(t,e),lp(e,n,null,r);var a=e.memoizedState;if(n=a.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){s=Hc(Error(Ne(423)),e),e=Hj(t,e,n,r,s);break e}else if(n!==s){s=Hc(Error(Ne(424)),e),e=Hj(t,e,n,r,s);break e}else for(Xn=Bo(e.stateNode.containerInfo.firstChild),es=e,Jt=!0,Fs=null,r=oE(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(zc(),n===s){e=qi(t,e,r);break e}yn(t,e,n,r)}e=e.child}return e;case 5:return cE(e),t===null&&ob(e),n=e.type,s=e.pendingProps,o=t!==null?t.memoizedProps:null,a=s.children,tb(n,s)?a=null:o!==null&&tb(n,o)&&(e.flags|=32),OE(t,e),yn(t,e,a,r),e.child;case 6:return t===null&&ob(e),null;case 13:return $E(t,e,r);case 4:return A0(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Uc(e,null,n,r):yn(t,e,n,r),e.child;case 11:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:As(n,s),zj(t,e,n,s,r);case 7:return yn(t,e,e.pendingProps,r),e.child;case 8:return yn(t,e,e.pendingProps.children,r),e.child;case 12:return yn(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,s=e.pendingProps,o=e.memoizedProps,a=s.value,Ut(op,n._currentValue),n._currentValue=a,o!==null)if(Ws(o.value,a)){if(o.children===s.children&&!Dn.current){e=qi(t,e,r);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){a=o.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(o.tag===1){c=Li(-1,r&-r),c.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}o.lanes|=r,c=o.alternate,c!==null&&(c.lanes|=r),ab(o.return,r,e),l.lanes|=r;break}c=c.next}}else if(o.tag===10)a=o.type===e.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(Ne(341));a.lanes|=r,l=a.alternate,l!==null&&(l.lanes|=r),ab(a,r,e),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===e){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}yn(t,e,s.children,r),e=e.child}return e;case 9:return s=e.type,n=e.pendingProps.children,gc(e,r),s=vs(s),n=n(s),e.flags|=1,yn(t,e,n,r),e.child;case 14:return n=e.type,s=As(n,e.pendingProps),s=As(n.type,s),Uj(t,e,n,s,r);case 15:return RE(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:As(n,s),Em(t,e),e.tag=1,Fn(n)?(t=!0,np(e)):t=!1,gc(e,r),PE(e,n,s),cb(e,n,s,r),hb(null,e,n,!0,t,r);case 19:return DE(t,e,r);case 22:return IE(t,e,r)}throw Error(Ne(156,e.tag))};function ZE(t,e){return NC(t,e)}function fF(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ds(t,e,r,n){return new fF(t,e,r,n)}function q0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function mF(t){if(typeof t=="function")return q0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===d0)return 11;if(t===h0)return 14}return 2}function Ho(t,e){var r=t.alternate;return r===null?(r=ds(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Am(t,e,r,n,s,o){var a=2;if(n=t,typeof t=="function")q0(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case Jl:return Ha(r.children,s,o,e);case u0:a=8,s|=8;break;case Iy:return t=ds(12,r,e,s|2),t.elementType=Iy,t.lanes=o,t;
vendor: 4,230 bytes, line 40
40case Oy:return t=ds(13,r,e,s),t.elementType=Oy,t.lanes=o,t;case My:return t=ds(19,r,e,s),t.elementType=My,t.lanes=o,t;case cC:return Cg(r,s,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case aC:a=10;break e;case lC:a=9;break e;case d0:a=11;break e;case h0:a=14;break e;case wo:a=16,n=null;break e}throw Error(Ne(130,t==null?t:typeof t,""))}return e=ds(a,r,e,s),e.elementType=t,e.type=n,e.lanes=o,e}function Ha(t,e,r,n){return t=ds(7,t,n,e),t.lanes=r,t}function Cg(t,e,r,n){return t=ds(22,t,n,e),t.elementType=cC,t.lanes=r,t.stateNode={isHidden:!1},t}function xx(t,e,r){return t=ds(6,t,null,e),t.lanes=r,t}function yx(t,e,r){return e=ds(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function pF(t,e,r,n,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Zv(0),this.expirationTimes=Zv(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zv(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function V0(t,e,r,n,s,o,a,l,c){return t=new pF(t,e,r,l,c),e===1?(e=1,o===!0&&(e|=8)):e=0,o=ds(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},T0(o),t}function gF(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ql,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function eP(t){if(!t)return Zo;t=t._reactInternals;e:{if(fl(t)!==t||t.tag!==1)throw Error(Ne(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Fn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Ne(171))}if(t.tag===1){var r=t.type;if(Fn(r))return eE(t,r,e)}return e}function tP(t,e,r,n,s,o,a,l,c){return t=V0(r,n,!0,t,s,o,a,l,c),t.context=eP(null),r=t.current,n=_n(),s=Wo(r),o=Li(n,s),o.callback=e??null,zo(r,o,s),t.current.lanes=s,Lh(t,s,n),Ln(t,n),t}function Eg(t,e,r,n){var s=e.current,o=_n(),a=Wo(s);return r=eP(r),e.context===null?e.context=r:e.pendingContext=r,e=Li(o,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=zo(s,e,a),t!==null&&(zs(t,s,a,o),Sm(t,s,a)),a}function gp(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function ek(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function K0(t,e){ek(t,e),(t=t.alternate)&&ek(t,e)}function vF(){return null}var rP=typeof reportError=="function"?reportError:function(t){console.error(t)};function Y0(t){this._internalRoot=t}Pg.prototype.render=Y0.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Ne(409));Eg(t,e,null,null)};Pg.prototype.unmount=Y0.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;el(function(){Eg(null,t,null,null)}),e[Hi]=null}};function Pg(t){this._internalRoot=t}Pg.prototype.unstable_scheduleHydration=function(t){if(t){var e=IC();t={blockedOn:null,target:t,priority:e};for(var r=0;r<ko.length&&e!==0&&e<ko[r].priority;r++);ko.splice(r,0,t),r===0&&MC(t)}};function Q0(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Tg(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function tk(){}function xF(t,e,r,n,s){if(s){if(typeof n=="function"){var o=n;n=function(){var u=gp(a);o.call(u)}}var a=tP(e,n,t,0,null,!1,!1,"",tk);return t._reactRootContainer=a,t[Hi]=a.current,qd(t.nodeType===8?t.parentNode:t),el(),a}for(;s=t.lastChild;)t.removeChild(s);if(typeof n=="function"){var l=n;n=function(){var u=gp(c);l.call(u)}}var c=V0(t,0,!1,null,null,!1,!1,"",tk);return t._reactRootContainer=c,t[Hi]=c.current,qd(t.nodeType===8?t.parentNode:t),el(function(){Eg(e,c,r,n
vendor: 4,915 bytes, line 40
40)}),c}function Ag(t,e,r,n,s){var o=r._reactRootContainer;if(o){var a=o;if(typeof s=="function"){var l=s;s=function(){var c=gp(a);l.call(c)}}Eg(e,a,t,s)}else a=xF(r,e,t,s,n);return gp(a)}AC=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=ld(e.pendingLanes);r!==0&&(p0(e,r|1),Ln(e,xr()),!(wt&6)&&(Gc=xr()+500,ca()))}break;case 13:el(function(){var n=Gi(t,1);if(n!==null){var s=_n();zs(n,t,1,s)}}),K0(t,1)}};g0=function(t){if(t.tag===13){var e=Gi(t,134217728);if(e!==null){var r=_n();zs(e,t,134217728,r)}K0(t,134217728)}};RC=function(t){if(t.tag===13){var e=Wo(t),r=Gi(t,e);if(r!==null){var n=_n();zs(r,t,e,n)}K0(t,e)}};IC=function(){return Mt};OC=function(t,e){var r=Mt;try{return Mt=t,e()}finally{Mt=r}};Gy=function(t,e,r){switch(e){case"input":if(Fy(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var n=r[e];if(n!==t&&n.form===t.form){var s=wg(n);if(!s)throw Error(Ne(90));dC(n),Fy(n,s)}}}break;case"textarea":fC(t,r);break;case"select":e=r.value,e!=null&&hc(t,!!r.multiple,e,!1)}};bC=W0;wC=el;var yF={usingClientEntryPoint:!1,Events:[zh,tc,wg,xC,yC,W0]},Uu={findFiberByHostInstance:Ia,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},bF={bundleType:Uu.bundleType,version:Uu.version,rendererPackageName:Uu.rendererPackageName,rendererConfig:Uu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ji.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=kC(t),t===null?null:t.stateNode},findFiberByHostInstance:Uu.findFiberByHostInstance||vF,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wf.isDisabled&&Wf.supportsFiber)try{vg=Wf.inject(bF),hi=Wf}catch{}}ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yF;ns.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Q0(e))throw Error(Ne(200));return gF(t,e,null,r)};ns.createRoot=function(t,e){if(!Q0(t))throw Error(Ne(299));var r=!1,n="",s=rP;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=V0(t,1,!1,null,null,r,!1,n,s),t[Hi]=e.current,qd(t.nodeType===8?t.parentNode:t),new Y0(e)};ns.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Ne(188)):(t=Object.keys(t).join(","),Error(Ne(268,t)));return t=kC(e),t=t===null?null:t.stateNode,t};ns.flushSync=function(t){return el(t)};ns.hydrate=function(t,e,r){if(!Tg(e))throw Error(Ne(200));return Ag(null,t,e,!0,r)};ns.hydrateRoot=function(t,e,r){if(!Q0(t))throw Error(Ne(405));var n=r!=null&&r.hydratedSources||null,s=!1,o="",a=rP;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(o=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=tP(e,null,t,1,r??null,s,!1,o,a),t[Hi]=e.current,qd(t),n)for(t=0;t<n.length;t++)r=n[t],s=r._getVersion,s=s(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,s]:e.mutableSourceEagerHydrationData.push(r,s);return new Pg(e)};ns.render=function(t,e,r){if(!Tg(e))throw Error(Ne(200));return Ag(null,t,e,!1,r)};ns.unmountComponentAtNode=function(t){if(!Tg(t))throw Error(Ne(40));return t._reactRootContainer?(el(function(){Ag(null,null,t,!1,function(){t._reactRootContainer=null,t[Hi]=null})}),!0):!1};ns.unstable_batchedUpdates=W0;ns.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!Tg(r))throw Error(Ne(200));if(t==null||t._reactInternals===void 0)throw Error(Ne(38));return Ag(t,e,r,!1,n)};ns.version="18.3.1-next-f1338f8080-20240426";function nP(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(nP)}catch(t){console.error(t)}}nP(),nC.exports=ns;var ml=nC.exports;const sP=t0(ml);var iP,rk=ml;iP=rk.createRoot,rk.hydrateRoot;const wF=1,_F=1e6;let bx=0;function jF(){return bx=(bx+1)%Number.MAX_SAFE_INTEGER,bx.toString()}const wx=new Map,nk=t=>{if(wx.has(t))return;const e=setTimeout(()=>{wx.delete(t),Ad({type:"REMOVE_TOAST",toastId:t})},_F);wx.set(t,e)},kF=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,wF)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===e.toast.id?{...r,...e.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=e;
40return r?nk(r):t.toasts.forEach(n=>{nk(n.id)}),{...t,toasts:t.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==e.toastId)}}},Rm=[];let Im={toasts:[]};function Ad(t){Im=kF(Im,t),Rm.forEach(e=>{e(Im)})}function SF({...t}){const e=jF(),r=s=>Ad({type:"UPDATE_TOAST",toast:{...s,id:e}}),n=()=>Ad({type:"DISMISS_TOAST",toastId:e});return Ad({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||n()}}}),{id:e,dismiss:n,update:r}}function NF(){const[t,e]=g.useState(Im);return g.useEffect(()=>(Rm.push(e),()=>{const r=Rm.indexOf(e);r>-1&&Rm.splice(r,1)}),[t]),{...t,toast:SF,dismiss:r=>Ad({type:"DISMISS_TOAST",toastId:r})}}function je(t,e,{checkForDefaultPrevented:r=!0}={}){return function(s){if(t==null||t(s),r===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function sk(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Rg(...t){return e=>{let r=!1;const n=t.map(s=>{const o=sk(s,e);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<n.length;s++){const o=n[s];typeof o=="function"?o():sk(t[s],null)}}}}function Ge(...t){return g.useCallback(Rg(...t),t)}function CF(t,e){const r=g.createContext(e),n=o=>{const{children:a,...l}=o,c=g.useMemo(()=>l,Object.values(l));return i.jsx(r.Provider,{value:c,children:a})};n.displayName=t+"Provider";function s(o){const a=g.useContext(r);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[n,s]}function _r(t,e=[]){let r=[];function n(o,a){const l=g.createContext(a),c=r.length;r=[...r,a];const u=h=>{var x;const{scope:m,children:f,...v}=h,p=((x=m==null?void 0:m[t])==null?void 0:x[c])||l,b=g.useMemo(()=>v,Object.values(v));return i.jsx(p.Provider,{value:b,children:f})};u.displayName=o+"Provider";function d(h,m){var p;const f=((p=m==null?void 0:m[t])==null?void 0:p[c])||l,v=g.useContext(f);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[u,d]}const s=()=>{const o=r.map(a=>g.createContext(a));return function(l){const c=(l==null?void 0:l[t])||o;return g.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[n,EF(s,...e)]}function EF(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const a=n.reduce((l,{useScope:c,scopeName:u})=>{const h=c(o)[`__scope${u}`];return{...l,...h}},{});return g.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function ea(t){const e=TF(t),r=g.forwardRef((n,s)=>{const{children:o,...a}=n,l=g.Children.toArray(o),c=l.find(AF);if(c){const u=c.props.children,d=l.map(h=>h===c?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:h);return i.jsx(e,{...a,ref:s,children:g.isValidElement(u)?g.cloneElement(u,void 0,d):null})}return i.jsx(e,{...a,ref:s,children:o})});return r.displayName=`${t}.Slot`,r}var PF=ea("Slot");function TF(t){const e=g.forwardRef((r,n)=>{const{children:s,...o}=r;if(g.isValidElement(s)){const a=IF(s),l=RF(o,s.props);return s.type!==g.Fragment&&(l.ref=n?Rg(n,a):a),g.cloneElement(s,l)}return g.Children.count(s)>1?g.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var oP=Symbol("radix.slottable");function aP(t){const e=({children:r})=>i.jsx(i.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=oP,e}function AF(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===oP}function RF(t,e){const r={...e};for(const n in e){const s=t[n],o=e[n];/^on[A-Z]/.test(n)?s&&o?r[n]=(...l)=>{const c=o(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...o}:n==="className"&&(r[n]=[s,o].filter(Boolean).join(" "))}return{...t,...r}}function IF(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.
vendor: 10,438 bytes, line 40
40isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function cu(t){const e=t+"CollectionProvider",[r,n]=_r(e),[s,o]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{const{scope:b,children:x}=p,y=ke.useRef(null),w=ke.useRef(new Map).current;return i.jsx(s,{scope:b,itemMap:w,collectionRef:y,children:x})};a.displayName=e;const l=t+"CollectionSlot",c=ea(l),u=ke.forwardRef((p,b)=>{const{scope:x,children:y}=p,w=o(l,x),j=Ge(b,w.collectionRef);return i.jsx(c,{ref:j,children:y})});u.displayName=l;const d=t+"CollectionItemSlot",h="data-radix-collection-item",m=ea(d),f=ke.forwardRef((p,b)=>{const{scope:x,children:y,...w}=p,j=ke.useRef(null),_=Ge(b,j),S=o(d,x);return ke.useEffect(()=>(S.itemMap.set(j,{ref:j,...w}),()=>void S.itemMap.delete(j))),i.jsx(m,{[h]:"",ref:_,children:y})});f.displayName=d;function v(p){const b=o(t+"CollectionConsumer",p);return ke.useCallback(()=>{const y=b.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${h}]`));return Array.from(b.itemMap.values()).sort((S,N)=>w.indexOf(S.ref.current)-w.indexOf(N.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:u,ItemSlot:f},v,n]}var OF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Me=OF.reduce((t,e)=>{const r=ea(`Primitive.${e}`),n=g.forwardRef((s,o)=>{const{asChild:a,...l}=s,c=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:o})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function J0(t,e){t&&ml.flushSync(()=>t.dispatchEvent(e))}function yr(t){const e=g.useRef(t);return g.useEffect(()=>{e.current=t}),g.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function MF(t,e=globalThis==null?void 0:globalThis.document){const r=yr(t);g.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var $F="DismissableLayer",kb="dismissableLayer.update",DF="dismissableLayer.pointerDownOutside",FF="dismissableLayer.focusOutside",ik,lP=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pl=g.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,u=g.useContext(lP),[d,h]=g.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=g.useState({}),v=Ge(e,N=>h(N)),p=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=p.indexOf(b),y=d?p.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,j=y>=x,_=BF(N=>{const P=N.target,C=[...u.branches].some(O=>O.contains(P));!j||C||(s==null||s(N),a==null||a(N),N.defaultPrevented||l==null||l())},m),S=zF(N=>{const P=N.target;[...u.branches].some(O=>O.contains(P))||(o==null||o(N),a==null||a(N),N.defaultPrevented||l==null||l())},m);return MF(N=>{y===u.layers.size-1&&(n==null||n(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},m),g.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ik=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),ok(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=ik)}},[d,m,r,u]),g.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),ok())},[d,u]),g.useEffect(()=>{const N=()=>f({});return document.addEventListener(kb,N),()=>document.removeEventListener(kb,N)},[]),i.jsx(Me.div,{...c,ref:v,style:{pointerEvents:w?j?"auto":"none":void 0,...t.style},onFocusCapture:je(t.onFocusCapture,S.onFocusCapture),onBlurCapture:je(t.onBlurCapture,S.onBlurCapture),onPointerDownCapture:je(t.onPointerDownCapture,_.onPointerDownCapture)})});pl.displayName=$F;var LF="DismissableLayerBranch",cP=g.forwardRef((t,e)=>{const r=g.useContext(lP),n=g.useRef(null),s=Ge(e,n);return g.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),i.jsx(Me.div,{...t,ref:s})});cP.displayName=LF;function BF(t,e=globalThis==null?void 0:globalThis.document){const r=yr(t),n=g.useRef(!1),s=g.useRef(()=>{});return g.useEffect(()=>{const o=l=>{if(l.target&&!n.current){let c=function(){uP(DF,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",o),e.removeEventListener("click",s.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function zF(t,e=globalThis==null?void 0:globalThis.document){const r=yr(t),n=g.useRef(!1);return g.useEffect(()=>{const s=o=>{o.target&&!n.current&&uP(FF,r,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function ok(){const t=new CustomEvent(kb);document.dispatchEvent(t)}function uP(t,e,r,{discrete:n}){const s=r.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?J0(s,o):s.dispatchEvent(o)}var UF=pl,WF=cP,Br=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},HF="Portal",uu=g.forwardRef((t,e)=>{var l;const{container:r,...n}=t,[s,o]=g.useState(!1);Br(()=>o(!0),[]);const a=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?sP.createPortal(i.jsx(Me.div,{...n,ref:e}),a):null});uu.displayName=HF;function GF(t,e){return g.useReducer((r,n)=>e[r][n]??r,t)}var Tr=t=>{const{present:e,children:r}=t,n=qF(e),s=typeof r=="function"?r({present:n.isPresent}):g.Children.only(r),o=Ge(n.ref,VF(s));return typeof r=="function"||n.isPresent?g.cloneElement(s,{ref:o}):null};Tr.displayName="Presence";function qF(t){const[e,r]=g.useState(),n=g.useRef(null),s=g.useRef(t),o=g.useRef("none"),a=t?"mounted":"unmounted",[l,c]=GF(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=Hf(n.current);o.current=l==="mounted"?u:"none"},[l]),Br(()=>{const u=n.current,d=s.current;if(d!==t){const m=o.current,f=Hf(u);t?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==f?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),Br(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,h=f=>{const p=Hf(n.current).includes(f.animationName);if(f.target===e&&p&&(c("ANIMATION_END"),!s.current)){const b=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},m=f=>{f.target===e&&(o.current=Hf(n.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Hf(t){return(t==null?void 0:t.animationName)||"none"}function VF(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var KF=o0[" useInsertionEffect ".trim().toString()]||Br;function rn({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[s,o,a]=YF({defaultProp:e,onChange:r}),l=t!==void 0,c=l?t:s;{const d=g.useRef(t!==void 0);g.useEffect(()=>{const h=d.current;h!==l&&console.warn(`${n} is changing from ${h?"controlled":"uncontrolled"} to ${l?"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.`),d.current=l},[l,n])}const u=g.useCallback(d=>{var h;if(l){const m=QF(d)?d(t):d;m!==t&&((h=a.current)==null||h.call(a,m))}else o(d)},[l,t,o,a]);return[c,u]}function YF({defaultProp:t,onChange:e}){const[r,n]=g.useState(t),s=g.useRef(r),o=g.useRef(e);return KF(()=>{o.current=e},[e]),g.useEffect(()=>{var a;s.current!==r&&((a=o.current)==null||a.call(o,r),s.current=r)},[r,s]),[r,n,o]}function QF(t){return typeof t=="function"}var dP=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),JF="VisuallyHidden",Wh=g.forwardRef((t,e)=>i.jsx(Me.span,{...t,ref:e,style:{...dP,...t.style}}));Wh.displayName=JF;var XF=Wh,X0="ToastProvider",[Z0,ZF,eL]=cu("Toast"),[hP,cse]=_r("Toast",[eL]),[tL,Ig]=hP(X0),fP=t=>{const{__scopeToast:e,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:a}=t,[l,c]=g.useState(null),[u,d]=g.useState(0),h=g.useRef(!1),m=g.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${X0}\`. Expected non-empty \`string\`.`),i.jsx(Z0.Provider,{scope:e,children:i.jsx(tL,{scope:e,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:g.useCallback(()=>d(f=>f+1),[]),onToastRemove:g.useCallback(()=>d(f=>f-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:m,children:a})})};fP.displayName=X0;var mP="ToastViewport",rL=["F8"],Sb="toast.viewportPause",Nb="toast.viewportResume",pP=g.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:n=rL,label:s="Notifications ({hotkey})",...o}=t,a=Ig(mP,r),l=ZF(r),c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),h=g.useRef(null),m=Ge(e,h,a.onViewportChange),f=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=a.toastCount>0;g.useEffect(()=>{const b=x=>{var w;n.length!==0&&n.every(j=>x[j]||x.code===j)&&((w=h.current)==null||w.focus())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[n]),g.useEffect(()=>{const b=c.current,x=h.current;if(v&&b&&x){const y=()=>
40{if(!a.isClosePausedRef.current){const S=new CustomEvent(Sb);x.dispatchEvent(S),a.isClosePausedRef.current=!0}},w=()=>{if(a.isClosePausedRef.current){const S=new CustomEvent(Nb);x.dispatchEvent(S),a.isClosePausedRef.current=!1}},j=S=>{!b.contains(S.relatedTarget)&&w()},_=()=>{b.contains(document.activeElement)||w()};return b.addEventListener("focusin",y),b.addEventListener("focusout",j),b.addEventListener("pointermove",y),b.addEventListener("pointerleave",_),window.addEventListener("blur",y),window.addEventListener("focus",w),()=>{b.removeEventListener("focusin",y),b.removeEventListener("focusout",j),b.removeEventListener("pointermove",y),b.removeEventListener("pointerleave",_),window.removeEventListener("blur",y),window.removeEventListener("focus",w)}}},[v,a.isClosePausedRef]);const p=g.useCallback(({tabbingDirection:b})=>{const y=l().map(w=>{const j=w.ref.current,_=[j,...pL(j)];return b==="forwards"?_:_.reverse()});return(b==="forwards"?y.reverse():y).flat()},[l]);return g.useEffect(()=>{const b=h.current;if(b){const x=y=>{var _,S,N;const w=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!w){const P=document.activeElement,C=y.shiftKey;if(y.target===b&&C){(_=u.current)==null||_.focus();return}const T=p({tabbingDirection:C?"backwards":"forwards"}),A=T.findIndex(k=>k===P);_x(T.slice(A+1))?y.preventDefault():C?(S=u.current)==null||S.focus():(N=d.current)==null||N.focus()}};return b.addEventListener("keydown",x),()=>b.removeEventListener("keydown",x)}},[l,p]),i.jsxs(WF,{ref:c,role:"region","aria-label":s.replace("{hotkey}",f),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&i.jsx(Cb,{ref:u,onFocusFromOutsideViewport:()=>{const b=p({tabbingDirection:"forwards"});_x(b)}}),i.jsx(Z0.Slot,{scope:r,children:i.jsx(Me.ol,{tabIndex:-1,...o,ref:m})}),v&&i.jsx(Cb,{ref:d,onFocusFromOutsideViewport:()=>{const b=p({tabbingDirection:"backwards"});_x(b)}})]})});pP.displayName=mP;var gP="ToastFocusProxy",Cb=g.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=t,o=Ig(gP,r);return i.jsx(Wh,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{var u;const l=a.relatedTarget;!((u=o.viewport)!=null&&u.contains(l))&&n()}})});Cb.displayName=gP;var Hh="Toast",nL="toast.swipeStart",sL="toast.swipeMove",iL="toast.swipeCancel",oL="toast.swipeEnd",vP=g.forwardRef((t,e)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...a}=t,[l,c]=rn({prop:n,defaultProp:s??!0,onChange:o,caller:Hh});return i.jsx(Tr,{present:r||l,children:i.jsx(cL,{open:l,...a,ref:e,onClose:()=>c(!1),onPause:yr(t.onPause),onResume:yr(t.onResume),onSwipeStart:je(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:je(t.onSwipeMove,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:je(t.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:je(t.onSwipeEnd,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),c(!1)})})})});vP.displayName=Hh;var[aL,lL]=hP(Hh,{onClose(){}}),cL=g.forwardRef((t,e)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:m,onSwipeEnd:f,...v}=t,p=Ig(Hh,r),[b,x]=g.useState(null),y=Ge(e,k=>x(k)),w=g.useRef(null),j=g.useRef(null),_=s||p.duration,S=g.useRef(0),N=g.useRef(_),P=g.useRef(0),{onToastAdd:C,onToastRemove:O}=p,F=yr(()=>{var $;(b==null?void 0:b.contains(document.activeElement))&&(($=p.viewport)==null||$.focus()),a()}),T=g.useCallback(k=>
40{!k||k===1/0||(window.clearTimeout(P.current),S.current=new Date().getTime(),P.current=window.setTimeout(F,k))},[F]);g.useEffect(()=>{const k=p.viewport;if(k){const $=()=>{T(N.current),u==null||u()},K=()=>{const H=new Date().getTime()-S.current;N.current=N.current-H,window.clearTimeout(P.current),c==null||c()};return k.addEventListener(Sb,K),k.addEventListener(Nb,$),()=>{k.removeEventListener(Sb,K),k.removeEventListener(Nb,$)}}},[p.viewport,_,c,u,T]),g.useEffect(()=>{o&&!p.isClosePausedRef.current&&T(_)},[o,_,p.isClosePausedRef,T]),g.useEffect(()=>(C(),()=>O()),[C,O]);const A=g.useMemo(()=>b?kP(b):null,[b]);return p.viewport?i.jsxs(i.Fragment,{children:[A&&i.jsx(uL,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:A}),i.jsx(aL,{scope:r,onClose:F,children:ml.createPortal(i.jsx(Z0.ItemSlot,{scope:r,children:i.jsx(UF,{asChild:!0,onEscapeKeyDown:je(l,()=>{p.isFocusedToastEscapeKeyDownRef.current||F(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:i.jsx(Me.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":p.swipeDirection,...v,ref:y,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:je(t.onKeyDown,k=>{k.key==="Escape"&&(l==null||l(k.nativeEvent),k.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,F()))}),onPointerDown:je(t.onPointerDown,k=>{k.button===0&&(w.current={x:k.clientX,y:k.clientY})}),onPointerMove:je(t.onPointerMove,k=>{if(!w.current)return;const $=k.clientX-w.current.x,K=k.clientY-w.current.y,H=!!j.current,W=["left","right"].includes(p.swipeDirection),R=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,G=W?R(0,$):0,U=W?0:R(0,K),z=k.pointerType==="touch"?10:2,oe={x:G,y:U},L={originalEvent:k,delta:oe};H?(j.current=oe,Gf(sL,h,L,{discrete:!1})):ak(oe,p.swipeDirection,z)?(j.current=oe,Gf(nL,d,L,{discrete:!1}),k.target.setPointerCapture(k.pointerId)):(Math.abs($)>z||Math.abs(K)>z)&&(w.current=null)}),onPointerUp:je(t.onPointerUp,k=>{const $=j.current,K=k.target;if(K.hasPointerCapture(k.pointerId)&&K.releasePointerCapture(k.pointerId),j.current=null,w.current=null,$){const H=k.currentTarget,W={originalEvent:k,delta:$};ak($,p.swipeDirection,p.swipeThreshold)?Gf(oL,f,W,{discrete:!0}):Gf(iL,m,W,{discrete:!0}),H.addEventListener("click",R=>R.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),uL=t=>{const{__scopeToast:e,children:r,...n}=t,s=Ig(Hh,e),[o,a]=g.useState(!1),[l,c]=g.useState(!1);return fL(()=>a(!0)),g.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:i.jsx(uu,{asChild:!0,children:i.jsx(Wh,{...n,children:o&&i.jsxs(i.Fragment,{children:[s.label," ",r]})})})},dL="ToastTitle",xP=g.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return i.jsx(Me.div,{...n,ref:e})});xP.displayName=dL;var hL="ToastDescription",yP=g.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return i.jsx(Me.div,{...n,ref:e})});yP.displayName=hL;var bP="ToastAction",wP=g.forwardRef((t,e)=>{const{altText:r,...n}=t;return r.trim()?i.jsx(jP,{altText:r,asChild:!0,children:i.jsx(e_,{...n,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${bP}\`. Expected non-empty \`string\`.`),null)});wP.displayName=bP;var _P="ToastClose",e_=g.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t,s=lL(_P,r);return i.jsx(jP,{asChild:!0,children:i.jsx(Me.button,{type:"button",...n,ref:e,onClick:je(t.onClick,s.onClose)})})});e_.displayName=_P;var jP=g.forwardRef((t,e)=>{const{__scopeToast:r,altText:n,...s}=t;return i.jsx(Me.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:e})});function kP(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),mL(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const a=n.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...kP(n))}}),e}function Gf(t,e,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?J0(s,o):s.dispatchEvent(o)}var ak=(t,e,r=0)=>{const n=Math.abs(t.x),s=Math.abs(t.y),o=n>s;return e==="left"||e==="right"?o&&n>r:!o&&s>r};function fL(t=()=>{}){const e=yr(t);Br(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[e])}function mL(t){return t.nodeType===t.ELEMENT_NODE}function pL(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function _x(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var gL=fP,SP=pP,NP=vP,CP=xP,EP=yP,PP=wP,TP=e_;function AP(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=AP(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function RP(){for(var t,e,r=0,n="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=AP(t))&&(n&&(n+=" "),n+=e);return n}const lk=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,ck=RP,du=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return ck(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:o}=e,a=Object.keys(s).map(u=>{const d=r==null?void 0:r[u],h=o==null?void 0:o[u];if(d===null)return null;const m=lk(d)||lk(h);return s[u][m]}),l=r&&Object.entries(r).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),c=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:h,className:m,...f}=d;return Object.entries(f).every(v=>{let[p,b]=v;return Array.isArray(b)?b.includes({...o,...l}[p]):{...o,...l}[p]===b})?[...u,h,m]:u},[]);return ck(t,a,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
41 * @license lucide-react v0.462.0 - ISC
42 *
43 * This source code is licensed under the ISC license.
44 * See the LICENSE file in the root directory of this source tree.
45 */const vL=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),IP=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
46 * @license lucide-react v0.462.0 - ISC
47 *
48 * This source code is licensed under the ISC license.
49 * See the LICENSE file in the root directory of this source tree.
50 */var xL={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
51 * @license lucide-react v0.462.0 - ISC
52 *
53 * This source code is licensed under the ISC license.
54 * See the LICENSE file in the root directory of this source tree.
55 */const yL=g.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:a,...l},c)=>g.createElement("svg",{ref:c,...xL,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:IP("lucide",s),...l},[...a.map(([u,d])=>g.createElement(u,d)),...Array.isArray(o)?o:[o]]));/**
56 * @license lucide-react v0.462.0 - ISC
57 *
58 * This source code is licensed under the ISC license.
59 * See the LICENSE file in the root directory of this source tree.
60 */const Ee=(t,e)=>{const r=g.forwardRef(({className:n,...s},o)=>g.createElement(yL,{ref:o,iconNode:e,className:IP(`lucide-${vL(t)}`,n),...s}));return r.displayName=`${t}`,r};/**
61 * @license lucide-react v0.462.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const OP=Ee("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
66 * @license lucide-react v0.462.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */const Ga=Ee("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
71 * @license lucide-react v0.462.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const bL=Ee("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
76 * @license lucide-react v0.462.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const MP=Ee("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);/**
81 * @license lucide-react v0.462.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const Na=Ee("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
86 * @license lucide-react v0.462.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const $P=Ee("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
91 * @license lucide-react v0.462.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const gl=Ee("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
96 * @license lucide-react v0.462.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const th=Ee("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
101 * @license lucide-react v0.462.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const fr=Ee("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
106 * @license lucide-react v0.462.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const Hs=Ee("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
111 * @license lucide-react v0.462.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const DP=Ee("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
116 * @license lucide-react v0.462.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const Gh=Ee("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
121 * @license lucide-react v0.462.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const FP=Ee("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
126 * @license lucide-react v0.462.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const t_=Ee("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
131 * @license lucide-react v0.462.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const wL=Ee("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
136 * @license lucide-react v0.462.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const vp=Ee("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
141 * @license lucide-react v0.462.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const _L=Ee("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
146 * @license lucide-react v0.462.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const Eb=Ee("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
151 * @license lucide-react v0.462.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const LP=Ee("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
156 * @license lucide-react v0.462.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const xc=Ee("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
161 * @license lucide-react v0.462.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const BP=Ee("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
166 * @license lucide-react v0.462.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const yc=Ee("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
171 * @license lucide-react v0.462.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const r_=Ee("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
176 * @license lucide-react v0.462.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const Pb=Ee("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
181 * @license lucide-react v0.462.0 - ISC
182 *
183 * This source code is licensed under the ISC license.
184 * See the LICENSE file in the root directory of this source tree.
185 */const Og=Ee("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
186 * @license lucide-react v0.462.0 - ISC
187 *
188 * This source code is licensed under the ISC license.
189 * See the LICENSE file in the root directory of this source tree.
190 */const jL=Ee("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
191 * @license lucide-react v0.462.0 - ISC
192 *
193 * This source code is licensed under the ISC license.
194 * See the LICENSE file in the root directory of this source tree.
195 */const Wn=Ee("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
196 * @license lucide-react v0.462.0 - ISC
197 *
198 * This source code is licensed under the ISC license.
199 * See the LICENSE file in the root directory of this source tree.
200 */const kL=Ee("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
201 * @license lucide-react v0.462.0 - ISC
202 *
203 * This source code is licensed under the ISC license.
204 * See the LICENSE file in the root directory of this source tree.
205 */const SL=Ee("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
206 * @license lucide-react v0.462.0 - ISC
207 *
208 * This source code is licensed under the ISC license.
209 * See the LICENSE file in the root directory of this source tree.
210 */const Bi=Ee("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
211 * @license lucide-react v0.462.0 - ISC
212 *
213 * This source code is licensed under the ISC license.
214 * See the LICENSE file in the root directory of this source tree.
215 */const NL=Ee("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
216 * @license lucide-react v0.462.0 - ISC
217 *
218 * This source code is licensed under the ISC license.
219 * See the LICENSE file in the root directory of this source tree.
220 */const Mg=Ee("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
221 * @license lucide-react v0.462.0 - ISC
222 *
223 * This source code is licensed under the ISC license.
224 * See the LICENSE file in the root directory of this source tree.
225 */const CL=Ee("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
226 * @license lucide-react v0.462.0 - ISC
227 *
228 * This source code is licensed under the ISC license.
229 * See the LICENSE file in the root directory of this source tree.
230 */const EL=Ee("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
231 * @license lucide-react v0.462.0 - ISC
232 *
233 * This source code is licensed under the ISC license.
234 * See the LICENSE file in the root directory of this source tree.
235 */const Tb=Ee("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
236 * @license lucide-react v0.462.0 - ISC
237 *
238 * This source code is licensed under the ISC license.
239 * See the LICENSE file in the root directory of this source tree.
240 */const rh=Ee("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
241 * @license lucide-react v0.462.0 - ISC
242 *
243 * This source code is licensed under the ISC license.
244 * See the LICENSE file in the root directory of this source tree.
245 */const Rd=Ee("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
246 * @license lucide-react v0.462.0 - ISC
247 *
248 * This source code is licensed under the ISC license.
249 * See the LICENSE file in the root directory of this source tree.
250 */const tl=Ee("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
251 * @license lucide-react v0.462.0 - ISC
252 *
253 * This source code is licensed under the ISC license.
254 * See the LICENSE file in the root directory of this source tree.
255 */const zP=Ee("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
256 * @license lucide-react v0.462.0 - ISC
257 *
258 * This source code is licensed under the ISC license.
259 * See the LICENSE file in the root directory of this source tree.
260 */const qa=Ee("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
261 * @license lucide-react v0.462.0 - ISC
262 *
263 * This source code is licensed under the ISC license.
264 * See the LICENSE file in the root directory of this source tree.
265 */const PL=Ee("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);/**
266 * @license lucide-react v0.462.0 - ISC
267 *
268 * This source code is licensed under the ISC license.
269 * See the LICENSE file in the root directory of this source tree.
270 */const qc=Ee("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
271 * @license lucide-react v0.462.0 - ISC
272 *
273 * This source code is licensed under the ISC license.
274 * See the LICENSE file in the root directory of this source tree.
275 */const n_=Ee("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
276 * @license lucide-react v0.462.0 - ISC
277 *
278 * This source code is licensed under the ISC license.
279 * See the LICENSE file in the root directory of this source tree.
280 */const xp=Ee("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
281 * @license lucide-react v0.462.0 - ISC
282 *
283 * This source code is licensed under the ISC license.
284 * See the LICENSE file in the root directory of this source tree.
285 */const TL=Ee("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
286 * @license lucide-react v0.462.0 - ISC
287 *
288 * This source code is licensed under the ISC license.
289 * See the LICENSE file in the root directory of this source tree.
290 */const et=Ee("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
291 * @license lucide-react v0.462.0 - ISC
292 *
293 * This source code is licensed under the ISC license.
294 * See the LICENSE file in the root directory of this source tree.
295 */const nh=Ee("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
296 * @license lucide-react v0.462.0 - ISC
297 *
298 * This source code is licensed under the ISC license.
299 * See the LICENSE file in the root directory of this source tree.
300 */const uk=Ee("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
301 * @license lucide-react v0.462.0 - ISC
302 *
303 * This source code is licensed under the ISC license.
304 * See the LICENSE file in the root directory of this source tree.
305 */const AL=Ee("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
306 * @license lucide-react v0.462.0 - ISC
307 *
308 * This source code is licensed under the ISC license.
309 * See the LICENSE file in the root directory of this source tree.
310 */const UP=Ee("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
311 * @license lucide-react v0.462.0 - ISC
312 *
313 * This source code is licensed under the ISC license.
314 * See the LICENSE file in the root directory of this source tree.
315 */const WP=Ee("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
316 * @license lucide-react v0.462.0 - ISC
317 *
318 * This source code is licensed under the ISC license.
319 * See the LICENSE file in the root directory of this source tree.
320 */const RL=Ee("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
321 * @license lucide-react v0.462.0 - ISC
322 *
323 * This source code is licensed under the ISC license.
324 * See the LICENSE file in the root directory of this source tree.
325 */const Ab=Ee("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
326 * @license lucide-react v0.462.0 - ISC
327 *
328 * This source code is licensed under the ISC license.
329 * See the LICENSE file in the root directory of this source tree.
330 */const IL=Ee("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
331 * @license lucide-react v0.462.0 - ISC
332 *
333 * This source code is licensed under the ISC license.
334 * See the LICENSE file in the root directory of this source tree.
335 */const OL=Ee("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
336 * @license lucide-react v0.462.0 - ISC
337 *
338 * This source code is licensed under the ISC license.
339 * See the LICENSE file in the root directory of this source tree.
340 */const ML=Ee("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
341 * @license lucide-react v0.462.0 - ISC
342 *
343 * This source code is licensed under the ISC license.
344 * See the LICENSE file in the root directory of this source tree.
345 */const ta=Ee("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
346 * @license lucide-react v0.462.0 - ISC
347 *
348 * This source code is licensed under the ISC license.
349 * See the LICENSE file in the root directory of this source tree.
350 */const $L=Ee("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/**
351 * @license lucide-react v0.462.0 - ISC
352 *
353 * This source code is licensed under the ISC license.
354 * See the LICENSE file in the root directory of this source tree.
355 */const DL=Ee("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/**
356 * @license lucide-react v0.462.0 - ISC
357 *
358 * This source code is licensed under the ISC license.
359 * See the LICENSE file in the root directory of this source tree.
360 */const HP=Ee("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/**
361 * @license lucide-react v0.462.0 - ISC
362 *
363 * This source code is licensed under the ISC license.
364 * See the LICENSE file in the root directory of this source tree.
365 */const Vc=Ee("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
366 * @license lucide-react v0.462.0 - ISC
367 *
368 * This source code is licensed under the ISC license.
369 * See the LICENSE file in the root directory of this source tree.
370 */const yp=Ee("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
371 * @license lucide-react v0.462.0 - ISC
372 *
373 * This source code is licensed under the ISC license.
374 * See the LICENSE file in the root directory of this source tree.
375 */const s_=Ee("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
376 * @license lucide-react v0.462.0 - ISC
377 *
378 * This source code is licensed under the ISC license.
379 * See the LICENSE file in the root directory of this source tree.
380 */const bp=Ee("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
381 * @license lucide-react v0.462.0 - ISC
382 *
383 * This source code is licensed under the ISC license.
384 * See the LICENSE file in the root directory of this source tree.
385 */const qh=Ee("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3
385kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
386 * @license lucide-react v0.462.0 - ISC
387 *
388 * This source code is licensed under the ISC license.
389 * See the LICENSE file in the root directory of this source tree.
390 */const sh=Ee("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
391 * @license lucide-react v0.462.0 - ISC
392 *
393 * This source code is licensed under the ISC license.
394 * See the LICENSE file in the root directory of this source tree.
395 */const FL=Ee("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
396 * @license lucide-react v0.462.0 - ISC
397 *
398 * This source code is licensed under the ISC license.
399 * See the LICENSE file in the root directory of this source tree.
400 */const $g=Ee("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
401 * @license lucide-react v0.462.0 - ISC
402 *
403 * This source code is licensed under the ISC license.
404 * See the LICENSE file in the root directory of this source tree.
405 */const wp=Ee("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
406 * @license lucide-react v0.462.0 - ISC
407 *
408 * This source code is licensed under the ISC license.
409 * See the LICENSE file in the root directory of this source tree.
410 */const Om=Ee("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
411 * @license lucide-react v0.462.0 - ISC
412 *
413 * This source code is licensed under the ISC license.
414 * See the LICENSE file in the root directory of this source tree.
415 */const dk=Ee("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/**
416 * @license lucide-react v0.462.0 - ISC
417 *
418 * This source code is licensed under the ISC license.
419 * See the LICENSE file in the root directory of this source tree.
420 */const jx=Ee("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
421 * @license lucide-react v0.462.0 - ISC
422 *
423 * This source code is licensed under the ISC license.
424 * See the LICENSE file in the root directory of this source tree.
425 */const i_=Ee("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
426 * @license lucide-react v0.462.0 - ISC
427 *
428 * This source code is licensed under the ISC license.
429 * See the LICENSE file in the root directory of this source tree.
430 */const LL=Ee("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
431 * @license lucide-react v0.462.0 - ISC
432 *
433 * This source code is licensed under the ISC license.
434 * See the LICENSE file in the root directory of this source tree.
435 */const BL=Ee("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/**
436 * @license lucide-react v0.462.0 - ISC
437 *
438 * This source code is licensed under the ISC license.
439 * See the LICENSE file in the root directory of this source tree.
440 */const zL=Ee("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
441 * @license lucide-react v0.462.0 - ISC
442 *
443 * This source code is licensed under the ISC license.
444 * See the LICENSE file in the root directory of this source tree.
445 */const UL=Ee("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
446 * @license lucide-react v0.462.0 - ISC
447 *
448 * This source code is licensed under the ISC license.
449 * See the LICENSE file in the root directory of this source tree.
450 */const St=Ee("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
451 * @license lucide-react v0.462.0 - ISC
452 *
453 * This source code is licensed under the ISC license.
454 * See the LICENSE file in the root directory of this source tree.
455 */const ys=Ee("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
456 * @license lucide-react v0.462.0 - ISC
457 *
458 * This source code is licensed under the ISC license.
459 * See the LICENSE file in the root directory of this source tree.
460 */const WL=Ee("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]);/**
461 * @license lucide-react v0.462.0 - ISC
462 *
463 * This source code is licensed under the ISC license.
464 * See the LICENSE file in the root directory of this source tree.
465 */const HL=Ee("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
466 * @license lucide-react v0.462.0 - ISC
467 *
468 * This source code is licensed under the ISC license.
469 * See the LICENSE file in the root directory of this source tree.
470 */const GL=Ee("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
471 * @license lucide-react v0.462.0 - ISC
472 *
473 * This source code is licensed under the ISC license.
474 * See the LICENSE file in the root directory of this source tree.
475 */const GP=Ee("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
476 * @license lucide-react v0.462.0 - ISC
477 *
478 * This source code is licensed under the ISC license.
479 * See the LICENSE file in the root directory of this source tree.
480 */const qL=Ee("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
481 * @license lucide-react v0.462.0 - ISC
482 *
483 * This source code is licensed under the ISC license.
484 * See the LICENSE file in the root directory of this source tree.
485 */const VL=Ee("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
486 * @license lucide-react v0.462.0 - ISC
487 *
488 * This source code is licensed under the ISC license.
489 * See the LICENSE file in the root directory of this source tree.
490 */const li=Ee("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
491 * @license lucide-react v0.462.0 - ISC
492 *
493 * This source code is licensed under the ISC license.
494 * See the LICENSE file in the root directory of this source tree.
495 */const qP=Ee("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
496 * @license lucide-react v0.462.0 - ISC
497 *
498 * This source code is licensed under the ISC license.
499 * See the LICENSE file in the root directory of this source tree.
500 */const _p=Ee("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
501 * @license lucide-react v0.462.0 - ISC
502 *
503 * This source code is licensed under the ISC license.
504 * See the LICENSE file in the root directory of this source tree.
505 */const VP=Ee("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
506 * @license lucide-react v0.462.0 - ISC
507 *
508 * This source code is licensed under the ISC license.
509 * See the LICENSE file in the root directory of this source tree.
510 */const KP=Ee("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
511 * @license lucide-react v0.462.0 - ISC
512 *
513 * This source code is licensed under the ISC license.
514 * See the LICENSE file in the root directory of this source tree.
515 */const Bn=Ee("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
516 * @license lucide-react v0.462.0 - ISC
517 *
518 * This source code is licensed under the ISC license.
519 * See the LICENSE file in the root directory of this source tree.
520 */const ua=Ee("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),o_="-",KL=t=>{const e=QL(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{const l=a.split(o_);return l[0]===""&&l.length!==1&&l.shift(),YP(l,e)||YL(a)},getConflictingClassGroupIds:(a,l)=>{const c=r[a]||[];return l&&n[a]?[...c,...n[a]]:c}}},YP=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),s=n?YP(t.slice(1),n):void 0;if(s)return s;if(e.validators.length===0)return;const o=t.join(o_);return(a=e.validators.find(({validator:l})=>l(o)))==null?void 0:a.classGroupId},hk=/^\[(.+)\]$/,YL=t=>{if(hk.test(t)){const e=hk.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},QL=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return XL(Object.entries(t.classGroups),r).forEach(([o,a])=>{Rb(a,n,o,e)}),n},Rb=(t,e,r,n)=>{t.forEach(s=>{if(typeof s=="string"){const o=s===""?e:fk(e,s);o.classGroupId=r;return}if(typeof s=="function"){if(JL(s)){Rb(s(n),e,r,n);return}e.validators.push({validator:s,classGroupId:r});return}
vendor: 4,829 bytes, line 520
520Object.entries(s).forEach(([o,a])=>{Rb(a,fk(e,o),r,n)})})},fk=(t,e)=>{let r=t;return e.split(o_).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},JL=t=>t.isThemeGetter,XL=(t,e)=>e?t.map(([r,n])=>{const s=n.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([a,l])=>[e+a,l])):o);return[r,s]}):t,ZL=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const s=(o,a)=>{r.set(o,a),e++,e>t&&(e=0,n=r,r=new Map)};return{get(o){let a=r.get(o);if(a!==void 0)return a;if((a=n.get(o))!==void 0)return s(o,a),a},set(o,a){r.has(o)?r.set(o,a):s(o,a)}}},QP="!",e6=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,s=e[0],o=e.length,a=l=>{const c=[];let u=0,d=0,h;for(let b=0;b<l.length;b++){let x=l[b];if(u===0){if(x===s&&(n||l.slice(b,b+o)===e)){c.push(l.slice(d,b)),d=b+o;continue}if(x==="/"){h=b;continue}}x==="["?u++:x==="]"&&u--}const m=c.length===0?l:l.substring(d),f=m.startsWith(QP),v=f?m.substring(1):m,p=h&&h>d?h-d:void 0;return{modifiers:c,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:p}};return r?l=>r({className:l,parseClassName:a}):a},t6=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},r6=t=>({cache:ZL(t.cacheSize),parseClassName:e6(t),...KL(t)}),n6=/\s+/,s6=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=e,o=[],a=t.trim().split(n6);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{modifiers:d,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:f}=r(u);let v=!!f,p=n(v?m.substring(0,f):m);if(!p){if(!v){l=u+(l.length>0?" "+l:l);continue}if(p=n(m),!p){l=u+(l.length>0?" "+l:l);continue}v=!1}const b=t6(d).join(":"),x=h?b+QP:b,y=x+p;if(o.includes(y))continue;o.push(y);const w=s(p,v);for(let j=0;j<w.length;++j){const _=w[j];o.push(x+_)}l=u+(l.length>0?" "+l:l)}return l};function i6(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=JP(e))&&(n&&(n+=" "),n+=r);return n}const JP=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=JP(t[n]))&&(r&&(r+=" "),r+=e);return r};function o6(t,...e){let r,n,s,o=a;function a(c){const u=e.reduce((d,h)=>h(d),t());return r=r6(u),n=r.cache.get,s=r.cache.set,o=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=s6(c,r);return s(c,d),d}return function(){return o(i6.apply(null,arguments))}}const Gt=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},XP=/^\[(?:([a-z-]+):)?(.+)\]$/i,a6=/^\d+\/\d+$/,l6=new Set(["px","full","screen"]),c6=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,u6=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,d6=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,h6=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,f6=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ki=t=>bc(t)||l6.has(t)||a6.test(t),ho=t=>hu(t,"length",w6),bc=t=>!!t&&!Number.isNaN(Number(t)),kx=t=>hu(t,"number",bc),Wu=t=>!!t&&Number.isInteger(Number(t)),m6=t=>t.endsWith("%")&&bc(t.slice(0,-1)),at=t=>XP.test(t),fo=t=>c6.test(t),p6=new Set(["length","size","percentage"]),g6=t=>hu(t,p6,ZP),v6=t=>hu(t,"position",ZP),x6=new Set(["image","url"]),y6=t=>hu(t,x6,j6),b6=t=>hu(t,"",_6),Hu=()=>!0,hu=(t,e,r)=>{const n=XP.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},w6=t=>u6.test(t)&&!d6.test(t),ZP=()=>!1,_6=t=>h6.test(t),j6=t=>f6.test(t),k6=()=>{const t=Gt("colors"),e=Gt("spacing"),r=Gt("blur"),n=Gt("brightness"),s=Gt("borderColor"),o=Gt("borderRadius"),a=Gt("borderSpacing"),l=Gt("borderWidth"),c=Gt("contrast"),u=Gt("grayscale"),d=Gt("hueRotate"),h=Gt("invert"),m=Gt("gap"),f=Gt("gradientColorStops"),v=Gt("gradientColorStopPositions"),p=Gt("inset"),b=Gt("margin"),x=Gt("opacity"),y=Gt("padding"),w=Gt("saturate"),j=Gt("scale"),_=Gt("sepia"),S=Gt("skew"),N=Gt("space"),P=Gt("translate"),C=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",at,e],T=()=>[at,e],A=()=>["",ki,ho],k=()=>["auto",bc,at],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>["start","end","center","between","around","evenly","stretch"],R=()=>["","0",at],G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[bc,at];return{cacheSize:500,separator:":",theme:{colors:[Hu],spacing:[ki,ho],blur:["none","",fo,at],brightness:U(),borderColor:[t],borderRadius:["n
520one","","full",fo,at],borderSpacing:T(),borderWidth:A(),contrast:U(),grayscale:R(),hueRotate:U(),invert:R(),gap:T(),gradientColorStops:[t],gradientColorStopPositions:[m6,ho],inset:F(),margin:F(),opacity:U(),padding:T(),saturate:U(),scale:U(),sepia:R(),skew:U(),space:T(),translate:T()},classGroups:{aspect:[{aspect:["auto","square","video",at]}],container:["container"],columns:[{columns:[fo]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...$(),at]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Wu,at]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",at]}],grow:[{grow:R()}],shrink:[{shrink:R()}],order:[{order:["first","last","none",Wu,at]}],"grid-cols":[{"grid-cols":[Hu]}],"col-start-end":[{col:["auto",{span:["full",Wu,at]},at]}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":[Hu]}],"row-start-end":[{row:["auto",{span:[Wu,at]},at]}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",at]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",at]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...W()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...W(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...W(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",at,e]}],"min-w":[{"min-w":[at,e,"min","max","fit"]}],"max-w":[{"max-w":[at,e,"none","full","min","max","fit","prose",{screen:[fo]},fo]}],h:[{h:[at,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[at,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[at,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[at,e,"auto","min","max","fit"]}],"font-size":[{text:["base",fo,ho]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kx]}],"font-family":[{font:[Hu]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",at]}],"line-clamp":[{"line-clamp":["none",bc,kx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ki,at]}],"list-image":[{"list-image":["none",at]}],"list-style-type":[{list:["none","disc","decimal",at]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ki,ho]}],"underline-offset":[{"underline-offset":["auto",ki,at]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",at]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",at]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),v6]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",g6]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},y6]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[v]}
vendor: 5,180 bytes, line 520
520],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:K()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[ki,at]}],"outline-w":[{outline:[ki,ho]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:A()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[ki,ho]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",fo,b6]}],"shadow-color":[{shadow:[Hu]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",fo,at]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[w]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",at]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",at]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",at]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Wu,at]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",at]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",at]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
vendor: 4,618 bytes, line 520
520],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",at]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ki,ho,kx]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},S6=o6(k6);function Se(...t){return S6(RP(t))}const N6=gL,eT=g.forwardRef(({className:t,...e},r)=>i.jsx(SP,{ref:r,className:Se("fixed top-4 left-1/2 -translate-x-1/2 z-[100] flex max-h-screen w-full flex-col p-4 md:max-w-[420px]",t),...e}));eT.displayName=SP.displayName;const C6=du("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),tT=g.forwardRef(({className:t,variant:e,...r},n)=>i.jsx(NP,{ref:n,className:Se(C6({variant:e}),t),...r}));tT.displayName=NP.displayName;const E6=g.forwardRef(({className:t,...e},r)=>i.jsx(PP,{ref:r,className:Se("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...e}));E6.displayName=PP.displayName;const rT=g.forwardRef(({className:t,...e},r)=>i.jsx(TP,{ref:r,className:Se("absolute right-2 top-2 rounded-md p-1 text-foreground
520/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:i.jsx(Bn,{className:"h-4 w-4"})}));rT.displayName=TP.displayName;const nT=g.forwardRef(({className:t,...e},r)=>i.jsx(CP,{ref:r,className:Se("text-sm font-semibold",t),...e}));nT.displayName=CP.displayName;const sT=g.forwardRef(({className:t,...e},r)=>i.jsx(EP,{ref:r,className:Se("text-sm opacity-90",t),...e}));sT.displayName=EP.displayName;function P6(){const{toasts:t}=NF();return i.jsxs(N6,{children:[t.map(function({id:e,title:r,description:n,action:s,...o}){return i.jsxs(tT,{...o,children:[i.jsxs("div",{className:"grid gap-1",children:[r&&i.jsx(nT,{children:r}),n&&i.jsx(sT,{children:n})]}),s,i.jsx(rT,{})]},e)}),i.jsx(eT,{})]})}var mk=["light","dark"],T6="(prefers-color-scheme: dark)",A6=g.createContext(void 0),R6={setTheme:t=>{},themes:[]},I6=()=>{var t;return(t=g.useContext(A6))!=null?t:R6};g.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:o,value:a,attrs:l,nonce:c})=>{let u=o==="system",d=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(v=>`'${v}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,h=s?mk.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(v,p=!1,b=!0)=>{let x=a?a[v]:v,y=p?v+"|| ''":`'${x}'`,w="";return s&&b&&!p&&mk.includes(v)&&(w+=`d.style.colorScheme = '${v}';`),r==="class"?p||x?w+=`c.add(${y})`:w+="null":x&&(w+=`d[s](n,${y})`),w},f=t?`!function(){${d}${m(t)}}()`:n?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${T6}',m=window.matchMedia(t);if(m.media!==t||m.matches){${m("dark")}}else{${m("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${m(a?"x[e]":"e",!0)}}${u?"":"else{"+m(o,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${a?`var x=${JSON.stringify(a)};`:""}${m(a?"x[e]":"e",!0)}}else{${m(o,!1,!1)};}${h}}catch(t){}}();`;return g.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:f}})});var O6=t=>{switch(t){case"success":return D6;case"info":return L6;case"warning":return F6;case"error":return B6;default:return null}},M6=Array(12).fill(0),$6=({visible:t,className:e})=>ke.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},ke.createElement("div",{className:"sonner-spinner"},M6.map((r,n)=>ke.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),D6=ke.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ke.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),F6=ke.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ke.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),L6=ke.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ke.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),B6=ke.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ke.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),z6=ke.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ke.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ke.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),U6=()=>{let[t,e]=ke.useState(document.hidden);return ke.useEffect(()=>{let r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},Ib=1,W6=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>
520{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;let{message:n,...s}=e,o=typeof(e==null?void 0:e.id)=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:Ib++,a=this.toasts.find(c=>c.id===o),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...e,id:o,title:n}),{...c,...e,id:o,dismissible:l,title:n}):c):this.addToast({title:n,...s,dismissible:l,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),this.subscribers.forEach(r=>r({id:e,dismiss:!0})),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));let s=e instanceof Promise?e:e(),o=n!==void 0,a,l=s.then(async u=>{if(a=["resolve",u],ke.isValidElement(u))o=!1,this.create({id:n,type:"default",message:u});else if(G6(u)&&!u.ok){o=!1;let d=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,h=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description;this.create({id:n,type:"error",message:d,description:h})}else if(r.success!==void 0){o=!1;let d=typeof r.success=="function"?await r.success(u):r.success,h=typeof r.description=="function"?await r.description(u):r.description;this.create({id:n,type:"success",message:d,description:h})}}).catch(async u=>{if(a=["reject",u],r.error!==void 0){o=!1;let d=typeof r.error=="function"?await r.error(u):r.error,h=typeof r.description=="function"?await r.description(u):r.description;this.create({id:n,type:"error",message:d,description:h})}}).finally(()=>{var u;o&&(this.dismiss(n),n=void 0),(u=r.finally)==null||u.call(r)}),c=()=>new Promise((u,d)=>l.then(()=>a[0]==="reject"?d(a[1]):u(a[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,r)=>{let n=(r==null?void 0:r.id)||Ib++;return this.create({jsx:e(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Tn=new W6,H6=(t,e)=>{let r=(e==null?void 0:e.id)||Ib++;return Tn.addToast({title:t,...e,id:r}),r},G6=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",q6=H6,V6=()=>Tn.toasts,K6=()=>Tn.getActiveToasts(),Q=Object.assign(q6,{success:Tn.success,info:Tn.info,warning:Tn.warning,error:Tn.error,custom:Tn.custom,message:Tn.message,promise:Tn.promise,dismiss:Tn.dismiss,loading:Tn.loading},{getHistory:V6,getToasts:K6});function Y6(t,{insertAt:e}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}Y6(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
520left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
520:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
520--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
521`);function qf(t){return t.label!==void 0}var Q6=3,J6="32px",X6="16px",pk=4e3,Z6=356,e8=14,t8=20,r8=200;function Cs(...t){return t.filter(Boolean).join(" ")}function n8(t){let[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}var s8=t=>{var e,r,n,s,o,a,l,c,u,d,h;let{invert:m,toast:f,unstyled:v,interacting:p,setHeights:b,visibleToasts:x,heights:y,index:w,toasts:j,expanded:_,removeToast:S,defaultRichColors:N,closeButton:P,style:C,cancelButtonStyle:O,actionButtonStyle:F,className:T="",descriptionClassName:A="",duration:k,position:$,gap:K,loadingIcon:H,expandByDefault:W,classNames:R,icons:G,closeButtonAriaLabel:U="Close toast",pauseWhenPageIsHidden:z}=t,[oe,L]=ke.useState(null),[q,he]=ke.useState(null),[X,J]=ke.useState(!1),[de,le]=ke.useState(!1),[fe,Z]=ke.useState(!1),[ae,E]=ke.useState(!1),[ne,te]=ke.useState(!1),[D,M]=ke.useState(0),[V,me]=ke.useState(0),ve=ke.useRef(f.duration||k||pk),se=ke.useRef(null),pe=ke.useRef(null),xe=w===0,we=w+1<=x,Ie=f.type,tt=f.dismissible!==!1,Ke=f.className||"",Dt=f.descriptionClassName||"",yt=ke.useMemo(()=>y.findIndex(Oe=>Oe.toastId===f.id)||0,[y,f.id]),Wt=ke.useMemo(()=>{var Oe;return(Oe=f.closeButton)!=null?Oe:P},[f.closeButton,P]),Ct=ke.useMemo(()=>f.duration||k||pk,[f.duration,k]),nt=ke.useRef(0),Ft=ke.useRef(0),kr=ke.useRef(0),ut=ke.useRef(null),[Ue,sn]=$.split("-"),bt=ke.useMemo(()=>y.reduce((Oe,$e,Ze)=>Ze>=yt?Oe:Oe+$e.height,0),[y,yt]),Vr=U6(),Je=f.invert||m,ie=Ie==="loading";Ft.current=ke.useMemo(()=>yt*K+bt,[yt,bt]),ke.useEffect(()=>{ve.current=Ct},[Ct]),ke.useEffect(()=>{J(!0)},[]),ke.useEffect(()=>{let Oe=pe.current;if(Oe){let $e=Oe.getBoundingClientRect().height;return me($e),b(Ze=>[{toastId:f.id,height:$e,position:f.position},...Ze]),()=>b(Ze=>Ze.filter(ht=>ht.toastId!==f.id))}},[b,f.id]),ke.useLayoutEffect(()=>{if(!X)return;let Oe=pe.current,$e=Oe.style.height;Oe.style.height="auto";let Ze=Oe.getBoundingClientRect().height;Oe.style.height=$e,me(Ze),b(ht=>ht.find(_t=>_t.toastId===f.id)?ht.map(_t=>_t.toastId===f.id?{..._t,height:Ze}:_t):[{toastId:f.id,height:Ze,position:f.position},...ht])},[X,f.title,f.description,b,f.id]);let be=ke.useCallback(()=>{le(!0),M(Ft.current),b(Oe=>Oe.filter($e=>$e.toastId!==f.id)),setTimeout(()=>{S(f)},r8)},[f,S,b,Ft]);ke.useEffect(()=>{if(f.promise&&Ie==="loading"||f.duration===1/0||f.type==="loading")return;let Oe;return _||p||z&&Vr?(()=>{if(kr.current<nt.current){let $e=new Date().getTime()-nt.current;ve.current=ve.current-$e}
521kr.current=new Date().getTime()})():ve.current!==1/0&&(nt.current=new Date().getTime(),Oe=setTimeout(()=>{var $e;($e=f.onAutoClose)==null||$e.call(f,f),be()},ve.current)),()=>clearTimeout(Oe)},[_,p,f,Ie,z,Vr,be]),ke.useEffect(()=>{f.delete&&be()},[be,f.delete]);function st(){var Oe,$e,Ze;return G!=null&&G.loading?ke.createElement("div",{className:Cs(R==null?void 0:R.loader,(Oe=f==null?void 0:f.classNames)==null?void 0:Oe.loader,"sonner-loader"),"data-visible":Ie==="loading"},G.loading):H?ke.createElement("div",{className:Cs(R==null?void 0:R.loader,($e=f==null?void 0:f.classNames)==null?void 0:$e.loader,"sonner-loader"),"data-visible":Ie==="loading"},H):ke.createElement($6,{className:Cs(R==null?void 0:R.loader,(Ze=f==null?void 0:f.classNames)==null?void 0:Ze.loader),visible:Ie==="loading"})}return ke.createElement("li",{tabIndex:0,ref:pe,className:Cs(T,Ke,R==null?void 0:R.toast,(e=f==null?void 0:f.classNames)==null?void 0:e.toast,R==null?void 0:R.default,R==null?void 0:R[Ie],(r=f==null?void 0:f.classNames)==null?void 0:r[Ie]),"data-sonner-toast":"","data-rich-colors":(n=f.richColors)!=null?n:N,"data-styled":!(f.jsx||f.unstyled||v),"data-mounted":X,"data-promise":!!f.promise,"data-swiped":ne,"data-removed":de,"data-visible":we,"data-y-position":Ue,"data-x-position":sn,"data-index":w,"data-front":xe,"data-swiping":fe,"data-dismissible":tt,"data-type":Ie,"data-invert":Je,"data-swipe-out":ae,"data-swipe-direction":q,"data-expanded":!!(_||W&&X),style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${de?D:Ft.current}px`,"--initial-height":W?"auto":`${V}px`,...C,...f.style},onDragEnd:()=>{Z(!1),L(null),ut.current=null},onPointerDown:Oe=>{ie||!tt||(se.current=new Date,M(Ft.current),Oe.target.setPointerCapture(Oe.pointerId),Oe.target.tagName!=="BUTTON"&&(Z(!0),ut.current={x:Oe.clientX,y:Oe.clientY}))},onPointerUp:()=>{var Oe,$e,Ze,ht;if(ae||!tt)return;ut.current=null;let _t=Number(((Oe=pe.current)==null?void 0:Oe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Et=Number((($e=pe.current)==null?void 0:$e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Cn=new Date().getTime()-((Ze=se.current)==null?void 0:Ze.getTime()),on=oe==="x"?_t:Et,En=Math.abs(on)/Cn;if(Math.abs(on)>=t8||En>.11){M(Ft.current),(ht=f.onDismiss)==null||ht.call(f,f),he(oe==="x"?_t>0?"right":"left":Et>0?"down":"up"),be(),E(!0),te(!1);return}Z(!1),L(null)},onPointerMove:Oe=>{var $e,Ze,ht,_t;if(!ut.current||!tt||(($e=window.getSelection())==null?void 0:$e.toString().length)>0)return;let Et=Oe.clientY-ut.current.y,Cn=Oe.clientX-ut.current.x,on=(Ze=t.swipeDirections)!=null?Ze:n8($);!oe&&(Math.abs(Cn)>1||Math.abs(Et)>1)&&L(Math.abs(Cn)>Math.abs(Et)?"x":"y");let En={x:0,y:0};oe==="y"?(on.includes("top")||on.includes("bottom"))&&(on.includes("top")&&Et<0||on.includes("bottom")&&Et>0)&&(En.y=Et):oe==="x"&&(on.includes("left")||on.includes("right"))&&(on.includes("left")&&Cn<0||on.includes("right")&&Cn>0)&&(En.x=Cn),(Math.abs(En.x)>0||Math.abs(En.y)>0)&&te(!0),(ht=pe.current)==null||ht.style.setProperty("--swipe-amount-x",`${En.x}px`),(_t=pe.current)==null||_t.style.setProperty("--swipe-amount-y",`${En.y}px`)}},Wt&&!f.jsx?ke.createElement("button",{"aria-label":U,"data-disabled":ie,"data-close-button":!0,onClick:ie||!tt?()=>{}:()=>{var Oe;be(),(Oe=f.onDismiss)==null||Oe.call(f,f)},className:Cs(R==null?void 0:R.closeButton,(s=f==null?void 0:f.classNames)==null?void 0:s.closeButton)},(o=G==null?void 0:G.close)!=null?o:z6):null,f.jsx||g.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:ke.createElement(ke.Fragment,null,Ie||f.icon||f.promise?ke.createElement("div",{"data-icon":"",className:Cs(R==null?void 0:R.icon,(a=f==null?void 0:f.classNames)==null?void 0:a.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||st():null,f.type!=="loading"?f.icon||(G==null?void 0:G[Ie])||O6(Ie):null):null,ke.createElement("div",{"data-content":"",className:Cs(R==null?void 0:R.content,(l=f==null?void 0:f.classNames)==null?void 0:l.content)},ke.createElement("div",{"data-title":"",className:Cs(R==null?void 0:R.title,(c=f==null?void 0:f.classNames)==null?void 0:c.title)},typeof f.title=="function"?f.title():f.title),f.description?ke.createElement("div",{"data-description":"",className:Cs(A,Dt,R==null?void 0:R.description,(u=f==null?void 0:f.classNames)==null?void 0:u.description)},typeof f.description=="function"?f.description():f.description):null),g.isValidElement(f.cancel)?f.cancel:f.cancel&&qf(f.cancel)?ke.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||O,onClick:Oe=>{var $e,Ze;qf(f.cancel)&&tt&&((Ze=($e=f.cancel).onClick)==null||Ze.call($e,Oe),be())},className:Cs(R==null?void 0:R.cancelButton,(d=f==null?void 0:f.classNames)==null?void 0:d.cancelButton)},f.cancel.label):null,g.isValidElement(f.action)?f.action:f.action&&qf(f.action)?ke.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||F,onClick:Oe=>{var $e,Ze;qf(f.action)&&((Ze=($e=f.action).onClick)==null||Ze.call($e,Oe),!Oe.defaultPrevented&&be())},className:Cs(R==null?void 0:R.actionButton,(h=f==null?void 0:f.classNames)==null?void 0:h.actionButton)},f.action.label):null))};function gk(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function i8(t,e){let r={};return[t,e].forEach((n,s)=>{let o=s===1,a=o?"--mobile-offset":"--offset",l=o?X6:J6;function c(u){["top","right","bottom","left"].forEach(d=>{r[`${a}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${a}-${u}`]=l:r[`${a}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(l)}),r}var o8=g.forwardRef(function(t,e){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:o,closeButton:a,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:h,duration:m,style:f,visibleToasts:v=Q6,toastOptions:p,dir:b=gk(),gap:x=e8,loadingIcon:y,icons:w,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:_}=t,[S,N]=ke.useState([]),P=ke.useMemo(()=>Array.from(new Set([n].concat(S.filter(z=>z.position).map(z=>z.position)))),[S,n]),[C,O]=ke.useState([]),[F,T]=ke.useState(!1),[A,k]=ke.useState(!1),[$,K]=ke.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dar
521k":"light"),H=ke.useRef(null),W=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=ke.useRef(null),G=ke.useRef(!1),U=ke.useCallback(z=>{N(oe=>{var L;return(L=oe.find(q=>q.id===z.id))!=null&&L.delete||Tn.dismiss(z.id),oe.filter(({id:q})=>q!==z.id)})},[]);return ke.useEffect(()=>Tn.subscribe(z=>{if(z.dismiss){N(oe=>oe.map(L=>L.id===z.id?{...L,delete:!0}:L));return}setTimeout(()=>{sP.flushSync(()=>{N(oe=>{let L=oe.findIndex(q=>q.id===z.id);return L!==-1?[...oe.slice(0,L),{...oe[L],...z},...oe.slice(L+1)]:[z,...oe]})})})}),[]),ke.useEffect(()=>{if(d!=="system"){K(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;let z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:oe})=>{K(oe?"dark":"light")})}catch{z.addListener(({matches:L})=>{try{K(L?"dark":"light")}catch(q){console.error(q)}})}},[d]),ke.useEffect(()=>{S.length<=1&&T(!1)},[S]),ke.useEffect(()=>{let z=oe=>{var L,q;s.every(he=>oe[he]||oe.code===he)&&(T(!0),(L=H.current)==null||L.focus()),oe.code==="Escape"&&(document.activeElement===H.current||(q=H.current)!=null&&q.contains(document.activeElement))&&T(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[s]),ke.useEffect(()=>{if(H.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,G.current=!1)}},[H.current]),ke.createElement("section",{ref:e,"aria-label":`${j} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((z,oe)=>{var L;let[q,he]=z.split("-");return S.length?ke.createElement("ol",{key:z,dir:b==="auto"?gk():b,tabIndex:-1,ref:H,className:l,"data-sonner-toaster":!0,"data-theme":$,"data-y-position":q,"data-lifted":F&&S.length>1&&!o,"data-x-position":he,style:{"--front-toast-height":`${((L=C[0])==null?void 0:L.height)||0}px`,"--width":`${Z6}px`,"--gap":`${x}px`,...f,...i8(c,u)},onBlur:X=>{G.current&&!X.currentTarget.contains(X.relatedTarget)&&(G.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||G.current||(G.current=!0,R.current=X.relatedTarget)},onMouseEnter:()=>T(!0),onMouseMove:()=>T(!0),onMouseLeave:()=>{A||T(!1)},onDragEnd:()=>T(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||k(!0)},onPointerUp:()=>k(!1)},S.filter(X=>!X.position&&oe===0||X.position===z).map((X,J)=>{var de,le;return ke.createElement(s8,{key:X.id,icons:w,index:J,toast:X,defaultRichColors:h,duration:(de=p==null?void 0:p.duration)!=null?de:m,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:r,visibleToasts:v,closeButton:(le=p==null?void 0:p.closeButton)!=null?le:a,interacting:A,position:z,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:U,toasts:S.filter(fe=>fe.position==X.position),heights:C.filter(fe=>fe.position==X.position),setHeights:O,expandByDefault:o,gap:x,loadingIcon:y,expanded:F,pauseWhenPageIsHidden:_,swipeDirections:t.swipeDirections})})):null}))});const a8=({...t})=>{const{theme:e="system"}=I6();return i.jsx(o8,{position:"top-center",theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground group-[.toast]:group-data-[type=error]:!text-destructive-foreground group-[.toast]:group-data-[type=success]:!text-primary-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:group-data-[type=error]:!bg-destructive group-[.toast]:group-data-[type=error]:!text-destructive-foreground group-[.toast]:group-data-[type=error]:!border-destructive-foreground
vendor: 24,672 bytes, line 521
521/40",error:"group-[.toaster]:!bg-destructive group-[.toaster]:!text-destructive-foreground group-[.toaster]:!border-destructive group-[.toaster]:!shadow-lg",success:"group-[.toaster]:!bg-primary group-[.toaster]:!text-primary-foreground group-[.toaster]:!border-primary",warning:"group-[.toaster]:!bg-accent group-[.toaster]:!text-accent-foreground group-[.toaster]:!border-accent"}},...t})};var l8=o0[" useId ".trim().toString()]||(()=>{}),c8=0;function zn(t){const[e,r]=g.useState(l8());return Br(()=>{t||r(n=>n??String(c8++))},[t]),t||(e?`radix-${e}`:"")}const u8=["top","right","bottom","left"],ra=Math.min,Vn=Math.max,jp=Math.round,Vf=Math.floor,mi=t=>({x:t,y:t}),d8={left:"right",right:"left",bottom:"top",top:"bottom"},h8={start:"end",end:"start"};function Ob(t,e,r){return Vn(t,ra(e,r))}function Vi(t,e){return typeof t=="function"?t(e):t}function Ki(t){return t.split("-")[0]}function fu(t){return t.split("-")[1]}function a_(t){return t==="x"?"y":"x"}function l_(t){return t==="y"?"height":"width"}const f8=new Set(["top","bottom"]);function ui(t){return f8.has(Ki(t))?"y":"x"}function c_(t){return a_(ui(t))}function m8(t,e,r){r===void 0&&(r=!1);const n=fu(t),s=c_(t),o=l_(s);let a=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(a=kp(a)),[a,kp(a)]}function p8(t){const e=kp(t);return[Mb(t),e,Mb(e)]}function Mb(t){return t.replace(/start|end/g,e=>h8[e])}const vk=["left","right"],xk=["right","left"],g8=["top","bottom"],v8=["bottom","top"];function x8(t,e,r){switch(t){case"top":case"bottom":return r?e?xk:vk:e?vk:xk;case"left":case"right":return e?g8:v8;default:return[]}}function y8(t,e,r,n){const s=fu(t);let o=x8(Ki(t),r==="start",n);return s&&(o=o.map(a=>a+"-"+s),e&&(o=o.concat(o.map(Mb)))),o}function kp(t){return t.replace(/left|right|bottom|top/g,e=>d8[e])}function b8(t){return{top:0,right:0,bottom:0,left:0,...t}}function iT(t){return typeof t!="number"?b8(t):{top:t,right:t,bottom:t,left:t}}function Sp(t){const{x:e,y:r,width:n,height:s}=t;return{width:n,height:s,top:r,left:e,right:e+n,bottom:r+s,x:e,y:r}}function yk(t,e,r){let{reference:n,floating:s}=t;const o=ui(e),a=c_(e),l=l_(a),c=Ki(e),u=o==="y",d=n.x+n.width/2-s.width/2,h=n.y+n.height/2-s.height/2,m=n[l]/2-s[l]/2;let f;switch(c){case"top":f={x:d,y:n.y-s.height};break;case"bottom":f={x:d,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:h};break;case"left":f={x:n.x-s.width,y:h};break;default:f={x:n.x,y:n.y}}switch(fu(e)){case"start":f[a]-=m*(r&&u?-1:1);break;case"end":f[a]+=m*(r&&u?-1:1);break}return f}const w8=async(t,e,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:a}=r,l=o.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(e));let u=await a.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=yk(u,n,c),m=n,f={},v=0;for(let p=0;p<l.length;p++){const{name:b,fn:x}=l[p],{x:y,y:w,data:j,reset:_}=await x({x:d,y:h,initialPlacement:n,placement:m,strategy:s,middlewareData:f,rects:u,platform:a,elements:{reference:t,floating:e}});d=y??d,h=w??h,f={...f,[b]:{...f[b],...j}},_&&v<=50&&(v++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(u=_.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:s}):_.rects),{x:d,y:h}=yk(u,m,c)),p=-1)}return{x:d,y:h,placement:m,strategy:s,middlewareData:f}};async function ih(t,e){var r;e===void 0&&(e={});const{x:n,y:s,platform:o,rects:a,elements:l,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=Vi(e,t),v=iT(f),b=l[m?h==="floating"?"reference":"floating":h],x=Sp(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(b)))==null||r?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),y=h==="floating"?{x:n,y:s,width:a.floating.width,height:a.floating.height}:a.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),j=await(o.isElement==null?void 0:o.isElement(w))?await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1}:{x:1,y:1},_=Sp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:w,strategy:c}):y);return{top:(x.top-_.top+v.top)/j.y,bottom:(_.bottom-x.bottom+v.bottom)/j.y,left:(x.left-_.left+v.left)/j.x,right:(_.right-x.right+v.right)/j.x}}const _8=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:s,rects:o,platform:a,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=Vi(t,e)||{};if(u==null)return{};const h=iT(d),m={x:r,y:n},f=c_(s),v=l_(f),p=await a.getDimensions(u),b=f==="y",x=b?"top":"left",y=b?"bottom":"right",w=b?"clientHeight":"clientWidth",j=o.reference[v]+o.reference[f]-m[f]-o.floating[v],_=m[f]-o.reference[f],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let N=S?S[w]:0;(!N||!await(a.isElement==null?void 0:a.isElement(S)))&&(N=l.floating[w]||o.floating[v]);const P=j/2-_/2,C=N/2-p[v]/2-1,O=ra(h[x],C),F=ra(h[y],C),T=O,A=N-p[v]-F,k=N/2-p[v]/2+P,$=Ob(T,k,A),K=!c.arrow&&fu(s)!=null&&k!==$&&o.reference[v]/2-(k<T?O:F)-p[v]/2<0,H=K?k<T?k-T:k-A:0;return{[f]:m[f]+H,data:{[f]:$,centerOffset:k-$-H,...K&&{alignmentOffset:H}},reset:K}}}),j8=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;const{placement:s,middlewareData:o,rects:a,initialPlacement:l,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:p=!0,...b}=Vi(t,e);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const x=Ki(s),y=ui(l),w=Ki(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=m||(w||!p?[kp(l)]:p8(l)),S=v!=="none";!m&&S&&_.push(...y8(l,p,v,j));const N=[l,..._],P=await ih(e,b),C=[];let O=((n=o.flip)==null?void 0:n.overflows)||[];if(d&&C.push(P[x]),h){const k=m8(s,a,j);C.push(P[k[0]],P[k[1]])}if(O=[...O,{placement:s,overflows:C}],!C.every(k=>k<=0)){var F,T;const k=(((F=o.flip)==null?void 0:F.index)||0)+1,$=N[k];if($&&(!(h==="alignment"?y!==ui($):!1)||O.every(W=>W.overflows[0]>0&&ui(W.placement)===y)))return{data:{index:k,overflows:O},reset:{placement:$}};let K=(T=O.filter(H=>H.overflows[0]<=0).sort((H,W)=>H.overflows[1]-W.overflows[1])[0])==null?void 0:T.placement;if(!K)switch(f){case"bestFit":{var A;const H=(A=O.filter(W=>{if(S){const R=ui(W.placement);return R===y||R==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(R=>R>0).reduce((R,G)=>R+G,0)]).sort((W,R)=>W[1]-R[1])[0])==null?void 0:A[0];H&&(K=H);break}case"initialPlacement":K=l;break}if(s!==K)return{reset:{placement:K}}}return{}}}};function bk(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function wk(t){return u8.some(e=>t[e]>=0)}const k8=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...s}=Vi(t,e);switch(n){case"referenceHidden":{const o=await ih(e,{...s,elementContext:"reference"}),a=bk(o,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:wk(a)}}}case"escaped":{const o=await ih(e,{...s,altBoundary:!0}),a=bk(o,r.floating);return{data:{escapedOffsets:a,escaped:wk(a)}}}default:return{}}}}},oT=new Set(["left","top"]);async function S8(t,e){const{placement:r,platform:n,elements:s}=t,o=await(n.isRTL==null?void 0:n.isRTL(s.floating)),a=Ki(r),l=fu(r),c=ui(r)==="y",u=oT.has(a)?-1:1,d=o&&c?-1:1,h=Vi(e,t);let{mainAxis:m,crossAxis:f,alignmentAxis:v}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof v=="number"&&(f=l==="end"?v*-1:v),c?{x:f*d,y:m*u}:{x:m*u,y:f*d}}const N8=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:s,y:o,placement:a,middlewareData:l}=e,c=await S8(e,t);return a===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:a}}}}},C8=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x,y}=b;return{x,y}}},...c}=Vi(t,e),u={x:r,y:n},d=await ih(e,c),h=ui(Ki(s)),m=a_(h);let f=u[m],v=u[h];if(o){const b=m==="y"?"top":"left",x=m==="y"?"bottom":"right",y=f+d[b],w=f-d[x];f=Ob(y,f,w)}if(a){const b=h==="y"?"top":"left",x=h==="y"?"bottom":"right",y=v+d[b],w=v-d[x];v=Ob(y,v,w)}const p=l.fn({...e,[m]:f,[h]:v});return{...p,data:{x:p.x-r,y:p.y-n,enabled:{[m]:o,[h]:a}}}}}},E8=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:s,rects:o,middlewareData:a}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Vi(t,e),d={x:r,y:n},h=ui(s),m=a_(h);let f=d[m],v=d[h];const p=Vi(l,e),b=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const w=m==="y"?"height":"width",j=o.reference[m]-o.floating[w]+b.mainAxis,_=o.reference[m]+o.reference[w]-b.mainAxis;f<j?f=j:f>_&&(f=_)}if(u){var x,y;const w=m==="y"?"width":"height",j=oT.has(Ki(s)),_=o.reference[h]-o.floating[w]+(j&&((x=a.offset)==null?void 0:x[h])||0)+(j?0:b.crossAxis),S=o.reference[h]+o.reference[w]+(j?0:((y=a.offset)==null?void 0:y[h])||0)-(j?b.crossAxis:0);v<_?v=_:v>S&&(v=S)}return{[m]:f,[h]:v}}}},P8=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;const{placement:s,rects:o,platform:a,elements:l}=e,{apply:c=()=>{},...u}=Vi(t,e),d=await ih(e,u),h=Ki(s),m=fu(s),f=ui(s)==="y",{width:v,height:p}=o.floating;let b,x;h==="top"||h==="bottom"?(b=h,x=m===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(x=h,b=m==="end"?"top":"bottom");const y=p-d.top-d.bottom,w=v-d.left-d.right,j=ra(p-d[b],y),_=ra(v-d[x],w),S=!e.middlewareData.shift;let N=j,P=_;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(P=w),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(N=y),S&&!m){const O=Vn(d.left,0),F=Vn(d.right,0),T=Vn(d.top,0),A=Vn(d.bottom,0);f?P=v-2*(O!==0||F!==0?O+F:Vn(d.left,d.right)):N=p-2*(T!==0||A!==0?T+A:Vn(d.top,d.bottom))}await c({...e,availableWidth:P,availableHeight:N});const C=await a.getDimensions(l.floating);return v!==C.width||p!==C.height?{reset:{rects:!0}}:{}}}};function Dg(){return typeof window<"u"}function mu(t){return aT(t)?(t.nodeName||"").toLowerCase():"#document"}function ts(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function yi(t){var e;return(e=(aT(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function aT(t){return Dg()?t instanceof Node||t instanceof ts(t).Node:!1}function Gs(t){return Dg()?t instanceof Element||t instanceof ts(t).Element:!1}function vi(t){return Dg()?t instanceof HTMLElement||t instanceof ts(t).HTMLElement:!1}function _k(t){return!Dg()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ts(t).ShadowRoot}const T8=new Set(["inline","contents"]);function Vh(t){const{overflow:e,overflowX:r,overflowY:n,display:s}=qs(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!T8.has(s)}const A8=new Set(["table","td","th"]);function R8(t){return A8.has(mu(t))}const I8=[":popover-open",":modal"];function Fg(t){return I8.some(e=>{try{return t.matches(e)}catch{return!1}})}const O8=["transform","translate","scale","rotate","perspective"],M8=["transform","translate","scale","rotate","perspective","filter"],$8=["paint","layout","strict","content"];function u_(t){const e=d_(),r=Gs(t)?qs(t):t;return O8.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||M8.some(n=>(r.willChange||"").includes(n))||$8.some(n=>(r.contain||"").includes(n))}function D8(t){let e=na(t);for(;vi(e)&&!Kc(e);){if(u_(e))return e;if(Fg(e))return null;e=na(e)}return null}function d_(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const F8=new Set(["html","body","#document"]);function Kc(t){return F8.has(mu(t))}function qs(t){return ts(t).getComputedStyle(t)}function Lg(t){return Gs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function na(t){if(mu(t)==="html")return t;const e=t.assignedSlot||t.parentNode||_k(t)&&t.host||yi(t);return _k(e)?e.host:e}function lT(t){const e=na(t);return Kc(e)?t.ownerDocument?t.ownerDocument.body:t.body:vi(e)&&Vh(e)?e:lT(e)}function oh(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const s=lT(t),o=s===((n=t.ownerDocument)==null?void 0:n.body),a=ts(s);if(o){const l=$b(a);return e.concat(a,a.visualViewport||[],Vh(s)?s:[],l&&r?oh(l):[])}return e.concat(s,oh(s,[],r))}function $b(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function cT(t){const e=qs(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=vi(t),o=s?t.offsetWidth:r,a=s?t.offsetHeight:n,l=jp(r)!==o||jp(n)!==a;return l&&(r=o,n=a),{width:r,height:n,$:l}}function h_(t){return Gs(t)?t:t.contextElement}function wc(t){const e=h_(t);if(!vi(e))return mi(1);const r=e.getBoundingClientRect(),{width:n,height:s,$:o}=cT(e);let a=(o?jp(r.width):r.width)/n,l=(o?jp(r.height):r.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const L8=mi(0);function uT(t){const e=ts(t);return!d_()||!e.visualViewport?L8:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function B8(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==ts(t)?!1:e}function rl(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const s=t.getBoundingClientRect(),o=h_(t);let a=mi(1);e&&(n?Gs(n)&&(a=wc(n)):a=wc(t));const l=B8(o,r,n)?uT(o):mi(0);let c=(s.left+l.x)/a.x,u=(s.top+l.y)/a.y,d=s.width/a.x,h=s.height/a.y;if(o){const m=ts(o),f=n&&Gs(n)?ts(n):n;let v=m,p=$b(v);for(;p&&n&&f!==v;){const b=wc(p),x=p.getBoundingClientRect(),y=qs(p),w=x.left+(p.clientLeft+parseFloat(y.paddingLeft))*b.x,j=x.top+(p.clientTop+parseFloat(y.paddingTop))*b.y;c*=b.x,u*=b.y,d*=b.x,h*=b.y,c+=w,u+=j,v=ts(p),p=$b(v)}}return Sp({width:d,height:h,x:c,y:u})}function f_(t,e){const r=Lg(t).scrollLeft;return e?e.left+r:rl(yi(t)).left+r}function dT(t,e,r){r===void 0&&(r=!1);const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-(r?0:f_(t,n)),o=n.top+e.scrollTop;return{x:s,y:o}}function z8(t){let{elements:e,rect:r,offsetParent:n,strategy:s}=t;const o=s==="fixed",a=yi(n),l=e?Fg(e.floating):!1;if(n===a||l&&o)return r;let c={scrollLeft:0,scrollTop:0},u=mi(1);const d=mi(0),h=vi(n);if((h||!h&&!o)&&((mu(n)!=="body"||Vh(a))&&(c=Lg(n)),vi(n))){const f=rl(n);u=wc(n),d.x=f.x+n.clientLeft,d.y=f.y+n.clientTop}const m=a&&!h&&!o?dT(a,c,!0):mi(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:r.y*u.y-c.scrollTop*u.y+d.y+m.y}}function U8(t){return Array.from(t.getClientRects())}function W8(t){const e=yi(t),r=Lg(t),n=t.ownerDocument.body,s=Vn(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=Vn(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+f_(t);const l=-r.scrollTop;return qs(n).direction==="rtl"&&(a+=Vn(e.clientWidth,n.clientWidth)-s),{width:s,height:o,x:a,y:l}}function H8(t,e){const r=ts(t),n=yi(t),s=r.visualViewport;let o=n.clientWidth,a=n.clientHeight,l=0,c=0;if(s){o=s.width,a=s.height;const u=d_();(!u||u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:o,height:a,x:l,y:c}}const G8=new Set(["absolute","fixed"]);function q8(t,e){const r=rl(t,!0,e==="fixed"),n=r.top+t.clientTop,s=r.left+t.clientLeft,o=vi(t)?wc(t):mi(1),a=t.clientWidth*o.x,l=t.clientHeight*o.y,c=s*o.x,u=n*o.y;return{width:a,height:l,x:c,y:u}}function jk(t,e,r){let n;if(e==="viewport")n=H8(t,r);else if(e==="document")n=W8(yi(t));else if(Gs(e))n=q8(e,r);else{const s=uT(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Sp(n)}function hT(t,e){const r=na(t);return r===e||!Gs(r)||Kc(r)?!1:qs(r).position==="fixed"||hT(r,e)}function V8(t,e){const r=e.get(t);if(r)return r;let n=oh(t,[],!1).filter(l=>Gs(l)&&mu(l)!=="body"),s=null;const o=qs(t).position==="fixed";let a=o?na(t):t;for(;Gs(a)&&!Kc(a);){const l=qs(a),c=u_(a);!c&&l.position==="fixed"&&(s=null),(o?!c&&!s:!c&&l.position==="static"&&!!s&&G8.has(s.position)||Vh(a)&&!c&&hT(t,a))?n=n.filter(d=>d!==a):s=l,a=na(a)}return e.set(t,n),n}function K8(t){let{element:e,boundary:r,rootBoundary:n,strategy:s}=t;const a=[...r==="clippingAncestors"?Fg(e)?[]:V8(e,this._c):[].concat(r),n],l=a[0],c=a.reduce((u,d)=>{const h=jk(e,d,s);return u.top=Vn(h.top,u.top),u.right=ra(h.right,u.right),u.bottom=ra(h.bottom,u.bottom),u.left=Vn(h.left,u.left),u},jk(e,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Y8(t){const{width:e,height:r}=cT(t);return{width:e,height:r}}function Q8(t,e,r){const n=vi(e),s=yi(e),o=r==="fixed",a=rl(t,!0,o,e);let l={scrollLeft:0,scrollTop:0};const c=mi(0);function u(){c.x=f_(s)}if(n||!n&&!o)if((mu(e)!=="body"||Vh(s))&&(l=Lg(e)),n){const f=rl(e,!0,o,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else s&&u();o&&!n&&s&&u();const d=s&&!n&&!o?dT(s,l):mi(0),h=a.left+l.scrollLeft-c.x-d.x,m=a.top+l.scrollTop-c.y-d.y;return{x:h,y:m,width:a.width,height:a.height}}function Sx(t){return qs(t).position==="static"}function kk(t,e){if(!vi(t)||qs(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return yi(t)===r&&(r=r.ownerDocument.body),r}function fT(t,e){const r=ts(t);if(Fg(t))return r;if(!vi(t)){let s=na(t);for(;s&&!Kc(s);){if(Gs(s)&&!Sx(s))return s;s=na(s)}return r}let n=kk(t,e);for(;n&&R8(n)&&Sx(n);)n=kk(n,e);return n&&Kc(n)&&Sx(n)&&!u_(n)?r:n||D8(t)||r}const J8=async function(t){const e=this.getOffsetParent||fT,r=this.getDimensions,n=await r(t.floating);return{reference:Q8(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function X8(t){return qs(t).direction==="rtl"}const Z8={convertOffsetParentRelativeRectToViewportRelativeRect:z8,getDocumentElement:yi,getClippingRect:K8,getOffsetParent:fT,getElementRects:J8,getClientRects:U8,getDimensions:Y8,getScale:wc,isElement:Gs,isRTL:X8};function mT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function eB(t,e){let r=null,n;const s=yi(t);function o(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const u=t.getBoundingClientRect(),{left:d,top:h,width:m,height:f}=u;if(l||e(),!m||!f)return;const v=Vf(h),p=Vf(s.clientWidth-(d+m)),b=Vf(s.clientHeight-(h+f)),x=Vf(d),w={rootMargin:-v+"px "+-p+"px "+-b+"px "+-x+"px",threshold:Vn(0,ra(1,c))||1};let j=!0;function _(S){const N=S[0].intersectionRatio;if(N!==c){if(!j)return a();N?a(!1,N):n=setTimeout(()=>{a(!1,1e-7)},1e3)}N===1&&!mT(u,t.getBoundingClientRect())&&a(),j=!1}try{r=new IntersectionObserver(_,{...w,root:s.ownerDocument})}catch{r=new IntersectionObserver(_,w)}r.observe(t)}return a(!0),o}function tB(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=h_(t),d=s||o?[...u?oh(u):[],...oh(e)]:[];d.forEach(x=>{s&&x.addEventListener("scroll",r,{passive:!0}),o&&x.addEventListener("resize",r)});const h=u&&l?eB(u,r):null;let m=-1,f=null;a&&(f=new ResizeObserver(x=>{let[y]=x;y&&y.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(e)})),r()}),u&&!c&&f.observe(u),f.observe(e));let v,p=c?rl(t):null;c&&b();function b(){const x=rl(t);p&&!mT(p,x)&&r(),p=x,v=requestAnimationFrame(b)}return r(),()=>{var x;d.forEach(y=>{s&&y.removeEventListener("scroll",r),o&&y.removeEventListener("resize",r)}),h==null||h(),(x=f)==null||x.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const rB=N8,nB=C8,sB=j8,iB=P8,oB=k8,Sk=_8,aB=E8,lB=(t,e,r)=>{const n=new Map,s={platform:Z8,...r},o={...s.platform,_c:n};return w8(t,e,{...s,platform:o})};var cB=typeof document<"u",uB=function(){},Mm=cB?g.useLayoutEffect:uB;function Np(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!Np(t[n],e[n]))return!1;return!0}if(s=Object.keys(t),r=s.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,s[n]))return!1;for(n=r;n--!==0;){const o=s[n];if(!(o==="_owner"&&t.$$typeof)&&!Np(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function pT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Nk(t,e){const r=pT(t);return Math.round(e*r)/r}function Nx(t){const e=g.useRef(t);return Mm(()=>{e.current=t}),e}function dB(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:o,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,h]=g.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[m,f]=g.useState(n);Np(m,n)||f(n);const[v,p]=g.useState(null),[b,x]=g.useState(null),y=g.useCallback(W=>{W!==S.current&&(S.current=W,p(W))},[]),w=g.useCallback(W=>{W!==N.current&&(N.current=W,x(W))},[]),j=o||v,_=a||b,S=g.useRef(null),N=g.useRef(null),P=g.useRef(d),C=c!=null,O=Nx(c),F=Nx(s),T=Nx(u),A=g.useCallback(()=>{if(!S.current||!N.current)return;const W={placement:e,strategy:r,middleware:m};F.current&&(W.platform=F.current),lB(S.current,N.current,W).then(R=>{const G={...R,isPositioned:T.current!==!1};k.current&&!Np(P.current,G)&&(P.current=G,ml.flushSync(()=>{h(G)}))})},[m,e,r,F,T]);Mm(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,h(W=>({...W,isPositioned:!1})))},[u]);const k=g.useRef(!1);Mm(()=>(k.current=!0,()=>{k.current=!1}),[]),Mm(()=>{if(j&&(S.current=j),_&&(N.current=_),j&&_){if(O.current)return O.current(j,_,A);A()}},[j,_,A,O,C]);const $=g.useMemo(()=>({reference:S,floating:N,setReference:y,setFloating:w}),[y,w]),K=g.useMemo(()=>({reference:j,floating:_}),[j,_]),H=g.useMemo(()=>{const W={position:r,left:0,top:0};if(!K.floating)return W;const R=Nk(K.floating,d.x),G=Nk(K.floating,d.y);return l?{...W,transform:"translate("+R+"px, "+G+"px)",...pT(K.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:R,top:G}},[r,l,K.floating,d.x,d.y]);return g.useMemo(()=>({...d,update:A,refs:$,elements:K,floatingStyles:H}),[d,A,$,K,H])}const hB=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:s}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?Sk({element:n.current,padding:s}).fn(r):{}:n?Sk({element:n,padding:s}).fn(r):{}}}},fB=(t,e)=>({...rB(t),options:[t,e]}),mB=(t,e)=>({...nB(t),options:[t,e]}),pB=(t,e)=>({...aB(t),options:[t,e]}),gB=(t,e)=>({...sB(t),options:[t,e]}),vB=(t,e)=>({...iB(t),options:[t,e]}),xB=(t,e)=>({...oB(t),options:[t,e]}),yB=(t,e)=>({...hB(t),options:[t,e]});var bB="Arrow",gT=g.forwardRef((t,e)=>{const{children:r,width:n=10,height:s=5,...o}=t;return i.jsx(Me.svg,{...o,ref:e,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});gT.displayName=bB;var wB=gT;function Kh(t){const[e,r]=g.useState(void 0);return Br(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let a,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=t.offsetWidth,l=t.offsetHeight;r({width:a,height:l})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var m_="Popper",[vT,da]=_r(m_),[_B,xT]=vT(m_),yT=t=>{const{__scopePopper:e,children:r}=t,[n,s]=g.useState(null);return i.jsx(_B,{scope:e,anchor:n,onAnchorChange:s,children:r})};yT.displayName=m_;var bT="PopperAnchor",wT=g.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...s}=t,o=xT(bT,r),a=g.useRef(null),l=Ge(e,a);return g.useEffect(()=>{o.onAnchorChange((n==null?void 0:n.current)||a.current)}),n?null:i.jsx(Me.div,{...s,ref:l})});wT.displayName=bT;var p_="PopperContent",[jB,kB]=vT(p_),_T=g.forwardRef((t,e)=>{var X,J,de,le,fe,Z;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:f="optimized",onPlaced:v,...p}=t,b=xT(p_,r),[x,y]=g.useState(null),w=Ge(e,ae=>y(ae)),[j,_]=g.useState(null),S=Kh(j),N=(S==null?void 0:S.width)??0,P=(S==null?void 0:S.height)??0,C=n+(o!=="center"?"-"+o:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},F=Array.isArray(u)?u:[u],T=F.length>
vendor: 6,554 bytes, line 521
5210,A={padding:O,boundary:F.filter(NB),altBoundary:T},{refs:k,floatingStyles:$,placement:K,isPositioned:H,middlewareData:W}=dB({strategy:"fixed",placement:C,whileElementsMounted:(...ae)=>tB(...ae,{animationFrame:f==="always"}),elements:{reference:b.anchor},middleware:[fB({mainAxis:s+P,alignmentAxis:a}),c&&mB({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?pB():void 0,...A}),c&&gB({...A}),vB({...A,apply:({elements:ae,rects:E,availableWidth:ne,availableHeight:te})=>{const{width:D,height:M}=E.reference,V=ae.floating.style;V.setProperty("--radix-popper-available-width",`${ne}px`),V.setProperty("--radix-popper-available-height",`${te}px`),V.setProperty("--radix-popper-anchor-width",`${D}px`),V.setProperty("--radix-popper-anchor-height",`${M}px`)}}),j&&yB({element:j,padding:l}),CB({arrowWidth:N,arrowHeight:P}),m&&xB({strategy:"referenceHidden",...A})]}),[R,G]=ST(K),U=yr(v);Br(()=>{H&&(U==null||U())},[H,U]);const z=(X=W.arrow)==null?void 0:X.x,oe=(J=W.arrow)==null?void 0:J.y,L=((de=W.arrow)==null?void 0:de.centerOffset)!==0,[q,he]=g.useState();return Br(()=>{x&&he(window.getComputedStyle(x).zIndex)},[x]),i.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:H?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[(le=W.transformOrigin)==null?void 0:le.x,(fe=W.transformOrigin)==null?void 0:fe.y].join(" "),...((Z=W.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(jB,{scope:r,placedSide:R,onArrowChange:_,arrowX:z,arrowY:oe,shouldHideArrow:L,children:i.jsx(Me.div,{"data-side":R,"data-align":G,...p,ref:w,style:{...p.style,animation:H?void 0:"none"}})})})});_T.displayName=p_;var jT="PopperArrow",SB={top:"bottom",right:"left",bottom:"top",left:"right"},kT=g.forwardRef(function(e,r){const{__scopePopper:n,...s}=e,o=kB(jT,n),a=SB[o.placedSide];return i.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:i.jsx(wB,{...s,ref:r,style:{...s.style,display:"block"}})})});kT.displayName=jT;function NB(t){return t!==null}var CB=t=>({name:"transformOrigin",options:t,fn(e){var b,x,y;const{placement:r,rects:n,middlewareData:s}=e,a=((b=s.arrow)==null?void 0:b.centerOffset)!==0,l=a?0:t.arrowWidth,c=a?0:t.arrowHeight,[u,d]=ST(r),h={start:"0%",center:"50%",end:"100%"}[d],m=(((x=s.arrow)==null?void 0:x.x)??0)+l/2,f=(((y=s.arrow)==null?void 0:y.y)??0)+c/2;let v="",p="";return u==="bottom"?(v=a?h:`${m}px`,p=`${-c}px`):u==="top"?(v=a?h:`${m}px`,p=`${n.floating.height+c}px`):u==="right"?(v=`${-c}px`,p=a?h:`${f}px`):u==="left"&&(v=`${n.floating.width+c}px`,p=a?h:`${f}px`),{data:{x:v,y:p}}}});function ST(t){const[e,r="center"]=t.split("-");return[e,r]}var Bg=yT,Yh=wT,zg=_T,Ug=kT,[Wg,dse]=_r("Tooltip",[da]),Hg=da(),NT="TooltipProvider",EB=700,Db="tooltip.open",[PB,g_]=Wg(NT),CT=t=>{const{__scopeTooltip:e,delayDuration:r=EB,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=t,a=g.useRef(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),i.jsx(PB,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:o})};CT.displayName=NT;var ah="Tooltip",[TB,Gg]=Wg(ah),ET=t=>{const{__scopeTooltip:e,children:r,open:n,defaultOpen:s,onOpenChange:o,disableHoverableContent:a,delayDuration:l}=t,c=g_(ah,t.__scopeTooltip),u=Hg(e),[d,h]=g.useState(null),m=zn(),f=g.useRef(0),v=a??c.disableHoverableContent,p=l??c.delayDuration,b=g.useRef(!1),[x,y]=rn({prop:n,defaultProp:s??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(Db))):c.onClose(),o==null||o(N)},caller:ah}),w=g.useMemo(()=>x?b.current?"delayed-open":"instant-open":"closed",[x]),j=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b.current=!1,y(!0)},[y]),_=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,y(!1)},[y]),S=g.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{b.current=!0,y(!0),f.current=0},p)},[p,y]);return g.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),i.jsx(Bg,{...u,children:i.jsx(TB,{scope:e,contentId:m,open:x,stateAttribute:w,trigger:d,onTriggerChange:h,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?S():j()},[c.isOpenDelayedRef,S,j]),onTriggerLeave:g.useCallback(()=>{v?_():(window.clearTimeout(f.current),f.current=0)},[_,v]),onOpen:j,onClose:_,disableHoverableContent:v,children:r})})};ET.displayName=ah;var Fb="TooltipTrigger",PT=g.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=Gg(Fb,r),o=g_(Fb,r),a=Hg(r),l=g.useRef(null),c=Ge(e,l,s.onTriggerChange),u=g.useRef(!1),d=g.useRef(!1),h=g.useCallback(()=>u.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),i.jsx(Yh,{asChild:!0,...a,children:i.jsx(Me.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:je(t.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:je(t.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:je(t.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:je(t.onFocus,()=>{u.current||s.onOpen()}),onBlur:je(t.onBlur,s.onClose),onClick:je(t.onClick,s.onClose)})})});PT.displayName=Fb;var AB="TooltipPortal",[hse,RB]=Wg(AB,{forceMount:void 0}),Yc="TooltipContent",TT=g.forwardRef((t,e)=>{const r=RB(Yc,t.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=t,a=Gg(Yc,t.__scopeTooltip);return i.jsx(Tr,{present:n||a.open,children:a.disableHoverableContent?i.jsx(AT,{side:s,...o,ref:e}):i.jsx(IB,{side:s,...o,ref:e})})}),IB=g.forwardRef((t,e)=>{const r=Gg(Yc,t.__scopeTooltip),n=g_(Yc,t.__scopeTooltip),s=g.useRef(null),o=Ge(e,s),[a,l]=g.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:h}=n,m=g.useCallback(()=>
vendor: 4,196 bytes, line 521
521{l(null),h(!1)},[h]),f=g.useCallback((v,p)=>{const b=v.currentTarget,x={x:v.clientX,y:v.clientY},y=FB(x,b.getBoundingClientRect()),w=LB(x,y),j=BB(p.getBoundingClientRect()),_=UB([...w,...j]);l(_),h(!0)},[h]);return g.useEffect(()=>()=>m(),[m]),g.useEffect(()=>{if(c&&d){const v=b=>f(b,d),p=b=>f(b,c);return c.addEventListener("pointerleave",v),d.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",v),d.removeEventListener("pointerleave",p)}}},[c,d,f,m]),g.useEffect(()=>{if(a){const v=p=>{const b=p.target,x={x:p.clientX,y:p.clientY},y=(c==null?void 0:c.contains(b))||(d==null?void 0:d.contains(b)),w=!zB(x,a);y?m():w&&(m(),u())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,d,a,u,m]),i.jsx(AT,{...t,ref:o})}),[OB,MB]=Wg(ah,{isInside:!1}),$B=aP("TooltipContent"),AT=g.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:a,...l}=t,c=Gg(Yc,r),u=Hg(r),{onClose:d}=c;return g.useEffect(()=>(document.addEventListener(Db,d),()=>document.removeEventListener(Db,d)),[d]),g.useEffect(()=>{if(c.trigger){const h=m=>{const f=m.target;f!=null&&f.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),i.jsx(pl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:i.jsxs(zg,{"data-state":c.stateAttribute,...u,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[i.jsx($B,{children:n}),i.jsx(OB,{scope:r,isInside:!0,children:i.jsx(XF,{id:c.contentId,role:"tooltip",children:s||n})})]})})});TT.displayName=Yc;var RT="TooltipArrow",DB=g.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=Hg(r);return MB(RT,r).isInside?null:i.jsx(Ug,{...s,...n,ref:e})});DB.displayName=RT;function FB(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function LB(t,e,r=5){const n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function BB(t){const{top:e,right:r,bottom:n,left:s}=t;return[{x:s,y:e},{x:r,y:e},{x:r,y:n},{x:s,y:n}]}function zB(t,e){const{x:r,y:n}=t;let s=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){const l=e[o],c=e[a],u=l.x,d=l.y,h=c.x,m=c.y;d>n!=m>n&&r<(h-u)*(n-d)/(m-d)+u&&(s=!s)}return s}function UB(t){const e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),WB(e)}function WB(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n<t.length;n++){const s=t[n];for(;e.length>=2;){const o=e[e.length-1],a=e[e.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const s=t[n];for(;r.length>=2;){const o=r[r.length-1],a=r[r.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))r.pop();else break}r.push(s)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var HB=CT,GB=ET,qB=PT,IT=TT;const Qh=HB,lh=GB,ch=qB,Qc=g.forwardRef(({className:t,sideOffset:e=4,...r},n)=>i.jsx(IT,{ref:n,sideOffset:e,className:Se("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
521de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));Qc.displayName=IT.displayName;var qg=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Vg=typeof window>"u"||"Deno"in globalThis;function Rs(){}function VB(t,e){return typeof t=="function"?t(e):t}function KB(t){return typeof t=="number"&&t>=0&&t!==1/0}function YB(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Lb(t,e){return typeof t=="function"?t(e):t}function QB(t,e){return typeof t=="function"?t(e):t}function Ck(t,e){const{type:r="all",exact:n,fetchStatus:s,predicate:o,queryKey:a,stale:l}=t;if(a){if(n){if(e.queryHash!==v_(a,e.options))return!1}else if(!dh(e.queryKey,a))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||o&&!o(e))}function Ek(t,e){const{exact:r,status:n,predicate:s,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(r){if(uh(e.options.mutationKey)!==uh(o))return!1}else if(!dh(e.options.mutationKey,o))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function v_(t,e){return((e==null?void 0:e.queryKeyHashFn)||uh)(t)}function uh(t){return JSON.stringify(t,(e,r)=>Bb(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function dh(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>dh(t[r],e[r])):!1}function OT(t,e){if(t===e)return t;const r=Pk(t)&&Pk(e);if(r||Bb(t)&&Bb(e)){const n=r?t:Object.keys(t),s=n.length,o=r?e:Object.keys(e),a=o.length,l=r?[]:{},c=new Set(n);let u=0;for(let d=0;d<a;d++){const h=r?d:o[d];(!r&&c.has(h)||r)&&t[h]===void 0&&e[h]===void 0?(l[h]=void 0,u++):(l[h]=OT(t[h],e[h]),l[h]===t[h]&&t[h]!==void 0&&u++)}return s===a&&u===s?t:l}return e}function Pk(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Bb(t){if(!Tk(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!Tk(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Tk(t){return Object.prototype.toString.call(t)==="[object Object]"}function JB(t){return new Promise(e=>{setTimeout(e,t)})}function XB(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?OT(t,e):e}function ZB(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function ez(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var x_=Symbol();function MT(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===x_?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Da,Eo,Ac,F2,tz=(F2=class extends qg{constructor(){super();kt(this,Da);kt(this,Eo);kt(this,Ac);ot(this,Ac,e=>{if(!Vg&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){ye(this,Eo)||this.setEventListener(ye(this,Ac))}onUnsubscribe(){var e;this.hasListeners()||((e=ye(this,Eo))==null||e.call(this),ot(this,Eo,void 0))}setEventListener(e){var r;ot(this,Ac,e),(r=ye(this,Eo))==null||r.call(this),ot(this,Eo,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){ye(this,Da)!==e&&(ot(this,Da,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof ye(this,Da)=="boolean"?ye(this,Da):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Da=new WeakMap,Eo=new WeakMap,Ac=new WeakMap,F2),$T=new tz,Rc,Po,Ic,L2,rz=(L2=class extends qg{constructor(){super();kt(this,Rc,!0);kt(this,Po);kt(this,Ic);ot(this,Ic,e=>{if(!Vg&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n
vendor: 4,369 bytes, line 521
521)}}})}onSubscribe(){ye(this,Po)||this.setEventListener(ye(this,Ic))}onUnsubscribe(){var e;this.hasListeners()||((e=ye(this,Po))==null||e.call(this),ot(this,Po,void 0))}setEventListener(e){var r;ot(this,Ic,e),(r=ye(this,Po))==null||r.call(this),ot(this,Po,e(this.setOnline.bind(this)))}setOnline(e){ye(this,Rc)!==e&&(ot(this,Rc,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return ye(this,Rc)}},Rc=new WeakMap,Po=new WeakMap,Ic=new WeakMap,L2),Cp=new rz;function nz(){let t,e;const r=new Promise((s,o)=>{t=s,e=o});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),t(s)},r.reject=s=>{n({status:"rejected",reason:s}),e(s)},r}function sz(t){return Math.min(1e3*2**t,3e4)}function DT(t){return(t??"online")==="online"?Cp.isOnline():!0}var FT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Cx(t){return t instanceof FT}function LT(t){let e=!1,r=0,n=!1,s;const o=nz(),a=p=>{var b;n||(m(new FT(p)),(b=t.abort)==null||b.call(t))},l=()=>{e=!0},c=()=>{e=!1},u=()=>$T.isFocused()&&(t.networkMode==="always"||Cp.isOnline())&&t.canRun(),d=()=>DT(t.networkMode)&&t.canRun(),h=p=>{var b;n||(n=!0,(b=t.onSuccess)==null||b.call(t,p),s==null||s(),o.resolve(p))},m=p=>{var b;n||(n=!0,(b=t.onError)==null||b.call(t,p),s==null||s(),o.reject(p))},f=()=>new Promise(p=>{var b;s=x=>{(n||u())&&p(x)},(b=t.onPause)==null||b.call(t)}).then(()=>{var p;s=void 0,n||(p=t.onContinue)==null||p.call(t)}),v=()=>{if(n)return;let p;const b=r===0?t.initialPromise:void 0;try{p=b??t.fn()}catch(x){p=Promise.reject(x)}Promise.resolve(p).then(h).catch(x=>{var S;if(n)return;const y=t.retry??(Vg?0:3),w=t.retryDelay??sz,j=typeof w=="function"?w(r,x):w,_=y===!0||typeof y=="number"&&r<y||typeof y=="function"&&y(r,x);if(e||!_){m(x);return}r++,(S=t.onFail)==null||S.call(t,r,x),JB(j).then(()=>u()?void 0:f()).then(()=>{e?m(x):v()})})};return{promise:o,cancel:a,continue:()=>(s==null||s(),o),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?v():f().then(v),o)}}var iz=t=>setTimeout(t,0);function oz(){let t=[],e=0,r=l=>{l()},n=l=>{l()},s=iz;const o=l=>{e?t.push(l):s(()=>{r(l)})},a=()=>{const l=t;t=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||a()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var wn=oz(),Fa,B2,BT=(B2=class{constructor(){kt(this,Fa)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),KB(this.gcTime)&&ot(this,Fa,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Vg?1/0:5*60*1e3))}clearGcTimeout(){ye(this,Fa)&&(clearTimeout(ye(this,Fa)),ot(this,Fa,void 0))}},Fa=new WeakMap,B2),Oc,La,as,Ba,fn,$h,za,Os,Ni,z2,az=(z2=class extends BT{constructor(e){super();kt(this,Os);kt(this,Oc);kt(this,La);kt(this,as);kt(this,Ba);kt(this,fn);kt(this,$h);kt(this,za);ot(this,za,!1),ot(this,$h,e.defaultOptions),this.setOptions(e.options),this.observers=[],ot(this,Ba,e.client),ot(this,as,ye(this,Ba).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,ot(this,Oc,cz(this.options)),this.state=e.state??ye(this,Oc),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ye(this,fn))==null?void 0:e.promise}setOptions(e){this.options={...ye(this,$h),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ye(this,as).remove(this)}setData(e,r){const n=XB(this.state.data,e,this.options);return cn(this,Os,Ni).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){cn(this,Os,Ni).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n,s;const r=(n=ye(this,fn))==null?void 0:n.promise;return(s=ye(this,fn))==null||s.cancel(e),r?r.then(Rs).catch(Rs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ye(this,Oc))}isActive(){return this.observers.some(e=>QB(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===x_||this.state.dataUpdateCount+this.state.errorUpdate
521Count===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Lb(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:!YB(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=ye(this,fn))==null||r.continue()}onOnline(){var r;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=ye(this,fn))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ye(this,as).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(ye(this,fn)&&(ye(this,za)?ye(this,fn).cancel({revert:!0}):ye(this,fn).cancelRetry()),this.scheduleGc()),ye(this,as).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||cn(this,Os,Ni).call(this,{type:"invalidate"})}fetch(e,r){var u,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(ye(this,fn))return ye(this,fn).continueRetry(),ye(this,fn).promise}if(e&&this.setOptions(e),!this.options.queryFn){const m=this.observers.find(f=>f.options.queryFn);m&&this.setOptions(m.options)}const n=new AbortController,s=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(ot(this,za,!0),n.signal)})},o=()=>{const m=MT(this.options,r),v=(()=>{const p={client:ye(this,Ba),queryKey:this.queryKey,meta:this.meta};return s(p),p})();return ot(this,za,!1),this.options.persister?this.options.persister(m,v,this):m(v)},l=(()=>{const m={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:ye(this,Ba),state:this.state,fetchFn:o};return s(m),m})();(u=this.options.behavior)==null||u.onFetch(l,this),ot(this,La,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&cn(this,Os,Ni).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta});const c=m=>{var f,v,p,b;Cx(m)&&m.silent||cn(this,Os,Ni).call(this,{type:"error",error:m}),Cx(m)||((v=(f=ye(this,as).config).onError)==null||v.call(f,m,this),(b=(p=ye(this,as).config).onSettled)==null||b.call(p,this.state.data,m,this)),this.scheduleGc()};return ot(this,fn,LT({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,abort:n.abort.bind(n),onSuccess:m=>{var f,v,p,b;if(m===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(x){c(x);return}(v=(f=ye(this,as).config).onSuccess)==null||v.call(f,m,this),(b=(p=ye(this,as).config).onSettled)==null||b.call(p,m,this.state.error,this),this.scheduleGc()},onError:c,onFail:(m,f)=>{cn(this,Os,Ni).call(this,{type:"failed",failureCount:m,error:f})},onPause:()=>{cn(this,Os,Ni).call(this,{type:"pause"})},onContinue:()=>{cn(this,Os,Ni).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),ye(this,fn).start()}},Oc=new WeakMap,La=new WeakMap,as=new WeakMap,Ba=new WeakMap,fn=new WeakMap,$h=new WeakMap,za=new WeakMap,Os=new WeakSet,Ni=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...lz(n.data,this.options),fetchMeta:e.meta??null};case"success":return ot(this,La,void 0),{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return Cx(s)&&s.revert&&ye(this,La)?{...ye(this,La),fetchStatus:"idle"}
vendor: 3,891 bytes, line 521
521:{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),wn.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),ye(this,as).notify({query:this,type:"updated",action:e})})},z2);function lz(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:DT(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function cz(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var si,U2,uz=(U2=class extends qg{constructor(e={}){super();kt(this,si);this.config=e,ot(this,si,new Map)}build(e,r,n){const s=r.queryKey,o=r.queryHash??v_(s,r);let a=this.get(o);return a||(a=new az({client:e,queryKey:s,queryHash:o,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(a)),a}add(e){ye(this,si).has(e.queryHash)||(ye(this,si).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=ye(this,si).get(e.queryHash);r&&(e.destroy(),r===e&&ye(this,si).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){wn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ye(this,si).get(e)}getAll(){return[...ye(this,si).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>Ck(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>Ck(e,n)):r}notify(e){wn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){wn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){wn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},si=new WeakMap,U2),ii,xn,Ua,oi,xo,W2,dz=(W2=class extends BT{constructor(e){super();kt(this,oi);kt(this,ii);kt(this,xn);kt(this,Ua);this.mutationId=e.mutationId,ot(this,xn,e.mutationCache),ot(this,ii,[]),this.state=e.state||hz(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ye(this,ii).includes(e)||(ye(this,ii).push(e),this.clearGcTimeout(),ye(this,xn).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){ot(this,ii,ye(this,ii).filter(r=>r!==e)),this.scheduleGc(),ye(this,xn).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ye(this,ii).length||(this.state.status==="pending"?this.scheduleGc():ye(this,xn).remove(this))}continue(){var e;return((e=ye(this,Ua))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,u,d,h,m,f,v,p,b,x,y,w,j,_,S,N,P;const r=()=>{cn(this,oi,xo).call(this,{type:"continue"})};ot(this,Ua,LT({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(C,O)=>{cn(this,oi,xo).call(this,{type:"failed",failureCount:C,error:O})},onPause:()=>{cn(this,oi,xo).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ye(this,xn).canRun(this)}));const n=this.state.status==="pending",s=!ye(this,Ua).canStart();try{if(n)r();else{cn(this,oi,xo).call(this,{type:"pending",variables:e,isPaused:s}),await((a=(o=ye(this,xn).config).onMutate)==null?void 0:a.call(o,e,this));const O=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e));O!==this.state.context&&cn(this,oi,xo).call(this,{type:"pending",context:O,variables:e,isPaused:s})}
521const C=await ye(this,Ua).start();return await((d=(u=ye(this,xn).config).onSuccess)==null?void 0:d.call(u,C,e,this.state.context,this)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,C,e,this.state.context)),await((v=(f=ye(this,xn).config).onSettled)==null?void 0:v.call(f,C,null,this.state.variables,this.state.context,this)),await((b=(p=this.options).onSettled)==null?void 0:b.call(p,C,null,e,this.state.context)),cn(this,oi,xo).call(this,{type:"success",data:C}),C}catch(C){try{throw await((y=(x=ye(this,xn).config).onError)==null?void 0:y.call(x,C,e,this.state.context,this)),await((j=(w=this.options).onError)==null?void 0:j.call(w,C,e,this.state.context)),await((S=(_=ye(this,xn).config).onSettled)==null?void 0:S.call(_,void 0,C,this.state.variables,this.state.context,this)),await((P=(N=this.options).onSettled)==null?void 0:P.call(N,void 0,C,e,this.state.context)),C}finally{cn(this,oi,xo).call(this,{type:"error",error:C})}}finally{ye(this,xn).runNext(this)}}},ii=new WeakMap,xn=new WeakMap,Ua=new WeakMap,oi=new WeakSet,xo=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),wn.batch(()=>{ye(this,ii).forEach(n=>{n.onMutationUpdate(e)}),ye(this,xn).notify({mutation:this,type:"updated",action:e})})},W2);function hz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ii,Ms,Dh,H2,fz=(H2=class extends qg{constructor(e={}){super();kt(this,Ii);kt(this,Ms);kt(this,Dh);this.config=e,ot(this,Ii,new Set),ot(this,Ms,new Map),ot(this,Dh,0)}build(e,r,n){const s=new dz({mutationCache:this,mutationId:++Sf(this,Dh)._,options:e.defaultMutationOptions(r),state:n});return this.add(s),s}add(e){ye(this,Ii).add(e);const r=Kf(e);if(typeof r=="string"){const n=ye(this,Ms).get(r);n?n.push(e):ye(this,Ms).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ye(this,Ii).delete(e)){const r=Kf(e);if(typeof r=="string"){const n=ye(this,Ms).get(r);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&ye(this,Ms).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Kf(e);if(typeof r=="string"){const n=ye(this,Ms).get(r),s=n==null?void 0:n.find(o=>o.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const r=Kf(e);if(typeof r=="string"){const s=(n=ye(this,Ms).get(r))==null?void 0:n.find(o=>o!==e&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){wn.batch(()=>{ye(this,Ii).forEach(e=>{this.notify({type:"removed",mutation:e})}),ye(this,Ii).clear(),ye(this,Ms).clear()})}getAll(){return Array.from(ye(this,Ii))}find(e){const r={exact:!0,...e};return this.getAll().find(n=>Ek(r,n))}findAll(e={}){return this.getAll().filter(r=>Ek(e,r))}notify(e){wn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>
vendor: 6,930 bytes, lines 521-530
521r.state.isPaused);return wn.batch(()=>Promise.all(e.map(r=>r.continue().catch(Rs))))}},Ii=new WeakMap,Ms=new WeakMap,Dh=new WeakMap,H2);function Kf(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Ak(t){return{onFetch:(e,r)=>{var d,h,m,f,v;const n=e.options,s=(m=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,o=((f=e.state.data)==null?void 0:f.pages)||[],a=((v=e.state.data)==null?void 0:v.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const b=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?p=!0:e.signal.addEventListener("abort",()=>{p=!0}),e.signal)})},x=MT(e.options,e.fetchOptions),y=async(w,j,_)=>{if(p)return Promise.reject();if(j==null&&w.pages.length)return Promise.resolve(w);const N=(()=>{const F={client:e.client,queryKey:e.queryKey,pageParam:j,direction:_?"backward":"forward",meta:e.options.meta};return b(F),F})(),P=await x(N),{maxPages:C}=e.options,O=_?ez:ZB;return{pages:O(w.pages,P,C),pageParams:O(w.pageParams,j,C)}};if(s&&o.length){const w=s==="backward",j=w?mz:Rk,_={pages:o,pageParams:a},S=j(n,_);l=await y(_,S,w)}else{const w=t??o.length;do{const j=c===0?a[0]??n.initialPageParam:Rk(n,l);if(c>0&&j==null)break;l=await y(l,j),c++}while(c<w)}return l};e.options.persister?e.fetchFn=()=>{var p,b;return(b=(p=e.options).persister)==null?void 0:b.call(p,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=u}}}function Rk(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function mz(t,{pages:e,pageParams:r}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r):void 0}var ur,To,Ao,Mc,$c,Ro,Dc,Fc,G2,pz=(G2=class{constructor(t={}){kt(this,ur);kt(this,To);kt(this,Ao);kt(this,Mc);kt(this,$c);kt(this,Ro);kt(this,Dc);kt(this,Fc);ot(this,ur,t.queryCache||new uz),ot(this,To,t.mutationCache||new fz),ot(this,Ao,t.defaultOptions||{}),ot(this,Mc,new Map),ot(this,$c,new Map),ot(this,Ro,0)}mount(){Sf(this,Ro)._++,ye(this,Ro)===1&&(ot(this,Dc,$T.subscribe(async t=>{t&&(await this.resumePausedMutations(),ye(this,ur).onFocus())})),ot(this,Fc,Cp.subscribe(async t=>{t&&(await this.resumePausedMutations(),ye(this,ur).onOnline())})))}unmount(){var t,e;Sf(this,Ro)._--,ye(this,Ro)===0&&((t=ye(this,Dc))==null||t.call(this),ot(this,Dc,void 0),(e=ye(this,Fc))==null||e.call(this),ot(this,Fc,void 0))}isFetching(t){return ye(this,ur).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ye(this,To).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=ye(this,ur).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=ye(this,ur).build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Lb(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return ye(this,ur).findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),s=ye(this,ur).get(n.queryHash),o=s==null?void 0:s.state.data,a=VB(e,o);if(a!==void 0)return ye(this,ur).build(this,n).setData(a,{...r,manual:!0})}setQueriesData(t,e,r){return wn.batch(()=>ye(this,ur).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=ye(this,ur).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=ye(this,ur);wn.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=ye(this,ur);return wn.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=wn.batch(()=>ye(this,ur).findAll(t).map(s=>s.cancel(r)));return Promise.all(n).then(Rs).catch(Rs)}invalidateQueries(t,e={}){return wn.batch(()=>(ye(this,ur).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=wn.batch(()=>ye(this,ur).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,r);return r.throwOnError||(o=o.catch(Rs)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(Rs)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=ye(this,ur).build(this,e);return r.isStaleByTime(Lb(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Rs).catch(Rs)}fetchInfiniteQuery(t){return t.behavior=Ak(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Rs).catch(Rs)}ensureInfiniteQueryData(t){return t.behavior=Ak(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Cp.isOnline()?ye(this,To).resumePausedMutations():Promise.resolve()}getQueryCache(){return ye(this,ur)}getMutationCache(){return ye(this,To)}getDefaultOptions(){return ye(this,Ao)}setDefaultOptions(t){ot(this,Ao,t)}setQueryDefaults(t,e){ye(this,Mc).set(uh(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ye(this,Mc).values()],r={};return e.forEach(n=>{dh(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){ye(this,$c).set(uh(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ye(this,$c).values()],r={};return e.forEach(n=>{dh(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ye(this,Ao).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=v_(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===x_&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ye(this,Ao).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ye(this,ur).clear(),ye(this,To).clear()}},ur=new WeakMap,To=new WeakMap,Ao=new WeakMap,Mc=new WeakMap,$c=new WeakMap,Ro=new WeakMap,Dc=new WeakMap,Fc=new WeakMap,G2),gz=g.createContext(void 0),vz=({client:t,children:e})=>(g.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),i.jsx(gz.Provider,{value:t,children:e}));/**
522 * @remix-run/router v1.23.0
523 *
524 * Copyright (c) Remix Software Inc.
525 *
526 * This source code is licensed under the MIT license found in the
527 * LICENSE.md file in the root directory of this source tree.
528 *
529 * @license MIT
530 */function hh(){return hh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];
vendor: 5,028 bytes, line 530
530for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},hh.apply(this,arguments)}var Mo;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Mo||(Mo={}));const Ik="popstate";function xz(t){t===void 0&&(t={});function e(n,s){let{pathname:o,search:a,hash:l}=n.location;return zb("",{pathname:o,search:a,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function r(n,s){return typeof s=="string"?s:Ep(s)}return bz(e,r,null,t)}function br(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function zT(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function yz(){return Math.random().toString(36).substr(2,8)}function Ok(t,e){return{usr:t.state,key:t.key,idx:e}}function zb(t,e,r,n){return r===void 0&&(r=null),hh({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?pu(e):e,{state:r,key:e&&e.key||n||yz()})}function Ep(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function pu(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function bz(t,e,r,n){n===void 0&&(n={});let{window:s=document.defaultView,v5Compat:o=!1}=n,a=s.history,l=Mo.Pop,c=null,u=d();u==null&&(u=0,a.replaceState(hh({},a.state,{idx:u}),""));function d(){return(a.state||{idx:null}).idx}function h(){l=Mo.Pop;let b=d(),x=b==null?null:b-u;u=b,c&&c({action:l,location:p.location,delta:x})}function m(b,x){l=Mo.Push;let y=zb(p.location,b,x);u=d()+1;let w=Ok(y,u),j=p.createHref(y);try{a.pushState(w,"",j)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;s.location.assign(j)}o&&c&&c({action:l,location:p.location,delta:1})}function f(b,x){l=Mo.Replace;let y=zb(p.location,b,x);u=d();let w=Ok(y,u),j=p.createHref(y);a.replaceState(w,"",j),o&&c&&c({action:l,location:p.location,delta:0})}function v(b){let x=s.location.origin!=="null"?s.location.origin:s.location.href,y=typeof b=="string"?b:Ep(b);return y=y.replace(/ $/,"%20"),br(x,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,x)}let p={get action(){return l},get location(){return t(s,a)},listen(b){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Ik,h),c=b,()=>{s.removeEventListener(Ik,h),c=null}},createHref(b){return e(s,b)},createURL:v,encodeLocation(b){let x=v(b);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:m,replace:f,go(b){return a.go(b)}};return p}var Mk;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Mk||(Mk={}));function wz(t,e,r){return r===void 0&&(r="/"),_z(t,e,r,!1)}function _z(t,e,r,n){let s=typeof e=="string"?pu(e):e,o=y_(s.pathname||"/",r);if(o==null)return null;let a=UT(t);jz(a);let l=null;for(let c=0;l==null&&c<a.length;++c){let u=Oz(o);l=Rz(a[c],u,n)}return l}function UT(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let s=(o,a,l)=>{let c={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};c.relativePath.startsWith("/")&&(br(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=Go([n,c.relativePath]),d=r.concat(c);o.children&&o.children.length>0&&(br(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),UT(o.children,e,d,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:Tz(u,o.index),routesMeta:d})};return t.forEach((o,a)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))s(o,a);else for(let c of WT(o.path))s(o,a,c)}),e}function WT(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,s=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return s?[o,""]:[o];let a=WT(n.join("/")),l=[];return l.push(...a.map(c=>c===""?o:[o,c].join("/"))),s&&l.push(...a),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function jz(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:Az(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const kz=/^:[\w-]+$/,Sz=3,Nz=2,Cz=1,Ez=10,Pz=-2,$k=t=>t==="*";function Tz(t,e){let r=t.split("/"),n=r.length;return r.some($k)&&(n+=Pz),e&&(n+=Nz),r.filter(s=>!$k(s)).reduce((s,o)=>s+(kz.test(o)?Sz:o===""?Cz:Ez),n)}function Az(t,e){return t.length===e.length&&t.slice(0,-1).every((n,s)=>n===e[s])?t[t.length-1]-e[e.length-1]:0}function Rz(t,e,r){let{routesMeta:n}=t,s={},o="/",a=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=o==="/"?e:e.slice(o.length)||"/",h=Dk({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),m=c.route;if(!h&&u&&r&&!n[n.length-1].route.index&&(h=Dk({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;
vendor: 9,263 bytes, lines 530-539
530Object.assign(s,h.params),a.push({params:s,pathname:Go([o,h.pathname]),pathnameBase:Fz(Go([o,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(o=Go([o,h.pathnameBase]))}return a}function Dk(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=Iz(t.path,t.caseSensitive,t.end),s=e.match(r);if(!s)return null;let o=s[0],a=o.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((u,d,h)=>{let{paramName:m,isOptional:f}=d;if(m==="*"){let p=l[h]||"";a=o.slice(0,o.length-p.length).replace(/(.)\/+$/,"$1")}const v=l[h];return f&&!v?u[m]=void 0:u[m]=(v||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:a,pattern:t}}function Iz(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),zT(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),n]}function Oz(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return zT(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function y_(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function Mz(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:s=""}=typeof t=="string"?pu(t):t;return{pathname:r?r.startsWith("/")?r:$z(r,e):e,search:Lz(n),hash:Bz(s)}}function $z(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Ex(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"].  Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Dz(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function b_(t,e){let r=Dz(t);return e?r.map((n,s)=>s===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function w_(t,e,r,n){n===void 0&&(n=!1);let s;typeof t=="string"?s=pu(t):(s=hh({},t),br(!s.pathname||!s.pathname.includes("?"),Ex("?","pathname","search",s)),br(!s.pathname||!s.pathname.includes("#"),Ex("#","pathname","hash",s)),br(!s.search||!s.search.includes("#"),Ex("#","search","hash",s)));let o=t===""||s.pathname==="",a=o?"/":s.pathname,l;if(a==null)l=r;else{let h=e.length-1;if(!n&&a.startsWith("..")){let m=a.split("/");for(;m[0]==="..";)m.shift(),h-=1;s.pathname=m.join("/")}l=h>=0?e[h]:"/"}let c=Mz(s,l),u=a&&a!=="/"&&a.endsWith("/"),d=(o||a===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Go=t=>t.join("/").replace(/\/\/+/g,"/"),Fz=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Lz=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Bz=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function zz(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const HT=["post","put","patch","delete"];new Set(HT);const Uz=["get",...HT];new Set(Uz);/**
531 * React Router v6.30.1
532 *
533 * Copyright (c) Remix Software Inc.
534 *
535 * This source code is licensed under the MIT license found in the
536 * LICENSE.md file in the root directory of this source tree.
537 *
538 * @license MIT
539 */function fh(){return fh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},fh.apply(this,arguments)}const __=g.createContext(null),Wz=g.createContext(null),ha=g.createContext(null),Kg=g.createContext(null),Xi=g.createContext({outlet:null,matches:[],isDataRoute:!1}),GT=g.createContext(null);function Hz(t,e){let{relative:r}=e===void 0?{}:e;gu()||br(!1);let{basename:n,navigator:s}=g.useContext(ha),{hash:o,pathname:a,search:l}=VT(t,{relative:r}),c=a;return n!=="/"&&(c=a==="/"?n:Go([n,a])),s.createHref({pathname:c,search:l,hash:o})}function gu(){return g.useContext(Kg)!=null}function Zi(){return gu()||br(!1),g.useContext(Kg).location}function qT(t){g.useContext(ha).static||g.useLayoutEffect(t)}function Zt(){let{isDataRoute:t}=g.useContext(Xi);return t?nU():Gz()}function Gz(){gu()||br(!1);let t=g.useContext(__),{basename:e,future:r,navigator:n}=g.useContext(ha),{matches:s}=g.useContext(Xi),{pathname:o}=Zi(),a=JSON.stringify(b_(s,r.v7_relativeSplatPath)),l=g.useRef(!1);return qT(()=>{l.current=!0}),g.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let h=w_(u,JSON.parse(a),o,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Go([e,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[e,n,a,o,t])}function j_(){let{matches:t}=g.useContext(Xi),e=t[t.length-1];return e?e.params:{}}function VT(t,e){let{relative:r}=e===void 0?{}:e,{future:n}=g.useContext(ha),{matches:s}=g.useContext(Xi),{pathname:o}=Zi(),a=JSON.stringify(b_(s,n.v7_relativeSplatPath));return g.useMemo(()=>w_(t,JSON.parse(a),o,r==="path"),[t,a,o,r])}function qz(t,e){return Vz(t,e)}function Vz(t,e,r,n){gu()||br(!1);let{navigator:s}=g.useContext(ha),{matches:o}=g.useContext(Xi),a=o[o.length-1],l=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let u=Zi(),d;if(e){var h;let b=typeof e=="string"?pu(e):e;c==="/"||(h=b.pathname)!=null&&h.startsWith(c)||br(!1),d=b}else d=u;let m=d.pathname||"/",f=m;if(c!=="/"){let b=c.replace(/^\//,"").split("/");f="/"+m.replace(/^\//,"").split("/").slice(b.length).join("/")}let v=wz(t,{pathname:f}),p=Xz(v&&v.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:Go([c,s.encodeLocation?s.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:Go([c,s.encodeLocation?s.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),o,r,n);return e&&p?g.createElement(Kg.Provider,{value:{location:fh({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Mo.Pop}},p):p}function Kz(){let t=rU(),e=zz(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},e),r?g.createElement("pre",{style:s},r):null,null)}const Yz=g.createElement(Kz,null);class Qz extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?g.createElement(Xi.Provider,{value:this.props.routeContext},g.createElement(GT.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Jz(t){let{routeContext:e,match:r,children:n}=t,s=g.useContext(__);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),g.createElement(Xi.Provider,{value:e},n)}function Xz(t,e,r,n){var s;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if(!r)return null;if(r.errors)t=r.matches;else if((o=n)!=null&&o.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let a=t,l=(s=r)==null?void 0:s.errors;if(l!=null){let d=a.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);d>=0||br(!1),a=a.slice(0,Math.min(a.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<a.length;d++){let h=a[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:m,errors:f}=r,v=h.route.loader&&m[h.route.id]===void 0&&(!f||f[h.route.id]===void 0);if(h.route.lazy||v){c=!0,u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}return a.reduceRight((d,h,m)=>{let f,v=!1,p=null,b=null;r&&(f=l&&h.route.id?l[h.route.id]:void 0,p=h.route.errorElement||Yz,c&&(u<0&&m===0?(v=!0,b=null):u===m&&(v=!0,b=h.route.hydrateFallbackElement||null)));let x=e.concat(a.slice(0,m+1)),y=()=>{let w;return f?w=p:v?w=b:h.route.Component?w=g.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=d,g.createElement(Jz,{match:h,routeC
539ontext:{outlet:d,matches:x,isDataRoute:r!=null},children:w})};return r&&(h.route.ErrorBoundary||h.route.errorElement||m===0)?g.createElement(Qz,{location:r.location,revalidation:r.revalidation,component:p,error:f,children:y(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):y()},null)}var KT=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(KT||{}),Pp=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Pp||{});function Zz(t){let e=g.useContext(__);return e||br(!1),e}function eU(t){let e=g.useContext(Wz);return e||br(!1),e}function tU(t){let e=g.useContext(Xi);return e||br(!1),e}function YT(t){let e=tU(),r=e.matches[e.matches.length-1];return r.route.id||br(!1),r.route.id}function rU(){var t;let e=g.useContext(GT),r=eU(Pp.UseRouteError),n=YT(Pp.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function nU(){let{router:t}=Zz(KT.UseNavigateStable),e=YT(Pp.UseNavigateStable),r=g.useRef(!1);return qT(()=>{r.current=!0}),g.useCallback(function(s,o){o===void 0&&(o={}),r.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,fh({fromRouteId:e},o)))},[t,e])}function sU(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Ub(t){let{to:e,replace:r,state:n,relative:s}=t;gu()||br(!1);let{future:o,static:a}=g.useContext(ha),{matches:l}=g.useContext(Xi),{pathname:c}=Zi(),u=Zt(),d=w_(e,b_(l,o.v7_relativeSplatPath),c,s==="path"),h=JSON.stringify(d);return g.useEffect(()=>u(JSON.parse(h),{replace:r,state:n,relative:s}),[u,h,s,r,n]),null}function Vt(t){br(!1)}function iU(t){let{basename:e="/",children:r=null,location:n,navigationType:s=Mo.Pop,navigator:o,static:a=!1,future:l}=t;gu()&&br(!1);let c=e.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:c,navigator:o,static:a,future:fh({v7_relativeSplatPath:!1},l)}),[c,l,o,a]);typeof n=="string"&&(n=pu(n));let{pathname:d="/",search:h="",hash:m="",state:f=null,key:v="default"}=n,p=g.useMemo(()=>{let b=y_(d,c);return b==null?null:{location:{pathname:b,search:h,hash:m,state:f,key:v},navigationType:s}},[c,d,h,m,f,v,s]);return p==null?null:g.createElement(ha.Provider,{value:u},g.createElement(Kg.Provider,{children:r,value:p}))}function oU(t){let{children:e,location:r}=t;return qz(Wb(e),r)}new Promise(()=>{});function Wb(t,e){e===void 0&&(e=[]);let r=[];return g.Children.forEach(t,(n,s)=>{if(!g.isValidElement(n))return;let o=[...e,s];if(n.type===g.Fragment){r.push.apply(r,Wb(n.props.children,o));return}n.type!==Vt&&br(!1),!n.props.index||!n.props.children||br(!1);let a={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(a.children=Wb(n.props.children,o)),r.push(a)}),r}/**
540 * React Router DOM v6.30.1
541 *
542 * Copyright (c) Remix Software Inc.
543 *
544 * This source code is licensed under the MIT license found in the
545 * LICENSE.md file in the root directory of this source tree.
546 *
547 * @license MIT
548 */function Hb(){return Hb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Hb.apply(this,arguments)}function aU(t,e){if(t==null)return{};var r={},n=Object.keys(t),s,o;for(o=0;o<n.length;o++)s=n[o],!(e.indexOf(s)>=0)&&(r[s]=t[s]);return r}function lU(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function cU(t,e){return t.button===0&&(!e||e==="_self")&&!lU(t)}function Gb(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,r)=>{let n=t[r];return e.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function uU(t,e){let r=Gb(t);return e&&e.forEach((n,s)=>
548{r.has(s)||e.getAll(s).forEach(o=>{r.append(s,o)})}),r}const dU=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],hU="6";try{window.__reactRouterVersion=hU}catch{}const fU="startTransition",Fk=o0[fU];function mU(t){let{basename:e,children:r,future:n,window:s}=t,o=g.useRef();o.current==null&&(o.current=xz({window:s,v5Compat:!0}));let a=o.current,[l,c]=g.useState({action:a.action,location:a.location}),{v7_startTransition:u}=n||{},d=g.useCallback(h=>{u&&Fk?Fk(()=>c(h)):c(h)},[c,u]);return g.useLayoutEffect(()=>a.listen(d),[a,d]),g.useEffect(()=>sU(n),[n]),g.createElement(iU,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:a,future:n})}const pU=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gU=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,No=g.forwardRef(function(e,r){let{onClick:n,relative:s,reloadDocument:o,replace:a,state:l,target:c,to:u,preventScrollReset:d,viewTransition:h}=e,m=aU(e,dU),{basename:f}=g.useContext(ha),v,p=!1;if(typeof u=="string"&&gU.test(u)&&(v=u,pU))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),_=y_(j.pathname,f);j.origin===w.origin&&_!=null?u=_+j.search+j.hash:p=!0}catch{}let b=Hz(u,{relative:s}),x=vU(u,{replace:a,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:h});function y(w){n&&n(w),w.defaultPrevented||x(w)}return g.createElement("a",Hb({},m,{href:v||b,onClick:p||o?n:y,ref:r,target:c}))});var Lk;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Lk||(Lk={}));var Bk;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Bk||(Bk={}));function vU(t,e){let{target:r,replace:n,state:s,preventScrollReset:o,relative:a,viewTransition:l}=e===void 0?{}:e,c=Zt(),u=Zi(),d=VT(t,{relative:a});return g.useCallback(h=>{if(cU(h,r)){h.preventDefault();let m=n!==void 0?n:Ep(u)===Ep(d);c(t,{replace:m,state:s,preventScrollReset:o,relative:a,viewTransition:l})}},[u,c,d,n,s,r,t,o,a,l])}function eo(t){let e=g.useRef(Gb(t)),r=g.useRef(!1),n=Zi(),s=g.useMemo(()=>uU(n.search,r.current?null:e.current),[n.search]),o=Zt(),a=g.useCallback((l,c)=>{const u=Gb(typeof l=="function"?l(s):l);r.current=!0,o("?"+u,c)},[o,s]);return[s,a]}var ci=function(){return ci=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},ci.apply(this,arguments)};function vu(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function xU(t,e,r,n){function s(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function l(d){try{u(n.next(d))}catch(h){a(h)}}function c(d){try{u(n.throw(d))}catch(h){a(h)}}function u(d){d.done?o(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})}function yU(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,o;n<s;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))}const bU=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class k_ extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}}class wU extends k_{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class zk extends k_{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Uk extends k_{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var qb;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(qb||(qb={}));class _U{constructor(e,{headers:r={},customFetch:n,region:s=qb.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=bU(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return xU(this,arguments,void 0,function*(r,n={}){var s;let o,a;try{const{headers:l,method:c,body:u,signal:d,timeout:h}=n;let m={},{region:f}=n;f||(f=this.region);const v=new URL(`${this.url}/${r}`);f&&f!=="any"&&(m["x-region"]=f,v.searchParams.set("forceFunctionRegion",f));let p;u&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",p=u):typeof u=="string"?(m["Content-Type"]="text/plain",p=u):typeof FormData<"u"&&u instanceof FormData?p=u:(m["Content-Type"]="application/json",p=JSON.stringify(u)):p=u;let b=d;h&&(a=new AbortController,o=setTimeout(()=>a.abort(),h),d?(b=a.signal,d.addEventListener("abort",()=>a.abort())):b=a.signal);const x=yield this.fetch(v.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),l),body:p,signal:b}).catch(_=>{throw new wU(_)}),y=x.headers.get("x-relay-error");
548if(y&&y==="true")throw new zk(x);if(!x.ok)throw new Uk(x);let w=((s=x.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),j;return w==="application/json"?j=yield x.json():w==="application/octet-stream"||w==="application/pdf"?j=yield x.blob():w==="text/event-stream"?j=x:w==="multipart/form-data"?j=yield x.formData():j=yield x.text(),{data:j,error:null,response:x}}catch(l){return{data:null,error:l,response:l instanceof Uk||l instanceof zk?l.context:void 0}}finally{o&&clearTimeout(o)}})}}var jU=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},kU=class{constructor(t){var e,r;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var r=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const n=this.fetch;let s=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{let a=null,l=null,c=null,u=o.status,d=o.statusText;if(o.ok){var h,m;if(r.method!=="HEAD"){var f;const x=await o.text();x===""||(r.headers.get("Accept")==="text/csv"||r.headers.get("Accept")&&(!((f=r.headers.get("Accept"))===null||f===void 0)&&f.includes("application/vnd.pgrst.plan+text"))?l=x:l=JSON.parse(x))}const p=(h=r.headers.get("Prefer"))===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),b=(m=o.headers.get("content-range"))===null||m===void 0?void 0:m.split("/");p&&b&&b.length>1&&(c=parseInt(b[1])),r.isMaybeSingle&&r.method==="GET"&&Array.isArray(l)&&(l.length>1?(a={code:"PGRST116",details:`Results contain ${l.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},l=null,c=null,u=406,d="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{var v;const p=await o.text();try{a=JSON.parse(p),Array.isArray(a)&&o.status===404&&(l=[],a=null,u=200,d="OK")}catch{o.status===404&&p===""?(u=204,d="No Content"):a={message:p}}if(a&&r.isMaybeSingle&&(!(a==null||(v=a.details)===null||v===void 0)&&v.includes("0 rows"))&&(a=null,u=200,d="OK"),a&&r.shouldThrowOnError)throw new jU(a)}return{error:a,data:l,count:c,status:u,statusText:d}});return this.shouldThrowOnError||(s=s.catch(o=>{var a;let l="";const c=o==null?void 0:o.cause;if(c){var u,d,h,m;const v=(u=c==null?void 0:c.message)!==null&&u!==void 0?u:"",p=(d=c==null?void 0:c.code)!==null&&d!==void 0?d:"";l=`${(h=o==null?void 0:o.name)!==null&&h!==void 0?h:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
549
550Caused by: ${(m=c==null?void 0:c.name)!==null&&m!==void 0?m:"Error"}: ${v}`,p&&(l+=` (${p})`),c!=null&&c.stack&&(l+=`
551${c.stack}`)}else{var f;l=(f=o==null?void 0:o.stack)!==null&&f!==void 0?f:""}return{error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),s.then(t,e)}returns(){return this}overrideTypes(){return this}},SU=class extends kU{select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const o=s?`${s}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,o=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(o,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
551explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:o="text"}={}){var a;const l=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${c}"; options=${l};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const Wk=new RegExp("[,()]");var Gl=class extends SU{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&Wk.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&Wk.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const o=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${s}fts${o}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},NU=class{constructor(t,{headers:e={},schema:r,fetch:n}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n}select(t,e){const{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET";let o=!1;const a=(t??"*").split("").map(l=>/\s/.test(l)&&!o?"":(l==='"'&&(o=!o),l)).join("");return this.url.searchParams.set("select",a),n&&this.headers.append("Prefer",`count=${n}`),new Gl({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const s="POST";if(e&&this.headers.append("Prefer",`count=${e}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const o=t.reduce((a,l)=>a.concat(Object.keys(l)),[]);if(o.length>
5510){const a=[...new Set(o)].map(l=>`"${l}"`);this.url.searchParams.set("columns",a.join(","))}}return new Gl({method:s,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var o;const a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),n&&this.headers.append("Prefer",`count=${n}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const l=t.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){const c=[...new Set(l)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new Gl({method:a,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(t,{count:e}={}){var r;const n="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new Gl({method:n,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:t}={}){var e;const r="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new Gl({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},CU=class QT{constructor(e,{headers:r={},schema:n,fetch:s}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=s}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new NU(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new QT(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:s=!1,count:o}={}){var a;let l;const c=new URL(`${this.url}/rpc/${e}`);let u;n||s?(l=n?"HEAD":"GET",Object.entries(r).filter(([h,m])=>m!==void 0).map(([h,m])=>[h,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([h,m])=>{c.searchParams.append(h,m)})):(l="POST",u=r);const d=new Headers(this.headers);return o&&d.set("Prefer",`count=${o}`),new Gl({method:l,url:c,headers:d,schema:this.schemaName,body:u,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};class EU{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const r=process.versions;if(r&&r.node){const n=r.node,s=parseInt(n.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
552import ws from "ws"
553new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
554
555Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){const n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const PU="2.88.0",TU=`realtime-js/${PU}`,JT="1.0.0",AU="2.0.0",Hk=JT,Vb=1e4,RU=1e3,IU=100;var jo;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(jo||(jo={}));var Ir;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ir||(Ir={}));var Ds;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Ds||(Ds={}));var Kb;(function(t){t.websocket="websocket"})(Kb||(Kb={}));var Aa;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Aa||(Aa={}));class OU{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},a=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,r,n){var s,o;const a=e.topic,l=(s=e.ref)!==null&&s!==void 0?s:"",c=(o=e.join_ref)!==null&&o!==void 0?o:"",u=e.payload.event,d=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`userEvent length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const m=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+a.length+u.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+m);let v=new DataView(f),p=0;v.setUint8(p++,this.KINDS.userBroadcastPush),v.setUint8(p++,c.length),v.setUint8(p++,l.length),v.setUint8(p++,a.length),v.setUint8(p++,u.length),v.setUint8(p++,h.length),v.setUint8(p++,r),Array.from(c,x=>v.setUint8(p++,x.charCodeAt(0))),Array.from(l,x=>v.setUint8(p++,x.charCodeAt(0))),Array.from(a,x=>v.setUint8(p++,x.charCodeAt(0))),Array.from(u,x=>v.setUint8(p++,x.charCodeAt(0))),Array.from(h,x=>v.setUint8(p++,x.charCodeAt(0)));var b=new Uint8Array(f.byteLength+n.byteLength);return b.set(new Uint8Array(f),0),b.set(new Uint8Array(n),f.byteLength),b.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[s,o,a,l,c]=n;return r({join_ref:s,ref:o,topic:a,event:l,payload:c})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,s)}}_decodeUserBroadcast(e,r,n){const s=r.getUint8(1),o=r.getUint8(2),a=r.getUint8(3),l=r.getUint8(4);let c=this.HEADER_LENGTH+4;const u=n.decode(e.slice(c,c+s));c=c+s;
555const d=n.decode(e.slice(c,c+o));c=c+o;const h=n.decode(e.slice(c,c+a));c=c+a;const m=e.slice(c,e.byteLength),f=l===this.JSON_ENCODING?JSON.parse(n.decode(m)):m,v={type:this.BROADCAST_EVENT,event:d,payload:f};return a>0&&(v.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:v}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}class XT{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Bt;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Bt||(Bt={}));const Gk=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((o,a)=>(o[a]=MU(a,t,e,s),o),{}):{}},MU=(t,e,r,n)=>{const s=e.find(l=>
555l.name===t),o=s==null?void 0:s.type,a=r[t];return o&&!n.includes(o)?ZT(o,a):Yb(a)},ZT=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return LU(e,r)}switch(t){case Bt.bool:return $U(e);case Bt.float4:case Bt.float8:case Bt.int2:case Bt.int4:case Bt.int8:case Bt.numeric:case Bt.oid:return DU(e);case Bt.json:case Bt.jsonb:return FU(e);case Bt.timestamp:return BU(e);case Bt.abstime:case Bt.date:case Bt.daterange:case Bt.int4range:case Bt.int8range:case Bt.money:case Bt.reltime:case Bt.text:case Bt.time:case Bt.timestamptz:case Bt.timetz:case Bt.tsrange:case Bt.tstzrange:return Yb(e);default:return Yb(e)}},Yb=t=>t,$U=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},DU=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},FU=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},LU=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let o;const a=t.slice(1,r);try{o=JSON.parse("["+a+"]")}catch{o=a?a.split(","):[]}return o.map(l=>ZT(e,l))}return t},BU=t=>typeof t=="string"?t.replace(" ","T"):t,eA=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class Px{constructor(e,r,n={},s=Vb){this.channel=e,this.event=r,this.payload=n,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var qk;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(qk||(qk={}));class Id{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(r==null?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},s=>{const{onJoin:o,onLeave:a,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Id.syncState(this.state,s,o,a),this.pendingDiffs.forEach(c=>{this.state=Id.syncDiff(this.state,c,o,a)}),this.pendingDiffs=[],l()}),this.channel._on(n.diff,{},s=>{const{onJoin:o,onLeave:a,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=Id.syncDiff(this.state,s,o,a),l())}),this.onJoin((s,o,a)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:o,newPresences:a})}),this.onLeave((s,o,a)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:o,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,s){const o=this.cloneDeep(e),a=this.transformState(r),l={},c={};return this.map(o,(u,d)=>{a[u]||(c[u]=d)}),this.map(a,(u,d)=>{const h=o[u];if(h){const m=d.map(b=>b.presence_ref),f=h.map(b=>b.presence_ref),v=d.filter(b=>f.indexOf(b.presence_ref)<0),p=h.filter(b=>m.indexOf(b.presence_ref)<0);v.length>0&&(l[u]=v),p.length>0&&(c[u]=p)}else l[u]=d}),this.syncDiff(o,{joins:l,leaves:c},n,s)}static syncDiff(e,r,n,s){const{joins:o,leaves:a}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),s||(s=()=>{}),this.map(o,(l,c)=>{var u;
555const d=(u=e[l])!==null&&u!==void 0?u:[];if(e[l]=this.cloneDeep(c),d.length>0){const h=e[l].map(f=>f.presence_ref),m=d.filter(f=>h.indexOf(f.presence_ref)<0);e[l].unshift(...m)}n(l,d,c)}),this.map(a,(l,c)=>{let u=e[l];if(!u)return;const d=c.map(h=>h.presence_ref);u=u.filter(h=>d.indexOf(h.presence_ref)<0),e[l]=u,s(l,u,c),u.length===0&&delete e[l]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return"metas"in s?r[n]=s.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):r[n]=s,r},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Vk;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Vk||(Vk={}));var Od;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Od||(Od={}));var Ei;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Ei||(Ei={}));class lc{constructor(e,r={config:{}},n){var s,o;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=Ir.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new Px(this,Ds.join,this.params,this.timeout),this.rejoinTimer=new XT(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ir.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ir.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Ir.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ir.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Ir.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ds.reply,{},(a,l)=>{this._trigger(this._replyEventName(l),a)}),this.presence=new Id(this),this.broadcastEndpointURL=eA(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,r=this.timeout){var n,s,o;if(this.socket.isConnected()||this.socket.connect(),this.state==Ir.closed){const{config:{broadcast:a,presence:l,private:c}}=this.params,u=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[Od.PRESENCE]&&this.bindings[Od.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,h={},m={broadcast:a,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>e==null?void 0:e(Ei.CHANNEL_ERROR,f)),this._onClose(()=>e==null?void 0:e(Ei.CLOSED)),this.updateJoinPayload(Object.assign({config:m},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var v;if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(Ei.SUBSCRIBED);return}else{const p=this.bindings.postgres_changes,b=(v=p==null?void 0:p.length)!==null&&v!==void 0?v:0,x=[];for(let y=0;y<b;y++){const w=p[y],{filter:{event:j,schema:_,table:S,filter:N}}=w,P=f&&f[y];
555if(P&&P.event===j&&lc.isFilterValueEqual(P.schema,_)&&lc.isFilterValueEqual(P.table,S)&&lc.isFilterValueEqual(P.filter,N))x.push(Object.assign(Object.assign({},w),{id:P.id}));else{this.unsubscribe(),this.state=Ir.errored,e==null||e(Ei.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=x,e&&e(Ei.SUBSCRIBED);return}}).receive("error",f=>{this.state=Ir.errored,e==null||e(Ei.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Ei.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===Ir.joined&&e===Od.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,r,n)}async httpSend(e,r,n={}){var s;if(r==null)return Promise.reject("Payload is required for httpSend()");const o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;try{const u=await l.json();c=u.error||u.message||c}catch{}return Promise.reject(new Error(c))}async send(e,r={}){var n,s;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
555in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:a}=e,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:a,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var a,l,c;const u=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(l=(a=this.params)===null||a===void 0?void 0:a.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&o("ok"),u.receive("ok",()=>o("ok")),u.receive("error",()=>o("error")),u.receive("timeout",()=>o("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ir.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ds.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(s=>{n=new Px(this,Ds.leave,{},e),n.receive("ok",()=>{r(),s("ok")}).receive("timeout",()=>{r(),s("timed out")}).receive("error",()=>{s("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ir.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){const s=new AbortController,o=setTimeout(()=>s.abort(),n),a=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(o),a}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new Px(this,e,r,n);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>IU){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var s,o;const a=e.toLocaleLowerCase(),{close:l,error:c,leave:u,join:d}=Ds;if(n&&[l,c,u,d].indexOf(a)>=0&&n!==this._joinRef())return;let m=this._onMessage(a,r,n);if(r&&!m)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(f=>{var v,p,b;return((v=f.filter)===null||v===void 0?void 0:v.event)==="*"||((b=(p=f.filter)===null||p===void 0?void 0:p.event)===null||b===void 0?void 0:b.toLocaleLowerCase())===a}).map(f=>f.callback(m,n)):(o=this.bindings[a])===null||o===void 0||o.filter(f=>{var v,p,b,x,y,w;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in f){const j=f.id,_=(v=f.filter)===null||v===void 0?void 0:v.event;return j&&((p=r.ids)===null||p===void 0?void 0:p.includes(j))&&(_==="*"||(_==null?void 0:_.toLocaleLowerCase())===((b=r.data)===null||b===void 0?void 0:b.type.toLocaleLowerCase()))}else{const j=(y=(x=f==null?void 0:f.filter)===null||x===void 0?void 0:x.event)===null||y===void 0?void 0:y.toLocaleLowerCase();return j==="*"||j===((w=r==null?void 0:r.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===a}).map(f=>{if(typeof m=="object"&&"ids"in m){const v=m.data,{schema:p,table:b,commit_timestamp:x,type:y,errors:w}=v;m=Object.assign(Object.assign({},{schema:p,table:b,commit_timestamp:x,eventType:y,new:{},old:{},errors:w}),this._getPayloadRecords(v))}f.callback(m,n)})}_isClosed(){return this.state===Ir.closed}_isJoined(){return this.state===Ir.joined}_isJoining(){return this.state===Ir.joining}_isLeaving(){return this.state===Ir.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){const s=e.toLocaleLowerCase(),o={type:s,filter:r,callback:n};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this}_off(e,r){const n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(s=>{var o;return!(((o=s.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===n&&lc.isEqual(s.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(const n in e)if(e[n]!==r[n])return!1;return!0}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Ds.close,{},e)}_onError(e){this._on(Ds.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ir.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=Gk(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=Gk(e.columns,e.old_record)),r}}const Tx=()=>{},Yf={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},zU=[1e3,2e3,5e3,1e4],UU=1e4,WU=`
556  addEventListener("message", (e) => {
557    if (e.data.event === "start") {
558      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
559    }
560  });`;class HU{constructor(e,r){var n;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Vb,this.transport=null,this.heartbeatIntervalMs=Yf.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Tx,this.ref=0,this.reconnectTimer=null,this.vsn=Hk,this.logger=Tx,this.conn=null,this.sendBuffer=[],this.serializer
560=new OU,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=s=>s?(...o)=>s(...o):(...o)=>fetch(...o),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${e}/${Kb.websocket}`,this.httpEndpoint=eA(e),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=EU.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const r=e.message;throw r.includes("Node.js")?new Error(`${r}
561
562To use Realtime in Node.js, you need to provide a WebSocket implementation:
563
564Option 1: Use Node.js 22+ which has native WebSocket support
565Option 2: Install and provide the "ws" package:
566
567  npm install ws
568
569  import ws from "ws"
570  const client = new RealtimeClient(url, {
571    ...options,
572    transport: ws
573  })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const e=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,r,n){this.logger(e,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case jo.connecting:return Aa.Connecting;case jo.open:return Aa.Open;case jo.closing:return Aa.Closing;default:return Aa.Closed}}isConnected(){return this.connectionState()===Aa.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(o=>o.topic===n);if(s)return s;{const o=new lc(`realtime:${e}`,r,this);return this.channels.push(o),o}}push(e){const{topic:r,event:n,payload:s,ref:o}=e,a=()=>{this.encode(e,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${r} ${n} (${o})`,s),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(RU,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.sc
573heduleTimeout()},Yf.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let r=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${e}"`),r.unsubscribe())}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply")try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error")}catch(u){this.log("error","error in heartbeat callback",u)}r.ref&&r.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:n,event:s,payload:o,ref:a}=r,l=a?`(${a})`:"",c=o.status||"";this.log("receive",`${c} ${n} ${s} ${l}`.trim(),o),this.channels.filter(u=>u._isMember(n)).forEach(u=>u._trigger(s,o,a)),this._triggerStateCallbacks("message",r)})}_clearTimer(e){var r;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===jo.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===jo.open||this.conn.readyState===jo.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var r;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.sc
573heduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Ds.error))}_appendParams(e,r){if(Object.keys(r).length===0)return e;const n=e.match(/\?/)?"&":"?",s=new URLSearchParams(r);return`${e}${n}${s}`}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([WU],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(e,r=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(e=null){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const o={access_token:r,version:TU};r&&s.updateJoinPayload(o),s.joinedOnce&&s._isJoined()&&s._push(Ds.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_triggerStateCallbacks(e,r){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(r)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new XT(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Yf.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,s,o,a,l,c,u,d,h,m,f;switch(this.transport=(r=e==null?void 0:e.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:Vb,this.heartbeatIntervalMs=(s=e==null?void 0:e.heartbeatIntervalMs)!==null&&s!==void 0?s:Yf.HEARTBEAT_INTERVAL,this.worker=(o=e==null?void 0:e.worker)!==null&&o!==void 0?o:!1,this.accessToken=(a=e==null?void 0:e.accessToken)!==null&&a!==void 0?a:null,this.heartbeatCallback=(l=e==null?void 0:e.heartbeatCallback)!==null&&l!==void 0?l:Tx,this.vsn=(c=e==null?void 0:e.vsn)!==null&&c!==void 0?c:Hk,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:v=>zU[v-1]||UU,this.vsn){case JT:this.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:(v,p)=>p(JSON.stringify(v)),this.decode=(h=e==null?void 0:e.decode)!==null&&h!==void 0?h:(v,p)=>p(JSON.parse(v));break;case AU:this.encode=(m=e==null?void 0:e.encode)!==null&&m!==void 0?m:this.serializer.encode.bind(this.serializer),this.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}var mh=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function GU(t,e,r){const n=new URL(e,t);if(r)for(const[s,o]of Object.entries(r))o!==void 0&&n.searchParams.set(s,o);return n.toString()}async function qU(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function VU(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:o,headers:a}){const l=GU(t.baseUrl,n,s),c=await qU(t.auth),u=await e(l,{method:r,headers:{...o?{"Content-Type":"application/json"}:{},...c,...a},body:o?JSON.stringify(o):void 0}),d=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),m=h&&d?JSON.parse(d):d;if(!u.ok){const f=h?m:void 0,v=f==null?void 0:f.error;throw new mh((v==null?void 0:v.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:v==null?void 0:v.type,icebergCode:v==null?void 0:v.code,details:f})}return{status:u.status,headers:u.headers,data:m}}}}function Qf(t){return t.join("�")}var KU=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Qf(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Qf(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qf(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Qf(t.namespace)}`}),!0}catch(e){if(e instanceof mh&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof mh&&r.status===409)return;throw r}}};function Tl(t){return t.join("�")}var YU=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Tl(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Tl(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Tl(t.namespace)}
573/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Tl(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Tl(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Tl(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof mh&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof mh&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},QU=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=VU({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new KU(this.client,e),this.tableOps=new YU(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},Yg=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function tr(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var JU=class extends Yg{constructor(t,e,r){super(t),this.name="StorageApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Qb=class extends Yg{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const S_=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),XU=()=>Response,Jb=t=>{if(Array.isArray(t))return t.map(r=>Jb(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));e[s]=Jb(n)}),e},ZU=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},eW=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function ph(t){"@babel/helpers - typeof";return ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ph(t)}function tW(t,e){if(ph(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ph(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rW(t){var e=tW(t,"string");return ph(e)=="symbol"?e:e+""}function nW(t,e,r){return(e=rW(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Kk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Qe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};
573e%2?Kk(Object(r),!0).forEach(function(n){nW(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Kk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const Ax=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},sW=async(t,e,r)=>{t instanceof await XU()&&!(r!=null&&r.noResolveJson)?t.json().then(n=>{const s=t.status||500,o=(n==null?void 0:n.statusCode)||s+"";e(new JU(Ax(n),s,o))}).catch(n=>{e(new Qb(Ax(n),n))}):e(new Qb(Ax(t),t))},iW=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!n?s:(ZU(n)?(s.headers=Qe({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(n)):s.body=n,e!=null&&e.duplex&&(s.duplex=e.duplex),Qe(Qe({},s),r))};async function Jh(t,e,r,n,s,o){return new Promise((a,l)=>{t(r,iW(e,n,s,o)).then(c=>{if(!c.ok)throw c;return n!=null&&n.noResolveJson?c:c.json()}).then(c=>a(c)).catch(c=>sW(c,l,n))})}async function gh(t,e,r,n){return Jh(t,"GET",e,r,n)}async function Is(t,e,r,n,s){return Jh(t,"POST",e,n,s,r)}async function Xb(t,e,r,n,s){return Jh(t,"PUT",e,n,s,r)}async function oW(t,e,r,n){return Jh(t,"HEAD",e,Qe(Qe({},r),{},{noResolveJson:!0}),n)}async function N_(t,e,r,n,s){return Jh(t,"DELETE",e,n,s,r)}var aW=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(tr(e))return{data:null,error:e};throw e}}};let tA;tA=Symbol.toStringTag;var lW=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[tA]="BlobDownloadBuilder",this.promise=null}asStream(){return new aW(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(tr(e))return{data:null,error:e};throw e}}};const cW={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Yk={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var uW=class{constructor(t,e={},r,n){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=r,this.fetch=S_(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,r,n){var s=this;try{let o;const a=Qe(Qe({},Yk),n);let l=Qe(Qe({},s.headers),t==="POST"&&{"x-upsert":String(a.upsert)});const c=a.metadata;typeof Blob<"u"&&r instanceof Blob?(o=new FormData,o.append("cacheControl",a.cacheControl),c&&o.append("metadata",s.encodeMetadata(c)),o.append("",r)):typeof FormData<"u"&&r instanceof FormData?(o=r,o.has("cacheControl")||o.append("cacheControl",a.cacheControl),c&&!o.has("metadata")&&o.append("metadata",s.encodeMetadata(c))):(o=r,l["cache-control"]=`max-age=${a.cacheControl}`,l["content-type"]=a.contentType,c&&(l["x-metadata"]=s.toBase64(s.encodeMetadata(c))),(typeof ReadableStream<"u"&&o instanceof ReadableStream||o&&typeof o=="object"&&"pipe"in o&&typeof o.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers&&(l=Qe(Qe({},l),n.headers));const u=s._removeEmptyFolders(e),d=s._getFinalPath(u),h=await(t=="PUT"?Xb:Is)(s.fetch,`${s.url}/object/${d}`,o,Qe({headers:l},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{data:{path:u,id:h.Id,fullPath:h.Key},error:null}}catch(o){if(s.shouldThrowOnError)throw o;if(tr(o))return{data:null,error:o};throw o}}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var s=this;const o=s._removeEmptyFolders(t),a=s._getFinalPath(o),l=new URL(s.url+`/object/upload/sign/${a}`);l.searchParams.set("token",e);try{let c;const u=Qe({upsert:Yk.upsert},n),d=Qe(Qe({},s.headers),{"x-upsert":String(u.upsert)});return typeof Blob<"u"&&r instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),c.append("",r)):typeof FormData<"u"&&r instanceof FormData?(c=r,c.append("cacheControl",u.cacheControl)):(c=r,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType),{data:{path:o,fullPath:(await Xb(s.fetch,l.toString(),c,{headers:d})).Key},error:null}}catch(c){if(s.shouldThrowOnError)throw c;if(tr(c))return{data:null,error:c};throw c}}async createSignedUploadUrl(t,e){var r=this;try{let n=r._getFinalPath(t);const s=Qe({},r.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const o=await Is(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),a=new URL(r.url+o.url),l=a.searchParams.get("token");if(!l)throw new Yg("No token returned by API");return{data:{signedUrl:a.toString(),path:t,token:l},error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(tr(n))return{data:null,error:n};throw n}}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}
573async move(t,e,r){var n=this;try{return{data:await Is(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}),error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(tr(s))return{data:null,error:s};throw s}}async copy(t,e,r){var n=this;try{return{data:{path:(await Is(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key},error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(tr(s))return{data:null,error:s};throw s}}async createSignedUrl(t,e,r){var n=this;try{let s=n._getFinalPath(t),o=await Is(n.fetch,`${n.url}/object/sign/${s}`,Qe({expiresIn:e},r!=null&&r.transform?{transform:r.transform}:{}),{headers:n.headers});const a=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return o={signedUrl:encodeURI(`${n.url}${o.signedURL}${a}`)},{data:o,error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(tr(s))return{data:null,error:s};throw s}}async createSignedUrls(t,e,r){var n=this;try{const s=await Is(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),o=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return{data:s.map(a=>Qe(Qe({},a),{},{signedUrl:a.signedURL?encodeURI(`${n.url}${a.signedURL}${o}`):null})),error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(tr(s))return{data:null,error:s};throw s}}download(t,e){const r=typeof(e==null?void 0:e.transform)<"u"?"render/image/authenticated":"object",n=this.transformOptsToQueryString((e==null?void 0:e.transform)||{}),s=n?`?${n}`:"",o=this._getFinalPath(t),a=()=>gh(this.fetch,`${this.url}/${r}/${o}${s}`,{headers:this.headers,noResolveJson:!0});return new lW(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);try{return{data:Jb(await gh(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(tr(n))return{data:null,error:n};throw n}}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await oW(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(tr(n)&&n instanceof Qb){const s=n.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=[],s=e!=null&&e.download?`download=${e.download===!0?"":e.download}`:"";s!==""&&n.push(s);const o=typeof(e==null?void 0:e.transform)<"u"?"render/image":"object",a=this.transformOptsToQueryString((e==null?void 0:e.transform)||{});a!==""&&n.push(a);let l=n.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${r}${l}`)}}}async remove(t){var e=this;try{return{data:await N_(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(tr(r))return{data:null,error:r};throw r}}async list(t,e,r){var n=this;try{const s=Qe(Qe(Qe({},cW),e),{},{prefix:t||""});return{data:await Is(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r),error:null}}catch(s){if(n.shouldThrowOnError)throw s;if(tr(s))return{data:null,error:s};throw s}}async listV2(t,e){var r=this;try{const n=Qe({},t);return{data:await Is(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(tr(n))return{data:null,error:n};throw n}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const rA="2.88.0",nA={"X-Client-Info":`storage-js/${rA}`};var dW=class{constructor(t,e={},r,n){this.shouldThrowOnError=!1;const s=new URL(t);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Qe(Qe({},nA),e),this.fetch=S_(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const r=e.listBucketOptionsToQueryString(t);return{data:await gh(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(tr(r))return{data:null,error:r};throw r}}async getBucket(t){var e=this;try{return{data:await gh(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(tr(r))return{data:null,error:r};throw r}}async createBucket(t,e={public:!1}){var r=this;try{return{data:await Is(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(tr(n))return{data:null,error:n};throw n}}async updateBucket(t,e){var r=this;try{return{data:await Xb(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(tr(n))return{data:null,error:n};throw n}}async emptyBucket(t){var e=this;try{return{data:await Is(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(tr(r))return{data:null,error:r};throw r}}async deleteBucket(t){var e=this;try{return{data:await N_(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(tr(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},hW=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Qe(Qe({},nA),e),this.fetch=S_(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Is(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(tr(r))return{data:null,error:r};throw r}}async listBuckets(t){var e=this;
573try{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return{data:await gh(e.fetch,s,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(tr(r))return{data:null,error:r};throw r}}async deleteBucket(t){var e=this;try{return{data:await N_(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(tr(r))return{data:null,error:r};throw r}}from(t){var e=this;if(!eW(t))throw new Yg("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new QU({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,o){const a=s[o];return typeof a!="function"?a:async(...l)=>{try{return{data:await a.apply(s,l),error:null}}catch(c){if(n)throw c;return{data:null,error:c}}}}})}};const C_={"X-Client-Info":`storage-js/${rA}`,"Content-Type":"application/json"};var sA=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Qn(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Rx=class extends sA{constructor(t,e,r){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},fW=class extends sA{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const E_=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),mW=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Qk=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),pW=async(t,e,r)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(r!=null&&r.noResolveJson)){const n=t.status||500,s=t;if(typeof s.json=="function")s.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||n+"";e(new Rx(Qk(o),n,a))}).catch(()=>{const o=n+"";e(new Rx(s.statusText||`HTTP ${n} error`,n,o))});else{const o=n+"";e(new Rx(s.statusText||`HTTP ${n} error`,n,o))}}else e(new fW(Qk(t),t))},gW=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return n?(mW(n)?(s.headers=Qe({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(n)):s.body=n,Qe(Qe({},s),r)):s};async function vW(t,e,r,n,s,o){return new Promise((a,l)=>{t(r,gW(e,n,s,o)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.noResolveJson)return c;const u=c.headers.get("content-type");return!u||!u.includes("application/json")?{}:c.json()}).then(c=>a(c)).catch(c=>pW(c,l,n))})}async function Jn(t,e,r,n,s){return vW(t,"POST",e,n,s,r)}var xW=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Qe(Qe({},C_),e),this.fetch=E_(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await Jn(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}async getIndex(t,e){var r=this;try{return{data:await Jn(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(Qn(n))return{data:null,error:n};throw n}}async listIndexes(t){var e=this;try{return{data:await Jn(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}async deleteIndex(t,e){var r=this;try{return{data:await Jn(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{},error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(Qn(n))return{data:null,error:n};throw n}}},yW=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Qe(Qe({},C_),e),this.fetch=E_(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Jn(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}async getVectors(t){var e=this;try{return{data:await Jn(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
573if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await Jn(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}async queryVectors(t){var e=this;try{return{data:await Jn(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Jn(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}},bW=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Qe(Qe({},C_),e),this.fetch=E_(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Jn(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}async getBucket(t){var e=this;try{return{data:await Jn(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}async listBuckets(t={}){var e=this;try{return{data:await Jn(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}async deleteBucket(t){var e=this;try{return{data:await Jn(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Qn(r))return{data:null,error:r};throw r}}},wW=class extends bW{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new _W(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},_W=class extends xW{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,Qe(Qe({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,Qe(Qe({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new jW(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},jW=class extends yW{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,Qe(Qe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,Qe(Qe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,Qe(Qe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,Qe(Qe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,Qe(Qe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},kW=class extends dW{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new uW(this.url,this.headers,t,this.fetch)}get vectors(){return new wW(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new hW(this.url+"/iceberg",this.headers,this.fetch)}};const iA="2.88.0",ql=30*1e3,Zb=3,Ix=Zb*ql,SW="http://localhost:9999",NW="supabase.auth.token",CW={"X-Client-Info":`gotrue-js/${iA}`},ew="X-Supabase-Api-Version",oA={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},EW=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,PW=10*60*1e3;
573class vh extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}}function He(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class TW extends vh{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function AW(t){return He(t)&&t.name==="AuthApiError"}class Ra extends vh{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class to extends vh{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class Gn extends to{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function RW(t){return He(t)&&t.name==="AuthSessionMissingError"}class Al extends to{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Jf extends to{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Xf extends to{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function IW(t){return He(t)&&t.name==="AuthImplicitGrantRedirectError"}class Jk extends to{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class OW extends to{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class tw extends to{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Ox(t){return He(t)&&t.name==="AuthRetryableFetchError"}class Xk extends to{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}}class rw extends to{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Tp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Zk=` 	
574\r=`.split(""),MW=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Zk.length;e+=1)t[Zk[e].charCodeAt(0)]=-2;for(let e=0;e<Tp.length;e+=1)t[Tp[e].charCodeAt(0)]=e;return t})();function eS(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Tp[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Tp[n]),e.queuedBits-=6}}function aA(t,e,r){const n=MW[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function tS(t){const e=[],r=a=>{e.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},o=a=>
574{FW(a,n,r)};for(let a=0;a<t.length;a+=1)aA(t.charCodeAt(a),s,o);return e.join("")}function $W(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function DW(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}$W(n,e)}}function FW(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function _c(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)aA(t.charCodeAt(s),r,n);return new Uint8Array(e)}function LW(t){const e=[];return DW(t,r=>e.push(r)),new Uint8Array(e)}function $a(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>eS(s,r,n)),eS(null,r,n),e.join("")}function BW(t){return Math.round(Date.now()/1e3)+t}function zW(){return Symbol("auth-callback")}const Qr=()=>typeof window<"u"&&typeof document<"u",ya={tested:!1,writable:!1},lA=()=>{if(!Qr())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ya.tested)return ya.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),ya.tested=!0,ya.writable=!0}catch{ya.tested=!0,ya.writable=!1}return ya.writable};function UW(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,o)=>{e[o]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const cA=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),WW=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Vl=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},ba=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Yr=async(t,e)=>{await t.removeItem(e)};class Qg{constructor(){this.promise=new Qg.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}Qg.promiseConstructor=Promise;function Mx(t){const e=t.split(".");if(e.length!==3)throw new rw("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!EW.test(e[n]))throw new rw("JWT not in base64url format");return{header:JSON.parse(tS(e[0])),payload:JSON.parse(tS(e[1])),signature:_c(e[2]),raw:{header:e[0],payload:e[1]}}}async function HW(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function GW(t,e){return new Promise((n,s)=>{(async()=>{for(let o=0;o<1/0;o++)try{const a=await t(o);if(!e(o,null,a)){n(a);return}}catch(a){if(!e(o,a)){s(a);return}}})()})}function qW(t){return("0"+t.toString(16)).substr(-2)}function VW(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let o=0;o<56;o++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,qW).join("")}async function KW(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(o=>String.fromCharCode(o)).join("")}async function YW(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await KW(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Rl(t,e,r=!1){const n=VW();let s=n;r&&(s+="/PASSWORD_RECOVERY"),await Vl(t,`${e}-code-verifier`,s);const o=await YW(n);return[o,n===o?"plain":"s256"]}const QW=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function JW(t){const e=t.headers.get(ew);if(!e||!e.match(QW))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function XW(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function ZW(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const eH=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Il(t){if(!eH.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function $x(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;
574if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function tH(t,e){return new Proxy(t,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const o=n.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,s)}})}function rS(t){return JSON.parse(JSON.stringify(t))}const Ca=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),rH=[502,503,504];async function nS(t){var e;if(!WW(t))throw new tw(Ca(t),0);if(rH.includes(t.status))throw new tw(Ca(t),t.status);let r;try{r=await t.json()}catch(o){throw new Ra(Ca(o),o)}let n;const s=JW(t);if(s&&s.getTime()>=oA["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new Xk(Ca(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Gn}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((o,a)=>o&&typeof a=="string",!0))throw new Xk(Ca(r),t.status,r.weak_password.reasons);throw new TW(Ca(r),t.status||500,n)}const nH=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function Ye(t,e,r,n){var s;const o=Object.assign({},n==null?void 0:n.headers);o[ew]||(o[ew]=oA["2024-01-01"].name),n!=null&&n.jwt&&(o.Authorization=`Bearer ${n.jwt}`);const a=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);const l=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",c=await sH(t,e,r+l,{headers:o,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(c):{data:Object.assign({},c),error:null}}async function sH(t,e,r,n,s,o){const a=nH(e,n,s,o);let l;try{l=await t(r,Object.assign({},a))}catch(c){throw console.error(c),new tw(Ca(c),0)}if(l.ok||await nS(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await nS(c)}}function Es(t){var e;let r=null;aH(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=BW(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function sS(t){const e=Es(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Co(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function iH(t){return{data:t,error:null}}function oH(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:o}=t,a=vu(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:o},c=Object.assign({},a);return{data:{properties:l,user:c},error:null}}function iS(t){return t}function aH(t){return t.access_token&&t.refresh_token&&t.expires_in}const Dx=["global","local","others"];class lH{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=cA(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}
vendor: 4,780 bytes, line 574
574async signOut(e,r=Dx[0]){if(Dx.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Dx.join(", ")}`);try{return await Ye(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(He(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await Ye(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Co})}catch(n){if(He(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=vu(e,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await Ye(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:oH,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(He(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await Ye(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Co})}catch(r){if(He(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,o,a,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Ye(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(o=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:iS});if(d.error)throw d.error;const h=await d.json(),m=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(v=>{const p=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(v.split(";")[1].split("=")[1]);u[`${b}Page`]=p}),u.total=parseInt(m)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(He(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){Il(e);try{return await Ye(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Co})}catch(r){if(He(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Il(e);try{return await Ye(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Co})}catch(n){if(He(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Il(e);try{return await Ye(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Co})}catch(n){if(He(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Il(e.userId);try{const{data:r,error:n}=await Ye(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(He(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Il(e.userId),Il(e.id);try{return{data:await Ye(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(He(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,s,o,a,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Ye(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(o=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:iS});if(d.error)throw d.error;const h=await d.json(),m=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(v=>{const p=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(v.split(";")[1].split("=")[1]);u[`${b}Page`]=p}),u.total=parseInt(m)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(He(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(e){try{return await Ye(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(He(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await Ye(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(He(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await Ye(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(He(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await Ye(this.fetch,"DELET
574E",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(He(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await Ye(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(He(r))return{data:null,error:r};throw r}}}function oS(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const Ol={debug:!!(globalThis&&lA()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class uA extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class cH extends uA{}async function uH(t,e,r){Ol.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),Ol.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async s=>{if(s){Ol.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,s.name);try{return await r()}finally{Ol.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,s.name)}}else{if(e===0)throw Ol.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new cH(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Ol.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null,"  "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}}))}function dH(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function dA(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function hH(t){return parseInt(t,16)}function fH(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function mH(t){var e;const{chainId:r,domain:n,expirationTime:s,issuedAt:o=new Date,nonce:a,notBefore:l,requestId:c,resources:u,scheme:d,uri:h,version:m}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(m!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
575`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=dA(t.address),v=d?`${d}://${n}`:n,p=t.statement?`${t.statement}
576`:"",b=`${v} wants you to sign in with your Ethereum account:
577${f}
578
579${p}`;let x=`URI: ${h}
580Version: ${m}
581Chain ID: ${r}${a?`
582Nonce: ${a}`:""}
583Issued At: ${o.toISOString()}`;if(s&&(x+=`
584Expiration Time: ${s.toISOString()}`),l&&(x+=`
585Not Before: ${l.toISOString()}`),c&&(x+=`
586Request ID: ${c}`),u){let y=`
587Resources:`;for(const w of u){if(!w||typeof w!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${w}`);y+=`
588- ${w}`}x+=y}return`${b}
589${x}`}
589class Nr extends Error{constructor({message:e,code:r,cause:n,name:s}){var o;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(o=s??(n instanceof Error?n.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=r}}class Ap extends Nr{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function pH({error:t,options:e}){var r,n,s;const{publicKey:o}=e;if(!o)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Nr({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=o.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Nr({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=o.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Nr({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Nr({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Nr({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Nr({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return o.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new Nr({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Nr({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const a=window.location.hostname;if(hA(a)){if(o.rp.id!==a)return new Nr({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Nr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new Nr({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Nr({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Nr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function gH({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Nr({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Nr({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(hA(n)){if(r.rpId!==n)return new Nr({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Nr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Nr({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Nr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class vH{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const xH=new vH;function yH(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,s=vu(t,["challenge","user","excludeCredentials"]),o=_c(e).buffer,a=Object.assign(Object.assign({},r),{id:_c(r.id).buffer}),l=Object.assign(Object.assign({}
589,s),{challenge:o,user:a});if(n&&n.length>0){l.excludeCredentials=new Array(n.length);for(let c=0;c<n.length;c++){const u=n[c];l.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:_c(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function bH(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=vu(t,["challenge","allowCredentials"]),s=_c(e).buffer,o=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){o.allowCredentials=new Array(r.length);for(let a=0;a<r.length;a++){const l=r[a];o.allowCredentials[a]=Object.assign(Object.assign({},l),{id:_c(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return o}function wH(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:$a(new Uint8Array(t.response.attestationObject)),clientDataJSON:$a(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function _H(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:$a(new Uint8Array(s.authenticatorData)),clientDataJSON:$a(new Uint8Array(s.clientDataJSON)),signature:$a(new Uint8Array(s.signature)),userHandle:s.userHandle?$a(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function hA(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function aS(){var t,e;return!!(Qr()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function jH(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ap("Browser returned unexpected credential type",e)}:{data:null,error:new Ap("Empty credential response",e)}}catch(e){return{data:null,error:pH({error:e,options:t})}}}async function kH(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ap("Browser returned unexpected credential type",e)}:{data:null,error:new Ap("Empty credential response",e)}}catch(e){return{data:null,error:gH({error:e,options:t})}}}const SH={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},NH={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Rp(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of t)if(s)for(const o in s){const a=s[o];if(a!==void 0)if(Array.isArray(a))n[o]=a;else if(r(a))n[o]=a;else if(e(a)){const l=n[o];e(l)?n[o]=Rp(l,a):n[o]=Rp(a)}else n[o]=a}return n}function CH(t,e){return Rp(SH,t,e||{})}function EH(t,e){return Rp(NH,t,e||{})}class PH{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:s},o){try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!a)return{data:null,error:l};const c=s??xH.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;u.name||(u.name=`${u.id}:${n}`),u.displayName||(u.displayName=u.name)}
589switch(a.webauthn.type){case"create":{const u=CH(a.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:d,error:h}=await jH({publicKey:u,signal:c});return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}case"request":{const u=EH(a.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:d,error:h}=await kH(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}}}catch(a){return He(a)?{data:null,error:a}:{data:null,error:new Ra("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},o){if(!r)return{data:null,error:new vh("rpId is required for WebAuthn authentication")};try{if(!aS())return{data:null,error:new Ra("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:o});if(!a)return{data:null,error:l};const{webauthn:c}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:c.type,rpId:r,rpOrigins:n,credential_response:c.credential_response}})}catch(a){return He(a)?{data:null,error:a}:{data:null,error:new Ra("Unexpected error in authenticate",a)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},o){if(!r)return{data:null,error:new vh("rpId is required for WebAuthn registration")};try{if(!aS())return{data:null,error:new Ra("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(d=>{var h;return(h=d.data)===null||h===void 0?void 0:h.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===e&&m.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d==null?void 0:d.id}):void 0),{data:null,error:l};const{data:c,error:u}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:o});return c?this._verify({factorId:a.id,challengeId:c.challengeId,webauthn:{rpId:r,rpOrigins:n,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(a){return He(a)?{data:null,error:a}:{data:null,error:new Ra("Unexpected error in register",a)}}}}dH();const TH={url:SW,storageKey:NW,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:CW,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function lS(t,e,r){return await r()}const Ml={};class xh{get jwks(){var e,r;return(r=(e=Ml[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Ml[this.storageKey]=Object.assign(Object.assign({},Ml[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Ml[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ml[this.storageKey]=Object.assign(Object.assign({},Ml[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},TH),e);if(this.storageKey=o.storageKey,this.instanceID=(r=xh.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,xh.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Qr()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.admin=new lH({url:o.url,headers:o.headers,fetch:o.fetch}),this.url=o.url,this.headers=o.headers,this.fetch=cA(o.fetch),this.lock=o.lock||lS,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,o.lock?this.lock=o.lock:this.persistSession&&Qr()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=uH:this.lock=lS,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new PH(this)}
589,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:lA()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=oS(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=oS(this.memoryStorage)),Qr()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),await this._notifyAllSubscribers(a.data.event,a.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${iA}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if(Qr()&&(r=UW(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Qr()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:o}=await this._getSessionFromURL(r,n);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),IW(o)){const c=(e=o.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:a,redirectType:l}=s;return this._debug("#_initialize()","detected session in URL",a,"redirect type",l),await this._saveSession(a),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return He(r)?this._returnResult({error:r}):this._returnResult({error:new Ra("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const o=await Ye(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:Es}),{data:a,error:l}=o;if(l||!a)return this._returnResult({data:{user:null,session:null},error:l});const c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(o){if(He(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signUp(e){var r,n,s;try{let o;if("email"in e){const{email:d,password:h,options:m}=e;let f=null,v=null;this.flowType==="pkce"&&([f,v]=await Rl(this.storage,this.storageKey)),o=await Ye(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:d,password:h,data:(r=m==null?void 0:m.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:f,code_challenge_method:v},xform:Es})}else if("phone"in e){const{phone:d,password:h,options:m}=e;o=await Ye(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(n=m==null?void 0:m.data)!==null&&n!==void 0?n:{},channel:(s=m==null?void 0:m.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:Es})}else throw new Jf("You must provide either an email or phone number and a password");const{data:a,error:l}=o;if(l||!a)return await Yr(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(o){if(await Yr(this.storage,`${this.storageKey}-code-verifier`),He(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithPassword(e){try{let r;if("email"in e){const{email:o,password:a,options:l}=e;r=await Ye(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:sS})}else if("phone"in e){const{phone:o,password:a,options:l}=e;r=await Ye(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:sS})}else throw new Jf("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const o=new Al;return this._returnResult({data:{user:null,session:null},error:o})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(He(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,s,o;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(o=e.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,s,o,a,l,c,u,d,h,m;let f,v;if("message"in e)f=e.message,v=e.signature;else{const{chain:p,wallet:b,statement:x,options:y}=e;let w;if(Qr())if(typeof b=="object")w=b;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")w=C.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof b!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=b}const j=new URL((r=y==null?void 0:y.url)!==null&&r!==void 0?r:window.location.href),_=await w.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!_||_.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const S=dA(_[0]);let N=(n=y==null?void 0:y.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!N){const C=await w.request({method:"eth_chainId"});N=hH(C)}const P={domain:j.host,address:S,statement:x,uri:j.href,version:"1",chainId:N,nonce:(s=y==null?void 0:y.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(a=(o=y==null?void 0:y.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(l=y==null?void 0:y.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=y==null?void 0:y.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=y==null?void 0:y.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=y==null?void 0:y.signInWithEthereum)===null||d===void 0?void 0:d.resources};f=mH(P),v=await w.request({method:"personal_sign",params:[fH(f),S]})}try{const{data:p,error:b}=await Ye(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:v}
589,!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(m=e.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:Es});if(b)throw b;if(!p||!p.session||!p.user){const x=new Al;return this._returnResult({data:{user:null,session:null},error:x})}return p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("SIGNED_IN",p.session)),this._returnResult({data:Object.assign({},p),error:b})}catch(p){if(He(p))return this._returnResult({data:{user:null,session:null},error:p});throw p}}async signInWithSolana(e){var r,n,s,o,a,l,c,u,d,h,m,f;let v,p;if("message"in e)v=e.message,p=e.signature;else{const{chain:b,wallet:x,statement:y,options:w}=e;let j;if(Qr())if(typeof x=="object")j=x;else{const S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))j=S.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof x!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=x}const _=new URL((r=w==null?void 0:w.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in j&&j.signIn){const S=await j.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:_.host,uri:_.href}),y?{statement:y}:null));let N;if(Array.isArray(S)&&S[0]&&typeof S[0]=="object")N=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)N=S;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in N&&"signature"in N&&(typeof N.signedMessage=="string"||N.signedMessage instanceof Uint8Array)&&N.signature instanceof Uint8Array)v=typeof N.signedMessage=="string"?N.signedMessage:new TextDecoder().decode(N.signedMessage),p=N.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in j)||typeof j.signMessage!="function"||!("publicKey"in j)||typeof j!="object"||!j.publicKey||!("toBase58"in j.publicKey)||typeof j.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");v=[`${_.host} wants you to sign in with your Solana account:`,j.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${_.href}`,`Issued At: ${(s=(n=w==null?void 0:w.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((a=w==null?void 0:w.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((u=w==null?void 0:w.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((h=(d=w==null?void 0:w.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...w.signInWithSolana.resources.map(N=>`- ${N}`)]:[]].join(`
590`);const S=await j.signMessage(new TextEncoder().encode(v),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=S}}try{const{data:b,error:x}=await Ye(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:v,signature:$a(p)},!((m=e.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:Es});if(x)throw x;if(!b||!b.session||!b.user){const y=new Al;return this._returnResult({data:{user:null,session:null},error:y})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:x})}catch(b){if(He(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async _exchangeCodeForSession(e){const r=await ba(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new OW;const{data:o,error:a}=await Ye(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:Es});if(await Yr(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!o||!o.session||!o.user){const l=new Al;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),this._returnResult({data:Object.assign(Object.assign({},o),{redirectType:s??null}),error:a})}catch(o){if(await Yr(this.storage,`${this.storageKey}-code-verifier`),He(o))return this._returnResult({data:{user:null,session:null,redirectType:null},error:o});throw o}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:o,nonce:a}=e,l=await Ye(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:o,nonce:a,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:Es}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const d=new Al;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(r){if(He(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,s,o,a;try{if("email"in e){const{email:l,options:c}=e;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Rl(this.storage,this.storageKey));const{error:h}=await Ye(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:l,options:c}=e,{data:u,error:d}=await Ye(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(o=c==null?void 0:c.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(a=c==null?void 0:c.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new Jf("You must provide either an email or phone number.")}catch(l){if(await Yr(this.storage,`${this.storageKey}-code-verifier`),He(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(e){var r,n;try{let s,o;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,o=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:a,error:l}=await Ye(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:o}}),redirectTo:s,xform:Es});if(l)throw l;if(!a)throw new Error("An error occurred on token verification.");const c=a.session,u=a.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(He(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var r,n,s,o,a;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await Rl(this.storage,this.storageKey));const u=await Ye(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:iH});return!((o=u.data)===null||o===void 0)&&o.url&&Qr()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(await Yr(this.storage,`${this.storageKey}-code-verifier`),He(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new Gn;const{error:s}=await Ye(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(He(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:o}=e,{error:a}=await Ye(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in e){const{phone:n,type:s,options:o}=e,{data:a,error:l}=await Ye(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:l})}throw new Jf("You must provide either an email or phone number and a type")}catch(r){if(He(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await ba(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not val
590id"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<Ix:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const a=await ba(this.userStorage,this.storageKey+"-user");a!=null&&a.user?e.user=a.user:e.user=$x()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};e.user=tH(e.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:o}=await this._callRefreshToken(e.refresh_token);return o?this._returnResult({data:{session:null},error:o}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const r=await this._acquireLock(-1,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await Ye(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Co}):await this._useSession(async r=>{var n,s,o;const{data:a,error:l}=r;if(l)throw l;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Gn}:await Ye(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&o!==void 0?o:void 0,xform:Co})})}catch(r){if(He(r))return RW(r)&&(await this._removeSession(),await Yr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:s,error:o}=n;if(o)throw o;if(!s.session)throw new Gn;const a=s.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await Rl(this.storage,this.storageKey));const{data:u,error:d}=await Ye(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:a.access_token,xform:Co});if(d)throw d;return a.user=u.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await Yr(this.storage,`${this.storageKey}-code-verifier`),He(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Gn;const r=Date.now()/1e3;let n=r,s=!0,o=null;const{payload:a}=Mx(e.access_token);if(a.exp&&(n=a.exp,s=n<=r),s){const{data:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};o=l}else{const{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;o={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return this._returnResult({data:{user:o.user,session:o},error:null})}catch(r){if(He(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:a,error:l}=r;if(l)throw l;e=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new Gn;const{data:s,error:o}=await this._callRefreshToken(e.refresh_token);return o?this._returnResult({data:{user:null,session:null},error:o}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(He(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!Qr())throw new Xf("No browser detected.");
590if(e.error||e.error_description||e.error_code)throw new Xf(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new Jk("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Xf("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Jk("No code detected.");const{data:y,error:w}=await this._exchangeCodeForSession(e.code);if(w)throw w;const j=new URL(window.location.href);return j.searchParams.delete("code"),window.history.replaceState(window.history.state,"",j.toString()),{data:{session:y.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:s,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=e;if(!o||!l||!a||!u)throw new Xf("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(l);let m=d+h;c&&(m=parseInt(c));const f=m-d;f*1e3<=ql&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);const v=m-h;d-v>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",v,m,d):d-v<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",v,m,d);const{data:p,error:b}=await this._getUser(o);if(b)throw b;const x={provider_token:n,provider_refresh_token:s,access_token:o,expires_in:h,expires_at:m,refresh_token:a,token_type:u,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:x,redirectType:e.type},error:null})}catch(n){if(He(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await ba(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:o}=r;if(o)return this._returnResult({error:o});const a=(n=s.session)===null||n===void 0?void 0:n.access_token;if(a){const{error:l}=await this.admin.signOut(a,e);if(l&&!(AW(l)&&(l.status===404||l.status===401||l.status===403)))return this._returnResult({error:l})}return e!=="others"&&(await this._removeSession(),await Yr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=zW(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:o},error:a}=r;if(a)throw a;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",e,"session",o)}catch(o){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",o),console.error(o)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Rl(this.storage,this.storageKey,!0));try{return await Ye(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(o){if(await Yr(this.storage,`${this.storageKey}-code-verifier`),He(o))return this._returnResult({data:null,error:o});throw o}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(He(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,error:s}=await this._useSession(async o=>{var a,l,c,u,d;const{data:h,error:m}=o;if(m)throw m;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await Ye(this.fetch,"GET",f,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return Qr()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(He(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:o}}=r;if(s)throw s;const{options:a,provider:l,token:c,access_token:u,nonce:d}=e,h=await Ye(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=o==null?void 0:o.access_token)!==null&&n!==void 0?n:void 0,body:{provider:l,id_token:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Es}),{data:m,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!m||!m.session||!m.user?this._returnResult({data:{user:null,session:null},error:new Al}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:f}))}catch(s){if(await Yr(this.storage,`${this.storageKey}-code-verifier`),He(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:o,error:a}=r;if(a)throw a;
590return await Ye(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(He(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await GW(async s=>(s>0&&await HW(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await Ye(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Es})),(s,o)=>{const a=200*Math.pow(2,s);return o&&Ox(o)&&Date.now()+a-n<ql})}catch(n){if(this._debug(r,"error",n),He(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),Qr()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await ba(this.storage,this.storageKey);if(s&&this.userStorage){let a=await ba(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:s.user},await Vl(this.userStorage,this.storageKey+"-user",a)),s.user=(e=a==null?void 0:a.user)!==null&&e!==void 0?e:$x()}else if(s&&!s.user&&!s.user){const a=await ba(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(s.user=a.user,await Yr(this.storage,this.storageKey+"-user"),await Vl(this.storage,this.storageKey,s)):s.user=$x()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const o=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Ix;if(this._debug(n,`session has${o?"":" not"} expired with margin of ${Ix}s`),o){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(console.error(a),Ox(a)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:l}=await this._getUser(s.access_token);!l&&(a!=null&&a.user)?(s.user=a.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(n,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new Gn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new Qg;const{data:o,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!o.session)throw new Gn;await this._saveSession(o.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const l={data:o.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(o){if(this._debug(s,"error",o),He(o)){const a={data:null,error:o};return Ox(o)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(o),o}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const o=[],a=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,r)}catch(c){o.push(c)}});if(await Promise.all(a),o.length>0){for(let l=0;l<o.length;l+=1)console.error(o[l]);throw o[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Yr(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await Vl(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const o=rS(s);await Vl(this.storage,this.storageKey,o)}else{const s=rS(r);await Vl(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Yr(this.storage,this.storageKey),await Yr(this.storage,this.storageKey+"-code-verifier"),await Yr(this.storage,this.storageKey+"-user"),this.userStorage&&await Yr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;
590try{e&&Qr()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),ql);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/ql);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${ql}ms, refresh threshold is ${Zb} ticks`),s<=Zb&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof uA)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Qr()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[o,a]=await Rl(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(a)}`});s.push(l.toString())}if(n!=null&&n.queryParams){const o=new URLSearchParams(n.queryParams);s.push(o.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:o}=r;return o?this._returnResult({data:null,error:o}):await Ye(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(He(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:o,error:a}=r;if(a)return this._returnResult({data:null,error:a});const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:c,error:u}=await Ye(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=o==null?void 0:o.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(e.factorType==="totp"&&c.type==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(r){if(He(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?wH(e.webauthn.credential_response):_H(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:c}=await Ye(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(r){if(He(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});const a=await Ye(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});if(a.error)return a;const{data:l}=a;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:yH(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:bH(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(He(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const o of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])s.all.push(o),o.status==="verified"&&s[o.factor_type].push(o);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(){var e,r;const{data:{session:n},error:s}
590=await this.getSession();if(s)return this._returnResult({data:null,error:s});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Mx(n.access_token);let a=null;o.aal&&(a=o.aal);let l=a;((r=(e=n.user.factors)===null||e===void 0?void 0:e.filter(d=>d.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(l="aal2");const u=o.amr||[];return{data:{currentLevel:a,nextLevel:l,currentAuthenticationMethods:u},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await Ye(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new Gn})})}catch(r){if(He(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:o}=n;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new Gn});const a=await Ye(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&Qr()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(He(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:o}=n;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new Gn});const a=await Ye(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&Qr()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(He(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await Ye(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Gn})})}catch(e){if(He(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await Ye(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Gn})})}catch(r){if(He(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(l=>l.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(l=>l.kid===e),n&&this.jwks_cached_at+PW>s)return n;const{data:o,error:a}=await Ye(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=s,n=o.keys.find(l=>l.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:f,error:v}
590=await this.getSession();if(v||!f.session)return this._returnResult({data:null,error:v});n=f.session.access_token}const{header:s,payload:o,signature:a,raw:{header:l,payload:c}}=Mx(n);r!=null&&r.allowExpired||XW(o.exp);const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!u){const{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:o,header:s,signature:a},error:null}}const d=ZW(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,a,LW(`${l}.${c}`)))throw new rw("Invalid JWT signature");return{data:{claims:o,header:s,signature:a},error:null}}catch(n){if(He(n))return this._returnResult({data:null,error:n});throw n}}}xh.nextInstanceID={};const AH=xh,RH="2.88.0";let ud="";typeof Deno<"u"?ud="deno":typeof document<"u"?ud="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ud="react-native":ud="node";const IH={"X-Client-Info":`supabase-js-${ud}/${RH}`},OH={headers:IH},MH={schema:"public"},$H={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},DH={};function yh(t){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yh(t)}function FH(t,e){if(yh(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(yh(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function LH(t){var e=FH(t,"string");return yh(e)=="symbol"?e:e+""}function BH(t,e,r){return(e=LH(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function cS(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function dr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?cS(Object(r),!0).forEach(function(n){BH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cS(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const zH=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),UH=()=>Headers,WH=(t,e,r)=>{const n=zH(r),s=UH();return async(o,a)=>{var l;const c=(l=await e())!==null&&l!==void 0?l:t;let u=new s(a==null?void 0:a.headers);return u.has("apikey")||u.set("apikey",t),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),n(o,dr(dr({},a),{},{headers:u}))}};function HH(t){return t.endsWith("/")?t:t+"/"}function GH(t,e){var r,n;const{db:s,auth:o,realtime:a,global:l}=t,{db:c,auth:u,realtime:d,global:h}=e,m={db:dr(dr({},c),s),auth:dr(dr({},u),o),realtime:dr(dr({},d),a),storage:{},global:dr(dr(dr({},h),l),{},{headers:dr(dr({},(r=h==null?void 0:h.headers)!==null&&r!==void 0?r:{}),(n=l==null?void 0:l.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?m.accessToken=t.accessToken:delete m.accessToken,m}function qH(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(HH(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var VH=class extends AH{constructor(t){super(t)}},KH=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const o=qH(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",o),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",o),this.storageUrl=new URL("storage/v1",o),this.functionsUrl=new URL("functions/v1",o);const a=`sb-${o.hostname.split(".")[0]}-auth-token`,l={db:MH,realtime:DH,auth:dr(dr({},$H),{},{storageKey:a}),global:OH},c=GH(r??{},l);if(this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=c.auth)!==null&&u!==void 0?u:{},this.headers,c.global.fetch)}this.fetch=WH(e,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(dr({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new CU(new URL("rest/v1",o).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),this.storage=new kW(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new _U(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:o,flowType:a,lock:l,debug:c,throwOnError:u},d,h){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new VH({url:this.authUrl.href,headers:dr(dr({},m),d),storageKey:o,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:a,lock:l,debug:c,throwOnError:u,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new HU(this.realtimeUrl.href,dr(dr({},t),{},{params:dr(dr({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const YH=(t,e,r)=>new KH(t,e,r);function QH(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}QH()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to N
590ode.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");function JH(){var b,x;if(typeof window>"u")return;const t=location.hostname,r=["lovableproject.com","lovableproject-dev.com","lovable.app","gpt-eng.com","gptengineer.run"].some(y=>t===y||t.endsWith("."+y)),n="[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",s=r?((b=t.match(new RegExp("^(?:id-preview(?:-[a-z0-9]+)?|project)--("+n+")(?:-dev)?(?=\\.|$)","i")))==null?void 0:b[1])??((x=t.match(new RegExp("^("+n+")(?=[.-])","i")))==null?void 0:x[1]):void 0,o=window.parent&&window.parent!==window;if(!s||!o)return localStorage;const a=t.endsWith(".lovableproject-dev.com")||t.endsWith(".gpt-eng.com"),l=a?/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$|^http:\/\/localhost:3000$/:/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$/,c=location.ancestorOrigins&&location.ancestorOrigins[0]||(document.referrer?new URL(document.referrer).origin:""),u=c&&l.test(c)?[c]:a?["https://lovable.dev","http://localhost:3000"]:["https://lovable.dev"],d="lovable-preview-auth:result",h=2e3,m=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),f=(y,w,j)=>new Promise(_=>{const S=m();let N=!1,P;const C=T=>{N||(N=!0,clearTimeout(P),window.removeEventListener("message",O),_(T))},O=T=>{if(u.indexOf(T.origin)<0)return;const A=T.data;A&&A.type===d&&A.requestId===S&&C(A)};window.addEventListener("message",O);const F={type:y,requestId:S,projectId:s,key:w};j!==void 0&&(F.value=j);for(const T of u)window.parent.postMessage(F,T);P=setTimeout(()=>C(null),h)});let v=!0;const p=250;return{getItem:async y=>{let w=await f("lovable-preview-auth:get",y);return!w&&v&&(await new Promise(j=>setTimeout(j,p)),w=await f("lovable-preview-auth:get",y)),v=!1,w&&w.ok&&typeof w.value=="string"?w.value===""?(localStorage.removeItem(y),null):w.value:localStorage.getItem(y)},setItem:(y,w)=>(localStorage.setItem(y,w),f("lovable-preview-auth:set",y,w).then(j=>{j&&j.ok&&typeof j.value=="string"&&localStorage.getItem(y)===w&&(j.value===""?localStorage.removeItem(y):localStorage.setItem(y,j.value))})),removeItem:y=>(localStorage.removeItem(y),f("lovable-preview-auth:remove",y).then(()=>{}))}}const XH="https://tmixwolpvcqsnzjfxkly.supabase.co",ZH="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRtaXh3b2xwdmNxc256amZ4a2x5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjYwNDgxMTUsImV4cCI6MjA4MTYyNDExNX0.53jlUZqMobnCBmvNYlGvkuGeCN7J63UDahOJ3_FCwPg",re=YH(XH,ZH,{auth:{storage:JH(),persistSession:!0,autoRefreshToken:!0}}),fA=g.createContext(void 0);function e7({children:t}){const[e,r]=g.useState(null),[n,s]=g.useState(null),[o,a]=g.useState(null),[l,c]=g.useState(!0),[u,d]=g.useState(!1),h=async S=>{const{data:N}=await re.from("user_roles").select("role").eq("user_id",S).in("role",["support","admin","super_admin"]);d(!!N&&N.length>0)},m=async S=>{const{data:N,error:P}=await re.from("profiles").select("id, user_id, display_name, email, website_url, company, design_preferences, theme_generations_count, is_premium, email_verified, referral_code").eq("user_id",S).single();!P&&N&&a(N)},f=async()=>{e&&await m(e.id)};g.useEffect(()=>{const{data:{subscription:S}}=re.auth.onAuthStateChange((N,P)=>{s(P),r((P==null?void 0:P.user)??null),P!=null&&P.user?setTimeout(()=>{m(P.user.id),h(P.user.id)},0):(a(null),d(!1)),c(!1)});return re.auth.getSession().then(({data:{session:N}})=>{s(N),r((N==null?void 0:N.user)??null),N!=null&&N.user&&(m(N.user.id),h(N.user.id)),c(!1)}),()=>S.unsubscribe()},[]),g.useEffect(()=>{const S=async()=>{if(document.visibilityState==="visible"&&e){try{await re.auth.refreshSession()}catch{}m(e.id)}};return document.addEventListener("visibilitychange",S),window.addEventListener("focus",S),()=>{document.removeEventListener("visibilitychange",S),window.removeEventListener("focus",S)}},[e]);const v=async(S,N,P)=>{const{data:C,error:O}=await re.auth.signUp({email:S,password:N,options:{emailRedirectTo:`${window.location.origin}/dashboard`,data:{display_name:P}}});return!O&&(C!=null&&C.user)&&Array.isArray(C.user.identities)&&C.user.identities.length===0?{data:C,error:new Error("This email is already registered. Please sign in instead.")}:{data:C,error:O}},p=async(S,N)=>{const{error:P}=await re.auth.signInWithPassword({email:S,password:N});return{error:P}},b=async()=>{await re.auth.signOut(),a(null)},x=3,y=(o==null?void 0:o.is_premium)||((o==null?void 0:o.theme_generations_count)??0)<x,w=Math.max(0,x-((o==null?void 0:o.theme_generations_count)??0)),j=!!(e!=null&&e.email_confirmed_at)||!!(e!=null&&e.confirmed_at)||((o==null?void 0:o.email_verified)??!1),_=async()=>
590{if(!e||!o)return{error:new Error("User not found")};try{const{error:S}=await re.auth.resend({type:"signup",email:o.email||e.email,options:{emailRedirectTo:`${window.location.origin}/dashboard`}});return S?{error:new Error(S.message||"Failed to send verification email")}:{error:null}}catch(S){return{error:new Error(S.message||"Failed to send verification email")}}};return i.jsx(fA.Provider,{value:{user:e,session:n,profile:o,loading:l,signUp:v,signIn:p,signOut:b,refreshProfile:f,canGenerateThemes:y,remainingGenerations:w,isEmailVerified:j,resendVerificationEmail:_,isStaff:u},children:t})}function $t(){const t=g.useContext(fA);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}async function uS(t){const e=new TextEncoder().encode(t.trim().toLowerCase()),r=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(r)).map(n=>n.toString(16).padStart(2,"0")).join("")}function Fx(t,e){typeof window.rdt=="function"&&window.rdt("track",t,e)}const t7=24*60*60*1e3;function r7(t){const e=`rdt_purchase_fired:${t}`;try{if(typeof localStorage<"u"){const r=localStorage.getItem(e);if(r){const n=Number(r);if(Number.isFinite(n)&&Date.now()-n<t7)return!0}return localStorage.setItem(e,String(Date.now())),!1}}catch{}try{if(typeof sessionStorage<"u"){if(sessionStorage.getItem(e))return!0;sessionStorage.setItem(e,String(Date.now()))}}catch{}return!1}function P_(){return{track:(n,s)=>Fx(n,s),trackSignUp:async n=>{const s={};n&&(s.email=await uS(n)),Fx("SignUp",s)},trackPurchase:async n=>{if(n.transactionId&&r7(n.transactionId))return;const s={currency:n.currency||"USD"};typeof n.value=="number"&&(s.value=n.value),n.transactionId&&(s.transactionId=n.transactionId),n.email&&(s.email=await uS(n.email)),Fx("Purchase",s)}}}const n7=24*60*60*1e3;function s7(t){const e=`adroll_purchase_fired:${t}`;try{if(typeof localStorage<"u"){const r=localStorage.getItem(e);if(r){const n=Number(r);if(Number.isFinite(n)&&Date.now()-n<n7)return!0}return localStorage.setItem(e,String(Date.now())),!1}}catch{}try{if(typeof sessionStorage<"u"){if(sessionStorage.getItem(e))return!0;sessionStorage.setItem(e,String(Date.now()))}}catch{}return!1}function dS(t,e){if(typeof window<"u"&&window.adroll&&typeof window.adroll.track=="function")try{window.adroll.track(t,e)}catch(r){console.warn("AdRoll track failed:",r)}}function T_(){return{trackSignUp:r=>{var n;if(r&&((n=window.adroll)!=null&&n.identify_email))try{window.adroll.identify_email(r)}catch{}dS("signup")},trackPurchase:r=>{var s;if(r.transactionId&&s7(r.transactionId))return;if(r.email&&((s=window.adroll)!=null&&s.identify_email))try{window.adroll.identify_email(r.email)}catch{}const n={currency:r.currency||"USD"};typeof r.value=="number"&&(n.conversion_value=r.value),r.transactionId&&(n.order_id=r.transactionId),dS("purchase",n)}}}function i7(){var e;if(typeof navigator>"u")return!1;const t=navigator.userAgent;return!!(/iPhone|iPad|iPod|Android/i.test(t)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1||typeof window<"u"&&((e=window.matchMedia)!=null&&e.call(window,"(pointer: coarse)").matches))}function Ls(t){if(!t)return;if(i7()){window.location.assign(t);return}window.open(t,"_blank","noopener,noreferrer")||Q.success("Checkout ready",{description:"Pop-up blocked? Click below to open checkout.",action:{label:"Open Checkout",onClick:()=>window.location.assign(t)},duration:15e3})}const A_="appsumo_pending_license",mA="appsumo_consumed_code";function o7(t){try{localStorage.setItem(A_,t)}catch{}}function pA(){try{return localStorage.getItem(A_)}catch{return null}}function nw(){try{localStorage.removeItem(A_)}catch{}}function a7(t){if(t)try{sessionStorage.setItem(mA,t)}catch{}}function l7(t){if(!t)return!1;try{return sessionStorage.getItem(mA)===t}catch{return!1}}async function On(t,e="Something went wrong. Please try again."){const r=t==null?void 0:t.context;if(r&&typeof r.json=="function")try{const s=await r.clone().json();return s&&typeof s.error=="string"&&s.error.trim()?{message:s.error,body:s}:{message:e,body:s??{}}}catch{}return{message:(t instanceof Error?t.message:"")||e,body:{}}}const c7={project:{yearly:69},starter:{monthly:10,yearly:99},pro:{monthly:20,yearly:199},agency:{monthly:40,yearly:399},project_pass:{monthly:39,yearly:39}},hS=new Set(["project","starter","pro","agency","project_pass"]),$m={plan:"free",source:"stripe",billingInterval:null,subscriptionEnd:null,cancelAtPeriodEnd:!1,creditsRemaining:5,monthlyCredits:0,monthlyCreditsExpireAt:null,extraCredits:5,extraCreditsExpireAt:null,lifetimeCreditsUsed:0,isSuperAdmin:!1,canUseCredits:!0,trialStatus:"ineligible",trialEndsAt:null},gA=g.createContext(null);function u7({children:t}){const{user:e,session:r,loading:n}=$t(),[s,o]=g.useState($m),[a,l]=g.useState(!0),c=g.useRef(!1),{trackPurchase:u}
590=P_(),{trackPurchase:d}=T_(),h=g.useRef(null),m=g.useCallback(async j=>{var S,N;if(n||c.current)return;let _=j??r;if(!e||!(_!=null&&_.access_token)){o($m),l(!1);return}c.current=!0;try{if(_.expires_at&&_.expires_at*1e3-Date.now()<6e4){const{data:O}=await re.auth.refreshSession();(S=O==null?void 0:O.session)!=null&&S.access_token&&(_=O.session)}let{data:P,error:C}=await re.functions.invoke("check-subscription",{headers:{Authorization:`Bearer ${_.access_token}`}});if(C){const{data:O}=await re.auth.refreshSession();if((N=O==null?void 0:O.session)!=null&&N.access_token){const F=await re.functions.invoke("check-subscription",{headers:{Authorization:`Bearer ${O.session.access_token}`}});P=F.data,C=F.error}}if(C){console.error("Failed to check subscription:",C);return}if(P){o({plan:P.plan||"free",source:P.source||"stripe",billingInterval:P.billingInterval||null,subscriptionEnd:P.subscriptionEnd||null,cancelAtPeriodEnd:P.cancelAtPeriodEnd??!1,creditsRemaining:P.creditsRemaining??15,monthlyCredits:P.monthlyCredits??0,monthlyCreditsExpireAt:P.monthlyCreditsExpireAt??null,extraCredits:P.extraCredits??0,extraCreditsExpireAt:P.extraCreditsExpireAt??null,lifetimeCreditsUsed:P.lifetimeCreditsUsed??0,isSuperAdmin:P.isSuperAdmin??!1,canUseCredits:P.canUseCredits??!0,trialStatus:P.trialStatus??"ineligible",trialEndsAt:P.trialEndsAt??null});try{const O=P.plan||"free",F=P.billingInterval||"monthly",T=P.subscriptionEnd||"none",A=h.current;h.current=O;const k=W=>{var R;return hS.has(W)?((R=c7[W])==null?void 0:R[F])??0:0},$=k(O),K=A?k(A):0;if(hS.has(O)&&A!==null&&A!==O&&$>K&&(e!=null&&e.email)&&$>0){const W=`reddit_purchase_fired:${e.id}:${O}:${F}:${T}`;typeof sessionStorage<"u"&&!sessionStorage.getItem(W)&&(u({email:e.email,value:$,currency:"USD",transactionId:`${O}:${F}:${T}`}),d({email:e.email,value:$,currency:"USD",transactionId:`${O}:${F}:${T}`}),sessionStorage.setItem(W,"1"))}}catch(O){console.warn("Reddit purchase tracking skipped:",O)}}}catch(P){console.error("Error checking subscription:",P)}finally{l(!1),c.current=!1}},[e,r,n]);g.useEffect(()=>{if(!n&&e&&(r!=null&&r.access_token)){const j=setTimeout(()=>{m(r)},100);return()=>clearTimeout(j)}else!n&&!e&&(o($m),l(!1))},[e,r,n,m]),g.useEffect(()=>{if(!e||!(r!=null&&r.access_token))return;const j=setInterval(()=>m(r),6e4);return()=>clearInterval(j)},[e,m]),g.useEffect(()=>{if(!e||s.trialStatus!=="active"||!s.trialEndsAt)return;const j=Math.max(0,new Date(s.trialEndsAt).getTime()-Date.now())+100,_=window.setTimeout(()=>void m(r),j);return()=>window.clearTimeout(_)},[s.trialEndsAt,s.trialStatus,m,r,e]);const f=g.useRef(!1);g.useEffect(()=>{if(!e||!(r!=null&&r.access_token)||f.current)return;const j=pA();j&&(f.current=!0,(async()=>{const{data:_,error:S}=await re.functions.invoke("appsumo-activate",{body:{licenseKey:j}});if(!S&&!(_!=null&&_.error))nw(),await m(r);else{const N=S?await On(S,"Could not attach AppSumo license."):{message:String((_==null?void 0:_.error)||"Could not attach AppSumo license."),body:{}},P=N.message.toLowerCase(),C=P.includes("already been redeemed by another account")||P.includes("no longer active")||N.body.retryable===!1;C&&nw(),Q.error(N.message,{description:C?"Please contact support with your AppSumo license key if you need help.":"Your license is saved. Please try again in a moment."})}})())},[e,r,m]);const v=async(j,_)=>{const S=typeof window<"u"?window.endorsely_referral:void 0,{data:N}=await re.auth.getSession();if(!N.session)throw new Error("Your session expired. Please sign in again to continue to checkout.");const{data:P,error:C}=await re.functions.invoke("create-checkout",{body:{plan:j,billingInterval:_,endorselyReferral:S}});if(C){const O=await On(C,"Failed to create checkout session");throw new Error(O.message)}return P!=null&&P.upgraded?(await m(),{upgraded:!0,message:P.message}):P!=null&&P.noChange?{noChange:!0,message:P.message}:P!=null&&P.alreadySubscribed?(P!=null&&P.url&&Ls(P.url),{alreadySubscribed:!0,message:P.message,url:P.url}):P!=null&&P.url?(Ls(P.url),{url:P.url}):P},p=async()=>{const{data:j,error:_}=await re.functions.invoke("create-one-time-checkout");if(_){const S=await On(_,"Failed to create one-time checkout session");throw new Error(S.message)}j!=null&&j.url&&Ls(j.url)},b=async()=>{const{data:j,error:_}=await re.functions.invoke("customer-portal");if(_)throw new Error(_.message||"Failed to open customer portal");j!=null&&j.url&&Ls(j.url)},x=async()=>{const{data:j,error:_}=await re.functions.invoke("cancel-subscription");if(_)throw new Error(_.message||"Failed to cancel subscription");return j!=null&&j.no_subscription?(o(S=>({...S,plan:"free",billingInterval:null,subscriptionEnd:null,cancelAtPeriodEnd:!1})),j):(await m(),j)},y=async()=>{const{data:j,error:_}=await re.functions.invoke("reactivate-subscription");if(_)throw new Error(_.message||"Failed to reactivate subscription");return await m(),j},w=async(j,_)=>{const{data:S,error:N}=await re.functions.invoke("preview-subscription-change",{body:{plan:j,billingInterval:_}});if(N)throw new Error(N.message||"Failed to preview subscription change");return S};return i.jsx(gA.Provider,{value:{...s,loading:a,refreshSubscription:m,createCheckout:v,createOneTimeCheckout:p,openCustomerPortal:b,cancelSubscription:x,reactivateSubscription:y,previewSubscriptionChange:w},children:t})}const d7={...$m,loading:!0,refreshSubscription:async()=>{},createCheckout:async()=>{},createOneTimeCheckout:async()=>{},openCustomerPortal:async()=>{},cancelSubscription:async()=>({success:!1}),reactivateSubscription:async()=>({success:!1}),previewSubscriptionChange:async()=>({isUpgrade:!1,isDowngrade:!1,currentPlan:"free",currentInterval:"monthly",targetPlan:"free",billingInterval:"monthly",currentCredits:0,newCredits:0,creditDifference:0,currentBalance:0,newBalance:0,proratedAmount:0,currency:"usd",periodStart:new Date().toISOString(),periodEnd:new Date().toISOString(),nextRenewalDate:new Date().toISOString(),effectiveDate:new Date().toISOString(),currentPlanPrice:0,targetPlanPrice:0})};function nn(){const t=g.useContext(gA);return t||(console.warn("useSubscription called outside SubscriptionProvider, using defaults"),d7)}var ue=typeof window<"u"?window:void 0,Zr=typeof globalThis<"u"?globalThis:ue;typeof self>"u"&&(Zr.self=Zr),typeof File>"u"&&(Zr.File=function(){});var vA=Array.prototype,fS=vA.forEach,mS=vA.indexOf,Zn=Zr==null?void 0:Zr.navigator,De=Zr==null?void 0:Zr.document,In=Zr==null?void 0:Zr.location,sw=Zr==null?void 0:Zr.fetch,iw=Zr!=null&&Zr.X
vendor: 48,710 bytes, lines 590-591
590MLHttpRequest&&"withCredentials"in new Zr.XMLHttpRequest?Zr.XMLHttpRequest:void 0,pS=Zr==null?void 0:Zr.AbortController,An=Zn==null?void 0:Zn.userAgent,Ve=ue??{},Pi={DEBUG:!1,LIB_VERSION:"1.310.0"};function gS(t,e,r,n,s,o,a){try{var l=t[o](a),c=l.value}catch(u){return void r(u)}l.done?e(c):Promise.resolve(c).then(n,s)}function vS(t){return function(){var e=this,r=arguments;return new Promise(function(n,s){var o=t.apply(e,r);function a(c){gS(o,n,s,a,l,"next",c)}function l(c){gS(o,n,s,a,l,"throw",c)}a(void 0)})}}function ze(){return ze=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ze.apply(null,arguments)}function xA(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}var h7=["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"],xS=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var r=t.toLowerCase();return h7.concat(e).some(n=>{var s=n.toLowerCase();return r.indexOf(s)!==-1})},f7=["$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"];function gt(t,e){return t.indexOf(e)!==-1}var Jg=function(t){return t.trim()},ow=function(t){return t.replace(/^\$/,"")},m7=Array.isArray,yA=Object.prototype,bA=yA.hasOwnProperty,Xg=yA.toString,At=m7||function(t){return Xg.call(t)==="[object Array]"},qo=t=>typeof t=="function",Hr=t=>t===Object(t)&&!At(t),cc=t=>{if(Hr(t)){for(var e in t)if(bA.call(t,e))return!1;return!0}return!1},Re=t=>t===void 0,$r=t=>Xg.call(t)=="[object String]",aw=t=>$r(t)&&t.trim().length===0,Ys=t=>t===null,Tt=t=>Re(t)||Ys(t),xi=t=>Xg.call(t)=="[object Number]",zi=t=>Xg.call(t)==="[object Boolean]",p7=t=>t instanceof FormData,g7=t=>gt(f7,t);function lw(t){return t===null||typeof t!="object"}function Ip(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"}function wA(t){return!Re(Event)&&function(e,r){try{return e instanceof r}catch{return!1}}(t,Event)}var v7=[!0,"true",1,"1","yes"],Lx=t=>gt(v7,t),x7=[!1,"false",0,"0","no"];function di(t,e,r,n,s){return e>r&&(n.warn("min cannot be greater than max."),e=r),xi(t)?t>r?(n.warn(" cannot be  greater than max: "+r+". Using max value instead."),r):t<e?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),di(s||r,e,r,n))}class y7{constructor(e){this.t={},this.i=e.i,this.o=di(e.bucketSize,0,100,e.h),this.m=di(e.refillRate,0,this.o,e.h),this.$=di(e.refillInterval,0,864e5,e.h)}S(e,r){var n=r-e.lastAccess,s=Math.floor(n/this.$);if(s>0){var o=s*this.m;e.tokens=Math.min(e.tokens+o,this.o),e.lastAccess=e.lastAccess+s*this.$}}consumeRateLimit(e){var r,n=Date.now(),s=String(e),o=this.t[s];return o?this.S(o,n):(o={tokens:this.o,lastAccess:n},this.t[s]=o),o.tokens===0||(o.tokens--,o.tokens===0&&((r=this.i)==null||r.call(this,e)),o.tokens===0)}stop(){this.t={}}}var ms="Mobile",Op="iOS",Fi="Android",bh="Tablet",_A=Fi+" "+bh,jA="iPad",kA="Apple",SA=kA+" Watch",wh="Safari",Jc="BlackBerry",NA="Samsung",CA=NA+"Browser",EA=NA+" Internet",nl="Chrome",b7=nl+" OS",PA=nl+" "+Op,R_="Internet Explorer",TA=R_+" "+ms,I_="Opera",w7=I_+" Mini",O_="Edge",AA="Microsoft "+O_,jc="Firefox",RA=jc+" "+Op,_h="Nintendo",jh="PlayStation",kc="Xbox",IA=Fi+" "+ms,OA=ms+" "+wh,dd="Windows",cw=dd+" Phone",yS="Nokia",uw="Ouya",MA="Generic",_7=MA+" "+ms.toLowerCase(),$A=MA+" "+bh.toLowerCase(),dw="Konqueror",vn="(\\d+(\\.\\d+)?)",Bx=new RegExp("Version/"+vn),j7=new RegExp(kc,"i"),k7=new RegExp(jh+" \\w+","i"),S7=new RegExp(_h+" \\w+","i"),M_=new RegExp(Jc+"|PlayBook|BB10","i"),N7={"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"},Zf,bS,zx,C7=(t,e)=>e&&gt(e,kA)||function(r){return gt(r,wh)&&!gt(r,nl)&&!gt(r,Fi)}(t),DA=function(t,e){return e=e||"",gt(t," OPR/")&&gt(t,"Mini")?w7:gt(t," OPR/")?I_:M_.test(t)?Jc:gt(t,"IE"+ms)||gt(t,"WPDesktop")?TA:gt(t,CA)?EA:gt(t,O_)||gt(t,"Edg/")?AA:gt(t,"FBIOS")?"Facebook "+ms:gt(t,"UCWEB")||gt(t,"UCBrowser")?"UC Browser":gt(t,"CriOS")?PA:gt(t,"CrMo")||gt(t,nl)?nl:gt(t,Fi)&&gt(t,wh)?IA:gt(t,"FxiOS")?RA:gt(t.toLowerCase(),dw.toLowerCase())?dw:C7(t,e)?gt(t,ms)?OA:wh:gt(t,jc)?jc:gt(t,"MSIE")||gt(t,"Trident/")?R_:gt(t,"Gecko")?jc:""},E7={[TA]:[new RegExp("rv:"+vn)],[AA]:[new RegExp(O_+"?\\/"+vn)],[nl]:[new RegExp("("+nl+"|CrMo)\\/"+vn)],[PA]:[new RegExp("CriOS\\/"+vn)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+vn)],[wh]:[Bx],[OA]:[Bx],[I_]:[new RegExp("(Opera|OPR)\\/"+vn)],[jc]:[new RegExp(jc+"\\/"+vn)],[RA]:[new RegExp("FxiOS\\/"+vn)],[dw]:[new RegExp("Konqueror[:/]?"+vn,"i")],[Jc]:[new RegExp(Jc+" "+vn),Bx],[IA]:[new RegExp("android\\s"+vn,"i")],[EA]:[new RegExp(CA+"\\/"+vn)],[R_]:[new RegExp("(rv:|MSIE )"+vn)],Mozilla:[new RegExp("rv:"+vn)]},P7=function(t,e){var r=DA(t,e),n=E7[r];if(Re(n))return null;for(var s=0;s<n.length;s++){var o=n[s],a=t.match(o);if(a)return parseFloat(a[a.length-2])}return null},wS=[[new RegExp(kc+"; "+kc+" (.*?)[);]","i"),t=>[kc,t&&t[1]||""]],[new RegExp(_h,"i"),[_h,""]],[new RegExp(jh,"i"),[jh,""]],[M_,[Jc,""]],[new RegExp(dd,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[cw,""];if(new RegExp(ms).test(e)&&!/IEMobile\b/.test(e))return[dd+" "+ms,""];var r=/Windows NT ([0-9.]+)/i.exec(e);if(r&&r[1]){var n=r[1],s=N7[n]||"";return/arm/i.test(e)&&(s="RT"),[dd,s]}return[dd,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[Op,e.join(".")]}return[Op,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=Re(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Fi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Fi+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[Fi,e.join(".")]}return[Fi,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];if(t&&t[1]){var r=[t[1],t[2],t[3]||"0"];e[1]=r.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[b7,""]],[/Linux|debian/i,["Linux",""]]],_S=function(t){return S7.test(t)?_h:k7.test(t)?jh:j7.test(t)?kc:new RegExp(uw,"i").test(t)?uw:new RegExp("("+cw+"|WPDesktop)","i").test(t)?cw:/iPad/.test(t)?jA:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?SA:M_.test(t)?Jc:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(yS,"i").test(t)?yS:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(ms).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Fi:_A:new RegExp("(pda|"+ms+")","i").test(t)?_7:new RegExp(bh,"i").test(t)&&!new RegExp(bh+" pc","i").test(t)?$A:""},T7=t=>t instanceof Error;function A7(t){var e=globalThis._posthogChunkIds;if(e){var r=Object.keys(e);return zx&&r.length===bS||(bS=r.length,zx=r.reduce((n,s)=>{Zf||(Zf={});var o=Zf[s];if(o)n[o[0]]=o[1];else for(var a=t(s),l=a.length-1;l>=0;l--){var c=a[l],u=c==null?void 0:c.filename,d=e[s];if(u&&d){n[u]=d,Zf[s]=[u,d];break}}return n},{})),zx}}class R7{constructor(e,r,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=r,this.modifiers=n}buildFromUnknown(e,r){r===void 0&&(r={});var n=r&&r.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(n,r,0).apply(e),o=this.buildParsingContext(),a=this.parseStacktrace(s,o);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:"error"}}modifyFrames(e){var r=this;return vS(function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&At(n.stacktrace.frames)&&(n.stacktrace.frames=yield r.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){var r;return{type:"Error",value:"Unknown error",stack:(r=e.syntheticException)==null?void 0:r.stack,synthetic:!0}}parseStacktrace(e,r){var n,s;return e.cause!=null&&(n=this.parseStacktrace(e.cause,r)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),r.chunkIdMap)),ze({},e,{cause:n,stack:s})}applyChunkIds(e,r){return e.map(n=>(n.filename&&r&&(n.chunk_id=r[n.filename]),n))}applyCoercers(e,r){for(var n of this.coercers)if(n.match(e))return n.coerce(e,r);return this.coerceFallback(r)}applyModifiers(e){var r=this;return vS(function*(){var n=e;for(var s of r.modifiers)n=yield s(n);return n})()}convertToExceptionList(e,r){var n,s,o,a={type:e.type,value:e.value,mechanism:{type:(n=r.type)!==null&&n!==void 0?n:"generic",handled:(s=r.handled)===null||s===void 0||s,synthetic:(o=e.synthetic)!==null&&o!==void 0&&o}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var l=[a];return e.cause!=null&&l.push(...this.convertToExceptionList(e.cause,ze({},r,{handled:!0}))),l}buildParsingContext(){return{chunkIdMap:A7(this.stackParser)}}buildCoercingContext(e,r,n){n===void 0&&(n=0);var s=(o,a)=>{if(a<=4){var l=this.buildCoercingContext(e,r,a);return this.applyCoercers(o,l)}};return ze({},r,{syntheticException:n==0?r.syntheticException:void 0,mechanism:e,apply:o=>s(o,n),next:o=>s(o,n+1)})}}var Xc="?";function hw(t,e,r,n,s){var o={platform:t,filename:e,function:r==="<anonymous>"?Xc:r,in_app:!0};return Re(n)||(o.lineno=n),Re(s)||(o.colno=s),o}var FA=(t,e)=>{var r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:Xc,r?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},I7=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,O7=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,M7=/\((\S*)(?::(\d+))(?::(\d+))\)/,$7=(t,e)=>{var r=I7.exec(t);if(r){var[,n,s,o]=r;return hw(e,n,Xc,+s,+o)}var a=O7.exec(t);if(a){if(a[2]&&a[2].indexOf("eval")===0){var l=M7.exec(a[2]);l&&(a[2]=l[1],a[3]=l[2],a[4]=l[3])}var[c,u]=FA(a[1]||Xc,a[2]);return hw(e,u,c,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},D7=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,F7=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,L7=(t,e)=>{var r=D7.exec(t);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var n=F7.exec(r[3]);n&&(r[1]=r[1]||"eval",r[3]=n[1],r[4]=n[2],r[5]="")}var s=r[3],o=r[1]||Xc;return[o,s]=FA(o,s),hw(e,s,o,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},jS=/\(error: (.*)\)/,kS=50;function B7(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return function(s,o){o===void 0&&(o=0);for(var a=[],l=s.split(`
591`),c=o;c<l.length;c++){var u=l[c];if(!(u.length>1024)){var d=jS.test(u)?u.replace(jS,"$1"):u;if(!d.match(/\S*Error: /)){for(var h of r){var m=h(d,t);if(m){a.push(m);break}}if(a.length>=kS)break}}}return function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,kS).map(p=>{return ze({},p,{filename:p.filename||(b=v,b[b.length-1]||{}).filename,function:p.function||Xc});var b})}(a)}}class z7{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,r){var n=$r(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var r=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?r+": "+e.message:r}isDOMException(e){return Ip(e,"DOMException")}isDOMError(e){return Ip(e,"DOMError")}}class U7{match(e){return(r=>r instanceof Error)(e)}coerce(e,r){return{type:this.getType(e),value:this.getMessage(e,r),stack:this.getStack(e),cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,r){var n=e.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(e){return e.stacktrace||e.stack||void 0}}class W7{constructor(){}match(e){return Ip(e,"ErrorEvent")&&e.error!=null}coerce(e,r){var n,s=r.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}}var H7=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class G7{match(e){return typeof e=="string"}coerce(e,r){var n,[s,o]=this.getInfos(e);return{type:s??"Error",value:o??e,stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(e){var r="Error",n=e,s=e.match(H7);return s&&(r=s[1],n=s[2]),[r,n]}}var q7=["fatal","error","warning","log","info","debug"];function LA(t,e){e===void 0&&(e=40);var r=Object.keys(t);if(r.sort(),!r.length)return"[object has no keys]";for(var n=r.length;n>0;n--){var s=r.slice(0,n).join(", ");if(!(s.length>e))return n===r.length||s.length<=e?s:s.slice(0,e)+"..."}return""}class V7{match(e){return typeof e=="object"&&e!==null}coerce(e,r){var n,s=this.getErrorPropertyFromObject(e);return s?r.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(n=r.syntheticException)==null?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return wA(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var r="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(r+=" with message: '"+e.message+"'"),r}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: "+LA(e)}isSeverityLevel(e){return $r(e)&&!aw(e)&&q7.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];if(T7(n))return n}}getObjectClassName(e){try{var r=Object.getPrototypeOf(e);return r?r.constructor.name:void 0}catch{return}}}class K7{match(e){return wA(e)}coerce(e,r){var n,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+LA(e),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}}class Y7{match(e){return lw(e)}coerce(e,r){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}}class Q7{match(e){return Ip(e,"PromiseRejectionEvent")}coerce(e,r){var n,s=this.getUnhandledRejectionReason(e);return lw(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}:r.apply(s)}getUnhandledRejectionReason(e){if(lw(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var BA=function(t,e){var{debugEnabled:r}=e===void 0?{}:e,n={k:function(s){if(ue&&(Pi.DEBUG||Ve.POSTHOG_DEBUG||r)&&!Re(ue.console)&&ue.console){for(var o=("__rrweb_original__"in ue.console[s])?ue.console[s].__rrweb_original__:ue.console[s],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];o(t,...l)}},info:function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];n.k("log",...o)},warn:function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];n.k("warn",...o)},error:function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];n.k("error",...o)},critical:function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];console.error(t,...o)},uninitializedWarning:s=>{n.error("You must initialize PostHog before calling "+s)},createLogger:(s,o)=>BA(t+" "+s,o)};return n},Le=BA("[PostHog.js]"),jr=Le.createLogger,J7=jr("[ExternalScriptsLoader]"),SS=(t,e,r)=>{if(t.config.disable_external_dependency_loading)return J7.warn(e+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var n=De==null?void 0:De.querySelectorAll("script");if(n){for(var s,o=function(){if(n[a].src===e){var c=n[a];return c.__posthog_loading_callback_fired?{v:r()}:(c.addEventListener("load",u=>{c.__posthog_loading_callback_fired=!0,r(void 0,u)}),c.onerror=u=>r(u),{v:void 0})}},a=0;a<n.length;a++)if(s=o())return s.v}var l=()=>{if(!De)return r("document not found");var c=De.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=e,c.onload=h=>{c.__posthog_loading_callback_fired=!0,r(void 0,h)},c.onerror=h=>r(h),t.config.prepare_external_dependency_script&&(c=t.config.prepare_external_dependency_script(c)),!c)return r("prepare_external_dependency_script returned null");var u,d=De.querySelectorAll("body > script");d.length>0?(u=d[0].parentNode)==null||u.insertBefore(c,d[0]):De.body.appendChild(c)};De!=null&&De.body?l():De==null||De.addEventListener("DOMContentLoaded",l)};Ve.__PosthogExtensions__=Ve.__PosthogExtensions__||{},Ve.__PosthogExtensions__.loadExternalDependency=(t,e,r)=>{var n="/static/"+e+".js?v="+t.version;if(e==="remote-config"&&(n="/array/"+t.config.token+"/config.js"),e==="toolbar"){var s=3e5;n=n+"&t="+Math.floor(Date.now()/s)*s}var o=t.requestRouter.endpointFor("assets",n);SS(t,o,r)},Ve.__PosthogExtensions__.loadSiteApp=(t,e,r)=>{var n=t.requestRouter.endpointFor("api",e);SS(t,n,r)};var Mp={};function Vo(t,e,r){if(At(t)){if(fS&&t.forEach===fS)t.forEach(e,r);else if("length"in t&&t.length===+t.length){for(var n=0,s=t.length;n<s;n++)if(n in t&&e.call(r,t[n],n)===Mp)return}}}function zt(t,e,r){if(!Tt(t)){if(At(t))return Vo(t,e,r);if(p7(t)){for(var n of t.entries())if(e.call(r,n[1],n[0])===Mp)return}else for(var s in t)if(bA.call(t,s)&&e.call(r,t[s],s)===Mp)return}}var vr=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Vo(r,function(s){for(var o in s)s[o]!==void 0&&(t[o]=s[o])}),t},xu=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Vo(r,function(s){Vo(s,function(o){t.push(o)})}),t};function Dm(t){for(var e=Object.keys(t),r=e.length,n=new Array(r);r--;)n[r]=[e[r],t[e[r]]];return n}var NS=function(t){try{return t()}catch{return}},X7=function(t){return function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.apply(this,r)}catch(s){Le.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Le.critical(s)}}},$_=function(t){var e={};return zt(t,function(r,n){($r(r)&&r.length>0||xi(r))&&(e[n]=r)}),e};function Z7(t,e){return r=t,n=o=>$r(o)&&!Ys(e)?o.slice(0,e):o,s=new Set,function o(a,l){return a!==Object(a)?n?n(a,l):a:s.has(a)?void 0:(s.add(a),At(a)?(c=[],Vo(a,u=>{c.push(o(u))})):(c={},zt(a,(u,d)=>{s.has(u)||(c[d]=o(u,d))})),c);var c}(r);var r,n,s}var e9=["herokuapp.com","vercel.app","netlify.app"];function t9(t){var e=t==null?void 0:t.hostname;if(!$r(e))return!1;var r=e.split(".").slice(-2).join(".");for(var n of e9)if(r===n)return!1;return!0}function zA(t,e){for(var r=0;r<t.length;r++)if(e(t[r]))return t[r]}function Pr(t,e,r,n){var{capture:s=!1,passive:o=!0}=n??{};t==null||t.addEventListener(e,r,{capture:s,passive:o})}var UA="$people_distinct_id",hd="__alias",fd="__timers",CS="$autocapture_disabled_server_side",fw="$heatmaps_enabled_server_side",ES="$exception_capture_enabled_server_side",mw="$error_tracking_suppression_rules",PS="$error_tracking_capture_extension_exceptions",TS="$web_vitals_enabled_server_side",WA="$dead_clicks_enabled_server_side",AS="$product_tours_enabled_server_side",RS="$web_vitals_allowed_metrics",Ux="$session_recording_remote_config",$p="$sesid",HA="$session_is_sampled",uc="$enabled_feature_flags",md="$early_access_features",pw="$feature_flag_details",pd="$stored_person_properties",Ea="$stored_group_properties",gw="$surveys",Dp="$flag_call_reported",Ti="$user_state",vw="$client_session_props",xw="$capture_rate_limit",yw="$initial_campaign_params",bw="$initial_referrer_info",Fp="$initial_person_info",Lp="$epp",GA="__POSTHOG_TOOLBAR__",Gu="$posthog_cookieless",r9=[UA,hd,"__cmpns",fd,"$session_recording_enabled_server_side",fw,$p,uc,mw,Ti,md,pw,Ea,pd,gw,Dp,vw,xw,yw,bw,Lp,Fp,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function IS(t){return t instanceof Element&&(t.id===GA||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function Zg(t){return!!t&&t.nodeType===1}function Ko(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function qA(t){return!!t&&t.nodeType===3}function VA(t){return!!t&&t.nodeType===11}function D_(t){return t?Jg(t).split(/\s+/):[]}function OS(t){var e=ue==null?void 0:ue.location.href;return!!(e&&t&&t.some(r=>e.match(r)))}function Bp(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return D_(e)}function KA(t){return Tt(t)?null:Jg(t).split(/(\s+)/).filter(e=>kh(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Xh(t){var e="";return ww(t)&&!ZA(t)&&t.childNodes&&t.childNodes.length&&zt(t.childNodes,function(r){var n;qA(r)&&r.textContent&&(e+=(n=KA(r.textContent))!==null&&n!==void 0?n:"")}),Jg(e)}function YA(t){return Re(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var F_=["a","button","form","input","select","textarea","label"];function QA(t,e){if(Re(e))return!0;var r,n=function(o){if(e.some(a=>o.matches(a)))return{v:!0}};for(var s of t)if(r=n(s))return r.v;return!1}function JA(t){var e=t.parentNode;return!(!e||!Zg(e))&&e}var n9=["next","previous","prev",">","<"],MS=10,$S=[".ph-no-rageclick",".ph-no-capture"];function s9(t,e){if(!ue||L_(t))return!1;var r,n,s;if(zi(e)?(r=!!e&&$S,n=void 0):(r=(s=e==null?void 0:e.css_selector_ignorelist)!==null&&s!==void 0?s:$S,n=e==null?void 0:e.content_ignorelist),r===!1)return!1;var{targetElementList:o}=XA(t,!1);return!function(a,l){if(a===!1||Re(a))return!1;var c;if(a===!0)c=n9;else{if(!At(a))return!1;if(a.length>MS)return Le.error("[PostHog] content_ignorelist array cannot exceed "+MS+" items. Use css_selector_ignorelist for more complex matching."),!1;c=a.map(u=>u.toLowerCase())}return l.some(u=>{var{safeText:d,ariaLabel:h}=u;return c.some(m=>d.includes(m)||h.includes(m))})}(n,o.map(a=>{var l;return{safeText:Xh(a).toLowerCase(),ariaLabel:((l=a.getAttribute("aria-label"))==null?void 0:l.toLowerCase().trim())||""}}))&&!QA(o,r)}var L_=t=>!t||Ko(t,"html")||!Zg(t),XA=(t,e)=>{if(!ue||L_(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,n=[t],s=t;s.parentNode&&!Ko(s,"body");)if(VA(s.parentNode))n.push(s.parentNode.host),s=s.parentNode.host;else{var o=JA(s);if(!o)break;if(e||F_.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=ue.getComputedStyle(o);a&&a.getPropertyValue("cursor")==="pointer"&&(r=!0)}n.push(o),s=o}return{parentIsUsefulElement:r,targetElementList:n}};function i9(t,e,r,n,s){var o,a,l,c;if(r===void 0&&(r=void 0),!ue||L_(t)||(o=r)!=null&&o.url_allowlist&&!OS(r.url_allowlist)||(a=r)!=null&&a.url_ignorelist&&OS(r.url_ignorelist))return!1;if((l=r)!=null&&l.dom_event_allowlist){var u=r.dom_event_allowlist;if(u&&!u.some(v=>e.type===v))return!1}var{parentIsUsefulElement:d,targetElementList:h}=XA(t,n);if(!function(v,p){var b=p==null?void 0:p.element_allowlist;if(Re(b))return!0;var x,y=function(j){if(b.some(_=>j.tagName.toLowerCase()===_))return{v:!0}};for(var w of v)if(x=y(w))return x.v;return!1}(h,r)||!QA(h,(c=r)==null?void 0:c.css_selector_allowlist))return!1;var m=ue.getComputedStyle(t);if(m&&m.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var f=t.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return d?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(F_.indexOf(f)>-1||t.getAttribute("contenteditable")==="true")}}function ww(t){for(var e=t;e.parentNode&&!Ko(e,"body");e=e.parentNode){var r=Bp(e);if(gt(r,"ph-sensitive")||gt(r,"ph-no-capture"))return!1}if(gt(Bp(t),"ph-include"))return!0;var n=t.type||"";if($r(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!($r(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function ZA(t){return!!(Ko(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ko(t,"select")||Ko(t,"textarea")||t.getAttribute("contenteditable")==="true")}var eR="(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})",o9=new RegExp("^(?:"+eR+")$"),a9=new RegExp(eR),tR="\\d{3}-?\\d{2}-?\\d{4}",l9=new RegExp("^("+tR+")$"),c9=new RegExp("("+tR+")");function kh(t,e){return e===void 0&&(e=!0),!(Tt(t)||$r(t)&&(t=Jg(t),(e?o9:a9).test((t||"").replace(/[- ]/g,""))||(e?l9:c9).test(t)))}function rR(t){var e=Xh(t);return kh(e=(e+" "+nR(t)).trim())?e:""}function nR(t){var e="";return t&&t.childNodes&&t.childNodes.length&&zt(t.childNodes,function(r){var n;if(r&&((n=r.tagName)==null?void 0:n.toLowerCase())==="span")try{var s=Xh(r);e=(e+" "+s).trim(),r.childNodes&&r.childNodes.length&&(e=(e+" "+nR(r)).trim())}catch(o){Le.error("[AutoCapture]",o)}}),e}function u9(t){return function(e){var r=e.map(n=>{var s,o,a="";if(n.tag_name&&(a+=n.tag_name),n.attr_class)for(var l of(n.attr_class.sort(),n.attr_class))a+="."+l.replace(/"/g,"");var c=ze({},n.text?{text:n.text}:{},{"nth-child":(s=n.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(o=n.nth_of_type)!==null&&o!==void 0?o:0},n.href?{href:n.href}:{},n.attr_id?{attr_id:n.attr_id}:{},n.attributes),u={};return Dm(c).sort((d,h)=>{var[m]=d,[f]=h;return m.localeCompare(f)}).forEach(d=>{var[h,m]=d;return u[DS(h.toString())]=DS(m.toString())}),a+=":",a+=Dm(u).map(d=>{var[h,m]=d;return h+'="'+m+'"'}).join("")});return r.join(";")}(function(e){return e.map(r=>{var n,s,o={text:(n=r.$el_text)==null?void 0:n.slice(0,400),tag_name:r.tag_name,href:(s=r.attr__href)==null?void 0:s.slice(0,2048),attr_class:d9(r),attr_id:r.attr__id,nth_child:r.nth_child,nth_of_type:r.nth_of_type,attributes:{}};return Dm(r).filter(a=>{var[l]=a;return l.indexOf("attr__")===0}).forEach(a=>{var[l,c]=a;return o.attributes[l]=c}),o})}(t))}function DS(t){return t.replace(/"|\\"/g,'\\"')}function d9(t){var e=t.attr__class;return e?At(e)?e:D_(e):void 0}class sR{constructor(e){this.disabled=e===!1;var r=Hr(e)?e:{};this.thresholdPx=r.threshold_px||30,this.timeoutMs=r.timeout_ms||1e3,this.clickCount=r.click_count||3,this.clicks=[]}isRageClick(e,r,n){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(r-s.y)<this.thresholdPx&&n-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:r,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:r,timestamp:n}];return!1}}var Wx="$copy_autocapture",Oi=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),zp=t=>{var e=De==null?void 0:De.createElement("a");return Re(e)?null:(e.href=t,e)},h9=function(t,e){var r,n;e===void 0&&(e="&");var s=[];return zt(t,function(o,a){Re(o)||Re(a)||a==="undefined"||(r=encodeURIComponent((l=>l instanceof File)(o)?o.name:o.toString()),n=encodeURIComponent(a),s[s.length]=n+"="+r)}),s.join(e)},Up=function(t,e){for(var r,n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<n.length;s++){var o=n[s].split("=");if(o[0]===e){r=o;break}}if(!At(r)||r.length<2)return"";var a=r[1];try{a=decodeURIComponent(a)}catch{Le.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Zh=function(t,e,r){if(!t||!e||!e.length)return t;for(var n=t.split("#"),s=n[0]||"",o=n[1],a=s.split("?"),l=a[1],c=a[0],u=(l||"").split("&"),d=[],h=0;h<u.length;h++){var m=u[h].split("=");At(m)&&(e.includes(m[0])?d.push(m[0]+"="+r):d.push(u[h]))}var f=c;return l!=null&&(f+="?"+d.join("&")),o!=null&&(f+="#"+o),f},Wp=function(t,e){var r=t.match(new RegExp(e+"=([^&]*)"));return r?r[1]:null},FS=jr("[AutoCapture]");function Hx(t,e){return e.length>t?e.slice(0,t)+"...":e}function f9(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!Zg(e));return e}function m9(t,e,r,n){var s=t.tagName.toLowerCase(),o={tag_name:s};F_.indexOf(s)>-1&&!r&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?o.$el_text=Hx(1024,rR(t)):o.$el_text=Hx(1024,Xh(t)));var a=Bp(t);a.length>0&&(o.classes=a.filter(function(d){return d!==""})),zt(t.attributes,function(d){var h;if((!ZA(t)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(n==null||!n.includes(d.name))&&!e&&kh(d.value)&&(h=d.name,!$r(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var m=d.value;d.name==="class"&&(m=D_(m).join(" ")),o["attr__"+d.name]=Hx(1024,m)}});for(var l=1,c=1,u=t;u=f9(u);)l++,u.tagName===t.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}function p9(t,e){for(var r,n,{e:s,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=e,u=[t],d=t;d.parentNode&&!Ko(d,"body");)VA(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var h,m=[],f={},v=!1,p=!1;if(zt(u,j=>{var _=ww(j);j.tagName.toLowerCase()==="a"&&(v=j.getAttribute("href"),v=_&&v&&kh(v)&&v),gt(Bp(j),"ph-no-capture")&&(p=!0),m.push(m9(j,o,a,l));var S=function(N){if(!ww(N))return{};var P={};return zt(N.attributes,function(C){if(C.name&&C.name.indexOf("data-ph-capture-attribute")===0){var O=C.name.replace("data-ph-capture-attribute-",""),F=C.value;O&&F&&kh(F)&&(P[O]=F)}}),P}(j);vr(f,S)}),p)return{props:{},explicitNoCapture:p};if(a||(t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?m[0].$el_text=rR(t):m[0].$el_text=Xh(t)),v){var b,x;m[0].attr__href=v;var y=(b=zp(v))==null?void 0:b.host,w=ue==null||(x=ue.location)==null?void 0:x.host;y&&w&&y!==w&&(h=v)}return{props:vr({$event_type:s.type,$ce_version:1},c?{}:{$elements:m},{$elements_chain:u9(m)},(r=m[0])!=null&&r.$el_text?{$el_text:(n=m[0])==null?void 0:n.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},f)}}class g9{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new sR(e.config.rageclick),this.C=null}get R(){var e,r,n=Hr(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map(s=>new RegExp(s)),n.url_ignorelist=(r=n.url_ignorelist)==null?void 0:r.map(s=>new RegExp(s)),n}F(){if(this.isBrowserSupported()){if(ue&&De){var e=n=>{n=n||(ue==null?void 0:ue.event);try{this.M(n)}catch(s){FS.error("Failed to capture event",s)}};if(Pr(De,"submit",e,{capture:!0}),Pr(De,"change",e,{capture:!0}),Pr(De,"click",e,{capture:!0}),this.R.capture_copied_text){var r=n=>{n=n||(ue==null?void 0:ue.event),this.M(n,Wx)};Pr(De,"copy",r,{capture:!0}),Pr(De,"cut",r,{capture:!0})}}}else FS.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[CS]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var r,n=[];return(r=this.C)==null||r.forEach(s=>{var o=De==null?void 0:De.querySelectorAll(s);o==null||o.forEach(a=>{e===a&&n.push(s)})}),n}get isEnabled(){var e,r,n=(e=this.instance.persistence)==null?void 0:e.props[CS],s=this.T;if(Ys(s)&&!zi(n)&&!this.instance.O())return!1;var o=(r=this.T)!==null&&r!==void 0?r:!!n;return!!this.instance.config.autocapture&&!o}M(e,r){if(r===void 0&&(r="$autocapture"),this.isEnabled){var n,s=YA(e);qA(s)&&(s=s.parentNode||null),r==="$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())&&s9(s,this.instance.config.rageclick)&&this.M(e,"$rageclick");var o=r===Wx;if(s&&i9(s,e,this.R,o,o?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:l}=p9(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(l)return!1;var c=this.getElementSelectors(s);if(c&&c.length>0&&(a.$element_selectors=c),r===Wx){var u,d=KA(ue==null||(u=ue.getSelection())==null?void 0:u.toString()),h=e.type||"clipboard";if(!d)return!1;a.$selected_content=d,a.$copy_type=h}return this.instance.capture(r,a),!0}}}isBrowserSupported(){return qo(De==null?void 0:De.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return xi(t)&&isFinite(t)&&Math.floor(t)===t});var LS="0123456789abcdef";class Hp{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,n,s){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(s)||e<0||r<0||n<0||s<0||e>0xffffffffffff||r>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=e/Math.pow(2,40),o[1]=e/Math.pow(2,32),o[2]=e/Math.pow(2,24),o[3]=e/Math.pow(2,16),o[4]=e/Math.pow(2,8),o[5]=e,o[6]=112|r>>>8,o[7]=r,o[8]=128|n>>>24,o[9]=n>>>16,o[10]=n>>>8,o[11]=n,o[12]=s>>>24,o[13]=s>>>16,o[14]=s>>>8,o[15]=s,new Hp(o)}toString(){for(var e="",r=0;r<this.bytes.length;r++)e=e+LS.charAt(this.bytes[r]>>>4)+LS.charAt(15&this.bytes[r]),r!==3&&r!==5&&r!==7&&r!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Hp(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var r=0;r<16;r++){var n=this.bytes[r]-e.bytes[r];if(n!==0)return Math.sign(n)}return 0}}class v9{constructor(){this.A=0,this.D=0,this.j=new x9}generate(){var e=this.generateOrAbort();if(Re(e)){this.A=0;var r=this.generateOrAbort();if(Re(r))throw new Error("Could not generate UUID after timestamp reset");return r}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return Hp.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var BS,iR=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<t.length;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};ue&&!Re(ue.crypto)&&crypto.getRandomValues&&(iR=t=>crypto.getRandomValues(t));class x9{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(iR(this.N),this.U=0),this.N[this.U++]}}var $o=()=>y9().toString(),y9=()=>(BS||(BS=new v9)).generate(),qu="",b9=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function w9(t,e){if(e){var r=function(s,o){if(o===void 0&&(o=De),qu)return qu;if(!o||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),l=Math.min(a.length,8),c="dmn_chk_"+$o();!qu&&l--;){var u=a.slice(l).join("."),d=c+"=1;domain=."+u+";path=/";o.cookie=d+";max-age=3",o.cookie.includes(c)&&(o.cookie=d+";max-age=0",qu=u)}return qu}(t);if(!r){var n=(s=>{var o=s.match(b9);return o?o[0]:""})(t);n!==r&&Le.info("Warning: cookie subdomain discovery mismatch",n,r),r=n}return r?"; domain=."+r:""}return""}var pi={H:()=>!!De,B:function(t){Le.error("cookieStore error: "+t)},q:function(t){if(De){try{for(var e=t+"=",r=De.cookie.split(";").filter(o=>o.length),n=0;n<r.length;n++){for(var s=r[n];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},W:function(t){var e;try{e=JSON.parse(pi.q(t))||{}}catch{}return e},G:function(t,e,r,n,s){if(De)try{var o="",a="",l=w9(De.location.hostname,n);if(r){var c=new Date;c.setTime(c.getTime()+24*r*60*60*1e3),o="; expires="+c.toUTCString()}s&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&Le.warn("cookieStore warning: large cookie, len="+u.length),De.cookie=u,u}catch{return}},V:function(t,e){if(De!=null&&De.cookie)try{pi.G(t,"",-1,e)}catch{return}}},Gx=null,nr={H:function(){if(!Ys(Gx))return Gx;var t=!0;if(Re(ue))t=!1;else try{var e="__mplssupport__";nr.G(e,"xyz"),nr.q(e)!=='"xyz"'&&(t=!1),nr.V(e)}catch{t=!1}return t||Le.error("localStorage unsupported; falling back to cookie store"),Gx=t,t},B:function(t){Le.error("localStorage error: "+t)},q:function(t){try{return ue==null?void 0:ue.localStorage.getItem(t)}catch(e){nr.B(e)}return null},W:function(t){try{return JSON.parse(nr.q(t))||{}}catch{}return null},G:function(t,e){try{ue==null||ue.localStorage.setItem(t,JSON.stringify(e))}catch(r){nr.B(r)}},V:function(t){try{ue==null||ue.localStorage.removeItem(t)}catch(e){nr.B(e)}}},_9=["distinct_id",$p,HA,Lp,Fp],em=ze({},nr,{W:function(t){try{var e={};try{e=pi.W(t)||{}}catch{}var r=vr(e,JSON.parse(nr.q(t)||"{}"));return nr.G(t,r),r}catch{}return null},G:function(t,e,r,n,s,o){try{nr.G(t,e,void 0,void 0,o);var a={};_9.forEach(l=>{e[l]&&(a[l]=e[l])}),Object.keys(a).length&&pi.G(t,a,r,n,s,o)}catch(l){nr.B(l)}},V:function(t,e){try{ue==null||ue.localStorage.removeItem(t),pi.V(t,e)}catch(r){nr.B(r)}}}),tm={},j9={H:function(){return!0},B:function(t){Le.error("memoryStorage error: "+t)},q:function(t){return tm[t]||null},W:function(t){return tm[t]||null},G:function(t,e){tm[t]=e},V:function(t){delete tm[t]}},wa=null,Xr={H:function(){if(!Ys(wa))return wa;if(wa=!0,Re(ue))wa=!1;else try{var t="__support__";Xr.G(t,"xyz"),Xr.q(t)!=='"xyz"'&&(wa=!1),Xr.V(t)}catch{wa=!1}return wa},B:function(t){Le.error("sessionStorage error: ",t)},q:function(t){try{return ue==null?void 0:ue.sessionStorage.getItem(t)}catch(e){Xr.B(e)}return null},W:function(t){try{return JSON.parse(Xr.q(t))||null}catch{}return null},G:function(t,e){try{ue==null||ue.sessionStorage.setItem(t,JSON.stringify(e))}catch(r){Xr.B(r)}},V:function(t){try{ue==null||ue.sessionStorage.removeItem(t)}catch(e){Xr.B(e)}}},Ai=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class k9{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Ai.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===Ai.DENIED||this.consent===Ai.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ai.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:r,consent_persistence_name:n}=this._instance.config;return n||(r?r+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return Lx(e)?Ai.GRANTED:gt(x7,e)?Ai.DENIED:Ai.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?nr:pi;var r=e==="localStorage"?pi:nr;r.q(this.X)&&(this.Z.q(this.X)||this.optInOut(Lx(r.q(this.X))),r.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!zA([Zn==null?void 0:Zn.doNotTrack,Zn==null?void 0:Zn.msDoNotTrack,Ve.doNotTrack],e=>Lx(e))}}var rm=jr("[Dead Clicks]"),S9=()=>!0,N9=t=>{var e,r=!((e=t.instance.persistence)==null||!e.get_property(WA)),n=t.instance.config.capture_dead_clicks;return zi(n)?n:!!Hr(n)||r};class oR{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,r,n){this.instance=e,this.isEnabled=r,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[WA]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it(()=>{this.et()})}it(e){var r,n;(r=Ve.__PosthogExtensions__)!=null&&r.initDeadClicksAutocapture&&e(),(n=Ve.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",s=>{s?rm.error("failed to load script",s):e()})}et(){var e;if(De){if(!this.tt&&(e=Ve.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var r=Hr(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};r.__onCapture=this.onCapture,this.tt=Ve.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,r),this.tt.start(De),rm.info("starting...")}}else rm.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,rm.info("stopping..."))}}var Vu=jr("[ExceptionAutocapture]");class C9{constructor(e){var r,n,s;this.rt=()=>{var o;if(ue&&this.isEnabled&&(o=Ve.__PosthogExtensions__)!=null&&o.errorWrappingFunctions){var a=Ve.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,l=Ve.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=Ve.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=a(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=l(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=c(this.captureException.bind(this)))}catch(u){Vu.error("failed to start",u),this.ut()}}},this._instance=e,this.ht=!((r=this._instance.persistence)==null||!r.props[ES]),this.dt=new y7({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:Vu}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,r={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Hr(e)?r=ze({},r,e):(Re(e)?this.ht:e)&&(r=ze({},r,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),r}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Vu.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var r,n;(r=Ve.__PosthogExtensions__)!=null&&r.errorWrappingFunctions&&e(),(n=Ve.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",s=>{if(s)return Vu.error("failed to load script",s);e()})}ut(){var e,r,n;(e=this.st)==null||e.call(this),this.st=void 0,(r=this.nt)==null||r.call(this),this.nt=void 0,(n=this.ot)==null||n.call(this),this.ot=void 0}onRemoteConfig(e){var r=e.autocaptureExceptions;this.ht=!!r||!1,this._instance.persistence&&this._instance.persistence.register({[ES]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var r,n,s=(r=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&r!==void 0?r:"Exception";this.dt.consumeRateLimit(s)?Vu.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}}function zS(t,e,r){try{if(!(e in t))return()=>{};var n=t[e],s=r(n);return qo(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=n}}catch{return()=>{}}}class E9{constructor(e){var r;this._instance=e,this.ct=(ue==null||(r=ue.location)==null?void 0:r.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Le.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,Le.info("History API monitoring stopped")}monitorHistoryChanges(){var e,r;if(ue&&ue.history){var n=this;(e=ue.history.pushState)!=null&&e.__posthog_wrapped__||zS(ue.history,"pushState",s=>function(o,a,l){s.call(this,o,a,l),n._t("pushState")}),(r=ue.history.replaceState)!=null&&r.__posthog_wrapped__||zS(ue.history,"replaceState",s=>function(o,a,l){s.call(this,o,a,l),n._t("replaceState")}),this.bt()}}_t(e){try{var r,n=ue==null||(r=ue.location)==null?void 0:r.pathname;if(!n)return;n!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=n}catch(s){Le.error("Error capturing "+e+" pageview",s)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};Pr(ue,"popstate",e),this.ft=()=>{ue&&ue.removeEventListener("popstate",e)}}}}var qx=jr("[SegmentIntegration]");function P9(t,e){var r=t.config.segment;if(!r)return e();(function(n,s){var o=n.config.segment;if(!o)return s();var a=c=>{var u=()=>c.anonymousId()||$o();n.config.get_device_id=u,c.id()&&(n.register({distinct_id:c.id(),$device_id:u()}),n.persistence.set_property(Ti,"identified")),s()},l=o.user();"then"in l&&qo(l.then)?l.then(c=>a(c)):a(l)})(t,()=>{r.register((n=>{Promise&&Promise.resolve||qx.warn("This browser does not have Promise support, and can not use the segment integration");var s=(o,a)=>{if(!a)return o;o.event.userId||o.event.anonymousId===n.get_distinct_id()||(qx.info("No userId set, resetting PostHog"),n.reset()),o.event.userId&&o.event.userId!==n.get_distinct_id()&&(qx.info("UserId set, identifying with PostHog"),n.identify(o.event.userId));var l=n.calculateEventProperties(a,o.event.properties);return o.event.properties=Object.assign({},l,o.event.properties),o};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:o=>s(o,o.event.event),page:o=>s(o,"$pageview"),identify:o=>s(o,"$identify"),screen:o=>s(o,"$screen")}})(t)).then(()=>{e()})})}var aR="posthog-js";function lR(t,e){var{organization:r,projectId:n,prefix:s,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return l=>{var c,u,d,h,m;if(!(o==="*"||o.includes(l.level))||!t.__loaded)return l;l.tags||(l.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());l.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(l.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var v=((c=l.exception)==null?void 0:c.values)||[],p=v.map(x=>ze({},x,{stacktrace:x.stacktrace?ze({},x.stacktrace,{type:"raw",frames:(x.stacktrace.frames||[]).map(y=>ze({},y,{platform:"web:javascript"}))}):void 0})),b={$exception_message:((u=v[0])==null?void 0:u.value)||l.message,$exception_type:(d=v[0])==null?void 0:d.type,$exception_level:l.level,$exception_list:p,$sentry_event_id:l.event_id,$sentry_exception:l.exception,$sentry_exception_message:((h=v[0])==null?void 0:h.value)||l.message,$sentry_exception_type:(m=v[0])==null?void 0:m.type,$sentry_tags:l.tags};return r&&n&&(b.$sentry_url=(s||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+l.event_id),a&&t.exceptions.sendExceptionEvent(b),l}}class T9{constructor(e,r,n,s,o,a){this.name=aR,this.setupOnce=function(l){l(lR(e,{organization:r,projectId:n,prefix:s,severityAllowList:o,sendExceptionsToPostHog:a==null||a}))}}}var A9=ue!=null&&ue.location?Wp(ue.location.hash,"__posthog")||Wp(location.hash,"state"):null,US="_postHogToolbarParam
591s",WS=jr("[Toolbar]"),yo=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(yo||{});class R9{constructor(e){this.instance=e}yt(e){Ve.ph_toolbar_state=e}wt(){var e;return(e=Ve.ph_toolbar_state)!==null&&e!==void 0?e:yo.UNINITIALIZED}maybeLoadToolbar(e,r,n){if(e===void 0&&(e=void 0),r===void 0&&(r=void 0),n===void 0&&(n=void 0),!ue||!De)return!1;e=e??ue.location,n=n??ue.history;try{if(!r){try{ue.localStorage.setItem("test","test"),ue.localStorage.removeItem("test")}catch{return!1}r=ue==null?void 0:ue.localStorage}var s,o=A9||Wp(e.hash,"__posthog")||Wp(e.hash,"state"),a=o?NS(()=>JSON.parse(atob(decodeURIComponent(o))))||NS(()=>JSON.parse(decodeURIComponent(o))):null;return a&&a.action==="ph_authorize"?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(r.getItem(US)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}xt(e){var r=Ve.ph_load_toolbar||Ve.ph_load_editor;!Tt(r)&&qo(r)?r(e,this.instance):WS.warn("No toolbar load function found")}loadToolbar(e){var r=!(De==null||!De.getElementById(GA));if(!ue||r)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=ze({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(ue.localStorage.setItem(US,JSON.stringify(ze({},s,{source:void 0}))),this.wt()===yo.LOADED)this.xt(s);else if(this.wt()===yo.UNINITIALIZED){var o;this.yt(yo.LOADING),(o=Ve.__PosthogExtensions__)==null||o.loadExternalDependency==null||o.loadExternalDependency(this.instance,"toolbar",a=>{if(a)return WS.error("[Toolbar] Failed to load",a),void this.yt(yo.UNINITIALIZED);this.yt(yo.LOADED),this.xt(s)}),Pr(ue,"turbolinks:load",()=>{this.yt(yo.UNINITIALIZED),this.loadToolbar(s)})}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,r,n){return e===void 0&&(e=void 0),r===void 0&&(r=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,r,n)}}var I9=jr("[TracingHeaders]");class O9{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var r,n;Re(this.$t)&&((r=Ve.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Re(this.St)&&((n=Ve.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var r,n;(r=Ve.__PosthogExtensions__)!=null&&r.tracingHeadersPatchFns&&e(),(n=Ve.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",s=>{if(s)return I9.error("failed to load script",s);e()})}startIfEnabledOrStop(){var e,r;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.$t)==null||e.call(this),(r=this.St)==null||r.call(this),this.$t=void 0,this.St=void 0)}}var nm="https?://(.*)",yu=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],M9=xu(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],yu),ef="<masked>",$9=["li_fat_id"];function cR(t,e,r){if(!De)return{};var n,s=e?xu([],yu,r||[]):[],o=uR(Zh(De.URL,s,ef),t),a=(n={},zt($9,function(l){var c=pi.q(l);n[l]=c||null}),n);return vr(a,o)}function uR(t,e){var r=M9.concat(e||[]),n={};return zt(r,function(s){var o=Up(t,s);n[s]=o||null}),n}function dR(t){var e=function(o){return o?o.search(nm+"google.([^/?]*)")===0?"google":o.search(nm+"bing.com")===0?"bing":o.search(nm+"yahoo.com")===0?"yahoo":o.search(nm+"duckduckgo.com")===0?"duckduckgo":null:null}(t),r=e!="yahoo"?"q":"p",n={};if(!Ys(e)){n.$search_engine=e;var s=De?Up(De.referrer,r):"";s.length&&(n.ph_keyword=s)}return n}function HS(){return navigator.language||navigator.userLanguage}function hR(){return(De==null?void 0:De.referrer)||"$direct"}function fR(t,e){var r=t?xu([],yu,e||[]):[],n=In==null?void 0:In.href.substring(0,1e3);return{r:hR().substring(0,1e3),u:n?Zh(n,r,ef):void 0}}function mR(t){var e,{r,u:n}=t,s={$referrer:r,$referring_domain:r==null?void 0:r=="$direct"?"$direct":(e=zp(r))==null?void 0:e.host};
vendor: 82,986 bytes, lines 591-593
591if(n){s.$current_url=n;var o=zp(n);s.$host=o==null?void 0:o.host,s.$pathname=o==null?void 0:o.pathname;var a=uR(n);vr(s,a)}if(r){var l=dR(r);vr(s,l)}return s}function pR(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function D9(){try{return new Date().getTimezoneOffset()}catch{return}}function F9(t,e){if(!An)return{};var r,n,s,o=t?xu([],yu,e||[]):[],[a,l]=function(c){for(var u=0;u<wS.length;u++){var[d,h]=wS[u],m=d.exec(c),f=m&&(qo(h)?h(m,c):h);if(f)return f}return["",""]}(An);return vr($_({$os:a,$os_version:l,$browser:DA(An,navigator.vendor),$device:_S(An),$device_type:(n=An,s=_S(n),s===jA||s===_A||s==="Kobo"||s==="Kindle Fire"||s===$A?bh:s===_h||s===kc||s===jh||s===uw?"Console":s===SA?"Wearable":s?ms:"Desktop"),$timezone:pR(),$timezone_offset:D9()}),{$current_url:Zh(In==null?void 0:In.href,o,ef),$host:In==null?void 0:In.host,$pathname:In==null?void 0:In.pathname,$raw_user_agent:An.length>1e3?An.substring(0,997)+"...":An,$browser_version:P7(An,navigator.vendor),$browser_language:HS(),$browser_language_prefix:(r=HS(),typeof r=="string"?r.split("-")[0]:void 0),$screen_height:ue==null?void 0:ue.screen.height,$screen_width:ue==null?void 0:ue.screen.width,$viewport_height:ue==null?void 0:ue.innerHeight,$viewport_width:ue==null?void 0:ue.innerWidth,$lib:"web",$lib_version:Pi.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var mo=jr("[Web Vitals]"),GS=9e5;class L9{constructor(e){var r;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce((n,s)=>ze({},n,{["$web_vitals_"+s.name+"_event"]:ze({},s),["$web_vitals_"+s.name+"_value"]:s.value}),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=n=>{var s,o=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(Re(o))mo.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.Ct();Re(a)||(Tt(n==null?void 0:n.name)||Tt(n==null?void 0:n.value)?mo.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?mo.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==a&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),Re(this.N.url)&&(this.N.url=a),this.N.firstMetricTimestamp=Re(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.N.metrics.push(ze({},n,{$current_url:a,$session_id:o.sessionId,$window_id:o.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{var n,s,o,a,l=Ve.__PosthogExtensions__;Re(l)||Re(l.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:s,onFCP:o,onINP:a}=l.postHogWebVitalsCallbacks),n&&s&&o&&a?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&o(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this.It.bind(this)),this.P=!0):mo.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.kt=!((r=this._instance.persistence)==null||!r.props[TS]),this.startIfEnabled()}get allowedMetrics(){var e,r,n=Hr(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Re(n)?((r=this._instance.persistence)==null?void 0:r.props[RS])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Hr(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var e=Hr(this._instance.config.capture_performance)&&xi(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:GS;return 0<e&&e<=6e4?GS:e}get isEnabled(){var e=In==null?void 0:In.protocol;if(e!=="http:"&&e!=="https:")return mo.info("Web Vitals are disabled on non-http/https protocols"),!1;var r=Hr(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:zi(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return zi(r)?r:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(mo.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var r=Hr(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Hr(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[TS]:r}),this._instance.persistence.register({[RS]:n})),this.kt=r,this.startIfEnabled()}it(e){var r,n;(r=Ve.__PosthogExtensions__)!=null&&r.postHogWebVitalsCallbacks&&e(),(n=Ve.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"web-vitals",s=>{s?mo.error("failed to load script",s):e()})}Ct(){var e=ue?ue.location.href:void 0;if(e){var r=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties,s=r?xu([],yu,n||[]):[];return Zh(e,s,ef)}mo.error("Could not determine current URL")}}var B9=jr("[Heatmaps]");function qS(t){return Hr(t)&&"clientX"in t&&"clientY"in t&&xi(t.clientX)&&xi(t.clientY)}class z9{constructor(e){var r;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((r=this.instance.persistence)==null||!r.props[fw]),this.rageclicks=new sR(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return Hr(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Re(this.instance.config.capture_heatmaps)?Re(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;B9.info("starting..."),this.Mt(),this.Ot()}else{var e;clearInterval((e=this.Ft)!==null&&e!==void 0?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var r=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[fw]:r}),this.kt=r,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Dt(e){this.jt(e.originalEvent,"deadclick")}Ot(){this.Ft&&clearInterval(this.Ft),this.Ft=function(e){return(e==null?void 0:e.visibilityState)==="visible"}(De)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Mt(){ue&&De&&(this.Nt=this.Lt.bind(this),Pr(ue,"beforeunload",this.Nt),this.Ut=e=>this.jt(e||(ue==null?void 0:ue.event)),Pr(De,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||(ue==null?void 0:ue.event)),Pr(De,"mousemove",this.zt,{capture:!0}),this.Bt=new oR(this.instance,S9,this.Dt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Ot.bind(this),Pr(De,"visibilitychange",this.qt),this.P=!0)}At(){var e;ue&&De&&(this.Nt&&ue.removeEventListener("beforeunload",this.Nt),this.Ut&&De.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&De.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&De.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,r){var n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),a=function(l,c,u){for(var d=l;d&&Zg(d)&&!Ko(d,"body");){if(d===u)return!1;if(gt(c,ue==null?void 0:ue.getComputedStyle(d).position))return!0;d=JA(d)}return!1}(YA(e),["fixed","sticky"],o);return{x:e.clientX+(a?0:s),y:e.clientY+(a?0:n),target_fixed:a,type:r}}jt(e,r){var n;if(r===void 0&&(r="click"),!IS(e.target)&&qS(e)){var s=this.Gt(e,r);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(ze({},s,{type:"rageclick"})),this.Vt(s)}}Ht(e){!IS(e.target)&&qS(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout(()=>{this.Vt(this.Gt(e,"mousemove"))},500))}Vt(e){if(ue){var r=ue.location.href,n=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,o=n?xu([],yu,s||[]):[],a=Zh(r,o,ef);this.N=this.N||{},this.N[a]||(this.N[a]=[]),this.N[a].push(e)}}Lt(){this.N&&!cc(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class U9{constructor(e){this._instance=e}doPageView(e,r){var n,s=this.Jt(e,r);return this.Kt={pathname:(n=ue==null?void 0:ue.location.pathname)!==null&&n!==void 0?n:"",pageViewId:r,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var r;return this.Jt(e,(r=this.Kt)==null?void 0:r.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Kt)==null?void 0:e.pageViewId}}Jt(e,r){var n=this.Kt;if(!n)return{$pageview_id:r};var s={$pageview_id:r,$prev_pageview_id:n.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:l,maxScrollY:c,maxContentHeight:u,lastContentY:d,maxContentY:h}=o;if(!(Re(a)||Re(l)||Re(c)||Re(u)||Re(d)||Re(h))){a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d),h=Math.ceil(h);var m=a<=1?1:di(l/a,0,1,Le),f=a<=1?1:di(c/a,0,1,Le),v=u<=1?1:di(d/u,0,1,Le),p=u<=1?1:di(h/u,0,1,Le);s=vr(s,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:m,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:p})}}return n.pathname&&(s.$prev_pageview_pathname=n.pathname),n.timestamp&&(s.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),s}}var ps=Uint8Array,$n=Uint16Array,Zc=Uint32Array,B_=new ps([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]),z_=new ps([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]),VS=new ps([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gR=function(t,e){for(var r=new $n(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];var s=new Zc(r[30]);for(n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)s[o]=o-r[n]<<5|n;return[r,s]},vR=gR(B_,2),W9=vR[0],_w=vR[1];W9[28]=258,_w[258]=28;for(var KS=gR(z_,0)[1],xR=new $n(32768),Kt=0;Kt<32768;++Kt){var _a=(43690&Kt)>>>1|(21845&Kt)<<1;_a=(61680&(_a=(52428&_a)>>>2|(13107&_a)<<2))>>>4|(3855&_a)<<4,xR[Kt]=((65280&_a)>>>8|(255&_a)<<8)>>>1}var Md=function(t,e,r){for(var n=t.length,s=0,o=new $n(e);s<n;++s)++o[t[s]-1];var a,l=new $n(e);for(s=0;s<e;++s)l[s]=l[s-1]+o[s-1]<<1;for(a=new $n(n),s=0;s<n;++s)a[s]=xR[l[t[s]-1]++]>>>15-t[s];return a},sl=new ps(288);for(Kt=0;Kt<144;++Kt)sl[Kt]=8;for(Kt=144;Kt<256;++Kt)sl[Kt]=9;for(Kt=256;Kt<280;++Kt)sl[Kt]=7;for(Kt=280;Kt<288;++Kt)sl[Kt]=8;var Gp=new ps(32);for(Kt=0;Kt<32;++Kt)Gp[Kt]=5;var H9=Md(sl,9),G9=Md(Gp,5),yR=function(t){return(t/8>>0)+(7&t&&1)},bR=function(t,e,r){(r==null||r>t.length)&&(r=t.length);var n=new(t instanceof $n?$n:t instanceof Zc?Zc:ps)(r-e);return n.set(t.subarray(e,r)),n},Si=function(t,e,r){r<<=7&e;var n=e/8>>0;t[n]|=r,t[n+1]|=r>>>8},Ku=function(t,e,r){r<<=7&e;var n=e/8>>0;t[n]|=r,t[n+1]|=r>>>8,t[n+2]|=r>>>16},Vx=function(t,e){for(var r=[],n=0;n<t.length;++n)t[n]&&r.push({s:n,f:t[n]});var s=r.length,o=r.slice();if(!s)return[new ps(0),0];if(s==1){var a=new ps(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(_,S){return _.f-S.f}),r.push({s:-1,f:25001});var l=r[0],c=r[1],u=0,d=1,h=2;for(r[0]={s:-1,f:l.f+c.f,l,r:c};d!=s-1;)l=r[r[u].f<r[h].f?u++:h++],c=r[u!=d&&r[u].f<r[h].f?u++:h++],r[d++]={s:-1,f:l.f+c.f,l,r:c};var m=o[0].s;for(n=1;n<s;++n)o[n].s>m&&(m=o[n].s);var f=new $n(m+1),v=jw(r[d-1],f,0);if(v>e){n=0;var p=0,b=v-e,x=1<<b;for(o.sort(function(_,S){return f[S.s]-f[_.s]||_.f-S.f});n<s;++n){var y=o[n].s;if(!(f[y]>e))break;p+=x-(1<<v-f[y]),f[y]=e}for(p>>>=b;p>0;){var w=o[n].s;f[w]<e?p-=1<<e-f[w]++-1:++n}for(;n>=0&&p;--n){var j=o[n].s;f[j]==e&&(--f[j],++p)}v=e}return[new ps(f),v]},jw=function(t,e,r){return t.s==-1?Math.max(jw(t.l,e,r+1),jw(t.r,e,r+1)):e[t.s]=r},YS=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new $n(++e),n=0,s=t[0],o=1,a=function(c){r[n++]=c},l=1;l<=e;++l)if(t[l]==s&&l!=e)++o;else{if(!s&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(s),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(s);o=1,s=t[l]}return[r.subarray(0,n),e]},Yu=function(t,e){for(var r=0,n=0;n<e.length;++n)r+=t[n]*e[n];return r},kw=function(t,e,r){var n=r.length,s=yR(e+2);t[s]=255&n,t[s+1]=n>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var o=0;o<n;++o)t[s+o+4]=r[o];return 8*(s+4+n)},QS=function(t,e,r,n,s,o,a,l,c,u,d){Si(e,d++,r),++s[256];for(var h=Vx(s,15),m=h[0],f=h[1],v=Vx(o,15),p=v[0],b=v[1],x=YS(m),y=x[0],w=x[1],j=YS(p),_=j[0],S=j[1],N=new $n(19),P=0;P<y.length;++P)N[31&y[P]]++;for(P=0;P<_.length;++P)N[31&_[P]]++;for(var C=Vx(N,7),O=C[0],F=C[1],T=19;T>4&&!O[VS[T-1]];--T);var A,k,$,K,H=u+5<<3,W=Yu(s,sl)+Yu(o,Gp)+a,R=Yu(s,m)+Yu(o,p)+a+14+3*T+Yu(N,O)+(2*N[16]+3*N[17]+7*N[18]);if(H<=W&&H<=R)return kw(e,d,t.subarray(c,c+u));if(Si(e,d,1+(R<W)),d+=2,R<W){A=Md(m,f),k=m,$=Md(p,b),K=p;var G=Md(O,F);for(Si(e,d,w-257),Si(e,d+5,S-1),Si(e,d+10,T-4),d+=14,P=0;P<T;++P)Si(e,d+3*P,O[VS[P]]);d+=3*T;for(var U=[y,_],z=0;z<2;++z){var oe=U[z];for(P=0;P<oe.length;++P){var L=31&oe[P];Si(e,d,G[L]),d+=O[L],L>15&&(Si(e,d,oe[P]>>>5&127),d+=oe[P]>>>12)}}}else A=H9,k=sl,$=G9,K=Gp;for(P=0;P<l;++P)if(n[P]>255){L=n[P]>>>18&31,Ku(e,d,A[L+257]),d+=k[L+257],L>7&&(Si(e,d,n[P]>>>23&31),d+=B_[L]);var q=31&n[P];Ku(e,d,$[q]),d+=K[q],q>3&&(Ku(e,d,n[P]>>>5&8191),d+=z_[q])}else Ku(e,d,A[n[P]]),d+=k[n[P]];return Ku(e,d,A[256]),d+k[256]},q9=new Zc([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),V9=function(){for(var t=new Zc(256),e=0;e<256;++e){for(var r=e,n=9;--n;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),K9=function(t,e,r,n,s){return function(o,a,l,c,u,d){var h=o.length,m=new ps(c+h+5*(1+Math.floor(h/7e3))+u),f=m.subarray(c,m.length-u),v=0;if(!a||h<8)for(var p=0;p<=h;p+=65535){var b=p+65535;b<h?v=kw(f,v,o.subarray(p,b)):(f[p]=d,v=kw(f,v,o.subarray(p,h)))}else{for(var x=q9[a-1],y=x>>>13,w=8191&x,j=(1<<l)-1,_=new $n(32768),S=new $n(j+1),N=Math.ceil(l/3),P=2*N,C=function(D){return(o[D]^o[D+1]<<N^o[D+2]<<P)&j},O=new Zc(25e3),F=new $n(288),T=new $n(32),A=0,k=0,$=(p=0,0),K=0,H=0;p<h;++p){var W=C(p),R=32767&p,G=S[W];if(_[R]=G,S[W]=R,K<=p){var U=h-p;if((A>7e3||$>24576)&&U>423){v=QS(o,f,0,O,F,T,k,$,H,p-H,v),$=A=k=0,H=p;for(var z=0;z<286;++z)F[z]=0;for(z=0;z<30;++z)T[z]=0}var oe=2,L=0,q=w,he=R-G&32767;if(U>2&&W==C(p-he))for(var X=Math.min(y,U)-1,J=Math.min(32767,p),de=Math.min(258,U);he<=J&&--q&&R!=G;){if(o[p+oe]==o[p+oe-he]){for(var le=0;le<de&&o[p+le]==o[p+le-he];++le);if(le>oe){if(oe=le,L=he,le>X)break;var fe=Math.min(he,le-2),Z=0;for(z=0;z<fe;++z){var ae=p-he+z+32768&32767,E=ae-_[ae]+32768&32767;E>Z&&(Z=E,G=ae)}}}he+=(R=G)-(G=_[R])+32768&32767}if(L){O[$++]=268435456|_w[oe]<<18|KS[L];var ne=31&_w[oe],te=31&KS[L];k+=B_[ne]+z_[te],++F[257+ne],++T[te],K=p+oe,++A}else O[$++]=o[p],++F[o[p]]}}v=QS(o,f,d,O,F,T,k,$,H,p-H,v)}return bR(m,0,c+yR(v)+u)}(t,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,r,n,!0)},Kx=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8};function Y9(t,e){e===void 0&&(e={});var r=function(){var l=4294967295;return{p:function(c){for(var u=l,d=0;d<c.length;++d)u=V9[255&u^c[d]]^u>>>8;l=u},d:function(){return 4294967295^l}}}(),n=t.length;r.p(t);var s,o=K9(t,e,10+((s=e).filename&&s.filename.length+1||0),8),a=o.length;return function(l,c){var u=c.filename;if(l[0]=31,l[1]=139,l[2]=8,l[8]=c.level<2?4:c.level==9?2:0,l[9]=3,c.mtime!=0&&Kx(l,4,Math.floor(new Date(c.mtime||Date.now())/1e3)),u){l[3]=8;for(var d=0;d<=u.length;++d)l[d+10]=u.charCodeAt(d)}}(o,e),Kx(o,a-8,r.d()),Kx(o,a-4,n),o}var Q9=function(t){var e,r,n,s,o="";for(e=r=0,n=(t=(t+"").replace(/\r\n/g,`
592`).replace(/\r/g,`
593`)).length,s=0;s<n;s++){var a=t.charCodeAt(s),l=null;a<128?r++:l=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),Ys(l)||(r>e&&(o+=t.substring(e,r)),o+=l,e=r=s+1)}return r>e&&(o+=t.substring(e,t.length)),o},J9=!!iw||!!sw,JS="text/plain",qp=function(t,e,r){var n;r===void 0&&(r=!0);var[s,o]=t.split("?"),a=ze({},e),l=(n=o==null?void 0:o.split("&").map(u=>{var d,[h,m]=u.split("="),f=r&&(d=a[h])!==null&&d!==void 0?d:m;return delete a[h],h+"="+f}))!==null&&n!==void 0?n:[],c=h9(a);return c&&l.push(c),s+"?"+l.join("&")},gd=(t,e)=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString():n,e),Yx=t=>{var{data:e,compression:r}=t;if(e){if(r===Oi.GZipJS){var n=Y9(function(c,u){var d=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var h=new ps(c.length+(c.length>>>1)),m=0,f=function(x){h[m++]=x},v=0;v<d;++v){if(m+5>h.length){var p=new ps(m+8+(d-v<<1));p.set(h),h=p}var b=c.charCodeAt(v);b<128||u?f(b):b<2048?(f(192|b>>>6),f(128|63&b)):b>55295&&b<57344?(f(240|(b=65536+(1047552&b)|1023&c.charCodeAt(++v))>>>18),f(128|b>>>12&63),f(128|b>>>6&63),f(128|63&b)):(f(224|b>>>12),f(128|b>>>6&63),f(128|63&b))}return bR(h,0,m)}(gd(e)),{mtime:0}),s=new Blob([n],{type:JS});return{contentType:JS,body:s,estimatedSize:s.size}}if(r===Oi.Base64){var o=function(c){var u,d,h,m,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=0,b=0,x="",y=[];if(!c)return c;c=Q9(c);do u=(f=c.charCodeAt(p++)<<16|c.charCodeAt(p++)<<8|c.charCodeAt(p++))>>18&63,d=f>>12&63,h=f>>6&63,m=63&f,y[b++]=v.charAt(u)+v.charAt(d)+v.charAt(h)+v.charAt(m);while(p<c.length);switch(x=y.join(""),c.length%3){case 1:x=x.slice(0,-2)+"==";break;case 2:x=x.slice(0,-1)+"="}return x}(gd(e)),a=(c=>"data="+encodeURIComponent(typeof c=="string"?c:gd(c)))(o);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var l=gd(e);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},Fm=[];sw&&Fm.push({transport:"fetch",method:t=>{var e,r,{contentType:n,body:s,estimatedSize:o}=(e=Yx(t))!==null&&e!==void 0?e:{},a=new Headers;zt(t.headers,function(d,h){a.append(h,d)}),n&&a.append("Content-Type",n);var l=t.url,c=null;if(pS){var u=new pS;c={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}sw(l,ze({method:(t==null?void 0:t.method)||"GET",headers:a,keepalive:t.method==="POST"&&(o||0)<52428.8,body:s,signal:(r=c)==null?void 0:r.signal},t.fetchOptions)).then(d=>d.text().then(h=>{var m={statusCode:d.status,text:h};if(d.status===200)try{m.json=JSON.parse(h)}catch(f){Le.error(f)}t.callback==null||t.callback(m)})).catch(d=>{Le.error(d),t.callback==null||t.callback({statusCode:0,text:d})}).finally(()=>c?clearTimeout(c.timeout):null)}}),iw&&Fm.push({transport:"XHR",method:t=>{var e,r=new iw;r.open(t.method||"GET",t.url,!0);var{contentType:n,body:s}=(e=Yx(t))!==null&&e!==void 0?e:{};zt(t.headers,function(o,a){r.setRequestHeader(a,o)}),n&&r.setRequestHeader("Content-Type",n),t.timeout&&(r.timeout=t.timeout),t.disableXHRCredentials||(r.withCredentials=!0),r.onreadystatechange=()=>{if(r.readyState===4){var o={statusCode:r.status,text:r.responseText};if(r.status===200)try{o.json=JSON.parse(r.responseText)}catch{}t.callback==null||t.callback(o)}},r.send(s)}}),Zn!=null&&Zn.sendBeacon&&Fm.push({transport:"sendBeacon",method:t=>{var e=qp(t.url,{beacon:"1"});try{var r,{contentType:n,body:s}=(r=Yx(t))!==null&&r!==void 0?r:{},o=typeof s=="string"?new Blob([s],{type:n}):s;Zn.sendBeacon(e,o)}catch{}}});var Vp=function(t,e){if(!function(r){try{new RegExp(r)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function XS(t,e,r){return gd({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:r})}var wR={exact:(t,e)=>e.some(r=>t.some(n=>r===n)),is_not:(t,e)=>e.every(r=>t.every(n=>r!==n)),regex:(t,e)=>e.some(r=>t.some(n=>Vp(r,n))),not_regex:(t,e)=>e.every(r=>t.every(n=>!Vp(r,n))),icontains:(t,e)=>e.map(sm).some(r=>t.map(sm).some(n=>r.includes(n))),not_icontains:(t,e)=>e.map(sm).every(r=>t.map(sm).every(n=>!r.includes(n))),gt:(t,e)=>e.some(r=>{var n=parseFloat(r);return!isNaN(n)&&t.some(s=>n>parseFloat(s))}),lt:(t,e)=>e.some(r=>{var n=parseFloat(r);return!isNaN(n)&&t.some(s=>n<parseFloat(s))})},sm=t=>t.toLowerCase();function _R(t,e){return!t||Object.entries(t).every(r=>{var[n,s]=r,o=e==null?void 0:e[n];if(Re(o)||Ys(o))return!1;var a=[String(o)],l=wR[s.operator];return!!l&&l(s.values,a)})}var Qx=jr("[Error tracking]");class X9{constructor(e){var r,n;this.Yt=[],this.Xt=new R7([new z7,new Q7,new W7,new U7,new K7,new V7,new G7,new Y7],B7("web:javascript",$7,L7)),this._instance=e,this.Yt=(r=(n=this._instance.persistence)==null?void 0:n.get_property(mw))!==null&&r!==void 0?r:[]}onRemoteConfig(e){var r,n,s,o=(r=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&r!==void 0?r:[],a=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Yt=o,this._instance.persistence&&this._instance.persistence.register({[mw]:this.Yt,[PS]:a})}get Qt(){var e,r=!!this._instance.get_property(PS),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??r)!==null&&e!==void 0&&e}buildProperties(e,r){return this.Xt.buildFromUnknown(e,{syntheticException:r==null?void 0:r.syntheticException,mechanism:{handled:r==null?void 0:r.handled}})}sendExceptionEvent(e){var r=e.$exception_list;if(this.Zt(r)){if(this.ti(r))return void Qx.info("Skipping exception capture because a suppression rule matched");if(!this.Qt&&this.ii(r))return void Qx.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ei(r))return void Qx.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ti(e){if(e.length===0)return!1;var r=e.reduce((n,s)=>{var{type:o,value:a}=s;return $r(o)&&o.length>0&&n.$exception_types.push(o),$r(a)&&a.length>0&&n.$exception_values.push(a),n},{$exception_types:[],$exception_values:[]});return this.Yt.some(n=>{var s=n.values.map(o=>{var a,l=wR[o.operator],c=At(o.value)?o.value:[o.value],u=(a=r[o.key])!==null&&a!==void 0?a:[];return c.length>0&&l(c,u)});return n.type==="OR"?s.some(Boolean):s.every(Boolean)})}ii(e){return e.flatMap(r=>{var n,s;return(n=(s=r.stacktrace)==null?void 0:s.frames)!==null&&n!==void 0?n:[]}).some(r=>r.filename&&r.filename.startsWith("chrome-extension://"))}ei(e){if(e.length>0){var r,n,s,o,a=(r=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&r!==void 0?r:[],l=a[a.length-1];return(s=l==null||(o=l.filename)==null?void 0:o.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Zt(e){return!Tt(e)&&At(e)}}var Ps=jr("[FeatureFlags]"),Qu=jr("[FeatureFlags]",{debugEnabled:!0}),Jx="$active_feature_flags",$l="$override_feature_flags",ZS="$feature_flag_payloads",Ju="$override_feature_flag_payloads",eN="$feature_flag_request_id",tN="$feature_flag_evaluated_at",rN=t=>{var e={};for(var[r,n]of Dm(t||{}))n&&(e[r]=n);return e},Z9=t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map(r=>{var n;return[r,(n=e[r].variant)!==null&&n!==void 0?n:e[r].enabled]})),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(r=>e[r].enabled).filter(r=>{var n;return(n=e[r].metadata)==null?void 0:n.payload}).map(r=>{var n;return[r,(n=e[r].metadata)==null?void 0:n.payload]}))):Ps.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},eG=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class tG{constructor(e){this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this._instance=e,this.featureFlagEventHandlers=[]}hi(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter(r=>{var n=r&&typeof r=="string"&&r.trim().length>0;return n||Ps.error("Invalid evaluation environment found:",r,"Expected non-empty string"),n}):[]}di(){return this.hi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.li=!0;else{var e=!this.vi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.ci({disableFlags:e})}}get hasLoadedFlags(){return this.si}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(pw),r=this._instance.get_property($l),n=this._instance.get_property(Ju);if(!n&&!r)return e||{};var s=vr({},e||{}),o=[...new Set([...Object.keys(n||{}),...Object.keys(r||{})])];for(var a of o){var l,c,u=s[a],d=r==null?void 0:r[a],h=Re(d)?(l=u==null?void 0:u.enabled)!==null&&l!==void 0&&l:!!d,m=Re(d)?u.variant:typeof d=="string"?d:void 0,f=n==null?void 0:n[a],v=ze({},u,{enabled:h,variant:h?m??(u==null?void 0:u.variant):void 0});h!==(u==null?void 0:u.enabled)&&(v.original_enabled=u==null?void 0:u.enabled),m!==(u==null?void 0:u.variant)&&(v.original_variant=u==null?void 0:u.variant),f&&(v.metadata=ze({},u==null?void 0:u.metadata,{payload:f,original_payload:u==null||(c=u.metadata)==null?void 0:c.payload})),s[a]=v}return this.ri||(Ps.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:s}),this.ri=!0),s}getFlagVariants(){var e=this._instance.get_property(uc),r=this._instance.get_property($l);if(!r)return e||{};for(var n=vr({},e),s=Object.keys(r),o=0;o<s.length;o++)n[s[o]]=r[s[o]];return this.ri||(Ps.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:r,finalFlags:n}),this.ri=!0),n}getFlagPayloads(){var e=this._instance.get_property(ZS),r=this._instance.get_property(Ju);if(!r)return e||{};for(var n=vr({},e||{}),s=Object.keys(r),o=0;o<s.length;o++)n[s[o]]=r[s[o]];return this.ri||(Ps.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:r,finalPayloads:n}),this.ri=!0),n}reloadFeatureFlags(){this.oi||this._instance.config.advanced_disable_feature_flags||this.vi||(this.vi=setTimeout(()=>{this.ci()},5))}fi(){clearTimeout(this.vi),this.vi=void 0}ensureFlagsLoaded(){this.si||this.ni||this.vi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.oi=e}ci(e){var r;if(this.fi(),!this._instance.O())if(this.ni)this.ai=!0;else{var n=this._instance.config.token,s=this._instance.get_property("$device_id"),o={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ze({},((r=this._instance.persistence)==null?void 0:r.get_initial_props())||{},this._instance.get_property(pd)||{}),group_properties:this._instance.get_property(Ea)};Ys(s)||Re(s)||(o.$device_id=s),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(o.disable_flags=!0),this.di()&&(o.evaluation_environments=this.hi());var a=this._instance.config.__preview_remote_config,l=a?"/flags/?v=2":"/flags/?v=2&config=true",c=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",u=this._instance.requestRouter.endpointFor("flags",l+c);a&&(o.timezone=pR()),this.ni=!0,this._instance._send_request({method:"POST",url:u,data:o,compression:this._instance.config.disable_compression?void 0:Oi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:d=>{var h,m,f=!0;if(d.statusCode===200&&(this.ai||(this.$anon_distinct_id=void 0),f=!1),this.ni=!1,this.li||(this.li=!0,this._instance.pi((m=d.json)!==null&&m!==void 0?m:{})),!o.disable_flags||this.ai)if(this.ui=!f,d.json&&(h=d.json.quotaLimited)!=null&&h.includes(eG.FeatureFlags))Ps.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.");else{var v;o.disable_flags||this.receivedFeatureFlags((v=d.json)!==null&&v!==void 0?v:{},f),this.ai&&(this.ai=!1,this.ci())}}})}}getFeatureFlag(e,r){if(r===void 0&&(r={}),this.si||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants()[e],s=""+n,o=this._instance.get_property(eN)||void 0,a=this._instance.get_property(tN)||void 0,l=this._instance.get_property(Dp)||{};if((r.send_event||!("send_event"in r))&&(!(e in l)||!l[e].includes(s))){var c,u,d,h,m,f,v,p,b;At(l[e])?l[e].push(s):l[e]=[s],(c=this._instance.persistence)==null||c.register({[Dp]:l});var x=this.getFeatureFlagDetails(e),y={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:((u=this._instance.config.bootstrap)==null||(u=u.featureFlags)==null?void 0:u[e])||null,$feature_flag_bootstrapped_payload:((d=this._instance.config.bootstrap)==null||(d=d.featureFlagPayloads)==null?void 0:d[e])||null,$used_bootstrap_value:!this.ui};Re(x==null||(h=x.metadata)==null?void 0:h.version)||(y.$feature_flag_version=x.metadata.version);var w,j=(m=x==null||(f=x.reason)==null?void 0:f.description)!==null&&m!==void 0?m:x==null||(v=x.reason)==null?void 0:v.code;j&&(y.$feature_flag_reason=j),x!=null&&(p=x.metadata)!=null&&p.id&&(y.$feature_flag_id=x.metadata.id),Re(x==null?void 0:x.original_variant)&&Re(x==null?void 0:x.original_enabled)||(y.$feature_flag_original_response=Re(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&(b=x.metadata)!=null&&b.original_payload&&(y.$feature_flag_original_payload=x==null||(w=x.metadata)==null?void 0:w.original_payload),this._instance.capture("$feature_flag_called",y)}return n}Ps.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,r){var n=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:n};this.di()&&(s.evaluation_environments=this.hi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:Oi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:o=>{var a,l=(a=o.json)==null?void 0:a.featureFlagPayloads;r((l==null?void 0:l[e])||void 0)}})}isFeatureEnabled(e,r){if(r===void 0&&(r={}),this.si||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,r);return Re(n)?void 0:!!n}Ps.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(r=>r!==e)}receivedFeatureFlags(e,r){if(this._instance.persistence){this.si=!0;var n=this.getFlagVariants(),s=this.getFlagPayloads(),o=this.getFlagsWithDetails();(function(a,l,c,u,d){c===void 0&&(c={}),u===void 0&&(u={}),d===void 0&&(d={});var h=Z9(a),m=h.flags,f=h.featureFlags,v=h.featureFlagPayloads;if(f){var p=a.requestId,b=a.evaluatedAt;if(At(f)){Ps.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var x={};if(f)for(var y=0;y<f.length;y++)x[f[y]]=!0;l&&l.register({[Jx]:f,[uc]:x})}else{var w=f,j=v,_=m;a.errorsWhileComputingFlags&&(w=ze({},c,w),j=ze({},u,j),_=ze({},d,_)),l&&l.register(ze({[Jx]:Object.keys(rN(w)),[uc]:w||{},[ZS]:j||{},[pw]:_||{}},p?{[eN]:p}:{},b?{[tN]:b}:{}))}}})(e,this._instance.persistence,n,s,o),this.gi(r)}}override(e,r){r===void 0&&(r=!1),Ps.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:r})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Ps.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister($l),this._instance.persistence.unregister(Ju),this.gi(),Qu.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var r,n=e;if(this.ri=!!((r=n.suppressWarning)!==null&&r!==void 0&&r),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister($l),Qu.info("Flag overrides cleared");else if(n.flags){if(At(n.flags)){for(var s={},o=0;o<n.flags.length;o++)s[n.flags[o]]=!0;this._instance.persistence.register({[$l]:s})}else this._instance.persistence.register({[$l]:n.flags});Qu.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(Ju),Qu.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[Ju]:n.payloads}),Qu.info("Payload overrides set",{payloads:n.payloads}))),void this.gi()}this.gi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.si){var{flags:r,flagVariants:n}=this.mi();e(r,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,r,n){var s,o=(this._instance.get_property(md)||[]).find(u=>u.flagKey===e),a={["$feature_enrollment/"+e]:r},l={$feature_flag:e,$feature_enrollment:r,$set:a};o&&(l.$early_access_feature_name=o.name),n&&(l.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",l),this.setPersonPropertiesForFlags(a,!1);var c=ze({},this.getFlagVariants(),{[e]:r});(s=this._instance.persistence)==null||s.register({[Jx]:Object.keys(rN(c)),[uc]:c}),this.gi()}getEarlyAccessFeatures(e,r,n){r===void 0&&(r=!1);var s=this._instance.get_property(md),o=n?"&"+n.map(a=>"stage="+a).join("&"):"";if(s&&!r)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+o),method:"GET",callback:a=>{var l,c;if(a.json){var u=a.json.earlyAccessFeatures;return(l=this._instance.persistence)==null||l.unregister(md),(c=this._instance.persistence)==null||c.register({[md]:u}),e(u)}}})}mi(){var e=this.getFlags(),r=this.getFlagVariants();return{flags:e.filter(n=>r[n]),flagVariants:Object.keys(r).filter(n=>r[n]).reduce((n,s)=>(n[s]=r[s],n),{})}}gi(e){var{flags:r,flagVariants:n}=this.mi();this.featureFlagEventHandlers.forEach(s=>s(r,n,{errorsLoading:e}))}setPersonPropertiesForFlags(e,r){r===void 0&&(r=!0);var n=this._instance.get_property(pd)||{};this._instance.register({[pd]:ze({},n,e)}),r&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(pd)}setGroupPropertiesForFlags(e,r){r===void 0&&(r=!0);var n=this._instance.get_property(Ea)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(s=>{n[s]=ze({},n[s],e[s]),delete e[s]}),this._instance.register({[Ea]:ze({},n,e)}),r&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var r=this._instance.get_property(Ea)||{};this._instance.register({[Ea]:ze({},r,{[e]:{}})})}else this._instance.unregister(Ea)}reset(){this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.$anon_distinct_id=void 0,this.fi(),this.ri=!1}}var rG=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Xx{constructor(e,r){this.R=e,this.props={},this.bi=!1,this.yi=(n=>{var s="";return n.token&&(s=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+s+"_posthog"})(e),this.Y=this.wi(e),this.load(),e.debug&&Le.info("Persistence loaded",e.persistence,ze({},this.props)),this.update_config(e,e,r),this.save()}isDisabled(){return!!this.xi}wi(e){rG.indexOf(e.persistence.toLowerCase())===-1&&(Le.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var r=e.persistence.toLowerCase();return r==="localstorage"&&nr.H()?nr:r==="localstorage+cookie"&&em.H()?em:r==="sessionstorage"&&Xr.H()?Xr:r==="memory"?j9:r==="cookie"?pi:em.H()?em:pi}properties(){var e={};return zt(this.props,function(r,n){if(n===uc&&Hr(r))for(var s=Object.keys(r),o=0;o<s.length;o++)e["$feature/"+s[o]]=r[s[o]];else l=n,c=!1,(Ys(a=r9)?c:mS&&a.indexOf===mS?a.indexOf(l)!=-1:(zt(a,function(u){if(c||(c=u===l))return Mp}),c))||(e[n]=r);var a,l,c}),e}load(){if(!this.xi){var e=this.Y.W(this.yi);e&&(this.props=vr({},e))}}save(){this.xi||this.Y.G(this.yi,this.props,this.Ei,this.$i,this.Si,this.R.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(e,r,n){if(Hr(e)){Re(r)&&(r="None"),this.Ei=Re(n)?this.ki:n;var s=!1;if(zt(e,(o,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==r||(this.props[a]=o,s=!0)}),s)return this.save(),!0}return!1}register(e,r){if(Hr(e)){this.Ei=Re(r)?this.ki:r;var n=!1;if(zt(e,(s,o)=>{e.hasOwnProperty(o)&&this.props[o]!==s&&(this.props[o]=s,n=!0)}),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.bi){var e=cR(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);cc($_(e))||this.register(e),this.bi=!0}}update_search_keyword(){var e;this.register((e=De==null?void 0:De.referrer)?dR(e):{})}update_referrer_info(){var e;this.register_once({$referrer:hR(),$referring_domain:De!=null&&De.referrer&&((e=zp(De.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[yw]||this.props[bw]||this.register_once({[Fp]:fR(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};zt([bw,yw],a=>{var l=this.props[a];l&&zt(l,function(c,u){e["$initial_"+ow(u)]=c})});var r,n,s=this.props[Fp];if(s){var o=(r=mR(s),n={},zt(r,function(a,l){n["$initial_"+ow(l)]=a}),n);vr(e,o)}return e}safe_merge(e){return zt(this.props,function(r,n){n in e||(e[n]=r)}),e}update_config(e,r,n){if(this.ki=this.Ei=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==r.persistence){var s=this.wi(e),o=this.props;this.clear(),this.Y=s,this.props=o,this.save()}}set_disabled(e){this.xi=e,this.xi?this.remove():this.save()}set_cross_subdomain(e){e!==this.$i&&(this.$i=e,this.remove(),this.save())}set_secure(e){e!==this.Si&&(this.Si=e,this.remove(),this.save())}set_event_timer(e,r){var n=this.props[fd]||{};n[e]=r,this.props[fd]=n,this.save()}remove_event_timer(e){var r=(this.props[fd]||{})[e];return Re(r)||(delete this.props[fd][e],this.save()),r}get_property(e){return this.props[e]}set_property(e,r){this.props[e]=r,this.save()}}var nN=jr("[Product Tours]"),Zx="ph_product_tours";class nG{constructor(e){this.Pi=null,this.Ti=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[AS]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,r;this.Pi||(e=this._instance).config.disable_product_tours||(r=e.persistence)==null||!r.get_property(AS)||this.it(()=>this.Ii())}it(e){var r,n;(r=Ve.__PosthogExtensions__)!=null&&r.generateProductTours?e():(n=Ve.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",s=>{s?nN.error("Could not load product tours script",s):e()})}Ii(){var e;!this.Pi&&(e=Ve.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Pi=Ve.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,r){if(r===void 0&&(r=!1),!At(this.Ti)||r){var n=this._instance.persistence;if(n){var s=n.props[Zx];if(At(s)&&!r)return this.Ti=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:o=>{var a=o.statusCode;if(a!==200||!o.json){var l="Product Tours API could not be loaded, status: "+a;return nN.error(l),void e([],{isLoaded:!1,error:l})}var c=At(o.json.product_tours)?o.json.product_tours:[];this.Ti=c,n&&n.register({[Zx]:c}),e(c,{isLoaded:!0})}})}else e(this.Ti,{isLoaded:!0})}getActiveProductTours(e){Tt(this.Pi)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Pi.getActiveProductTours(e)}showProductTour(e){var r;(r=this.Pi)==null||r.showTourById(e)}previewTour(e){this.Pi?this.Pi.previewTour(e):this.it(()=>{var r;this.Ii(),(r=this.Pi)==null||r.previewTour(e)})}dismissProductTour(){var e;(e=this.Pi)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Pi)==null||e.nextStep()}previousStep(){var e;(e=this.Pi)==null||e.previousStep()}clearCache(){var e;this.Ti=null,(e=this._instance.persistence)==null||e.unregister(Zx)}resetTour(e){var r;(r=this.Pi)==null||r.resetTour(e)}resetAllTours(){var e;(e=this.Pi)==null||e.resetAllTours()}cancelPendingTour(e){var r;(r=this.Pi)==null||r.cancelPendingTour(e)}}var Xu=function(t){return t.Activation="events",t.Cancellation="cancelEvents",t}({});(function(t){return t.Button="button",t.Tab="tab",t.Selector="selector",t})({});(function(t){return t.TopLeft="top_left",t.TopRight="top_right",t.TopCenter="top_center",t.MiddleLeft="middle_left",t.MiddleRight="middle_right",t.MiddleCenter="middle_center",t.Left="left",t.Center="center",t.Right="right",t.NextToTrigger="next_to_trigger",t})({});(function(t){return t.Top="top",t.Left="left",t.Right="right",t.Bottom="bottom",t})({});var ey=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({});(function(t){return t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link",t})({});(function(t){return t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question",t})({});(function(t){return t.Once="once",t.Recurring="recurring",t.Always="always",t})({});var Lm=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t.ABANDONED="survey abandoned",t}({}),sN=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t.PRODUCT_TOUR_ID="$product_tour_id",t}({}),jR=function(t){return t.Popover="popover",t.Inline="inline",t}({}),Lt=jr("[Surveys]"),kR="seenSurvey_",sG=(t,e)=>{var r="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(r="$survey_"+e+"/"+t.id+"/"+t.current_iteration),r},iN=t=>((e,r)=>{var n=""+e+r.id;return r.current_iteration&&r.current_iteration>0&&(n=""+e+r.id+"_"+r.current_iteration),n})(kR,t),iG=[ey.Popover,ey.Widget,ey.API],oG={ignoreConditions:!1,ignoreDelay:!1,displayType:jR.Popover};class U_{constructor(){this.Ci={},this.Ci={}}on(e,r){return this.Ci[e]||(this.Ci[e]=[]),this.Ci[e].push(r),()=>{this.Ci[e]=this.Ci[e].filter(n=>n!==r)}}emit(e,r){for(var n of this.Ci[e]||[])n(r);for(var s of this.Ci["*"]||[])s(e,r)}}function Dl(t,e,r){if(Tt(t))return!1;switch(r){case"exact":return t===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class aG{constructor(e){this.Ri=new U_,this.Fi=(r,n)=>this.Mi(r,n)&&this.Oi(r,n)&&this.Ai(r,n)&&this.Di(r,n),this.Mi=(r,n)=>n==null||!n.event||(r==null?void 0:r.event)===(n==null?void 0:n.event),this._instance=e,this.ji=new Set,this.Li=new Set}init(){var e;if(!Re((e=this._instance)==null?void 0:e.Ni)){var r;(r=this._instance)==null||r.Ni((n,s)=>{this.on(n,s)})}}register(e){var r,n;if(!Re((r=this._instance)==null?void 0:r.Ni)&&(e.forEach(a=>{var l,c;(l=this.Li)==null||l.add(a),(c=a.steps)==null||c.forEach(u=>{var d;(d=this.ji)==null||d.add((u==null?void 0:u.event)||"")})}),(n=this._instance)!=null&&n.autocapture)){var s,o=new Set;e.forEach(a=>{var l;(l=a.steps)==null||l.forEach(c=>{c!=null&&c.selector&&o.add(c==null?void 0:c.selector)})}),(s=this._instance)==null||s.autocapture.setElementSelectors(o)}}on(e,r){var n;r!=null&&e.length!=0&&(this.ji.has(e)||this.ji.has(r==null?void 0:r.event))&&this.Li&&((n=this.Li)==null?void 0:n.size)>0&&this.Li.forEach(s=>{this.Ui(r,s)&&this.Ri.emit("actionCaptured",s.name)})}zi(e){this.onAction("actionCaptured",r=>e(r))}Ui(e,r){if((r==null?void 0:r.steps)==null)return!1;for(var n of r.steps)if(this.Fi(e,n))return!0;return!1}onAction(e,r){return this.Ri.on(e,r)}Oi(e,r){if(r!=null&&r.url){var n,s=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!s||typeof s!="string"||!Dl(s,r.url,r.url_matching||"contains"))return!1}return!0}Ai(e,r){return!!this.Hi(e,r)&&!!this.Bi(e,r)&&!!this.qi(e,r)}Hi(e,r){var n;if(r==null||!r.href)return!0;var s=this.Wi(e);if(s.length>0)return s.some(l=>Dl(l.href,r.href,r.href_matching||"exact"));var o,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!a&&Dl((o=a.match(/(?::|")href="(.*?)"/))?o[1]:"",r.href,r.href_matching||"exact")}Bi(e,r){var n;if(r==null||!r.text)return!0;var s=this.Wi(e);if(s.length>0)return s.some(u=>Dl(u.text,r.text,r.text_matching||"exact")||Dl(u.$el_text,r.text,r.text_matching||"exact"));var o,a,l,c=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!c&&(o=function(u){for(var d,h=[],m=/(?::|")text="(.*?)"/g;!Tt(d=m.exec(u));)h.includes(d[1])||h.push(d[1]);return h}(c),a=r.text,l=r.text_matching||"exact",o.some(u=>Dl(u,a,l)))}qi(e,r){var n,s;if(r==null||!r.selector)return!0;var o=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(o!=null&&o.includes(r.selector))return!0;var a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(r.selector_regex&&a)try{return new RegExp(r.selector_regex).test(a)}catch{return!1}return!1}Wi(e){var r;return(e==null||(r=e.properties)==null?void 0:r.$elements)==null?[]:e==null?void 0:e.properties.$elements}Di(e,r){return r==null||!r.properties||r.properties.length===0||_R(r.properties.reduce((n,s)=>{var o=At(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return n[s.key]={values:o,operator:s.operator||"exact"},n},{}),e==null?void 0:e.properties)}}class lG{constructor(e){this._instance=e,this.Gi=new Map,this.Vi=new Map,this.Ji=new Map}Ki(e,r){return!!e&&_R(e.propertyFilters,r==null?void 0:r.properties)}Yi(e,r){var n=new Map;return e.forEach(s=>{var o;(o=s.conditions)==null||(o=o[r])==null||(o=o.values)==null||o.forEach(a=>{if(a!=null&&a.name){var l=n.get(a.name)||[];l.push(s.id),n.set(a.name,l)}})}),n}Xi(e,r,n){var s=(n===Xu.Activation?this.Gi:this.Vi).get(e),o=[];return this.Qi(a=>{o=a.filter(l=>s==null?void 0:s.includes(l.id))}),o.filter(a=>{var l,c=(l=a.conditions)==null||(l=l[n])==null||(l=l.values)==null?void 0:l.find(u=>u.name===e);return this.Ki(c,r)})}register(e){var r;Re((r=this._instance)==null?void 0:r.Ni)||(this.Zi(e),this.te(e))}te(e){var r=e.filter(n=>{var s,o;return((s=n.conditions)==null?void 0:s.actions)&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0});r.length!==0&&(this.ie==null&&(this.ie=new aG(this._instance),this.ie.init(),this.ie.zi(n=>{this.onAction(n)})),r.forEach(n=>{var s,o,a,l,c;n.conditions&&(s=n.conditions)!=null&&s.actions&&(o=n.conditions)!=null&&(o=o.actions)!=null&&o.values&&((a=n.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((l=this.ie)==null||l.register(n.conditions.actions.values),(c=n.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEach(u=>{if(u&&u.name){var d=this.Ji.get(u.name);d&&d.push(n.id),this.Ji.set(u.name,d||[n.id])}}))}))}Zi(e){var r,n=e.filter(o=>{var a,l;return((a=o.conditions)==null?void 0:a.events)&&((l=o.conditions)==null||(l=l.events)==null||(l=l.values)==null?void 0:l.length)>0}),s=e.filter(o=>{var a,l;return((a=o.conditions)==null?void 0:a.cancelEvents)&&((l=o.conditions)==null||(l=l.cancelEvents)==null||(l=l.values)==null?void 0:l.length)>0});(n.length!==0||s.length!==0)&&((r=this._instance)==null||r.Ni((o,a)=>{this.onEvent(o,a)}),this.Gi=this.Yi(e,Xu.Activation),this.Vi=this.Yi(e,Xu.Cancellation))}onEvent(e,r){var n,s=this.ee(),o=this.re(),a=this.se(),l=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[o])||[];if(a===e&&r&&l.length>0){var c,u;s.info("event matched, removing item from activated items",{event:e,eventPayload:r,existingActivatedItems:l});var d=(r==null||(c=r.properties)==null?void 0:c.$survey_id)||(r==null||(u=r.properties)==null?void 0:u.$product_tour_id);if(d){var h=l.indexOf(d);h>=0&&(l.splice(h,1),this.ne(l))}}else{if(this.Vi.has(e)){var m=this.Xi(e,r,Xu.Cancellation);m.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:m.map(v=>v.id)}),m.forEach(v=>{var p=l.indexOf(v.id);p>=0&&l.splice(p,1),this.oe(v.id)}),this.ne(l))}if(this.Gi.has(e)){s.info("event name matched",{event:e,eventPayload:r,items:this.Gi.get(e)});var f=this.Xi(e,r,Xu.Activation);this.ne(l.concat(f.map(v=>v.id)||[]))}}}onAction(e){var r,n=this.re(),s=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[n])||[];this.Ji.has(e)&&this.ne(s.concat(this.Ji.get(e)||[]))}ne(e){var r,n=this.ee(),s=this.re(),o=[...new Set(e)].filter(a=>!this.ae(a));n.info("updating activated items",{activatedItems:o}),(r=this._instance)==null||(r=r.persistence)==null||r.register({[s]:o})}getActivatedIds(){var e,r=this.re(),n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[r];return n||[]}getEventToItemsMap(){return this.Gi}le(){return this.ie}}class cG extends lG{constructor(e){super(e)}re(){return"$surveys_activated"}se(){return Lm.SHOWN}Qi(e){var r;(r=this._instance)==null||r.getSurveys(e)}oe(e){var r;(r=this._instance)==null||r.cancelPendingSurvey(e)}ee(){return Lt}ae(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class uG{constructor(e){this.ue=void 0,this._surveyManager=null,this.he=!1,this.de=!1,this.ve=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var r=e.surveys;if(Tt(r))return Lt.warn("Flags not loaded yet. Not loading surveys.");var n=At(r);this.ue=n?r.length>0:r,Lt.info("flags response received, isSurveysEnabled: "+this.ue),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);(n!=null&&n.startsWith(kR)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(s=>localStorage.removeItem(s))}loadIfEnabled(){if(!this._surveyManager)if(this.de)Lt.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Lt.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Lt.info("Not loading surveys in cookieless mode without consent.");else{var e=Ve==null?void 0:Ve.__PosthogExtensions__;if(e){if(!Re(this.ue)||this._instance.config.advanced_enable_surveys){var r=this.ue||this._instance.config.advanced_enable_surveys;this.de=!0;try{var n=e.generateSurveys;if(n)return void this.ce(n,r);var s=e.loadExternalDependency;if(!s)return void this.fe("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",o=>{o||!e.generateSurveys?this.fe("Could not load surveys script",o):this.ce(e.generateSurveys,r)})}catch(o){throw this.fe("Error initializing surveys",o),o}finally{this.de=!1}}}else Lt.error("PostHog Extensions not found.")}}ce(e,r){this._surveyManager=e(this._instance,r),this._surveyEventReceiver=new cG(this._instance),Lt.info("Surveys loaded successfully"),this.pe({isLoaded:!0})}fe(e,r){Lt.error(e,r),this.pe({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ve.push(e),this._surveyManager&&this.pe({isLoaded:!0}),()=>{this.ve=this.ve.filter(r=>r!==e)}}getSurveys(e,r){if(r===void 0&&(r=!1),this._instance.config.disable_surveys)return Lt.info("Disabled. Not loading surveys."),e([]);var n=this._instance.get_property(gw);if(n&&!r)return e(n,{isLoaded:!0});if(this.he)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.he=!0,this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var o;this.he=!1;var a=s.statusCode;if(a!==200||!s.json){var l="Surveys API could not be loaded, status: "+a;return Lt.error(l),e([],{isLoaded:!1,error:l})}var c,u=s.json.surveys||[],d=u.filter(h=>function(m){return!(!m.start_date||m.end_date)}(h)&&(function(m){var f;return!((f=m.conditions)==null||(f=f.events)==null||(f=f.values)==null||!f.length)}(h)||function(m){var f;return!((f=m.conditions)==null||(f=f.actions)==null||(f=f.values)==null||!f.length)}(h)));return d.length>0&&((c=this._surveyEventReceiver)==null||c.register(d)),(o=this._instance.persistence)==null||o.register({[gw]:u}),e(u,{isLoaded:!0})}})}catch(s){throw this.he=!1,s}}pe(e){for(var r of this.ve)try{if(!e.isLoaded)return r([],e);this.getSurveys(r)}catch(n){Lt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,r){if(r===void 0&&(r=!1),!Tt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,r);Lt.warn("init was not called")}ge(e){var r=null;return this.getSurveys(n=>{var s;r=(s=n.find(o=>o.id===e))!==null&&s!==void 0?s:null}),r}_e(e){if(Tt(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var r=typeof e=="string"?this.ge(e):e;return r?this._surveyManager.checkSurveyEligibility(r):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Tt(this._surveyManager))return Lt.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var r=this._e(e);return{visible:r.eligible,disabledReason:r.reason}}canRenderSurveyAsync(e,r){return Tt(this._surveyManager)?(Lt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(n=>{this.getSurveys(s=>{var o,a=(o=s.find(c=>c.id===e))!==null&&o!==void 0?o:null;if(a){var l=this._e(a);n({visible:l.eligible,disabledReason:l.reason})}else n({visible:!1,disabledReason:"Survey not found"})},r)})}renderSurvey(e,r){var n;if(Tt(this._surveyManager))Lt.warn("init was not called");else{var s=typeof e=="string"?this.ge(e):e;if(s!=null&&s.id)if(iG.includes(s.type)){var o=De==null?void 0:De.querySelector(r);if(o)return(n=s.appearance)!=null&&n.surveyPopupDelaySeconds?(Lt.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var a,l;Lt.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(s,o),Lt.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o);Lt.warn("Survey element not found")}else Lt.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Lt.warn("Survey not found")}}displaySurvey(e,r){var n;if(Tt(this._surveyManager))Lt.warn("init was not called");else{var s=this.ge(e);if(s){var o=s;if((n=s.appearance)!=null&&n.surveyPopupDelaySeconds&&r.ignoreDelay&&(o=ze({},s,{appearance:ze({},s.appearance,{surveyPopupDelaySeconds:0})})),r.ignoreConditions===!1){var a=this.canRenderSurvey(s);if(!a.visible)return void Lt.warn("Survey is not eligible to be displayed: ",a.disabledReason)}r.displayType!==jR.Inline?this._surveyManager.handlePopoverSurvey(o):this.renderSurvey(o,r.selector)}else Lt.warn("Survey not found")}}cancelPendingSurvey(e){Tt(this._surveyManager)?Lt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}var Zu=jr("[Conversations]");class dG{constructor(e){this.me=void 0,this._conversationsManager=null,this.be=!1,this.ye=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var r=e.conversations;Tt(r)||(zi(r)?this.me=r:(this.me=r.enabled,this.ye=r),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.me=void 0,this.ye=null}loadIfEnabled(){if(!this._conversationsManager&&!this.be&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Ve==null?void 0:Ve.__PosthogExtensions__;if(e&&!Re(this.me)&&this.me)if(this.ye&&this.ye.token){if(function(s){var o;if(!s||s.length===0)return!0;var a=ue==null||(o=ue.location)==null?void 0:o.hostname;return!a||s.some(l=>{var c=function(d){var h=d.replace(/^https?:\/\//,"");return(h=h.split("/")[0].split("?")[0].split(":")[0])||null}(l);if(!c)return!1;if(c.startsWith("*.")){var u=c.slice(2);return a.endsWith("."+u)||a===u}return a===c})}(this.ye.domains)){this.be=!0;try{var r=e.initConversations;if(r)return this.we(r),void(this.be=!1);var n=e.loadExternalDependency;if(!n)return void this.xe("PostHog loadExternalDependency extension not found.");n(this._instance,"conversations",s=>{s||!e.initConversations?this.xe("Could not load conversations script",s):this.we(e.initConversations),this.be=!1})}catch(s){this.xe("Error initializing conversations",s),this.be=!1}}}else Zu.error("Conversations enabled but missing token in remote config.")}}we(e){if(this.ye)try{this._conversationsManager=e(this.ye,this._instance),Zu.info("Conversations loaded successfully")}catch(r){this.xe("Error completing conversations initialization",r)}else Zu.error("Cannot complete initialization: remote config is null")}xe(e,r){Zu.error(e,r),this._conversationsManager=null,this.be=!1}enable(){this._conversationsManager?this._conversationsManager.enable():Zu.warn("Conversations not loaded yet.")}disable(){this._conversationsManager&&this._conversationsManager.disable()}isLoaded(){return!Ys(this._conversationsManager)}isEnabled(){return this.me===!0}}var oN=jr("[RateLimiter]");class hG{constructor(e){var r,n;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=s=>{var o=s.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(a=>{oN.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void oN.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:o})}},this.instance=e,this.captureEventsPerSecond=((r=e.config.rate_limiting)==null?void 0:r.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((n=e.config.rate_limiting)==null?void 0:n.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var r,n,s;e===void 0&&(e=!1);var o=new Date().getTime(),a=(r=(n=this.instance.persistence)==null?void 0:n.get_property(xw))!==null&&r!==void 0?r:{tokens:this.captureEventsBurstLimit,last:o};a.tokens+=(o-a.last)/1e3*this.captureEventsPerSecond,a.last=o,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var l=a.tokens<1;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(s=this.instance.persistence)==null||s.set_property(xw,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var r=this.serverLimits[e||"events"]||!1;return r!==!1&&new Date().getTime()<r}}var ja=jr("[RemoteConfig]");class fG{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Ve._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ee(e){var r,n;(r=Ve.__PosthogExtensions__)!=null&&r.loadExternalDependency?(n=Ve.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(ja.error("PostHog Extensions not found. Cannot load remote config."),e())}$e(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:r=>{e(r.json)}})}load(){try{if(this.remoteConfig)return ja.info("Using preloaded remote config",this.remoteConfig),void this.pi(this.remoteConfig);if(this._instance.O())return void ja.warn("Remote config is disabled. Falling back to local config.");this.Ee(e=>{if(!e)return ja.info("No config found after loading remote JS config. Falling back to JSON."),void this.$e(r=>{this.pi(r)});this.pi(e)})}catch(e){ja.error("Error loading remote config",e)}}pi(e){e?this._instance.config.__preview_remote_config?(this._instance.pi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):ja.info("__preview_remote_config is disabled. Logging config instead",e):ja.error("Failed to fetch remote config from PostHog.")}}var Sw=3e3;class mG{constructor(e,r){this.Se=!0,this.ke=[],this.Pe=di((r==null?void 0:r.flush_interval_ms)||Sw,250,5e3,Le.createLogger("flush interval"),Sw),this.Te=e}enqueue(e){this.ke.push(e),this.Ie||this.Ce()}unload(){this.Re();var e=this.ke.length>0?this.Fe():{},r=Object.values(e);[...r.filter(n=>n.url.indexOf("/e")===0),...r.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.Te(ze({},n,{transport:"sendBeacon"}))})}enable(){this.Se=!1,this.Ce()}Ce(){var e=this;this.Se||(this.Ie=setTimeout(()=>{if(this.Re(),this.ke.length>0){var r=this.Fe(),n=function(){var o=r[s],a=new Date().getTime();o.data&&At(o.data)&&zt(o.data,l=>{l.offset=Math.abs(l.timestamp-a),delete l.timestamp}),e.Te(o)};for(var s in r)n()}},this.Pe))}Re(){clearTimeout(this.Ie),this.Ie=void 0}Fe(){var e={};return zt(this.ke,r=>{var n,s=r,o=(s?s.batchKey:null)||s.url;Re(e[o])&&(e[o]=ze({},s,{data:[]})),(n=e[o].data)==null||n.push(s.data)}),this.ke=[],e}}var pG=["retriesPerformedSoFar"];class gG{constructor(e){this.Me=!1,this.Oe=3e3,this.ke=[],this._instance=e,this.ke=[],this.Ae=!0,!Re(ue)&&"onLine"in ue.navigator&&(this.Ae=ue.navigator.onLine,this.De=()=>{this.Ae=!0,this.Lt()},this.je=()=>{this.Ae=!1},Pr(ue,"online",this.De),Pr(ue,"offline",this.je))}get length(){return this.ke.length}retriableRequest(e){var{retriesPerformedSoFar:r}=e,n=xA(e,pG);xi(r)&&r>0&&(n.url=qp(n.url,{retry_count:r})),this._instance._send_request(ze({},n,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(r??0)<10?this.Le(ze({retriesPerformedSoFar:r},n)):n.callback==null||n.callback(s)}}))}Le(e){var r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;var n=function(a){var l=3e3*Math.pow(2,a),c=l/2,u=Math.min(18e5,l),d=(Math.random()-.5)*(u-c);return Math.ceil(u+d)}(r),s=Date.now()+n;this.ke.push({retryAt:s,requestOptions:e});var o="Enqueued failed request for retry in "+n;navigator.onLine||(o+=" (Browser is offline)"),Le.warn(o),this.Me||(this.Me=!0,this.Ne())}Ne(){if(this.Ue&&clearTimeout(this.Ue),this.ke.length===0)return this.Me=!1,void(this.Ue=void 0);this.Ue=setTimeout(()=>{this.Ae&&this.ke.length>0&&this.Lt(),this.Ne()},this.Oe)}Lt(){var e=Date.now(),r=[],n=this.ke.filter(o=>o.retryAt<e||(r.push(o),!1));if(this.ke=r,n.length>0)for(var{requestOptions:s}of n)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Ue&&(clearTimeout(this.Ue),this.Ue=void 0),this.Me=!1,Re(ue)||(this.De&&(ue.removeEventListener("online",this.De),this.De=void 0),this.je&&(ue.removeEventListener("offline",this.je),this.je=void 0)),this.ke))try{this._instance._send_request(ze({},e,{transport:"sendBeacon"}))}catch(r){Le.error(r)}this.ke=[]}}class vG{constructor(e){this.ze=()=>{var r,n,s,o;this.He||(this.He={});var a=this.scrollElement(),l=this.scrollY(),c=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=l+((a==null?void 0:a.clientHeight)||0),d=(a==null?void 0:a.scrollHeight)||0;this.He.lastScrollY=Math.ceil(l),this.He.maxScrollY=Math.max(l,(r=this.He.maxScrollY)!==null&&r!==void 0?r:0),this.He.maxScrollHeight=Math.max(c,(n=this.He.maxScrollHeight)!==null&&n!==void 0?n:0),this.He.lastContentY=u,this.He.maxContentY=Math.max(u,(s=this.He.maxContentY)!==null&&s!==void 0?s:0),this.He.maxContentHeight=Math.max(d,(o=this.He.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=e}getContext(){return this.He}resetContext(){var e=this.He;return setTimeout(this.ze,0),e}startMeasuringScrollPosition(){Pr(ue,"scroll",this.ze,{capture:!0}),Pr(ue,"scrollend",this.ze,{capture:!0}),Pr(ue,"resize",this.ze)}scrollElement(){if(!this._instance.config.scroll_root_selector)return ue==null?void 0:ue.document.documentElement;var e=At(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var r of e){var n=ue==null?void 0:ue.document.querySelector(r);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return ue&&(ue.scrollY||ue.pageYOffset||ue.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return ue&&(ue.scrollX||ue.pageXOffset||ue.document.documentElement.scrollLeft)||0}}var xG=t=>fR(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class aN{constructor(e,r,n,s){this.Be=o=>{var a=this.qe();if(!a||a.sessionId!==o){var l={sessionId:o,props:this.We(this._instance)};this.Ge.register({[vw]:l})}},this._instance=e,this.Ve=r,this.Ge=n,this.We=s||xG,this.Ve.onSessionId(this.Be)}qe(){return this.Ge.props[vw]}getSetOnceProps(){var e,r=(e=this.qe())==null?void 0:e.props;return r?"r"in r?mR(r):{$referring_domain:r.referringDomain,$pathname:r.initialPathName,utm_source:r.utm_source,utm_campaign:r.utm_campaign,utm_medium:r.utm_medium,utm_content:r.utm_content,utm_term:r.utm_term}:{}}getSessionProps(){var e={};return zt($_(this.getSetOnceProps()),(r,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+ow(n)]=r}),e}}var ty=jr("[SessionId]");class lN{on(e,r){return this.Je.on(e,r)}constructor(e,r,n){var s;if(this.Ke=[],this.Ye=void 0,this.Je=new U_,this.Xe=(d,h)=>Math.abs(d-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Ge=e.persistence,this.Qe=void 0,this.Ze=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.tr=r||$o,this.ir=n||$o;var o=this.R.persistence_name||this.R.token,a=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*di(a,60,36e3,ty.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.er(),this.rr="ph_"+o+"_window_id",this.sr="ph_"+o+"_primary_window_exists",this.nr()){var l=Xr.W(this.rr),c=Xr.W(this.sr);l&&!c?this.Qe=l:Xr.V(this.rr),Xr.G(this.sr,!0)}if((s=this.R.bootstrap)!=null&&s.sessionID)try{var u=(d=>{var h=d.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.R.bootstrap.sessionID);this.ar(this.R.bootstrap.sessionID,new Date().getTime(),u)}catch(d){ty.error("Invalid sessionID in bootstrap",d)}this.lr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Re(this.Ke)&&(this.Ke=[]),this.Ke.push(e),this.Ze&&e(this.Ze,this.Qe),()=>{this.Ke=this.Ke.filter(r=>r!==e)}}nr(){return this.R.persistence!=="memory"&&!this.Ge.xi&&Xr.H()}ur(e){e!==this.Qe&&(this.Qe=e,this.nr()&&Xr.G(this.rr,e))}hr(){return this.Qe?this.Qe:this.nr()?Xr.W(this.rr):null}ar(e,r,n){e===this.Ze&&r===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=r,this.Ze=e,this.Ge.register({[$p]:[r,e,n]}))}dr(){var e=this.Ge.props[$p];return At(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.ar(null,null,null)}destroy(){clearTimeout(this.vr),this.vr=void 0,this.Ye&&ue&&(ue.removeEventListener("beforeunload",this.Ye,{capture:!1}),this.Ye=void 0),this.Ke=[]}lr(){this.Ye=()=>{this.nr()&&Xr.V(this.sr)},Pr(ue,"beforeunload",this.Ye,{capture:!1})}checkAndGetSessionAndWindowId(e,r){if(e===void 0&&(e=!1),r===void 0&&(r=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=r||new Date().getTime(),[s,o,a]=this.dr(),l=this.hr(),c=xi(a)&&a>0&&Math.abs(n-a)>864e5,u=!1,d=!o,h=!d&&!e&&this.Xe(n,s);d||h||c?(o=this.tr(),l=this.ir(),ty.info("new session ID generated",{sessionId:o,windowId:l,changeReason:{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:c}}),a=n,u=!0):l||(l=this.ir(),u=!0);var m=s===0||!e||c?n:s,f=a===0?new Date().getTime():a;return this.ur(l),this.ar(o,m,f),e||this.er(),u&&this.Ke.forEach(v=>v(o,l,u?{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:c}:void 0)),{sessionId:o,windowId:l,sessionStartTimestamp:f,changeReason:u?{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:s}}er(){clearTimeout(this.vr),this.vr=setTimeout(()=>{var[e]=this.dr();if(this.Xe(new Date().getTime(),e)){var r=this.Ze;this.resetSessionId(),this.Je.emit("forcedIdleReset",{idleSessionId:r})}},1.1*this.sessionTimeoutMs)}}var yG=["$set_once","$set"],po=jr("[SiteApps]");class bG{constructor(e){this._instance=e,this.cr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}pr(e,r){if(r){var n=this.globalsForEvent(r);this.cr.push(n),this.cr.length>1e3&&(this.cr=this.cr.slice(10))}}get siteAppLoaders(){var e;return(e=Ve._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ni(this.pr.bind(this));this.gr=()=>{e(),this.cr=[],this.gr=void 0}}}globalsForEvent(e){var r,n,s,o,a,l,c;if(!e)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[m,f]of Object.entries(h))u[m]={id:d[m],type:m,properties:f};var{$set_once:v,$set:p}=e;return{event:ze({},xA(e,yG),{properties:ze({},e.properties,p?{$set:ze({},(r=(n=e.properties)==null?void 0:n.$set)!==null&&r!==void 0?r:{},p)}:{},v?{$set_once:ze({},(s=(o=e.properties)==null?void 0:o.$set_once)!==null&&s!==void 0?s:{},v)}:{}),elements_chain:(a=(l=e.properties)==null?void 0:l.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(c=e.properties)==null?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var r=this.apps[e.id],n=()=>{var l;!r.errored&&this.cr.length&&(po.info("Processing "+this.cr.length+" events for site app with id "+e.id),this.cr.forEach(c=>r.processEvent==null?void 0:r.processEvent(c)),r.processedBuffer=!0),Object.values(this.apps).every(c=>c.processedBuffer||c.errored)&&((l=this.gr)==null||l.call(this))},s=!1,o=l=>{r.errored=!l,r.loaded=!0,po.info("Site app with id "+e.id+" "+(l?"loaded":"errored")),s&&n()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:l=>{o(l)}});a&&(r.processEvent=a),s=!0}catch(l){po.error("Error while initializing PostHog app with config id "+e.id,l),o(!1)}if(s&&r.loaded)try{n()}catch(l){po.error("Error while processing buffered events PostHog app with config id "+e.id,l),r.errored=!0}}_r(){var e=this.siteAppLoaders||[];for(var r of e)this.apps[r.id]={id:r.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}mr(e){if(Object.keys(this.apps).length!==0){var r=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(r)}catch(s){po.error("Error while processing event "+e.event+" for site app "+n.id,s)}}}onRemoteConfig(e){var r,n,s,o=this;if((r=this.siteAppLoaders)!=null&&r.length)return this.isEnabled?(this._r(),void this._instance.on("eventCaptured",u=>this.mr(u))):void po.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.gr)==null||n.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var a=function(u){var d;Ve["__$$ph_site_app_"+u]=o._instance,(d=Ve.__PosthogExtensions__)==null||d.loadSiteApp==null||d.loadSiteApp(o._instance,c,h=>{if(h)return po.error("Error while initializing PostHog app with config id "+u,h)})};for(var{id:l,url:c}of e.siteApps)a(l)}else po.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var SR=function(t,e){if(!t)return!1;var r=t.userAgent;if(r&&xS(r,e))return!0;try{var n=t==null?void 0:t.userAgentData;if(n!=null&&n.brands&&n.brands.some(s=>xS(s==null?void 0:s.brand,e)))return!0}catch{}return!!t.webdriver},vd=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),cN="i.posthog.com";class wG{constructor(e){this.br={},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,r=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return r||(r=this.apiHost.replace("."+cN,".posthog.com")),r==="https://app.posthog.com"?"https://us.posthog.com":r}get region(){return this.br[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.br[this.apiHost]=vd.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.br[this.apiHost]=vd.EU:this.br[this.apiHost]=vd.CUSTOM),this.br[this.apiHost]}endpointFor(e,r){if(r===void 0&&(r=""),r&&(r=r[0]==="/"?r:"/"+r),e==="ui")return this.uiHost+r;if(e==="flags")return this.flagsApiHost+r;if(this.region===vd.CUSTOM)return this.apiHost+r;var n=cN+r;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var _G={icontains:(t,e)=>!!ue&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!ue&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!ue&&Vp(e.href,t),not_regex:(t,e)=>!!ue&&!Vp(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class hn{constructor(e){var r=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),r.getWebExperiments(s=>{hn.yr("retrieved web experiments from the server"),r.wr=new Map,s.forEach(o=>{if(o.feature_flag_key){var a;r.wr&&(hn.yr("setting flag key ",o.feature_flag_key," to web experiment ",o),(a=r.wr)==null||a.set(o.feature_flag_key,o));var l=r._instance.getFeatureFlag(o.feature_flag_key);$r(l)&&o.variants[l]&&r.Er(o.name,l,o.variants[l].transforms)}else if(o.variants)for(var c in o.variants){var u=o.variants[c];hn.$r(u)&&r.Er(o.name,c,u.transforms)}})},n)},this._instance=e,this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}onFeatureFlags(e){if(this._is_bot())hn.yr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(Tt(this.wr))return this.wr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();hn.yr("applying feature flags",e),e.forEach(r=>{var n;if(this.wr&&(n=this.wr)!=null&&n.has(r)){var s,o=this._instance.getFeatureFlag(r),a=(s=this.wr)==null?void 0:s.get(r);o&&a!=null&&a.variants[o]&&this.Er(a.name,o,a.variants[o].transforms)}})}}previewWebExperiment(){var e=hn.getWindowLocation();if(e!=null&&e.search){var r=Up(e==null?void 0:e.search,"__experiment_id"),n=Up(e==null?void 0:e.search,"__experiment_variant");r&&n&&(hn.yr("previewing web experiments "+r+" && "+n),this.getWebExperiments(s=>{this.Sr(parseInt(r),n,s)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,r,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!r)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:o=>{if(o.statusCode!==200||!o.json)return e([]);var a=o.json.experiments||[];return e(a)}})}Sr(e,r,n){var s=n.filter(o=>o.id===e);s&&s.length>0&&(hn.yr("Previewing web experiment ["+s[0].name+"] with variant ["+r+"]"),this.Er(s[0].name,r,s[0].variants[r].transforms))}static $r(e){return!Tt(e.conditions)&&hn.kr(e)&&hn.Pr(e)}static kr(e){var r;if(Tt(e.conditions)||Tt((r=e.conditions)==null?void 0:r.url))return!0;var n,s,o,a=hn.getWindowLocation();return!!a&&((n=e.conditions)==null||!n.url||_G[(s=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,a))}static getWindowLocation(){return ue==null?void 0:ue.location}static Pr(e){var r;if(Tt(e.conditions)||Tt((r=e.conditions)==null?void 0:r.utm))return!0;var n=cR();if(n.utm_source){var s,o,a,l,c,u,d,h,m=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==n.utm_campaign,f=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==n.utm_source,v=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==n.utm_medium,p=(d=e.conditions)==null||(d=d.utm)==null||!d.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==n.utm_term;return m&&v&&p&&f}return!1}static yr(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];Le.info("[WebExperiments] "+e,n)}Er(e,r,n){this._is_bot()?hn.yr("Refusing to render web experiment since the viewer is a likely bot"):r!=="control"?n.forEach(s=>{if(s.selector){var o;hn.yr("applying transform of variant "+r+" for experiment "+e+" ",s);var a=(o=document)==null?void 0:o.querySelectorAll(s.selector);a==null||a.forEach(l=>{var c=l;s.html&&(c.innerHTML=s.html),s.css&&c.setAttribute("style",s.css)})}}):hn.yr("Control variants leave the page unmodified.")}_is_bot(){return Zn&&this._instance?SR(Zn,this._instance.config.custom_blocked_useragents):void 0}}var jG=jr("[PostHog ExternalIntegrations]"),kG={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class SG{constructor(e){this._instance=e}it(e,r){var n;(n=Ve.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,s=>{if(s)return jG.error("failed to load script",s);r()})}startIfEnabledOrStop(){var e=this,r=function(a){var l,c,u;!s||(l=Ve.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]||e.it(kG[a],()=>{var d;(d=Ve.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[a])==null||d.start(e._instance)}),!s&&(c=Ve.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[a]&&((u=Ve.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.stop())};for(var[n,s]of Object.entries((o=this._instance.config.integrations)!==null&&o!==void 0?o:{})){var o;r(n)}}}var Nw="[SessionRecording]",ed=jr(Nw);class uN{get started(){var e;return!((e=this.Tr)==null||!e.isStarted)}get status(){return this.Tr?this.Tr.status:this.Ir&&!this.Cr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ir=!1,this.Rr=void 0,this._instance=e,!this._instance.sessionManager)throw ed.error("started without valid sessionManager"),new Error(Nw+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Nw+' cannot be used with cookieless_mode="always"')}get Cr(){var e,r=!((e=this._instance.get_property(Ux))==null||!e.enabled),n=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return ue&&r&&n&&!s}startIfEnabledOrStop(e){var r;if(!this.Cr||(r=this.Tr)==null||!r.isStarted){var n=!Re(Object.assign)&&!Re(Array.from);this.Cr&&n?(this.Fr(e),ed.info("starting")):this.stopRecording()}}Fr(e){var r,n,s;this.Cr&&(Ve!=null&&(r=Ve.__PosthogExtensions__)!=null&&(r=r.rrweb)!=null&&r.record&&(n=Ve.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Mr(e):(s=Ve.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Or,o=>{if(o)return ed.error("could not load recorder",o);this.Mr(e)}))}stopRecording(){var e,r;(e=this.Rr)==null||e.call(this),this.Rr=void 0,(r=this.Tr)==null||r.stop()}Ar(){var e;(e=this._instance.persistence)==null||e.unregister(HA)}Dr(e){if(this._instance.persistence){var r,n,s=this._instance.persistence,o=()=>{var a=e.sessionRecording===!1?void 0:e.sessionRecording,l=a==null?void 0:a.sampleRate,c=Tt(l)?null:parseFloat(l);Tt(c)&&this.Ar();var u=a==null?void 0:a.minimumDurationMilliseconds;s.register({[Ux]:ze({enabled:!!a},a,{networkPayloadCapture:ze({capturePerformance:e.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:c,minimumDurationMilliseconds:Re(u)?null:u,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers})})};o(),(r=this.Rr)==null||r.call(this),this.Rr=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(o)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.Dr(e),this.Ir=!0,this.startIfEnabledOrStop()):this.Ir=!0:ed.info("skipping remote config with no sessionRecording",e)}log(e,r){var n;r===void 0&&(r="log"),(n=this.Tr)!=null&&n.log?this.Tr.log(e,r):ed.warn("log called before recorder was ready")}get Or(){var e,r,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Ux);return(n==null||(r=n.scriptConfig)==null?void 0:r.script)||"lazy-recorder"}Mr(e){var r,n;if((r=Ve.__PosthogExtensions__)==null||!r.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Tr||(this.Tr=(n=Ve.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Tr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Tr.start(e)}onRRwebEmit(e){var r;(r=this.Tr)==null||r.onRRwebEmit==null||r.onRRwebEmit(e)}overrideLinkedFlag(){var e,r;this.Tr||(r=this._instance.persistence)==null||r.register({$replay_override_linked_flag:!0}),(e=this.Tr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,r;this.Tr||(r=this._instance.persistence)==null||r.register({$replay_override_sampling:!0}),(e=this.Tr)==null||e.overrideSampling()}overrideTrigger(e){var r,n;this.Tr||(n=this._instance.persistence)==null||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}
593),(r=this.Tr)==null||r.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Tr)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,r){var n;return!((n=this.Tr)==null||!n.tryAddCustomEvent(e,r))}}var $d={},Cw=()=>{},Kl="posthog",NR=!J9&&(An==null?void 0:An.indexOf("MSIE"))===-1&&(An==null?void 0:An.indexOf("Mozilla"))===-1,dN=t=>{var e;return ze({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:t9(De==null?void 0:De.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Cw,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,debug:In&&$r(In==null?void 0:In.search)&&In.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:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(ue==null||(e=ue.location)==null?void 0:e.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_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:r=>{var n="Bad HTTP status: "+r.statusCode+" "+r.text;Le.error(n)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Sw},error_tracking:{},_onCapture:Cw,__preview_eager_load_replay:!1},(r=>({rageclick:!(r&&r>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(r&&r>="2025-05-24")||"history_change",session_recording:r&&r>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(t))},hN=t=>{var e={};Re(t.process_person)||(e.person_profiles=t.process_person),Re(t.xhr_headers)||(e.request_headers=t.xhr_headers),Re(t.cookie_name)||(e.persistence_name=t.cookie_name),Re(t.disable_cookie)||(e.disable_persistence=t.disable_cookie),Re(t.store_google)||(e.save_campaign_params=t.store_google),Re(t.verbose)||(e.debug=t.verbose);var r=vr({},e,t);return At(t.property_blacklist)&&(Re(t.property_denylist)?r.property_denylist=t.property_blacklist:At(t.property_denylist)?r.property_denylist=[...t.property_blacklist,...t.property_denylist]:Le.error("Invalid value for property_denylist config: "+t.property_denylist)),r};class NG{constructor(){this.__forceAllowLocalhost=!1}get jr(){return this.__forceAllowLocalhost}set jr(e){Le.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ev{get decideEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new NG,this.Lr=!1,this.version=Pi.LIB_VERSION,this.Nr=new U_,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=dN(),this.SentryIntegration=T9,this.sentryIntegration=e=>function(r,n){var s=lR(r,n);return{name:aR,processEvent:o=>s(o)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ur=!1,this.zr=null,this.Hr=null,this.Br=null,this.featureFlags=new tG(this),this.toolbar=ne
vendor: 25,440 bytes, line 593
593w R9(this),this.scrollManager=new vG(this),this.pageViewManager=new U9(this),this.surveys=new uG(this),this.conversations=new dG(this),this.experiments=new hn(this),this.exceptions=new X9(this),this.rateLimiter=new hG(this),this.requestRouter=new wG(this),this.consent=new k9(this),this.externalIntegrations=new SG(this),this.people={set:(e,r,n)=>{var s=$r(e)?{[e]:r}:e;this.setPersonProperties(s),n==null||n({})},set_once:(e,r,n)=>{var s=$r(e)?{[e]:r}:e;this.setPersonProperties(void 0,s),n==null||n({})}},this.on("eventCaptured",e=>Le.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,r,n){if(n&&n!==Kl){var s,o=(s=$d[n])!==null&&s!==void 0?s:new ev;return o._init(e,r,n),$d[n]=o,$d[Kl][n]=o,o}return this._init(e,r,n)}_init(e,r,n){var s;if(r===void 0&&(r={}),Re(e)||aw(e))return Le.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={},r.debug=this.qr(r.debug),this.Wr=r,this.Gr=[],r.person_profiles&&(this.Hr=r.person_profiles),this.set_config(vr({},dN(r.defaults),hN(r),{name:n,token:e})),this.config.on_xhr_error&&Le.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:Oi.GZipJS;var o=this.Vr();this.persistence=new Xx(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Xx(ze({},this.config,{persistence:"sessionStorage"}),o);var a=ze({},this.persistence.props),l=ze({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Jr=new mG(y=>this.Kr(y),this.config.request_queue_config),this.Yr=new gG(this),this.__request_queue=[];var c=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new lN(this),this.sessionPropsManager=new aN(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Le.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Xr(c)},0)):(Le.info("Initializing extensions synchronously"),this.Xr(c)),Pi.DEBUG=Pi.DEBUG||this.config.debug,Pi.DEBUG&&Le.info("Starting in debug mode",{this:this,config:r,thisC:ze({},this.config),p:a,s:l}),((s=r.bootstrap)==null?void 0:s.distinctID)!==void 0){var u,d,h=this.config.get_device_id($o()),m=(u=r.bootstrap)!=null&&u.isIdentifiedID?h:r.bootstrap.distinctID;this.persistence.set_property(Ti,(d=r.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:r.bootstrap.distinctID,$device_id:m})}if(this.Qr()){var f,v,p=Object.keys(((f=r.bootstrap)==null?void 0:f.featureFlags)||{}).filter(y=>{var w;return!((w=r.bootstrap)==null||(w=w.featureFlags)==null||!w[y])}).reduce((y,w)=>{var j;return y[w]=((j=r.bootstrap)==null||(j=j.featureFlags)==null?void 0:j[w])||!1,y},{}),b=Object.keys(((v=r.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter(y=>p[y]).reduce((y,w)=>{var j,_;return(j=r.bootstrap)!=null&&(j=j.featureFlagPayloads)!=null&&j[w]&&(y[w]=(_=r.bootstrap)==null||(_=_.featureFlagPayloads)==null?void 0:_[w]),y},{});this.featureFlags.receivedFeatureFlags({featureFlags:p,featureFlagPayloads:b})}if(c)this.register_once({distinct_id:Gu,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id($o());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(Ti,"anonymous")}return Pr(ue,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),r.segment?P9(this,()=>this.Zr()):this.Zr(),qo(this.config._onCapture)&&this.config._onCapture!==Cw&&(Le.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",y=>this.config._onCapture(y.event,y))),this.config.ip&&Le.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}Xr(e){var r=performance.now();this.historyAutocapture=new E9(this),this.historyAutocapture.startIfEnabled();var n=[];n.push(()=>{new O9(this).startIfEnabledOrStop()}),n.push(()=>{var s;this.siteApps=new bG(this),(s=this.siteApps)==null||s.init()}),e||n.push(()=>{this.sessionRecording=new uN(this),this.sessionRecording.startIfEnabledOrStop()}),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.push(()=>{this.autocapture=new g9(this),this.autocapture.startIfEnabled()}),n.push(()=>{this.surveys.loadIfEnabled()}),n.push(()=>{this.conversations.loadIfEnabled()}),n.push(()=>{this.productTours=new nG(this),this.productTours.loadIfEnabled()}),n.push(()=>{this.heatmaps=new z9(this),this.heatmaps.startIfEnabled()}),n.push(()=>{this.webVitalsAutocapture=new L9(this)}),n.push(()=>{this.exceptionObserver=new C9(this),this.exceptionObserver.startIfEnabledOrStop()}),n.push(()=>{this.deadClicksAutocapture=new oR(this,N9),this.deadClicksAutocapture.startIfEnabled()}),n.push(()=>{if(this.ts){var s=this.ts;this.ts=void 0,this.pi(s)}}),this.es(n,r)}es(e,r){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&e.length>0)return void setTimeout(()=>{this.es(e,r)},0);var n=e.shift();if(n)try{n()}catch(o){Le.error("Error initializing extension:",o)}}var s=Math.round(performance.now()-r);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&Le.info("PostHog extensions initialized ("+s+"ms)")}pi(e){var r,n,s,o,a,l,c,u,d;if(!De||!De.body)return Le.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.pi(e)},500);this.config.__preview_deferred_init_extensions&&(this.ts=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=gt(e.supportedCompression,Oi.GZipJS)?Oi.GZipJS:gt(e.supportedCompression,Oi.Base64)?Oi.Base64:void 0),(r=e.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Hr?this.Hr:"identified_only"}),(n=this.siteApps)==null||n.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(o=this.autocapture)==null||o.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(l=this.productTours)==null||l.onRemoteConfig(e),(c=this.webVitalsAutocapture)==null||c.onRemoteConfig(e),(u=this.exceptionObserver)==null||u.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(d=this.deadClicksAutocapture)==null||d.onRemoteConfig(e)}Zr(){try{this.config.loaded(this)}catch(e){Le.critical("`loaded` function failed",e)}this.rs(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.ss()},1),new fG(this).load(),this.featureFlags.flags()}rs(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Jr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Vo(this.__request_queue,e=>this.Kr(e)),this.__request_queue=[],this.rs()}_handle_unload(){var e,r;this.surveys.handlePageUnload(),this.config.request_batching?(this.ns()&&this.capture("$pageleave"),(e=this.Jr)==null||e.unload(),(r=this.Yr)==null||r.unload()):this.ns()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(NR?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=qp(e.url,{ip:this.config.ip?1:0}),e.headers=ze({},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,(r=>{var n,s,o,a=ze({},r);a.timeout=a.timeout||6e4,a.url=qp(a.url,{_:new Date().getTime().toString(),ver:Pi.LIB_VERSION,compression:a.compression});var l=(n=a.transport)!==null&&n!==void 0?n:"fetch",c=Fm.filter(d=>!a.disableTransport||!d.transport||!a.disableTransport.includes(d.transport)),u=(s=(o=zA(c,d=>d.transport===l))==null?void 0:o.method)!==null&&s!==void 0?s:c[0].method;if(!u)throw new Error("No available transport method");u(a)})(ze({},e,{callback:r=>{var n,s;this.rateLimiter.checkForLimiting(r),r.statusCode>=400&&((n=(s=this.config).on_request_error)==null||n.call(s,r)),e.callback==null||e.callback(r)}}))))}Kr(e){this.Yr?this.Yr.retriableRequest(e):this._send_request(e)}_execute_array(e){var r,n=[],s=[],o=[];Vo(e,l=>{l&&(r=l[0],At(r)?o.push(l):qo(l)?l.call(this):At(l)&&r==="alias"?n.push(l):At(l)&&r.indexOf("capture")!==-1&&qo(this[r])?o.push(l):s.push(l))});var a=function(l,c){Vo(l,function(u){if(At(u[0])){var d=c;zt(u,function(h){d=d[h[0]].apply(d,h.slice(1))})}else this[u[0]].apply(this,u.slice(1))},c)};a(n,this),a(s,this),a(o,this)}Qr(){var e,r;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((r=this.config.bootstrap)==null?void 0:r.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,r,n){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jr){if(this.is_capturing())if(!Re(e)&&$r(e)){var o=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(o&&!this.config.__preview_capture_bot_pageviews)){var a=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){r!=null&&r.$current_url&&!$r(r==null?void 0:r.$current_url)&&(Le.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),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,c=(n==null?void 0:n.timestamp)||l,u=$o(),d={uuid:u,event:e,properties:this.calculateEventProperties(e,r||{},c,u)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),a&&(d.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),n!=null&&n.$set&&(d.$set=n==null?void 0:n.$set);var h,m=e!=="$groupidentify",f=this.os(n==null?void 0:n.$set_once,m);if(f&&(d.$set_once=f),(d=Z7(d,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=c,Re(n==null?void 0:n.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),e===Lm.DISMISSED||e===Lm.SENT){var v=r==null?void 0:r[sN.SURVEY_ID],p=r==null?void 0:r[sN.SURVEY_ITERATION];h={id:v,current_iteration:p},localStorage.getItem(iN(h))||localStorage.setItem(iN(h),"true"),d.$set=ze({},d.$set,{[sG({id:v,current_iteration:p},e===Lm.SENT?"responded":"dismissed")]:!0})}var b=ze({},d.properties.$set,d.$set);if(cc(b)||this.setPersonPropertiesForFlags(b),!Tt(this.config.before_send)){var x=this.ls(d);if(!x)return;d=x}this.Nr.emit("eventCaptured",d);var y={method:"POST",url:(s=n==null?void 0:n._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:n==null?void 0:n._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Kr(y):this.Jr.enqueue(y),d}Le.critical("This capture call is ignored due to client rate limiting.")}}else Le.error("No event name provided to posthog.capture")}else Le.uninitializedWarning("posthog.capture")}Ni(e){return this.on("eventCaptured",r=>e(r.event,r))}calculateEventProperties(e,r,n,s,o){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return r;var a=o?void 0:this.persistence.remove_event_timer(e),l=ze({},r);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(l.$cookieless_mode=!0),e==="$snapshot"){var c=ze({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=c.distinct_id,(!$r(l.distinct_id)&&!xi(l.distinct_id)||aw(l.distinct_id))&&Le.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=F9(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:m}=this.sessionManager.checkAndGetSessionAndWindowId(o,n.getTime());l.$session_id=h,l.$window_id=m}this.sessionPropsManager&&vr(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&vr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(f=this.Yr)==null?void 0:f.length}catch(x){l.$sdk_debug_error_capturing_properties=String(x)}if(this.requestRouter.region===vd.CUSTOM&&(l.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||o?e!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,s),l=vr(l,u),e==="$pageview"&&De&&(l.title=De.title),!Re(a)){var v=n.getTime()-a;l.$duration=parseFloat((v/1e3).toFixed(3))}An&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=vr({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),At(this.config.property_denylist)?zt(this.config.property_denylist,function(x){delete l[x]}):Le.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&(Le.error("sanitize_properties is deprecated. Use before_send instead"),l=p(l,e));var b=this.us();return l.$process_person_profile=b,b&&!o&&this.hs("_calculate_event_properties"),l}os(e,r){var n;if(r===void 0&&(r=!0),!this.persistence||!this.us()||this.Lr)return e;var s=this.persistence.get_initial_props(),o=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),a=vr({},s,o||{},e||{}),l=this.config.sanitize_properties;return l&&(Le.error("sanitize_properties is deprecated. Use before_send instead"),a=l(a,"$set_once")),r&&(this.Lr=!0),cc(a)?void 0:a}register(e,r){var n;(n=this.persistence)==null||n.register(e,r)}register_once(e,r,n){var s;(s=this.persistence)==null||s.register_once(e,r,n)}register_for_session(e){var r;(r=this.sessionPersistence)==null||r.register(e)}unregister(e){var r;(r=this.persistence)==null||r.unregister(e)}unregister_for_session(e){var r;(r=this.sessionPersistence)==null||r.unregister(e)}ds(e,r){this.register({[e]:r})}getFeatureFlag(e,r){return this.featureFlags.getFeatureFlag(e,r)}getFeatureFlagPayload(e){var r=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(r)}catch{return r}}isFeatureEnabled(e,r){return this.featureFlags.isFeatureEnabled(e,r)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,r,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,r,n)}getEarlyAccessFeatures(e,r,n){return r===void 0&&(r=!1),this.featureFlags.getEarlyAccessFeatures(e,r,n)}on(e,r){return this.Nr.on(e,r)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var r,n;return(r=(n=this.sessionManager)==null?void 0:n.onSessionId(e))!==null&&r!==void 0?r:()=>{}}getSurveys(e,r){r===void 0&&(r=!1),this.surveys.getSurveys(e,r)}getActiveMatchingSurveys(e,r){r===void 0&&(r=!1),this.surveys.getActiveMatchingSurveys(e,r)}renderSurvey(e,r){this.surveys.renderSurvey(e,r)}displaySurvey(e,r){r===void 0&&(r=oG),this.surveys.displaySurvey(e,r)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,r){return r===void 0&&(r=!1),this.surveys.canRenderSurveyAsync(e,r)}identify(e,r,n){if(!this.__loaded||!this.persistence)return Le.uninitializedWarning("posthog.identify");if(xi(e)&&(e=e.toString(),Le.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))Le.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.');else if(e!==Gu){if(this.hs("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var o=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}e!==s&&e!==this.get_property(hd)&&(this.unregister(hd),this.register({distinct_id:e}));var a=(this.persistence.get_property(Ti)||"anonymous")==="anonymous";e!==s&&a?(this.persistence.set_property(Ti,"identified"),this.setPersonPropertiesForFlags(ze({},n||{},r||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:r||{},$set_once:n||{}}),this.Br=XS(e,r,n),this.featureFlags.setAnonymousDistinctId(s)):(r||n)&&this.setPersonProperties(r,n),e!==s&&(this.reloadFeatureFlags(),this.unregister(Dp))}}else Le.critical('The string "'+Gu+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Le.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,r){if((e||r)&&this.hs("posthog.setPersonProperties")){var n=XS(this.get_distinct_id(),e,r);this.Br!==n?(this.setPersonPropertiesForFlags(ze({},r||{},e||{})),this.capture("$set",{$set:e||{},$set_once:r||{}}),this.Br=n):Le.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,r,n){if(e&&r){var s=this.getGroups();s[e]!==r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ze({},s,{[e]:r})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:r,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),s[e]===r||n||this.reloadFeatureFlags()}else Le.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,r){r===void 0&&(r=!0),this.featureFlags.setPersonPropertiesForFlags(e,r)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,r){r===void 0&&(r=!0),this.hs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,r)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var r,n,s,o;if(Le.info("reset"),!this.__loaded)return Le.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(r=this.persistence)==null||r.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(Ti,"anonymous"),(o=this.sessionManager)==null||o.resetSessionId(),this.Br=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Gu,$device_id:null},"");else{var l=this.config.get_device_id($o());this.register_once({distinct_id:l,$device_id:e?l:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,r;return(e=(r=this.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:r,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+r);if(e!=null&&e.withTimestamp&&n){var o,a=(o=e.timestampLookBack)!==null&&o!==void 0?o:10;if(!n)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-a,0)}return s}alias(e,r){return e===this.get_property(UA)?(Le.critical("Attempting to create alias for existing People user - aborting."),-2):this.hs("posthog.alias")?(Re(r)&&(r=this.get_distinct_id()),e!==r?(this.ds(hd,e),this.capture("$create_alias",{alias:e,distinct_id:r})):(Le.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var r=ze({},this.config);if(Hr(e)){var n,s,o,a,l,c,u;vr(this.config,hN(e));var d=this.Vr();(n=this.persistence)==null||n.update_config(this.config,r,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Xx(ze({},this.config,{persistence:"sessionStorage"}),d);var h=this.qr(this.config.debug);zi(h)&&(this.config.debug=h),zi(this.config.debug)&&(this.config.debug?(Pi.DEBUG=!0,nr.H()&&nr.G("ph_debug","true"),Le.info("set_config",{config:e,oldConfig:r,newConfig:ze({},this.config)})):(Pi.DEBUG=!1,nr.H()&&nr.V("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this.vs(),(u=this.externalIntegrations)==null||u.startIfEnabledOrStop()}}startSessionRecording(e){var r=e===!0,n={sampling:r||!(e==null||!e.sampling),linked_flag:r||!(e==null||!e.linked_flag),url_trigger:r||!(e==null||!e.url_trigger),event_trigger:r||!(e==null||!e.event_trigger)};if(Object.values(n).some(Boolean)){var s,o,a,l,c;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),n.sampling&&((o=this.sessionRecording)==null||o.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),n.url_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("url")),n.event_trigger&&((c=this.sessionRecording)==null||c.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,r){var n=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(ze({},s,r))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var r;return(r=this.persistence)==null?void 0:r.props[e]}getSessionProperty(e){var r;return(r=this.sessionPersistence)==null?void 0:r.props[e]}toString(){var e,r=(e=this.config.name)!==null&&e!==void 0?e:Kl;return r!==Kl&&(r=Kl+"."+r),r}_isIdentified(){var e,r;return((e=this.persistence)==null?void 0:e.get_property(Ti))==="identified"||((r=this.sessionPersistence)==null?void 0:r.get_property(Ti))==="identified"}us(){var e,r;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&cc(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[hd])&&((r=this.persistence)==null||(r=r.props)==null||!r[Lp]))}ns(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.us()||this.hs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}hs(e){return this.config.person_profiles==="never"?(Le.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.ds(Lp,!0),!0)}Vr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),r=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!r}vs(){var e,r,n,s,o=this.Vr();return((e=this.persistence)==null?void 0:e.xi)!==o&&((n=this.persistence)==null||n.set_disabled(o)),((r=this.sessionPersistence)==null?void 0:r.xi)!==o&&((s=this.sessionPersistence)==null||s.set_disabled(o)),o}opt_in_capturing(e){var r;if(this.config.cookieless_mode!=="always"){var n,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),this.sessionManager=new lN(this),this.persistence&&(this.sessionPropsManager=new aN(this,this.sessionManager,this.persistence)),this.sessionRecording=new uN(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.vs(),this.rs(),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(Re(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((s=e==null?void 0:e.captureEventName)!==null&&s!==void 0?s:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.ss()}
593else Le.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,r;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.vs(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:Gu,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.ss())):Le.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}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===Ai.GRANTED?"granted":e===Ai.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.vs()}_is_bot(){return Zn?SR(Zn,this.config.custom_blocked_useragents):void 0}ss(){De&&(De.visibilityState==="visible"?this.Ur||(this.Ur=!0,this.capture("$pageview",{title:De.title},{send_instantly:!0}),this.zr&&(De.removeEventListener("visibilitychange",this.zr),this.zr=null)):this.zr||(this.zr=this.ss.bind(this),Pr(De,"visibilitychange",this.zr)))}debug(e){e===!1?(ue==null||ue.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(ue==null||ue.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}))}O(){var e,r,n,s,o,a,l,c=this.Wr||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Le.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",s=!1,o=Le,a=(r="advanced_disable_flags")in(e=c)&&!Re(e[r]),l=n in e&&!Re(e[n]),a?e[r]:l?(o&&o.warn("Config field '"+n+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),e[n]):s)}ls(e){if(Tt(this.config.before_send))return e;var r=At(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var s of r){if(n=s(n),Tt(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return g7(e.event)?Le.warn(o+". This can cause unexpected behavior."):Le.info(o),null}n.properties&&!cc(n.properties)||Le.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var e;return(e=this.pageViewManager.Kt)==null?void 0:e.pageViewId}captureTraceFeedback(e,r){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:r})}captureTraceMetric(e,r,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:r,$ai_metric_value:String(n)})}qr(e){var r=zi(e)&&!e,n=nr.H()&&nr.q("ph_debug")==="true";return!r&&(!!n||e)}}(function(t,e){for(var r=0;r<e.length;r++)t.prototype[e[r]]=X7(t.prototype[e[r]])})(ev,["identify"]);var fN,Bm=(fN=$d[Kl]=new ev,function(){function t(){t.done||(t.done=!0,NR=!1,zt($d,function(e){e._dom_loaded()}))}De!=null&&De.addEventListener?De.readyState==="complete"?t():Pr(De,"DOMContentLoaded",t,{capture:!1}):ue&&Le.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),fN);const Ew="phc_MJrJ7dn7T1yyqDYhCbiyxxyS1plGme1gDdD7GoHr7tl",mN="https://us.i.posthog.com";console.log("[PostHog] Environment check:",{hasKey:!!Ew,keyPrefix:Ew.substring(0,10)+"..."});function CG({children:t}){const{user:e,profile:r}=$t(),{plan:n,source:s,billingInterval:o,creditsRemaining:a,loading:l}=nn();return g.useEffect(()=>{console.log("[PostHog] Initializing with host:",mN),Bm.init(Ew,{api_host:mN,person_profiles:"identified_only",capture_pageview:!0,capture_pageleave:!0,autocapture:!0,disable_surveys:!0,loaded:c=>{console.log("[PostHog] Successfully loaded, distinct_id:",c.get_distinct_id())}})},[]),g.useEffect(()=>{if(e){if(l)return;const c=n!=="free";Bm.identify(e.id,{email:e.email,display_name:r==null?void 0:r.display_name,is_premium:c,plan:n,plan_source:s,billing_interval:o,credits_remaining:a,theme_generations_count:r==null?void 0:r.theme_generations_count})}else Bm.reset()},[e,r,n,s,o,a,l]),i.jsx(i.Fragment,{children:t})}const tv=du("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Y=g.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...s},o)=>{const a=n?PF:"button";return i.jsx(a,{className:Se(tv({variant:e,size:r,className:t})),ref:o,...s})});Y.displayName="Button";function EG(){const t=Zt(),{user:e}=$t(),{creditsRemaining:r,loading:n}=nn();if(!e||n||r===null||r>=5)return null;const s=r===0,o=s?"border-destructive/30":"border-amber-500/30",a=s?"bg-destructive/10":"bg-amber-500/10",l=s?"bg-destructive/20":"bg-
593amber-500/20",c=s?"text-destructive":"text-amber-600 dark:text-amber-400",u=s?"text-destructive dark:text-red-400":"text-amber-800 dark:text-amber-200",d=s?"text-destructive/80 dark:text-red-300/80":"text-amber-700/80 dark:text-amber-300/80";return i.jsx("div",{className:`border-b ${o} ${a}`,children:i.jsx("div",{className:"container mx-auto px-4 py-3",children:i.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`p-1.5 rounded-full ${l} shrink-0`,children:i.jsx(li,{className:`h-4 w-4 ${c}`})}),i.jsxs("div",{children:[i.jsx("p",{className:`font-medium ${u}`,children:"Add credits to continue designing and editing themes."}),i.jsxs("p",{className:`text-sm ${d} mt-1`,children:["You have ",r.toFixed(2)," credit",r!==1?"s":""," remaining."]})]})]}),i.jsx("div",{className:"flex gap-2 shrink-0 w-full sm:w-auto justify-center sm:justify-start",children:i.jsxs(Y,{onClick:()=>t("/pricing"),size:"sm",className:"bg-primary hover:bg-primary/90",children:[i.jsx(St,{className:"h-4 w-4 mr-2"}),"View Plans"]})})]})})})}function PG(){const{user:t}=$t();return g.useEffect(()=>{var n;if(!t){if(window.Tawk_API&&typeof window.Tawk_API.hideWidget=="function")try{window.Tawk_API.hideWidget()}catch{}return}if(document.getElementById("tawk-to-script")){if(window.Tawk_API&&typeof window.Tawk_API.showWidget=="function")try{window.Tawk_API.showWidget()}catch{}return}window.Tawk_API=window.Tawk_API||{},window.Tawk_LoadStart=new Date;const e=document.createElement("script");e.id="tawk-to-script",e.async=!0,e.src="https://embed.tawk.to/69b011d4f802ed1c36f7b2cd/1jjbsb99t",e.charset="UTF-8",e.setAttribute("crossorigin","*");const r=document.getElementsByTagName("script")[0];(n=r==null?void 0:r.parentNode)==null||n.insertBefore(e,r)},[t]),null}const TG=du("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function rt({className:t,variant:e,...r}){return i.jsx("div",{className:Se(TG({variant:e}),t),...r})}var AG=g.createContext(void 0);function fa(t){const e=g.useContext(AG);return t||e||"ltr"}var ry=0;function rv(){g.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??pN()),document.body.insertAdjacentElement("beforeend",t[1]??pN()),ry++,()=>{ry===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),ry--}},[])}function pN(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var ny="focusScope.autoFocusOnMount",sy="focusScope.autoFocusOnUnmount",gN={bubbles:!1,cancelable:!0},RG="FocusScope",tf=g.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=t,[l,c]=g.useState(null),u=yr(s),d=yr(o),h=g.useRef(null),m=Ge(e,p=>c(p)),f=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(n){let p=function(w){if(f.paused||!l)return;const j=w.target;l.contains(j)?h.current=j:bo(h.current,{select:!0})},b=function(w){if(f.paused||!l)return;const j=w.relatedTarget;j!==null&&(l.contains(j)||bo(h.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const _ of w)_.removedNodes.length>0&&bo(l)};document.addEventListener("focusin",p),document.addEventListener("focusout",b);const y=new MutationObserver(x);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",b),y.disconnect()}}},[n,l,f.paused]),g.useEffect(()=>{if(l){xN.add(f);const p=document.activeElement;if(!l.contains(p)){const x=new CustomEvent(ny,gN);l.addEventListener(ny,u),l.dispatchEvent(x),x.defaultPrevented||(IG(FG(CR(l)),{select:!0}),document.activeElement===p&&bo(l))}return()=>{l.removeEventListener(ny,u),setTimeout(()=>{const x=new CustomEvent(sy,gN);l.addEventListener(sy,d),l.dispatchEvent(x),x.defaultPrevented||bo(p??document.body,{select:!0}),l.removeEventListener(sy,d),xN.remove(f)},0)}}},[l,u,d,f]);const v=g.useCallback(p=>{if(!r&&!n||f.paused)return;const b=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,x=document.activeElement;if(b&&x){const y=p.currentTarget,[w,j]=OG(y);w&&j?!p.shiftKey&&x===j?(p.preventDefault(),r&&bo(w,{select:!0}
vendor: 5,392 bytes, line 593
593)):p.shiftKey&&x===w&&(p.preventDefault(),r&&bo(j,{select:!0})):x===y&&p.preventDefault()}},[r,n,f.paused]);return i.jsx(Me.div,{tabIndex:-1,...a,ref:m,onKeyDown:v})});tf.displayName=RG;function IG(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(bo(n,{select:e}),document.activeElement!==r)return}function OG(t){const e=CR(t),r=vN(e,t),n=vN(e.reverse(),t);return[r,n]}function CR(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function vN(t,e){for(const r of t)if(!MG(r,{upTo:e}))return r}function MG(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function $G(t){return t instanceof HTMLInputElement&&"select"in t}function bo(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&$G(t)&&e&&t.select()}}var xN=DG();function DG(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=yN(t,e),t.unshift(e)},remove(e){var r;t=yN(t,e),(r=t[0])==null||r.resume()}}}function yN(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function FG(t){return t.filter(e=>e.tagName!=="A")}var iy="rovingFocusGroup.onEntryFocus",LG={bubbles:!1,cancelable:!0},rf="RovingFocusGroup",[Pw,ER,BG]=cu(rf),[zG,bu]=_r(rf,[BG]),[UG,WG]=zG(rf),PR=g.forwardRef((t,e)=>i.jsx(Pw.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(Pw.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(HG,{...t,ref:e})})}));PR.displayName=rf;var HG=g.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=t,m=g.useRef(null),f=Ge(e,m),v=fa(o),[p,b]=rn({prop:a,defaultProp:l??null,onChange:c,caller:rf}),[x,y]=g.useState(!1),w=yr(u),j=ER(r),_=g.useRef(!1),[S,N]=g.useState(0);return g.useEffect(()=>{const P=m.current;if(P)return P.addEventListener(iy,w),()=>P.removeEventListener(iy,w)},[w]),i.jsx(UG,{scope:r,orientation:n,dir:v,loop:s,currentTabStopId:p,onItemFocus:g.useCallback(P=>b(P),[b]),onItemShiftTab:g.useCallback(()=>y(!0),[]),onFocusableItemAdd:g.useCallback(()=>N(P=>P+1),[]),onFocusableItemRemove:g.useCallback(()=>N(P=>P-1),[]),children:i.jsx(Me.div,{tabIndex:x||S===0?-1:0,"data-orientation":n,...h,ref:f,style:{outline:"none",...t.style},onMouseDown:je(t.onMouseDown,()=>{_.current=!0}),onFocus:je(t.onFocus,P=>{const C=!_.current;if(P.target===P.currentTarget&&C&&!x){const O=new CustomEvent(iy,LG);if(P.currentTarget.dispatchEvent(O),!O.defaultPrevented){const F=j().filter(K=>K.focusable),T=F.find(K=>K.active),A=F.find(K=>K.id===p),$=[T,A,...F].filter(Boolean).map(K=>K.ref.current);RR($,d)}}_.current=!1}),onBlur:je(t.onBlur,()=>y(!1))})})}),TR="RovingFocusGroupItem",AR=g.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:o,children:a,...l}=t,c=zn(),u=o||c,d=WG(TR,r),h=d.currentTabStopId===u,m=ER(r),{onFocusableItemAdd:f,onFocusableItemRemove:v,currentTabStopId:p}=d;return g.useEffect(()=>{if(n)return f(),()=>v()},[n,f,v]),i.jsx(Pw.ItemSlot,{scope:r,id:u,focusable:n,active:s,children:i.jsx(Me.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:e,onMouseDown:je(t.onMouseDown,b=>{n?d.onItemFocus(u):b.preventDefault()}),onFocus:je(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:je(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){d.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const x=VG(b,d.orientation,d.dir);if(x!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let w=m().filter(j=>j.focusable).map(j=>j.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const j=w.indexOf(b.currentTarget);w=d.loop?KG(w,j+1):w.slice(j+1)}setTimeout(()=>RR(w))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:p!=null}):a})})});AR.displayName=TR;var GG={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qG(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function VG(t,e,r){const n=qG(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return GG[n]}function RR(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function KG(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var W_=PR,H_=AR,YG=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Fl=new WeakMap,im=new WeakMap,om={},oy=0,IR=function(t){return t&&(t.host||IR(t.parentNode))},QG=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=IR(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},JG=function(t,e,r,n){var s=QG(e,Array.isArray(t)?t:[t]);om[r]||(om[r]=new WeakMap);var o=om[r],a=[],l=new Set,c=new Set(s),u=function(h){!h||l.has(h
vendor: 4,220 bytes, line 593
593)||(l.add(h),u(h.parentNode))};s.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(l.has(m))d(m);else try{var f=m.getAttribute(n),v=f!==null&&f!=="false",p=(Fl.get(m)||0)+1,b=(o.get(m)||0)+1;Fl.set(m,p),o.set(m,b),a.push(m),p===1&&v&&im.set(m,!0),b===1&&m.setAttribute(r,"true"),v||m.setAttribute(n,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return d(e),l.clear(),oy++,function(){a.forEach(function(h){var m=Fl.get(h)-1,f=o.get(h)-1;Fl.set(h,m),o.set(h,f),m||(im.has(h)||h.removeAttribute(n),im.delete(h)),f||h.removeAttribute(r)}),oy--,oy||(Fl=new WeakMap,Fl=new WeakMap,im=new WeakMap,om={})}},nv=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=YG(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),JG(n,s,r,"aria-hidden")):function(){return null}},zm="right-scroll-bar-position",Um="width-before-scroll-bar",XG="with-scroll-bars-hidden",ZG="--removed-body-scroll-bar-size";function ay(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function eq(t,e){var r=g.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=e,r.facade}var tq=typeof window<"u"?g.useLayoutEffect:g.useEffect,bN=new WeakMap;function rq(t,e){var r=eq(null,function(n){return t.forEach(function(s){return ay(s,n)})});return tq(function(){var n=bN.get(r);if(n){var s=new Set(n),o=new Set(t),a=r.current;s.forEach(function(l){o.has(l)||ay(l,null)}),o.forEach(function(l){s.has(l)||ay(l,a)})}bN.set(r,t)},[t]),r}function nq(t){return t}function sq(t,e){e===void 0&&(e=nq);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(o){var a=e(o,n);return r.push(a),function(){r=r.filter(function(l){return l!==a})}},assignSyncMedium:function(o){for(n=!0;r.length;){var a=r;r=[],a.forEach(o)}r={push:function(l){return o(l)},filter:function(){return r}}},assignMedium:function(o){n=!0;var a=[];if(r.length){var l=r;r=[],l.forEach(o),a=r}var c=function(){var d=a;a=[],d.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),r}}}};return s}function iq(t){t===void 0&&(t={});var e=sq(null);return e.options=ci({async:!0,ssr:!1},t),e}var OR=function(t){var e=t.sideCar,r=vu(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return g.createElement(n,ci({},r))};OR.isSideCarExport=!0;function oq(t,e){return t.useMedium(e),OR}var MR=iq(),ly=function(){},sv=g.forwardRef(function(t,e){var r=g.useRef(null),n=g.useState({onScrollCapture:ly,onWheelCapture:ly,onTouchMoveCapture:ly}),s=n[0],o=n[1],a=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,h=t.shards,m=t.sideCar,f=t.noRelative,v=t.noIsolation,p=t.inert,b=t.allowPinchZoom,x=t.as,y=x===void 0?"div":x,w=t.gapMode,j=vu(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=m,S=rq([r,e]),N=ci(ci({},j),s);return g.createElement(g.Fragment,null,d&&g.createElement(_,{sideCar:MR,removeScrollBar:u,shards:h,noRelative:f,noIsolation:v,inert:p,setCallbacks:o,allowPinchZoom:!!b,lockRef:r,gapMode:w}),a?g.cloneElement(g.Children.only(l),ci(ci({},N),{ref:S})):g.createElement(y,ci({},N,{className:c,ref:S}),l))});sv.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};sv.classNames={fullWidth:Um,zeroRight:zm};var aq=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function lq(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=aq();return e&&t.setAttribute("nonce",e),t}function cq(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function uq(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var dq=function(){var t=0,e=null;
vendor: 4,547 bytes, lines 593-633
593return{add:function(r){t==0&&(e=lq())&&(cq(e,r),uq(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},hq=function(){var t=dq();return function(e,r){g.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},$R=function(){var t=hq(),e=function(r){var n=r.styles,s=r.dynamic;return t(n,s),null};return e},fq={left:0,top:0,right:0,gap:0},cy=function(t){return parseInt(t||"",10)||0},mq=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[cy(r),cy(n),cy(s)]},pq=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return fq;var e=mq(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},gq=$R(),Sc="data-scroll-locked",vq=function(t,e,r,n){var s=t.left,o=t.top,a=t.right,l=t.gap;return r===void 0&&(r="margin"),`
594  .`.concat(XG,` {
595   overflow: hidden `).concat(n,`;
596   padding-right: `).concat(l,"px ").concat(n,`;
597  }
598  body[`).concat(Sc,`] {
599    overflow: hidden `).concat(n,`;
600    overscroll-behavior: contain;
601    `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
602    padding-left: `.concat(s,`px;
603    padding-top: `).concat(o,`px;
604    padding-right: `).concat(a,`px;
605    margin-left:0;
606    margin-top:0;
607    margin-right: `).concat(l,"px ").concat(n,`;
608    `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
609  }
610  
611  .`).concat(zm,` {
612    right: `).concat(l,"px ").concat(n,`;
613  }
614  
615  .`).concat(Um,` {
616    margin-right: `).concat(l,"px ").concat(n,`;
617  }
618  
619  .`).concat(zm," .").concat(zm,` {
620    right: 0 `).concat(n,`;
621  }
622  
623  .`).concat(Um," .").concat(Um,` {
624    margin-right: 0 `).concat(n,`;
625  }
626  
627  body[`).concat(Sc,`] {
628    `).concat(ZG,": ").concat(l,`px;
629  }
630`)},wN=function(){var t=parseInt(document.body.getAttribute(Sc)||"0",10);return isFinite(t)?t:0},xq=function(){g.useEffect(function(){return document.body.setAttribute(Sc,(wN()+1).toString()),function(){var t=wN()-1;t<=0?document.body.removeAttribute(Sc):document.body.setAttribute(Sc,t.toString())}},[])},yq=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,s=n===void 0?"margin":n;xq();var o=g.useMemo(function(){return pq(s)},[s]);return g.createElement(gq,{styles:vq(o,!e,s,r?"":"!important")})},Tw=!1;if(typeof window<"u")try{var am=Object.defineProperty({},"passive",{get:function(){return Tw=!0,!0}});window.addEventListener("test",am,am),window.removeEventListener("test",am,am)}catch{Tw=!1}var Ll=Tw?{passive:!1}:!1,bq=function(t){return t.tagName==="TEXTAREA"},DR=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!bq(t)&&r[e]==="visible")},wq=function(t){return DR(t,"overflowY")},_q=function(t){return DR(t,"overflowX")},_N=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=FR(t,n);if(s){var o=LR(t,n),a=o[1],l=o[2];if(a>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},jq=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},kq=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},FR=function(t,e){return t==="v"?wq(e):_q(e)},LR=function(t,e){return t==="v"?jq(e):kq(e)},Sq=function(t,e){return t==="h"&&e==="rtl"?-1:1},Nq=function(t,e,r,n,s){var o=Sq(t,window.getComputedStyle(e).direction),a=o*n,l=r.target,c=e.contains(l),u=!1,d=a>0,h=0,m=0;do{if(!l)break;var f=LR(t,l),v=f[0],p=f[1],b=f[2],x=p-b-o*v;(v||x)&&FR(t,l)&&(h+=x,m+=v);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&(Math.abs(h)<1||!s)||!d&&(Math.abs(m)<1||!s))&&(u=!0),u},lm=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},jN=function(t){return[t.deltaX,t.deltaY]},kN=function(t){return t&&"current"in t?t.current:t},Cq=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Eq=function(t){return`
631  .block-interactivity-`.concat(t,` {pointer-events: none;}
632  .allow-interactivity-`).concat(t,` {pointer-events: all;}
633`)},Pq=0,Bl=[];function Tq(t){var e=g.useRef([]),r=g.useRef([0,0]),n=g.useRef(),s=g.useState(Pq++)[0],o=g.useState($R)[0],a=g.useRef(t);g.useEffect(function(){a.current=t},[t]),g.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));
vendor: 20,615 bytes, line 633
633var p=yU([t.lockRef.current],(t.shards||[]).map(kN),!0).filter(Boolean);return p.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=g.useCallback(function(p,b){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!a.current.allowPinchZoom;var x=lm(p),y=r.current,w="deltaX"in p?p.deltaX:y[0]-x[0],j="deltaY"in p?p.deltaY:y[1]-x[1],_,S=p.target,N=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in p&&N==="h"&&S.type==="range")return!1;var P=_N(N,S);if(!P)return!0;if(P?_=N:(_=N==="v"?"h":"v",P=_N(N,S)),!P)return!1;if(!n.current&&"changedTouches"in p&&(w||j)&&(n.current=_),!_)return!0;var C=n.current||_;return Nq(C,b,p,C==="h"?w:j,!0)},[]),c=g.useCallback(function(p){var b=p;if(!(!Bl.length||Bl[Bl.length-1]!==o)){var x="deltaY"in b?jN(b):lm(b),y=e.current.filter(function(_){return _.name===b.type&&(_.target===b.target||b.target===_.shadowParent)&&Cq(_.delta,x)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var w=(a.current.shards||[]).map(kN).filter(Boolean).filter(function(_){return _.contains(b.target)}),j=w.length>0?l(b,w[0]):!a.current.noIsolation;j&&b.cancelable&&b.preventDefault()}}},[]),u=g.useCallback(function(p,b,x,y){var w={name:p,delta:b,target:x,should:y,shadowParent:Aq(x)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(j){return j!==w})},1)},[]),d=g.useCallback(function(p){r.current=lm(p),n.current=void 0},[]),h=g.useCallback(function(p){u(p.type,jN(p),p.target,l(p,t.lockRef.current))},[]),m=g.useCallback(function(p){u(p.type,lm(p),p.target,l(p,t.lockRef.current))},[]);g.useEffect(function(){return Bl.push(o),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Ll),document.addEventListener("touchmove",c,Ll),document.addEventListener("touchstart",d,Ll),function(){Bl=Bl.filter(function(p){return p!==o}),document.removeEventListener("wheel",c,Ll),document.removeEventListener("touchmove",c,Ll),document.removeEventListener("touchstart",d,Ll)}},[]);var f=t.removeScrollBar,v=t.inert;return g.createElement(g.Fragment,null,v?g.createElement(o,{styles:Eq(s)}):null,f?g.createElement(yq,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Aq(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Rq=oq(MR,Tq);var nf=g.forwardRef(function(t,e){return g.createElement(sv,ci({},t,{ref:e,sideCar:Rq}))});nf.classNames=sv.classNames;var Aw=["Enter"," "],Iq=["ArrowDown","PageUp","Home"],BR=["ArrowUp","PageDown","End"],Oq=[...Iq,...BR],Mq={ltr:[...Aw,"ArrowRight"],rtl:[...Aw,"ArrowLeft"]},$q={ltr:["ArrowLeft"],rtl:["ArrowRight"]},sf="Menu",[Sh,Dq,Fq]=cu(sf),[vl,zR]=_r(sf,[Fq,da,bu]),iv=da(),UR=bu(),[Lq,xl]=vl(sf),[Bq,of]=vl(sf),WR=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:s,onOpenChange:o,modal:a=!0}=t,l=iv(e),[c,u]=g.useState(null),d=g.useRef(!1),h=yr(o),m=fa(s);return g.useEffect(()=>{const f=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),i.jsx(Bg,{...l,children:i.jsx(Lq,{scope:e,open:r,onOpenChange:h,content:c,onContentChange:u,children:i.jsx(Bq,{scope:e,onClose:g.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:m,modal:a,children:n})})})};WR.displayName=sf;var zq="MenuAnchor",G_=g.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=iv(r);return i.jsx(Yh,{...s,...n,ref:e})});G_.displayName=zq;var q_="MenuPortal",[Uq,HR]=vl(q_,{forceMount:void 0}),GR=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:s}=t,o=xl(q_,e);return i.jsx(Uq,{scope:e,forceMount:r,children:i.jsx(Tr,{present:r||o.open,children:i.jsx(uu,{asChild:!0,container:s,children:n})})})};GR.displayName=q_;var gs="MenuContent",[Wq,V_]=vl(gs),qR=g.forwardRef((t,e)=>{const r=HR(gs,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,o=xl(gs,t.__scopeMenu),a=of(gs,t.__scopeMenu);return i.jsx(Sh.Provider,{scope:t.__scopeMenu,children:i.jsx(Tr,{present:n||o.open,children:i.jsx(Sh.Slot,{scope:t.__scopeMenu,children:a.modal?i.jsx(Hq,{...s,ref:e}):i.jsx(Gq,{...s,ref:e})})})})}),Hq=g.forwardRef((t,e)=>{const r=xl(gs,t.__scopeMenu),n=g.useRef(null),s=Ge(e,n);return g.useEffect(()=>{const o=n.current;if(o)return nv(o)},[]),i.jsx(K_,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:je(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Gq=g.forwardRef((t,e)=>{const r=xl(gs,t.__scopeMenu);return i.jsx(K_,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),qq=ea("MenuContent.ScrollLock"),K_=g.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:f,disableOutsideScroll:v,...p}=t,b=xl(gs,r),x=of(gs,r),y=iv(r),w=UR(r),j=Dq(r),[_,S]=g.useState(null),N=g.useRef(null),P=Ge(e,N,b.onContentChange),C=g.useRef(0),O=g.useRef(""),F=g.useRef(0),T=g.useRef(null),A=g.useRef("right"),k=g.useRef(0),$=v?nf:g.Fragment,K=v?{as:qq,allowPinchZoom:!0}:void 0,H=R=>{var X,J;const G=O.current+R,U=j().filter(de=>!de.disabled),z=document.activeElement,oe=(X=U.find(de=>de.ref.current===z))==null?void 0:X.textValue,L=U.map(de=>de.textValue),q=sV(L,G,oe),he=(J=U.find(de=>de.textValue===q))==null?void 0:J.ref.current;(function de(le){O.current=le,window.clearTimeout(C.current),le!==""&&(C.current=window.setTimeout(()=>de(""),1e3))})(G),he&&setTimeout(()=>he.focus())};g.useEffect(()=>()=>window.clearTimeout(C.current),[]),rv();const W=g.useCallback(R=>{var U,z;return A.current===((U=T.current)==null?void 0:U.side)&&oV(R,(z=T.current)==null?void 0:z.area)},[]);return i.jsx(Wq,{scope:r,searchRef:O,onItemEnter:g.useCallback(R=>{W(R)&&R.preventDefault()},[W]),onItemLeave:g.useCallback(R=>{var G;W(R)||((G=N.current)==null||G.focus(),S(null))},[W]),onTriggerLeave:g.useCallback(R=>{W(R)&&R.preventDefault()},[W]),pointerGraceTimerRef:F,onPointerGraceIntentChange:g.useCallback(R=>{T.current=R},[]),children:i.jsx($,{...K,children:i.jsx(tf,{asChild:!0,trapped:s,onMountAutoFocus:je(o,R=>{var G;R.preventDefault(),(G=N.current)==null||G.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:i.jsx(pl,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:f,children:i.jsx(W_,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:_,onCurrentTabStopIdChange:S,onEntryFocus:je(c,R=>{x.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(zg,{role:"menu","aria-orientation":"vertical","data-state":lI(b.open),"data-radix-menu-content":"",dir:x.dir,...y,...p,ref:P,style:{outline:"none",...p.style},onKeyDown:je(p.onKeyDown,R=>{const U=R.target.closest("[data-radix-menu-content]")===R.currentTarget,z=R.ctrlKey||R.altKey||R.metaKey,oe=R.key.length===1;U&&(R.key==="Tab"&&R.preventDefault(),!z&&oe&&H(R.key));const L=N.current;if(R.target!==L||!Oq.includes(R.key))return;R.preventDefault();const he=j().filter(X=>!X.disabled).map(X=>X.ref.current);BR.includes(R.key)&&he.reverse(),rV(he)}),onBlur:je(t.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(C.current),O.current="")}),onPointerMove:je(t.onPointerMove,Nh(R=>{const G=R.target,U=k.current!==R.clientX;if(R.currentTarget.contains(G)&&U){const z=R.clientX>k.current?"right":"left";A.current=z,k.current=R.clientX}}))})})})})})})});qR.displayName=gs;var Vq="MenuGroup",Y_=g.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return i.jsx(Me.div,{role:"group",...n,ref:e})});Y_.displayName=Vq;var Kq="MenuLabel",VR=g.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return i.jsx(Me.div,{...n,ref:e})});VR.displayName=Kq;var Kp="MenuItem",SN="menu.itemSelect",ov=g.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...s}=t,o=g.useRef(null),a=of(Kp,t.__scopeMenu),l=V_(Kp,t.__scopeMenu),c=Ge(e,o),u=g.useRef(!1),d=()=>{const h=o.current;if(!r&&h){const m=new CustomEvent(SN,{bubbles:!0,cancelable:!0});h.addEventListener(SN,f=>n==null?void 0:n(f),{once:!0}),J0(h,m),m.defaultPrevented?u.current=!1:a.onClose()}};return i.jsx(KR,{...s,ref:c,disabled:r,onClick:je(t.onClick,d),onPointerDown:h=>{var m;(m=t.onPointerDown)==null||m.call(t,h),u.current=!0},onPointerUp:je(t.onPointerUp,h=>{var m;u.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:je(t.onKeyDown,h=>{const m=l.searchRef.current!=="";r||m&&h.key===" "||Aw.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});ov.displayName=Kp;var KR=g.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=t,a=V_(Kp,r),l=UR(r),c=g.useRef(null),u=Ge(e,c),[d,h]=g.useState(!1),[m,f]=g.useState("");return g.useEffect(()=>{const v=c.current;v&&f((v.textContent??"").trim())},[o.children]),i.jsx(Sh.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:i.jsx(H_,{asChild:!0,...l,focusable:!n,children:i.jsx(Me.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:je(t.onPointerMove,Nh(v=>{n?a.onItemLeave(v):(a.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:je(t.onPointerLeave,Nh(v=>a.onItemLeave(v))),onFocus:je(t.onFocus,()=>h(!0)),onBlur:je(t.onBlur,()=>h(!1))})})})}),Yq="MenuCheckboxItem",YR=g.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...s}=t;return i.jsx(eI,{scope:t.__scopeMenu,checked:r,children:i.jsx(ov,{role:"menuitemcheckbox","aria-checked":Yp(r)?"mixed":r,...s,ref:e,"data-state":J_(r),onSelect:je(s.onSelect,()=>n==null?void 0:n(Yp(r)?!0:!r),{checkForDefaultPrevented:!1})})})});YR.displayName=Yq;var QR="MenuRadioGroup",[Qq,Jq]=vl(QR,{value:void 0,onValueChange:()=>{}}),JR=g.forwardRef((t,e)=>{const{value:r,onValueChange:n,...s}=t,o=yr(n);return i.jsx(Qq,{scope:t.__scopeMenu,value:r,onValueChange:o,children:i.jsx(Y_,{...s,ref:e})})});JR.displayName=QR;var XR="MenuRadioItem",ZR=g.forwardRef((t,e)=>{const{value:r,...n}=t,s=Jq(XR,t.__scopeMenu),o=r===s.value;return i.jsx(eI,{scope:t.__scopeMenu,checked:o,children:i.jsx(ov,{role:"menuitemradio","aria-checked":o,...n,ref:e,"data-state":J_(o),onSelect:je(n.onSelect,()=>{var a;return(a=s.onValueChange)==null?void 0:a.call(s,r)},{checkForDefaultPrevented:!1})})})});ZR.displayName=XR;var Q_="MenuItemIndicator",[eI,Xq]=vl(Q_,{checked:!1}),tI=g.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...s}=t,o=Xq(Q_,r);return i.jsx(Tr,{present:n||Yp(o.checked)||o.checked===!0,children:i.jsx(Me.span,{...s,ref:e,"data-state":J_(o.checked)})})});tI.displayName=Q_;var Zq="MenuSeparator",rI=g.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return i.jsx(Me.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});rI.displayName=Zq;var eV="MenuArrow",nI=g.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=iv(r);return i.jsx(Ug,{...s,...n,ref:e})});nI.displayName=eV;var tV="MenuSub",[fse,sI]=vl(tV),xd="MenuSubTrigger",iI=g.forwardRef((t,e)=>{const r=xl(xd,t.__scopeMenu),n=of(xd,t.__scopeMenu),s=sI(xd,t.__scopeMenu),o=V_(xd,t.__scopeMenu),a=g.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,u={__scopeMenu:t.__scopeMenu},d=g.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return g.useEffect(()=>d,[d]),g.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),i.jsx(G_,{asChild:!0,...u,children:i.jsx(KR,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":lI(r.open),...t,ref:Rg(e,s.onTriggerChange),onClick:h=>{var m;(m=t.onClick)==null||m.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:je(t.onPointerMove,Nh(h=>{o.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!r.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:je(t.onPointerLeave,Nh(h=>{var f,v;d();const m=(f=r.content)==null?void 0:f.getBoundingClientRect();if(m){const p=(v=r.content)==null?void 0:v.dataset.side,b=p==="right",x=b?-5:5,y=m[b?"left":"right"],w=m[b?"right":"left"];o.onPointerGraceIntentChange({area:[{x:h.clientX+x,y:h.clientY},{x:y,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:y,y:m.bottom}],side:p}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(h),h.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:je(t.onKeyDown,h=>{var f;const m=o.searchRef.current!=="";t.disabled||m&&h.key===" "||Mq[n.dir].includes(h.key)&&(r.onOpenChange(!0),(f=r.content)==null||f.focus(),h.preventDefault())})})})});iI.displayName=xd;var oI="MenuSubContent",aI=g.forwardRef((t,e)=>{const r=HR(gs,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,o=xl(gs,t.__scopeMenu),a=of(gs,t.__scopeMenu),l=sI(oI,t.__scopeMenu),c=g.useRef(null),u=Ge(e,c);return i.jsx(Sh.Provider,{scope:t.__scopeMenu,children:i.jsx(Tr,{present:n||o.open,children:i.jsx(Sh.Slot,{scope:t.__scopeMenu,children:i.jsx(K_,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;a.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:je(t.onFocusOutside,d=>{d.target!==l.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:je(t.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:je(t.onKeyDown,d=>{var f;const h=d.currentTarget.contains(d.target),m=$q[a.dir].includes(d.key);h&&m&&(o.onOpenChange(!1),(f=l.trigger)==null||f.focus(),d.preventDefault())})})})})})});aI.displayName=oI;function lI(t){return t?"open":"closed"}function Yp(t){return t==="indeterminate"}function J_(t){return Yp(t)?"indeterminate":t?"checked":"unchecked"}function rV(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function nV(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function sV(t,e,r){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=r?t.indexOf(r):-1;let a=nV(t,Math.max(o,0));s.length===1&&(a=a.filter(u=>u!==r));const c=a.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function iV(t,e){const{x:r,y:n}=t;let s=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){const l=e[o],c=e[a],u=l.x,d=l.y,h=c.x,m=c.y;d>n!=m>n&&r<(h-u)*(n-d)/(m-d)+u&&(s=!s)}return s}function oV(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return iV(r,e)}function Nh(t){return e=>e.pointerType==="mouse"?t(e):void 0}var aV=WR,lV=G_,cV=GR,uV=qR,dV=Y_,hV=VR,fV=ov,mV=YR,pV=JR,gV=ZR,vV=tI,xV=rI,yV=nI,bV=iI,wV=aI,av="DropdownMenu",[_V,mse]=_r(av,[zR]),Nn=zR(),[jV,cI]=_V(av),uI=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:a,modal:l=!0}=t,c=Nn(e),u=g.useRef(null),[d,h]=rn({prop:s,defaultProp:o??!1,onChange:a,caller:av});return i.jsx(jV,{scope:e,triggerId:zn(),triggerRef:u,contentId:zn(),open:d,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(m=>!m),[h]),modal:l,children:i.jsx(aV,{...c,open:d,onOpenChange:h,dir:n,modal:l,children:r})})};uI.displayName=av;var dI="DropdownMenuTrigger",hI=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=t,o=cI(dI,r),a=Nn(r);return i.jsx(lV,{asChild:!0,...a,children:i.jsx(Me.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:Rg(e,o.triggerRef),onPointerDown:je(t.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(o.onOpenToggle(),o.open||l.preventDefault())}),onKeyDown:je(t.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&o.onOpenToggle(),l.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});hI.displayName=dI;var kV="DropdownMenuPortal",fI=t=>{const{__scopeDropdownMenu:e,...r}=t,n=Nn(e);return i.jsx(cV,{...n,...r})};fI.displayName=kV;var mI="DropdownMenuContent",pI=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=cI(mI,r),o=Nn(r),a=g.useRef(!1);return i.jsx(uV,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:e,onCloseAutoFocus:je(t.onCloseAutoFocus,l=>{var c;a.current||(c=s.triggerRef.current)==null||c.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:je(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(a.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pI.displayName=mI;var SV="DropdownMenuGroup",NV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(dV,{...s,...n,ref:e})});NV.displayName=SV;var CV="DropdownMenuLabel",gI=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(hV,{...s,...n,ref:e})});gI.displayName=CV;var EV="DropdownMenuItem",vI=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(fV,{...s,...n,ref:e})});vI.displayName=EV;var PV="DropdownMenuCheckboxItem",xI=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(mV,{...s,...n,ref:e})});xI.displayName=PV;var TV="DropdownMenuRadioGroup",AV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(pV,{...s,...n,ref:e})});AV.displayName=TV;var RV="DropdownMenuRadioItem",yI=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(gV,{...s,...n,ref:e})});yI.displayName=RV;var IV="DropdownMenuItemIndicator",bI=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(vV,{...s,...n,ref:e})});bI.displayName=IV;var OV="DropdownMenuSeparator",wI=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(xV,{...s,...n,ref:e})});wI.displayName=OV;var MV="DropdownMenuArrow",$V=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(yV,{...s,...n,ref:e})});$V.displayName=MV;var DV="DropdownMenuSubTrigger",_I=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(bV,{...s,...n,ref:e})});_I.displayName=DV;var FV="DropdownMenuSubContent",jI=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Nn(r);return i.jsx(wV,{...s,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});jI.displayName=FV;var LV=uI,BV=hI,zV=fI,kI=pI,SI=gI,NI=vI,CI=xI,EI=yI,PI=bI,TI=wI,AI=_I,RI=jI;const lv=LV,cv=BV,UV=g.forwardRef(({className:t,inset:e,children:r,...n},s)=>i.jsxs(AI,{ref:s,className:Se("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",e&&"pl-8",t),...n,children:[r,i.jsx(Gh,{className:"ml-auto h-4 w-4"})]}));UV.displayName=AI.displayName;const WV=g.forwardRef(({className:t,...e},r)=>i.jsx(RI,{ref:r,className:Se("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
633de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));WV.displayName=RI.displayName;const af=g.forwardRef(({className:t,sideOffset:e=4,...r},n)=>i.jsx(zV,{children:i.jsx(kI,{ref:n,sideOffset:e,className:Se("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));af.displayName=kI.displayName;const hs=g.forwardRef(({className:t,inset:e,...r},n)=>i.jsx(NI,{ref:n,className:Se("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e&&"pl-8",t),...r}));hs.displayName=NI.displayName;const HV=g.forwardRef(({className:t,children:e,checked:r,...n},s)=>i.jsxs(CI,{ref:s,className:Se("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),checked:r,...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(PI,{children:i.jsx(fr,{className:"h-4 w-4"})})}),e]}));HV.displayName=CI.displayName;const GV=g.forwardRef(({className:t,children:e,...r},n)=>i.jsxs(EI,{ref:n,className:Se("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...r,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(PI,{children:i.jsx(LP,{className:"h-2 w-2 fill-current"})})}),e]}));GV.displayName=EI.displayName;const qV=g.forwardRef(({className:t,inset:e,...r},n)=>i.jsx(SI,{ref:n,className:Se("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...r}));qV.displayName=SI.displayName;const Nc=g.forwardRef(({className:t,...e},r)=>i.jsx(TI,{ref:r,className:Se("-mx-1 my-1 h-px bg-muted",t),...e}));Nc.displayName=TI.displayName;var uv="Dialog",[II,OI]=_r(uv),[VV,Qs]=II(uv),MI=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,l=g.useRef(null),c=g.useRef(null),[u,d]=rn({prop:n,defaultProp:s??!1,onChange:o,caller:uv});return i.jsx(VV,{scope:e,triggerRef:l,contentRef:c,contentId:zn(),titleId:zn(),descriptionId:zn(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(h=>!h),[d]),modal:a,children:r})};MI.displayName=uv;var $I="DialogTrigger",DI=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Qs($I,r),o=Ge(e,s.triggerRef);return i.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":e1(s.open),...n,ref:o,onClick:je(t.onClick,s.onOpenToggle)})});DI.displayName=$I;var X_="DialogPortal",[KV,FI]=II(X_,{forceMount:void 0}),LI=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:s}=t,o=Qs(X_,e);return i.jsx(KV,{scope:e,forceMount:r,children:g.Children.map(n,a=>i.jsx(Tr,{present:r||o.open,children:i.jsx(uu,{asChild:!0,container:s,children:a})}))})};LI.displayName=X_;var Qp="DialogOverlay",BI=g.forwardRef((t,e)=>{const r=FI(Qp,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,o=Qs(Qp,t.__scopeDialog);return o.modal?i.jsx(Tr,{present:n||o.open,children:i.jsx(QV,{...s,ref:e})}):null});BI.displayName=Qp;var YV=ea("DialogOverlay.RemoveScroll"),QV=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Qs(Qp,r);return i.jsx(nf,{as:YV,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(Me.div,{"data-state":e1(s.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),il="DialogContent",zI=g.forwardRef((t,e)=>{const r=FI(il,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,o=Qs(il,t.__scopeDialog);return i.jsx(Tr,{present:n||o.open,children:o.modal?i.jsx(JV,{...s,ref:e}):i.jsx(XV,{...s,ref:e})})});zI.displayName=il;var JV=g.forwardRef((t,e)=>{const r=Qs(il,t.__scopeDialog),n=g.useRef(null),s=Ge(e,r.contentRef,n);return g.useEffect(()=>{const o=n.current;if(o)return nv(o)},[]),i.jsx(UI,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:je(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=r.triggerRef.current)==null||a.focus()}),onPointerDownOutside:je(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&o.preventDefault()}),onFocusOutside:je(t.onFocusOutside,o=>o.preventDefault())})}),XV=g.forwardRef((t,e)=>{const r=Qs(il,t.__scopeDialog),n=g.useRef(!1),s=g.useRef(!1);return i.jsx(UI,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,l;(a=t.onCloseAutoFocus)==null||a.call(t,o),o.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),UI=g.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...a}=t,l=Qs(il,r),c=g.useRef(null),u=Ge(e,c);return rv(),i.jsxs(i.Fragment,{children:[i.jsx(tf,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:i.jsx(pl,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":e1(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(eK,{titleId:l.titleId}),i.jsx(rK,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Z_="DialogTitle",WI=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Qs(Z_,r);return i.jsx(Me.h2,{id:s.titleId,...n,ref:e})});WI.displayName=Z_;var HI="DialogDescription",GI=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Qs(HI,r);return i.jsx(Me.p,{id:s.descriptionId,...n,ref:e})});GI.displayName=HI;var qI="DialogClose",VI=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=Qs(qI,r);return i.jsx(Me.button,{type:"button",...n,ref:e,onClick:je(t.onClick,()=>s.onOpenChange(!1))})});VI.displayName=qI;function e1(t){return t?"open":"closed"}var KI="DialogTitleWarning",[ZV,YI]=CF(KI,{contentName:il,titleName:Z_,docsSlug:"dialog"}),eK=({titleId:t})=>{const e=YI(KI),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
634
635If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
636
637For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return g.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},tK="DialogDescriptionWarning",rK=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${YI(tK).contentName}}.`;return g.useEffect(()=>{var o;const s=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},t1=MI,r1=DI,n1=LI,lf=BI,cf=zI,uf=WI,df=GI,hf=VI;const QI=t1,JI=r1,nK=n1,XI=g.forwardRef(({className:t,...e},r)=>i.jsx(lf,{className:Se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));XI.displayName=lf.displayName;const sK=du("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4  border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),s1=g.forwardRef(({side:t="right",className:e,children:r,...n},s)=>i.jsxs(nK,{children:[i.jsx(XI,{}),i.jsxs(cf,{ref:s,className:Se(sK({side:t}),e),...n,children:[r,i.jsxs(hf,{className:"absolute right-4 top-4 roun
637ded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(Bn,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));s1.displayName=cf.displayName;const ZI=({className:t,...e})=>i.jsx("div",{className:Se("flex flex-col space-y-2 text-center sm:text-left",t),...e});ZI.displayName="SheetHeader";const e4=g.forwardRef(({className:t,...e},r)=>i.jsx(uf,{ref:r,className:Se("text-lg font-semibold text-foreground",t),...e}));e4.displayName=uf.displayName;const iK=g.forwardRef(({className:t,...e},r)=>i.jsx(df,{ref:r,className:Se("text-sm text-muted-foreground",t),...e}));iK.displayName=df.displayName;var dv="Popover",[t4,pse]=_r(dv,[da]),ff=da(),[oK,ma]=t4(dv),r4=t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:a=!1}=t,l=ff(e),c=g.useRef(null),[u,d]=g.useState(!1),[h,m]=rn({prop:n,defaultProp:s??!1,onChange:o,caller:dv});return i.jsx(Bg,{...l,children:i.jsx(oK,{scope:e,contentId:zn(),triggerRef:c,open:h,onOpenChange:m,onOpenToggle:g.useCallback(()=>m(f=>!f),[m]),hasCustomAnchor:u,onCustomAnchorAdd:g.useCallback(()=>d(!0),[]),onCustomAnchorRemove:g.useCallback(()=>d(!1),[]),modal:a,children:r})})};r4.displayName=dv;var n4="PopoverAnchor",aK=g.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=ma(n4,r),o=ff(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=s;return g.useEffect(()=>(a(),()=>l()),[a,l]),i.jsx(Yh,{...o,...n,ref:e})});aK.displayName=n4;var s4="PopoverTrigger",i4=g.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=ma(s4,r),o=ff(r),a=Ge(e,s.triggerRef),l=i.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":u4(s.open),...n,ref:a,onClick:je(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:i.jsx(Yh,{asChild:!0,...o,children:l})});i4.displayName=s4;var i1="PopoverPortal",[lK,cK]=t4(i1,{forceMount:void 0}),o4=t=>{const{__scopePopover:e,forceMount:r,children:n,container:s}=t,o=ma(i1,e);return i.jsx(lK,{scope:e,forceMount:r,children:i.jsx(Tr,{present:r||o.open,children:i.jsx(uu,{asChild:!0,container:s,children:n})})})};o4.displayName=i1;var eu="PopoverContent",a4=g.forwardRef((t,e)=>{const r=cK(eu,t.__scopePopover),{forceMount:n=r.forceMount,...s}=t,o=ma(eu,t.__scopePopover);return i.jsx(Tr,{present:n||o.open,children:o.modal?i.jsx(dK,{...s,ref:e}):i.jsx(hK,{...s,ref:e})})});a4.displayName=eu;var uK=ea("PopoverContent.RemoveScroll"),dK=g.forwardRef((t,e)=>{const r=ma(eu,t.__scopePopover),n=g.useRef(null),s=Ge(e,n),o=g.useRef(!1);return g.useEffect(()=>{const a=n.current;if(a)return nv(a)},[]),i.jsx(nf,{as:uK,allowPinchZoom:!0,children:i.jsx(l4,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:je(t.onCloseAutoFocus,a=>{var l;a.preventDefault(),o.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:je(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;o.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:je(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),hK=g.forwardRef((t,e)=>{const r=ma(eu,t.__scopePopover),n=g.useRef(!1),s=g.useRef(!1);return i.jsx(l4,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,l;(a=t.onCloseAutoFocus)==null||a.call(t,o),o.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),l4=g.forwardRef((t,e)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...h}=t,m=ma(eu,r),f=ff(r);return rv(),i.jsx(tf,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:i.jsx(pl,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),children:i.jsx(zg,{"data-state":u4(m.open),role:"dialog",id:m.contentId,...f,...h,ref:e,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),c4="PopoverClose",fK=g.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=ma(c4,r);return i.jsx(Me.button,{type:"button",...n,ref:e,onClick:je(t.onClick,()=>s.onOpenChange(!1))})});fK.displayName=c4;var mK="PopoverArrow",pK=g.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=ff(r);return i.jsx(Ug,{...s,...n,ref:e})});pK.displayName=mK;function u4(t){return t?"open":"closed"}var gK=r4,vK=i4,xK=o4,d4=a4;const ol=gK,al=vK,sa=g.forwardRef(({className:t,align:e="center",sideOffset:r=4,...n},s)=>i.jsx(xK,{children:i.jsx(d4,{ref:s,align:e,sideOffset:r,className:Se("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
637de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));sa.displayName=d4.displayName;function Js(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function ll(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const h4=6048e5,yK=864e5;let bK={};function hv(){return bK}function Ch(t,e){var l,c,u,d;const r=hv(),n=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=Js(t),o=s.getDay(),a=(o<n?7:0)+o-n;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function Jp(t){return Ch(t,{weekStartsOn:1})}function f4(t){const e=Js(t),r=e.getFullYear(),n=ll(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const s=Jp(n),o=ll(t,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);const a=Jp(o);return e.getTime()>=s.getTime()?r+1:e.getTime()>=a.getTime()?r:r-1}function NN(t){const e=Js(t);return e.setHours(0,0,0,0),e}function CN(t){const e=Js(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function wK(t,e){const r=NN(t),n=NN(e),s=+r-CN(r),o=+n-CN(n);return Math.round((s-o)/yK)}function _K(t){const e=f4(t),r=ll(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),Jp(r)}function jK(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function kK(t){if(!jK(t)&&typeof t!="number")return!1;const e=Js(t);return!isNaN(Number(e))}function SK(t){const e=Js(t),r=ll(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const NK={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},CK=(t,e,r)=>{let n;const s=NK[t];return typeof s=="string"?n=s:e===1?n=s.one:n=s.other.replace("{{count}}",e.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function uy(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const EK={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},PK={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},TK={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},AK={date:uy({formats:EK,defaultWidth:"full"}),time:uy({formats:PK,defaultWidth:"full"}),dateTime:uy({formats:TK,defaultWidth:"full"})},RK={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},IK=(t,e,r,n)=>RK[t];function td(t){return(e,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let s;if(n==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,l=r!=null&&r.width?String(r.width):a;s=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=r!=null&&r.width?String(r.width):t.defaultWidth;s=t.values[l]||t.values[a]}const o=t.argumentCallback?t.argumentCallback(e):e;return s[o]}}const OK={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},MK={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]}
vendor: 15,651 bytes, line 637
637,$K={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},DK={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},FK={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},LK={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},BK=(t,e)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},zK={ordinalNumber:BK,era:td({values:OK,defaultWidth:"wide"}),quarter:td({values:MK,defaultWidth:"wide",argumentCallback:t=>t-1}),month:td({values:$K,defaultWidth:"wide"}),day:td({values:DK,defaultWidth:"wide"}),dayPeriod:td({values:FK,defaultWidth:"wide",formattingValues:LK,defaultFormattingWidth:"wide"})};function rd(t){return(e,r={})=>{const n=r.width,s=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],o=e.match(s);if(!o)return null;const a=o[0],l=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?WK(l,h=>h.test(a)):UK(l,h=>h.test(a));let u;u=t.valueCallback?t.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=e.slice(a.length);return{value:u,rest:d}}}function UK(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function WK(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function HK(t){return(e,r={})=>{const n=e.match(t.matchPattern);if(!n)return null;const s=n[0],o=e.match(t.parsePattern);if(!o)return null;let a=t.valueCallback?t.valueCallback(o[0]):o[0];a=r.valueCallback?r.valueCallback(a):a;const l=e.slice(s.length);return{value:a,rest:l}}}const GK=/^(\d+)(th|st|nd|rd)?/i,qK=/\d+/i,VK={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},KK={any:[/^b/i,/^(a|c)/i]},YK={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},QK={any:[/1/i,/2/i,/3/i,/4/i]},JK={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},XK={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ZK={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},eY={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},tY={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},rY={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},nY={ordinalNumber:HK({matchPattern:GK,parsePattern:qK,valueCallback:t=>parseInt(t,10)}),era:rd({matchPatterns:VK,defaultMatchWidth:"wide",parsePatterns:KK,defaultParseWidth:"any"}),quarter:rd({matchPatterns:YK,defaultMatchWidth:"wide",parsePatterns:QK,defaultParseWidth:"any",valueCallback:t=>t+1}),month:rd({matchPatterns:JK,defaultMatchWidth:"wide",parsePatterns:XK,defaultParseWidth:"any"}),day:rd({matchPatterns:ZK,defaultMatchWidth:"wide",parsePatterns:eY,defaultParseWidth:"any"}),dayPeriod:rd({matchPatterns:tY,defaultMatchWidth:"any",parsePatterns:rY,defaultParseWidth:"any"})},sY={code:"en-US",formatDistance:CK,formatLong:AK,formatRelative:IK,localize:zK,match:nY,options:{weekStartsOn:0,firstWeekContainsDate:1}};function iY(t){const e=Js(t);return wK(e,SK(e))+1}function oY(t){const e=Js(t),r=+Jp(e)-+_K(e);return Math.round(r/h4)+1}function m4(t,e){var d,h,m,f;const r=Js(t),n=r.getFullYear(),s=hv(),o=(e==null?void 0:e.firstWeekContainsDate)??((h=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((f=(m=s.locale)==null?void 0:m.options)==null?void 0:f.firstWeekContainsDate)??1,a=ll(t,0);a.setFullYear(n+1,0,o),a.setHours(0,0,0,0);const l=Ch(a,e),c=ll(t,0);c.setFullYear(n,0,o),c.setHours(0,0,0,0);const u=Ch(c,e);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function aY(t,e){var l,c,u,d;const r=hv(),n=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,s=m4(t,e),o=ll(t,0);return o.setFullYear(s,0,n),o.setHours(0,0,0,0),Ch(o,e)}function lY(t,e){const r=Js(t),n=+Ch(r,e)-+aY(r,e);return Math.round(n/h4)+1}function Ot(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const go={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return Ot(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):Ot(r+1,2)},d(t,e){return Ot(t.getDate(),e.length)},a(t,e){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return Ot(t.getHours()%12||12,e.length)},H(t,e){return Ot(t.getHours(),e.length)},m(t,e){return Ot(t.getMinutes(),e.length)},s(t,e){return Ot(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return Ot(s,e.length)}},zl={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},EN={G:function(t,e,r){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if(e==="yo"){const n=t.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return go.y(t,e)},Y:function(t,e,r,n){const s=m4(t,n),o=s>0?s:1-s;if(e==="YY"){const a=o%100;return Ot(a,2)}return e==="Yo"?r.ordinalNumber(o,{unit:"year"}):Ot(o,e.length)},R:function(t,e){const r=f4(t);return Ot(r,e.length)},u:function(t,e){const r=t.getFullYear();return Ot(r,e.length)},Q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Ot(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Ot(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){const n=t.getMonth();switch(e){case"M":case"MM":return go.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return Ot(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){const s=lY(t,n);return e==="wo"?r.ordinalNumber(s,{unit:"week"}):Ot(s,e.length)},I:function(t,e,r){const n=oY(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):Ot(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):go.d(t,e)},D:function(t,e,r){const n=iY(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):Ot(n,e.length)},E:function(t,e,r){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){const s=t.getDay(),o=(s-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return Ot(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){const s=t.getDay(),o=(s-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return Ot(o,e.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,r){const n=t.getDay(),s=n===0?7:n;switch(e){case"i":return String(s);case"ii":return Ot(s,e.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,r){const n=t.getHours();let s;switch(n===12?s=zl.noon:n===0?s=zl.midnight:s=n/12>=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,r){const n=t.getHours();let s;switch(n>=17?s=zl.evening:n>=12?s=zl.afternoon:n>=4?s=zl.morning:s=zl.night,e){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,r){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return go.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):go.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):Ot(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):Ot(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):go.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):go.s(t,e)},S:function(t,e){return go.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return TN(n);case"XXXX":case"XX":return Pa(n);case"XXXXX":case"XXX":default:return Pa(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return TN(n);case"xxxx":case"xx":return Pa(n);case"xxxxx":case"xxx":default:return Pa(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+PN(n,":");case"OOOO":default:return"GMT"+Pa(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+PN(n,":");case"zzzz":default:return"GMT"+Pa(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return Ot(n,e.length)},T:function(t,e,r){const n=t.getTime();return Ot(n,e.length)}};function PN(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),s=Math.trunc(n/60),o=n%60;return o===0?r+String(s):r+String(s)+e+Ot(o,2)}function TN(t,e){return t%60===0?(t>0?"-":"+")+Ot(Math.abs(t)/60,2):Pa(t,e)}function Pa(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),s=Ot(Math.trunc(n/60),2),o=Ot(n%60,2);return r+s+e+o}const AN=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},p4=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},cY=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return AN(t,e);let o;switch(n){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;case"PPPP":default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",AN(n,e)).replace("{{time}}",p4(s,e))},uY={p:p4,P:cY},dY=/^D+$/,hY=/^Y+$/,fY=["D","DD","YY","YYYY"];function mY(t){return dY.test(t)}function pY(t){return hY.test(t)}function gY(t,e,r){const n=vY(t,e,r);if(console.warn(n),fY.includes(t))throw new RangeError(n)}function vY(t,e,r){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const xY=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,yY=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,bY=/^'([^]*?)'?$/,wY=/''/g,_Y=/[a-zA-Z]/;function Xp(t,e,r){var d,h,m,f;const n=hv(),s=n.locale??sY,o=n.firstWeekContainsDate??((h=(d=n.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??1,a=n.weekStartsOn??((f=(m=n.locale)==null?void 0:m.options)==null?void 0:f.weekStartsOn)??0,l=Js(t);if(!kK(l))throw new RangeError("Invalid time value");let c=e.match(yY).map(v=>{const p=v[0];if(p==="p"||p==="P"){const b=uY[p];return b(v,s.formatLong)}return v}).join("").match(xY).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const p=v[0];if(p==="'")return{isToken:!1,value:jY(v)};if(EN[p])return{isToken:!0,value:v};
637if(p.match(_Y))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const u={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return c.map(v=>{if(!v.isToken)return v.value;const p=v.value;(pY(p)||mY(p))&&gY(p,e,String(t));const b=EN[p[0]];return b(l,p,s.localize,u)}).join("")}function jY(t){const e=t.match(bY);return e?e[1].replace(wY,"'"):t}function kY(){const{user:t}=$t(),e=Zt(),[r,n]=g.useState(null);return g.useEffect(()=>{t&&(async()=>{const{data:s}=await re.from("user_ai_keys").select("success_count, status").eq("user_id",t.id).eq("provider","gemini").maybeSingle();s&&n({success:Number(s.success_count)||0,status:s.status})})()},[t]),r?i.jsxs("div",{className:"flex items-start justify-between gap-3 pt-2 border-t border-border",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"mt-1 h-2.5 w-2.5 rounded-full bg-emerald-500 shrink-0"}),i.jsxs("div",{children:[i.jsxs("p",{className:"text-sm font-medium flex items-center gap-1",children:[i.jsx(n_,{className:"h-3 w-3"})," Your Gemini Key"]}),i.jsx("button",{onClick:()=>e("/account/api-key"),className:"text-xs text-muted-foreground hover:text-primary hover:underline",children:r.status==="active"?"Manage key":"Key disabled — review"})]})]}),i.jsx("span",{className:"text-sm tabular-nums",children:r.success})]}):null}const SY=90*365;function RN(t){if(!t)return"";const e=new Date(t);return isNaN(e.getTime())?"":(e.getTime()-Date.now())/(1e3*60*60*24)>SY?"Never expires":`Expires ${Xp(e,"MMM d, yyyy")}`}function Rw({children:t}){const e=Zt(),{monthlyCredits:r,monthlyCreditsExpireAt:n,extraCredits:s,extraCreditsExpireAt:o,isSuperAdmin:a}=nn(),l=Math.max(0,r+s),c=l>0?r/l*100:0,u=l>0?s/l*100:0,d=4;let h=c,m=u;return r>0&&s>0&&(h<d?(h=d,m=100-d):m<d&&(m=d,h=100-d)),a?i.jsxs(ol,{children:[i.jsx(al,{asChild:!0,children:t}),i.jsx(sa,{className:"w-72",align:"end",children:i.jsx("p",{className:"text-sm font-medium",children:"Super admin — unlimited credits"})})]}):i.jsxs(ol,{children:[i.jsx(al,{asChild:!0,children:t}),i.jsx(sa,{className:"w-80 p-4",align:"end",children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h4",{className:"text-sm font-semibold flex items-center gap-1.5",children:[i.jsx(yc,{className:"h-4 w-4 text-primary"}),"Credit balance"]}),i.jsx("span",{className:"text-sm font-bold",children:l.toFixed(2)})]}),l>0?i.jsxs("div",{className:"h-2 w-full rounded-full overflow-hidden bg-muted flex",children:[i.jsx("div",{className:"bg-primary h-full",style:{width:`${h}%`},"aria-label":"Monthly credits"}),i.jsx("div",{className:"bg-amber-500 h-full",style:{width:`${m}%`},"aria-label":"Extra credits"})]}):i.jsx("div",{className:"h-2 w-full rounded-full bg-muted"}),i.jsxs("div",{className:"space-y-2 pt-1",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"mt-1 h-2.5 w-2.5 rounded-full bg-primary shrink-0"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"Monthly"}),n&&i.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[i.jsx(th,{className:"h-3 w-3"}),RN(n)]})]})]}),i.jsx("span",{className:"text-sm tabular-nums",children:r.toFixed(2)})]}),i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"mt-1 h-2.5 w-2.5 rounded-full bg-amber-500 shrink-0"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:"Extra"}),i.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[i.jsx(th,{className:"h-3 w-3"}),o?RN(o):"Never expires"]})]})]}),i.jsx("span",{className:"text-sm tabular-nums",children:s.toFixed(2)})]})]}),i.jsx(kY,{}),i.jsxs("p",{className:"text-xs text-muted-foreground pt-1 border-t border-border",children:["Monthly credits are spent first."," ",i.jsx("button",{onClick:()=>e("/pricing"),className:"text-primary hover:underline",children:"Get more credits →"})]})]})})]})}const Zp="/assets/logo-B-iiu69u.png";function zr({showGenerationCounter:t=!1}){const e=Zt(),r=Zi(),{user:n,profile:s,signOut:o}=$t(),{creditsRemaining:a,plan:l,source:c,loading:u,cancelAtPeriodEnd:d,subscriptionEnd:h,trialStatus:m,trialEndsAt:f}=nn(),[v,p]=g.useState(!1),[b,x]=g.useState(!1),[y,w]=g.useState(null),j={free:"Free",project:"Creator",project_pass:"Project Pass",starter:"Freelance",pro:"Pro",agency:"Agency"},_=l==="free"&&m==="active",S=`${_?"Free Trial":j[l]||l}${c==="appsumo"?" (AppSumo)":""}`,N=()=>
637{if(!_||!f){w(null);return}const $=new Date(f).getTime()-Date.now();w(Math.max(0,Math.ceil($/(60*60*1e3))))},P=$=>{x($),$&&N()},C=$=>{p($),$&&N()},O=async()=>{await o(),e("/auth")},F=r.pathname==="/",T=$=>{if(p(!1),F){const K=document.getElementById($);K&&K.scrollIntoView({behavior:"smooth"})}else e(`/#${$}`)},A=$=>{p(!1),e($)},k=[...n?[]:[{label:"Benefits",anchor:"benefits",isAnchor:!0},{label:"How it Works",anchor:"how-it-works",isAnchor:!0},{label:"Testimonials",anchor:"testimonials",isAnchor:!0}],{label:"Themes",path:"/themes",isAnchor:!1},{label:"Pricing",path:"/pricing",isAnchor:!1}];return i.jsx("header",{className:"bg-card/80 backdrop-blur-sm sticky top-0 z-50 border-b border-border/50",children:i.jsxs("div",{className:"container mx-auto px-4 py-4 flex items-center justify-between",children:[i.jsx("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>e("/"),children:i.jsx("img",{src:Zp,alt:"Press Me GPT",className:"h-14 md:h-16"})}),i.jsxs("nav",{className:"hidden lg:flex items-center gap-2 xl:gap-4",children:[k.map($=>i.jsx(Y,{variant:"ghost",onClick:()=>$.isAnchor?T($.anchor):A($.path),children:$.label},$.label)),n?i.jsxs(i.Fragment,{children:[i.jsx(Y,{variant:"ghost",onClick:()=>e("/dashboard"),children:"Dashboard"}),i.jsxs(lv,{open:b,onOpenChange:P,children:[i.jsx(cv,{asChild:!0,children:i.jsx(Y,{variant:"ghost",size:"icon",className:"rounded-full",children:i.jsx(VP,{className:"h-5 w-5"})})}),i.jsxs(af,{align:"end",className:"w-64",children:[i.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[i.jsx("p",{className:"font-medium",children:(s==null?void 0:s.display_name)||"User"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:n==null?void 0:n.email})]}),i.jsxs(hs,{onClick:()=>e("/pricing"),className:"flex items-center justify-between cursor-pointer",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(Pb,{className:"h-4 w-4 mr-2"}),"My Plan"]}),i.jsx(rt,{variant:"secondary",className:"capitalize text-xs",children:S})]}),_&&y!==null&&i.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground border-b border-border",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(xc,{className:"h-3 w-3"}),i.jsxs("span",{children:[y," ",y===1?"hour":"hours"," left in trial"]})]})}),l!=="free"&&h&&!isNaN(new Date(h).getTime())&&i.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground border-b border-border",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(th,{className:"h-3 w-3"}),d?i.jsxs("span",{className:"text-destructive",children:["Cancels ",Xp(new Date(h),"MMM d, yyyy")]}):i.jsxs("span",{children:["Renews ",Xp(new Date(h),"MMM d, yyyy")]})]})}),["[email protected]","[email protected]"].includes((n==null?void 0:n.email)??"")&&i.jsxs(i.Fragment,{children:[i.jsx(Nc,{}),i.jsxs(hs,{onClick:()=>e("/admin/regenerate-thumbnails"),className:"cursor-pointer",children:[i.jsx(yc,{className:"h-4 w-4 mr-2"}),"Regenerate Thumbnails"]})]}),i.jsx(Nc,{}),i.jsxs(hs,{onClick:()=>e("/account/api-key"),className:"cursor-pointer",children:[i.jsx(n_,{className:"h-4 w-4 mr-2"}),"API Keys"]}),i.jsx(Nc,{}),i.jsxs(hs,{onClick:O,className:"text-destructive focus:text-destructive",children:[i.jsx(uk,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]}),!u&&i.jsx(Rw,{children:i.jsxs("button",{type:"button",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium transition-all cursor-pointer ${(a??0)<=2?"bg-destructive/10 text-destructive animate-pulse":(a??0)<=5?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"bg-primary/10 text-primary"}`,children:[i.jsx(yc,{className:"h-4 w-4"}),i.jsx("span",{children:(a??0).toFixed(2)})]})})]}):i.jsxs(i.Fragment,{children:[i.jsx(Y,{className:"bg-accent text-accent-foreground hover:bg-accent/90",onClick:()=>e("/auth?mode=signin"),children:"Sign In"}),i.jsx(Y,{onClick:()=>e("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90",children:"Free Trial"})]})]}),i.jsxs("div",{className:"flex lg:hidden items-center gap-2",children:[n&&!u&&i.jsx(Rw,{children:i.jsxs("button",{type:"button",className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium transition-all cursor-pointer ${(a??0)<=2?"bg-destructive/10 text-destructive animate-pulse":(a??0)<=5?"bg-amber-500/10 text-amber-600 dar
637k:text-amber-400":"bg-primary/10 text-primary"}`,children:[i.jsx(yc,{className:"h-3 w-3"}),i.jsx("span",{children:(a??0).toFixed(2)})]})}),i.jsxs(QI,{open:v,onOpenChange:C,children:[i.jsx(JI,{asChild:!0,children:i.jsx(Y,{variant:"ghost",size:"icon",children:i.jsx(RL,{className:"h-6 w-6"})})}),i.jsx(s1,{side:"right",className:"w-[280px] sm:w-[320px]",children:i.jsxs("div",{className:"flex flex-col gap-4 mt-8",children:[k.map($=>i.jsx(Y,{variant:"ghost",className:"justify-start text-lg",onClick:()=>$.isAnchor?T($.anchor):A($.path),children:$.label},$.label)),n?i.jsxs(i.Fragment,{children:[i.jsx(Y,{variant:"ghost",className:"justify-start text-lg",onClick:()=>A("/dashboard"),children:"Dashboard"}),i.jsxs("div",{className:"border-t border-border pt-4 mt-2",children:[i.jsxs("div",{className:"px-4 py-2 mb-2",children:[i.jsx("p",{className:"font-medium",children:(s==null?void 0:s.display_name)||"User"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:n==null?void 0:n.email})]}),i.jsxs(Y,{variant:"ghost",className:"justify-start w-full",onClick:()=>A("/pricing"),children:[i.jsx(Pb,{className:"h-4 w-4 mr-2"}),"My Plan",i.jsx(rt,{variant:"secondary",className:"capitalize text-xs ml-auto",children:S})]}),_&&y!==null&&i.jsx("div",{className:"px-4 py-2 text-xs text-muted-foreground border-b border-border",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(xc,{className:"h-3 w-3"}),i.jsxs("span",{children:[y," ",y===1?"hour":"hours"," left in trial"]})]})}),i.jsxs(Y,{variant:"ghost",className:"justify-start text-destructive hover:text-destructive w-full",onClick:O,children:[i.jsx(uk,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]}):i.jsxs("div",{className:"border-t border-border pt-4 mt-2 flex flex-col gap-2",children:[i.jsx(Y,{className:"justify-start bg-accent text-accent-foreground hover:bg-accent/90",onClick:()=>A("/auth?mode=signin"),children:"Sign In"}),i.jsx(Y,{onClick:()=>A("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90",children:"Free Trial"})]})]})})]})]})]})})}function yl({title:t,description:e,canonicalUrl:r,ogImage:n="/og-image.png",ogType:s="website",keywords:o,structuredData:a}){return g.useEffect(()=>{document.title=t;const l=(d,h,m=!1)=>{const f=m?"property":"name";let v=document.querySelector(`meta[${f}="${d}"]`);v||(v=document.createElement("meta"),v.setAttribute(f,d),document.head.appendChild(v)),v.setAttribute("content",h)};l("description",e),o&&l("keywords",o),l("og:title",t,!0),l("og:description",e,!0),l("og:type",s,!0),n&&l("og:image",n,!0),r&&l("og:url",r,!0),l("twitter:card","summary_large_image"),l("twitter:title",t),l("twitter:description",e),n&&l("twitter:image",n);let c=document.querySelector('link[rel="canonical"]');r?(c||(c=document.createElement("link"),c.setAttribute("rel","canonical"),document.head.appendChild(c)),c.setAttribute("href",r)):c&&c.remove();let u=document.querySelector('script[type="application/ld+json"]');return a?(u||(u=document.createElement("script"),u.setAttribute("type","application/ld+json"),document.head.appendChild(u)),u.textContent=JSON.stringify(a)):u&&u.remove(),()=>{document.title="Press Me GPT - AI WordPress Theme Generator"}},[t,e,r,n,s,o,a]),null}const NY=[{quote:"it made me a theme 😀",role:"Agency Owner"},{quote:"Its a huge asset",role:"Freelancer"},{quote:"its fast, beautiful, and mostly free",role:"Blogger"},{quote:"I'm definitely going to use this on a real project",role:"Freelancer"},{quote:"The biggest benefit is speed",role:"Freelancer"},{quote:"It's fast and easy!",role:"Blogger"},{quote:"Must have!",role:"Consultant"},{quote:"You must try it",role:"Hobbyist"},{quote:"Time saver.",role:"Blogger"},{quote:"A great tool to create a theme quickly",role:"WordPress Developer"},{quote:"So fast to create a theme without any experience",role:"WordPress Developer"}];function CY(t){const e=[...t];for(let r=e.length-1;r>0;r--){const n=Math.floor(Math.random()*(r+1));[e[r],e[n]]=[e[n],e[r]]}return e}function wu(){const t=g.useMemo(()=>CY(NY),[]),[e,r]=g.useState(()=>t.slice(0,3)),[n,s]=g.useState(null),o=g.useMemo(()=>({current:3}),[]),a=g.useCallback(l=>{s(l),setTimeout(()=>{r(c=>{const u=[...c];return u[l]=t[o.current%t.length],o.current++,u}),s(null)},500)},[t,o]);return g.useEffect(()=>{const l=[setInterval(()=>a(0),4e3),setInterval(()=>a(1),5e3),setInterval(()=>a(2),7e3)];return()=>l.forEach(clearInterval)},[a]),i.jsx("section",{id:"testimonials",className:"py-16 px-4 bg-muted/50",children:i.jsxs("div",{className:"container mx-auto max-w-5xl",children:[i.jsx("h2",{className:"text-2xl font-bold text-center mb-8",children:"What Our Users Say"}),i.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:e.map((l,c)=>i.jsxs("div",{className:`bg-card border border-border/50 rounded-2xl p-6 text-center transition-opacity duration-500 min-h-[180px] flex flex-col items-center justify-center ${n===c?"opacity-0":"opacity-100"}`,children:[i.jsx("div",{className:"flex justify-center gap-1 mb-3",children:[...Array(5)].map((u,d)=>i.jsx(ys,{className:"h-4 w-4 fill-primary text-primary"},d))}),i.jsxs("p",{className:"text-lg font-bold leading-relaxed text-foreground",children:['"',l.quote,'"']}),i.jsxs("p",{className:"text-xs text-muted-foreground mt-3",children:["— ",l.role]})]},`slot-${c}`))}),i.jsx("p",{className:"text-xs text-muted-foreground text-center mt-6",children:"Comments are left by actual users from our export survey."})]})})}function EY(t){return Object.prototype.toString.call(t)==="[object Object]"}function IN(t){return EY(t)||Array.isArray(t)}function PY(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function o1(t,e){const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;const s=JSON.stringify(Object.keys(t.breakpoints||{})),o=JSON.stringify(Object.keys(e.breakpoints||{}));return s!==o?!1:r.every(a=>{const l=t[a],c=e[a];return typeof l=="function"?`${l}`==`${c}`:!IN(l)||!IN(c)?l===c:o1(l,c)})}function ON(t){return t.concat().sort((e,r)=>e.name>
vendor: 4,217 bytes, line 637
637r.name?1:-1).map(e=>e.options)}function TY(t,e){if(t.length!==e.length)return!1;const r=ON(t),n=ON(e);return r.every((s,o)=>{const a=n[o];return o1(s,a)})}function a1(t){return typeof t=="number"}function Iw(t){return typeof t=="string"}function fv(t){return typeof t=="boolean"}function MN(t){return Object.prototype.toString.call(t)==="[object Object]"}function sr(t){return Math.abs(t)}function l1(t){return Math.sign(t)}function Dd(t,e){return sr(t-e)}function AY(t,e){if(t===0||e===0||sr(t)<=sr(e))return 0;const r=Dd(sr(t),sr(e));return sr(r/t)}function RY(t){return Math.round(t*100)/100}function Eh(t){return Ph(t).map(Number)}function Us(t){return t[mf(t)]}function mf(t){return Math.max(0,t.length-1)}function c1(t,e){return e===mf(t)}function $N(t,e=0){return Array.from(Array(t),(r,n)=>e+n)}function Ph(t){return Object.keys(t)}function g4(t,e){return[t,e].reduce((r,n)=>(Ph(n).forEach(s=>{const o=r[s],a=n[s],l=MN(o)&&MN(a);r[s]=l?g4(o,a):a}),r),{})}function Ow(t,e){return typeof e.MouseEvent<"u"&&t instanceof e.MouseEvent}function IY(t,e){const r={start:n,center:s,end:o};function n(){return 0}function s(c){return o(c)/2}function o(c){return e-c}function a(c,u){return Iw(t)?r[t](c):t(e,c,u)}return{measure:a}}function Th(){let t=[];function e(s,o,a,l={passive:!0}){let c;if("addEventListener"in s)s.addEventListener(o,a,l),c=()=>s.removeEventListener(o,a,l);else{const u=s;u.addListener(a),c=()=>u.removeListener(a)}return t.push(c),n}function r(){t=t.filter(s=>s())}const n={add:e,clear:r};return n}function OY(t,e,r,n){const s=Th(),o=1e3/60;let a=null,l=0,c=0;function u(){s.add(t,"visibilitychange",()=>{t.hidden&&v()})}function d(){f(),s.clear()}function h(b){if(!c)return;a||(a=b,r(),r());const x=b-a;for(a=b,l+=x;l>=o;)r(),l-=o;const y=l/o;n(y),c&&(c=e.requestAnimationFrame(h))}function m(){c||(c=e.requestAnimationFrame(h))}function f(){e.cancelAnimationFrame(c),a=null,l=0,c=0}function v(){a=null,l=0}return{init:u,destroy:d,start:m,stop:f,update:r,render:n}}function MY(t,e){const r=e==="rtl",n=t==="y",s=n?"y":"x",o=n?"x":"y",a=!n&&r?-1:1,l=d(),c=h();function u(v){const{height:p,width:b}=v;return n?p:b}function d(){return n?"top":r?"right":"left"}function h(){return n?"bottom":r?"left":"right"}function m(v){return v*a}return{scroll:s,cross:o,startEdge:l,endEdge:c,measureSize:u,direction:m}}function cl(t=0,e=0){const r=sr(t-e);function n(u){return u<t}function s(u){return u>e}function o(u){return n(u)||s(u)}function a(u){return o(u)?n(u)?t:e:u}function l(u){return r?u-r*Math.ceil((u-e)/r):u}return{length:r,max:e,min:t,constrain:a,reachedAny:o,reachedMax:s,reachedMin:n,removeOffset:l}}function v4(t,e,r){const{constrain:n}=cl(0,t),s=t+1;let o=a(e);function a(m){return r?sr((s+m)%s):n(m)}function l(){return o}function c(m){return o=a(m),h}function u(m){return d().set(l()+m)}function d(){return v4(t,l(),r)}const h={get:l,set:c,add:u,clone:d};return h}function $Y(t,e,r,n,s,o,a,l,c,u,d,h,m,f,v,p,b,x,y){const{cross:w,direction:j}=t,_=["INPUT","SELECT","TEXTAREA"],S={passive:!1},N=Th(),P=Th(),C=cl(50,225).constrain(f.measure(20)),O={mouse:300,touch:400},F={mouse:500,touch:600},T=v?43:25;let A=!1,k=0,$=0,K=!1,H=!1,W=!1,R=!1;function G(Z){if(!y)return;function ae(ne){(fv(y)||y(Z,ne))&&he(ne)}const E=e;N.add(E,"dragstart",ne=>ne.preventDefault(),S).add(E,"touchmove",()=>{},S).add(E,"touchend",()=>{}).add(E,"touchstart",ae).add(E,"mousedown",ae).add(E,"touchcancel",J).add(E,"contextmenu",J).add(E,"click",de,!0)}function U(){N.clear(),P.clear()}function z(){const Z=R?r:e;P.add(Z,"touchmove",X,S).add(Z,"touchend",J).add(Z,"mousemove",X,S).add(Z,"mouseup",J)}function oe(Z){const ae=Z.nodeName||"";return _.includes(ae)}function L(){return(v?F:O)[R?"mouse":"touch"]}function q(Z,ae){const E=h.add(l1(Z)*-1),ne=d.byDistance(Z,!v).distance;return v||sr(Z)<C?ne:b&&ae?ne*.5:d.byIndex(E.get(),0).distance}function he(Z){const ae=Ow(Z,n);R=ae,W=v&&ae&&!Z.buttons&&A,A=Dd(s.get(),a.get())>=2,!(ae&&Z.button!==0)&&(oe(Z.target)||(K=!0,o.pointerDown(Z),u.useFriction(0).useDuration(0),s.set(a),z(),k=o.readPoint(Z),$=o.readPoint(Z,w),m.emit("pointerDown")))}function X(Z){if(!Ow(Z,n)&&Z.touches.length>=2)return J(Z);const E=o.readPoint(Z),ne=o.readPoint(Z,w),te=Dd(E,k),D=Dd(ne,$);
vendor: 14,458 bytes, line 637
637if(!H&&!R&&(!Z.cancelable||(H=te>D,!H)))return J(Z);const M=o.pointerMove(Z);te>p&&(W=!0),u.useFriction(.3).useDuration(.75),l.start(),s.add(j(M)),Z.preventDefault()}function J(Z){const E=d.byDistance(0,!1).index!==h.get(),ne=o.pointerUp(Z)*L(),te=q(j(ne),E),D=AY(ne,te),M=T-10*D,V=x+D/50;H=!1,K=!1,P.clear(),u.useDuration(M).useFriction(V),c.distance(te,!v),R=!1,m.emit("pointerUp")}function de(Z){W&&(Z.stopPropagation(),Z.preventDefault(),W=!1)}function le(){return K}return{init:G,destroy:U,pointerDown:le}}function DY(t,e){let n,s;function o(h){return h.timeStamp}function a(h,m){const v=`client${(m||t.scroll)==="x"?"X":"Y"}`;return(Ow(h,e)?h:h.touches[0])[v]}function l(h){return n=h,s=h,a(h)}function c(h){const m=a(h)-a(s),f=o(h)-o(n)>170;return s=h,f&&(n=h),m}function u(h){if(!n||!s)return 0;const m=a(s)-a(n),f=o(h)-o(n),v=o(h)-o(s)>170,p=m/f;return f&&!v&&sr(p)>.1?p:0}return{pointerDown:l,pointerMove:c,pointerUp:u,readPoint:a}}function FY(){function t(r){const{offsetTop:n,offsetLeft:s,offsetWidth:o,offsetHeight:a}=r;return{top:n,right:s+o,bottom:n+a,left:s,width:o,height:a}}return{measure:t}}function LY(t){function e(n){return t*(n/100)}return{measure:e}}function BY(t,e,r,n,s,o,a){const l=[t].concat(n);let c,u,d=[],h=!1;function m(b){return s.measureSize(a.measure(b))}function f(b){if(!o)return;u=m(t),d=n.map(m);function x(y){for(const w of y){if(h)return;const j=w.target===t,_=n.indexOf(w.target),S=j?u:d[_],N=m(j?t:n[_]);if(sr(N-S)>=.5){b.reInit(),e.emit("resize");break}}}c=new ResizeObserver(y=>{(fv(o)||o(b,y))&&x(y)}),r.requestAnimationFrame(()=>{l.forEach(y=>c.observe(y))})}function v(){h=!0,c&&c.disconnect()}return{init:f,destroy:v}}function zY(t,e,r,n,s,o){let a=0,l=0,c=s,u=o,d=t.get(),h=0;function m(){const S=n.get()-t.get(),N=!c;let P=0;return N?(a=0,r.set(n),t.set(n),P=S):(r.set(t),a+=S/c,a*=u,d+=a,t.add(a),P=d-h),l=l1(P),h=d,_}function f(){const S=n.get()-e.get();return sr(S)<.001}function v(){return c}function p(){return l}function b(){return a}function x(){return w(s)}function y(){return j(o)}function w(S){return c=S,_}function j(S){return u=S,_}const _={direction:p,duration:v,velocity:b,seek:m,settled:f,useBaseFriction:y,useBaseDuration:x,useFriction:j,useDuration:w};return _}function UY(t,e,r,n,s){const o=s.measure(10),a=s.measure(50),l=cl(.1,.99);let c=!1;function u(){return!(c||!t.reachedAny(r.get())||!t.reachedAny(e.get()))}function d(f){if(!u())return;const v=t.reachedMin(e.get())?"min":"max",p=sr(t[v]-e.get()),b=r.get()-e.get(),x=l.constrain(p/a);r.subtract(b*x),!f&&sr(b)<o&&(r.set(t.constrain(r.get())),n.useDuration(25).useBaseFriction())}function h(f){c=!f}return{shouldConstrain:u,constrain:d,toggleActive:h}}function WY(t,e,r,n,s){const o=cl(-e+t,0),a=h(),l=d(),c=m();function u(v,p){return Dd(v,p)<=1}function d(){const v=a[0],p=Us(a),b=a.lastIndexOf(v),x=a.indexOf(p)+1;return cl(b,x)}function h(){return r.map((v,p)=>{const{min:b,max:x}=o,y=o.constrain(v),w=!p,j=c1(r,p);return w?x:j||u(b,y)?b:u(x,y)?x:y}).map(v=>parseFloat(v.toFixed(3)))}function m(){if(e<=t+s)return[o.max];if(n==="keepSnaps")return a;const{min:v,max:p}=l;return a.slice(v,p)}return{snapsContained:c,scrollContainLimit:l}}function HY(t,e,r){const n=e[0],s=r?n-t:Us(e);return{limit:cl(s,n)}}function GY(t,e,r,n){const o=e.min+.1,a=e.max+.1,{reachedMin:l,reachedMax:c}=cl(o,a);function u(m){return m===1?c(r.get()):m===-1?l(r.get()):!1}function d(m){if(!u(m))return;const f=t*(m*-1);n.forEach(v=>v.add(f))}return{loop:d}}function qY(t){const{max:e,length:r}=t;function n(o){const a=o-e;return r?a/-r:0}return{get:n}}function VY(t,e,r,n,s){const{startEdge:o,endEdge:a}=t,{groupSlides:l}=s,c=h().map(e.measure),u=m(),d=f();function h(){return l(n).map(p=>Us(p)[a]-p[0][o]).map(sr)}function m(){return n.map(p=>r[o]-p[o]).map(p=>-sr(p))}function f(){return l(u).map(p=>p[0]).map((p,b)=>p+c[b])}return{snaps:u,snapsAligned:d}}function KY(t,e,r,n,s,o){const{groupSlides:a}=s,{min:l,max:c}=n,u=d();function d(){const m=a(o),f=!t||e==="keepSnaps";return r.length===1?[o]:f?m:m.slice(l,c).map((v,p,b)=>{const x=!p,y=c1(b,p);if(x){const w=Us(b[0])+1;return $N(w)}if(y){const w=mf(o)-Us(b)[0]+1;return $N(w,Us(b)[0])}return v})}return{slideRegistry:u}}function YY(t,e,r,n,s){const{reachedAny:o,removeOffset:a,constrain:l}=n;function c(v){return v.concat().sort((p,b)=>sr(p)-sr(b))[0]}function u(v){const p=t?a(v):l(v),b=e.map((y,w)=>({diff:d(y-p,0),index:w})).sort((y,w)=>sr(y.diff)-sr(w.diff)),{index:x}=b[0];return{index:x,distance:p}}function d(v,p){const b=[v,v+r,v-r];if(!t)return v;if(!p)return c(b);const x=b.filter(y=>l1(y)===p);return x.length?c(x):Us(b)-r}function h(v,p){const b=e[v]-s.get(),x=d(b,p);return{index:v,distance:x}}function m(v,p){const b=s.get()+v,{index:x,distance:y}=u(b),w=!t&&o(b);if(!p||w)return{index:x,distance:v};const j=e[x]-y,_=v+d(j,0);return{index:x,distance:_}}return{byDistance:m,byIndex:h,shortcut:d}}function QY(t,e,r,n,s,o,a){function l(h){const m=h.distance,f=h.index!==e.get();o.add(m),m&&(n.duration()?t.start():(t.update(),t.render(1),t.update())),f&&(r.set(e.get()),e.set(h.index),a.emit("select"))}function c(h,m){const f=s.byDistance(h,m);l(f)}function u(h,m){const f=e.clone().set(h),v=s.byIndex(f.get(),m);l(v)}return{distance:c,index:u}}function JY(t,e,r,n,s,o,a,l){const c={passive:!0,capture:!0};let u=0;function d(f){if(!l)return;function v(p){if(new Date().getTime()-u>10)return;a.emit("slideFocusStart"),t.scrollLeft=0;const y=r.findIndex(w=>w.includes(p));a1(y)&&(s.useDuration(0),n.index(y,0),a.emit("slideFocus"))}o.add(document,"keydown",h,!1),e.forEach((p,b)=>{o.add(p,"focus",x=>{(fv(l)||l(f,x))&&v(b)},c)})}function h(f){f.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function yd(t){let e=t;function r(){return e}function n(c){e=a(c)}function s(c){e+=a(c)}function o(c){e-=a(c)}function a(c){return a1(c)?c:c.get()}return{get:r,set:n,add:s,subtract:o}}function x4(t,e){const r=t.scroll==="x"?a:l,n=e.style;let s=null,o=!1;function a(m){return`translate3d(${m}px,0px,0px)`}function l(m){return`translate3d(0px,${m}px,0px)`}function c(m){if(o)return;const f=RY(t.direction(m));f!==s&&(n.transform=r(f),s=f)}function u(m){o=!m}function d(){o||(n.transform="",e.getAttribute("style")||e.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function XY(t,e,r,n,s,o,a,l,c){const d=Eh(s),h=Eh(s).reverse(),m=x().concat(y());function f(N,P){return N.reduce((C,O)=>C-s[O],P)}function v(N,P){return N.reduce((C,O)=>f(C,P)>0?C.concat([O]):C,[])}function p(N){return o.map((P,C)=>({start:P-n[C]+.5+N,end:P+e-.5+N}))}function b(N,P,C){const O=p(P);return N.map(F=>{const T=C?0:-r,A=C?r:0,k=C?"end":"start",$=O[F][k];return{index:F,loopPoint:$,slideLocation:yd(-1),translate:x4(t,c[F]),target:()=>l.get()>$?T:A}})}function x(){const N=a[0],P=v(h,N);return b(P,r,!1)}function y(){const N=e-a[0]-1,P=v(d,N);return b(P,-r,!0)}function w(){return m.every(({index:N})=>{const P=d.filter(C=>C!==N);return f(P,e)<=.1})}function j(){m.forEach(N=>{const{target:P,translate:C,slideLocation:O}=N,F=P();F!==O.get()&&(C.to(F),O.set(F))})}function _(){m.forEach(N=>N.translate.clear())}return{canLoop:w,clear:_,loop:j,loopPoints:m}}function ZY(t,e,r){let n,s=!1;function o(c){if(!r)return;function u(d){for(const h of d)if(h.type==="childList"){c.reInit(),e.emit("slidesChanged");break}}n=new MutationObserver(d=>{s||(fv(r)||r(c,d))&&u(d)}),n.observe(t,{childList:!0})}function a(){n&&n.disconnect(),s=!0}return{init:o,destroy:a}}function eQ(t,e,r,n){const s={};let o=null,a=null,l,c=!1;function u(){l=new IntersectionObserver(v=>{c||(v.forEach(p=>{const b=e.indexOf(p.target);s[b]=p}),o=null,a=null,r.emit("slidesInView"))},{root:t.parentElement,threshold:n}),e.forEach(v=>l.observe(v))}function d(){l&&l.disconnect(),c=!0}function h(v){return Ph(s).reduce((p,b)=>{const x=parseInt(b),{isIntersecting:y}=s[x];return(v&&y||!v&&!y)&&p.push(x),p},[])}function m(v=!0){if(v&&o)return o;if(!v&&a)return a;const p=h(v);return v&&(o=p),v||(a=p),p}return{init:u,destroy:d,get:m}}function tQ(t,e,r,n,s,o){const{measureSize:a,startEdge:l,endEdge:c}=t,u=r[0]&&s,d=v(),h=p(),m=r.map(a),f=b();function v(){if(!u)return 0;const y=r[0];return sr(e[l]-y[l])}function p(){if(!u)return 0;const y=o.getComputedStyle(Us(n));return parseFloat(y.getPropertyValue(`margin-${c}`))}function b(){return r.map((y,w,j)=>{const _=!w,S=c1(j,w);return _?m[w]+d:S?m[w]+h:j[w+1][l]-y[l]}).map(sr)}return{slideSizes:m,slideSizesWithGaps:f,startGap:d,endGap:h}}function rQ(t,e,r,n,s,o,a,l,c){const{startEdge:u,endEdge:d,direction:h}=t,m=a1(r);function f(x,y){return Eh(x).filter(w=>w%y===0).map(w=>x.slice(w,w+y))}function v(x){return x.length?Eh(x).reduce((y,w,j)=>{const _=Us(y)||0,S=_===0,N=w===mf(x),P=s[u]-o[_][u],C=s[u]-o[w][d],O=!n&&S?h(a):0,F=!n&&N?h(l):0,T=sr(C-F-(P+O));return j&&T>e+c&&y.push(w),N&&y.push(x.length),y},[]).map((y,w,j)=>{const _=Math.max(j[w-1]||0);return x.slice(_,y)}):[]}function p(x){return m?f(x,r):v(x)}return{groupSlides:p}}function nQ(t,e,r,n,s,o,a){const{align:l,axis:c,direction:u,startIndex:d,loop:h,duration:m,dragFree:f,dragThreshold:v,inViewThreshold:p,slidesToScroll:b,skipSnaps:x,containScroll:y,watchResize:w,watchSlides:j,watchDrag:_,watchFocus:S}=o,N=2,P=FY(),C=P.measure(e),O=r.map(P.measure),F=MY(c,u),T=F.measureSize(C),A=LY(T),k=IY(l,T),$=!h&&!!y,K=h||!!y,{slideSizes:H,slideSizesWithGaps:W,startGap:R,endGap:G}=tQ(F,C,O,r,K,s),U=rQ(F,T,b,h,C,O,R,G,N),{snaps:z,snapsAligned:oe}=VY(F,k,C,O,U),L=-Us(z)+Us(W),{snapsContained:q,scrollContainLimit:he}=WY(T,L,oe,y,N),X=$?q:oe,{limit:J}=HY(L,X,h),de=v4(mf(X),d,h),le=de.clone(),fe=Eh(r),Z=({dragHandler:yt,scrollBody:Wt,scrollBounds:Ct,options:{loop:nt}})=>{nt||Ct.constrain(yt.pointerDown()),Wt.seek()},ae=({scrollBody:yt,translate:Wt,location:Ct,offsetLocation:nt,previousLocation:Ft,scrollLooper:kr,slideLooper:ut,dragHandler:Ue,animation:sn,eventHandler:bt,scrollBounds:Vr,options:{loop:Je}},ie)=>{const be=yt.settled(),st=!Vr.shouldConstrain(),Oe=Je?be:be&&st,$e=Oe&&!Ue.pointerDown();$e&&sn.stop();const Ze=Ct.get()*ie+Ft.get()*(1-ie);nt.set(Ze),Je&&(kr.loop(yt.direction()),ut.loop()),Wt.to(nt.get()),$e&&bt.emit("settle"),Oe||bt.emit("scroll")},E=OY(n,s,()=>Z(Dt),yt=>ae(Dt,yt)),ne=.68,te=X[de.get()],D=yd(te),M=yd(te),V=yd(te),me=yd(te),ve=zY(D,V,M,me,m,ne),se=YY(h,X,L,J,me),pe=QY(E,de,le,ve,se,me,a),xe=qY(J),we=Th(),Ie=eQ(e,r,a,p),{slideRegistry:tt}=KY($,y,X,he,U,fe),Ke=JY(t,r,tt,pe,ve,we,a,S),Dt={ownerDocument:n,ownerWindow:s,eventHandler:a,containerRect:C,slideRects:O,animation:E,axis:F,dragHandler:$Y(F,t,n,s,me,DY(F,s),D,E,pe,ve,se,de,a,A,f,v,x,ne,_),eventStore:we,percentOfView:A,index:de,indexPrevious:le,limit:J,location:D,offsetLocation:V,previousLocation:M,options:o,resizeHandler:BY(e,a,s,r,F,w,P),scrollBody:ve,scrollBounds:UY(J,V,me,ve,A),scrollLooper:GY(L,J,V,[D,V,M,me]),scrollProgress:xe,scrollSnapList:X.map(xe.get),scrollSnaps:X,scrollTarget:se,scrollTo:pe,slideLooper:XY(F,T,L,H,W,z,X,V,r),slideFocus:Ke,slidesHandler:ZY(e,a,j),slidesInView:Ie,slideIndexes:fe,slideRegistry:tt,slidesToScroll:U,target:me,translate:x4(F,e)};return Dt}function sQ(){let t={},e;function r(u){e=u}function n(u){return t[u]||[]}function s(u){return n(u).forEach(d=>d(e,u)),c}function o(u,d){return t[u]=n(u).concat([d]),c}function a(u,d){return t[u]=n(u).filter(h=>h!==d),c}function l(){t={}}const c={init:r,emit:s,off:a,on:o,clear:l};return c}const iQ={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function oQ(t){function e(o,a){return g4(o,a||{})}function r(o){const a=o.breakpoints||{},l=Ph(a).filter(c=>t.matchMedia(c).matches).map(c=>a[c]).reduce((c,u)=>e(c,u),{});return e(o,l)}function n(o){return o.map(a=>Ph(a.breakpoints||{})).reduce((a,l)=>a.concat(l),[]).map(t.matchMedia)}return{mergeOptions:e,optionsAtMedia:r,optionsMediaQueries:n}}function aQ(t){let e=[];function r(o,a){return e=a.filter(({options:l})=>t.optionsAtMedia(l).active!==!1),e.forEach(l=>l.init(o,t)),a.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function n(){e=e.filter(o=>o.destroy())}return{init:r,destroy:n}}function eg(t,e,r){const n=t.ownerDocument,s=n.defaultView,o=oQ(s),a=aQ(o),l=Th(),c=sQ(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:h}=o,{on:m,off:f,emit:v}=c,p=F;let b=!1,x,y=u(iQ,eg.globalOptions),w=u(y),j=[],_,S,N;function P(){const{container:fe,slides:Z}=w;S=(Iw(fe)?t.querySelector(fe):fe)||t.children[0];const E=Iw(Z)?S.querySelectorAll(Z):Z;N=[].slice.call(E||S.children)}function C(fe){const Z=nQ(t,S,N,n,s,fe,c);if(fe.loop&&!Z.slideLooper.canLoop()){const ae=Object.assign({},fe,{loop:!1});return C(ae)}return Z}function O(fe,Z){b||(y=u(y,fe),w=d(y),j=Z||j,P(),x=C(w),h([y,...j.map(({options:ae})=>ae)]).forEach(ae=>l.add(ae,"change",F)),w.active&&(x.translate.to(x.location.get()),x.animation.init(),x.slidesInView.init(),x.slideFocus.init(le),x.eventHandler.init(le),x.resizeHandler.init(le),x.slidesHandler.init(le),x.options.loop&&x.slideLooper.loop(),S.offsetParent&&N.length&&x.dragHandler.init(le),_=a.init(le,j)))}function F(fe,Z){const ae=U();T(),O(u({startIndex:ae},fe),Z),c.emit("reInit")}function T(){x.dragHandler.destroy(),x.eventStore.clear(),x.translate.clear(),x.slideLooper.clear(),x.resizeHandler.destroy(),x.slidesHandler.destroy(),x.slidesInView.destroy(),x.animation.destroy(),a.destroy(),l.clear()}function A(){b||(b=!0,l.clear(),T(),c.emit("destroy"),c.clear())}function k(fe,Z,ae){!w.active||b||(x.scrollBody.useBaseFriction().useDuration(Z===!0?0:w.duration),x.scrollTo.index(fe,ae||0))}function $(fe){const Z=x.index.add(1).get();k(Z,fe,-1)}function K(fe){const Z=x.index.add(-1).get();k(Z,fe,1)}function H(){return x.index.add(1).get()!==U()}function W(){return x.index.add(-1).get()!==U()}function R(){return x.scrollSnapList}function G(){return x.scrollProgress.get(x.offsetLocation.get())}function U(){return x.index.get()}function z(){return x.indexPrevious.get()}function oe(){return x.slidesInView.get()}function L(){return x.slidesInView.get(!1)}function q(){return _}function he(){return x}function X(){return t}function J(){return S}function de(){return N}const le={canScrollNext:H,canScrollPrev:W,containerNode:J,internalEngine:he,destroy:A,off:f,on:m,emit:v,plugins:q,previousScrollSnap:z,reInit:p,rootNode:X,scrollNext:$,scrollPrev:K,scrollProgress:G,scrollSnapList:R,scrollTo:k,selectedScrollSnap:U,slideNo
637des:de,slidesInView:oe,slidesNotInView:L};return O(e,r),setTimeout(()=>c.emit("init"),0),le}eg.globalOptions=void 0;function u1(t={},e=[]){const r=g.useRef(t),n=g.useRef(e),[s,o]=g.useState(),[a,l]=g.useState(),c=g.useCallback(()=>{s&&s.reInit(r.current,n.current)},[s]);return g.useEffect(()=>{o1(r.current,t)||(r.current=t,c())},[t,c]),g.useEffect(()=>{TY(n.current,e)||(n.current=e,c())},[e,c]),g.useEffect(()=>{if(PY()&&a){eg.globalOptions=u1.globalOptions;const u=eg(a,r.current,n.current);return o(u),()=>u.destroy()}else o(void 0)},[a,o]),[l,s]}u1.globalOptions=void 0;function tu({quotes:t,eyebrow:e,heading:r,variant:n="muted",autoplayMs:s=7e3}){const[o,a]=u1({loop:!0,align:"start"}),[l,c]=g.useState(0),[u,d]=g.useState([]),[h,m]=g.useState(!1);return g.useEffect(()=>{if(!a)return;d(a.scrollSnapList());const f=()=>c(a.selectedScrollSnap());a.on("select",f),a.on("reInit",f),f()},[a]),g.useEffect(()=>{if(!a||h)return;const f=setInterval(()=>a.scrollNext(),s);return()=>clearInterval(f)},[a,h,s]),i.jsx("section",{className:Se("py-20 px-4 border-y border-border/50",n==="muted"&&"bg-muted/40",n==="gradient"&&"bg-gradient-to-br from-primary/5 via-card to-accent/5"),children:i.jsxs("div",{className:"container mx-auto max-w-7xl",children:[(e||r)&&i.jsxs("div",{className:"text-center mb-10",children:[e&&i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-primary mb-2",children:e}),r&&i.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground",children:r})]}),i.jsxs("div",{className:"relative",onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[i.jsx("div",{className:"overflow-hidden",ref:o,children:i.jsx("div",{className:"flex -ml-4",children:t.map((f,v)=>i.jsx("div",{className:"min-w-0 shrink-0 grow-0 basis-full md:basis-1/2 lg:basis-1/3 pl-4",children:i.jsxs("article",{className:"h-full bg-card border border-border/60 rounded-2xl p-8 shadow-sm hover:shadow-md transition-shadow flex flex-col",children:[i.jsx(s_,{className:"h-8 w-8 text-primary/30 mb-4"}),i.jsx("div",{className:"flex gap-1 mb-4",children:Array.from({length:5}).map((p,b)=>i.jsx(ys,{className:"h-4 w-4 fill-primary text-primary"},b))}),i.jsxs("p",{className:"text-lg md:text-xl font-bold text-foreground leading-relaxed flex-1",children:['"',f.quote,'"']}),i.jsxs("p",{className:"text-sm font-medium text-muted-foreground mt-6",children:["— ",f.role]})]})},v))})}),t.length>1&&i.jsxs("div",{className:"flex items-center justify-center gap-4 mt-8",children:[i.jsx(Y,{variant:"outline",size:"icon",className:"h-9 w-9 rounded-full",onClick:()=>a==null?void 0:a.scrollPrev(),"aria-label":"Previous testimonials",children:i.jsx(DP,{className:"h-4 w-4"})}),i.jsx("div",{className:"flex gap-2",children:u.map((f,v)=>i.jsx("button",{onClick:()=>a==null?void 0:a.scrollTo(v),"aria-label":`Go to slide ${v+1}`,className:Se("h-2 rounded-full transition-all",v===l?"w-6 bg-primary":"w-2 bg-border hover:bg-muted-foreground/40")},v))}),i.jsx(Y,{variant:"outline",size:"icon",className:"h-9 w-9 rounded-full",onClick:()=>a==null?void 0:a.scrollNext(),"aria-label":"Next testimonials",children:i.jsx(Gh,{className:"h-4 w-4"})})]})]})]})})}function Yo({quotes:t,showRatings:e=!1}){return i.jsx("section",{className:"border-y border-border/50 bg-card px-4 py-14 md:py-16",children:i.jsxs("div",{className:"container mx-auto max-w-6xl",children:[i.jsx("div",{className:`grid gap-8 ${t.length>2?"lg:grid-cols-3":"md:grid-cols-2"}`,children:t.map(r=>i.jsxs("figure",{className:"flex h-full flex-col border-l-4 border-primary pl-6 md:pl-8",children:[i.jsx(s_,{className:"mb-4 h-7 w-7 text-primary","aria-hidden":"true"}),i.jsxs("blockquote",{className:"flex-1 text-xl font-bold leading-relaxed text-foreground md:text-2xl",children:["“",r.quote,"”"]}),i.jsxs("figcaption",{className:"mt-5 text-sm font-semibold text-muted-foreground",children:["— ",r.role]})]},`${r.quote}-${r.role}`))}),e&&i.jsxs("div",{className:"mt-10 flex flex-col items-center justify-center gap-3 border-t border-border/60 pt-7 sm:flex-row sm:gap-8",children:[i.jsxs("a",{href:"https://www.producthunt.com/products/pressmegpt-com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 font-semibold text-foreground transition-colors hover:text-primary",children:[i.jsx(ys,{className:"h-5 w-5 fill-primary text-primary","aria-hidden":"true"}),"Rated 4.5 Stars on Product Hunt"]}),i.jsxs("a",{href:"https://www.trustpilot.com/review/pressmegpt.com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 font-semibold text-foreground transition-colors hover:text-primary",children:[i.jsx(ys,{className:"h-5 w-5 fill-primary text-primary","aria-hidden":"true"}),"Rated 4.5 Stars on Trustpilot"]})]})]})})}const lQ=[{quote:"From what I have seen, I would describe PressMegpt as an ideal solution to have a site developed.",role:"Business Owner"},{quote:"A must-use for WordPress users of all experience types. Makes themes much easier and efficie
637nt.",role:"Blogger"},{quote:"No more searching hours for the template that will save you the most time in later development. Just use this, add your media and enjoy the time saved doing something else.",role:"Blogger"},{quote:"It gave me 80% of my needs in just one click.",role:"Freelancer"},{quote:"The biggest benefit I experienced was the significant reduction in development time. I was able to generate a well-structured, modern portfolio website, focus on content and branding, and avoid spending days building the UI from scratch.",role:"WordPress Developer"},{quote:"A decent starting point for a wordpress site.",role:"Freelancer"},{quote:"It is a game changer, the future to wordpress development.",role:"Web Developer"},{quote:"I love it that i can finally design for myself instead of buying on themeforest.",role:"Blogger"},{quote:"A wordpress theme builder without all the bloat of industry standards like Divi or Elementor.",role:"Web Developer"},{quote:"I can translate text prompt into custom functional wordpress themes in minutes. Also i can copy existing web design or migrate projects built on other platforms into native Wordpress themes.",role:"Business Owner"},{quote:"It is an AI powered tool that helps you create WordPress websites and themes simply by describing what you want.",role:"Blogger"},{quote:"A great way to mockup a client's site design.",role:"Agency Owner"},{quote:"Awesome. Allows me to do things no other app can do.",role:"Blogger"}],Cr=t=>{const e=lQ.find(r=>r.quote.toLowerCase().includes(t.toLowerCase()));if(!e)throw new Error(`Testimonial not found: ${t}`);return e},y4=[Cr("mockup a client"),Cr("game changer"),Cr("80% of my needs"),Cr("AI powered tool")],b4=[Cr("Awesome. Allows me"),Cr("without all the bloat"),Cr("translate text prompt"),Cr("must-use for WordPress"),Cr("80% of my needs"),Cr("design for myself"),Cr("mockup a client"),Cr("decent starting point")],cQ=[Cr("significant reduction in development time"),Cr("without all the bloat"),Cr("No more searching hours"),Cr("ideal solution to have a site developed")],uQ=[Cr("game changer"),Cr("translate text prompt"),Cr("must-use for WordPress"),Cr("Awesome. Allows me")],us=[{quote:"The AI saves me days of work, and the preview helps me visualize the design before exporting.",role:"WordPress Developer, 1–3 years experience"},{quote:"I was able to generate a well-structured, modern portfolio website and avoid spending days building the UI from scratch.",role:"Freelancer & WordPress Developer, 3–7 years experience"},{quote:"I can translate a text prompt into a custom, functional WordPress theme in minutes.",role:"Business Owner building their own site"},{quote:"It saved a lot of time and generated a professional website structure quickly.",role:"WordPress Developer & Freelancer"},{quote:"The biggest benefit is significantly reducing the time spent on repetitive coding tasks, allowing me to focus more on de
637sign and strategy.",role:"Freelancer using Elementor, 3+ years experience"},{quote:"It creates a modern WordPress design much faster than building everything manually, while keeping the result editable and exportable.",role:"Business Owner, 10+ years WordPress experience"},{quote:"Speed and agility — not having to search through endless styling that a client may want.",role:"Freelancer using Elementor, 7+ years experience"},{quote:"The speed of generating high-quality structural layouts. It eliminates the ‘blank page’ struggle and allows me to focus on creative art direction and fine-tuning.",role:"Freelancer using Elementor, 1+ years experience"},{quote:"It takes your ideas or what you've already created on Lovable and turns it into a functioning, editable theme on WordPress.",role:"Agency Owner"},{quote:"I used AI to save time making a website — now this app helps me convert that AI website into something I can edit with WordPress.",role:"New WordPress user"},{quote:"Very easy to make a WordPress theme. Before this, it was very difficult — I don't understand coding at all.",role:"Hobbyist / Blogger, 3–7 years WordPress experience"},{quote:"Saved my company money.",role:"In-house Marketing Team"}],Cc=[[us[0],us[2]],[us[8],us[9]],[us[10],us[11]]],DN=[[us[1],us[3],us[4]],[us[5],us[6],us[7]]],Xt=t1,d1=r1,dQ=n1,hQ=hf,w4=g.forwardRef(({className:t,...e},r)=>i.jsx(lf,{ref:r,className:Se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));w4.displayName=lf.displayName;const Qt=g.forwardRef(({className:t,children:e,hideClose:r=!1,...n},s)=>i.jsxs(dQ,{children:[i.jsx(w4,{}),i.jsxs(cf,{ref:s,className:Se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,!r&&i.jsxs(hf,{className:"absolute right-4 top-4 roun
637ded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(Bn,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Qt.displayName=cf.displayName;const gn=({className:t,...e})=>i.jsx("div",{className:Se("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});gn.displayName="DialogHeader";const pf=({className:t,...e})=>i.jsx("div",{className:Se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});pf.displayName="DialogFooter";const wr=g.forwardRef(({className:t,...e},r)=>i.jsx(uf,{ref:r,className:Se("text-lg font-semibold leading-none tracking-tight",t),...e}));wr.displayName=uf.displayName;const jn=g.forwardRef(({className:t,...e},r)=>i.jsx(df,{ref:r,className:Se("text-sm text-muted-foreground",t),...e}));jn.displayName=df.displayName;const h1="/assets/convert-providers-Da-cigA0.png",_4="/assets/hero-wordpress-ai-website-builder-BM26PhVC.png",fQ="/assets/terra-nova-v1TcsgGl.png",mQ="/assets/gradient-shift-CmVBkmIx.png",pQ="/assets/beauty-salon-rwyR7nuW.png",gQ="/assets/cadence-dark-BEW8F7js.png",vQ="/assets/persona-BQwhutqV.png",xQ="/assets/community-weaver-FrA64diN.png",yQ="/assets/ember-ash-BkHCwsgu.png",bQ="/assets/red-brick-DNPKZ6cP.png",wQ="/assets/learning-center-C_V_HwkD.png",j4="/assets/spectra_logo-CE0lheiT.gif",k4="/assets/kadence_blocks_logo-SnFa6FOt.png",S4="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20256%20256'%3e%3cpath%20style='fill:%230f111f'%20d='M0%200h256v256H0z'/%3e%3cpath%20d='M68.3%20133.1V91.6h.1l21.2-7.5%2021.2-7.5%2031.6-11.2L174%2054.2h.1c.1%200%200%200%200-.1V30.7s0-.2-.1-.2h-.2l-42.4%2015.1L89%2060.7l-21.2%207.5-21.2%207.5h-.1c-.1%200%200%200%200%20.1v124.3s0%20.2.1.2h.2l10.7-3.8%2010.7-3.8h.1c.1%200%200%200%200-.1v-59.1Z'%20style='fill:%2300aee6'/%3e%3cpath%20d='m124.6%20127.7%2042.4-15.1%2042.4-15.1h.1c.1%200%200%200%200-.1V56.3s0-.2-.1-.2h-.2l-42.4%2015.1-42.4%2015.1-21.2%207.5-21.2%207.5h-.1c-.1%200%200%200%200%20.1v124.3s0%20.2.1.2h.2l21.1-7.5%2021.1-7.5%2021.3-7.6%2021.3-7.6%2021.2-7.5%2021.2-7.5h.1c.1%200%200%200%200-.1v-61.9s0-.2-.1-.2h-.2l-21%207.5-21%207.5h-.1c-.1%200%200%200%200%20.1v20.5h-.1l-21%207.5-21%207.5h-.2s-.1-.1-.1-.2v-41.2h.1Z'%20style='fill:%23fff'/%3e%3c/svg%3e",N4="/assets/stackable_logo-cfkUPa-V.png",C4="/assets/greenshift_logo-CHBlcNwX.gif",E4="/assets/otter_blocks-BN11Gbkr.gif",P4="/assets/ultimate_blocks_logo-DgxpaXRu.png",T4="/assets/qubely_logo-CEChtn-a.jpg",A4="/assets/coblocks_logo-BZS_Zd5G.jpg",R4="data:image/svg+xml,%3csvg%20width='256'%20height='256'%20viewBox='0%200%20256%20256'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M56.96%207.0411L7.04%2056.9689C2.52%2061.4896%200%2067.5706%200%2073.9316V243.998C0%20250.639%205.36%20256%2012%20256H244C250.64%20256%20256%20250.639%20256%20243.998V12.0019C256%205.36084%20250.64%200%20244%200H73.96C67.6%200%2061.48%202.52039%2057%207.0411H56.96Z'%20fill='url(%23paint0_radial_84_8417)'/%3e%3cg%20filter='url(%23filter0_d_84_8417)'%3e%3cpath%20d='M181.129%20168.663H162.596V94.0793H211.999V111.447H181.129V124.756H210.225V141.692H181.129V168.666V168.663Z'%20fill='white'/%3e%3cpath%20opacity='0.05'%20d='M157.707%20137.362H176.077C173.359%20156.345%20157.4%20168.9%20138.066%20168.9C116.894%20168.9%2099.6553%20153.029%2099.6553%20131.657C99.611%20126.686%20100.574%20121.759%20102.487%20117.174C104.4%20112.589%20107.222%20108.441%20110.781%20104.984C118.088%2097.8862%20127.896%2093.9739%20138.066%2094.1001C157.221%2094.1001%20173.626%20106.752%20175.958%20125.431H157.607C152.089%20104.272%20117.707%20106.341%20117.707%20131.657C117.707%20156.975%20152.52%20158.84%20157.707%20137.368V137.362Z'%20fill='%23002447'/%3e%3cpath%20d='M153.948%20137.362C150.796%20148.042%20139.579%20154.392%20128.538%20151.733C117.49%20149.064%20110.568%20138.354%20112.862%20127.467C115.152%20116.577%20125.835%20109.402%20137.058%20111.219C141.656%20111.843%20145.896%20114.048%20149.055%20117.456C151.239%20119.711%20152.877%20122.438%20153.845%20125.428H171.659C169.327%20106.706%20152.877%2094.1003%20133.767%2094.1003C123.596%2093.9705%20113.785%2097.8807%20106.476%20104.978C102.914%20108.436%20100.091%20112.585%2098.1774%20117.173C96.2641%20121.76%2095.3012%20126.69%2095.3473%20131.663C95.3473%20153.035%20112.485%20168.9%2
6370133.773%20168.9C153.092%20168.9%20169.005%20156.345%20171.772%20137.362H153.945H153.948Z'%20fill='white'/%3e%3cpath%20opacity='0.05'%20d='M98.5881%20157.812H72.7959L68.5796%20168.65H48.8418L79.0475%2094H92.2121L123.619%20168.675H102.78L98.582%20157.812H98.5881ZM80.1274%20139.334L79.4813%20141.019H92.0028L91.569%20139.754L85.739%20123.746L80.1274%20139.334Z'%20fill='%23002447'/%3e%3cpath%20d='M93.7039%20157.812H67.9541L63.7408%20168.65H44L74.2088%2094H87.3733L118.78%20168.675H97.9505L93.7039%20157.812ZM75.2856%20139.334L74.6425%20141.019H87.164L86.7272%20139.754L80.9002%20123.746L75.2886%20139.334H75.2856Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_d_84_8417'%20x='36'%20y='86'%20width='183.999'%20height='90.8997'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset/%3e%3cfeGaussianBlur%20stdDeviation='4'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200.141176%200%200%200%200%200.278431%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='BackgroundImageFix'%20result='effect1_dropShadow_84_8417'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='effect1_dropShadow_84_8417'%20result='shape'/%3e%3c/filter%3e%3cradialGradient%20id='paint0_radial_84_8417'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(45)%20scale(362.039)'%3e%3cstop%20stop-color='%230ECAD4'/%3e%3cstop%20offset='1'%20stop-color='%23006BD6'/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e",I4="/assets/wordpress_icon-DKXsAQ5N.png",O4="/assets/essential_addons-PL09GBxC.gif",M4="/assets/unlimited_elements-9dLVnFEn.png",$4="/assets/crocoblock-DBnKwusu.jpeg",D4="/assets/ultimate_addons_elementor-CuEDgxAl.jpeg",F4="/assets/powerpack-BMnxYzR6.png",L4="/assets/elementskit-HNZliECF.webp",B4="/assets/the_plus_addons-lWwz1CdS.png",z4="/assets/premium_addons-Ba8HlfME.png",U4="/assets/elementor_extras-DKf_ftzf.gif",W4="/assets/dynamic_content-drUpcwtK.webp",_Q=[{icon:gl,title:"Small Businesses",description:"Are you familiar with WordPress but don't know how to design your own theme? PressMeGPT can generate a beautiful website in a few minutes, saving you thousands."},{icon:WP,title:"Marketing Agencies",description:"Finally you can design & customize WordPress websites yourself from scratch without needing a web designer to make simple changes."},{icon:$P,title:"Freelancers",description:"Want to increase your profit without increasing your hourly rate? Let PressMeGPT get you to 80% in a few minutes, and customize the rest with your skills."},{icon:BP,title:"Web Development Agencies",description:"Want to improve your team's workflow and output? Use PressMeGPT to generate an Elementor, Gutenberg, & Classic theme with no plugin bloat and time savings, then modify to satisfy the requirements."},{icon:HP,title:"Bloggers & Content Creators",description:"Trying to find that perfect WordPress theme, only for it to look nothing like what was advertised? PressMeGPT themes look just like what you design."},{icon:qh,title:"Founders & Entrepreneurs",description:"Need to get an SEO friendly website up quickly for your next big idea without fussing with theme customization. PressMeGPT generates a theme that looks like what you design with AI prompts."}],jQ=[{src:fQ,alt:"Terra Nova - Adventure Travel Theme",slug:"terra-nova-1768162190305-0"},{src:mQ,alt:"GradientShift - SaaS Theme",slug:"gradientshift-1767930896193-1"},{src:pQ,alt:"Beauty Salon Theme",slug:"glamour-1767899216888-0"},{src:gQ,alt:"Cadence Dark - CAD Software Theme",slug:"cadence-dark-1768308813813-1"},{src:vQ,alt:"Persona AI - Review Blog Theme",slug:"persona-1767621391908-3"},{src:xQ,alt:"Community Weaver - Church Theme",slug:"community-weaver-1768315551616-1"},{src:yQ,alt:"Ember & Ash - Restaurant Theme",slug:"ember-ash-1768328855341-1"},{src:bQ,alt:"The Red Brick - Diner Theme",slug:"the-red-brick-1768328857253-2"},{src:wQ,alt:"Learning Center - Education Theme",slug:"amaki-explorer-1768378475718-1"}
637],kQ=[{src:j4,name:"Spectra"},{src:k4,name:"Kadence Blocks"},{src:S4,name:"Generate Blocks"},{src:N4,name:"Stackable"},{src:C4,name:"Greenshift"},{src:E4,name:"Otter Blocks"},{src:P4,name:"Ultimate Blocks"},{src:T4,name:"Qubely"},{src:A4,name:"CoBlocks"},{src:R4,name:"ACF Blocks"}],SQ=[{src:O4,name:"Essential Addons"},{src:M4,name:"Unlimited Elements"},{src:$4,name:"Crocoblock"},{src:D4,name:"Ultimate Addons"},{src:F4,name:"PowerPack"},{src:L4,name:"ElementsKit"},{src:B4,name:"The Plus Addons"},{src:z4,name:"Premium Addons"},{src:U4,name:"Elementor Extras"},{src:W4,name:"Dynamic Content"}];function NQ(){const t=Zt(),{user:e,loading:r}=$t(),[n,s]=g.useState("gutenberg"),[o,a]=g.useState(null),[l,c]=g.useState(!1);return g.useEffect(()=>{re.from("public_themes").select("*",{count:"exact",head:!0}).then(({count:u})=>{typeof u=="number"&&a(u)})},[]),g.useEffect(()=>{e&&!r&&t("/dashboard")},[e,r,t]),i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(yl,{title:"WordPress AI Website Builder & Theme Generator - PressMeGPT",description:"Generate production-ready WordPress themes with editable headers, footers, and blocks — export and use anywhere without additional plugins or bloat!",canonicalUrl:"https://pressmegpt.com",keywords:"wordpress ai, wordpress theme generator, elementor theme generator, gutenberg theme builder, wordpress website builder, ai wordpress"}),i.jsx(zr,{}),i.jsx("div",{className:"bg-primary text-primary-foreground py-3 px-4",children:i.jsx("div",{className:"container mx-auto flex items-center justify-center text-sm md:text-base text-center",children:i.jsxs("span",{children:[i.jsx("strong",{children:"New Features:"})," ",i.jsx("a",{href:"#convert-design",className:"underline hover:no-underline",children:"Convert a Design"})," ","from Wix, Lovable, Gemini, Claude & others to WordPress. Now"," ",i.jsx("a",{href:"#compatibility",className:"underline hover:no-underline",children:"compatible with Elementor"})," ","& more."]})})}),i.jsxs("main",{children:[i.jsxs("section",{className:"py-24 px-4 relative overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/5 via-transparent to-accent/5"}),i.jsxs("div",{className:"container mx-auto text-center max-w-4xl relative",children:[i.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary/10 text-primary text-sm font-medium mb-6",children:[i.jsx(St,{className:"h-4 w-4"}),"AI WordPress Theme Generator & Website Builder"]}),i.jsx("h1",{className:"text-3xl md:text-5xl lg:text-6xl font-bold mb-6 tracking-tight",children:"The Easiest Way to Convert Any Web Design to WordPress & Create Themes with AI"}),i.jsx("h2",{className:"text-xl md:text-2xl font-semibold mb-4 text-muted-foreground",children:"No Plugins. No Builders. No Code. No Lock-in. Only Words."}),i.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-10 leading-relaxed max-w-3xl mx-auto",children:"Export as an Elementor, Gutenberg, or Classic theme and host anywhere."}),i.jsx("div",{className:"flex gap-4 justify-center flex-wrap",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25 text-lg px-8 py-6",children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{children:"Start Free Trial"})]})}),i.jsx("div",{className:"mt-4 flex justify-center",children:i.jsxs("button",{type:"button",onClick:()=>c(!0),className:"inline-flex items-center gap-2 text-primary hover:text-primary/80 font-medium underline-offset-4 hover:underline transition-colors",children:[i.jsx(Vc,{className:"h-4 w-4 fill-current"}),"Watch Demo Video"]})}),i.jsx("p",{className:"text-sm text-muted-foreground mt-6",children:"Enjoy the Pro features for 3 days with ways to earn free credits. No credit card required."})]})]}),i.jsx(tu,{eyebrow:"What builders are saying",heading:"Trusted by WordPress creators",variant:"muted",quotes:y4}
637),i.jsx("section",{id:"benefits",className:"py-20 px-4 bg-gradient-to-br from-destructive/10 via-card to-destructive/5 border-y border-destructive/10",children:i.jsxs("div",{className:"container mx-auto max-w-4xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"The Problem With Traditional WordPress Themes & Builders"}),i.jsx("p",{className:"text-center text-muted-foreground mb-10 max-w-2xl mx-auto",children:"Most WordPress builders create long-term pain:"}),i.jsx("div",{className:"grid md:grid-cols-2 gap-4 mb-8",children:["You keep paying monthly even after the site is finished","Themes don't look like the demo without hours of tweaking","Heavy page builders and plugins slow your site down","Plugin stacks increase security risks","Updates break things — stop paying and things break"].map((u,d)=>i.jsxs("div",{className:"flex items-start gap-3 bg-card/80 rounded-xl p-4 border border-destructive/20",children:[i.jsx("span",{className:"text-destructive text-xl flex-shrink-0",children:"❌"}),i.jsx("p",{className:"text-foreground",children:u})]},d))}),i.jsx("p",{className:"text-center text-lg font-medium text-muted-foreground",children:"You shouldn't need a subscription just to keep a finished site running."})]})}),i.jsx("section",{className:"py-20 px-4 bg-gradient-to-br from-primary/10 via-accent/5 to-primary/5",children:i.jsxs("div",{className:"container mx-auto max-w-4xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"The PressMeGPT Difference"}),i.jsx("p",{className:"text-center text-muted-foreground mb-10 max-w-2xl mx-auto",children:"Pay once. Generate themes forever with credits. Build clean, production-ready WordPress themes in minutes — without page builders, plugins, or recurring fees."}),i.jsx("div",{className:"grid md:grid-cols-2 gap-4 mb-10",children:["You own the theme once it's generated","What you see is what you get — the theme actually matches the design!","No page builders or plugins required","Lightweight, fast, and secure","Works with Elementor, Gutenberg, & Classic Editor"].map((u,d)=>i.jsxs("div",{className:"flex items-start gap-3 bg-card/80 rounded-xl p-4 border border-primary/20",children:[i.jsx("span",{className:"text-primary text-xl flex-shrink-0",children:"✓"}),i.jsx("p",{className:"text-foreground",children:u})]},d))}),i.jsx("p",{className:"text-center text-lg font-semibold text-foreground mb-8",children:"Generate the theme → Download it → Install it → Host it wherever you want!"}),i.jsx("div",{className:"text-center",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25",children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{children:"Start Free Trial"})]})})]})}),i.jsx(Yo,{quotes:Cc[0]}),i.jsx("section",{id:"how-it-works",className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-5xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"How It Works"}),i.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-2xl mx-auto",children:"Three simple steps to create your perfect WordPress theme"}),i.jsx("div",{className:"max-w-5xl mx-auto mb-12 flex justify-center",children:i.jsx("img",{src:_4,alt:"Generate WordPress themes from a simple prompt — works with WordPress and Elementor",className:"w-full h-auto",loading:"lazy"})}),i.jsxs("div",{className:"grid md:grid-cols-3 gap-8 mb-16",children:[i.jsxs("div",{className:"text-center group",children:[i.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary text-primary-foreground flex items-center justify-center mx-auto mb-5 shadow-lg shadow-primary/20 group-hover:scale-110 transition-transform",children:i.jsx(St,{className:"h-7 w-7"})}),i.jsx("h3",{className:"text-lg font-semibold mb-3",children:"1. Describe Your Vision"}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Tell us about your ideal theme - colors, style, industry, and mood. Our AI understands your needs."})]}),i.jsxs("div",{className:"text-center group",children:[i.jsx("div",{className:"w-16 h-16 rounded-2xl bg-accent text-accent-foreground flex items-center justify-center mx-auto mb-5 shadow-lg shadow-accent/20 group-hover:scale-110 transition-transform",children:i.jsx(xp,{className:"h-7 w-7"})}),i.jsx("h3",{className:"text-lg font-semibold mb-3",children:"2. Choose & Customize"}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Pick from 3 unique designs, then fine-tune each section with AI-powered customization."})]}),i.jsxs("div",{className:"text-center group",children:[i.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary text-primary-foreground flex items-center justify-center mx-auto mb-5 shadow-lg shadow-primary/20 group-hover:scale-110 transition-transform",children:i.jsx(Wn,{className:"h-7 w-7"})}),i.jsx("h3",{className:"text-lg font-semibold mb-3",children:"3. Export & Install"}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Download a complete WordPress theme package ready to upload and activate on your site."})]})]}),i.jsx("div",{className:"text-center",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25",children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{children:"Start Free Trial"})]})})]})}),i.jsxs("section",{id:"convert-design",className:"py-20 px-4 relative overflow-hidden bg-gradient-to-br from-primary/15 via-accent/10 to-primary/5 border-y border-primary/20",children:[i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,hsl(var(--primary)/0.1),transparent_60%),radial-gradient(ellipse_at_bottom_left,hsl(var(--accent)/0.15),transparent_60%)]"}),i.jsxs("div",{className:"container mx-auto max-w-4xl relative",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Even Convert Your Existing Site to WordPress"}),i.jsx("p",{className:"text-center text-muted-foreground mb-8 max-w-2xl mx-auto text-lg leading-relaxed",children:"You can now create a WordPress theme from an existing site or draw inspiration from any of these providers:"}),i.jsx("div",{className:"flex justify-center mb-10",children:i.jsx("img",{src:h1,alt:"Convert from Gemini, Replit, Squarespace, Wix, Claude, Base44, Lovable, Framer, Webflow, Bolt.new, and HTML to WordPress via PressMeGPT",className:"max-w-full h-auto max-h-[400px] object-contain"})}),i.jsx("p",{className:"text-center text-muted-foreground mb-8 max-w-2xl mx-auto",children:"Simply paste a URL and our AI will replicate the structure, layout, and styling into a clean, lightweight WordPress theme — ready to export and install."}),i.jsx("div",{className:"text-center",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25",children:[i.jsx(Ga,{className:"h-5 w-5 mr-2"}),"Convert Your Site Now"]})})]})]}),i.jsx(Yo,{quotes:Cc[1]}),i.jsx("section",{id:"compatibility",className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-5xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Export to Your Favorite Builders"}),i.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-2xl mx-auto",children:"Export themes that work seamlessly with the most popular WordPress builders and block editors"}),i.jsxs("div",{className:"grid md:grid-cols-2 gap-8 max-w-3xl mx-auto mb-8",children:[i.jsxs("button",{onClick:()=>s("elementor"),onMouseEnter:()=>s("elementor"),className:`bg-card rounded-2xl p-8 border text-center transition-all cursor-pointer ${n==="elementor"?"border-primary shadow-lg ring-2 ring-primary/20":"border-border/50 hover:shadow-lg"}`,children:[i.jsx("div",{className:"w-20 h-20 mx-auto mb-4 flex items-center justify-center",children:i.jsxs("svg",{viewBox:"0 0 800 800",className:"w-full h-full",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M400 0C179.1 0 0 179.1 0 400s179.1 400 400 400 400-179.1 400-400S620.9 0 400 0z",fill:"#92003B"}),i.jsx("path",{d:"M296 296h48v208h-48zM392 296h112v48H392zM392 376h112v48H392zM392 456h112v48H392z",fill:"#fff"})]})}),i.jsx("h3",{className:"text-xl font-bold mb-2",children:"Elementor"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Works with Elementor Free and Pro"})]}),i.jsxs("button",{onClick:()=>s("gutenberg"),onMouseEnter:()=>s("gutenberg"),className:`bg-card rounded-2xl p-8 border text-center transition-all cursor-pointer ${n==="gutenberg"?"border-primary shadow-lg ring-2 ring-primary/20":"border-border/50 hover:shadow-lg"}`,children:[i.jsx("div",{className:"w-20 h-20 mx-auto mb-4 flex items-center justify-center",children:i.jsx("img",{src:I4,alt:"WordPress",className:"w-full h-full object-contain"})}),i.jsx("h3",{className:"text-xl font-bold mb-2",children:"Gutenberg & Classic"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Native WordPress block themes and classic PHP themes"})]})]}),i.jsxs("div",{className:"bg-card rounded-2xl p-8 border border-border/50 max-w-3xl mx-auto",children:[i.jsx("p",{className:"text-center text-sm text-muted-foreground mb-6",children:n==="gutenberg"?"Also works with popular Gutenberg Block plugins":"Also w
637orks with popular Elementor Addon plugins"}),i.jsx("div",{className:"grid grid-cols-5 gap-6 max-w-xl mx-auto",children:(n==="gutenberg"?kQ:SQ).map(u=>i.jsxs("div",{className:"flex flex-col items-center gap-1.5 group",title:u.name,children:[i.jsx("div",{className:"w-12 h-12 rounded-lg bg-background border border-border/50 flex items-center justify-center overflow-hidden group-hover:scale-110 transition-transform shadow-sm",children:i.jsx("img",{src:u.src,alt:u.name,className:"w-8 h-8 object-contain"})}),i.jsx("span",{className:"text-xs text-muted-foreground leading-tight text-center max-w-[70px]",children:u.name})]},u.name))})]})]})}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-6xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Who It's For"}),i.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-2xl mx-auto",children:"PressMeGPT helps professionals across industries save time and money"}),i.jsx("div",{className:"grid md:grid-cols-2 gap-8",children:_Q.map((u,d)=>i.jsx("div",{className:"bg-card rounded-2xl p-6 border border-border/50 hover:shadow-lg transition-shadow",children:i.jsxs("div",{className:"flex items-start gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 text-primary flex items-center justify-center flex-shrink-0",children:i.jsx(u.icon,{className:"h-6 w-6"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-2",children:u.title}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:u.description})]})]})},d))}),i.jsx("div",{className:"text-center mt-12",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25",children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{children:"Start Free Trial"})]})})]})}),i.jsx(tu,{eyebrow:"Loved by WordPress pros",heading:"From freelancers to agencies",variant:"gradient",quotes:b4}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-6xl",children:[i.jsxs("h2",{className:"text-3xl font-bold text-center mb-4",children:[(o??1500).toLocaleString(),o===null?"+":""," Themes Generated and Counting"]}),i.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-2xl mx-auto",children:"Real WordPress themes generated with PressMeGPT"}),i.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-10",children:jQ.map((u,d)=>i.jsxs("a",{href:`/themes/${u.slug}`,target:"_blank",rel:"noopener noreferrer",className:"group relative overflow-hidden rounded-xl border border-border/50 bg-card shadow-sm hover:shadow-xl transition-all duration-300 cursor-pointer text-left block",children:[i.jsx("div",{className:"aspect-[16/10] overflow-hidden",children:i.jsx("img",{src:u.src,alt:u.alt,className:"w-full h-full object-cover object-top group-hover:scale-105 transition-transform duration-500"})}),i.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-background/80 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end justify-center pb-4",children:i.jsx("span",{className:"text-sm font-medium text-foreground bg-background/80 px-3 py-1.5 rounded-full",children:"Click to Preview"})})]},d))}),i.jsx("div",{className:"text-center",children:i.jsxs(Y,{variant:"outline",size:"lg",onClick:()=>t("/themes"),children:["View More Themes",i.jsx(Ga,{className:"h-4 w-4 ml-2"})]})})]})}),i.jsx(wu,{}),i.jsx("section",{className:"py-20 px-4",children:i.jsx("div",{className:"container mx-auto max-w-5xl",children:i.jsxs("div",{className:"bg-gradient-to-br from-primary/10 via-card to-accent/10 rounded-3xl p-12 md:p-16 text-center border border-border/50",children:[i.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Generate Your First WordPress Theme Free"}),i.jsx("p",{className:"text-muted-foreground mb-8 text-lg max-w-3xl mx-auto",children:"Join thousands of agencies, designers, small businesses, developers, and freelancers using AI to build beautiful Elementor, Gutenberg, & Classic WordPress themes faster."}),i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25 text-lg px-8 py-6",children:[i.jsx("span",{children:"Start Free Trial"}),i.jsx(Ga,{className:"h-5 w-5 ml-2"})]})]})})}),i.jsx(Yo,{quotes:Cc[2],showRatings:!0})]}),i.jsx("footer",{className:"border-t border-border/50 py-8 px-4 bg-card/50",children:i.jsxs("div",{className:"container mx-auto text-center text-sm text-muted-foreground",children:[i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/about",className:"hover:text-foreground transition-colors",children:"About"}),i.jsx("a",{href:"/privacy",className:"hover:text-foreground transition-colors",children:"Privacy Policy"}),i.jsx("a",{href:"/terms",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),i.jsx("a",{href:"/sitemap.txt",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Sitemap"}),i.jsx("a",{href:"https://pressmegpt.featurebase.app/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Roadmap"}),i.jsx("a",{href:"https://pressmegpt.endorsely.com/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Affiliate Program"})]}),i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/themes",className:"hover:text-foreground transition-colors",children:"WordPress Theme Directory"}),i.jsx("a",{href:"https://blog.pressmegpt.com/ai-wordpress-theme-generator/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Theme Generators"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-10-best-wordpress-ai-website-builders-for-rapid-web-design/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Website Builders"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-top-10-wordpress-theme-builder
637-software-solutions/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Theme Builder Software"}),i.jsx("a",{href:"https://blog.pressmegpt.com/how-to-customize-a-wordpress-theme-with-ai/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Customize a Theme with AI"})]}),i.jsxs("p",{children:["© ",new Date().getFullYear()," PressMeGPT. All rights reserved."]})]})}),i.jsx(Xt,{open:l,onOpenChange:c,children:i.jsxs(Qt,{className:"max-w-4xl p-0 overflow-hidden border-border/50",children:[i.jsx(wr,{className:"sr-only",children:"PressMeGPT Demo Video"}),i.jsx("div",{className:"aspect-video w-full bg-black",children:l&&i.jsx("iframe",{width:"100%",height:"100%",src:"https://www.youtube.com/embed/NjLhSBx1kws?autoplay=1",title:"PressMeGPT Demo Video",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,className:"w-full h-full"})})]})})]})}function ro(){return{track:(r,n)=>{typeof window.fbq=="function"&&window.fbq("track",r,n)},trackCustom:(r,n)=>{typeof window.fbq=="function"&&window.fbq("trackCustom",r,n)}}}function f1(){const{user:t}=$t(),{track:e}=ro(),[r,n]=g.useState([]),[s,o]=g.useState(!0),a=async()=>{if(!t)return;o(!0);const{data:f,error:v}=await re.from("projects").select("*").eq("user_id",t.id).order("updated_at",{ascending:!1});!v&&f&&n(f),o(!1)};return g.useEffect(()=>{t&&a()},[t]),{projects:r,loading:s,fetchProjects:a,createProject:async(f,v)=>{if(!t)return null;const{data:p,error:b}=await re.from("projects").insert([{user_id:t.id,name:f,status:"created",project_mode:(v==null?void 0:v.projectMode)||"describe",source_url:(v==null?void 0:v.sourceUrl)||null,source_mode:(v==null?void 0:v.sourceMode)||null}]).select().single();return!b&&p?(r.length===0&&e("StartTrial",{content_name:f}),await a(),p):null},updateProject:async(f,v)=>{const{error:p}=await re.from("projects").update(v).eq("id",f);return p?!1:(await a(),!0)},deleteProject:async f=>{await re.from("public_themes").delete().eq("source_project_id",f);const{error:v}=await re.from("projects").delete().eq("id",f);return v?!1:(await a(),!0)},duplicateProject:async f=>{if(!t)return null;const{data:v,error:p}=await re.from("projects").insert([{user_id:t.id,name:`${f.name} (Copy)`,description:f.description,status:f.status,theme_description:f.theme_description,selected_theme_index:f.selected_theme_index,theme_options:JSON.parse(JSON.stringify(f.theme_options)),current_theme_data:JSON.parse(JSON.stringify(f.current_theme_data)),section_customizations:JSON.parse(JSON.stringify(f.section_customizations)),master_html:f.master_html,master_css:f.master_css}]).select().single();return!p&&v?(await a(),v):null},remixPublicTheme:async f=>{if(!t)return null;const{data:v,error:p}=await re.from("public_themes").select("*").eq("id",f).single();if(p||!v)return null;const{data:b,error:x}=await re.from("projects").insert({user_id:t.id,name:`${v.name} (Remix)`,status:"customizing",theme_description:v.theme_description,selected_theme_index:0,theme_options:[{name:v.name,description:v.description||"",previewHtml:v.master_html||"",previewCss:v.master_css||""}],master_html:v.master_html,master_css:v.master_css,version:"1.0"}).select().single();return!x&&b?(await a(),b):null},getProject:async f=>{const{data:v,error:p}=await re.from("projects").select("*").eq("id",f).single();return!p&&v?v:null}}}const Nt=g.forwardRef(({className:t,type:e,...r},n)=>i.jsx("input",{type:e,className:Se("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...r}));Nt.displayName="Input";var CQ="Label",H4=g.forwardRef((t,e)=>i.jsx(Me.label,{...t,ref:e,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));H4.displayName=CQ;var G4=H4;const EQ=du("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Xe=g.forwardRef(({className:t,...e},r)=>i.jsx(G4,{ref:r,className:Se(EQ(),t),...e}));Xe.displayName=G4.displayName;const dt=g.forwardRef(({className:t,...e},r)=>i.jsx("div",{ref:r,className:Se("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));
637dt.displayName="Card";const ir=g.forwardRef(({className:t,...e},r)=>i.jsx("div",{ref:r,className:Se("flex flex-col space-y-1.5 p-6",t),...e}));ir.displayName="CardHeader";const Dr=g.forwardRef(({className:t,...e},r)=>i.jsx("h3",{ref:r,className:Se("text-2xl font-semibold leading-none tracking-tight",t),...e}));Dr.displayName="CardTitle";const Gr=g.forwardRef(({className:t,...e},r)=>i.jsx("p",{ref:r,className:Se("text-sm text-muted-foreground",t),...e}));Gr.displayName="CardDescription";const ct=g.forwardRef(({className:t,...e},r)=>i.jsx("div",{ref:r,className:Se("p-6 pt-0",t),...e}));ct.displayName="CardContent";const ia=g.forwardRef(({className:t,...e},r)=>i.jsx("div",{ref:r,className:Se("flex items-center p-6 pt-0",t),...e}));ia.displayName="CardFooter";var mv="Tabs",[PQ,gse]=_r(mv,[bu]),q4=bu(),[TQ,m1]=PQ(mv),V4=g.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=t,d=fa(l),[h,m]=rn({prop:n,onChange:s,defaultProp:o??"",caller:mv});return i.jsx(TQ,{scope:r,baseId:zn(),value:h,onValueChange:m,orientation:a,dir:d,activationMode:c,children:i.jsx(Me.div,{dir:d,"data-orientation":a,...u,ref:e})})});V4.displayName=mv;var K4="TabsList",Y4=g.forwardRef((t,e)=>{const{__scopeTabs:r,loop:n=!0,...s}=t,o=m1(K4,r),a=q4(r);return i.jsx(W_,{asChild:!0,...a,orientation:o.orientation,dir:o.dir,loop:n,children:i.jsx(Me.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:e})})});Y4.displayName=K4;var Q4="TabsTrigger",J4=g.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=t,a=m1(Q4,r),l=q4(r),c=eO(a.baseId,n),u=tO(a.baseId,n),d=n===a.value;return i.jsx(H_,{asChild:!0,...l,focusable:!s,active:d,children:i.jsx(Me.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:e,onMouseDown:je(t.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?a.onValueChange(n):h.preventDefault()}),onKeyDown:je(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(n)}),onFocus:je(t.onFocus,()=>{const h=a.activationMode!=="manual";!d&&!s&&h&&a.onValueChange(n)})})})});J4.displayName=Q4;var X4="TabsContent",Z4=g.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...a}=t,l=m1(X4,r),c=eO(l.baseId,n),u=tO(l.baseId,n),d=n===l.value,h=g.useRef(d);return g.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),i.jsx(Tr,{present:s||d,children:({present:m})=>i.jsx(Me.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:h.current?"0s":void 0},children:m&&o})})});Z4.displayName=X4;function eO(t,e){return`${t}-trigger-${e}`}function tO(t,e){return`${t}-content-${e}`}var AQ=V4,rO=Y4,nO=J4,sO=Z4;const oa=AQ,Yi=g.forwardRef(({className:t,...e},r)=>i.jsx(rO,{ref:r,className:Se("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Yi.displayName=rO.displayName;const gr=g.forwardRef(({className:t,...e},r)=>i.jsx(nO,{ref:r,className:Se("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",t),...e}));gr.displayName=nO.displayName;const Mr=g.forwardRef(({className:t,...e},r)=>i.jsx(sO,{ref:r,className:Se("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",t),...e}));Mr.displayName=sO.displayName;function RQ(){const[t,e]=g.useState(!1),[r,n]=g.useState(""),[s,o]=g.useState(!1),[a,l]=g.useState(!1),c=async()=>{if(!r){Q.error("Please enter your email");return}o(!0),await re.auth.resetPasswordForEmail(r,{redirectTo:`${window.location.origin}/reset-password`}),o(!1),l(!0)};return a?i.jsxs("div",{className:"mt-2 space-y-3",children:[i.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"If we have an account for that email address, you'll receive an email with instructions on how to reset your password."}),i.jsx("button",{type:"button",className:"text-sm text-muted-foreground underline hover:text-foreground block mx-auto",onClick:()=>{l(!1),e(!1)},children:"Back to Sign In"})]}):t?i.jsxs("div",{className:"mt-3 space-y-2",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Nt,{type:"email",placeholder:"Your email address",value:r,onChange:u=>n(u.target.value),disabled:s,className:"bg-background/50 flex-1"}),i.jsx(Y,{type:"button",variant:"outline",size:"sm",disabled:s,onClick:c,children:s?i.jsx(et,{className:"h-4 w-4 animate-spin"}):"Send"})]}),i.jsx("button",{type:"button",className:"text-xs text-muted-foreground underline hover:text-foreground",onClick:()=>e(!1),children:"Cancel"})]}):i.jsx("button",{type:"button",className:"text-sm text-muted-foreground underline hover:text-foreground mt-2 block mx-auto",onClick:()=>e(!0),children:"Forgot Password?"})}function IQ(){const t=Zt(),[e,r]=eo(),{user:n,signIn:s,signUp:o,loading:a,isEmailVerified:l}=$t(),{remixPublicTheme:c}=f1(),{track:u}=ro(),{trackSignUp:d,trackPurchase:h}=P_(),{trackSignUp:m,trackPurchase:f}=T_(),[v,p]=g.useState(!1),b=g.useRef(!1),[x,y]=g.useState(!1),[w,j]=g.useState(""),_=e.get("mode"),[S,N]=g.useState(_==="signin"?"login":"signup"),[P,C]=g.useState(!1),[O,F]=g.useState(""),T=g.useRef(!1),[A,k]=g.useState(e.get("email")??""),[$,K]=g.useState(""),[H,W]=g.useState(""),[R,G]=g.useState(""),[U,z]=g.useState(""),oe=e.get("remix"),L=e.get("redirect"),q=e.get("ref"),he=e.get("checkout_session_id");g.useEffect(()=>{_==="signin"?N("login"):_==="signup"&&N("signup")},[_]),g.useEffect(()=>{q&&localStorage.setItem("referral_code",q)},[q]),g.useEffect(()=>{if(!he||T.current)return;T.current=!0;const le=()=>{const Z=new URLSearchParams(window.location.search);Z.has("checkout_session_id")&&(Z.delete("checkout_session_id"),r(Z,{replace:!0}))};(async()=>{C(!0);try{const{data:Z,error:ae}=await re.functions.invoke("complete-guest-checkout",{body:{session_id:he}});if(ae||Z!=null&&Z.error)throw new Error((Z==null?void 0:Z.error)||(ae==null?void 0:ae.message)||"Failed to complete checkout");if(Z!=null&&Z.duplicate){C(!1),F(`This email already has an active ${Z.current_plan||"paid"} plan. Sign in to change your plan instead.`),k(Z.email||""),N("login"),le();return}u("Purchase",{content_name:"guest_checkout",currency:"USD"}),typeof(Z==null?void 0:Z.amount)=="number"?(h({email:Z.email,value:Z.amount,currency:"USD",transactionId:he}),f({email:Z.email,value:Z.amount,currency:"USD",transactionId:he})):(h({email:Z==null?void 0:Z.email,transactionId:he}),f({email:Z==null?void 0:Z.email,transactionId:he})),Z.passwordSetupUrl?window.location.href=Z.passwordSetupUrl:Z.existingUser?(C(!1),F(`Welcome back! Your plan has been activated for ${Z.email}. Sign in to continue.`),k(Z.email),le()):(C(!1),F(Z.passwordSetupPending?"Your purchase was completed! Check your email for an account activation link, or contact support if you need help setting your password.":"Your purchase was completed! Sign in to continue."),le())}catch(Z){console.error("Guest checkout completion error:",Z),C(!1),Q.error("There was an issue completing your purchase. Please contact support."),le()}})()},[he]);const X=async()=>{var Z;const le=e.get("plan_intent"),fe=e.get("billing_intent");
637if(le&&fe){const ae=new URLSearchParams;ae.set("plan_intent",le),ae.set("billing_intent",fe),t(`/pricing?${ae.toString()}`);return}if(oe){let ae=l;if(!ae)try{await re.auth.refreshSession();const{data:ne}=await re.auth.getUser();ae=!!((Z=ne.user)!=null&&Z.email_confirmed_at)}catch(ne){console.error("refreshSession failed",ne)}if(!ae){Q.info("Please verify your email before remixing themes."),t("/dashboard");return}const E=await c(oe);E?(Q.success("Theme remixed! Start customizing."),t(`/project/${E.id}`)):(Q.error("Failed to remix theme"),t("/dashboard"))}else t(L||"/dashboard")};g.useEffect(()=>{n&&!a&&!b.current&&!x&&!P&&!he&&X()},[n,a,x,P,he]);const J=async le=>{if(le.preventDefault(),!A||!$){Q.error("Please fill in all fields");return}p(!0);const{error:fe}=await s(A,$);p(!1),fe?Q.error(fe.message||"Failed to sign in"):Q.success("Welcome back!")},de=async le=>{if(le.preventDefault(),!H||!R||!U){Q.error("Please fill in all fields");return}if(R.length<6){Q.error("Password must be at least 6 characters");return}b.current=!0,p(!0);const{data:fe,error:Z}=await o(H,R,U);if(Z){b.current=!1,p(!1),Z.message.includes("already registered")?Q.error("This email is already registered. Please sign in instead."):Q.error(Z.message||"Failed to create account");return}const ae=(fe==null?void 0:fe.user)??null;if(ae){const E=localStorage.getItem("referral_code");E&&re.functions.invoke("process-referral",{body:{referredUserId:ae.id,referralCode:E}}).then(()=>{localStorage.removeItem("referral_code")}).catch(ne=>console.error("Failed to process referral:",ne))}p(!1),u("Lead",{content_name:"signup"}),d(H),m(H),j(H),b.current=!1,y(!0)};return a||P?i.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-background gap-4",children:[i.jsx(et,{className:"h-8 w-8 animate-spin text-primary"}),P&&i.jsx("p",{className:"text-muted-foreground text-sm",children:"Setting up your account..."})]}):x?i.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/10 via-background to-accent/10"}),i.jsx("div",{className:"absolute top-0 left-1/4 w-96 h-96 bg-primary/20 rounded-full blur-3xl"}),i.jsx("div",{className:"absolute bottom-0 right-1/4 w-96 h-96 bg-accent/20 rounded-full blur-3xl"}),i.jsx("div",{className:"relative z-10",children:i.jsx(zr,{})}),i.jsx("div",{className:"relative z-10 flex items-center justify-center p-4 min-h-[calc(100vh-80px)]",children:i.jsxs(dt,{className:"w-full max-w-md relative bg-card/80 backdrop-blur-sm shadow-2xl border-border/50",children:[i.jsx(ir,{className:"text-center",children:i.jsx("div",{className:"flex justify-center mb-4",children:i.jsx("img",{src:Zp,alt:"Press Me GPT - AI WordPress Theme Generator",className:"h-20 md:h-24"})})}),i.jsxs(ct,{className:"text-center space-y-4",children:[i.jsx("div",{className:"w-16 h-16 mx-auto bg-primary/10 rounded-full flex items-center justify-center",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),i.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Check your email"}),i.jsxs("p",{className:"text-muted-foreground",children:["We've sent a confirmation link to ",i.jsx("span",{className:"font-medium text-foreground",children:w})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Click the link in the email to verify your account and get started."}),i.jsx(Y,{variant:"outline",className:"mt-4",onClick:()=>y(!1),children:"Back to Sign In"})]})]})})]}):i.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/10 via-background to-accent/10"}),i.jsx("div",{className:"absolute top-0 left-1/4 w-96 h-96 bg-primary/20 rounded-full blur-3xl"}),i.jsx("div",{className:"absolute bottom-0 right-1/4 w-96 h-96 bg-accent/20 rounded-full blur-3xl"}),i.jsx("div",{className:"relative z-10",children:i.jsx(zr,{})}),i.jsx("div",{className:"relative z-10 flex items-center justify-center p-4 min-h-[calc(100vh-80px)]",children:i.jsxs(dt,{className:"w-full max-w-md relative bg-card/80 backdrop-blur-sm shadow-2xl border-border/50",children:[i.jsxs(ir,{className:"text-center",children:[i.jsx("div",{className:"flex justify-center mb-4",children:i.jsx("img",{src:Zp,alt:"Press Me GPT - AI WordPress Theme Generator",className:"h-20 md:h-24"})}),i.jsx(Gr,{children:"Create beautiful WordPress themes with AI assistance"})]}),i.jsxs(ct,{children:[i.jsxs(oa,{value:S,onValueChange:N,children:[i.jsxs(Yi,{className:"grid w-full grid-cols-2 mb-6",children:[i.jsx(gr,{value:"signup",children:"Sign Up"}),i.jsx(gr,{value:"login",children:"Sign In"})]}),O&&i.jsx("div",{className:"mb-4 p-3 bg-primary/10 border border-primary/20 rounded-lg text-center",children:i.jsx("p",{className:"text-sm text-foreground font-medium",children:O})}),i.jsxs(Mr,{value:"signup",children:[i.jsxs("form",{onSubmit:de,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"signup-name",children:"Display Name"}),i.jsx(Nt,{id:"signup-name",type:"text",placeholder:"Your name",value:U,onChange:le=>z(le.target.value),disabled:v,className:"bg-background/50"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"signup-email",children:"Email"}),i.jsx(Nt,{id:"signup-email",type:"email",placeholder:"[email protected]",value:H,onChange:le=>W(le.target.value),disabled:v,className:"bg-background/50"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"signup-password",children:"Password"}),i.jsx(Nt,{id:"signup-password",type:"password",placeholder:"••••••••",value:R,onChange:le=>G(le.target.value),disabled:v,className:"bg-background/50"})]}),i.jsxs(Y,{type:"submit",className:"w-full bg-primary hover:bg-primary/90 shadow-lg shadow-primary/20",disabled:v,children:[v?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Create Account"]})]}),i.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-4",children:["Already have an account?"," ",i.jsx("button",{type:"button",className:"text-primary hover:underline underline-offset-2",onClick:()=>N("login"),children:"Sign in"})]})]}),i.jsx(Mr,{value:"login",children:i.jsxs("form",{onSubmit:J,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"login-email",children:"Email"}),i.jsx(Nt,{id:"login-email",type:"email",placeholder:"[email protected]",value:A,onChange:le=>k(le.target.value),disabled:v,className:"bg-background/50"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"login-password",children:"Password"}),i.jsx(Nt,{id:"login-password",type:"password",placeholder:"••••••••",value:$,onChange:le=>K(le.target.value),disabled:v,className:"bg-background/50"})]}),i.jsxs(Y,{type:"submit",className:"w-full bg-primary hover:bg-primary/90 shadow-lg shadow-primary/20",disabled:v,children:[v?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Sign In"]}),i.jsx(RQ,{})]})})]}),i.jsxs("p",{className:"text-xs text-muted-foreground text-center mt-4",children:["By using this site I agree to the"," ",i.jsx("a",{href:"/terms",className:"underline hover:text-foreground transition-colors",children:"Terms of Service"})," ","and"," ",i.jsx("a",{href:"/privacy",className:"underline hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})]})})]})}function no(){return{track:(e,r)=>{Bm.capture(e,r)}}}function iO(t){const{user:e}=$t(),[r,n]=g.useState(!1),[s,o]=g.useState(!1),a=g.useCallback(async()=>
637{if(!e||!t)return;const{data:c}=await re.from("theme_favorites").select("id").eq("user_id",e.id).eq("theme_id",t).maybeSingle();n(!!c)},[e,t]);return g.useEffect(()=>{a()},[a]),{isFavorited:r,toggleFavorite:async()=>{if(!e)return Q.error("Please sign in to save themes"),!1;if(!t)return!1;if(o(!0),r){const{error:c}=await re.from("theme_favorites").delete().eq("user_id",e.id).eq("theme_id",t);c||(n(!1),Q.success("Removed from saved themes"))}else{const{error:c}=await re.from("theme_favorites").insert({user_id:e.id,theme_id:t});c||(n(!0),Q.success("Added to saved themes"))}return o(!1),!0},loading:s}}function OQ(){const{user:t}=$t(),[e,r]=g.useState([]),[n,s]=g.useState(!0),o=g.useCallback(async()=>{if(!t){r([]),s(!1);return}s(!0);const{data:a,error:l}=await re.from("theme_favorites").select(`
638        id,
639        created_at,
640        theme:public_themes(
641          id, name, description, slug, thumbnail_url, download_count, heart_count, published_at
642        )
643      `).eq("user_id",t.id).order("created_at",{ascending:!1});!l&&a&&r(a.filter(c=>c.theme)),s(!1)},[t]);return g.useEffect(()=>{o()},[o]),{favorites:e,loading:n,refetch:o}}function cm(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var oO={exports:{}};/*!
644
645JSZip v3.10.1 - A JavaScript class for generating and reading zip files
646<http://stuartk.com/jszip>
647
648(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
649Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
650
651JSZip uses the library pako released under the MIT license :
652https://github.com/nodeca/pako/blob/main/LICENSE
653*/(function(t,e){(function(r){t.exports=r()})(function(){return function r(n,s,o){function a(u,d){if(!s[u]){if(!n[u]){var h=typeof cm=="function"&&cm;if(!d&&h)return h(u,!0);if(l)return l(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var f=s[u]={exports:{}};n[u][0].call(f.exports,function(v){var p=n[u][1][v];return a(p||v)},f,f.exports,r,n,s,o)}return s[u].exports}for(var l=typeof cm=="function"&&cm,c=0;c<o.length;c++)a(o[c]);return a}({1:[function(r,n,s){var o=r("./utils"),a=r("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var u,d,h,m,f,v,p,b=[],x=0,y=c.length,w=y,j=o.getTypeOf(c)!=="string";x<c.length;)w=y-x,h=j?(u=c[x++],d=x<y?c[x++]:0,x<y?c[x++]:0):(u=c.charCodeAt(x++),d=x<y?c.charCodeAt(x++):0,x<y?c.charCodeAt(x++):0),m=u>>2,f=(3&u)<<4|d>>4,v=1<w?(15&d)<<2|h>>6:64,p=2<w?63&h:64,b.push(l.charAt(m)+l.charAt(f)+l.charAt(v)+l.charAt(p));return b.join("")},s.decode=function(c){var u,d,h,m,f,v,p=0,b=0,x="data:";if(c.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");var y,w=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&w--,c.charAt(c.length-2)===l.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=a.uint8array?new Uint8Array(0|w):new Array(0|w);p<c.length;)u=l.indexOf(c.charAt(p++))<<2|(m=l.indexOf(c.charAt(p++)))>>4,d=(15&m)<<4|(f=l.indexOf(c.charAt(p++)))>>2,h=(3&f)<<6|(v=l.indexOf(c.charAt(p++))),y[b++]=u,f!==64&&(y[b++]=d),v!==64&&(y[b++]=h);return y}},{"./support":30,"./utils":32}],2:[function(r,n,s){var o=r("./external"),a=r("./stream/DataWorker"),l=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,h,m,f,v){this.compressedSize=d,this.uncompressedSize=h,this.crc32=m,this.compression=f,this.compressedContent=v}u.prototype={getContentWorker:function(){var d=new a(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new a(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,h,m){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var o=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var o=r("./utils"),a=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();n.exports=function(l,c){return l!==void 0&&l.length?o.getTypeOf(l)!=="str
653ing"?function(u,d,h,m){var f=a,v=m+h;u^=-1;for(var p=m;p<v;p++)u=u>>>8^f[255&(u^d[p])];return-1^u}(0|c,l,l.length,0):function(u,d,h,m){var f=a,v=m+h;u^=-1;for(var p=m;p<v;p++)u=u>>>8^f[255&(u^d.charCodeAt(p))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var o=null;o=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:o}},{lie:37}],7:[function(r,n,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=r("pako"),l=r("./utils"),c=r("./stream/GenericWorker"),u=o?"uint8array":"array";function d(h,m){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=m,this.meta={}}s.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,h.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(m){h.push({data:m,meta:h.meta})}},s.compressWorker=function(h){return new d("Deflate",h)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function o(f,v){var p,b="";for(p=0;p<v;p++)b+=String.fromCharCode(255&f),f>>>=8;return b}function a(f,v,p,b,x,y){var w,j,_=f.file,S=f.compression,N=y!==u.utf8encode,P=l.transformTo("string",y(_.name)),C=l.transformTo("string",u.utf8encode(_.name)),O=_.comment,F=l.transformTo("string",y(O)),T=l.transformTo("string",u.utf8encode(O)),A=C.length!==_.name.length,k=T.length!==O.length,$="",K="",H="",W=_.dir,R=_.date,G={crc32:0,compressedSize:0,uncompressedSize:0};v&&!p||(G.crc32=f.crc32,G.compressedSize=f.compressedSize,G.uncompressedSize=f.uncompressedSize);var U=0;v&&(U|=8),N||!A&&!k||(U|=2048);var z=0,oe=0;W&&(z|=16),x==="UNIX"?(oe=798,z|=function(q,he){var X=q;return q||(X=he?16893:33204),(65535&X)<<16}(_.unixPermissions,W)):(oe=20,z|=function(q){return 63&(q||0)}(_.dosPermissions)),w=R.getUTCHours(),w<<=6,w|=R.getUTCMinutes(),w<<=5,w|=R.getUTCSeconds()/2,j=R.getUTCFullYear()-1980,j<<=4,j|=R.getUTCMonth()+1,j<<=5,j|=R.getUTCDate(),A&&(K=o(1,1)+o(d(P),4)+C,$+="up"+o(K.length,2)+K),k&&(H=o(1,1)+o(d(F),4)+T,$+="uc"+o(H.length,2)+H);var L="";return L+=`
654\0`,L+=o(U,2),L+=S.magic,L+=o(w,2),L+=o(j,2),L+=o(G.crc32,4),L+=o(G.compressedSize,4),L+=o(G.uncompressedSize,4),L+=o(P.length,2),L+=o($.length,2),{fileRecord:h.LOCAL_FILE_HEADER+L+P+$,dirRecord:h.CENTRAL_FILE_HEADER+o(oe,2)+L+o(F.length,2)+"\0\0\0\0"+o(z,4)+o(b,4)+P+$+F}}var l=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),h=r("../signature");function m(f,v,p,b){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=p,this.encodeFileName=b,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(m,c),m.prototype.push=function(f){var v=f.meta.percent||0,p=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,c.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(v+100*(p-b-1))/p:100}}))},m.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var v=this.streamFiles&&!f.file.dir;if(v){var p=a(f,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(f){this.accumulate=!1;var v=this.streamFiles&&!f.file.dir,p=a(f,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),v)this.push({data:function(b){return h.DATA_DESCRIPTOR+o(b.crc32,4)+o(b.compressedSize,4)+o(b.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var f=this.bytesWritten,v=0;v<this.dirRecords.length;v++)this.push({data:this.dirRecords[v],meta:{percent:100}});var p=this.bytesWritten-f,b=function(x,y,w,j,_){var S=l.transformTo("string",_(j));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+o(x,2)+o(x,2)+o(y,4)+o(w,4)+o(S.length,2)+S}(this.dirRecords.length,p,f,this.zipComment,this.encodeFileName);this.push({data:b,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(f){this._sources.push(f);var v=this;return f.on("data",function(p){v.processChunk(p)}),f.on("end",function(){v.closedSource(v.previous.streamInfo),v._sources.length?v.prepareNextSource():v.end()}),f.on("error",function(p){v.error(p)}),this},m.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(f){var v=this._sources;if(!c.prototype.error.call(this,f))return!1;for(var p=0;p<v.length;p++)try{v[p].error(f)}catch{}return!0},m.prototype.lock=function(){c.prototype.lock.call(this);for(var f=this._sources,v=0;v<f.length;v++)f[v].lock()},n.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,s){var o=r("../compressions"),a=r("./ZipFileWorker");s.generateWorker=function(l,c,u){var d=new a(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{l.forEach(function(m,f){h++;var v=function(y,w){var j=y||w,_=o[j];if(!_)throw new Error(j+" is not a valid compression method !");return _}(f.options.compression,c.compression),p=f.options.compressionOptions||c.compressionOptions||{},b=f.dir,x=f.date;f._compressWorker(v,p).withStreamInfo("file",{name:m,dir:b,date:x,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(m){d.error(m)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,s){function o(){if(!(this instanceof o))return new o;
vendor: 41,025 bytes, line 654
654if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new o;for(var l in this)typeof this[l]!="function"&&(a[l]=this[l]);return a}}(o.prototype=r("./object")).loadAsync=r("./load"),o.support=r("./support"),o.defaults=r("./defaults"),o.version="3.10.1",o.loadAsync=function(a,l){return new o().loadAsync(a,l)},o.external=r("./external"),n.exports=o},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,s){var o=r("./utils"),a=r("./external"),l=r("./utf8"),c=r("./zipEntries"),u=r("./stream/Crc32Probe"),d=r("./nodejsUtils");function h(m){return new a.Promise(function(f,v){var p=m.decompressed.getContentWorker().pipe(new u);p.on("error",function(b){v(b)}).on("end",function(){p.streamInfo.crc32!==m.decompressed.crc32?v(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}n.exports=function(m,f){var v=this;return f=o.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(m)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):o.prepareContent("the loaded zip file",m,!0,f.optimizedBinaryString,f.base64).then(function(p){var b=new c(f);return b.load(p),b}).then(function(p){var b=[a.Promise.resolve(p)],x=p.files;if(f.checkCRC32)for(var y=0;y<x.length;y++)b.push(h(x[y]));return a.Promise.all(b)}).then(function(p){for(var b=p.shift(),x=b.files,y=0;y<x.length;y++){var w=x[y],j=w.fileNameStr,_=o.resolve(w.fileNameStr);v.file(_,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:f.createFolders}),w.dir||(v.file(_).unsafeOriginalName=j)}return b.zipComment.length&&(v.comment=b.zipComment),v})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,s){var o=r("../utils"),a=r("../stream/GenericWorker");function l(c,u){a.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}o.inherits(l,a),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,s){var o=r("readable-stream").Readable;function a(l,c,u){o.call(this,c),this._helper=l;var d=this;l.on("data",function(h,m){d.push(h)||d._helper.pause(),u&&u(m)}).on("error",function(h){d.emit("error",h)}).on("end",function(){d.push(null)})}r("../utils").inherits(a,o),a.prototype._read=function(){this._helper.resume()},n.exports=a},{"../utils":32,"readable-stream":16}],14:[function(r,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(o,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(o,a);if(typeof o=="number")throw new Error('The "data" argument must not be a number');return new Buffer(o,a)},allocBuffer:function(o){if(Buffer.alloc)return Buffer.alloc(o);var a=new Buffer(o);return a.fill(0),a},isBuffer:function(o){return Buffer.isBuffer(o)},isStream:function(o){return o&&typeof o.on=="function"&&typeof o.pause=="function"&&typeof o.resume=="function"}}},{}],15:[function(r,n,s){function o(_,S,N){var P,C=l.getTypeOf(S),O=l.extend(N||{},d);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&16384&O.unixPermissions&&(O.dir=!0),O.dosPermissions&&16&O.dosPermissions&&(O.dir=!0),O.dir&&(_=x(_)),O.createFolders&&(P=b(_))&&y.call(this,P,!0);var F=C==="string"&&O.binary===!1&&O.base64===!1;N&&N.binary!==void 0||(O.binary=!F),(S instanceof h&&S.uncompressedSize===0||O.dir||!S||S.length===0)&&(O.base64=!1,O.binary=!0,S="",O.compression="STORE",C="string");var T=null;T=S instanceof h||S instanceof c?S:v.isNode&&v.isStream(S)?new p(_,S):l.prepareContent(_,S,O.binary,O.optimizedBinaryString,O.base64);var A=new m(_,T,O);this.files[_]=A}var a=r("./utf8"),l=r("./utils"),c=r("./stream/GenericWorker"),u=r("./stream/StreamHelper"),d=r("./defaults"),h=r("./compressedObject"),m=r("./zipObject"),f=r("./generate"),v=r("./nodejsUtils"),p=r("./nodejs/NodejsStreamInputAdapter"),b=function(_){_.slice(-1)==="/"&&(_=_.substring(0,_.length-1));var S=_.lastIndexOf("/");return 0<S?_.substring(0,S):""},x=function(_){return _.slice(-1)!=="/"&&(_+="/"),_},y=function(_,S){return S=S!==void 0?S:d.createFolders,_=x(_),this.files[_]||o.call(this,_,null,{dir:!0,createFolders:S}),this.files[_]};function w(_){return Object.prototype.toString.call(_)==="[object RegExp]"}var j={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(_){var S,N,P;for(S in this.files)P=this.files[S],(N=S.slice(this.root.length,S.length))&&S.slice(0,this.root.length)===this.root&&_(N,P)},filter:function(_){var S=[];return this.forEach(function(N,P){_(N,P)&&S.push(P)}),S},file:function(_,S,N){if(arguments.length!==1)return _=this.root+_,o.call(this,_,S,N),this;if(w(_)){var P=_;return this.filter(function(O,F){return!F.dir&&P.test(O)})}var C=this.files[this.root+_];return C&&!C.dir?C:null},folder:function(_){if(!_)return this;if(w(_))return this.filter(function(C,O){return O.dir&&_.test(C)});var S=this.root+_,N=y.call(this,S),P=this.clone();return P.root=N.name,P},remove:function(_){_=this.root+_;var S=this.files[_];if(S||(_.slice(-1)!=="/"&&(_+="/"),S=this.files[_]),S&&!S.dir)delete this.files[_];else for(var N=this.filter(function(C,O){return O.name.slice(0,_.length)===_}),P=0;P<N.length;P++)delete this.files[N[P].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(_){var S,N={};try{if((N=l.extend(_||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");l.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var P=N.comment||this.comment||"";S=f.generateWorker(this,N,P)}catch(C){(S=new c("error")).error(C)}return new u(S,N.type||"string",N.mimeType)},generateAsync:function(_,S){return this.generateInternalStream(_).accumulate(S)},generateNodeStream:function(_,S){return(_=_||{}).type||(_.type="nodebuffer"),this.generateInternalStream(_).toNodejsStream(S)}};n.exports=j},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,s){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,s){var o=r("./DataReader");function a(l){o.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}r("../utils").inherits(a,o),a.prototype.byteAt=function(l){return this.data[this.zero+l]},a.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===c&&this.data[m+1]===u&&this.data[m+2]===d&&this.data[m+3]===h)return m-this.zero;return-1},a.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),m=this.readData(4);return c===m[0]&&u===m[1]&&d===m[2]&&h===m[3]},a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=a},{"../utils":32,"./DataReader":18}],18:[function(r,n,s){var o=r("../utils");function a(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return o.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},n.exports=a},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function a(l){o.call(this,l)}r("../utils").inherits(a,o),a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function a(l){o.call(this,l)}r("../utils").inherits(a,o),a.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},a.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},a.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=a},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function a(l){o.call(this,l)}r("../utils").inherits(a,o),a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),a=r("../support"),l=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(h){var m=o.getTypeOf(h);return o.checkSupport(m),m!=="string"||a.uint8array?m==="nodebuffer"?new u(h):a.uint8array?new d(o.transformTo("uint8array",h)):new l(o.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK��",s.CENTRAL_FILE_HEADER="PK��",s.CENTRAL_DIRECTORY_END="PK��",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK�\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK��",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var o=r("./GenericWorker"),a=r("../utils");function l(c){o.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(l,o),l.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),a=r("../crc32");function l(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(l,o),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),a=r("./GenericWorker");function l(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(l,a),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}a.prototype.processChunk.call(this,c)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),a=r("./GenericWorker");function l(c){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(l,a),l.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function o(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,l){return this._listeners[a].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,l){if(this._listeners[a])for(var c=0;c<this._listeners[a].length;c++)this._listeners[a][c].call(this,l)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var l=this;return a.on("data",function(c){l.processChunk(c)}),a.on("end",function(){l.end()}),a.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,l){return this.extraStreamInfo[a]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),a=r("./ConvertWorker"),l=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),h=null;if(u.nodestream)try{h=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(v,p){return new d.Promise(function(b,x){var y=[],w=v._internalType,j=v._outputType,_=v._mimeType;v.on("data",function(S,N){y.push(S),p&&p(N)}).on("error",function(S){y=[],x(S)}).on("end",function(){try{var S=function(N,P,C){switch(N){case"blob":return o.newBlob(o.transformTo("arraybuffer",P),C);case"base64":return c.encode(P);default:return o.transformTo(N,P)}}(j,function(N,P){var C,O=0,F=null,T=0;for(C=0;C<P.length;C++)T+=P[C].length;switch(N){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(F=new Uint8Array(T),C=0;C<P.length;C++)F.set(P[C],O),O+=P[C].length;return F;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+N+"'")}}(w,y),_);b(S)}catch(N){x(N)}y=[]}).resume()})}function f(v,p,b){var x=p;switch(p){case"blob":case"arraybuffer":x="uint8array";break;case"base64":x="string"}try{this._internalType=x,this._outputType=p,this._mimeType=b,o.checkSupport(x),this._worker=v.pipe(new a(x)),v.lock()}catch(y){this._worker=new l("error"),this._worker.error(y)}}f.prototype={accumulate:function(v){return m(this,v)},on:function(v,p){var b=this;return v==="data"?this._worker.on(v,function(x){p.call(b,x.data,x.meta)}):this._worker.on(v,function(){o.delay(p,arguments,b)}),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(v){if(o.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},v)}},n.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(o),s.blob=a.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),a=r("./support"),l=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}s.utf8encode=function(f){return a.nodebuffer?l.newBufferFrom(f,"utf-8"):function(v){var p,b,x,y,w,j=v.length,_=0;for(y=0;y<j;y++)(64512&(b=v.charCodeAt(y)))==55296&&y+1<j&&(64512&(x=v.charCodeAt(y+1)))==56320&&(b=65536+(b-55296<<10)+(x-56320),y++),_+=b<128?1:b<2048?2:b<65536?3:4;for(p=a.uint8array?new Uint8Array(_):new Array(_),y=w=0;w<_;y++)(64512&(b=v.charCodeAt(y)))==55296&&y+1<j&&(64512&(x=v.charCodeAt(y+1)))==56320&&(b=65536+(b-55296<<10)+(x-56320),y++),b<128?p[w++]=b:(b<2048?p[w++]=192|b>>>6:(b<65536?p[w++]=224|b>>>12:(p[w++]=240|b>>>18,p[w++]=128|b>>>12&63),p[w++]=128|b>>>6&63),p[w++]=128|63&b);return p}(f)},s.utf8decode=function(f){return a.nodebuffer?o.transformTo("nodebuffer",f).toString("utf-8"):function(v){var p,b,x,y,w=v.length,j=new Array(2*w);for(p=b=0;p<w;)if((x=v[p++])<128)j[b++]=x;else if(4<(y=u[x]))j[b++]=65533,p+=y-1;else{for(x&=y===2?31:y===3?15:7;1<y&&p<w;)x=x<<6|63&v[p++],y--;1<y?j[b++]=65533:x<65536?j[b++]=x:(x-=65536,j[b++]=55296|x>>10&1023,j[b++]=56320|1023&x)}return j.length!==b&&(j.subarray?j=j.subarray(0,b):j.length=b),o.applyFromCharCode(j)}(f=o.transformTo(a.uint8array?"uint8array":"array",f))},o.inherits(h,c),h.prototype.processChunk=function(f){var v=o.transformTo(a.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var p=v;(v=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),v.set(p,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var b=function(y,w){var j;for((w=w||y.length)>y.length&&(w=y.length),j=w-1;0<=j&&(192&y[j])==128;)j--;return j<0||j===0?w:j+u[y[j]]>w?j:w}(v),x=v;b!==v.length&&(a.uint8array?(x=v.subarray(0,b),this.leftOver=v.subarray(b,v.length)):(x=v.slice(0,b),this.leftOver=v.slice(b,v.length))),this.push({data:s.utf8decode(x),meta:f.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=h,o.inherits(m,c),m.prototype.processChunk=function(f){this.push({data:s.utf8encode(f.data),meta:f.meta})},s.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),a=r("./base64"),l=r("./nodejsUtils"),c=r("./external");function u(p){return p}function d(p,b){for(var x=0;x<p.length;++x)b[x]=255&p.charCodeAt(x);return b}r("setimmediate"),s.newBlob=function(p,b){s.checkSupport("blob");try{return new Blob([p],{type:b})}catch{try{var x=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return x.append(p),x.getBlob(b)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(p,b,x){var y=[],w=0,j=p.length;if(j<=x)return String.fromCharCode.apply(null,p);for(;w<j;)b==="array"||b==="nodebuffer"?y.push(String.fromCharCode.apply(null,p.slice(w,Math.min(w+x,j)))):y.push(String.fromCharCode.apply(null,p.subarray(w,Math.min(w+x,j)))),w+=x;return y.join("")},stringifyByChar:function(p){for(var b="",x=0;x<p.length;x++)b+=String.fromCharCode(p[x]);return b},applyCanBeUsed:{uint8array:function(){try{return o.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return o.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function m(p){var b=65536,x=s.getTypeOf(p),y=!0;if(x==="uint8array"?y=h.applyCanBeUsed.uint8array:x==="nodebuffer"&&(y=h.applyCanBeUsed.nodebuffer),y)for(;1<b;)try{return h.stringifyByChunk(p,x,b)}catch{b=Math.floor(b/2)}return h.stringifyByChar(p)}function f(p,b){for(var x=0;x<p.length;x++)b[x]=p[x];return b}s.applyFromCharCode=m;var v={};v.string={string:u,array:function(p){return d(p,new Array(p.length))},arraybuffer:function(p){return v.string.uint8array(p).buffer},uint8array:function(p){return d(p,new Uint8Array(p.length))},nodebuffer:function(p){return d(p,l.allocBuffer(p.length))}},v.array={string:m,array:u,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return l.newBufferFrom(p)}},v.arraybuffer={string:function(p){return m(new Uint8Array(p))},array:function(p){return f(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:u,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return l.newBufferFrom(new Uint8Array(p))}},v.uint8array={string:m,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:u,nodebuffer:function(p){return l.newBufferFrom(p)}},v.nodebuffer={string:m,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return v.nodebuffer.uint8array(p).buffer},uint8array:function(p){return f(p,new Uint8Array(p.length))},nodebuffer:u},s.transformTo=function(p,b){if(b=b||"",!p)return b;s.checkSupport(p);var x=s.getTypeOf(b);return v[x][p](b)},s.resolve=function(p){for(var b=p.split("/"),x=[],y=0;y<b.length;y++){var w=b[y];w==="."||w===""&&y!==0&&y!==b.length-1||(w===".."?x.pop():x.push(w))}return x.join("/")},s.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":o.nodebuffer&&l.isBuffer(p)?"nodebuffer":o.uint8array&&p instanceof Uint8Array?"uint8array":o.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(p){if(!o[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(p){var b,x,y="";for(x=0;x<(p||"").length;x++)y+="\\x"+((b=p.charCodeAt(x))<16?"0":"")+b.toString(16).toUpperCase();return y},s.delay=function(p,b,x){setImmediate(function(){p.apply(x||null,b||[])})},s.inherits=function(p,b){function x(){}x.prototype=b.prototype,p.prototype=new x},s.extend=function(){var p,b,x={};for(p=0;p<arguments.length;p++)for(b in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],b)&&x[b]===void 0&&(x[b]=arguments[p][b]);return x},s.prepareContent=function(p,b,x,y,w){return c.Promise.resolve(b).then(function(j){return o.blob&&(j instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(j))!==-1)&&typeof FileReader<"u"?new c.Promise(function(_,S){var N=new FileReader;N.onload=function(P){_(P.target.result)},N.onerror=function(P){S(P.target.error)},N.readAsArrayBuffer(j)}):j}).then(function(j){var _=s.getTypeOf(j);return _?(_==="arraybuffer"?j=s.transformTo("uint8array",j):_==="string"&&(w?j=a.decode(j):x&&y!==!0&&(j=function(S){return d(S,o.uint8array?new Uint8Array(S.length):new Array(S.length))}(j))),j):c.Promise.reject(new Error("Can't read the data of '"+p+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,s){var o=r("./reader/readerFor"),a=r("./utils"),l=r("./signature"),c=r("./zipEntry"),u=r("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(m)+", expected "+a.pretty(h)+")")}},isSignature:function(h,m){var f=this.reader.index;this.reader.setIndex(h);var v=this.reader.readString(4)===m;return this.reader.setIndex(f),v},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),m=u.uint8array?"uint8array":"array",f=a.transformTo(m,h);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,m,f,v=this.zip64EndOfCentralSize-44;0<v;)h=this.reader.readInt(2),m=this.reader.readInt(4),f=this.reader.readData(m),this.zip64ExtensibleData[h]={id:h,length:m,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,m;for(h=0;h<this.files.length;h++)m=this.files[h],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var m=h;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var v=m-f;if(0<v)this.isSignature(m,l.CENTRAL_FILE_HEADER)||(this.reader.zero=v);else if(v<0)throw new Error("Corrupted zip: missing "+Math.abs(v)+" bytes.")},prepareReader:function(h){this.reader=o(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,s){var o=r("./reader/readerFor"),a=r("./utils"),l=r("./compressedObject"),c=r("./crc32"),u=r("./utf8"),d=r("./compressions"),h=r("./support");function m(f,v){this.options=f,this.loadOptions=v}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var v,p;if(f.skip(22),this.fileNameLength=f.readInt(2),p=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(p),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((v=function(b){for(var x in d)if(Object.prototype.hasOwnProperty.call(d,x)&&d[x].magic===b)return d[x];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,v,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var v=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(v),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=o(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var v,p,b,x=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<x;)v=f.readInt(2),p=f.readInt(2),b=f.readData(p),this.extraFields[v]={id:v,length:p,value:b};f.setIndex(x)},handleUTF8:function(){var f=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var v=this.findExtraFieldUnicodePath();if(v!==null)this.fileNameStr=v;else{var p=a.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var b=this.findExtraFieldUnicodeComment();if(b!==null)this.fileCommentStr=b;else{var x=a.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(x)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var v=o(f.value);return v.readInt(1)!==1||c(this.fileName)!==v.readInt(4)?null:u.utf8decode(v.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var v=o(f.value);return v.readInt(1)!==1||c(this.fileComment)!==v.readInt(4)?null:u.utf8decode(v.readData(f.length-5))}return null}},n.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,s){function o(v,p,b){this.name=v,this.dir=b.dir,this.date=b.date,this.comment=b.comment,this.unixPermissions=b.unixPermissions,this.dosPermissions=b.dosPermissions,this._data=p,this._dataBinary=b.binary,this.options={compression:b.compression,compressionOptions:b.compressionOptions}}var a=r("./stream/StreamHelper"),l=r("./stream/DataWorker"),c=r("./utf8"),u=r("./compressedObject"),d=r("./stream/GenericWorker");o.prototype={internalStream:function(v){var p=null,b="string";try{if(!v)throw new Error("No output type specified.");var x=(b=v.toLowerCase())==="string"||b==="text";b!=="binarystring"&&b!=="text"||(b="string"),p=this._decompressWorker();var y=!this._dataBinary;y&&!x&&(p=p.pipe(new c.Utf8EncodeWorker)),!y&&x&&(p=p.pipe(new c.Utf8DecodeWorker))}catch(w){(p=new d("error")).error(w)}return new a(p,b,"")},async:function(v,p){return this.internalStream(v).accumulate(p)},nodeStream:function(v,p){return this.internalStream(v||"nodebuffer").toNodejsStream(p)},_compressWorker:function(v,p){if(this._data instanceof u&&this._data.compression.magic===v.magic)return this._data.getCompressedWorker();var b=this._decompressWorker();return this._dataBinary||(b=b.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(b,v,p)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<h.length;f++)o.prototype[h[f]]=m;n.exports=o},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,s){(function(o){var a,l,c=o.MutationObserver||o.WebKitMutationObserver;if(c){var u=0,d=new c(v),h=o.document.createTextNode("");d.observe(h,{characterData:!0}),a=function(){h.data=u=++u%2}}else if(o.setImmediate||o.MessageChannel===void 0)a="document"in o&&"onreadystatechange"in o.document.createElement("script")?function(){var p=o.document.createElement("script");p.onreadystatechange=function(){v(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},o.document.documentElement.appendChild(p)}:function(){setTimeout(v,0)};else{var m=new o.MessageChannel;m.port1.onmessage=v,a=function(){m.port2.postMessage(0)}}var f=[];function v(){var p,b;l=!0;for(var x=f.length;x;){for(b=f,f=[],p=-1;++p<x;)b[p]();x=f.length}l=!1}n.exports=function(p){f.push(p)!==1||l||a()}}).call(this,typeof Nf<"u"?Nf:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,s){var o=r("immediate");function a(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,x!==a&&p(this,x)}function m(x,y,w){this.promise=x,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function f(x,y,w){o(function(){var j;try{j=y(w)}catch(_){return l.reject(x,_)}j===x?l.reject(x,new TypeError("Cannot resolve promise with itself")):l.resolve(x,j)})}function v(x){var y=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof y=="function")return function(){y.apply(x,arguments)}}function p(x,y){var w=!1;function j(N){w||(w=!0,l.reject(x,N))}function _(N){w||(w=!0,l.resolve(x,N))}var S=b(function(){y(_,j)});S.status==="error"&&j(S.value)}function b(x,y){var w={};try{w.value=x(y),w.status="success"}catch(j){w.status="error",w.value=j}return w}(n.exports=h).prototype.finally=function(x){if(typeof x!="function")return this;var y=this.constructor;return this.then(function(w){return y.resolve(x()).then(function(){return w})},function(w){return y.resolve(x()).then(function(){throw w})})},h.prototype.catch=function(x){return this.then(null,x)},h.prototype.then=function(x,y){if(typeof x!="function"&&this.state===u||typeof y!="function"&&this.state===c)return this;var w=new this.constructor(a);return this.state!==d?f(w,this.state===u?x:y,this.outcome):this.queue.push(new m(w,x,y)),w},m.prototype.callFulfilled=function(x){l.resolve(this.promise,x)},m.prototype.otherCallFulfilled=function(x){f(this.promise,this.onFulfilled,x)},m.prototype.callRejected=function(x){l.reject(this.promise,x)},m.prototype.otherCallRejected=function(x){f(this.promise,this.onRejected,x)},l.resolve=function(x,y){var w=b(v,y);if(w.status==="error")return l.reject(x,w.value);var j=w.value;if(j)p(x,j);else{x.state=u,x.outcome=y;for(var _=-1,S=x.queue.length;++_<S;)x.queue[_].callFulfilled(y)}return x},l.reject=function(x,y){x.state=c,x.outcome=y;for(var w=-1,j=x.queue.length;++w<j;)x.queue[w].callRejected(y);return x},h.resolve=function(x){return x instanceof this?x:l.resolve(new this(a),x)},h.reject=function(x){var y=new this(a);return l.reject(y,x)},h.all=function(x){var y=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=x.length,j=!1;if(!w)return this.resolve([]);for(var _=new Array(w),S=0,N=-1,P=new this(a);++N<w;)C(x[N],N);return P;function C(O,F){y.resolve(O).then(function(T){_[F]=T,++S!==w||j||(j=!0,l.resolve(P,_))},function(T){j||(j=!0,l.reject(P,T))})}},h.race=function(x){var y=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=x.length,j=!1;if(!w)return this.resolve([]);for(var _=-1,S=new this(a);++_<w;)N=x[_],y.resolve(N).then(function(P){j||(j=!0,l.resolve(S,P))},function(P){j||(j=!0,l.reject(S,P))});var N;return S}},{immediate:36}],38:[function(r,n,s){var o={};(0,r("./lib/utils/common").assign)(o,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=o},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,s){var o=r("./zlib/deflate"),a=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/messages"),u=r("./zlib/zstream"),d=Object.prototype.toString,h=0,m=-1,f=0,v=8;function p(x){if(!(this instanceof p))return new p(x);this.options=a.assign({level:m,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},x||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var w=o.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(w!==h)throw new Error(c[w]);if(y.header&&o.deflateSetHeader(this.strm,y.header),y.dictionary){var j;if(j=typeof y.dictionary=="string"?l.string2buf(y.dictionary):d.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(w=o.deflateSetDictionary(this.strm,j))!==h)throw new Error(c[w]);this._dict_set=!0}}function b(x,y){var w=new p(y);if(w.push(x,!0),w.err)throw w.msg||c[w.err];return w.result}p.prototype.push=function(x,y){var w,j,_=this.strm,S=this.options.chunkSize;if(this.ended)return!1;
vendor: 5,431 bytes, line 654
654j=y===~~y?y:y===!0?4:0,typeof x=="string"?_.input=l.string2buf(x):d.call(x)==="[object ArrayBuffer]"?_.input=new Uint8Array(x):_.input=x,_.next_in=0,_.avail_in=_.input.length;do{if(_.avail_out===0&&(_.output=new a.Buf8(S),_.next_out=0,_.avail_out=S),(w=o.deflate(_,j))!==1&&w!==h)return this.onEnd(w),!(this.ended=!0);_.avail_out!==0&&(_.avail_in!==0||j!==4&&j!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(a.shrinkBuf(_.output,_.next_out))):this.onData(a.shrinkBuf(_.output,_.next_out)))}while((0<_.avail_in||_.avail_out===0)&&w!==1);return j===4?(w=o.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===h):j!==2||(this.onEnd(h),!(_.avail_out=0))},p.prototype.onData=function(x){this.chunks.push(x)},p.prototype.onEnd=function(x){x===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=x,this.msg=this.strm.msg},s.Deflate=p,s.deflate=b,s.deflateRaw=function(x,y){return(y=y||{}).raw=!0,b(x,y)},s.gzip=function(x,y){return(y=y||{}).gzip=!0,b(x,y)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,s){var o=r("./zlib/inflate"),a=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/constants"),u=r("./zlib/messages"),d=r("./zlib/zstream"),h=r("./zlib/gzheader"),m=Object.prototype.toString;function f(p){if(!(this instanceof f))return new f(p);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},p||{});var b=this.options;b.raw&&0<=b.windowBits&&b.windowBits<16&&(b.windowBits=-b.windowBits,b.windowBits===0&&(b.windowBits=-15)),!(0<=b.windowBits&&b.windowBits<16)||p&&p.windowBits||(b.windowBits+=32),15<b.windowBits&&b.windowBits<48&&!(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var x=o.inflateInit2(this.strm,b.windowBits);if(x!==c.Z_OK)throw new Error(u[x]);this.header=new h,o.inflateGetHeader(this.strm,this.header)}function v(p,b){var x=new f(b);if(x.push(p,!0),x.err)throw x.msg||u[x.err];return x.result}f.prototype.push=function(p,b){var x,y,w,j,_,S,N=this.strm,P=this.options.chunkSize,C=this.options.dictionary,O=!1;if(this.ended)return!1;y=b===~~b?b:b===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof p=="string"?N.input=l.binstring2buf(p):m.call(p)==="[object ArrayBuffer]"?N.input=new Uint8Array(p):N.input=p,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new a.Buf8(P),N.next_out=0,N.avail_out=P),(x=o.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&C&&(S=typeof C=="string"?l.string2buf(C):m.call(C)==="[object ArrayBuffer]"?new Uint8Array(C):C,x=o.inflateSetDictionary(this.strm,S)),x===c.Z_BUF_ERROR&&O===!0&&(x=c.Z_OK,O=!1),x!==c.Z_STREAM_END&&x!==c.Z_OK)return this.onEnd(x),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&x!==c.Z_STREAM_END&&(N.avail_in!==0||y!==c.Z_FINISH&&y!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=l.utf8border(N.output,N.next_out),j=N.next_out-w,_=l.buf2string(N.output,w),N.next_out=j,N.avail_out=P-j,j&&a.arraySet(N.output,N.output,w,j,0),this.onData(_)):this.onData(a.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(O=!0)}while((0<N.avail_in||N.avail_out===0)&&x!==c.Z_STREAM_END);return x===c.Z_STREAM_END&&(y=c.Z_FINISH),y===c.Z_FINISH?(x=o.inflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===c.Z_OK):y!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},f.prototype.onData=function(p){this.chunks.push(p)},f.prototype.onEnd=function(p){p===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},s.Inflate=f,s.inflate=v,s.inflateRaw=function(p,b){return(b=b||{}).raw=!0,v(p,b)},s.ungzip=v},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}return c},s.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var a={arraySet:function(c,u,d,h,m){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),m);else for(var f=0;f<h;f++)c[m+f]=u[d+f]},flattenChunks:function(c){var u,d,h,m,f,v;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(v=new Uint8Array(h),u=m=0,d=c.length;u<d;u++)f=c[u],v.set(f,m),m+=f.length;return v}},l={arraySet:function(c,u,d,h,m){for(var f=0;f<h;f++)c[m+f]=u[d+f]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,a)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(o)},{}],42:[function(r,n,s){var o=r("./common"),a=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new o.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,m){if(m<65537&&(h.subarray&&l||!h.subarray&&a))return String.fromCharCode.apply(null,o.shrinkBuf(h,m));for(var f="",v=0;v<m;v++)f+=String.fromCharCode(h[v]);return f}c[254]=c[254]=1,s.string2buf=function(h){var m,f,v,p,b,x=h.length,y=0;for(p=0;p<x;
vendor: 9,340 bytes, line 654
654p++)(64512&(f=h.charCodeAt(p)))==55296&&p+1<x&&(64512&(v=h.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(v-56320),p++),y+=f<128?1:f<2048?2:f<65536?3:4;for(m=new o.Buf8(y),p=b=0;b<y;p++)(64512&(f=h.charCodeAt(p)))==55296&&p+1<x&&(64512&(v=h.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(v-56320),p++),f<128?m[b++]=f:(f<2048?m[b++]=192|f>>>6:(f<65536?m[b++]=224|f>>>12:(m[b++]=240|f>>>18,m[b++]=128|f>>>12&63),m[b++]=128|f>>>6&63),m[b++]=128|63&f);return m},s.buf2binstring=function(h){return d(h,h.length)},s.binstring2buf=function(h){for(var m=new o.Buf8(h.length),f=0,v=m.length;f<v;f++)m[f]=h.charCodeAt(f);return m},s.buf2string=function(h,m){var f,v,p,b,x=m||h.length,y=new Array(2*x);for(f=v=0;f<x;)if((p=h[f++])<128)y[v++]=p;else if(4<(b=c[p]))y[v++]=65533,f+=b-1;else{for(p&=b===2?31:b===3?15:7;1<b&&f<x;)p=p<<6|63&h[f++],b--;1<b?y[v++]=65533:p<65536?y[v++]=p:(p-=65536,y[v++]=55296|p>>10&1023,y[v++]=56320|1023&p)}return d(y,v)},s.utf8border=function(h,m){var f;for((m=m||h.length)>h.length&&(m=h.length),f=m-1;0<=f&&(192&h[f])==128;)f--;return f<0||f===0?m:f+c[h[f]]>m?f:m}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,a,l,c){for(var u=65535&o|0,d=o>>>16&65535|0,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;d=d+(u=u+a[c++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(r,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,n,s){var o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();n.exports=function(a,l,c,u){var d=o,h=u+c;a^=-1;for(var m=u;m<h;m++)a=a>>>8^d[255&(a^l[m])];return-1^a}},{}],46:[function(r,n,s){var o,a=r("../utils/common"),l=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),h=0,m=4,f=0,v=-2,p=-1,b=4,x=2,y=8,w=9,j=286,_=30,S=19,N=2*j+1,P=15,C=3,O=258,F=O+C+1,T=42,A=113,k=1,$=2,K=3,H=4;function W(E,ne){return E.msg=d[ne],ne}function R(E){return(E<<1)-(4<E?9:0)}function G(E){for(var ne=E.length;0<=--ne;)E[ne]=0}function U(E){var ne=E.state,te=ne.pending;te>E.avail_out&&(te=E.avail_out),te!==0&&(a.arraySet(E.output,ne.pending_buf,ne.pending_out,te,E.next_out),E.next_out+=te,ne.pending_out+=te,E.total_out+=te,E.avail_out-=te,ne.pending-=te,ne.pending===0&&(ne.pending_out=0))}function z(E,ne){l._tr_flush_block(E,0<=E.block_start?E.block_start:-1,E.strstart-E.block_start,ne),E.block_start=E.strstart,U(E.strm)}function oe(E,ne){E.pending_buf[E.pending++]=ne}function L(E,ne){E.pending_buf[E.pending++]=ne>>>8&255,E.pending_buf[E.pending++]=255&ne}function q(E,ne){var te,D,M=E.max_chain_length,V=E.strstart,me=E.prev_length,ve=E.nice_match,se=E.strstart>E.w_size-F?E.strstart-(E.w_size-F):0,pe=E.window,xe=E.w_mask,we=E.prev,Ie=E.strstart+O,tt=pe[V+me-1],Ke=pe[V+me];E.prev_length>=E.good_match&&(M>>=2),ve>E.lookahead&&(ve=E.lookahead);do if(pe[(te=ne)+me]===Ke&&pe[te+me-1]===tt&&pe[te]===pe[V]&&pe[++te]===pe[V+1]){V+=2,te++;do;while(pe[++V]===pe[++te]&&pe[++V]===pe[++te]&&pe[++V]===pe[++te]&&pe[++V]===pe[++te]&&pe[++V]===pe[++te]&&pe[++V]===pe[++te]&&pe[++V]===pe[++te]&&pe[++V]===pe[++te]&&V<Ie);if(D=O-(Ie-V),V=Ie-O,me<D){if(E.match_start=ne,ve<=(me=D))break;tt=pe[V+me-1],Ke=pe[V+me]}}while((ne=we[ne&xe])>se&&--M!=0);return me<=E.lookahead?me:E.lookahead}function he(E){var ne,te,D,M,V,me,ve,se,pe,xe,we=E.w_size;do{if(M=E.window_size-E.lookahead-E.strstart,E.strstart>=we+(we-F)){for(a.arraySet(E.window,E.window,we,we,0),E.match_start-=we,E.strstart-=we,E.block_start-=we,ne=te=E.hash_size;D=E.head[--ne],E.head[ne]=we<=D?D-we:0,--te;);for(ne=te=we;D=E.prev[--ne],E.prev[ne]=we<=D?D-we:0,--te;);M+=we}if(E.strm.avail_in===0)break;if(me=E.strm,ve=E.window,se=E.strstart+E.lookahead,pe=M,xe=void 0,xe=me.avail_in,pe<xe&&(xe=pe),te=xe===0?0:(me.avail_in-=xe,a.arraySet(ve,me.input,me.next_in,xe,se),me.state.wrap===1?me.adler=c(me.adler,ve,xe,se):me.state.wrap===2&&(me.adler=u(me.adler,ve,xe,se)),me.next_in+=xe,me.total_in+=xe,xe),E.lookahead+=te,E.lookahead+E.insert>=C)for(V=E.strstart-E.insert,E.ins_h=E.window[V],E.ins_h=(E.ins_h<<E.hash_shift^E.window[V+1])&E.hash_mask;E.insert&&(E.ins_h=(E.ins_h<<E.hash_shift^E.window[V+C-1])&E.hash_mask,E.prev[V&E.w_mask]=E.head[E.ins_h],E.head[E.ins_h]=V,V++,E.insert--,!(E.lookahead+E.insert<C)););}while(E.lookahead<F&&E.strm.avail_in!==0)}function X(E,ne){for(var te,D;;){if(E.lookahead<F){if(he(E),E.lookahead<F&&ne===h)return k;if(E.lookahead===0)break}if(te=0,E.lookahead>=C&&(E.ins_h=(E.ins_h<<E.hash_shift^E.window[E.strstart+C-1])&E.hash_mask,te=E.prev[E.strstart&E.w_mask]=E.head[E.ins_h],E.head[E.ins_h]=E.strstart),te!==0&&E.strstart-te<=E.w_size-F&&(E.match_length=q(E,te)),E.match_length>=C)if(D=l._tr_tally(E,E.strstart-E.match_start,E.match_length-C),E.lookahead-=E.match_length,E.match_length<=E.max_lazy_match&&E.lookahead>=C){for(E.match_length--;E.strstart++,E.ins_h=(E.ins_h<<E.hash_shift^E.window[E.strstart+C-1])&E.hash_mask,te=E.prev[E.strstart&E.w_mask]=E.head[E.ins_h],E.head[E.ins_h]=E.strstart,--E.match_length!=0;);E.strstart++}else E.strstart+=E.match_length,E.match_length=0,E.ins_h=E.window[E.strstart],E.ins_h=(E.ins_h<<E.hash_shift^E.window[E.strstart+1])&E.hash_mask;else D=l._tr_tally(E,0,E.window[E.strstart]),E.lookahead--,E.strstart++;if(D&&(z(E,!1),E.strm.avail_out===0))return k}return E.insert=E.strstart<C-1?E.strstart:C-1,ne===m?(z(E,!0),E.strm.avail_out===0?K:H):E.last_lit&&(z(E,!1),E.strm.avail_out===0)?k:$}function J(E,ne){for(var te,D,M;;){if(E.lookahead<F){if(he(E),E.lookahead<F&&ne===h)return k;if(E.lookahead===0)break}if(te=0,E.lookahead>=C&&(E.ins_h=(E.ins_h<<E.hash_shift^E.window[E.strstart+C-1])&E.hash_mask,te=E.prev[E.strstart&E.w_mask]=E.head[E.ins_h],E.head[E.ins_h]=E.strstart),E.prev_length=E.match_length,E.prev_match=E.match_start,E.match_length=C-1,te!==0&&E.prev_length<E.max_lazy_match&&E.strstart-te<=E.w_size-F&&(E.match_length=q(E,te),E.match_length<=5&&(E.strategy===1||E.match_length===C&&4096<E.strstart-E.match_start)&&(E.match_length=C-1)),E.prev_length>=C&&E.match_length<=E.prev_length){for(M=E.strstart+E.lookahead-C,D=l._tr_tally(E,E.strstart-1-E.prev_match,E.prev_length-C),E.lookahead-=E.prev_length-1,E.prev_length-=2;++E.strstart<=M&&(E.ins_h=(E.ins_h<<E.hash_shift^E.window[E.strstart+C-1])&E.hash_mask,te=E.prev[E.strstart&E.w_mask]=E.head[E.ins_h],E.head[E.ins_h]=E.strstart),--E.prev_length!=0;);if(E.match_available=0,E.match_length=C-1,E.strstart++,D&&(z(E,!1),E.strm.avail_out===0))return k}else if(E.match_available){if((D=l._tr_tally(E,0,E.window[E.strstart-1]))&&z(E,!1),E.strstart++,E.lookahead--,E.strm.avail_out===0)return k}else E.match_available=1,E.strstart++,E.lookahead--}return E.match_available&&(D=l._tr_tally(E,0,E.window[E.strstart-1]),E.match_available=0),E.insert=E.strstart<C-1?E.strstart:C-1,ne===m?(z(E,!0),E.strm.avail_out===0?K:H):E.last_lit&&(z(E,!1),E.strm.avail_out===0)?k:$}function de(E,ne,te,D,M){this.good_length=E,this.max_lazy=ne,this.nice_length=te,this.max_chain=D,this.func=M}function le(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*N),this.dyn_dtree=new a.Buf16(2*(2*_+1)),this.bl_tree=new a.Buf16(2*(2*S+1)),G(this.dyn_ltree),G(this.dyn_dtree),G(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(P+1),this.heap=new a.Buf16(2*j+1),G(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*j+1),G(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function fe(E){var ne;return E&&E.state?(E.total_in=E.total_out=0,E.data_type=x,(ne=E.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?T:A,E.adler=ne.wrap===2?0:1,ne.last_flush=h,l._tr_init(ne),f):W(E,v)}function Z(E){var ne=fe(E);return ne===f&&function(te){te.window_size=2*te.w_size,G(te.head),te.max_lazy_match=o[te.level].max_lazy,te.good_match=o[te.level].good_length,te.nice_match=o[te.level].nice_length,te.max_chain_length=o[te.level].max_chain,te.strstart=0,te.block_start=0,te.lookahead=0,te.insert=0,te.match_length=te.prev_length=C-1,te.match_available=0,te.ins_h=0}(E.state),ne}function ae(E,ne,te,D,M,V){if(!E)return v;var me=1;if(ne===p&&(ne=6),D<0?(me=0,D=-D):15<D&&(me=2,D-=16),M<1||w<M||te!==y||D<8||15<D||ne<0||9<ne||V<0||b<V)return W(E,v);D===8&&(D=9);var ve=new le;return(E.state=ve).strm=E,ve.wrap=me,ve.gzhead=null,ve.w_bits=D,ve.w_size=1<<ve.w_bits,ve.
vendor: 8,468 bytes, line 654
654w_mask=ve.w_size-1,ve.hash_bits=M+7,ve.hash_size=1<<ve.hash_bits,ve.hash_mask=ve.hash_size-1,ve.hash_shift=~~((ve.hash_bits+C-1)/C),ve.window=new a.Buf8(2*ve.w_size),ve.head=new a.Buf16(ve.hash_size),ve.prev=new a.Buf16(ve.w_size),ve.lit_bufsize=1<<M+6,ve.pending_buf_size=4*ve.lit_bufsize,ve.pending_buf=new a.Buf8(ve.pending_buf_size),ve.d_buf=1*ve.lit_bufsize,ve.l_buf=3*ve.lit_bufsize,ve.level=ne,ve.strategy=V,ve.method=te,Z(E)}o=[new de(0,0,0,0,function(E,ne){var te=65535;for(te>E.pending_buf_size-5&&(te=E.pending_buf_size-5);;){if(E.lookahead<=1){if(he(E),E.lookahead===0&&ne===h)return k;if(E.lookahead===0)break}E.strstart+=E.lookahead,E.lookahead=0;var D=E.block_start+te;if((E.strstart===0||E.strstart>=D)&&(E.lookahead=E.strstart-D,E.strstart=D,z(E,!1),E.strm.avail_out===0)||E.strstart-E.block_start>=E.w_size-F&&(z(E,!1),E.strm.avail_out===0))return k}return E.insert=0,ne===m?(z(E,!0),E.strm.avail_out===0?K:H):(E.strstart>E.block_start&&(z(E,!1),E.strm.avail_out),k)}),new de(4,4,8,4,X),new de(4,5,16,8,X),new de(4,6,32,32,X),new de(4,4,16,16,J),new de(8,16,32,32,J),new de(8,16,128,128,J),new de(8,32,128,256,J),new de(32,128,258,1024,J),new de(32,258,258,4096,J)],s.deflateInit=function(E,ne){return ae(E,ne,y,15,8,0)},s.deflateInit2=ae,s.deflateReset=Z,s.deflateResetKeep=fe,s.deflateSetHeader=function(E,ne){return E&&E.state?E.state.wrap!==2?v:(E.state.gzhead=ne,f):v},s.deflate=function(E,ne){var te,D,M,V;if(!E||!E.state||5<ne||ne<0)return E?W(E,v):v;if(D=E.state,!E.output||!E.input&&E.avail_in!==0||D.status===666&&ne!==m)return W(E,E.avail_out===0?-5:v);if(D.strm=E,te=D.last_flush,D.last_flush=ne,D.status===T)if(D.wrap===2)E.adler=0,oe(D,31),oe(D,139),oe(D,8),D.gzhead?(oe(D,(D.gzhead.text?1:0)+(D.gzhead.hcrc?2:0)+(D.gzhead.extra?4:0)+(D.gzhead.name?8:0)+(D.gzhead.comment?16:0)),oe(D,255&D.gzhead.time),oe(D,D.gzhead.time>>8&255),oe(D,D.gzhead.time>>16&255),oe(D,D.gzhead.time>>24&255),oe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),oe(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(oe(D,255&D.gzhead.extra.length),oe(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(E.adler=u(E.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(oe(D,0),oe(D,0),oe(D,0),oe(D,0),oe(D,0),oe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),oe(D,3),D.status=A);else{var me=y+(D.w_bits-8<<4)<<8;me|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(me|=32),me+=31-me%31,D.status=A,L(D,me),D.strstart!==0&&(L(D,E.adler>>>16),L(D,65535&E.adler)),E.adler=1}if(D.status===69)if(D.gzhead.extra){for(M=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>M&&(E.adler=u(E.adler,D.pending_buf,D.pending-M,M)),U(E),M=D.pending,D.pending!==D.pending_buf_size));)oe(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>M&&(E.adler=u(E.adler,D.pending_buf,D.pending-M,M)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){M=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>M&&(E.adler=u(E.adler,D.pending_buf,D.pending-M,M)),U(E),M=D.pending,D.pending===D.pending_buf_size)){V=1;break}V=D.gzindex<D.gzhead.name.length?255&D.gzhead.name.charCodeAt(D.gzindex++):0,oe(D,V)}while(V!==0);D.gzhead.hcrc&&D.pending>M&&(E.adler=u(E.adler,D.pending_buf,D.pending-M,M)),V===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){M=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>M&&(E.adler=u(E.adler,D.pending_buf,D.pending-M,M)),U(E),M=D.pending,D.pending===D.pending_buf_size)){V=1;break}V=D.gzindex<D.gzhead.comment.length?255&D.gzhead.comment.charCodeAt(D.gzindex++):0,oe(D,V)}while(V!==0);D.gzhead.hcrc&&D.pending>M&&(E.adler=u(E.adler,D.pending_buf,D.pending-M,M)),V===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&U(E),D.pending+2<=D.pending_buf_size&&(oe(D,255&E.adler),oe(D,E.adler>>8&255),E.adler=0,D.status=A)):D.status=A),D.pending!==0){if(U(E),E.avail_out===0)return D.last_flush=-1,f}else if(E.avail_in===0&&R(ne)<=R(te)&&ne!==m)return W(E,-5);if(D.status===666&&E.avail_in!==0)return W(E,-5);if(E.avail_in!==0||D.lookahead!==0||ne!==h&&D.status!==666){var ve=D.strategy===2?function(se,pe){for(var xe;;){if(se.lookahead===0&&(he(se),se.lookahead===0)){if(pe===h)return k;break}if(se.match_length=0,xe=l._tr_tally(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++,xe&&(z(se,!1),se.strm.avail_out===0))return k}return se.insert=0,pe===m?(z(se,!0),se.strm.avail_out===0?K:H):se.last_lit&&(z(se,!1),se.strm.avail_out===0)?k:$}(D,ne):D.strategy===3?function(se,pe){for(var xe,we,Ie,tt,Ke=se.window;;){if(se.lookahead<=O){if(he(se),se.lookahead<=O&&pe===h)return k;if(se.lookahead===0)break}if(se.match_length=0,se.lookahead>=C&&0<se.strstart&&(we=Ke[Ie=se.strstart-1])===Ke[++Ie]&&we===Ke[++Ie]&&we===Ke[++Ie]){tt=se.strstart+O;do;while(we===Ke[++Ie]&&we===Ke[++Ie]&&we===Ke[++Ie]&&we===Ke[++Ie]&&we===Ke[++Ie]&&we===Ke[++Ie]&&we===Ke[++Ie]&&we===Ke[++Ie]&&Ie<tt);se.match_length=O-(tt-Ie),se.match_length>se.lookahead&&(se.match_length=se.lookahead)}if(se.match_length>=C?(xe=l._tr_tally(se,1,se.match_length-C),se.lookahead-=se.match_length,se.strstart+=se.match_length,se.match_length=0):(xe=l._tr_tally(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++),xe&&(z(se,!1),se.strm.avail_out===0))return k}return se.insert=0,pe===m?(z(se,!0),se.strm.avail_out===0?K:H):se.last_lit&&(z(se,!1),se.strm.avail_out===0)?k:$}(D,ne):o[D.level].func(D,ne);if(ve!==K&&ve!==H||(D.status=666),ve===k||ve===K)return E.avail_out===0&&(D.last_flush=-1),f;if(ve===$&&(ne===1?l._tr_align(D):ne!==5&&(l._tr_stored_block(D,0,0,!1),ne===3&&(G(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),U(E),E.avail_out===0))return D.last_flush=-1,f}return ne!==m?f:D.wrap<=0?1:(D.wrap===2?(oe(D,255&E.adler),oe(D,E.adler>>8&255),oe(D,E.adler>>16&255),oe(D,E.adler>>24&255),oe(D,255&E.total_in),oe(D,E.total_in>>8&255),oe(D,E.total_in>>16&255),oe(D,E.total_in>>24&255)):(L(D,E.adler>>>16),L(D,65535&E.adler)),U(E),0<D.wrap&&(D.wrap=-D.wrap),D.pending!==0?f:1)},s.deflateEnd=function(E){var ne;return E&&E.state?(ne=E.state.status)!==T&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==A&&ne!==666?W(E,v):(E.state=null,ne===A?W(E,-3):f):v},s.deflateSetDictionary=function(E,ne){var te,D,M,V,me,ve,se,pe,xe=ne.length;if(!E||!E.state||(V=(te=E.state).wrap)===2||V===1&&te.status!==T||te.lookahead)return v;for(V===1&&(E.adler=c(E.adler,ne,xe,0)),te.wrap=0,xe>=te.w_size&&(V===0&&(G(te.head),te.strstart=0,te.block_start=0,te.insert=0),pe=new a.Buf8(te.w_size),a.arraySet(pe,ne,xe-te.w_size,te.w_size,0),ne=pe,xe=te.w_size),me=E.avail_in,ve=E.next_in,se=E.input,E.avail_in=xe,E.next_in=0,E.input=ne,he(te);te.lookahead>=C;){for(D=te.strstart,M=te.lookahead-(C-1);te.ins_h=(te.ins_h<<te.hash_shift^te.window[D+C-1])&te.hash_mask,te.prev[D&te.w_mask]=te.head[te.ins_h],te.head[te.ins_h]=D,D++,--M;);te.strstart=D,te.lookahead=C-1,he(te)}return te.strstart+=te.lookahead,te.block_start=te.strstart,te.insert=te.lookahead,te.lookahead=0,te.match_length=te.prev_length=C-1,te.match_available=0,E.next_in=ve,E.input=se,E.avail_in=me,te.wrap=V,f},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,s){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,n,s){n.exports=function(o,a){var l,c,u,d,h,m,f,v,p,b,x,y,w,j,_,S,N,P,C,O,F,T,A,k,$;l=o.state,c=o.next_in,k=o.input,u=c+(o.avail_in-5),d=o.next_out,$=o.output,h=d-(a-o.avail_out),m=d+(o.avail_out-257),f=l.dmax,v=l.wsize,p=l.whave,b=l.wnext,x=l.window,y=l.hold,w=l.bits,j=l.lencode,_=l.distcode,S=(1<<l.lenbits)-1,N=(1<<l.distbits)-1;e:do{w<15&&(y+=k[c++]<<w,w+=8,y+=k[c++]<<w,w+=8),P=j[y&S];t:for(;;){if(y>>>=C=P>>>24,w-=C,(C=P>>>16&255)===0)$[d++]=65535&P;else{if(!(16&C)){if(!(64&C)){P=j[(65535&P)+(y&(1<<C)-1)];continue t}if(32&C){l.mode=12;break e}o.msg="invalid literal/length code",l.mode=30;break e}O=65535&P,(C&=15)&&(w<C&&(y+=k[c++]<<w,w+=8),O+=y&(1<<C)-1,y>>>=C,w-=C),w<15&&(y+=k[c++]<<w,w+=8,y+=k[c++]<<w,w+=8),P=_[y&N];r:for(;;){if(y>>>=C=P>>>24,w-=C,!(16&(C=P>>>16&255))){if(!(64&C)){P=_[(65535&P)+(y&(1<<C)-1)];continue r}o.msg="invalid distance code",l.mode=30;break e}
vendor: 5,345 bytes, line 654
654if(F=65535&P,w<(C&=15)&&(y+=k[c++]<<w,(w+=8)<C&&(y+=k[c++]<<w,w+=8)),f<(F+=y&(1<<C)-1)){o.msg="invalid distance too far back",l.mode=30;break e}if(y>>>=C,w-=C,(C=d-h)<F){if(p<(C=F-C)&&l.sane){o.msg="invalid distance too far back",l.mode=30;break e}if(A=x,(T=0)===b){if(T+=v-C,C<O){for(O-=C;$[d++]=x[T++],--C;);T=d-F,A=$}}else if(b<C){if(T+=v+b-C,(C-=b)<O){for(O-=C;$[d++]=x[T++],--C;);if(T=0,b<O){for(O-=C=b;$[d++]=x[T++],--C;);T=d-F,A=$}}}else if(T+=b-C,C<O){for(O-=C;$[d++]=x[T++],--C;);T=d-F,A=$}for(;2<O;)$[d++]=A[T++],$[d++]=A[T++],$[d++]=A[T++],O-=3;O&&($[d++]=A[T++],1<O&&($[d++]=A[T++]))}else{for(T=d-F;$[d++]=$[T++],$[d++]=$[T++],$[d++]=$[T++],2<(O-=3););O&&($[d++]=$[T++],1<O&&($[d++]=$[T++]))}break}}break}}while(c<u&&d<m);c-=O=w>>3,y&=(1<<(w-=O<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c<u?u-c+5:5-(c-u),o.avail_out=d<m?m-d+257:257-(d-m),l.hold=y,l.bits=w}},{}],49:[function(r,n,s){var o=r("../utils/common"),a=r("./adler32"),l=r("./crc32"),c=r("./inffast"),u=r("./inftrees"),d=1,h=2,m=0,f=-2,v=1,p=852,b=592;function x(T){return(T>>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(T){var A;return T&&T.state?(A=T.state,T.total_in=T.total_out=A.total=0,T.msg="",A.wrap&&(T.adler=1&A.wrap),A.mode=v,A.last=0,A.havedict=0,A.dmax=32768,A.head=null,A.hold=0,A.bits=0,A.lencode=A.lendyn=new o.Buf32(p),A.distcode=A.distdyn=new o.Buf32(b),A.sane=1,A.back=-1,m):f}function j(T){var A;return T&&T.state?((A=T.state).wsize=0,A.whave=0,A.wnext=0,w(T)):f}function _(T,A){var k,$;return T&&T.state?($=T.state,A<0?(k=0,A=-A):(k=1+(A>>4),A<48&&(A&=15)),A&&(A<8||15<A)?f:($.window!==null&&$.wbits!==A&&($.window=null),$.wrap=k,$.wbits=A,j(T))):f}function S(T,A){var k,$;return T?($=new y,(T.state=$).window=null,(k=_(T,A))!==m&&(T.state=null),k):f}var N,P,C=!0;function O(T){if(C){var A;for(N=new o.Buf32(512),P=new o.Buf32(32),A=0;A<144;)T.lens[A++]=8;for(;A<256;)T.lens[A++]=9;for(;A<280;)T.lens[A++]=7;for(;A<288;)T.lens[A++]=8;for(u(d,T.lens,0,288,N,0,T.work,{bits:9}),A=0;A<32;)T.lens[A++]=5;u(h,T.lens,0,32,P,0,T.work,{bits:5}),C=!1}T.lencode=N,T.lenbits=9,T.distcode=P,T.distbits=5}function F(T,A,k,$){var K,H=T.state;return H.window===null&&(H.wsize=1<<H.wbits,H.wnext=0,H.whave=0,H.window=new o.Buf8(H.wsize)),$>=H.wsize?(o.arraySet(H.window,A,k-H.wsize,H.wsize,0),H.wnext=0,H.whave=H.wsize):($<(K=H.wsize-H.wnext)&&(K=$),o.arraySet(H.window,A,k-$,K,H.wnext),($-=K)?(o.arraySet(H.window,A,k-$,$,0),H.wnext=$,H.whave=H.wsize):(H.wnext+=K,H.wnext===H.wsize&&(H.wnext=0),H.whave<H.wsize&&(H.whave+=K))),0}s.inflateReset=j,s.inflateReset2=_,s.inflateResetKeep=w,s.inflateInit=function(T){return S(T,15)},s.inflateInit2=S,s.inflate=function(T,A){var k,$,K,H,W,R,G,U,z,oe,L,q,he,X,J,de,le,fe,Z,ae,E,ne,te,D,M=0,V=new o.Buf8(4),me=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!T||!T.state||!T.output||!T.input&&T.avail_in!==0)return f;(k=T.state).mode===12&&(k.mode=13),W=T.next_out,K=T.output,G=T.avail_out,H=T.next_in,$=T.input,R=T.avail_in,U=k.hold,z=k.bits,oe=R,L=G,ne=m;e:for(;;)switch(k.mode){case v:if(k.wrap===0){k.mode=13;break}for(;z<16;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if(2&k.wrap&&U===35615){V[k.check=0]=255&U,V[1]=U>>>8&255,k.check=l(k.check,V,2,0),z=U=0,k.mode=2;break}if(k.flags=0,k.head&&(k.head.done=!1),!(1&k.wrap)||(((255&U)<<8)+(U>>8))%31){T.msg="incorrect header check",k.mode=30;break}if((15&U)!=8){T.msg="unknown compression method",k.mode=30;break}if(z-=4,E=8+(15&(U>>>=4)),k.wbits===0)k.wbits=E;else if(E>k.wbits){T.msg="invalid window size",k.mode=30;break}k.dmax=1<<E,T.adler=k.check=1,k.mode=512&U?10:12,z=U=0;break;case 2:for(;z<16;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if(k.flags=U,(255&k.flags)!=8){T.msg="unknown compression method",k.mode=30;break}if(57344&k.flags){T.msg="unknown header flags set",k.mode=30;break}k.head&&(k.head.text=U>>8&1),512&k.flags&&(V[0]=255&U,V[1]=U>>>8&255,k.check=l(k.check,V,2,0)),z=U=0,k.mode=3;case 3:for(;z<32;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}k.head&&(k.head.time=U),512&k.flags&&(V[0]=255&U,V[1]=U>>>8&255,V[2]=U>>>16&255,V[3]=U>>>24&255,k.check=l(k.check,V,4,0)),z=U=0,k.mode=4;case 4:for(;z<16;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}k.head&&(k.head.xflags=255&U,k.head.os=U>>8),512&k.flags&&(V[0]=255&U,V[1]=U>>>8&255,k.check=l(k.check,V,2,0)),z=U=0,k.mode=5;case 5:if(1024&k.flags){for(;z<16;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}k.length=U,k.head&&(k.head.extra_len=U),512&k.flags&&(V[0]=255&U,V[1]=U>>>8&255,k.check=l(k.check,V,2,0)),z=U=0}else k.head&&(k.head.extra=null);k.mode=6;case 6:if(1024&k.flags&&(R<(q=k.length)&&(q=R),q&&(k.head&&(E=k.head.extra_len-k.length,k.head.extra||(k.head.extra=new Array(k.head.extra_len)),o.arraySet(k.head.extra,$,H,q,E)),512&k.flags&&(k.check=l(k.check,$,q,H)),R-=q,H+=q,k.length-=q),k.length))break e;k.length=0,k.mode=7;case 7:if(2048&k.flags){if(R===0)break e;
vendor: 10,738 bytes, line 654
654for(q=0;E=$[H+q++],k.head&&E&&k.length<65536&&(k.head.name+=String.fromCharCode(E)),E&&q<R;);if(512&k.flags&&(k.check=l(k.check,$,q,H)),R-=q,H+=q,E)break e}else k.head&&(k.head.name=null);k.length=0,k.mode=8;case 8:if(4096&k.flags){if(R===0)break e;for(q=0;E=$[H+q++],k.head&&E&&k.length<65536&&(k.head.comment+=String.fromCharCode(E)),E&&q<R;);if(512&k.flags&&(k.check=l(k.check,$,q,H)),R-=q,H+=q,E)break e}else k.head&&(k.head.comment=null);k.mode=9;case 9:if(512&k.flags){for(;z<16;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if(U!==(65535&k.check)){T.msg="header crc mismatch",k.mode=30;break}z=U=0}k.head&&(k.head.hcrc=k.flags>>9&1,k.head.done=!0),T.adler=k.check=0,k.mode=12;break;case 10:for(;z<32;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}T.adler=k.check=x(U),z=U=0,k.mode=11;case 11:if(k.havedict===0)return T.next_out=W,T.avail_out=G,T.next_in=H,T.avail_in=R,k.hold=U,k.bits=z,2;T.adler=k.check=1,k.mode=12;case 12:if(A===5||A===6)break e;case 13:if(k.last){U>>>=7&z,z-=7&z,k.mode=27;break}for(;z<3;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}switch(k.last=1&U,z-=1,3&(U>>>=1)){case 0:k.mode=14;break;case 1:if(O(k),k.mode=20,A!==6)break;U>>>=2,z-=2;break e;case 2:k.mode=17;break;case 3:T.msg="invalid block type",k.mode=30}U>>>=2,z-=2;break;case 14:for(U>>>=7&z,z-=7&z;z<32;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if((65535&U)!=(U>>>16^65535)){T.msg="invalid stored block lengths",k.mode=30;break}if(k.length=65535&U,z=U=0,k.mode=15,A===6)break e;case 15:k.mode=16;case 16:if(q=k.length){if(R<q&&(q=R),G<q&&(q=G),q===0)break e;o.arraySet(K,$,H,q,W),R-=q,H+=q,G-=q,W+=q,k.length-=q;break}k.mode=12;break;case 17:for(;z<14;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if(k.nlen=257+(31&U),U>>>=5,z-=5,k.ndist=1+(31&U),U>>>=5,z-=5,k.ncode=4+(15&U),U>>>=4,z-=4,286<k.nlen||30<k.ndist){T.msg="too many length or distance symbols",k.mode=30;break}k.have=0,k.mode=18;case 18:for(;k.have<k.ncode;){for(;z<3;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}k.lens[me[k.have++]]=7&U,U>>>=3,z-=3}for(;k.have<19;)k.lens[me[k.have++]]=0;if(k.lencode=k.lendyn,k.lenbits=7,te={bits:k.lenbits},ne=u(0,k.lens,0,19,k.lencode,0,k.work,te),k.lenbits=te.bits,ne){T.msg="invalid code lengths set",k.mode=30;break}k.have=0,k.mode=19;case 19:for(;k.have<k.nlen+k.ndist;){for(;de=(M=k.lencode[U&(1<<k.lenbits)-1])>>>16&255,le=65535&M,!((J=M>>>24)<=z);){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if(le<16)U>>>=J,z-=J,k.lens[k.have++]=le;else{if(le===16){for(D=J+2;z<D;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if(U>>>=J,z-=J,k.have===0){T.msg="invalid bit length repeat",k.mode=30;break}E=k.lens[k.have-1],q=3+(3&U),U>>>=2,z-=2}else if(le===17){for(D=J+3;z<D;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}z-=J,E=0,q=3+(7&(U>>>=J)),U>>>=3,z-=3}else{for(D=J+7;z<D;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}z-=J,E=0,q=11+(127&(U>>>=J)),U>>>=7,z-=7}if(k.have+q>k.nlen+k.ndist){T.msg="invalid bit length repeat",k.mode=30;break}for(;q--;)k.lens[k.have++]=E}}if(k.mode===30)break;if(k.lens[256]===0){T.msg="invalid code -- missing end-of-block",k.mode=30;break}if(k.lenbits=9,te={bits:k.lenbits},ne=u(d,k.lens,0,k.nlen,k.lencode,0,k.work,te),k.lenbits=te.bits,ne){T.msg="invalid literal/lengths set",k.mode=30;break}if(k.distbits=6,k.distcode=k.distdyn,te={bits:k.distbits},ne=u(h,k.lens,k.nlen,k.ndist,k.distcode,0,k.work,te),k.distbits=te.bits,ne){T.msg="invalid distances set",k.mode=30;break}if(k.mode=20,A===6)break e;case 20:k.mode=21;case 21:if(6<=R&&258<=G){T.next_out=W,T.avail_out=G,T.next_in=H,T.avail_in=R,k.hold=U,k.bits=z,c(T,L),W=T.next_out,K=T.output,G=T.avail_out,H=T.next_in,$=T.input,R=T.avail_in,U=k.hold,z=k.bits,k.mode===12&&(k.back=-1);break}for(k.back=0;de=(M=k.lencode[U&(1<<k.lenbits)-1])>>>16&255,le=65535&M,!((J=M>>>24)<=z);){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if(de&&!(240&de)){for(fe=J,Z=de,ae=le;de=(M=k.lencode[ae+((U&(1<<fe+Z)-1)>>fe)])>>>16&255,le=65535&M,!(fe+(J=M>>>24)<=z);){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}U>>>=fe,z-=fe,k.back+=fe}if(U>>>=J,z-=J,k.back+=J,k.length=le,de===0){k.mode=26;break}if(32&de){k.back=-1,k.mode=12;break}if(64&de){T.msg="invalid literal/length code",k.mode=30;break}k.extra=15&de,k.mode=22;case 22:if(k.extra){for(D=k.extra;z<D;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}k.length+=U&(1<<k.extra)-1,U>>>=k.extra,z-=k.extra,k.back+=k.extra}k.was=k.length,k.mode=23;case 23:for(;de=(M=k.distcode[U&(1<<k.distbits)-1])>>>16&255,le=65535&M,!((J=M>>>24)<=z);){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if(!(240&de)){for(fe=J,Z=de,ae=le;de=(M=k.distcode[ae+((U&(1<<fe+Z)-1)>>fe)])>>>16&255,le=65535&M,!(fe+(J=M>>>24)<=z);){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}U>>>=fe,z-=fe,k.back+=fe}if(U>>>=J,z-=J,k.back+=J,64&de){T.msg="invalid distance code",k.mode=30;break}k.offset=le,k.extra=15&de,k.mode=24;case 24:if(k.extra){for(D=k.extra;z<D;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}k.offset+=U&(1<<k.extra)-1,U>>>=k.extra,z-=k.extra,k.back+=k.extra}if(k.offset>k.dmax){T.msg="invalid distance too far back",k.mode=30;break}k.mode=25;case 25:if(G===0)break e;if(q=L-G,k.offset>q){if((q=k.offset-q)>k.whave&&k.sane){T.msg="invalid distance too far back",k.mode=30;break}he=q>k.wnext?(q-=k.wnext,k.wsize-q):k.wnext-q,q>k.length&&(q=k.length),X=k.window}else X=K,he=W-k.offset,q=k.length;for(G<q&&(q=G),G-=q,k.length-=q;K[W++]=X[he++],--q;);k.length===0&&(k.mode=21);break;case 26:if(G===0)break e;K[W++]=k.length,G--,k.mode=21;break;case 27:if(k.wrap){for(;z<32;){if(R===0)break e;R--,U|=$[H++]<<z,z+=8}if(L-=G,T.total_out+=L,k.total+=L,L&&(T.adler=k.check=k.flags?l(k.check,K,L,W-L):a(k.check,K,L,W-L)),L=G,(k.flags?U:x(U))!==k.check){T.msg="incorrect data check",k.mode=30;break}z=U=0}k.mode=28;case 28:if(k.wrap&&k.flags){for(;z<32;){if(R===0)break e;R--,U+=$[H++]<<z,z+=8}if(U!==(4294967295&k.total)){T.msg="incorrect length check",k.mode=30;break}z=U=0}k.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;case 32:default:return f}return T.next_out=W,T.avail_out=G,T.next_in=H,T.avail_in=R,k.hold=U,k.bits=z,(k.wsize||L!==T.avail_out&&k.mode<30&&(k.mode<27||A!==4))&&F(T,T.output,T.next_out,L-T.avail_out)?(k.mode=31,-4):(oe-=T.avail_in,L-=T.avail_out,T.total_in+=oe,T.total_out+=L,k.total+=L,k.wrap&&L&&(T.adler=k.check=k.flags?l(k.check,K,L,T.next_out-L):a(k.check,K,L,T.next_out-L)),T.data_type=k.bits+(k.last?64:0)+(k.mode===12?128:0)+(k.mode===20||k.mode===15?256:0),(oe==0&&L===0||A===4)&&ne===m&&(ne=-5),ne)},s.inflateEnd=function(T){if(!T||!T.state)return f;var A=T.state;return A.window&&(A.window=null),T.state=null,m},s.inflateGetHeader=function(T,A){var k;return T&&T.state&&2&(k=T.state).wrap?((k.head=A).done=!1,m):f},s.inflateSetDictionary=function(T,A){var k,$=A.length;return T&&T.state?(k=T.state).wrap!==0&&k.mode!==11?f:k.mode===11&&a(1,A,$,0)!==k.check?-3:F(T,A,$,$)?(k.mode=31,-4):(k.havedict=1,m):f},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,s){var o=r("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(d,h,m,f,v,p,b,x){var y,w,j,_,S,N,P,C,O,F=x.bits,T=0,A=0,k=0,$=0,K=0,H=0,W=0,R=0,G=0,U=0,z=null,oe=0,L=new o.Buf16(16),q=new o.Buf16(16),he=null,X=0;for(T=0;T<=15;T++)L[T]=0;for(A=0;A<f;A++)L[h[m+A]]++;for(K=F,$=15;1<=$&&L[$]===0;$--);if($<K&&(K=$),$===0)return v[p++]=20971520,v[p++]=20971520,x.bits=1,0;for(k=1;k<$&&L[k]===0;k++);for(K<k&&(K=k),T=R=1;T<=15;T++)if(R<<=1,(R-=L[T])<0)return-1;if(0<R&&(d===0||$!==1))return-1;for(q[1]=0,T=1;T<15;T++)q[T+1]=q[T]+L[T];for(A=0;A<f;A++)h[m+A]!==0&&(b[q[h[m+A]]++]=A);if(N=d===0?(z=he=b,19):d===1?(z=a,oe-=257,he=l,X-=257,256):(z=c,he=u,-1),T=k,S=p,W=A=U=0,j=-1,_=(G=1<<(H=K))-1,d===1&&852<G||d===2&&592<G)return 1;for(;;){for(P=T-W,O=b[A]<N?(C=0,b[A]):b[A]>N?(C=he[X+b[A]],z[oe+b[A]]):(C=96,0),y=1<<T-W,k=w=1<<H;v[S+(U>>W)+(w-=y)]=P<<24|C<<16|O|0,w!==0;);for(y=1<<T-1;U&y;)y>>=1;if(y!==0?(U&=y-1,U+=y):U=0,A++,--L[T]==0){if(T===$)break;T=h[m+b[A]]}if(K<T&&(U&_)!==j){for(W===0&&(W=K),S+=k,R=1<<(H=T-W);H+W<$&&!((R-=L[H+W])<=0);)H++,R<<=1;if(G+=1<<H,d===1&&852<G||d===2&&592<G)return 1;v[j=U&_]=K<<24|H<<16|S-p|0}}return U!==0&&(v[S+U]=T-W<<24|64<<16|0),x.bits=K,0}},{"../utils/common":41}],51:[function(r,n,s){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,n,s){var o=r("../utils/common"),a=0,l=1;function c(M){for(var V=M.length;0<=--V;)M[V]=0}var u=0,d=29,h=256,m=h+1+d,f=30,v=19,p=2*m+1,b=15,x=16,y=7,w=256,j=16,_=17,S=18,N=[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],P=[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],C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F=new Array(2*(m+2));c(F);var T=new Array(2*f);c(T);var A=new Array(512);c(A);var k=new Array(256);c(k);var $=new Array(d);c($);var K,H,W,R=new Array(f);function G(M,V,me,ve,se){this.static_tree=M,this.extra_bits=V,this.extra_base=me,this.elems=ve,this.max_length=se,this.has_stree=M&&M.length}function U(M,V){this.dyn_tree=M,this.max_code=0,this.stat_desc=V}function z(M){return M<256?A[M]:A[256+(M>>>7)]}function oe(M,V){M.pending_buf[M.pending++]=255&V,M.pending_buf[M.pending++]=V>>>8&255}function L(M,V,me){M.bi_valid>x-me?(M.bi_buf|=V<<M.bi_valid&65535,oe(M,M.bi_buf),M.bi_buf=V>>x-M.bi_valid,M.bi_valid+=me-x):(M.bi_buf|=V<<M.bi_valid&65535,M.bi_valid+=me)}function q(M,V,me){L(M,me[2*V],me[2*V+1])}function he(M,V){for(var me=0;me|=1&M,M>>>=1,me<<=1,0<--V;);return me>>>1}function X(M,V,me){var ve,se,pe=new Array(b+1),xe=0;for(ve=1;ve<=b;ve++)pe[ve]=xe=xe+me[ve-1]<<1;for(se=0;se<=V;se++){var we=M[2*se+1];we!==0&&(M[2*se]=he(pe[we]++,we))}}function J(M){var V;for(V=0;V<m;V++)M.dyn_ltree[2*V]=0;for(V=0;V<f;V++)M.dyn_dtree[2*V]=0;for(V=0;V<v;V++)M.bl_tree[2*V]=0;M.dyn_ltree[2*w]=1,M.opt_len=M.static_len=0,M.last_lit=M.matches=0}function de(M){8<M.bi_valid?oe(M,M.bi_buf):0<M.bi_valid&&(M.pending_buf[M.pending++]=M.bi_buf),M.bi_buf=0,M.bi_valid=0}function le(M,V,me,ve){var se=2*V,pe=2*me;return M[se]<M[pe]||M[se]===M[pe]&&ve[V]<=ve[me]}function fe(M,V,me){for(var ve=M.heap[me],se=me<<1;se<=M.heap_len&&(se<M.heap_len&&le(V,M.heap[se+1],M.heap[se],M.depth)&&se++,!le(V,ve,M.heap[se],M.depth));)M.heap[me]=M.heap[se],me=se,se<<=1;M.heap[me]=ve}function Z(M,V,me){var ve,se,pe,xe,we=0;if(M.last_lit!==0)for(;
vendor: 6,734 bytes, line 654
654ve=M.pending_buf[M.d_buf+2*we]<<8|M.pending_buf[M.d_buf+2*we+1],se=M.pending_buf[M.l_buf+we],we++,ve===0?q(M,se,V):(q(M,(pe=k[se])+h+1,V),(xe=N[pe])!==0&&L(M,se-=$[pe],xe),q(M,pe=z(--ve),me),(xe=P[pe])!==0&&L(M,ve-=R[pe],xe)),we<M.last_lit;);q(M,w,V)}function ae(M,V){var me,ve,se,pe=V.dyn_tree,xe=V.stat_desc.static_tree,we=V.stat_desc.has_stree,Ie=V.stat_desc.elems,tt=-1;for(M.heap_len=0,M.heap_max=p,me=0;me<Ie;me++)pe[2*me]!==0?(M.heap[++M.heap_len]=tt=me,M.depth[me]=0):pe[2*me+1]=0;for(;M.heap_len<2;)pe[2*(se=M.heap[++M.heap_len]=tt<2?++tt:0)]=1,M.depth[se]=0,M.opt_len--,we&&(M.static_len-=xe[2*se+1]);for(V.max_code=tt,me=M.heap_len>>1;1<=me;me--)fe(M,pe,me);for(se=Ie;me=M.heap[1],M.heap[1]=M.heap[M.heap_len--],fe(M,pe,1),ve=M.heap[1],M.heap[--M.heap_max]=me,M.heap[--M.heap_max]=ve,pe[2*se]=pe[2*me]+pe[2*ve],M.depth[se]=(M.depth[me]>=M.depth[ve]?M.depth[me]:M.depth[ve])+1,pe[2*me+1]=pe[2*ve+1]=se,M.heap[1]=se++,fe(M,pe,1),2<=M.heap_len;);M.heap[--M.heap_max]=M.heap[1],function(Ke,Dt){var yt,Wt,Ct,nt,Ft,kr,ut=Dt.dyn_tree,Ue=Dt.max_code,sn=Dt.stat_desc.static_tree,bt=Dt.stat_desc.has_stree,Vr=Dt.stat_desc.extra_bits,Je=Dt.stat_desc.extra_base,ie=Dt.stat_desc.max_length,be=0;for(nt=0;nt<=b;nt++)Ke.bl_count[nt]=0;for(ut[2*Ke.heap[Ke.heap_max]+1]=0,yt=Ke.heap_max+1;yt<p;yt++)ie<(nt=ut[2*ut[2*(Wt=Ke.heap[yt])+1]+1]+1)&&(nt=ie,be++),ut[2*Wt+1]=nt,Ue<Wt||(Ke.bl_count[nt]++,Ft=0,Je<=Wt&&(Ft=Vr[Wt-Je]),kr=ut[2*Wt],Ke.opt_len+=kr*(nt+Ft),bt&&(Ke.static_len+=kr*(sn[2*Wt+1]+Ft)));if(be!==0){do{for(nt=ie-1;Ke.bl_count[nt]===0;)nt--;Ke.bl_count[nt]--,Ke.bl_count[nt+1]+=2,Ke.bl_count[ie]--,be-=2}while(0<be);for(nt=ie;nt!==0;nt--)for(Wt=Ke.bl_count[nt];Wt!==0;)Ue<(Ct=Ke.heap[--yt])||(ut[2*Ct+1]!==nt&&(Ke.opt_len+=(nt-ut[2*Ct+1])*ut[2*Ct],ut[2*Ct+1]=nt),Wt--)}}(M,V),X(pe,tt,M.bl_count)}function E(M,V,me){var ve,se,pe=-1,xe=V[1],we=0,Ie=7,tt=4;for(xe===0&&(Ie=138,tt=3),V[2*(me+1)+1]=65535,ve=0;ve<=me;ve++)se=xe,xe=V[2*(ve+1)+1],++we<Ie&&se===xe||(we<tt?M.bl_tree[2*se]+=we:se!==0?(se!==pe&&M.bl_tree[2*se]++,M.bl_tree[2*j]++):we<=10?M.bl_tree[2*_]++:M.bl_tree[2*S]++,pe=se,tt=(we=0)===xe?(Ie=138,3):se===xe?(Ie=6,3):(Ie=7,4))}function ne(M,V,me){var ve,se,pe=-1,xe=V[1],we=0,Ie=7,tt=4;for(xe===0&&(Ie=138,tt=3),ve=0;ve<=me;ve++)if(se=xe,xe=V[2*(ve+1)+1],!(++we<Ie&&se===xe)){if(we<tt)for(;q(M,se,M.bl_tree),--we!=0;);else se!==0?(se!==pe&&(q(M,se,M.bl_tree),we--),q(M,j,M.bl_tree),L(M,we-3,2)):we<=10?(q(M,_,M.bl_tree),L(M,we-3,3)):(q(M,S,M.bl_tree),L(M,we-11,7));pe=se,tt=(we=0)===xe?(Ie=138,3):se===xe?(Ie=6,3):(Ie=7,4)}}c(R);var te=!1;function D(M,V,me,ve){L(M,(u<<1)+(ve?1:0),3),function(se,pe,xe,we){de(se),oe(se,xe),oe(se,~xe),o.arraySet(se.pending_buf,se.window,pe,xe,se.pending),se.pending+=xe}(M,V,me)}s._tr_init=function(M){te||(function(){var V,me,ve,se,pe,xe=new Array(b+1);for(se=ve=0;se<d-1;se++)for($[se]=ve,V=0;V<1<<N[se];V++)k[ve++]=se;for(k[ve-1]=se,se=pe=0;se<16;se++)for(R[se]=pe,V=0;V<1<<P[se];V++)A[pe++]=se;for(pe>>=7;se<f;se++)for(R[se]=pe<<7,V=0;V<1<<P[se]-7;V++)A[256+pe++]=se;for(me=0;me<=b;me++)xe[me]=0;for(V=0;V<=143;)F[2*V+1]=8,V++,xe[8]++;for(;V<=255;)F[2*V+1]=9,V++,xe[9]++;for(;V<=279;)F[2*V+1]=7,V++,xe[7]++;for(;V<=287;)F[2*V+1]=8,V++,xe[8]++;for(X(F,m+1,xe),V=0;V<f;V++)T[2*V+1]=5,T[2*V]=he(V,5);K=new G(F,N,h+1,m,b),H=new G(T,P,0,f,b),W=new G(new Array(0),C,0,v,y)}(),te=!0),M.l_desc=new U(M.dyn_ltree,K),M.d_desc=new U(M.dyn_dtree,H),M.bl_desc=new U(M.bl_tree,W),M.bi_buf=0,M.bi_valid=0,J(M)},s._tr_stored_block=D,s._tr_flush_block=function(M,V,me,ve){var se,pe,xe=0;0<M.level?(M.strm.data_type===2&&(M.strm.data_type=function(we){var Ie,tt=4093624447;for(Ie=0;Ie<=31;Ie++,tt>>>=1)if(1&tt&&we.dyn_ltree[2*Ie]!==0)return a;if(we.dyn_ltree[18]!==0||we.dyn_ltree[20]!==0||we.dyn_ltree[26]!==0)return l;for(Ie=32;Ie<h;Ie++)if(we.dyn_ltree[2*Ie]!==0)return l;return a}(M)),ae(M,M.l_desc),ae(M,M.d_desc),xe=function(we){var Ie;for(E(we,we.dyn_ltree,we.l_desc.max_code),E(we,we.dyn_dtree,we.d_desc.max_code),ae(we,we.bl_desc),Ie=v-1;3<=Ie&&we.bl_tree[2*O[Ie]+1]===0;Ie--);return we.opt_len+=3*(Ie+1)+5+5+4,Ie}(M),se=M.opt_len+3+7>>>3,(pe=M.static_len+3+7>>>3)<=se&&(se=pe)):se=pe=me+5,me+4<=se&&V!==-1?D(M,V,me,ve):M.strategy===4||pe===se?(L(M,2+(ve?1:0),3),Z(M,F,T)):(L(M,4+(ve?1:0),3),function(we,Ie,tt,Ke){var Dt;for(L(we,Ie-257,5),L(we,tt-1,5),L(we,Ke-4,4),Dt=0;Dt<Ke;Dt++)L(we,we.bl_tree[2*O[Dt]+1],3);ne(we,we.dyn_ltree,Ie-1),ne(we,we.dyn_dtree,tt-1)}(M,M.l_desc.max_code+1,M.d_desc.max_code+1,xe+1),Z(M,M.dyn_ltree,M.dyn_dtree)),J(M),ve&&de(M)},s._tr_tally=function(M,V,me){return M.pending_buf[M.d_buf+2*M.last_lit]=V>>>8&255,M.pending_buf[M.d_buf+2*M.last_lit+1]=255&V,M.pending_buf[M.l_buf+M.last_lit]=255&me,M.last_lit++,V===0?M.dyn_ltree[2*me]++:(M.matches++,V--,M.dyn_ltree[2*(k[me]+h+1)]++,M.dyn_dtree[2*z(V)]++),M.last_lit===M.lit_bufsize-1},s._tr_align=function(M){L(M,2,3),q(M,w,F),function(V){V.bi_valid===16?(oe(V,V.bi_buf),V.bi_buf=0,V.bi_valid=0):8<=V.bi_valid&&(V.pending_buf[V.pending++]=255&V.bi_buf,V.bi_buf>>=8,V.bi_valid-=8)}(M)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(o){(function(a,l){if(!a.setImmediate){var c,u,d,h,m=1,f={},v=!1,p=a.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(a);b=b&&b.setTimeout?b:a,c={}.toString.call(a.process)==="[object process]"?function(j){process.nextTick(function(){y(j)})}:function(){if(a.postMessage&&!a.importScripts){var j=!0,_=a.onmessage;return a.onmessage=function(){j=!1},a.postMessage("","*"),a.onmessage=_,j}}()?(h="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",w,!1):a.attachEvent("onmessage",w),function(j){a.postMessage(h+j,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(j){y(j.data)},function(j){d.port2.postMessage(j)}):p&&"onreadystatechange"in p.createElement("script")?(u=p.documentElement,function(j){var _=p.createElement("script");_.onreadystatechange=function(){y(j),_.onreadystatechange=null,u.removeChild(_),_=null},u.appendChild(_)}):function(j){setTimeout(y,0,j)},b.setImmediate=function(j){typeof j!="function"&&(j=new Function(""+j));for(var _=new Array(arguments.length-1),S=0;S<_.length;S++)_[S]=arguments[S+1];var N={callback:j,args:_};return f[m]=N,c(m),m++},b.clearImmediate=x}function x(j){delete f[j]}function y(j){if(v)setTimeout(y,0,j);else{var _=f[j];if(_){v=!0;try{(function(S){var N=S.callback,P=S.args;switch(P.length){case 0:N();break;case 1:N(P[0]);break;case 2:N(P[0],P[1]);break;case 3:N(P[0],P[1],P[2]);break;default:N.apply(l,P)}})(_)}finally{x(j),v=!1}}}}
654function w(j){j.source===a&&typeof j.data=="string"&&j.data.indexOf(h)===0&&y(+j.data.slice(h.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof Nf<"u"?Nf:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(oO);var MQ=oO.exports;const Mw=t0(MQ);function p1(){const{user:t}=$t(),{trackCustom:e}=ro(),{track:r}=no(),[n,s]=g.useState(!1);return{downloadTheme:async(a,l="classic")=>{var c,u,d,h;if(!t)return Q.error("Please sign in to download themes"),{success:!1,insufficientCredits:!1};if(!a.master_html||!a.master_css)return Q.error("Theme files are not available"),{success:!1,insufficientCredits:!1};s(!0);try{await re.from("theme_downloads").insert({user_id:t.id,theme_id:a.id});const{data:m,error:f}=await re.functions.invoke("export-theme",{body:{project:{id:a.id,name:a.name,masterHtml:a.master_html,masterCss:a.master_css,version:a.version||"1.0",current_theme_data:a.current_theme_data??null},exportFormat:l}});if(f){try{const N=f!=null&&f.context?await f.context.json():null;if(N!=null&&N.creditsNeeded||(u=(c=N==null?void 0:N.error)==null?void 0:c.includes)!=null&&u.call(c,"Insufficient credits"))return{success:!1,insufficientCredits:!0}}catch{}if((d=f.message)!=null&&d.includes("403")||(h=f.message)!=null&&h.includes("Insufficient credits"))return{success:!1,insufficientCredits:!0};throw f}if(m!=null&&m.error&&(m!=null&&m.creditsNeeded))return{success:!1,insufficientCredits:!0};const v=m.format;if(v&&v!==l)return Q.error(`Export format mismatch: requested ${l} but received ${v}. Please try again.`),{success:!1,insufficientCredits:!1};const p=new Mw,b=m.files,x=a.name.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),y=p.folder(x);if(!y)throw new Error("Failed to create theme folder");for(const[N,P]of Object.entries(b))N!=="screenshot.txt"&&y.file(N,P);if(a.thumbnail_url)try{const N=await fetch(a.thumbnail_url);if(N.ok){const C=await(await N.blob()).arrayBuffer();y.file("screenshot.png",C)}}catch(N){console.warn("Could not fetch thumbnail for screenshot:",N)}const w=await p.generateAsync({type:"blob"}),j=URL.createObjectURL(w),_=a.version||"1.0",S=document.createElement("a");return S.href=j,S.download=`${a.name.toLowerCase().replace(/\s+/g,"-")}-theme-v${_}.zip`,document.body.appendChild(S),S.click(),document.body.removeChild(S),URL.revokeObjectURL(j),Q.success("Theme downloaded successfully!"),e("ThemeExport",{theme_name:a.name,format:l}),r("theme_exported",{export_type:l}),{success:!0,insufficientCredits:!1}}catch(m){return console.error("Download error:",m),Q.error("Failed to download theme"),{success:!1,insufficientCredits:!1}}finally{s(!1)}},loading:n}}function $Q(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const r=document.implementation.createHTMLDocument(),n=r.createElement("base"),s=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(s),e&&(n.href=e),s.href=t,s.href}const DQ=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function Qo(t){const e=[];for(let r=0,n=t.length;r<n;r++)e.push(t[r]);return e}let Ul=null;function aO(t={}){return Ul||(t.includeStyleProperties?(Ul=t.includeStyleProperties,Ul):(Ul=Qo(window.getComputedStyle(document.documentElement)),Ul))}function tg(t,e){const n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function FQ(t){const e=tg(t,"border-left-width"),r=tg(t,"border-right-width");return t.clientWidth+e+r}function LQ(t){const e=tg(t,"border-top-width"),r=tg(t,"border-bottom-width");return t.clientHeight+e+r}function lO(t,e={}){const r=e.width||FQ(t),n=e.height||LQ(t);return{width:r,height:n}}function BQ(){let t,e;try{e=process}catch{}const r=e&&e.env?e.env.devicePixelRatio:null;return r&&(t=parseInt(r,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const Hn=16384;function zQ(t){(t.width>Hn||t.height>Hn)&&(t.width>Hn&&t.height>Hn?t.width>t.height?(t.height*=Hn/t.width,t.width=Hn):(t.width*=Hn/t.height,t.height=Hn):t.width>Hn?(t.height*=Hn/t.width,t.width=Hn):(t.width*=Hn/t.height,t.height=Hn))}function rg(t){return new Promise((e,r)=>{const n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>e(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=t})}async function UQ(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function WQ(t,e,r){const n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttribute("width",`${e}`),s.setAttribute("height",`${r}`),s.setAttribute("viewBox",`0 0 ${e} ${r}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),s.appendChild(o),o.appendChild(t),UQ(s)}const Un=(t,e)=>{if(t instanceof e)return!0;const r=Object.getPrototypeOf(t);return r===null?!1:r.constructor.name===e.name||Un(r,e)};function HQ(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function GQ(t,e){return aO(e).map(r=>{const n=t.getPropertyValue(r),s=t.getPropertyPriority(r);return`${r}: ${n}${s?" !important":""};`}).join(" ")}function qQ(t,e,r,n){const s=`.${t}:${e}`,o=r.cssText?HQ(r):GQ(r,n);return document.createTextNode(`${s}{${o}}`)}function FN(t,e,r,n){const s=window.getComputedStyle(t,r),o=s.getPropertyValue("content");
654if(o===""||o==="none")return;const a=DQ();try{e.className=`${e.className} ${a}`}catch{return}const l=document.createElement("style");l.appendChild(qQ(a,r,s,n)),e.appendChild(l)}function VQ(t,e,r){FN(t,e,":before",r),FN(t,e,":after",r)}const LN="application/font-woff",BN="image/jpeg",KQ={woff:LN,woff2:LN,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:BN,jpeg:BN,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function YQ(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function g1(t){const e=YQ(t).toLowerCase();return KQ[e]||""}function QQ(t){return t.split(/,/)[1]}function $w(t){return t.search(/^(data:)/)!==-1}function JQ(t,e){return`data:${e};base64,${t}`}async function cO(t,e,r){const n=await fetch(t,e);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const s=await n.blob();return new Promise((o,a)=>{const l=new FileReader;l.onerror=a,l.onloadend=()=>{try{o(r({res:n,result:l.result}))}catch(c){a(c)}},l.readAsDataURL(s)})}const dy={};function XQ(t,e,r){let n=t.replace(/\?.*/,"");return r&&(n=t),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),e?`[${e}]${n}`:n}async function v1(t,e,r){const n=XQ(t,e,r.includeQueryParams);if(dy[n]!=null)return dy[n];r.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let s;try{const o=await cO(t,r.fetchRequestInit,({res:a,result:l})=>(e||(e=a.headers.get("Content-Type")||""),QQ(l)));s=JQ(o,e)}catch(o){s=r.imagePlaceholder||"";let a=`Failed to fetch resource: ${t}`;o&&(a=typeof o=="string"?o:o.message),a&&console.warn(a)}return dy[n]=s,s}async function ZQ(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):rg(e)}async function eJ(t,e){if(t.currentSrc){const o=document.createElement("canvas"),a=o.getContext("2d");o.width=t.clientWidth,o.height=t.clientHeight,a==null||a.drawImage(t,0,0,o.width,o.height);const l=o.toDataURL();return rg(l)}const r=t.poster,n=g1(r),s=await v1(r,n,e);return rg(s)}async function tJ(t,e){var r;try{if(!((r=t==null?void 0:t.contentDocument)===null||r===void 0)&&r.body)return await pv(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function rJ(t,e){return Un(t,HTMLCanvasElement)?ZQ(t):Un(t,HTMLVideoElement)?eJ(t,e):Un(t,HTMLIFrameElement)?tJ(t,e):t.cloneNode(uO(t))}const nJ=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",uO=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function sJ(t,e,r){var n,s;if(uO(e))return e;let o=[];return nJ(t)&&t.assignedNodes?o=Qo(t.assignedNodes()):Un(t,HTMLIFrameElement)&&(!((n=t.contentDocument)===null||n===void 0)&&n.body)?o=Qo(t.contentDocument.body.childNodes):o=Qo(((s=t.shadowRoot)!==null&&s!==void 0?s:t).childNodes),o.length===0||Un(t,HTMLVideoElement)||await o.reduce((a,l)=>a.then(()=>pv(l,r)).then(c=>{c&&e.appendChild(c)}),Promise.resolve()),e}function iJ(t,e,r){const n=e.style;if(!n)return;const s=window.getComputedStyle(t);s.cssText?(n.cssText=s.cssText,n.transformOrigin=s.transformOrigin):aO(r).forEach(o=>{let a=s.getPropertyValue(o);o==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),Un(t,HTMLIFrameElement)&&o==="display"&&a==="inline"&&(a="block"),o==="d"&&e.getAttribute("d")&&(a=`path(${e.getAttribute("d")})`),n.setProperty(o,a,s.getPropertyPriority(o))})}function oJ(t,e){Un(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),Un(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function aJ(t,e){if(Un(t,HTMLSelectElement)){const r=e,n=Array.from(r.children).find(s=>t.value===s.getAttribute("value"));n&&n.setAttribute("selected","")}}function lJ(t,e,r){return Un(e,Element)&&(iJ(t,e,r),VQ(t,e,r),oJ(t,e),aJ(t,e)),e}async function cJ(t,e){const r=t.querySelectorAll?t.querySelectorAll("use"):[];if(r.length===0)return t;const n={};for(let o=0;o<r.length;o++){const l=r[o].getAttribute("xlink:href");if(l){const c=t.querySelector(l),u=document.querySelector(l);!c&&u&&!n[l]&&(n[l]=await pv(u,e,!0))}}const s=Object.values(n);if(s.length){const o="http://www.w3.org/1999/xhtml",a=document.createElementNS(o,"svg");a.setAttribute("xmlns",o),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";const l=document.createElementNS(o,"defs");a.appendChild(l);for(let c=0;c<s.length;c++)l.appendChild(s[c]);t.appendChild(a)}return t}async function pv(t,e,r){return!r&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(n=>rJ(n,e)).then(n=>sJ(t,n,e)).then(n=>lJ(t,n,e)).then(n=>cJ(n,e))}const dO=/url\((['"]?)([^'"]+?)\1\)/g,uJ=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,dJ=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function hJ(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function fJ(t){const e=[];return t.replace(dO,(r,n,s)=>(e.push(s),r)),e.filter(r=>!$w(r))}async function mJ(t,e,r,n,s){try{const o=r?$Q(e,r):e,a=g1(e);let l;return s||(l=await v1(o,a,n)),t.replace(hJ(e),`$1${l}$3`)}catch{}return t}function pJ(t,{preferredFontFormat:e}){return e?t.replace(dJ,r=>{for(;;){const[n,,s]=uJ.exec(r)||[];if(!s)return"";if(s===e)return`src: ${n};`}}):t}function hO(t){return t.search(dO)!==-1}async function fO(t,e,r){if(!hO(t))return t;const n=pJ(t,r);return fJ(n).reduce((o,a)=>o.then(l=>mJ(l,a,e,r)),Promise.resolve(n))}async function Wl(t,e,r){var n;const s=(n=e.style)===null||n===void 0?void 0:n.getPropertyValue(t);if(s){const o=await fO(s,null,r);return e.style.setProperty(t,o,e.style.getPropertyPriority(t)),!0}return!1}async function gJ(t,e){await Wl("background",t,e)||await Wl("background-image",t,e),await Wl("mask",t,e)||await Wl("-webkit-mask",t,e)||await Wl("mask-image",t,e)||await Wl("-webkit-mask-image",t,e)}async function vJ(t,e){const r=Un(t,HTMLImageElement);if(!(r&&!$w(t.src))&&!(Un(t,SVGImageElement)&&!$w(t.href.baseVal)))return;const n=r?t.src:t.href.baseVal,s=await v1(n,g1(n),e);await new Promise((o,a)=>{t.onload=o,t.onerror=e.onImageErrorHandler?(...c)=>{try{o(e.onImageErrorHandler(...c))}catch(u){a(u)}}:a;const l=t;l.decode&&(l.decode=o),l.loading==="lazy"&&(l.loading="eager"),r?(t.srcset="",t.src=s):t.href.baseVal=s})}async function xJ(t,e){const n=Qo(t.childNodes).map(s=>mO(s,e));await Promise.all(n).then(()=>t)}async function mO(t,e){Un(t,Element)&&(await gJ(t,e),await vJ(t,e),await xJ(t,e))}function yJ(t,e){const{style:r}=t;e.backgroundColor&&(r.backgroundColor=e.backgroundColor),e.width&&(r.width=`${e.width}px`),e.height&&(r.height=`${e.height}px`);const n=e.style;
654return n!=null&&Object.keys(n).forEach(s=>{r[s]=n[s]}),t}const zN={};async function UN(t){let e=zN[t];if(e!=null)return e;const n=await(await fetch(t)).text();return e={url:t,cssText:n},zN[t]=e,e}async function WN(t,e){let r=t.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,o=(r.match(/url\([^)]+\)/g)||[]).map(async a=>{let l=a.replace(n,"$1");return l.startsWith("https://")||(l=new URL(l,t.url).href),cO(l,e.fetchRequestInit,({result:c})=>(r=r.replace(a,`url(${c})`),[a,c]))});return Promise.all(o).then(()=>r)}function HN(t){if(t==null)return[];const e=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=t.replace(r,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const c=s.exec(n);if(c===null)break;e.push(c[0])}n=n.replace(s,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",l=new RegExp(a,"gi");for(;;){let c=o.exec(n);if(c===null){if(c=l.exec(n),c===null)break;o.lastIndex=l.lastIndex}else l.lastIndex=o.lastIndex;e.push(c[0])}return e}async function bJ(t,e){const r=[],n=[];return t.forEach(s=>{if("cssRules"in s)try{Qo(s.cssRules||[]).forEach((o,a)=>{if(o.type===CSSRule.IMPORT_RULE){let l=a+1;const c=o.href,u=UN(c).then(d=>WN(d,e)).then(d=>HN(d).forEach(h=>{try{s.insertRule(h,h.startsWith("@import")?l+=1:s.cssRules.length)}catch(m){console.error("Error inserting rule from remote css",{rule:h,error:m})}})).catch(d=>{console.error("Error loading remote css",d.toString())});n.push(u)}})}catch(o){const a=t.find(l=>l.href==null)||document.styleSheets[0];s.href!=null&&n.push(UN(s.href).then(l=>WN(l,e)).then(l=>HN(l).forEach(c=>{a.insertRule(c,a.cssRules.length)})).catch(l=>{console.error("Error loading remote stylesheet",l)})),console.error("Error inlining remote css file",o)}}),Promise.all(n).then(()=>(t.forEach(s=>{if("cssRules"in s)try{Qo(s.cssRules||[]).forEach(o=>{r.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${s.href}`,o)}}),r))}function wJ(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>hO(e.style.getPropertyValue("src")))}async function _J(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=Qo(t.ownerDocument.styleSheets),n=await bJ(r,e);return wJ(n)}function pO(t){return t.trim().replace(/["']/g,"")}function jJ(t){const e=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(o=>{e.add(pO(o))}),Array.from(n.children).forEach(o=>{o instanceof HTMLElement&&r(o)})}return r(t),e}async function kJ(t,e){const r=await _J(t,e),n=jJ(t);return(await Promise.all(r.filter(o=>n.has(pO(o.style.fontFamily))).map(o=>{const a=o.parentStyleSheet?o.parentStyleSheet.href:null;return fO(o.cssText,a,e)}))).join(`
655`)}async function SJ(t,e){const r=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await kJ(t,e);if(r){const n=document.createElement("style"),s=document.createTextNode(r);n.appendChild(s),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}async function NJ(t,e={}){const{width:r,height:n}=lO(t,e),s=await pv(t,e,!0);return await SJ(s,e),await mO(s,e),yJ(s,e),await WQ(s,r,n)}async function CJ(t,e={}){const{width:r,height:n}=lO(t,e),s=await NJ(t,e),o=await rg(s),a=document.createElement("canvas"),l=a.getContext("2d"),c=e.pixelRatio||BQ(),u=e.canvasWidth||r,d=e.canvasHeight||n;return a.width=u*c,a.height=d*c,e.skipAutoScale||zQ(a),a.style.width=`${u}`,a.style.height=`${d}`,e.backgroundColor&&(l.fillStyle=e.backgroundColor,l.fillRect(0,0,a.width,a.height)),l.drawImage(o,0,0,a.width,a.height),a}async function EJ(t,e={}){return(await CJ(t,e)).toDataURL()}const PJ="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/webfonts/",TJ="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css",AJ=/fonts\.gstatic\.com|fonts\.googleapis\.com|cdnjs\.cloudflare\.com|data:/i,RJ=/fonts\.googleapis\.com|fonts\.gstatic\.com/i;function IJ(t){return t&&t.replace(/url\(\s*(['"]?)([^)'"]*webfonts\/(fa-[^)'"?#\s]+))\1\s*\)/gi,(e,r,n,s)=>`url(${PJ}${s})`)}function OJ(t){return t&&t.replace(/@font-face\s*\{[^}]*\}/gi,e=>!/url\(\s*['"]?https?:/i.test(e)||AJ.test(e)?e:"")}
655function gv(t){return OJ(IJ(t))}function gO(t){return t&&t.replace(/<link\b[^>]*>/gi,r=>{var s;if(!/\brel\s*=\s*['"]stylesheet['"]/i.test(r)&&!/\brel\s*=\s*stylesheet\b/i.test(r))return r;const n=((s=r.match(/\bhref\s*=\s*['"]([^'"]+)['"]/i))==null?void 0:s[1])||"";return RJ.test(n)?r:""}).replace(/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,(r,n,s,o)=>`${n}${gv(s)}${o}`)}let um=null;function MJ(){return um||(um=fetch(TJ).then(t=>{if(!t.ok)throw new Error(String(t.status));return t.text()}).then(t=>gv(t).replace(/<\/style/gi,"<\\/style")).catch(()=>(um=null,""))),um}const dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==",$J="linear-gradient(135deg, #667eea 0%, #764ba2 100%)";function ng(t){return t.startsWith("https://placehold.co")||/https?:\/\/[a-z0-9-]+\.supabase\.co\/storage\/v1\/object\/public\//.test(t)}function DJ(t){let e=t.replace(/(<img[^>]+src=["'])https?:\/\/([^"']+)(["'])/gi,(r,n,s,o)=>{const a=`https://${s}`;return ng(a)?r:`${n}${dc}${o}`});return e=e.replace(/\ssrcset=["'][^"']*["']/gi,""),e=e.replace(/(background(?:-image)?:\s*url\(['"]?)https?:\/\/([^)'">]+)/gi,(r,n,s)=>{const o=`https://${s}`;return ng(o)?r:`${n}${dc}`}),e}function vO(t){return t.replace(/url\((['"]?)https?:\/\/[^)'"]*\1\)/gi,e=>{const r=e.match(/url\(['"]?(https?:\/\/[^)'"]+)['"]?\)/i);return r&&ng(r[1])?e:$J})}function FJ(t){return t.replace(/(<style[^>]*>)([\s\S]*?)(<\/style>)/gi,(e,r,n,s)=>`${r}${vO(n)}${s}`)}function LJ(t){return t.replace(/<video[^>]*>[\s\S]*?<\/video>/gi,e=>{const r=e.match(/poster=["']([^"']+)["']/i),n=r?r[1]:null;return`<div style="${n?`background-image:url('${n}');background-size:cover;background-position:center;`:"background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);"}width:100%;height:100%;display:flex;align-items:center;justify-content:center;min-height:400px;"><div style="width:64px;height:64px;background:rgba(255,255,255,0.3);border-radius:50%;display:flex;align-items:center;justify-content:center;"><div style="width:0;height:0;border-top:13px solid transparent;border-bottom:13px solid transparent;border-left:22px solid white;margin-left:5px;"></div></div></div>`})}async function vv(t,e,r={}){const{width:n=1200,height:s=900}=r;return new Promise((o,a)=>{const l=document.createElement("iframe");l.style.position="fixed",l.style.left="-9999px",l.style.top="0",l.style.width=`${n}px`,l.style.height=`${s}px`,l.style.border="none",l.style.backgroundColor="#ffffff",document.body.appendChild(l);let c=!1;l.onload=async()=>{if(!c){c=!0;try{const u=l.contentDocument;if(!u)throw new Error("Could not access iframe document");const d=FJ(DJ(LJ(gO(t)))),h=vO(gv(e));u.open(),u.write(`
656          <!DOCTYPE html>
657          <html>
658            <head>
659              <style>
660                html, body {
661                  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
662                  width: ${n}px;
663                  margin: 0;
664                  background: #ffffff;
665                }
666                body {
667                  height: ${s}px;
668                  overflow: hidden;
669                }
670                ${h}
671              </style>
672            </head>
673            <body>
674              ${d}
675            </body>
676          </html>
677        `),u.close();const m=u.createElement("style");m.textContent=`
678          .animate-on-scroll, .animate-slide-left, .animate-slide-right, .animate-slide-up, .animate-scale {
679            opacity: 1 !important;
680            transform: none !important;
681            animation: none !important;
682          }
683          /* Force desktop header layout for screenshots: hide hamburger toggles
684             and ensure the inline nav is visible regardless of viewport-based
685             media queries that may otherwise leave a malformed/partial state. */
686          .fse-toggle-button,
687          .fse-nav-toggle,
688          .fse-mobile-menu,
689          .menu-toggle,
690          [class*="hamburger"],
691          [class*="mobile-menu-toggle"],
692          [aria-label="Menu" i][role="button"],
693          button[aria-controls*="menu" i] {
694            display: none !important;
695          }
696          .fse-main-nav,
697          header nav,
698          .fse-header nav {
699            display: flex !important;
700            visibility: visible !important;
701            opacity: 1 !important;
702          }
703        `,u.head.appendChild(m),await new Promise(y=>setTimeout(y,500));const f=u.body;if(!f)throw new Error("Could not access iframe body");(y=>{y.querySelectorAll("img").forEach(j=>
703{j.complete&&j.naturalWidth===0&&(j.src=dc),j.onerror=function(){this.onerror=null,this.src=dc}})})(u),u.querySelectorAll("img").forEach(y=>{const w=y.getAttribute("src")||"";/^https?:/i.test(w)&&!ng(w)&&y.setAttribute("src",dc)});const p=await EJ(f,{width:n,height:s,cacheBust:!1,pixelRatio:1,skipFonts:!0,imagePlaceholder:dc,filter:y=>{var w,j;return!(y.tagName==="LINK"&&((w=y.getAttribute("href"))!=null&&w.includes("cdnjs.cloudflare.com"))||y.tagName==="SCRIPT"&&((j=y.getAttribute("src"))!=null&&j.includes("cdn.tailwindcss.com")))}}),x=await(await fetch(p)).blob();document.body.removeChild(l),o(x)}catch(u){document.body.removeChild(l),a(u)}}},l.onerror=()=>{document.body.removeChild(l),a(new Error("Failed to load iframe"))},l.src="about:blank"})}function BJ(t,e){const r=URL.createObjectURL(t),n=document.createElement("a");n.download=e,n.href=r,n.click(),URL.revokeObjectURL(r)}function zJ(t){return new Promise((e,r)=>{const n=new FileReader;n.onloadend=()=>{const o=n.result.split(",")[1];e(o)},n.onerror=r,n.readAsDataURL(t)})}const xO=/https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/project-images\/[^"'\s)]+/gi,UJ="https://placehold.co/200x60/EEE/999?text=Logo",yO="https://placehold.co/800x600/EEE/999?text=Image+Placeholder",x1="linear-gradient(135deg, #667eea 0%, #764ba2 100%)";function WJ(t){return t.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*\/?>/gi,"").replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,"").replace(/\son[a-z]+\s*=\s*'[^']*'/gi,"").replace(/\son[a-z]+\s*=\s*[^\s>]+/gi,"").replace(/(href|src|action|formaction|xlink:href)\s*=\s*(["'])\s*javascript:[^"']*\2/gi,"$1=$2#$2")}function sg(t){return t&&WJ(t).replace(xO,r=>/\/logo[-_]/i.test(r)?UJ:yO)}function ig(t){return t&&t.replace(xO,()=>x1)}const HJ=/(<img[^>]+src=["'])https?:\/\/(?!placehold\.co[/"]|[a-z0-9-]+\.supabase\.co\/storage\/v1\/object\/public\/thumbnails)[^"']+/gi,GJ=/srcset=["'][^"']*https?:\/\/(?!placehold\.co)[^"']+["']/gi,qJ=/(background(?:-image)?:\s*url\(['"]?)https?:\/\/(?!placehold\.co[/"'])[^)'">]+/gi;function Dw(t){if(!t)return t;let e=sg(t);return e=e.replace(HJ,`$1${yO}`),e=e.replace(GJ,""),e=e.replace(qJ,`$1${x1}`),e}const VJ=/(url\(['"]?)https?:\/\/(?!placehold\.co[/"']|[a-z0-9-]+\.supabase\.co\/storage\/v1\/object\/public\/thumbnails)[^)'">]+/gi;function Fw(t){if(!t)return t;let e=ig(t);return e=e.replace(VJ,`$1${x1}`),e}const Ah="https://placehold.co/1200x900/F3F4F6/9CA3AF?text=Preview+Unavailable";function hy(t){const e=t.current_theme_data;return{html:t.master_html||(e==null?void 0:e.previewHtml)||"",css:t.master_css||(e==null?void 0:e.previewCss)||""}}async function GN(t){return y1(t)}async function y1(t){const{userId:e,projectId:r,html:n,css:s,isFromWebsite:o=!1,storageKey:a}=t,l=o?Dw:sg,c=o?Fw:ig,u=l(n),d=c(s||"");let h="";for(let m=0;m<2&&!h;m++)try{m>0&&await new Promise(b=>setTimeout(b,1e3));const f=await vv(u,d,{width:1200,height:900,cropAboveFold:!0}),v=a||`${e}/${r}-thumbnail.png`,{error:p}=await re.storage.from("thumbnails").upload(v,f,{upsert:!0,contentType:"image/png"});if(!p){const{data:b}=re.storage.from("thumbnails").getPublicUrl(v);h=b.publicUrl}}catch(f){console.error(`Thumbnail capture failed (attempt ${m+1}):`,f)}return h||Ah}function bO({src:t,alt:e,className:r=""}){const[n,s]=g.useState(!1);return!t||n?n?i.jsx("img",{src:Ah,alt:e,className:r,loading:"lazy"}):i.jsx("div",{className:`w-full h-full flex items-center justify-center text-muted-foreground bg-muted ${r}`,children:i.jsx("span",{className:"text-sm",children:"No preview available"})}):i.jsx("img",{src:t,alt:e,className:r,loading:"lazy",onError:()=>s(!0)})}function KJ(){const t=Zt(),{favorites:e,loading:r,refetch:n}=OQ(),{downloadTheme:s,loading:o}=p1();return r?i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Array.from({length:3}).map((a,l)=>i.jsx("div",{className:"aspect-video bg-muted rounded-lg animate-pulse"},l))}):e.length===0?i.jsxs("div",{className:"text-center py-16",children:[i.jsx(tl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),i.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Saved Themes"}),i.jsx("p",{className:"text-muted-foreground mb-4",children:"Browse the theme gallery and save themes you like."}),i.jsx(Y,{onClick:()=>t("/themes"),children:"Browse Themes"})]}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map(a=>{const l=a.theme;return l?i.jsxs(dt,{className:"group overflow-hidden hover:shadow-lg transition-shadow",children:[i.jsxs(ct,{className:"p-0",children:[i.jsx("div",{className:"relative aspect-video bg-muted cursor-pointer",onClick:()=>t(`/themes/${l.slug}`),children:i.jsx(bO,{src:l.thumbnail_url,alt:`${l.name} WordPress theme preview`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),i.jsxs("div",{className:"p-4",children:[i.jsx("h3",{className:"font-semibold text-lg truncate",children:l.name}),i.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mt-1",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(tl,{className:"h-3 w-3 fill-destructive text-destructive"}),l.heart_count||0]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Wn,{className:"h-3 w-3"}),l.download_count||0]})]})]})]}),i.jsxs(ia,{className:"px-4 pb-4 pt-0 flex gap-2",children:[i.jsxs(Y,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>t(`/themes/${l.slug}`),children:[i.jsx(Bi,{className:"h-4 w-4 mr-1"}),"View"]}
vendor: 19,025 bytes, line 703
703),i.jsxs(Y,{size:"sm",className:"flex-1",disabled:o,onClick:async()=>{t(`/themes/${l.slug}`)},children:[i.jsx(Wn,{className:"h-4 w-4 mr-1"}),"Download"]})]})]},a.id):null})})}const Ui=g.forwardRef(({className:t,...e},r)=>i.jsx("textarea",{className:Se("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...e}));Ui.displayName="Textarea";function Rh(t,[e,r]){return Math.min(r,Math.max(e,t))}function gf(t){const e=g.useRef({value:t,previous:t});return g.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var YJ=[" ","Enter","ArrowUp","ArrowDown"],QJ=[" ","Enter"],ul="Select",[xv,yv,JJ]=cu(ul),[_u,vse]=_r(ul,[JJ,da]),bv=da(),[XJ,pa]=_u(ul),[ZJ,eX]=_u(ul),wO=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:s,onOpenChange:o,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:m,required:f,form:v}=t,p=bv(e),[b,x]=g.useState(null),[y,w]=g.useState(null),[j,_]=g.useState(!1),S=fa(u),[N,P]=rn({prop:n,defaultProp:s??!1,onChange:o,caller:ul}),[C,O]=rn({prop:a,defaultProp:l,onChange:c,caller:ul}),F=g.useRef(null),T=b?v||!!b.closest("form"):!0,[A,k]=g.useState(new Set),$=Array.from(A).map(K=>K.props.value).join(";");return i.jsx(Bg,{...p,children:i.jsxs(XJ,{required:f,scope:e,trigger:b,onTriggerChange:x,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:_,contentId:zn(),value:C,onValueChange:O,open:N,onOpenChange:P,dir:S,triggerPointerDownPosRef:F,disabled:m,children:[i.jsx(xv.Provider,{scope:e,children:i.jsx(ZJ,{scope:t.__scopeSelect,onNativeOptionAdd:g.useCallback(K=>{k(H=>new Set(H).add(K))},[]),onNativeOptionRemove:g.useCallback(K=>{k(H=>{const W=new Set(H);return W.delete(K),W})},[]),children:r})}),T?i.jsxs(GO,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:h,value:C,onChange:K=>O(K.target.value),disabled:m,form:v,children:[C===void 0?i.jsx("option",{value:""}):null,Array.from(A)]},$):null]})})};wO.displayName=ul;var _O="SelectTrigger",jO=g.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...s}=t,o=bv(r),a=pa(_O,r),l=a.disabled||n,c=Ge(e,a.onTriggerChange),u=yv(r),d=g.useRef("touch"),[h,m,f]=VO(p=>{const b=u().filter(w=>!w.disabled),x=b.find(w=>w.value===a.value),y=KO(b,p,x);y!==void 0&&a.onValueChange(y.value)}),v=p=>{l||(a.onOpenChange(!0),f()),p&&(a.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return i.jsx(Yh,{asChild:!0,...o,children:i.jsx(Me.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":qO(a.value)?"":void 0,...s,ref:c,onClick:je(s.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&v(p)}),onPointerDown:je(s.onPointerDown,p=>{d.current=p.pointerType;const b=p.target;b.hasPointerCapture(p.pointerId)&&b.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(v(p),p.preventDefault())}),onKeyDown:je(s.onKeyDown,p=>{const b=h.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(b&&p.key===" ")&&YJ.includes(p.key)&&(v(),p.preventDefault())})})})});jO.displayName=_O;var kO="SelectValue",SO=g.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:a="",...l}=t,c=pa(kO,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,h=Ge(e,c.onValueNodeChange);return Br(()=>{u(d)},[u,d]),i.jsx(Me.span,{...l,ref:h,style:{pointerEvents:"none"},children:qO(c.value)?i.jsx(i.Fragment,{children:a}):o})});SO.displayName=kO;var tX="SelectIcon",NO=g.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...s}=t;return i.jsx(Me.span,{"aria-hidden":!0,...s,ref:e,children:n||"▼"})});NO.displayName=tX;var rX="SelectPortal",CO=t=>i.jsx(uu,{asChild:!0,...t});CO.displayName=rX;var dl="SelectContent",EO=g.forwardRef((t,e)=>{const r=pa(dl,t.__scopeSelect),[n,s]=g.useState();if(Br(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?ml.createPortal(i.jsx(PO,{scope:t.__scopeSelect,children:i.jsx(xv.Slot,{scope:t.__scopeSelect,children:i.jsx("div",{children:t.children})})}),o):null}return i.jsx(TO,{...t,ref:e})});EO.displayName=dl;var Ts=10,[PO,ga]=_u(dl),nX="SelectContentImpl",sX=ea("SelectContent.RemoveScroll"),TO=g.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:v,hideWhenDetached:p,avoidCollisions:b,...x}=t,y=pa(dl,r),[w,j]=g.useState(null),[_,S]=g.useState(null),N=Ge(e,X=>j(X)),[P,C]=g.useState(null),[O,F]=g.useState(null),T=yv(r),[A,k]=g.useState(!1),$=g.useRef(!1);g.useEffect(()=>{if(w)return nv(w)},[w]),rv();const K=g.useCallback(X=>{const[J,...de]=T().map(Z=>Z.ref.current),[le]=de.slice(-1),fe=document.activeElement;for(const Z of X)if(Z===fe||(Z==null||Z.scrollIntoView({block:"nearest"}),Z===J&&_&&(_.scrollTop=0),Z===le&&_&&(_.scrollTop=_.scrollHeight),Z==null||Z.focus(),document.activeElement!==fe))return},[T,_]),H=g.useCallback(()=>K([P,w]),[K,P,w]);g.useEffect(()=>{A&&H()},[A,H]);const{onOpenChange:W,triggerPointerDownPosRef:R}=y;g.useEffect(()=>{if(w){let X={x:0,y:0};const J=le=>{var fe,Z;X={x:Math.abs(Math.round(le.pageX)-(((fe=R.current)==null?void 0:fe.x)??0)),y:Math.abs(Math.round(le.pageY)-(((Z=R.current)==null?void 0:Z.y)??0))}},de=le=>{X.x<=10&&X.y<=10?le.preventDefault():w.contains(le.target)||W(!1),document.removeEventListener("pointermove",J),R.current=null};return R.current!==null&&(document.addEventListener("pointermove",J),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",de,{capture:!0})}}},[w,W,R]),g.useEffect(()=>{const X=()=>W(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[W]);const[G,U]=VO(X=>{const J=T().filter(fe=>!fe.disabled),de=J.find(fe=>fe.ref.current===document.activeElement),le=KO(J,X,de);le&&setTimeout(()=>le.ref.current.focus())}),z=g.useCallback((X,J,de)=>{const le=!$.current&&!de;(y.value!==void 0&&y.value===J||le)&&(C(X),le&&($.current=!0))},[y.value]),oe=g.useCallback(()=>w==null?void 0:w.focus(),[w]),L=g.useCallback((X,J,de)=>{const le=!$.current&&!de;(y.value!==void 0&&y.value===J||le)&&F(X)},[y.value]),q=n==="popper"?Lw:AO,he=q===Lw?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:v,hideWhenDetached:p,avoidCollisions:b}:{};return i.jsx(PO,{scope:r,content:w,viewport:_,onViewportChange:S,itemRefCallback:z,selectedItem:P,onItemLeave:oe,itemTextRefCallback:L,focusSelectedItem:H,selectedItemText:O,position:n,isPositioned:A,searchRef:G,children:i.jsx(nf,{as:sX,allowPinchZoom:!0,children:i.jsx(tf,{asChild:!0,trapped:y.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:je(s,X=>{var J;(J=y.trigger)==null||J.focus({preventScroll:!0}),X.preventDefault()}),children:i.jsx(pl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:i.jsx(q,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:X=>X.preventDefault(),...x,...he,onPlaced:()=>k(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:je(x.onKeyDown,X=>{const J=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!J&&X.key.length===1&&U(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let le=T().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(X.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const fe=X.target,Z=le.indexOf(fe);le=le.slice(Z+1)}setTimeout(()=>K(le)),X.preventDefault()}})})})})})})});TO.displayName=nX;var iX="SelectItemAlignedPosition",AO=g.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...s}=t,o=pa(dl,r),a=ga(dl,r),[l,c]=g.useState(null),[u,d]=g.useState(null),h=Ge(e,N=>d(N)),m=yv(r),f=g.useRef(!1),v=g.useRef(!0),{viewport:p,selectedItem:b,selectedItemText:x,focusSelectedItem:y}=a,w=g.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&u&&p&&b&&x){const N=o.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),C=o.valueNode.getBoundingClientRect(),O=x.getBoundingClientRect();if(o.dir!=="rtl"){const fe=O.left-P.left,Z=C.left-fe,ae=N.left-Z,E=N.width+ae,ne=Math.max(E,P.width),te=window.innerWidth-Ts,D=Rh(Z,[Ts,Math.max(Ts,te-ne)]);l.style.minWidth=E+"px",l.style.left=D+"px"}else{const fe=P.right-O.right,Z=window.innerWidth-C.right-fe,ae=window.innerWidth-N.right-Z,E=N.width+ae,ne=Math.max(E,P.width),te=window.innerWidth-Ts,D=Rh(Z,[Ts,Math.max(Ts,te-ne)]);l.style.minWidth=E+"px",l.style.right=D+"px"}const F=m(),T=window.innerHeight-Ts*2,A=p.scrollHeight,k=window.getComputedStyle(u),$=parseInt(k.borderTopWidth,10),K=parseInt(k.paddingTop,10),H=parseInt(k.borderBottomWidth,10),W=parseInt(k.paddingBottom,10),R=$+K+A+W+H,G=Math.min(b.offsetHeight*5,R),U=window.getComputedStyle(p),z=parseInt(U.paddingTop,10),oe=parseInt(U.paddingBottom,10),L=N.top+N.height/2-Ts,q=T-L,he=b.offsetHeight/2,X=b.offsetTop+he,J=$+K+X,de=R-J;if(J<=L){const fe=F.length>0&&b===F[F.length-1].ref.current;l.style.bottom="0px";const Z=u.clientHeight-p.offsetTop-p.offsetHeight,ae=Math.max(q,he+(fe?oe:0)+Z+H),E=J+ae;l.style.height=E+"px"}else{const fe=F.length>0&&b===F[0].ref.current;l.style.top="0px";const ae=Math.max(L,$+p.offsetTop+(fe?z:0)+he)+de;l.style.height=ae+"px",p.scrollTop=J-L+p.offsetTop}l.style.margin=`${Ts}px 0`,l.style.minHeight=G+"px",l.style.maxHeight=T+"px",n==null||n(),requestAnimationFrame(()=>f.current=!0)}},[m,o.trigger,o.valueNode,l,u,p,b,x,o.dir,n]);Br(()=>w(),[w]);const[j,_]=g.useState();Br(()=>{u&&_(window.getComputedStyle(u).zIndex)},[u]);const S=g.useCallback(N=>{N&&v.current===!0&&(w(),y==null||y(),v.current=!1)},[w,y]);return i.jsx(aX,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:f,onScrollButtonChange:S,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:i.jsx(Me.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});AO.displayName=iX;var oX="SelectPopperPosition",Lw=g.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Ts,...o}=t,a=bv(r);return i.jsx(zg,{...a,...o,ref:e,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Lw.displayName=oX;var[aX,b1]=_u(dl,{}),Bw="SelectViewport",RO=g.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:n,...s}=t,o=ga(Bw,r),a=b1(Bw,r),l=Ge(e,o.onViewportChange),c=g.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),i.jsx(xv.Slot,{scope:r,children:i.jsx(Me.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:je(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=a;if(m!=null&&m.current&&h){const f=Math.abs(c.current-d.scrollTop);if(f>0){const v=window.innerHeight-Ts*2,p=parseFloat(h.style.minHeight),b=parseFloat(h.style.height),x=Math.max(p,b);if(x<v){const y=x+f,w=Math.min(v,y),j=y-w;h.style.height=w+"px",h.style.bottom==="0px"&&(d.scrollTop=j>0?j:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});RO.displayName=Bw;var IO="SelectGroup",[lX,cX]=_u(IO),uX=g.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=zn();return i.jsx(lX,{scope:r,id:s,children:i.jsx(Me.div,{role:"group","aria-labelledby":s,...n,ref:e})})});uX.displayName=IO;var OO="SelectLabel",MO=g.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=cX(OO,r);return i.jsx(Me.div,{id:s.id,...n,ref:e})});MO.displayName=OO;var og="SelectItem",[dX,$O]=_u(og),DO=g.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...a}=t,l=pa(og,r),c=ga(og,r),u=l.value===n,[d,h]=g.useState(o??""),[m,f]=g.useState(!1),v=Ge(e,y=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,y,n,s)}),p=zn(),b=g.useRef("touch"),x=()=>{s||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(dX,{scope:r,value:n,disabled:s,textId:p,isSelected:u,onItemTextChange:g.useCallback(y=>{h(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:i.jsx(xv.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:i.jsx(Me.div,{role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:v,onFocus:je(a.onFocus,()=>f(!0)),onBlur:je(a.onBlur,()=>f(!1)),onClick:je(a.onClick,()=>{b.current!=="mouse"&&x()}),onPointerUp:je(a.onPointerUp,()=>{b.current==="mouse"&&x()}),onPointerDown:je(a.onPointerDown,y=>{b.current=y.pointerType}),onPointerMove:je(a.onPointerMove,y=>{var w;b.current=y.pointerType,s?(w=c.onItemLeave)==null||w.call(c):b.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:je(a.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:je(a.onKeyDown,y=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&y.key===" "||(QJ.includes(y.key)&&x(),y.key===" "&&y.preventDefault())})})})})});DO.displayName=og;var bd="SelectItemText",FO=g.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,...o}=t,a=pa(bd,r),l=ga(bd,r),c=$O(bd,r),u=eX(bd,r),[d,h]=g.useState(null),m=Ge(e,x=>h(x),c.onItemTextChange,x=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,x,c.value,c.disabled)}),f=d==null?void 0:d.textContent,v=g.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:p,onNativeOptionRemove:b}=u;return Br(()=>(p(v),()=>b(v)),[p,b,v]),i.jsxs(i.Fragment,{children:[i.jsx(Me.span,{id:c.textId,...o,ref:m}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?ml.createPortal(o.children,a.valueNode):null]})});FO.displayName=bd;var LO="SelectItemIndicator",BO=g.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return $O(LO,r).isSelected?i.jsx(Me.span,{"aria-hidden":!0,...n,ref:e}):null});BO.displayName=LO;var zw="SelectScrollUpButton",zO=g.forwardRef((t,e)=>{const r=ga(zw,t.__scopeSelect),n=b1(zw,t.__scopeSelect),[s,o]=g.useState(!1),a=Ge(e,n.onScrollButtonChange);return Br(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?i.jsx(WO,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});zO.displayName=zw;var Uw="SelectScrollDownButton",UO=g.forwardRef((t,e)=>{const r=ga(Uw,t.__scopeSelect),n=b1(Uw,t.__scopeSelect),[s,o]=g.useState(!1),a=Ge(e,n.onScrollButtonChange);return Br(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;o(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?i.jsx(WO,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});UO.displayName=Uw;var WO=g.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=t,o=ga("SelectScrollButton",r),a=g.useRef(null),l=yv(r),c=g.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),Br(()=>{var d;const u=l().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),i.jsx(Me.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:je(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:je(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:je(s.onPointerLeave,()=>{c()})})}),hX="SelectSeparator",HO=g.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return i.jsx(Me.div,{"aria-hidden":!0,...n,ref:e})});HO.displayName=hX;var Ww="SelectArrow",fX=g.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=bv(r),o=pa(Ww,r),a=ga(Ww,r);return o.open&&a.position==="popper"?i.jsx(Ug,{...s,...n,ref:e}):null});fX.displayName=Ww;var mX="SelectBubbleInput",GO=g.forwardRef(({__scopeSelect:t,value:e,...r},n)=>{const s=g.useRef(null),o=Ge(n,s),a=gf(e);return g.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&d){const h=new Event("change",{bubbles:!0});d.call(l,e),l.dispatchEvent(h)}},[a,e]),i.jsx(Me.select,{...r,style:{...dP,...r.style},ref:o,defaultValue:e})});GO.displayName=mX;function qO(t){return t===""||t===void 0}function VO(t){const e=yr(t),r=g.useRef(""),n=g.useRef(0),s=g.useCallback(a=>{const l=r.current+a;e(l),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),o=g.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function KO(t,e,r){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=r?t.indexOf(r):-1;let a=pX(t,Math.max(o,0));s.length===1&&(a=a.filter(u=>u!==r));const c=a.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function pX(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var gX=wO,YO=jO,vX=SO,xX=NO,yX=CO,QO=EO,bX=RO,JO=MO,XO=DO,wX=FO,_X=BO,ZO=zO,e5=UO,t5=HO;const Vs=gX,Ks=vX,bs=g.forwardRef(({className:t,children:e,...r},n)=>i.jsxs(YO,{ref:n,className:Se("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
703ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[e,i.jsx(xX,{asChild:!0,children:i.jsx(Hs,{className:"h-4 w-4 opacity-50"})})]}));bs.displayName=YO.displayName;const r5=g.forwardRef(({className:t,...e},r)=>i.jsx(ZO,{ref:r,className:Se("flex cursor-default items-center justify-center py-1",t),...e,children:i.jsx(FP,{className:"h-4 w-4"})}));r5.displayName=ZO.displayName;const n5=g.forwardRef(({className:t,...e},r)=>i.jsx(e5,{ref:r,className:Se("flex cursor-default items-center justify-center py-1",t),...e,children:i.jsx(Hs,{className:"h-4 w-4"})}));n5.displayName=e5.displayName;const ws=g.forwardRef(({className:t,children:e,position:r="popper",...n},s)=>i.jsx(yX,{children:i.jsxs(QO,{ref:s,className:Se("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[i.jsx(r5,{}),i.jsx(bX,{className:Se("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),i.jsx(n5,{})]})}));ws.displayName=QO.displayName;const jX=g.forwardRef(({className:t,...e},r)=>i.jsx(JO,{ref:r,className:Se("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));jX.displayName=JO.displayName;const Lr=g.forwardRef(({className:t,children:e,...r},n)=>i.jsxs(XO,{ref:n,className:Se("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...r,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(_X,{children:i.jsx(fr,{className:"h-4 w-4"})})}),i.jsx(wX,{children:e})]}));Lr.displayName=XO.displayName;const kX=g.forwardRef(({className:t,...e},r)=>i.jsx(t5,{ref:r,className:Se("-mx-1 my-1 h-px bg-muted",t),...e}));kX.displayName=t5.displayName;var wv="Checkbox",[SX,xse]=_r(wv),[NX,w1]=SX(wv);function CX(t){const{__scopeCheckbox:e,checked:r,children:n,defaultChecked:s,disabled:o,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=t,[m,f]=rn({prop:r,defaultProp:s??!1,onChange:c,caller:wv}),[v,p]=g.useState(null),[b,x]=g.useState(null),y=g.useRef(!1),w=v?!!a||!!v.closest("form"):!0,j={checked:m,disabled:o,setChecked:f,control:v,setControl:p,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:y,required:u,defaultChecked:Jo(s)?!1:s,isFormControl:w,bubbleInput:b,setBubbleInput:x};return i.jsx(NX,{scope:e,...j,children:EX(h)?h(j):n})}var s5="CheckboxTrigger",i5=g.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:r,...n},s)=>{const{control:o,value:a,disabled:l,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:f,bubbleInput:v}=w1(s5,t),p=Ge(s,d),b=g.useRef(c);return g.useEffect(()=>{const x=o==null?void 0:o.form;if(x){const y=()=>h(b.current);return x.addEventListener("reset",y),()=>x.removeEventListener("reset",y)}},[o,h]),i.jsx(Me.button,{type:"button",role:"checkbox","aria-checked":Jo(c)?"mixed":c,"aria-required":u,"data-state":u5(c),"data-disabled":l?"":void 0,disabled:l,value:a,...n,ref:p,onKeyDown:je(e,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:je(r,x=>{h(y=>Jo(y)?!0:!y),v&&f&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});i5.displayName=s5;var _1=g.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:o,required:a,disabled:l,value:c,onCheckedChange:u,form:d,...h}=t;return i.jsx(CX,{__scopeCheckbox:r,checked:s,defaultChecked:o,disabled:l,required:a,onCheckedChange:u,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>i.jsxs(i.Fragment,{children:[i.jsx(i5,{...h,ref:e,__scopeCheckbox:r}),m&&i.jsx(c5,{__scopeCheckbox:r})]})})});_1.displayName=wv;var o5="CheckboxIndicator",a5=g.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...s}=t,o=w1(o5,r);return i.jsx(Tr,{present:n||Jo(o.checked)||o.checked===!0,children:i.jsx(Me.span,{"data-state":u5(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...t.style}})})});a5.displayName=o5;var l5="CheckboxBubbleInput",c5=g.forwardRef(({__scopeCheckbox:t,...e},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:a,required:l,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:f}=w1(l5,t),v=Ge(r,f),p=gf(o),b=Kh(n);g.useEffect(()=>{const y=m;if(!y)return;const w=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(w,"checked").set,S=!s.current;if(p!==o&&_){const N=new Event("click",{bubbles:S});y.indeterminate=Jo(o),_.call(y,Jo(o)?!1:o),y.dispatchEvent(N)}},[m,p,o,s]);const x=g.useRef(Jo(o)?!1:o);return i.jsx(Me.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??x.current,required:l,disabled:c,name:u,value:d,form:h,...e,tabIndex:-1,ref:v,style:{...e.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});c5.displayName=l5;function EX(t){return typeof t=="function"}function Jo(t){return t==="indeterminate"}function u5(t){return Jo(t)?"indeterminate":t?"checked":"unchecked"}const Kn=g.forwardRef(({className:t,...e},r)=>i.jsx(_1,{ref:r,className:Se("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:i.jsx(a5,{className:Se("flex items-center justify-center text-current"),children:i.jsx(fr,{className:"h-4 w-4"})})}));Kn.displayName=_1.displayName;function PX(t,e){return g.useReducer((r,n)=>e[r][n]??r,t)}var j1="ScrollArea",[d5,yse]=_r(j1),[TX,_s]=d5(j1),h5=g.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...a}=t,[l,c]=g.useState(null),[u,d]=g.useState(null),[h,m]=g.useState(null),[f,v]=g.useState(null),[p,b]=g.useState(null),[x,y]=g.useState(0),[w,j]=g.useState(0),[_,S]=g.useState(!1),[N,P]=g.useState(!1),C=Ge(e,F=>c(F)),O=fa(s);return i.jsx(TX,{scope:r,type:n,dir:O,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:d,content:h,onContentChange:m,scrollbarX:f,onScrollbarXChange:v,scrollbarXEnabled:_,onScrollbarXEnabledChange:S,scrollbarY:p,onScrollbarYChange:b,scrollbarYEnabled:N,onScrollbarYEnabledChange:P,onCornerWidthChange:y,onCornerHeight
vendor: 9,193 bytes, line 703
703Change:j,children:i.jsx(Me.div,{dir:O,...a,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});h5.displayName=j1;var f5="ScrollAreaViewport",m5=g.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=t,a=_s(f5,r),l=g.useRef(null),c=Ge(e,l,a.onViewportChange);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),i.jsx(Me.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:i.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});m5.displayName=f5;var bi="ScrollAreaScrollbar",k1=g.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=_s(bi,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:a}=s,l=t.orientation==="horizontal";return g.useEffect(()=>(l?o(!0):a(!0),()=>{l?o(!1):a(!1)}),[l,o,a]),s.type==="hover"?i.jsx(AX,{...n,ref:e,forceMount:r}):s.type==="scroll"?i.jsx(RX,{...n,ref:e,forceMount:r}):s.type==="auto"?i.jsx(p5,{...n,ref:e,forceMount:r}):s.type==="always"?i.jsx(S1,{...n,ref:e}):null});k1.displayName=bi;var AX=g.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=_s(bi,t.__scopeScrollArea),[o,a]=g.useState(!1);return g.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),a(!0)},d=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),i.jsx(Tr,{present:r||o,children:i.jsx(p5,{"data-state":o?"visible":"hidden",...n,ref:e})})}),RX=g.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=_s(bi,t.__scopeScrollArea),o=t.orientation==="horizontal",a=jv(()=>c("SCROLL_END"),100),[l,c]=PX("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),g.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let h=u[d];const m=()=>{const f=u[d];h!==f&&(c("SCROLL"),a()),h=f};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,o,c,a]),i.jsx(Tr,{present:r||l!=="hidden",children:i.jsx(S1,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:je(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:je(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),p5=g.forwardRef((t,e)=>{const r=_s(bi,t.__scopeScrollArea),{forceMount:n,...s}=t,[o,a]=g.useState(!1),l=t.orientation==="horizontal",c=jv(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;a(l?u:d)}},10);return ru(r.viewport,c),ru(r.content,c),i.jsx(Tr,{present:n||o,children:i.jsx(S1,{"data-state":o?"visible":"hidden",...s,ref:e})})}),S1=g.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,s=_s(bi,t.__scopeScrollArea),o=g.useRef(null),a=g.useRef(0),[l,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=b5(l.viewport,l.content),d={...n,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:m=>a.current=m};function h(m,f){return FX(m,a.current,l,f)}return r==="horizontal"?i.jsx(IX,{...d,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollLeft,f=qN(m,l,s.dir);o.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=h(m,s.dir))}}):r==="vertical"?i.jsx(OX,{...d,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollTop,f=qN(m,l);o.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=h(m))}}):null}),IX=g.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...s}=t,o=_s(bi,t.__scopeScrollArea),[a,l]=g.useState(),c=g.useRef(null),u=Ge(e,c,o.onScrollbarXChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),i.jsx(v5,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":_v(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(o.viewport){const m=o.viewport.scrollLeft+d.deltaX;t.onWheelScroll(m),_5(m,h)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:lg(a.paddingLeft),paddingEnd:lg(a.paddingRight)}})}})}),OX=g.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...s}=t,o=_s(bi,t.__scopeScrollArea),[a,l]=g.useState(),c=g.useRef(null),u=Ge(e,c,o.onScrollbarYChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),i.jsx(v5,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":_v(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(o.viewport){const m=o.viewport.scrollTop+d.deltaY;t.onWheelScroll(m),_5(m,h)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:lg(a.paddingTop),paddingEnd:lg(a.paddingBottom)}})}})}),[MX,g5]=d5(bi),v5=g.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:h,...m}=t,f=_s(bi,r),[v,p]=g.useState(null),b=Ge(e,C=>p(C)),x=g.useRef(null),y=g.useRef(""),w=f.viewport,j=n.content-n.viewport,_=yr(d),S=yr(c),N=jv(h,10);function P(C){if(x.current){const O=C.clientX-x.current.left,F=C.clientY-x.current.top;u({x:O,y:F})}}return g.useEffect(()=>{const C=O=>{const F=O.target;(v==null?void 0:v.contains(F))&&_(O,j)};return document.addEventListener("wheel",C,{passive:!1}),()=>document.removeEventListener("wheel",C,{passive:!1})},[w,v,j,_]),g.useEffect(S,[n,S]),ru(v,N),ru(f.content,N),i.jsx(MX,{scope:r,scrollbar:v,hasThumb:s,onThumbChange:yr(o),onThumbPointerUp:yr(a),onThumbPositionChange:S,onThumbPointerDown:yr(l),children:i.jsx(Me.div,{...m,ref:b,style:{position:"absolute",...m.style},onPointerDown:je(t.onPointerDown,C=>{C.button===0&&(C.target.setPointerCapture(C.pointerId),x.current=v.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),P(C))}),onPointerMove:je(t.onPointerMove,P),onPointerUp:je(t.onPointerUp,C=>{const O=C.target;O.hasPointerCapture(C.pointerId)&&O.releasePointerCapture(C.pointerId),document.body.style.webkitUserSelect=y.current,f.viewport&&(f.viewport.style.scrollBehavior=""),x.current=null})})})}),ag="ScrollAreaThumb",x5=g.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=g5(ag,t.__scopeScrollArea);return i.jsx(Tr,{present:r||s.hasThumb,children:i.jsx($X,{ref:e,...n})})}),$X=g.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...s}=t,o=_s(ag,r),a=g5(ag,r),{onThumbPositionChange:l}=a,c=Ge(e,h=>a.onThumbChange(h)),u=g.useRef(void 0),d=jv(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const h=o.viewport;if(h){const m=()=>{if(d(),!u.current){const f=LX(h,l);u.current=f,l()}};return l(),h.addEventListener("scroll",m),()=>h.removeEventListener("scroll",m)}},[o.viewport,d,l]),i.jsx(Me.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:je(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),v=h.clientX-f.left,p=h.clientY-f.top;a.onThumbPointerDown({x:v,y:p})}),onPointerUp:je(t.onPointerUp,a.onThumbPointerUp)})});x5.displayName=ag;var N1="ScrollAreaCorner",y5=g.forwardRef((t,e)=>{const r=_s(N1,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?i.jsx(DX,{...t,ref:e}):null});y5.displayName=N1;var DX=g.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,s=_s(N1,r),[o,a]=g.useState(0),[l,c]=g.useState(0),u=!!(o&&l);return ru(s.scrollbarX,()=>{var h;const d=((h=s.scrollbarX)==null?void 0:h.offsetHeight)||0;
703s.onCornerHeightChange(d),c(d)}),ru(s.scrollbarY,()=>{var h;const d=((h=s.scrollbarY)==null?void 0:h.offsetWidth)||0;s.onCornerWidthChange(d),a(d)}),u?i.jsx(Me.div,{...n,ref:e,style:{width:o,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function lg(t){return t?parseInt(t,10):0}function b5(t,e){const r=t/e;return isNaN(r)?0:r}function _v(t){const e=b5(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function FX(t,e,r,n="ltr"){const s=_v(r),o=s/2,a=e||o,l=s-a,c=r.scrollbar.paddingStart+a,u=r.scrollbar.size-r.scrollbar.paddingEnd-l,d=r.content-r.viewport,h=n==="ltr"?[0,d]:[d*-1,0];return w5([c,u],h)(t)}function qN(t,e,r="ltr"){const n=_v(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-s,a=e.content-e.viewport,l=o-n,c=r==="ltr"?[0,a]:[a*-1,0],u=Rh(t,c);return w5([0,a],[0,l])(u)}function w5(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function _5(t,e){return t>0&&t<e}var LX=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return function s(){const o={left:t.scrollLeft,top:t.scrollTop},a=r.left!==o.left,l=r.top!==o.top;(a||l)&&e(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function jv(t,e){const r=yr(t),n=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),g.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function ru(t,e){const r=yr(e);Br(()=>{let n=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(t),()=>{window.cancelAnimationFrame(n),s.unobserve(t)}}},[t,r])}var j5=h5,BX=m5,zX=y5;const Qi=g.forwardRef(({className:t,children:e,viewportRef:r,...n},s)=>i.jsxs(j5,{ref:s,className:Se("relative overflow-hidden",t),...n,children:[i.jsx(BX,{ref:r,className:"h-full w-full rounded-[inherit] [&>div]:!block [&>div]:!min-w-0",children:e}),i.jsx(k5,{}),i.jsx(zX,{})]}));Qi.displayName=j5.displayName;const k5=g.forwardRef(({className:t,orientation:e="vertical",...r},n)=>i.jsx(k1,{ref:n,orientation:e,className:Se("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:i.jsx(x5,{className:"relative flex-1 rounded-full bg-border"})}));k5.displayName=k1.displayName;const UX=["WordPress developer","Freelancer","Agency owner","In-house marketing team","Business owner building my own site","Hobbyist / blogger"],WX=["Elementor","Divi","Gutenberg only","Premium theme (ThemeForest)","Custom coded","AI builder (ZipWP, 10Web, etc.)"],HX=["< 1 year","1–3 years","3–7 years","7+ years"],GX=["Definitely","Probably","Not sure","Probably not"];function VN({label:t,options:e,selected:r,onToggle:n,otherValue:s,onOtherChange:o,otherChecked:a,onOtherToggle:l}){const[c,u]=g.useState(!1),d=r.length+(a?1:0);return i.jsxs(ol,{open:c,onOpenChange:u,children:[i.jsx(al,{asChild:!0,children:i.jsxs(Y,{variant:"outline",className:"w-full justify-between font-normal h-auto min-h-10 py-2",children:[d===0?i.jsx("span",{className:"text-muted-foreground",children:"Select options..."}):i.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(h=>i.jsx(rt,{variant:"secondary",className:"text-xs",children:h},h)),a&&s.trim()&&i.jsxs(rt,{variant:"secondary",className:"text-xs",children:["Other: ",s]}),a&&!s.trim()&&i.jsx(rt,{variant:"secondary",className:"text-xs",children:"Other"})]}),i.jsx(Hs,{className:"h-4 w-4 shrink-0 opacity-50 ml-2"})]})}),i.jsx(sa,{className:"w-[var(--radix-popover-trigger-width)] p-2",align:"start",children:i.jsxs("div",{className:"space-y-1",children:[e.map(h=>i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer px-2 py-1.5 rounded hover:bg-muted",children:[i.jsx(Kn,{checked:r.includes(h),onCheckedChange:()=>n(h)}),i.jsx("span",{className:"text-sm",children:h})]},h)),i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer px-2 py-1.5 rounded hover:bg-muted",children:[i.jsx(Kn,{checked:a,onCheckedChange:h=>l(!!h)}),i.jsx("span",{className:"text-sm",children:"Other"})]}),a&&i.jsx(Nt,{placeholder:"Please specify...",value:s,onChange:h=>o(h.target.value),className:"mt-1",onClick:h=>h.stopPropagation()})]})})]})}function S5({open:t,onClose:e}){const{refreshSubscription:r}=nn(),[n,s]=g.useState(!1),[o,a]=g.useState(!1),[l,c]=g.useState(!1),[u,d]=g.useState([]),[h,m]=g.useState(""),[f,v]=g.useState(!1),[p,b]=g.useState(""),[x,y]=g.useState([]),[w,j]=g.useState(""),[_,S]=g.useState(!1),[N,P]=g.useState(""),[C,O]=g.useState(""),[F,T]=g.useState(""),[A,k]=g.useState(""),[$,K]=g.useState({}),[H,W]=g.useState(null),R=g.useRef({}),G=g.useRef({}),U=g.useCallback(async(J,de)=>{const{data:le}=await re.functions.invoke("award-bonus-credits",{body:{bonusType:J}});le!=null&&le.success?(await r(),K(fe=>({...fe,[J]:!0})),Q.success(`Thank you for your ${de} review! 5 credits have been added.`)):le!=null&&le.already_claimed&&(K(fe=>({...fe,[J]:!0})),Q.info(`You've already received credits for a ${de} review.`)),W(null)},[r]),z=(J,de,le)=>{if($[J]){Q.info(`You've already received credits for a ${le}
703 review. Thank you!`);return}W(J),window.open(de,"_blank");const fe=Date.now(),Z=()=>{window.removeEventListener("mousemove",ae),window.removeEventListener("keydown",ae),window.removeEventListener("focus",ae);const E=R.current[J];E&&(clearTimeout(E),R.current[J]=null)},ae=async()=>{Date.now()-fe<6e4?(Z(),W(null)):(Z(),await U(J,le))};window.addEventListener("mousemove",ae,{once:!0}),window.addEventListener("keydown",ae,{once:!0}),window.addEventListener("focus",ae,{once:!0}),G.current[J]=Z,R.current[J]=setTimeout(async()=>{Z(),await U(J,le)},10*60*1e3)};g.useEffect(()=>(t||(Object.values(G.current).forEach(J=>J==null?void 0:J()),G.current={},W(null)),()=>{Object.values(G.current).forEach(J=>J==null?void 0:J()),G.current={}}),[t]),g.useEffect(()=>{o&&(async()=>{const{data:{user:J}}=await re.auth.getUser();if(!J)return;const{data:de}=await re.from("bonus_credit_claims").select("bonus_type").eq("user_id",J.id);if(de){const le={};de.forEach(fe=>{le[fe.bonus_type]=!0}),K(le)}})()},[o]);const oe=(J,de,le)=>{le(de.includes(J)?de.filter(fe=>fe!==J):[...de,J])},L=()=>{const J=u.length>0||f&&h.trim().length>0,de=p.length>0,le=x.length>0||_&&w.trim().length>0,fe=N.trim().length>0,Z=C.trim().length>0,ae=F.length>0,E=A.trim().length>0;return J&&de&&le&&fe&&Z&&ae&&E},q=async()=>{var J;if(!L()){Q.error("Please answer all questions before submitting.");return}s(!0);try{const de=[...u];f&&h.trim()&&de.push(`Other: ${h.trim()}`);const le=[...x];_&&w.trim()&&le.push(`Other: ${w.trim()}`);const{data:fe,error:Z}=await re.functions.invoke("submit-export-survey",{body:{describe_yourself:de,wp_experience:p,build_method:le,missing_features:N,biggest_benefit:C,likelihood:F,describe_to_friend:A}});if(Z){const ae=((J=Z==null?void 0:Z.context)==null?void 0:J.status)||(Z==null?void 0:Z.status),E=(Z==null?void 0:Z.message)||"";if(ae===409||E.includes("409")||E.includes("already submitted")){Q.info("You have already completed this survey."),e(),s(!1);return}throw Z}(fe==null?void 0:fe.credits_awarded)===0?(a(!0),c(!0)):a(!0)}catch(de){console.error("Survey submit error:",de),Q.error("Failed to submit survey. Please try again.")}s(!1)},he=async()=>{o&&!l&&(c(!0),Q.success("Thank you! 5 credits have been added to your account 🎉"),await r()),e()},X=[{type:"trustpilot_review",label:"TrustPilot",url:"https://www.trustpilot.com/review/pressmegpt.com"},{type:"g2_review",label:"G2",url:"https://www.g2.com/products/pressmegpt/reviews"},{type:"product_hunt_review",label:"Product Hunt",url:"https://www.producthunt.com/products/pressmegpt-com/reviews"}];return g.useEffect(()=>{t&&(a(!1),c(!1),d([]),m(""),v(!1),b(""),y([]),j(""),S(!1),P(""),O(""),T(""),k(""))},[t]),i.jsx(Xt,{open:t,onOpenChange:J=>{J||he()},children:i.jsx(Qt,{className:"w-[calc(100vw-2rem)] max-w-lg max-h-[90vh] p-0 overflow-y-auto",children:i.jsx(Qi,{className:"max-h-[85vh] p-6",children:o?i.jsxs(i.Fragment,{children:[i.jsxs(gn,{className:"mb-6",children:[i.jsx(wr,{className:"text-xl text-center",children:"⭐ Thank you for your feedback!"}),i.jsx(jn,{className:"text-center text-base mt-2",children:"Your 5 credits will be added to your account."})]}),i.jsxs("div",{className:"flex flex-col items-center gap-4 py-4",children:[i.jsxs("p",{className:"text-center text-muted-foreground text-sm max-w-sm",children:["Earn up to ",i.jsx("strong",{children:"15 credits"})," by sharing your experience on any of these platforms — 5 credits per platform are added automatically once you leave a review."]}),i.jsx("div",{className:"flex flex-col gap-2 w-full",children:X.map(({type:J,label:de,url:le})=>{const fe=!!$[J],Z=H===J;return i.jsx(Y,{size:"lg",variant:fe?"outline":"default",className:"w-full text-base",disabled:Z,onClick:()=>z(J,le,de),children:Z?i.jsxs(i.Fragment,{children:[i.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}),"Waiting for your review…"]}):fe?`${de} — Credits Claimed`:`Review on ${de} (+5 Credits)`},le)})}),i.jsx(Y,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:he,children:"Skip for now"})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs(gn,{className:"mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2 justify-center sm:justify-start",children:[i.jsx(rh,{className:"h-5 w-5 text-primary"}),i.jsx(wr,{className:"text-lg",children:"Get 5 Free Instant Credits for your Feedback"})]}),i.jsx(jn,{children:"Answer a few quick questions and we'll add 5 credits to your account instantly!"})]}),i.jsxs("div",{className:"space-y-5",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Xe,{className:"font-medium",children:"1. How would you describe yourself?"}),i.jsx(VN,{label:"Describe yourself",options:UX,selected:u,onToggle:J=>oe(J,u,d),otherValue:h,onOtherChange:m,otherChecked:f,onOtherToggle:v})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Xe,{className:"font-medium",children:"2. How long have you used WordPress?"}),i.jsxs(Vs,{value:p,onValueChange:b,children:[i.jsx(bs,{children:i.jsx(Ks,{placeholder:"Select experience..."})}),i.jsx(ws,{children:HX.map(J=>i.jsx(Lr,{value:J,children:J},J))})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Xe,{className:"font-medium",children:"3. How did you usually build WP sites?"}),i.jsx(VN,{label:"Build method",options:WX,selected:x,onToggle:J=>oe(J,x,y),otherValue:w,onOtherChange:j,otherChecked:_,onOtherToggle:S})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Xe,{className:"font-medium",children:"4. What should be improved or added?"}),i.jsx(Ui,{placeholder:"Your thoughts...",value:N,onChange:J=>P(J.target.value),rows:2})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Xe,{className:"font-medium",children:"5. Biggest benef
703it you experienced?"}),i.jsx(Ui,{placeholder:"Your thoughts...",value:C,onChange:J=>O(J.target.value),rows:2})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Xe,{className:"font-medium",children:"6. How likely are you to use this for a real project?"}),i.jsxs(Vs,{value:F,onValueChange:T,children:[i.jsx(bs,{children:i.jsx(Ks,{placeholder:"Select..."})}),i.jsx(ws,{children:GX.map(J=>i.jsx(Lr,{value:J,children:J},J))})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Xe,{className:"font-medium",children:"7. How would you describe PressMeGPT to a friend?"}),i.jsx(Ui,{placeholder:"In one sentence...",value:A,onChange:J=>k(J.target.value),rows:2})]}),i.jsx(Y,{onClick:q,disabled:n||!L(),className:"w-full",children:n?i.jsxs(i.Fragment,{children:[i.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}),"Submitting..."]}):"Submit & Get 5 Free Credits"})]})]})})})})}function qX(){const{user:t,profile:e}=$t(),{refreshSubscription:r}=nn(),[n,s]=g.useState(null),[o,a]=g.useState({total:0,pending:0,converted:0,creditsEarned:0}),[l,c]=g.useState(!0),[u,d]=g.useState(!1),[h,m]=g.useState(!1),[f,v]=g.useState(!1),[p,b]=g.useState({}),[x,y]=g.useState(null),w=g.useRef({}),j=g.useRef({});g.useEffect(()=>(t&&(S(),_()),()=>{Object.values(w.current).forEach(A=>A&&clearTimeout(A)),Object.values(j.current).forEach(A=>A&&A())}),[t]);const _=async()=>{if(!t)return;const{data:A}=await re.from("bonus_credit_claims").select("bonus_type").eq("user_id",t.id);if(A){const $={};A.forEach(K=>{$[K.bonus_type]=!0}),b($)}const{data:k}=await re.from("export_survey_responses").select("id").eq("user_id",t.id).limit(1);k&&k.length>0&&v(!0)},S=async()=>{if(!t)return;c(!0);const{data:A}=await re.from("profiles").select("referral_code").eq("user_id",t.id).single();A!=null&&A.referral_code&&s(A.referral_code);const{data:k}=await re.from("referrals").select("status, credits_awarded").eq("referrer_user_id",t.id);if(k){const $=k.filter(W=>W.status==="pending").length,K=k.filter(W=>W.status==="converted").length,H=k.reduce((W,R)=>W+(R.credits_awarded||0),0);a({total:k.length,pending:$,converted:K,creditsEarned:H})}c(!1)},N=n?`${window.location.origin}/?ref=${n}`:"",P=async()=>{if(N)try{await navigator.clipboard.writeText(N),d(!0),Q.success("Referral link copied!"),setTimeout(()=>d(!1),2e3)}catch{Q.error("Failed to copy link")}},C=async A=>{if(!N)return;const k="I've been using PressMeGPT to create AI-powered WordPress themes. Check it out!";let $="";switch(A){case"twitter":$=`https://twitter.com/intent/tweet?text=${encodeURIComponent(k)}&url=${encodeURIComponent(N)}`;break;case"linkedin":$=`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(N)}`;break;case"reddit":$=`https://www.reddit.com/submit?url=${encodeURIComponent(N)}&title=${encodeURIComponent("AI-Powered WordPress Theme Generator - PressMeGPT")}`;break}window.open($,"_blank","width=600,height=400")},O=()=>{m(!1),_(),r()},F=g.useCallback(async(A,k)=>{const{data:$}=await re.functions.invoke("award-bonus-credits",{body:{bonusType:A}});$!=null&&$.success?(await r(),b(K=>({...K,[A]:!0})),Q.success(`Thank you for your ${k} review! 5 credits have been added.`)):$!=null&&$.already_claimed&&(b(K=>({...K,[A]:!0})),Q.info(`You've already received credits for a ${k} review.`)),y(null)},[r]),T=(A,k,$)=>{if(p[A]){Q.info(`You've already received credits for a ${$} review. Thank you!`);return}y(A),window.open(k,"_blank");const K=Date.now(),H=async()=>{Date.now()-K<6e4?(W(),y(null)):(W(),await F(A,$))};window.addEventListener("mousemove",H,{once:!0}),window.addEventListener("keydown",H,{once:!0}),window.addEventListener("focus",H,{once:!0});const W=()=>{window.removeEventListener("mousemove",H),window.removeEventListener("keydown",H),window.removeEventListener("focus",H);const R=w.current[A];R&&(clearTimeout(R),w.current[A]=null)};j.current[A]=W,w.current[A]=setTimeout(async()=>{W(),await F(A,$)},10*60*1e3)};return l?i.jsx(dt,{children:i.jsx(ct,{className:"flex items-center justify-center py-12",children:i.jsx(et,{className:"h-6 w-6 animate-spin text-primary"})})}):i.jsxs(i.Fragment,{children:[i.jsxs(dt,{className:"mb-6",children:[i.jsxs(ir,{children:[i.jsxs(Dr,{className:"flex items-center gap-2",children:[i.jsx(ys,{className:"h-5 w-5 text-primary"}
vendor: 8,672 bytes, line 703
703),"Earn Bonus Credits"]}),i.jsx(Gr,{children:"Get extra credits by leaving feedback or reviewing us on TrustPilot."})]}),i.jsx(ct,{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsx(dt,{className:"border-border/50",children:i.jsxs(ct,{className:"pt-6 text-center space-y-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center mx-auto",children:i.jsx(Ab,{className:"h-5 w-5 text-primary"})}),i.jsx("h4",{className:"font-medium text-sm",children:"Leave Feedback"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Answer a few questions and earn 5 credits"}),i.jsx(Y,{onClick:()=>m(!0),variant:f?"outline":"default",size:"sm",className:"w-full",children:f?"Credits Claimed":"Leave Feedback"})]})}),[{type:"trustpilot_review",label:"TrustPilot",url:"https://www.trustpilot.com/review/pressmegpt.com",Icon:ys},{type:"g2_review",label:"G2",url:"https://www.g2.com/products/pressmegpt/reviews",Icon:bL},{type:"product_hunt_review",label:"Product Hunt",url:"https://www.producthunt.com/products/pressmegpt-com/reviews",Icon:qh}].map(({type:A,label:k,url:$,Icon:K})=>{const H=!!p[A],W=x===A;return i.jsx(dt,{className:"border-border/50",children:i.jsxs(ct,{className:"pt-6 text-center space-y-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center mx-auto",children:i.jsx(K,{className:"h-5 w-5 text-primary"})}),i.jsxs("h4",{className:"font-medium text-sm",children:[k," Review"]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave a review and earn 5 credits"}),i.jsx(Y,{onClick:()=>T(A,$,k),variant:H?"outline":"default",size:"sm",className:"w-full",disabled:W,children:W?i.jsxs(i.Fragment,{children:[i.jsx(et,{className:"h-3.5 w-3.5 animate-spin mr-1"})," Waiting..."]}):H?"Credits Claimed":`Review on ${k}`})]})},A)})]})})]}),i.jsxs(dt,{children:[i.jsxs(ir,{children:[i.jsxs(Dr,{className:"flex items-center gap-2",children:[i.jsx(Bi,{className:"h-5 w-5 text-primary"}),"Affiliate Program"]}),i.jsx(Gr,{children:"Earn up to 50% of every purchase for the first 12 months with our generous affiliate program."})]}),i.jsx(ct,{children:i.jsx(Y,{onClick:()=>window.open("https://pressmegpt.endorsely.com/","_blank"),className:"w-full",children:"Apply now"})})]}),i.jsx("div",{className:"h-6"}),i.jsxs(dt,{children:[i.jsxs(ir,{children:[i.jsxs(Dr,{className:"flex items-center gap-2",children:[i.jsx(rh,{className:"h-5 w-5 text-primary"}),"Refer Friends"]}),i.jsx(Gr,{children:"Share your referral link and earn 5 credits for each friend who creates their first theme!"})]}),i.jsxs(ct,{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Your Referral Link"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Nt,{value:N,readOnly:!0,className:"bg-muted/50 font-mono text-sm"}),i.jsx(Y,{variant:"outline",size:"icon",onClick:P,className:"shrink-0",children:u?i.jsx(fr,{className:"h-4 w-4 text-primary"}):i.jsx(r_,{className:"h-4 w-4"})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-sm font-medium",children:"Share on Social Media"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(Y,{variant:"outline",size:"sm",onClick:()=>C("twitter"),className:"flex-1",children:[i.jsx(jx,{className:"h-4 w-4 mr-2"})," Twitter"]}),i.jsxs(Y,{variant:"outline",size:"sm",onClick:()=>C("linkedin"),className:"flex-1",children:[i.jsx(jx,{className:"h-4 w-4 mr-2"})," LinkedIn"]}),i.jsxs(Y,{variant:"outline",size:"sm",onClick:()=>C("reddit"),className:"flex-1",children:[i.jsx(jx,{className:"h-4 w-4 mr-2"})," Reddit"]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 border-t border-border",children:[i.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[i.jsxs("div",{className:"flex items-center justify-center gap-1 text-2xl font-bold text-primary",children:[i.jsx(KP,{className:"h-5 w-5"})," ",o.total]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Total Referrals"})]}),i.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[i.jsxs("div",{className:"flex items-center justify-center gap-1 text-2xl font-bold text-primary",children:[i.jsx(rh,{className:"h-5 w-5"})," ",o.creditsEarned]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Credits Earned"})]})]}),o.pending>0&&i.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-amber-500/10 p-3 rounded-lg",children:[i.jsxs(rt,{variant:"secondary",className:"bg-amber-500/20 text-amber-600",children:[o.pending," pending"]}),i.jsx("span",{children:"Waiting for referrals to create their first theme"})]}),i.jsxs("div",{className:"pt-4 border-t border-border",children:[i.jsx("h4",{className:"text-sm font-medium mb-3",children:"How it works"}),i.jsxs("ol",{className:"space-y-2 text-sm text-muted-foreground",children:[i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-primary/10 text-primary text-xs flex items-center justify-center font-medium",children:"1"}),"Share your unique referral link with friends"]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-primary/10 text-primary text-xs flex items-center justify-center font-medium",children:"2"}),"They sign up and verify their email"]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-primary/10 text-primary text-xs flex items-center justify-center font-medium",children:"3"}),"When they create their first theme, you get 5 credits!"]})]})]})]})]}),i.jsx(S5,{open:h,onClose:O})]})}var C1="Radio",[VX,N5]=_r(C1),[KX,YX]=VX(C1),C5=g.forwardRef((t,e)=>{const{__scopeRadio:r,name:n,checked:s=!1,required:o,disabled:a,value:l="on",onCheck:c,form:u,...d}=t,[h,m]=g.useState(null),f=Ge(e,b=>m(b)),v=g.useRef(!1),p=h?u||!!h.closest("form"):!0;return i.jsxs(KX,{scope:r,checked:s,disabled:a,children:[i.jsx(Me.button,{type:"button",role:"radio","aria-checked":s,"data-state":A5(s),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:f,onClick:je(t.onClick,b=>{s||c==null||c(),p&&(v.current=b.isPropagationStopped(),v.current||b.stopPropagation())})}),p&&i.jsx(T5,{control:h,bubbles:!v.current,name:n,value:l,checked:s,required:o,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});C5.displayName=C1;var E5="RadioIndicator",P5=g.forwardRef((t,e)=>{const{__scopeRadio:r,forceMount:n,...s}=t,o=YX(E5,r);return i.jsx(Tr,{present:n||o.checked,children:i.jsx(Me.span,{"data-state":A5(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:e})})});P5.displayName=E5;var QX="RadioBubbleInput",T5=g.forwardRef(({__scopeRadio:t,control:e,checked:r,bubbles:n=!0,...s},o)=>{const a=g.useRef(null),l=Ge(a,o),c=gf(r),u=Kh(e);return g.useEffect(()=>{const d=a.current;if(!d)return;const h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==r&&f){const v=new Event("click",{bubbles:n});f.call(d,r),d.dispatchEvent(v)}},[c,r,n]),i.jsx(Me.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});T5.displayName=QX;function A5(t){return t?"checked":"unchecked"}var JX=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],kv="RadioGroup",[XX,bse]=_r(kv,[bu,N5]),R5=bu(),I5=N5(),[ZX,eZ]=XX(kv),O5=g.forwardRef((t,e)=>{const{__scopeRadioGroup:r,name:n,defaultValue:s,value:o,required:a=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:h,...m}=t,f=R5(r),v=fa(u),[p,b]=rn({prop:o,defaultProp:s??null,onChange:h,caller:kv});return i.jsx(ZX,{scope:r,name:n,required:a,disabled:l,value:p,onValueChange:b,children:i.jsx(W_,{asChild:!0,...f,orientation:c,dir:v,loop:d,children:i.jsx(Me.div,{role:"radiogroup","aria-required":a,"aria-orientation":c,"data-disabled":l?"":void 0,dir:v,...m,ref:e})})})});O5.displayName=kv;var M5="RadioGroupItem",$5=g.forwardRef((t,e)=>{const{__scopeRadioGroup:r,disabled:n,...s}=t,o=eZ(M5,r),a=o.disabled||n,l=R5(r),c=I5(r),u=g.useRef(null),d=Ge(e,u),h=o.value===s.value,m=g.useRef(!1);return g.useEffect(()=>{const f=p=>{JX.includes(p.key)&&(m.current=!0)},v=()=>m.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",v)}},[]),i.jsx(H_,{asChild:!0,...l,focusable:!a,active:h,children:i.jsx(C5,{disabled:a,required:o.required,
703checked:h,...c,...s,name:o.name,ref:d,onCheck:()=>o.onValueChange(s.value),onKeyDown:je(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:je(s.onFocus,()=>{var f;m.current&&((f=u.current)==null||f.click())})})})});$5.displayName=M5;var tZ="RadioGroupIndicator",D5=g.forwardRef((t,e)=>{const{__scopeRadioGroup:r,...n}=t,s=I5(r);return i.jsx(P5,{...s,...n,ref:e})});D5.displayName=tZ;var F5=O5,L5=$5,rZ=D5;const Ih=g.forwardRef(({className:t,...e},r)=>i.jsx(F5,{className:Se("grid gap-2",t),...e,ref:r}));Ih.displayName=F5.displayName;const Oh=g.forwardRef(({className:t,...e},r)=>i.jsx(L5,{ref:r,className:Se("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:i.jsx(rZ,{className:"flex items-center justify-center",children:i.jsx(LP,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Oh.displayName=L5.displayName;const nZ=["Facebook","Reddit","ChatGPT","Google","Bing","X","BlueSky","YouTube","Friend","Other"];function sZ({open:t,onClose:e,userId:r,userEmail:n}){const[s,o]=g.useState(""),[a,l]=g.useState(""),[c,u]=g.useState(!1),d=async()=>{if(!s){Q.error("Please select an option");return}if(s==="Other"&&!a.trim()){Q.error("Please tell us more about how you found us");return}u(!0);try{const{data:h,error:m}=await re.from("attribution_surveys").upsert({user_id:r,source:s,other_details:s==="Other"?a:null},{onConflict:"user_id",ignoreDuplicates:!0}).select();m&&console.error("Attribution survey insert error:",m),h&&h.length>0&&await re.functions.invoke("submit-attribution-survey",{body:{userId:r,email:n,source:s,otherDetails:s==="Other"?a:""}}),e()}catch(h){console.error("Attribution survey error:",h),e()}finally{u(!1)}};return i.jsx(Xt,{open:t,onOpenChange:()=>{},children:i.jsxs(Qt,{className:"sm:max-w-md [&>button]:hidden",onPointerDownOutside:h=>h.preventDefault(),onEscapeKeyDown:h=>h.preventDefault(),children:[i.jsxs(gn,{children:[i.jsx(wr,{children:"Welcome! 🎉"}),i.jsx(jn,{children:"Quick question — where did you hear about us?"})]}),i.jsxs("div",{className:"space-y-4 py-2",children:[i.jsx(Ih,{value:s,onValueChange:o,className:"grid grid-cols-2 gap-2",children:nZ.map(h=>i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(Oh,{value:h,id:`source-${h}`}),i.jsx(Xe,{htmlFor:`source-${h}`,className:"cursor-pointer",children:h})]},h))}),s==="Other"&&i.jsx(Nt,{placeholder:"Please tell us more...",value:a,onChange:h=>l(h.target.value),className:"bg-background/50"}),i.jsx("div",{className:"flex gap-2 justify-end pt-2",children:i.jsxs(Y,{onClick:d,disabled:c||!s,children:[c?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Submit"]})})]})]})})}const iZ={out_of_credits:{preHeadline:"You are out of credits. 🙁",headline:"Upgrade or wait until next month to continue! 😀"},low_credits:{preHeadline:"You are almost out of credits. 🙁",headline:"Upgrade to keep vibing! 😀"},private_themes:{preHeadline:"Free tier plans are public for all to see (even your clients). 👀",headline:"Upgrade to make your themes private. 🔒"},export_credits:{preHeadline:"This export will use credits. 🎟️",headline:"Get FREE Elementor, Gutenberg & Classic Exports by Upgrading. 🆓"},gutenberg_export:{preHeadline:"Available on paid plans only 🙁",headline:"Upgrade Today to Export to Gutenberg! 🔥"},elementor_export:{preHeadline:"Available on paid plans only 🙁",headline:"Upgrade Today to Export to Elementor! 🔥"},multi_page_builder:{preHeadline:"To Add Multiple Pages",headline:"Upgrade Today"},multi_page_scraper:{preHeadline:"To Copy Multiple Pages",headline:"Upgrade Today"},pro_model:{preHeadline:"For Faster, Higher Quality HTML",headline:"Upgrade Today"},media_migration:{preHeadline:"Save Hours Manually Updating Image Paths",headline:"Upgrade Today"},byok:{preHeadline:"Bring Your Own AI Key",headline:"Upgrade today"},trial_expired:{preHeadline:"Your free trial is up.",headline:"Upgrade to continue."}},oZ=[{icon:Na,title:"Design WordPress Sites with AI",description:"Build several multi-page WordPress sites each month."},{icon:kL,title:"Convert Full Websites to WordPress",description:"Use AI to clone a site from Wix, Base44, Squarespace, Lovable, Claude, Gemini, and more."},{icon:Tb,title:"Higher Credit Limits = More Designs",description:"Build today instead of waiting for your credits to replenish."},{icon:nh,title:"Private Themes",description:"Keep your themes private instead of public for your clients to see."},{icon:St,title:"Faster Generation, Professional Designs",description:"Use upgraded AI models and even Bring your own key when you upgrade."},{icon:Wn,title:"FREE Elementor, Gutenberg, & Classic Exports",description:"Save your credits for actual work. Exports are free when you upgrade."},{icon:qh,title:"Many More Benefits...",description:"Credit Saver, Multi-User, Media Migration, and more..."}],vo=[{quote:"The AI saves me days of work, and the preview helps me visualize the design before exporting.",attribution:"WordPress Developer, 1–3 years experience"},{quote:"Saved my company money.",attribution:"In-house Marketing Team"},{quote:"It creates a modern WordPress design much faster than building everything manually, while keeping the result editable and exportable.",attribution:"Business Owner, 10+ years WordPress experience"},{quote:"I was able to generate a well-structured, modern portfolio website and avoid spending days building the UI from scratch.",attribution:"Freelancer & WordPress Developer, 3–7 years experience"},{quote:"It saved a lot of time and generated a professional website structure quickly.",attribution:"WordPress Developer & Freelancer"}
703,{quote:"The biggest benefit is significantly reducing the time spent on repetitive coding tasks, allowing me to focus more on design and strategy.",attribution:"Freelancer using Elementor, 3+ years experience"}];function bl({open:t,onOpenChange:e,reason:r,onContinueWithCredits:n,continueLabel:s,continueBlockedLabel:o,preHeadlineOverride:a}){const l=Zt(),{user:c}=$t(),{trialStatus:u,plan:d}=nn(),[h,m]=g.useState(0),[f,v]=g.useState(!1),p=d==="free"&&u==="expired",b=!!c&&!!sessionStorage.getItem(`pmgpt:trial-continued:${c.id}`),x=p&&!b?"trial_expired":r,{preHeadline:y,headline:w}=iZ[x];g.useEffect(()=>{if(!t||f||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const _=window.setInterval(()=>{m(S=>(S+1)%vo.length)},6e3);return()=>window.clearInterval(_)},[t,f]),g.useEffect(()=>{t&&m(0)},[t]);const j=()=>{e(!1),l("/pricing")};return i.jsx(Xt,{open:t,onOpenChange:_=>x!=="trial_expired"||_?e(_):void 0,children:i.jsxs(Qt,{className:"w-[calc(100vw-2rem)] sm:max-w-md max-h-[90vh] overflow-y-auto",hideClose:x==="trial_expired",onEscapeKeyDown:x==="trial_expired"?_=>_.preventDefault():void 0,onPointerDownOutside:x==="trial_expired"?_=>_.preventDefault():void 0,children:[i.jsxs(gn,{children:[i.jsx(jn,{className:"text-base font-bold text-foreground",children:x===r&&a||y}),i.jsx(wr,{className:"text-xl",children:w})]}),i.jsx("div",{className:"space-y-3 mt-2",children:oZ.map(({icon:_,title:S,description:N})=>i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"p-1.5 rounded-md bg-primary/10 shrink-0 mt-0.5",children:i.jsx(_,{className:"h-4 w-4 text-primary"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium",children:S}),i.jsx("p",{className:"text-xs text-muted-foreground",children:N})]})]},S))}),i.jsxs("div",{className:"mt-2 border-y border-border py-1.5","aria-label":"Customer testimonials","aria-live":"polite",onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),onFocusCapture:()=>v(!0),onBlurCapture:()=>v(!1),children:[i.jsxs("div",{className:"min-h-[6.5rem] flex flex-col justify-center text-center px-6",children:[i.jsxs("blockquote",{className:"text-sm font-bold leading-relaxed",children:["“",vo[h].quote,"”"]}),i.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["— ",vo[h].attribution]})]}),i.jsxs("div",{className:"mt-2 flex items-center justify-center gap-2",children:[i.jsx(Y,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>m((h-1+vo.length)%vo.length),"aria-label":"Previous testimonial",children:i.jsx(OP,{className:"h-4 w-4"})}),i.jsx("div",{className:"flex items-center gap-1.5","aria-label":`Testimonial ${h+1} of ${vo.length}`,children:vo.map((_,S)=>i.jsx("button",{type:"button",className:`h-2 w-2 rounded-full transition-colors ${S===h?"bg-primary":"bg-muted-foreground/30"}`,onClick:()=>m(S),"aria-label":`Show testimonial ${S+1}`,"aria-current":S===h?"true":void 0},_.attribution))}),i.jsx(Y,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>m((h+1)%vo.length),"aria-label":"Next testimonial",children:i.jsx(Ga,{className:"h-4 w-4"})})]})]}),i.jsxs(Y,{onClick:j,className:"w-full mt-2",size:"lg",children:[i.jsx(St,{className:"h-4 w-4 mr-2"}),x==="export_credits"?"See Plans":"Upgrade Options"]}),x==="trial_expired"&&i.jsx(Y,{variant:"link",className:"w-full",onClick:()=>{c&&sessionStorage.setItem(`pmgpt:trial-continued:${c.id}`,"1"),e(!1)},children:"Continue with Free"}),x==="export_credits"&&(n?i.jsxs(Y,{variant:"outline",size:"lg",className:"w-full",onClick:()=>{n(),e(!1)},children:[i.jsx(Wn,{className:"h-4 w-4 mr-2"}),s||"Continue and use 1 credit"]}):i.jsx("p",{className:"text-center text-sm text-muted-foreground",children:o||"You need 1 credit to export."})),x!=="export_credits"&&x!=="trial_expired"&&n&&i.jsx("div",{className:"text-center pt-1",children:i.jsx("button",{onClick:()=>{n(),e(!1)},className:"text-sm text-muted-foreground underline hover:text-foreground transition-colors",children:"Continue with Credits"})})]})})}const KN={created:{label:"New",variant:"outline"},described:{label:"Described",variant:"secondary"},options_generated:{label:"Options Ready",variant:"secondary"},theme_selected:{label:"Theme Selected",variant:"default"},customizing:{label:"Customizing",variant:"default"},ready_to_export:{label:"Ready",variant:"default"}};function aZ(){const t=Zt(),[e,r]=eo(),{trackPurchase:n}=P_(),{trackPurchase:s}=T_(),{user:o,profile:a,signOut:l,refreshProfile:c,isEmailVerified:u,resendVerificationEmail
703:d}=$t(),{projects:h,loading:m,createProject:f,deleteProject:v,duplicateProject:p,updateProject:b}=f1(),{track:x}=no(),{creditsRemaining:y,refreshSubscription:w}=nn(),[j,_]=g.useState(!1),[S,N]=g.useState(!1),[P,C]=g.useState(""),O=g.useRef(null),[F,T]=g.useState(!1),[A,k]=g.useState(!1),[$,K]=g.useState(!1);g.useEffect(()=>{if(e.get("checkout")!=="success")return;const L=e.get("kind"),q=Number(e.get("amount")),he=e.get("session_id")||"";if(L==="credit_pack"){const X=`credit_pack_toast:${he||q}`;(typeof sessionStorage>"u"||!sessionStorage.getItem(X))&&(Q.success("Payment successful! Your credits have been added to your account."),sessionStorage==null||sessionStorage.setItem(X,"1")),w();const J=[3e3,8e3].map(de=>window.setTimeout(()=>w(),de));window.setTimeout(()=>J.forEach(clearTimeout),9e3)}if((L==="lifetime"||L==="project_pass"||L==="credit_pack")&&q>0){const X=`reddit_purchase_fired:${L}:${he||q}`;typeof sessionStorage<"u"&&!sessionStorage.getItem(X)&&(n({email:o==null?void 0:o.email,value:q,currency:"USD",transactionId:he||`${L}:${q}`}),s({email:o==null?void 0:o.email,value:q,currency:"USD",transactionId:he||`${L}:${q}`}),sessionStorage.setItem(X,"1"))}(L||e.get("amount")||e.get("session_id"))&&(e.delete("kind"),e.delete("amount"),e.delete("session_id"),r(e,{replace:!0}))},[e,r,o==null?void 0:o.email,n,w]),g.useEffect(()=>{if(!o)return;(async()=>{const{data:q}=await re.from("attribution_surveys").select("id").eq("user_id",o.id).limit(1);(!q||q.length===0)&&k(!0)})()},[o]);const H=async()=>{T(!0);const{error:L}=await d();T(!1),L?Q.error(L.message||"Failed to send verification email"):Q.success("Verification email sent! Please check your inbox.")},W=()=>{if(!u){Q.error("Please verify your email before creating projects.",{action:{label:"Resend Email",onClick:()=>H()}});return}C(""),N(!0),setTimeout(()=>{var L;return(L=O.current)==null?void 0:L.focus()},0)},R=()=>{N(!1),C("")},G=async()=>{if(!u){Q.error("Please verify your email before creating projects.",{action:{label:"Resend Email",onClick:()=>H()}});return}const L=P.trim();if(!L)return;_(!0);const q=await f(L);if(_(!1),!q){Q.error("Failed to create project");return}x("project_created",{project_id:q.id,project_name:q.name,mode:"describe",source_mode:null}),N(!1),C(""),Q.success("Project created!"),t(`/project/${q.id}`)},U=async L=>{await v(L.id)?(x("project_deleted",{project_id:L.id}),Q.success("Project deleted")):Q.error("Failed to delete project")},z=async L=>{const q=await p(L);q?(x("project_duplicated",{original_project_id:L.id,new_project_id:q.id}),Q.success("Project duplicated")):Q.error("Failed to duplicate project")},oe=async L=>{const q=!L.is_public;if(!q){const{data:X,error:J}=await re.functions.invoke("set-theme-private",{body:{projectId:L.id}});if(J||X!=null&&X.error){let de=X??null;try{de=J!=null&&J.context?await J.context.json():de}catch{}de!=null&&de.creditsNeeded?K(!0):Q.error("Failed to update visibility");return}(X==null?void 0:X.charged)>0&&w()}if(await b(L.id,{is_public:q})){if(q){await re.from("public_themes").delete().eq("source_project_id",L.id);let X=L.thumbnail_url;if(!X&&L.master_html)try{X=await y1({userId:L.user_id,projectId:L.id,html:L.master_html,css:L.master_css||"",isFromWebsite:L.project_mode==="from_website"}),await b(L.id,{thumbnail_url:X})}catch(de){console.warn("Dashboard: thumbnail generation failed when making public",de),X=Ah}const J=`${(L.slug||L.id).toString()}-${Date.now()}`;await re.from("public_themes").insert({user_id:L.user_id,name:L.name,slug:J,description:L.description,theme_description:L.theme_description,master_html:L.master_html,master_css:L.master_css,thumbnail_url:X||Ah,source_project_id:L.id,version:L.version||"1.0",published_at:new Date().toISOString()}),Q.success("Theme is now public")}else await re.from("public_themes").delete().eq("source_project_id",L.id),Q.success("Theme is now private");x("project_visibility_changed",{project_id:L.id,is_public:q})}else Q.error("Failed to update visibility")};return i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{showGenerationCounter:!0}),!u&&i.jsx("div",{className:"border-b border-amber-500/30 bg-amber-500/10",children:i.jsx("div",{className:"container mx-auto px-4 py-3",children:i.jsxs("div",{className:"flex items-center justify-between gap-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-1.5 rounded-full bg-amber-500/20",children:i.jsx(AL,{className:"h-4 w-4 text-amber-600 dar
703k:text-amber-400"})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-amber-800 dark:text-amber-200",children:"Verify your email to start creating themes"}),i.jsx("p",{className:"text-sm text-amber-700/80 dark:text-amber-300/80",children:"Check your inbox for a verification link from PressMeGPT"})]})]}),i.jsxs(Y,{variant:"outline",size:"sm",onClick:H,disabled:F,className:"border-amber-500/50 text-amber-700 dark:text-amber-300 hover:bg-amber-500/20",children:[F?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Resend Email"]})]})})}),i.jsx("main",{className:"container mx-auto px-4 py-8",children:i.jsxs(oa,{defaultValue:"projects",className:"w-full",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-8",children:[i.jsx("div",{className:"w-full sm:w-auto overflow-x-auto -mx-1 px-1",children:i.jsxs(Yi,{className:"w-max",children:[i.jsxs(gr,{value:"projects",className:"gap-2",children:[i.jsx(ta,{className:"h-4 w-4"}),"Your Projects"]}),i.jsxs(gr,{value:"saved",className:"gap-2",children:[i.jsx(tl,{className:"h-4 w-4"}),"Saved Themes"]}),i.jsxs(gr,{value:"earn",className:"gap-2",children:[i.jsx(rh,{className:"h-4 w-4"}),"Free Credits"]})]})}),i.jsxs("div",{className:"flex items-center gap-3 w-full sm:w-auto",children:[i.jsxs("div",{className:"hidden md:flex items-center gap-2 px-3 py-1.5 rounded-full bg-primary/10 text-primary text-sm font-medium",children:[i.jsx(St,{className:"h-4 w-4"}),i.jsxs("span",{children:[y," credits remaining"]})]}),S?i.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[i.jsx(Nt,{ref:O,placeholder:"Project name",value:P,onChange:L=>C(L.target.value),onKeyDown:L=>{L.key==="Enter"&&G(),L.key==="Escape"&&R()},disabled:j,className:"h-9 w-full sm:w-56"}),i.jsx(Y,{onClick:G,disabled:j||!P.trim(),size:"sm",className:"bg-primary hover:bg-primary/90",children:j?i.jsx(et,{className:"h-4 w-4 animate-spin"}):"Create"}),i.jsx(Y,{onClick:R,disabled:j,variant:"ghost",size:"icon",className:"h-9 w-9","aria-label":"Cancel",children:i.jsx(Bn,{className:"h-4 w-4"})})]}):i.jsxs(Y,{onClick:W,className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/20 w-full sm:w-auto",children:[i.jsx(yp,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),i.jsxs(Mr,{value:"projects",className:"mt-0",children:[y<=0&&i.jsx(dt,{className:"mb-6 border-destructive/30 bg-destructive/5",children:i.jsxs(ct,{className:"flex items-center gap-4 py-4",children:[i.jsx("div",{className:"p-2 rounded-full bg-destructive/10",children:i.jsx(t_,{className:"h-5 w-5 text-destructive"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"font-medium",children:"Out of credits"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"You've used all your credits. Upgrade your plan to continue creating themes."})]}),i.jsx(Y,{onClick:()=>t("/pricing"),className:"bg-primary hover:bg-primary/90",children:"Add Credits"})]})}),m?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(et,{className:"h-8 w-8 animate-spin text-primary"})}):h.length===0?i.jsx(dt,{className:"text-center py-16 bg-gradient-to-br from-card via-card to-primary/5 border-dashed border-2",children:i.jsxs(ct,{children:[i.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto mb-6",children:i.jsx(ta,{className:"h-8 w-8 text-primary"})}),i.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No projects yet"}),i.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm mx-auto",children:"Create your first WordPress theme project to get started with AI-powered design."}),i.jsxs(Y,{onClick:W,className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/20",children:[i.jsx(yp,{className:"h-4 w-4 mr-2"}),"Create First Project"]})]})}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:h.map(L=>{var q,he;return i.jsxs(dt,{className:"cursor-pointer group hover:shadow-xl hover:shadow-primary/5 transition-all duration-300 hover:-translate-y-1 border-border/50 overflow-hidden",onClick:()=>t(`/project/${L.id}`),children:[i.jsx("div",{className:"h-1 bg-gradient-to-r from-primary to-accent"}),i.jsxs(ir,{className:"flex flex-row items-start justify-between space-y-0",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx(Dr,{className:"text-lg group-hover:text-primary transition-colors",children:L.name}),i.jsxs(Gr,{className:"mt-1",children:["Updated ",new Date(L.updated_at).toLocaleDateString()]})]}),i.jsxs(lv,{children:[i.jsx(cv,{asChild:!0,onClick:X=>X.stopPropagation(),children:i.jsx(Y,{variant:"ghost",size:"icon",className:"h-8 w-8",children:i.jsx(SL,{className:"h-4 w-4"})})}),i.jsxs(af,{align:"end",children:[i.jsxs(hs,{onClick:X=>{X.stopPropagation(),z(L)},children:[i.jsx(r_,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),i.jsx(hs,{onClick:X=>{X.stopPropagation(),oe(L)},children:L.is_public?i.jsxs(i.Fragment,{children:[i.jsx(NL,{className:"h-4 w-4 mr-2"}),"Make Private"]}):i.jsxs(i.Fragment,{children:[i.jsx(Mg,{className:"h-4 w-4 mr-2"}),"Make Public"]})}),i.jsxs(hs,{onClick:X=>{X.stopPropagation(),U(L)},className:"text-destructive focus:text-destructive",children:[i.jsx(GP,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]}),i.jsxs(ct,{className:"flex items-center gap-2",children:[i.jsx(rt,{variant:((q=KN[L.status])==null?void 0:q.variant)||"outline",children:((he=KN[L.status])==null?void 0:he.label)||L.status}),L.is_public?i.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx(Rd,{className:"h-3 w-3"}),"Public"]}):i.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx(nh,{className:"h-3 w-3"}),"Private"]})]})]},L.id)})})]}),i.jsx(Mr,{value:"saved",className:"mt-0",children:i.jsx(KJ,{})}),i.jsx(Mr,{value:"earn",className:"mt-0",children:i.jsx("div",{className:"max-w-2xl mx-auto",children:i.jsx(qX,{})})})]})}),o&&i.jsx(sZ,{open:A,onClose:()=>k(!1),userId:o.id,userEmail:o.email||""}),i.jsx(bl,{open:$,onOpenChange:K,reason:"out_of_credits"})]})}const lZ="com|net|org|io|app|dev|co|ai|site|xyz|me|us|uk|ca|au|de|new|page|store|shop|biz|info",cZ="(?:com|co|org|net|gov|edu|ac)\\.(?:ng|uk|za|au|nz|ke|gh|in|br|mx|jp|sg|ae|sa)",uZ=new RegExp(`\\b((?:https?:\\/\\/|www\\.)[^\\s<>"')]+|[a-z0-9-]+(?:\\.[a-z0-9-]+)*\\.(?:${cZ}|${lZ})(?:\\/[^\\s<>"')]*)?)`,"i");function YN(t){const e=(t||"").match(uZ);return e?e[1].replace(/[.,;:!?]+$/,""):null}function dZ(t,e){return t.replace(e,"").replace(/\s{2,}/g," ").trim()}function Hw(t,e){const r=(t||"").trim(),n=(e||"").trim();if(!n)return r;const s=n.replace(/^https?:\/\//i,"").replace(/\/$/,"").toLowerCase();return s&&r.toLowerCase().includes(s)?r:r?`${r}
704
705Website: ${n}`:n}
705const fy=/\/\*\s*(?:Source stylesheet:\s*)?https?:\/\/[^\n*]{0,400}\*\//,my="/* End Global Design Settings */";function B5(t){if(!t||!fy.test(t))return t;let e="",r=t;if(t.startsWith("/* Global Design Settings")&&t.includes(my)){const f=t.indexOf(my)+my.length;e=t.slice(0,f).trim()+`
706
707`,r=t.slice(f)}const n=r.search(/--td-color-primary\s*:/);if(n<0)return t;const s=r.slice(0,n);if(!fy.test(s))return t;let o=-1;for(const f of s.matchAll(new RegExp(fy.source,"g")))f.index!=null&&(o=f.index+f[0].length);if(o<0)return t;const a=r.slice(o,n),l=a.lastIndexOf(":root"),c=a.lastIndexOf("/* Global Design Settings"),u=Math.max(l,c),h=u>=0&&n-(o+u)<2500?o+u:r.lastIndexOf(`
708`,n)+1,m=(e+r.slice(h)).trim();return m.length<40||t.length-m.length<500?t:m}const z5="siteCapture",hZ=/\.(png|jpe?g|gif|webp|svg|avif)(\?|#|$)/i;function fZ(t){if(hZ.test(t))return!1;try{const e=new URL(/^https?:\/\//i.test(t)?t:`https://${t}`),r=(e.searchParams.get("fm")||"").toLowerCase();if(/^(png|jpe?g|gif|webp|svg|avif)$/.test(r)||(e.searchParams.get("auto")||"").toLowerCase().split(",").includes("format")||e.searchParams.has("ixid")||e.searchParams.has("ixlib"))return!1}catch{return!0}return!0}function mZ(t){const e=t==null?void 0:t[z5];if(!e||typeof e!="object")return null;const r=e;return!r.url||r.status!=="ok"&&r.status!=="failed"?null:r}function pZ(t,e){return{...t||{},[z5]:e}}function QN(t,e){if(typeof t!="string")return;const r=t.trim();if(r)return r.length>e?r.slice(0,e):r}function gZ(t){const e=QN(t.screenshot,18e4),r=Array.isArray(t.sections)?t.sections.map(n=>String(n||"").trim()).filter(Boolean).slice(0,24):[];return{url:t.url,status:t.status,error:t.error?t.error.slice(0,240):void 0,capturedAt:new Date().toISOString(),mode:t.mode||null,screenshot:e&&e.startsWith("data:")&&e.length>2e4?void 0:e,markdown:QN(t.markdown,12e3),sections:r,brandingSummary:t.branding?JSON.stringify(t.branding).slice(0,1500):void 0}}function vZ(t){const e=t==null?void 0:t.sections;return Array.isArray(e)?e.map(r=>{if(!r||typeof r!="object")return"";const n=r;return String(n.heading||n.title||n.role||"").trim()}).filter(Boolean):[]}function xZ(t){var r;if(!t||t.status!=="ok")return"";const e=[`Saved ${t.mode||"website"} capture of ${t.url} from ${t.capturedAt}.`,"Use this instead of scanning the site again."];return(r=t.sections)!=null&&r.length&&e.push(`Sections: ${t.sections.join(", ")}`),t.brandingSummary&&e.push(`Branding: ${t.brandingSummary}`),t.markdown&&e.push(`Page text:
709${t.markdown.slice(0,4e3)}`),e.join(`
710`)}function yZ(t,e){if(!(!t||t.status!=="ok"||!t.screenshot)&&/^https?:\/\//i.test(t.screenshot)&&/\b(exactly|match the url|like the url|copy)\b/i.test(e))return t.screenshot}const bZ="project-images",U5=60*60,wZ=5*60*1e3,_Z=/https?:\/\/[a-z0-9-]+\.supabase\.co\/storage\/v1\/object\/(?:public|sign)\/project-images\/[^"'\s)]+/gi,JN=new Map,py=new Map;function W5(t){return t?/\/storage\/v1\/object\/(?:public|sign)\/project-images\//i.test(t):!1}function H5(t){if(!W5(t))return null;try{const e=new URL(t),r="/project-images/",n=e.pathname.indexOf(r);if(n===-1)return null;const s=e.pathname.slice(n+r.length);return s?decodeURIComponent(s):null}catch{return null}}async function jZ(t){const{data:e,error:r}=await re.storage.from(bZ).createSignedUrl(t,U5);if(r||!(e!=null&&e.signedUrl))throw r??new Error("Failed to sign URL");return e.signedUrl}async function E1(t){const e=H5(t);if(!e)return t;const r=JN.get(e);if(r&&r.expiresAt>Date.now())return r.url;let n=py.get(e);return n||(n=jZ(e).then(s=>(JN.set(e,{url:s,expiresAt:Date.now()+U5*1e3-wZ}),s)).catch(()=>t).finally(()=>{py.delete(e)}),py.set(e,n)),n}async function G5(t){if(!t)return t;const e=Array.from(new Set(t.match(_Z)||[]));if(e.length===0)return t;const r=await Promise.all(e.map(async s=>{const o=s.replace(/&amp;/g,"&");return[s,await E1(o)]}));let n=t;for(const[s,o]of r)s!==o&&(n=n.split(s).join(o));return n}const kZ=Object.freeze(Object.defineProperty({__proto__:null,isProjectImageUrl:W5,projectImagePath:H5,signProjectImageUrl:E1,signProjectImageUrlsInHtml:G5},Symbol.toStringTag,{value:"Module"}));function XN(t){return t==="not_published"||t==="login_required"||t==="error_page"}function SZ(t){return/^(https?:\/\/)?[^\s/]+\.[a-z]{2,}(\/\S*)?$/i.test(t.trim())}function NZ(t,e=!0){const[r,n]=g.useState("idle"),[s,o]=g.useState(""),a=g.useRef(0);return g.useEffect(()=>{const l=++a.current;if(!e||!SZ(t)){n("idle"),o("");return}const c=setTimeout(async()=>{n("checking"),o("Checking if the site is publicly accessible...");try{const{data:u}=await re.functions.invoke("check-url-access",{body:{url:t.trim()}});if(l!==a.current)return;
710const d=(u==null?void 0:u.status)||"unknown";n(d),o(d==="unknown"?"":(u==null?void 0:u.message)||"")}catch{if(l!==a.current)return;n("unknown"),o("")}},600);return()=>clearTimeout(c)},[t,e]),{status:r,message:s}}var Sv="Collapsible",[CZ,q5]=_r(Sv),[EZ,P1]=CZ(Sv),V5=g.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:a,...l}=t,[c,u]=rn({prop:n,defaultProp:s??!1,onChange:a,caller:Sv});return i.jsx(EZ,{scope:r,disabled:o,contentId:zn(),open:c,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),children:i.jsx(Me.div,{"data-state":I1(c),"data-disabled":o?"":void 0,...l,ref:e})})});V5.displayName=Sv;var K5="CollapsibleTrigger",T1=g.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,s=P1(K5,r);return i.jsx(Me.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":I1(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:e,onClick:je(t.onClick,s.onOpenToggle)})});T1.displayName=K5;var A1="CollapsibleContent",R1=g.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=P1(A1,t.__scopeCollapsible);return i.jsx(Tr,{present:r||s.open,children:({present:o})=>i.jsx(PZ,{...n,ref:e,present:o})})});R1.displayName=A1;var PZ=g.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=t,a=P1(A1,r),[l,c]=g.useState(n),u=g.useRef(null),d=Ge(e,u),h=g.useRef(0),m=h.current,f=g.useRef(0),v=f.current,p=a.open||l,b=g.useRef(p),x=g.useRef(void 0);return g.useEffect(()=>{const y=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(y)},[]),Br(()=>{const y=u.current;if(y){x.current=x.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const w=y.getBoundingClientRect();h.current=w.height,f.current=w.width,b.current||(y.style.transitionDuration=x.current.transitionDuration,y.style.animationName=x.current.animationName),c(n)}},[a.open,n]),i.jsx(Me.div,{"data-state":I1(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!p,...o,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...t.style},children:p&&s})});function I1(t){return t?"open":"closed"}var Y5=V5,TZ=T1,AZ=R1,Xs="Accordion",RZ=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[O1,IZ,OZ]=cu(Xs),[Nv,wse]=_r(Xs,[OZ,q5]),M1=q5(),Q5=ke.forwardRef((t,e)=>{const{type:r,...n}=t,s=n,o=n;return i.jsx(O1.Provider,{scope:t.__scopeAccordion,children:r==="multiple"?i.jsx(FZ,{...o,ref:e}):i.jsx(DZ,{...s,ref:e})})});Q5.displayName=Xs;var[J5,MZ]=Nv(Xs),[X5,$Z]=Nv(Xs,{collapsible:!1}),DZ=ke.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:o=!1,...a}=t,[l,c]=rn({prop:r,defaultProp:n??"",onChange:s,caller:Xs});return i.jsx(J5,{scope:t.__scopeAccordion,value:ke.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:ke.useCallback(()=>o&&c(""),[o,c]),children:i.jsx(X5,{scope:t.__scopeAccordion,collapsible:o,children:i.jsx(Z5,{...a,ref:e})})})}),FZ=ke.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=t,[a,l]=rn({prop:r,defaultProp:n??[],onChange:s,caller:Xs}),c=ke.useCallback(d=>l((h=[])=>[...h,d]),[l]),u=ke.useCallback(d=>l((h=[])=>h.filter(m=>m!==d)),[l]);return i.jsx(J5,{scope:t.__scopeAccordion,value:a,onItemOpen:c,onItemClose:u,children:i.jsx(X5,{scope:t.__scopeAccordion,collapsible:!0,children:i.jsx(Z5,{...o,ref:e})})})}),[LZ,Cv]=Nv(Xs),Z5=ke.forwardRef((t,e)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:o="vertical",...a}=t,l=ke.useRef(null),c=Ge(l,e),u=IZ(r),h=fa(s)==="ltr",m=je(t.onKeyDown,f=>{var P;if(!RZ.includes(f.key))return;const v=f.target,p=u().filter(C=>{var O;return!((O=C.ref.current)!=null&&O.disabled)}),b=p.findIndex(C=>C.ref.current===v),x=p.length;if(b===-1)return;f.preventDefault();let y=b;const w=0,j=x-1,_=()=>{y=b+1,y>j&&(y=w)},S=()=>{y=b-1,y<w&&(y=j)};switch(f.key){case"Home":y=w;break;case"End":y=j;break;case"ArrowRight":o==="horizontal"&&(h?_():S());break;case"ArrowDown":o==="vertical"&&_();break;case"ArrowLeft":o==="horizontal"&&(h?S():_());break;case"ArrowUp":o==="vertical"&&S();break}const N=y%x;(P=p[N].ref.current)==null||P.focus()});return i.jsx(LZ,{scope:r,disabled:n,direction:s,orientation:o,children:i.jsx(O1.Slot,{scope:r,children:i.jsx(Me.div,{...a,"data-orientation":o,ref:c,onKeyDown:n?void 0:m})})})}),cg="AccordionItem",[BZ,$1]=Nv(cg),eM=ke.forwardRef((t,e)=>{const{__scopeAccordion:r,value:n,...s}=t,o=Cv(cg,r),a=MZ(cg,r),l=M1(r),c=zn(),u=n&&a.value.includes(n)||!1,d=o.disabled||t.disabled;return i.jsx(BZ,{scope:r,open:u,disabled:d,triggerId:c,children:i.jsx(Y5,{"data-orientation":o.orientation,"data-state":oM(u),...l,...s,ref:e,disabled:d,open:u,onOpenChange:h=>{h?a.onItemOpen(n):a.onItemClose(n)}})})});eM.displayName=cg;var tM="AccordionHeader",rM=ke.forwardRef((t,e)=>{const{__scopeAccordion:r,...n}=t,s=Cv(Xs,r),o=$1(tM,r);return i.jsx(Me.h3,{"data-orientation":s.orientation,"data-state":oM(o.open),"data-disabled":o.disabled?"":void 0,...n,ref:e})});rM.displayName=tM;var Gw="AccordionTrigger",nM=ke.forwardRef((t,e)=>{const{__scopeAccordion:r,...n}=t,s=Cv(Xs,r),o=$1(Gw,r),a=$Z(Gw,r),l=M1(r);return i.jsx(O1.ItemSlot,{scope:r,children:i.jsx(TZ,{"aria-disabled":o.open&&!a.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...l,...n,ref:e})})});nM.displayName=Gw;var sM="AccordionContent",iM=ke.forwardRef((t,e)=>{const{__scopeAccordion:r,...n}=t,s=Cv(Xs,r),o=$1(sM,r),a=M1(r);return i.jsx(AZ,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...a,...n,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});iM.displayName=sM;function oM(t){return t?"open":"closed"}var zZ=Q5,UZ=eM,WZ=rM,aM=nM,lM=iM;const Ev=zZ,Va=g.forwardRef(({className:t,...e},r)=>i.jsx(UZ,{ref:r,className:Se("border-b",t),...e}));Va.displayName="AccordionItem";const Ka=g.forwardRef(({className:t,children:e,...r},n)=>i.jsx(WZ,{className:"flex",children:i.jsxs(aM,{ref:n,className:Se("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...r,children:[e,i.jsx(Hs,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Ka.displayName=aM.displayName;const Ya=g.forwardRef(({className:t,children:e,...r},n)=>i.jsx(lM,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:i.jsx("div",{className:Se("pb-4 pt-0",t),children:e})}));Ya.displayName=lM.displayName;function D1(){const[t,e]=g.useState([]),[r,n]=g.useState([]),[s,o]=g.useState([]),[a,l]=g.useState(!0);g.useEffect(()=>{(async()=>
710{l(!0);const[d,h,m]=await Promise.all([re.from("theme_compatibility_tags").select("*").order("name"),re.from("theme_type_tags").select("*").order("name"),re.from("theme_industry_tags").select("*").order("category").order("name")]);!d.error&&d.data&&e(d.data),!h.error&&h.data&&n(h.data),!m.error&&m.data&&o(m.data),l(!1)})()},[]);const c=s.reduce((u,d)=>{const h=d.category||"Other";return u[h]||(u[h]=[]),u[h].push(d),u},{});return{compatibilityTags:t,typeTags:r,industryTags:s,industriesByCategory:c,loading:a}}function HZ(t){const[e,r]=g.useState({compatibility:[],themeType:null,industries:[]}),[n,s]=g.useState(!0);return g.useEffect(()=>{(async()=>{var m,f,v;if(!t){s(!1);return}s(!0);const[a,l,c]=await Promise.all([re.from("theme_compatibility").select("tag_id, theme_compatibility_tags(id, name, slug, description)").eq("theme_id",t),re.from("theme_types").select("tag_id, theme_type_tags(id, name, slug, description)").eq("theme_id",t).maybeSingle(),re.from("theme_industries").select("tag_id, theme_industry_tags(id, name, slug, category)").eq("theme_id",t)]),u=((m=a.data)==null?void 0:m.map(p=>p.theme_compatibility_tags).filter(Boolean))||[],d=((f=l.data)==null?void 0:f.theme_type_tags)||null,h=((v=c.data)==null?void 0:v.map(p=>p.theme_industry_tags).filter(Boolean))||[];r({compatibility:u,themeType:d,industries:h}),s(!1)})()},[t]),{tags:e,loading:n}}function GZ(){return{saveThemeTags:g.useCallback(async(e,r)=>{var c,u,d;const{themeType:n,industries:s}=r;console.log(`[saveThemeTags] Saving tags for theme ${e}: type="${n}", industries=[${s.join(", ")}]`);const[o,a,l]=await Promise.all([re.from("theme_type_tags").select("id").eq("slug",n).single(),re.from("theme_industry_tags").select("id, slug").in("slug",s),re.from("theme_compatibility_tags").select("id, slug").in("slug",["gutenberg","classic","elementor"])]);if(o.error&&console.error("[saveThemeTags] Error fetching type tag:",o.error),a.error&&console.error("[saveThemeTags] Error fetching industry tags:",a.error),l.error&&console.error("[saveThemeTags] Error fetching compat tags:",l.error),console.log("[saveThemeTags] Found type tag:",(c=o.data)==null?void 0:c.id,"| industry tags:",(u=a.data)==null?void 0:u.length,"| compat tags:",(d=l.data)==null?void 0:d.length),o.data){const{error:h}=await re.from("theme_types").upsert({theme_id:e,tag_id:o.data.id},{onConflict:"theme_id,tag_id"});h&&console.error("[saveThemeTags] Error inserting theme type:",h)}if(a.data&&a.data.length>0){const h=a.data.map(v=>({theme_id:e,tag_id:v.id})),{error:m}=await re.from("theme_industries").delete().eq("theme_id",e);m&&console.error("[saveThemeTags] Error deleting old industries:",m);const{error:f}=await re.from("theme_industries").insert(h);f&&console.error("[saveThemeTags] Error inserting industries:",f)}if(l.data&&l.data.length>0){const h=l.data.map(v=>({theme_id:e,tag_id:v.id})),{error:m}=await re.from("theme_compatibility").delete().eq("theme_id",e);m&&console.error("[saveThemeTags] Error deleting old compat tags:",m);const{error:f}=await re.from("theme_compatibility").insert(h);f&&console.error("[saveThemeTags] Error inserting compat tags:",f)}return!0},[])}}const qZ=({onHome:t,onRefresh:e,className:r=""})=>i.jsx(Qh,{children:i.jsxs("div",{className:`flex items-center gap-1 ${r}`,children:[i.jsxs(lh,{children:[i.jsx(ch,{asChild:!0,children:i.jsx(Y,{variant:"ghost",size:"icon",onClick:t,className:"h-8 w-8",children:i.jsx(zP,{className:"h-4 w-4"})})}),i.jsx(Qc,{children:i.jsx("p",{children:"Back to Home"})})]}),i.jsxs(lh,{children:[i.jsx(ch,{asChild:!0,children:i.jsx(Y,{variant:"ghost",size:"icon",onClick:e,className:"h-8 w-8",children:i.jsx(sh,{className:"h-4 w-4"})})}),i.jsx(Qc,{children:i.jsx("p",{children:"Refresh Preview"})})]})]})}),VZ="modulepreload",KZ=function(t){return"/"+t},ZN={},YZ=function(e,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(r.map(c=>{if(c=KZ(c),c in ZN)return;ZN[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");
710if(h.rel=u?"stylesheet":VZ,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((m,f)=>{h.addEventListener("load",m),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&o(l.reason);return e().catch(o)})};function e2(t){const[e,r]=g.useState(t);return g.useEffect(()=>{let n=!1;if(r(t),!(!t||!/\/project-images\//i.test(t)))return G5(t).then(s=>{n||r(s)}),()=>{n=!0}},[t]),e}function QZ(t){const[e,r]=g.useState(t||"");return g.useEffect(()=>{let n=!1;if(!t){r("");return}if(r(t),!!/\/project-images\//i.test(t))return YZ(async()=>{const{signProjectImageUrl:s}=await Promise.resolve().then(()=>kZ);return{signProjectImageUrl:s}},void 0).then(({signProjectImageUrl:s})=>s(t).then(o=>{n||r(o)})),()=>{n=!0}},[t]),e}const JZ=[/<(?:header|div|section)[^>]*class=["'][^"']*\bfse-header\b[^"']*["'][^>]*>/i,/<nav\b[^>]*class=["']nav(?:\s+[^"']*)?["'][^>]*>/i,/<header\b[^>]*>/i,/<(?:div|section)[^>]*class=["'][^"']*\b(?:site-header|main-header|page-header|global-header|global-nav|gl-navbar)\b[^"']*["'][^>]*>/i,/<(?:div|section)[^>]*class=["'][^"']*\b(?:navbar|top-nav)\b[^"']*["'][^>]*>/i];function ug(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function t2(t){const e=t.match(/\s*class=["']([^"']*)["']/i);return e?` class="${e[1]}"`:""}function XZ(t,e){return e?t?t.replace(/class=["']([^"']*)["']/i,(r,n)=>{const s=`${n} ${e}`.trim();return`class="${ug(s)}"`}):` class="${ug(e)}"`:t}function F1(t,e,r){const n=t.href||(t.slug==="home"?"#":`${t.slug||"#"}.html`),s=XZ(e,t.className),o=t.children&&t.children.length>0?`<ul>${t.children.map(a=>F1(a,e,r)).join(`
711`)}</ul>`:"";return`<li${s}><a${r} href="${ug(n)}">${ug(t.title)}</a>${o}</li>`}function ZZ(t,e=' class="fse-nav-menu"',r="",n=""){const s=t.map(o=>F1(o,r,n)).join(`
712`);return`<ul${e}>${s}</ul>`}function cM(t){return`<nav class="fse-main-nav fse-nav-menu-host" aria-label="Primary">${ZZ(t)}</nav>`}function eee(t){const e=[/<ul([^>]*class=["'][^"']*(?:fse-nav-menu|fse-main-nav|nav-menu)[^"']*["'][^>]*)>([\s\S]*?)<\/ul>/i,/<nav[^>]*class=["'][^"']*(?:fse-main-nav|fse-nav)[^"']*["'][^>]*>[\s\S]*?<ul([^>]*)>([\s\S]*?)<\/ul>/i,/<nav[^>]*>[\s\S]*?<ul([^>]*class=["'][^"']*nav[^"']*["'][^>]*)>([\s\S]*?)<\/ul>/i,/<nav[^>]*>[\s\S]*?<ul([^>]*)>([\s\S]*?)<\/ul>/i];for(const r of e){const n=t.match(r);if(!n)continue;const s=n[1]||"",o=n[2]||"";if(!(!/<a\b/i.test(o)&&o.trim()))return{full:n[0],ulAttrs:s,ulContent:o}}return null}function tee(t,e,r){const n=r.ulContent.match(/<li([^>]*)>/i),s=r.ulContent.match(/<a([^>]*)>/i),o=n?t2(n[1]):"",a=s?t2(s[1]):"",l=e.map(u=>F1(u,o,a)).join(`
713`),c=`<ul${r.ulAttrs}>${l}</ul>`;return t.replace(r.full,c)}function ree(t,e){const r=t.match(/<nav([^>]*class=["'][^"']*(?:fse-main-nav|fse-nav|nav-menu)[^"']*["'][^>]*)>([\s\S]*?)<\/nav>/i)||t.match(/<nav([^>]*)>([\s\S]*?)<\/nav>/i);if(!r)return null;const n=r[2]||"";return/<ul\b/i.test(n)||!/<a\b/i.test(n)?null:t.replace(r[0],cM(e))}function nee(t,e){const r=cM(e),n=[/(<div[^>]*class=["'][^"']*\bfse-header-right\b[^"']*["'][^>]*>)/i,/(<div[^>]*class=["'][^"']*\bfse-header-center\b[^"']*["'][^>]*>)/i,/(<div[^>]*class=["'][^"']*\bfse-header-actions\b[^"']*["'][^>]*>)/i,/(<div[^>]*class=["'][^"']*\bfse-header-content\b[^"']*["'][^>]*>)/i,/(<div[^>]*class=["'][^"']*\bfse-group\b[^"']*["'][^>]*>)/i,/(<(?:header|div|section)[^>]*class=["'][^"']*\bfse-header\b[^"']*["'][^>]*>)/i];for(const s of n){const o=t.match(s);if(o)return t.replace(o[0],`${o[0]}
714${r}`)}return`${r}
715${t}`}function see(t){const e=/<nav[^>]*class=["'][^"']*\bfse-main-nav\b[^"']*["'][^>]*>[\s\S]*?<\/nav>/gi,r=[...t.matchAll(e)];if(r.length<=1)return t;let n=r.length-1;for(let o=0;o<r.length;o++){const a=t.slice(0,r[o].index??0);if(/\bfse-header-right\b/i.test(a)){n=o;break}}let s=t;for(let o=r.length-1;o>=0;o--){if(o===n)continue;const a=r[o].index??0;s=s.slice(0,a)+s.slice(a+r[o][0].length)}return s}function r2(t,e){if(!t||e.length===0)return t;const r=eee(t);let n=r?tee(t,e,r):ree(t,e)??nee(t,e);return see(n)}function uM(t,e,r){const n=t.indexOf(">",e);if(n===-1)return null;let s=1;const o=new RegExp(`<(/?)(${r})\\b[^>]*>`,"gi");o.lastIndex=n+1;let a;for(;(a=o.exec(t))!==null;){if(a[1]==="/"?s-=1:s+=1,s===0)return t.slice(e,o.lastIndex);if(s<0)return null}return null}function iee(t){var r,n;let e=null;for(const s of JZ){const o=t.match(s);if(!o||o.index===void 0)continue;const a=((n=(r=o[0].match(/<(header|nav|div|section)/i))==null?void 0:r[1])==null?void 0:n.toLowerCase())||"header";(!e||o.index<e.index)&&(e={index:o.index,tag:a,openTag:o[0]})}return e}function qw(t){const e=iee(t);if(!e)return null;let r=e.index;const s=t.slice(0,e.index).match(/<(?:div|section)[^>]*class=["'][^"']*(?:\bmv-topbar\b|\btop-?bar\b|\butility-bar\b|\bsite-topbar\b|\btd-topbar\b)[^"']*["'][^>]*>[\s\S]*?<\/(?:div|section)>\s*$/i);s&&s.index!==void 0&&(r=s.index);const o=uM(t,e.index,e.tag);if(o)return{start:r,end:e.index+o.length};const a=t.slice(e.index+e.openTag.length),l=a.match(new RegExp(`</${e.tag}>`,"i"));if(l&&l.index!==void 0)return{start:r,end:e.index+e.openTag.length+l.index+l[0].length};const c=a.match(/<(?:main|section|footer)\b/i),u=c&&c.index!==void 0?e.index+e.openTag.length+c.index:t.length;return{start:r,end:u}}function Vw(t){const e=qw(t);return e?t.slice(e.start,e.end):""}function oee(t){var s,o;const e=[...t.matchAll(/<footer\b[^>]*>/gi)];if(e.length>0){const a=e[e.length-1];if(a.index!==void 0)return{index:a.index,tag:"footer"}}const r=[/<(?:div|section)[^>]*class=["'][^"']*\bfse-footer\b[^"']*["'][^>]*>/gi,/<(?:div|section)[^>]*class=["'][^"']*\bsite-footer\b[^"']*["'][^>]*>/gi,/<(?:div|section)[^>]*class=["'][^"']*footer[^"']*["'][^>]*>/gi];let n=null;for(const a of r){let l;for(;(l=a.exec(t))!==null;){const c=((o=(s=l[0].match(/^<(\w+)/i))==null?void 0:s[1])==null?void 0:o.toLowerCase())||"div";l.index!==void 0&&(!n||l.index>n.index)&&(n={index:l.index,tag:c})}}return n}function n2(t){const e=oee(t);return e&&uM(t,e.index,e.tag)||""}function aee(t,e){const r=Vw(t),n=n2(t);if(!r&&!n)return e;let s=e.trim();r&&(s=s.split(r).join("")),n&&(s=s.split(n).join("")),s=s.replace(/<header[^>]*>[\s\S]*?<\/header>/gi,""),s=s.replace(/<footer[^>]*>[\s\S]*?<\/footer>/gi,"");const o=n2(s);
715return o&&(s=s.replace(o,"")),[r,s.trim(),n].filter(Boolean).join(`
716`)}function lee(t,e){let r=t.slice(0,e.start);const n=[/<nav[^>]*class=["'][^"']*\bfse-main-nav\b[^"']*["'][^>]*>[\s\S]*?<\/nav>\s*/gi,/<nav[^>]*class=["'][^"']*\bfse-nav-menu-host\b[^"']*["'][^>]*>[\s\S]*?<\/nav>\s*/gi,/<nav[^>]*aria-label=["']Primary["'][^>]*>[\s\S]*?<\/nav>\s*/gi,/<ul[^>]*class=["'][^"']*\bfse-nav-menu\b[^"']*["'][^>]*>[\s\S]*?<\/ul>\s*/gi];for(const s of n)r=r.replace(s,"");return r===t.slice(0,e.start)?t:r+t.slice(e.start)}function Yl(t,e){if(!t||e.length===0)return t;const r=qw(t);if(r){const n=lee(t,r),s=qw(n)||r,o=n.slice(0,s.start),a=n.slice(s.start,s.end),l=n.slice(s.end);return o+r2(a,e)+l}return r2(t,e)}function cee(t,e){return!t||e.length===0?t:Yl(t,e)}const dM=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),uee=new Set(["script","style"]),dee={li:new Set(["li"]),p:new Set(["p"]),option:new Set(["option"]),td:new Set(["td","th"]),th:new Set(["td","th"]),tr:new Set(["tr"])};function s2(t,e={}){return{type:"element",tag:t,attrs:e,children:[],parent:null,selfClosing:dM.has(t)}}function i2(t){return{type:"text",value:t,parent:null}}function gy(t,e){e.parent=t,t.children.push(e)}function hee(t){const e={};let r=0,n=!1;for(;r<t.length;){for(;r<t.length&&/\s/.test(t[r]);)r++;if(r>=t.length)break;if(t[r]==="/"){n=!0,r++;continue}let s=r;for(;r<t.length&&!/[\s=/]/.test(t[r]);)r++;const o=t.slice(s,r).toLowerCase();if(!o){r++;continue}for(;r<t.length&&/\s/.test(t[r]);)r++;let a="";if(t[r]==="="){for(r++;r<t.length&&/\s/.test(t[r]);)r++;const l=t[r];if(l==='"'||l==="'"){r++;const c=t.indexOf(l,r);a=c===-1?t.slice(r):t.slice(r,c),r=c===-1?t.length:c+1}else{const c=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;a=t.slice(c,r)}}e[o]=a}return{attrs:e,selfClosing:n}}function hM(t){const e=s2("#root");let r=e,n=0;const s=[],o=()=>{if(!s.length)return;const a=s.join("");s.length=0,a&&gy(r,i2(a))};for(;n<t.length;){const a=t.indexOf("<",n);if(a===-1){s.push(t.slice(n));break}if(a>n&&s.push(t.slice(n,a)),t.startsWith("<!--",a)){const b=t.indexOf("-->",a+4);n=b===-1?t.length:b+3;continue}if(t.startsWith("<!",a)){const b=t.indexOf(">",a);n=b===-1?t.length:b+1;continue}const l=t[a+1]==="/",c=fee(t,a);if(c===-1){s.push(t.slice(a));break}const u=t.slice(a+(l?2:1),c),d=(()=>{let b=0;for(;b<u.length&&!/[\s/>]/.test(u[b]);)b++;return b})(),h=u.slice(0,d).toLowerCase();if(!h){s.push(t.slice(a,c+1)),n=c+1;continue}if(o(),l){let b=r;for(;b&&b!==e&&b.tag!==h;)b=b.parent;b&&b!==e&&b.tag===h&&(r=b.parent||e),n=c+1;continue}const{attrs:m,selfClosing:f}=hee(u.slice(d)),v=dee[h];v&&r!==e&&v.has(r.tag)&&(r=r.parent||e);const p=s2(h,m);if(p.selfClosing=dM.has(h)||f,gy(r,p),uee.has(h)&&!p.selfClosing){const b=t.toLowerCase().indexOf(`</${h}`,c+1),x=b===-1?t.slice(c+1):t.slice(c+1,b);if(x&&gy(p,i2(x)),b===-1)n=t.length;else{const y=t.indexOf(">",b);n=y===-1?t.length:y+1}continue}p.selfClosing||(r=p),n=c+1}return o(),e}function fee(t,e){let r="";for(let n=e+1;n<t.length;n++){const s=t[n];if(r){s===r&&(r="");continue}if(s==='"'||s==="'"){r=s;continue}if(s===">")return n}return-1}function fM(t){return!!t&&t.type==="element"}function nu(t){return t.children.filter(fM)}function mM(t,e){for(const r of t.children)fM(r)&&(e(r),mM(r,e))}function pM(t,e){const r=[];return mM(t,n=>{e(n)&&r.push(n)}),r}function o2(t,e){return pM(t,e)[0]||null}function gM(t,...e){const r=new Set(e.map(n=>n.toLowerCase()));return pM(t,n=>r.has(n.tag))}function vM(t){return(t.attrs.class||"").split(/\s+/).filter(Boolean)}function Yn(t,e){const r=e.toLowerCase();return vM(t).some(n=>n.toLowerCase().includes(r))||(t.attrs.id||"").toLowerCase().includes(r)}function mee(t,e){const r=t.attrs.style||"";for(const n of r.split(";")){const s=n.indexOf(":");if(s!==-1&&n.slice(0,s).trim().toLowerCase()===e.toLowerCase())return n.slice(s+1).trim()}return""}function xM(t){return t.type==="text"?t.value:t.children.map(xM).join("")}function pee(t){const e=t.trim();if(!e||e==="*")return{tag:null,classes:[],id:null};if(/[:\[]/.test(e))return null;const r=e;if(!r)return null;const n=[];let s=null,o=null,a="",l="tag";const c=()=>{a&&(l==="class"?n.push(a.toLowerCase()):l==="id"?o=a.toLowerCase():s=a.toLowerCase(),a="")};for(const u of r){if(u==="."){c(),l="class";continue}if(u==="#"){c(),l="id";continue}a+=u}return c(),!s&&!n.length&&!o?null:{tag:s,classes:n,id:o}}function gee(t){const e=t.replace(/\s*[>+~]\s*/g," ").trim().split(/\s+/),r=[];for(const s of e){const o=pee(s);if(!o)return null;r.push(o)}if(!r.length)return null;const n=r.reduce((s,o)=>s+(o.id?100:0)+o.classes.length*10+(o.tag?1:0),0);return{parts:r,specificity:n}}function vee(t){const e={};for(const r of t.split(";")){const n=r.indexOf(":");if(n===-1)continue;const s=r.slice(0,n).trim().toLowerCase(),o=r.slice(n+1).trim();
716s&&o&&(e[s]=o.replace(/\s*!important\s*$/i,""))}return e}function xee(t){const e=[],r={};if(!t)return{rules:e,variables:r};const n=t.replace(/\/\*[\s\S]*?\*\//g,"");let s=0,o=0;for(;s<n.length;){const a=n.indexOf("{",s);if(a===-1)break;const l=n.slice(s,a).trim();let c=1,u=a+1;for(;u<n.length&&c>0;)n[u]==="{"?c++:n[u]==="}"&&c--,u++;const d=n.slice(a+1,u-1);if(s=u,l.startsWith("@"))continue;const h=vee(d);if(Object.keys(h).length){if(l.split(",").some(m=>[":root","html","body"].includes(m.trim().toLowerCase())))for(const[m,f]of Object.entries(h))m.startsWith("--")&&(r[m]=f);for(const m of l.split(",")){const f=gee(m);f&&e.push({...f,order:o++,declarations:h})}}}return{rules:e,variables:r}}function a2(t,e){if(e.tag&&t.tag!==e.tag||e.id&&(t.attrs.id||"").toLowerCase()!==e.id)return!1;if(e.classes.length){const r=vM(t).map(n=>n.toLowerCase());if(!e.classes.every(n=>r.includes(n)))return!1}return!0}function yee(t,e){const r=e.parts[e.parts.length-1];if(!a2(t,r))return!1;let n=e.parts.slice(0,-1),s=t.parent;for(;n.length&&s;)a2(s,n[n.length-1])&&(n=n.slice(0,-1)),s=s.parent;return n.length===0}function bee(t,e,r){if(!r)return"";const n=e.toLowerCase();let s=null;for(const o of r.rules)o.declarations[n]!==void 0&&yee(t,o)&&(!s||o.specificity>s.specificity||o.specificity===s.specificity&&o.order>s.order)&&(s=o);return s?s.declarations[n]:""}function Mh(t){const e=t.replace("#","");if(e.length<6)return!1;const r=parseInt(e.slice(0,2),16),n=parseInt(e.slice(2,4),16),s=parseInt(e.slice(4,6),16);return(r*299+n*587+s*114)/1e3<128}function wee(t){var a;const e=String(t||"").trim().replace(/\s*!important\s*$/i,"");if(!e||/^(transparent|none|inherit|initial|unset|currentcolor)$/i.test(e))return null;const r=(a=e.match(/^#([0-9a-f]{3})$/i))==null?void 0:a[1];if(r)return r.split("").map(l=>parseInt(`${l}${l}`,16));const n=e.match(/^#([0-9a-f]{6})([0-9a-f]{2})?$/i);if(n)return n[2]&&parseInt(n[2],16)<250?null:[0,2,4].map(l=>parseInt(n[1].slice(l,l+2),16));const s=e.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+)%?)?\s*\)$/i);if(!s)return null;const o=s[4]===void 0?1:Number(s[4])/(e.includes("%")?100:1);return!Number.isFinite(o)||o<.98?null:[Number(s[1]),Number(s[2]),Number(s[3])].map(l=>Math.max(0,Math.min(255,l)))}function l2(t){const e=wee(t);if(!e)return null;const r=e.map(n=>{const s=n/255;return s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4)});return .2126*r[0]+.7152*r[1]+.0722*r[2]}function _ee(t,e){const r=l2(t),n=l2(e);if(r===null||n===null)return null;const s=Math.max(r,n),o=Math.min(r,n);return(s+.05)/(o+.05)}const jee=["single-centered","split-left-right","columns-2","columns-3","columns-4","stacked"];function kee(t){return typeof t=="string"&&jee.includes(t)}const c2="fse-footer-layout-";function See(t){const e=hM(t||"");return o2(e,n=>n.tag==="footer")||o2(e,n=>Yn(n,"footer"))||e}function Nee(t){const e=t?xee(t):null;return(r,n)=>(mee(r,n)||bee(r,n,e)).trim().toLowerCase()}function Cee(t,e){const r=e(t,"width").replace(/\s+/g,"");return r==="50%"||r.includes("calc(50%")||e(t,"flex-basis").replace(/\s+/g,"")==="50%"?!0:Yn(t,"col_half")||Yn(t,"col-half")||Yn(t,"half")||Yn(t,"col-md-6")||Yn(t,"col-sm-6")}function Eee(t,e){return e(t,"text-align")==="right"||e(t,"float")==="right"?!0:Yn(t,"tright")||Yn(t,"fright")||Yn(t,"text-right")||Yn(t,"align-right")||Yn(t,"text-end")||Yn(t,"pull-right")}function yM(t){const e=t.trim();if(!e)return 0;const r=e.match(/repeat\(\s*(\d+)/);if(r)return Number.parseInt(r[1],10);const n=e.split(/\s+/).filter(s=>s&&s!=="none");return n.length>1?n.length:0}function Pee(t){let e=t;for(let r=0;r<4;r++){const n=nu(e).filter(s=>s.tag!=="style"&&s.tag!=="script");if(n.length!==1||nu(n[0]).length===0)break;e=n[0]}return e}function bM(t){return nu(t).filter(e=>e.tag==="style"||e.tag==="script"||e.tag==="br"||e.tag==="hr"?!1:xM(e).trim().length>0||gM(e,"img").length>0)}function Tee(t,e){const r=[...nu(t)];let n=0;for(let s=0;s<r.length&&s<200;s++){const o=r[s];if(o.tag==="style"||o.tag==="script")continue;const a=yM(e(o,"grid-template-columns"));if(a>=2)n=Math.max(n,a);else if(Yn(o,"footer-columns")){const l=bM(o);l.length>=2&&(n=Math.max(n,l.length))}r.push(...nu(o))}return n}function Aee(t){const e=hM(t||""),r=[e,...gM(e,"footer"),...nu(e)];for(const n of r){const s=(n.attrs.class||"").split(/\s+/);for(const o of s){if(!o.startsWith(c2))continue;const a=o.slice(c2.length);if(kee(a))return a}}return null}function Ree(t,e){if(!t||!t.trim())return"stacked";const r=See(t),n=Nee(e),s=Pee(r),o=bM(s);if(o.length===0)return n(s,"text-align")==="center"||n(r,"text-align")==="center"?"single-centered":"stacked";
716const a=n(s,"justify-content"),l=n(s,"display"),c=yM(n(s,"grid-template-columns")),u=o.filter(m=>Cee(m,n)),d=o.filter(m=>Eee(m,n));if(o.length===2&&(u.length===2||d.length===1||l.includes("flex")&&(a==="space-between"||a==="space-around"))||o.length>2&&d.length===1&&u.length===2)return"split-left-right";const h=c||(l.includes("flex")&&o.length>1?o.length:0)||Tee(s,n);if(h>=4)return"columns-4";if(h===3)return"columns-3";if(h===2)return"columns-2";if(o.length===1){const m=o[0];return n(m,"text-align")==="center"||n(s,"text-align")==="center"||n(r,"text-align")==="center"?"single-centered":"stacked"}return n(s,"text-align")==="center"||n(r,"text-align")==="center"?"single-centered":"stacked"}function Iee(t,e){return Aee(t)||Ree(t,e)}function Oee(t,e=".fse-footer"){const r=(Array.isArray(e)?e:[e]).map(l=>l.trim()).filter(Boolean),n=[{suffix:" .fse-footer-columns",skipWhen:[]},{suffix:" .fse-footer-inner",skipWhen:[".fse-footer-columns"]},{suffix:" .footer-inner",skipWhen:[".fse-footer-columns",".fse-footer-inner"]},{suffix:" > .container",skipWhen:[".fse-footer-columns",".fse-footer-inner",".footer-inner"]},{suffix:" > div:only-child > div",skipWhen:[".fse-footer-columns",".fse-footer-inner",".footer-inner",".container"]},{suffix:" > div",skipWhen:[".fse-footer-columns",".fse-footer-inner",".footer-inner",".container"]}],s=r.flatMap(l=>n.map(({suffix:c,skipWhen:u})=>{const d=u.length?`:not(:has(${u.join(", ")}))`:"";return`${l}${d}${c}${c===" > div"||c===" > div:only-child > div"?":not(:has(.fse-footer-columns, .fse-footer-inner, .footer-inner, .container))":""}`})).join(", "),o=r.map(l=>`${l} .fse-footer-bottom`).join(", "),a={"single-centered":`${s} { text-align: center; }
717${o} { text-align: center; }`,"split-left-right":`${s} {
718  display: flex;
719  flex-direction: row;
720  flex-wrap: wrap;
721  justify-content: space-between;
722  align-items: center;
723  gap: 1rem;
724  text-align: left;
725}
726${s} > * { flex: 1 1 45%; min-width: 240px; }
727${s} > *:last-child { text-align: right; }
728@media (max-width: 781px) {
729  ${s} { flex-direction: column; align-items: flex-start; }
730  ${s} > *, ${s} > *:last-child { text-align: left; width: 100%; }
731}`,"columns-2":vy(s,2),"columns-3":vy(s,3),"columns-4":vy(s,4),stacked:`${s} { text-align: left; }`};return`/* PressMeGPT footer archetype: ${t} */
732${a[t]}
733`}function vy(t,e){return`${t} {
734  display: grid;
735  grid-template-columns: repeat(${e}, minmax(0, 1fr));
736  gap: 2rem;
737  align-items: start;
738  text-align: left;
739}
740@media (max-width: 781px) {
741  ${t} { grid-template-columns: 1fr; }
742}`}const Mee=[".fse-footer","footer"],wM=["logo-left-menu-right","logo-right-menu-left","logo-center-menu-below","logo-center-menu-split"],_M={"logo-left-menu-right":"Logo left, menu right","logo-right-menu-left":"Logo right, menu left","logo-center-menu-below":"Centered logo, menu below","logo-center-menu-split":"Centered logo, split menu"},$ee=80,Dee=40,Fee=160,Lee="/* Theme Designer - Header Layout */",Bee="/* End Theme Designer - Header Layout */",dg="fse-layout-",hg="fse-header-sticky",fg="fse-header-static",zee="/* Theme Designer - Sticky Header */",Uee="/* End Theme Designer - Sticky Header */";function Wee(t){return wM.includes(t)}function Pv(t){return t.body.querySelector("header")||t.body.querySelector(".fse-header")||t.body.querySelector('[class*="header"]')}function jM(t){if(!t||typeof DOMParser>"u")return{archetype:null,logoHeight:null};const e=new DOMParser().parseFromString(t,"text/html"),r=Pv(e);if(!r)return{archetype:null,logoHeight:null};let n=null;r.classList.forEach(a=>{if(!a.startsWith(dg))return;const l=a.slice(dg.length);Wee(l)&&(n=l)});const s=r.getAttribute("data-logo-height"),o=s&&Number.isFinite(Number.parseInt(s,10))?Number.parseInt(s,10):null;return{archetype:n,logoHeight:o}}function Hee(t,e=""){var a,l;if(!t||typeof DOMParser>"u")return!1;const r=new DOMParser().parseFromString(t,"text/html"),n=Pv(r);if(!n)return!1;if(n.classList.contains(hg))return!0;if(n.classList.contains(fg))return!1;const s=(((a=n.style)==null?void 0:a.getPropertyValue("position"))||"").trim().toLowerCase();if(s==="sticky"||s==="fixed")return!0;const o=kM(e);for(const c of Array.from(n.classList)){const u=(((l=o.get(c.toLowerCase()))==null?void 0:l.position)||"").trim().toLowerCase();if(u==="sticky"||u==="fixed")return!0}return Array.from(n.classList).some(c=>/sticky|fixed-header/i.test(c))}function Gee(t){return t?`.${hg} {
743  position: sticky !important;
744  top: 0;
745  z-index: 999;
746  background: var(--td-color-header-bg, #ffffff);
747}`:`/* Header is static (${fg}) */`}function kM(t){const e=new Map;if(!t)return e;const r=t.replace(/\/\*[\s\S]*?\*\//g,"");let n=0;for(;n<r.length;){const s=r.indexOf("{",n);if(s===-1)break;const o=r.slice(n,s).trim();let a=1,l=s+1;for(;l<r.length&&a>0;)r[l]==="{"?a++:r[l]==="}"&&a--,l++;const c=r.slice(s+1,l-1);if(n=l,!o.startsWith("@"))for(const u of o.split(",")){const d=u.trim();if(!/^[a-z]*\.[a-zA-Z0-9_-]+$/.test(d))continue;const h=d.slice(d.indexOf(".")+1).toLowerCase(),m=e.get(h)||{};for(const f of c.split(";")){const v=f.indexOf(":");v!==-1&&(m[f.slice(0,v).trim().toLowerCase()]=f.slice(v+1).trim())}e.set(h,m)}}return e}function SM(t,e){if(!t||typeof DOMParser>"u")return null;const r=new DOMParser().parseFromString(t,"text/html"),n=Pv(r);if(!n)return null;const s=n.querySelector('nav, [role="navigation"]'),o=n.querySelector("img");if(!s||!o)return null;const a=kM(e),l=(x,y)=>{var j,_;if(!x)return"";const w=((j=x.style)==null?void 0:j.getPropertyValue(y))||"";if(w)return w.trim().toLowerCase();for(const S of Array.from(x.classList).reverse()){const N=(_=a.get(S.toLowerCase()))==null?void 0:_[y];if(N)return N.trim().toLowerCase()}return""};let c=o.parentElement;for(;
747c&&!c.contains(s);)c=c.parentElement;if(!c)return null;const u=x=>{let y=x;for(;y&&y.parentElement&&y.parentElement!==c;)y=y.parentElement;return(y==null?void 0:y.parentElement)===c?y:null},d=u(o),h=u(s),m=Array.from(c.children),f=d?m.indexOf(d):-1,v=h?m.indexOf(h):-1;if(l(c,"flex-direction").startsWith("column")||f!==-1&&f===v)return"logo-center-menu-below";const p=["text-align","justify-content","align-items"].some(x=>l(c,x)==="center"),b=Number.parseFloat(l(h,"margin-top")||"0")>0||l(h,"width")==="100%";return p&&b&&v>f?"logo-center-menu-below":f!==-1&&v!==-1&&v<f?"logo-right-menu-left":"logo-left-menu-right"}function qee(t,e,r,n){if(!t||typeof DOMParser>"u")return t;const s=new DOMParser().parseFromString(t,"text/html"),o=Pv(s);return o?([...o.classList].forEach(a=>{a.startsWith(dg)&&o.classList.remove(a)}),o.classList.add("fse-header-archetype"),o.classList.add(`${dg}${e}`),o.setAttribute("data-logo-height",String(r)),typeof n=="boolean"&&(o.classList.remove(hg,fg),o.classList.add(n?hg:fg)),/<html[\s>]/i.test(t)?`<!DOCTYPE html>${s.documentElement.outerHTML}`:s.body.innerHTML):t}function Vee(t,e){const r=".fse-header-archetype",n=`${r} .fse-header-inner, ${r} .header-inner, ${r} > div`,s=`${r} nav, ${r} .fse-main-nav, ${r} .main-navigation`,o=`${r} .fse-logo img, ${r} .site-logo img, ${r} .logo img, ${r} img.logo, ${r} .custom-logo`,a=Math.max(40,Math.round(e*.7)),l={"logo-left-menu-right":`${n} { display: flex; flex-direction: row; justify-content: space-between; align-items: center; }`,"logo-right-menu-left":`${n} { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: center; }`,"logo-center-menu-below":`${n} { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.75rem; }
748${s} { justify-content: center; }`,"logo-center-menu-split":`${n} { display: flex; flex-direction: row; justify-content: center; align-items: center; gap: 1.5rem; }
749${s} { flex: 1 1 0; justify-content: center; }`};return`${o} {
750  height: auto;
751  width: auto;
752  max-height: ${e}px;
753  max-width: min(320px, 60vw);
754  object-fit: contain;
755}
756@media (max-width: 781px) {
757  ${o} { max-height: ${a}px; }
758}
759${l[t]}`}const Kee=`
760/* PressMeGPT interactive widgets (quiz / tabs / toggle / filter) */
761[data-pmgpt-quiz] [data-pmgpt-quiz-result] { display: none; }
762[data-pmgpt-quiz][data-pmgpt-ready] [data-pmgpt-quiz-step] { display: none; }
763[data-pmgpt-quiz][data-pmgpt-ready] [data-pmgpt-quiz-step].is-active,
764[data-pmgpt-quiz][data-pmgpt-ready] [data-pmgpt-quiz-result].is-active { display: block; }
765[data-pmgpt-quiz][data-pmgpt-ready] [data-pmgpt-quiz-restart] { display: none; }
766[data-pmgpt-quiz][data-pmgpt-ready].is-complete [data-pmgpt-quiz-restart] { display: inline-flex; }
767[data-pmgpt-quiz-option] { cursor: pointer; }
768[data-pmgpt-quiz-option].is-selected { outline: 2px solid currentColor; outline-offset: 2px; }
769[data-pmgpt-quiz-progress] { display: block; }
770
771[data-pmgpt-tabs][data-pmgpt-ready] [data-pmgpt-panel] { display: none; }
772[data-pmgpt-tabs][data-pmgpt-ready] [data-pmgpt-panel].is-active { display: block; }
773[data-pmgpt-tab] { cursor: pointer; }
774
775[data-pmgpt-toggle] { cursor: pointer; }
776[data-pmgpt-toggle-target].is-hidden { display: none; }
777
778[data-pmgpt-filter-btn] { cursor: pointer; }
779[data-pmgpt-filter-item].is-hidden { display: none; }
780`,Yee=`/**
781 * File interactive.js
782 *
783 * PressMeGPT interactive widgets. Driven entirely by data attributes in the
784 * page markup so it survives Classic, Gutenberg and Elementor exports.
785 */
786(function () {
787  function all(root, selector) {
788    return Array.prototype.slice.call(root.querySelectorAll(selector));
789  }
790
791  function owns(container, el, selector) {
792    var parent = el.closest(selector);
793    return parent === container;
794  }
795
796  function initQuiz(quiz) {
797    if (quiz.dataset.pmgptReady === '1') return;
798    var steps = all(quiz, '[data-pmgpt-quiz-step]').filter(function (el) {
799      return owns(quiz, el, '[data-pmgpt-quiz]');
800    });
801    var results = all(quiz, '[data-pmgpt-quiz-result]').filter(function (el) {
802      return owns(quiz, el, '[data-pmgpt-quiz]');
803    });
804    if (steps.length === 0 || results.length === 0) return;
805
806    quiz.dataset.pmgptReady = '1';
807    quiz.setAttribute('data-pmgpt-ready', '');
808
809    var answers = [];
810    var index = 0;
811    var progress = quiz.querySelector('[data-pmgpt-quiz-progress]');
812
813    function paint() {
814      steps.forEach(function (step, i) {
815        step.classList.toggle('is-active', i === index && index < steps.length);
816      });
817      results.forEach(function (result) { result.classList.remove('is-active'); });
818      quiz.classList.remove('is-complete');
819      if (progress) {
820        progress.textContent = 'Question ' + Math.min(index + 1, steps.length) + ' of ' + steps.length;
821        progress.style.display = '';
822      }
823    }
824
825    function finish() {
826      var tally = {};
827      answers.forEach(function (value) {
828        if (!value) return;
829        tally[value] = (tally[value] || 0) + 1;
830      });
831      var winner = null;
832      var best = -1;
833      Object.keys(tally).forEach(function (key) {
834        if (tally[key] > best) { best = tally[key]; winner = key; }
835      });
836      var match = results.filter(function (result) {
837        return result.getAttribute('data-pmgpt-quiz-result') === winner;
838      })[0] || results[0];
839      steps.forEach(function (step) { step.classList.remove('is-active'); });
840      results.forEach(function (result) { result.classList.remove('is-active'); });
841      match.classList.add('is-active');
842      quiz.classList.add('is-complete');
843      if (progress) { progress.style.display = 'none'; }
844      if (typeof match.scrollIntoView === 'function') {
845        match.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
846      }
847    }
848
849    all(quiz, '[data-pmgpt-quiz-option]').forEach(function (option) {
850      option.addEventListener('click', function (event) {
851        event.preventDefault();
852        var step = option.closest('[data-pmgpt-quiz-step]');
853        var stepIndex = steps.indexOf(step);
854        if (stepIndex < 0) return;
855        all(step, '[data-pmgpt-quiz-option]').forEach(function (sibling) {
856          sibling.classList.remove('is-selected');
857        });
858        option.classList.add('is-selected');
859        answers[stepIndex] = option.getAttribute('data-pmgpt-quiz-option') || '';
860        index = stepIndex + 1;
861        if (index >= steps.length) { finish(); } else { paint(); }
862      });
863    });
864
865    all(quiz, '[data-pmgpt-quiz-back]').forEach(function (back) {
866      back.addEventListener('click', function (event) {
867        event.preventDefault();
868        if (index > 0) { index -= 1; paint(); }
869      });
870    });
871
872    all(quiz, '[data-pmgpt-quiz-restart]').forEach(function (restart) {
873      restart.addEventListener('click', function (event) {
874        event.preventDefault();
875        answers = [];
876        index = 0;
877        all(quiz, '[data-pmgpt-quiz-option].is-selected').forEach(function (option) {
878          option.classList.remove('is-selected');
879        });
880        paint();
881      });
882    });
883
884    paint();
885  }
886
887  function initTabs(tabs) {
888    if (tabs.dataset.pmgptReady === '1') return;
889    var buttons = all(tabs, '[data-pmgpt-tab]');
890    var panels = all(tabs, '[data-pmgpt-panel]');
891    if (buttons.length === 0 || panels.length === 0) return;
892    tabs.dataset.pmgptReady = '1';
893    tabs.setAttribute('data-pmgpt-ready', '');
894
895    function select(name) {
896      buttons.forEach(function (button) {
897        button.classList.toggle('is-active', button.getAttribute('data-pmgpt-tab') === name);
898      });
899      panels.forEach(function (panel) {
900        panel.classList.toggle('is-active', panel.getAttribute('data-pmgpt-panel') === name);
901      });
902    }
903
904    buttons.forEach(function (button) {
905      button.addEventListener('click', function (event) {
906        event.preventDefault();
907        select(button.getAttribute('data-pmgpt-tab'));
908      });
909    });
910
911    select(buttons[0].getAttribute('data-pmgpt-tab'));
912  }
913
914  function initToggle(trigger) {
915    if (trigger.dataset.pmgptReady === '1') return;
916    var name = trigger.getAttribute('data-pmgpt-toggle');
917    if (!name) return;
918    trigger.dataset.pmgptReady = '1';
919    var targets = all(document, '[data-pmgpt-toggle-target="' + name + '"]');
920    targets.forEach(function (target) { target.classList.add('is-hidden'); });
921    trigger.addEventListener('click', function (event) {
922      event.preventDefault();
923      targets.forEach(function (target) { target.classList.toggle('is-hidden'); });
924      trigger.classList.toggle('is-active');
925    });
926  }
927
928  function initFilter(group) {
929    if (group.dataset.pmgptReady === '1') return;
930    var buttons = all(group, '[data-pmgpt-filter-btn]');
931    var items = all(group, '[data-pmgpt-filter-item]');
932    if (buttons.length === 0 || items.length === 0) return;
933    group.dataset.pmgptReady = '1';
934
935    function apply(value) {
936      buttons.forEach(function (button) {
937        button.classList.toggle('is-active', button.getAttribute('data-pmgpt-filter-btn') === value);
938      });
939      items.forEach(function (item) {
940        var itemValue = item.getAttribute('data-pmgpt-filter-item') || '';
941        var show = value === 'all' || itemValue === value || itemValue.split(/\\s+/).indexOf(value) >= 0;
942        item.classList.toggle('is-hidden', !show);
943      });
944    }
945
946    buttons.forEach(function (button) {
947      button.addEventListener('click', function (event) {
948        event.preventDefault();
949        apply(button.getAttribute('data-pmgpt-filter-btn'));
950      });
951    });
952
953    apply(buttons[0].getAttribute('data-pmgpt-filter-btn') || 'all');
954  }
955
956  function init() {
957    all(document, '[data-pmgpt-quiz]').forEach(initQuiz);
958    all(document, '[data-pmgpt-tabs]').forEach(initTabs);
959    all(document, '[data-pmgpt-toggle]').forEach(initToggle);
960    all(document, '[data-pmgpt-filter]').forEach(initFilter);
961  }
962
963  if (document.readyState === 'loading') {
964    document.addEventListener('DOMContentLoaded', init);
965  } else {
966    init();
967  }
968})();`,NM=["logo-left-menu-right","logo-right-menu-left","logo-center-menu-below","logo-center-menu-split"],u2="#ffffff",Qee="#111111",Jee="#111111",Xee="#ffffff";function nd(t,e,r){const n=typeof t=="string"?t.trim().toLowerCase():"";return e.includes(n)?n:r}function bn(t){if(typeof t!="string")return"";const e=t.trim().replace(/!important/gi,"").trim();return!e||/^(inherit|currentcolor|initial|unset|transparent|none)$/i.test(e)?"":/^#[0-9a-f]{3}$/i.test(e)?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:/^#[0-9a-f]{6}$/i.test(e)?e.toLowerCase():/^#[0-9a-f]{8}$/i.test(e)?e.slice(0,7).toLowerCase():/^rgba?\(/i.test(e)?Zee(e):""}function Zee(t){const e=t.match(/[\d.]+/g);if(!e||e.length<3)return"";const[r,n,s]=e.slice(0,3).map(a=>Math.max(0,Math.min(255,Math.round(parseFloat(a)))));return(e.length>3?parseFloat(e[3]):1)===0?"":`#${[r,n,s].map(a=>a.toString(16).padStart(2,"0")).join("")}`}function Kw(t,e){const r=bn(t),n=bn(e);return!r||!n?1:_ee(r,n)||1}function xy(t,e,r=3.5){const n=Mh(e)?Xee:Jee;return t&&Kw(t,e)>=r?t:n}function ete(t){const e=typeof t=="string"?t:"";return NM.includes(e)?e:""}function tte(t,e){const r=String(t||""),n=l=>{for(const c of l){const u=r.match(c),d=bn((u==null?void 0:u[1])||"");if(d)return d}return""},s=n([/--td-color-header-bg:\s*([^;]+)/i,/\.fse-header\b[^{]*\{[^}]*\bbackground-color:\s*([^;}\n]+)/i,/\.fse-header\b[^{]*\{[^}
968]*\bbackground:\s*([^;}\n]+)/i,/\bheader\s*\{[^}]*\bbackground-color:\s*([^;}\n]+)/i,/\bheader\s*\{[^}]*\bbackground:\s*([^;}\n]+)/i,/--td-color-background:\s*([^;]+)/i])||bn(e==null?void 0:e.background),o=n([/--td-color-header-text:\s*([^;]+)/i,/\.fse-header\b[^{]*\{[^}]*\bcolor:\s*([^;}\n]+)/i,/\bheader\s*\{[^}]*\bcolor:\s*([^;}\n]+)/i,/--td-color-text:\s*([^;]+)/i])||bn(e==null?void 0:e.text),a=n([/--td-color-primary:\s*([^;]+)/i])||bn(e==null?void 0:e.accent);return{background:s,text:o,accent:a,font:e==null?void 0:e.font}}function rte(t,e,r){const n={},s=e||{},o=bn(n.barBackground)||bn(s.background)||u2,a=["light","dark"].includes(String(n.scheme||"").toLowerCase())?String(n.scheme).toLowerCase():Mh(o)?"dark":"light",l=xy(bn(n.barText)||bn(s.text),o),c=xy(bn(n.barTextHover)||bn(s.accent)||l,o,2.5),u=bn(n.drawerBackground)||(a==="dark"?Qee:u2),d=xy(bn(n.drawerText)||l,u),h=bn(n.drawerDivider)||(Mh(u)?"#ffffff26":"#00000014"),f=Number(n.breakpoint)===768?768:1024;return{placement:ete(r)||nd(n.placement,NM,"logo-left-menu-right"),menuAlign:nd(n.menuAlign,["center","left","right"],"center"),scheme:a,barBackground:o,barText:l,barTextHover:c,drawerBackground:u,drawerText:d,drawerDivider:h,breakpoint:f,linkFont:typeof n.linkFont=="string"&&n.linkFont.trim()||s.font||"inherit",linkSize:yy(n.linkSize,"15px"),linkWeight:/^(?:[1-9]00|normal|bold|bolder|lighter)$/i.test(String(n.linkWeight||""))?String(n.linkWeight):"500",linkTransform:nd(n.linkTransform,["none","uppercase","capitalize","lowercase"],"none"),linkGap:yy(n.linkGap,"24px"),toggleIcon:nd(n.toggleIcon,["bars","dots","plus"],"bars"),toggleSize:yy(n.toggleSize,"24px"),activeStyle:nd(n.activeStyle,["underline","color","pill","none"],"underline")}}function yy(t,e){const r=String(t??"").trim();return/^\d+(?:\.\d+)?(px|rem|em)$/i.test(r)?r:/^\d+(?:\.\d+)?$/.test(r)?`${r}px`:e}const nte='<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M5 5l14 14M19 5L5 19" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>';function d2(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ste(t,e=""){const r=t.map(s=>`<a class="pmgpt-menu-link" href="${d2(s.href)}">${d2(s.text)}</a>`).join(""),n=e?`<div class="pmgpt-menu-actions">${e}</div>`:"";return`
969<div class="pmgpt-menu-backdrop" id="pmgpt-menu-backdrop" hidden></div>
970<div class="pmgpt-menu-panel" id="pmgpt-menu-panel" role="dialog" aria-modal="true" aria-label="Menu">
971  <div class="pmgpt-menu-panel-head">
972    <button type="button" class="pmgpt-menu-close" id="pmgpt-menu-close" aria-label="Close menu">${nte}</button>
973  </div>
974  <nav class="pmgpt-menu-links" aria-label="Mobile">${r}</nav>
975  ${n}
976</div>`}function ite(t,e=""){const r=e?`${e} `:"",n=t.breakpoint,s=t.placement==="logo-center-menu-below",o=t.placement==="logo-center-menu-split",a=t.placement==="logo-right-menu-left",l=s||o?"center":"space-between",c=s?"column":a?"row-reverse":"row",u=s||o?t.menuAlign==="left"?"flex-start":t.menuAlign==="right"?"flex-end":"center":a?"flex-start":"flex-end",d=Kw(t.barText,t.barBackground)<3?`filter:drop-shadow(0 0 1px ${Mh(t.barText)?"#ffffff":"#000000"})!important;`:"",h=Kw(t.drawerText,t.drawerBackground)<3?`filter:drop-shadow(0 0 1px ${Mh(t.drawerText)?"#ffffff":"#000000"})!important;`:"",m=t.activeStyle==="underline"?`${r}.fse-main-nav a:hover,${r}.fse-main-nav a.current-menu-item,${r}.fse-main-nav .current-menu-item > a{color:${t.barTextHover};text-decoration:underline;text-underline-offset:4px;}`:t.activeStyle==="color"?`${r}.fse-main-nav a:hover,${r}.fse-main-nav a.current-menu-item,${r}.fse-main-nav .current-menu-item > a{color:${t.barTextHover};}`:t.activeStyle==="pill"?`${r}.fse-main-nav a:hover,${r}.fse-main-nav a.current-menu-item,${r}.fse-main-nav .current-menu-item > a{color:${t.barTextHover};background:${t.barTextHover}1a;border-radius:999px;padding:6px 12px;}`:"";return`/* PressMeGPT canonical menu — placement:${t.placement} scheme:${t.scheme} */
977${r}.fse-header-content,${r}.fse-header-inner{display:flex!important;align-items:center!important;justify-content:${l}!important;flex-direction:${c}!important;flex-wrap:nowrap!important;}
978${r}.fse-header-left{display:flex!important;align-items:center!important;flex:0 1 auto!important;min-width:0!important;}
979${r}.fse-header-right{display:flex!important;align-items:center!important;justify-content:${s||o?"center":"flex-end"}!important;flex:0 0 auto!important;gap:10px;${s||o?"":"margin-left:auto!important;"}${s?"margin-top:12px!important;width:100%!important;":""}}
980${r}.fse-main-nav{display:none;align-items:center;justify-content:${u};}
981${r}.fse-main-nav ul{list-style:none!important;margin:0!important;padding:0!important;display:flex!important;align-items:center!important;flex-wrap:nowrap!important;gap:${t.linkGap};}
982${r}.fse-main-nav li{list-style:none!important;margin:0!important;}
983${r}.fse-main-nav a{text-decoration:none;color:${t.barText};font-family:${t.linkFont};font-size:${t.linkSize};font-weight:${t.linkWeight};text-transform:${t.linkTransform};white-space:nowrap;}
984${m}
985/* Hamburger — always first in the actions cluster, always contrast-checked.
986   Stroke AND fill are driven from the token, and a low-contrast fallback adds a
987   halo so the icon can never disappear into the bar. */
988${r}.fse-toggle-button,${r}#pmgpt-menu-toggle{order:-1!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;background:none!important;border:none!important;box-shadow:none!important;padding:0!important;margin:0 4px 0 0!important;min-width:44px!important;min-height:44px!important;cursor:pointer;color:${t.barText}!important;opacity:1!important;visibility:visible!important;}
989${r}.fse-toggle-button svg,${r}#pmgpt-menu-toggle svg{width:${t.toggleSize}!important;height:${t.toggleSize}!important;min-width:24px;min-height:24px;stroke:currentColor!important;color:${t.barText}!important;opacity:1!important;display:inline-block!important;${d}}
990${r}.fse-toggle-button svg [stroke]:not([stroke="none"]),${r}#pmgpt-menu-toggle svg [stroke]:not([stroke="none"]){stroke:currentColor!important;}
991${r}.fse-toggle-button svg [fill]:not([fill="none"]),${r}#pmgpt-menu-toggle svg [fill]:not([fill="none"]){fill:currentColor!important;}
992
993/* Search never ships */
994${r}form[role="search"],${r}input[type="search"],${r}
994.fse-search{display:none!important;}
995@media(min-width:${n}px){
996  ${r}.fse-main-nav{display:flex!important;}
997  ${r}.fse-toggle-button,${r}#pmgpt-menu-toggle{display:none!important;}
998}
999/* Drawer — id-scoped so design CSS cannot reshape it */
1000#pmgpt-menu-backdrop{position:fixed!important;inset:0!important;z-index:99998!important;background:rgba(0,0,0,.5);opacity:0;visibility:hidden;transition:opacity .25s,visibility .25s;}
1001#pmgpt-menu-backdrop.open{opacity:1;visibility:visible;}
1002#pmgpt-menu-panel{position:fixed!important;top:0!important;right:0!important;bottom:0!important;left:auto!important;width:300px!important;max-width:86vw!important;z-index:99999!important;display:flex!important;flex-direction:column!important;align-items:stretch!important;transform:translateX(100%);transition:transform .25s ease;background:${t.drawerBackground}!important;color:${t.drawerText}!important;box-shadow:-4px 0 24px rgba(0,0,0,.18);overflow-y:auto;}
1003#pmgpt-menu-panel.open{transform:translateX(0);}
1004#pmgpt-menu-panel .pmgpt-menu-panel-head{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:flex-end!important;width:100%!important;padding:12px 16px!important;border-bottom:1px solid ${t.drawerDivider};}
1005#pmgpt-menu-close{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:44px!important;min-height:44px!important;background:none!important;border:none!important;padding:0!important;cursor:pointer;color:${t.drawerText}!important;opacity:1!important;visibility:visible!important;}
1006#pmgpt-menu-close svg{width:24px!important;height:24px!important;stroke:currentColor!important;color:${t.drawerText}!important;opacity:1!important;display:inline-block!important;${h}}
1007#pmgpt-menu-close svg [stroke]:not([stroke="none"]){stroke:currentColor!important;}
1008#pmgpt-menu-close svg [fill]:not([fill="none"]){fill:currentColor!important;}
1009#pmgpt-menu-panel .pmgpt-menu-links{display:flex!important;flex-direction:column!important;align-items:stretch!important;width:100%!important;padding:8px 0!important;}
1010#pmgpt-menu-panel .pmgpt-menu-link{display:block!important;width:100%!important;box-sizing:border-box!important;padding:14px 20px!important;text-align:left!important;text-decoration:none!important;color:${t.drawerText}!important;font-family:${t.linkFont};font-size:16px;font-weight:${t.linkWeight};text-transform:${t.linkTransform};border-bottom:1px solid ${t.drawerDivider};}
1011#pmgpt-menu-panel .pmgpt-menu-actions{display:flex!important;flex-direction:row!important;flex-wrap:wrap!important;align-items:center!important;gap:12px;padding:16px 20px!important;border-top:1px solid ${t.drawerDivider};}
1012#pmgpt-menu-panel .pmgpt-menu-actions a,#pmgpt-menu-panel .pmgpt-menu-actions button{color:${t.drawerText};}
1013#pmgpt-menu-panel .pmgpt-menu-actions svg,#pmgpt-menu-panel .pmgpt-menu-actions img,#pmgpt-menu-panel .pmgpt-menu-actions i{width:22px;height:22px;max-width:22px;max-height:22px;}
1014@media(min-width:${n}px){
1015  #pmgpt-menu-backdrop,#pmgpt-menu-panel{display:none!important;}
1016}`}function ote(){return`(function(){
1017  function init(){
1018    var toggle=document.getElementById('pmgpt-menu-toggle')||document.querySelector('.f
1018se-toggle-button,.pmgpt-menu-toggle,[aria-label="Menu"]');
1019    var panel=document.getElementById('pmgpt-menu-panel');
1020    var backdrop=document.getElementById('pmgpt-menu-backdrop');
1021    var closeBtn=document.getElementById('pmgpt-menu-close');
1022    if(!toggle||!panel||!backdrop) return;
1023    if(panel.getAttribute('data-pmgpt-menu-bound')==='1') return;
1024    panel.setAttribute('data-pmgpt-menu-bound','1');
1025    function focusables(){return panel.querySelectorAll('a[href],button:not([disabled]),[tabindex]:not([tabindex="-1"])');}
1026    function open(){
1027      backdrop.hidden=false;backdrop.classList.add('open');panel.classList.add('open');
1028      toggle.setAttribute('aria-expanded','true');document.documentElement.style.overflow='hidden';
1029      var f=focusables();if(f.length)f[0].focus();
1030    }
1031    function close(){
1032      backdrop.classList.remove('open');panel.classList.remove('open');
1033      toggle.setAttribute('aria-expanded','false');document.documentElement.style.overflow='';
1034      window.setTimeout(function(){if(!panel.classList.contains('open'))backdrop.hidden=true;},250);
1035      if(toggle.focus)toggle.focus();
1036    }
1037    function toggleMenu(e){if(e){e.preventDefault();e.stopPropagation();}panel.classList.contains('open')?close():open();}
1038    toggle.addEventListener('click',toggleMenu);
1039    toggle.addEventListener('keydown',function(e){if(e.key==='Enter'||e.key===' ')toggleMenu(e);});
1040    if(closeBtn)closeBtn.addEventListener('click',close);
1041    backdrop.addEventListener('click',close);
1042    document.addEventListener('keydown',function(e){
1043      if(!panel.classList.contains('open'))return;
1044      if(e.key==='Escape'){close();return;}
1045      if(e.key!=='Tab')return;
1046      var f=focusables();if(!f.length)return;
1047      var first=f[0],last=f[f.length-1];
1048      if(e.shiftKey&&document.activeElement===first){e.preventDefault();last.focus();}
1049      else if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first.focus();}
1050    });
1051    panel.addEventListener('click',function(e){var t=e.target;if(t&&t.closest&&t.closest('a'))close();});
1052  }
1053  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1054})();`}function ate(t){return tte(t)}const wl=g.forwardRef(({html:t,css:e,pages:r,showNavigation:n=!1,syncPages:s,navigationConfig:o,activePage:a,onPageChange:l,preserveSourceLayout:c=!1,stylesheetUrls:u=[]},d)=>{const h=g.useRef(null),[m,f]=g.useState("home"),[v,p]=g.useState(0),[b,x]=g.useState("");g.useEffect(()=>{let ae=!0;return MJ().then(E=>{ae&&E&&x(E)}),()=>{ae=!1}},[]);const y=a??m,w=g.useCallback(ae=>{l?l(ae):f(ae)},[l]),_=(ae=>{if(!ae)return[];const E=[],ne=[...ae.matchAll(/--td-font-body:\s*'([^']+)'/gi)],te=[...ae.matchAll(/--td-font-heading:\s*'([^']+)'/gi)],D=[...ae.matchAll(/--td-font-script:\s*'([^']+)'/gi)],M=ne.length>0?ne[ne.length-1][1]:null,V=te.length>0?te[te.length-1][1]:null,me=D.length>0?D[D.length-1][1]:null;return M&&E.push(M),V&&V!==M&&E.push(V),me&&!E.includes(me)&&E.push(me),E})(e),S=_.join("-"),N=ae=>/pacifico|great.?vibes|dancing.?script|satisfy|caveat|sacramento|allura|yellowtail/i.test(ae),P=_.length>0?`https://fonts.googleapis.com/css2?${_.map(ae=>N(ae)?`family=${ae.replace(/ /g,"+")}`:`family=${ae.replace(/ /g,"+")}:wght@400;500;600;700`).join("&")}&display=swap&v=${encodeURIComponent(S)}`:"",C=g.useCallback(()=>{var ae;return y==="home"?t:((ae=r==null?void 0:r[y])==null?void 0:ae.html)||t},[y,t,r]),O=g.useCallback(()=>{w("home")},[w]),F=g.useCallback(()=>{p(ae=>ae+1)},[]);g.useImperativeHandle(d,()=>({goHome:O,refresh:F}));const T=g.useCallback(()=>{const ae=h.current;ae!=null&&ae.contentDocument&&ae.contentDocument.addEventListener("click",E=>{var M;const te=E.target.closest("a");if(!te)return;const D=te.getAttribute("href");if(D){if(E.preventDefault(),E.stopPropagation(),D.startsWith("#")&&D.length>1){const V=(M=ae.contentDocument)==null?void 0:M.querySelector(D);V&&V.scrollIntoView({behavior:"smooth"});return}if(D.startsWith("http://")||D.startsWith("https://")||te.getAttribute("target")==="_blank"){window.open(D,"_blank");return}if(D.endsWith(".html")&&r){const V=D.replace(".html","").replace(/^.*\//,"");r[V]?w(V):(V==="index"||V==="home")&&w("home");return}}},!0)},[r,w]),A=g.useCallback(ae=>{var E;if(((E=ae.data)==null?void 0:E.type)==="navigate-page"){const ne=ae.data.slug;ne==="home"||ne==="index"?w("home"):r!=null&&r[ne]&&w(ne)}},[r,w]);g.useEffect(()=>(window.addEventListener("message",A),()=>window.removeEventListener("message",A)),[A]);const $=(ae=>{if(ae.includes("<!DOCTYPE")||ae.includes("<html")){const E=ae.match(/<body[^>]*>([\s\S]*)<\/body>/i);return E&&E[1]?E[1].trim():ae.replace(/<!DOCTYPE[^>]*>/gi,"").replace(/<\/?html[^>]*>/gi,"").replace(/<head[\s\S]*?<\/head>/gi,"").replace(/<\/?body[^>]*>/gi,"").trim()}return ae})(C()),K=c||/\bfse-copy-preserve\b/i.test($),H=g.useMemo(()=>!s||s.length===0?$:cee($,s),[$,s]),W=e2(H),R=e2(e||""),G=g.useMemo(()=>{const ae=[],E=new Set,ne=(te,D)=>{E.has(D)||(E.add(D),ae.push({title:te,slug:D}))};return s&&s.length>0?(s.forEach(te=>{te.slug&&ne(te.title,te.slug)}),E.has("home")||ae.unshift({title:"Home",slug:"home"})):(ne("Homepage","home"),r&&Object.entries(r).forEach(([te,D])=>{D.isTemplate||ne(D.title||te,te)})),ae},[s,r]),U=g.useMemo(()=>rte(null,ate(e),jM(t||"").archetype||SM(t||"",e||"")||void 0),[e,t]),z=g.useMemo(()=>ite(U),[U]),oe=g.useMemo(()=>ste(G.map(ae=>({href:ae.slug==="home"?"#":`${ae.slug}.html`,text:ae.title}))),[G]),L=`
1055<script>
1056(function() {
1057  var pages = ${JSON.stringify(G)};
1058  var shadowOnScroll = ${JSON.stringify(!!(o!=null&&o.shadowOnScroll))};
1059
1060  // Reveal any scroll-animation elements immediately in the preview so the
1061  // header/footer/sections aren't stuck at opacity:0 on pages that don't
1062  // include the original site's IntersectionObserver script (e.g. new-page
1063  // placeholders while AI generation is running).
1064  try {
1065    document.querySelectorAll(
1066      '.animate-on-scroll, .animate-slide-left, .animate-slide-right, .animate-scale, .animate-slide-up'
1067    ).forEach(function(el) { el.classList.add('visible'); el.classList.add('is-visible'); });
1068  } catch (e) {}
1069
1070  // Drawer markup comes from the canonical contract so preview == export.
1071  var host = document.createElement('div');
1072  host.innerHTML = ${JSON.stringify(oe)};
1073  while (host.firstChild) { document.body.appendChild(host.firstChild); }
1074  ${ote()}
1075
1076  var panel = document.getElementById('pmgpt-menu-panel');
1077  var overlay = document.getElementById('pmgpt-menu-backdrop');
1078  function openMenu() {
1079    if (!panel || !overlay) return;
1080    overlay.hidden = false; overlay.classList.add('open'); panel.classList.add('open');
1081  }
1082  function closeMenu() {
1083    if (!panel || !overlay) return;
1084    overlay.classList.remove('open'); panel.classList.remove('open');
1085  }
1086  // Preview links navigate the host app instead of the iframe document.
1087  if (panel) {
1088    panel.querySelectorAll('.pmgpt-menu-link').forEach(function(link, i) {
1089      link.addEventListener('click', function(e) {
1090        e.preventDefault();
1091        var p = pages[i];
1092        if (p) window.parent.postMessage({ type: 'navigate-page', slug: p.slug }, '*');
1093        closeMenu();
1094      });
1095    });
1096  }
1097
1098  function bindHamburgers() {
1099    document.querySelectorAll('.fse-toggle-button, .mobile-menu-toggle, [class*="hamburger"], [class*="mobile-toggle"]').forEach(function(btn) {
1100      if (btn.getAttribute('data-pmgpt-bound') === '1') return;
1101      btn.setAttribute('data-pmgpt-bound', '1');
1102      // Always render an inline SVG unless the button already has one: icon
1103      // fonts (fa-bars, custom webfonts) frequently never load inside the
1104      // preview iframe, leaving an invisible toggle.
1105      if (!btn.querySelector('svg')) {
1106        btn.innerHTML = '<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true"><path d="M3 6h18M3 12h18M3 18h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>';
1107      }
1108
1109      if (!btn.id) btn.id = 'pmgpt-menu-toggle';
1110      btn.addEventListener('click', function(e) {
1111        e.preventDefault();
1112        e.stopPropagation();
1113        openMenu();
1114      });
1115    });
1116  }
1117
1118  function updateScrollShadow() {
1119    if (!shadowOnScroll) return;
1120    document.body.classList.toggle('pmgpt-nav-scrolled', window.scrollY > 4);
1121  }
1122  updateScrollShadow();
1123  window.addEventListener('scroll', updateScrollShadow, { passive: true });
1124
1125  // --- Restructure header into pm-header-left / pm-header-right ---
1126  // --- Remove every search bar (never functional in an exported theme) ---
1127  try {
1128    var SEARCH_TOKEN = /(^|[^a-z])search([^a-z]|$)/i;
1129    var searchNodes = document.querySelectorAll(
1130      'form[role="search"], input[type="search"], [class*="search" i], [id*="search" i], [aria-label*="search" i], [placeholder*="search" i]'
1131    );
1132    Array.prototype.slice.call(searchNodes).forEach(function(node) {
1133      if (!node || !node.parentNode) return;
1134      var attrs = (node.className || '') + ' ' + (node.id || '') + ' ' + (node.getAttribute('aria-label') || '') + ' ' + (node.getAttribute('placeholder') || '') + ' ' + (node.getAttribute('role') || '');
1135      var isInput = node.tagName === 'INPUT' || node.tagName === 'FORM';
1136      if (!isInput && !SEARCH_TOKEN.test(String(attrs))) return;
1137      if (node.querySelector('nav, header, footer, h1, h2, h3')) return;
1138      var target = node;
1139      var wrap = node.closest ? node.closest('form, .fse-search, [class*="search-bar" i], [class*="search-box" i], [class*="search-form" i]') : null;
1140      if (wrap && !wrap.querySelector('nav, a[href]:not([class*="search" i])')) target = wrap;
1141      var li = target.closest ? target.closest('li') : null;
1142      if (li && li.children.length === 1) target = li;
1143      if (target.parentNode) target.parentNode.removeChild(target);
1144    });
1145  } catch (e) {}
1146
1147  var preserveLayout = ${JSON.stringify(K)};
1148  // Preserved (copy/mockup) headers keep their designed markup, but they still need a
1149  // hamburger below 1024px — create one without touching the rest of the layout.
1150  if (preserveLayout) {
1151    var pHeader = document.querySelector('.fse-header') || document.querySelector('header');
1152
1153    // --- Prune dead menu links (pages that don't exist in this project) ---
1154    try {
1155      var slugify = function(s) { return String(s || '').toLowerCase().replace(/[^a-z0-9]+/g, ''); };
1156      var known = {};
1157      pages.forEach(function(p) {
1158        var s = slugify(p.slug); if (s) known[s] = p.slug === 'home' ? '#' : p.slug + '.html';
1159        var t = slugify(p.title); if (t) known[t] = p.slug === 'home' ? '#' : p.slug + '.html';
1160      });
1161      known['home'] = '#'; known['index'] = '#';
1162      var ACTION_RE = /(search|cart|bag|basket|profile|account|wishlist|favorit|login|log-in|sign-?in|sign-?up|register|btn|button|cta)/i;
1163      var chrome = [];
1164      if (pHeader) chrome.push(pHeader);
1165      var pFooter = document.querySelector('.fse-footer') || document.querySelector('footer');
1166      if (pFooter) chrome.push(pFooter);
1167      chrome.forEach(function(root) {
1168        Array.prototype.slice.call(root.querySelectorAll('a[href]')).forEach(function(a) {
1169          var href = a.getAttribute('href') || '';
1170          if (/^(https?:|mailto:|tel:|javascript:|#)/i.test(href)) return;
1171          if (a.querySelector('img, svg, i, [class*="icon"]')) return;   // logos + icon actions
1172          if (ACTION_RE.test(a.className || '') || ACTION_RE.test(a.getAttribute('aria-label') || '')) return;
1173          var parentCls = a.parentElement ? (a.parentElement.className || '') : '';
1174          if (ACTION_RE.test(String(parentCls))) return;
1175          var text = (a.textContent || '').replace(/\\s+/g, ' ').trim();
1176          if (!text || text.length > 40) return;
1177          var seg = href.split('#')[0].split('?')[0].replace(/\\.html?$/i, '').split('/').filter(Boolean).pop() || 'home';
1178          var key = known[slugify(seg)] ? slugify(seg) : (known[slugify(text)] ? slugify(text) : null);
1179          if (key) { a.setAttribute('href', known[key]); return; }
1180          var li = a.closest('li');
1181          if (li && li.querySelectorAll('a').length === 1) li.parentNode.removeChild(li);
1182          else a.parentNode.removeChild(a);
1183        });
1184      });
1185    } catch (e) {}
1186
1187    if (pHeader && !pHeader.querySelector('.fse-toggle-button, .mobile-menu-toggle, [class*="hamburger"], [class*="mobile-toggle"]')) {
1188      var pBtn = document.createElement('button');
1189      pBtn.type = 'button';
1190      pBtn.className = 'fse-toggle-button';
1191      pBtn.setAttribute('aria-label', 'Open menu');
1192      pBtn.innerHTML = '<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true"><path d="M3 6h18M3 12h18M3 18h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>';
1193      var host = pHeader.querySelector('.fse-header-right, .fse-header-actions') || pHeader.querySelector('.fse-header-content') || pHeader;
1194      // Must sit BEFORE any CTA / action item (profile, wishlist, bag, search…)
1195      if (host.firstChild) { host.insertBefore(pBtn, host.firstChild); } else { host.appendChild(pBtn); }
1196      host.setAttribute('data-pmgpt-toggle-host', '1');
1197    }
1198  }
1199  if (!preserveLayout) {
1200  var header = document.querySelector('.fse-header') || document.querySelector('header');
1201  if (header) {
1202    // Collect ALL meaningful leaf elements from the header, regardless of nesting
1203    var allEls = header.querySelectorAll('a, button, img, svg, span, p, h1, h2, h3, h4, h5, h6, div');
1204    var logo = null;
1205    var brandText = null;
1206    var ctaButtons = [];
1207    var hamburger = null;
1208
1209    // Find the logo (first link with image/svg, or element with logo class)
1210    var logoLink = header.querySelector('a.fse-logo, a[class*="logo"], a[class*="brand"], .fse-logo');
1211    if (!logoLink) {
1212      // Try first <a> that contains an img or svg
1213      var links = header.querySelectorAll('a');
1214      for (var i = 0; i < links.length; i++) {
1215        if (links[i].querySelector('img') || links[i].querySelector('svg')) {
1216          logoLink = links[i];
1217          break;
1218        }
1219      }
1220    }
1221    logo = logoLink;
1222
1223    // Find brand/site text (usually .fse-site-title or similar)
1224    brandText = header.querySelector('.fse-site-title, [class*="site-title"], [class*="site-name"]');
1225    // If no dedicated element, look for a standalone text element near the logo
1226    if (!brandText) {
1227      var h = header.querySelector('h1, h2, h3, h4, h5, h6');
1228      if (h) brandText = h;
1229    }
1230
1231    // Find CTA buttons (links styled as buttons, excluding logo)
1232    header.querySelectorAll('a.fse-button, a[class*="btn"], a[class*="cta"], a[class*="button"]').forEach(function(el) {
1233      if (el !== logo) ctaButtons.push(el);
1234    });
1235
1236    // Find hamburger
1237    hamburger = header.querySelector('.fse-toggle-button, .mobile-menu-toggle, [class*="hamburger"], [class*="mobile-toggle"]');
1238
1239    // If no hamburger exists on this page (common on AI-generated inner pages),
1240    // create one so the slide-out menu works everywhere just like the homepage.
1241    if (!hamburger) {
1242      var newBtn = document.createElement('button');
1243      newBtn.type = 'button';
1244      newBtn.className = 'fse-toggle-button';
1245      newBtn.setAttribute('aria-label', 'Open menu');
1246      newBtn.innerHTML = '<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true"><path d="M3 6h18M3 12h18M3 18h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>';
1247      hamburger = newBtn;
1248    }
1249
1250    // Find desktop nav (preserved so CSS can show it inline on desktop)
1251    var desktopNav = header.querySelector('.fse-main-nav, nav.fse-nav, header nav');
1252
1253    // A header that already has the designed left/right row must stay intact.
1254    // Rebuilding it drops the content width, centers the remaining items, and
1255    // in the narrow customize pane hides the menu behind the mobile rules.
1256    var alreadyStructured = header.querySelector('.fse-header-content, .fse-header-left');
1257
1258    // Only restructure if we found at least a logo and the design has no row yet
1259    if (!alreadyStructured && (logo || brandText)) {
1260      // Preserve header's own styles (background, padding, etc) by keeping the element
1261      // But replace its content with our two-column layout
1262      var leftDiv = document.createElement('div');
1263      leftDiv.className = 'fse-header-left';
1264      if (logo) leftDiv.appendChild(logo);
1265      if (brandText && brandText !== logo) leftDiv.appendChild(brandText);
1266
1267      var rightDiv = document.createElement('div');
1268      rightDiv.className = 'fse-header-right';
1269      if (desktopNav) rightDiv.appendChild(desktopNav);
1270      if (hamburger) rightDiv.appendChild(hamburger);
1271      ctaButtons.forEach(function(btn) { rightDiv.appendChild(btn); });
1272
1273      // Clear and rebuild
1274      header.innerHTML = '';
1275      header.appendChild(leftDiv);
1276      header.appendChild(rightDiv);
1277    } else if (hamburger && !hamburger.parentNode) {
1278      // No restructure happened but we created a hamburger — attach it directly.
1279      header.appendChild(hamburger);
1280    }
1281  }
1282  }
1283
1284  // Bind after restructure so freshly-created/moved buttons get handlers.
1285  bindHamburgers();
1286})();
1287<\/script>
1288`,q=(o==null?void 0:o.sticky)||e.includes("position: sticky")||e.includes("position:sticky"),he=!!(o!=null&&o.shadowOnScroll),X=`
1289      /* Keep the header row inside the viewport at every width */
1290      .fse-header,
1291      header,
1292      .fse-header > .fse-header-content,
1293      .fse-header > .fse-header-inner,
1294      header > .fse-header-content,
1295      header > .fse-header-inner {
1296        max-width: 100% !important;
1297        overflow-x: clip;
1298      }
1299      @media (max-width: 639px) {
1300        .fse-header-right,
1301        .fse-header-actions {
1302          flex: 0 1 auto !important;
1303          min-width: 0 !important;
1304          overflow: hidden !important;
1305          gap: 6px !important;
1306        }
1307        /* Icon-only actions on small screens: drop the tiny labels.
1308           NEVER applies to the hamburger — a glyph icon would collapse to 0px. */
1309        .fse-header-actions a,
1310        .fse-header-actions button:not(.fse-toggle-button):not([class*="hamburger"]):not([class*="mobile-toggle"]),
1311        .fse-header-right > a,
1312        .fse-header-right > button:not(.fse-toggle-button):not([class*="hamburger"]):not([class*="mobile-toggle"]) {
1313          font-size: 0 !important;
1314          gap: 0 !important;
1315        }
1316        .fse-header-actions a svg,
1317        .fse-header-actions a i,
1318        .fse-header-actions a img,
1319        .fse-header-right > a svg,
1320        .fse-header-right > a i,
1321        .fse-header-right > a img {
1322          width: 18px !important;
1323          height: 18px !important;
1324          max-width: 18px !important;
1325          max-height: 18px !important;
1326          font-size: 16px !important;
1327        }
1328        /* The hamburger is never the element that gets squeezed out */
1329        .fse-toggle-button,
1330        .mobile-menu-toggle,
1331        [class*="hamburger"],
1332        [class*="mobile-toggle"] {
1333          flex: 0 0 auto !important;
1334          order: -1 !important;
1335          font-size: 18px !important;
1336        }
1337      }
1338    `,J=K?`${X}
1339
1340      /* Copy-site: minimal preview overrides — source CSS controls layout */
1341      .fse-copy-preserve img:not(.fse-logo-sprite) { max-width: 100%; }
1342      .fse-copy-preserve img.fse-logo-sprite {
1343        object-fit: none !important;
1344        max-width: none !important;
1345        max-height: none !important;
1346        flex: 0 0 auto !important;
1347      }
1348      /* Header stays ONE row: logo shrinks, actions never wrap below it */
1349      .fse-header > .fse-header-content,
1350      .fse-header > .fse-header-inner,
1351      header > .fse-header-content,
1352      header > .fse-header-inner,
1353      .fse-header > div:first-child,
1354      header > div:first-child {
1355        display: flex !important;
1356        flex-wrap: nowrap !important;
1357        align-items: center !important;
1358      }
1359      .fse-header > .fse-header-content > *,
1360      .fse-header > .fse-header-inner > *,
1361      header > .fse-header-content > *,
1362      header > .fse-header-inner > * {
1363        min-width: 0;
1364      }
1365      .fse-header-left,
1366      .fse-logo-area,
1367      .fse-header .fse-logo,
1368      header .fse-logo {
1369        flex: 0 1 auto !important;
1370      }
1371      .fse-header-right,
1372      .fse-header-actions,
1373      [data-pmgpt-toggle-host] {
1374        flex: 0 0 auto !important;
1375        flex-wrap: nowrap !important;
1376        margin-left: auto !important;
1377        justify-content: flex-end !important;
1378      }
1379      /* Responsive header nav — beats scraped source stylesheets */
1380
1381      .fse-toggle-button,
1382      .mobile-menu-toggle,
1383      [class*="hamburger"],
1384      [class*="mobile-toggle"] {
1385        background: none !important;
1386        border: none !important;
1387        box-shadow: none !important;
1388        outline: none !important;
1389        cursor: pointer !important;
1390        padding: 6px 8px !important;
1391        font-size: 20px !important;
1392        line-height: 1 !important;
1393        color: inherit !important;
1394        align-items: center !important;
1395        justify-content: center !important;
1396        flex: 0 0 auto !important;
1397        order: -1 !important;
1398      }
1399      [data-pmgpt-toggle-host] {
1400        flex-wrap: nowrap !important;
1401      }
1402      .fse-toggle-button::before,
1403      .mobile-menu-toggle::before,
1404      [class*="hamburger"]::before,
1405      [class*="mobile-toggle"]::before,
1406      .fse-toggle-button::after,
1407      .mobile-menu-toggle::after,
1408      [class*="hamburger"]::after,
1409      [class*="mobile-toggle"]::after {
1410        content: none !important;
1411      }
1412      @media (min-width: 1024px) {
1413        .fse-toggle-button,
1414        .mobile-menu-toggle,
1415        [class*="hamburger"],
1416        [class*="mobile-toggle"] {
1417          display: none !important;
1418        }
1419        .fse-main-nav,
1420        header nav {
1421          display: flex !important;
1422          align-items: center !important;
1423        }
1424      }
1425      @media (max-width: 1023px) {
1426        .fse-nav-menu,
1427        .fse-main-nav > ul,
1428        .fse-header nav > ul,
1429        header nav > ul {
1430          display: none !important;
1431        }
1432        /* Nav wrappers must not reserve a row of their own */
1433        .fse-header nav,
1434        header nav,
1435        .fse-main-nav {
1436          flex: 0 0 auto !important;
1437          width: auto !important;
1438          margin: 0 !important;
1439        }
1440        .fse-toggle-button,
1441        .mobile-menu-toggle,
1442        [class*="hamburger"],
1443        [class*="mobile-toggle"] {
1444          display: inline-flex !important;
1445        }
1446        .fse-header-left img:not(.fse-logo-sprite),
1447        header .fse-logo img:not(.fse-logo-sprite),
1448        header .site-logo img:not(.fse-logo-sprite) {
1449          min-height: 28px !important;
1450          width: auto !important;
1451          object-fit: contain !important;
1452        }
1453      }
1454
1455    `:`${X}
1456      .fse-header,
1457      header {
1458        overflow: visible !important;
1459        overflow-x: visible !important;
1460        ${q?`
1461        position: sticky !important;
1462        top: 0 !important;
1463        z-index: 1000 !important;
1464        `:""}
1465      }
1466      ${he?`
1467      body.pmgpt-nav-scrolled .fse-header,
1468      body.pmgpt-nav-scrolled header {
1469        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12) !important;
1470      }
1471      `:""}
1472      /* Prevent generic .fse-section vertical padding (60-70px) from inflating
1473         the header/footer when they also carry the .fse-section class. */
1474      header.fse-section,
1475      .fse-header.fse-section,
1476      header.fse-header {
1477        padding-top: 10px !important;
1478        padding-bottom: 10px !important;
1479      }
1480      footer.fse-section,
1481      .fse-footer.fse-section {
1482        padding-top: 40px !important;
1483        padding-bottom: 40px !important;
1484      }
1485      /* Structured header layout — only for headers that are not already a
1486         designed row. Forcing flex on a header whose only child is
1487         .fse-header-content turns that row into a shrink-wrapped, centered bar. */
1488      .fse-header:not(:has(.fse-header-content)):not(:has(.fse-header-left)),
1489      header:not(:has(.fse-header-content)):not(:has(.fse-header-left)) {
1490        display: flex !important;
1491        align-items: center !important;
1492        justify-content: space-between !important;
1493        flex-wrap: nowrap !important;
1494      }
1495      .fse-header-left {
1496        display: flex !important;
1497        align-items: center !important;
1498        gap: 8px !important;
1499        flex: 0 1 auto !important;
1500        min-width: 0 !important;
1501        padding-left: 16px !important;
1502      }
1503      .fse-header-right {
1504        display: flex !important;
1505        align-items: center !important;
1506        gap: 8px !important;
1507        flex: 0 0 auto !important;
1508        margin-left: auto !important;
1509        padding-right: 16px !important;
1510      }
1511      /* Customize preview: keep primary nav visible so menu edits are always seen */
1512      .fse-main-nav,
1513      .fse-header-right nav,
1514      .fse-header nav,
1515      .fse-header .fse-nav-list,
1516      .fse-header .nav-menu,
1517      .fse-header .fse-nav-menu,
1518      header nav,
1519      header .nav-menu {
1520        display: flex !important;
1521        align-items: center !important;
1522        flex-wrap: wrap !important;
1523        gap: 16px !important;
1524      }
1525      .fse-main-nav ul,
1526      .fse-header-right nav ul,
1527      .fse-header nav ul,
1528      .fse-header .fse-nav-list,
1529      .fse-header .nav-menu,
1530      header nav ul,
1531      header .nav-menu {
1532        display: flex !important;
1533        flex-direction: row !important;
1534        flex-wrap: wrap !important;
1535        align-items: center !important;
1536        gap: 16px !important;
1537        list-style: none !important;
1538        margin: 0 !important;
1539        padding: 0 !important;
1540      }
1541      .fse-main-nav a,
1542      .fse-header-right nav a,
1543      .fse-header nav a,
1544      header nav a {
1545        text-decoration: none !important;
1546        white-space: nowrap !important;
1547        font-size: 14px !important;
1548        color: inherit !important;
1549      }
1550      .fse-toggle-button,
1551      .mobile-menu-toggle,
1552      [class*="hamburger"],
1553      [class*="mobile-toggle"] {
1554        display: none !important;
1555      }
1556      @media (max-width: 1023px) {
1557        /* Hide only the menu LIST — never the nav/header wrapper, which carries
1558           the design's background, border and bar styling. */
1559        .fse-main-nav > ul,
1560        .fse-header nav > ul,
1561        header nav > ul,
1562        .fse-header .fse-nav-menu,
1563        .fse-header .fse-nav-list,
1564        .fse-header .nav-menu,
1565        header .nav-menu {
1566          display: none !important;
1567        }
1568        .fse-toggle-button,
1569        .mobile-menu-toggle,
1570        [class*="hamburger"],
1571        [class*="mobile-toggle"] {
1572          display: flex !important;
1573          align-items: center !important;
1574          justify-content: center !important;
1575          background: none !important;
1576          border: none !important;
1577          box-shadow: none !important;
1578          outline: none !important;
1579          cursor: pointer !important;
1580          padding: 4px !important;
1581          font-size: 16px !important;
1582          color: inherit !important;
1583        }
1584        /* Keep the actions cluster flush right. */
1585        .fse-header-right,
1586        .fse-header-actions {
1587          margin-left: auto !important;
1588          justify-content: flex-end !important;
1589          flex: 0 0 auto !important;
1590          flex-wrap: nowrap !important;
1591        }
1592        .fse-header-left img {
1593          min-height: 28px !important;
1594          width: auto !important;
1595          object-fit: contain !important;
1596        }
1597      }
1598      .fse-toggle-button::before,
1599      .mobile-menu-toggle::before,
1600      [class*="hamburger"]::before,
1601      [class*="mobile-toggle"]::before,
1602      .fse-toggle-button::after,
1603      .mobile-menu-toggle::after,
1604      [class*="hamburger"]::after,
1605      [class*="mobile-toggle"]::after {
1606        content: none !important;
1607      }
1608    `,de="",le=K?`html, body { margin: 0; padding: 0; }
1609            *, *::before, *::after { box-sizing: border-box; }`:"* { margin: 0; padding: 0; box-sizing: border-box; }",fe=K?"":Oee(Iee(W,e||""),Mee),Z=`
1610      <!DOCTYPE html>
1611      <html>
1612        <head>
1613          <meta name="viewport" content="width=device-width, initial-scale=1.0">
1614          <base target="_blank">
1615          ${P?`<link rel="stylesheet" href="${P}">`:""}
1616          ${de}
1617          ${b?`<style>${b}</style>`:""}
1618          <style>
1619            ${le}
1620            ${gv(R)}
1621            /* Injected mobile menu styles */
1622            ${J}
1623            ${fe}
1624            /* Canonical menu contract LAST — it is authoritative for the
1625               hamburger/drawer (display, size, contrast-checked colors). */
1626            ${z}
1627
1628            /* Interactive widgets — identical to the exported theme runtime */
1629            ${Kee}
1630
1631            /* Generated sections start at opacity: 0 until a scroll script adds
1632               .visible. The customize preview must show them even if that
1633               script never runs, or the page looks like an empty black frame. */
1634            .animate-on-scroll,
1635            .animate-slide-left,
1636            .animate-slide-right,
1637            .animate-scale,
1638            .animate-slide-up {
1639              opacity: 1 !important;
1640              transform: none !important;
1641              animation: none !important;
1642            }
1643          </style>
1644        </head>
1645        <body>
1646          ${gO(W)}
1647          ${L}
1648          <script>${Yee}<\/script>
1649        </body>
1650      </html>
1651    `;return i.jsxs("div",{className:"relative w-full h-full",children:[n&&i.jsx("div",{className:"absolute top-2 left-2 z-10 bg-background/80 backdrop-blur-sm rounded-md border border-border shadow-sm",children:i.jsx(qZ,{onHome:O,onRefresh:F})}),i.jsx("iframe",{ref:h,srcDoc:Z,className:"block w-full h-full min-w-full border-0 preview-iframe",style:{width:"100%",height:"100%"},title:"Theme Preview",onLoad:T},v)]})});wl.displayName="ThemePreview";function Tv(){return i.jsx(rt,{variant:"secondary",className:"ml-1.5 align-middle text-[10px]",children:"Pro Feature"})}const dm={gemini25:{label:"Gemini 2.5",icon:ua,desc:"1 credit/change — Best for simple updates or requests."},gemini30:{label:"Gemini 3.0",icon:St,desc:"1 credit/change — Better for more complex requests."}};function CM({value:t,onChange:e,disabled:r,flashDesc:n,proDesc:s,plan:o,onUpgradeNeeded:a,trialActive:l=!1}){const c={gemini25:{...dm.gemini25,desc:n||dm.gemini25.desc},gemini30:{...dm.gemini30,desc:s||dm.gemini30.desc}},[u,d]=g.useState(!1),h=g.useRef(null);g.useEffect(()=>{const b=x=>{h.current&&!h.current.contains(x.target)&&d(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]);const m=o==="free"&&!l,f=b=>{if(b==="gemini30"&&m){d(!1),a==null||a();return}e(b),d(!1)},v=c[t],p=v.icon;return i.jsxs("div",{className:"relative inline-flex items-center",ref:h,children:[i.jsxs("button",{type:"button",disabled:r,onClick:()=>d(!u),className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-border bg-muted/50 text-xs transition-colors hover:bg-muted ${r?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[i.jsx(p,{className:"h-3 w-3 text-primary"}),i.jsx("span",{className:"font-medium",children:v.label}),i.jsx(Hs,{className:"h-3 w-3 text-muted-foreground"})]}),u&&i.jsx("div",{className:"absolute bottom-full mb-1 left-0 z-50 w-72 rounded-lg border border-border bg-popover shadow-lg p-1",children:Object.keys(c).map(b=>{const x=c[b],y=x.icon,w=t===b,j=b==="gemini30"&&m;return i.jsxs("button",{type:"button",onClick:()=>f(b),className:`w-full flex items-start gap-2 px-3 py-2 rounded-md text-left transition-colors ${w?"bg-primary/15 text-primary":"hover:bg-muted text-foreground"}`,children:[i.jsx(y,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),i.jsxs("div",{children:[i.jsx("span",{className:"text-xs font-medium",children:x.label}),b==="gemini30"&&l&&i.jsx(Tv,{}),j&&i.jsx("span",{className:"text-[10px] text-muted-foreground ml-1",children:"(paid plans)"}),i.jsx("p",{className:"text-[10px] text-muted-foreground leading-tight mt-0.5",children:x.desc})]})]},b)})})]})}var EM="AlertDialog",[lte,_se]=_r(EM,[OI]),so=OI(),PM=t=>{const{__scopeAlertDialog:e,...r}=t,n=so(e);return i.jsx(t1,{...n,...r,modal:!0})};PM.displayName=EM;var cte="AlertDialogTrigger",ute=g.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=so(r);return i.jsx(r1,{...s,...n,ref:e})});ute.displayName=cte;var dte="AlertDialogPortal",TM=t=>{const{__scopeAlertDialog:e,...r}=t,n=so(e);return i.jsx(n1,{...n,...r})};TM.displayName=dte;var hte="AlertDialogOverlay",AM=g.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=so(r);return i.jsx(lf,{...s,...n,ref:e})});AM.displayName=hte;var Ec="AlertDialogContent",[fte,mte]=lte(Ec),pte=aP("AlertDialogContent"),RM=g.forwardRef((t,e)=>{const{__scopeAlertDialog:r,children:n,...s}=t,o=so(r),a=g.useRef(null),l=Ge(e,a),c=g.useRef(null);return i.jsx(ZV,{contentName:Ec,titleName:IM,docsSlug:"alert-dialog",children:i.jsx(fte,{scope:r,cancelRef:c,children:i.jsxs(cf,{role:"alertdialog",...o,...s,ref:l,onOpenAutoFocus:je(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[i.jsx(pte,{children:n}),i.jsx(vte,{contentRef:a})]})})})});RM.displayName=Ec;var IM="AlertDialogTitle",OM=g.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=so(r);return i.jsx(uf,{...s,...n,ref:e})});OM.displayName=IM;var MM="AlertDialogDescription",$M=g.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=so(r);return i.jsx(df,{...s,...n,ref:e})});$M.displayName=MM;var gte="AlertDialogAction",DM=g.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=so(r);return i.jsx(hf,{...s,...n,ref:e})});DM.displayName=gte;var FM="AlertDialogCancel",LM=g.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,{cancelRef:s}=mte(FM,r),o=so(r),a=Ge(e,s);return i.jsx(hf,{...o,...n,ref:a})});LM.displayName=FM;var vte=({contentRef:t})=>{const e=`\`${Ec}\` requires a description for the component to be accessible for screen reader users.
1652
1653You can add a description to the \`${Ec}\` by passing a \`${MM}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
1654
1655Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ec}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
1656
1657For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return g.useEffect(()=>{var n;document.getElementById((n=t.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},xte=PM,yte=TM,BM=AM,zM=RM,UM=DM,WM=LM,HM=OM,GM=$M;const vf=xte,bte=yte,qM=g.forwardRef(({className:t,...e},r)=>i.jsx(BM,{className:Se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));qM.displayName=BM.displayName;const ju=g.forwardRef(({className:t,...e},r)=>i.jsxs(bte,{children:[i.jsx(qM,{}),i.jsx(zM,{ref:r,className:Se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));ju.displayName=zM.displayName;const ku=({className:t,...e})=>i.jsx("div",{className:Se("flex flex-col space-y-2 text-center sm:text-left",t),...e});ku.displayName="AlertDialogHeader";const Su=({className:t,...e})=>i.jsx("div",{className:Se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Su.displayName="AlertDialogFooter";const Nu=g.forwardRef(({className:t,...e},r)=>i.jsx(HM,{ref:r,className:Se("text-lg font-semibold",t),...e}));Nu.displayName=HM.displayName;const Cu=g.forwardRef(({className:t,...e},r)=>i.jsx(GM,{ref:r,className:Se("text-sm text-muted-foreground",t),...e}));Cu.displayName=GM.displayName;const xf=g.forwardRef(({className:t,...e},r)=>i.jsx(UM,{ref:r,className:Se(tv(),t),...e}));xf.displayName=UM.displayName;const yf=g.forwardRef(({className:t,...e},r)=>i.jsx(WM,{ref:r,className:Se(tv({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));yf.displayName=WM.displayName;const wte=["image/jpeg","image/png","image/webp","image/gif"];function L1(t){const e=t.type.toLowerCase();return wte.includes(e)?t.size>5*1024*1024?"Image must be less than 5MB":null:e==="image/svg+xml"||t.name.toLowerCase().endsWith(".svg")?"SVG is not supported. Please use JPG, PNG, WebP, or GIF.":"Please upload a JPG, PNG, WebP, or GIF image. For PSD files, export as PNG first."}function Yw({src:t,...e}){const r=QZ(t);return i.jsx("img",{...e,src:r||void 0})}function VM({projectId:t,mockupUrl:e,onMockupChange:r,disabled:n=!1,label:s="Design mockup",hint:o="Reference only — AI recreates the layout; the mockup file is never placed on your page."}){const a=g.useRef(null),[l,c]=g.useState(!1),u=async h=>{var f;const m=L1(h);if(m){Q.error(m);return}c(!0);try{const{data:{session:v}}=await re.auth.getSession();if(!((f=v==null?void 0:v.user)!=null&&f.id))throw new Error("Not authenticated");const p=h.name.split(".").pop(),b=`${v.user.id}/${t}/mockup-${Date.now()}.${p}`,{error:x}=await re.storage.from("project-images").upload(b,h);if(x)throw x;const{data:{publicUrl:y}}=re.storage.from("project-images").getPublicUrl(b);await re.from("project_assets").insert({project_id:t,type:"image",url:y,source:"upload",name:`mockup-${h.name}`,metadata:{role:"mockup"}}),r(y),Q.success("Mockup uploaded!")}catch(v){console.error("Mockup upload error:",v),Q.error("Failed to upload mockup")}c(!1),a.current&&(a.current.value="")},d=()=>{r(null),a.current&&(a.current.value="")};return i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium",children:s}),i.jsx("p",{className:"text-xs text-muted-foreground",children:o}),i.jsx("input",{ref:a,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",className:"hidden",disabled:n||l,onChange:h=>{var f;const m=(f=h.target.files)==null?void 0:f[0];m&&u(m)}}),e?i.jsxs("div",{className:"relative rounded-lg border border-border overflow-hidden bg-muted/30",children:[i.jsx(Yw,{src:e,alt:"Design mockup",className:"w-full max-h-48 object-contain"}),i.jsx(Y,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-8 w-8",onClick:d,disabled:n||l,children:i.jsx(Bn,{className:"h-4 w-4"})})]}):i.jsx("div",{className:"border-2 border-dashed border-border rounded-lg p-6 text-center cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>{var h;return!n&&!l&&((h=a.current)==null?void 0:h.click())},children:l?i.jsx(et,{className:"h-8 w-8 mx-auto animate-spin text-muted-foreground"}):i.jsxs(i.Fragment,{children:[i.jsx(qa,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to upload mockup"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"PSD: export as PNG first"})]})}),e&&i.jsxs(Y,{type:"button",variant:"outline",size:"sm",disabled:n||l,onClick:()=>{var h;
1657return(h=a.current)==null?void 0:h.click()},children:[l?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):i.jsx(_p,{className:"h-4 w-4 mr-2"}),"Replace mockup"]})]})}function _te({pages:t,activePage:e,onPageSelect:r,onAddPage:n,onRemovePage:s,hasTemplate:o,projectId:a,disabled:l=!1,onUpgradeNeeded:c}){var F,T;const[u,d]=g.useState(!1),[h,m]=g.useState(""),[f,v]=g.useState("page"),[p,b]=g.useState(""),[x,y]=g.useState(null),[w,j]=g.useState(null),_=Object.entries(t).filter(([,A])=>!A.isTemplate),S=e==="home"?"Homepage":((F=t[e])==null?void 0:F.title)||e,N=()=>{if(c){c();return}d(!0)},P=()=>{h.trim()&&(n(h.trim(),f,p.trim()||void 0,x||void 0),m(""),v("page"),b(""),y(null),d(!1))},C=()=>{w&&(s(w),j(null))},O=w?((T=t[w])==null?void 0:T.title)||w:"";return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/30",children:[i.jsx("div",{className:"flex-1"}),i.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[1+_.length," ",_.length===0?"page":"pages",":"]}),i.jsxs(lv,{children:[i.jsx(cv,{asChild:!0,children:i.jsxs(Y,{variant:"outline",size:"sm",disabled:l,className:"h-8 px-3 text-xs font-medium gap-1.5 min-w-[120px] justify-between",children:[i.jsx("span",{className:"truncate",children:S}),i.jsx(Hs,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]})}),i.jsxs(af,{align:"end",className:"min-w-[180px]",children:[i.jsx(hs,{onClick:()=>r("home"),className:e==="home"?"bg-accent":"",children:i.jsx("span",{className:"flex-1",children:"Homepage"})}),_.length>0&&i.jsx(Nc,{}),_.map(([A,k])=>i.jsxs(hs,{onClick:()=>r(A),className:`${e===A?"bg-accent":""} group`,children:[i.jsx("span",{className:"flex-1 truncate",children:k.title}),i.jsx("span",{role:"button",onClick:$=>{$.stopPropagation(),j(A)},className:"ml-2 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:bg-destructive/10 hover:text-destructive transition-all",title:`Delete ${k.title}`,children:i.jsx(GP,{className:"h-3 w-3"})})]},A))]})]}),i.jsxs(Y,{variant:"ghost",size:"sm",onClick:N,disabled:l,className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground gap-1",title:o?"Add a new page":"Create inner page template first",children:[i.jsx(yp,{className:"h-3.5 w-3.5"}),"Page"]})]}),i.jsx(vf,{open:!!w,onOpenChange:A=>!A&&j(null),children:i.jsxs(ju,{children:[i.jsxs(ku,{children:[i.jsx(Nu,{children:"Are you sure you want to delete this page?"}),i.jsxs(Cu,{children:['This will permanently delete the "',O,'" page. This action cannot be undone.']})]}),i.jsxs(Su,{children:[i.jsx(yf,{children:"Cancel"}),i.jsx(xf,{onClick:C,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),i.jsx(Xt,{open:u,onOpenChange:d,children:i.jsxs(Qt,{className:"sm:max-w-md",children:[i.jsx(gn,{children:i.jsx(wr,{children:"Add New Page"})}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx(Xe,{htmlFor:"page-title",children:"Page Title"}),i.jsx(Nt,{id:"page-title",value:h,onChange:A=>m(A.target.value),placeholder:"e.g. About Us, Contact, Services",onKeyDown:A=>{A.key==="Enter"&&P()}})]}),i.jsxs("div",{children:[i.jsx(Xe,{htmlFor:"page-type",children:"Type"}),i.jsxs(Vs,{value:f,onValueChange:A=>v(A),children:[i.jsx(bs,{id:"page-type",children:i.jsx(Ks,{})}),i.jsxs(ws,{children:[i.jsx(Lr,{value:"page",children:"Page"}),i.jsx(Lr,{value:"post",children:"Post"})]})]})]}),i.jsxs("div",{children:[i.jsx(Xe,{htmlFor:"page-desc",children:"Content Description (optional if mockup uploaded)"}),i.jsx(Ui,{id:"page-desc",value:p,onChange:A=>b(A.target.value),placeholder:"Briefly describe what this page should contain...",className:"min-h-[80px] resize-none"})]}),i.jsx(VM,{projectId:a,mockupUrl:x,onMockupChange:y,label:"Design from mockup (optional)",hint:"Reference only — recreates layout from the mockup; the upload is never shown on the page."}),!o&&i.jsx("p",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2",children:"We'll set up your inner page template automatically with this first page (still 0.5 credits)."}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Each page costs 0.5 credits to generate."})]}),i.jsxs(pf,{children:[i.jsx(Y,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),i.jsx(Y,{onClick:P,disabled:!h.trim(),children:"Create Page"})]})]})})]})}var KM=["PageUp","PageDown"],YM=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],QM={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Eu="Slider",[Qw,jte,kte]=cu(Eu),[JM,jse]=_r(Eu,[kte]),[Ste,Av]=JM(Eu),XM=g.forwardRef((t,e)=>{const{name:r,min:n=0,max:s=100,step:o=1,orientation:a="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[n],value:d,onValueChange:h=()=>{},onValueCommit:m=()=>{},inverted:f=!1,form:v,...p}=t,b=g.useRef(new Set),x=g.useRef(0),w=a==="horizontal"?Nte:Cte,[j=[],_]=rn({prop:d,defaultProp:u,onChange:F=>{var A;(A=[...b.current][x.current])==null||A.focus(),h(F)}}),S=g.useRef(j);function N(F){const T=Rte(j,F);O(F,T)}function P(F){O(F,x.current)}function C(){const F=S.current[x.current];j[x.current]!==F&&m(j)}function O(F,T,{commit:A}={commit:!1}){const k=$te(o),$=Dte(Math.round((F-n)/o)*o+n,k),K=Rh($,[n,s]);_((H=[])=>{const W=Tte(H,K,T);
1657if(Mte(W,c*o)){x.current=W.indexOf(K);const R=String(W)!==String(H);return R&&A&&m(W),R?W:H}else return H})}return i.jsx(Ste,{scope:t.__scopeSlider,name:r,disabled:l,min:n,max:s,valueIndexToChangeRef:x,thumbs:b.current,values:j,orientation:a,form:v,children:i.jsx(Qw.Provider,{scope:t.__scopeSlider,children:i.jsx(Qw.Slot,{scope:t.__scopeSlider,children:i.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...p,ref:e,onPointerDown:je(p.onPointerDown,()=>{l||(S.current=j)}),min:n,max:s,inverted:f,onSlideStart:l?void 0:N,onSlideMove:l?void 0:P,onSlideEnd:l?void 0:C,onHomeKeyDown:()=>!l&&O(n,0,{commit:!0}),onEndKeyDown:()=>!l&&O(s,j.length-1,{commit:!0}),onStepKeyDown:({event:F,direction:T})=>{if(!l){const $=KM.includes(F.key)||F.shiftKey&&YM.includes(F.key)?10:1,K=x.current,H=j[K],W=o*$*T;O(H+W,K,{commit:!0})}}})})})})});XM.displayName=Eu;var[ZM,e3]=JM(Eu,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Nte=g.forwardRef((t,e)=>{const{min:r,max:n,dir:s,inverted:o,onSlideStart:a,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=t,[h,m]=g.useState(null),f=Ge(e,w=>m(w)),v=g.useRef(void 0),p=fa(s),b=p==="ltr",x=b&&!o||!b&&o;function y(w){const j=v.current||h.getBoundingClientRect(),_=[0,j.width],N=B1(_,x?[r,n]:[n,r]);return v.current=j,N(w-j.left)}return i.jsx(ZM,{scope:t.__scopeSlider,startEdge:x?"left":"right",endEdge:x?"right":"left",direction:x?1:-1,size:"width",children:i.jsx(t3,{dir:p,"data-orientation":"horizontal",...d,ref:f,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const j=y(w.clientX);a==null||a(j)},onSlideMove:w=>{const j=y(w.clientX);l==null||l(j)},onSlideEnd:()=>{v.current=void 0,c==null||c()},onStepKeyDown:w=>{const _=QM[x?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:_?-1:1})}})})}),Cte=g.forwardRef((t,e)=>{const{min:r,max:n,inverted:s,onSlideStart:o,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...u}=t,d=g.useRef(null),h=Ge(e,d),m=g.useRef(void 0),f=!s;function v(p){const b=m.current||d.current.getBoundingClientRect(),x=[0,b.height],w=B1(x,f?[n,r]:[r,n]);return m.current=b,w(p-b.top)}return i.jsx(ZM,{scope:t.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:i.jsx(t3,{"data-orientation":"vertical",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:p=>{const b=v(p.clientY);o==null||o(b)},onSlideMove:p=>{const b=v(p.clientY);a==null||a(b)},onSlideEnd:()=>{m.current=void 0,l==null||l()},onStepKeyDown:p=>{const x=QM[f?"from-bottom":"from-top"].includes(p.key);c==null||c({event:p,direction:x?-1:1})}})})}),t3=g.forwardRef((t,e)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:s,onSlideEnd:o,onHomeKeyDown:a,onEndKeyDown:l,onStepKeyDown:c,...u}=t,d=Av(Eu,r);return i.jsx(Me.span,{...u,ref:e,onKeyDown:je(t.onKeyDown,h=>{h.key==="Home"?(a(h),h.preventDefault()):h.key==="End"?(l(h),h.preventDefault()):KM.concat(YM).includes(h.key)&&(c(h),h.preventDefault())}),onPointerDown:je(t.onPointerDown,h=>{const m=h.target;m.setPointerCapture(h.pointerId),h.preventDefault(),d.thumbs.has(m)?m.focus():n(h)}),onPointerMove:je(t.onPointerMove,h=>{h.target.hasPointerCapture(h.pointerId)&&s(h)}),onPointerUp:je(t.onPointerUp,h=>{const m=h.target;m.hasPointerCapture(h.pointerId)&&(m.releasePointerCapture(h.pointerId),o(h))})})}),r3="SliderTrack",n3=g.forwardRef((t,e)=>{const{__scopeSlider:r,...n}=t,s=Av(r3,r);return i.jsx(Me.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:e})});n3.displayName=r3;var Jw="SliderRange",s3=g.forwardRef((t,e)=>{const{__scopeSlider:r,...n}=t,s=Av(Jw,r),o=e3(Jw,r),a=g.useRef(null),l=Ge(e,a),c=s.values.length,u=s.values.map(m=>a3(m,s.min,s.max)),d=c>1?Math.min(...u):0,h=100-Math.max(...u);return i.jsx(Me.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:l,style:{...t.style,[o.startEdge]:d+"%",[o.endEdge]:h+"%"}})});s3.displayName=Jw;var Xw="SliderThumb",i3=g.forwardRef((t,e)=>{const r=jte(t.__scopeSlider),[n,s]=g.useState(null),o=Ge(e,l=>s(l)),a=g.useMemo(()=>n?r().findIndex(l=>l.ref.current===n):-1,[r,n]);return i.jsx(Ete,{...t,ref:o,index:a})}),Ete=g.forwardRef((t,e)=>{const{__scopeSlider:r,index:n,name:s,...o}=t,a=Av(Xw,r),l=e3(Xw,r),[c,u]=g.useState(null),d=Ge(e,y=>u(y)),h=c?a.form||!!c.closest("form"):!0,m=Kh(c),f=a.values[n],v=f===void 0?0:a3(f,a.min,a.max),p=Ate(n,a.values.length),b=m==null?void 0:m[l.size],x=b?Ite(b,v,l.direction):0;return g.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),i.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${v}% + ${x}px)`},children:[i.jsx(Qw.ItemSlot,{scope:t.__scopeSlider,children:i.jsx(Me.span,{role:"slider","aria-label":t["aria-label"]||p,"aria-valuemin":a.min,"aria-valuenow":f,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...o,ref:d,style:f===void 0?{display:"none"}:t.style,onFocus:je(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),h&&i.jsx(o3,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:f},n)]})});
1657i3.displayName=Xw;var Pte="RadioBubbleInput",o3=g.forwardRef(({__scopeSlider:t,value:e,...r},n)=>{const s=g.useRef(null),o=Ge(s,n),a=gf(e);return g.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&d){const h=new Event("input",{bubbles:!0});d.call(l,e),l.dispatchEvent(h)}},[a,e]),i.jsx(Me.input,{style:{display:"none"},...r,ref:o,defaultValue:e})});o3.displayName=Pte;function Tte(t=[],e,r){const n=[...t];return n[r]=e,n.sort((s,o)=>s-o)}function a3(t,e,r){const o=100/(r-e)*(t-e);return Rh(o,[0,100])}function Ate(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Rte(t,e){if(t.length===1)return 0;const r=t.map(s=>Math.abs(s-e)),n=Math.min(...r);return r.indexOf(n)}function Ite(t,e,r){const n=t/2,o=B1([0,50],[0,n]);return(n-o(e)*r)*r}function Ote(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function Mte(t,e){if(e>0){const r=Ote(t);return Math.min(...r)>=e}return!0}function B1(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function $te(t){return(String(t).split(".")[1]||"").length}function Dte(t,e){const r=Math.pow(10,e);return Math.round(t*r)/r}var l3=XM,Fte=n3,Lte=s3,Bte=i3;const su=g.forwardRef(({className:t,...e},r)=>i.jsxs(l3,{ref:r,className:Se("relative flex w-full touch-none select-none items-center",t),...e,children:[i.jsx(Fte,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:i.jsx(Lte,{className:"absolute h-full bg-primary"})}),i.jsx(Bte,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));su.displayName=l3.displayName;var Rv="Switch",[zte,kse]=_r(Rv),[Ute,Wte]=zte(Rv),c3=g.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:o,required:a,disabled:l,value:c="on",onCheckedChange:u,form:d,...h}=t,[m,f]=g.useState(null),v=Ge(e,w=>f(w)),p=g.useRef(!1),b=m?d||!!m.closest("form"):!0,[x,y]=rn({prop:s,defaultProp:o??!1,onChange:u,caller:Rv});return i.jsxs(Ute,{scope:r,checked:x,disabled:l,children:[i.jsx(Me.button,{type:"button",role:"switch","aria-checked":x,"aria-required":a,"data-state":f3(x),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:v,onClick:je(t.onClick,w=>{y(j=>!j),b&&(p.current=w.isPropagationStopped(),p.current||w.stopPropagation())})}),b&&i.jsx(h3,{control:m,bubbles:!p.current,name:n,value:c,checked:x,required:a,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});c3.displayName=Rv;var u3="SwitchThumb",d3=g.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,s=Wte(u3,r);return i.jsx(Me.span,{"data-state":f3(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:e})});d3.displayName=u3;var Hte="SwitchBubbleInput",h3=g.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:n=!0,...s},o)=>{const a=g.useRef(null),l=Ge(a,o),c=gf(r),u=Kh(e);return g.useEffect(()=>{const d=a.current;if(!d)return;const h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==r&&f){const v=new Event("click",{bubbles:n});f.call(d,r),d.dispatchEvent(v)}},[c,r,n]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});h3.displayName=Hte;function f3(t){return t?"checked":"unchecked"}var m3=c3,Gte=d3;const p3=g.forwardRef(({className:t,...e},r)=>i.jsx(m3,{className:Se("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...e,ref:r,children:i.jsx(Gte,{className:Se("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}
1657));p3.displayName=m3.displayName;function qte({archetype:t}){const r={fill:"currentColor",opacity:.75};return i.jsxs("svg",{viewBox:"0 0 96 40",className:"w-full h-10 text-foreground",role:"img","aria-label":_M[t],children:[i.jsx("rect",{x:"1",y:"1",width:"94",height:"38",rx:"4",fill:"none",stroke:"currentColor",strokeOpacity:"0.25"}),t==="logo-left-menu-right"&&i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"8",y:"14",width:"22",height:"12",rx:"2",...r}),i.jsx("rect",{x:"50",y:"18",width:"12",height:"4",rx:"2",...r}),i.jsx("rect",{x:"66",y:"18",width:"12",height:"4",rx:"2",...r}),i.jsx("rect",{x:"82",y:"18",width:"6",height:"4",rx:"2",...r})]}),t==="logo-right-menu-left"&&i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"66",y:"14",width:"22",height:"12",rx:"2",...r}),i.jsx("rect",{x:"8",y:"18",width:"12",height:"4",rx:"2",...r}),i.jsx("rect",{x:"24",y:"18",width:"12",height:"4",rx:"2",...r}),i.jsx("rect",{x:"40",y:"18",width:"6",height:"4",rx:"2",...r})]}),t==="logo-center-menu-below"&&i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"37",y:"6",width:"22",height:"11",rx:"2",...r}),i.jsx("rect",{x:"26",y:"26",width:"12",height:"4",rx:"2",...r}),i.jsx("rect",{x:"42",y:"26",width:"12",height:"4",rx:"2",...r}),i.jsx("rect",{x:"58",y:"26",width:"12",height:"4",rx:"2",...r})]}),t==="logo-center-menu-split"&&i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:"37",y:"14",width:"22",height:"12",rx:"2",...r}),i.jsx("rect",{x:"8",y:"18",width:"10",height:"4",rx:"2",...r}),i.jsx("rect",{x:"21",y:"18",width:"10",height:"4",rx:"2",...r}),i.jsx("rect",{x:"65",y:"18",width:"10",height:"4",rx:"2",...r}),i.jsx("rect",{x:"78",y:"18",width:"10",height:"4",rx:"2",...r})]})]})}function Vte({archetype:t,logoHeight:e,sticky:r,onArchetypeChange:n,onLogoHeightChange:s,onStickyChange:o,onSave:a,isSaving:l}){return i.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[i.jsx(Qi,{className:"flex-1 min-h-0",children:i.jsxs("div",{className:"space-y-6 p-4 pb-2",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx(Xe,{className:"text-sm font-medium",children:"Header layout"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Applies instantly — no credits used. Your pick is kept for every export format."})]}),i.jsx("div",{className:"grid grid-cols-2 gap-3",children:wM.map(c=>{const u=c===t;return i.jsxs("button",{type:"button",onClick:()=>n(c),"aria-pressed":u,className:`relative rounded-lg border p-2 text-left transition-colors hover:bg-accent ${u?"border-primary ring-1 ring-primary bg-accent":"border-border"}`,children:[u&&i.jsx("span",{className:"absolute right-2 top-2 rounded-full bg-primary p-0.5 text-primary-foreground",children:i.jsx(fr,{className:"h-3 w-3"})}),i.jsx(qte,{archetype:c}),i.jsx("span",{className:"mt-2 block text-xs leading-tight text-muted-foreground",children:_M[c]})]},c)})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(Xe,{className:"text-sm font-medium",children:"Logo size"}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[e,"px tall"]})]}),i.jsx(su,{value:[e],min:Dee,max:Fee,step:4,onValueChange:c=>s(c[0])}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Maximum logo height on desktop. Mobile scales down automatically."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx(Xe,{htmlFor:"sticky-header",className:"text-sm font-medium",children:"Sticky header"}),i.jsx(p3,{id:"sticky-header",checked:r,onCheckedChange:o})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Keeps the header pinned to the top while visitors scroll. Applied to every export format."})]})]})}),i.jsx("div",{className:"border-t p-3",children:i.jsxs(Y,{onClick:a,disabled:l,className:"w-full",children:[i.jsx($g,{className:"h-4 w-4 mr-2"}),l?"Applying…":"Apply Header Layout"]})})]})}const Iv=Y5,Ov=T1,Mv=R1,Kte=[{key:"primary",label:"Primary Color",description:"Main brand color"},{key:"secondary",label:"Secondary Color",description:"Complementary color"}
1657,{key:"background",label:"Background Color",description:"Page background color"},{key:"text",label:"Text Color",description:"Main paragraph text color"},{key:"heading",label:"Heading Color",description:"Color for H1-H6 headings"},{key:"link",label:"Link Color",description:"Hyperlink color"},{key:"linkHover",label:"Link Hover Color",description:"Hover state for links"}],Yte=[{key:"primaryButtonBg",label:"Background",description:"Primary button background"},{key:"primaryButtonText",label:"Text",description:"Primary button text color"},{key:"primaryButtonHover",label:"Hover",description:"Primary button hover state"}],Qte=[{key:"secondaryButtonBg",label:"Background",description:"Secondary button background"},{key:"secondaryButtonText",label:"Text",description:"Secondary button text color"},{key:"secondaryButtonHover",label:"Hover",description:"Secondary button hover state"}],Jte=g.forwardRef(function({colors:e,onColorChange:r,onSave:n,isSaving:s},o){return i.jsxs("div",{ref:o,className:"flex flex-col h-full min-h-0",children:[i.jsx(Qi,{className:"flex-1 min-h-0",children:i.jsxs("div",{className:"space-y-6 p-4 pb-2",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wider",children:"General Colors"}),i.jsx("div",{className:"grid gap-4",children:Kte.map(({key:a,label:l,description:c})=>i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg border border-border shadow-sm flex-shrink-0 cursor-pointer relative overflow-hidden",style:{backgroundColor:e[a]},children:i.jsx("input",{type:"color",value:e[a],onChange:u=>r(a,u.target.value),className:"absolute inset-0 opacity-0 cursor-pointer w-full h-full"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx(Xe,{className:"text-sm font-medium",children:l}),i.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c})]}),i.jsx(Nt,{type:"text",value:e[a],onChange:u=>r(a,u.target.value),className:"w-24 font-mono text-xs"})]},a))})]}),i.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[i.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wider",children:"Primary Buttons"}),i.jsx("div",{className:"grid gap-4",children:Yte.map(({key:a,label:l,description:c})=>i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg border border-border shadow-sm flex-shrink-0 cursor-pointer relative overflow-hidden",style:{backgroundColor:e[a]},children:i.jsx("input",{type:"color",value:e[a],onChange:u=>r(a,u.target.value),className:"absolute inset-0 opacity-0 cursor-pointer w-full h-full"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx(Xe,{className:"text-sm font-medium",children:l}),i.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c})]}),i.jsx(Nt,{type:"text",value:e[a],onChange:u=>r(a,u.target.value),className:"w-24 font-mono text-xs"})]},a))})]}),i.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[i.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wider",children:"Secondary Buttons"}),i.jsx("div",{className:"grid gap-4",children:Qte.map(({key:a,label:l,description:c})=>i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg border border-border shadow-sm flex-shrink-0 cursor-pointer relative overflow-hidden",style:{backgroundColor:e[a]},children:i.jsx("input",{type:"color",value:e[a],onChange:u=>r(a,u.target.value),className:"absolute inset-0 opacity-0 cursor-pointer w-full h-full"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx(Xe,{className:"text-sm font-medium",children:l}),i.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c})]}),i.jsx(Nt,{type:"text",value:e[a],onChange:u=>r(a,u.target.value),className:"w-24 font-mono text-xs"})]},a))})]})]})}),i.jsx("div",{className:"p-4 border-t border-border",children:i.jsxs(Y,{onClick:n,disabled:s,className:"w-full",children:[i.jsx($g,{className:"h-4 w-4 mr-2"}),"Apply Colors"]})})]})}),Xte=[{label:"Inter",value:"Inter"},{label:"Open Sans",value:"Open Sans"},{label:"Roboto",value:"Roboto"},{label:"Lato",value:"Lato"},{label:"Poppins",value:"Poppins"},{label:"Montserrat",value:"Montserrat"},{label:"Source Sans Pro",value:"Source Sans Pro"},{label:"Nunito",value:"Nunito"},{label:"Raleway",value:"Raleway"},{label:"PT Sans",value:"PT Sans"}],Zte=[{label:"Inter",value:"Inter"},{label:"Playfair Display",value:"Playfair Display"},{label:"Montserrat",value:"Montserrat"},{label:"Oswald",value:"Oswald"},{label:"Merriweather",value:"Merriweather"},{label:"Roboto Slab",value:"Roboto Slab"},{label:"Lora",value:"Lora"},{label:"Poppins",value:"Poppins"},{label:"Raleway",value:"Raleway"},{label:"Source Serif Pro",value:"Source Serif Pro"}],ere=g.forwardRef(function({typography:e,onTypographyChange:r,onSave:n,isSaving:s},o){const{baseFontSize:a,headingScale:l,bodyFont:c,headingFont:u}=e,d=a,h=Math.round(a*l),m=Math.round(a*Math.pow(l,2)),f=Math.round(a*Math.pow(l,3)),v=Math.round(a*Math.pow(l,4)),p=Math.round(a*Math.pow(l,5));return g.useEffect(()=>
1657{const b=[c,u].filter((w,j,_)=>_.indexOf(w)===j),x=document.getElementById("typography-preview-fonts"),y=`https://fonts.googleapis.com/css2?${b.map(w=>`family=${w.replace(/ /g,"+")}:wght@400;600;700`).join("&")}&display=swap`;if(x)x.href=y;else{const w=document.createElement("link");w.id="typography-preview-fonts",w.rel="stylesheet",w.href=y,document.head.appendChild(w)}},[c,u]),i.jsxs("div",{ref:o,className:"flex flex-col h-full min-h-0",children:[i.jsx(Qi,{className:"flex-1 min-h-0",children:i.jsxs("div",{className:"space-y-6 p-4 pb-2",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wider",children:"Font Families"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{children:"Body Font"}),i.jsxs(Vs,{value:e.bodyFont,onValueChange:b=>r("bodyFont",b),children:[i.jsx(bs,{children:i.jsx(Ks,{})}),i.jsx(ws,{children:Xte.map(b=>i.jsx(Lr,{value:b.value,children:b.label},b.value))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{children:"Heading Font"}),i.jsxs(Vs,{value:e.headingFont,onValueChange:b=>r("headingFont",b),children:[i.jsx(bs,{children:i.jsx(Ks,{})}),i.jsx(ws,{children:Zte.map(b=>i.jsx(Lr,{value:b.value,children:b.label},b.value))})]})]})]}),i.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[i.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wider",children:"Size Settings"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx(Xe,{children:"Base Font Size"}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[e.baseFontSize,"px"]})]}),i.jsx(su,{value:[e.baseFontSize],onValueChange:b=>r("baseFontSize",b[0]),min:12,max:24,step:1})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx(Xe,{children:"Heading Scale"}),i.jsx("span",{className:"text-sm text-muted-foreground",children:e.headingScale.toFixed(2)})]}),i.jsx(su,{value:[e.headingScale],onValueChange:b=>r("headingScale",b[0]),min:1.1,max:1.5,step:.05})]})]}),i.jsxs("div",{className:"space-y-4 pt-4 border-t border-border",children:[i.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wider",children:"Type Scale Preview"}),i.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg space-y-3 overflow-hidden",children:[i.jsx("div",{style:{fontFamily:`'${u}', serif`,fontSize:`${p}px`,lineHeight:1.2,fontWeight:600},className:"truncate text-foreground",children:"Heading 1"}),i.jsx("div",{style:{fontFamily:`'${u}', serif`,fontSize:`${v}px`,lineHeight:1.2,fontWeight:600},className:"truncate text-foreground",children:"Heading 2"}),i.jsx("div",{style:{fontFamily:`'${u}', serif`,fontSize:`${f}px`,lineHeight:1.3,fontWeight:600},className:"truncate text-foreground",children:"Heading 3"}),i.jsx("div",{style:{fontFamily:`'${u}', serif`,fontSize:`${m}px`,lineHeight:1.3,fontWeight:600},className:"truncate text-foreground",children:"Heading 4"}),i.jsx("div",{style:{fontFamily:`'${u}', serif`,fontSize:`${h}px`,lineHeight:1.4,fontWeight:600},className:"truncate text-foreground",children:"Heading 5"}),i.jsx("div",{style:{fontFamily:`'${u}', serif`,fontSize:`${d}px`,lineHeight:1.4,fontWeight:600},className:"truncate text-foreground",children:"Heading 6"}),i.jsx("div",{className:"pt-2 border-t border-border/50",children:i.jsx("p",{style:{fontFamily:`'${c}', sans-serif`,fontSize:`${a}px`,lineHeight:1.6},className:"text-foreground",children:"Body text looks like this. The quick brown fox jumps over the lazy dog."})})]})]})]})}),i.jsx("div",{className:"p-4 border-t border-border",children:i.jsxs(Y,{onClick:n,disabled:s,className:"w-full",children:[i.jsx($g,{className:"h-4 w-4 mr-2"}),"Apply Typography"]})})]})});function tre({projectId:t,onImageSelect:e}){const{track:r}=no(),[n,s]=g.useState(""),[o,a]=g.useState([]),[l,c]=g.useState(!1),[u,d]=g.useState(!1),[h,m]=g.useState(null),f=g.useRef(null),v=async()=>{var x;if(n.trim()){c(!0);try{const{data:y,error:w}=await re.functions.invoke("search-images",{body:{query:n}});if(w)throw w;a(y.results||[]),((x=y.results)==null?void 0:x.length)===0&&Q.info("No images found. Try a different search term.")}catch(y){console.error("Search error:",y),Q.error("Failed to search images")}c(!1)}},p=async x=>{var w;if(!x)return;const y=L1(x);if(y){Q.error(y);return}d(!0);try{const{data:{session:j}}=await re.auth.getSession();if(!((w=j==null?void 0:j.user)!=null&&w.id))throw new Error("Not authenticated");const _=x.name.split(".").pop(),S=`${j.user.id}/${t}/custom-${Date.now()}.${_}`,{error:N}=await re.storage.from("project-images").upload(S,x);if(N)throw N;const{data:{publicUrl:P}}=re.storage.from("project-images").getPublicUrl(S);await re.from("project_assets").insert({project_id:t,type:"image",url:P,source:"upload",name:x.name}),e(P,"upload"),r("theme_customized",{project_id:t,action:"image_uploaded"}),Q.success("Image uploaded!")}catch(j){console.error("Upload error:",j),Q.error("Failed to upload image")}d(!1)},b=async x=>{try{await re.from("project_assets").insert({project_id:t,type:"image",url:x.urls.regular,source:"unsplash",name:x.alt_description||"Unsplash image",metadata:{unsplash_id:x.id,photographer:x.user.name,photographer_url:x.user.links.html}}),e(x.urls.regular,"unsplash"),r("theme_customized",{project_id:t,action:"api_image_selected",source:"unsplash"}),Q.success("Image selected!")}catch(y){console.error("Select error:",y),Q.error("Failed to select image")}};return i.jsx("div",{className:"flex flex-col h-full min-h-0",children:i.jsxs(oa,{defaultValue:"search",className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[i.jsxs(Yi,{className:"grid w-full grid-cols-2 mx-4 mt-4",style:{width:"calc(100% - 2rem)"},children:[i.jsxs(gr,{value:"search",children:[i.jsx(wp,{className:"h-4 w-4 mr-2"}),"Search"]}),i.jsxs(gr,{value:"upload",children:[i.jsx(_p,{className:"h-4 w-4 mr-2"}),"Upload"]})]}),i.jsxs(Mr,{value:"search",className:"flex-1 flex flex-col mt-0 px-4 pb-4 min-h-0 overflow-hidden",children:[i.jsxs("div",{className:"flex gap-2 mb-4 pt-4 flex-shrink-0",children:[i.jsx(Nt,{placeholder:"Search Unsplash...",value:n,onChange:x=>s(x.target.value),onKeyDown:x=>x.key==="Enter"&&v()}),i.jsx(Y,{onClick:v,disabled:l||!n.trim(),size:"icon",children:l?i.jsx(et,{className:"h-4 w-4 animate-spin"}):i.jsx(wp,{className:"h-4 w-4"})})]}),i.jsx(Qi,{className:"flex-1 min-h-0",children:o.length>0?i.jsx("div",{className:"grid grid-cols-2 gap-3",children:o.map(x=>i.jsxs("div",{className:`relative cursor-pointer rounded-lg overflow-hidden border-2 transition-all ${h===x.urls.regular?"border-primary ring-2 ring-primary/50":"border-transparent hover:border-primary/50"}`,onClick:()=>m(x.urls.regular),onDoubleClick:()=>b(x),children:[i.jsx("img",{src:x.urls.small,alt:x.alt_description||"Unsplash image",className:"w-full aspect-video object-cover"}),i.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/60 to-transparent p-2",children:i.jsx("p",{className:"text-xs text-white truncate",children:x.user.name})})]},x.id))}):i.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-muted-foreground",children:[i.jsx(qa,{className:"h-8 w-8 mb-2"}),i.jsx("p",{className:"text-sm",children:"Search for images"})]})}),h&&i.jsx("div",{className:"mt-4",children:i.jsx(Y,{onClick:()=>{const x=o.find(y=>y.urls.regular===h);x&&b(x)},className:"w-full",children:"Use Selected Image"})})]}),i.jsxs(Mr,{value:"upload",className:"flex-1 px-4 pb-4 mt-0 min-h-0 overflow-auto",children:[i.jsx("div",{className:"border-2 border-dashed border-border rounded-lg p-6 text-center cursor-pointer hover:border-primary transition-colors mt-4",onClick:()=>{var x;return(x=f.current)==null?void 0:x.click()},children:u?i.jsx(et,{className:"h-12 w-12 mx-auto animate-spin text-primary"}):i.jsxs(i.Fragment,{children:[i.jsx(_p,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),i.jsx("p",{className:"text-foreground font-medium",children:"Click to upload"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"PNG, JPG, GIF up to 5MB"})]})}),i.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:x=>{var w;const y=(w=x.target.files)==null?void 0:w[0];y&&p(y),x.target.value=""}})]})]})})}const Hl="https://placehold.co/800x600/EEE/999?text=Image";function rre(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nre(t){const e=t.trim();if(!e)return[];const r=new Set([e]);
1657try{r.add(encodeURI(e)),r.add(decodeURIComponent(e))}catch{}try{const n=new URL(e);r.add(`${n.origin}${n.pathname}`),r.add(n.pathname);const s=n.pathname.replace(/^\/storage\/v1\/object\/public/i,"");s&&s!==n.pathname&&r.add(s)}catch{}return[...r].filter(Boolean)}function sre(t,e,r){let n=t||"",s=e||"",o=0;for(const l of nre(r||"")){if(l.length<8)continue;const c=new RegExp(rre(l),"gi"),u=(n.match(c)||[]).length,d=(s.match(c)||[]).length;u+d>0&&(n=n.replace(c,Hl),s=s.replace(c,Hl),o+=u+d)}const a=[/https?:\/\/[^"'\s)]+\/project-images\/[^"'\s)]*\/mockup-[^"'\s)]+/gi,/\/storage\/v1\/object\/public\/project-images\/[^"'\s)]*\/mockup-[^"'\s)]+/gi,/url\(\s*['"]?[^)"']*\/project-images\/[^)"']*\/mockup-[^)"']+['"]?\s*\)/gi];for(const l of a){const c=(n.match(l)||[]).length,u=(s.match(l)||[]).length;c+u>0&&(n=n.replace(l,d=>d.toLowerCase().startsWith("url(")?`url(${Hl})`:Hl),s=s.replace(l,d=>d.toLowerCase().startsWith("url(")?`url(${Hl})`:Hl),o+=c+u)}return{html:n,css:s,replacements:o}}const ire=/^\[\[pmgpt:([^\]]+)\]\]\s*/;function ore(t){const e=JSON.stringify(t);return btoa(unescape(encodeURIComponent(e)))}function are(t){try{const e=decodeURIComponent(escape(atob(t)));return JSON.parse(e)}catch{return}}function by(t){return btoa(unescape(encodeURIComponent(JSON.stringify(t))))}function wy(t){try{const e=decodeURIComponent(escape(atob(t)));return JSON.parse(e)}catch{return}}function os(t,e){const r=[];return e.page&&e.page!=="home"&&r.push(`page=${encodeURIComponent(e.page)}`),e.themeSettings&&Object.keys(e.themeSettings).length>0&&r.push(`settings=${ore(e.themeSettings)}`),e.navigationConfig&&Object.keys(e.navigationConfig).length>0&&r.push(`nav=${by(e.navigationConfig)}`),e.clarifyOptions&&e.clarifyOptions.length>0&&r.push(`options=${by(e.clarifyOptions.slice(0,5))}`),e.planSummary&&e.planSummary.length>0&&r.push(`plan=${by(e.planSummary.slice(0,6))}`),e.planStage&&r.push(`stage=${e.planStage}`),e.sourceLabel&&r.push(`source=${encodeURIComponent(e.sourceLabel)}`),e.snapshotKind&&r.push(`kind=${e.snapshotKind}`),e.undone&&r.push("undone=1"),r.length===0?t:`[[pmgpt:${r.join("&")}]] ${t}`}function gi(t){const e=t.match(ire);if(!e)return{displayContent:t,meta:{}};const r=t.slice(e[0].length),n={};for(const s of e[1].split("&")){const o=s.indexOf("=");if(o<0)continue;const a=s.slice(0,o),l=s.slice(o+1);if(a==="page"&&l&&(n.page=decodeURIComponent(l)),a==="settings"&&l&&(n.themeSettings=are(l)),a==="nav"&&l&&(n.navigationConfig=wy(l)),a==="options"&&l){const c=wy(l);Array.isArray(c)&&(n.clarifyOptions=c.filter(u=>typeof u=="string"&&u.trim().length>0).slice(0,5))}if(a==="plan"&&l){const c=wy(l);Array.isArray(c)&&(n.planSummary=c.filter(u=>typeof u=="string"&&u.trim().length>0).slice(0,6))}a==="stage"&&(l==="questions"||l==="approve")&&(n.planStage=l),a==="source"&&l&&(n.sourceLabel=decodeURIComponent(l)),a==="kind"&&l&&(n.snapshotKind=l),a==="undone"&&l==="1"&&(n.undone=!0)}return{displayContent:r,meta:n}}function lre(t){return!!(t.html_snapshot&&t.html_snapshot.trim().length>0)}function h2(t,e){const{displayContent:r,meta:n}=gi(t);return os(r,{...n,undone:!0})}function z1(t){if(t.role&&t.role!=="assistant"||!lre(t))return!1;const{displayContent:e,meta:r}=gi(t.content);return!(r.snapshotKind==="checkpoint"||r.undone||e==="Reverted to previous design"||e==="Undid previous change"||e.startsWith("Reverted to design from:"))}const cre=/\b(rollback|roll\s*back|revert|undo|go\s+back|restore\s+(?:my|the|previous)?\s*(?:design|version|site)?|getting worse|gotten worse|made it worse|each iteration)\b/i;function ure(t){return cre.test(t.trim())}function dre(){return"Click Undo on the latest change to step back one edit at a time. After each undo, the previous change becomes available to undo next."}function hre(t){const e=t.match(/^Applied: "(.+)"$/s);return e?`Undid: ${e[1]}`:t.startsWith("Applied: ")?`Undid: ${t.slice(9)}`:`Undid: ${t}`}function fre(t){const{displayContent:e,meta:r}=gi(t);return r.undone?hre(U1(e,r)):null}function mre(t){const{displayContent:e}=gi(t);return e==="Undid previous change"}function U1(t,e={}){if(e.sourceLabel)return e.sourceLabel;const r=t.match(/^Applied: "(.+)"$/s);if(r)return`Applied: "${r[1]}"`;if(/^Applied (Color|Typography|Design Settings)/i.test(t))return t;
1657if(/^Edit failed:/i.test(t))return t.replace(/\s*Your current design was kept.*$/i,"").trim();const n=t.match(/^Reverted to design from: "(.+)"$/s);return n?U1(n[1],{}):t.length>120?`${t.slice(0,117)}...`:t}function f2(t){const{displayContent:e,meta:r}=gi(t);return e==="Reverted to previous design"&&r.sourceLabel?`Reverted to: ${r.sourceLabel}`:e==="Undid previous change"&&r.sourceLabel?r.sourceLabel:e.startsWith("Reverted to design from:")?`Reverted to: ${U1(e,r)}`:e}function pre(t,e,r){var s;const n=t.findIndex(o=>o.id===e.id);if(n<0)return{html:r.fallbackHtml.trim(),css:r.fallbackCss.trim(),meta:{}};for(let o=n-1;o>=0;o--){const a=t[o];if(!((s=a.html_snapshot)!=null&&s.trim()))continue;if(a.role==="user"){const c=gi(a.content).meta;return{html:a.html_snapshot.trim(),css:(a.css_snapshot||r.fallbackCss).trim(),meta:c}}if(a.role!=="assistant")continue;const l=gi(a.content).meta;if(l.snapshotKind!=="before"&&l.snapshotKind!=="checkpoint"&&!l.undone)return{html:a.html_snapshot.trim(),css:(a.css_snapshot||r.fallbackCss).trim(),meta:l}}return{html:r.fallbackHtml.trim(),css:r.fallbackCss.trim(),meta:{}}}function Zw(t){for(let e=t.length-1;e>=0;e--)if(z1(t[e]))return t[e].id;return null}function m2(t,e){return z1(t)?Zw(e)===t.id:!1}function sd(t,e){var n;const r=[...t.matchAll(new RegExp(e.source,"gi"))];return r.length>0?((n=r[r.length-1][1])==null?void 0:n.trim())??null:null}function Wm(t){var c,u;const e={},r=[[/--td-color-primary:\s*([^;]+)/i,"primary"],[/--td-color-secondary:\s*([^;]+)/i,"secondary"],[/--td-color-background:\s*([^;]+)/i,"background"],[/--td-color-text:\s*([^;]+)/i,"text"],[/--td-color-heading:\s*([^;]+)/i,"heading"],[/--td-color-link:\s*([^;]+)/i,"link"],[/--td-color-link-hover:\s*([^;]+)/i,"linkHover"],[/--td-color-btn-primary-bg:\s*([^;]+)/i,"primaryButtonBg"],[/--td-color-btn-primary-text:\s*([^;]+)/i,"primaryButtonText"],[/--td-color-btn-primary-hover:\s*([^;]+)/i,"primaryButtonHover"],[/--td-color-btn-secondary-bg:\s*([^;]+)/i,"secondaryButtonBg"],[/--td-color-btn-secondary-text:\s*([^;]+)/i,"secondaryButtonText"],[/--td-color-btn-secondary-hover:\s*([^;]+)/i,"secondaryButtonHover"]];for(const[d,h]of r){const m=sd(t,d);m&&(e[h]=m.replace(/\s*!important\s*$/i,""))}const n={},s=sd(t,/--td-font-body:\s*([^;]+)/);if(s){const d=s.match(/['"]([^'"]+)['"]/);n.bodyFont=((c=d==null?void 0:d[1])==null?void 0:c.trim())||s.split(",")[0].replace(/^["'\s]+|["'\s]+$/g,"")}const o=sd(t,/--td-font-heading:\s*([^;]+)/);if(o){const d=o.match(/['"]([^'"]+)['"]/);n.headingFont=((u=d==null?void 0:d[1])==null?void 0:u.trim())||o.split(",")[0].replace(/^["'\s]+|["'\s]+$/g,"")}const a=sd(t,/--td-font-size-base:\s*(\d+)px/);a&&(n.baseFontSize=parseInt(a,10));const l=sd(t,/--td-heading-scale:\s*([\d.]+)/);return l&&(n.headingScale=parseFloat(l)),{colors:e,typography:n}}const g3="__navigationConfig";function v3(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"custom-link"}function x3(t,e=""){return`${v3(t)}${e?`-${e}`:""}`}function W1(t){let e=String(t||"").trim();return e&&(e=e.replace(/\.(?:php|html?|aspx?|jsp)$/i,"").replace(/[-_]+/g," ").replace(/\s+/g," ").trim(),e.split(" ").map(r=>{if(!r)return r;const n=r.toLowerCase();return new Set(["de","da","do","das","dos","e","o","a","os","as"]).has(n)&&e.indexOf(r)>0?n:r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()}).join(" "))}function y3(t){return String(t||"").trim().replace(/\.(?:php|html?|aspx?|jsp)$/i,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"page"}function gre(t){const e=[{id:"home",label:"Home",type:"page",target:"home",pageSlug:"home",visible:!0}];return Object.entries(t||{}).forEach(([r,n])=>{if(r==="home"||n.isTemplate||n.pageType==="post")return;const s=y3(r);e.push({id:x3(s),label:W1(n.title||s),type:"page",target:s,pageSlug:s,visible:!0})}),e}function p2(t,e){return{primary:Array.isArray(t==null?void 0:t.primary)&&t.primary.length>0?t.primary.map((n,s)=>({...n,id:n.id||x3(n.label||n.target||`item-${s}`),label:W1(n.label||n.target||`Item ${s+1}`),type:n.type||(n.pageSlug?"page":"custom_url"),target:n.target||n.pageSlug||n.href||"#",visible:n.visible!==!1})):gre(e),footer:t==null?void 0:t.footer,layout:(t==null?void 0:t.layout)||"horizontal",sticky:!!(t!=null&&t.sticky),shadowOnScroll:!!(t!=null&&t.shadowOnScroll),updatedAt:t==null?void 0:t.updatedAt}}function b3(t,e){const r=t==null?void 0:t[g3];return p2(r&&typeof r=="object"?r:void 0,e)}function vre(t,e){return{...t||{},[g3]:{...e,updatedAt:new Date().toISOString()}}}function xre(t){return t.href?t.href:t.type==="anchor"?t.target.startsWith("#")?t.target:`#${v3(t.target)}`:t.type==="custom_url"?t.target||"#":t.pageSlug==="home"||t.target==="home"?"#":`${t.pageSlug||t.target}.html`}function w3(t){const e=r=>{var s;const n=r.type==="page"?y3(r.pageSlug||r.target||""):void 0;return{title:W1(r.label),slug:n,href:xre({...r,pageSlug:n,target:n||r.target}),type:r.type,className:r.className||(r.type==="cta"?"nav-button-primary":void 0),children:(s=r.children)==null?void 0:s.filter(o=>o.visible!==!1).map(e)}};return t.primary.filter(r=>r.visible!==!1).map(e)}function yre(t){return["Applying"]}function bre(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _3(t){return t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"')}function wre(t){return t.replace(/&nbsp;/gi," ").replace(/&amp;/gi,"&").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#39;/gi,"'")}function j3(t){const e=_3(t.trim()),r=[/^replace\s+"([^"]+)"\s+with\s+"([^"]*)"\.?$/i,/^replace\s+'([^']+)'\s+with\s+'([^']*)'\.?$/i,/^change\s+"([^"]+)"\s+to\s+"([^"]*)"\.?$/i,/^change\s+'([^']+)'\s+to\s+'([^']*)'\.?$/i,/^rename\s+"([^"]+)"\s+to\s+"([^"]*)"\.?$/i,/^rename\s+'([^']+)'\s+to\s+'([^']*)'\.?$/i,/^please\s+replace\s+"([^"]+)"\s+with\s+"([^"]*)"\.?$/i];for(const n of r){const s=e.match(n);if(s)return{find:s[1],replace:s[2]}}return null}function g2(t,e,r){if(!e||e===r)return{text:t,count:0};const n=wre(_3(e));if(t.includes(n)){const d=t.split(n);return{text:d.join(r),count:d.length-1}}
1657const s=n.trim().split(/\s+/).filter(Boolean);if(s.length===0)return{text:t,count:0};const a=s.map(bre).join("(?:\\s|&nbsp;|&#160;|<[^>]+>)*"),l=new RegExp(a,"gi");let c=0;return{text:t.replace(l,()=>(c+=1,r)),count:c}}function _re(t,e,r,n){const s=g2(t||"",r,n),o=g2(e||"",r,n),a=s.count+o.count;return a===0?null:{html:s.text,css:o.text,replacements:a}}function jre(t){if(t.project_mode==="from_website"&&t.source_mode==="copy"||kre(t.master_html||""))return!0;const e=t.current_theme_data;if((e==null?void 0:e.copySiteSource)==="direct"||typeof(e==null?void 0:e.externalCss)=="string"&&e.externalCss.length>0)return!0;const r=e==null?void 0:e.stylesheetUrls;return!!(Array.isArray(r)&&r.length>0)}function k3(t){const e=t.project_mode||"";if(e==="mockup"||e==="figma"||jre(t))return!0;const r=[t.description,t.theme_description].map(s=>String(s||"")).join(" ");if(/mockup|figma|uploaded design|design mockup|from image|image to website|recreate the uploaded/i.test(r))return!0;const n=t.current_theme_data;if(n){const s=String(n.description||"");if(/mockup|figma|uploaded design|design mockup/i.test(s))return!0}return!1}function kre(t){return/\bfse-copy-preserve\b/i.test(t||"")}function Sre(t,e){if(!t||!e)return[];const r=new Set,n=[/<link[^>]+rel=["']stylesheet["'][^>]+href=["']([^"']+)["']/gi,/<link[^>]+href=["']([^"']+)["'][^>]+rel=["']stylesheet["']/gi,/<link[^>]+rel=["']preload["'][^>]+as=["']style["'][^>]+href=["']([^"']+)["']/gi,/<link[^>]+href=["']([^"']+)["'][^>]+as=["']style["']/gi];for(const s of n){let o;for(;(o=s.exec(t))!==null;)try{const a=o[1].startsWith("http")?o[1]:new URL(o[1],e).href;a.startsWith("http")&&r.add(a)}catch{}}return[...r]}function S3(t){const e=t.current_theme_data,r=e==null?void 0:e.stylesheetUrls;if(Array.isArray(r)&&r.length>0)return r.filter(o=>typeof o=="string"&&o.startsWith("http"));const n=String((e==null?void 0:e.scrapedHtml)||(e==null?void 0:e.scraped_html)||""),s=String(t.source_url||(e==null?void 0:e.sourceUrl)||"");return n.length>500&&s?Sre(n,s):[]}async function Nre(t){var r,n;const e={message:"Failed to apply changes. Please try again.",isInsufficientCredits:!1};if(!t||typeof t!="object"||!("context"in t))return e;try{const s=await((n=(r=t.context)==null?void 0:r.json)==null?void 0:n.call(r));if(!s)return e;if(typeof s.error=="string"){const o=s.creditsRemaining,a=typeof s.code=="string"?s.code:void 0,l=s.details&&typeof s.details=="object"?s.details:void 0;return(a||l)&&console.error("modify-section error details:",{code:a,details:l}),{message:s.error,isInsufficientCredits:typeof o=="number"&&o<1,code:a,details:l}}}catch{}return e}const v2={good:["Make the hero background the photo of the gym, not the green colour.","The three programme boxes should sit in one row, not stacked."],bad:["It doesn't look right, fix it.","It's getting worse."]};function Cre(t){return!j3(t)}function Ere(t,e){var r;return t!=="home"&&((r=e[t])!=null&&r.title)?e[t].title:t==="home"?"Home":t}const Pre={primary:"#0066cc",secondary:"#6c757d",background:"#ffffff",text:"#333333",heading:"#111111",link:"#0066cc",linkHover:"#004499",primaryButtonBg:"#0066cc",primaryButtonText:"#ffffff",primaryButtonHover:"#004499",secondaryButtonBg:"#6c757d",secondaryButtonText:"#ffffff",secondaryButtonHover:"#5a6268"},Tre={bodyFont:"Inter",headingFont:"Inter",baseFontSize:16,headingScale:1.25};function Are({project:t,onUpdate:e,onFinish:r,selectedModel:n,onModelChange:s,plan:o,trialActive:a=!1,onUpgradeNeeded:l,onAddPageUpgradeNeeded:c,onFullScreenPreview:u,discoveryNode:d,onShowDiscovery:h,discoveryHidden:m,activePageOverride:f,onActivePageConsumed:v,replicationState:p,replicationAutoContinue:b,onReplicationContinue:x,onReplicationStop:y,onReplicationRetry:w,onReplicationSkip:j,onReplicationSetAutoContinue:_}){var Ru,Iu;const{track:S}=no(),{refreshSubscription:N}=nn(),[P,C]=g.useState([]),[O,F]=g.useState(""),[T,A]=g.useState(!1),[k,$]=g.useState(null),[K,H]=g.useState(""),W=g.useRef(null),[R,G]=g.useState(!1),[U,z]=g.useState(!0),[oe,L]=g.useState([]),[q,he]=g.useState(""),[X,J]=g.useState(""),[de,le]=g.useState("editor"),[fe,Z]=g.useState(!1),[ae,E]=g.useState("chat"),[ne,te]=g.useState("logo-left-menu-right"),[D,M]=g.useState($ee),[V,me]=g.useState(!1),ve=g.useRef(!1),[se,pe]=g.useState(!1),[xe,we]=g.useState("home"),Ie=g.useRef(null),[tt,Ke]=g.useState([]),[Dt,yt]=g.useState(""),[Wt,Ct]=g.useState(!1),nt=g.useRef(""),Ft=g.useRef(null),kr=g.useCallback(I=>{Ke(B=>[...B,{...I,id:`${Date.now()}-${Math.random().toString(36).slice(2,7)}`}])},[]);g.useEffect(()=>{if(!p)return;const I=p;let B="";if(I.status==="running"?B=`run:${I.index}:${I.current.url}`:I.status==="awaiting_checkpoint"?B=`cp:${I.index}:${I.lastItem.url}`:I.status==="error"?B=`err:${I.index}:${I.current.url}:${I.message}`:I.status==="idle"&&(B=nt.current?"idle":""),!(!B||B===nt.current)){if(nt.current=B,I.status==="running")Ft.current={name:I.current.name,index:I.index,total:I.total};else if(I.status==="awaiting_checkpoint")kr({kind:"success",text:`✓ Copied the "${I.lastItem.name}" page (${I.index} of ${I.total}). If there are any issues, let me know specifically what to change.`}),Ft.current=null;else if(I.status==="error")kr({kind:"error",text:`Failed "${I.current.name}": ${I.message}`}),Ft.current=null;else if(I.status==="idle"&&tt.length>0){const ee=Ft.current;ee&&(kr({kind:"success",text:`✓ Copied the "${ee.name}" page (${ee.index+1} of ${ee.total}). If there are any issues, let me know specifically what to change.`}),Ft.current=null),kr({kind:"complete",text:"✓ All done — every selected page has been copied. Take a look, and if anything needs fixing, tell me exactly what to change and which page."})}}},[p==null?void 0:p.status,p==null?void 0:p.index]),g.useEffect(()=>{f&&f!==xe&&(we(f),le("preview"),v==null||v())},[f]);const ut=()=>{setTimeout(()=>{Ie.current&&Ie.current.scrollTo({top:Ie.current.scrollHeight,behavior:"smooth"})},0)},[Ue,sn]=g.useState(Pre),[bt,Vr]=g.useState(Tre),Je=t.pages||{},ie=Object.values(Je).some(I=>I.isTemplate),be=g.useCallback(I=>{we(I)},[]),st=g.useRef(!1),Oe=g.useMemo(()=>b3(t.section_customizations,Je),[t.section_customizations,Je]),$e=g.useMemo(()=>w3(Oe),[Oe]),Ze=g.useMemo(()=>k3(t),[t.project_mode,t.source_mode,t.source_url,t.master_html,t.description,t.theme_description,t.current_theme_data]),ht=g.useMemo(()=>S3(t),[t.current_theme_data,t.source_url]),_t=g.useCallback(I=>({...I!=="home"?{page:I}:{},navigationConfig:Oe}),[Oe]),Et=g.useMemo(()=>{var Ce;const I=t.master_html||"",B=Yl(I,$e),ee=Vw(B)||((Ce=B.match(/<header[^>]*>[\s\S]*?<\/header>/i))==null?void 0:Ce[0])||"",ce=I.match(/<footer[^>]*>[\s\S]*?<\/footer>/i)||I.match(/<(?:div|section)[^>]*class=["'][^"']*\bfse-footer\b[^"']*["'][^>]*>[\s\S]*?<\/(?:div|section)>/i),_e=ce?ce[0]:"";
1657return{header:ee,footer:_e}},[t.master_html,$e]),Cn=g.useMemo(()=>{var Ce,Pe;if(!Ze)return 0;const I=t.master_html||"",B=Vw(I)||((Ce=I.match(/<header[^>]*>[\s\S]*?<\/header>/i))==null?void 0:Ce[0])||"";if(!B)return 0;const ee=new Set($e.map(Te=>String(Te.title||"").toLowerCase().replace(/[^a-z0-9]+/g,"")).filter(Boolean));ee.add("home");let ce=0;const _e=[...B.matchAll(/<a\b([^>]*)>([\s\S]*?)<\/a>/gi)];for(const[,Te,We]of _e){const ft=((Pe=Te.match(/href=["']([^"']*)["']/i))==null?void 0:Pe[1])||"";if(/^(https?:|mailto:|tel:|#)/i.test(ft))continue;const qe=We.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();if(!qe||qe.length>40||/\b(btn|button|cta)\b/i.test(Te))continue;const ge=qe.toLowerCase().replace(/[^a-z0-9]+/g,"");ge&&!ee.has(ge)&&(ce+=1)}return ce},[Ze,t.master_html,$e]),on=Cn>0?i.jsxs("div",{className:"flex gap-3 justify-start mb-4",children:[i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0",children:i.jsx(Na,{className:"h-4 w-4 text-primary"})}),i.jsxs("div",{className:"max-w-[92%] flex-1 p-3 rounded-lg border border-border bg-muted/50 text-sm",children:["I removed ",Cn," menu link",Cn===1?"":"s"," from the header/footer because those pages don't exist yet. Add the pages and they'll be mapped to a real WordPress menu automatically. Buttons and action items were kept, but they may not be functional until you wire them up."]})]}):null,En=g.useCallback(I=>{if(!I)return I;const{header:B,footer:ee}=Et;if(!B&&!ee)return I;let ce=I;return B&&(/<header[^>]*>[\s\S]*?<\/header>/i.test(ce)?ce=ce.replace(/<header[^>]*>[\s\S]*?<\/header>/i,B):ce=`${B}
1658${ce}`),ee&&(/<footer[^>]*>[\s\S]*?<\/footer>/i.test(ce)?ce=ce.replace(/<footer[^>]*>[\s\S]*?<\/footer>/i,ee):ce=`${ce}
1659${ee}`),ce},[Et]),io=g.useRef(""),_l=g.useRef(!1),jl=g.useRef(!1),oo=g.useRef(null),Pu=g.useRef(null),an=g.useRef(null),ao=g.useRef(null),kl=g.useRef(null),va=g.useCallback(async(I,B,ee,ce)=>{const _e=I.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),Ce='<div class="fse-page-content" style="text-align:center; padding:80px 20px;"><h1 style="margin:0 0 12px;">'+I+'</h1><p style="opacity:0.7;">Page content will be generated...</p></div>',Te={html:Et.header?`${Et.header}
1660${Ce}
1661${Et.footer}`:Ce,title:I,slug:_e,pageType:B,isTemplate:!1,templateSlug:"inner-page",status:"draft",description:ee||void 0},We={...Je,[_e]:Te};await e({pages:We}),we(_e);{E("chat");const ft=!ie,qe=Et.header?`
1662
1663IMPORTANT: Use this EXACT header HTML (do not modify it):
1664${Et.header}
1665
1666And this EXACT footer HTML (do not modify it):
1667${Et.footer}`:"",ge=ft?`
1668
1669NOTE: This is the first inner page for this site. Design the layout so it works as a REUSABLE inner-page template — clean header, content area, and footer matching the homepage — while still containing the specific content requested below. The same structure will be reused for future pages.`:"";B==="post"?(F(ee?`Create a blog post page titled "${I}" about: ${ee}`:`Create a blog post page titled "${I}" with engaging, well-structured content appropriate for this site's topic.`),io.current=qe+ge+`
1670
1671CRITICAL BLOG POST RULES — you MUST follow these exactly:
16721. The page MUST begin with a banner section that uses the attribute data-pm-post-hero="true" like this:
1673<section class="fse-post-hero" data-pm-post-hero="true" style="background: [use a bold background color matching the site theme]; padding: 60px 20px; text-align: center;">
1674  <div class="fse-post-hero-inner" style="max-width: 1200px; margin: 0 auto;">
1675    <h1 class="fse-post-title" style="color: [contrasting text color]; font-size: 2.5rem;">${I}: [Your Generated Subtitle]</h1>
1676    <div class="fse-post-meta" style="color: [slightly faded text color]; margin-top: 12px;">Published on [today's date] • by Author</div>
1677  </div>
1678</section>
16792. The h1 title MUST be in the format "${I}: [AI Generated Subtitle]".
16803. Do NOT include any second hero, title banner, or duplicate h1 anywhere else in the post body.
16814. The rest of the article body should start immediately after the hero section with well-structured content sections.
16825. Style the banner inline so the background and text colors are explicit (not CSS variable references).`):(io.current=qe+ge,ce?(oo.current=ce,F(ee?`Recreate the "${I}" page layout from the uploaded design mockup. Notes: ${ee}`:`Recreate the "${I}" page layout from the uploaded design mockup. Match sections, spacing, colors, and typography closely.`)):F(ee?`Create a "${I}" page for this website: ${ee}`:`Create a "${I}" page for this website with appropriate sections and content for a typical "${I}
1682" page.`)),_l.current=!0,jl.current=!0,ft&&(an.current=_e)}},[Je,e,Et,ie]),Sl=g.useCallback(async I=>{const B={...Je};delete B[I],await e({pages:B}),xe===I&&we("home")},[Je,e,xe]),Ae=t.current_theme_data,[Zs,js]=g.useState(0),xa=g.useMemo(()=>`${X.split("").reduce((B,ee)=>(B<<5)-B+ee.charCodeAt(0)|0,0)}-${bt.bodyFont}-${bt.headingFont}-${Zs}`,[X,bt.bodyFont,bt.headingFont,Zs]);g.useEffect(()=>{is()},[t.id]);const er=g.useRef(!1),ei=g.useRef(!1),lo=g.useRef(new Set),wi=g.useMemo(()=>P.map(I=>lo.current.has(I.id)?{...I,content:h2(I.content)}:I),[P]);g.useEffect(()=>{if(er.current){er.current=!1;return}let I,B;xe!=="home"&&Je[xe]?(I=Yl(Je[xe].html||"",$e),B=Je[xe].css||t.master_css||(Ae==null?void 0:Ae.previewCss)||""):(I=Yl(t.master_html||(Ae==null?void 0:Ae.previewHtml)||"",$e),B=t.master_css||(Ae==null?void 0:Ae.previewCss)||""),B=B5(B),he(()=>I),J(()=>B),Tu(B)},[t.master_html,t.master_css,t.id,Ae==null?void 0:Ae.previewHtml,Ae==null?void 0:Ae.previewCss,xe,Je,$e]),g.useEffect(()=>{_l.current&&O.trim()&&!R&&(_l.current=!1,co())},[O,R]),g.useEffect(()=>{!U&&P.length>0&&ut()},[P,U]),g.useEffect(()=>{ut()},[tt,p==null?void 0:p.status,p==null?void 0:p.index]);const ti=(I,B)=>{var ce;const ee=[...I.matchAll(new RegExp(B.source,"gi"))];return ee.length>0?(ce=ee[ee.length-1][1])==null?void 0:ce.trim():null},Tu=I=>{const B={},ee=[[/--td-color-primary:\s*([^;]+)/i,"primary"],[/--td-color-secondary:\s*([^;]+)/i,"secondary"],[/--td-color-background:\s*([^;]+)/i,"background"],[/--td-color-text:\s*([^;]+)/i,"text"],[/--td-color-heading:\s*([^;]+)/i,"heading"],[/--td-color-link:\s*([^;]+)/i,"link"],[/--td-color-link-hover:\s*([^;]+)/i,"linkHover"],[/--td-color-btn-primary-bg:\s*([^;]+)/i,"primaryButtonBg"],[/--td-color-btn-primary-text:\s*([^;]+)/i,"primaryButtonText"],[/--td-color-btn-primary-hover:\s*([^;]+)/i,"primaryButtonHover"],[/--td-color-btn-secondary-bg:\s*([^;]+)/i,"secondaryButtonBg"],[/--td-color-btn-secondary-text:\s*([^;]+)/i,"secondaryButtonText"],[/--td-color-btn-secondary-hover:\s*([^;]+)/i,"secondaryButtonHover"]];for(const[We,ft]of ee){const qe=ti(I,We);qe&&(B[ft]=qe)}Object.keys(B).length>0&&sn(We=>({...We,...B}));const ce={},_e=ti(I,/--td-font-body:\s*'([^']+)'/);_e&&(ce.bodyFont=_e);const Ce=ti(I,/--td-font-heading:\s*'([^']+)'/);Ce&&(ce.headingFont=Ce);const Pe=ti(I,/--td-font-size-base:\s*(\d+)px/);Pe&&(ce.baseFontSize=parseInt(Pe));const Te=ti(I,/--td-heading-scale:\s*([\d.]+)/);Te&&(ce.headingScale=parseFloat(Te)),Object.keys(ce).length>0&&Vr(We=>({...We,...ce}))},is=async()=>{z(!0);const{data:I,error:B}=await re.from("design_messages").select("*").eq("project_id",t.id).order("created_at",{ascending:!0});B?console.error("Failed to load messages:",B):C((I||[]).map(ee=>{const ce=ee.role;gi(ee.content).meta.undone&&lo.current.add(ee.id);const Ce=lo.current.has(ee.id)?h2(ee.content):ee.content;return{...ee,role:ce,content:Ce}})),z(!1)},co=async(I,B={})=>{var it,mt,Pt,jt,Pn,pt;if(R)return;const ee=(I??O).trim();if(!ee)return;const ce=Pu.current,_e=ce&&ee.includes(ce)?ce:null;Pu.current=null;const Ce=io.current?`${ee}${io.current}`:ee;io.current="",L(["Thinking"]),F(""),G(!0);let Pe,Te;kl.current?(Pe=kl.current,kl.current=null,Te=X||t.master_css||(Ae==null?void 0:Ae.previewCss)||""):xe!=="home"&&Je[xe]&&!st.current?(Pe=Je[xe].html||q||"",Te=Je[xe].css||X||t.master_css||(Ae==null?void 0:Ae.previewCss)||""):(Pe=q||t.master_html||(Ae==null?void 0:Ae.previewHtml)||"",Te=X||t.master_css||(Ae==null?void 0:Ae.previewCss)||"");const{data:We,error:ft}=await re.from("design_messages").insert({project_id:t.id,role:"user",content:os(ee,_t(xe)),html_snapshot:Pe||null,css_snapshot:Te||null}).select().single();if(ft){console.error("Failed to save user message:",ft),Q.error("Failed to save message"),G(!1);return}C(xt=>[...xt,{...We,role:We.role}]);const qe=mZ(t.section_customizations);let ge=Ce;if(ure(ee)){await re.functions.invoke("clarify-request",{body:{action:"charge_read",model:n}});const xt=Zw(wi),Rt=xt?wi.find(Fe=>Fe.id===xt):null;if(Rt)G(!1),await Nl(Rt);else{const{data:Fe}=await re.from("design_messages").insert({project_id:t.id,role:"assistant",content:os(dre(),{page:xe!=="home"?xe:"home",snapshotKind:"checkpoint"}),html_snapshot:Pe||null,css_snapshot:Te||null}).select().single();Fe?C(Ht=>[...Ht,{...Fe,role:Fe.role}]):await is(),G(!1),ut()}return}if(!B.skipClarification&&!_e&&Ce===ee&&!jl.current&&!oo.current&&Cre(ee))try{const{data:xt,error:Rt}=await re.functions.invoke("clarify-request",{body:{message:ee,pageName:Ere(xe,Je),html:Pe,css:Te,recentMessages:P.slice(-6).map(Fe=>({role:Fe.role,content:f2(Fe.content)})),model:n,siteCapture:qe?{url:qe.url,status:qe.status,error:qe.error}:null}});if(Rt){const{message:Fe}=await On(Rt,"The AI helper could not review this request.");Q.error(Fe,{duration:8e3}),G(!1),ut();return}else{const Fe=xt,Ht=(Fe==null?void 0:Fe.mode)??(Fe!=null&&Fe.intentIsVague?"vague":"specific");
1682if(Ht==="specific"&&((it=Fe==null?void 0:Fe.instruction)!=null&&it.trim()&&(ge=`${Fe.instruction.trim()}
1683
1684Original request: ${ee}`),!oo.current)){const mr=yZ(qe,ee);mr&&(oo.current=mr)}if(Ht==="undo"){G(!1);const mr=Zw(wi),Ur=mr?wi.find(ks=>ks.id===mr):null;if(Ur){await Nl(Ur);return}}if(Fe&&Ht!=="specific"){const mr=Array.isArray(Fe.options)?Fe.options.filter(Sr=>typeof Sr=="string"&&Sr.trim().length>0).slice(0,5):[],Ur=Array.isArray(Fe.planSummary)?Fe.planSummary.filter(Sr=>typeof Sr=="string"&&Sr.trim().length>0).slice(0,6):[],ks=Ht==="plan"?Ur.length>0?"approve":"questions":void 0,pr=(mt=Fe.capabilityNote)==null?void 0:mt.trim(),lt=((Pt=Fe.reply)==null?void 0:Pt.trim())||(Ht==="plan"?"Before I build this, a couple of quick questions.":"I need one specific thing to change before I edit it."),Ar=pr&&Ht==="plan"?`${lt}
1685
1686${pr}`:lt,{data:Rr,error:lr}=await re.from("design_messages").insert({project_id:t.id,role:"assistant",content:os(Ar,{page:xe!=="home"?xe:"home",snapshotKind:"checkpoint",clarifyOptions:mr,planSummary:Ur.length>0?Ur:void 0,planStage:ks}),html_snapshot:Pe||null,css_snapshot:Te||null}).select().single();lr?(console.error("Failed to save clarification message:",lr),await is()):C(Sr=>[...Sr,{...Rr,role:Rr.role}]),G(!1),ut();return}}}catch(xt){console.warn("Clarification failed:",xt instanceof Error?xt.message:xt),Q.error("The AI helper could not review this request. Your design was not changed."),G(!1),ut();return}L(yre());try{const xt=jl.current;jl.current=!1;const Rt=oo.current;oo.current=null;let Fe=null,Ht=!1;const mr=!xt&&!Rt&&Ce===ee?j3(ee):null;if(mr){const It=_re(Pe,Te,mr.find,mr.replace);if(It)Fe=It,Ht=!0,console.info("Applied simple text edit locally without AI",{find:mr.find,replace:mr.replace,replacements:It.replacements});else{const cr=`Could not find "${mr.find}" in the current page. Check the exact wording, punctuation, and quotes from the preview.`;Q.error(cr,{duration:8e3}),await re.from("design_messages").insert({project_id:t.id,role:"assistant",content:os(`Edit failed: ${cr}`,{page:xe!=="home"?xe:"home",themeSettings:{colors:Ue,typography:bt},snapshotKind:"checkpoint"}),html_snapshot:Pe||null,css_snapshot:Te||null}),await is(),G(!1),ut();return}}if(!Fe){const{data:It,error:cr}=await re.functions.invoke("modify-section",{body:{section:"design",prompt:ge,masterHtml:Pe,masterCss:Te,themeName:(Ae==null?void 0:Ae.name)||t.name,model:n,isPageGeneration:xt,referenceImageUrl:Rt||void 0,referenceDigest:xZ(qe)||void 0,checks:_e?[{kind:"html_contains",value:_e}]:void 0}});if(cr)throw cr;Fe=It}if(!(Fe!=null&&Fe.html)||!(Fe!=null&&Fe.css))throw new Error("Invalid response from AI");if(Rt){const It=sre(Fe.html,Fe.css,Rt);It.replacements>0&&(Fe={html:It.html,css:It.css})}const Ur=an.current?an.current:st.current?"inner-page":xe!=="home"&&Je[xe]?xe:"home",ks=`Applied: "${ee}"`;let pr=Fe.html;const lt=Fe.css;(jt=ao.current)!=null&&jt.length?(pr=Yl(pr,ao.current),ao.current=null):Ze&&Ur==="home"&&!/\b(header|footer|logo|nav|menu|top bar)\b/i.test(ee)?pr=aee(Pe,pr):!Ze&&$e.length>0&&Ur==="home"&&(pr=Yl(pr,$e));const Ar=st.current;st.current=!1;const Rr=an.current;if(an.current=null,Rr){const It=En(Fe.html);pr=It;const cr={html:It,title:"Inner Page Template",slug:"inner-page",css:Fe.css,isTemplate:!0,status:"published"},Kr=Je[Rr],ji={...Kr||{},html:It,css:Fe.css,slug:Rr,title:(Kr==null?void 0:Kr.title)||Rr,pageType:(Kr==null?void 0:Kr.pageType)||"page",isTemplate:!1,templateSlug:"inner-page",status:"published"},ln={...Je,"inner-page":cr,[Rr]:ji};await e({pages:ln}),he(It),J(Fe.css)}else if(Ar){const It=En(Fe.html);pr=It;const cr={html:It,title:"Inner Page Template",slug:"inner-page",css:Fe.css,isTemplate:!0,status:"published"},Kr={...Je,"inner-page":cr};await e({pages:Kr}),he(It),J(Fe.css)}else if(xe!=="home"&&Je[xe]){const It=En(Fe.html);pr=It;const Kr={...Je[xe],html:It,css:Fe.css},ji={...Je,[xe]:Kr};await e({pages:ji}),he(It),J(Fe.css)}else await e({master_html:Fe.html,master_css:Fe.css}),he(Fe.html),J(Fe.css);const{data:lr,error:Sr}=await re.from("design_messages").insert({project_id:t.id,role:"assistant",content:os(ks,{page:Ur,themeSettings:{colors:Ue,typography:bt},sourceLabel:ks,snapshotKind:"applied"}),html_snapshot:pr,css_snapshot:lt}).select().single();Sr?console.error("Failed to save assistant message:",Sr):C(It=>[...It,{...lr,role:lr.role}]),S("theme_customized",{project_id:t.id,action:"chat_modification"}),Ht||await N(),Q.success(Ht?"Text updated!":"Design updated!")}catch(xt){console.error("Design modification error:",xt);const{message:Rt,isInsufficientCredits:Fe,code:Ht,details:mr}=await Nre(xt);if((Ht||mr)&&console.error("Design modification failure context:",{code:Ht,details:mr}),Fe){pe(!0),G(!1);return}Q.error(Rt,{duration:8e3});const Ur=xe!=="home"&&Je[xe]?xe:"home",ks=Ur!=="home"?((Pn=Je[Ur])==null?void 0:Pn.html)||q||"":q||t.master_html||(Ae==null?void 0:Ae.previewHtml)||"",pr=Ur!=="home"?((pt=Je[Ur])==null?void 0:pt.css)||X||t.master_css||(Ae==null?void 0:Ae.previewCss)||"":X||t.master_css||(Ae==null?void 0:Ae.previewCss)||"";await re.from("design_messages").insert({project_id:t.id,role:"assistant",content:os(`Edit failed: ${Rt} Your current design was kept — use Revert on an earlier message to restore a previous version.`,{page:Ur,themeSettings:{colors:Ue,typography:bt},snapshotKind:"checkpoint"}),html_snapshot:ks||null,css_snapshot:pr||null}),await is()}G(!1),ut()},Nl=async I=>{if(ei.current||R)return;if(!m2(I,wi)){z1(I)?Q.error("Undo the most recent change first, then work backward one step at a time."):Q.error("Cannot undo this change — no earlier design snapshot.");return}const{displayContent:B,meta:ee}
1686=gi(I.content),ce=(Ae==null?void 0:Ae.previewHtml)||t.master_html||q||"",_e=(Ae==null?void 0:Ae.previewCss)||t.master_css||X||"",Ce=pre(wi,I,{fallbackHtml:ce,fallbackCss:_e}),Pe=Ce.html,Te=Ce.css||_e,We=ee.page||Ce.meta.page||"home",ft={};if(We!=="home"&&Je[We]){const ge=Je[We];ft.pages={...Je,[We]:{...ge,html:Pe,css:Te}}}else ft.master_html=Pe,ft.master_css=Te;const qe=Ce.meta.themeSettings??ee.themeSettings??(()=>{const ge=Wm(Te);if(!(Object.keys(ge.colors).length===0&&Object.keys(ge.typography).length===0))return ge})();qe&&(ft.theme_settings={...t.theme_settings,...qe},qe.colors&&sn(ge=>({...ge,...qe.colors})),qe.typography&&Vr(ge=>({...ge,...qe.typography}))),Ce.meta.navigationConfig&&(ft.section_customizations=vre(t.section_customizations,Ce.meta.navigationConfig)),ei.current=!0,G(!0);try{await e(ft);const ge=os(B,{...ee,undone:!0}),{error:it}=await re.from("design_messages").update({content:ge}).eq("id",I.id);lo.current.add(I.id),it&&console.error("Failed to mark message undone:",it),C(mt=>mt.map(Pt=>Pt.id===I.id?{...Pt,content:ge}:Pt)),We!=="home"&&we(We),er.current=!0,he(Pe),J(Te),js(mt=>mt+1),Tu(Te),await is(),Q.success(We!=="home"?`Undid change on "${We}" page`:"Undid change — restored previous design")}catch(ge){console.error("Revert error:",ge),Q.error(ge instanceof Error?ge.message:"Failed to revert design")}ei.current=!1,G(!1),ut()},bf=async(I,B)=>{if(R){Q.info("Please wait for the current update to finish before replacing another image.");return}Pu.current=I,F(`Replace the placeholder image with this new image: ${I}`),E("chat"),Q.info("Replace one image at a time and wait for the update to finish.",{duration:5e3}),S("theme_customized",{project_id:t.id,action:B==="upload"?"image_uploaded":"api_image_selected"})},wf=(I,B=!1)=>{co(I,{skipClarification:!B})},Au=I=>{$(I),H(""),setTimeout(()=>{var B;return(B=W.current)==null?void 0:B.focus()},0)},_i=(I=!1)=>{const B=K.trim();B&&($(null),H(""),co(B,{skipClarification:!I}))},Fv=I=>{const B=`Build this now on the current page:
1687${I.map(ee=>`- ${ee}`).join(`
1688`)}
1689
1690Build any interactive behaviour so it also keeps working on the exported WordPress site. If part of it needs a server (payments, logins, saved submissions, emails, live data), add a clearly labelled placeholder for that part instead.`;co(B,{skipClarification:!0})},Lv=I=>new Date(I).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),_f=(I,B)=>{sn(ee=>({...ee,[I]:B}))},Bv=(I,B)=>{Vr(ee=>({...ee,[I]:B}))},zv=()=>`
1691/* Theme Designer - Color Settings */
1692:root {
1693  --td-color-primary: ${Ue.primary};
1694  --td-color-secondary: ${Ue.secondary};
1695  --td-color-background: ${Ue.background};
1696  --td-color-text: ${Ue.text};
1697  --td-color-heading: ${Ue.heading};
1698  --td-color-link: ${Ue.link};
1699  --td-color-link-hover: ${Ue.linkHover};
1700  --td-color-btn-primary-bg: ${Ue.primaryButtonBg};
1701  --td-color-btn-primary-text: ${Ue.primaryButtonText};
1702  --td-color-btn-primary-hover: ${Ue.primaryButtonHover};
1703  --td-color-btn-secondary-bg: ${Ue.secondaryButtonBg};
1704  --td-color-btn-secondary-text: ${Ue.secondaryButtonText};
1705  --td-color-btn-secondary-hover: ${Ue.secondaryButtonHover};
1706}
1707
1708body {
1709  color: var(--td-color-text) !important;
1710  background-color: var(--td-color-background) !important;
1711}
1712
1713h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 { color: var(--td-color-heading) !important; }
1714
1715p, .text, .body-text { color: var(--td-color-text) !important; }
1716
1717a:not(.btn):not(.button):not(.wp-block-button__link):not(.wp-element-button):not(.fse-button):not([class*="fse-button"]) { color: var(--td-color-link) !important; }
1718a:not(.btn):not(.button):not(.wp-block-button__link):not(.wp-element-button):not(.fse-button):not([class*="fse-button"]):hover { color: var(--td-color-link-hover) !important; }
1719
1720.btn, .button, .fse-button, .fse-button-primary, .wp-block-button__link, .wp-element-button, .btn-primary, .button-primary, .cta, input[type="submit"], button[type="submit"] {
1721  background-color: var(--td-color-btn-primary-bg) !important;
1722  border-color: var(--td-color-btn-primary-bg) !important;
1723  color: var(--td-color-btn-primary-text) !important;
1724}
1725.btn:hover, .button:hover, .btn-primary:hover, .cta:hover {
1726  background-color: var(--td-color-btn-primary-hover) !important;
1727  border-color: var(--td-color-btn-primary-hover) !important;
1728}
1729
1730.fse-button-secondary, .btn-secondary, .button-secondary {
1731  background-color: var(--td-color-btn-secondary-bg) !important;
1732  border-color: var(--td-color-btn-secondary-bg) !important;
1733  color: var(--td-color-btn-secondary-text) !important;
1734}
1735.btn-secondary:hover, .button-secondary:hover {
1736  background-color: var(--td-color-btn-secondary-hover) !important;
1737  border-color: var(--td-color-btn-secondary-hover) !important;
1738}
1739/* End Theme Designer - Color Settings */
1740`,Uv=()=>{const{baseFontSize:I,headingScale:B}=bt,ee=I,ce=Math.round(I*B),_e=Math.round(I*Math.pow(B,2)),Ce=Math.round(I*Math.pow(B,3)),Pe=Math.round(I*Math.pow(B,4)),Te=Math.round(I*Math.pow(B,5));return`
1741/* Theme Designer - Typography Settings */
1742:root {
1743  --td-font-body: '${bt.bodyFont}', sans-serif;
1744  --td-font-heading: '${bt.headingFont}', serif;
1745  --td-font-size-base: ${I}px;
1746  --td-heading-scale: ${B};
1747}
1748
1749body {
1750  font-family: var(--td-font-body) !important;
1751  font-size: var(--td-font-size-base) !important;
1752}
1753
1754h1, .h1 { font-family: var(--td-font-heading) !important; font-size: ${Te}px !important; }
1755h2, .h2 { font-family: var(--td-font-heading) !important; font-size: ${Pe}px !important; }
1756h3, .h3 { font-family: var(--td-font-heading) !important; font-size: ${Ce}px !important; }
1757h4, .h4 { font-family: var(--td-font-heading) !important; font-size: ${_e}px !important; }
1758h5, .h5 { font-family: var(--td-font-heading) !important; font-size: ${ce}px !important; }
1759h6, .h6 { font-family: var(--td-font-heading) !important; font-size: ${ee}px !important; }
1760
1761p, .text, .body-text { font-family: var(--td-font-body) !important; font-size: var(--td-font-size-base) !important; }
1762/* End Theme Designer - Typography Settings */
1763`},Wv=I=>{let B=I;const ee=/\/\*\s*Global Design Settings[^*]*\*\/[\s\S]*?\/\*\s*End Global Design Settings\s*\*\//gi;B=B.replace(ee,""),B=B.replace(/(:root\s*\{[^}]*)(--td-font-body:[^;]+;)/gi,(_e,Ce,Pe)=>_e.includes("Theme Designer - Typography")?_e:Ce+"/* neutralized: "+Pe+" */"),B=B.replace(/(:root\s*\{[^}]*)(--td-font-heading:[^;]+;)/gi,(_e,Ce,Pe)=>_e.includes("Theme Designer - Typography")?_e:Ce+"/* neutralized: "+Pe+" */"),B=B.replace(/(:root\s*\{[^}]*)(--td-font-size-base:[^;]+;)/gi,(_e,Ce,Pe)=>_e.includes("Theme Designer - Typography")?_e:Ce+"/* neutralized: "+Pe+" */"),B=B.replace(/(:root\s*\{[^}]*)(--td-heading-scale:[^;]+;)/gi,(_e,Ce,Pe)=>_e.includes("Theme Designer - Typography")?_e:Ce+"/* neutralized: "+Pe+" */");const ce=/(h[1-6](?:\s*,\s*\.h[1-6])*\s*\{[^}]*)(font-family:\s*(?!'var\(--td-font-heading\)')[^;!]+!important;)/gi;return B=B.replace(ce,(_e,Ce,Pe)=>Pe.includes("var(--td-font-heading)")?_e:Ce+"/* neutralized: "+Pe+" */"),B},Cl=(I,B,ee,ce,_e=!1)=>{let Ce=I;if(_e)Ce=Wv(Ce);else{const We=/\/\*\s*Global Design Settings[^*]*\*\/[\s\S]*?\/\*\s*End Global Design Settings\s*\*\//gi;Ce=Ce.replace(We,"")}const Pe=Ce.indexOf(ee),Te=Ce.indexOf(ce);return Pe!==-1&&Te!==-1?Ce.slice(0,Pe)+B+Ce.slice(Te+ce.length):Ce.trim()+`
1764
1765`+B};g.useEffect(()=>{if(ve.current)return;const I=q||t.master_html||(Ae==null?void 0:Ae.previewHtml)||"";if(!I)return;ve.current=!0;const{archetype:B,logoHeight:ee}=jM(I),ce=X||t.master_css||(Ae==null?void 0:Ae.previewCss)||"",_e=B||SM(I,ce);_e&&te(_e),ee&&M(ee),me(Hee(I,ce))},[q,X,t.master_html,t.master_css,Ae==null?void 0:Ae.previewHtml,Ae==null?void 0:Ae.previewCss]);const Hv=async()=>{Z(!0);try{const I=q||t.master_html||(Ae==null?void 0:Ae.previewHtml)||"",B=X||t.master_css||(Ae==null?void 0:Ae.previewCss)||"",ee=qee(I,ne,D,V);let ce=Cl(B,Vee(ne,D),Lee,Bee);ce=Cl(ce,Gee(V),zee,Uee),await e({master_html:ee,master_css:ce}),await re.from("design_messages").insert({project_id:t.id,role:"assistant",content:os(`Applied Header Layout: ${ne} (logo ${D}px)`,{page:"home",sourceLabel:`Applied Header Layout: ${ne}`,snapshotKind:"applied"}),html_snapshot:ee,css_snapshot:ce}),er.current=!0,he(ee),J(ce),js(_e=>_e+1),await is(),S("theme_customized",{project_id:t.id,action:"header_layout_applied"}),Q.success("Header layout applied!")}catch(I){console.error("Failed to apply header layout:",I),Q.error("Failed to apply header layout")}Z(!1)},jf=async()=>{Z(!0);try{const I=zv(),B=X||t.master_css||(Ae==null?void 0:Ae.previewCss)||"",ee=Cl(B,I,"/* Theme Designer - Color Settings */","/* End Theme Designer - Color Settings */"),ce=t.master_html||(Ae==null?void 0:Ae.previewHtml)||"";await e({theme_settings:{colors:Ue,typography:bt},master_css:ee}),await re.from("design_messages").insert({project_id:t.id,role:"assistant",content:os(`Applied Color Settings: Primary ${Ue.primary}, Secondary ${Ue.secondary}`,{page:"home",themeSettings:{colors:Ue,typography:bt},sourceLabel:`Applied Color Settings: Primary ${Ue.primary}, Secondary ${Ue.secondary}`,snapshotKind:"applied"}),html_snapshot:ce,css_snapshot:ee}),er.current=!0,J(ee),js(_e=>_e+1),await is(),S("theme_customized",{project_id:t.id,action:"colors_applied",colors_changed:!0}),Q.success("Colors applied!")}catch(I){console.error("Failed to save colors:",I),Q.error("Failed to apply colors")}Z(!1)},kf=async()=>{Z(!0);try{const I=Uv(),B=X||t.master_css||(Ae==null?void 0:Ae.previewCss)||"",ee=Cl(B,I,"/* Theme Designer - Typography Settings */","/* End Theme Designer - Typography Settings */",!0),ce=t.master_html||(Ae==null?void 0:Ae.previewHtml)||"";await e({theme_settings:{colors:Ue,typography:bt},master_css:ee}),await re.from("design_messages").insert({project_id:t.id,role:"assistant",content:os(`Applied Typography: ${bt.headingFont} headings, ${bt.bodyFont} body, ${bt.baseFontSize}px base`,{page:"home",themeSettings:{colors:Ue,typography:bt},sourceLabel:`Applied Typography: ${bt.headingFont} headings, ${bt.bodyFont} body, ${bt.baseFontSize}px base`,snapshotKind:"applied"}),html_snapshot:ce,css_snapshot:ee}),er.current=!0,J(ee),js(_e=>_e+1),await is(),S("theme_customized",{project_id:t.id,action:"typography_applied",fonts_changed:!0}),Q.success("Typography applied!")}catch(I){console.error("Failed to save typography:",I),Q.error("Failed to apply typography")}Z(!1)},El=()=>{const I=p;if(!(tt.length>0||I&&I.status!=="idle"))return null;const ee=({children:ce,tone:_e="default"})=>i.jsxs("div",{className:"flex gap-3 justify-start",children:[i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0",children:i.jsx(Na,{className:"h-4 w-4 text-primary"})}),i.jsx("div",{className:`max-w-[92%] flex-1 rounded-2xl px-4 py-2 text-sm ${_e==="error"?"bg-destructive/10 text-destructive border border-destructive/30":"bg-muted"}`,children:ce})]});return i.jsxs("div",{className:"space-y-3",children:[tt.map(ce=>i.jsx(ee,{tone:ce.kind==="error"?"error":"default",children:i.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[i.jsx("span",{children:ce.text}),ce.kind==="complete"&&h&&m&&i.jsx(Y,{size:"sm",variant:"link",className:"h-auto p-0 text-xs",onClick:h,children:"Replicate more pages →"})]})},ce.id)),(I==null?void 0:I.status)==="running"&&i.jsx(ee,{children:i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:"inline-flex items-center gap-2",children:[i.jsx(et,{className:"h-3.5 w-3.5 animate-spin text-primary"}),"Replicating page ",I.index+1," of ",I.total,": ",i.jsx("span",{className:"font-medium",children:I.current.name})]}),y&&i.jsx(Y,{size:"sm",variant:"ghost",onClick:y,className:"h-7 px-2 text-xs",children:"Stop"})]})}),(I==null?void 0:I.status)==="awaiting_checkpoint"&&i.jsx(ee,{children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"text-xs text-muted-foreground",children:["Page ",I.index," of ",I.total," complete"]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(fr,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),i.jsxs("span",{children:['"',I.lastItem.name,'" generated. Continue with the next page?']})]}),Wt&&i.jsx(Ui,{value:Dt,onChange:ce=>yt(ce.target.value),placeholder:"Add instructions for remaining pages…",className:"min-h-[60
1765px] text-xs"}),i.jsxs("div",{className:"flex flex-wrap justify-center gap-2",children:[i.jsx(Y,{size:"sm",onClick:()=>{const ce=Dt.trim();yt(""),Ct(!1),x==null||x(ce||void 0)},children:"Continue"}),i.jsx(Y,{size:"sm",variant:"outline",onClick:()=>Ct(ce=>!ce),children:Wt?"Hide notes":"Add notes"}),i.jsx(Y,{size:"sm",variant:"outline",onClick:y,children:"Cancel"})]}),i.jsxs("div",{className:"flex items-center justify-center gap-2 pt-1",children:[i.jsx(Kn,{id:"auto-cont-inline",checked:!!b,onCheckedChange:ce=>_==null?void 0:_(ce===!0)}),i.jsx("label",{htmlFor:"auto-cont-inline",className:"text-xs text-muted-foreground cursor-pointer",children:"Auto-continue this session"})]})]})}),(I==null?void 0:I.status)==="error"&&i.jsx(ee,{tone:"error",children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"inline-flex items-center gap-2",children:[i.jsx(t_,{className:"h-4 w-4"}),i.jsxs("span",{children:['Failed: "',I.current.name,'" — ',I.message]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(Y,{size:"sm",onClick:w,children:[i.jsx(FL,{className:"h-3.5 w-3.5 mr-1"})," Retry"]}),i.jsx(Y,{size:"sm",variant:"outline",onClick:j,children:"Skip"}),i.jsxs(Y,{size:"sm",variant:"ghost",onClick:y,children:[i.jsx(Bn,{className:"h-3.5 w-3.5 mr-1"})," Stop"]})]})]})})]})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"lg:hidden mb-3",children:i.jsx(oa,{value:de,onValueChange:I=>le(I),children:i.jsxs(Yi,{className:"grid w-full grid-cols-2",children:[i.jsxs(gr,{value:"editor",children:[i.jsx(Ab,{className:"h-4 w-4 mr-2"}),"Editor"]}),i.jsxs(gr,{value:"preview",children:[i.jsx(Mg,{className:"h-4 w-4 mr-2"}),"Live Preview"]})]})})}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-4 h-[calc(100vh-200px)] min-h-0",children:[i.jsx(dt,{className:`lg:col-span-2 lg:flex flex-col overflow-hidden min-h-0 ${de==="editor"?"flex":"hidden"}`,children:i.jsxs(oa,{value:ae,onValueChange:E,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[i.jsx(ir,{className:"p-3 pb-2",children:i.jsxs(Yi,{className:"w-full grid grid-cols-6",children:[i.jsxs(gr,{value:"chat",className:"text-xs",children:[i.jsx(Ab,{className:"h-4 w-4 lg:mr-1"}),i.jsx("span",{className:"hidden lg:inline",children:"Chat"})]}),i.jsxs(gr,{value:"colors",className:"text-xs",children:[i.jsx(ta,{className:"h-4 w-4 lg:mr-1"}),i.jsx("span",{className:"hidden lg:inline",children:"Colors"})]}),i.jsxs(gr,{value:"typography",className:"text-xs",children:[i.jsx(qP,{className:"h-4 w-4 lg:mr-1"}),i.jsx("span",{className:"hidden lg:inline",children:"Type"})]}),i.jsxs(gr,{value:"header",className:"text-xs",children:[i.jsx($L,{className:"h-4 w-4 lg:mr-1"}),i.jsx("span",{className:"hidden lg:inline",children:"Header"})]}),i.jsxs(gr,{value:"images",className:"text-xs",children:[i.jsx(qa,{className:"h-4 w-4 lg:mr-1"}),i.jsx("span",{className:"hidden lg:inline",children:"Images"})]}),i.jsxs(gr,{value:"icons",className:"text-xs",children:[i.jsx(dk,{className:"h-4 w-4 lg:mr-1"}),i.jsx("span",{className:"hidden lg:inline",children:"Icons"})]})]})}),i.jsxs(Mr,{value:"chat",className:"flex-1 flex flex-col overflow-hidden mt-0 min-h-0",children:[i.jsx(ct,{className:"flex-1 overflow-hidden p-0 min-h-0",children:i.jsx(Qi,{className:"h-full",viewportRef:Ie,children:i.jsx("div",{className:"px-4 pr-6",children:U?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(et,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):P.length===0?i.jsxs("div",{className:"py-4",children:[t.theme_description&&i.jsxs("div",{className:"mb-4 p-3 bg-muted/50 rounded-lg border border-border",children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Original Description"}),i.jsx("p",{className:"text-sm break-words [overflow-wrap:anywhere] whitespace-pre-wrap",children:Hw(t.theme_description||"",t.source_url)})]}),d&&i.jsxs("div",{className:"flex gap-3 justify-start mb-4",children:[i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0",children:i.jsx(Na,{className:"h-4 w-4 text-primary"})}),i.jsx("div",{className:"max-w-[92%] flex-1",children:d})]}),on,El(),i.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[i.jsx(St,{className:"h-8 w-8 mx-auto mb-2 text-primary"}),i.jsx("p",{className:"mb-2",children:"Start customizing your theme"}),i.jsx("p",{className:"text-sm",children:"Describe what changes you'd like"})]})]}):i.jsxs("div",{className:"space-y-4 py-4",children:[t.theme_description&&i.jsxs("div",{className:"p-3 bg-muted/50 rounded-lg border border-border mb-4",children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Original Description"}),i.jsx("p",{className:"text-sm break-words [overflow-wrap:anywhere] whitespace-pre-wrap",children:Hw(t.theme_description||"",t.source_url)})]}),d&&i.jsxs("div",{className:"flex gap-3 justify-start",children:[i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0",children:i.jsx(Na,{className:"h-4 w-4 text-primary"})}),i.jsx("div",{className:"max-w-[92%] flex-1",children:d})]}),on,P.filter(I=>!mre(I.content)).map(I=>{const{meta:B}=gi(I.content),ee=I.role==="assistant"?B.clarifyOptions||[]:[],ce=I.role==="assistant"?B.planSummary||[]:[],_e=I.role==="assistant"&&B.planStage==="questions",Ce=I.role==="assistant"?fre(I.content):null;return i.jsxs("div",{className:`flex gap-3 ${I.role==="user"?"justify-end":"justify-start"}`,children:[I.role==="assistant"&&i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0",children:i.jsx(Na,{className:"h-4 w-4 text-primary"})}),i.jsxs("div",{className:`max-w-[85%] overflow-hidden ${I.role==="user"?"order-first":""}`,children:[i.jsxs("div",{className:`rounded-2xl px-4 py-2 ${I.role==="user"?"bg-primary text-primary-foreground":"bg-muted"}`,children:[i.jsx("p",{className:"text-sm break-words",children:f2(I.content)}),Ce&&i.jsx("p",{className:"text-sm text-muted-foreground mt-1.5 pt-1.5 border-t border-border/40",children:Ce}),ee.length>0&&i.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[_e&&i.jsx("p",{className:"text-xs text-muted-foreground",children:"One question at a time — pick an answer, skip it, or type your own."}),ee.map((Pe,Te)=>i.jsx(Y,{variant:"outline",size:"sm",className:"h-auto justify-start whitespace-normal text-left text-xs leading-snug",onClick:()=>wf(Pe,_e),disabled:R,children:Pe},`${I.id}-option-${Te}`)),_e&&!ee.some(Pe=>/no preference|skip/i.test(Pe))&&i.jsx(Y,{variant:"outline",size:"sm",className:"h-auto justify-start whitespace-normal text-left text-xs leading-snug",onClick:()=>
1765wf("No preference — you pick what works best",!0),disabled:R,children:"No preference — you pick"}),k===I.id?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{ref:W,value:K,onChange:Pe=>H(Pe.target.value),onKeyDown:Pe=>{Pe.key==="Enter"&&!Pe.shiftKey&&(Pe.preventDefault(),_i(_e))},placeholder:_e?"Type your answer...":"Type what you'd like to change...",className:"h-9 w-full rounded-md border border-border bg-background px-3 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),i.jsx(Y,{size:"icon",className:"h-9 w-9 flex-shrink-0",onClick:()=>_i(_e),disabled:R||!K.trim(),"aria-label":"Send custom change",children:i.jsx(Om,{className:"h-3.5 w-3.5"})})]}):i.jsx(Y,{variant:"outline",size:"sm",className:"h-auto justify-start whitespace-normal text-left text-xs leading-snug",onClick:()=>Au(I.id),disabled:R,children:"Other, specify:"})]}),ce.length>0&&i.jsxs("div",{className:"mt-3",children:[i.jsx("ul",{className:"list-disc pl-4 space-y-1 text-sm",children:ce.map((Pe,Te)=>i.jsx("li",{className:"break-words",children:Pe},`${I.id}-plan-${Te}`))}),i.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[i.jsx(Y,{size:"sm",className:"h-8 text-xs",onClick:()=>Fv(ce),disabled:R,children:"Build it"}),k===I.id?null:i.jsx(Y,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>Au(I.id),disabled:R,children:"Change something"})]}),k===I.id&&ee.length===0&&i.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[i.jsx("input",{ref:W,value:K,onChange:Pe=>H(Pe.target.value),onKeyDown:Pe=>{Pe.key==="Enter"&&!Pe.shiftKey&&(Pe.preventDefault(),_i(!0))},placeholder:"What should be different?",className:"h-9 w-full rounded-md border border-border bg-background px-3 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),i.jsx(Y,{size:"icon",className:"h-9 w-9 flex-shrink-0",onClick:()=>_i(!0),disabled:R||!K.trim(),"aria-label":"Send plan change",children:i.jsx(Om,{className:"h-3.5 w-3.5"})})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 mt-1 px-1",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:Lv(I.created_at)}),I.role==="assistant"&&m2(I,wi)&&i.jsxs(Y,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>Nl(I),disabled:R,children:[i.jsx(sh,{className:"h-3 w-3 mr-1"}),"Undo"]})]})]}),I.role==="user"&&i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary flex items-center justify-center flex-shrink-0",children:i.jsx(VP,{className:"h-4 w-4 text-primary-foreground"})})]},I.id)}),El(),R&&i.jsxs("div",{className:"flex gap-3 justify-start",children:[i.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center",children:i.jsx(Na,{className:"h-4 w-4 text-primary"})}),i.jsx("div",{className:"bg-muted rounded-2xl px-4 py-3",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(et,{className:"h-4 w-4 animate-spin text-primary mt-0.5"}),i.jsxs("span",{className:"text-sm",children:[oe[0]||"Thinking","..."]})]})})]})]})})})}),i.jsx(Iv,{open:T,onOpenChange:A,children:i.jsxs("div",{className:"px-4 py-2 border-t border-border",children:[i.jsxs(Ov,{className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[T?i.jsx(FP,{className:"h-3 w-3"}):i.jsx(Hs,{className:"h-3 w-3"}),"Prompt Examples"]}),i.jsx(Mv,{className:"pt-2",children:i.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[i.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 p-3",children:[i.jsx("p",{className:"font-medium text-foreground",children:"Good"}),i.jsx("ul",{className:"mt-1 space-y-1 text-muted-foreground",children:v2.good.map(I=>i.jsxs("li",{children:["“",I,"”"]},I))})]}),i.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 p-3",children:[i.jsx("p",{className:"font-medium text-foreground",children:"Bad"}),i.jsx("ul",{className:"mt-1 space-y-1 text-muted-foreground",children:v2.bad.map(I=>i.jsxs("li",{children:["“",I,"”"]},I))})]})]})})]})}),i.jsxs("div",{className:"p-4 border-t border-border",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Ui,{placeholder:"Describe the changes you want...",value:O,onChange:I=>F(I.target.value),onKeyDown:I=>
1765{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),co())},className:"min-h-[60px] max-h-[120px] resize-none",disabled:R}),i.jsx(Y,{onClick:()=>co(),disabled:R||!O.trim(),children:R?i.jsx(et,{className:"h-4 w-4 animate-spin"}):i.jsx(Om,{className:"h-4 w-4"})})]}),i.jsx("div",{className:"mt-2",children:i.jsx(CM,{value:n,onChange:s,disabled:R,plan:o,trialActive:a,onUpgradeNeeded:l})})]})]}),i.jsx(Mr,{value:"colors",className:"flex-1 overflow-hidden mt-0 min-h-0",children:i.jsx(Jte,{colors:Ue,onColorChange:_f,onSave:jf,isSaving:fe})}),i.jsx(Mr,{value:"typography",className:"flex-1 overflow-hidden mt-0 min-h-0",children:i.jsx(ere,{typography:bt,onTypographyChange:Bv,onSave:kf,isSaving:fe})}),i.jsx(Mr,{value:"header",className:"flex-1 overflow-hidden mt-0 min-h-0",children:i.jsx(Vte,{archetype:ne,logoHeight:D,sticky:V,onStickyChange:me,onArchetypeChange:te,onLogoHeightChange:M,onSave:Hv,isSaving:fe})}),i.jsx(Mr,{value:"images",className:"flex-1 overflow-hidden mt-0 min-h-0",children:i.jsx(tre,{projectId:t.id,onImageSelect:bf})}),i.jsx(Mr,{value:"icons",className:"flex-1 overflow-hidden mt-0 min-h-0",children:i.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground p-4",children:[i.jsx(dk,{className:"h-12 w-12 mb-4"}),i.jsx("p",{className:"text-center font-medium text-foreground",children:"Available Icon Libraries"}),i.jsx("p",{className:"text-sm text-center mt-2",children:"Use the Chat tab to request icon changes"}),i.jsxs("div",{className:"mt-6 space-y-3 w-full max-w-sm",children:[i.jsxs("div",{className:"p-4 border rounded-lg bg-card",children:[i.jsx("h4",{className:"font-medium text-foreground",children:"Lucide React"}),i.jsx("p",{className:"text-xs mt-1",children:"Beautiful & consistent open-source icons - 1,500+ available"}),i.jsxs("div",{className:"flex gap-3 justify-center mt-3",children:[i.jsx("a",{href:"https://lucide.dev",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline",children:"Browse Icons →"}),i.jsx("a",{href:"https://lucide.dev/guide/packages/lucide-react",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline",children:"Documentation →"})]})]}),i.jsxs("div",{className:"p-4 border rounded-lg bg-card",children:[i.jsx("h4",{className:"font-medium text-foreground",children:"Font Awesome 6 Free"}),i.jsx("p",{className:"text-xs mt-1",children:"The web's most popular icon set - 2,000+ free icons"}),i.jsxs("div",{className:"flex gap-3 justify-center mt-3",children:[i.jsx("a",{href:"https://fontawesome.com/icons",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline",children:"Browse Icons →"}),i.jsx("a",{href:"https://fontawesome.com/docs",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline",children:"Documentation →"})]})]})]})]})})]})}),i.jsxs(dt,{className:`lg:col-span-3 overflow-hidden lg:flex flex-col ${de==="preview"?"flex":"hidden"}`,children:[i.jsx(ir,{className:"pb-0 flex-shrink-0",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Dr,{children:"Live Preview"}),i.jsxs(Xt,{children:[i.jsx(d1,{asChild:!0,children:i.jsx(Y,{variant:"ghost",size:"icon",className:"h-6 w-6",children:i.jsx(_L,{className:"h-4 w-4 text-muted-foreground"})})}),i.jsxs(Qt,{className:"max-w-2xl max-h-[80vh]",children:[i.jsx(gn,{children:i.jsx(wr,{children:"How to Use PressMeGPT"})}),i.jsx(Qi,{className:"h-[60vh] pr-4",children:i.jsxs("div",{className:"space-y-6 text-sm",children:[i.jsx("p",{children:"PressMeGPT helps you generate an AI-powered WordPress theme that you can customize and extend directly inside WordPress."}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-semibold text-base mb-2",children:"1. Design Your Homepage"}),i.jsx("p",{className:"text-muted-foreground",children:"Start with the homepage. Use the AI chat, color, typography, and image tabs to refine your design until it looks perfect."})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-semibold text-base mb-2",children:"2. Add More Pages"}),i.jsx("p",{className:"text-muted-foreground",children:"Click the + tab above the preview to create additional pages. You'll first create an inner page template (layout), then add as many pages as you need using that template."})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-semibold text-base mb-2",children:"3. Export & Install"}),i.jsx("p",{className:"text-muted-foreground",children:"Export your theme and install it in WordPress. Pages, menus, and content are automatically created on theme activation."})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-semibold text-base mb-2",children:"4. Customize in WordPress"}),i.jsx("p",{className:"text-muted-foreground",children:"Edit pages, headers, and footers using WordPress's native block editor and Full Site Editor."})]})]})})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Y,{variant:"outline",size:"sm",onClick:u,children:[i.jsx(UP,{className:"h-4 w-4 mr-1"}),"Preview"]}),i.jsx(Y,{size:"sm",onClick:r,children:"Continue to Preview"})]})]})}),i.jsx(_te,{pages:Je,activePage:xe,onPageSelect:be,onAddPage:va,onRemovePage:Sl,hasTemplate:ie,projectId:t.id,disabled:R,onUpgradeNeeded:c}),i.jsx(ct,{className:"p-0 flex-1 min-h-0",children:i.jsx("div",{className:"h-full bg-muted",children:i.jsx(wl,{html:xe==="home"?q:((Ru=Je[xe])==null?void 0:Ru.html)||q,css:xe==="home"?X:((Iu=Je[xe])==null?void 0:Iu.css)||X||t.master_css||"",pages:Je,showNavigation:!0,syncPages:$e,navigationConfig:Oe,preserveSourceLayout:Ze,stylesheetUrls:ht},xa)})})]})]}),i.jsx(bl,{open:se,onOpenChange:pe,reason:"out_of_credits"})]})}function Rre(t){return t?/resume_needed|wall clock|WallClockTime|backgroundDeploy timed out|InstaWP task polling timed out|Function shutdown/i.test(t):!1}function Ire(t,e,r,n=!1){const[s,o]=g.useState({status:"idle",previewId:null,wpUrl:null,sHash:null,errorMessage:null,deployedVersion:null,expiresAt:null}),a=g.useRef(null),l=g.useRef(0),c=g.useRef(null),[u,d]=g.useState(()=>Date.now());function h(){a.current&&(clearInterval(a.current),a.current=null),l.current=0}async function m(_,S){if(l.current+=1,l.current>120){h(),o(C=>({...C,status:"failed",errorMessage:"Still preparing your preview — check back in a moment."}));return}e&&l.current>1&&l.current%3===0&&re.functions.invoke("deploy-preview",{body:{projectId:t,exportFormat:e,forceRedeploy:!1,bundleMedia:n}}).then(({data:C}
1765)=>{C&&C.status==="ready"&&(h(),o({status:"ready",previewId:_,wpUrl:C.wp_url??null,sHash:C.s_hash??null,errorMessage:null,deployedVersion:C.project_version??null,expiresAt:C.expires_at??null}))}).catch(()=>{});const{data:N,error:P}=await re.from("preview_instances").select("status, wp_url, s_hash, error_message, created_at, project_version, expires_at").eq("id",_).single();if(!(P||!N)){if(N.status==="provisioning"&&S&&(Date.now()-new Date(S).getTime())/1e3>240){h(),o(O=>({...O,status:"failed",errorMessage:"Site provisioning timed out. Please try again."}));return}if(N.status==="ready")h(),o(C=>({...C,status:"ready",wpUrl:N.wp_url,sHash:N.s_hash,deployedVersion:N.project_version??null,expiresAt:N.expires_at??null,errorMessage:null}));else if(N.status==="failed"){const C=N.error_message??"Preview failed. Please try again.";if(Rre(C)&&e){o(O=>({...O,status:"deploying",errorMessage:null})),re.functions.invoke("deploy-preview",{body:{projectId:t,exportFormat:e,forceRedeploy:!1,bundleMedia:n}});return}h(),o(O=>({...O,status:"failed",errorMessage:C}))}else N.status==="deploying"&&o(C=>({...C,status:"deploying",errorMessage:null}))}}g.useEffect(()=>{if(!t||!e)return;let _=!1;return h(),o({status:"idle",previewId:null,wpUrl:null,sHash:null,errorMessage:null,deployedVersion:null,expiresAt:null}),(async()=>{const{data:S}=await re.from("preview_instances").select("id, status, wp_url, s_hash, project_version, created_at, error_message, expires_at").eq("project_id",t).eq("export_format",e).not("status","in","(failed,expired)").order("created_at",{ascending:!1}).limit(1).maybeSingle();if(!(_||!S))if(S.status==="ready"){if(S.expires_at&&new Date(S.expires_at).getTime()<=Date.now())return;o({status:"ready",previewId:S.id,wpUrl:S.wp_url,sHash:S.s_hash,errorMessage:null,deployedVersion:S.project_version??null,expiresAt:S.expires_at??null})}else(S.status==="provisioning"||S.status==="deploying")&&(o(N=>({...N,status:S.status,previewId:S.id,errorMessage:null})),f(S.id,S.created_at),re.functions.invoke("deploy-preview",{body:{projectId:t,exportFormat:e,forceRedeploy:!1}}))})(),()=>{_=!0}},[t,e]),g.useEffect(()=>{if(s.status!=="ready"||!s.expiresAt){c.current&&(clearInterval(c.current),c.current=null);return}const _=new Date(s.expiresAt).getTime();if(Date.now()>=_){o({status:"idle",previewId:null,wpUrl:null,sHash:null,errorMessage:null,deployedVersion:null,expiresAt:null});return}return d(Date.now()),c.current=setInterval(()=>{const S=Date.now();S>=_?(c.current&&(clearInterval(c.current),c.current=null),o({status:"idle",previewId:null,wpUrl:null,sHash:null,errorMessage:null,deployedVersion:null,expiresAt:null})):d(S)},3e4),()=>{c.current&&(clearInterval(c.current),c.current=null)}},[s.status,s.expiresAt]);function f(_,S){h(),l.current=0,a.current=setInterval(()=>{m(_,S)},5e3)}async function v(_,S=!1){const N=S||s.status==="ready"&&!!r&&!!s.deployedVersion&&s.deployedVersion!==r;o($=>({...$,status:N?"deploying":"provisioning",previewId:N?$.previewId:null,errorMessage:null}));const{data:P,error:C}=await re.functions.invoke("deploy-preview",{body:{projectId:t,exportFormat:_,forceRedeploy:N,bundleMedia:n}});if(C||!P){const $=(P==null?void 0:P.detail)??(P==null?void 0:P.error);o(K=>({...K,status:"failed",errorMessage:$??(C==null?void 0:C.message)??"Failed to start preview."}));return}if(P!=null&&P.error){o($=>({...$,status:"failed",errorMessage:P.detail??P.error}));return}const{previewId:O,status:F,wp_url:T,s_hash:A,alreadyReady:k}=P;if(k||F==="ready"){o({status:"ready",previewId:O,wpUrl:T??null,sHash:A??null,errorMessage:null,deployedVersion:P.project_version??null,expiresAt:P.expires_at??null});return}o($=>({...$,status:F==="deploying"?"deploying":"provisioning",previewId:O,errorMessage:null})),f(O,new Date().toISOString())}async function p(){e&&await v(e,!0)}function b(){h(),o({status:"idle",previewId:null,wpUrl:null,sHash:null,errorMessage:null,deployedVersion:null,expiresAt:null})}function x(){if(s.wpUrl){window.open(s.wpUrl,"_blank");return}o(_=>({..._,errorMessage:"Preview unavailable. Click Preview in WordPress again to redeploy."}))}function y(){s.sHash&&window.open(`https://app.instawp.io/wordpress-auto-login?site=${s.sHash}`,"_blank")}const w=s.status==="ready"&&!!r&&!!s.deployedVersion&&s.deployedVersion!==r,j=s.status==="ready"&&s.expiresAt?Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-u)/6e4)):null;return{...s,needsRedeploy:w,minutesRemaining:j,startPreview:v,redeployPreview:p,reset:b,openPreview:x,openWpAdmin:y}}function Ore({open:t,onClose:e,projectId:r,previewUrl:n}){const[s,o]=g.useState(null),[a,l]=g.useState(""),[c,u]=g.useState(!1),{refreshSubscription:d}=nn();g.useEffect(()=>{t&&(o(null),l(""),u(!1))},[t]);const h=async()=>
1765{if(!s){Q.error("Please tap thumbs up or thumbs down first.");return}if(!a.trim()){Q.error("Please share a few details so we can improve.");return}u(!0);try{const{data:m,error:f}=await re.functions.invoke("submit-preview-feedback",{body:{rating:s,details:a,projectId:r,previewUrl:n}});if(f)throw f;(m==null?void 0:m.credits_awarded)>0?(Q.success("Thanks for the feedback! 5 credits added."),d()):Q.success("Thanks for the feedback!"),e()}catch(m){console.error("preview feedback error",m),Q.error("Could not send feedback. Please try again.")}u(!1)};return i.jsx(Xt,{open:t,onOpenChange:m=>{m||e()},children:i.jsxs(Qt,{className:"max-w-md",children:[i.jsxs(gn,{children:[i.jsx(wr,{children:"How'd the WordPress preview look?"}),i.jsxs(jn,{children:["Get ",i.jsx("strong",{children:"5 bonus credits"})," for a quick thumbs up or down — your feedback helps us tune the export."]})]}),i.jsxs("div",{className:"flex justify-center gap-4 py-2",children:[i.jsxs("button",{type:"button",onClick:()=>o("up"),className:Se("flex flex-col items-center gap-1 rounded-lg border p-4 w-24 transition-colors",s==="up"?"border-primary bg-primary/10":"border-border hover:bg-muted"),children:[i.jsx(GL,{className:Se("h-7 w-7",s==="up"?"text-primary":"text-muted-foreground")}),i.jsx("span",{className:"text-xs",children:"Looks great"})]}),i.jsxs("button",{type:"button",onClick:()=>o("down"),className:Se("flex flex-col items-center gap-1 rounded-lg border p-4 w-24 transition-colors",s==="down"?"border-destructive bg-destructive/10":"border-border hover:bg-muted"),children:[i.jsx(HL,{className:Se("h-7 w-7",s==="down"?"text-destructive":"text-muted-foreground")}),i.jsx("span",{className:"text-xs",children:"Needs work"})]})]}),i.jsx(Ui,{placeholder:"Tell us what worked or didn't — the more detail, the better.",value:a,onChange:m=>l(m.target.value),rows:4}),i.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[i.jsx(Y,{variant:"ghost",onClick:e,disabled:c,children:"Close"}),i.jsx(Y,{onClick:h,disabled:c||!s||!a.trim(),children:c?i.jsxs(i.Fragment,{children:[i.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending…"]}):"Submit"})]})]})})}function x2({projectId:t,exportFormat:e,projectVersion:r,bundleMedia:n=!1,onPreparePreview:s,actionLabel:o="Preview in WordPress"}){const a=e==="elementor"?void 0:e,{status:l,errorMessage:c,needsRedeploy:u,minutesRemaining:d,wpUrl:h,startPreview:m,redeployPreview:f,reset:v,openPreview:p,openWpAdmin:b}=Ire(t,a,r??null,n),[x,y]=g.useState(!1),[w,j]=g.useState(!1),{track:_}=no(),S=`pmg-preview-feedback-shown:${t}:${e}`,N=()=>{p(),typeof window<"u"&&!localStorage.getItem(S)&&(localStorage.setItem(S,"1"),setTimeout(()=>y(!0),1200))},P=async()=>{if(s){j(!0);try{await s()}catch(k){console.warn("WordPress preview: using the existing thumbnail after refresh failed",k)}finally{j(!1)}}},C=async()=>{a&&(_("theme_previewed",{preview_type:a}),await P(),await m(a))},O=async()=>{await P(),await f()};if(e==="elementor")return null;const F=l==="ready"&&d!==null&&d<=3,T=l==="ready"&&d!==null?`Preview expires in ${d} min`:"WordPress preview take 1-2 minutes to generate and expire 10 minutes after";let A;return w?A=i.jsxs(Y,{variant:"secondary",className:"w-full",disabled:!0,children:[i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}),"Preparing theme preview…"]}):l==="idle"?A=i.jsxs(Y,{variant:"secondary",className:"w-full",onClick:C,children:[i.jsx(Bi,{className:"h-4 w-4 mr-2"}),o]}):l==="failed"?A=i.jsxs("div",{className:"flex gap-2 w-full",children:[i.jsxs(Y,{variant:"secondary",className:"flex-1",onClick:C,children:[i.jsx(Bi,{className:"h-4 w-4 mr-2"}),o]}),i.jsx(Y,{variant:"ghost",size:"icon",onClick:v,title:"Start over",children:i.jsx(sh,{className:"h-4 w-4"})})]}):l==="provisioning"?A=i.jsxs(Y,{variant:"secondary",className:"w-full",disabled:!0,children:[i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}),"Creating WordPress site…"]}):l==="deploying"?A=i.jsxs(Y,{variant:"secondary",className:"w-full",disabled:!0,children:[i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}),"Installing theme… (1–2 min)"]}):A=i.jsxs("div",{className:"flex gap-2 w-full",children:[u&&i.jsxs(Y,{variant:"secondary",className:"flex-1",onClick:O,children:[i.jsx(bp,{className:"h-4 w-4 mr-2"}
1765),"Update Preview"]}),i.jsxs(Y,{variant:"secondary",className:"flex-1",onClick:N,children:[i.jsx(Bi,{className:"h-4 w-4 mr-2"}),"View Site"]}),i.jsxs(Y,{variant:"secondary",className:"flex-1",onClick:b,children:[i.jsx(TL,{className:"h-4 w-4 mr-2"}),"WP Admin"]})]}),i.jsxs("div",{className:"flex flex-col gap-1.5 w-full",children:[i.jsx("p",{className:`text-xs text-center ${F?"text-destructive":"text-muted-foreground"}`,children:T}),A,l==="ready"&&i.jsx("button",{type:"button",onClick:()=>y(!0),className:"text-xs text-muted-foreground hover:text-foreground underline-offset-2 hover:underline text-center",children:"How'd the WordPress preview look?"}),l==="failed"&&c&&i.jsx("p",{className:"text-xs text-destructive text-center",children:c}),i.jsx(Ore,{open:x,onClose:()=>y(!1),projectId:t,previewUrl:h})]})}const Mre="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAABGCAMAAADVcTJ4AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACQUExURQAAAO8A7+8I7+8A7+cA7+8F7+8A7+oA7+8E7+8A7+sA7+8D7+wD7OwA7+8D7+8A8u8D7+wD7OwA7+oA7O8C8e8C7+0C7e0A7+sA7e8C7+0C7esA7e8C7+0C7e0C7ewC7ewA7e8C7+0C7+0C7ewC7ewC7O4B7+4B7uwB7u4B7u4B7u0B7u4B7u0B7u0B7u0B7necHg0AAAAvdFJOUwAQICAgMDAwQEBAUFBQX19gYGBgb29wcHB/gICPj5CQkJ+fn6Cgr6+wv8/P39/vm+81jgAAB+FJREFUeNrsmW1vmzAQgO14oi7pthAtZLCiqnE0dAT7/v+/W3Gm2pAjpiEvX/x8A9354B7sxDI7x2KZV0pBrapyKVnkocgcDPaAKkp5FLxokUKr6OQBSMBxmiw26L4IwPPoqOSO8FcMo8RVzKPHLraeRGqcgsmjkLuwwakoHoXcHP6O09EiCmF8YeE3Gv2AX0GLKGSPFnisD2ckCnFCHu5jvhGedhyiEJoa8Y5GHBCFkBR4CRCF3EjIC15GFYXcRIjQeCFpFHILIQovRfMo5PpCJHposBi0NECAHmUUcn0hGj2yXqMEI0APw6OQawvJcIaQSVNE5qpp27aBasknCeGyqrsMqEvJPMTKIzmOXdQ2MBO9AWzFBmw6wWKloP0Aqn7eyuOZWWTVFWjq3At8XlkALdql0O9tqwTKLJb2yk6QOULCU4QXBj1qGRQiKj9DK0EvruXgMM3FSTh/fJPB2JkbesDw4UG6qUED4+8NGZtSxr7kDCHhKbIx9HEKLYQ+kin4iJBiEMcsgwEUD50x6O8jnUoGoVVICK3DfRp0GWkQnRA1U4gJnz/S708LSTSVISghzodvhAMOaHhwD1yQnUoMMVRICC3dogRZRqKDMY4zhWD69Q1OMSrkh0EK/UQIyfCEnLED0QjmeEcSRXSKevp6kpAN0mgRKsNYdlbIrxUB9tlN8tG2rdfrnyNCEuxluAsjToQool+GF0jgFotXL7b3ROq0UwoJ8glCChxDi0AZxuoxISHCa5YbBFI71Z+22vWXEOIMmreUdaT73hY0aVun6RgLb2UJXl8NdjQfd/dOmD5Zr2D7zRZcQ6/TbYfxx0fTABhfeVDIixcNqizrxjPCh2Uag0faDsbMbCGYBP5P69Td+4NHgBSi8MhBnP4KlQPPlr/iGFSjwxXcDpdVgf/5zT5Zm8E3wkp0wPDDwJLah9Drgl5zZhEuvWJUmV3K3RoxW0jOSMS/ds64t00eCOO2vDdBTEgtlUjlqGnVZC91Evu+/7db1W57ynHGFId0k3j+TDDnu5/PxvgSjzTtEykFIMXvMKuP+oGhyfu2xUUEnf5cWdIvvXSB3ykFrQMmLUQK4BjcMAwERuhJS5RKmGEDCOmVCeR5OEGMvL0VgDjxBZn2bGg6GOYX8QFgO1E04PhRFb1LoxHA9YmUw0AMiVb0kXA1zPQitLsAkJMS5UXvlQ7wC0A+ulKxFiWCijY89Wr6rVowRgZjl7y41oG4lUIKs80wkH1kmGrPgFpxQLsokNxVvWD4uRu2B6SBf10BYadvNeMshdt+XOc8a8emiRPaSOBKxG8AiGGjpd/ewYwQodMwkHYviLi04oK9l9hU5npAHOIlItwxIEYewCwKgLmKjR/d9cOS3JEAj+JAbiON0cMAM0KEPOVuDOWr4uFFXDiQEHtoa7o9d+JMuSOpuQGQWAYiChXLKtkjNwhkH49Jg77EuVMmEFjg+vYud+4JXQYQtFj3G4TuFOLAR5iceGfRRf1uwMo9QnLZSCYdxgA54TMuDTOM+/xAoEAxrTgQJJCswNZgEUiIAkEYY7KdO50mASFMr7FEfGYj6LpAKKpSBlJQVGOA+CSQdiQQNwEIzwKIpzY6vACZE4hBGCHxepi5/KK+us6U5S8D5PBlQNpsIOm3vXFsNiXNgBibUJMJpLJv2tmY1hcAkpiykkDaOJDxUpJ8Mns4kOSBVx4QbGeiSgDJXdRRyMzMzP/qBNab0UA08m0OIIjArEB83IgeMzM2FwDyoiQd0gU+8sawmQvILXbK8wE5RIzAPpWimdlfvzcJ9zkQrHkzAcGufU4gTSwoiKkeNBNygcgOwn0bW11qDqTB/eRRs8oDEp9O9vhiPBB5B6mjRbb/EdoPmHGzHeE6nMTxzJUfe3VAaYcQr/zHXhsZvQaT5RQgQQzoQ+z1ez0MpBkEsrOCBpcQqKbB8ybfP6Dayb4YwkUZQEA8rBWEygcy44HwRQEqUcghPs/6xMyYUQYE4rK8dDSgT2jGgZgAIsLpp8kFggPEUqrUcmockMTZh0OxE6QdwpUw4zKBxFftUqjZKzwGCgeCgJEvWAkgrskBgoPeB9Ov5Vt/FohyzMHusKJTwZ2AF3EzVQYQWBD1SCjQ/V4Uxc3DGXklAVFH1Aja1xbfb/YBR+X5QDBGiNqmeDXQYDw+qZFA+KyMIp5n/qlv7U3z4ALBiyQQFfKAmEk/Jd0qEYjxFFOl8oCgVEGW16OBQF4slNtSTMGoNBCbASSx8dNtggeApIjcqWwgcrAwdCcAWQcGJGFkpUYA0T4DSCxBhv2/VxzIYHk2VuF8IKoSkf+v1QQgIMK+qkUjzqhhIJgJoda+yScee5EgCZWeuNxK9YFAGy+HKx8IygiZwv2EnbqQ0i5tJG0GHs703wH1sYujTP5g576DJLRokQ0EhaFQ2Gr1aSBQ7RgQIJGNpIGYQBNVqzEym/YYiOh83G9Yt27tmyqeV9a9t3CPNVp025S8yZsa+VjGsB7Vj+5MROHcbnCf7p16vlWRz5Uu643wla6YkZQZaEPjtfzN1TX0Y+KEtURuJmlPn1dYeMwnM4FItYTtryJytwRtZiILj3+YSCiXgM0ufVier75QOfuRJ73E6joyjtLyy3R1RdWehhW2S3pcG8mC4y9T3ZIst1lwfI1M3QaeG27zbQnMV2pd2dYdz686to/1esmNa+gn1IMqR8DnpIsAAAAASUVORK5CYII=";var N3="Toggle",C3=g.forwardRef((t,e)=>
1765{const{pressed:r,defaultPressed:n,onPressedChange:s,...o}=t,[a,l]=rn({prop:r,onChange:s,defaultProp:n??!1,caller:N3});return i.jsx(Me.button,{type:"button","aria-pressed":a,"data-state":a?"on":"off","data-disabled":t.disabled?"":void 0,...o,ref:e,onClick:je(t.onClick,()=>{t.disabled||l(!a)})})});C3.displayName=N3;var E3=C3;const $re=du("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),Hm=g.forwardRef(({className:t,variant:e,size:r,...n},s)=>i.jsx(E3,{ref:s,className:Se($re({variant:e,size:r,className:t})),...n}));Hm.displayName=E3.displayName;const P3=g.forwardRef(function({open:e,onClose:r,html:n,css:s,themeName:o,pages:a,syncPages:l,navigationConfig:c,preserveSourceLayout:u=!1,stylesheetUrls:d=[]},h){var C,O,F;const[m,f]=g.useState("desktop"),[v,p]=g.useState("home"),b=g.useMemo(()=>a?Object.fromEntries(Object.entries(a).filter(([,T])=>!T.isTemplate)):{},[a]),x=Object.entries(b),y=x.length>0,w=1+x.length,j=v==="home"?"Homepage":((C=b[v])==null?void 0:C.title)||v,_=v==="home"?n:((O=a==null?void 0:a[v])==null?void 0:O.html)||n,S=v==="home"?s:((F=a==null?void 0:a[v])==null?void 0:F.css)||s,N=u||/\bfse-copy-preserve\b/i.test(_),P=async()=>{try{const T=await vv(_,S,{width:1920,height:1080});BJ(T,`${o}-mockup.png`)}catch(T){console.error("Failed to generate mockup:",T)}};return i.jsx(Xt,{open:e,onOpenChange:r,children:i.jsx(Qt,{className:"max-w-[100vw] max-h-[100vh] w-screen h-screen p-0 [&>button]:hidden rounded-none border-0",children:i.jsxs("div",{ref:h,className:"h-full flex flex-col",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 p-3 sm:p-4 border-b border-border bg-background",children:[i.jsx("h2",{className:"text-base sm:text-lg font-semibold",children:"Full Screen Preview"}),i.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[y&&i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"hidden sm:inline text-xs text-muted-foreground whitespace-nowrap",children:[w," ",w===1?"page":"pages",":"]}),i.jsxs(lv,{children:[i.jsx(cv,{asChild:!0,children:i.jsxs(Y,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs font-medium gap-1.5 min-w-[120px] justify-between",children:[i.jsx("span",{className:"truncate",children:j}),i.jsx(Hs,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]})}),i.jsxs(af,{align:"end",className:"min-w-[180px]",children:[i.jsx(hs,{onClick:()=>p("home"),className:v==="home"?"bg-accent":"",children:i.jsx("span",{className:"flex-1",children:"Homepage"})}),x.length>0&&i.jsx(Nc,{}),x.map(([T,A])=>i.jsx(hs,{onClick:()=>p(T),className:v===T?"bg-accent":"",children:i.jsx("span",{className:"flex-1 truncate",children:A.title||T})},T))]})]}),i.jsx("div",{className:"w-px h-6 bg-border mx-1"})]}),i.jsxs("div",{className:"flex items-center gap-1 border border-border rounded-md p-1",children:[i.jsx(Hm,{pressed:m==="desktop",onPressedChange:()=>f("desktop"),size:"sm","aria-label":"Desktop view",className:"data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:i.jsx(OL,{className:"h-4 w-4"})}),i.jsx(Hm,{pressed:m==="tablet",onPressedChange:()=>f("tablet"),size:"sm","aria-label":"Tablet view",className:"data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:i.jsx(WL,{className:"h-4 w-4"})}),i.jsx(Hm,{pressed:m==="mobile",onPressedChange:()=>f("mobile"),size:"sm","aria-label":"Mobile view",className:"data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:i.jsx(UL,{className:"h-4 w-4"})})]}),i.jsxs(Y,{variant:"outline",size:"sm",onClick:P,className:"hidden sm:inline-flex",children:[i.jsx(Wn,{className:"h-4 w-4 mr-2"}),"Download Mockup"]}),i.jsx(hQ,{asChild:!0,children:i.jsx(Y,{variant:"outline",size:"sm",children:"Close"})})]})]}),i.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-muted flex items-start justify-center p-2 sm:p-4",children:i.jsx("div",{className:`bg-background shadow-lg transition-all duration-300 h-full ${m==="mobile"?"w-[375px] max-w-full rounded-lg border border-border":m==="tablet"?"w-[768px] max-w-full rounded-lg border border-border":"w-full"}`,children:i.jsx(wl,{html:_,css:S,pages:a,showNavigation:!1,syncPages:l,navigationConfig:c,activePage:v,onPageChange:p,preserveSourceLayout:N,stylesheetUrls:d})})})]})})})});P3.displayName="FullScreenPreview";
1765const Pc=[{id:"describe",label:"Describe",statuses:["created","described"]},{id:"select",label:"Select Theme",statuses:["options_generated"]},{id:"customize",label:"Customize",statuses:["theme_selected","customizing"]},{id:"wordpress_preview",label:"Preview",statuses:["wordpress_preview"]},{id:"export",label:"Export",statuses:["ready_to_export"]}];function Dre(t){var e;return((e=Pc.find(r=>r.statuses.includes(t)))==null?void 0:e.id)??"describe"}function Fre(t){switch(t){case"describe":return"described";case"select":return"options_generated";case"customize":return"customizing";case"wordpress_preview":return"wordpress_preview";case"export":return"ready_to_export"}}function Lre(t,e,r){const n=Pc.findIndex(o=>o.id===Dre(t)),s=Pc.findIndex(o=>o.id===e);return s<=n?!0:s!==n+1?!1:e==="select"?r.hasThemeOptions:e==="customize"||e==="wordpress_preview"||e==="export"?r.hasSelectedTheme:!0}function y2({currentStatus:t,onStepClick:e,canNavigate:r,compact:n=!1,vertical:s=!1}){const o=Pc.findIndex(a=>a.statuses.includes(t));return i.jsx("div",{className:Se("w-full",n?"py-0":"py-4"),children:i.jsx("nav",{"aria-label":"Progress",children:i.jsx("ol",{className:Se("flex",s?"flex-col items-stretch gap-1":Se("items-center",n?"justify-start gap-1 md:gap-2":"justify-center gap-2 md:gap-4")),children:Pc.map((a,l)=>{const c=l<o,u=a.statuses.includes(t),d=r(a.id);return i.jsxs("li",{className:Se("flex",s?"flex-col items-stretch":"items-center"),children:[i.jsxs("button",{onClick:()=>d&&e(a.id),disabled:!d,className:Se("flex items-center gap-2 rounded-lg transition-all font-medium",s?"px-3 py-2 text-sm w-full":n?"px-2 py-1 text-xs":"px-3 py-2 text-sm",d&&"cursor-pointer hover:bg-accent/50",!d&&"cursor-not-allowed opacity-50",u&&"bg-primary text-primary-foreground shadow-md",c&&!u&&"bg-primary/20 text-primary",!c&&!u&&"bg-muted text-muted-foreground"),children:[i.jsx("span",{className:Se("flex items-center justify-center rounded-full font-bold",n?"h-5 w-5 text-[10px]":"h-6 w-6 text-xs",u&&"bg-primary-foreground/20",c&&!u&&"bg-primary text-primary-foreground",!c&&!u&&"bg-border"),children:c?i.jsx(fr,{className:n?"h-3 w-3":"h-3.5 w-3.5"}):l+1}),i.jsx("span",{className:Se(s?"inline":n?"hidden lg:inline":"hidden sm:inline"),children:a.label})]}),!s&&l<Pc.length-1&&i.jsx("div",{className:Se("h-0.5 mx-1",n?"w-3 md:w-6":"w-8 md:w-12",l<o?"bg-primary":"bg-border")})]},a.id)})})})})}const mg={colors:{primary:"#0066cc",secondary:"#6c757d",background:"#ffffff",text:"#333333",heading:"#111111",link:"#0066cc",linkHover:"#004499",primaryButtonBg:"#0066cc",primaryButtonText:"#ffffff",primaryButtonHover:"#004499",secondaryButtonBg:"#6c757d",secondaryButtonText:"#ffffff",secondaryButtonHover:"#5a6268"},typography:{bodyFont:"Inter",headingFont:"Inter",baseFontSize:16,headingScale:1.25}},Bre=[{label:"Inter",value:"Inter"},{label:"Open Sans",value:"Open Sans"},{label:"Roboto",value:"Roboto"},{label:"Lato",value:"Lato"},{label:"Poppins",value:"Poppins"},{label:"Montserrat",value:"Montserrat"},{label:"Source Sans Pro",value:"Source Sans Pro"},{label:"Nunito",value:"Nunito"},{label:"Raleway",value:"Raleway"},{label:"PT Sans",value:"PT Sans"}],zre=[{label:"Inter",value:"Inter"},{label:"Playfair Display",value:"Playfair Display"},{label:"Montserrat",value:"Montserrat"},{label:"Oswald",value:"Oswald"},{label:"Merriweather",value:"Merriweather"},{label:"Roboto Slab",value:"Roboto Slab"},{label:"Lora",value:"Lora"},{label:"Poppins",value:"Poppins"},{label:"Raleway",value:"Raleway"},{label:"Source Serif Pro",value:"Source Serif Pro"}],Mi=t=>(t=t.toLowerCase(),t.length===4?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t),b2=t=>{t=Mi(t);const e=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),n=parseInt(t.slice(5,7),16),s=(e+r+n)/3;return s>240||s<15?!0:Math.max(Math.abs(e-r),Math.abs(r-n),Math.abs(e-n))<20},Ta=t=>{t=Mi(t);const e=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),n=parseInt(t.slice(5,7),16);return(e*299+r*587+n*114)/1e3},wd=(t,e)=>{t=Mi(t);const r=parseInt(t.slice(1,3),16),n=parseInt(t.slice(3,5),16),s=parseInt(t.slice(5,7),16),o=1-e/100,a=Math.max(0,Math.round(r*o)),l=Math.max(0,Math.round(n*o)),c=Math.max(0,Math.round(s*o));return`#${a.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}${c.toString(16).padStart(2,"0")}`},hm=t=>Ta(t)>128?"#000000":"#ffffff",Ure=(t,e,r)=>{const n={primaryButtonBg:e,primaryButtonText:hm(e),primaryButtonHover:wd(e,15),secondaryButtonBg:r,secondaryButtonText:hm(r),secondaryButtonHover:wd(r,15)},s=[/\.btn-primary[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.btn\.primary[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.cta[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/button\.primary[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.hero[^{]*button[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.btn[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i];for(const u of s){const d=t.match(u);if(d){n.primaryButtonBg=Mi(d[1]),n.primaryButtonText=hm(n.primaryButtonBg),n.primaryButtonHover=wd(n.primaryButtonBg,15);break}}const o=[new RegExp("\\.btn-primary[^{]*\\{[^}]*(?<!background-)color:\\s*(#[0-9a-fA-F]{3,6})","i"),new RegExp("\\.btn\\.primary[^{]*\\{[^}]*(?<!background-)color:\\s*(#[0-9a-fA-F]{3,6})","i"),new RegExp("\\.cta[^{]*\\{[^}]*(?<!background-)color:\\s*(#[0-9a-fA-F]{3,6})","i")];for(const u of o){const d=t.match(u);if(d){n.primaryButtonText=Mi(d[1]);break}}const a=[/\.btn-primary:hover[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.btn\.primary:hover[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.cta:hover[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.btn:hover[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i];for(const u of a){const d=t.match(u);if(d){n.primaryButtonHover=Mi(d[1]);break}}const l=[/\.btn-secondary[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.btn\.secondary[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.btn-outline[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/button\.secondary[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i];for(const u of l){const d=t.match(u);if(d){n.secondaryButtonBg=Mi(d[1]),n.secondaryButtonText=hm(n.secondaryButtonBg),n.secondaryButtonHover=wd(n.secondaryButtonBg,15);break}}const c=[/\.btn-secondary:hover[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.btn\.secondary:hover[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i,/\.btn-outline:hover[^{]*\{[^}]*background(?:-color)?:\s*(#[0-9a-fA-F]{3,6})/i];for(const u of c){const d=t.match(u);if(d){n.secondaryButtonHover=Mi(d[1]);break}}return n},Wre=t=>{const e={},r=[[/--td-color-primary:\s*([^;]+)/i,"primary"],[/--td-color-secondary:\s*([^;
1765]+)/i,"secondary"],[/--td-color-background:\s*([^;]+)/i,"background"],[/--td-color-text:\s*([^;]+)/i,"text"],[/--td-color-heading:\s*([^;]+)/i,"heading"],[/--td-color-link:\s*([^;]+)/i,"link"],[/--td-color-link-hover:\s*([^;]+)/i,"linkHover"],[/--td-color-btn-primary-bg:\s*([^;]+)/i,"primaryButtonBg"],[/--td-color-btn-primary-text:\s*([^;]+)/i,"primaryButtonText"],[/--td-color-btn-primary-hover:\s*([^;]+)/i,"primaryButtonHover"],[/--td-color-btn-secondary-bg:\s*([^;]+)/i,"secondaryButtonBg"],[/--td-color-btn-secondary-text:\s*([^;]+)/i,"secondaryButtonText"],[/--td-color-btn-secondary-hover:\s*([^;]+)/i,"secondaryButtonHover"]];for(const[h,m]of r){const f=t.match(h);f&&(e[m]=f[1].trim())}if(Object.keys(e).length>=10)return e;const n=t.match(/#[0-9a-fA-F]{3,6}\b/g)||[],s={};for(const h of n){const m=Mi(h);s[m]=(s[m]||0)+1}const o=Object.entries(s).sort((h,m)=>m[1]-h[1]).map(([h])=>h),a=o.filter(h=>!b2(h)),l=o.filter(h=>b2(h));if(!e.primary&&a.length>0&&(e.primary=a[0]),!e.secondary)if(a.length>1)e.secondary=a[1];else{const h=l.find(m=>Ta(m)<100&&Ta(m)>10);h&&(e.secondary=h)}if(!e.background){const h=l.find(m=>Ta(m)>240);h&&(e.background=h)}if(!e.text){const h=l.find(m=>Ta(m)<80&&Ta(m)>5);h&&(e.text=h)}if(!e.heading){const h=l.find(m=>Ta(m)<50);h?e.heading=h:e.text&&(e.heading=e.text)}e.link||(e.link=e.primary||"#0066cc"),e.linkHover||(e.linkHover=e.link?wd(e.link,20):"#004499");const c=e.primary||mg.colors.primary,u=e.secondary||mg.colors.secondary,d=Ure(t,c,u);return e.primaryButtonBg||(e.primaryButtonBg=d.primaryButtonBg),e.primaryButtonText||(e.primaryButtonText=d.primaryButtonText),e.primaryButtonHover||(e.primaryButtonHover=d.primaryButtonHover),e.secondaryButtonBg||(e.secondaryButtonBg=d.secondaryButtonBg),e.secondaryButtonText||(e.secondaryButtonText=d.secondaryButtonText),e.secondaryButtonHover||(e.secondaryButtonHover=d.secondaryButtonHover),e},Hre=t=>{const e={},r=t.match(/--td-font-body:\s*'([^']+)'/);r&&(e.bodyFont=r[1]);const n=t.match(/--td-font-heading:\s*'([^']+)'/);n&&(e.headingFont=n[1]);const s=t.match(/--td-font-size-base:\s*(\d+)px/);s&&(e.baseFontSize=parseInt(s[1]));const o=t.match(/--td-heading-scale:\s*([\d.]+)/);if(o&&(e.headingScale=parseFloat(o[1])),!e.bodyFont){const a=t.match(/body[^{]*\{[^}]*font-family:\s*'?([^',;\n]+)/);a&&(e.bodyFont=a[1].trim())}if(!e.headingFont){const a=t.match(/h[1-6][^{]*\{[^}]*font-family:\s*'?([^',;\n]+)/);a&&(e.headingFont=a[1].trim())}return e},w2=(t,e)=>{const r=Wre(e),n=Hre(e);return{colors:{...mg.colors,...r,...(t==null?void 0:t.colors)||{}},typography:{...mg.typography,...n,...(t==null?void 0:t.typography)||{}}}};function Gre({open:t,onClose:e,settings:r,currentCss:n,onSave:s}){const{track:o}=no(),[a,l]=g.useState(()=>w2(r,n));g.useEffect(()=>{l(w2(r,n))},[r,n,t]);const c=(v,p)=>{l(b=>({...b,colors:{...b.colors,[v]:p}}))},u=(v,p)=>{l(b=>({...b,typography:{...b.typography,[v]:p}}))},d=()=>{o("theme_customized",{action:"global_settings_saved"}),s(a),e()},h=[{key:"primary",label:"Primary Color",description:"Main brand color"},{key:"secondary",label:"Secondary Color",description:"Complementary color"},{key:"background",label:"Background Color",description:"Page background color"},{key:"text",label:"Text Color",description:"Main paragraph text color"},{key:"heading",label:"Heading Color",description:"Color for H1-H6 headings"},{key:"link",label:"Link Color",description:"Hyperlink color"},{key:"linkHover",label:"Link Hover Color",description:"Hover state for links"}],m=[{key:"primaryButtonBg",label:"Background",description:"Primary button background"},{key:"primaryButtonText",label:"Text",description:"Primary button text color"},{key:"primaryButtonHover",label:"Hover",description:"Primary button hover state"}],f=[{key:"secondaryButtonBg",label:"Background",description:"Secondary button background"},{key:"secondaryButtonText",label:"Text",description:"Secondary button text color"},{key:"secondaryButtonHover",label:"Hover",description:"Secondary button hover state"}];return i.jsx(Xt,{open:t,onOpenChange:e,children:i.jsxs(Qt,{className:"max-w-2xl max-h-[85vh] flex flex-col overflow-hidden",children:[i.jsxs(gn,{className:"flex-shrink-0",children:[i.jsxs(wr,{className:"flex items-center gap-2",children:[i.jsx(ta,{className:"h-5 w-5"}),"Global Design Settings"]}),i.jsx(jn,{children:"Configure global colors and typography for your theme. These settings will be applied across the entire design and exported to WordPress Customizer."})]}),i.jsxs(oa,{defaultValue:"colors",className:"mt-4 flex-1 flex flex-col min-h-0",children:[i.jsxs(Yi,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[i.jsxs(gr,{value:"colors",className:"flex items-center gap-2",children:[i.jsx(ta,{className:"h-4 w-4"}),"Colors"]}),i.jsxs(gr,{value:"typography",className:"flex items-center gap-2",children:[i.jsx(qP,{className:"h-4 w-4"}),"Typography"]})]}),i.jsxs(Mr,{value:"colors",className:"space-y-6 mt-4 flex-1 overflow-y-auto",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold mb-3",children:"General Colors"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:h.map(({key:v,label:p,description:b})=>i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:v,className:"text-sm font-medium",children:p}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("div",{className:"w-10 h-10 rounded-md border border-border flex-shrink-0 cursor-pointer",style:{backgroundColor:a.colors[v]},onClick:()=>{var x;return(x=document.getElementById(`color-${v}`))==null?void 0:x.click()}}),i.jsxs("div",{className:"flex-1 space-y-1",children:[i.jsx(Nt,{id:v,type:"text",value:a.colors[v],onChange:x=>c(v,x.target.value),placeholder:"#000000",className:"font-mono text-sm"}),i.jsx("input",{id:`color-${v}`,type:"color",value:a.colors[v],onChange:x=>c(v,x.target.value),className:"sr-only"})]})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:b})]},v))})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Primary Button"}),i.jsx("div",{className:"grid grid-cols-3 gap-4",children:m.map(({key:v,label:p,description:b})=>i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:v,className:"text-sm font-medium",children:p}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("div",{className:"w-10 h-10 rounded-md border border-border flex-shrink-0 cursor-pointer",style:{backgroundColor:a.colors[v]},onClick:()=>{var x;return(x=document.getElementById(`color-${v}`))==null?void 0:x.click()}}),i.jsxs("div",{className:"flex-1",children:[i.jsx(Nt,{id:v,type:"text",value:a.colors[v],onChange:x=>c(v,x.target.value),placeholder:"#000000",className:"font-mono text-sm"}),i.jsx("input",{id:`color-${v}`,type:"color",value:a.colors[v],onChange:x=>c(v,x.target.value),className:"sr-only"})]})]})]},v))})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Secondary Button"}),i.jsx("div",{className:"grid grid-cols-3 gap-4",children:f.map(({key:v,label:p,description:b})=>i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:v,className:"text-sm font-medium",children:p}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("div",{className:"w-10 h-10 rounded-md border border-border flex-shrink-0 cursor-pointer",style:{backgroundColor:a.colors[v]},onClick:()=>{var x;return(x=document.getElementById(`color-${v}`))==null?void 0:x.click()}}),i.jsxs("div",{className:"flex-1",children:[i.jsx(Nt,{id:v,type:"text",value:a.colors[v],onChange:x=>c(v,x.target.value),placeholder:"#000000",className:"font-mono text-sm"}),i.jsx("input",{id:`color-${v}`,type:"color",value:a.colors[v],onChange:x=>c(v,x.target.value),className:"sr-only"})]})]})]},v))})]})]}),i.jsxs(Mr,{value:"typography",className:"space-y-6 mt-4 flex-1 overflow-y-auto",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"bodyFont",children:"Body Font"}
1765),i.jsxs(Vs,{value:a.typography.bodyFont,onValueChange:v=>u("bodyFont",v),children:[i.jsx(bs,{id:"bodyFont",children:i.jsx(Ks,{placeholder:"Select font"})}),i.jsx(ws,{children:Bre.map(v=>i.jsx(Lr,{value:v.value,children:v.label},v.value))})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Font for paragraphs and body text"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"headingFont",children:"Heading Font"}),i.jsxs(Vs,{value:a.typography.headingFont,onValueChange:v=>u("headingFont",v),children:[i.jsx(bs,{id:"headingFont",children:i.jsx(Ks,{placeholder:"Select font"})}),i.jsx(ws,{children:zre.map(v=>i.jsx(Lr,{value:v.value,children:v.label},v.value))})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Font for H1-H6 headings"})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(Xe,{children:"Base Font Size"}),i.jsxs("span",{className:"text-sm font-mono text-muted-foreground",children:[a.typography.baseFontSize,"px"]})]}),i.jsx(su,{value:[a.typography.baseFontSize],onValueChange:v=>u("baseFontSize",v[0]),min:14,max:20,step:1,className:"w-full"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Base size for body text (14-20px)"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(Xe,{children:"Heading Scale"}),i.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:a.typography.headingScale.toFixed(2)})]}),i.jsx(su,{value:[a.typography.headingScale*100],onValueChange:v=>u("headingScale",v[0]/100),min:120,max:150,step:5,className:"w-full"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Scale ratio for heading sizes (1.2-1.5)"})]})]}),i.jsxs("div",{className:"p-4 rounded-lg border border-border bg-card",children:[i.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Preview"}),i.jsx("div",{style:{fontFamily:`'${a.typography.headingFont}', serif`,color:a.colors.heading,fontSize:`${a.typography.baseFontSize*a.typography.headingScale*a.typography.headingScale}px`},className:"font-bold mb-2",children:"Heading Example"}),i.jsxs("p",{style:{fontFamily:`'${a.typography.bodyFont}', sans-serif`,fontSize:`${a.typography.baseFontSize}px`,color:a.colors.text},children:["This is how your body text will look with the selected font and size settings."," ",i.jsx("span",{style:{color:a.colors.link},children:"Links will appear like this"}),"."]})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-border flex-shrink-0 bg-background",children:[i.jsx(Y,{variant:"outline",onClick:e,children:"Cancel"}),i.jsxs(Y,{onClick:d,children:[i.jsx($g,{className:"h-4 w-4 mr-2"}),"Apply Settings"]})]})]})})}function qre({projectId:t,existingImages:e,onImagesChange:r}){const{track:n}=no(),[s,o]=g.useState(!1),a=g.useRef(null),l=g.useRef(null),c=e.find(m=>m.type==="logo"),u=e.filter(m=>m.type==="image"),d=async(m,f)=>{var p;if(!m)return;const v=L1(m);if(v){Q.error(v);return}o(!0);try{const{data:{session:b}}=await re.auth.getSession();if(!((p=b==null?void 0:b.user)!=null&&p.id))throw new Error("Not authenticated");const x=m.name.split(".").pop(),y=`${b.user.id}/${t}/${f}-${Date.now()}.${x}`,{error:w}=await re.storage.from("project-images").upload(y,m);if(w)throw w;const{data:{publicUrl:j}}=re.storage.from("project-images").getPublicUrl(y),{data:_,error:S}=await re.from("project_assets").insert({project_id:t,type:f,url:j,source:"upload",name:m.name,slot_index:f==="image"?u.length:null}).select().single();if(S)throw S;const N={id:_.id,url:j,type:f,name:m.name};if(f==="logo"){const P=e.filter(C=>C.type!=="logo");r([...P,N]),n("theme_customized",{project_id:t,action:"logo_uploaded"})}else r([...e,N]),n("theme_customized",{project_id:t,action:"image_uploaded"});Q.success(`${f==="logo"?"Logo":"Image"} uploaded!`)}catch(b){console.error("Upload error:",b),Q.error("Failed to upload image")}o(!1)},h=async m=>{try{await re.from("project_assets").delete().eq("id",m.id),r(e.filter(f=>f.id!==m.id)),Q.success("Image removed")}catch(f){console.error("Remove error:",f),Q.error("Failed to remove image")}};return i.jsxs("div",{className:"space-y-5",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground mb-2 block",children:"Logo (optional)"}),i.jsxs("div",{className:"flex items-center gap-4",children:[c?i.jsxs("div",{className:"relative group",children:[i.jsx(Yw,{src:c.url,alt:"Logo",className:"h-16 w-auto max-w-[200px] object-contain rounded border border-border"}),i.jsx("button",{onClick:()=>h(c),className:"absolute -top-2 -right-2 h-5 w-5 rounded-full bg-destructive text-destructive-foreground flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:i.jsx(Bn,{className:"h-3 w-3"})})]}):i.jsxs(Y,{variant:"outline",size:"sm",onClick:()=>{var m;return(m=l.current)==null?void 0:m.click()},disabled:s,children:[s?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):i.jsx(_p,{className:"h-4 w-4 mr-2"}),"Upload Logo"]}),i.jsx("input",{ref:l,type:"file",accept:"image/*",className:"hidden",onChange:m=>{var v;const f=(v=m.target.files)==null?void 0:v[0];f&&d(f,"logo"),m.target.value=""}})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground mb-2 block",children:"Additional Images (up to 4)"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[u.map(m=>i.jsx(dt,{className:"relative group overflow-hidden",children:i.jsxs(ct,{className:"p-0 as
1765pect-video",children:[i.jsx(Yw,{src:m.url,alt:m.name,className:"w-full h-full object-cover"}),i.jsx("button",{onClick:()=>h(m),className:"absolute top-1 right-1 h-6 w-6 rounded-full bg-destructive text-destructive-foreground flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:i.jsx(Bn,{className:"h-3 w-3"})})]})},m.id)),u.length<4&&i.jsx(dt,{className:"cursor-pointer hover:border-primary transition-colors",onClick:()=>{var m;return(m=a.current)==null?void 0:m.click()},children:i.jsx(ct,{className:"p-0 aspect-video flex items-center justify-center",children:s?i.jsx(et,{className:"h-6 w-6 animate-spin text-muted-foreground"}):i.jsxs("div",{className:"text-center text-muted-foreground",children:[i.jsx(qa,{className:"h-6 w-6 mx-auto mb-1"}),i.jsx("span",{className:"text-xs",children:"Add Image"})]})})})]}),i.jsx("input",{ref:a,type:"file",accept:"image/*",className:"hidden",onChange:m=>{var v;const f=(v=m.target.files)==null?void 0:v[0];f&&d(f,"image"),m.target.value=""}}),i.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Upload images to include in your theme. If none provided, placeholder images will be used."})]})]})}const _y=768;function H1(){const[t,e]=g.useState(void 0);return g.useEffect(()=>{const r=window.matchMedia(`(max-width: ${_y-1}px)`),n=()=>{e(window.innerWidth<_y)};return r.addEventListener("change",n),e(window.innerWidth<_y),()=>r.removeEventListener("change",n)},[]),!!t}const Vre=new Set(["free",""]);function T3(t){return!Vre.has((t||"free").toLowerCase())}const Kre=new Set(["starter","pro","agency","project_pass"]);function Yre(t,e,r){if(r!=null&&r.isStaff||r!=null&&r.isSuperAdmin||r!=null&&r.trialActive)return!0;const n=(e||"free").toLowerCase();return Kre.has(n)}const Qre={classic:1,gutenberg:3,elementor:5};function $v(t){return Qre[t]??1}const _2=1;function e0(t){return`${t} credit${t===1?"":"s"} - Free with Plan`}function iu(t){return t.isStaff||t.isSuperAdmin||t.trialActive?!0:T3(t.plan)?t.source==="credit_pack"&&t.subscriptionEnd?new Date(t.subscriptionEnd).getTime()>Date.now():!0:!1}const Jre={classic:{tooltip:"Traditional WordPress theme format. High-fidelity design match and easy to install, but harder to modify without HTML, PHP, CSS, and theme-structure knowledge.",scores:{design:{value:3,label:"Best"},install:{value:3,label:"Easy"},flexibility:{value:1,label:"Low"}}},gutenberg:{tooltip:"Modern block theme for the Full-Site Editor. Easy to install and ultra-flexible with drag-and-drop blocks, though some designs don't map perfectly to native blocks.",scores:{design:{value:2,label:"Good"},install:{value:3,label:"Easy"},flexibility:{value:2,label:"Medium"}}},elementor:{tooltip:"Importable Elementor template with excellent design match and top-tier customizability, but takes a little more time and knowledge to configure.",scores:{design:{value:3,label:"Best"},install:{value:2,label:"Moderate"},flexibility:{value:3,label:"High"}}}};function Xre({value:t}){return i.jsx("div",{className:"flex items-end gap-0.5","aria-label":`${t} of 3`,children:[1,2,3].map(e=>i.jsx("span",{className:Se("w-[3px] rounded-full transition-colors",e===1?"h-1.5":e===2?"h-2.5":"h-3.5",e<=t?"bg-primary":"bg-muted-foreground/30")},e))})}function Zre({meta:t}){const e=[{key:"design",title:"Design Match",v:t.scores.design.value,label:t.scores.design.label},{key:"install",title:"Install",v:t.scores.install.value,label:t.scores.install.label},{key:"flexibility",title:"Flexibility",v:t.scores.flexibility.value,label:t.scores.flexibility.label}];return i.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:e.map(r=>i.jsxs("div",{className:"flex flex-col items-center gap-1 rounded-2xl bg-primary/10 px-3 py-2 sm:flex-row sm:items-center sm:gap-1.5 sm:rounded-full sm:px-2 sm:py-0.5",children:[i.jsx("span",{className:"text-[10px] font-medium leading-none text-foreground",children:r.title}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-[10px] tabular-nums text-primary",children:r.label}),i.jsx(Xre,{value:r.v})]})]},r.key))})}function ene({content:t}){const e=r=>r.stopPropagation();return i.jsxs(ol,{children:[i.jsx(al,{asChild:!0,children:i.jsx("button",{type:"button","aria-label":"More info",onClick:e,className:"inline-flex h-4 w-4 items-center justify-center rounded-full text-primary/80 hover:text-primary",children:i.jsx(qc,{className:"h-3 w-3"})})}),i.jsx(sa,{side:"top",className:"max-w-xs text-xs",onClick:e,children:t})]})}function jy({format:t,selected:e,onSelect:r,title:n,description:s,isMobile:o,creditText:a}){const l=Jre[t],c=Se("flex items-start gap-2 p-2 rounded-md cursor-pointer border transition-colors w-full text-left",e?"bg-primary/10 border-primary/70":"bg-background border-border/60 hover:border-primary/40"),u=i.jsxs("div",{role:"radio","aria-checked":e,tabIndex:0,onClick:()=>r(t),onKeyDown:d=>{(d.key===" "||d.key==="Enter")&&(d.preventDefault(),r(t))},className:c,children:[i.jsx("input",{type:"radio",name:"exportFormat",value:t,checked:e,readOnly:!0,tabIndex:-1,
1765className:"mt-0.5 pointer-events-none"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[i.jsx("span",{className:"text-sm font-medium",children:n}),a&&i.jsx("span",{className:"text-xs bg-muted text-muted-foreground px-1.5 py-0.5 rounded",children:a}),o?i.jsx(ene,{content:l.tooltip}):i.jsx(qc,{className:"h-3 w-3 text-primary/70","aria-hidden":"true"})]}),s,i.jsx(Zre,{meta:l})]})]});return o?u:i.jsxs(lh,{children:[i.jsx(ch,{asChild:!0,children:u}),i.jsx(Qc,{side:"right",sideOffset:6,className:"max-w-xs text-xs leading-snug",children:l.tooltip})]})}function A3({value:t,onChange:e,showCreditLabels:r=!1}){const n=H1(),s=a=>r?e0($v(a)):void 0,o=a=>{e(a)};return i.jsx(Qh,{delayDuration:150,children:i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(jy,{format:"classic",selected:t==="classic",onSelect:o,isMobile:n,creditText:s("classic"),title:"Classic Theme (PHP)",description:i.jsx(i.Fragment,{children:i.jsx("p",{className:"text-xs text-muted-foreground/80",children:"Traditional WordPress theme with PHP templates. Compatible with all WordPress versions and the Customizer."})})}),i.jsx(jy,{format:"gutenberg",selected:t==="gutenberg",onSelect:o,isMobile:n,creditText:s("gutenberg"),title:"Gutenberg Block Theme (FSE)",description:i.jsx("p",{className:"text-xs text-muted-foreground/80",children:"Modern block-based theme for Full Site Editor (WordPress 5.9+). Built-in mobile navigation."})}),i.jsx(jy,{format:"elementor",selected:t==="elementor",onSelect:o,isMobile:n,creditText:s("elementor"),title:"Elementor Template",description:i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-xs text-muted-foreground/80",children:"Importable JSON template for Elementor (free version compatible). Use with any WordPress theme."}),i.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-1",children:["Using Elementor Free?"," ",i.jsx("a",{href:"https://app.box.com/shared/static/uc9ajs7fbyrplvnf7m22orfi4shthgu2.zip",target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),className:"text-primary underline hover:no-underline",children:"Download our plugin"})," ","to set headers & footers."]})]})})]})})}function tne(t,e){const r="".toLowerCase().split(";")[0].trim(),n={"image/svg+xml":"svg","image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/avif":"avif"};if(n[r])return n[r];if(t&&t.length>=12){const s=t;if(s[0]===137&&s[1]===80&&s[2]===78&&s[3]===71)return"png";if(s[0]===255&&s[1]===216&&s[2]===255)return"jpg";if(s[0]===71&&s[1]===73&&s[2]===70&&s[3]===56)return"gif";if(s[0]===82&&s[1]===73&&s[2]===70&&s[3]===70&&s[8]===87&&s[9]===69&&s[10]===66&&s[11]===80)return"webp";const o=new TextDecoder().decode(s.slice(0,256)).trim().toLowerCase();if(o.startsWith("<svg")||o.startsWith("<?xml")&&o.includes("<svg"))return"svg"}return null}function j2(t,e){var n;if(!e)return t;const r=(((n=t.match(/\.([a-z0-9]+)$/i))==null?void 0:n[1])||"").toLowerCase();return(r==="jpeg"?"jpg":r)===e?t:`${t.replace(/\.[a-z0-9]+$/i,"")}.${e}`}function rne(t,e){const r=new Set,n=new Set,s=/<img[^>]+src=["']([^"']+)["']/gi;let o;for(;(o=s.exec(t))!==null;)o[1]&&!o[1].startsWith("data:")&&r.add(o[1]);const a=/<(?:video|source)[^>]+src=["']([^"']+)["']/gi;for(;(o=a.exec(t))!==null;)o[1]&&!o[1].startsWith("data:")&&n.add(o[1]);const l=/style=["'][^"']*url\(["']?([^"')]+)["']?\)/gi;for(;(o=l.exec(t))!==null;)o[1]&&!o[1].startsWith("data:")&&r.add(o[1]);const c=/url\(["']?([^"')]+)["']?\)/gi;for(;(o=c.exec(e))!==null;){const u=o[1];u&&!u.startsWith("data:")&&!u.startsWith("#")&&!u.endsWith(".woff")&&!u.endsWith(".woff2")&&!u.endsWith(".ttf")&&!u.endsWith(".eot")&&(/\.(mp4|webm|ogg|mov)(\?|$)/i.test(u)?n.add(u):r.add(u))}return{images:Array.from(r),videos:Array.from(n)}}function k2(t,e,r){try{let s=new URL(t).pathname.split("/").pop()||"";return s=s.replace(/[^a-zA-Z0-9._-]/g,"_"),r==="image"&&!/\.(jpg|jpeg|png|gif|webp|svg|avif|ico)$/i.test(s)&&(s=s+".jpg"),r==="video"&&!/\.(mp4|webm|ogg|mov)$/i.test(s)&&(s=s+".mp4"),`${String(e+1).padStart(3,"0")}-${s}`}catch{return`${String(e+1).padStart(3,"0")}-${r}${e}.${r==="image"?"jpg":"mp4"}`}}function nne(t,e){const{images:r,videos:n}=rne(t,e),s={};return r.forEach((o,a)=>{const l=k2(o,a,"image").replace(/theme-images\//g,"");s[o]=`wp-content/uploads/${l}`}
1765),n.forEach((o,a)=>{const l=k2(o,a,"video").replace(/theme-images\//g,"");s[o]=`wp-content/uploads/${l}`}),s}const S2="/assets/media-settings-help-CWvjU4NN.png",sne=.75,ky=20;function ine({projectId:t,sourceUrl:e,creditsRemaining:r,onClose:n,onStart:s,compact:o=!1,replicationActive:a=!1,replicatedUrls:l,onInsufficientCredits:c,onUpgradeNeeded:u,trialActive:d=!1}){const[h,m]=g.useState(!0),[f,v]=g.useState(null),[p,b]=g.useState([]),[x,y]=g.useState(0),[w,j]=g.useState({}),[_,S]=g.useState(""),N=async(R=!1)=>{var G,U;if(u){u();return}m(!0),v(null);try{const{data:z,error:oe}=await re.functions.invoke("discover-pages",{body:{url:e,projectId:t,rescan:R}});if(oe){let he="";if(oe&&typeof oe=="object"&&"name"in oe&&oe.name==="FunctionsHttpError")try{const de=await((U=(G=oe.context)==null?void 0:G.json)==null?void 0:U.call(G));de!=null&&de.error&&(he=de.error)}catch{}const J=he||oe.message||"Discovery failed";if(R&&/insufficient_credits|402/i.test(J)&&c){c(1,r);return}throw new Error(J)}if(!(z!=null&&z.success))throw new Error((z==null?void 0:z.error)||"Discovery failed");const L=z.pages||[];b(L),y(z.total||L.length);const q={};L.forEach(he=>{q[he.url]={selected:!1,type:"page"}}),j(q),R&&Q.success(`Re-scanned. Found ${z.total||L.length} pages.`)}catch(z){v(z instanceof Error?z.message:"Discovery failed")}finally{m(!1)}},P=()=>{if(u){u();return}if(r<1){c==null||c(1,r);return}confirm("Re-scan this site for new pages? This costs 1 credit.")&&N(!0)};g.useEffect(()=>{if(u){m(!1);return}N()},[e,t,u]);const C=R=>!!(l!=null&&l.has(R)),O=g.useMemo(()=>{const R=_.trim().toLowerCase();return R?p.filter(G=>G.name.toLowerCase().includes(R)||G.pathname.toLowerCase().includes(R)):p},[p,_]),F=g.useMemo(()=>p.filter(R=>{var G;return((G=w[R.url])==null?void 0:G.selected)&&!C(R.url)}).length,[w,p,l]),T=+(F*sne).toFixed(2),A=T>r,k=F>=ky,$=R=>{C(R)||j(G=>{const U=G[R]||{selected:!1,type:"page"};return!U.selected&&k?(Q.message("Per-batch limit reached",{description:`You can replicate up to ${ky} pages per batch. Run another batch when these finish.`}),G):{...G,[R]:{...U,selected:!U.selected}}})},K=(R,G)=>j(U=>({...U,[R]:{...U[R],type:G}})),H=()=>{if(u){u();return}const R=p.filter(G=>{var U;return((U=w[G.url])==null?void 0:U.selected)&&!C(G.url)}).map(G=>({url:G.url,name:G.name,contentType:w[G.url].type}));if(R.length!==0){if(T>r&&c){c(T,r);return}s(R)}};let W=e;try{W=new URL(e.startsWith("http")?e:`https://${e}`).hostname.replace(/^www\./,"")}catch{}return o?i.jsxs("div",{className:`rounded-2xl border border-primary/30 bg-gradient-to-br from-primary/5 to-accent/5 p-3 space-y-3 ${a?"opacity-60":""}`,children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"text-sm min-w-0 break-words [overflow-wrap:anywhere]",children:[d&&i.jsx(Tv,{}),h?i.jsxs("span",{className:"text-muted-foreground inline-flex items-center gap-2",children:[i.jsx(et,{className:"h-3.5 w-3.5 animate-spin"})," Scanning ",i.jsx("span",{className:"font-medium",children:W})," for additional pages…"]}):f?i.jsxs("span",{className:"text-destructive break-words [overflow-wrap:anywhere]",children:["Couldn't scan ",W,": ",f]}):u?i.jsxs("span",{children:["Additional page scanning and replication are available on paid plans."," ",i.jsx(Y,{variant:"link",size:"sm",className:"h-auto p-0 text-sm align-baseline",onClick:u,children:"Upgrade to unlock"})]}):p.length===0?i.jsxs("span",{children:["I scanned ",i.jsx("span",{className:"font-medium",children:W})," but didn't find any additional pages I could replicate."]}):i.jsxs("span",{children:["I scanned ",i.jsx("span",{className:"font-medium",children:W})," and found"," ",i.jsxs("span",{className:"font-semibold text-primary",children:[x," additional page",x===1?"":"s"]})," ","you can replicate. Pick the ones you'd like and I'll build them one at a time."]})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[!h&&i.jsxs(Y,{variant:"ghost",size:"sm",onClick:P,disabled:a,title:"Re-scan for new pages (1 credit)",className:"h-7 px-2 text-xs gap-1",children:[i.jsx(bp,{className:"h-3.5 w-3.5"}),"Re-scan (1 cr)"]}),i.jsx(Y,{variant:"ghost",size:"sm",onClick:n,title:"Dismiss",className:"h-7 w-7 p-0",children:i.jsx(Bn,{className:"h-3.5 w-3.5"})})]})]}),!h&&!f&&p.length>0&&i.jsxs(i.Fragment,{children:[p.length>8&&i.jsxs("div",{className:"relative",children:[i.jsx(wp,{className:"h-3.5 w-3.5 absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}
1765),i.jsx(Nt,{value:_,onChange:R=>S(R.target.value),placeholder:`Filter ${p.length} pages…`,disabled:a,className:"h-7 text-xs pl-7"})]}),i.jsxs("div",{className:"text-xs text-muted-foreground",children:["Selected ",i.jsx("span",{className:"font-medium text-foreground",children:F})," / ",ky," per batch"]}),i.jsx("div",{className:`rounded-lg border bg-background/60 divide-y max-h-[260px] overflow-auto ${a?"pointer-events-none":""}`,children:O.map(R=>{const G=w[R.url]||{selected:!1,type:"page"},U=C(R.url),z=a||U||k&&!G.selected;return i.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 hover:bg-muted/40",children:[i.jsx(Kn,{checked:U||G.selected,disabled:z,onCheckedChange:()=>$(R.url),className:"disabled:opacity-100"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"font-medium text-sm truncate flex items-center gap-2",children:[i.jsx("span",{className:"truncate",children:R.name}),U&&i.jsx(rt,{variant:"secondary",className:"text-[10px] py-0 px-1.5",children:"Replicated"})]}),i.jsxs("a",{href:R.url,target:"_blank",rel:"noopener noreferrer",className:`text-xs text-muted-foreground hover:text-primary inline-flex items-center gap-1 truncate ${a?"pointer-events-none":""}`,tabIndex:a?-1:0,children:[R.pathname,i.jsx(Bi,{className:"h-3 w-3 shrink-0"})]})]}),i.jsxs(Vs,{value:G.type,disabled:a||U,onValueChange:oe=>K(R.url,oe),children:[i.jsx(bs,{className:"h-7 w-[78px] text-xs",children:i.jsx(Ks,{})}),i.jsxs(ws,{children:[i.jsx(Lr,{value:"page",children:"Page"}),i.jsx(Lr,{value:"post",children:"Post"})]})]})]},R.url)})}),i.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1",children:[i.jsxs("div",{className:"text-xs",children:[i.jsx("span",{className:"text-muted-foreground",children:"Cost: "}),i.jsxs("span",{className:"font-semibold",children:[T.toFixed(2)," credits"]}),i.jsxs("span",{className:"text-muted-foreground",children:[" (",F," × 0.75)"]}
1765),A&&i.jsx("span",{className:"ml-2 text-destructive",children:"— low balance"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Y,{variant:"ghost",size:"sm",onClick:n,children:a?"Hide":"Skip"}),i.jsx(Y,{size:"sm",onClick:H,disabled:F===0||a,children:a?"Replicating…":"Replicate"})]})]})]})]}):i.jsxs(dt,{className:"border-primary/30 shadow-md",children:[i.jsxs(ir,{className:"pb-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs(Dr,{className:"text-base flex items-center gap-2",children:["Additional pages found",!h&&x>0&&i.jsx(rt,{variant:"secondary",children:x})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs(Y,{variant:"ghost",size:"sm",onClick:P,disabled:h,title:"Re-scan for new pages (1 credit)",className:"gap-1 text-xs",children:[i.jsx(bp,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Re-scan (1 cr)"]}),i.jsx(Y,{variant:"ghost",size:"sm",onClick:n,title:"Dismiss",children:i.jsx(Bn,{className:"h-4 w-4"})})]})]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["We scanned ",i.jsx("span",{className:"font-medium",children:e})," and found inner pages you can replicate. Pick the ones you want and we'll generate them one-by-one."]})]}),i.jsxs(ct,{className:"space-y-3",children:[h&&i.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-4",children:[i.jsx(et,{className:"h-4 w-4 animate-spin"})," Discovering pages…"]}),!h&&f&&i.jsx("p",{className:"text-sm text-destructive",children:f}),!h&&!f&&p.length===0&&i.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional pages were discovered on this site."}),!h&&!f&&p.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"rounded-md border divide-y max-h-[360px] overflow-auto",children:O.map(R=>{const G=w[R.url]||{selected:!1,type:"page"};return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 hover:bg-muted/40",children:[i.jsx(Kn,{checked:G.selected,onCheckedChange:()=>$(R.url)}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"font-medium text-sm truncate",children:R.name}),i.jsxs("a",{href:R.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-primary inline-flex items-center gap-1 truncate",children:[R.pathname,i.jsx(Bi,{className:"h-3 w-3 shrink-0"})]})]}),i.jsxs(Vs,{value:G.type,onValueChange:U=>K(R.url,U),children:[i.jsx(bs,{className:"h-8 w-[88px] text-xs",children:i.jsx(Ks,{})}),i.jsxs(ws,{children:[i.jsx(Lr,{value:"page",children:"Page"}),i.jsx(Lr,{value:"post",children:"Post"})]})]})]},R.url)})}),i.jsxs("div",{className:"flex items-center justify-between gap-3 pt-2 border-t",children:[i.jsxs("div",{className:"text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Estimated cost: "}),i.jsxs("span",{className:"font-semibold",children:[T.toFixed(2)," credits"]}),i.jsxs("span",{className:"text-muted-foreground",children:[" (",F," × 0.75)"]}
1765)]}),i.jsxs("div",{className:`text-xs ${A?"text-destructive":"text-muted-foreground"}`,children:["Balance: ",r.toFixed(2)," credits ",A&&"— not enough to replicate all selected pages"]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Y,{variant:"outline",size:"sm",onClick:n,children:"Skip"}),i.jsx(Y,{size:"sm",onClick:H,disabled:F===0,children:"Replicate selected"})]})]})]})]})]})}const Sy=t=>`pmgpt:auto-continue:${t}`;function one(t,e,r){const[n,s]=g.useState({status:"idle"}),[o,a]=g.useState(()=>{try{return sessionStorage.getItem(Sy(t))==="1"}catch{return!1}}),l=g.useRef([]),c=g.useRef(0),u=g.useRef(0),d=g.useRef(!1),h=g.useRef(""),m=g.useRef(""),f=g.useRef(null),v=g.useRef(o);v.current=o;const p=N=>{try{N?sessionStorage.setItem(Sy(t),"1"):sessionStorage.removeItem(Sy(t))}catch{}if(a(N),N&&f.current){const P=f.current;f.current=null,P(!0)}},b=async N=>{var O,F,T;const{data:P,error:C}=await re.functions.invoke("generate-page-from-url",{body:{projectId:t,url:N.url,pageName:N.name,contentType:N.contentType,extraInstructions:m.current||void 0,model:e}});if(C){const A=C&&typeof C=="object"&&"name"in C&&C.name==="FunctionsHttpError";let k="Failed to generate page";if(A)try{const $=await((F=(O=C.context)==null?void 0:O.json)==null?void 0:F.call(O));$!=null&&$.error&&(k=$.error)}catch{}else C instanceof Error&&(k=C.message);throw new Error(k)}if(!(P!=null&&P.success))throw new Error((P==null?void 0:P.error)||"Failed to generate page");return h.current=((T=P.page)==null?void 0:T.slug)||"",P},x=g.useCallback(async()=>{for(;c.current<l.current.length;){if(d.current){s({status:"idle"});return}const N=c.current,P=l.current[N];s({status:"running",index:N,total:l.current.length,current:P});try{await b(P)}catch(C){const O=C instanceof Error?C.message:"Unknown error";s({status:"error",index:N,total:l.current.length,current:P,message:O}),Q.error(`"${P.name}": ${O}`);return}try{const C=h.current||"",O=u.current===0;u.current+=1,r(C,O,P.url),Q.success(`Generated "${P.name}"`),c.current=N+1}catch{c.current=N+1}if(c.current>=l.current.length)break;if(!v.current){s({status:"awaiting_checkpoint",index:c.current,total:l.current.length,lastItem:P});const C=await new Promise(O=>{f.current=O});if(f.current=null,!C){s({status:"idle"});return}}}s({status:"idle"}),Q.success("All selected pages replicated.")},[r,t,e]),y=g.useCallback(N=>{N.length!==0&&n.status==="idle"&&(l.current=N,c.current=0,u.current=0,d.current=!1,m.current="",x())},[n.status,x]),w=g.useCallback(()=>{d.current=!0,f.current&&f.current(!1),s({status:"idle"}),Q.info("Replication stopped.")},[]),j=g.useCallback(N=>{N&&(m.current=(m.current?m.current+`
1766`:"")+N),f.current&&f.current(!0)},[]),_=g.useCallback(()=>{n.status==="error"&&x()},[n.status,x]),S=g.useCallback(()=>{n.status==="error"&&(c.current=n.index+1,x())},[n.status,x]);return{state:n,start:y,stop:w,continueNext:j,retryCurrent:_,skipCurrent:S,autoContinue:o,setAutoContinue:p}}function N2(t){var e,r;return!!((e=t==null?void 0:t.screenshot)!=null&&e.trim()&&Array.isArray((r=t.copyBlueprint)==null?void 0:r.sections)&&t.copyBlueprint.sections.length>0)}const id=200;function fm(t){return t.trim().split(/\s+/).filter(Boolean).length}function ane(t,e){const r=t.trim().split(/\s+/).filter(Boolean);return r.length<=e?t:r.slice(0,e).join(" ")}const lne=[{title:"Start with the homepage",body:"Only describe the homepage and universal styles. It saves credits and you can add additional pages later."},{title:"Include colors and styles",body:"Include any specific colors or styles you'd like us to use."},{title:"Be descriptive but not too restrictive",body:"Describe what you want at a high level but not at a pixel-by-pixel level. Doing so could actually become too long and restrictive for the AI to design it for you."},{title:"Keep it short",body:"Keep your prompt under 200 words for best results."},{title:"Design then modify",body:"Think of the first iteration as a draft, not the final work-of-art. Modify it with prompts accordingly."}];function C2(){return i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"font-medium",children:"What makes a good prompt?"}),i.jsx("ul",{className:"space-y-2",children:lne.map(t=>i.jsxs("li",{className:"leading-snug",children:[i.jsxs("span",{className:"font-semibold text-foreground",children:[t.title," — "]}),i.jsx("span",{className:"text-muted-foreground",children:t.body})]},t.title))})]})}function cne(){const t=H1(),e=i.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-xs text-primary hover:text-primary/80 transition-colors","aria-label":"What makes a good prompt?",children:[i.jsx(qc,{className:"h-3.5 w-3.5"}),"What makes a good prompt?"]});return t?i.jsxs(ol,{children:[i.jsx(al,{asChild:!0,children:e}),i.jsx(sa,{side:"top",className:"max-w-xs text-xs",children:i.jsx(C2,{})})]}):i.jsx(Qh,{delayDuration:150,children:i.jsxs(lh,{children:[i.jsx(ch,{asChild:!0,children:e}),i.jsx(Qc,{side:"bottom",sideOffset:6,className:"max-w-xs text-xs leading-snug",children:i.jsx(C2,{})})]})})}const mm=[{title:"Web design not quite what you expected?",body:"AI hallucinates sometimes and may not deliver exactly what you had in mind. You can refine it with prompts on the Customize screen, or generate a new set of designs."},{title:"Menu missing links?",body:"That's usually because the target page doesn't exist yet. Create new pages with + Page in the top right of the Customize screen, or scan the source site for additional pages to copy."}
1766,{title:"Which export format is best?",body:"Classic themes give the highest design match but are harder to customize after download. Gutenberg themes may not match the design exactly but are highly drag-and-drop customizable. Elementor templates match your design and are highly customizable, but need more knowledge to install and configure."}];function une({open:t,isFromWebsite:e,generationStep:r,themeCount:n}){const[s,o]=g.useState(()=>Math.floor(Math.random()*mm.length));g.useEffect(()=>{if(!t)return;o(Math.floor(Math.random()*mm.length));const l=setInterval(()=>{o(c=>(c+1)%mm.length)},8e3);return()=>clearInterval(l)},[t]);const a=mm[s];return i.jsx(Xt,{open:t,children:i.jsxs(Qt,{className:"max-w-lg [&>button]:hidden",onEscapeKeyDown:l=>l.preventDefault(),onPointerDownOutside:l=>l.preventDefault(),onInteractOutside:l=>l.preventDefault(),children:[i.jsxs(Wh,{children:[i.jsx(wr,{children:"Generating your theme"}),i.jsx(jn,{children:"Progress and helpful tips while your theme is being generated."})]}),i.jsxs("div",{className:"space-y-5",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-primary",children:[i.jsx(et,{className:"h-4 w-4 animate-spin"}),"This can take a few minutes. Don't refresh or leave the page."]}),e?i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`h-3 w-3 rounded-full transition-colors ${r>=1?"bg-primary shadow-lg shadow-primary/30":"bg-border animate-pulse"}`}),i.jsx("span",{className:"text-sm text-foreground font-medium",children:r>=1?"Theme generated!":"Analyzing website & building theme..."}),r<1&&i.jsx(et,{className:"h-3 w-3 animate-spin text-primary"}),r>=1&&i.jsx(fr,{className:"h-4 w-4 text-primary"})]}):i.jsx("div",{className:"space-y-3",children:Array.from({length:n},(l,c)=>c+1).map(l=>i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`h-3 w-3 rounded-full transition-colors ${r>=l?"bg-primary shadow-lg shadow-primary/30":"bg-border"}`}),i.jsxs("span",{className:`text-sm ${r>=l?"text-foreground font-medium":"text-muted-foreground"}`,children:[r===l?"Building":r>l?"Built":"Pending"," Theme ",l]}),r===l&&i.jsx(et,{className:"h-3 w-3 animate-spin text-primary"}),r>l&&i.jsx(fr,{className:"h-4 w-4 text-primary"})]},l))}),i.jsx("div",{className:"w-full bg-border rounded-full h-2.5 overflow-hidden",children:i.jsx("div",{className:"bg-gradient-to-r from-primary to-accent h-2.5 rounded-full transition-all duration-500",style:{width:`${e?r>=1?100:50:r/n*100}%`}})}),i.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-4 text-sm animate-in fade-in slide-in-from-bottom-2 duration-500",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-primary/80 mb-1",children:"Tips and Tricks"}),i.jsx("div",{className:"font-medium text-foreground mb-1",children:a.title}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:a.body})]},s)]})]})})}function dne(){var Iu;const{id:t}=j_(),e=Zt(),{getProject:r,updateProject:n}=f1(),{user:s,refreshProfile:o,profile:a,isEmailVerified:l,resendVerificationEmail:c,isStaff:u}=$t(),{track:d}=no(),{creditsRemaining:h,loading:m,refreshSubscription:f,plan:v,source:p,subscriptionEnd:b,isSuperAdmin:x,trialStatus:y}=nn(),w=y==="active",{saveThemeTags:j}=GZ(),[_,S]=g.useState(null),[N,P]=g.useState(!0),[C,O]=g.useState(""),[F,T]=g.useState(!1),[A,k]=g.useState(0),[$,K]=g.useState(!1),[H,W]=g.useState(!1),[R,G]=g.useState(!1),[U,z]=g.useState(!1),[oe,L]=g.useState([]),[q,he]=g.useState(null),[X,J]=g.useState("classic"),de=g.useRef(!1),[le,fe]=g.useState(!1),[Z,ae]=g.useState(null),[E,ne]=g.useState(!1),[te,D]=g.useState(!1),[M,V]=g.useState(!1),[me,ve]=g.useState(!1),[se,pe]=g.useState(!1),xe=g.useMemo(()=>_?b3(_.section_customizations,_.pages):void 0,[_==null?void 0:_.section_customizations,_==null?void 0:_.pages]),we=g.useMemo(()=>xe?w3(xe):[],[xe]),Ie=g.useMemo(()=>_?k3(_):!1,[_==null?void 0:_.project_mode,_==null?void 0:_.source_mode,_==null?void 0:_.source_url,_==null?void 0:_.master_html,_==null?void 0:_.description,_==null?void 0:_.theme_description,_==null?void 0:_.current_theme_data]),tt=g.useMemo(()=>_?S3(_):[],[_==null?void 0:_.current_theme_data,_==null?void 0:_.source_url]),[Ke,Dt]=g.useState("gemini25"),[yt,Wt]=g.useState(3),[Ct,nt]=g.useState("describe"),[Ft,kr]=g.useState(""),ut=NZ(Ft),[Ue,sn]=g.useState("words"),[bt,Vr]=g.useState(!1),[Je,ie]=g.useState(""),[be,st]=g.useState(null),[Oe,$e]=g.useState(null),[Ze,ht]=g.useState(!1),[_t,Et]=g.useState(!0),[Cn,on]=g.useState(!1),[En,io]=g.useState(void 0),[_l,
1766jl]=g.useState(0),[oo,Pu]=g.useState(()=>{try{const I=sessionStorage.getItem(`pmgpt:replicated-urls:${t||""}`);return I?new Set(JSON.parse(I)):new Set}catch{return new Set}}),an=one((_==null?void 0:_.id)||"",Ke,(I,B,ee)=>{t&&lo({silent:!0}),B&&I&&io(I),ee&&Pu(ce=>{const _e=new Set(ce);_e.add(ee);try{sessionStorage.setItem(`pmgpt:replicated-urls:${t||""}`,JSON.stringify([..._e]))}catch{}return _e})}),ao=(_==null?void 0:_.status)==="customizing"&&(_==null?void 0:_.source_mode)==="copy"&&!!(_!=null&&_.source_url);u||w||T3(v);const kl=iu({plan:v,source:p,subscriptionEnd:b,isStaff:u,isSuperAdmin:x,trialActive:w}),va=kl,Sl=Yre("multi_page_builder",v,{isStaff:u,trialActive:w}),Ae=!iu({plan:v,source:p,subscriptionEnd:b,isStaff:u,isSuperAdmin:x}),Zs=$v(X),js=I=>ae(I),xa=(I,B=va)=>B?!0:(js(I),!1),er=Ct==="inspiration"||Ct==="copy",ei=Ct==="copy"?3:2;g.useEffect(()=>{!m&&va&&Dt("gemini30")},[v,m,va]),g.useEffect(()=>{lo()},[t]),g.useEffect(()=>{_!=null&&_.id&&wi()},[_==null?void 0:_.id]),g.useEffect(()=>{if(_){const I=Array.isArray(_.theme_options)&&_.theme_options.length>0;fe(I&&_.is_public===!1)}},[_==null?void 0:_.id,_==null?void 0:_.is_public]),g.useEffect(()=>{(_==null?void 0:_.status)!=="ready_to_export"||te||!s||(D(!0),re.from("export_survey_responses").select("id").eq("user_id",s.id).limit(1).then(({data:I})=>{(!I||I.length===0)&&ne(!0)}))},[_==null?void 0:_.status,te,s==null?void 0:s.id]);const lo=async I=>{var ee,ce;if(!t)return;I!=null&&I.silent||P(!0);const B=await r(t);if(B){if(B.status==="theme_selected"){const _e=B.current_theme_data,Ce={status:"customizing"};!B.master_html&&(_e!=null&&_e.previewHtml)&&(Ce.master_html=_e.previewHtml,Ce.master_css=_e.previewCss||"",Ce.section_customizations={}),await n(t,Ce),Object.assign(B,Ce)}if((B.status==="described"||B.status==="created")&&(B.master_html&&B.selected_theme_index!==null&&((ee=B.theme_options)==null?void 0:ee.length)>0?(await n(t,{status:"customizing"}),B.status="customizing"):((ce=B.theme_options)==null?void 0:ce.length)>0&&(await n(t,{status:"options_generated"}),B.status="options_generated")),B.master_css){const _e=B5(B.master_css),Ce=B.current_theme_data||null,Pe=typeof(Ce==null?void 0:Ce.externalCss)=="string"&&Ce.externalCss.length>0;if(_e!==B.master_css||Pe){const Te={};if(_e!==B.master_css&&(B.master_css=_e,Te.master_css=_e),Pe&&Ce){const We={...Ce};delete We.externalCss,B.current_theme_data=We,Te.current_theme_data=We}n(t,Te)}}S(B),B.theme_description&&O(B.theme_description),B.project_mode==="from_website"?nt(B.source_mode==="copy"?"copy":"inspiration"):nt("describe"),B.source_url&&kr(B.source_url),B.project_mode==="from_website"||B.source_url?sn("url"):sn("words")}else Q.error("Project not found"),e("/dashboard");I!=null&&I.silent||P(!1)},wi=async()=>{if(!(_!=null&&_.id))return;const{data:I,error:B}=await re.from("project_assets").select("*").eq("project_id",_.id).in("type",["logo","image"]);!B&&I&&L(I.map(ee=>({id:ee.id,url:ee.url,type:ee.type,name:ee.name||""})))},ti=(_==null?void 0:_.theme_options)&&_.theme_options.length>0&&_.status!=="created"&&_.status!=="described",Tu=I=>{if(!I)return"1.0";const[B,ee]=I.split(".").map(Number);return ee>=9?`${B+1}.0`:`${B}.${ee+1}`},is=I=>{I===Ue||F||(sn(I),I!=="url"?(kr(""),nt("describe"),Vr(!1)):Ct==="describe"&&nt("inspiration"),I!=="mockup"&&I!=="figma"?(he(null),Wt(3)):Wt(1),I!=="figma"&&(ie(""),st(null),$e(null)))},co=async()=>{var I;if(!_||!Je.trim()){Q.error("Please enter a Figma frame URL"),$e("Please enter a Figma frame URL.");return}ht(!0),$e(null);try{const{data:B,error:ee}=await re.functions.invoke("import-figma",{body:{url:Je.trim(),projectId:_.id}});if(ee)throw ee;if(!(B!=null&&B.success)||!((I=B==null?void 0:B.data)!=null&&I.screenshotUrl))throw new Error((B==null?void 0:B.error)||"Failed to import Figma frame");const ce=B.data;st(ce),he(ce.screenshotUrl),Q.success("Figma frame imported!")}catch(B){console.error("Figma import error:",B);const ee=B instanceof Error?B.message:"Failed to import Figma design";$e(ee),Q.error(ee)}ht(!1)},Nl=()=>{if(!_||F)return;if(Ue==="words"&&!C.trim()){Q.error("Please describe your theme");return}if(Ue==="words"){const B=YN(C);if(B&&fZ(B)){Q.error("That description includes a website. Move the link to the Website URL box. It is scanned once and reused on later edits.");return}}
1766if(Ue==="mockup"&&!q){Q.error("Please upload a design mockup");return}if(Ue==="figma"&&!(be!=null&&be.screenshotUrl)){Q.error("Please import a selected Figma frame first");return}if(er){if(!Ft.trim()){Q.error("Please enter a website URL");return}if(Ct==="copy"&&!bt){Q.error("Please confirm the legal disclaimer to copy a website");return}}if(!er&&!C.trim()&&!q){Q.error("Please describe your theme, upload a mockup, or import a Figma frame");return}if(!l){Q.error("Please verify your email before generating themes.",{action:{label:"Resend Email",onClick:async()=>{const{error:B}=await c();B?Q.error("Failed to send verification email"):Q.success("Verification email sent! Check your inbox.")}}});return}if(h<(er?ei:yt)){ae(h<=1?"low_credits":"out_of_credits");return}if(ti){z(!0);return}bf()},bf=async()=>{if(!_||!er&&!C.trim()&&!q)return;let I=!1;if(le&&!ti){const{data:B,error:ee}=await re.functions.invoke("set-theme-private",{body:{projectId:_.id,withGenerationCost:er?ei:yt}});if(ee||B!=null&&B.error){let ce=B??null;try{ce=ee!=null&&ee.context?await ee.context.json():ce}catch{}ce!=null&&ce.creditsNeeded?ae("out_of_credits"):Q.error("Could not make theme private");return}I=(B==null?void 0:B.charged)>0,I&&f()}try{await wf()}finally{if(I){const{data:B}=await re.functions.invoke("set-theme-private",{body:{projectId:_.id,refund:!0}});(B==null?void 0:B.refunded)>0&&(Q.info("Your 1 credit for the private option was returned."),f())}}},wf=async()=>{var Ce,Pe;if(!_)return;const I=er?"from_website":Ue==="mockup"?"mockup":Ue==="figma"?"figma":"describe",B=er?Ct==="copy"?"copy":"inspiration":null,ee=er?Ft.trim():null,ce=(Ce=be==null?void 0:be.metadata)==null?void 0:Ce.frameName,_e=Hw(C||(Ue==="mockup"&&q?"Recreate the uploaded design mockup as the homepage.":Ue==="figma"&&ce?`Recreate the imported Figma frame "${ce}" as the homepage.`:""),ee);await n(_.id,{project_mode:I,source_mode:B,source_url:ee,theme_description:_e}),S(Te=>Te?{...Te,project_mode:I,source_mode:B,source_url:ee,theme_description:_e}:null),Ct==="copy"&&ee&&await re.from("website_consent_log").insert({user_id:s.id,project_id:_.id,source_url:ee,consent_given:!0}),T(!0),k(0);try{const Te=(Pe=oe.find(ge=>ge.type==="logo"))==null?void 0:Pe.url,We=oe.filter(ge=>ge.type==="image").map(ge=>ge.url),ft=q&&!er?1:yt,qe=[];if(er){k(0),Q.info("Scraping website content...");let ge=null,it="";try{const{data:pt,error:xt}=await re.functions.invoke("scrape-website",{body:{url:ee,mode:B}});if(xt){const{message:Rt}=await On(xt,"Could not scrape website. Please try again.");it=Rt,console.error("Scrape error:",Rt,xt),Q.error(Rt,{duration:1/0,closeButton:!0})}else if(pt!=null&&pt.blocked){Q.error(pt.error,{duration:1/0,closeButton:!0}),T(!1);return}else if(pt!=null&&pt.success&&pt.data)ge=pt.data,Q.success("Website scraped! Generating theme...");else{const Rt=(pt==null?void 0:pt.error)||"Could not scrape website. Please try again.";it=Rt,console.warn("Scrape returned unsuccessful:",Rt),Q.error(Rt,{duration:1/0,closeButton:!0})}}catch(pt){const{message:xt}=await On(pt,"Could not scrape website. Please try again.");it=xt,console.error("Scrape exception:",xt,pt),Q.error(xt,{duration:1/0,closeButton:!0})}if(ee){const pt=!ge||B==="copy"&&!N2(ge),xt=gZ({url:ee,status:pt?"failed":"ok",error:pt?it||"Could not save a usable copy of this website.":void 0,mode:B,screenshot:ge==null?void 0:ge.screenshot,markdown:ge==null?void 0:ge.markdown,branding:ge==null?void 0:ge.branding,sections:vZ(ge==null?void 0:ge.copyBlueprint)}),Rt=pZ(_.section_customizations,xt);await n(_.id,{section_customizations:Rt}),S(Fe=>Fe&&{...Fe,section_customizations:Rt})}if(B==="copy"&&!N2(ge)){const pt=it||"Copy mode needs a successful website capture with a screenshot and section map. Please try again.";Q.error(pt,{duration:1/0,closeButton:!0}),T(!1);return}const{data:mt,error:Pt}=await re.functions.invoke("generate-themes",{body:{description:C||`Design based on ${ee}`,projectName:_.name,logoUrl:Te,imageUrls:We,themeIndex:0,deductCredits:!0,model:Ke,fromWebsite:{url:ee,mode:B,scrapedHtml:(ge==null?void 0:ge.html)||null,scrapedMarkdown:(ge==null?void 0:ge.markdown)||null,imageUrls:(ge==null?void 0:ge.imageUrls)||null,branding:(ge==null?void 0:ge.branding)||null,screenshot:(ge==null?void 0:ge.screenshot)||null,externalCss:(ge==null?void 0:ge.externalCss)||null,stylesheetUrls:(ge==null?void 0:ge.stylesheetUrls)||null,copyBlueprint:(ge==null?void 0:ge.copyBlueprint)||null},creditCost:ei}});if(Pt)throw console.error("Error generating theme from website:",Pt),Pt;if(!mt.theme)throw new Error("Failed to generate theme. Please try again.");qe.push(mt.theme),k(1),Q.success("Theme generated!");const jt=qe[0],Pn=Wm(jt.previewCss||"");if(await n(_.id,{theme_options:qe,selected_theme_index:0,current_theme_data:{...jt,scrapedHtml:(ge==null?void 0:ge.html)||null,externalCss:(ge==null?void 0:ge.externalCss)||null,stylesheetUrls:jt.stylesheetUrls||(ge==null?void 0:ge.stylesheetUrls)||null,copyBlueprint:jt.copyBlueprint||(ge==null?void 0:ge.copyBlueprint)||null,copyFidelity:jt.copyFidelity||null,copyAccuracySummary:jt.copyAccuracySummary||null,captureMethod:(ge==null?void 0:ge.captureMethod)||null},master_html:jt.previewHtml,master_css:jt.previewCss||"",theme_settings:Pn,status:"customizing"}),await o(),await f(),S(pt=>pt?{...pt,theme_options:qe,selected_theme_index:0,current_theme_data:{...jt,scrapedHtml:(ge==null?void 0:ge.html)||null,externalCss:(ge==null?void 0:ge.externalCss)||null,stylesheetUrls:jt.stylesheetUrls||(ge==null?void 0:ge.stylesheetUrls)||null,copyBlueprint:jt.copyBlueprint||(ge==null?void 0:ge.copyBlueprint)||null,copyFidelity:jt.copyFidelity||null,copyAccuracySummary:jt.copyAccuracySummary||null,captureMethod:(ge==null?void 0:ge.captureMethod)||null},master_html:jt.previewHtml,master_css:jt.previewCss||"",theme_settings:Pn,status:"customizing"}:null),d("theme_generated",{project_id:_.id,theme_count:1,mode:"from_website"}),B==="copy"){const pt=jt,xt=typeof pt.copyAccuracySummary=="string"&&pt.copyAccuracySummary.trim()?pt.copyAccuracySummary:"I copied this website using its rendered section map, text, full-page screenshot, brand details and stylesheet. It should be close, but some sections may not be exact. Tell me specifically what to change for each section and I'll fix it.";await re.from("design_messages").insert({project_id:_.id,role:"assistant",content:xt}),Q.info("Copy finished — check each section; some may not be exact.",{duration:1e4})}le||await _i(qe,_)}else{for(let it=0;
1766it<ft;it++){k(it);const{data:mt,error:Pt}=await re.functions.invoke("generate-themes",{body:{description:C||(Ue==="figma"?"Recreate the imported Figma frame as the homepage.":q?"Recreate the uploaded design mockup as the homepage.":""),projectName:_.name,logoUrl:Te,imageUrls:We,mockupImageUrl:q||void 0,figma:be?{sourceUrl:be.sourceUrl||Je.trim(),screenshotUrl:be.screenshotUrl,metadata:be.metadata}:void 0,themeIndex:it,deductCredits:it===ft-1,model:Ke,creditCost:ft,themeCountTotal:ft}});if(Pt)throw console.error(`Error generating theme ${it+1}:`,Pt),Pt;if(!mt.theme)throw console.error(`No theme returned for index ${it}`),new Error(`Failed to generate theme ${it+1}. Please try again.`);qe.push(mt.theme),Q.success(`Theme ${it+1} of ${ft} generated!`)}k(ft);const ge=q?C||"Recreate the uploaded design mockup as the homepage.":void 0;if(await re.from("profiles").update({theme_generations_count:((a==null?void 0:a.theme_generations_count)||0)+1}).eq("user_id",_.user_id),await o(),await f(),q&&qe.length===1){const it=qe[0],mt=Wm(it.previewCss||""),Pt=Ue==="figma"?"figma":"mockup";await n(_.id,{theme_options:qe,selected_theme_index:0,current_theme_data:it,master_html:it.previewHtml,master_css:it.previewCss||"",theme_description:ge,theme_settings:mt,project_mode:Pt,status:"customizing"}),S(jt=>jt?{...jt,theme_options:qe,selected_theme_index:0,current_theme_data:it,master_html:it.previewHtml,master_css:it.previewCss||"",theme_description:ge??jt.theme_description,theme_settings:mt,project_mode:Pt,status:"customizing"}:null),Q.success("Theme generated from mockup!"),d("theme_generated",{project_id:_.id,theme_count:1,mode:"mockup"}),le||await _i(qe,_)}else await n(_.id,{theme_options:qe,status:"options_generated"}),S(it=>it?{...it,theme_options:qe,status:"options_generated"}:null),d("theme_generated",{project_id:_.id,theme_count:qe.length}),Q.success(`All ${yt} theme option${yt===1?"":"s"} generated!`),le||await _i(qe,_)}}catch(Te){if(console.error("Generation error:",Te),Te&&typeof Te=="object"&&"name"in Te&&Te.name==="FunctionsHttpError")try{const{message:qe,body:ge}=await On(Te,"Failed to generate themes. Please try again.");if(typeof ge.creditsRemaining=="number"){ae("out_of_credits"),T(!1),k(0);return}Q.error(qe,{duration:1/0,closeButton:!0}),T(!1),k(0);return}catch{}const ft=Te instanceof Error&&Te.message?Te.message:"Failed to generate themes. Please try again.";Q.error(ft,{duration:1/0,closeButton:!0})}T(!1),k(0)},Au=async(I,B=!0)=>{if(!_)return!1;if(I){const{data:ee,error:ce}=await re.functions.invoke("set-theme-private",{body:{projectId:_.id}});if(ce||ee!=null&&ee.error){let _e=ee??null;try{_e=ce!=null&&ce.context?await ce.context.json():_e}catch{}return _e!=null&&_e.creditsNeeded?ae("out_of_credits"):Q.error("Could not make theme private"),!1}return S(_e=>_e?{..._e,is_public:!1}:null),(ee==null?void 0:ee.charged)>0&&f(),Q.success((ee==null?void 0:ee.charged)>0?`Theme set to private (${ee.charged} credit used)`:"Theme set to private"),!0}else return B&&(await _i(_.theme_options,_),S(ee=>ee?{...ee,is_public:!0}:null),Q.success("Theme published to gallery")),!0},_i=async(I,B)=>{var ee;try{const{data:{user:ce}}=await re.auth.getUser();if(!ce)return;const _e=(Te,We)=>`${Te.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}-${Date.now()}-${We}`,Ce=B.project_mode==="from_website";await re.from("public_themes").delete().eq("source_project_id",B.id);let Pe="";for(let Te=0;Te<I.length;Te++){const We=I[Te],ft=Ce?Dw:sg,qe=Ce?Fw:ig,ge=!!B.master_html&&Te===(B.selected_theme_index??-1)&&(B.status==="customizing"||B.status==="ready_to_export"||B.status==="theme_selected"),it=ge?B.master_html:We.previewHtml,mt=ge?B.master_css||"":We.previewCss||"",Pt=ft(it),jt=qe(mt),Pn=await y1({userId:ce.id,projectId:B.id,html:Pt,css:jt,isFromWebsite:Ce,storageKey:`${ce.id}/generated-${Date.now()}-${Te}.png`});Pe||(Pe=Pn);const pt=_e(We.name,Te),{data:xt,error:Rt}=await re.from("public_themes").insert({user_id:ce.id,source_project_id:B.id,name:We.name,description:We.description||B.theme_description,theme_description:B.theme_description,master_html:Pt,master_css:jt,slug:pt,published_at:new Date().toISOString(),thumbnail_url:Pn,heart_count:0,download_count:0,version:"1.0"}).select("id").single();if(Rt)console.error("Failed to publish theme to gallery:",We.name,Rt);else if(xt){const Fe=We.classification;if(console.log(`[Tags] Theme "${We.name}" classification:`,JSON.stringify(Fe)),Fe&&Fe.themeType)try{const Ht=await j(xt.id,Fe);console.log(`[Tags] Saved tags for theme "${We.name}": type=${Fe.themeType}, industries=${(ee=Fe.industries)==null?void 0:ee.join(", ")}, result=${Ht}`)}catch(Ht){console.error("[Tags] Failed to save tags for theme:",We.name,Ht)}else console.warn(`[Tags] Theme "${We.name}" has no classification data — tags will be missing`)}}console.log(`Published ${I.length} themes to gallery`),Pe?await re.from("projects").update({thumbnail_url:Pe,is_public:!0}).eq("id",B.id):await re.from("projects").update({is_public:!0}).eq("id",B.id),re.functions.invoke("regenerate-sitemap").then(({error:Te})=>{Te?console.error("Failed to regenerate sitemap:",Te):console.log("Sitemap regenerated after theme generation")})}catch(ce){console.error("Error publishing themes to gallery:",ce)}},Fv=async I=>{await Lv(I)},Lv=async I=>{if(!_)return;if(!l){Q.error("Please verify your email before customizing themes.",{action:{label:"Resend Email",onClick:async()=>{const{error:_e}=await c();_e?Q.error("Failed to send verification email"):Q.success("Verification email sent! Check your inbox.")}}});return}const B=_.theme_options[I],ee=Wm(B.previewCss||""),ce={selected_theme_index:I,current_theme_data:B,status:"customizing",theme_settings:ee};B!=null&&B.previewHtml&&(ce.master_html=B.previewHtml,ce.master_css=B.previewCss||"",ce.section_customizations={}),await n(_.id,ce),S(_e=>_e?{..._e,...ce}:null),d("theme_selected",{project_id:_.id,theme_index:I,theme_name:B.name}),Q.success(`Selected: ${B.name}`)},_f=async()=>
1766{if(!_)return;if(!l){Q.error("Please verify your email before customizing themes.",{action:{label:"Resend Email",onClick:async()=>{const{error:ee}=await c();ee?Q.error("Failed to send verification email"):Q.success("Verification email sent! Check your inbox.")}}});return}const I=_.current_theme_data,B={status:"customizing"};_.status==="ready_to_export"||_.status==="wordpress_preview"||_.status==="theme_selected"&&(I!=null&&I.previewHtml)&&(B.master_html=I.previewHtml,B.master_css=I.previewCss||"",B.section_customizations={}),await n(_.id,B),S(ee=>ee?{...ee,...B}:null)},Bv=async I=>{if(!_)return;const{master_html:B,master_css:ee,section_customizations:ce,pages:_e,...Ce}=I,Pe={...Ce};if(B!==void 0&&(Pe.master_html=B),ee!==void 0&&(Pe.master_css=ee),ce!==void 0&&(Pe.section_customizations=ce),_e!==void 0&&(Pe.pages=_e),!await n(_.id,Pe))throw new Error("Failed to save changes to your project. Please try again.");S(We=>We?{...We,...Pe}:null)},zv=async I=>{var Ce,Pe;if(!_)return;const B=Uv(I),ee=_.master_css||((Ce=_.current_theme_data)==null?void 0:Ce.previewCss)||"",ce=Wv(ee,B);await n(_.id,{theme_settings:I,master_css:ce});const _e=`Applied Design Settings: Primary ${I.colors.primary}, Secondary ${I.colors.secondary}, Font ${I.typography.bodyFont}`;await re.from("design_messages").insert({project_id:_.id,role:"assistant",content:os(_e,{page:"home",themeSettings:{colors:I.colors,typography:I.typography},sourceLabel:_e}),html_snapshot:_.master_html||((Pe=_.current_theme_data)==null?void 0:Pe.previewHtml)||null,css_snapshot:ce}),S(Te=>Te?{...Te,theme_settings:I,master_css:ce}:null),Q.success("Design settings applied!")},Uv=I=>{const{baseFontSize:B,headingScale:ee}=I.typography,ce=B,_e=Math.round(B*ee),Ce=Math.round(B*Math.pow(ee,2)),Pe=Math.round(B*Math.pow(ee,3)),Te=Math.round(B*Math.pow(ee,4)),We=Math.round(B*Math.pow(ee,5)),ft=I.colors.primaryButtonBg||I.colors.primary,qe=I.colors.primaryButtonText||"#ffffff",ge=I.colors.primaryButtonHover||I.colors.secondary,it=I.colors.secondaryButtonBg||I.colors.secondary,mt=I.colors.secondaryButtonText||"#ffffff",Pt=I.colors.secondaryButtonHover||I.colors.primary;return`
1767/* Global Design Settings - Generated by Theme Designer */
1768@import url('https://fonts.googleapis.com/css2?family=${I.typography.bodyFont.replace(/ /g,"+")}:wght@400;500;600;700&family=${I.typography.headingFont.replace(/ /g,"+")}:wght@400;500;600;700&display=swap');
1769
1770:root {
1771  --td-color-primary: ${I.colors.primary};
1772  --td-color-secondary: ${I.colors.secondary};
1773  --td-color-background: ${I.colors.background};
1774  --td-color-text: ${I.colors.text};
1775  --td-color-heading: ${I.colors.heading};
1776  --td-color-link: ${I.colors.link};
1777  --td-color-link-hover: ${I.colors.linkHover};
1778  --td-color-btn-primary-bg: ${ft};
1779  --td-color-btn-primary-text: ${qe};
1780  --td-color-btn-primary-hover: ${ge};
1781  --td-color-btn-secondary-bg: ${it};
1782  --td-color-btn-secondary-text: ${mt};
1783  --td-color-btn-secondary-hover: ${Pt};
1784  --td-font-body: '${I.typography.bodyFont}', sans-serif;
1785  --td-font-heading: '${I.typography.headingFont}', serif;
1786  --td-font-size-base: ${I.typography.baseFontSize}px;
1787  --td-heading-scale: ${I.typography.headingScale};
1788}
1789
1790/* Body Styles */
1791body {
1792  font-family: var(--td-font-body) !important;
1793  font-size: var(--td-font-size-base) !important;
1794  color: var(--td-color-text) !important;
1795  background-color: var(--td-color-background) !important;
1796}
1797
1798/* Heading Styles with Calculated Sizes */
1799h1, .h1 { 
1800  font-family: var(--td-font-heading) !important; 
1801  color: var(--td-color-heading) !important; 
1802  font-size: ${We}px !important;
1803}
1804h2, .h2 { 
1805  font-family: var(--td-font-heading) !important; 
1806  color: var(--td-color-heading) !important; 
1807  font-size: ${Te}px !important;
1808}
1809h3, .h3 { 
1810  font-family: var(--td-font-heading) !important; 
1811  color: var(--td-color-heading) !important; 
1812  font-size: ${Pe}px !important;
1813}
1814h4, .h4 { 
1815  font-family: var(--td-font-heading) !important; 
1816  color: var(--td-color-heading) !important; 
1817  font-size: ${Ce}px !important;
1818}
1819h5, .h5 { 
1820  font-family: var(--td-font-heading) !important; 
1821  color: var(--td-color-heading) !important; 
1822  font-size: ${_e}px !important;
1823}
1824h6, .h6 { 
1825  font-family: var(--td-font-heading) !important; 
1826  color: var(--td-color-heading) !important; 
1827  font-size: ${ce}px !important;
1828}
1829
1830/* Paragraph Styles */
1831p, .text, .body-text, .content p, article p {
1832  font-family: var(--td-font-body) !important;
1833  font-size: var(--td-font-size-base) !important;
1834  color: var(--td-color-text) !important;
1835}
1836
1837/* Link Styles — exclude Gutenberg/FSE button links */
1838a:not(.btn):not(.button):not([class*="btn-"]):not(.wp-block-button__link):not(.wp-element-button):not(.fse-button):not([class*="fse-button"]) {
1839  color: var(--td-color-link) !important;
1840}
1841a:not(.btn):not(.button):not([class*="btn-"]):not(.wp-block-button__link):not(.wp-element-button):not(.fse-button):not([class*="fse-button"]):hover {
1842  color: var(--td-color-link-hover) !important;
1843}
1844
1845/* Primary Button Styles */
1846.btn, .button, .fse-button, .fse-button-primary,
1847.wp-block-button__link, .wp-element-button,
1848[class*="btn-primary"], [class*="button-primary"],
1849.btn-primary, .button-primary,
1850.cta, .cta-button, .primary-btn,
1851input[type="submit"], button[type="submit"] {
1852  background-color: var(--td-color-btn-primary-bg) !important;
1853  border-color: var(--td-color-btn-primary-bg) !important;
1854  color: var(--td-color-btn-primary-text) !important;
1855}
1856.btn:hover, .button:hover, 
1857[class*="btn-primary"]:hover, [class*="button-primary"]:hover,
1858.btn-primary:hover, .button-primary:hover,
1859.cta:hover, .cta-button:hover, .primary-btn:hover,
1860input[type="submit"]:hover, button[type="submit"]:hover {
1861  background-color: var(--td-color-btn-primary-hover) !important;
1862  border-color: var(--td-color-btn-primary-hover) !important;
1863}
1864
1865/* Secondary Button Styles */
1866.fse-button-secondary,
1867[class*="btn-secondary"], [class*="button-secondary"],
1868.btn-secondary, .button-secondary,
1869.secondary-btn {
1870  background-color: var(--td-color-btn-secondary-bg) !important;
1871  border-color: var(--td-color-btn-secondary-bg) !important;
1872  color: var(--td-color-btn-secondary-text) !important;
1873}
1874[class*="btn-secondary"]:hover, [class*="button-secondary"]:hover,
1875.btn-secondary:hover, .button-secondary:hover,
1876.secondary-btn:hover {
1877  background-color: var(--td-color-btn-secondary-hover) !important;
1878  border-color: var(--td-color-btn-secondary-hover) !important;
1879}
1880
1881/* Badge/Tag styles using secondary */
1882.badge, .tag, .label {
1883  background-color: var(--td-color-secondary) !important;
1884}
1885
1886/* Accent elements using primary color */
1887.highlight, .accent, .featured,
1888[class*="highlight"], [class*="accent"] {
1889  background-color: var(--td-color-primary) !important;
1890}
1891
1892/* Border and outline accents */
1893.border-primary, [class*="border-primary"],
1894.outline-primary, [class*="outline-primary"] {
1895  border-color: var(--td-color-primary) !important;
1896}
1897
1898/* Text using primary color */
1899.text-primary, [class*="text-primary"],
1900.primary-text, .accent-text {
1901  color: var(--td-color-primary) !important;
1902}
1903
1904/* Text using secondary color */
1905.text-secondary, [class*="text-secondary"],
1906.secondary-text {
1907  color: var(--td-color-secondary) !important;
1908}
1909
1910/* Background sections */
1911.bg-primary, [class*="bg-primary"] {
1912  background-color: var(--td-color-primary) !important;
1913}
1914.bg-secondary, [class*="bg-secondary"] {
1915  background-color: var(--td-color-secondary) !important;
1916}
1917/* End Global Design Settings */
1918`},Wv=(I,B)=>{const ee="/* Global Design Settings - Generated by Theme Designer */",ce="/* End Global Design Settings */",_e=I.indexOf(ee),Ce=I.indexOf(ce);return _e!==-1&&Ce!==-1?I.slice(0,_e)+B+I.slice(Ce+ce.length):B+`
1919`+I},Cl=async()=>{_&&(await n(_.id,{status:"wordpress_preview"}),S(I=>I?{...I,status:"wordpress_preview"}:null))},Hv=async()=>{var ee;if(!_)return;await n(_.id,{status:"ready_to_export"}),S(ce=>ce?{...ce,status:"ready_to_export"}:null);const{html:I,css:B}=hy(_);if(I)try{const{data:{user:ce}}=await re.auth.getUser();if(ce){const _e=await GN({userId:ce.id,projectId:_.id,sourceProjectId:_.id,themeName:(ee=_.current_theme_data)==null?void 0:ee.name,html:I,css:B,isFromWebsite:_.project_mode==="from_website"});await n(_.id,{thumbnail_url:_e}),S(Ce=>Ce?{...Ce,thumbnail_url:_e}:null)}}catch(ce){console.warn("Export preparation: thumbnail generation skipped",ce)}},jf=async()=>{var Ce;if(!_||!s)return;const{html:I,css:B}=hy(_);if(!I){console.warn("WordPress preview: no project HTML available for thumbnail refresh");return}const ee=await GN({userId:s.id,projectId:_.id,sourceProjectId:_.id,themeName:(Ce=_.current_theme_data)==null?void 0:Ce.name,html:I,css:B,isFromWebsite:_.project_mode==="from_website"});if(!ee||ee===Ah){console.warn("WordPress preview: fresh thumbnail unavailable; retaining the existing thumbnail");return}const{data:ce,error:_e}=await re.from("projects").update({thumbnail_url:ee}).eq("id",_.id).select("thumbnail_url, updated_at").single();
1919if(_e||!ce)throw _e||new Error("Thumbnail update returned no project data");S(Pe=>Pe?{...Pe,thumbnail_url:ce.thumbnail_url,updated_at:ce.updated_at}:null)},kf=async(I=!0)=>{if(I&&d("theme_export_attempted",{export_type:X}),!!_&&!((se||M)&&!xa("media_migration"))){if(!kl&&!de.current){ae("export_credits");return}K(!0);try{const{html:B,css:ee}=hy(_),ce=_.project_mode==="from_website",_e=ce?Dw:sg,Ce=ce?Fw:ig,Te=!_.last_exported_at||new Date(_.updated_at)>new Date(_.last_exported_at)?Tu(_.version):_.version||"1.0";let We="",ft=null;try{ft=await vv(_e(B),Ce(ee),{width:1200,height:900,cropAboveFold:!0}),We=await zJ(ft)}catch(lt){console.error("Failed to generate screenshot:",lt)}let qe=_.thumbnail_url;if(ft)try{const{data:{user:lt}}=await re.auth.getUser();if(lt){const Ar=`${lt.id}/${_.id}-thumbnail.png`,{error:Rr}=await re.storage.from("thumbnails").upload(Ar,ft,{upsert:!0,contentType:"image/png"});if(!Rr){const{data:lr}=re.storage.from("thumbnails").getPublicUrl(Ar);qe=lr.publicUrl}}}catch(lt){console.error("Failed to upload thumbnail:",lt)}await n(_.id,{thumbnail_url:qe});let ge,it,mt;if(se&&!M&&(ge=nne(B,ee),console.log(`Built local media path map with ${Object.keys(ge).length} entries`)),M&&me){Q.info("Exporting images... This may take a moment.");const{data:lt,error:Ar}=await re.functions.invoke("export-images",{body:{projectId:_.id,masterHtml:B,masterCss:ee}});if(Ar){const{body:lr}=await On(Ar);if(lr.code==="feature_locked"&&lr.feature==="media_migration"){ae("media_migration"),K(!1);return}if(lr.creditsNeeded){ae("out_of_credits"),K(!1);return}throw Ar}if(lt!=null&&lt.error&&(lt!=null&&lt.creditsNeeded)){ae("out_of_credits"),K(!1);return}ge=lt.pathMap,mt=lt.readme;const Rr=lt.urlList;if(Rr&&Rr.length>0){Q.info(`Downloading ${Rr.length} media files...`);const lr={},Sr=4,It=async cr=>{const Kr=_.source_url||void 0,ji={};if(Kr)try{ji.Referer=Kr,ji.Origin=new URL(Kr).origin}catch{}const ln=await E1(cr);try{const Ss=await fetch(ln,{headers:ji});if(Ss.ok)return await Ss.arrayBuffer()}catch{}try{const Ss="https://tmixwolpvcqsnzjfxkly.supabase.co",Ou="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRtaXh3b2xwdmNxc256amZ4a2x5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjYwNDgxMTUsImV4cCI6MjA4MTYyNDExNX0.53jlUZqMobnCBmvNYlGvkuGeCN7J63UDahOJ3_FCwPg",Gv=(await re.auth.getSession()).data.session,qv=await fetch(`${Ss}/functions/v1/proxy-media`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(Gv==null?void 0:Gv.access_token)??Ou}`,apikey:Ou},body:JSON.stringify({url:cr,referer:_.source_url||void 0})});return qv.ok?await qv.arrayBuffer():(console.warn(`Proxy returned ${qv.status} for ${cr}`),null)}catch(Ss){return console.warn(`Proxy fetch failed for ${cr}:`,Ss),null}};for(let cr=0;cr<Rr.length;cr+=Sr){const Kr=Rr.slice(cr,cr+Sr),ji=await Promise.allSettled(Kr.map(async ln=>{const Ss=await It(ln.url);if(Ss&&Ss.byteLength>0){const Ou=tne(new Uint8Array(Ss.slice(0,256)));return{url:ln.url,path:j2(ln.localPath,Ou),ext:Ou,buf:Ss}}return null}));for(const ln of ji)ln.status==="fulfilled"&&ln.value&&(lr[ln.value.path]=ln.value.buf,ge&&ge[ln.value.url]&&(ge[ln.value.url]=j2(ge[ln.value.url],ln.value.ext)))}it=lr}try{await re.from("website_consent_log").insert({user_id:s.id,project_id:_.id,source_url:_.source_url||"N/A",consent_type:"media_export",consent_given:!0})}catch(lr){console.warn("Failed to log media consent:",lr)}}const{data:Pt,error:jt}=await re.functions.invoke("export-theme",{body:{project:{id:_.id,name:_.name,description:_.description,themeDescription:_.theme_description,theme_description:_.theme_description,masterHtml:B,masterCss:ee,customizations:_.section_customizations,themeSettings:_.theme_settings,screenshotBase64:We,version:Te,pages:_.pages||{},project_mode:_.project_mode,source_url:_.source_url,current_theme_data:_.current_theme_data},exportFormat:X,imagePathMap:ge}});if(jt){const{body:lt}=await On(jt);if(lt.code==="feature_locked"){const Ar=lt.feature;if(Ar==="gutenberg_export"||Ar==="elementor_export"||Ar==="media_migration"){ae(Ar),K(!1);return}}if(lt.creditsNeeded){ae("out_of_credits"),K(!1);return}throw jt}const Pn=Pt.format;if(Pn&&Pn!==X){Q.error(`Export format mismatch: requested ${X} but received ${Pn}. Please try again.`),K(!1);return}const pt=new Date().toISOString();await n(_.id,{version:Te,last_exported_at:pt}),S(lt=>lt?{...lt,version:Te,last_exported_at:pt}:null);const xt=new Mw,Rt=Pt.files,Fe=_.name.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),Ht=xt.folder(Fe);if(!Ht)throw new Error("Failed to create theme folder");for(const[lt,Ar]of Object.entries(Rt))Ht.file(lt,Ar);let mr=!1;if(We)Ht.file("screenshot.png",We,{base64:!0}),mr=!0;else if(qe&&!qe.includes("placehold.co"))try{const lt=await fetch(qe);lt.ok&&(Ht.file("screenshot.png",await lt.arrayBuffer()),mr=!0)}catch(lt){console.warn("Could not fetch stored thumbnail for screenshot.png:",lt)}mr?Ht.remove("screenshot.txt"):(console.warn("Export produced no screenshot.png — theme will show a blank thumbnail in WordPress"),Q.warning("Preview image unavailable",{description:"Theme exported, but the preview image couldn't be generated."}));const Ur=await xt.generateAsync({type:"blob"}),ks=URL.createObjectURL(Ur),pr=document.createElement("a");if(pr.href=ks,pr.download=`${_.name.toLowerCase().replace(/\s+/g,"-")}-theme-${X}-v${Te}.zip`,document.body.appendChild(pr),pr.click(),document.body.removeChild(pr),URL.revokeObjectURL(ks),it&&Object.keys(it).length>0){const lt=new Mw;mt&&lt.file("readme.txt",mt);try{const cr=await(await(await fetch(S2)).blob()).arrayBuffer();
1919lt.file("Media_Settings_Help.png",cr)}catch(Sr){console.warn("Could not include Media_Settings_Help.png:",Sr)}for(const[Sr,It]of Object.entries(it))lt.file(Sr,It);const Ar=await lt.generateAsync({type:"blob"}),Rr=URL.createObjectURL(Ar),lr=document.createElement("a");lr.href=Rr,lr.download=`${_.name.toLowerCase().replace(/\s+/g,"-")}-images-v${Te}.zip`,document.body.appendChild(lr),await new Promise(Sr=>setTimeout(Sr,500)),lr.click(),document.body.removeChild(lr),URL.revokeObjectURL(Rr),Q.success("Theme and images exported successfully!")}else Q.success("Theme exported successfully!");d("theme_exported",{project_id:_.id,project_name:_.name,exportImages:!!M,export_type:X}),(X==="gutenberg"||X==="elementor"||M)&&f()}catch(B){console.error("Export error:",B),Q.error("Failed to export theme. Please try again.")}K(!1)}},El=I=>{var B;return _?Lre(_.status,I,{hasThemeOptions:!!((B=_.theme_options)!=null&&B.length),hasSelectedTheme:_.selected_theme_index!==null}):!1},Ru=async I=>{if(!_||!El(I))return;const B=Fre(I);await n(_.id,{status:B}),await lo()};return N?i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:i.jsx(et,{className:"h-8 w-8 animate-spin text-primary"})}):_?i.jsxs("div",{className:"min-h-screen bg-background",children:[u&&s&&_.user_id!==s.id&&i.jsxs("div",{className:"bg-amber-500 text-amber-950 text-center text-xs sm:text-sm font-semibold py-1.5 px-3 sticky top-0 z-[60]",children:["⚠ Staff impersonation — viewing another user's project (owner ID: ",_.user_id,"). All edits are logged."]}),i.jsx("header",{className:"bg-card/80 backdrop-blur-sm sticky top-0 z-50 border-b border-border/50",children:i.jsxs("div",{className:"w-full px-3 sm:px-4 lg:px-6 py-2.5 grid grid-cols-[auto_1fr_auto] items-center gap-2 sm:gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(Y,{variant:"ghost",size:"icon",onClick:()=>e("/dashboard"),className:"rounded-full shrink-0","aria-label":"Home",title:"Home",children:i.jsx(zP,{className:"h-5 w-5"})}),i.jsx("h1",{className:"text-sm sm:text-base font-bold truncate min-w-0 max-w-[40vw] sm:max-w-[240px] lg:max-w-[320px]",children:_.name})]}),i.jsxs("div",{className:"flex justify-center min-w-0",children:[i.jsx("div",{className:"hidden md:flex",children:i.jsx(y2,{currentStatus:_.status,onStepClick:Ru,canNavigate:El,compact:!0})}),i.jsx("div",{className:"md:hidden",children:(()=>{const B={created:"Describe",described:"Describe",options_generated:"Select Theme",theme_selected:"Customize",customizing:"Customize",wordpress_preview:"Preview",ready_to_export:"Export"}[_.status]??"Describe";return i.jsxs(ol,{children:[i.jsx(al,{asChild:!0,children:i.jsxs(Y,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs gap-1",children:[B,i.jsx(Hs,{className:"h-3.5 w-3.5"})]})}),i.jsx(sa,{align:"center",className:"w-[240px] p-2",children:i.jsx(y2,{currentStatus:_.status,onStepClick:Ru,canNavigate:El,vertical:!0})})]})})()})]}),!m&&i.jsx(Rw,{children:i.jsxs("button",{type:"button",className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs sm:text-sm font-medium transition-all cursor-pointer ${(h??0)<=2?"bg-destructive/10 text-destructive animate-pulse":(h??0)<=5?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"bg-primary/10 text-primary"}`,children:[i.jsx(yc,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}),i.jsxs("span",{className:"whitespace-nowrap",children:[(h??0).toFixed(2),i.jsx("span",{className:"hidden sm:inline",children:" credits"})]})]})})]})}),i.jsxs("main",{className:"w-full px-3 sm:px-4 lg:px-6 py-6 sm:py-8",children:[(_.status==="created"||_.status==="described")&&i.jsx("div",{className:"max-w-2xl mx-auto",children:i.jsxs(dt,{children:[i.jsxs(ir,{children:[i.jsxs(Dr,{className:"flex items-center gap-2",children:[i.jsx(ta,{className:"h-5 w-5"}),"Describe Your Theme"]}),i.jsx(Gr,{children:"Describe your homepage. Optionally add a URL to draw inspiration from or copy."})]}),i.jsxs(ct,{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Describe only the homepage and general website styles. You can add additional pages later.",Ue==="mockup"?" Optional notes — the mockup drives the layout.":"",Ue==="figma"?" Optional notes — the Figma frame drives the layout.":"",Ue==="url"?" Optional notes — the URL drives the layout.":""]}),i.jsx(Ui,{placeholder:Ue==="mockup"?"Optional: add notes about the mockup (e.g. industry, tone, copy tweaks)...":Ue==="figma"?"Optional: add notes about the Figma design (e.g. industry, tone, copy tweaks)...":Ue==="url"?"Optional: add notes to guide the URL-based generation...":"I want a modern, clean theme for a tech startup. It should have a dark blue and white color scheme with bold typography. The layout should be minimalist with lots of whitespace...",value:C,onChange:I=>{const B=I.target.value;fm(B)>id?(O(ane(B,id)),Q.info("Prompt limited to 200 words for best results.")):O(B)},className:"min-h-[150px]",disabled:F}),(()=>{const I=YN(C);return I?i.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/10 p-2 text-xs",children:[i.jsx(li,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),i.jsx("span",{className:"flex-1 min-w-[12rem]",children:"It looks like you added a link. Move it to the Website URL box. Inspiration is 2 credits, a copy is 3, and that scan is saved for later edits."}),i.jsx(Y,{type:"button",size:"sm",variant:"outline",disabled:F,onClick:()=>{Ue!=="url"&&is("url"),kr(/^https?:\/\//i.test(I)?I:`https://${I}
1919`),Ct==="describe"&&nt("inspiration"),O(dZ(C,I)),setTimeout(()=>{const B=document.getElementById("source-url");B==null||B.scrollIntoView({behavior:"smooth",block:"center"}),B==null||B.focus()},100)},children:"Move link to Website URL"})]}):null})(),i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx(cne,{}),i.jsxs("span",{className:`text-xs tabular-nums ${fm(C)>=id?"text-destructive":fm(C)>=id-10?"text-amber-600 dark:text-amber-400":"text-muted-foreground"}`,children:[fm(C)," / ",id," words"]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{className:"text-sm font-medium",children:"Design Source"}),i.jsx(Ih,{value:Ue,onValueChange:I=>is(I),className:"space-y-2",children:[{key:"words",label:"Design with Words",cost:Ue==="mockup"||Ue==="figma"?"1–3 credits":`${yt} credit${yt===1?"":"s"}`,icon:ta,desc:"Generate themes purely from your description above."},{key:"url",label:"Design from Existing Website",cost:"2–3 credits",icon:St,desc:"Use a URL as inspiration, or copy its layout closely."},{key:"mockup",label:"Design from Mockup",cost:"1 credit",icon:qa,desc:"Upload an image and we recreate it as a homepage."}].map(({key:I,label:B,cost:ee,icon:ce,desc:_e})=>{var Pe,Te,We,ft,qe,ge,it;const Ce=Ue===I;return i.jsxs("div",{className:`rounded-lg border transition-colors ${Ce?"bg-primary/10 border-primary":"bg-background border-border hover:border-primary/50"}`,children:[i.jsxs("label",{className:`flex items-start gap-3 p-3 ${F?"cursor-not-allowed opacity-70":"cursor-pointer"}`,children:[i.jsx(Oh,{value:I,id:`ds-${I}`,disabled:F,className:"mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx(ce,{className:"h-4 w-4 text-primary"}),i.jsx("span",{className:"font-medium text-sm",children:B}),i.jsx("span",{className:"text-xs bg-primary/20 text-primary px-1.5 py-0.5 rounded",children:ee})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:_e})]})]}),Ce&&I==="url"&&i.jsxs("div",{className:"px-3 pb-3 space-y-2 border-t border-primary/20 pt-3",children:[i.jsx(Xe,{htmlFor:"source-url",className:"text-xs",children:"Website URL"}),i.jsx(Nt,{id:"source-url",type:"url",placeholder:"https://example.com",value:Ft,onChange:mt=>{const Pt=mt.target.value;kr(Pt),Pt.trim()?Ct==="describe"&&nt("inspiration"):Vr(!1)},disabled:F}),ut.status!=="idle"&&ut.message&&i.jsxs("p",{role:"status",className:`flex items-start gap-1.5 text-xs ${ut.status==="ok"?"text-primary":XN(ut.status)?"text-destructive":"text-muted-foreground"}`,children:[ut.status==="checking"?i.jsx(et,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 animate-spin"}):ut.status==="ok"?i.jsx(fr,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}):i.jsx(li,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),i.jsx("span",{children:ut.message})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Select how you'd like to use this website:"}),i.jsx(Ih,{value:Ct==="copy"?"copy":"inspiration",onValueChange:mt=>{nt(mt),mt!=="copy"&&Vr(!1)},className:"space-y-2 pt-1",children:[{k:"inspiration",l:"Use for Inspiration",c:"2 credits",i:St,d:"We'll analyze the style and create a unique theme inspired by it."},{k:"copy",l:"Copy a Website",c:"3 credits",i:r_,d:"We'll replicate the design as closely as possible."}].map(({k:mt,l:Pt,c:jt,i:Pn,d:pt})=>{const xt=Ct===mt;return i.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg border transition-colors ${F?"opacity-50 cursor-not-allowed border-border":xt?"bg-primary/10 border-primary cursor-pointer":"bg-background border-border hover:border-primary/50 cursor-pointer"}`,children:[i.jsx(Oh,{value:mt,id:`pj-${mt}`,disabled:F,className:"mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx(Pn,{className:"h-4 w-4 text-primary"}),i.jsx("span",{className:"font-medium text-sm",children:Pt}),i.jsx("span",{className:"text-xs bg-primary/20 text-primary px-1.5 py-0.5 rounded",children:jt})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:pt})]})]},mt)}
1919)}),Ct==="copy"&&i.jsxs("div",{className:"p-3 rounded-lg border border-amber-500/30 bg-amber-500/10 space-y-2 mt-2",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(li,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 mt-0.5 shrink-0"}),i.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:"Legal disclaimer required"})]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(Kn,{id:"copy-consent",checked:bt,onCheckedChange:mt=>Vr(mt===!0)}),i.jsx(Xe,{htmlFor:"copy-consent",className:"text-xs leading-relaxed cursor-pointer text-muted-foreground",children:"I certify that this website belongs to me and/or I have written consent to replicate it, and thus hold PressMeGPT harmless in any legal or financial consequences of my actions."})]})]})]}),Ce&&I==="mockup"&&i.jsxs("div",{className:"px-3 pb-3 border-t border-primary/20 pt-3",children:[i.jsx(VM,{projectId:_.id,mockupUrl:q,onMockupChange:he,disabled:F}),i.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Mockup mode generates 1 theme."})]}),Ce&&I==="figma"&&i.jsxs("div",{className:"px-3 pb-3 border-t border-primary/20 pt-3 space-y-3",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"figma-url",className:"text-xs",children:"Figma frame URL"}),i.jsx(Nt,{id:"figma-url",type:"url",placeholder:"https://www.figma.com/design/FILE_KEY/name?node-id=123-456",value:Je,onChange:mt=>{ie(mt.target.value),st(null),$e(null),he(null)},disabled:F||Ze}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paste a selected frame URL that includes ",i.jsx("span",{className:"font-mono",children:"node-id"}),". For MVP, full file links without a selected frame are not supported."]})]}),i.jsxs(Y,{type:"button",variant:"outline",size:"sm",onClick:co,disabled:F||Ze||!Je.trim(),children:[Ze?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):i.jsx(xp,{className:"h-4 w-4 mr-2"}),"Import Figma Design"]}),Oe&&i.jsx("p",{className:"text-xs text-destructive",children:Oe}),(be==null?void 0:be.screenshotUrl)&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"relative rounded-lg border border-border overflow-hidden bg-muted/30",children:i.jsx("img",{src:be.screenshotUrl,alt:"Imported Figma frame",className:"w-full max-h-48 object-contain"})}),i.jsxs("div",{className:"rounded-lg bg-muted/50 border border-border p-3 text-xs text-muted-foreground space-y-1",children:[i.jsxs("p",{className:"font-medium text-foreground",children:["Imported: ",((Pe=be.metadata)==null?void 0:Pe.frameName)||"Selected Figma frame"]}),((We=(Te=be.metadata)==null?void 0:Te.dimensions)==null?void 0:We.width)&&((qe=(ft=be.metadata)==null?void 0:ft.dimensions)==null?void 0:qe.height)&&i.jsxs("p",{children:["Size: ",be.metadata.dimensions.width," x ",be.metadata.dimensions.height]}),Array.isArray((ge=be.metadata)==null?void 0:ge.colors)&&be.metadata.colors.length>0&&i.jsxs("p",{children:["Colors: ",be.metadata.colors.slice(0,8).join(", ")]}),Array.isArray((it=be.metadata)==null?void 0:it.textLayers)&&be.metadata.textLayers.length>0&&i.jsxs("p",{children:["Text layers found: ",be.metadata.textLayers.length]})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Figma mode generates 1 theme using this screenshot as the primary visual reference."})]})]})]},I)})})]}),!er&&(()=>{const I=/\b(pages?|sub-?pages?|about\s*(us|page)?|contact\s*(us|page)?|services?\s*page|pricing\s*page|blog|events?|team\s*page|portfolio|gallery|faq|members?\s*(area|page|section)?|login\s*page|shop\s*page|store\s*page|other\s+pages?|additional\s+pages?|inner\s+pages?)\b/i,B=typeof window<"u"&&sessionStorage.getItem("homepage-scope-hint-dismissed")==="1";return!I.test(C)||B||Cn?null:i.jsxs("div",{className:"rounded-xl border border-primary/40 bg-gradient-to-r from-primary/10 via-accent/10 to-primary/10 p-3 flex items-start gap-3",children:[i.jsx(St,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),i.jsxs("div",{className:"text-sm flex-1",children:[i.jsx("p",{className:"font-semibold text-foreground",children:"The first generation is for the homepage only."}),i.jsxs("p",{className:"text-muted-foreground mt-0.5",children:["You can add additional pages (About, Services, Blog, etc.) afterwards — either replicated from a website or generated one at a time from the editor. Keep this prompt focused on ",i.jsx("span",{className:"font-medium text-foreground",children:"homepage content and overall style"}),"."]})]}),i.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs shrink-0",onClick:()=>{try{sessionStorage.setItem("homepage-scope-hint-dismissed","1")}catch{}on(!0)},children:"Got it"})]})})(),i.jsxs(Iv,{defaultOpen:oe.length>0,className:"pt-4 border-t border-border",children:[i.jsx(Ov,{asChild:!0,children:i.jsxs(Y,{variant:"ghost",size:"sm",className:"w-full justify-between px-2 group",children:[i.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium",children:[i.jsx(qa,{className:"h-4 w-4"}),"Add Logo & Images ",i.jsx("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),i.jsx(Hs,{className:"h-4 w-4 transition-transform group-data-[state=open]:rotate-180"})]})}),i.jsxs(Mv,{className:"pt-4",children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"You can add these later."}),i.jsx(qre,{projectId:_.id,existingImages:oe,onImagesChange:L})]})]}),i.jsxs("div",{className:"flex items-center gap-4 flex-wrap justify-between pt-2",children:[i.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[i.jsx(CM,{value:Ke,onChange:Dt,disabled:F,flashDesc:"Faster, great for simpler sites.",proDesc:"Better for complex designs or higher-quality output.",plan:va?v:"free",onUpgradeNeeded:()=>js("pro_model"),trialActive:w}),!er&&i.jsxs(Vs,{value:String(yt),onValueChange:I=>Wt(Number(I)),disabled:F||Ue==="mockup",children:[i.jsxs(bs,{id:"theme-count-select",className:"inline-flex h-auto w-auto items-center gap-1.5 px-2.5 py-1 rounded-md border border-border bg-muted/50 text-xs font-medium hover:bg-muted focus:ring-0 focus:ring-offset-0 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:opacity-100 [&>svg]:text-muted-foreground",children:[i.jsx(xp,{className:"h-3 w-3 text-primary"}),i.jsx(Ks,{})]}),i.jsxs(ws,{children:[i.jsx(Lr,{value:"3",children:"3 Themes"}),i.jsx(Lr,{value:"2",children:"2 Themes"}),i.jsx(Lr,{value:"1",children:"1 Theme"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Kn,{id:"make-private-describe",checked:le,disabled:F,onCheckedChange:async I=>{const B=I===!0;fe(B),_&&ti&&(await Au(B,ti)||fe(!B))}}),i.jsxs(Xe,{htmlFor:"make-private-describe",className:"text-sm cursor-pointer",children:[i.jsx(nh,{className:"h-3.5 w-3.5 inline mr-1"}),"Make private"]}),Ae&&i.jsx("span",{className:"text-xs bg-muted text-muted-foreground px-1.5 py-0.5 rounded",children:e0(_2)})]})]}),i.jsx(Y,{onClick:Nl,disabled:F||Ue==="words"&&!C.trim()||Ue==="url"&&(!Ft.trim()||XN(ut.status))||Ue==="mockup"&&!q,className:"ml-auto",children:F?i.jsxs(i.Fragment,{children:[i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}),"Generating..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Om,{className:"h-4 w-4 mr-2"}),`Generate (${er?ei:q?1:yt} credit${(er?ei:q?1:yt)===1?"":"s"})`]})})]}),i.jsx(une,{open:F,isFromWebsite:er,generationStep:A,themeCount:yt})]})]})}),_.status==="options_generated"&&i.jsxs("div",{children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Choose Your Theme"}),i.jsx("p",{className:"text-muted-foreground",children:"Select one of the 3 generated theme options to customize further"}),i.jsx("div",{className:"flex flex-col sm:flex-row gap-2 justify-center mt-4 max-w-md mx-auto",children:i.jsxs(Y,{onClick:()=>Fv(_l),className:"w-full sm:flex-1",children:[i.jsx(fr,{className:"h-4 w-4 mr-2"}),"Select This Theme"]})})]}),i.jsxs(oa,{value:`theme-${_l}`,onValueChange:I=>jl(parseInt(I.replace("theme-",""),10)),className:"w-full max-w-[1400px] mx-auto",children:[i.jsx(Yi,{className:"grid w-full grid-cols-3 mb-6",children:_.theme_options.map((I,B)=>i.jsxs(gr,{value:`theme-${B}`,children:["Theme ",B+1]},B))}),_.theme_options.map((I,B)=>i.jsx(Mr,{value:`theme-${B}`,children:i.jsxs(dt,{className:"overflow-hidden",children:[i.jsx("div",{className:"relative w-full h-[60vh] min-h-[420px] bg-muted overflow-hidden",children:i.jsx(wl,{html:I.previewHtml,css:I.previewCss})}),i.jsxs(ir,{className:"p-4",children:[i.jsx(Dr,{className:"text-base",children:I.name}),i.jsx(Gr,{className:"text-sm",children:I.description})]})]})},B))]}),i.jsxs("div",{className:"text-center mt-8 space-y-4",children:[h>=3?i.jsxs(Y,{variant:"outline",onClick:Nl,disabled:F,children:[i.jsx(bp,{className:"h-4 w-4 mr-2"}),"Regenerate Themes"]}):i.jsxs(Y,{onClick:()=>ae("out_of_credits"),className:"bg-primary hover:bg-primary/90",children:[i.jsx(St,{className:"h-4 w-4 mr-2"}),"Get More Credits"]}),i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx(Kn,{id:"make-private",checked:le,disabled:F,onCheckedChange:async I=>{const B=I===!0;fe(B),_&&(await Au(B)||fe(!B))}}),i.jsxs(Xe,{htmlFor:"make-private",className:"text-sm cursor-pointer",children:[i.jsx(nh,{className:"h-3.5 w-3.5 inline mr-1"}),"Make themes private"]}),Ae&&i.jsx("span",{className:"text-xs bg-muted text-muted-foreground px-1.5 py-0.5 rounded",children:e0(_2)})]})]})]}),_.status==="customizing"&&i.jsxs("div",{children:[ao&&!_t&&an.state.status==="idle"&&i.jsx("div",{className:"mb-2 flex justify-end",children:i.jsx(Y,{variant:"outline",size:"sm",onClick:()=>{xa("multi_page_scraper",Sl)&&Et(!0)},children:"Replicate more pages"})}),i.jsx(Are,{project:_,onUpdate:Bv,onFinish:Cl,selectedModel:Ke,onModelChange:Dt,plan:va?v:"free",trialActive:w,onUpgradeNeeded:()=>js("pro_model"),onAddPageUpgradeNeeded:Sl?void 0:()=>js("multi_page_builder"),onFullScreenPreview:()=>W(!0),activePageOverride:En,onActivePageConsumed:()=>io(void 0),replicationState:an.state,replicationAutoContinue:an.autoContinue,onReplicationContinue:an.continueNext,onReplicationStop:an.stop,onReplicationRetry:an.retryCurrent,onReplicationSkip:an.skipCurrent,onReplicationSetAutoContinue:an.setAutoContinue,discoveryNode:
1919ao&&_t?i.jsx(ine,{compact:!0,projectId:_.id,sourceUrl:_.source_url||"",creditsRemaining:h??0,replicationActive:an.state.status!=="idle",replicatedUrls:oo,onInsufficientCredits:()=>js("out_of_credits"),onUpgradeNeeded:Sl?void 0:()=>js("multi_page_scraper"),trialActive:w,onClose:()=>Et(!1),onStart:I=>{an.start(I)}}):void 0,onShowDiscovery:ao?()=>{xa("multi_page_scraper",Sl)&&Et(!0)}:void 0,discoveryHidden:ao&&!_t},`${_.id}-${_.selected_theme_index}`)]}),_.status==="wordpress_preview"&&i.jsxs("div",{className:"max-w-5xl mx-auto space-y-8",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx(Y,{variant:"outline",onClick:_f,children:"Back to Customize"}),i.jsx(Y,{onClick:Hv,children:"Continue to Export"})]}),i.jsxs("div",{className:"text-center space-y-3",children:[i.jsx("h2",{className:"text-3xl font-bold",children:"Preview Your WordPress Theme"}),i.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Check your design at different screen sizes, then test how it looks and edits inside WordPress."}),i.jsxs(Y,{variant:"outline",size:"lg",onClick:()=>W(!0),children:[i.jsx(UP,{className:"h-4 w-4 mr-2"}),"Preview Theme"]})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[i.jsxs(dt,{children:[i.jsxs(ir,{children:[i.jsx(Dr,{children:"Classic WordPress"}),i.jsx(Gr,{children:"Best for the closest visual match to your generated design."})]}),i.jsx(ct,{children:i.jsx(x2,{projectId:_.id,exportFormat:"classic",projectVersion:_.updated_at,onPreparePreview:jf,actionLabel:"Preview in Classic WordPress"})})]}),i.jsxs(dt,{children:[i.jsxs(ir,{children:[i.jsx(Dr,{children:"Gutenberg WordPress"}),i.jsx(Gr,{children:"Best for native block editing and Full Site Editing."})]}),i.jsx(ct,{children:i.jsx(x2,{projectId:_.id,exportFormat:"gutenberg",projectVersion:_.updated_at,onPreparePreview:jf,actionLabel:"Preview in Gutenberg WordPress"})})]})]}),i.jsxs("p",{className:"text-sm text-muted-foreground text-center flex items-center justify-center gap-2",children:[i.jsx("img",{src:Mre,alt:"Elementor",className:"h-5 w-auto inline-block",loading:"lazy"}),i.jsx("span",{children:"Elementor Previews not available. Export Elementor Templates on the next page."})]}),i.jsxs("section",{className:"border-y border-border py-8 grid gap-8 lg:grid-cols-[0.8fr_1.2fr]",children:[i.jsxs("blockquote",{className:"border-l-4 border-primary pl-5 flex flex-col justify-center",children:[i.jsx("p",{className:"font-bold leading-relaxed",children:"“IT GAVE ME 80% OF WHAT I NEEDED IN JUST ONE CLICK”"}),i.jsx("footer",{className:"text-sm text-muted-foreground mt-3",children:"— WordPress Blogger, +7 years experience"})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-xl font-bold mb-2",children:"Things you may have to adjust in WordPress or use plug-ins for"}),i.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-4",children:"Exports might not be 100% exact - Menus, Spacing, Color selections, and other CSS might need to be adjusted once you export due to how each theme format works in WordPress."}),i.jsx("ul",{className:"grid gap-3 sm:grid-cols-2",children:["Menus","Spacing, Margins, & Padding","Animations","Forms","Colors","Pop-ups","eCommerce","Custom functions (Quizzes, Sliders, etc.)"].map(I=>i.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[i.jsx(Bn,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"}),i.jsx("span",{children:I})]},I))})]})]})]}),_.status==="ready_to_export"&&i.jsx("div",{className:"max-w-2xl mx-auto",children:i.jsxs(dt,{className:"overflow-hidden",children:[i.jsx("div",{className:"h-1 bg-gradient-to-r from-primary to-accent"}),i.jsxs(ir,{className:"text-center",children:[i.jsx("div",{className:"mx-auto p-4 rounded-2xl bg-primary text-primary-foreground w-fit mb-4 shadow-lg shadow-primary/25",children:i.jsx(Wn,{className:"h-8 w-8"})}),i.jsx(Dr,{className:"text-2xl",children:"Ready to Export!"}),i.jsxs(Gr,{children:["Your WordPress theme is ready. Download the complete theme package.",_.version&&i.jsx("span",{className:"block mt-1 text-xs font-medium text-primary",children:!_.last_exported_at||new Date(_.updated_at)>new Date(_.last_exported_at)?`Next export: v${Tu(_.version)} (Current: v${_.version})`:`Current version: v${_.version}`}),!_.version&&i.jsx("span",{className:"block mt-1 text-xs font-medium text-primary",children:"First export: v
19191.0"})]})]}),i.jsxs(ct,{className:"space-y-4",children:[i.jsxs(Ev,{type:"multiple",defaultValue:["format"],children:[i.jsxs(Va,{value:"format",children:[i.jsx(Ka,{className:"hover:no-underline px-1",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(CL,{className:"h-4 w-4 text-muted-foreground"}),i.jsx("span",{children:"Theme Format"}),i.jsx(rt,{variant:"secondary",className:"ml-2 font-normal",children:X==="classic"?"Classic (PHP)":X==="gutenberg"?"Gutenberg (FSE)":"Elementor"})]})}),i.jsx(Ya,{children:i.jsx("div",{className:"space-y-2 pt-1",children:i.jsx(A3,{value:X,onChange:J,showCreditLabels:Ae})})})]}),i.jsxs(Va,{value:"media",children:[i.jsx(Ka,{className:"hover:no-underline px-1",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(qa,{className:"h-4 w-4 text-muted-foreground"}),i.jsx("span",{children:"Media Options"}),w&&i.jsx(Tv,{}),i.jsx("span",{className:"ml-1 text-xs bg-muted text-muted-foreground px-1.5 py-0.5 rounded",children:"1 Credit+"}),(se||M)&&i.jsx(rt,{variant:"secondary",className:"ml-2 font-normal",children:[se&&"Local paths",M&&"Download media"].filter(Boolean).join(" + ")})]})}),i.jsx(Ya,{children:i.jsxs("div",{className:"space-y-3 pt-1",children:[i.jsxs("div",{className:"flex items-start gap-3 border border-border rounded-lg p-3",children:[i.jsx(Kn,{id:"useLocalMediaPaths",checked:se,onCheckedChange:I=>{I===!0&&!xa("media_migration")||pe(I===!0)}}),i.jsxs("div",{className:"space-y-1 flex-1",children:[i.jsx("label",{htmlFor:"useLocalMediaPaths",className:"font-medium cursor-pointer leading-none text-sm",children:"Export with local media paths (Optional)"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Only check this box if you've already exported and uploaded your media and want to re-export your theme with the local WordPress media paths."})]})]}),i.jsx("div",{className:"border border-border rounded-lg p-3",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(Kn,{id:"exportImages",checked:M,onCheckedChange:I=>{I===!0&&!xa("media_migration")||(V(I===!0),I&&pe(!0),I||ve(!1))}}),i.jsxs("div",{className:"space-y-2 flex-1",children:[i.jsx("label",{htmlFor:"exportImages",className:"font-medium cursor-pointer leading-none text-sm",children:"Copy & Download Media (Optional)"}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[i.jsx("strong",{children:"When to do it:"})," Only do this on your final export of the theme to save on credits, and rewrite image URLs in your theme."]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[i.jsx("strong",{children:"How it works:"})," Downloads all images and videos used in your theme as a separate ZIP file. Image paths in your theme will be automatically updated to use local WordPress media paths."]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[i.jsx("strong",{children:"Credit cost:"})," 1 credit per 5 scraped images (rounded up), 1 credit per scraped video. Images you uploaded or used from Unsplash are free."]}),i.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-3 space-y-1.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(li,{className:"h-4 w-4 text-destructive shrink-0"}),i.jsx("span",{className:"text-sm font-semibold text-destructive",children:"IMPORTANT"})]}),i.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed pl-6",children:['In WordPress → Settings → Media, uncheck "Organize my uploads into month- and year-based folders" ',i.jsx("strong",{children:"BEFORE"})," uploading."]}),i.jsx("div",{className:"pl-6",children:i.jsxs(ol,{children:[i.jsx(al,{asChild:!0,children:i.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[i.jsx(qc,{className:"h-3.5 w-3.5"}),"Media Settings Help"]})}),i.jsx(sa,{className:"w-[70vw] max-w-2xl",side:"top",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm font-medium",children:"WordPress Media Settings"}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Before uploading the images ZIP, go to ",i.jsx("strong",{children:"WordPress → Settings → Media"})," and uncheck the option shown below:"]}),i.jsx("img",{src:S2,alt:"WordPress Media Settings - uncheck organize uploads",className:"rounded border border-border w-full"})]})})]})})]}),M&&i.jsxs("div",{className:"flex items-start gap-3 pt-2 border-t border-border",children:[i.jsx(Kn,{id:"copyrightConsent",checked:me,onCheckedChange:I=>ve(I===!0)}),i.jsxs("label",{htmlFor:"copyrightConsent",className:"text-xs text-muted-foreground cursor-pointer leading-snug",children:[i.jsx("strong",{children:"Copyright Ownership:"})," I confirm that I own the copyright or have obtained proper licensing for all images, videos, and media included in this export. I understand that PressMeGPT is not responsible for any copyright infringement."]})]})]})]})})]})})]}),i.jsxs(Va,{value:"contents",children:[i.jsx(Ka,{className:"hover:no-underline px-1",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ML,{className:"h-4 w-4 text-muted-foreground"}
1919),i.jsx("span",{children:"Installation Instructions"})]})}),i.jsxs(Ya,{children:[i.jsx("p",{className:"pb-3 text-sm font-semibold text-foreground",children:X==="classic"?"Classic Theme Instructions":X==="gutenberg"?"Gutenberg Theme Instructions":"Elementor Template Instructions"}),i.jsx("ol",{className:"list-decimal space-y-2 pl-5 pt-1 text-sm text-muted-foreground",children:X==="classic"?i.jsxs(i.Fragment,{children:[i.jsx("li",{children:"Download your PressMeGPT Classic Theme ZIP file."}),i.jsxs("li",{children:["In WordPress, go to ",i.jsx("strong",{className:"text-foreground",children:"Appearance → Themes → Add New → Upload Theme"}),"."]}),i.jsxs("li",{children:["Upload the ZIP file, then click ",i.jsx("strong",{className:"text-foreground",children:"Install Now"})," and ",i.jsx("strong",{className:"text-foreground",children:"Activate"}),"."]}),i.jsxs("li",{children:["Customize your site-wide header, footer, menu, logo, colors, and other theme settings under ",i.jsx("strong",{className:"text-foreground",children:"Appearance → Customize"}),"."]}),i.jsxs("li",{children:["Manage your navigation menus from the WordPress Customizer or ",i.jsx("strong",{className:"text-foreground",children:"Appearance → Menus"}),", depending on your WordPress setup."]})]}):X==="gutenberg"?i.jsxs(i.Fragment,{children:[i.jsx("li",{children:"Download your PressMeGPT Gutenberg Theme ZIP file."}),i.jsxs("li",{children:["In WordPress, go to ",i.jsx("strong",{className:"text-foreground",children:"Appearance → Themes → Add New → Upload Theme"}),"."]}),i.jsxs("li",{children:["Upload the ZIP file, then click ",i.jsx("strong",{className:"text-foreground",children:"Install Now"})," and ",i.jsx("strong",{className:"text-foreground",children:"Activate"}),"."]}),i.jsx("li",{children:"Edit pages and content using the native WordPress block editor."}),i.jsxs("li",{children:["To edit your global header, go to ",i.jsx("strong",{className:"text-foreground",children:"Appearance → Editor → Patterns → Header"}),"."]}),i.jsxs("li",{children:["To edit your global footer, go to ",i.jsx("strong",{className:"text-foreground",children:"Appearance → Editor → Patterns → Footer"}),"."]}),i.jsx("li",{children:"Edit your site navigation/menu inside the Header pattern using the WordPress Navigation block."})]}):i.jsxs(i.Fragment,{children:[i.jsx("li",{children:"Make sure Elementor is installed and activated on your WordPress site."}),i.jsxs("li",{children:["Install and activate the free ",i.jsx("strong",{className:"text-foreground",children:"PressMeGPT – Header & Footer for Elementor"})," plugin from the WordPress Plugin Repository."]}),i.jsxs("li",{children:["Import the PressMeGPT Elementor page templates into ",i.jsx("strong",{className:"text-foreground",children:"Elementor → Templates"}),".",i.jsx("strong",{className:"mt-1 block text-destructive",children:"DO NOT INSTALL ELEMENTOR AS A WORDPRESS THEME!"})]}),i.jsxs("li",{children:["Go to ",i.jsx("strong",{className:"text-foreground",children:"PressMeGPT – Header & Footer"})," in your WordPress dashboard."]}),i.jsx("li",{children:"Upload the included Header JSON and Footer JSON files, then set them as your global header and footer."}),i.jsxs("li",{children:["You can edit either one at any time using ",i.jsx("strong",{className:"text-foreground",children:"Edit with Elementor"}),"."]}),i.jsxs("li",{children:["Edit your global navigation/menu under ",i.jsx("strong",{className:"text-foreground",children:"Appearance → Menus"})," in WordPress. Your PressMeGPT header will use this menu for site navigation."]}),i.jsxs("li",{children:["Edit individual pages by opening the page and selecting ",i.jsx("strong",{className:"text-foreground",children:"Edit with Elementor"}),"."]})]})})]})]})]}),i.jsxs("div",{className:"flex gap-3 pt-2",children:[i.jsx(Y,{variant:"outline",onClick:_f,children:"Continue Editing"}),i.jsx(Y,{onClick:()=>void kf(),disabled:$||M&&!me,className:"flex-1",children:$?i.jsxs(i.Fragment,{children:[i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}),"Exporting..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Wn,{className:"h-4 w-4 mr-2"}),"Download Theme (.zip)"]})})]})]})]})})]}),_.current_theme_data&&i.jsx(P3,{open:H,onClose:()=>W(!1),html:_.master_html||_.current_theme_data.previewHtml,css:_.master_css||_.current_theme_data.previewCss,themeName:_.n
1919ame,pages:_.pages,syncPages:we,navigationConfig:xe,preserveSourceLayout:Ie,stylesheetUrls:tt}),i.jsx(Gre,{open:R,onClose:()=>G(!1),settings:_.theme_settings,currentCss:_.master_css||((Iu=_.current_theme_data)==null?void 0:Iu.previewCss)||"",onSave:zv}),i.jsx(vf,{open:U,onOpenChange:z,children:i.jsxs(ju,{children:[i.jsxs(ku,{children:[i.jsxs(Nu,{className:"flex items-center gap-2",children:[i.jsx(li,{className:"h-5 w-5 text-amber-500"}),"Regenerate Themes?"]}),i.jsxs(Cu,{className:"space-y-2",children:[i.jsx("p",{children:"This will replace your current theme options with new ones."}),i.jsxs("p",{className:"font-medium text-foreground",children:["Cost: ",er?ei:yt," credits (You have ",(h??0).toFixed(2)," credits remaining)"]})]})]}),i.jsxs(Su,{children:[i.jsx(yf,{children:"Cancel"}),i.jsx(xf,{onClick:()=>{z(!1),bf()},children:"Continue"})]})]})}),Z&&i.jsx(bl,{open:!!Z,onOpenChange:I=>{I||ae(null)},reason:Z,preHeadlineOverride:Z==="export_credits"?`This export will use ${Zs} credit${Zs===1?"":"s"}. 🎟️`:void 0,continueLabel:Z==="export_credits"?`Continue and use ${Zs} credit${Zs===1?"":"s"}`:void 0,continueBlockedLabel:Z==="export_credits"?`You need ${Zs} credit${Zs===1?"":"s"} — you have ${(h??0).toFixed(2)}`:void 0,onContinueWithCredits:Z==="export_credits"&&h>=Zs?()=>{ae(null),de.current=!0,kf(!1)}:void 0}),i.jsx(S5,{open:E,onClose:()=>ne(!1)})]}):null}function hne({isOpen:t,onClose:e,onConfirm:r,currentPlan:n,periodEnd:s,loading:o,creditsRemaining:a}){const l=s?new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):"the end of your billing period";return i.jsx(vf,{open:t,onOpenChange:e,children:i.jsxs(ju,{className:"max-w-md",children:[i.jsxs(ku,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(li,{className:"h-5 w-5 text-destructive"}),i.jsx(Nu,{children:"Cancel Subscription?"})]}),i.jsx(Cu,{asChild:!0,children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{children:["Your ",i.jsx(rt,{variant:"outline",className:"mx-1 capitalize",children:n})," plan will remain active until:"]}),i.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 text-center",children:[i.jsx("p",{className:"text-lg font-semibold text-foreground",children:l}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"After this date, you'll be on the Free plan"})]}),i.jsxs("div",{className:"rounded-lg border p-4 bg-card",children:[i.jsx("p",{className:"font-medium text-foreground mb-2",children:"What happens to your credits?"}),i.jsxs("ul",{className:"text-sm space-y-2",children:[i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-green-600",children:"✓"}),i.jsxs("span",{children:["Your ",i.jsx("strong",{children:a})," credits will be preserved"]})]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-green-600",children:"✓"}),i.jsx("span",{children:"Credits never expire — use them anytime"})]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-muted-foreground",children:"•"}),i.jsx("span",{children:"No new credits will be added on Free plan"})]})]})]}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["You can reactivate your subscription at any time before ",l,"."]})]})})]}),i.jsxs(Su,{children:[i.jsx(yf,{disabled:o,children:"Keep Plan"}),i.jsx(xf,{onClick:r,disabled:o,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:o?"Processing...":"Cancel at Period End"})]})]})})}function fne({isOpen:t,onClose:e,onConfirm:r,loading:n,previewData:s,previewLoading:o}){if(!s&&!o)return null;const a=(m,f="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:f.toUpperCase()}).format(m),l=m=>Xp(new Date(m),"MMMM d, yyyy"),c={free:"Free",project:"Creator",project_pass:"Project Pass",starter:"Freelance",pro:"Pro",agency:"Agency"},u={monthly:"/mo",yearly:"/yr"},d=(m,f,v)=>m==="free"?"Free":`${c[m]||m} (${a(f)}${u[v]||""})`,h=()=>n?"Processing...":s?s.isUpgrade?s.proratedAmount>0?`Upgrade & Pay ${a(s.proratedAmount,s.currency)} Today`:"Upgrade Now":s.isDowngrade?"Schedule Downgrade":"Confirm Change":"Confirm";return i.jsx(vf,{open:t,onOpenChange:m=>!m&&e(),children:i.jsxs(ju,{className:"max-w-md",children:[i.jsxs(ku,{children:[i.jsx(Nu,{className:"flex items-center gap-2",children:s!=null&&s.isUpgrade?i.jsxs(i.Fragment,{children:[i.jsx(VL,{className:"h-5 w-5 text-primary"}),"Upgrade Your Plan"]}):i.jsxs(i.Fragment,{children:[i.jsx(qL,{className:"h-5 w-5 text-muted-foreground"}),"Change Your Plan"]})}),i.jsx(Cu,{children:"Review the changes below before confirming."})]}),o?i.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"Calculating changes..."}):s?i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg space-y-2",children:[i.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Plan Change"}),i.jsxs("div",{className:"flex items-center justify-center gap-3",children:[i.jsx("div",{className:"text-center",children:i.jsx(rt,{variant:"outline",className:"text-sm px-3 py-1",children:d(s.currentPlan,s.currentPlanPrice,s.currentInterval)})}),i.jsx(Ga,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),i.jsx("div",{className:"text-center",children:i.jsx(rt,{variant:"default",className:"text-sm px-3 py-1",children:d(s.targetPlan,s.targetPlanPrice,s.billingInterval)})})]})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(th,{className:"h-4 w-4 text-muted-foreground"}),i.jsx("span",{className:"text-sm font-medium",children:"Billing Perio
1919d Started"})]}),i.jsx("span",{className:"text-sm text-muted-foreground",children:l(s.periodStart)})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(th,{className:"h-4 w-4 text-primary"}),i.jsx("span",{className:"text-sm font-medium",children:"Effective"})]}),i.jsx("span",{className:"text-sm",children:s.isUpgrade?i.jsx(rt,{variant:"secondary",children:"Immediately"}):l(s.periodEnd)})]}),i.jsxs("div",{className:"p-3 border rounded-lg space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(yc,{className:"h-4 w-4 text-primary"}),i.jsx("span",{className:"text-sm font-medium",children:"Credit Impact"})]}),s.isUpgrade?i.jsxs("div",{className:"pl-6 space-y-1",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Current balance"}),i.jsxs("span",{className:"font-semibold",children:[s.currentBalance," credits"]})]}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Credits added today"}),i.jsxs("span",{className:"font-bold text-green-600",children:["+",s.creditDifference," credits"]})]}),i.jsxs("div",{className:"flex justify-between text-sm pt-1 border-t mt-1",children:[i.jsx("span",{className:"text-muted-foreground",children:"New balance after upgrade"}),i.jsxs("span",{className:"font-semibold",children:[s.newBalance," credits"]})]}),i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground pt-1",children:[i.jsx(qc,{className:"h-3 w-3 flex-shrink-0"}),i.jsx("span",{children:"You pay the full price of your new plan today and receive its full credit allocation."})]})]}):i.jsxs("div",{className:"pl-6 space-y-1",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Current balance"}),i.jsxs("span",{className:"font-semibold",children:[s.currentBalance," credits"]})]}),i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx(qc,{className:"h-3 w-3"}),i.jsx("span",{children:"Credits are never removed"})]})]})]}),i.jsxs("div",{className:"p-3 border rounded-lg space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Pb,{className:"h-4 w-4 text-primary"}),i.jsx("span",{className:"text-sm font-medium",children:"Billing"})]}),s.isUpgrade?i.jsxs("div",{className:"pl-6 space-y-1",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Amount due today"}),i.jsx("span",{className:"font-bold text-primary text-lg",children:s.proratedAmount>0?a(s.proratedAmount,s.currency):"Calculating..."})]}),i.jsx("p",{className:"text-xs text-muted-foreground pl-0",children:"Full price of your new plan — your billing date moves to today"}),i.jsxs("div",{className:"flex justify-between text-sm pt-1 border-t mt-2",children:[i.jsx("span",{className:"text-muted-foreground",children:"Next renewal"}),i.jsxs("span",{children:[a(s.targetPlanPrice)," on ",l(s.nextRenewalDate)]})]})]}):i.jsxs("div",{className:"pl-6 space-y-1",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"No refund for current period"}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"Next charge"}),i.jsxs("span",{children:[a(s.targetPlanPrice)," on ",l(s.periodEnd)]})]})]})]})]}),s.isDowngrade&&i.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:["Your current plan will remain active until ",l(s.periodEnd),"."]})]}):null,i.jsxs(Su,{children:[i.jsx(Y,{variant:"outline",onClick:e,disabled:n,children:"Cancel"}),i.jsx(Y,{onClick:r,disabled:n||o,variant:s!=null&&s.isDowngrade?"secondary":"default",children:h()})]})]})})}const E2=[{value:"finished_project",label:"I finished my project",requiresDetail:!1},{value:"bug",label:"Bug",requiresDetail:!0,placeholder:"Please describe the bug..."},{value:"not_using",label:"I'm not using PressMeGPT",requiresDetail:!1},{value:"missing_feature",label:"Missing feature",requiresDetail:!0,placeholder:"What feature would keep you?"},{value:"drag_and_drop",label:"I went back to building with drag-and-drop",requiresDetail:!0,placeholder:"Which builder? (e.g. Elementor, Divi, Bricks)"},{value:"price_too_high",label:"Price too high",requiresDetail:!0,placeholder:"What is PressMeGPT worth to you?"},{value:"too_many_credits",label:"I have too many credits",requiresDetail:!1},{value:"other",label:"Other",requiresDetail:!0,placeholder:"Tell us more..."}];function mne({isOpen:t,onClose:e,onSubmit:r,loading:n}){const[s,o]=g.useState(""),[a,l]=g.useState(""),c=E2.find(m=>m.value===s),u=(c==null?void 0:c.requiresDetail)??!1,d=s&&(!u||a.trim().length>0),h=async()=>{d&&await r(s,a.trim())};return i.jsx(Xt,{open:t,onOpenChange:m=>{m||e()},children:i.jsxs(Qt,{className:"max-w-md",children:[i.jsxs(gn,{children:[i.jsx(wr,{children:"We're sorry to see you go"}),i.jsx(jn,{children:"Why did you decide to cancel? Your feedback helps us improve."})]}),i.jsx(Ih,{value:s,onValueChange:m=>{o(m),l("")},className:"space-y-3",children:E2.map(m=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(Oh,{value:m.value,id:m.value}),i.jsx(Xe,{htmlFor:m.value,className:"cursor-pointer font-normal",children:m.label})]}),s===m.value&&m.requiresDetail&&i.jsx(Nt,{placeholder:m.placeholder,value:a,onChange:f=>
1919l(f.target.value),className:"ml-6 w-[calc(100%-1.5rem)]",autoFocus:!0})]},m.value))}),i.jsxs(pf,{children:[i.jsx(Y,{variant:"ghost",onClick:e,disabled:n,children:"Never mind"}),i.jsxs(Y,{onClick:h,disabled:!d||n,variant:"destructive",children:[n?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Submit Feedback"]})]})]})})}function pne({isOpen:t,onClose:e,onAccept:r,onDecline:n,loading:s,currentPlan:o,currentPrice:a,billingInterval:l}){const c=(a*.5).toFixed(2),u=l==="yearly"?"year":"month";return i.jsx(Xt,{open:t,onOpenChange:d=>{d||e()},children:i.jsxs(Qt,{className:"max-w-md",children:[i.jsxs(gn,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(rh,{className:"h-5 w-5 text-primary"}),i.jsx(wr,{children:"Thanks for the feedback!"})]}),i.jsx(jn,{children:"We'd love to keep you. Here's an exclusive offer:"})]}),i.jsxs("div",{className:"rounded-lg border-2 border-primary/30 bg-primary/5 p-5 space-y-4",children:[i.jsxs("div",{className:"text-center",children:[i.jsx(rt,{className:"mb-3 text-base px-4 py-1",children:"50% Off for One Year"}),i.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Stay on your ",i.jsx("span",{className:"font-semibold capitalize",children:o})," plan at half price."]})]}),i.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-2",children:[i.jsx("p",{className:"font-medium text-foreground",children:"How it works:"}),i.jsxs("ul",{className:"text-sm space-y-2",children:[i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx(fr,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),i.jsx("span",{children:"We'll cancel your current plan today"})]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx(fr,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),i.jsx("span",{children:"You keep all your accumulated credits"})]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx(fr,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),i.jsxs("span",{children:["We'll resubscribe you at ",i.jsx("strong",{children:"50% off"})," for one year"]})]})]})]}),i.jsxs("div",{className:"text-center rounded-lg bg-muted/50 p-3",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"You will pay"}),i.jsxs("p",{className:"text-2xl font-bold text-foreground",children:["$",c,i.jsxs("span",{className:"text-base font-normal text-muted-foreground",children:["/",u]})]}),i.jsxs("p",{className:"text-xs text-muted-foreground line-through",children:["$",a,"/",u]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Charged to your card on file"})]}),i.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"This offer is only available once."})]}),i.jsxs(pf,{className:"flex-col gap-2 sm:flex-col",children:[i.jsxs(Y,{onClick:r,disabled:s,className:"w-full bg-primary hover:bg-primary/90",children:[s?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Yes, I'd like 50% off!"]}),i.jsx(Y,{variant:"ghost",onClick:n,disabled:s,className:"w-full text-muted-foreground",children:"No thanks, cancel anyway"})]})]})})}function gne({isOpen:t,onClose:e,onConfirm:r,loading:n,currentPlan:s,discountedPrice:o,billingInterval:a}){const l=a==="yearly"?"year":"month";return i.jsx(vf,{open:t,onOpenChange:n?void 0:e,children:i.jsx(ju,{className:"max-w-sm",children:n?i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-4",children:[i.jsx(et,{className:"h-8 w-8 animate-spin text-primary"}),i.jsx("p",{className:"text-sm text-muted-foreground font-medium",children:"Processing your discount..."}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Please don't close this window."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(ku,{children:[i.jsx(Nu,{children:"Confirm 50% Off Subscription"}),i.jsx(Cu,{asChild:!0,children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("p",{children:["We'll cancel your current plan and open a checkout page in a new tab with your ",i.jsx("strong",{children:"50% discount"})," applied — just ",i.jsxs("strong",{children:["$",o,"/",l]})," for your ",i.jsx("span",{className:"capitalize font-medium",children:s})," plan."]}),i.jsx("p",{className:"text-sm",children:"This discounted rate applies for 12 months. Your existing credits will be preserved."})]})})]}),i.jsxs(Su,{children:[i.jsx(yf,{children:"Cancel"}),i.jsx(xf,{onClick:r,children:"Confirm & Subscribe"})]})]})})})}const vne={starter:10,pro:20,agency:40},xne=vne;function Tc(t){return xne[t]??0}const Ny=[{id:"starter",name:"Freelance",description:"For individual freelancers & web developers",price:Tc("starter"),credits:30,icon:ua,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)","Multi-Page Convert"],tagline:"3+ themes per month"},{id:"pro",name:"Pro",description:"For professional developers & designers",price:Tc("pro"),credits:70,icon:Og,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)","Multi-Page Convert","Bring Your Own Key (Gemini)","Theme Checker (coming soon)"],tagline:"7+ themes per month",popular:!0}
1919,{id:"agency",name:"Agency",description:"For WordPress teams and marketing agencies",price:Tc("agency"),credits:150,icon:gl,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)","Multi-Page Convert","Bring Your Own Key (Gemini)","Theme Checker (coming soon)","Multi-User (coming soon)"],tagline:"15+ themes per month"}],pm=[{id:"project",name:"Creator",description:"Great for bloggers, creators, and hobbyists",price:69,monthlyPrice:"$5.75",credits:120,icon:St,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 2.5 Only","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)"],tagline:"12+ themes per year"},{id:"starter",name:"Freelance",description:"For individual freelancers & web developers",price:99,monthlyPrice:"$8.25",credits:360,icon:ua,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)","Multi-Page Convert"],tagline:"36+ themes per year"},{id:"pro",name:"Pro",description:"For professional developers & designers",price:199,monthlyPrice:"$16.58",credits:840,icon:Og,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)","Multi-Page Convert","Bring Your Own Key (Gemini)","Theme Checker (coming soon)"],tagline:"84+ themes per year",popular:!0},{id:"agency",name:"Agency",description:"For WordPress teams and marketing agencies",price:399,monthlyPrice:"$33.25",credits:1800,icon:gl,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)","Multi-Page Convert","Bring Your Own Key (Gemini)","Theme Checker (coming soon)","Multi-User (coming soon)"],tagline:"180+ themes per year"}],gm={id:"project_pass",name:"Project Pass",description:"Perfect for your first AI-generated site or a single project",price:39,credits:20,icon:ys,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Credits Issued Upfront","Multi-Page Convert"],tagline:"2 custom themes"};function yne(){const t=Zt(),[e,r]=eo(),{user:n}=$t(),{plan:s,billingInterval:o,source:a,createCheckout:l,createOneTimeCheckout:c,loading:u,refreshSubscription:d,cancelSubscription:h,reactivateSubscription:m,previewSubscriptionChange:f,subscriptionEnd:v,cancelAtPeriodEnd:p,creditsRemaining:b}=nn(),[x,y]=g.useState("yearly"),w=a==="appsumo",[j,_]=g.useState(null),[S,N]=g.useState(!1),[P,C]=g.useState(!1),[O,F]=g.useState(!1),[T,A]=g.useState(!1),[k,$]=g.useState(!1),[K,H]=g.useState(!1),[W,R]=g.useState(!1),[G,U]=g.useState(!0),[z,oe]=g.useState(""),[L,q]=g.useState(""),[he,X]=g.useState(null),[J,de]=g.useState(!1),[le,fe]=g.useState(null),[Z,ae]=g.useState(!1),[E,ne]=g.useState(!1),{track:te}=ro(),[D,M]=g.useState({open:!1,plan:null,billingInterval:null,mode:"subscription"}),[V,me]=g.useState(""),[ve,se]=g.useState(!1),[pe,xe]=g.useState(null),we=x==="yearly";g.useEffect(()=>{const ie=e.get("checkout");ie==="canceled"?(Q.error("Checkout was canceled. No charges were made."),e.delete("checkout"),r(e,{replace:!0})):ie==="success"?(Q.success("Payment successful! Your credits have been added."),te("Purchase",{content_name:"subscription",currency:"USD"}),d(),e.delete("checkout"),r(e,{replace:!0})):ie==="upgraded"&&(Q.success("Your plan has been upgraded!"),d(),e.delete("checkout"),r(e,{replace:!0}))},[e,r,d]),g.useEffect(()=>{const ie=e.get("plan_intent"),be=e.get("billing_intent");!n||!ie||!be||(e.delete("plan_intent"),e.delete("billing_intent"),r(e,{replace:!0}),s!=="free"&&s!=="project_pass"&&!w&&!(ie===s&&be===o)&&(y(be),fe(ie),C(!0),de(!0),f(ie,be).then(st=>X(st)).catch(st=>{console.error("Plan intent preview error:",st),Q.error("Failed to load plan change preview."),C(!1)}).finally(()=>de(!1))))},[n,s,o,w,e,r,f]);const Ie=async(ie,be,st="subscription",Oe)=>{var $e,Ze;_(ie);try{te("InitiateCheckout",{content_name:ie,value:0,currency:"USD"});const{data:ht,error:_t}=await re.functions.invoke("create-guest-checkout",{body:{plan:ie,billingInterval:be,mode:st,email:Oe}});if(_t){const Et=await On(_t,"Checkout failed");if((($e=_t==null?void 0:_t.context)==null?void 0:$e.status)===409&&((Ze=Et.body)!=null&&Ze.already_subscribed)){xe({o
1919pen:!0,currentPlan:String(Et.body.current_plan||"paid"),targetPlan:String(Et.body.target_plan||ie),email:Oe||"",isUpgrade:!!Et.body.is_upgrade,isDowngrade:!!Et.body.is_downgrade});return}throw new Error(Et.message||_t.message||"Checkout failed")}if(ht!=null&&ht.error){if(ht.already_subscribed){xe({open:!0,currentPlan:ht.current_plan||"paid",targetPlan:ht.target_plan||ie,email:Oe||"",isUpgrade:!!ht.is_upgrade,isDowngrade:!!ht.is_downgrade});return}throw new Error(ht.error)}ht!=null&&ht.url&&Ls(ht.url)}catch(ht){const _t=ht instanceof Error?ht.message:"";Q.error(_t||"Failed to start checkout. Please try again."),console.error("Guest checkout error:",ht)}finally{_(null)}},tt=async()=>{if(D.plan){if(!V||!V.includes("@")){Q.error("Please enter a valid email address.");return}se(!0);try{await Ie(D.plan,D.billingInterval||void 0,D.mode,V),M({open:!1,plan:null,billingInterval:null,mode:"subscription"})}finally{se(!1)}}},Ke=async ie=>{if(!n){if(ie==="free"){t("/auth?mode=signup");return}M({open:!0,plan:ie,billingInterval:we?"yearly":"monthly",mode:"subscription"});return}if(u){Q.info("Loading your subscription… please try again in a moment.");return}if(ie==="free"&&s!=="free"){F(!0);return}if(ie==="free"){t("/dashboard");return}if(ie===s&&(we?"yearly":"monthly")===o){Q.info("You're already on this plan");return}if(!w&&s!=="free"&&s!=="project_pass"){fe(ie),C(!0),de(!0);try{const $e=await f(ie,we?"yearly":"monthly");X($e)}catch(Oe){console.error("Preview error:",Oe),Q.error("Failed to load preview. Please try again."),C(!1)}finally{de(!1)}return}_(ie);try{const Oe=we?"yearly":"monthly";te("InitiateCheckout",{content_name:ie,value:0,currency:"USD"});const $e=await l(ie,Oe);$e!=null&&$e.upgraded?Q.success($e.message||"Your subscription has been updated!"):$e!=null&&$e.noChange?Q.info($e.message||"You're already on this plan"):$e!=null&&$e.alreadySubscribed&&!($e!=null&&$e.url)&&Q.info($e.message||"You already have an active subscription")}catch(Oe){const $e=Oe instanceof Error?Oe.message:"";Q.error($e||"Failed to start checkout. Please try again."),console.error("Checkout error:",Oe)}finally{_(null)}},Dt=async()=>{if(!n){M({open:!0,plan:"project_pass",billingInterval:null,mode:"payment"});return}if(s==="project_pass"){Q.info("You already have a Project Pass");return}_("project_pass");try{await c()}catch(ie){const be=ie instanceof Error?ie.message:"";Q.error(be||"Failed to start checkout. Please try again."),console.error("One-time checkout error:",ie)}finally{_(null)}},yt=async()=>{if(le){_(le);try{const be=await l(le,we?"yearly":"monthly");be!=null&&be.upgraded?(Q.success(be.message||"Your subscription has been updated!"),await d()):be!=null&&be.noChange?Q.info(be.message||"You're already on this plan"):be!=null&&be.alreadySubscribed&&!(be!=null&&be.url)&&Q.info(be.message||"You already have an active subscription"),C(!1),fe(null),X(null)}catch(ie){const be=ie instanceof Error?ie.message:"Failed to update subscription. Please try again.";Q.error(be),console.error("Checkout error:",ie)}finally{_(null)}}},Wt=async()=>{ae(!0);try{const ie=await h();if(ie!=null&&ie.success||ie!=null&&ie.no_subscription){const be=ie!=null&&ie.no_subscription?"You are already on the free plan.":ie.message||"Subscription will be canceled at the end of your billing period.";Q.success(be),N(!1)}}catch(ie){Q.error("Failed to cancel subscription. Please try again."),console.error("Cancel error:",ie)}finally{ae(!1)}},Ct=()=>{const be=[...Ny,...pm].find(st=>st.id===s&&(o==="yearly"?pm.includes(st):Ny.includes(st)));return(be==null?void 0:be.price)??0},nt=async(ie,be)=>{H(!0),oe(ie),q(be);try{await re.functions.invoke("submit-cancellation-survey",{body:{reason:ie,details:be,current_plan:s,accepted_retention_offer:!1}}),F(!1);const{data:st}=await re.from("retention_offer_claims").select("id").limit(1);st&&st.length>0?(U(!1),N(!0)):(U(!0),A(!0))}catch(st){Q.error("Failed to submit feedback. Please try again."),console.error("Survey error:",st)}finally{H(!1)}},Ft=()=>{A(!1),$(!0)},kr=()=>{A(!1),N(!0)},ut=async()=>{R(!0);try{const{data:ie,error:be}=await re.functions.invoke("apply-retention-offer");if(be)throw new Error(be.message||"Failed to apply offer");if(ie!=null&&ie.error)throw new Error(ie.error);await re.functions.invoke("submit-cancellation-survey",{body:{reason:z,details:L,current_plan:s,accepted_retention_offer:!0,update_latest:!0}}),$(!1),ie!=null&&ie.checkout_url&&Ls(ie.checkout_url),await d()}catch(ie){const be=ie instanceof Error?ie.message:"Failed to apply retention offer.";Q.error(be),console.error("Retention error:",ie)}finally{R(!1)}},Ue=async()=>{ne(!0);try{const ie=await m();ie!=null&&ie.success&&Q.success(ie.message||"Your subscription has been reactivated!")}catch(ie){Q.error("Failed to reactivate subscription. Please try again."),console.error("Reactivate error:",ie)}finally{ne(!1)}},sn=(ie,be)=>
1919n&&w&&ie===s?"Included in your AppSumo deal":n&&be?"Current Plan":ie==="free"&&s!=="free"?"Downgrade":n&&ie===s&&!be?we?"Switch to Annual":"Switch to Monthly":"Start Free Trial",bt=new Set(["Multi-Page Convert","Multi-Page Builder","Theme Preview","Bring Your Own Key (Gemini)"]),Vr={"Create Themes with AI Prompts":"Use words to design native WordPress themes. No code.","Convert HTML to WordPress":"Enter a site URL and migrate it to a WordPress theme.","Media Migration with Credits":"Automatically download images and graphics for import into WordPress and automatically change source paths to local.","Multi-Page Builder":"Design entire WordPress sites with AI including Homepages, Headers, Footers, Pages and Posts.","Multi-Page Convert":"Convert websites to WordPress from AI builders like Claude, Gemini, Lovable, Base44, v0.dev, and Bolt.new or from providers like Wix and Squarespace.","Helper Plugins":"Plugins to help you design WordPress sites faster with PressMeGPT.","Credit-Saver":"Design 1, 2, or 3 themes at a time.","Theme Preview":"Preview your Theme in WordPress without having to install it.","Bring Your Own Key (Gemini)":"Connect your own Google Gemini API key to run AI generation on your own Google billing — platform credits only consumed for site conversions and other non-Gemini requests"},Je=ie=>{const be=Vr[ie],st=i.jsxs("span",{className:"flex items-center gap-2",children:[be?i.jsx("span",{className:"underline decoration-dotted decoration-muted-foreground/50 underline-offset-2 cursor-help",children:ie}):ie,bt.has(ie)&&i.jsx("span",{className:"inline-flex items-center rounded bg-accent px-1.5 py-0.5 text-[10px] font-medium text-accent-foreground",children:"New"})]});return be?i.jsxs(lh,{children:[i.jsx(ch,{asChild:!0,children:st}),i.jsx(Qc,{className:"max-w-xs",children:be})]}):st};return i.jsx("div",{className:"min-h-screen bg-background",children:i.jsxs(Qh,{delayDuration:150,children:[i.jsx(zr,{}),i.jsxs("main",{className:"container mx-auto px-4 py-12",children:[i.jsxs("div",{className:"text-center mb-12",children:[i.jsx("h1",{className:"text-4xl font-bold mb-4",children:"Save Hours over Drag-and-Drop"}),i.jsx("p",{className:"text-xl text-muted-foreground",style:{marginBottom:"15px"},children:"Own The Themes You Create. Host Anywhere."}),i.jsx("div",{className:"flex justify-center mb-4",children:i.jsxs("a",{href:"/terms#refund-policy",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[i.jsx(xc,{className:"h-5 w-5"}),i.jsx("span",{className:"font-bold",children:"30-day money-back guarantee"})]})}),i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex justify-center mb-6",children:i.jsxs("div",{className:"inline-flex rounded-lg border bg-muted p-1 gap-1",children:[i.jsx("button",{onClick:()=>y("monthly"),className:`px-5 py-2 rounded-md text-sm font-medium transition-colors ${x==="monthly"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Monthly & One-Time"}),i.jsx("button",{onClick:()=>y("yearly"),className:`px-5 py-2 rounded-md text-sm font-medium transition-colors ${x==="yearly"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Yearly"})]})}),we&&i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Save 17% — credits arrive monthly throughout the year. ",i.jsx("br",{})," Great for pros who build WordPress sites on the regular."]}),x==="monthly"&&i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Credits are issued to you each month, or grab a one-time Project Pass. ",i.jsx("br",{})," Great for small business, project, blog, or hobby website builds."]})]})]}),i.jsx("div",{className:"flex justify-center mb-10 px-4",children:i.jsxs("div",{className:"inline-flex flex-col sm:flex-row items-center justify-center gap-1.5 sm:gap-2 rounded-2xl sm:rounded-full border bg-card px-4 py-2 text-center text-sm leading-relaxed text-muted-foreground sm:px-5",children:[i.jsx(ys,{className:"h-4 w-4 sm:h-4 sm:w-4 shrink-0 text-primary fill-primary"}),i.jsxs("span",{children:[i.jsx("span",{className:"block sm:inline",children:"Rated 4.5 Stars on"})," ",i.jsxs("span",{className:"whitespace-nowrap",children:[i.jsx("a",{href:"https://www.producthunt.com/products/pressmegpt-com",target:"_blank",rel:"noopener noreferrer",className:"font-semibold text-foreground hover:text-primary transition-colors",children:"Product Hunt"})," ","&"," ",i.jsx("a",{href:"https://www.trustpilot.com/review/pressmegpt.com",target:"_blank",rel:"noopener noreferrer",className:"font-semibold text-foreground hover:text-primary transition-colors",children:"Trustpilot"})]})]})]})}),(()=>{const ie=n&&s==="free";return i.jsx("div",{id:"free-tier",className:"max-w-7xl mx-auto mb-8",children:i.jsxs(dt,{className:`relative ${ie?"ring-2 ring-primary":""}`,children:[ie&&i.jsx(rt,{variant:"outline",className:"absolute top-4 right-4",children:"Your Plan"}),i.jsxs("div",{className:"p-6 flex flex-col md:flex-row md:items-center gap-6",children:[i.jsxs("div",{className:"flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(Rd,{className:"h-5 w-5 text-primary"}),i.jsx("span",{className:"text-2xl font-bold leading-none tracking-tight",children:"3 Day Free Trial"})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"No credit card required"}),i.jsx("p",{className:"text-xs text-primary mt-1",children:"Enjoy the Pro features for 3 days with ways to earn free credits."})]}),i.jsx("div",{className:"flex-1 grid grid-cols-2 gap-x-6 gap-y-2 text-sm",children:[["Gemini 3.0","Private Themes"],["Media Migration","Multi-Page Tools"],["Free Classic, Gutenberg & Elementor Exports"]].flat().map((be,st)=>i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx(fr,{className:"h-4 w-4 text-primary shrink-0"}),be]},st))}),i.jsx("div",{className:"flex-shrink-0",children:ie?i.jsx(Y,{variant:"outline",disabled:!0,className:"min-w-[140px]",children:"Current Plan"}):n?i.jsx(Y,{variant:"outline",className:"min-w-[140px]",onClick:()=>Ke("free"),children:"Downgrade to Free"}):i.jsx(Y,{className:"min-w-[140px] bg-cta text-cta-foreground hover:bg-cta-hover",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})})]})]})})})(),i.jsxs("div",{id:"pricing-table",className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-7xl mx-auto",children:[!we&&(()=>{const ie=n&&s==="project_pass";return i.jsxs(dt,{className:`relative flex flex-col ${ie?"ring-2 ring-primary":"border-primary shadow-xl"}`,children:[i.jsx(rt,{className:"absolute -top-3 left-1/2 -translate-x-1/2 whitespace-nowrap",children:"No Subscription Required"}),ie&&i.jsx(rt,{variant:"outline",className:"absolute top-9 right-4",children:"Your Plan"}),i.jsxs(ir,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(ys,{className:"h-5 w-5 text-primary"}),i.jsx(Dr,{children:gm.name})]}),i.jsx(Gr,{children:gm.description})]}),i.jsxs(ct,{className:"flex-1",children:[i.jsxs("div",{className:"mb-6",children:[i.jsxs("div",{className:"flex items-baseline gap-1",children:[i.jsxs("span",{className:"text-4xl font-bold",children:["$",gm.price]}),i.jsx("span",{className:"text-muted-foreground",children:"one-time"})]}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"20 credits — good for 1 year"}),i.jsx("p",{className:"text-xs text-primary mt-1",children:"2+ completed sites"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"6+ themes generated"})]}),i.jsx("ul",{className:"space-y-3",children:gm.features.map((be,st)=>i.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[i.jsx(fr,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),Je(be)]},st))})]}),i.jsx(ia,{children:i.jsx(Y,{className:`w-full ${ie?"":"bg-cta text-cta-foreground hover:bg-cta-hover"}`,variant:ie?"outline":"default",disabled:!!ie||j==="project_pass"||u,onClick:Dt,children:j==="project_pass"?"Loading...":ie?"Current Plan":"Get Started — $39"})})]},"project_pass")})(),(we?pm:Ny).map(ie=>{const be=ie.icon,st=ie.price,Oe=ie.credits,$e=we?"yearly":"monthly",Ze=ie.id===s&&(w||$e===o);return i.jsxs(dt,{className:`relative flex flex-col ${ie.popular?"border-primary shadow-lg":""} ${Ze?"ring-2 ring-primary":""}`,children:[ie.popular&&i.jsx(rt,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Most Popular"}),Ze&&i.jsx(rt,{variant:"outline",className:"absolute top-9 right-4",children:w?"Your Plan (AppSumo)":"Your Plan"}),Ze&&!w&&p&&v&&i.jsxs(rt,{variant:"destructive",className:"absolute top-16 right-4 text-xs",children:["Cancels ",new Date(v).toLocaleDateString()]}),i.jsxs(ir,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(be,{className:"h-5 w-5 text-primary"}),i.jsx(Dr,{children:ie.name})]}),i.jsx(Gr,{children:ie.description})]}),i.jsxs(ct,{className:"flex-1",children:[i.jsxs("div",{className:"mb-6",children:[i.jsxs("div",{className:"flex items-baseline gap-1",children:[i.jsx("span",{className:"text-4xl font-bold",children:we&&"monthlyPrice"in ie?ie.monthlyPrice:`$${st}`}),i.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),we&&i.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Billed annually. You pay $",st," today."]}),Oe?i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:we?`${Oe} credits/year (issued monthly)`:`${Oe} credits/month`}):null,Oe?(()=>{const ht=we?Oe/12:Oe,_t=Math.floor(ht/10),Et=_t*3;return _t<1?null:i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[_t,"+ completed sites per month"]}),i.jsxs("p",{className:"text-xs text-primary mt-1",children:[Et,"+ themes generated per month"]})]})})():null]}),i.jsx("ul",{className:"space-y-3",children:ie.features.map((ht,_t)=>i.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[i.jsx(fr,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),Je(ht)]},_t))})]}),i.jsx(ia,{className:"flex flex-col gap-2",children:Ze&&!w&&p?i.jsxs(Y,{className:"w-full",variant:"outline",disabled:E,onClick:Ue,children:[i.jsx(sh,{className:"h-4 w-4 mr-2"}),E?"Reactivating...":"Reactivate"]}):i.jsx(Y,{className:`w-full ${Ze?"":"bg-cta text-cta-foreground hover:bg-cta-hover"}`,variant:Ze?"outline":"default",disabled:n&&Ze||j===ie.id||u,onClick:()=>Ke(ie.id),children:j===ie.id?"Loading...":sn(ie.id,Ze)})})]},ie.id)})]}),i.jsx("p",{className:"mt-8 mb-16 text-center text-sm text-muted-foreground",children:"Free plan available · Cancel anytime · No lock-in"}),n&&s!=="free"&&i.jsx("div",{className:"mt-6 text-center",children:i.jsx("button",{onClick:()=>Ke("free"),className:"text-sm text-destructive hover:text-destructive/80 underline underline-offset-4 transition-colors",children:"Cancel Paid Plan and Downgrade to Free"})}),i.jsx(Yo,{quotes:DN[0]}),i.jsxs("div",{className:"mt-20 max-w-6xl mx-auto",children:[i.jsx("h2",{className:"text-2xl font-bold mb-2 text-center",children:"Compare To Premium Themes & Website Builders"}),i.jsx("p",{className:"text-center text-muted-foreground mb-10",children:"See how PressMeGPT stacks up against the most popular WordPress alternatives."}),i.jsx("div",{className:"overflow-x-auto rounded-xl border bg-card shadow-sm mb-12",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b bg-muted/40",children:[i.jsx("th",{className:"text-left p-4 font-semibold text-foreground w-1/5",children:"Plan"}),i.jsxs("th",{className:"text-center p-4 font-semibold text-foreground",children:["Creator",i.jsx("br",{}),i.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"$5.75/mo"})]}),i.jsxs("th",{className:"text-center p-4 font-semibold text-foreground",children:["Freelance",i.jsx("br",{}),i.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"$8.25/mo"})]}),i.jsxs("th",{className:"text-center p-4 font-semibold text-primary border-x border-primary/20 bg-primary/5",children:["Pro",i.jsx("br",{}),i.jsx("span",{className:"text-sm font-medium",children:"$16.58/mo"})]}),i.jsxs("th",{className:"text-center p-4 font-semibold text-foreground",children:["Agency",i.jsx("br",{}),i.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"$33.25/mo"})]})]})}),i.jsxs("tbody",{children:[i.jsxs("tr",{className:"border-b",children:[i.jsxs("td",{className:"p-4 font-medium text-foreground",children:[i.jsx("span",{className:"text-primary font-semibold",children:"PressMeGPT"}),i.jsx("br",{}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Credits issued monthly"})]}),i.jsxs("td",{className:"p-4 text-center font-medium",children:["1+ completed sites/month",i.jsx("br",{}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"$69/year"})]}),i.jsxs("td",{className:"p-4 text-center font-medium",children:["3+ completed sites/month",i.jsx("br",{}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"$99/year"})]}),i.jsxs("td",{className:"p-4 text-center font-medium bg-primary/5 border-x border-primary/20",children:["7+ completed sites/month",i.jsx("br",{}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"$199/year"})]}),i.jsxs("td",{className:"p-4 text-center font-medium",children:["15+ completed sites/month",i.jsx("br",{}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"$399/year"})]})]}),i.jsxs("tr",{className:"border-b",children:[i.jsxs("td",{className:"p-4",children:[i.jsx("span",{className:"font-medium text-foreground",children:"Elementor"}),i.jsx("br",{}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Annual subscription"})]}),i.jsxs("td",{className:"p-4 text-center",children:[i.jsx("div",{className:"text-muted-foreground text-xs mb-0.5",children:"3 themes for $99/year"}),i.jsx(rt,{className:"text-xs",children:"Save 30%"})]}),i.jsxs("td",{className:"p-4 text-center",children:[i.jsx("div",{className:"text-muted-foreground text-xs mb-0.5",children:"36 themes for $204/year"}),i.jsx(rt,{className:"text-xs",children:"Save 51%"})]}),i.jsxs("td",{className:"p-4 text-center bg-primary/5 border-x border-primary/20",children:[i.jsx("div",{className:"text-muted-foreground text-xs mb-0.5",children:"84 themes for $540/year"}),i.jsx(rt,{className:"text-xs",children:"Save 63%"})]}),i.jsxs("td",{className:"p-4 text-center",children:[i.jsx("div",{className:"text-muted-foreground text-xs mb-0.5",children:"180 themes for $540/year"}),i.jsx(rt,{className:"text-xs",children:"Save 26%"})]})]}),i.jsxs("tr",{children:[i.jsxs("td",{className:"p-4",children:[i.jsx("span",{className:"font-medium text-foreground",children:"ThemeForest"}),i.jsx("br",{}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Avg. $49/theme"})]}),i.jsxs("td",{className:"p-4 text-center",children:[i.jsx("div",{className:"text-muted-foreground text-xs mb-0.5",children:"12 themes for $588"}),i.jsx(rt,{className:"text-xs",children:"Save 88%"})]}),i.jsxs("td",{className:"p-4 text-center",children:[i.jsx("div",{className:"text-muted-foreground text-xs mb-0.5",children:"36 themes for $1,764"}),i.jsx(rt,{className:"text-xs",children:"Save 94%"})]}),i.jsxs("td",{className:"p-4 text-center bg-primary/5 border-x border-primary/20",children:[i.jsx("div",{className:"text-muted-foreground text-xs mb-0.5",children:"84 themes for $4,116"}),i.jsx(rt,{className:"text-xs",children:"Save 95%"})]}),i.jsxs("td",{className:"p-4 text-center",children:[i.jsx("div",{className:"text-muted-foreground text-xs mb-0.5",children:"180 themes for $8,820"}),i.jsx(rt,{className:"text-xs",children:"Save 95%"})]})]}),i.jsxs("tr",{className:"border-t bg-muted/20",children:[i.jsx("td",{className:"p-4"}),pm.map(ie=>{const be=ie.id===s&&o==="yearly";return i.jsx("td",{className:`p-4 text-center ${ie.popular?"bg-primary/5 border-x border-primary/20":""}`,children:i.jsx(Y,{size:"sm",className:`w-full ${be?"":"bg-cta text-cta-foreground hover:bg-cta-hover"}`,variant:be?"outline":"default",disabled:!!n&&be||u,onClick:()=>{y("yearly"),Ke(ie.id)},children:sn(ie.id,be)})},ie.id)})]})]})]})}),i.jsx(tu,{eyebrow:"Worth every credit",heading:"Real Results from Real WordPress Builders",variant:"muted",quotes:cQ}),i.jsxs(oa,{defaultValue:"elementor",className:"w-full"
1919,children:[i.jsxs(Yi,{className:"w-full max-w-full mb-6 h-auto min-h-12 py-1",children:[i.jsx(gr,{value:"elementor",className:"flex-1 min-w-0 text-sm sm:text-base whitespace-normal leading-tight px-2 sm:px-3",children:"Elementor vs PressMeGPT"}),i.jsx(gr,{value:"themeforest",className:"flex-1 min-w-0 text-sm sm:text-base whitespace-normal leading-tight px-2 sm:px-3",children:"ThemeForest vs PressMeGPT"})]}),i.jsx(Mr,{value:"elementor",children:i.jsx("div",{className:"grid md:grid-cols-2 gap-5",children:[{icon:Tb,title:"Faster Site Speed",pro:"PressMeGPT generates plugin-free themes — your site loads fast right out of the box.",con:"Elementor relies on a heavy plugin that can significantly slow your site over time."},{icon:PL,title:"No Subscriptions Required",pro:"Own your theme outright. Once exported, themes are yours forever — no ongoing per-site fees.",con:"Elementor requires an ongoing annual subscription to keep sites live, even after you finish building."},{icon:Rd,title:"No Site Limits",pro:"PressMeGPT themes can be installed and customized on as many sites as you want.",con:"Elementor charges per website install — costs compound quickly for agencies managing multiple clients."},{icon:xc,title:"Time Savings",pro:"Just describe what you want — PressMeGPT creates your theme with AI in seconds.",con:"Elementor still requires hours of manual drag-and-drop work and creative effort for every site."}].map(ie=>{const be=ie.icon;return i.jsxs("div",{className:"rounded-xl border bg-card p-6 flex flex-col gap-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/10 flex items-center justify-center shrink-0",children:i.jsx(be,{className:"h-6 w-6 text-primary"})}),i.jsx("h3",{className:"text-lg font-semibold text-foreground",children:ie.title})]}),i.jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-primary/5 border border-primary/15 p-3",children:[i.jsx(vp,{className:"h-5 w-5 text-primary shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-semibold text-primary uppercase tracking-wide mb-1",children:"PressMeGPT"}),i.jsx("p",{className:"text-base text-foreground",children:ie.pro})]})]}),i.jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-muted/60 border border-border p-3",children:[i.jsx(Eb,{className:"h-5 w-5 text-muted-foreground shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Elementor"}),i.jsx("p",{className:"text-base text-muted-foreground",children:ie.con})]})]})]},ie.title)})})}),i.jsx(Mr,{value:"themeforest",children:i.jsx("div",{className:"grid md:grid-cols-2 gap-5",children:[{icon:St,title:"Truly Custom Designs",pro:"PressMeGPT themes are built uniquely for you and look nearly identical to what you designed.",con:"ThemeForest themes often don't match the demo — you'll spend hours importing test data and customizing."},{icon:Tb,title:"Faster Site Speed",pro:"PressMeGPT themes use native Classic WordPress or Gutenberg Blocks — zero plugin bloat.",con:"ThemeForest themes frequently bundle unnecessary plugins that drag down your site speed."},{icon:jL,title:"Lower Costs",pro:"No recurring per-site subscriptions. Plan credits drip monthly so you always have fresh credits when you build.",con:"ThemeForest costs add up fast — $49+ per theme with no reuse rights for client work."},{icon:xc,title:"Time Savings",pro:"Describe what you want and get a production-ready theme in minutes — fast and easy development.",con:"ThemeForest themes typically require a developer and many hours of setup to go live."}].map(ie=>{const be=ie.icon;return i.jsxs("div",{className:"rounded-xl border bg-card p-6 flex flex-col gap-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/10 flex items-center justify-center shrink-0",children:i.jsx(be,{className:"h-6 w-6 text-primary"})}),i.jsx("h3",{className:"text-lg font-semibold text-foreground",children:ie.title})]}),i.jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-primary/5 border border-primary/15 p-3",children:[i.jsx(vp,{className:"h-5 w-5 text-primary shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-semibold text-primary uppercase tracking-wide mb-1",children:"PressMeGPT"}),i.jsx("p",{className:"text-base text-foreground",children:ie.pro})]})]}),i.jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-muted/60 border border-border p-3",children:[i.jsx(Eb,{className:"h-5 w-5 text-muted-foreground shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"ThemeForest"}),i.jsx("p",{className:"text-base text-muted-foreground",children:ie.con})]})]})]},ie.title)})})})]})]}),i.jsx(tu,{eyebrow:"Built for every workflow",heading:"Why Pros & Noobs choose PressMeGPT",variant:"gradient",quotes:uQ}),i.jsxs("div",{className:"mt-16 max-w-5xl mx-auto",id:"credit-faqs",children:[i.jsx("h2",{className:"text-2xl font-bold mb-2 text-center",children:"How Credits Work"}),i.jsx("p",{className:"text-center text-muted-foreground mb-8",children:"Everything you build costs credits — here's exactly how they're used."}),i.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"rounded-lg border p-6 bg-card",children:[i.jsxs("h3",{className:"font-semibold text-foreground mb-2 flex items-center gap-2",children:[i.jsx(St,{className:"h-4 w-4 text-primary"}),"Theme Generation — 3 Credits"]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"On every new generation, the AI creates 3 different themes for you to pick from and uses 3 credits to do this."})]}),i.jsxs("div",{className:"rounded-lg border p-6 bg-card",children:[i.jsxs("h3",{className:"font-semibold text-foreground mb-2 flex items-center gap-2",children:[i.jsx(ua,{className:"h-4 w-4 text-primary"}),"Theme Customization — 1 Credit"]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Every AI modification request uses at least 1 credit based on the complexity of the request."})]}),i.jsxs("div",{className:"rounded-lg border p-6 bg-card",children:[i.jsxs("h3",{className:"font-semibold text-foreground mb-2 flex items-center gap-2",children:[i.jsx(Rd,{className:"h-4 w-4 text-primary"}),"Website Conversion to WordPress — 2–3 Credits"]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"PressMeGPT now has the ability to either use an existing website for inspiration or to copy a design on a website you own to a WordPress theme."})]}),i.jsxs("div",{className:"rounded-lg border p-6 bg-card",children:[i.jsxs("h3",{className:"font-semibold text-foreground mb-2 flex items-center gap-2",children:[i.jsx(DL,{className:"h-4 w-4 text-primary"}),"Additional Pages — 0.5–0.75 Credits"]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Creating a new page for your theme costs 0.5 credits. Converting an existing page from a website you own costs 0.75 credits."})]}),i.jsxs("div",{className:"rounded-lg border p-6 bg-card",children:[i.jsxs("h3",{className:"font-semibold text-foreground mb-2 flex items-center gap-2",children:[i.jsx(Og,{className:"h-4 w-4 text-primary"}),"Average Use Per Theme — 7 to 10 Credits"]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"The average user uses 7–10 credits to fully customize their theme. 3 to generate + 2–5 modification requests such as adding photos, sections, and/or font/color changes."})]}),i.jsxs("div",{className:"rounded-lg border p-6 bg-card",children:[i.jsxs("h3",{className:"font-semibold text-foreground mb-2 flex items-center gap-2",children:[i.jsx(sh,{className:"h-4 w-4 text-primary"}),"Credit Expiration"]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan credits are issued monthly and are valid for that month. Project Pass and Lifetime Credits are valid for 1 year from purchase. Hover the credit chip in the header to see exactly what you have and when each bucket expires."})]})]})]}),i.jsxs("div",{className:"mt-20 mb-16 flex items-center gap-4 max-w-6xl mx-auto","aria-hidden":"true",children:[i.jsx("span",{className:"h-px flex-1 bg-border"}),i.jsx(s_,{className:"h-5 w-5 text-primary/60"}),i.jsx("span",{className:"h-px flex-1 bg-border"})]}),i.jsx(Yo,{quotes:DN[1],showRatings:!0}),i.jsxs("div",{className:"mt-16 max-w-3xl mx-auto",id:"faqs",children:[i.jsx("h2",{className:"text-2xl font-bold mb-2 text-center",children:"Frequently Asked Questions"}),i.jsx("p",{className:"text-center text-muted-foreground mb-8",children:"Everything you need to know about PressMeGPT"}),i.jsx("div",{className:"space-y-4",children:[{question:"What is PressMeGPT?",answer:"PressMeGPT is an AI WordPress theme generator that creates real, installable WordPress block themes you can edit using Gutenberg and the Full Site Editor."},{question:"Is PressMeGPT a WordPress AI website builder?",answer:"Yes — but instead of locking you into a hosted builder, PressMeGPT generates a true WordPress theme that you can download, install, and customize on any WordPress site."},{question:"Does PressMeGPT generate real WordPress themes or just layouts?",answer:"PressMeGPT generates production-ready WordPress themes, not screenshots or static templates. The output works with native WordPress tools and follows modern block-theme standards."},{question:"Can I edit the theme after it's generated?",answer:"Absolutely. All generated themes are fully editable using Gutenberg blocks and the WordPress Full Site Editor — no custom page builder required."},{question:"Does it require any WordPress plugins or subscriptions?",answer:"No. PressMeGPT themes do NOT require any page builder plugins or come with any bloat-ware. Once you download a theme, you own it and it doesn't require a subscription to install and maintain it on your WordPress site."},{question:"Do themes require configuration once installed?",answer:"No. The nice thing about PressMeGPT is that it exports a WordPress theme true to what you designed unlike many other free and paid themes, that require heavy customization to look like what was advertised."},{question:"Do I need to know how to code to use PressMeGPT?",answer:"No coding is required. You describe what you want, PressMeGPT generates the theme, and you can customize it visually inside WordPress."},{question:"Can I export and use the theme anywhere?",answer:"Yes. You can download the theme as a ZIP file and use it on your own WordPress site, client projects, or staging environments."},{question:"Is there a free version of PressMeGPT?",answer:"Yes. You can generate and try themes for free. Paid plans unlock higher limits, advanced generation options, and faster workflows."},{question:"Who is PressMeGPT best for?",answer:"PressMeGPT is ideal for developers, agencies, freelancers, and founders, marketers, and small businesses who want to save time, money, and frustration by quickly generating editable WordPress themes in a few minutes instead of hours."}].map((ie,be)=>i.jsx("div",{className:"bg-card border border-border/50 rounded-xl px-6",children:i.jsxs("details",{className:"group",children:[i.jsxs("summary",{className:"flex items-center justify-between py-5 font-medium cursor-pointer list-none gap-4",children:[i.jsx("span",{children:ie.question}),i.jsx("span",{className:"text-muted-foreground group-open:rotate-180 transition-transform shrink-0",children:"▾"})]}),i.jsx("p",{className:"text-muted-foreground pb-5",children:ie.answer})]})},be))})]}),i.jsx(wu,{}),i.jsx("div",{className:"mt-20 max-w-4xl mx-auto",children:i.jsxs("div",{className:"bg-gradient-to-br from-primary/10 via-card to-accent/10 rounded-3xl p-12 md:p-16 text-center border border-border/50",children:[i.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Ready to Get Started?"}),i.jsx("p",{className:"text-muted-foreground mb-8 text-lg max-w-2xl mx-auto",children:"Choose the plan that fits your workflow and start generating beautiful WordPress themes in minutes."}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[i.jsxs(Y,{size:"lg",className:"bg-cta text-cta-foreground hover:bg-cta-hover shadow-lg text-lg px-8 py-6",onClick:()=>{var ie;return(ie=document.getElementById("pricing-table"))==null?void 0:ie.scrollIntoView({behavior:"smooth"})},children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),"View Plans"]}),i.jsx(Y,{size:"lg",variant:"outline",className:"text-lg px-8 py-6",onClick:()=>{var ie;return(ie=document.getElementById("free-tier"))==null?void 0:ie.scrollIntoView({behavior:"smooth"})},children:"Try Free — No Card Needed"})]})]})}),i.jsx("div",{className:"mt-12 text-center text-sm text-muted-foreground",children:i.jsxs("p",{children:["Questions? Contact us at"," ",i.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"[email protected]"})]})})]}),i.jsx(mne,{isOpen:O,onClose:()=>F(!1),onSubmit:nt,loading:K}),i.jsx(pne,{isOpen:T,onClose:()=>{A(!1),N(!0)},onAccept:Ft,onDecline:kr,loading:!1,currentPlan:s,currentPrice:Ct(),billingInterval:o||"monthly"}),i.jsx(gne,{isOpen:k,onClose:()=>$(!1),onConfirm:ut,loading:W,currentPlan:s,discountedPrice:(Ct()*.5).toFixed(2),billingInterval:o||"monthly"}),i.jsx(hne,{isOpen:S,onClose:()=>
1919N(!1),onConfirm:Wt,currentPlan:s,periodEnd:v,loading:Z,creditsRemaining:b}),i.jsx(fne,{isOpen:P,onClose:()=>{C(!1),fe(null),X(null)},onConfirm:yt,loading:j!==null,previewData:he,previewLoading:J}),i.jsx(Xt,{open:D.open,onOpenChange:ie=>{ie||M({open:!1,plan:null,billingInterval:null,mode:"subscription"})},children:i.jsxs(Qt,{className:"sm:max-w-md",children:[i.jsxs(gn,{children:[i.jsx(wr,{children:"Continue to checkout"}),i.jsx(jn,{children:"Enter your email so we can set up your account after purchase."})]}),i.jsxs("div",{className:"space-y-4 py-2",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"guest-email",children:"Email address"}),i.jsx(Nt,{id:"guest-email",type:"email",placeholder:"[email protected]",value:V,onChange:ie=>me(ie.target.value),disabled:ve,onKeyDown:ie=>{ie.key==="Enter"&&tt()}})]}),i.jsx(Y,{className:"w-full bg-cta text-cta-foreground hover:bg-cta-hover",onClick:tt,disabled:ve||!V.includes("@"),children:ve?"Checking...":"Continue to Checkout"})]})]})}),i.jsx(Xt,{open:!!(pe!=null&&pe.open),onOpenChange:()=>xe(null),children:i.jsxs(Qt,{className:"sm:max-w-md",children:[i.jsxs(gn,{children:[i.jsx(wr,{children:"You already have a paid plan"}),i.jsxs(jn,{children:["The email ",i.jsx("span",{className:"font-medium text-foreground",children:pe==null?void 0:pe.email})," already has an active"," ",i.jsx("span",{className:"font-medium text-foreground",children:pe==null?void 0:pe.currentPlan})," plan."]})]}),i.jsxs("div",{className:"space-y-4 py-2",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:pe!=null&&pe.isUpgrade?"Sign in to upgrade immediately and pay only the prorated difference.":pe!=null&&pe.isDowngrade?"Sign in to schedule a downgrade for the end of your current billing period.":"Sign in to manage or change your existing plan."}),i.jsx(Y,{className:"w-full bg-cta text-cta-foreground hover:bg-cta-hover",onClick:()=>{const ie=pe==null?void 0:pe.targetPlan,be=D.billingInterval||"monthly",st=new URLSearchParams;st.set("mode","signin"),st.set("email",(pe==null?void 0:pe.email)||""),st.set("plan_intent",ie||""),st.set("billing_intent",be),t(`/auth?${st.toString()}`),xe(null)},children:"Sign in to change plan"}),i.jsx(Y,{variant:"outline",className:"w-full",onClick:()=>xe(null),children:"Cancel"})]})]})})]})})}const R3=({className:t,...e})=>i.jsx("nav",{role:"navigation","aria-label":"pagination",className:Se("mx-auto flex w-full justify-center",t),...e});R3.displayName="Pagination";const I3=g.forwardRef(({className:t,...e},r)=>i.jsx("ul",{ref:r,className:Se("flex flex-row items-center gap-1",t),...e}));I3.displayName="PaginationContent";const Gm=g.forwardRef(({className:t,...e},r)=>i.jsx("li",{ref:r,className:Se("",t),...e}));Gm.displayName="PaginationItem";const Dv=({className:t,isActive:e,size:r="icon",...n})=>i.jsx("a",{"aria-current":e?"page":void 0,className:Se(tv({variant:e?"outline":"ghost",size:r}),t),...n});Dv.displayName="PaginationLink";const O3=({className:t,...e})=>i.jsxs(Dv,{"aria-label":"Go to previous page",size:"default",className:Se("gap-1 pl-2.5",t),...e,children:[i.jsx(DP,{className:"h-4 w-4"}),i.jsx("span",{children:"Previous"})]});O3.displayName="PaginationPrevious";const M3=({className:t,...e})=>i.jsxs(Dv,{"aria-label":"Go to next page",size:"default",className:Se("gap-1 pr-2.5",t),...e,children:[i.jsx("span",{children:"Next"}),i.jsx(Gh,{className:"h-4 w-4"})]});M3.displayName="PaginationNext";function $3({open:t,onOpenChange:e,onDownload:r,loading:n,themeName:s,creditsRemaining:o=1/0,showCreditLabels:a=!1,chargeCredits:l=!1,onUpgradeNeeded:c}){const[u,d]=g.useState("classic"),{track:h}=no(),m=async()=>{if(h("theme_export_attempted",{export_type:u}),l){e(!1),c==null||c(u);return}await r(u),e(!1)};return i.jsx(Xt,{open:t,onOpenChange:e,children:i.jsxs(Qt,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[i.jsxs(gn,{children:[i.jsxs(wr,{children:["Download ",s]}),i.jsx(jn,{children:"Choose your preferred WordPress theme format"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("h4",{className:"font-medium",children:"Choose Export Format:"}),i.jsx(A3,{value:u,onChange:d,showCreditLabels:a})]}),i.jsxs("div",{className:"p-4 bg-muted rounded-lg",children:[i.jsx("h4",{className:"font-medium mb-2",children:"Theme Package Contents:"}),i.jsx("ul",{className:"text-sm text-muted-foreground space-y-1",children:u==="classic"?i.jsxs(i.Fragment,{children:[i.jsx("li",{children:"• style.css - Theme stylesheet with metadata"}),i.jsx("li",{children:"• header.php, footer.php - Dynamic templates"}),i.jsx("li",{children:"• front-page.php - Homepage template"}),i.jsx("li",{children:"• functions.php - Theme setup & Customizer"}),i.jsx("li",{children:"• inc/customizer.php - Header/footer options"}),i.jsx("li",{children:"• screenshot.png - Theme preview"})]}):u==="gutenberg"?i.jsxs(i.Fragment,{children:[i.jsx("li",{children:"• style.css - Theme stylesheet"}),i.jsx("li",{children:"• theme.json - Block editor config"}
1919),i.jsx("li",{children:"• templates/ - HTML block templates"}),i.jsx("li",{children:"• parts/header.html - Block-based header"}),i.jsx("li",{children:"• parts/footer.html - Block-based footer"}),i.jsx("li",{children:"• screenshot.png - Theme preview"})]}):i.jsxs(i.Fragment,{children:[i.jsx("li",{children:"• elementor-homepage.json - Importable Elementor template"}),i.jsx("li",{children:"• Full CSS + fonts embedded for design fidelity"}),i.jsx("li",{children:"• readme.txt - Import instructions"}),i.jsx("li",{children:"• screenshot.png - Theme preview"})]})})]}),i.jsxs(pf,{children:[i.jsx(Y,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),i.jsx(Y,{onClick:m,disabled:n,children:n?i.jsxs(i.Fragment,{children:[i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}),"Downloading..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Wn,{className:"h-4 w-4 mr-2"}),"Download Theme (.zip)"]})})]})]})})}function bne({theme:t,onPreview:e}){const r=Zt(),{user:n}=$t(),{isFavorited:s,toggleFavorite:o,loading:a}=iO(t.id),{downloadTheme:l,loading:c}=p1(),{creditsRemaining:u,refreshSubscription:d,plan:h,source:m,subscriptionEnd:f,isSuperAdmin:v,trialStatus:p}=nn(),[b,x]=g.useState(null),[y,w]=g.useState(null),j=iu({plan:h,source:m,subscriptionEnd:f,isSuperAdmin:v,trialActive:p==="active"}),_=!iu({plan:h,source:m,subscriptionEnd:f,isSuperAdmin:v}),S=$v(y??"classic"),[N,P]=g.useState(t.heart_count||0),[C,O]=g.useState(t.download_count||0),[F,T]=g.useState(!1),A=()=>{r(`/themes/${t.slug}`)},k=async H=>{if(H.stopPropagation(),!n){r("/auth?redirect="+encodeURIComponent(`/themes/${t.slug}`));return}const W=s;P(G=>W?G-1:G+1),await o()||P(G=>W?G+1:G-1)},$=H=>{if(H.stopPropagation(),!n){r("/auth?redirect="+encodeURIComponent(`/themes/${t.slug}`));return}T(!0)},K=async H=>{O(R=>R+1);const W=await l({id:t.id,name:t.name,master_html:t.master_html,master_css:t.master_css,version:t.version,thumbnail_url:t.thumbnail_url},H);if(W.insufficientCredits){O(R=>R-1),w(H),x("export_credits");return}W.success?d():O(R=>R-1)};return i.jsxs(i.Fragment,{children:[i.jsxs(dt,{className:"group overflow-hidden hover:shadow-lg transition-shadow cursor-pointer",onClick:A,children:[i.jsxs(ct,{className:"p-0",children:[i.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[i.jsx(bO,{src:t.thumbnail_url,alt:`${t.name} WordPress theme preview`,className:"w-full h-full object-cover object-top group-hover:scale-105 transition-transform duration-300"}),i.jsx("div",{className:"absolute inset-0 bg-background/80 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:i.jsxs(Y,{variant:"secondary",size:"sm",onClick:H=>{H.stopPropagation(),e==null||e()},children:[i.jsx(Mg,{className:"h-4 w-4 mr-1"}),"Preview"]})})]}),i.jsxs("div",{className:"p-4",children:[i.jsx("h3",{className:"font-semibold text-lg truncate",children:t.name}),t.description&&i.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:t.description})]})]}),i.jsxs(ia,{className:"px-4 pb-4 pt-0 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(tl,{className:`h-4 w-4 ${s?"fill-destructive text-destructive":""}`}),N]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Wn,{className:"h-4 w-4"}),C]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Y,{variant:"ghost",size:"icon",onClick:k,disabled:a,className:"h-8 w-8",children:i.jsx(tl,{className:`h-4 w-4 ${s?"fill-destructive text-destructive":""}`})}),i.jsx(Y,{variant:"ghost",size:"icon",onClick:$,disabled:c,className:"h-8 w-8",children:i.jsx(Wn,{className:"h-4 w-4"})})]})]})]}),i.jsx($3,{open:F,onOpenChange:T,onDownload:K,loading:c,themeName:t.name,creditsRemaining:u,showCreditLabels:_,chargeCredits:!j,onUpgradeNeeded:H=>{w(H),x("export_credits")}}),i.jsx(bl,{open:b!==null,onOpenChange:H=>{H||x(null)},reason:b??"out_of_credits",preHeadlineOverride:`This export will use ${S} credit${S===1?"":"s"}. 🎟️`,continueLabel:`Continue and use ${S} credit${S===1?"":"s"}`,continueBlockedLabel:`You need ${S} credit${S===1?"":"s"} — you have ${u.toFixed(2)}
1919`,onContinueWithCredits:b==="export_credits"&&y&&u>=S?()=>{x(null),K(y)}:void 0})]})}function wne(t={}){const{search:e="",sortBy:r="newest",page:n=1,pageSize:s=12,compatibility:o=[],themeTypes:a=[],industries:l=[]}=t,[c,u]=g.useState([]),[d,h]=g.useState(!0),[m,f]=g.useState(0),v=g.useCallback(async()=>{h(!0);let p=null;if(o.length>0||a.length>0||l.length>0){const S=[];o.length>0&&S.push((async()=>{const{data:P}=await re.from("theme_compatibility").select("theme_id, theme_compatibility_tags!inner(slug)").in("theme_compatibility_tags.slug",o);return[...new Set((P==null?void 0:P.map(C=>C.theme_id))||[])]})()),a.length>0&&S.push((async()=>{const{data:P}=await re.from("theme_types").select("theme_id, theme_type_tags!inner(slug)").in("theme_type_tags.slug",a);return[...new Set((P==null?void 0:P.map(C=>C.theme_id))||[])]})()),l.length>0&&S.push((async()=>{const{data:P}=await re.from("theme_industries").select("theme_id, theme_industry_tags!inner(slug)").in("theme_industry_tags.slug",l);return[...new Set((P==null?void 0:P.map(C=>C.theme_id))||[])]})());const N=await Promise.all(S);if(N.length>0&&(p=N.reduce((P,C)=>P.filter(O=>C.includes(O))),p.length===0)){u([]),f(0),h(!1);return}}let b=re.from("public_themes").select("id, name, description, theme_description, slug, thumbnail_url, download_count, heart_count, published_at, master_html, master_css, version",{count:"exact"});switch(p!==null&&(b=b.in("id",p)),e&&(b=b.or(`name.ilike.%${e}%,description.ilike.%${e}%,theme_description.ilike.%${e}%`)),r){case"most_downloaded":b=b.order("download_count",{ascending:!1});break;case"most_loved":b=b.order("heart_count",{ascending:!1});break;case"newest":default:b=b.order("published_at",{ascending:!1});break}const x=(n-1)*s,y=x+s-1;b=b.range(x,y);const{data:w,error:j,count:_}=await b;!j&&w&&(u(w),f(_||0)),h(!1)},[e,r,n,s,o.join(","),a.join(","),l.join(",")]);return g.useEffect(()=>{v()},[v]),{themes:c,loading:d,totalCount:m,totalPages:Math.ceil(m/s),refetch:v}}function _ne(t){const[e,r]=g.useState(null),[n,s]=g.useState(!0);return g.useEffect(()=>{(async()=>{if(!t)return;s(!0);const{data:a,error:l}=await re.from("public_themes").select("id, name, description, theme_description, slug, thumbnail_url, download_count, heart_count, published_at, master_html, master_css, version").eq("slug",t).maybeSingle();!l&&a&&r(a),s(!1)})()},[t]),{theme:e,loading:n}}function jne({selectedCompatibility:t,selectedTypes:e,selectedIndustries:r,onCompatibilityChange:n,onTypesChange:s,onIndustriesChange:o,onClearAll:a}){const{compatibilityTags:l,typeTags:c,industriesByCategory:u,loading:d}=D1(),[h,m]=g.useState({}),f=t.length+e.length+r.length,v=y=>{t.includes(y)?n(t.filter(w=>w!==y)):n([...t,y])},p=y=>{e.includes(y)?s(e.filter(w=>w!==y)):s([...e,y])},b=y=>{r.includes(y)?o(r.filter(w=>w!==y)):o([...r,y])},x=(y,w)=>{m(j=>({...j,[y]:w}))};return d?i.jsxs("div",{className:"w-64 shrink-0 space-y-4",children:[i.jsx("div",{className:"h-8 bg-muted animate-pulse rounded"}),i.jsx("div",{className:"h-40 bg-muted animate-pulse rounded"}),i.jsx("div",{className:"h-40 bg-muted animate-pulse rounded"})]}):i.jsx("aside",{className:"w-64 shrink-0",children:i.jsxs("div",{className:"sticky top-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"font-semibold",children:"Filters"}),f>0&&i.jsxs(Y,{variant:"ghost",size:"sm",onClick:a,className:"h-auto py-1 px-2 text-xs",children:["Clear all (",f,")"]})]}),i.jsx(Qi,{className:"h-[calc(100vh-200px)]",children:i.jsxs("div",{className:"space-y-6 pr-4",children:[i.jsx(Cy,{title:"Theme Type",defaultOpen:!1,children:i.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:c.map(y=>i.jsx(Ey,{id:`type-${y.slug}`,label:y.name,checked:e.includes(y.slug),onChange:()=>p(y.slug)},y.id))})}),i.jsx(Cy,{title:"Industry",defaultOpen:!1,children:i.jsx("div",{className:"space-y-2",children:Object.entries(u).map(([y,w])=>i.jsxs(Iv,{open:h[y]??!1,onOpenChange:j=>x(y,j),children:[i.jsxs(Ov,{className:"flex items-center gap-1 w-full text-left text-sm font-medium py-1 hover:text-primary transition-colors",children:[h[y]?i.jsx(Hs,{className:"h-3 w-3"}):i.jsx(Gh,{className:"h-3 w-3"}),i.jsx("span",{children:y}),i.jsx(rt,{variant:"secondary",className:"ml-auto text-xs",children:w.filter(j=>r.includes(j.slug)).length||w.length})]}),i.jsx(Mv,{className:"pl-4 pt-1 space-y-1",children:w.map(j=>i.jsx(Ey,{id:`industry-${j.slug}`,label:j.name,checked:r.includes(j.slug),onChange:()=>b(j.slug)},j.id))})]},y))})}),i.jsx(Cy,{title:"Compatibility",defaultOpen:!1,children:l.map(y=>i.jsx(Ey,{id:`compat-${y.slug}`,label:y.name,checked:t.includes(y.slug),onChange:()=>v(y.slug)},y.id))})]})})]})})}function Cy({title:t,defaultOpen:e=!0,children:r}){return i.jsxs(Iv,{defaultOpen:e,children:[i.jsxs(Ov,{className:"flex items-center justify-between w-full py-2 text-sm font-semibold hover:text-primary transition-colors group",children:[i.jsx("span",{children:t}),i.jsx(Gh,{className:"h-4 w-4 transition-transform duration-200 group-data-[state=open]:rotate-90"})]}),i.jsx(Mv,{className:"pt-2 space-y-2",children:r})]})}function Ey({id:t,label:e,checked:r,onChange:n}){return i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(Kn,{id:t,checked:r,onCheckedChange:n}),i.jsx(Xe,{htmlFor:t,className:"text-sm font-normal cursor-pointer leading-tight",children:e})]})}function kne({selectedCompatibility:t,selectedTypes:e,selectedIndustries:r,onRemoveCompatibility:n,onRemoveType:s,onRemoveIndustry:o,onClearAll:a}){const{compatibilityTags:l,typeTags:c,industryTags:u}=D1();if(t.length+e.length+r.length===0)return null;const h=(m,f)=>{var v;return((v=f.find(p=>p.slug===m))==null?void 0:v.name)||m};return i.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[i.jsx("span",{className:"text-sm text-muted-foreground",children:"Active filters:"}),t.map(m=>i.jsxs(rt,{variant:"default",className:"gap-1",children:[h(m,l),i.jsx("button",{type:"button","aria-label":`Remove ${h(m,l)} filter`,onClick:()=>
1919n(m),className:"ml-1 text-primary-foreground/80 hover:text-primary-foreground",children:i.jsx(Bn,{className:"h-3 w-3"})})]},`compat-${m}`)),e.map(m=>i.jsxs(rt,{variant:"default",className:"gap-1",children:[h(m,c),i.jsx("button",{type:"button","aria-label":`Remove ${h(m,c)} filter`,onClick:()=>s(m),className:"ml-1 text-primary-foreground/80 hover:text-primary-foreground",children:i.jsx(Bn,{className:"h-3 w-3"})})]},`type-${m}`)),r.map(m=>i.jsxs(rt,{variant:"default",className:"gap-1",children:[h(m,u),i.jsx("button",{type:"button","aria-label":`Remove ${h(m,u)} filter`,onClick:()=>o(m),className:"ml-1 text-primary-foreground/80 hover:text-primary-foreground",children:i.jsx(Bn,{className:"h-3 w-3"})})]},`industry-${m}`)),i.jsx(Y,{variant:"ghost",size:"sm",onClick:a,className:"h-auto py-1 px-2 text-xs",children:"Clear all"})]})}function vm(){var U,z,oe;const t=Zt(),e=j_(),r=H1(),[n,s]=g.useState(""),[o,a]=g.useState("newest"),[l,c]=g.useState(1),[u,d]=g.useState(null),[h,m]=g.useState(!1),[f,v]=g.useState([]),[p,b]=g.useState([]),[x,y]=g.useState([]),{compatibilityTags:w,typeTags:j,industryTags:_}=D1();g.useEffect(()=>{e.compatibility&&v([e.compatibility]),e.type&&b([e.type]),e.industry&&y([e.industry])},[e.compatibility,e.type,e.industry]);const{themes:S,loading:N,totalPages:P,totalCount:C}=wne({search:n,sortBy:o,page:l,pageSize:12,compatibility:f,themeTypes:p,industries:x}),O=L=>{L.preventDefault(),c(1)},F=()=>{v([]),b([]),y([]),c(1),(e.compatibility||e.type||e.industry)&&t("/themes")},T=L=>{v(q=>q.filter(he=>he!==L)),c(1)},A=L=>{b(q=>q.filter(he=>he!==L)),c(1)},k=L=>{y(q=>q.filter(he=>he!==L)),c(1)},$=()=>{if(e.compatibility==="elementor")return"Elementor Template WordPress Themes - PressMeGPT";const L=[];if(e.compatibility){const q=w.find(he=>he.slug===e.compatibility);q&&L.push(q.name)}if(e.type){const q=j.find(he=>he.slug===e.type);q&&L.push(q.name)}if(e.industry){const q=_.find(he=>he.slug===e.industry);q&&L.push(`for ${q.name}`)}return L.length>0?`${L.join(" ")} WordPress Themes - PressMeGPT`:"AI WordPress Theme Directory - PressMeGPT"},K=()=>{if(e.compatibility==="elementor")return"Browse free Elementor template WordPress themes generated by AI. Import into Elementor (Free) and customize. Created by the community using PressMeGPT.";if(e.industry){const L=_.find(q=>q.slug===e.industry);if(L)return`Download free AI-generated WordPress themes designed for ${L.name}. Created by the community using Press Me GPT.`}if(e.type){const L=j.find(q=>q.slug===e.type);if(L)return`Browse free ${L.name} WordPress themes generated by AI. Created by the community using Press Me GPT.`}if(e.compatibility){const L=w.find(q=>q.slug===e.compatibility);if(L)return`Browse ${L.name} compatible WordPress themes. All themes are AI-generated and free to download.`}return"Browse and download free AI-generated WordPress themes. Created by the community using Press Me GPT - the AI WordPress theme generator."},H=()=>e.compatibility?`${window.location.origin}/themes/compatibility/${e.compatibility}`:e.type?`${window.location.origin}/themes/type/${e.type}`:e.industry?`${window.location.origin}/themes/industry/${e.industry}`:`${window.location.origin}/themes`,W={"@context":"https://schema.org","@type":"CollectionPage",name:$().replace(" - PressMeGPT",""),description:K(),url:H(),numberOfItems:C},R=f.length+p.length+x.length,G=i.jsx(jne,{selectedCompatibility:f,selectedTypes:p,selectedIndustries:x,onCompatibilityChange:L=>{v(L),c(1)},onTypesChange:L=>{b(L),c(1)},onIndustriesChange:L=>{y(L),c(1)},onClearAll:F});return i.jsxs(i.Fragment,{children:[i.jsx(yl,{title:$(),description:K(),canonicalUrl:H(),keywords:"wordpress themes, free themes, AI themes, wordpress templates, theme generator",structuredData:W}),i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{}),i.jsxs("main",{className:"container mx-auto px-4 py-8",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("h1",{className:"text-4xl font-bold mb-4",children:e.compatibility==="elementor"?"Elementor Template WordPress Themes":e.industry&&_.find(L=>L.slug===e.industry)?`WordPress Themes for ${(U=_.find(L=>
1919L.slug===e.industry))==null?void 0:U.name}`:e.type&&j.find(L=>L.slug===e.type)?`${(z=j.find(L=>L.slug===e.type))==null?void 0:z.name} WordPress Themes`:e.compatibility&&w.find(L=>L.slug===e.compatibility)?`${(oe=w.find(L=>L.slug===e.compatibility))==null?void 0:oe.name} WordPress Themes`:"AI WordPress Theme Directory"}),i.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:K()})]}),i.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mb-6",children:[i.jsxs("form",{onSubmit:O,className:"flex-1 flex gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(wp,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),i.jsx(Nt,{type:"search",placeholder:"Search themes...",value:n,onChange:L=>s(L.target.value),className:"pl-10"})]}),i.jsx(Y,{type:"submit",children:"Search"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[r&&i.jsxs(QI,{open:h,onOpenChange:m,children:[i.jsx(JI,{asChild:!0,children:i.jsxs(Y,{variant:"outline",className:"gap-2",children:[i.jsx(EL,{className:"h-4 w-4"}),"Filters",R>0&&i.jsx("span",{className:"bg-primary text-primary-foreground text-xs rounded-full px-1.5 py-0.5",children:R})]})}),i.jsxs(s1,{side:"left",className:"w-80",children:[i.jsx(ZI,{children:i.jsx(e4,{children:"Filter Themes"})}),i.jsx("div",{className:"mt-4",children:G})]})]}),i.jsx(zL,{className:"h-4 w-4 text-muted-foreground"}),i.jsxs(Vs,{value:o,onValueChange:L=>a(L),children:[i.jsx(bs,{className:"w-[180px]",children:i.jsx(Ks,{placeholder:"Sort by"})}),i.jsxs(ws,{children:[i.jsx(Lr,{value:"newest",children:"Newest First"}),i.jsx(Lr,{value:"most_downloaded",children:"Most Downloaded"}),i.jsx(Lr,{value:"most_loved",children:"Most Loved"})]})]})]})]}),i.jsx(kne,{selectedCompatibility:f,selectedTypes:p,selectedIndustries:x,onRemoveCompatibility:T,onRemoveType:A,onRemoveIndustry:k,onClearAll:F}),i.jsxs("div",{className:"flex gap-8",children:[!r&&G,i.jsxs("div",{className:"flex-1",children:[i.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[C," theme",C!==1?"s":""," found"]}),N?i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Array.from({length:6}).map((L,q)=>i.jsx("div",{className:"aspect-video bg-muted rounded-lg animate-pulse"},q))}):S.length===0?i.jsxs("div",{className:"text-center py-16",children:[i.jsx("p",{className:"text-lg text-muted-foreground mb-4",children:"No themes found"}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:R>0?"Try adjusting your filters":n?"Try a different search term":"Be the first to create a theme!"}),R>0?i.jsx(Y,{onClick:F,variant:"outline",children:"Clear Filters"}):!n&&i.jsx(Y,{onClick:()=>t("/auth"),children:"Create a Theme"})]}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:S.map(L=>i.jsx(bne,{theme:L,onPreview:()=>d(L)},L.id))}),P>1&&i.jsx("div",{className:"mt-8",children:i.jsx(R3,{children:i.jsxs(I3,{children:[i.jsx(Gm,{children:i.jsx(O3,{onClick:()=>c(Math.max(1,l-1)),className:l===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:Math.min(5,P)},(L,q)=>{let he;return P<=5||l<=3?he=q+1:l>=P-2?he=P-4+q:he=l-2+q,i.jsx(Gm,{children:i.jsx(Dv,{onClick:()=>c(he),isActive:l===he,className:"cursor-pointer",children:he})},he)}),i.jsx(Gm,{children:i.jsx(M3,{onClick:()=>c(Math.min(P,l+1)),className:l===P?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})]})]}),i.jsx("footer",{className:"border-t bg-card py-8 mt-16",children:i.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/privacy",className:"hover:text-foreground transition-colors",children:"Privacy Policy"}),i.jsx("a",{href:"/terms",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),i.jsx("a",{href:"/sitemap.txt",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Sitemap"}),i.jsx("a",{href:"https://pressmegpt.endorsely.com/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Affiliate Program"})]}),i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/themes",className:"hover:text-foreground transition-colors",children:"WordPress Theme Directory"}),i.jsx("a",{href:"https://blog.pressmegpt.com/ai-wordpress-theme-generator/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Theme Generators"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-10-best-wordpress-ai-website-builders-for-rapid-web-design/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Website Builders"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-top-10-wordpress-theme-builder
1919-software-solutions/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Theme Builder Software"}),i.jsx("a",{href:"https://blog.pressmegpt.com/how-to-customize-a-wordpress-theme-with-ai/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Customize a Theme with AI"})]}),i.jsxs("p",{children:["© ",new Date().getFullYear()," PressMeGPT. All rights reserved."]})]})})]}),i.jsx(Xt,{open:!!u,onOpenChange:()=>d(null),children:i.jsx(Qt,{className:"max-w-6xl h-[90vh] overflow-hidden",children:u&&i.jsx("div",{className:"h-full w-full min-h-0 pt-2",children:i.jsx(wl,{html:u.master_html||"",css:u.master_css||""})})})})]})}var Sne="Separator",P2="horizontal",Nne=["horizontal","vertical"],D3=g.forwardRef((t,e)=>{const{decorative:r,orientation:n=P2,...s}=t,o=Cne(n)?n:P2,l=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return i.jsx(Me.div,{"data-orientation":o,...l,...s,ref:e})});D3.displayName=Sne;function Cne(t){return Nne.includes(t)}var F3=D3;const qm=g.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},s)=>i.jsx(F3,{ref:s,decorative:r,orientation:e,className:Se("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));qm.displayName=F3.displayName;const Py=1280;function Ene({html:t,css:e}){const r=g.useRef(null),[n,s]=g.useState({width:Py,height:720});g.useEffect(()=>{const a=r.current;if(!a)return;const l=()=>s({width:a.clientWidth,height:a.clientHeight});l();const c=new ResizeObserver(l);return c.observe(a),()=>c.disconnect()},[]);const o=n.width>0?n.width/Py:1;return i.jsx("div",{ref:r,className:"relative h-[72vh] min-h-[520px] overflow-hidden bg-white",children:i.jsx("div",{className:"absolute left-0 top-0",style:{width:Py,height:n.height/o,transform:`scale(${o})`,transformOrigin:"top left"},children:i.jsx(wl,{html:t,css:e})})})}function Pne(){var X;const{slug:t}=j_(),e=Zt(),{user:r}=$t(),{theme:n,loading:s}=_ne(t||""),{tags:o,loading:a}=HZ(n==null?void 0:n.id),{isFavorited:l,toggleFavorite:c,loading:u}=iO(n==null?void 0:n.id),{downloadTheme:d,loading:h}=p1(),{creditsRemaining:m,refreshSubscription:f,plan:v,source:p,subscriptionEnd:b,isSuperAdmin:x,trialStatus:y}=nn(),[w,j]=g.useState(!1),[_,S]=g.useState(!1),{track:N}=ro(),[P,C]=g.useState(null),[O,F]=g.useState(null),T=iu({plan:v,source:p,subscriptionEnd:b,isSuperAdmin:x,trialActive:y==="active"}),A=!iu({plan:v,source:p,subscriptionEnd:b,isSuperAdmin:x}),k=$v(O??"classic"),[$,K]=g.useState(0),[H,W]=g.useState(0);g.useEffect(()=>{n&&(K(n.heart_count||0),W(n.download_count||0),N("ViewContent",{content_name:n.name,content_type:"theme"}))},[n]);const R=async()=>{if(!r){e("/auth?redirect="+encodeURIComponent(`/themes/${t}`));return}const J=l;K(le=>J?le-1:le+1),await c()||K(le=>J?le+1:le-1)},G=()=>{if(!r){e("/auth?redirect="+encodeURIComponent(`/themes/${t}`));return}S(!0)},U=async J=>{if(!n)return;W(le=>le+1);const de=await d({id:n.id,name:n.name,master_html:n.master_html,master_css:n.master_css,version:n.version,thumbnail_url:n.thumbnail_url},J);if(de.insufficientCredits){W(le=>le-1),F(J),C("export_credits");return}de.success?f():W(le=>le-1)};if(s)return i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Loading theme..."})});if(!n)return i.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center",children:[i.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Theme Not Found"}),i.jsx("p",{className:"text-muted-foreground mb-4",children:"This theme doesn't exist or has been removed."}),i.jsx(Y,{onClick:()=>e("/themes"),children:"Browse Themes"})]});const z={"@context":"https://schema.org","@type":"SoftwareApplication",name:n.name,description:n.description||n.theme_description,applicationCategory:"WordPress Theme",operatingSystem:"WordPress",offers:{"@type":"Offer",price:"0",priceCurrency:"USD"},aggregateRating:{"@type":"AggregateRating",ratingValue:"5",ratingCount:n.heart_count||1}},oe=((X=o.themeType)==null?void 0:X.name)||(o.industries.length>0?o.industries[0].name:null),L=oe?`${n.name} - WordPress Theme for ${oe} | PressMeGPT.com`:`${n.name} - WordPress Theme | PressMeGPT.com`,q=o.industries.map(J=>J.name).join(", "),he=[n.name,"wordpress theme",oe?`wordpress theme for ${oe.toLowerCase()}
1919`:"",q,"free theme","AI theme"].filter(Boolean).join(", ");return i.jsxs(i.Fragment,{children:[i.jsx(yl,{title:L,description:n.description||n.theme_description||`Download ${n.name}, a free AI-generated WordPress theme${oe?` for ${oe}`:""} from PressMeGPT.`,canonicalUrl:`${window.location.origin}/themes/${t}`,ogImage:n.thumbnail_url||void 0,ogType:"article",keywords:he,structuredData:z}),i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{}),i.jsxs("main",{className:"container mx-auto px-4 py-8",children:[i.jsxs(Y,{variant:"ghost",onClick:()=>e("/themes"),className:"mb-6",children:[i.jsx(OP,{className:"h-4 w-4 mr-2"}),"Back to Themes"]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[i.jsxs("div",{className:"lg:col-span-2",children:[i.jsx(dt,{className:"overflow-hidden",children:i.jsx(ct,{className:"p-0",children:i.jsx("div",{className:"relative bg-muted",children:n.master_html?i.jsx(Ene,{html:n.master_html||"",css:n.master_css||""}):n.thumbnail_url?i.jsx("img",{src:n.thumbnail_url,alt:`${n.name} WordPress theme preview`,className:"w-full h-[72vh] min-h-[520px] object-contain object-top"}):i.jsx("div",{className:"w-full h-[72vh] min-h-[520px] flex items-center justify-center text-muted-foreground",children:"No preview available"})})})}),i.jsxs(Y,{variant:"outline",className:"mt-4 w-full",onClick:()=>j(!0),children:[i.jsx(Mg,{className:"h-4 w-4 mr-2"}),"View Full Screen Preview"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold mb-2",children:n.name}),i.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(tl,{className:`h-4 w-4 ${l?"fill-destructive text-destructive":""}`}),$," likes"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Wn,{className:"h-4 w-4"}),H," downloads"]})]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(Y,{variant:l?"secondary":"outline",onClick:R,disabled:u,className:"flex-1",children:[i.jsx(tl,{className:`h-4 w-4 mr-2 ${l?"fill-current":""}`}),l?"Saved":"Save"]}),i.jsxs(Y,{onClick:G,disabled:h,className:"flex-1",children:[i.jsx(Wn,{className:"h-4 w-4 mr-2"}),"Download"]})]}),i.jsx(qm,{}),n.description&&i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold mb-2",children:"Description"}),i.jsx("p",{className:"text-muted-foreground",children:n.description})]}),n.theme_description&&i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold mb-2",children:"Design Prompt"}),i.jsx(dt,{children:i.jsx(ct,{className:"p-4",children:i.jsxs("p",{className:"text-sm text-muted-foreground italic",children:['"',n.theme_description,'"']})})})]}),!a&&(o.compatibility.length>0||o.themeType||o.industries.length>0)&&i.jsxs(i.Fragment,{children:[i.jsx(qm,{}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold mb-3",children:"Categories & Tags"}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.compatibility.map(J=>i.jsx(No,{to:`/themes/compatibility/${J.slug}`,children:i.jsx(rt,{variant:"outline",className:"cursor-pointer hover:bg-accent transition-colors",children:J.name})},J.id)),o.themeType&&i.jsx(No,{to:`/themes/type/${o.themeType.slug}`,children:i.jsx(rt,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 transition-colors",children:o.themeType.name})}),o.industries.map(J=>i.jsx(No,{to:`/themes/industry/${J.slug}`,children:i.jsx(rt,{className:"cursor-pointer hover:bg-primary/80 transition-colors",children:J.name})},J.id))]})]})]}),i.jsx(qm,{}),i.jsx(dt,{className:"bg-accent/10 border-accent/30",children:i.jsxs(ct,{className:"p-4 text-center",children:[i.jsx("h3",{className:"font-semibold mb-2",children:"Remix this WordPress Theme with AI"}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your own version of this WordPress theme with AI"}),i.jsxs(Y,{onClick:()=>e(`/auth?remix=${n.id}`),className:"w-full bg-accent hover:bg-accent/90 text-accent-foreground font-semibold",children:[i.jsx(BL,{className:"h-4 w-4 mr-2"}),"Remix This Theme for Free"]})]})}),i.jsx(dt,{className:"bg-primary/5 border-primary/20",children:i.jsxs(ct,{className:"p-4 text-center",children:[i.jsx("h3",{className:"font-semibold mb-2",children:"Create your own WordPress Theme with AI"}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Generate a custom WordPress theme with AI in minutes."}),i.jsxs(Y,{onClick:()=>e("/auth?mode=signup"),className:"w-full",children:[i.jsx(Bi,{className:"h-4 w-4 mr-2"}),"Start Free Trial"]})]})})]})]})]}),i.jsx("footer",{className:"border-t bg-card py-8 mt-16",children:i.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/privacy",className:"hover:text-foreground transition-colors",children:"Privacy Policy"}),i.jsx("a",{href:"/terms",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),i.jsx("a",{href:"/sitemap.txt",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Sitemap"}),i.jsx("a",{href:"https://pressmegpt.endorsely.com/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Affiliate Program"})]}),i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/themes",className:"hover:text-foreground transition-colors",children:"WordPress Theme Directory"}),i.jsx("a",{href:"https://blog.pressmegpt.com/ai-wordpress-theme-generator/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Theme Generators"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-10-best-wordpress-ai-website-builders-for-rapid-web-design/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Website Builders"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-top-10-wordpress-theme-builder
1919-software-solutions/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Theme Builder Software"}),i.jsx("a",{href:"https://blog.pressmegpt.com/how-to-customize-a-wordpress-theme-with-ai/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Customize a Theme with AI"})]}),i.jsxs("p",{children:["© ",new Date().getFullYear()," PressMeGPT. All rights reserved."]})]})})]}),i.jsx(Xt,{open:w,onOpenChange:j,children:i.jsx(Qt,{className:"max-w-[95vw] w-full h-[95vh]",children:i.jsx(wl,{html:n.master_html||"",css:n.master_css||"",showNavigation:!0})})}),n&&i.jsx($3,{open:_,onOpenChange:S,onDownload:U,loading:h,themeName:n.name,creditsRemaining:m,showCreditLabels:A,chargeCredits:!T,onUpgradeNeeded:J=>{F(J),C("export_credits")}}),i.jsx(bl,{open:P!==null,onOpenChange:J=>{J||C(null)},reason:P??"out_of_credits",preHeadlineOverride:`This export will use ${k} credit${k===1?"":"s"}. 🎟️`,continueLabel:`Continue and use ${k} credit${k===1?"":"s"}`,continueBlockedLabel:`You need ${k} credit${k===1?"":"s"} — you have ${m.toFixed(2)}`,onContinueWithCredits:P==="export_credits"&&O&&m>=k?()=>{C(null),U(O)}:void 0})]})}function Tne(){return i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(yl,{title:"Privacy Policy - PressMeGPT",description:"Privacy Policy for PressMeGPT.com - Learn how we collect, use, and protect your personal information.",canonicalUrl:"https://pressmegpt.com/privacy"}),i.jsx(zr,{}),i.jsxs("main",{className:"container mx-auto px-4 py-12 max-w-4xl",children:[i.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Privacy Policy for PressMeGPT.com"}),i.jsx("p",{className:"text-muted-foreground mb-8",children:"Effective Date: January 16, 2026"}),i.jsxs("div",{className:"prose prose-gray dark:prose-invert max-w-none space-y-8",children:[i.jsx("p",{className:"text-lg",children:'PressMeGPT.com ("we," "our," "us") values your privacy and is committed to protecting your personal information. This Privacy Policy explains what information we collect, how we use it, and your rights regarding that information when you visit or use our website, located at PressMeGPT.com ("Site").'}),i.jsx("p",{children:"By accessing or using our Site, you agree to the terms of this Privacy Policy."}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"1. Information We Collect"}),i.jsx("h3",{className:"text-xl font-medium mb-2",children:"1.1 Information You Provide"}),i.jsx("p",{className:"mb-4",children:"We may collect the following types of information when you interact with our Site:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsxs("li",{children:[i.jsx("strong",{children:"Account Information:"})," If you register for an account or subscribe to our services, we may collect your name and email address."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Content You Create:"})," Themes you generate using our free plan may be published and displayed on our public WordPress Theme Directory Page. By generating themes, you agree that non-personally identifiable aspects of your submissions may be publicly displayed."]})]}),i.jsx("h3",{className:"text-xl font-medium mb-2 mt-6",children:"1.2 Automatically Collected Information"}),i.jsx("p",{className:"mb-4",children:"We may automatically collect certain information when you visit our Site:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsxs("li",{children:[i.jsx("strong",{children:"Log Data:"})," Such as IP address, browser type, pages visited, date/time stamps, and click data."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Device and Usage Data:"})," Information about your device and how you interact with the Site to help improve performance and user experience."]})]})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"2. How We Use Your Information"}),i.jsx("p",{className:"mb-4",children:"We use information we collect to:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"Provide, operate, and improve the Site."}),i.jsx("li",{children:"Personalize user experience."}),i.jsx("li",{children:"Communicate with you about our services and updates."}),i.jsx("li",{children:"Monitor usage to protect the security and integrity of the Site."}),i.jsx("li",{children:"Publish submitted themes or content (only publicly visible, non-
1919personal content as consented to)."})]}),i.jsx("p",{className:"mt-4",children:"We do not use the information we collect for unrelated purposes without your consent."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"3. Information Sharing and Disclosure"}),i.jsx("p",{className:"mb-4",children:"We respect your privacy and do not share personal information with third parties, except in the limited circumstances described below:"}),i.jsx("h3",{className:"text-xl font-medium mb-2",children:"3.1 Third-Party Service Providers"}),i.jsx("p",{className:"mb-4",children:"We may share your information with trusted third-party service providers who assist us in operating the Site (e.g., hosting providers, analytics services). These providers are obligated to protect your information and only use it to perform services on our behalf."}),i.jsx("h3",{className:"text-xl font-medium mb-2",children:"3.2 Theme Directory"}),i.jsx("p",{className:"mb-4",children:"Themes or similar creative content generated on the free plan may be shared and displayed publicly on our WordPress Theme Directory Page. These are limited to the creative elements themselves and do not include any personally identifiable information unless explicitly provided."}),i.jsx("h3",{className:"text-xl font-medium mb-2",children:"3.3 Legal Requirements"}),i.jsx("p",{children:"We may disclose your information if required by law, by legal process, or to protect the rights, property, or safety of PressMeGPT.com, its users, or others."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"4. Data Retention"}),i.jsx("p",{children:"We retain information as long as necessary to provide services, comply with legal obligations, resolve disputes, and enforce our agreements."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"5. Children's Privacy"}),i.jsx("p",{className:"mb-4",children:"We do not knowingly collect or solicit personal information from minors under the age of 18 (or the applicable age of digital consent in your jurisdiction). If we learn that we have collected personal information from a minor without verification of parental consent, we will take steps to delete such information as soon as possible."}),i.jsx("p",{children:"If you believe that we may have any information from a minor, contact us at the email address below."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"6. Your Rights and Choices"}),i.jsx("p",{className:"mb-4",children:"Depending on your jurisdiction, you may have rights regarding your personal information, including:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"The right to access or correct your information."}),i.jsx("li",{children:"The right to request deletion of your personal data."}),i.jsx("li",{children:"The right to withdraw consent at any time (where applicable)."})]}),i.jsx("p",{className:"mt-4",children:"To exercise any of these rights, please contact us at the information below. We will respond in accordance with applicable law."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"7. Security"}),i.jsx("p",{children:"We implement reasonable administrative, technical, and physical security measures to protect your information. However, no method of transmission or storage is 100% secure, and we cannot guarantee absolute security."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"8. Third-Party Links"}),i.jsx("p",{children:"Our Site may contain links to third-party websites. We are not responsible for the privacy practices or content of those sites. We encourage you to review the privacy policies of any third-party sites you visit."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"9. Changes to This Privacy Policy"}),i.jsx("p",{children:'We may update this Privacy Policy from time to time. When we do, we will revise the "Effective Date" at the top of this page. C
1919ontinued use of the Site after changes are made constitutes acceptance of the updated policy.'})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"10. Contact Us"}),i.jsx("p",{children:"If you have questions about this Privacy Policy or wish to exercise your rights regarding your data, please contact us at:"}),i.jsx("p",{className:"mt-2",children:i.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"[email protected]"})})]})]})]}),i.jsx("footer",{className:"border-t border-border/50 py-8 px-4 bg-card/50 mt-16",children:i.jsxs("div",{className:"container mx-auto text-center text-sm text-muted-foreground",children:[i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/privacy",className:"hover:text-foreground transition-colors",children:"Privacy Policy"}),i.jsx("a",{href:"/terms",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),i.jsx("a",{href:"/sitemap.txt",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Sitemap"}),i.jsx("a",{href:"https://pressmegpt.endorsely.com/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Affiliate Program"})]}),i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/themes",className:"hover:text-foreground transition-colors",children:"WordPress Theme Directory"}),i.jsx("a",{href:"https://blog.pressmegpt.com/ai-wordpress-theme-generator/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Theme Generators"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-10-best-wordpress-ai-website-builders-for-rapid-web-design/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Website Builders"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-top-10-wordpress-theme-builder-software-solutions/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Theme Builder Software"}),i.jsx("a",{href:"https://blog.pressmegpt.com/how-to-customize-a-wordpress-theme-with-ai/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Customize a Theme with AI"})]}),i.jsxs("p",{children:["© ",new Date().getFullYear()," PressMeGPT. All rights reserved."]})]})})]})}const Ane=()=>(g.useEffect(()=>{if(window.location.hash){const t=window.location.hash.substring(1);setTimeout(()=>{var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth"})},100)}},[]),i.jsxs(i.Fragment,{children:[i.jsx(yl,{title:"Terms of Service - PressMeGPT",description:"Terms of Service for PressMeGPT.com - AI WordPress Theme Generator",canonicalUrl:"https://pressmegpt.com/terms"}),i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{}),i.jsxs("main",{className:"container mx-auto px-4 py-12 max-w-4xl",children:[i.jsx("h1",{className:"text-4xl font-bold mb-8",children:"Terms of Service for PressMeGPT.com"}),i.jsx("p",{className:"text-muted-foreground mb-8",children:"Effective Date: February 9, 2026"}),i.jsxs("div",{className:"prose prose-lg dark:prose-invert max-w-none space-y-8",children:[i.jsx("p",{children:'Welcome to PressMeGPT.com ("PressMeGPT," "we," "our," or "us"). These Terms of Service ("Terms") govern your access to and use of our website, products, and services (collectively, the "Service").'}),i.jsx("p",{children:"PressMeGPT provides creative assistance tools only and does not function as a website publisher, design agency, software development firm, legal advisor, or rights-clearance service."}),i.jsx("p",{children:"By accessing or using PressMeGPT.com, you agree to be bound by these Terms. If you do not agree, do not use the Service."}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"1. Eligibility"}),i.jsx("p",{children:"You must be at least 18 years old, or the age of majority in your jurisdiction, to use the Service."}),i.jsx("p",{children:"We do not knowingly allow minors to create accounts or use PressMeGPT. By using the Service, you represent that you meet this requirement."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"2. Description of the Service"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"PressMeGPT provides AI-powered tools that generate WordPress themes, layouts, and related content."}),i.jsx("li",{children:"The Service may include free and paid plans."}),i.jsx("li",{children:"Features and limitations vary by plan and may change over time."}),i.jsx("li",{children:"We reserve the right to modify, suspend, or discontinue any part of the Service at any time."})]})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"3. Accounts"}),i.jsx("p",{children:"To access certain features, you may be required to create an account."}),i.jsx("p",{children:"You agree to:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"Provide accurate and current information."}),i.jsx("li",{children:"Maintain the security of your login credentials."}),i.jsx("li",{children:"Accept responsibility for all activity under your account."})]}),i.jsx("p",{children:"We are not responsible for any loss or damage resulting from unauthorized account access."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"4. User Content & Theme Generation"}),i.jsx("h3",{className:"text-xl font-medium mb-2",children:"4.1 Ownership"}),i.jsx("p",{children:"You retain ownership of any content you input into PressMeGPT."}),i.jsx("p",{children:"Subject to these Terms:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"Paid plan users retain rights to themes they generate, subject to applicable licensing terms."}),i.jsx("li",{children:"Free plan themes may be shared publicly."})]}),i.jsx("h3",{className:"text-xl font-medium mb-2 mt-4",children:"4.2 Public Theme Directory (Free Plan)"}),i.jsx("p",{children:"By using the free plan, you agree that:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"Themes may be publicly displayed, shared, remixed, or downloaded via our directory."}),i.jsx("li",{children:"Shared themes do not include personal identifying information unless intentionally included by you."}),i.jsx("li",{children:"You grant PressMeGPT a non-exclusive, worldwide, royalty-free license to display, distribute, and promote these themes."})]})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"5. Acceptable Use"}),i.jsx("p",{children:"You agree not to:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"Use the Service for unlawful purposes."}),i.jsx("li",{children:"Generate malicious, deceptive, or harmful content."}
1919),i.jsx("li",{children:"Reverse engineer, exploit, or abuse the Service."}),i.jsx("li",{children:"Circumvent usage limits, credit systems, or pricing controls."}),i.jsx("li",{children:"Use unauthorized trademarks, copyrighted materials, or proprietary designs."}),i.jsx("li",{children:"Generate pornographic, sexually explicit, exploitative, or adult-oriented commercial content."}),i.jsx("li",{children:"Impersonate individuals or misrepresent affiliations."})]}),i.jsx("p",{children:"PressMeGPT may suspend or terminate accounts that violate these rules."})]}),i.jsxs("section",{id:"refund-policy",style:{scrollMarginTop:"2rem"},children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"6. Payments, Subscriptions & Credits"}),i.jsx("p",{children:"If you purchase a paid plan:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"Fees are billed in advance on a recurring basis unless otherwise stated."}),i.jsx("li",{children:"AI usage may be subject to credit limits."}),i.jsx("li",{children:"Unused credits may expire depending on your plan."}),i.jsx("li",{children:"Prices may change but will not apply retroactively."})]}),i.jsx("h3",{className:"text-xl font-medium mb-2 mt-6",children:"6.1 Refund Policy & Guarantee"}),i.jsx("p",{children:"All purchases are protected with a 30-day money-back guarantee, with exceptions as outlined below:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-3",children:[i.jsxs("li",{children:[i.jsx("strong",{children:"Monthly accounts"})," that use less than 30% of their credits and request a refund within 30 days can receive 100% of their purchase price."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Monthly accounts"})," that use 30% or more of their credits and request a refund within 30 days can receive a prorated refund to match the credits not used."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Annual accounts"})," that use less than 20% of their credits and request a refund within 30 days can receive 100% of their purchase price."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Annual accounts"})," that use 20% or more of their credits and request a refund within 30 days can receive a prorated refund to match the credits not used."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"One-time accounts"})," that use less than 20 of their credits and request a refund within 30 days can receive 100% of their purchase price."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"One-time accounts"})," that use 20 or more credits and request a refund within 30 days can receive a prorated refund to match the credits not used."]})]}),i.jsx("p",{className:"mt-3",children:"All refunds are for the current billing period (current year, month, or one-time purchase) and limited to 30 days after purchase."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"7. Intellectual Property & Generated Content Responsibility"}),i.jsx("p",{children:"You are solely responsible for ensuring that Generated Content does not infringe copyrights, trademarks, or other intellectual property rights."}),i.jsx("p",{children:"PressMeGPT does not verify licensing status or authorized use of themes, media assets, icons, graphics, fonts, or creative elements."}),i.jsx("p",{children:"You agree to:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"Obtain all necessary licenses and permissions."}),i.jsx("li",{children:"Confirm authorized or royalty-free use."}),i.jsx("li",{children:"Review Generated Content prior to publication or commercialization."})]})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"8. AI Services, Training Data & Output Limitations"}),i.jsx("p",{children:"PressMeGPT uses artificial intelligence systems trained on mixtures of publicly available information, licensed materials, synthetic datasets, and generalized design patterns."}),i.jsx("p",{children:"You acknowledge that:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"Outputs may contain inaccuracies or unintended similarities to existing works."}),i.jsx("li",{children:"Generated themes may resemble existing layouts or design styles."}),i.jsx("li",{children:"Similarity does not imply copying or reproduction of proprietary works."}),i.jsx("li",{children:"PressMeGPT makes no guarantees that Generated Content will be unique, original, or suitable for commercial deployment."})]}),i.jsx("p",{children:"You may not attempt to probe datasets, reverse engineer models, or identify training sources."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"9. Intended Use; No Adult Platform"}),i.jsx("p",{children:"The Service is intended for lawful business and creative purposes. PressMeGPT is not designed, marketed, or intended for adult entertainment or pornographic content distribution."}),i.jsx("p",{children:"We may remove such content and terminate associated accounts at our sole discretion."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"10. Availability, AI Limitations & Platform Neutrality"}),i.jsx("p",{children:"PressMeGPT relies on AI systems and third-party infrastru
1919cture."}),i.jsx("p",{children:"You acknowledge that:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"Outputs may be inaccurate or incomplete."}),i.jsx("li",{children:"Generated themes should be reviewed before production use."}),i.jsx("li",{children:"We do not guarantee uptime, availability, or error-free results."}),i.jsx("li",{children:'The Service is provided "as is" and "as available."'})]}),i.jsx("p",{children:"PressMeGPT operates solely as a technology platform enabling user-generated outputs and claims applicable safe-harbor protections under law."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"11. No Warranty of SEO Performance or Commercial Outcomes"}),i.jsx("p",{children:"PressMeGPT provides creative tools only and does not guarantee:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"search engine rankings or SEO performance;"}),i.jsx("li",{children:"conversion rates, revenue results, or marketing effectiveness;"}),i.jsx("li",{children:"compliance with accessibility or industry-specific regulations."})]}),i.jsx("p",{children:"Users remain responsible for validating Generated Content for business use."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"12. No Professional or Agency Relationship"}),i.jsx("p",{children:"Your use of the Service does not create any agency, partnership, joint venture, fiduciary, or professional relationship between you and PressMeGPT."}),i.jsx("p",{children:"PressMeGPT does not provide professional design, development, legal, compliance, or consulting services. Any reliance on Generated Content is at your sole discretion and risk."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"13. Termination"}),i.jsx("p",{children:"We may suspend or terminate your access if:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"You violate these Terms."}),i.jsx("li",{children:"You misuse the Service."}),i.jsx("li",{children:"Required by law."})]}),i.jsx("p",{children:"You may stop using the Service at any time."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"14. Disclaimer of Warranties"}),i.jsx("p",{children:"To the maximum extent permitted by law, PressMeGPT disclaims all warranties, express or implied, including merchantability, fitness for a particular purpose, and non-infringement."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"15. Limitation of Liability"}),i.jsx("p",{children:"To the fullest extent permitted by law, PressMeGPT shall not be liable for indirect, incidental, consequential, special, or punitive damages, including loss of data, revenue, or business."}),i.jsx("p",{children:"Our total cumulative liability shall not exceed the greater of:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"the amount paid by you to PressMeGPT during the twelve (12) months preceding the claim; or"}),i.jsx("li",{children:"one hundred U.S. dollars (USD $100)."})]})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"16. Indemnification"}),i.jsx("p",{children:"You agree to defend, indemnify, and hold harmless PressMeGPT from claims, damages, or expenses arising from:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"your use of Generated Content;"}),i.jsx("li",{children:"your violation of these Terms;"}),i.jsx("li",{children:"your failure to obtain appropriate rights or permissions."})]})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"17. Dispute Resolution; Arbitration & Class Action Waiver"}),i.jsx("p",{children:"Any dispute arising from these Terms or the Service shall be resolved through binding individual arbitration."}),i.jsx("p",{children:"You agree that:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[i.jsx("li",{children:"disputes will be conducted on an individual basis only;"}),i.jsx("li",{children:"class actions and representative claims are waived;"}),i.jsx("li",{children:"arbitration shall be conducted in the State of Florida and administered by a nationally recognized arbitration provider under applicable commercial rules."})]}),i.jsx("p",{children:"Either party may seek injunctive relief for intellectual property violations where permitted by law."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"18. Governing Law; Venue"}),i.jsx("p",{children:"These Terms and any dispute arising from them shall be governed by the laws of the State of Florida, without regard to its conflict of law principles."}),i.jsx("p",{children:"Subject to arbitration, the state and federal courts located in the State of Florida shall have exclusive jurisdiction and venue over any permitted court proceedings, and the parties consent to such jurisdiction."})]}),i.jsxs("section",{children:[i.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"19. Changes to These Terms"}),i.jsx("p",{children:"We may update these Terms from time to time. Continued use of the Service after changes become effective constitutes acceptance of the revised Terms."})]})]})]}),i.jsx("footer",{className:"border-t border-border/40 py-8 mt-16",children:i.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx(No,{to:"/",className:"hover:text-foreground transition-colors",children:"Home"}),i.jsx(No,{to:"/pricing",className:"hover:text-foreground transition-colors",children:"Pricing"}),i.jsx(No,{to:"/privacy",className:"hover:text-foreground transition-colors",children:"Privacy Policy"}),i.jsx(No,{to:"/terms",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),i.jsx("a",{href:"/sitemap.txt",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Sitemap"}),i.jsx("a",{href:"https://pressmegpt.endorsely.com/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Affiliate Program"})]}),i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx(No,{to:"/themes",className:"hover:text-foreground transition-colors",children:"WordPress Theme Directory"}),i.jsx("a",{href:"https://blog.pressmegpt.com/ai-wordpress-theme-generator/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Theme Generators"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-10-best-wordpress-ai-website-builders-for-rapid-web-design/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Website Builders"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-top-10-wordpress-theme-builder
1919-software-solutions/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Theme Builder Software"}),i.jsx("a",{href:"https://blog.pressmegpt.com/how-to-customize-a-wordpress-theme-with-ai/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Customize a Theme with AI"})]}),i.jsxs("p",{children:["© ",new Date().getFullYear()," PressMeGPT. All rights reserved."]})]})})]})]}));function Rne(){const[t,e]=g.useState(""),[r,n]=g.useState(!0),[s,o]=g.useState(null);return g.useEffect(()=>{(async()=>{try{const l=await fetch("https://tmixwolpvcqsnzjfxkly.supabase.co/functions/v1/generate-sitemap?format=txt");if(!l.ok)throw new Error("Failed to load sitemap");const c=await l.text();e(c)}catch(l){o(l instanceof Error?l.message:"Unknown error")}finally{n(!1)}})()},[]),r?i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Loading sitemap..."})}):s?i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsxs("div",{className:"text-destructive",children:["Error: ",s]})}):i.jsxs(i.Fragment,{children:[i.jsx(yl,{title:"Sitemap - PressMeGPT",description:"Sitemap for PressMeGPT - AI WordPress Theme Generator",canonicalUrl:`${window.location.origin}/sitemap`}),i.jsxs("div",{className:"min-h-screen bg-background p-8",children:[i.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Sitemap"}),i.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-auto text-sm font-mono whitespace-pre-wrap break-all",children:t})]})]})}function T2(){const[t]=eo(),e=Zt(),r=Zi(),n=t.get("welcome")==="true"||r.pathname.startsWith("/activate"),[s,o]=g.useState("checking"),[a,l]=g.useState(""),[c,u]=g.useState(""),[d,h]=g.useState(!1);g.useEffect(()=>{let f=!1;const{data:{subscription:v}}=re.auth.onAuthStateChange((b,x)=>{b==="PASSWORD_RECOVERY"&&x&&(f=!0,o("form"))});re.auth.getSession().then(({data:{session:b}})=>{b&&!f&&(f=!0,o("form"))});const p=setTimeout(()=>{f||o("invalid")},1500);return()=>{v.unsubscribe(),clearTimeout(p)}},[]);const m=async f=>{if(f.preventDefault(),a.length<6){Q.error("Password must be at least 6 characters");return}if(a!==c){Q.error("Passwords do not match");return}h(!0);try{const{error:v}=await re.auth.updateUser({password:a});if(v){const p=v.message||"Failed to reset password. Please try again.";/expired|invalid|session/i.test(p)?o("invalid"):Q.error(p),h(!1);return}o("success"),Q.success("Password set successfully!"),setTimeout(()=>{n?e("/dashboard"):re.auth.signOut().finally(()=>e("/auth"))},2e3)}catch{Q.error("An unexpected error occurred."),h(!1)}};return i.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/10 via-background to-accent/10"}),i.jsx("div",{className:"absolute top-0 left-1/4 w-96 h-96 bg-primary/20 rounded-full blur-3xl"}),i.jsx("div",{className:"absolute bottom-0 right-1/4 w-96 h-96 bg-accent/20 rounded-full blur-3xl"}),i.jsx("div",{className:"relative z-10",children:i.jsx(zr,{})}),i.jsx("div",{className:"relative z-10 flex items-center justify-center p-4 min-h-[calc(100vh-80px)]",children:i.jsxs(dt,{className:"w-full max-w-md relative bg-card/80 backdrop-blur-sm shadow-2xl border-border/50",children:[i.jsx(ir,{className:"text-center",children:i.jsx("div",{className:"flex justify-center mb-4",children:i.jsx("img",{src:Zp,alt:"PressMeGPT",className:"h-20 md:h-24"})})}),i.jsxs(ct,{className:"space-y-4",children:[s==="checking"&&i.jsxs("div",{className:"text-center space-y-4 py-6",children:[i.jsx(et,{className:"h-8 w-8 animate-spin text-primary mx-auto"}),i.jsx("p",{className:"text-muted-foreground",children:n?"Activating your account...":"Verifying your reset link..."})]}),s==="invalid"&&i.jsxs("div",{className:"text-center space-y-4",children:[i.jsx("div",{className:"w-16 h-16 mx-auto bg-destructive/10 rounded-full flex items-center justify-center",children:i.jsx(Eb,{className:"h-8 w-8 text-destructive"})}),i.jsx("h2",{className:"text-xl font-semibold text-foreground",children:n?"Activation Link Invalid or Expired":"Invalid or Expired Link"}),i.jsx("p",{className:"text-muted-foreground",children:n?"This account activation link is invali
1919d or has expired. Please contact support or try signing in with Forgot password.":"This password reset link is invalid or has expired. Please request a new one."}),i.jsx(Y,{onClick:()=>e("/auth"),className:"bg-primary hover:bg-primary/90",children:"Back to Sign In"})]}),s==="form"&&i.jsxs("form",{onSubmit:m,className:"space-y-4",children:[i.jsx("h2",{className:"text-xl font-semibold text-foreground text-center",children:n?"Activate your account":"Set New Password"}),n&&i.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Create a password to finish setting up your PressMeGPT account."}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"new-password",children:n?"Password":"New Password"}),i.jsx(Nt,{id:"new-password",type:"password",placeholder:"••••••••",value:a,onChange:f=>l(f.target.value),disabled:d,className:"bg-background/50",minLength:6,required:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"confirm-password",children:"Confirm Password"}),i.jsx(Nt,{id:"confirm-password",type:"password",placeholder:"••••••••",value:c,onChange:f=>u(f.target.value),disabled:d,className:"bg-background/50",minLength:6,required:!0})]}),i.jsxs(Y,{type:"submit",className:"w-full bg-primary hover:bg-primary/90",disabled:d,children:[d?i.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):null,n?"Create Password & Continue":"Reset Password"]})]}),s==="success"&&i.jsxs("div",{className:"text-center space-y-4",children:[i.jsx("div",{className:"w-16 h-16 mx-auto bg-primary/10 rounded-full flex items-center justify-center",children:i.jsx(wL,{className:"h-8 w-8 text-primary"})}),i.jsx("h2",{className:"text-xl font-semibold text-foreground",children:n?"You're all set!":"Password Reset!"}),i.jsx("p",{className:"text-muted-foreground",children:n?"Your account is activated. Redirecting to your dashboard...":"Your password has been updated. Redirecting to sign in..."})]})]})]})})]})}const Ine="/assets/eliot-headshot-DI3OC4g1.jpg";function One(){return i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(yl,{title:"About PressMeGPT - AI WordPress Theme Generator",description:"Learn the story behind PressMeGPT — built by a team with over a decade of WordPress experience to solve the biggest pain points in WordPress theme design.",canonicalUrl:"https://pressmegpt.com/about"}),i.jsx(zr,{}),i.jsxs("main",{className:"container mx-auto px-4 py-16 max-w-3xl",children:[i.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-8",children:"About PressMeGPT"}),i.jsxs("div",{className:"prose prose-lg max-w-none space-y-6 text-foreground leading-relaxed",children:[i.jsx("p",{children:"Before PressMeGPT, we ran a WordPress software company and marketing agency for over a decade. During that time, we built and maintained thousands of WordPress websites for clients — and I kept running into the same frustrations over and over again."}),i.jsx("p",{children:"WordPress is powerful. But building with it wasn't nearly as efficient as it should be."}),i.jsx("p",{children:"Even with modern website builders, it can still take a designer 8+ hours to design a homepage properly. Between layout decisions, styling, spacing, responsiveness, and revisions, projects drag on."}),i.jsx("p",{children:"That didn't make sense to me."}),i.jsx("p",{children:"With PressMeGPT, you can generate a homepage in minutes. Describe what you want, refine it with prompts, and export a real WordPress theme that's ready to install."}),i.jsx("h2",{className:"text-2xl font-semibold mt-10 mb-4",children:"Another frustration? Subscriptions."}),i.jsx("p",{children:"Most website builders require expensive per-site subscriptions just to keep a site live — even if you're not actively working on it anymore. For agencies managing multiple client sites, those recurring costs add up fast."}),i.jsx("p",{className:"font-semibold",children:"PressMeGPT themes are yours once you export them."}),i.jsxs("ul",{className:"list-none space-y-2 pl-0",children:[i.jsx("li",{children:"✓ No ongoing per-site subscription."}),i.jsx("li",{children:"✓ No lock-in."}),i.jsx("li",{children:"✓ Install them on as many WordPress sites as you'd like."})]}),i.jsx("h2",{className:"text-2xl font-semibold mt-10 mb-4",children:"What you see is what you get."}
1919),i.jsx("p",{children:"Then there's the classic WordPress problem: you install a theme and it looks nothing like the preview."}),i.jsx("p",{children:"The demo looked incredible. The installed version? Not even close."}),i.jsx("p",{children:"PressMeGPT themes look nearly identical to the generated design — aside from the elements that naturally must be customized inside WordPress (like menus or dynamic content). What you see during generation is essentially what you get after install."}),i.jsx("h2",{className:"text-2xl font-semibold mt-10 mb-4",children:"No bloat. No extra plugins."}),i.jsx("p",{children:"Many premium themes rely on extra plugins just to function properly. Page builders, add-ons, proprietary frameworks — all of which can slow down your website and complicate maintenance."}),i.jsx("p",{children:"PressMeGPT exports to native WordPress Classic themes and Gutenberg block themes."}),i.jsxs("ul",{className:"list-none space-y-2 pl-0",children:[i.jsx("li",{children:"✓ No required third-party builders."}),i.jsx("li",{children:"✓ No bloated plugin stack."}),i.jsx("li",{children:"✓ Just clean WordPress themes."})]}),i.jsx("h2",{className:"text-2xl font-semibold mt-10 mb-4",children:"Built to fix the starting point."}),i.jsx("p",{children:"Over the years, I realized the problem wasn't WordPress itself — it was the way we were forced to start every project."}),i.jsx("p",{children:"PressMeGPT was built to fix that starting point."}),i.jsx("p",{children:"Whether you're:"}),i.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[i.jsx("li",{children:"A freelancer trying to speed up client work"}),i.jsx("li",{children:"An agency reducing design hours"}),i.jsx("li",{children:"A business owner building your own site"}),i.jsx("li",{children:"A developer who wants a clean foundation"})]}),i.jsx("p",{children:"PressMeGPT helps you go from idea to working WordPress theme in minutes instead of hours."}),i.jsx("h2",{className:"text-2xl font-semibold mt-10 mb-4",children:"Migrate from any platform."}),i.jsx("p",{children:"It also solves another modern problem: migration."}),i.jsx("p",{children:`If you've built a site with Wix, SquareSpace, Lovable, Gemini, Claude, Base44, Replit, Bolt.new, or other AI and "vibe coded" platforms — you can convert those designs into a WordPress theme using PressMeGPT.`}),i.jsxs("ul",{className:"list-none space-y-2 pl-0",children:[i.jsx("li",{children:"✓ No rebuilding from scratch."}),i.jsx("li",{children:"✓ No starting over."})]}),i.jsx("p",{children:"Just bring your design into WordPress and keep building."}),i.jsx("h2",{className:"text-2xl font-semibold mt-10 mb-4",children:"The tool I wish I had years ago."}),i.jsx("p",{children:"After a decade of building for clients, I wanted a faster, cleaner way to start WordPress projects."}),i.jsx("p",{children:"PressMeGPT is the tool I wish I had years ago."}),i.jsx("p",{className:"font-semibold",children:"If you've ever been frustrated by slow builds, theme mismatches, subscription lock-in, or bloated plugins — this was built for you."}),i.jsxs("div",{className:"flex flex-col items-center gap-4 mt-12 pt-8 border-t border-border/50",children:[i.jsx("img",{src:Ine,alt:"Eliot Dill - Founder of PressMeGPT",className:"w-32 h-32 rounded-full object-cover object-top shadow-lg"}),i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"font-semibold text-lg",children:"Eliot Dill"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Web Developer & Founder of PressMeGPT"}),i.jsx("a",{href:"https://www.linkedin.com/in/eliotdill/",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline mt-1 inline-block",children:"Connect on LinkedIn →"})]})]})]})]}),i.jsx("footer",{className:"border-t border-border/50 py-8 px-4 bg-card/50",children:i.jsxs("div",{className:"container mx-auto text-center text-sm text-muted-foreground",children:[i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/about",className:"hover:text-foreground transition-colors",children:"About"}),i.jsx("a",{href:"/privacy",className:"hover:text-foreground transition-colors",children:"Privacy Policy"}),i.jsx("a",{href:"/terms",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),i.jsx("a",{href:"/sitemap.txt",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Sitemap"}),i.jsx("a",{href:"https://pressmegpt.endorsely.com/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Affiliate Program"})]}),i.jsxs("p",{children:["© ",new Date().getFullYear()," PressMeGPT. All rights reserved."]})]})})]})}
1919const Mne="/assets/theme-showcase-BHbCgosm.png",$ne="/assets/theme-showcase-mobile-CL6PAOJ1.png",Dne=[{icon:ua,title:"Create with words in minutes, not days",description:"WordPress Drag-and-Drop builders still take hours or days. PressMeGPT themes take minutes to generate."},{icon:Rd,title:"Flexible theme exports",description:"Compatible with Elementor, Gutenberg or Classic. No website builder lock-in."},{icon:ta,title:"Themes that actually look like the demo",description:'Stop tinkering with "premium" themes that never look right. PressMeGPT themes look nearly identical to what you designed with AI.'},{icon:qh,title:"No plugin bloat = Faster, safer sites",description:"Less security risk. Easier updates. PressMeGPT uses native WordPress with no plugin dependencies so there is very little to break."},{icon:LL,title:"No expensive per-site subscriptions",description:"Many builders charge per site with caps on live sites. PressMeGPT uses credits only when you are building — not while your site is live."},{icon:nh,title:"Own your theme. Host it anywhere.",description:"Once you design and export it, you own it. Edit and install it as much as you like manually, or come back to PressMeGPT to edit with prompts."}],A2=[{label:"Themes",lifetime:"50+",freelance:"36+",elementor:"50"},{label:"Credits",lifetime:"500",freelance:"360/yr",elementor:"0"},{label:"Price",lifetime:"$99 one-time",freelance:"$99/yr recurring",elementor:"$408/yr recurring"},{label:"Credits Expire?",lifetime:"Never",freelance:"Never",elementor:"Monthly"},{label:"Recurring Charge?",lifetime:"No",freelance:"Yes",elementor:"Yes"},{label:"Elementor Export",lifetime:"✓ w/ credits",freelance:"✓ Free",elementor:"Yes"},{label:"Gutenberg Export",lifetime:"✓ w/ credits",freelance:"✓ Free",elementor:"No"},{label:"Classic Export",lifetime:"✓ Free",freelance:"✓ Free",elementor:"No"},{label:"Convert from URL",lifetime:"✓",freelance:"✓",elementor:"No"},{label:"Media Migration",lifetime:"✓ w/ credits",freelance:"✓ Free",elementor:"No"},{label:"Stackable",lifetime:"Up to 5x (2,500 credits)",freelance:"N/A",elementor:"No"}];function Fne(){Zt();const[t,e]=eo(),{user:r}=$t(),[n,s]=g.useState(1),[o,a]=g.useState(!1),[l,c]=g.useState(!1),[u,d]=g.useState(!1),{track:h}=ro();g.useEffect(()=>{t.get("checkout")==="canceled"&&(Q.error("Checkout was canceled. No charges were made."),t.delete("checkout"),e(t,{replace:!0}))},[t,e]);const m=async()=>{a(!0);try{h("InitiateCheckout",{content_name:"lifetime_credits",value:n*99,currency:"USD"});const{data:b,error:x}=await re.functions.invoke("create-lifetime-checkout",{body:{quantity:n,guest:!r}});if(x||b!=null&&b.error)throw new Error((b==null?void 0:b.error)||(x==null?void 0:x.message)||"Checkout failed");b!=null&&b.url&&Ls(b.url)}catch(b){Q.error("Failed to start checkout. Please try again."),console.error("Lifetime checkout error:",b)}finally{a(!1)}},f=n*500,v=n*50,p=n*99;return i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{}),i.jsxs("main",{children:[i.jsxs("section",{className:"py-20 md:py-28 px-4 relative overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/10 via-accent/5 to-primary/5"}),i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,hsl(var(--primary)/0.15),transparent_60%),radial-gradient(ellipse_at_bottom_left,hsl(var(--accent)/0.1),transparent_60%)]"}),i.jsxs("div",{className:"container mx-auto max-w-5xl relative",children:[i.jsxs("div",{className:"text-center mb-12",children:[i.jsxs(rt,{variant:"secondary",className:"mb-4 px-4 py-2 text-sm font-medium bg-accent/10 text-accent border-accent/20",children:[i.jsx(xc,{className:"h-3.5 w-3.5 mr-1.5"}),"Limited to 1,000 buyers"]}),i.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-5 tracking-tight",children:["Pay Once. ",i.jsx("span",{className:"text-primary",children:"Get"})," ",i.jsx("span",{className:"text-primary",children:"Lifetime Credits."})]}),i.jsxs("p",{className:"text-xl md:text-2xl text-muted-foreground mb-3 max-w-3xl mx-auto",children:["Build WordPress Themes with Words.",i.jsx("br",{className:"hidden md:block"})," No Plugins. No Builders. No Code. No Lock-in."]}),i.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto mb-4",children:"Export as an Elementor, Gutenberg, or Classic theme and host anywhere."}),i.jsxs("button",{onClick:()=>c(!0),className:"inline-flex items-center gap-1.5 text-primary hover:text-primary/80 font-medium mb-8 transition-colors",children:[i.jsx(Vc,{className:"h-4 w-4 fill-primary"}),"See it in Action"]}),i.jsx("img",{src:$ne,alt:"AI-generated WordPress themes showcase",className:"max-w-full mx-auto h-auto object-contain lg:hidden"}),i.jsx("img",{src:Mne,alt:"AI-generated WordPress themes showcase",className:"hidden lg:block max-w-full lg:max-w-3xl mx-auto h-auto object-contain"})]}),i.jsx("div",{className:"max-w-lg mx-auto",children:i.jsxs("div",{className:"bg-card rounded-2xl border-2 border-primary/30 shadow-2xl shadow-primary/10 overflow-hidden",children:[i.jsx("div",{className:"bg-primary text-primary-foreground px-6 py-3 text-center text-sm font-semibold",children:"28% more credits than Freelance Annual — for a one-time price"}),i.jsxs("div",{className:"p-8",children:[i.jsxs("div",{className:"text-center mb-6",children:[i.jsxs("div",{className:"text-5xl font-bold mb-1",children:["$",p]}),i.jsx("div",{className:"text-muted-foreground text-sm",children:"one-time payment • no recurring fees"})]}),i.jsxs("div",{className:"flex items-center justify-center gap-6 mb-6 py-4 bg-muted/50 rounded-xl",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-primary",children:f.toLocaleStr
1919ing()}),i.jsx("div",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Credits"})]}),i.jsx("div",{className:"h-10 w-px bg-border"}),i.jsxs("div",{className:"text-center",children:[i.jsxs("div",{className:"text-3xl font-bold text-primary",children:[v,"+"]}),i.jsx("div",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Themes"})]})]}),i.jsxs("div",{className:"flex items-center justify-center gap-4 mb-6",children:[i.jsx("span",{className:"text-sm text-muted-foreground",children:"Quantity:"}),i.jsxs("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[i.jsx(Y,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>s(Math.max(1,n-1)),disabled:n<=1,children:i.jsx(IL,{className:"h-4 w-4"})}),i.jsx("span",{className:"w-8 text-center font-semibold",children:n}),i.jsx(Y,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>s(Math.min(5,n+1)),disabled:n>=5,children:i.jsx(yp,{className:"h-4 w-4"})})]}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"(max 5)"})]}),i.jsx(Y,{size:"lg",className:"w-full text-lg py-6 shadow-lg shadow-primary/25",onClick:m,disabled:o,children:o?"Opening checkout...":i.jsxs(i.Fragment,{children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{className:"sm:hidden",children:"Get Lifetime Credits"}),i.jsxs("span",{className:"hidden sm:inline",children:["Get ",f.toLocaleString()," Lifetime Credits — $",p]})]})}),i.jsx("div",{className:"mt-4 space-y-2",children:["Credits issued immediately","Credits never expire","Includes all current features","No account needed to purchase"].map(b=>i.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[i.jsx(fr,{className:"h-4 w-4 text-primary flex-shrink-0"}),b]},b))})]})]})})]})]}),i.jsxs("section",{className:"py-20 px-4 relative overflow-hidden bg-gradient-to-br from-primary/15 via-accent/10 to-primary/5 border-y border-primary/20",children:[i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,hsl(var(--primary)/0.1),transparent_60%),radial-gradient(ellipse_at_bottom_left,hsl(var(--accent)/0.15),transparent_60%)]"}),i.jsxs("div",{className:"container mx-auto max-w-4xl relative",children:[i.jsxs(rt,{variant:"secondary",className:"mx-auto mb-4 flex w-fit px-3 py-1 text-xs font-semibold bg-accent/10 text-accent border-accent/20",children:[i.jsx(KP,{className:"h-3 w-3 mr-1"}),"Most Popular Feature"]}),i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Convert Any Site or AI Project to WordPress"}),i.jsx("p",{className:"text-center text-muted-foreground mb-4 max-w-2xl mx-auto text-lg leading-relaxed",children:"Built something with AI already but want it on WordPress? Paste the URL and convert it to a native WP theme in minutes."}),i.jsx("div",{className:"text-center mb-8",children:i.jsxs("button",{onClick:()=>d(!0),className:"inline-flex items-center gap-1.5 text-primary hover:text-primary/80 font-medium transition-colors",children:[i.jsx(Vc,{className:"h-4 w-4 fill-primary"}),"Watch a Site Conversion"]})}),i.jsx("div",{className:"flex justify-center mb-10",children:i.jsx("img",{src:h1,alt:"Convert from Gemini, Replit, Squarespace, Wix, Claude, Lovable, Framer, Webflow and more to WordPress",className:"max-w-full h-auto max-h-[400px] object-contain"})}),i.jsx("div",{className:"text-center",children:i.jsx("div",{children:i.jsxs(Y,{size:"lg",onClick:m,disabled:o,className:"shadow-lg shadow-primary/25",children:[i.jsx(Ga,{className:"h-5 w-5 mr-2"}),i.jsx("span",{className:"hidden sm:inline",children:"Get Lifetime Credits & Start Converting"}),i.jsx("span",{className:"sm:hidden",children:"Get Lifetime Credits"})]})})})]})]}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-5xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Why PressMeGPT?"}),i.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-2xl mx-auto",children:"Stop paying monthly for finished websites. Build once, own forever."}),i.jsx("div",{className:"grid md:grid-cols-2 gap-6",children:Dne.map(b=>i.jsxs("div",{className:"flex gap-4 p-6 rounded-xl bg-card border border-border/50 hover:border-primary/20 transition-colors",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 text-primary flex items-center justify-center flex-shrink-0",children:i.jsx(b.
1919icon,{className:"h-5 w-5"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-semibold mb-1",children:b.title}),i.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:b.description})]})]},b.title))})]})}),i.jsx("section",{className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-3xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Lifetime Credits vs. Freelance Plan vs. Elementor"}),i.jsx("p",{className:"text-center text-muted-foreground mb-10",children:"See how the one-time offer stacks up against our most popular subscription."}),i.jsxs("div",{className:"bg-card rounded-xl border border-border overflow-hidden overflow-x-auto",children:[i.jsxs("div",{className:"grid grid-cols-4 text-sm font-semibold border-b border-border min-w-[500px]",children:[i.jsx("div",{className:"p-4"}),i.jsx("div",{className:"p-4 text-center bg-primary/5 text-primary border-x border-border",children:"Lifetime Credit Plan"}),i.jsx("div",{className:"p-4 text-center",children:"Freelance Plan"}),i.jsx("div",{className:"p-4 text-center border-l border-border",children:"Elementor"})]}),A2.map((b,x)=>i.jsxs("div",{className:`grid grid-cols-4 text-sm min-w-[500px] ${x<A2.length-1?"border-b border-border":""}`,children:[i.jsx("div",{className:"p-4 font-medium",children:b.label}),i.jsx("div",{className:"p-4 text-center bg-primary/5 border-x border-border font-medium",children:b.lifetime}),i.jsx("div",{className:"p-4 text-center text-muted-foreground",children:b.freelance}),i.jsx("div",{className:"p-4 text-center text-muted-foreground border-l border-border",children:b.elementor})]},b.label))]})]})}),i.jsx(wu,{}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-3xl text-center",children:[i.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Ready to Build WordPress Themes with Words?"}),i.jsxs("p",{className:"text-lg text-muted-foreground mb-8 max-w-xl mx-auto",children:["Get ",f.toLocaleString()," credits for $",p," one-time. No subscription. No expiry. Start building in minutes."]}),i.jsxs(Y,{size:"lg",className:"text-lg px-10 py-6 shadow-lg shadow-primary/25",onClick:m,disabled:o,children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{className:"sm:hidden",children:"Get Lifetime Credits"}),i.jsxs("span",{className:"hidden sm:inline",children:["Get Lifetime Credits — $",p]})]}),i.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"Lifetime Credit Plan • Limited to 1,000 buyers • 30-day money-back guarantee"})]})})]}),i.jsx(Xt,{open:l,onOpenChange:c,children:i.jsxs(Qt,{className:"sm:max-w-3xl p-0 overflow-hidden bg-black border-none",children:[i.jsx(wr,{className:"sr-only",children:"See it in Action"}),i.jsx("div",{className:"aspect-video",children:l&&i.jsx("iframe",{src:"https://www.youtube.com/embed/HBH-vnUozxU?autoplay=1",allow:"autoplay; encrypted-media",allowFullScreen:!0,className:"w-full h-full"})})]})}),i.jsx(Xt,{open:u,onOpenChange:d,children:i.jsxs(Qt,{className:"sm:max-w-3xl p-0 overflow-hidden bg-black border-none",children:[i.jsx(wr,{className:"sr-only",children:"Watch a Site Conversion"}),i.jsx("div",{className:"aspect-video",children:u&&i.jsx("iframe",{src:"https://www.youtube.com/embed/DKPaIKUp_KI?autoplay=1",allow:"autoplay; encrypted-media",allowFullScreen:!0,className:"w-full h-full"})})]})})]})}const Lne=[{icon:gl,title:"Small Businesses",description:"Are you familiar with WordPress but don't know how to design your own theme? PressMeGPT can generate a beautiful website in a few minutes, saving you thousands."},{icon:WP,title:"Marketing Agencies",description:"Finally you can design & customize WordPress websites yourself from scratch without needing a web designer to make simple changes."},{icon:$P,title:"Freelancers",description:"Want to increase your profit without increasing your hourly rate? Let PressMeGPT get you to 80% in a few minutes, and customize the rest with your skills."},{icon:BP,title:"Web Development Agencies",description:"Want to improve your team's workflow and output? Use PressMeGPT to generate an Elementor, Gutenberg, & Classic theme with no plugin bloat and time savings, then modify to satisfy the requirements."},{icon:HP,title:"Bloggers & Content Creators",description:"Trying to find that perfect WordPress theme, only for it to look nothing like what was advertised? PressMeGPT themes look just like what you design."},{icon:qh,title:"Founders & Entrepreneurs",description:"Need to get an SEO friendly website up quickly for your next big idea without fussing with theme customization. PressMeGPT generates a theme that looks like what you design with AI prompts."}],Bne=[{src:j4,name:"Spectra"},{src:k4,name:"Kadence Blocks"},{src:S4,name:"Generate Blocks"},{src:N4,name:"Stackable"},{src:C4,name:"Greenshift"},{src:E4,name:"Otter Blocks"},{src:P4,name:"Ultimate Blocks"},{src:T4,name:"Qubely"},{src:A4,name:"CoBlocks"}
1919,{src:R4,name:"ACF Blocks"}],zne=[{src:O4,name:"Essential Addons"},{src:M4,name:"Unlimited Elements"},{src:$4,name:"Crocoblock"},{src:D4,name:"Ultimate Addons"},{src:F4,name:"PowerPack"},{src:L4,name:"ElementsKit"},{src:B4,name:"The Plus Addons"},{src:z4,name:"Premium Addons"},{src:U4,name:"Elementor Extras"},{src:W4,name:"Dynamic Content"}],Ty=["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","Elementor & Gutenberg Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Convert Canva & Figma Mockups to WP","Multi-Page Convert"],xm=[{id:"starter",label:"Freelance",description:"For individual freelancers & web developers",price:Tc("starter"),credits:30,sites:3,icon:St,features:Ty},{id:"pro",label:"Pro",description:"For professional developers & designers",price:Tc("pro"),credits:70,sites:7,icon:ua,features:Ty,popular:!0},{id:"agency",label:"Agency",description:"For WordPress teams and marketing agencies",price:Tc("agency"),credits:150,sites:15,icon:gl,features:Ty}],R2=[{q:"Do I need to know how to code?",a:"No — describe what you want or paste a URL to convert, and PressMeGPT generates the theme."},{q:"What if I already have a site built somewhere else?",a:"Paste the URL and PressMeGPT converts it into a native WordPress theme — works with Lovable, Base44, Claude, Bolt.new, Wix, Squarespace, and similar builders."},{q:"Do credits expire?",a:"No. Buy once, use them on your own timeline."},{q:"What formats can I export to?",a:"Classic WordPress, Gutenberg, and Elementor — included in every pack."},{q:"Is this different from the monthly plan?",a:"Yes — monthly is for continuous, ongoing building. This is a one-time purchase for a project or a batch of projects."}];function Une(){const t=Zt(),[e,r]=eo(),{user:n}=$t(),[s,o]=g.useState(null),[a,l]=g.useState(!1),[c,u]=g.useState("gutenberg"),[d,h]=g.useState(null),{track:m}=ro(),[f,v]=g.useState({open:!1,plan:null}),[p,b]=g.useState(""),[x,y]=g.useState(!1),[w,j]=g.useState(null);g.useEffect(()=>{re.from("public_themes").select("*",{count:"exact",head:!0}).then(({count:C})=>{typeof C=="number"&&h(C)})},[]),g.useEffect(()=>{document.title="One-Time WordPress Theme Credits | PressMeGPT";const C=(F,T)=>{let A=document.querySelector(`meta[name="${F}"]`);A||(A=document.createElement("meta"),A.setAttribute("name",F),document.head.appendChild(A)),A.setAttribute("content",T)};
1919C("description","Build or convert AI generated websites to WordPress themes. No code, no subscription. One-time credit packs with Elementor, Gutenberg and Classic export included."),C("robots","noindex, nofollow");const O=document.createElement("script");return O.type="application/ld+json",O.text=JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:R2.map(F=>({"@type":"Question",name:F.q,acceptedAnswer:{"@type":"Answer",text:F.a}}))}),document.head.appendChild(O),()=>{const F=document.querySelector('meta[name="robots"]');F&&F.setAttribute("content","index, follow"),O.remove()}},[]),g.useEffect(()=>{e.get("checkout")==="canceled"&&(Q.error("Checkout was canceled. No charges were made."),e.delete("checkout"),r(e,{replace:!0}))},[e,r]);const _=async(C,O)=>{var T;const F=xm.find(A=>A.id===C);o(C);try{m("InitiateCheckout",{content_name:C,value:F.price,currency:"USD"});const{data:A,error:k}=await re.functions.invoke("create-guest-checkout",{body:{plan:C,billingInterval:"monthly",mode:"subscription",email:O}}),$=K=>{j({open:!0,currentPlan:String(K.current_plan||"paid"),targetPlan:String(K.target_plan||C),email:O,isUpgrade:!!K.is_upgrade,isDowngrade:!!K.is_downgrade}),v({open:!1,plan:null})};if(k){const K=await On(k,"Checkout failed");if((T=K.body)!=null&&T.already_subscribed){$(K.body);return}throw new Error(K.message||k.message||"Checkout failed")}if(A!=null&&A.error){if(A.already_subscribed){$(A);return}throw new Error(A.error)}if(!(A!=null&&A.url))throw new Error("Checkout session could not be created");Ls(A.url),v({open:!1,plan:null})}catch(A){const k=A instanceof Error?A.message:"Failed to start checkout";Q.error(`Failed to start checkout: ${k}`),console.error("Credit pack guest checkout error:",A)}finally{o(null)}},S=async()=>{if(f.plan){if(!p||!p.includes("@")){Q.error("Please enter a valid email address.");return}y(!0);try{await _(f.plan,p.trim())}finally{y(!1)}}},N=async C=>{var T;const O=xm.find(A=>A.id===C),{data:F}=await re.auth.getSession();if(!((T=F==null?void 0:F.session)!=null&&T.access_token)){b(A=>A||(n==null?void 0:n.email)||""),v({open:!0,plan:C});return}o(C);try{m("InitiateCheckout",{content_name:C,value:O.price,currency:"USD"});const{data:A,error:k}=await re.functions.invoke("create-checkout",{body:{plan:C,billingInterval:"monthly"}});if(k){const $=await On(k,"Checkout failed");throw new Error($.message||k.message||"Checkout failed")}if(A!=null&&A.error)throw new Error(A.error);if(A!=null&&A.url){Ls(A.url);return}if(A!=null&&A.noChange){Q.info(A.message||"You're already on this plan");return}if(A!=null&&A.upgraded){Q.success(A.message||"Your subscription has been updated!");return}if(A!=null&&A.alreadySubscribed){Q.info(A.message||"You already have an active subscription");return}throw new Error("Checkout session could not be created")}catch(A){const k=A instanceof Error?A.message:"Failed to start checkout";Q.error(`Failed to start checkout: ${k}`),console.error("Credit pack checkout error:",A)}finally{o(null)}},P=()=>{var C;(C=document.getElementById("pricing"))==null||C.scrollIntoView({behavior:"smooth"})};return i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{}),i.jsx("div",{className:"bg-primary text-primary-foreground py-3 px-4",children:i.jsx("div",{className:"container mx-auto flex items-center justify-center text-sm md:text-base text-center",children:i.jsxs("span",{children:[i.jsx("strong",{children:"New Features:"})," ",i.jsx("a",{href:"#convert-design",className:"underline hover:no-underline",children:"Convert a Design"})," ","from Wix, Lovable, Gemini, Claude & others to WordPress. Now"," ",i.jsx("a",{href:"#compatibility",className:"underline hover:no-underline",children:"compatible with Elementor"})," ","& more."]})})}),i.jsxs("main",{children:[i.jsxs("section",{className:"py-24 px-4 relative overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/5 via-transparent to-accent/5"}),i.jsxs("div",{className:"container mx-auto text-center max-w-4xl relative",children:[i.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary/10 text-primary text-sm font-medium mb-6",children:[i.jsx(St,{className:"h-4 w-4"}),"AI WordPress Theme Generator & Website Builder"]}),i.jsx("h1",{className:"text-3xl md:text-5xl lg:text-6xl font-bold mb-6 tracking-tight",children:"The Easiest Way to Convert Any Web Design to WordPress & Create Themes with AI"}),i.jsx("h2",{className:"text-xl md:text-2xl font-semibold mb-4 text-muted-foreground",children:"No Plugins. No Builders. No Code. No Lock-in. Only Words."}),i.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-10 leading-relaxed max-w-3xl mx-auto",children:"Export as an Elementor, Gutenberg, or Classic theme and host anywhere."}),i.jsx("div",{className:"flex gap-4 justify-center flex-wrap",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25 text-lg px-8 py-6",children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{children:"Start Free Trial"})]})}),i.jsx("div",{className:"mt-4 flex justify-center",children:i.jsxs("button",{type:"button",onClick:()=>l(!0),className:"inline-flex items-center gap-2 text-primary hover:text-primary/80 font-medium underline-offset-4 hover:underline transition-colors",children:[i.jsx(Vc,{className:"h-4 w-4 fill-current"}),"Watch Demo Video"]})}),i.jsx("p",{className:"text-sm text-muted-foreground mt-6",children:"5 free credits included (enough for 1 theme to test) • No credit card required"})]})]}),i.jsx(tu,{eyebrow:"What builders are saying",heading:"Trusted by WordPress creators",variant:"muted",quotes:y4}
1919),i.jsx("section",{id:"benefits",className:"py-20 px-4 bg-gradient-to-br from-destructive/10 via-card to-destructive/5 border-y border-destructive/10",children:i.jsxs("div",{className:"container mx-auto max-w-4xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"The Problem With Traditional WordPress Themes & Builders"}),i.jsx("p",{className:"text-center text-muted-foreground mb-10 max-w-2xl mx-auto",children:"Most WordPress builders create long-term pain:"}),i.jsx("div",{className:"grid md:grid-cols-2 gap-4 mb-8",children:["You keep paying monthly even after the site is finished","Themes don't look like the demo without hours of tweaking","Heavy page builders and plugins slow your site down","Plugin stacks increase security risks","Updates break things — stop paying and things break"].map((C,O)=>i.jsxs("div",{className:"flex items-start gap-3 bg-card/80 rounded-xl p-4 border border-destructive/20",children:[i.jsx("span",{className:"text-destructive text-xl flex-shrink-0",children:"❌"}),i.jsx("p",{className:"text-foreground",children:C})]},O))}),i.jsx("p",{className:"text-center text-lg font-medium text-muted-foreground",children:"You shouldn't need a subscription just to keep a finished site running."})]})}),i.jsx("section",{className:"py-20 px-4 bg-gradient-to-br from-primary/10 via-accent/5 to-primary/5",children:i.jsxs("div",{className:"container mx-auto max-w-4xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"The PressMeGPT Difference"}),i.jsx("p",{className:"text-center text-muted-foreground mb-10 max-w-2xl mx-auto",children:"Pay once. Generate themes forever with credits. Build clean, production-ready WordPress themes in minutes — without page builders, plugins, or recurring fees."}),i.jsx("div",{className:"grid md:grid-cols-2 gap-4 mb-10",children:["You own the theme once it's generated","What you see is what you get — the theme actually matches the design!","No page builders or plugins required","Lightweight, fast, and secure","Works with Elementor, Gutenberg, & Classic Editor"].map((C,O)=>i.jsxs("div",{className:"flex items-start gap-3 bg-card/80 rounded-xl p-4 border border-primary/20",children:[i.jsx("span",{className:"text-primary text-xl flex-shrink-0",children:"✓"}),i.jsx("p",{className:"text-foreground",children:C})]},O))}),i.jsx("p",{className:"text-center text-lg font-semibold text-foreground mb-8",children:"Generate the theme → Download it → Install it → Host it wherever you want!"}),i.jsx("div",{className:"text-center",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25",children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{children:"Start Free Trial"})]})})]})}),i.jsx(Yo,{quotes:Cc[0]}),i.jsx("section",{id:"how-it-works",className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-5xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"How It Works"}),i.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-2xl mx-auto",children:"Three simple steps to create your perfect WordPress theme"}),i.jsx("div",{className:"max-w-5xl mx-auto mb-12 flex justify-center",children:i.jsx("img",{src:_4,alt:"Generate WordPress themes from a simple prompt — works with WordPress and Elementor",className:"w-full h-auto",loading:"lazy"})}),i.jsxs("div",{className:"grid md:grid-cols-3 gap-8 mb-16",children:[i.jsxs("div",{className:"text-center group",children:[i.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary text-primary-foreground flex items-center justify-center mx-auto mb-5 shadow-lg shadow-primary/20 group-hover:scale-110 transition-transform",children:i.jsx(St,{className:"h-7 w-7"})}),i.jsx("h3",{className:"text-lg font-semibold mb-3",children:"1. Describe Your Vision"}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Tell us about your ideal theme - colors, style, industry, and mood. Our AI understands your needs."})]}),i.jsxs("div",{className:"text-center group",children:[i.jsx("div",{className:"w-16 h-16 rounded-2xl bg-accent text-accent-foreground flex items-center justify-center mx-auto mb-5 shadow-lg shadow-accent/20 group-hover:scale-110 transition-transform",children:i.jsx(xp,{className:"h-7 w-7"})}),i.jsx("h3",{className:"text-lg font-semibold mb-3",children:"2. Choose & Customize"}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Pick from 3 unique designs, then fine-tune each section with AI-powered customization."})]}),i.jsxs("div",{className:"text-center group",children:[i.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary text-primary-foreground flex items-center justify-center mx-auto mb-5 shadow-lg shadow-primary/20 group-hover:scale-110 transition-transform",children:i.jsx(Wn,{className:"h-7 w-7"})}),i.jsx("h3",{className:"text-lg font-semibold mb-3",children:"3. Export & Install"}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Download a complete WordPress theme package ready to upload and activate on your site."})]})]}),i.jsx("div",{className:"text-center",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25",children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{children:"Start Free Trial"})]})})]})}),i.jsxs("section",{id:"convert-design",className:"py-20 px-4 relative overflow-hidden bg-gradient-to-br from-primary/15 via-accent/10 to-primary/5 border-y border-primary/20",children:[i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,hsl(var(--primary)/0.1),transparent_60%),radial-gradient(ellipse_at_bottom_left,hsl(var(--accent)/0.15),transparent_60%)]"}),i.jsxs("div",{className:"container mx-auto max-w-4xl relative",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Even Convert Your Existing Site to WordPress"}),i.jsx("p",{className:"text-center text-muted-foreground mb-8 max-w-2xl mx-auto text-lg leading-relaxed",children:"You can now create a WordPress theme from an existing site or draw inspiration from any of these providers:"}),i.jsx("div",{className:"flex justify-center mb-10",children:i.jsx("img",{src:h1,alt:"Convert from Gemini, Replit, Squarespace, Wix, Claude, Base44, Lovable, Framer, Webflow, Bolt.new, and HTML to WordPress via PressMeGPT",className:"max-w-full h-auto max-h-[400px] object-contain"})}),i.jsx("p",{className:"text-center text-muted-foreground mb-8 max-w-2xl mx-auto",children:"Simply paste a URL and our AI will replicate the structure, layout, and styling into a clean, lightweight WordPress theme — ready to export and install."}),i.jsx("div",{className:"text-center",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25",children:[i.jsx(Ga,{className:"h-5 w-5 mr-2"}),"Convert Your Site Now"]})})]})]}),i.jsx(Yo,{quotes:Cc[1]}),i.jsx("section",{id:"compatibility",className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-5xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Export to Your Favorite Builders"}),i.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-2xl mx-auto",children:"Export themes that work seamlessly with the most popular WordPress builders and block editors"}),i.jsxs("div",{className:"grid md:grid-cols-2 gap-8 max-w-3xl mx-auto mb-8",children:[i.jsxs("button",{onClick:()=>u("elementor"),onMouseEnter:()=>u("elementor"),className:`bg-card rounded-2xl p-8 border text-center transition-all cursor-pointer ${c==="elementor"?"border-primary shadow-lg ring-2 ring-primary/20":"border-border/50 hover:shadow-lg"}`,children:[i.jsx("div",{className:"w-20 h-20 mx-auto mb-4 flex items-center justify-center",children:i.jsxs("svg",{viewBox:"0 0 800 800",className:"w-full h-full",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M400 0C179.1 0 0 179.1 0 400s179.1 400 400 400 400-179.1 400-400S620.9 0 400 0z",fill:"#92003B"}),i.jsx("path",{d:"M296 296h48v208h-48zM392 296h112v48H392zM392 376h112v48H392zM392 456h112v48H392z",fill:"#fff"})]})}),i.jsx("h3",{className:"text-xl font-bold mb-2",children:"Elementor"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Works with Elementor Free and Pro"})]}),i.jsxs("button",{onClick:()=>u("gutenberg"),onMouseEnter:()=>u("gutenberg"),className:`bg-card rounded-2xl p-8 border text-center transition-all cursor-pointer ${c==="gutenberg"?"border-primary shadow-lg ring-2 ring-primary/20":"border-border/50 hover:shadow-lg"}`,children:[i.jsx("div",{className:"w-20 h-20 mx-auto mb-4 flex items-center justify-center",children:i.jsx("img",{src:I4,alt:"WordPress",className:"w-full h-full object-contain"})}),i.jsx("h3",{className:"text-xl font-bold mb-2",children:"Gutenberg & Classic"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Native WordPress block themes and classic PHP themes"})]})]}),i.jsxs("div",{className:"bg-card rounded-2xl p-8 border border-border/50 max-w-3xl mx-auto",children:[i.jsx("p",{className:"text-center text-sm text-muted-foreground mb-6",children:c==="gutenberg"?"Also works with popular Gutenberg Block plugins":"Also w
1919orks with popular Elementor Addon plugins"}),i.jsx("div",{className:"grid grid-cols-5 gap-6 max-w-xl mx-auto",children:(c==="gutenberg"?Bne:zne).map(C=>i.jsxs("div",{className:"flex flex-col items-center gap-1.5 group",title:C.name,children:[i.jsx("div",{className:"w-12 h-12 rounded-lg bg-background border border-border/50 flex items-center justify-center overflow-hidden group-hover:scale-110 transition-transform shadow-sm",children:i.jsx("img",{src:C.src,alt:C.name,className:"w-8 h-8 object-contain"})}),i.jsx("span",{className:"text-xs text-muted-foreground leading-tight text-center max-w-[70px]",children:C.name})]},C.name))})]})]})}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-6xl",children:[i.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Who It's For"}),i.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-2xl mx-auto",children:"PressMeGPT helps professionals across industries save time and money"}),i.jsx("div",{className:"grid md:grid-cols-2 gap-8",children:Lne.map((C,O)=>i.jsx("div",{className:"bg-card rounded-2xl p-6 border border-border/50 hover:shadow-lg transition-shadow",children:i.jsxs("div",{className:"flex items-start gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 text-primary flex items-center justify-center flex-shrink-0",children:i.jsx(C.icon,{className:"h-6 w-6"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-2",children:C.title}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:C.description})]})]})},O))}),i.jsx("div",{className:"text-center mt-12",children:i.jsxs(Y,{size:"lg",onClick:()=>t("/auth?mode=signup"),className:"bg-primary hover:bg-primary/90 shadow-lg shadow-primary/25",children:[i.jsx(St,{className:"h-5 w-5 mr-2"}),i.jsx("span",{children:"Start Free Trial"})]})})]})}),i.jsx(tu,{eyebrow:"Loved by WordPress pros",heading:"From freelancers to agencies",variant:"gradient",quotes:b4}),i.jsx("section",{id:"pricing",className:"py-20 px-4 bg-muted/30 scroll-mt-20",children:i.jsxs("div",{className:"container mx-auto max-w-7xl",children:[i.jsxs("div",{className:"text-center mb-12",children:[i.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-3",children:[(d??3388).toLocaleString()," Themes Generated and Counting"]}),i.jsx("p",{className:"text-xl font-semibold text-foreground mb-2",children:"Simple Monthly Plans"}),i.jsx("p",{className:"text-muted-foreground",children:"Most freelancers and web developers choose Pro. Cancel anytime."})]}),i.jsx(dt,{className:"mb-8",children:i.jsxs(ct,{className:"p-6 flex flex-col md:flex-row md:items-center gap-6",children:[i.jsxs("div",{className:"flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(St,{className:"h-5 w-5 text-primary"}),i.jsx("span",{className:"text-2xl font-bold leading-none tracking-tight",children:"3 Day Free Trial"})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"No credit card required"}),i.jsx("p",{className:"text-xs text-primary mt-1",children:"Enjoy the Pro features for 3 days with ways to earn free credits."})]}),i.jsx("div",{className:"flex-1 grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2 text-sm",children:["Gemini 3.0","Private Themes","Media Migration","Multi-Page Tools","Free Classic, Gutenberg & Elementor Exports"].map(C=>i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx(fr,{className:"h-4 w-4 text-primary shrink-0"}),C]},C))}),i.jsx("div",{className:"flex-shrink-0",children:i.jsx(Y,{size:"lg",variant:"secondary",className:"min-w-[160px] hover:bg-cta-hover hover:text-cta-foreground active:bg-cta-hover active:text-cta-foreground transition-colors",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})})]})}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 items-stretch justify-center",children:xm.map(C=>{const O=C.icon;return i.jsxs(dt,{className:`relative flex flex-col ${C.popular?"border-primary shadow-lg":""}`,children:[C.popular&&i.jsx(rt,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Most Popular"}),i.jsxs(ir,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(O,{className:"h-5 w-5 text-primary"}),i.jsx(Dr,{children:C.label})]}),i.jsx(Gr,{children:C.description})]}),i.jsx(ct,{className:"flex-1",children:i.jsxs("div",{className:"mb-6",children:[i.jsxs("div",{className:"flex items-baseline gap-1",children:[i.jsxs("span",{className:"text-4xl font-bold",children:["$",C.price]}),i.jsx("span",{className:"text-muted-foreground",children:"/ month"})]}),i.jsxs("div",{className:"mt-3 space-y-1",children:[i.jsxs("p",{className:"text-sm font-semibold text-primary",children:["Generate ",C.sites*3," themes or more per month"]}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Build ",C.sites,"+ full sites with multiple pages"]}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[C.credits," credits every month"]})]})]})}),i.jsx(ia,{className:"flex flex-col gap-3",children:i.jsx(Y,{className:`w-full ${C.popular?"bg-cta text-cta-foreground hover:bg-cta-hover":""}`,variant:C.popular?"default":"outline",disabled:s!==null,onClick:()=>N(C.id),children:s===C.id?"Opening checkout...":`Get ${C.label}`})})]},C.id)})}),i.jsxs("div",{className:"mt-16",children:[i.jsxs("h3",{className:"text-2xl font-bold text-center mb-8",children:["All Paid Plans ",i.jsx("span",{className:"text-primary",children:"Include"})]}),i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-4 max-w-5xl mx-auto",children:xm[0].features.map((C,O)=>i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(fr,{className:"h-5 w-5 text-primary shrink-0 mt-0.5"}),i.jsx("span",{className:"text-foreground",children:C})]},O))})]})]})}),i.jsx("section",{className:"py-16 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-2xl text-center",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-4",children:[i.jsxs("a",{href:"https://www.trustpilot.com/review/pressmegpt.com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-lg font-medium hover:text-primary transition-colors",children:[i.jsx(ys,{className:"h-5 w-5 fill-current text-primary"}),"Rated 4.5 on Trustpilot by freelancers and WordPress agencies"]}
1919),i.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3 w-full sm:w-auto",children:[i.jsx(Y,{size:"lg",className:"text-lg px-8 py-6 shadow-lg shadow-primary/25",onClick:P,children:"See Plans"}),i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-8 py-6 hover:bg-cta-hover hover:text-cta-foreground active:bg-cta-hover active:text-cta-foreground transition-colors",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})]}),i.jsx("p",{className:"text-sm text-primary font-medium w-full",children:"Includes 5 Free Credits / Month"})]}),i.jsxs("p",{className:"text-muted-foreground mt-4 inline-flex items-center gap-2 justify-center",children:[i.jsx(i_,{className:"h-4 w-4 text-primary"}),"Limited Time · 30-day money-back guarantee"]})]})}),i.jsx(wu,{}),i.jsx("section",{className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-3xl",children:[i.jsxs("h2",{className:"text-3xl font-bold text-center mb-10",children:["Frequently Asked ",i.jsx("span",{className:"text-primary",children:"Questions"})]}),i.jsx(Ev,{type:"single",collapsible:!0,className:"w-full",children:R2.map((C,O)=>i.jsxs(Va,{value:`item-${O}`,children:[i.jsx(Ka,{className:"text-left",children:C.q}),i.jsx(Ya,{className:"text-muted-foreground",children:C.a})]},C.q))})]})}),i.jsx(Yo,{quotes:Cc[2],showRatings:!0}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-3xl text-center",children:[i.jsxs("h2",{className:"text-3xl font-bold mb-6",children:["Built it with AI and"," ",i.jsx("span",{className:"text-primary",children:"Never Pay Recurring Fees Once a Site is Live"})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3",children:[i.jsx(Y,{size:"lg",className:"text-lg px-10 py-6 shadow-lg shadow-primary/25",onClick:P,children:"See Plans"}),i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-10 py-6 hover:bg-cta-hover hover:text-cta-foreground active:bg-cta-hover active:text-cta-foreground transition-colors",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})]}),i.jsx("p",{className:"text-sm text-primary font-medium mt-3",children:"Includes 5 Free Credits / Month"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"Limited Time · 30-day money-back guarantee · No subscription"})]})})]}),i.jsx("footer",{className:"border-t border-border/50 py-8 px-4 bg-card/50",children:i.jsxs("div",{className:"container mx-auto text-center text-sm text-muted-foreground",children:[i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/about",className:"hover:text-foreground transition-colors",children:"About"}),i.jsx("a",{href:"/privacy",className:"hover:text-foreground transition-colors",children:"Privacy Policy"}),i.jsx("a",{href:"/terms",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),i.jsx("a",{href:"/sitemap.txt",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Sitemap"}),i.jsx("a",{href:"https://pressmegpt.featurebase.app/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Roadmap"}),i.jsx("a",{href:"https://pressmegpt.endorsely.com/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Affiliate Program"})]}),i.jsxs("div",{className:"flex justify-center gap-6 mb-4 flex-wrap",children:[i.jsx("a",{href:"/themes",className:"hover:text-foreground transition-colors",children:"WordPress Theme Directory"}),i.jsx("a",{href:"https://blog.pressmegpt.com/ai-wordpress-theme-generator/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Theme Generators"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-10-best-wordpress-ai-website-builders-for-rapid-web-design/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"AI Website Builders"}),i.jsx("a",{href:"https://blog.pressmegpt.com/the-top-10-wordpress-theme-builder
1919-software-solutions/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Theme Builder Software"}),i.jsx("a",{href:"https://blog.pressmegpt.com/how-to-customize-a-wordpress-theme-with-ai/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Customize a Theme with AI"})]}),i.jsxs("p",{children:["© ",new Date().getFullYear()," PressMeGPT. All rights reserved."]})]})}),i.jsx(Xt,{open:a,onOpenChange:l,children:i.jsxs(Qt,{className:"max-w-4xl p-0 overflow-hidden border-border/50",children:[i.jsx(wr,{className:"sr-only",children:"PressMeGPT Demo Video"}),i.jsx("div",{className:"aspect-video w-full bg-foreground",children:a&&i.jsx("iframe",{width:"100%",height:"100%",src:"https://www.youtube.com/embed/NjLhSBx1kws?autoplay=1",title:"PressMeGPT Demo Video",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,className:"w-full h-full"})})]})}),i.jsx(Xt,{open:f.open,onOpenChange:C=>{C||v({open:!1,plan:null})},children:i.jsxs(Qt,{className:"sm:max-w-md",children:[i.jsxs(gn,{children:[i.jsx(wr,{children:"Continue to checkout"}),i.jsx(jn,{children:"Enter your email so we can set up your account after purchase."})]}),i.jsxs("div",{className:"space-y-4 py-2",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"guest-email",children:"Email address"}),i.jsx(Nt,{id:"guest-email",type:"email",placeholder:"[email protected]",value:p,onChange:C=>b(C.target.value),disabled:x,onKeyDown:C=>{C.key==="Enter"&&S()}})]}),i.jsx(Y,{className:"w-full bg-cta text-cta-foreground hover:bg-cta-hover",onClick:S,disabled:x||!p.includes("@"),children:x?"Checking...":"Continue to Checkout"})]})]})}),i.jsx(Xt,{open:!!(w!=null&&w.open),onOpenChange:()=>j(null),children:i.jsxs(Qt,{className:"sm:max-w-md",children:[i.jsxs(gn,{children:[i.jsx(wr,{children:"You already have a paid plan"}),i.jsxs(jn,{children:["The email ",i.jsx("span",{className:"font-medium text-foreground",children:w==null?void 0:w.email})," ","already has an active"," ",i.jsx("span",{className:"font-medium text-foreground",children:w==null?void 0:w.currentPlan})," plan."]})]}),i.jsxs("div",{className:"space-y-4 py-2",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:w!=null&&w.isUpgrade?"Sign in to upgrade immediately and pay only the prorated difference.":w!=null&&w.isDowngrade?"Sign in to schedule a downgrade for the end of your current billing period.":"Sign in to manage or change your existing plan."}),i.jsx(Y,{className:"w-full bg-cta text-cta-foreground hover:bg-cta-hover",onClick:()=>{const C=new URLSearchParams;C.set("mode","signin"),C.set("email",(w==null?void 0:w.email)||""),C.set("plan_intent",(w==null?void 0:w.targetPlan)||""),C.set("billing_intent","monthly"),t(`/auth?${C.toString()}`),j(null)},children:"Sign in to change plan"}),i.jsx(Y,{variant:"outline",className:"w-full",onClick:()=>j(null),children:"Cancel"})]})]})})]})}const L3="/assets/credit-pricing-prompt-to-theme-DSg3_pUe.jpg",B3="/assets/credit-pricing-convert-to-wordpress-NW-6weY3.jpg",z3="/assets/credit-pricing-no-recurring-LmxcvPBE.jpg",U3="/assets/credit-pricing-time-saved-C1n8lcNc.jpg",I2=[{id:"micro",label:"Micro",description:"Great for bloggers, creators, and hobbyists",price:99,credits:120,sites:12,icon:St,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 2.5 Only","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)"]},{id:"mini",label:"Mini",description:"For individual freelancers & web developers",price:149,credits:360,sites:36,icon:ua,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)","Multi-Page Convert"],popular:!0},{id:"medium",label:"Medium",description:"For professional developers & designers",price:299,credits:840,sites:84,icon:Og,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)","Multi-Page Convert","Bring Your Own Key (Gemini)","Theme Checker (coming soon)"]},{id:"massive",label:"Massive",description:"For WordPress teams and marketing agencies",price:599,credits:1800,sites:180,icon:gl,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Canva & Figma Integrations (coming soon)","Multi-Page Convert","Bring Your Own Key (Gemini)","Theme Checker (coming soon)","Multi-User (coming soon)"]}],O2=[{q:"Do I need to know how to code?",a:"No — describe what you want or paste a URL to convert, and PressMeGPT generates the theme."},{q:"What if I already have a site built somewhere else?",a:"Paste the URL and PressMeGPT converts it into a 
1919native WordPress theme — works with Lovable, Base44, Claude, Bolt.new, Wix, Squarespace, and similar builders."},{q:"Do credits expire?",a:"No. Buy once, use them on your own timeline."},{q:"What formats can I export to?",a:"Classic WordPress, Gutenberg, and Elementor — included in every pack."},{q:"Is this different from the monthly plan?",a:"Yes — monthly is for continuous, ongoing building. This is a one-time purchase for a project or a batch of projects."}];function Wne(){const t=Zt(),[e,r]=eo();$t();const[n,s]=g.useState(null),[o,a]=g.useState(!1),{track:l}=ro();g.useEffect(()=>{document.title="One-Time WordPress Theme Credits | PressMeGPT";const d=(m,f)=>{let v=document.querySelector(`meta[name="${m}"]`);v||(v=document.createElement("meta"),v.setAttribute("name",m),document.head.appendChild(v)),v.setAttribute("content",f)};d("description","Build or convert AI generated websites to WordPress themes. No code, no subscription. One-time credit packs with Elementor, Gutenberg and Classic export included."),d("robots","noindex, nofollow");const h=document.createElement("script");return h.type="application/ld+json",h.text=JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:O2.map(m=>({"@type":"Question",name:m.q,acceptedAnswer:{"@type":"Answer",text:m.a}}))}),document.head.appendChild(h),()=>{const m=document.querySelector('meta[name="robots"]');m&&m.setAttribute("content","index, follow"),h.remove()}},[]),g.useEffect(()=>{e.get("checkout")==="canceled"&&(Q.error("Checkout was canceled. No charges were made."),e.delete("checkout"),r(e,{replace:!0}))},[e,r]);const c=async d=>{var m;const h=I2.find(f=>f.id===d);s(d);try{l("InitiateCheckout",{content_name:`credit_pack_${d}`,value:h.price,currency:"USD"});const{data:f}=await re.auth.getSession(),v=!((m=f==null?void 0:f.session)!=null&&m.access_token),{data:p,error:b}=await re.functions.invoke("create-credit-pack-checkout",{body:{pack:d,guest:v}});if(b||p!=null&&p.error)throw new Error((p==null?void 0:p.error)||(b==null?void 0:b.message)||"Checkout failed");if(!(p!=null&&p.url))throw new Error("Checkout session could not be created");Ls(p.url)}catch(f){const v=f instanceof Error?f.message:"Failed to start checkout";Q.error(`Failed to start checkout: ${v}`),console.error("Credit pack checkout error:",f)}finally{s(null)}},u=()=>{var d;(d=document.getElementById("pricing"))==null||d.scrollIntoView({behavior:"smooth"})};return i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{}),i.jsxs("main",{children:[i.jsxs("section",{className:"py-20 md:py-28 px-4 relative overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/10 via-accent/5 to-primary/5"}),i.jsxs("div",{className:"container mx-auto max-w-4xl relative text-center",children:[i.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-5 tracking-tight",children:["Build or Convert AI Generated Websites to WordPress Themes."," ",i.jsx("span",{className:"text-primary",children:"No Code, No Subscription!"})]}),i.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-6 max-w-3xl mx-auto",children:"Describe your site in words, or convert one you already built with AI — either way, get a WordPress theme that looks like the design. Pay once. No monthly plan required."}),i.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-primary/30 bg-primary/10 px-5 py-2.5 mb-4 text-base md:text-lg font-semibold text-primary",children:[i.jsx(MP,{className:"h-5 w-5"}),"Export to Elementor, Gutenberg & Classic Themes"]}),i.jsxs("div",{className:"mt-4 flex flex-col sm:flex-row items-center justify-center gap-3",children:[i.jsxs(Xt,{open:o,onOpenChange:a,children:[i.jsx(d1,{asChild:!0,children:i.jsxs(Y,{size:"lg",className:"text-lg px-8 py-6 shadow-lg shadow-primary/25",children:[i.jsx(Vc,{className:"h-5 w-5 mr-2"}),"See it in Action"]})}),i.jsx(Qt,{className:"max-w-4xl p-0 border-none bg-black overflow-hidden",children:i.jsx("div",{className:"aspect-video w-full",children:i.jsx("iframe",{className:"w-full h-full",src:"https://www.youtube.com/embed/HBH-vnUozxU?start=5",title:"See PressMeGPT in Action",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})]}),i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-8 py-6",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})]}
1919),i.jsx("p",{className:"text-sm text-primary font-medium mt-3",children:"Includes 5 Free Credits / Month"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"Limited Time · 30-day money-back guarantee"})]})]}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-5xl grid md:grid-cols-2 gap-10 items-center",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-3xl font-bold mb-4",children:["Design WordPress Themes. No Code."," ",i.jsx("span",{className:"text-primary",children:"Just Words."})]}),i.jsx("p",{className:"text-muted-foreground leading-relaxed mb-4",children:"Tell PressMeGPT what you want — the industry, the mood, the colors — and it generates a complete, production-ready WordPress theme. Pick from the designs it creates, fine-tune with more prompts, and export."}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"No page builder tutorials. No hiring a developer to translate your idea into a working theme. Just describe it, and it's built."})]}),i.jsx("img",{src:L3,alt:"A written prompt turning into a finished WordPress theme homepage",loading:"lazy",width:1280,height:800,className:"w-full h-auto rounded-xl border border-border/50"})]})}),i.jsx("section",{className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-5xl grid md:grid-cols-2 gap-10 items-center",children:[i.jsx("img",{src:B3,alt:"An existing AI-built website converted side by side into a WordPress theme",loading:"lazy",width:1280,height:800,className:"w-full h-auto rounded-xl border border-border/50 md:order-first"}),i.jsxs("div",{children:[i.jsxs("h2",{className:"text-3xl font-bold mb-4",children:["Already Built a Site in Lovable, Base44, Claude, or Bolt.new?"," ",i.jsx("span",{className:"text-primary",children:"Convert It to WordPress."})]}),i.jsx("p",{className:"text-muted-foreground leading-relaxed mb-4",children:"Paste the URL. PressMeGPT replicates the layout, structure, and visual style as a clean, native WordPress theme — no rebuilding from scratch, no losing the design you already approved."}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Whichever fits how you (or your client) already work in WordPress."})]})]})}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-5xl grid md:grid-cols-2 gap-10 items-center",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-3xl font-bold mb-6",children:["Translate Text Prompts Into"," ",i.jsx("span",{className:"text-primary",children:"Custom Functional WordPress Themes in Minutes"})]}),i.jsx("blockquote",{className:"border-l-4 border-primary pl-5 italic text-foreground mb-6",children:"“No more searching hours for the template… enjoy the time saved doing something else.”"}),i.jsx("blockquote",{className:"border-l-4 border-primary pl-5 italic text-foreground mb-4",children:"“The AI saves me days of work. It can build pages within minutes and that is so great.”"}),i.jsx("p",{className:"text-sm text-muted-foreground pl-5",children:"— Web Developer"})]}),i.jsx("img",{src:U3,alt:"A stopwatch beside a WordPress theme layout showing fast theme generation",loading:"lazy",width:1280,height:800,className:"w-full h-auto rounded-xl border border-border/50"})]})}),i.jsx("section",{className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-5xl grid md:grid-cols-2 gap-10 items-center",children:[i.jsx("img",{src:z3,alt:"A completed website with no recurring subscription charges",loading:"lazy",width:1280,height:800,className:"w-full h-auto rounded-xl border border-border/50 md:order-first"}),i.jsxs("div",{children:[i.jsxs("h2",{className:"text-3xl font-bold mb-4",children:["Your Site Is Done."," ",i.jsx("span",{className:"text-primary",children:"Why Are You Still Being Charged For It?"})]}),i.jsx("p",{className:"text-muted-foreground leading-relaxed mb-4",children:"Most WordPress Builders lock you into a monthly plan whether you're actively building or not. Finish a project, forget to cancel, and you're paying for a tool sitting idle."}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"PressMeGPT credits work differently: buy once, use them whenever your next project comes up. No auto-renewal, no charge showing up three months after you're done."})]})]})}),i.jsx("section",{id:"pricing",className:"py-20 px-4 bg-muted/30 scroll-mt-20",children:i.jsxs("div",{className:"container mx-auto max-w-7xl",children:[i.jsxs("div",{className:"text-center mb-12",children:[i.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-3",children:["One-Time ",i.jsx("span",{className:"text-primary",children:"Credit Packs"})]}),i.jsx("p",{className:"text-muted-foreground",children:"Most freelancers and agencies choose Mini. Credits never expire."}),i.jsx("div",{className:"mt-6 flex flex-col sm:flex-row items-center justify-center gap-3",children:i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-8 py-6",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})}
1919),i.jsx("p",{className:"text-sm text-primary font-medium mt-3",children:"Includes 5 Free Credits / Month"})]}),i.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6 items-stretch",children:I2.map(d=>{const h=d.icon;return i.jsxs(dt,{className:`relative flex flex-col ${d.popular?"border-primary shadow-lg":""}`,children:[d.popular&&i.jsx(rt,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Most Popular"}),i.jsxs(ir,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(h,{className:"h-5 w-5 text-primary"}),i.jsx(Dr,{children:d.label})]}),i.jsx(Gr,{children:d.description})]}),i.jsxs(ct,{className:"flex-1",children:[i.jsxs("div",{className:"mb-6",children:[i.jsxs("div",{className:"flex items-baseline gap-1",children:[i.jsxs("span",{className:"text-4xl font-bold",children:["$",d.price]}),i.jsx("span",{className:"text-muted-foreground",children:"one-time"})]}),i.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[d.credits," credits · never expire"]}),i.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[d.sites,"+ full sites created"]}),i.jsxs("p",{className:"text-xs text-primary mt-1",children:[d.sites*3,"+ themes generated"]})]}),i.jsx("ul",{className:"space-y-3",children:d.features.map((m,f)=>i.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[i.jsx(fr,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),m]},f))})]}),i.jsx(ia,{className:"flex flex-col gap-3",children:i.jsx(Y,{className:`w-full ${d.popular?"bg-cta text-cta-foreground hover:bg-cta-hover":""}`,variant:d.popular?"default":"outline",disabled:n!==null,onClick:()=>c(d.id),children:n===d.id?"Opening checkout...":`Get ${d.label}`})})]},d.id)})})]})}),i.jsx("section",{className:"py-16 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-2xl text-center",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-4",children:[i.jsxs("a",{href:"https://www.trustpilot.com/review/pressmegpt.com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-lg font-medium hover:text-primary transition-colors",children:[i.jsx(ys,{className:"h-5 w-5 fill-current text-primary"}),"Rated 4.5 on Trustpilot by freelancers and WordPress agencies"]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3 w-full sm:w-auto",children:[i.jsx(Y,{size:"lg",className:"text-lg px-8 py-6 shadow-lg shadow-primary/25",onClick:u,children:"Buy Credits"}),i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-8 py-6",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})]}),i.jsx("p",{className:"text-sm text-primary font-medium w-full",children:"Includes 5 Free Credits / Month"})]}),i.jsxs("p",{className:"text-muted-foreground mt-4 inline-flex items-center gap-2 justify-center",children:[i.jsx(i_,{className:"h-4 w-4 text-primary"}),"Limited Time · 30-day money-back guarantee"]})]})}),i.jsx(wu,{}),i.jsx("section",{className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-3xl",children:[i.jsxs("h2",{className:"text-3xl font-bold text-center mb-10",children:["Frequently Asked ",i.jsx("span",{className:"text-primary",children:"Questions"})]}),i.jsx(Ev,{type:"single",collapsible:!0,className:"w-full",children:O2.map((d,h)=>i.jsxs(Va,{value:`item-${h}`,children:[i.jsx(Ka,{className:"text-left",children:d.q}),i.jsx(Ya,{className:"text-muted-foreground",children:d.a})]},d.q))})]})}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-3xl text-center",children:[i.jsxs("h2",{className:"text-3xl font-bold mb-6",children:["Built it with AI and"," ",i.jsx("span",{className:"text-primary",children:"Never Pay Recurring Fees Once a Site is Live"})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3",children:[i.jsx(Y,{size:"lg",className:"text-lg px-10 py-6 shadow-lg shadow-primary/25",onClick:u,children:"Buy Credits"}),i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-10 py-6",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})]}
1919),i.jsx("p",{className:"text-sm text-primary font-medium mt-3",children:"Includes 5 Free Credits / Month"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"Limited Time · 30-day money-back guarantee · No subscription"})]})})]})]})}const Ay=[{id:"launch",label:"Launch Pack",description:"Perfect for your first sites or a single client project",price:29,credits:30,sites:3,icon:St,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Convert Canva & Figma Mockups to WP","Multi-Page Convert"]},{id:"growth",label:"Growth Pack",description:"For individual freelancers & web developers",price:49,credits:70,sites:7,icon:ua,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Convert Canva & Figma Mockups to WP","Multi-Page Convert"],popular:!0},{id:"scale",label:"Scale Pack",description:"For WordPress teams and marketing agencies",price:99,credits:150,sites:15,icon:gl,features:["Create Themes with AI Prompts","Convert HTML to WordPress","Make Themes Private","Gemini AI 3.0 + 2.5","Media Migration with Credits","FREE Elementor, Gutenberg & Classic Exports","Multi-Page Builder","Helper Plugins","Credit-Saver","Theme Preview","Convert Canva & Figma Mockups to WP","Multi-Page Convert"]}],M2=[{q:"Do I need to know how to code?",a:"No — describe what you want or paste a URL to convert, and PressMeGPT generates the theme."},{q:"What if I already have a site built somewhere else?",a:"Paste the URL and PressMeGPT converts it into a native WordPress theme — works with Lovable, Base44, Claude, Bolt.new, Wix, Squarespace, and similar builders."},{q:"Do credits expire?",a:"No. Buy once, use them on your own timeline."},{q:"What formats can I export to?",a:"Classic WordPress, Gutenberg, and Elementor — included in every pack."},{q:"Is this different from the monthly plan?",a:"Yes — monthly is for continuous, ongoing building. This is a one-time purchase for a project or a batch of projects."}];function Hne(){const t=Zt(),[e,r]=eo();$t();const[n,s]=g.useState(null),[o,a]=g.useState(!1),{track:l}=ro();g.useEffect(()=>{document.title="One-Time WordPress Theme Credits | PressMeGPT";const d=(m,f)=>{let v=document.querySelector(`meta[name="${m}"]`);v||(v=document.createElement("meta"),v.setAttribute("name",m),document.head.appendChild(v)),v.setAttribute("content",f)};
1919d("description","Build or convert AI generated websites to WordPress themes. No code, no subscription. One-time credit packs with Elementor, Gutenberg and Classic export included."),d("robots","noindex, nofollow");const h=document.createElement("script");return h.type="application/ld+json",h.text=JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:M2.map(m=>({"@type":"Question",name:m.q,acceptedAnswer:{"@type":"Answer",text:m.a}}))}),document.head.appendChild(h),()=>{const m=document.querySelector('meta[name="robots"]');m&&m.setAttribute("content","index, follow"),h.remove()}},[]),g.useEffect(()=>{e.get("checkout")==="canceled"&&(Q.error("Checkout was canceled. No charges were made."),e.delete("checkout"),r(e,{replace:!0}))},[e,r]);const c=async d=>{var m;const h=Ay.find(f=>f.id===d);s(d);try{l("InitiateCheckout",{content_name:`credit_pack_${d}`,value:h.price,currency:"USD"});const{data:f}=await re.auth.getSession(),v=!((m=f==null?void 0:f.session)!=null&&m.access_token),{data:p,error:b}=await re.functions.invoke("create-credit-pack-checkout",{body:{pack:d,guest:v}});if(b||p!=null&&p.error)throw new Error((p==null?void 0:p.error)||(b==null?void 0:b.message)||"Checkout failed");if(!(p!=null&&p.url))throw new Error("Checkout session could not be created");Ls(p.url)}catch(f){const v=f instanceof Error?f.message:"Failed to start checkout";Q.error(`Failed to start checkout: ${v}`),console.error("Credit pack checkout error:",f)}finally{s(null)}},u=()=>{var d;(d=document.getElementById("pricing"))==null||d.scrollIntoView({behavior:"smooth"})};return i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{}),i.jsxs("main",{children:[i.jsxs("section",{className:"py-20 md:py-28 px-4 relative overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/10 via-accent/5 to-primary/5"}),i.jsxs("div",{className:"container mx-auto max-w-4xl relative text-center",children:[i.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-5 tracking-tight",children:["Build or Convert AI Generated Websites to WordPress Themes."," ",i.jsx("span",{className:"text-primary",children:"No Code, No Subscription!"})]}),i.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-6 max-w-3xl mx-auto",children:"Describe your site in words, or convert one you already built with AI — either way, get a WordPress theme that looks like the design. Pay once. No monthly plan required."}),i.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-primary/30 bg-primary/10 px-5 py-2.5 mb-4 text-base md:text-lg font-semibold text-primary",children:[i.jsx(MP,{className:"h-5 w-5"}),"Export to Elementor, Gutenberg & Classic Themes"]}),i.jsxs("div",{className:"mt-4 flex flex-col sm:flex-row items-center justify-center gap-3",children:[i.jsxs(Xt,{open:o,onOpenChange:a,children:[i.jsx(d1,{asChild:!0,children:i.jsxs(Y,{size:"lg",className:"text-lg px-8 py-6 shadow-lg shadow-primary/25",children:[i.jsx(Vc,{className:"h-5 w-5 mr-2"}),"See it in Action"]})}),i.jsx(Qt,{className:"max-w-4xl p-0 border-none bg-black overflow-hidden",children:i.jsx("div",{className:"aspect-video w-full",children:i.jsx("iframe",{className:"w-full h-full",src:"https://www.youtube.com/embed/HBH-vnUozxU?start=5",title:"See PressMeGPT in Action",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})]}),i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-8 py-6 hover:bg-cta-hover hover:text-cta-foreground active:bg-cta-hover active:text-cta-foreground transition-colors",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})]}),i.jsx("p",{className:"text-sm text-primary font-medium mt-3",children:"Includes 5 Free Credits / Month"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"Limited Time · 30-day money-back guarantee"})]})]}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-5xl grid md:grid-cols-2 gap-10 items-center",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-3xl font-bold mb-4",children:["Design WordPress Themes. No Code."," ",i.jsx("span",{className:"text-primary",children:"Just Words."})]}),i.jsx("p",{className:"text-muted-foreground leading-relaxed mb-4",children:"Tell PressMeGPT what you want — the industry, the mood, the colors — and it generates a complete, production-ready WordPress theme. Pick from the designs it creates, fine-tune with more prompts, and export."}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"No page builder tutorials. No hiring a developer to translate your idea into a working theme. Just describe it, and it's built."})]}),i.jsx("img",{src:L3,alt:"A written prompt turning into a finished WordPress theme homepage",loading:"lazy",width:1280,height:800,className:"w-full h-auto rounded-xl border border-border/50"})]})}),i.jsx("section",{className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-5xl grid md:grid-cols-2 gap-10 items-center",children:[i.jsx("img",{src:B3,alt:"An existing AI-built website converted side by side into a WordPress theme",loading:"lazy",width:1280,height:800,className:"w-full h-auto rounded-xl border border-border/50 md:order-first"}),i.jsxs("div",{children:[i.jsxs("h2",{className:"text-3xl font-bold mb-4",children:["Already Built a Site in Lovable, Base44, Claude, or Bolt.new?"," ",i.jsx("span",{className:"text-primary",children:"Convert It to WordPress."})]}),i.jsx("p",{className:"text-muted-foreground leading-relaxed mb-4",children:"Paste the URL. PressMeGPT replicates the layout, structure, and visual style as a clean, native WordPress theme — no rebuilding from scratch, no losing the design you already approved."}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Whichever fits how you (or your client) already work in WordPress."})]})]})}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-5xl grid md:grid-cols-2 gap-10 items-center",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-3xl font-bold mb-6",children:["Translate Text Prompts Into"," ",i.jsx("span",{className:"text-primary",children:"Custom Functional WordPress Themes in Minutes"})]}),i.jsx("blockquote",{className:"border-l-4 border-primary pl-5 italic text-foreground mb-6",children:"“No more searching hours for the template… enjoy the time saved doing something else.”"}),i.jsx("blockquote",{className:"border-l-4 border-primary pl-5 italic text-foreground mb-4",children:"“The AI saves me days of work. It can build pages within minutes and that is so great.”"}),i.jsx("p",{className:"text-sm text-muted-foreground pl-5",children:"— Web Developer"})]}),i.jsx("img",{src:U3,alt:"A stopwatch beside a WordPress theme layout showing fast theme generation",loading:"lazy",width:1280,height:800,className:"w-full h-auto rounded-xl border border-border/50"})]})}),i.jsx("section",{className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-5xl grid md:grid-cols-2 gap-10 items-center",children:[i.jsx("img",{src:z3,alt:"A completed website with no recurring subscription charges",loading:"lazy",width:1280,height:800,className:"w-full h-auto rounded-xl border border-border/50 md:order-first"}),i.jsxs("div",{children:[i.jsxs("h2",{className:"text-3xl font-bold mb-4",children:["Your Site Is Done."," ",i.jsx("span",{className:"text-primary",children:"Why Are You Still Being Charged For It?"})]}),i.jsx("p",{className:"text-muted-foreground leading-relaxed mb-4",children:"Most WordPress Builders lock you into a monthly plan whether you're actively building or not. Finish a project, forget to cancel, and you're paying for a tool sitting idle."}),i.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"PressMeGPT credits work differently: buy once, use them whenever your next project comes up. No auto-renewal, no charge showing up three months after you're done."})]})]})}),i.jsx("section",{id:"pricing",className:"py-20 px-4 bg-muted/30 scroll-mt-20",children:i.jsxs("div",{className:"container mx-auto max-w-7xl",children:[i.jsxs("div",{className:"text-center mb-12",children:[i.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-3",children:["One-Time ",i.jsx("span",{className:"text-primary",children:"Credit Packs"})]}),i.jsx("p",{className:"text-muted-foreground",children:"Most freelancers and web developers choose Growth. Credits never expire."}),i.jsx("div",{className:"mt-6 flex flex-col sm:flex-row items-center justify-center gap-3",children:i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-8 py-6 hover:bg-cta-hover hover:text-cta-foreground active:bg-cta-hover active:text-cta-foreground transition-colors",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})}
1919),i.jsx("p",{className:"text-sm text-primary font-medium mt-3",children:"Includes 5 Free Credits / Month"})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 items-stretch justify-center",children:Ay.map(d=>{const h=d.icon;return i.jsxs(dt,{className:`relative flex flex-col ${d.popular?"border-primary shadow-lg":""}`,children:[d.popular&&i.jsx(rt,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Most Popular"}),i.jsxs(ir,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(h,{className:"h-5 w-5 text-primary"}),i.jsx(Dr,{children:d.label})]}),i.jsx(Gr,{children:d.description})]}),i.jsx(ct,{className:"flex-1",children:i.jsxs("div",{className:"mb-6",children:[i.jsxs("div",{className:"flex items-baseline gap-1",children:[i.jsxs("span",{className:"text-4xl font-bold",children:["$",d.price]}),i.jsx("span",{className:"text-muted-foreground",children:"one-time"})]}),i.jsxs("div",{className:"mt-3 space-y-1",children:[i.jsxs("p",{className:"text-sm font-semibold text-primary",children:["Generate ",d.sites*3," themes or more"]}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Build ",d.sites,"+ full sites with multiple pages"]}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[d.credits," credits included"]})]})]})}),i.jsx(ia,{className:"flex flex-col gap-3",children:i.jsx(Y,{className:`w-full ${d.popular?"bg-cta text-cta-foreground hover:bg-cta-hover":""}`,variant:d.popular?"default":"outline",disabled:n!==null,onClick:()=>c(d.id),children:n===d.id?"Opening checkout...":`Get ${d.label}`})})]},d.id)})}),i.jsxs("div",{className:"mt-16",children:[i.jsxs("h3",{className:"text-2xl font-bold text-center mb-8",children:["All Credit Packs ",i.jsx("span",{className:"text-primary",children:"Include"})]}),i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-4 max-w-5xl mx-auto",children:Ay[0].features.map((d,h)=>i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(fr,{className:"h-5 w-5 text-primary shrink-0 mt-0.5"}),i.jsx("span",{className:"text-foreground",children:d})]},h))})]})]})}),i.jsx("section",{className:"py-16 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-2xl text-center",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-4",children:[i.jsxs("a",{href:"https://www.trustpilot.com/review/pressmegpt.com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-lg font-medium hover:text-primary transition-colors",children:[i.jsx(ys,{className:"h-5 w-5 fill-current text-primary"}),"Rated 4.5 on Trustpilot by freelancers and WordPress agencies"]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3 w-full sm:w-auto",children:[i.jsx(Y,{size:"lg",className:"text-lg px-8 py-6 shadow-lg shadow-primary/25",onClick:u,children:"Buy Credits"}),i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-8 py-6 hover:bg-cta-hover hover:text-cta-foreground active:bg-cta-hover active:text-cta-foreground transition-colors",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})]}),i.jsx("p",{className:"text-sm text-primary font-medium w-full",children:"Includes 5 Free Credits / Month"})]}),i.jsxs("p",{className:"text-muted-foreground mt-4 inline-flex items-center gap-2 justify-center",children:[i.jsx(i_,{className:"h-4 w-4 text-primary"}),"Limited Time · 30-day money-back guarantee"]})]})}),i.jsx(wu,{}),i.jsx("section",{className:"py-20 px-4 bg-muted/30",children:i.jsxs("div",{className:"container mx-auto max-w-3xl",children:[i.jsxs("h2",{className:"text-3xl font-bold text-center mb-10",children:["Frequently Asked ",i.jsx("span",{className:"text-primary",children:"Questions"})]}),i.jsx(Ev,{type:"single",collapsible:!0,className:"w-full",children:M2.map((d,h)=>i.jsxs(Va,{value:`item-${h}`,children:[i.jsx(Ka,{className:"text-left",children:d.q}),i.jsx(Ya,{className:"text-muted-foreground",children:d.a})]},d.q))})]})}),i.jsx("section",{className:"py-20 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-3xl text-center",children:[i.jsxs("h2",{className:"text-3xl font-bold mb-6",children:["Built it with AI and"," ",i.jsx("span",{className:"text-primary",children:"Never Pay Recurring Fees Once a Site is Live"})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3",children:[i.jsx(Y,{size:"lg",className:"text-lg px-10 py-6 shadow-lg shadow-primary/25",onClick:u,children:"Buy Credits"}),i.jsx(Y,{size:"lg",variant:"secondary",className:"text-lg px-10 py-6 hover:bg-cta-hover hover:text-cta-foreground active:bg-cta-hover active:text-cta-foreground transition-colors",onClick:()=>t("/auth?mode=signup"),children:"Start Free Trial"})]}
1919),i.jsx("p",{className:"text-sm text-primary font-medium mt-3",children:"Includes 5 Free Credits / Month"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"Limited Time · 30-day money-back guarantee · No subscription"})]})})]})]})}const Gne=new Set(["pro","agency"]);function qne(){const{user:t}=$t(),{plan:e,source:r,loading:n,trialStatus:s}=nn(),o=Zt(),[a,l]=g.useState(null),[c,u]=g.useState(!0),[d,h]=g.useState(!1),[m,f]=g.useState(""),[v,p]=g.useState(!1),[b,x]=g.useState(null),y=s==="active"||Gne.has(e||"")&&r!=="credit_pack",w="user_id, provider, status, enabled, key_hint, lifetime_requests, consecutive_failures, last_used_at, last_validated_at";g.useEffect(()=>{t&&(async()=>{const{data:S}=await re.from("user_ai_keys").select(w).eq("user_id",t.id).eq("provider","gemini").maybeSingle();l(S),u(!1)})()},[t]);const j=async(S=!1)=>{var N,P;if(!m.trim()){Q.error("Please enter a Gemini API key.");return}h(!0),x(null);try{const{data:C,error:O}=await re.functions.invoke("save-gemini-key",{body:{apiKey:m.trim(),force:S}});if(O){let T="Failed to validate key",A=!1;try{const k=await((P=(N=O.context)==null?void 0:N.json)==null?void 0:P.call(N));k!=null&&k.error&&(T=k.error),k!=null&&k.canForce&&(A=!0)}catch{}throw x({msg:T,canForce:A}),new Error(T)}if(!(C!=null&&C.ok))throw new Error((C==null?void 0:C.error)||"Failed to validate key");Q.success(S?"Gemini key saved (validation skipped).":"Gemini key saved and validated."),f("");const{data:F}=await re.from("user_ai_keys").select(w).eq("user_id",t.id).eq("provider","gemini").maybeSingle();l(F)}catch(C){Q.error(C instanceof Error?C.message:"Failed to save key")}finally{h(!1)}},_=async()=>{if(!a||!confirm("Remove your Gemini API key? Future generations will use platform credits."))return;const{error:S}=await re.from("user_ai_keys").delete().eq("user_id",t.id).eq("provider","gemini");S?Q.error(S.message):(l(null),Q.success("Key removed."))};return n||c?i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{}),i.jsx("div",{className:"container max-w-2xl mx-auto py-16 flex justify-center",children:i.jsx(et,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]}):i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx(zr,{}),i.jsxs("div",{className:"container max-w-2xl mx-auto px-4 py-10 space-y-6",children:[i.jsxs("div",{children:[i.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-2",children:[i.jsx(n_,{className:"h-7 w-7 text-primary"}),"Bring Your Own Gemini Key",s==="active"&&i.jsx(Tv,{})]}),i.jsx("p",{className:"text-muted-foreground mt-2",children:"Use your own Google Gemini API key for theme, section, and page generations. Platform features like website scraping and exports still use PressMeGPT credits."})]}),!y&&i.jsx(dt,{className:"border-primary/40 bg-primary/5",children:i.jsxs(ct,{className:"pt-6 flex items-start gap-3",children:[i.jsx(li,{className:"h-5 w-5 text-primary shrink-0 mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"font-medium",children:"Available on Pro & Agency plans"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Upgrade to bring your own Gemini key and generate without spending platform credits on AI."}),i.jsx(Y,{className:"mt-3",size:"sm",onClick:()=>p(!0),children:"See upgrade options"})]})]})}),i.jsxs(dt,{children:[i.jsxs(ir,{children:[i.jsxs(Dr,{className:"flex items-center gap-2",children:["Gemini API Key",(a==null?void 0:a.status)==="active"&&i.jsxs(rt,{className:"bg-emerald-500/15 text-emerald-600 border-emerald-500/30",variant:"outline",children:[i.jsx(vp,{className:"h-3 w-3 mr-1"})," Active"]}),(a==null?void 0:a.status)==="invalid"&&i.jsxs(rt,{variant:"destructive",children:[i.jsx(li,{className:"h-3 w-3 mr-1"})," Invalid"]})]}),i.jsxs(Gr,{children:["Get one at"," ",i.jsxs("a",{href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer",className:"text-primary hover:underline inline-flex items-center gap-1",children:["aistudio.google.com ",i.jsx(Bi,{className:"h-3 w-3"})]}),". Keys are encrypted at rest."]})]}),i.jsxs(ct,{className:"space-y-4",children:[a&&i.jsxs("div",{className:"rounded-md border border-border p-3 text-sm space-y-1",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Key"}),i.jsxs("span",{className:"font-mono",children:["•••• ",a.key_hint]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Lifetime requests"}),i.jsx("span",{className:"tabular-nums",children:a.lifetime_requests??
19190})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Consecutive failures"}),i.jsx("span",{className:"tabular-nums",children:a.consecutive_failures??0})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Nt,{type:"password",placeholder:"Paste your Gemini API key",value:m,onChange:S=>f(S.target.value),disabled:!y||d}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(Y,{onClick:()=>j(!1),disabled:!y||d||!m.trim(),children:[d?i.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}):null,a?"Replace Key":"Save Key"]}),a&&i.jsx(Y,{variant:"outline",onClick:_,disabled:d,children:"Remove"})]}),b&&i.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3 text-sm space-y-2",children:[i.jsx("p",{className:"text-destructive font-medium",children:"Validation failed"}),i.jsx("p",{className:"text-muted-foreground break-all",children:b.msg}),b.canForce&&m.trim()&&i.jsx("button",{type:"button",onClick:()=>j(!0),className:"text-xs text-primary hover:underline",disabled:d,children:"Save anyway without testing →"})]})]}),i.jsxs("div",{className:"text-xs text-muted-foreground border-t border-border pt-3 space-y-1",children:[i.jsx("p",{children:"• BYOK covers: main theme generation, section customization, and page generation."}),i.jsx("p",{children:"• PressMeGPT credits still handle: website scraping, exports, and image processing."}),i.jsx("p",{children:"• If your key fails 3× in a row it's auto-disabled and platform credits take over."})]})]})]}),i.jsx("button",{onClick:()=>o(-1),className:"text-sm text-muted-foreground hover:text-foreground",children:"← Back"})]}),i.jsx(bl,{open:v,onOpenChange:p,reason:"byok"})]})}const Vne={project:"Creator",starter:"Freelance",pro:"Pro"};function Kne(){const[t]=eo(),e=Zt(),{user:r,session:n}=$t(),{refreshSubscription:s}=nn(),o=t.get("code"),[a,l]=g.useState(null),[c,u]=g.useState(!0),[d,h]=g.useState(null),[m,f]=g.useState(!1),[v,p]=g.useState(!1),[b,x]=g.useState(""),[y,w]=g.useState(""),[j,_]=g.useState(""),[S,N]=g.useState(!1);g.useEffect(()=>{let T=!1;return(async()=>{const A=pA(),k=l7(o);if(r&&k&&!A){p(!0),u(!1);return}if(!o&&!A){h("This page needs to be opened from your AppSumo purchase link."),u(!1);return}const{data:$,error:K}=await re.functions.invoke("appsumo-oauth",{body:A?{licenseKey:A}:{code:o,redirectUri:`${window.location.origin}/appsumo`}});if(!T){if(K||$!=null&&$.error)if(K){const{message:H}=await On(K,"We could not verify your AppSumo purchase. Please try again.");T||h(H)}else h(($==null?void 0:$.error)||"We could not verify your AppSumo purchase. Please try again.");else{const H=$;H!=null&&H.licenseKey&&(o7(H.licenseKey),a7(o)),l(H)}u(!1)}})(),()=>{T=!0}},[o,r]);const P=g.useCallback(async T=>{if(!a)return;const{data:A,error:k}=await re.functions.invoke("appsumo-activate",{body:{licenseKey:a.licenseKey,...T??{}}});if(k||A!=null&&A.error){if(k){const{message:$,body:K}=await On(k,"We could not activate your license."),H=new Error($);throw H.emailInUse=K.emailInUse===!0,H}throw new Error((A==null?void 0:A.error)||"We could not activate your license.")}await s(),nw(),p(!0)},[a,s]),C=async()=>{f(!0);try{await P(),Q.success("Your AppSumo plan is active.")}catch(T){Q.error(T instanceof Error?T.message:"Activation failed.")}finally{f(!1)}},O=async T=>{if(T.preventDefault(),y.length<8){Q.error("Please choose a password with at least 8 characters.");return}if(y!==j){Q.error("Those passwords don't match. Please re-enter them.");return}f(!0);try{await P({email:b.trim(),password:y});const{error:A}=await re.auth.signInWithPassword({email:b.trim(),password:y});A?Q.success("Your AppSumo plan is active. Please sign in to continue."):(await s(),Q.success("Your AppSumo plan is active."))}catch(A){if(A!=null&&A.emailInUse){N(!0),Q.error("You already have an account — sign in and we'll attach your deal.");return}Q.error(A instanceof Error?A.message:"We could not create your account.")}finally{f(!1)}},F=a?Vne[a.plan]??a.plan:"";return i.jsx("main",{className:"min-h-screen flex items-center justify-center bg-background px-4 py-12",children:i.jsx(dt,{className:"w-full max-w-md",children:c?i.jsxs(ct,{className:"flex flex-col items-center gap-3 py-16",children:[i.jsx(et,{className:"h-8 w-8 animate-spin text-primary"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Verifying your AppSumo purchase…"})]}):d?i.jsxs(ct,{className:"flex flex-col items-center gap-3 py-16 text-center",children:[i.jsx(t_,{className:"h-8 w-8 text-destructive"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:d}),i.jsx(Y,{variant:"outline",onClick:()=>window.location.reload(),children:"Try again"})]}):v?i.jsxs(ct,{className:"flex flex-col items-center gap-3 py-16 text-center",children:[i.jsx(vp,{className:"h-8 w-8 text-primary"}),i.jsxs("h1",{className:"text-xl font-semibold",children:["You're on the ",F," plan"]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Lifetime access is attached to your account, with credits arriving every month."}),i.jsx(Y,{onClick:()=>
1919e("/dashboard"),children:"Go to dashboard"})]}):i.jsxs(i.Fragment,{children:[i.jsxs(ir,{children:[i.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-md border border-primary/30 bg-primary/10 p-3",children:[i.jsx(li,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),i.jsxs("p",{className:"text-sm text-foreground",children:[i.jsx("span",{className:"font-semibold",children:"Final step."})," Complete this form to activate your AppSumo deal and get access to your account."]})]}),i.jsx(Dr,{className:"text-2xl",children:"Redeem your AppSumo deal"}),i.jsxs(Gr,{children:["Your purchase unlocks the ",i.jsx("span",{className:"font-semibold text-foreground",children:F})," ","plan for life."]})]}),i.jsx(ct,{children:r?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Attach this license to ",i.jsx("span",{className:"font-medium text-foreground",children:r.email}),"."]}),i.jsxs(Y,{className:"w-full",onClick:C,disabled:m||!n,children:[m&&i.jsx(et,{className:"mr-2 h-4 w-4 animate-spin"}),"Activate ",F," on this account"]})]}):S?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-sm text-muted-foreground",children:["You already have a PressMeGPT account for"," ",i.jsx("span",{className:"font-medium text-foreground",children:b.trim()}),". Sign in and we'll attach your AppSumo deal automatically."]}),i.jsx(Y,{className:"w-full",onClick:()=>e(`/auth?mode=signin&redirect=${encodeURIComponent(window.location.pathname+window.location.search)}`),children:"Sign in to attach my deal"}),i.jsx(Y,{variant:"ghost",className:"w-full",onClick:()=>N(!1),children:"Use a different email"})]}):i.jsxs("form",{className:"space-y-4",onSubmit:O,children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"appsumo-email",children:"Email"}),i.jsx(Nt,{id:"appsumo-email",type:"email",required:!0,autoComplete:"email",value:b,onChange:T=>x(T.target.value),placeholder:"[email protected]"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"appsumo-password",children:"Create a password"}),i.jsx(Nt,{id:"appsumo-password",type:"password",required:!0,autoComplete:"new-password",value:y,onChange:T=>w(T.target.value),placeholder:"At least 8 characters"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{htmlFor:"appsumo-password-confirm",children:"Confirm password"}),i.jsx(Nt,{id:"appsumo-password-confirm",type:"password",required:!0,autoComplete:"new-password",value:j,onChange:T=>_(T.target.value),placeholder:"Re-enter your password"}),j.length>0&&j!==y&&i.jsx("p",{className:"text-xs text-destructive",children:"Passwords don't match."})]}),i.jsxs(Y,{type:"submit",className:"w-full",disabled:m||y.length<8||y!==j,children:[m&&i.jsx(et,{className:"mr-2 h-4 w-4 animate-spin"}),"Create account & activate"]}),i.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["Already have an account?"," ",i.jsx("button",{type:"button",className:"text-primary underline-offset-4 hover:underline",onClick:()=>e(`/auth?mode=signin&redirect=${encodeURIComponent(window.location.pathname+window.location.search)}`),children:"Sign in"})," ","to attach this license."]})]})})]})})})}var G1="Progress",q1=100,[Yne,Sse]=_r(G1),[Qne,Jne]=Yne(G1),W3=g.forwardRef((t,e)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:o=Xne,...a}=t;(s||s===0)&&!$2(s)&&console.error(Zne(`${s}`,"Progress"));const l=$2(s)?s:q1;n!==null&&!D2(n,l)&&console.error(ese(`${n}`,"Progress"));const c=D2(n,l)?n:null,u=pg(c)?o(c,l):void 0;return i.jsx(Qne,{scope:r,value:c,max:l,children:i.jsx(Me.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":pg(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":q3(c,l),"data-value":c??void 0,"data-max":l,...a,ref:e})})});W3.displayName=G1;var H3="ProgressIndicator",G3=g.forwardRef((t,e)=>{const{__scopeProgress:r,...n}=t,s=Jne(H3,r);return i.jsx(Me.div,{"data-state":q3(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:e})});G3.displayName=H3;function Xne(t,e){return`${Math.round(t/e*100)}%`}function q3(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function pg(t){return typeof t=="number"}function $2(t){return pg(t)&&!isNaN(t)&&t>0}function D2(t,e){return pg(t)&&!isNaN(t)&&t<=e&&t>=0}function Zne(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${q1}\`.`}function ese(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
1920  - a positive number
1921  - less than the value passed to \`max\` (or ${q1} if no \`max\` prop is set)
1922  - \`null\` or \`undefined\` if the progress is indeterminate.
1923
1924Defaulting to \`null\`.`}var V3=W3,tse=G3;const K3=g.forwardRef(({className:t,value:e,...r},n)=>i.jsx(V3,{ref:n,className:Se("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...r,children:i.jsx(tse,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));K3.displayName=V3.displayName;function rse(){const{user:t}=$t(),[e,r]=g.useState([]),[n,s]=g.useState(!1),[o,a]=g.useState(0),[l,c]=g.useState(0),[u,d]=g.useState([]),[h,m]=g.useState(!1),f=g.useRef(!1),[v,p]=g.useState(!1),[b,x]=g.useState(!1);if(g.useEffect(()=>{let j=!1;return(async()=>
1924{if(!t){p(!0);return}const{data:_}=await re.from("user_roles").select("role").eq("user_id",t.id).in("role",["admin","super_admin"]);j||(x(!!_&&_.length>0),p(!0))})(),()=>{j=!0}},[t]),!t)return i.jsx(Ub,{to:"/auth",replace:!0});if(!v)return i.jsxs(i.Fragment,{children:[i.jsx(zr,{}),i.jsx("div",{className:"min-h-screen bg-background p-8 max-w-3xl mx-auto",children:i.jsx("p",{className:"text-muted-foreground",children:"Checking permissions…"})})]});if(!b)return i.jsx(Ub,{to:"/dashboard",replace:!0});const y=async()=>{const{data:j,error:_}=await re.from("public_themes").select("id, name, master_html, master_css").or("thumbnail_url.is.null,thumbnail_url.like.%placehold.co%,thumbnail_url.eq.").order("created_at",{ascending:!1});if(_){console.error("Failed to load themes:",_);return}r(j||[]),c((j==null?void 0:j.length)||0),m(!0)},w=async()=>{s(!0),f.current=!1,d([]);for(let j=0;j<e.length&&!f.current;j++){const _=e[j];if(a(j+1),!_.master_html){d(S=>[...S,{name:_.name,status:"⚠️ No HTML"}]);continue}try{let S=null;for(let T=0;T<3;T++)try{T>0&&await new Promise(A=>setTimeout(A,1500)),S=await vv(_.master_html,_.master_css||"",{width:1200,height:900});break}catch(A){if(console.warn(`Screenshot attempt ${T+1} failed for ${_.name}:`,A),T===2)throw A}if(!S)throw new Error("Screenshot capture returned no data");const N=`${_.id}-thumb-${Date.now()}.png`,P=`${t.id}/${N}`,{error:C}=await re.storage.from("thumbnails").upload(P,S,{contentType:"image/png",upsert:!0});if(C)throw C;const{data:O}=re.storage.from("thumbnails").getPublicUrl(P),{error:F}=await re.from("public_themes").update({thumbnail_url:O.publicUrl}).eq("id",_.id);if(F)throw F;d(T=>[...T,{name:_.name,status:"✅ Done"}])}catch(S){const N=S instanceof Error?S.message:typeof S=="object"?JSON.stringify(S):String(S);d(P=>[...P,{name:_.name,status:`❌ ${N}`}])}await new Promise(S=>setTimeout(S,300))}s(!1)};return i.jsxs(i.Fragment,{children:[i.jsx(zr,{}),i.jsxs("div",{className:"min-h-screen bg-background p-8 max-w-3xl mx-auto",children:[i.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Regenerate Missing Thumbnails"}),h?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-muted-foreground",children:["Found ",l," themes needing thumbnails."]}),n&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(K3,{value:o/l*100}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Processing ",o," / ",l]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Y,{onClick:w,disabled:n||l===0,children:n?"Processing...":"Regenerate All"}),n&&i.jsx(Y,{variant:"destructive",onClick:()=>{f.current=!0},children:"Stop"})]}),u.length>0&&i.jsx("div",{className:"mt-4 max-h-96 overflow-y-auto border rounded p-3 text-sm space-y-1",children:u.map((j,_)=>i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"truncate mr-2",children:j.name}),i.jsx("span",{className:"whitespace-nowrap",children:j.status})]},_))})]}):i.jsx(Y,{onClick:y,children:"Load Themes With Missing Thumbnails"})]})]})}const nse=()=>{const t=Zi();return g.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:i.jsxs("div",{className:"text-center",children:[i.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),i.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),i.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})};function sse(){const{user:t}=$t(),{trialStatus:e,plan:r,loading:n}=nn(),[s,o]=g.useState(!1);g.useEffect(()=>{if(n||!t||r!=="free"||e!=="expired")return;const l=`pmgpt:trial-expired-seen:${t.id}`;sessionStorage.getItem(l)||o(!0)},[n,r,e,t]);const a=l=>{!l&&t&&sessionStorage.setItem(`pmgpt:trial-expired-seen:${t.id}`,"1"),o(l)};return i.jsx(bl,{open:s,onOpenChange:a,reason:"trial_expired"})}const ise=new pz;function ym({children:t}){const{user:e,loading:r}=$t();return r?i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:i.jsx(et,{className:"h-8 w-8 animate-spin text-primary"})}):e?i.jsxs(i.Fragment,{children:[i.jsx(sse,{}),t]}):i.jsx(Ub,{to:"/auth",replace:!0})}function ose(){return i.jsxs(i.Fragment,{children:[i.jsx(EG,{}),i.jsx(PG,{}),i.jsxs(oU,{children:[i.jsx(Vt,{path:"/",element:i.jsx(NQ,{})}),i.jsx(Vt,{path:"/auth",element:i.jsx(IQ,{})}),i.jsx(Vt,{path:"/pricing",element:i.jsx(yne,{})}),i.jsx(Vt,{path:"/themes",element:i.jsx(vm,{})}),i.jsx(Vt,{path:"/themes/compatibility/:compatibility",element:i.jsx(vm,{})}),i.jsx(Vt,{path:"/themes/type/:type",element:i.jsx(vm,{})}),i.jsx(Vt,{path:"/themes/industry/:industry",element:i.jsx(vm,{})}),i.jsx(Vt,{path:"/themes/:slug",element:i.jsx(Pne,{})}),i.jsx(Vt,{path:"/privacy",element:i.jsx(Tne,{})}),i.jsx(Vt,{path:"/terms",element:i.jsx(Ane,{})}),i.jsx(Vt,{path:"/sitemap",element:i.jsx(Rne,{})}),i.jsx(Vt,{path:"/reset-password",element:i.jsx(T2,{})}),i.jsx(Vt,{path:"/activate",element:i.jsx(T2,{})}),i.jsx(Vt,{path:"/about",element:i.jsx(One,{})}),i.jsx(Vt,{path:"/lifetime-credits",element:i.jsx(Fne,{})}),i.jsx(Vt,{path:"/credit-pricing",element:i.jsx(Une,{})}),i.jsx(Vt,{path:"/credit-pricing-big",element:i.jsx(Wne,{})}),i.jsx(Vt,{path:"/credit-pricing-small",element:i.jsx(Hne,{})}),i.jsx(Vt,{path:"/appsumo",element:i.jsx(Kne,{})}),i.jsx(Vt,{path:"/dashboard",element:i.jsx(ym,{children:i.jsx(aZ,{})})}),i.jsx(Vt,{path:"/project/:id",element:i.jsx(ym,{children:i.jsx(dne,{})})}),i.jsx(Vt,{path:"/account/api-key",element:i.jsx(ym,{children:i.jsx(qne,{})})}),i.jsx(Vt,{path:"/admin/regenerate-thumbnails",element:i.jsx(ym,{children:i.jsx(rse,{})})}),i.jsx(Vt,{path:"*",element:i.jsx(nse,{})})]})]})}const ase=()=>i.jsx(vz,{client:ise,children:i.jsx(e7,{children:i.jsx(u7,{children:i.jsx(CG,{children:i.jsxs(Qh,{children:[i.jsx(P6,{}),i.jsx(a8,{}),i.jsx(mU,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:i.jsx(ose,{})})]})})})})});iP(document.getElementById("root")).render(i.jsx(ase,{}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.